tizen 2.4 release accepted/tizen_2.4_mobile tizen_2.4 accepted/tizen/2.4/mobile/20151029.025404 submit/tizen_2.4/20151028.065511 tizen_2.4_mobile_release
authorjk7744.park <jk7744.park@samsung.com>
Sat, 24 Oct 2015 08:27:55 +0000 (17:27 +0900)
committerjk7744.park <jk7744.park@samsung.com>
Sat, 24 Oct 2015 08:27:55 +0000 (17:27 +0900)
901 files changed:
.dir-locals.el [new file with mode: 0644]
.gitignore
COPYING
Makefile.am
Xext/Makefile.am
Xext/dpmsproc.h
Xext/geext.c
Xext/hashtable.c
Xext/hashtable.h
Xext/panoramiX.c
Xext/panoramiXprocs.c
Xext/panoramiXsrv.h
Xext/saver.c
Xext/security.c
Xext/shape.c
Xext/shm.c
Xext/shmint.h
Xext/sleepuntil.c
Xext/sleepuntil.h
Xext/smack_util.c [new file with mode: 0644]
Xext/smack_util.h [new file with mode: 0644]
Xext/sync.c
Xext/syncsrv.h
Xext/xace.c
Xext/xacestr.h
Xext/xf86bigfont.c
Xext/xres.c
Xext/xselinux_ext.c
Xext/xselinux_hooks.c
Xext/xtest.c
Xext/xvdisp.c
Xext/xvdix.h
Xext/xvmain.c
Xext/xvmc.c
Xext/xvmcext.h
Xi/Makefile.am
Xi/chgdctl.c
Xi/devbell.c
Xi/exevents.c
Xi/extinit.c
Xi/grabdev.c
Xi/gtmotion.c
Xi/listdev.c
Xi/setdval.c
Xi/setmode.c
Xi/ungrdevb.c
Xi/ungrdevk.c
Xi/xiallowev.c
Xi/xibarriers.c [new file with mode: 0644]
Xi/xibarriers.h [new file with mode: 0644]
Xi/xichangecursor.c
Xi/xichangehierarchy.c
Xi/xigrabdev.c
Xi/xipassivegrab.c
Xi/xiproperty.c [changed mode: 0644->0755]
Xi/xiquerydevice.c
Xi/xiquerypointer.c
Xi/xiqueryversion.c
Xi/xiselectev.c
autogen.sh
composite/Makefile.am
composite/compalloc.c
composite/compext.c
composite/compinit.c
composite/compint.h [changed mode: 0644->0755]
composite/compositeext.h [changed mode: 0644->0755]
composite/compoverlay.c
composite/compwindow.c
config/10-quirks.conf [new file with mode: 0644]
config/Makefile.am
config/config-backends.h
config/config.c
config/dbus-core.c
config/dbus.c [deleted file]
config/hal.c
config/udev.c [changed mode: 0644->0755]
config/xorg-server.conf [deleted file]
configure.ac [changed mode: 0755->0644]
container/Makefile.am [new file with mode: 0644]
container/container.c [new file with mode: 0755]
container/container.h [new file with mode: 0755]
damageext/damageext.c
damageext/damageextint.h
dbe/Makefile.am
dbe/dbe.c
dbe/dbestruct.h
dbe/midbe.c
dbe/midbestr.h [deleted file]
dix/Makefile.am
dix/colormap.c
dix/cursor.c
dix/devices.c [changed mode: 0644->0755]
dix/dispatch.c [changed mode: 0644->0755]
dix/dixfonts.c
dix/dixutils.c
dix/enterleave.c
dix/eventconvert.c
dix/events.c
dix/extension.c
dix/gc.c
dix/getevents.c
dix/globals.c
dix/glyphcurs.c
dix/grabs.c
dix/inpututils.c
dix/main.c
dix/pixmap.c
dix/privates.c
dix/property.c [changed mode: 0644->0755]
dix/protocol.txt
dix/ptrveloc.c
dix/region.c
dix/registry.c
dix/resource.c
dix/stubmain.c [new file with mode: 0644]
dix/touch.c
dix/window.c [changed mode: 0644->0755]
doc/c-extensions
dri3/Makefile.am [new file with mode: 0644]
dri3/dri3.c [new file with mode: 0644]
dri3/dri3.h [new file with mode: 0644]
dri3/dri3_event.c [new file with mode: 0644]
dri3/dri3_priv.h [new file with mode: 0644]
dri3/dri3_request.c [new file with mode: 0644]
dri3/dri3_screen.c [new file with mode: 0644]
dri3/dri3int.h [moved from mi/mibstore.c with 66% similarity]
exa/Makefile.am
exa/exa.c
exa/exa.h
exa/exa_accel.c
exa/exa_classic.c
exa/exa_driver.c
exa/exa_glyphs.c
exa/exa_migration_classic.c
exa/exa_migration_mixed.c
exa/exa_mixed.c
exa/exa_offscreen.c
exa/exa_priv.h
exa/exa_render.c
exa/exa_unaccel.c
fb/Makefile.am
fb/fb.h
fb/fb24_32.c
fb/fb24_32.h
fb/fbblt.c
fb/fbbltone.c
fb/fbcopy.c
fb/fbgc.c
fb/fbglyph.c
fb/fboverlay.c
fb/fboverlay.h
fb/fbpict.c
fb/fbpict.h
fb/fbpixmap.c
fb/fbscreen.c
fb/wfbrename.h
gesture/gesture.c
glamor/Makefile.am [new file with mode: 0644]
glamor/glamor.c [new file with mode: 0644]
glamor/glamor.h [new file with mode: 0644]
glamor/glamor_addtraps.c [new file with mode: 0644]
glamor/glamor_compositerects.c [new file with mode: 0644]
glamor/glamor_context.h [new file with mode: 0644]
glamor/glamor_copyarea.c [new file with mode: 0644]
glamor/glamor_copyplane.c [new file with mode: 0644]
glamor/glamor_copywindow.c [new file with mode: 0644]
glamor/glamor_core.c [new file with mode: 0644]
glamor/glamor_debug.h [new file with mode: 0644]
glamor/glamor_egl.c [new file with mode: 0644]
glamor/glamor_egl_stubs.c [new file with mode: 0644]
glamor/glamor_eglmodule.c [new file with mode: 0644]
glamor/glamor_fbo.c [new file with mode: 0644]
glamor/glamor_fill.c [new file with mode: 0644]
glamor/glamor_font.c [new file with mode: 0644]
glamor/glamor_font.h [new file with mode: 0644]
glamor/glamor_glx.c [new file with mode: 0644]
glamor/glamor_glyphblt.c [new file with mode: 0644]
glamor/glamor_glyphs.c [new file with mode: 0644]
glamor/glamor_gradient.c [new file with mode: 0644]
glamor/glamor_image.c [new file with mode: 0644]
glamor/glamor_largepixmap.c [new file with mode: 0644]
glamor/glamor_picture.c [new file with mode: 0644]
glamor/glamor_pixmap.c [new file with mode: 0644]
glamor/glamor_points.c [new file with mode: 0644]
glamor/glamor_polylines.c [new file with mode: 0644]
glamor/glamor_priv.h [new file with mode: 0644]
glamor/glamor_program.c [new file with mode: 0644]
glamor/glamor_program.h [new file with mode: 0644]
glamor/glamor_rects.c [new file with mode: 0644]
glamor/glamor_render.c [new file with mode: 0644]
glamor/glamor_segment.c [new file with mode: 0644]
glamor/glamor_spans.c [new file with mode: 0644]
glamor/glamor_text.c [new file with mode: 0644]
glamor/glamor_tile.c [new file with mode: 0644]
glamor/glamor_transfer.c [new file with mode: 0644]
glamor/glamor_transfer.h [new file with mode: 0644]
glamor/glamor_transform.c [new file with mode: 0644]
glamor/glamor_transform.h [new file with mode: 0644]
glamor/glamor_trapezoid.c [new file with mode: 0644]
glamor/glamor_triangles.c [new file with mode: 0644]
glamor/glamor_utils.h [new file with mode: 0644]
glamor/glamor_vbo.c [new file with mode: 0644]
glamor/glamor_window.c [new file with mode: 0644]
glamor/glamor_xv.c [new file with mode: 0644]
glx/Makefile.am
glx/createcontext.c
glx/dispatch.h [deleted file]
glx/extension_string.c
glx/extension_string.h
glx/glapi.c [deleted file]
glx/glapi.h [deleted file]
glx/glapi_gentable.c [deleted file]
glx/glapitable.h [deleted file]
glx/glprocs.h [deleted file]
glx/glthread.c [deleted file]
glx/glthread.h [deleted file]
glx/glxcmds.c
glx/glxcmdsswap.c
glx/glxcontext.h
glx/glxdri.c [deleted file]
glx/glxdri2.c [changed mode: 0755->0644]
glx/glxdricommon.c
glx/glxdriswrast.c
glx/glxext.c
glx/glxext.h
glx/glxscreens.c
glx/glxscreens.h
glx/glxserver.h
glx/indirect_dispatch.c
glx/indirect_dispatch.h
glx/indirect_dispatch_swap.c
glx/indirect_program.c
glx/indirect_reqsize.c
glx/indirect_reqsize.h
glx/indirect_size.h
glx/indirect_size_get.c
glx/indirect_size_get.h
glx/indirect_table.c
glx/indirect_texture_compression.c
glx/indirect_util.c
glx/render2.c
glx/render2swap.c
glx/renderpix.c
glx/renderpixswap.c
glx/single2.c
glx/single2swap.c
glx/singlepix.c
glx/singlepixswap.c
glx/singlesize.c
glx/swap_interval.c
glx/xfont.c
hw/Makefile.am
hw/dmx/Makefile.am
hw/dmx/config/Canvas.c
hw/dmx/config/dmxcompat.c
hw/dmx/config/xdmxconfig.c
hw/dmx/dmx.c
hw/dmx/dmx.h
hw/dmx/dmx_glxvisuals.c
hw/dmx/dmxclient.h
hw/dmx/dmxcursor.c
hw/dmx/dmxextension.c
hw/dmx/dmxfont.c
hw/dmx/dmxgc.c
hw/dmx/dmxgc.h
hw/dmx/dmxgcops.c
hw/dmx/dmxgcops.h
hw/dmx/dmxinit.c
hw/dmx/dmxpict.c
hw/dmx/dmxpict.h
hw/dmx/dmxscrinit.c
hw/dmx/dmxshadow.c [deleted file]
hw/dmx/dmxshadow.h [deleted file]
hw/dmx/dmxstat.c
hw/dmx/dmxsync.c
hw/dmx/dmxwindow.c
hw/dmx/doc/dmx.xml
hw/dmx/examples/xinput.c
hw/dmx/glxProxy/Makefile.am
hw/dmx/glxProxy/glxcmds.c
hw/dmx/glxProxy/glxcmdsswap.c
hw/dmx/glxProxy/glxext.c
hw/dmx/glxProxy/glxscreens.c
hw/dmx/glxProxy/glxserver.h
hw/dmx/glxProxy/glxsingle.c
hw/dmx/glxProxy/glxswap.c
hw/dmx/glxProxy/glxutil.c [deleted file]
hw/dmx/glxProxy/glxutil.h
hw/dmx/glxProxy/glxvendor.c
hw/dmx/glxProxy/renderpixswap.c
hw/dmx/input/dmxbackend.c
hw/dmx/input/dmxbackend.h
hw/dmx/input/dmxcommon.c
hw/dmx/input/dmxcommon.h
hw/dmx/input/dmxconsole.c
hw/dmx/input/dmxconsole.h
hw/dmx/input/dmxevents.c
hw/dmx/input/dmxinputinit.c
hw/dmx/input/dmxinputinit.h
hw/dmx/input/lnx-keyboard.c
hw/dmx/input/lnx-keyboard.h
hw/dmx/input/lnx-ms.c
hw/dmx/input/lnx-ms.h
hw/dmx/input/lnx-ps2.c
hw/dmx/input/lnx-ps2.h
hw/dmx/input/usb-common.c
hw/dmx/input/usb-common.h
hw/dmx/input/usb-private.h
hw/dmx/man/Xdmx.man
hw/kdrive/ephyr/Makefile.am
hw/kdrive/ephyr/XF86dri.c [deleted file]
hw/kdrive/ephyr/ephyr.c
hw/kdrive/ephyr/ephyr.h
hw/kdrive/ephyr/ephyr_glamor_glx.c [new file with mode: 0644]
hw/kdrive/ephyr/ephyr_glamor_glx.h [new file with mode: 0644]
hw/kdrive/ephyr/ephyrdri.c
hw/kdrive/ephyr/ephyrdri.h
hw/kdrive/ephyr/ephyrdriext.c
hw/kdrive/ephyr/ephyrglxext.c
hw/kdrive/ephyr/ephyrhostglx.c
hw/kdrive/ephyr/ephyrhostglx.h
hw/kdrive/ephyr/ephyrhostproxy.c [deleted file]
hw/kdrive/ephyr/ephyrhostproxy.h [deleted file]
hw/kdrive/ephyr/ephyrhostvideo.c [deleted file]
hw/kdrive/ephyr/ephyrhostvideo.h [deleted file]
hw/kdrive/ephyr/ephyrinit.c
hw/kdrive/ephyr/ephyrproxyext.c [deleted file]
hw/kdrive/ephyr/ephyrproxyext.h [deleted file]
hw/kdrive/ephyr/ephyrvideo.c
hw/kdrive/ephyr/hostx.c
hw/kdrive/ephyr/hostx.h
hw/kdrive/ephyr/man/Xephyr.man
hw/kdrive/ephyr/os.c
hw/kdrive/ephyr/xf86dri.h [deleted file]
hw/kdrive/fake/Makefile.am
hw/kdrive/fbdev/Makefile.am
hw/kdrive/fbdev/fbdev.c
hw/kdrive/fbdev/fbdev.h
hw/kdrive/linux/Makefile.am
hw/kdrive/linux/evdev.c
hw/kdrive/linux/linux.c
hw/kdrive/linux/mouse.c
hw/kdrive/linux/ps2.c
hw/kdrive/src/Makefile.am
hw/kdrive/src/kcmap.c
hw/kdrive/src/kdrive.c
hw/kdrive/src/kdrive.h
hw/kdrive/src/kinput.c
hw/kdrive/src/kxv.c
hw/kdrive/src/kxv.h
hw/vfb/InitInput.c
hw/vfb/InitOutput.c
hw/vfb/Makefile.am
hw/xfree86/Makefile.am
hw/xfree86/Xorg.sh.in [new file with mode: 0644]
hw/xfree86/common/Makefile.am
hw/xfree86/common/compiler.h
hw/xfree86/common/dgaproc.h
hw/xfree86/common/vidmodeproc.h
hw/xfree86/common/xf86.h
hw/xfree86/common/xf86AutoConfig.c
hw/xfree86/common/xf86Bus.c
hw/xfree86/common/xf86Bus.h
hw/xfree86/common/xf86Config.c
hw/xfree86/common/xf86Config.h
hw/xfree86/common/xf86Configure.c
hw/xfree86/common/xf86Cursor.c
hw/xfree86/common/xf86DGA.c
hw/xfree86/common/xf86DPMS.c [changed mode: 0644->0755]
hw/xfree86/common/xf86Events.c
hw/xfree86/common/xf86Extensions.c
hw/xfree86/common/xf86Globals.c
hw/xfree86/common/xf86Helper.c
hw/xfree86/common/xf86InPriv.h
hw/xfree86/common/xf86Init.c
hw/xfree86/common/xf86Mode.c
hw/xfree86/common/xf86Module.h
hw/xfree86/common/xf86Opt.h
hw/xfree86/common/xf86Option.c
hw/xfree86/common/xf86Optionstr.h
hw/xfree86/common/xf86PM.c
hw/xfree86/common/xf86Priv.h
hw/xfree86/common/xf86Privstr.h
hw/xfree86/common/xf86RandR.c
hw/xfree86/common/xf86VGAarbiter.c
hw/xfree86/common/xf86VGAarbiterPriv.h
hw/xfree86/common/xf86VidMode.c
hw/xfree86/common/xf86Xinput.c [changed mode: 0644->0755]
hw/xfree86/common/xf86Xinput.h [changed mode: 0644->0755]
hw/xfree86/common/xf86cmap.c
hw/xfree86/common/xf86fbman.c
hw/xfree86/common/xf86fbman.h
hw/xfree86/common/xf86pciBus.c
hw/xfree86/common/xf86pciBus.h
hw/xfree86/common/xf86platformBus.c
hw/xfree86/common/xf86platformBus.h
hw/xfree86/common/xf86sbusBus.c
hw/xfree86/common/xf86sbusBus.h
hw/xfree86/common/xf86str.h
hw/xfree86/common/xf86vmode.c
hw/xfree86/common/xf86xv.c [changed mode: 0644->0755]
hw/xfree86/common/xf86xv.h
hw/xfree86/common/xf86xvmc.c
hw/xfree86/common/xf86xvmc.h
hw/xfree86/ddc/Makefile.am
hw/xfree86/ddc/ddc.c
hw/xfree86/ddc/interpret_edid.c
hw/xfree86/ddc/xf86DDC.h
hw/xfree86/dixmods/Makefile.am
hw/xfree86/dixmods/extmod/modinit.h [changed mode: 0644->0755]
hw/xfree86/dixmods/glxmodule.c
hw/xfree86/doc/ddxDesign.xml
hw/xfree86/dri/dri.c
hw/xfree86/dri/dri.h
hw/xfree86/dri/xf86dri.c
hw/xfree86/dri2/dri2.c
hw/xfree86/dri2/dri2ext.c
hw/xfree86/exa/Makefile.am
hw/xfree86/exa/examodule.c
hw/xfree86/fbdevhw/Makefile.am
hw/xfree86/fbdevhw/fbdevhw.c
hw/xfree86/glamor_egl/Makefile.am [new file with mode: 0644]
hw/xfree86/i2c/Makefile.am
hw/xfree86/i2c/bt829.c
hw/xfree86/i2c/fi1236.c
hw/xfree86/i2c/msp3430.c
hw/xfree86/i2c/tda9850.c
hw/xfree86/i2c/xf86i2c.h
hw/xfree86/int10/Makefile.am
hw/xfree86/int10/generic.c
hw/xfree86/int10/helper_exec.c
hw/xfree86/int10/helper_mem.c
hw/xfree86/int10/stub.c
hw/xfree86/int10/xf86int10.h
hw/xfree86/int10/xf86x86emu.c
hw/xfree86/loader/Makefile.am
hw/xfree86/loader/loaderProcs.h
hw/xfree86/loader/loadmod.c
hw/xfree86/man/Makefile.am
hw/xfree86/man/Xorg.man
hw/xfree86/man/Xorg.wrap.man [new file with mode: 0644]
hw/xfree86/man/Xwrapper.config.man [new file with mode: 0644]
hw/xfree86/man/xorg.conf.man
hw/xfree86/modes/Makefile.am
hw/xfree86/modes/xf86Crtc.c [changed mode: 0644->0755]
hw/xfree86/modes/xf86Crtc.h [changed mode: 0644->0755]
hw/xfree86/modes/xf86Cursors.c [changed mode: 0644->0755]
hw/xfree86/modes/xf86DisplayIDModes.c
hw/xfree86/modes/xf86EdidModes.c
hw/xfree86/modes/xf86Modes.c
hw/xfree86/modes/xf86Modes.h
hw/xfree86/modes/xf86RandR12.c [changed mode: 0644->0755]
hw/xfree86/modes/xf86RandR12.h
hw/xfree86/modes/xf86Rename.h [deleted file]
hw/xfree86/modes/xf86Rotate.c
hw/xfree86/modes/xf86cvt.c
hw/xfree86/modes/xf86gtf.c
hw/xfree86/os-support/bsd/Makefile.am
hw/xfree86/os-support/bsd/alpha_video.c
hw/xfree86/os-support/bsd/arm_video.c
hw/xfree86/os-support/bsd/bsd_apm.c
hw/xfree86/os-support/bsd/bsd_ev56.c
hw/xfree86/os-support/bsd/bsd_kqueue_apm.c
hw/xfree86/os-support/bsd/i386_video.c
hw/xfree86/os-support/bsd/ppc_video.c
hw/xfree86/os-support/bsd/sparc64_video.c
hw/xfree86/os-support/bus/Makefile.am
hw/xfree86/os-support/bus/Sbus.c
hw/xfree86/os-support/bus/nobus.c
hw/xfree86/os-support/hurd/Makefile.am
hw/xfree86/os-support/hurd/hurd_init.c
hw/xfree86/os-support/hurd/hurd_mmap.c
hw/xfree86/os-support/hurd/hurd_video.c
hw/xfree86/os-support/linux/Makefile.am
hw/xfree86/os-support/linux/int10/linux.c
hw/xfree86/os-support/linux/lnx_acpi.c
hw/xfree86/os-support/linux/lnx_apm.c
hw/xfree86/os-support/linux/lnx_ev56.c
hw/xfree86/os-support/linux/lnx_init.c
hw/xfree86/os-support/linux/lnx_kmod.c
hw/xfree86/os-support/linux/lnx_platform.c
hw/xfree86/os-support/linux/lnx_video.c
hw/xfree86/os-support/linux/systemd-logind.c [new file with mode: 0644]
hw/xfree86/os-support/misc/Makefile.am
hw/xfree86/os-support/shared/agp_noop.c
hw/xfree86/os-support/shared/ioperm_noop.c
hw/xfree86/os-support/shared/posix_tty.c
hw/xfree86/os-support/shared/vidmem.c
hw/xfree86/os-support/solaris/Makefile.am
hw/xfree86/os-support/solaris/sun_apm.c
hw/xfree86/os-support/solaris/sun_init.c
hw/xfree86/os-support/solaris/sun_vid.c
hw/xfree86/os-support/stub/Makefile.am
hw/xfree86/os-support/stub/stub_init.c
hw/xfree86/os-support/xf86OSpriv.h
hw/xfree86/os-support/xf86_OSlib.h
hw/xfree86/os-support/xf86_OSproc.h
hw/xfree86/parser/Configint.h
hw/xfree86/parser/DRI.c
hw/xfree86/parser/Device.c
hw/xfree86/parser/Extensions.c
hw/xfree86/parser/Files.c
hw/xfree86/parser/Flags.c
hw/xfree86/parser/Input.c
hw/xfree86/parser/InputClass.c
hw/xfree86/parser/Layout.c
hw/xfree86/parser/Makefile.am
hw/xfree86/parser/Module.c
hw/xfree86/parser/Monitor.c
hw/xfree86/parser/OutputClass.c [new file with mode: 0644]
hw/xfree86/parser/Pointer.c
hw/xfree86/parser/Screen.c
hw/xfree86/parser/Vendor.c
hw/xfree86/parser/Video.c
hw/xfree86/parser/configProcs.h
hw/xfree86/parser/read.c
hw/xfree86/parser/scan.c
hw/xfree86/parser/write.c
hw/xfree86/parser/xf86Parser.h
hw/xfree86/parser/xf86tokens.h
hw/xfree86/ramdac/IBM.c
hw/xfree86/ramdac/Makefile.am
hw/xfree86/ramdac/TI.c
hw/xfree86/ramdac/xf86Cursor.c
hw/xfree86/ramdac/xf86Cursor.h
hw/xfree86/ramdac/xf86CursorPriv.h
hw/xfree86/ramdac/xf86HWCurs.c
hw/xfree86/sdksyms.sh
hw/xfree86/shadowfb/Makefile.am
hw/xfree86/shadowfb/shadow.c
hw/xfree86/utils/cvt/Makefile.am [changed mode: 0755->0644]
hw/xfree86/utils/cvt/cvt.c
hw/xfree86/utils/gtf/Makefile.am [changed mode: 0755->0644]
hw/xfree86/vbe/Makefile.am
hw/xfree86/vbe/vbe.c
hw/xfree86/vbe/vbe.h
hw/xfree86/vbe/vbeModes.c
hw/xfree86/vbe/vbeModes.h
hw/xfree86/vgahw/Makefile.am
hw/xfree86/vgahw/vgaCmap.c
hw/xfree86/vgahw/vgaHW.h
hw/xfree86/x86emu/Makefile.am
hw/xfree86/x86emu/decode.c
hw/xfree86/x86emu/ops.c
hw/xfree86/x86emu/x86emu/regs.h
hw/xfree86/x86emu/x86emu/x86emui.h
hw/xfree86/xorg-wrapper.c [new file with mode: 0644]
hw/xfree86/xorgconf.cpp
hw/xnest/Args.h
hw/xnest/Color.c
hw/xnest/Events.c
hw/xnest/Font.c
hw/xnest/GC.c
hw/xnest/GCOps.c
hw/xnest/GCOps.h
hw/xnest/Handlers.c
hw/xnest/Handlers.h
hw/xnest/Init.c
hw/xnest/Keyboard.c
hw/xnest/Keyboard.h
hw/xnest/Makefile.am
hw/xnest/Pixmap.c
hw/xnest/Screen.c
hw/xnest/Visual.c
hw/xnest/Window.c
hw/xnest/XNGC.h
hw/xnest/XNPixmap.h
hw/xquartz/GL/capabilities.c
hw/xquartz/GL/glcontextmodes.c
hw/xquartz/GL/indirect.c
hw/xquartz/GL/visualConfigs.c
hw/xquartz/Makefile.am
hw/xquartz/X11Application.m
hw/xquartz/X11Controller.m
hw/xquartz/applewm.c
hw/xquartz/bundle/Info.plist.cpp
hw/xquartz/darwin.c
hw/xquartz/darwinfb.h
hw/xquartz/mach-startup/stub.c
hw/xquartz/pbproxy/x-selection.m
hw/xquartz/quartz.c
hw/xquartz/quartzCocoa.m
hw/xquartz/quartzCommon.h
hw/xquartz/xpr/Makefile.am
hw/xquartz/xpr/appledri.c
hw/xquartz/xpr/dri.c
hw/xquartz/xpr/dri.h
hw/xquartz/xpr/driWrap.c
hw/xquartz/xpr/x-hook.c
hw/xquartz/xpr/xprCursor.c
hw/xquartz/xpr/xprFrame.c
hw/xquartz/xpr/xprScreen.c
hw/xwayland/.gitignore [new file with mode: 0644]
hw/xwayland/Makefile.am [new file with mode: 0644]
hw/xwayland/drm.xml [new file with mode: 0644]
hw/xwayland/xwayland-cursor.c [new file with mode: 0644]
hw/xwayland/xwayland-cvt.c [new file with mode: 0644]
hw/xwayland/xwayland-glamor.c [new file with mode: 0644]
hw/xwayland/xwayland-input.c [new file with mode: 0644]
hw/xwayland/xwayland-output.c [new file with mode: 0644]
hw/xwayland/xwayland-shm.c [new file with mode: 0644]
hw/xwayland/xwayland.c [new file with mode: 0644]
hw/xwayland/xwayland.h [new file with mode: 0644]
hw/xwin/InitInput.c
hw/xwin/InitOutput.c
hw/xwin/Makefile.am
hw/xwin/XWin.exe.manifest
hw/xwin/ddraw.h
hw/xwin/glx/Makefile.am
hw/xwin/glx/gen_gl_wrappers.py
hw/xwin/glx/glshim.c [new file with mode: 0644]
hw/xwin/glx/glthunk.c [moved from hw/xwin/glx/glwrap.c with 54% similarity]
hw/xwin/glx/glwindows.h
hw/xwin/glx/indirect.c
hw/xwin/man/XWin.man
hw/xwin/propertystore.h [new file with mode: 0644]
hw/xwin/win.h
hw/xwin/winSetAppUserModelID.c [new file with mode: 0644]
hw/xwin/winallpriv.c
hw/xwin/winauth.c
hw/xwin/winblock.c
hw/xwin/winclipboard.h
hw/xwin/winclipboardinit.c
hw/xwin/winclipboardtextconv.c
hw/xwin/winclipboardthread.c
hw/xwin/winclipboardwndproc.c
hw/xwin/winclipboardwrappers.c
hw/xwin/winclipboardxevents.c
hw/xwin/wincmap.c
hw/xwin/winconfig.c
hw/xwin/winconfig.h
hw/xwin/wincursor.c
hw/xwin/windialogs.c
hw/xwin/winengine.c
hw/xwin/winerror.c
hw/xwin/winfillsp.c
hw/xwin/wingc.c
hw/xwin/winglobals.c
hw/xwin/winglobals.h
hw/xwin/winkeybd.c
hw/xwin/winlayouts.h
hw/xwin/winmessages.h
hw/xwin/winmonitors.c
hw/xwin/winmonitors.h
hw/xwin/winmouse.c
hw/xwin/winms.h
hw/xwin/winmsg.c
hw/xwin/winmsg.h
hw/xwin/winmsgwindow.c [new file with mode: 0644]
hw/xwin/winmultiwindowclass.c
hw/xwin/winmultiwindowclass.h
hw/xwin/winmultiwindowicons.c
hw/xwin/winmultiwindowshape.c
hw/xwin/winmultiwindowwindow.c
hw/xwin/winmultiwindowwm.c
hw/xwin/winmultiwindowwndproc.c
hw/xwin/winnativegdi.c
hw/xwin/winpfbdd.c
hw/xwin/winpixmap.c
hw/xwin/winprefs.c
hw/xwin/winprefs.h
hw/xwin/winprefslex.l
hw/xwin/winprefsyacc.y
hw/xwin/winprocarg.c
hw/xwin/winregistry.c [deleted file]
hw/xwin/winresource.h
hw/xwin/winscrinit.c
hw/xwin/winsetsp.c
hw/xwin/winshaddd.c
hw/xwin/winshadddnl.c
hw/xwin/winshadgdi.c
hw/xwin/wintaskbar.c [new file with mode: 0644]
hw/xwin/wintrayicon.c
hw/xwin/winvalargs.c
hw/xwin/winwakeup.c
hw/xwin/winwin32rootless.c
hw/xwin/winwin32rootlesswindow.c
hw/xwin/winwin32rootlesswndproc.c
hw/xwin/winwindow.c
hw/xwin/winwindow.h
hw/xwin/winwindowswm.c
hw/xwin/winwndproc.c
hwa/Makefile.am [new file with mode: 0644]
hwa/hwa.c [new file with mode: 0644]
hwa/hwa.h [new file with mode: 0644]
hwa/hwa_priv.h [new file with mode: 0644]
hwa/hwa_request.c [new file with mode: 0644]
hwa/hwa_screen.c [new file with mode: 0644]
hwc/Makefile.am
hwc/hwc.c [changed mode: 0755->0644]
hwc/hwc.h [changed mode: 0755->0644]
hwc/hwc_event.c [changed mode: 0755->0644]
hwc/hwc_priv.h [changed mode: 0755->0644]
hwc/hwc_request.c [changed mode: 0755->0644]
hwc/hwc_screen.c
hwc/hwc_storage.c [new file with mode: 0644]
include/Makefile.am
include/busfault.h [new file with mode: 0644]
include/callback.h
include/closestr.h
include/colormap.h
include/cursor.h
include/cursorstr.h
include/dbus-core.h [new file with mode: 0644]
include/dix-config.h.in
include/dix.h [changed mode: 0644->0755]
include/dixfont.h
include/dixfontstubs.h [new file with mode: 0644]
include/dixgrabs.h
include/dixstruct.h [changed mode: 0755->0644]
include/eventconvert.h
include/events.h
include/eventstr.h
include/extension.h
include/extinit.h
include/extnsionst.h
include/gc.h
include/gcstruct.h
include/globals.h
include/hotplug.h
include/input.h [changed mode: 0644->0755]
include/inputstr.h
include/inpututils.h
include/kdrive-config.h.in
include/list.h
include/misc.h
include/miscstruct.h
include/opaque.h
include/os.h
include/pixmap.h
include/pixmapstr.h
include/privates.h
include/property.h
include/propertyst.h
include/protocol-versions.h
include/regionstr.h
include/registry.h
include/resource.h
include/scrnintstr.h
include/servermd.h
include/systemd-logind.h [new file with mode: 0644]
include/window.h
include/windowstr.h
include/xkbrules.h
include/xkbsrv.h
include/xorg-config.h.in
include/xorg-server.h.in
include/xserver-properties.h [changed mode: 0644->0755]
include/xwin-config.h.in
m4/xorg-tls.m4
man/Xserver.man
manpages.am
mi/Makefile.am
mi/mi.h [changed mode: 0644->0755]
mi/miarc.c
mi/mibitblt.c
mi/mibstore.h [deleted file]
mi/micmap.c
mi/midispcur.c
mi/mieq.c
mi/miexpose.c
mi/migc.c
mi/migc.h
mi/miglblt.c
mi/miinitext.c
mi/mioverlay.c
mi/mipointer.c [changed mode: 0644->0755]
mi/mipointer.h [changed mode: 0644->0755]
mi/mipolyrect.c
mi/miscrinit.c
mi/mispans.c
mi/misprite.c
mi/miwideline.c
mi/miwindow.c
miext/damage/Makefile.am
miext/damage/damage.c
miext/damage/damage.h
miext/damage/damagestr.h
miext/rootless/rootlessCommon.c
miext/rootless/rootlessGC.c
miext/rootless/rootlessScreen.c
miext/rootless/rootlessWindow.c
miext/shadow/Makefile.am
miext/shadow/c2p_core.h [new file with mode: 0644]
miext/shadow/shadow.c
miext/shadow/shadow.h
miext/shadow/shafb4.c [new file with mode: 0644]
miext/shadow/shafb8.c [new file with mode: 0644]
miext/shadow/shiplan2p4.c [new file with mode: 0644]
miext/shadow/shiplan2p8.c [new file with mode: 0644]
miext/shadow/shpacked.c
miext/sync/Makefile.am
miext/sync/misync.c
miext/sync/misync.h
miext/sync/misyncfd.c [new file with mode: 0644]
miext/sync/misyncfd.h [new file with mode: 0644]
miext/sync/misyncshm.c [new file with mode: 0644]
miext/sync/misyncshm.h [new file with mode: 0644]
miext/sync/misyncstr.h
os/Makefile.am
os/WaitFor.c
os/access.c
os/auth.c
os/backtrace.c
os/busfault.c [new file with mode: 0644]
os/connection.c
os/io.c
os/log.c
os/osdep.h
os/osinit.c
os/rpcauth.c
os/strndup.c
os/utils.c
os/xdmauth.c
os/xdmcp.c
os/xsha1.c
os/xstrans.c
packaging/xorg-x11-server.spec
present/Makefile.am [new file with mode: 0644]
present/present.c [new file with mode: 0755]
present/present.h [new file with mode: 0644]
present/present_event.c [new file with mode: 0644]
present/present_fake.c [new file with mode: 0644]
present/present_fence.c [new file with mode: 0644]
present/present_notify.c [new file with mode: 0644]
present/present_priv.h [new file with mode: 0644]
present/present_request.c [new file with mode: 0644]
present/present_screen.c [new file with mode: 0644]
present/presentext.h [new file with mode: 0644]
pseudoramiX/Makefile.am [new file with mode: 0644]
pseudoramiX/pseudoramiX.c [moved from hw/xquartz/pseudoramiX.c with 98% similarity]
pseudoramiX/pseudoramiX.h [moved from hw/xquartz/pseudoramiX.h with 100% similarity]
randr/randr.c
randr/randrstr.h [changed mode: 0644->0755]
randr/rrcrtc.c [changed mode: 0644->0755]
randr/rrdispatch.c
randr/rrinfo.c
randr/rrmode.c
randr/rroutput.c
randr/rrpointer.c
randr/rrproperty.c [changed mode: 0644->0755]
randr/rrprovider.c
randr/rrproviderproperty.c
randr/rrscreen.c
randr/rrsdispatch.c
record/record.c
render/animcur.c
render/glyph.c
render/glyphstr.h
render/mipict.c
render/mipict.h
render/mirect.c
render/picture.c
render/picturestr.h
render/render.c
test/Makefile.am
test/fixes.c
test/hashtabletest.c
test/input.c
test/os.c
test/signal-logging.c
test/touch.c
test/xfree86.c
test/xi2/Makefile.am
test/xi2/protocol-common.c
test/xi2/protocol-common.h
test/xi2/protocol-eventconvert.c
test/xi2/protocol-xigetselectedevents.c
test/xi2/protocol-xipassivegrabdevice.c
test/xi2/protocol-xiquerydevice.c
test/xi2/protocol-xiqueryversion.c
test/xi2/protocol-xiselectevents.c
test/xi2/protocol-xiwarppointer.c
test/xi2/xi2.c
test/xkb.c
test/xtest.c
xfixes/cursor.c
xfixes/region.c
xfixes/select.c
xfixes/xfixes.c
xfixes/xfixes.h
xfixes/xfixesint.h
xkb/Makefile.am
xkb/XKBAlloc.c [changed mode: 0755->0644]
xkb/ddxBeep.c
xkb/ddxList.c [deleted file]
xkb/ddxLoad.c [changed mode: 0755->0644]
xkb/maprules.c
xkb/xkb.c [changed mode: 0755->0644]
xkb/xkbAccessX.c
xkb/xkbActions.c [changed mode: 0755->0644]
xkb/xkbEvents.c
xkb/xkbInit.c
xkb/xkbPrKeyEv.c
xkb/xkbUtils.c
xkb/xkbout.c
xkb/xkbtext.c
xkb/xkmread.c
xkb/xserver-keymap-dir.in [changed mode: 0644->0755]
xorg-server.m4
xorg-x11-server-Xorg.manifest

diff --git a/.dir-locals.el b/.dir-locals.el
new file mode 100644 (file)
index 0000000..6aceae3
--- /dev/null
@@ -0,0 +1 @@
+((c-mode . ((c-basic-offset . 4) (indent-tabs-mode . nil))))
\ No newline at end of file
index 94a12fd..ec01204 100644 (file)
@@ -79,3 +79,9 @@ core
 doltcompile
 doltlibtool
 xserver.ent
+# Eclipse things
+.cproject
+.project
+.settings/
+Debug/
+
diff --git a/COPYING b/COPYING
index 7aa0df0..cc52a32 100644 (file)
--- a/COPYING
+++ b/COPYING
@@ -20,6 +20,7 @@ Copyright Â© 1999 Keith Packard
 Copyright Â© 2007-2009 Red Hat, Inc.
 Copyright Â© 2005-2008 Daniel Stone
 Copyright Â© 2006-2009 Simon Thum
+Copyright Â© 2003-2008, 2013 Geert Uytterhoeven
 Copyright Â© 2006 Luc Verhaegen
 
 Permission is hereby granted, free of charge, to any person obtaining a
index a53b471..163753f 100644 (file)
@@ -1,10 +1,20 @@
 AUTOMAKE_OPTIONS=nostdinc
+
+# Required for automake < 1.14
 ACLOCAL_AMFLAGS = -I m4
 
 if COMPOSITE
 COMPOSITE_DIR=composite
 endif
 
+if HWC
+HWC_DIR=hwc
+endif
+
+if HWA
+HWA_DIR=hwa
+endif
+
 if GLX
 GLX_DIR=glx
 endif
@@ -17,6 +27,26 @@ if RECORD
 RECORD_DIR=record
 endif
 
+if DRI3
+DRI3_DIR=dri3
+endif
+
+if PRESENT
+PRESENT_DIR=present
+endif
+
+if CONTAINER
+CONTAINER_DIR=container
+endif
+
+if PSEUDORAMIX
+PSEUDORAMIX_DIR=pseudoramiX
+endif
+
+if GLAMOR
+GLAMOR_DIR=glamor
+endif
+
 SUBDIRS = \
        doc \
        man \
@@ -31,16 +61,22 @@ SUBDIRS = \
        render  \
        Xi \
        xkb \
+       $(PSEUDORAMIX_DIR) \
        $(DBE_DIR) \
        $(RECORD_DIR) \
        xfixes \
        damageext \
        $(COMPOSITE_DIR) \
        $(GLX_DIR) \
+       $(PRESENT_DIR) \
+       $(DRI3_DIR) \
        exa \
+       $(GLAMOR_DIR) \
        config \
        gesture \
-       hwc \
+       $(HWC_DIR) \
+       $(HWA_DIR) \
+       $(CONTAINER_DIR) \
        hw \
        test
 
@@ -79,6 +115,7 @@ DIST_SUBDIRS = \
        Xext \
        miext \
        os \
+       pseudoramiX \
        randr \
        render  \
        Xi \
@@ -90,8 +127,14 @@ DIST_SUBDIRS = \
        composite \
        glx \
        exa \
+       glamor \
        config \
        hw \
+       hwc \
+       hwa \
+       container \
+       present \
+       dri3 \
        test
 
 # gross hack
index 778159b..0c12b69 100644 (file)
@@ -1,6 +1,6 @@
-noinst_LTLIBRARIES = libXext.la
+noinst_LTLIBRARIES = libXext.la libXextdpmsstubs.la
 
-AM_CFLAGS = $(DIX_CFLAGS)
+AM_CFLAGS = $(DIX_CFLAGS) $(TTRACE_CFLAGS)
 
 if XORG
 sdk_HEADERS = xvdix.h xvmcext.h geext.h geint.h shmint.h syncsdk.h
@@ -18,7 +18,7 @@ BUILTIN_SRCS =                        \
        syncsrv.h               \
        xcmisc.c                \
        xtest.c
-BUILTIN_LIBS =
+BUILTIN_LIBS = $(TTRACE_LIBS)
 
 # Optional sources included if extension enabled by configure.ac rules
 
@@ -47,7 +47,7 @@ BUILTIN_SRCS  += $(SCREENSAVER_SRCS)
 endif
 
 # Xinerama extension: making multiple video devices act as one virtual screen
-XINERAMA_SRCS = panoramiX.c panoramiX.h panoramiXh.h panoramiXsrv.h panoramiXprocs.c panoramiXSwap.c 
+XINERAMA_SRCS = panoramiX.c panoramiX.h panoramiXh.h panoramiXsrv.h panoramiXprocs.c panoramiXSwap.c
 if XINERAMA
 BUILTIN_SRCS += $(XINERAMA_SRCS)
 if XORG
@@ -83,7 +83,7 @@ endif
 
 # Security extension: multi-level security to protect clients from each other
 XCSECURITY_SRCS = security.c securitysrv.h
-if XCSECURITY   
+if XCSECURITY
 BUILTIN_SRCS += $(XCSECURITY_SRCS)
 endif
 
@@ -99,11 +99,20 @@ if DPMSExtension
 BUILTIN_SRCS += $(DPMS_SRCS)
 endif
 
+# Smack utility
+SMACK_UTIL_SRCS = smack_util.c smack_util.h
+if SMACK_UTIL
+BUILTIN_SRCS += $(SMACK_UTIL_SRCS)
+BUILTIN_LIBS += $(SMACK_UTIL_LIBS)
+endif
+
 # Now take all of the above, mix well, bake for 10 minutes and get libXext*.la
 
 libXext_la_SOURCES =           $(BUILTIN_SRCS)
 libXext_la_LIBADD =            $(BUILTIN_LIBS)
 
+libXextdpmsstubs_la_SOURCES = dpmsstubs.c
+
 EXTRA_DIST = \
        $(MITSHM_SRCS) \
        $(XV_SRCS) \
@@ -116,5 +125,6 @@ EXTRA_DIST = \
        $(XINERAMA_SRCS) \
        $(BIGFONT_SRCS) \
        $(DPMS_SRCS) \
-        $(GE_SRCS)
+       $(GE_SRCS) \
+       $(SMACK_UTIL_SRCS)
 
index 7494dfd..82dccbd 100644 (file)
@@ -9,7 +9,7 @@
 
 #include "dixstruct.h"
 
-int DPMSSet(ClientPtr client, int level);
-Bool DPMSSupported(void);
+int _X_EXPORT DPMSSet(ClientPtr client, int level);
+Bool _X_EXPORT DPMSSupported(void);
 
 #endif
index 1e5ae6f..aee68c4 100644 (file)
@@ -150,7 +150,7 @@ SProcGEDispatch(ClientPtr client)
  * used in the furture for versioning support.
  */
 static void
-GEClientCallback(CallbackListPtr *list, pointer closure, pointer data)
+GEClientCallback(CallbackListPtr *list, void *closure, void *data)
 {
     NewClientInfoRec *clientinfo = (NewClientInfoRec *) data;
     ClientPtr pClient = clientinfo->client;
index 9d9ef89..471ecca 100644 (file)
@@ -23,7 +23,7 @@ struct HashTableRec {
     HashFunc        hash;
     HashCompareFunc compare;
 
-    pointer         cdata;
+    void            *cdata;
 };
 
 typedef struct {
@@ -37,7 +37,7 @@ ht_create(int             keySize,
           int             dataSize,
           HashFunc        hash,
           HashCompareFunc compare,
-          pointer         cdata)
+          void            *cdata)
 {
     int c;
     int numBuckets;
@@ -117,8 +117,8 @@ double_size(HashTable ht)
     }
 }
 
-pointer
-ht_add(HashTable ht, pointer key)
+void *
+ht_add(HashTable ht, const void *key)
 {
     unsigned index = ht->hash(ht->cdata, key, ht->bucketBits);
     struct xorg_list *bucket = &ht->buckets[index];
@@ -164,7 +164,7 @@ ht_add(HashTable ht, pointer key)
 }
 
 void
-ht_remove(HashTable ht, pointer key)
+ht_remove(HashTable ht, const void *key)
 {
     unsigned index = ht->hash(ht->cdata, key, ht->bucketBits);
     struct xorg_list *bucket = &ht->buckets[index];
@@ -182,8 +182,8 @@ ht_remove(HashTable ht, pointer key)
     }
 }
 
-pointer
-ht_find(HashTable ht, pointer key)
+void *
+ht_find(HashTable ht, const void *key)
 {
     unsigned index = ht->hash(ht->cdata, key, ht->bucketBits);
     struct xorg_list *bucket = &ht->buckets[index];
index 5d15984..a988af3 100644 (file)
@@ -55,7 +55,7 @@ extern _X_EXPORT HashTable ht_create(int             keySize,
                                      int             dataSize,
                                      HashFunc        hash,
                                      HashCompareFunc compare,
-                                     pointer         cdata);
+                                     void            *cdata);
 /** @brief  HtDestruct deinitializes the structure. It does not free the
             memory allocated to HashTableRec
 */
@@ -75,12 +75,12 @@ extern _X_EXPORT void ht_destroy(HashTable ht);
          to avoid returning NULL. Obviously the data pointed cannot be
          modified, as implied by dataSize being 0.
 */
-extern _X_EXPORT pointer ht_add(HashTable ht, pointer key);
+extern _X_EXPORT void *ht_add(HashTable ht, const void *key);
 
 /** @brief  Removes a key from the hash table along with its
             associated data, which will be free'd.
 */
-extern _X_EXPORT void ht_remove(HashTable ht, pointer key);
+extern _X_EXPORT void ht_remove(HashTable ht, const void *key);
 
 /** @brief  Finds the associated data of a key from the hash table.
 
@@ -93,7 +93,7 @@ extern _X_EXPORT void ht_remove(HashTable ht, pointer key);
           use HtMember instead to determine if a key has been
           inserted.
 */
-extern _X_EXPORT pointer ht_find(HashTable ht, pointer key);
+extern _X_EXPORT void *ht_find(HashTable ht, const void *key);
 
 /** @brief  A generic hash function */
 extern _X_EXPORT unsigned ht_generic_hash(void *cdata,
index 1c7197d..4d79c46 100644 (file)
@@ -53,9 +53,8 @@ Equipment Corporation.
 #include "servermd.h"
 #include "resource.h"
 #include "picturestr.h"
-#ifdef XFIXES
 #include "xfixesint.h"
-#endif
+#include "damageextint.h"
 #ifdef COMPOSITE
 #include "compint.h"
 #endif
@@ -75,7 +74,7 @@ int PanoramiXPixWidth = 0;
 int PanoramiXPixHeight = 0;
 int PanoramiXNumScreens = 0;
 
-static RegionRec PanoramiXScreenRegion = { {0, 0, 0, 0}, NULL };
+_X_EXPORT RegionRec PanoramiXScreenRegion = { {0, 0, 0, 0}, NULL };
 
 static int PanoramiXNumDepths;
 static DepthPtr PanoramiXDepths;
@@ -119,7 +118,7 @@ static DevPrivateKeyRec PanoramiXScreenKeyRec;
 typedef struct {
     DDXPointRec clipOrg;
     DDXPointRec patOrg;
-    GCFuncs *wrapFuncs;
+    const GCFuncs *wrapFuncs;
 } PanoramiXGCRec, *PanoramiXGCPtr;
 
 typedef struct {
@@ -131,11 +130,11 @@ static void XineramaValidateGC(GCPtr, unsigned long, DrawablePtr);
 static void XineramaChangeGC(GCPtr, unsigned long);
 static void XineramaCopyGC(GCPtr, unsigned long, GCPtr);
 static void XineramaDestroyGC(GCPtr);
-static void XineramaChangeClip(GCPtr, int, pointer, int);
+static void XineramaChangeClip(GCPtr, int, void *, int);
 static void XineramaDestroyClip(GCPtr);
 static void XineramaCopyClip(GCPtr, GCPtr);
 
-static GCFuncs XineramaGCFuncs = {
+static const GCFuncs XineramaGCFuncs = {
     XineramaValidateGC, XineramaChangeGC, XineramaCopyGC, XineramaDestroyGC,
     XineramaChangeClip, XineramaDestroyClip, XineramaCopyClip
 };
@@ -161,7 +160,7 @@ XineramaCloseScreen(ScreenPtr pScreen)
     if (pScreen->myNum == 0)
         RegionUninit(&PanoramiXScreenRegion);
 
-    free((pointer) pScreenPriv);
+    free(pScreenPriv);
 
     return (*pScreen->CloseScreen) (pScreen);
 }
@@ -295,7 +294,7 @@ XineramaCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst)
 }
 
 static void
-XineramaChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects)
+XineramaChangeClip(GCPtr pGC, int type, void *pvalue, int nrects)
 {
     Xinerama_GC_FUNC_PROLOGUE(pGC);
     (*pGC->funcs->ChangeClip) (pGC, type, pvalue, nrects);
@@ -319,7 +318,7 @@ XineramaDestroyClip(GCPtr pGC)
 }
 
 int
-XineramaDeleteResource(pointer data, XID id)
+XineramaDeleteResource(void *data, XID id)
 {
     free(data);
     return 1;
@@ -331,7 +330,7 @@ typedef struct {
 } PanoramiXSearchData;
 
 static Bool
-XineramaFindIDByScrnum(pointer resource, XID id, pointer privdata)
+XineramaFindIDByScrnum(void *resource, XID id, void *privdata)
 {
     PanoramiXRes *res = (PanoramiXRes *) resource;
     PanoramiXSearchData *data = (PanoramiXSearchData *) privdata;
@@ -343,7 +342,7 @@ PanoramiXRes *
 PanoramiXFindIDByScrnum(RESTYPE type, XID id, int screen)
 {
     PanoramiXSearchData data;
-    pointer val;
+    void *val;
 
     if (!screen) {
         dixLookupResourceByType(&val, id, type, serverClient, DixReadAccess);
@@ -583,22 +582,19 @@ PanoramiXExtensionInit(void)
     ProcVector[X_StoreNamedColor] = PanoramiXStoreNamedColor;
 
     PanoramiXRenderInit();
-#ifdef XFIXES
     PanoramiXFixesInit();
-#endif
+    PanoramiXDamageInit();
 #ifdef COMPOSITE
     PanoramiXCompositeInit();
 #endif
 
 }
 
-extern Bool CreateConnectionBlock(void);
-
 Bool
 PanoramiXCreateConnectionBlock(void)
 {
     int i, j, length;
-    Bool disableBackingStore = FALSE;
+    Bool disable_backing_store = FALSE;
     int old_width, old_height;
     float width_mult, height_mult;
     xWindowRoot *root;
@@ -624,10 +620,10 @@ PanoramiXCreateConnectionBlock(void)
         }
         if (pScreen->backingStoreSupport !=
             screenInfo.screens[0]->backingStoreSupport)
-            disableBackingStore = TRUE;
+            disable_backing_store = TRUE;
     }
 
-    if (disableBackingStore) {
+    if (disable_backing_store) {
         for (i = 0; i < screenInfo.numScreens; i++) {
             pScreen = screenInfo.screens[i];
             pScreen->backingStoreSupport = NotUseful;
@@ -695,9 +691,9 @@ PanoramiXCreateConnectionBlock(void)
     root->mmHeight *= height_mult;
 
     while (ConnectionCallbackList) {
-        pointer tmp;
+        void *tmp;
 
-        tmp = (pointer) ConnectionCallbackList;
+        tmp = (void *) ConnectionCallbackList;
         (*ConnectionCallbackList->func) ();
         ConnectionCallbackList = ConnectionCallbackList->next;
         free(tmp);
@@ -833,15 +829,15 @@ PanoramiXConsolidate(void)
     saver->type = XRT_WINDOW;
 
     FOR_NSCREENS(i) {
-        ScreenPtr pScreen = screenInfo.screens[i];
+        ScreenPtr scr = screenInfo.screens[i];
 
-        root->info[i].id = pScreen->root->drawable.id;
+        root->info[i].id = scr->root->drawable.id;
         root->u.win.class = InputOutput;
         root->u.win.root = TRUE;
-        saver->info[i].id = pScreen->screensaver.wid;
+        saver->info[i].id = scr->screensaver.wid;
         saver->u.win.class = InputOutput;
         saver->u.win.root = TRUE;
-        defmap->info[i].id = pScreen->defColormap;
+        defmap->info[i].id = scr->defColormap;
     }
 
     AddResource(root->info[0].id, XRT_WINDOW, root);
@@ -892,9 +888,8 @@ PanoramiXResetProc(ExtensionEntry * extEntry)
     int i;
 
     PanoramiXRenderReset();
-#ifdef XFIXES
     PanoramiXFixesReset();
-#endif
+    PanoramiXDamageReset();
 #ifdef COMPOSITE
     PanoramiXCompositeReset ();
 #endif
index 576844c..83a2e08 100644 (file)
@@ -72,7 +72,7 @@ PanoramiXCreateWindow(ClientPtr client)
     if (Ones(stuff->mask) != len)
         return BadLength;
 
-    result = dixLookupResourceByType((pointer *) &parent, stuff->parent,
+    result = dixLookupResourceByType((void **) &parent, stuff->parent,
                                      XRT_WINDOW, client, DixWriteAccess);
     if (result != Success)
         return result;
@@ -87,7 +87,7 @@ PanoramiXCreateWindow(ClientPtr client)
         pback_offset = Ones((Mask) stuff->mask & (CWBackPixmap - 1));
         tmp = *((CARD32 *) &stuff[1] + pback_offset);
         if ((tmp != None) && (tmp != ParentRelative)) {
-            result = dixLookupResourceByType((pointer *) &backPix, tmp,
+            result = dixLookupResourceByType((void **) &backPix, tmp,
                                              XRT_PIXMAP, client, DixReadAccess);
             if (result != Success)
                 return result;
@@ -97,7 +97,7 @@ PanoramiXCreateWindow(ClientPtr client)
         pbord_offset = Ones((Mask) stuff->mask & (CWBorderPixmap - 1));
         tmp = *((CARD32 *) &stuff[1] + pbord_offset);
         if (tmp != CopyFromParent) {
-            result = dixLookupResourceByType((pointer *) &bordPix, tmp,
+            result = dixLookupResourceByType((void **) &bordPix, tmp,
                                              XRT_PIXMAP, client, DixReadAccess);
             if (result != Success)
                 return result;
@@ -107,7 +107,7 @@ PanoramiXCreateWindow(ClientPtr client)
         cmap_offset = Ones((Mask) stuff->mask & (CWColormap - 1));
         tmp = *((CARD32 *) &stuff[1] + cmap_offset);
         if ((tmp != CopyFromParent) && (tmp != None)) {
-            result = dixLookupResourceByType((pointer *) &cmap, tmp,
+            result = dixLookupResourceByType((void **) &cmap, tmp,
                                              XRT_COLORMAP, client,
                                              DixReadAccess);
             if (result != Success)
@@ -178,7 +178,7 @@ PanoramiXChangeWindowAttributes(ClientPtr client)
     if (Ones(stuff->valueMask) != len)
         return BadLength;
 
-    result = dixLookupResourceByType((pointer *) &win, stuff->window,
+    result = dixLookupResourceByType((void **) &win, stuff->window,
                                      XRT_WINDOW, client, DixWriteAccess);
     if (result != Success)
         return result;
@@ -191,7 +191,7 @@ PanoramiXChangeWindowAttributes(ClientPtr client)
         pback_offset = Ones((Mask) stuff->valueMask & (CWBackPixmap - 1));
         tmp = *((CARD32 *) &stuff[1] + pback_offset);
         if ((tmp != None) && (tmp != ParentRelative)) {
-            result = dixLookupResourceByType((pointer *) &backPix, tmp,
+            result = dixLookupResourceByType((void **) &backPix, tmp,
                                              XRT_PIXMAP, client, DixReadAccess);
             if (result != Success)
                 return result;
@@ -201,7 +201,7 @@ PanoramiXChangeWindowAttributes(ClientPtr client)
         pbord_offset = Ones((Mask) stuff->valueMask & (CWBorderPixmap - 1));
         tmp = *((CARD32 *) &stuff[1] + pbord_offset);
         if (tmp != CopyFromParent) {
-            result = dixLookupResourceByType((pointer *) &bordPix, tmp,
+            result = dixLookupResourceByType((void **) &bordPix, tmp,
                                              XRT_PIXMAP, client, DixReadAccess);
             if (result != Success)
                 return result;
@@ -211,7 +211,7 @@ PanoramiXChangeWindowAttributes(ClientPtr client)
         cmap_offset = Ones((Mask) stuff->valueMask & (CWColormap - 1));
         tmp = *((CARD32 *) &stuff[1] + cmap_offset);
         if ((tmp != CopyFromParent) && (tmp != None)) {
-            result = dixLookupResourceByType((pointer *) &cmap, tmp,
+            result = dixLookupResourceByType((void **) &cmap, tmp,
                                              XRT_COLORMAP, client,
                                              DixReadAccess);
             if (result != Success)
@@ -243,7 +243,7 @@ PanoramiXDestroyWindow(ClientPtr client)
 
     REQUEST_SIZE_MATCH(xResourceReq);
 
-    result = dixLookupResourceByType((pointer *) &win, stuff->id, XRT_WINDOW,
+    result = dixLookupResourceByType((void **) &win, stuff->id, XRT_WINDOW,
                                      client, DixDestroyAccess);
     if (result != Success)
         return result;
@@ -271,7 +271,7 @@ PanoramiXDestroySubwindows(ClientPtr client)
 
     REQUEST_SIZE_MATCH(xResourceReq);
 
-    result = dixLookupResourceByType((pointer *) &win, stuff->id, XRT_WINDOW,
+    result = dixLookupResourceByType((void **) &win, stuff->id, XRT_WINDOW,
                                      client, DixDestroyAccess);
     if (result != Success)
         return result;
@@ -299,7 +299,7 @@ PanoramiXChangeSaveSet(ClientPtr client)
 
     REQUEST_SIZE_MATCH(xChangeSaveSetReq);
 
-    result = dixLookupResourceByType((pointer *) &win, stuff->window,
+    result = dixLookupResourceByType((void **) &win, stuff->window,
                                      XRT_WINDOW, client, DixReadAccess);
     if (result != Success)
         return result;
@@ -326,12 +326,12 @@ PanoramiXReparentWindow(ClientPtr client)
 
     REQUEST_SIZE_MATCH(xReparentWindowReq);
 
-    result = dixLookupResourceByType((pointer *) &win, stuff->window,
+    result = dixLookupResourceByType((void **) &win, stuff->window,
                                      XRT_WINDOW, client, DixWriteAccess);
     if (result != Success)
         return result;
 
-    result = dixLookupResourceByType((pointer *) &parent, stuff->parent,
+    result = dixLookupResourceByType((void **) &parent, stuff->parent,
                                      XRT_WINDOW, client, DixWriteAccess);
     if (result != Success)
         return result;
@@ -365,7 +365,7 @@ PanoramiXMapWindow(ClientPtr client)
 
     REQUEST_SIZE_MATCH(xResourceReq);
 
-    result = dixLookupResourceByType((pointer *) &win, stuff->id,
+    result = dixLookupResourceByType((void **) &win, stuff->id,
                                      XRT_WINDOW, client, DixReadAccess);
     if (result != Success)
         return result;
@@ -390,7 +390,7 @@ PanoramiXMapSubwindows(ClientPtr client)
 
     REQUEST_SIZE_MATCH(xResourceReq);
 
-    result = dixLookupResourceByType((pointer *) &win, stuff->id,
+    result = dixLookupResourceByType((void **) &win, stuff->id,
                                      XRT_WINDOW, client, DixReadAccess);
     if (result != Success)
         return result;
@@ -415,7 +415,7 @@ PanoramiXUnmapWindow(ClientPtr client)
 
     REQUEST_SIZE_MATCH(xResourceReq);
 
-    result = dixLookupResourceByType((pointer *) &win, stuff->id,
+    result = dixLookupResourceByType((void **) &win, stuff->id,
                                      XRT_WINDOW, client, DixReadAccess);
     if (result != Success)
         return result;
@@ -440,7 +440,7 @@ PanoramiXUnmapSubwindows(ClientPtr client)
 
     REQUEST_SIZE_MATCH(xResourceReq);
 
-    result = dixLookupResourceByType((pointer *) &win, stuff->id,
+    result = dixLookupResourceByType((void **) &win, stuff->id,
                                      XRT_WINDOW, client, DixReadAccess);
     if (result != Success)
         return result;
@@ -474,12 +474,12 @@ PanoramiXConfigureWindow(ClientPtr client)
         return BadLength;
 
     /* because we need the parent */
-    result = dixLookupResourceByType((pointer *) &pWin, stuff->window,
+    result = dixLookupResourceByType((void **) &pWin, stuff->window,
                                      RT_WINDOW, client, DixWriteAccess);
     if (result != Success)
         return result;
 
-    result = dixLookupResourceByType((pointer *) &win, stuff->window,
+    result = dixLookupResourceByType((void **) &win, stuff->window,
                                      XRT_WINDOW, client, DixWriteAccess);
     if (result != Success)
         return result;
@@ -489,7 +489,7 @@ PanoramiXConfigureWindow(ClientPtr client)
 
         sib_offset = Ones((Mask) stuff->mask & (CWSibling - 1));
         if ((tmp = *((CARD32 *) &stuff[1] + sib_offset))) {
-            result = dixLookupResourceByType((pointer *) &sib, tmp, XRT_WINDOW,
+            result = dixLookupResourceByType((void **) &sib, tmp, XRT_WINDOW,
                                              client, DixReadAccess);
             if (result != Success)
                 return result;
@@ -537,7 +537,7 @@ PanoramiXCirculateWindow(ClientPtr client)
 
     REQUEST_SIZE_MATCH(xCirculateWindowReq);
 
-    result = dixLookupResourceByType((pointer *) &win, stuff->window,
+    result = dixLookupResourceByType((void **) &win, stuff->window,
                                      XRT_WINDOW, client, DixWriteAccess);
     if (result != Success)
         return result;
@@ -687,7 +687,7 @@ PanoramiXCreatePixmap(ClientPtr client)
     REQUEST_SIZE_MATCH(xCreatePixmapReq);
     client->errorValue = stuff->pid;
 
-    result = dixLookupResourceByClass((pointer *) &refDraw, stuff->drawable,
+    result = dixLookupResourceByClass((void **) &refDraw, stuff->drawable,
                                       XRC_DRAWABLE, client, DixReadAccess);
     if (result != Success)
         return (result == BadValue) ? BadDrawable : result;
@@ -727,7 +727,7 @@ PanoramiXFreePixmap(ClientPtr client)
 
     client->errorValue = stuff->id;
 
-    result = dixLookupResourceByType((pointer *) &pix, stuff->id, XRT_PIXMAP,
+    result = dixLookupResourceByType((void **) &pix, stuff->id, XRT_PIXMAP,
                                      client, DixDestroyAccess);
     if (result != Success)
         return result;
@@ -766,7 +766,7 @@ PanoramiXCreateGC(ClientPtr client)
     if (Ones(stuff->mask) != len)
         return BadLength;
 
-    result = dixLookupResourceByClass((pointer *) &refDraw, stuff->drawable,
+    result = dixLookupResourceByClass((void **) &refDraw, stuff->drawable,
                                       XRC_DRAWABLE, client, DixReadAccess);
     if (result != Success)
         return (result == BadValue) ? BadDrawable : result;
@@ -774,7 +774,7 @@ PanoramiXCreateGC(ClientPtr client)
     if ((Mask) stuff->mask & GCTile) {
         tile_offset = Ones((Mask) stuff->mask & (GCTile - 1));
         if ((tmp = *((CARD32 *) &stuff[1] + tile_offset))) {
-            result = dixLookupResourceByType((pointer *) &tile, tmp, XRT_PIXMAP,
+            result = dixLookupResourceByType((void **) &tile, tmp, XRT_PIXMAP,
                                              client, DixReadAccess);
             if (result != Success)
                 return result;
@@ -783,7 +783,7 @@ PanoramiXCreateGC(ClientPtr client)
     if ((Mask) stuff->mask & GCStipple) {
         stip_offset = Ones((Mask) stuff->mask & (GCStipple - 1));
         if ((tmp = *((CARD32 *) &stuff[1] + stip_offset))) {
-            result = dixLookupResourceByType((pointer *) &stip, tmp, XRT_PIXMAP,
+            result = dixLookupResourceByType((void **) &stip, tmp, XRT_PIXMAP,
                                              client, DixReadAccess);
             if (result != Success)
                 return result;
@@ -792,7 +792,7 @@ PanoramiXCreateGC(ClientPtr client)
     if ((Mask) stuff->mask & GCClipMask) {
         clip_offset = Ones((Mask) stuff->mask & (GCClipMask - 1));
         if ((tmp = *((CARD32 *) &stuff[1] + clip_offset))) {
-            result = dixLookupResourceByType((pointer *) &clip, tmp, XRT_PIXMAP,
+            result = dixLookupResourceByType((void **) &clip, tmp, XRT_PIXMAP,
                                              client, DixReadAccess);
             if (result != Success)
                 return result;
@@ -846,7 +846,7 @@ PanoramiXChangeGC(ClientPtr client)
     if (Ones(stuff->mask) != len)
         return BadLength;
 
-    result = dixLookupResourceByType((pointer *) &gc, stuff->gc, XRT_GC,
+    result = dixLookupResourceByType((void **) &gc, stuff->gc, XRT_GC,
                                      client, DixReadAccess);
     if (result != Success)
         return result;
@@ -854,7 +854,7 @@ PanoramiXChangeGC(ClientPtr client)
     if ((Mask) stuff->mask & GCTile) {
         tile_offset = Ones((Mask) stuff->mask & (GCTile - 1));
         if ((tmp = *((CARD32 *) &stuff[1] + tile_offset))) {
-            result = dixLookupResourceByType((pointer *) &tile, tmp, XRT_PIXMAP,
+            result = dixLookupResourceByType((void **) &tile, tmp, XRT_PIXMAP,
                                              client, DixReadAccess);
             if (result != Success)
                 return result;
@@ -863,7 +863,7 @@ PanoramiXChangeGC(ClientPtr client)
     if ((Mask) stuff->mask & GCStipple) {
         stip_offset = Ones((Mask) stuff->mask & (GCStipple - 1));
         if ((tmp = *((CARD32 *) &stuff[1] + stip_offset))) {
-            result = dixLookupResourceByType((pointer *) &stip, tmp, XRT_PIXMAP,
+            result = dixLookupResourceByType((void **) &stip, tmp, XRT_PIXMAP,
                                              client, DixReadAccess);
             if (result != Success)
                 return result;
@@ -872,7 +872,7 @@ PanoramiXChangeGC(ClientPtr client)
     if ((Mask) stuff->mask & GCClipMask) {
         clip_offset = Ones((Mask) stuff->mask & (GCClipMask - 1));
         if ((tmp = *((CARD32 *) &stuff[1] + clip_offset))) {
-            result = dixLookupResourceByType((pointer *) &clip, tmp, XRT_PIXMAP,
+            result = dixLookupResourceByType((void **) &clip, tmp, XRT_PIXMAP,
                                              client, DixReadAccess);
             if (result != Success)
                 return result;
@@ -905,12 +905,12 @@ PanoramiXCopyGC(ClientPtr client)
 
     REQUEST_SIZE_MATCH(xCopyGCReq);
 
-    result = dixLookupResourceByType((pointer *) &srcGC, stuff->srcGC, XRT_GC,
+    result = dixLookupResourceByType((void **) &srcGC, stuff->srcGC, XRT_GC,
                                      client, DixReadAccess);
     if (result != Success)
         return result;
 
-    result = dixLookupResourceByType((pointer *) &dstGC, stuff->dstGC, XRT_GC,
+    result = dixLookupResourceByType((void **) &dstGC, stuff->dstGC, XRT_GC,
                                      client, DixWriteAccess);
     if (result != Success)
         return result;
@@ -936,7 +936,7 @@ PanoramiXSetDashes(ClientPtr client)
 
     REQUEST_FIXED_SIZE(xSetDashesReq, stuff->nDashes);
 
-    result = dixLookupResourceByType((pointer *) &gc, stuff->gc, XRT_GC,
+    result = dixLookupResourceByType((void **) &gc, stuff->gc, XRT_GC,
                                      client, DixWriteAccess);
     if (result != Success)
         return result;
@@ -961,7 +961,7 @@ PanoramiXSetClipRectangles(ClientPtr client)
 
     REQUEST_AT_LEAST_SIZE(xSetClipRectanglesReq);
 
-    result = dixLookupResourceByType((pointer *) &gc, stuff->gc, XRT_GC,
+    result = dixLookupResourceByType((void **) &gc, stuff->gc, XRT_GC,
                                      client, DixWriteAccess);
     if (result != Success)
         return result;
@@ -986,7 +986,7 @@ PanoramiXFreeGC(ClientPtr client)
 
     REQUEST_SIZE_MATCH(xResourceReq);
 
-    result = dixLookupResourceByType((pointer *) &gc, stuff->id, XRT_GC,
+    result = dixLookupResourceByType((void **) &gc, stuff->id, XRT_GC,
                                      client, DixDestroyAccess);
     if (result != Success)
         return result;
@@ -1015,7 +1015,7 @@ PanoramiXClearToBackground(ClientPtr client)
 
     REQUEST_SIZE_MATCH(xClearAreaReq);
 
-    result = dixLookupResourceByType((pointer *) &win, stuff->window,
+    result = dixLookupResourceByType((void **) &win, stuff->window,
                                      XRT_WINDOW, client, DixWriteAccess);
     if (result != Success)
         return result;
@@ -1060,14 +1060,14 @@ PanoramiXCopyArea(ClientPtr client)
 
     REQUEST_SIZE_MATCH(xCopyAreaReq);
 
-    result = dixLookupResourceByClass((pointer *) &src, stuff->srcDrawable,
+    result = dixLookupResourceByClass((void **) &src, stuff->srcDrawable,
                                       XRC_DRAWABLE, client, DixReadAccess);
     if (result != Success)
         return (result == BadValue) ? BadDrawable : result;
 
     srcShared = IS_SHARED_PIXMAP(src);
 
-    result = dixLookupResourceByClass((pointer *) &dst, stuff->dstDrawable,
+    result = dixLookupResourceByClass((void **) &dst, stuff->dstDrawable,
                                       XRC_DRAWABLE, client, DixWriteAccess);
     if (result != Success)
         return (result == BadValue) ? BadDrawable : result;
@@ -1077,7 +1077,7 @@ PanoramiXCopyArea(ClientPtr client)
     if (dstShared && srcShared)
         return (*SavedProcVector[X_CopyArea]) (client);
 
-    result = dixLookupResourceByType((pointer *) &gc, stuff->gc, XRT_GC,
+    result = dixLookupResourceByType((void **) &gc, stuff->gc, XRT_GC,
                                      client, DixReadAccess);
     if (result != Success)
         return result;
@@ -1219,14 +1219,14 @@ PanoramiXCopyPlane(ClientPtr client)
 
     REQUEST_SIZE_MATCH(xCopyPlaneReq);
 
-    rc = dixLookupResourceByClass((pointer *) &src, stuff->srcDrawable,
+    rc = dixLookupResourceByClass((void **) &src, stuff->srcDrawable,
                                   XRC_DRAWABLE, client, DixReadAccess);
     if (rc != Success)
         return (rc == BadValue) ? BadDrawable : rc;
 
     srcShared = IS_SHARED_PIXMAP(src);
 
-    rc = dixLookupResourceByClass((pointer *) &dst, stuff->dstDrawable,
+    rc = dixLookupResourceByClass((void **) &dst, stuff->dstDrawable,
                                   XRC_DRAWABLE, client, DixWriteAccess);
     if (rc != Success)
         return (rc == BadValue) ? BadDrawable : rc;
@@ -1236,7 +1236,7 @@ PanoramiXCopyPlane(ClientPtr client)
     if (dstShared && srcShared)
         return (*SavedProcVector[X_CopyPlane]) (client);
 
-    rc = dixLookupResourceByType((pointer *) &gc, stuff->gc, XRT_GC,
+    rc = dixLookupResourceByType((void **) &gc, stuff->gc, XRT_GC,
                                  client, DixReadAccess);
     if (rc != Success)
         return rc;
@@ -1327,7 +1327,7 @@ PanoramiXPolyPoint(ClientPtr client)
 
     REQUEST_AT_LEAST_SIZE(xPolyPointReq);
 
-    result = dixLookupResourceByClass((pointer *) &draw, stuff->drawable,
+    result = dixLookupResourceByClass((void **) &draw, stuff->drawable,
                                       XRC_DRAWABLE, client, DixWriteAccess);
     if (result != Success)
         return (result == BadValue) ? BadDrawable : result;
@@ -1335,7 +1335,7 @@ PanoramiXPolyPoint(ClientPtr client)
     if (IS_SHARED_PIXMAP(draw))
         return (*SavedProcVector[X_PolyPoint]) (client);
 
-    result = dixLookupResourceByType((pointer *) &gc, stuff->gc, XRT_GC,
+    result = dixLookupResourceByType((void **) &gc, stuff->gc, XRT_GC,
                                      client, DixReadAccess);
     if (result != Success)
         return result;
@@ -1392,7 +1392,7 @@ PanoramiXPolyLine(ClientPtr client)
 
     REQUEST_AT_LEAST_SIZE(xPolyLineReq);
 
-    result = dixLookupResourceByClass((pointer *) &draw, stuff->drawable,
+    result = dixLookupResourceByClass((void **) &draw, stuff->drawable,
                                       XRC_DRAWABLE, client, DixWriteAccess);
     if (result != Success)
         return (result == BadValue) ? BadDrawable : result;
@@ -1400,7 +1400,7 @@ PanoramiXPolyLine(ClientPtr client)
     if (IS_SHARED_PIXMAP(draw))
         return (*SavedProcVector[X_PolyLine]) (client);
 
-    result = dixLookupResourceByType((pointer *) &gc, stuff->gc, XRT_GC,
+    result = dixLookupResourceByType((void **) &gc, stuff->gc, XRT_GC,
                                      client, DixReadAccess);
     if (result != Success)
         return result;
@@ -1457,7 +1457,7 @@ PanoramiXPolySegment(ClientPtr client)
 
     REQUEST_AT_LEAST_SIZE(xPolySegmentReq);
 
-    result = dixLookupResourceByClass((pointer *) &draw, stuff->drawable,
+    result = dixLookupResourceByClass((void **) &draw, stuff->drawable,
                                       XRC_DRAWABLE, client, DixWriteAccess);
     if (result != Success)
         return (result == BadValue) ? BadDrawable : result;
@@ -1465,7 +1465,7 @@ PanoramiXPolySegment(ClientPtr client)
     if (IS_SHARED_PIXMAP(draw))
         return (*SavedProcVector[X_PolySegment]) (client);
 
-    result = dixLookupResourceByType((pointer *) &gc, stuff->gc, XRT_GC,
+    result = dixLookupResourceByType((void **) &gc, stuff->gc, XRT_GC,
                                      client, DixReadAccess);
     if (result != Success)
         return result;
@@ -1525,7 +1525,7 @@ PanoramiXPolyRectangle(ClientPtr client)
 
     REQUEST_AT_LEAST_SIZE(xPolyRectangleReq);
 
-    result = dixLookupResourceByClass((pointer *) &draw, stuff->drawable,
+    result = dixLookupResourceByClass((void **) &draw, stuff->drawable,
                                       XRC_DRAWABLE, client, DixWriteAccess);
     if (result != Success)
         return (result == BadValue) ? BadDrawable : result;
@@ -1533,7 +1533,7 @@ PanoramiXPolyRectangle(ClientPtr client)
     if (IS_SHARED_PIXMAP(draw))
         return (*SavedProcVector[X_PolyRectangle]) (client);
 
-    result = dixLookupResourceByType((pointer *) &gc, stuff->gc, XRT_GC,
+    result = dixLookupResourceByType((void **) &gc, stuff->gc, XRT_GC,
                                      client, DixReadAccess);
     if (result != Success)
         return result;
@@ -1592,7 +1592,7 @@ PanoramiXPolyArc(ClientPtr client)
 
     REQUEST_AT_LEAST_SIZE(xPolyArcReq);
 
-    result = dixLookupResourceByClass((pointer *) &draw, stuff->drawable,
+    result = dixLookupResourceByClass((void **) &draw, stuff->drawable,
                                       XRC_DRAWABLE, client, DixWriteAccess);
     if (result != Success)
         return (result == BadValue) ? BadDrawable : result;
@@ -1600,7 +1600,7 @@ PanoramiXPolyArc(ClientPtr client)
     if (IS_SHARED_PIXMAP(draw))
         return (*SavedProcVector[X_PolyArc]) (client);
 
-    result = dixLookupResourceByType((pointer *) &gc, stuff->gc, XRT_GC,
+    result = dixLookupResourceByType((void **) &gc, stuff->gc, XRT_GC,
                                      client, DixReadAccess);
     if (result != Success)
         return result;
@@ -1657,7 +1657,7 @@ PanoramiXFillPoly(ClientPtr client)
 
     REQUEST_AT_LEAST_SIZE(xFillPolyReq);
 
-    result = dixLookupResourceByClass((pointer *) &draw, stuff->drawable,
+    result = dixLookupResourceByClass((void **) &draw, stuff->drawable,
                                       XRC_DRAWABLE, client, DixWriteAccess);
     if (result != Success)
         return (result == BadValue) ? BadDrawable : result;
@@ -1665,7 +1665,7 @@ PanoramiXFillPoly(ClientPtr client)
     if (IS_SHARED_PIXMAP(draw))
         return (*SavedProcVector[X_FillPoly]) (client);
 
-    result = dixLookupResourceByType((pointer *) &gc, stuff->gc, XRT_GC,
+    result = dixLookupResourceByType((void **) &gc, stuff->gc, XRT_GC,
                                      client, DixReadAccess);
     if (result != Success)
         return result;
@@ -1723,7 +1723,7 @@ PanoramiXPolyFillRectangle(ClientPtr client)
 
     REQUEST_AT_LEAST_SIZE(xPolyFillRectangleReq);
 
-    result = dixLookupResourceByClass((pointer *) &draw, stuff->drawable,
+    result = dixLookupResourceByClass((void **) &draw, stuff->drawable,
                                       XRC_DRAWABLE, client, DixWriteAccess);
     if (result != Success)
         return (result == BadValue) ? BadDrawable : result;
@@ -1731,7 +1731,7 @@ PanoramiXPolyFillRectangle(ClientPtr client)
     if (IS_SHARED_PIXMAP(draw))
         return (*SavedProcVector[X_PolyFillRectangle]) (client);
 
-    result = dixLookupResourceByType((pointer *) &gc, stuff->gc, XRT_GC,
+    result = dixLookupResourceByType((void **) &gc, stuff->gc, XRT_GC,
                                      client, DixReadAccess);
     if (result != Success)
         return result;
@@ -1790,7 +1790,7 @@ PanoramiXPolyFillArc(ClientPtr client)
 
     REQUEST_AT_LEAST_SIZE(xPolyFillArcReq);
 
-    result = dixLookupResourceByClass((pointer *) &draw, stuff->drawable,
+    result = dixLookupResourceByClass((void **) &draw, stuff->drawable,
                                       XRC_DRAWABLE, client, DixWriteAccess);
     if (result != Success)
         return (result == BadValue) ? BadDrawable : result;
@@ -1798,7 +1798,7 @@ PanoramiXPolyFillArc(ClientPtr client)
     if (IS_SHARED_PIXMAP(draw))
         return (*SavedProcVector[X_PolyFillArc]) (client);
 
-    result = dixLookupResourceByType((pointer *) &gc, stuff->gc, XRT_GC,
+    result = dixLookupResourceByType((void **) &gc, stuff->gc, XRT_GC,
                                      client, DixReadAccess);
     if (result != Success)
         return result;
@@ -1855,7 +1855,7 @@ PanoramiXPutImage(ClientPtr client)
 
     REQUEST_AT_LEAST_SIZE(xPutImageReq);
 
-    result = dixLookupResourceByClass((pointer *) &draw, stuff->drawable,
+    result = dixLookupResourceByClass((void **) &draw, stuff->drawable,
                                       XRC_DRAWABLE, client, DixWriteAccess);
     if (result != Success)
         return (result == BadValue) ? BadDrawable : result;
@@ -1863,7 +1863,7 @@ PanoramiXPutImage(ClientPtr client)
     if (IS_SHARED_PIXMAP(draw))
         return (*SavedProcVector[X_PutImage]) (client);
 
-    result = dixLookupResourceByType((pointer *) &gc, stuff->gc, XRT_GC,
+    result = dixLookupResourceByType((void **) &gc, stuff->gc, XRT_GC,
                                      client, DixReadAccess);
     if (result != Success)
         return result;
@@ -1909,7 +1909,7 @@ PanoramiXGetImage(ClientPtr client)
         return BadValue;
     }
 
-    rc = dixLookupResourceByClass((pointer *) &draw, stuff->drawable,
+    rc = dixLookupResourceByClass((void **) &draw, stuff->drawable,
                                   XRC_DRAWABLE, client, DixWriteAccess);
     if (rc != Success)
         return (rc == BadValue) ? BadDrawable : rc;
@@ -2055,7 +2055,7 @@ PanoramiXPolyText8(ClientPtr client)
 
     REQUEST_AT_LEAST_SIZE(xPolyTextReq);
 
-    result = dixLookupResourceByClass((pointer *) &draw, stuff->drawable,
+    result = dixLookupResourceByClass((void **) &draw, stuff->drawable,
                                       XRC_DRAWABLE, client, DixWriteAccess);
     if (result != Success)
         return (result == BadValue) ? BadDrawable : result;
@@ -2063,7 +2063,7 @@ PanoramiXPolyText8(ClientPtr client)
     if (IS_SHARED_PIXMAP(draw))
         return (*SavedProcVector[X_PolyText8]) (client);
 
-    result = dixLookupResourceByType((pointer *) &gc, stuff->gc, XRT_GC,
+    result = dixLookupResourceByType((void **) &gc, stuff->gc, XRT_GC,
                                      client, DixReadAccess);
     if (result != Success)
         return result;
@@ -2098,7 +2098,7 @@ PanoramiXPolyText16(ClientPtr client)
 
     REQUEST_AT_LEAST_SIZE(xPolyTextReq);
 
-    result = dixLookupResourceByClass((pointer *) &draw, stuff->drawable,
+    result = dixLookupResourceByClass((void **) &draw, stuff->drawable,
                                       XRC_DRAWABLE, client, DixWriteAccess);
     if (result != Success)
         return (result == BadValue) ? BadDrawable : result;
@@ -2106,7 +2106,7 @@ PanoramiXPolyText16(ClientPtr client)
     if (IS_SHARED_PIXMAP(draw))
         return (*SavedProcVector[X_PolyText16]) (client);
 
-    result = dixLookupResourceByType((pointer *) &gc, stuff->gc, XRT_GC,
+    result = dixLookupResourceByType((void **) &gc, stuff->gc, XRT_GC,
                                      client, DixReadAccess);
     if (result != Success)
         return result;
@@ -2141,7 +2141,7 @@ PanoramiXImageText8(ClientPtr client)
 
     REQUEST_FIXED_SIZE(xImageTextReq, stuff->nChars);
 
-    result = dixLookupResourceByClass((pointer *) &draw, stuff->drawable,
+    result = dixLookupResourceByClass((void **) &draw, stuff->drawable,
                                       XRC_DRAWABLE, client, DixWriteAccess);
     if (result != Success)
         return (result == BadValue) ? BadDrawable : result;
@@ -2149,7 +2149,7 @@ PanoramiXImageText8(ClientPtr client)
     if (IS_SHARED_PIXMAP(draw))
         return (*SavedProcVector[X_ImageText8]) (client);
 
-    result = dixLookupResourceByType((pointer *) &gc, stuff->gc, XRT_GC,
+    result = dixLookupResourceByType((void **) &gc, stuff->gc, XRT_GC,
                                      client, DixReadAccess);
     if (result != Success)
         return result;
@@ -2184,7 +2184,7 @@ PanoramiXImageText16(ClientPtr client)
 
     REQUEST_FIXED_SIZE(xImageTextReq, stuff->nChars << 1);
 
-    result = dixLookupResourceByClass((pointer *) &draw, stuff->drawable,
+    result = dixLookupResourceByClass((void **) &draw, stuff->drawable,
                                       XRC_DRAWABLE, client, DixWriteAccess);
     if (result != Success)
         return (result == BadValue) ? BadDrawable : result;
@@ -2192,7 +2192,7 @@ PanoramiXImageText16(ClientPtr client)
     if (IS_SHARED_PIXMAP(draw))
         return (*SavedProcVector[X_ImageText16]) (client);
 
-    result = dixLookupResourceByType((pointer *) &gc, stuff->gc, XRT_GC,
+    result = dixLookupResourceByType((void **) &gc, stuff->gc, XRT_GC,
                                      client, DixReadAccess);
     if (result != Success)
         return result;
@@ -2225,7 +2225,7 @@ PanoramiXCreateColormap(ClientPtr client)
 
     REQUEST_SIZE_MATCH(xCreateColormapReq);
 
-    result = dixLookupResourceByType((pointer *) &win, stuff->window,
+    result = dixLookupResourceByType((void **) &win, stuff->window,
                                      XRT_WINDOW, client, DixReadAccess);
     if (result != Success)
         return result;
@@ -2266,7 +2266,7 @@ PanoramiXFreeColormap(ClientPtr client)
 
     client->errorValue = stuff->id;
 
-    result = dixLookupResourceByType((pointer *) &cmap, stuff->id, XRT_COLORMAP,
+    result = dixLookupResourceByType((void **) &cmap, stuff->id, XRT_COLORMAP,
                                      client, DixDestroyAccess);
     if (result != Success)
         return result;
@@ -2296,7 +2296,7 @@ PanoramiXCopyColormapAndFree(ClientPtr client)
 
     client->errorValue = stuff->srcCmap;
 
-    result = dixLookupResourceByType((pointer *) &cmap, stuff->srcCmap,
+    result = dixLookupResourceByType((void **) &cmap, stuff->srcCmap,
                                      XRT_COLORMAP, client,
                                      DixReadAccess | DixWriteAccess);
     if (result != Success)
@@ -2335,7 +2335,7 @@ PanoramiXInstallColormap(ClientPtr client)
 
     client->errorValue = stuff->id;
 
-    result = dixLookupResourceByType((pointer *) &cmap, stuff->id, XRT_COLORMAP,
+    result = dixLookupResourceByType((void **) &cmap, stuff->id, XRT_COLORMAP,
                                      client, DixReadAccess);
     if (result != Success)
         return result;
@@ -2360,7 +2360,7 @@ PanoramiXUninstallColormap(ClientPtr client)
 
     client->errorValue = stuff->id;
 
-    result = dixLookupResourceByType((pointer *) &cmap, stuff->id, XRT_COLORMAP,
+    result = dixLookupResourceByType((void **) &cmap, stuff->id, XRT_COLORMAP,
                                      client, DixReadAccess);
     if (result != Success)
         return result;
@@ -2386,7 +2386,7 @@ PanoramiXAllocColor(ClientPtr client)
 
     client->errorValue = stuff->cmap;
 
-    result = dixLookupResourceByType((pointer *) &cmap, stuff->cmap,
+    result = dixLookupResourceByType((void **) &cmap, stuff->cmap,
                                      XRT_COLORMAP, client, DixWriteAccess);
     if (result != Success)
         return result;
@@ -2412,7 +2412,7 @@ PanoramiXAllocNamedColor(ClientPtr client)
 
     client->errorValue = stuff->cmap;
 
-    result = dixLookupResourceByType((pointer *) &cmap, stuff->cmap,
+    result = dixLookupResourceByType((void **) &cmap, stuff->cmap,
                                      XRT_COLORMAP, client, DixWriteAccess);
     if (result != Success)
         return result;
@@ -2438,7 +2438,7 @@ PanoramiXAllocColorCells(ClientPtr client)
 
     client->errorValue = stuff->cmap;
 
-    result = dixLookupResourceByType((pointer *) &cmap, stuff->cmap,
+    result = dixLookupResourceByType((void **) &cmap, stuff->cmap,
                                      XRT_COLORMAP, client, DixWriteAccess);
     if (result != Success)
         return result;
@@ -2464,7 +2464,7 @@ PanoramiXAllocColorPlanes(ClientPtr client)
 
     client->errorValue = stuff->cmap;
 
-    result = dixLookupResourceByType((pointer *) &cmap, stuff->cmap,
+    result = dixLookupResourceByType((void **) &cmap, stuff->cmap,
                                      XRT_COLORMAP, client, DixWriteAccess);
     if (result != Success)
         return result;
@@ -2490,7 +2490,7 @@ PanoramiXFreeColors(ClientPtr client)
 
     client->errorValue = stuff->cmap;
 
-    result = dixLookupResourceByType((pointer *) &cmap, stuff->cmap,
+    result = dixLookupResourceByType((void **) &cmap, stuff->cmap,
                                      XRT_COLORMAP, client, DixWriteAccess);
     if (result != Success)
         return result;
@@ -2514,7 +2514,7 @@ PanoramiXStoreColors(ClientPtr client)
 
     client->errorValue = stuff->cmap;
 
-    result = dixLookupResourceByType((pointer *) &cmap, stuff->cmap,
+    result = dixLookupResourceByType((void **) &cmap, stuff->cmap,
                                      XRT_COLORMAP, client, DixWriteAccess);
     if (result != Success)
         return result;
@@ -2540,7 +2540,7 @@ PanoramiXStoreNamedColor(ClientPtr client)
 
     client->errorValue = stuff->cmap;
 
-    result = dixLookupResourceByType((pointer *) &cmap, stuff->cmap,
+    result = dixLookupResourceByType((void **) &cmap, stuff->cmap,
                                      XRT_COLORMAP, client, DixWriteAccess);
     if (result != Success)
         return result;
index 7c605fe..6d93eec 100644 (file)
@@ -11,6 +11,7 @@
 extern _X_EXPORT int PanoramiXNumScreens;
 extern _X_EXPORT int PanoramiXPixWidth;
 extern _X_EXPORT int PanoramiXPixHeight;
+extern _X_EXPORT RegionRec PanoramiXScreenRegion;
 
 extern _X_EXPORT VisualID PanoramiXTranslateVisualID(int screen, VisualID orig);
 extern _X_EXPORT void PanoramiXConsolidate(void);
@@ -18,7 +19,7 @@ extern _X_EXPORT Bool PanoramiXCreateConnectionBlock(void);
 extern _X_EXPORT PanoramiXRes *PanoramiXFindIDByScrnum(RESTYPE, XID, int);
 extern _X_EXPORT Bool
 XineramaRegisterConnectionBlockCallback(void (*func) (void));
-extern _X_EXPORT int XineramaDeleteResource(pointer, XID);
+extern _X_EXPORT int XineramaDeleteResource(void *, XID);
 
 extern _X_EXPORT void XineramaReinitData(void);
 
index ac4a633..8e92fdf 100644 (file)
@@ -107,9 +107,7 @@ typedef struct _ScreenSaverSuspension {
     int count;
 } ScreenSaverSuspensionRec;
 
-static int ScreenSaverFreeSuspend(pointer /*value */ ,
-                                  XID   /* id */
-    );
+static int ScreenSaverFreeSuspend(void *value, XID id);
 
 /*
  * each screen has a list of clients requesting
@@ -131,18 +129,14 @@ typedef struct _ScreenSaverEvent {
     CARD32 mask;
 } ScreenSaverEventRec;
 
-static int ScreenSaverFreeEvents(pointer /* value */ ,
-                                 XID    /* id */
-    );
+static int ScreenSaverFreeEvents(void * value, XID id);
 
-static Bool setEventMask(ScreenPtr /* pScreen */ ,
-                         ClientPtr /* client */ ,
-                         unsigned long  /* mask */
-    );
+static Bool setEventMask(ScreenPtr      pScreen,
+                         ClientPtr      client,
+                         unsigned long  mask);
 
-static unsigned long getEventMask(ScreenPtr /* pScreen */ ,
-                                  ClientPtr     /* client */
-    );
+static unsigned long getEventMask(ScreenPtr     pScreen,
+                                  ClientPtr     client);
 
 /*
  * when a client sets the screen saver attributes, a resource is
@@ -168,21 +162,16 @@ typedef struct _ScreenSaverAttr {
     unsigned long *values;
 } ScreenSaverAttrRec, *ScreenSaverAttrPtr;
 
-static int ScreenSaverFreeAttr(pointer /* value */ ,
-                               XID      /* id */
-    );
+static int ScreenSaverFreeAttr(void *value, XID id);
 
-static void FreeAttrs(ScreenSaverAttrPtr        /* pAttr */
-    );
+static void FreeAttrs(ScreenSaverAttrPtr pAttr);
 
-static void FreeScreenAttr(ScreenSaverAttrPtr   /* pAttr */
-    );
+static void FreeScreenAttr(ScreenSaverAttrPtr pAttr);
 
 static void
- SendScreenSaverNotify(ScreenPtr /* pScreen */ ,
-                       int /* state */ ,
-                       Bool     /* forced */
-    );
+SendScreenSaverNotify(ScreenPtr pScreen,
+                      int       state,
+                      Bool      forced);
 
 typedef struct _ScreenSaverScreenPrivate {
     ScreenSaverEventPtr events;
@@ -191,8 +180,7 @@ typedef struct _ScreenSaverScreenPrivate {
     Colormap installedMap;
 } ScreenSaverScreenPrivateRec, *ScreenSaverScreenPrivatePtr;
 
-static ScreenSaverScreenPrivatePtr MakeScreenPrivate(ScreenPtr  /* pScreen */
-    );
+static ScreenSaverScreenPrivatePtr MakeScreenPrivate(ScreenPtr pScreen);
 
 static DevPrivateKeyRec ScreenPrivateKeyRec;
 
@@ -288,7 +276,7 @@ setEventMask(ScreenPtr pScreen, ClientPtr client, unsigned long mask)
             pEv->client = client;
             pEv->screen = pScreen;
             pEv->resource = FakeClientID(client->index);
-            if (!AddResource(pEv->resource, SaverEventType, (pointer) pEv))
+            if (!AddResource(pEv->resource, SaverEventType, (void *) pEv))
                 return FALSE;
         }
         pEv->mask = mask;
@@ -319,7 +307,7 @@ FreeScreenAttr(ScreenSaverAttrPtr pAttr)
 }
 
 static int
-ScreenSaverFreeEvents(pointer value, XID id)
+ScreenSaverFreeEvents(void *value, XID id)
 {
     ScreenSaverEventPtr pOld = (ScreenSaverEventPtr) value;
     ScreenPtr pScreen = pOld->screen;
@@ -341,7 +329,7 @@ ScreenSaverFreeEvents(pointer value, XID id)
 }
 
 static int
-ScreenSaverFreeAttr(pointer value, XID id)
+ScreenSaverFreeAttr(void *value, XID id)
 {
     ScreenSaverAttrPtr pOldAttr = (ScreenSaverAttrPtr) value;
     ScreenPtr pScreen = pOldAttr->screen;
@@ -363,7 +351,7 @@ ScreenSaverFreeAttr(pointer value, XID id)
 }
 
 static int
-ScreenSaverFreeSuspend(pointer value, XID id)
+ScreenSaverFreeSuspend(void *value, XID id)
 {
     ScreenSaverSuspensionPtr data = (ScreenSaverSuspensionPtr) value;
     ScreenSaverSuspensionPtr *prev, this;
@@ -392,7 +380,7 @@ ScreenSaverFreeSuspend(pointer value, XID id)
             DeviceIntPtr dev;
             UpdateCurrentTimeIf();
             nt_list_for_each_entry(dev, inputInfo.devices, next)
-                lastDeviceEventTime[dev->id] = currentTime;
+                NoticeTime(dev, currentTime);
             SetScreenSaverTimer();
         }
     }
@@ -460,7 +448,7 @@ UninstallSaverColormap(ScreenPtr pScreen)
     int rc;
 
     if (pPriv && pPriv->installedMap != None) {
-        rc = dixLookupResourceByType((pointer *) &pCmap, pPriv->installedMap,
+        rc = dixLookupResourceByType((void **) &pCmap, pPriv->installedMap,
                                      RT_COLORMAP, serverClient,
                                      DixUninstallAccess);
         if (rc == Success)
@@ -529,15 +517,16 @@ CreateSaverWindow(ScreenPtr pScreen)
         mask |= CWBorderPixmap;
     }
     if (pAttr->pCursor) {
+        CursorPtr cursor;
         if (!pWin->optional)
             if (!MakeWindowOptional(pWin)) {
                 FreeResource(pWin->drawable.id, RT_NONE);
                 return FALSE;
             }
-        pAttr->pCursor->refcnt++;
+        cursor = RefCursor(pAttr->pCursor);
         if (pWin->optional->cursor)
             FreeCursor(pWin->optional->cursor, (Cursor) 0);
-        pWin->optional->cursor = pAttr->pCursor;
+        pWin->optional->cursor = cursor;
         pWin->cursorIsNone = FALSE;
         CheckWindowOptionalNeed(pWin);
         mask |= CWCursor;
@@ -570,7 +559,7 @@ CreateSaverWindow(ScreenPtr pScreen)
     if (i < numInstalled)
         return TRUE;
 
-    result = dixLookupResourceByType((pointer *) &pCmap, wantMap, RT_COLORMAP,
+    result = dixLookupResourceByType((void **) &pCmap, wantMap, RT_COLORMAP,
                                      serverClient, DixInstallAccess);
     if (result != Success)
         return TRUE;
@@ -678,7 +667,7 @@ ProcScreenSaverQueryInfo(ClientPtr client)
     pPriv = GetScreenPrivate(pDraw->pScreen);
 
     UpdateCurrentTime();
-    lastInput = GetTimeInMillis() - lastDeviceEventTime[XIAllDevices].milliseconds;
+    lastInput = GetTimeInMillis() - LastEventTime(XIAllDevices).milliseconds;
 
     rep = (xScreenSaverQueryInfoReply) {
         .type = X_Reply,
@@ -835,7 +824,7 @@ ScreenSaverSetAttributes(ClientPtr client)
     if ((visual != ancwopt->visual) || (depth != pParent->drawable.depth)) {
         fOK = FALSE;
         for (idepth = 0; idepth < pScreen->numDepths; idepth++) {
-            pDepth = (DepthPtr) & pScreen->allowedDepths[idepth];
+            pDepth = (DepthPtr) &pScreen->allowedDepths[idepth];
             if ((depth == pDepth->depth) || (depth == 0)) {
                 for (ivisual = 0; ivisual < pDepth->numVids; ivisual++) {
                     if (visual == pDepth->vids[ivisual]) {
@@ -922,7 +911,7 @@ ScreenSaverSetAttributes(ClientPtr client)
             }
             else {
                 ret =
-                    dixLookupResourceByType((pointer *) &pPixmap, pixID,
+                    dixLookupResourceByType((void **) &pPixmap, pixID,
                                             RT_PIXMAP, client, DixReadAccess);
                 if (ret == Success) {
                     if ((pPixmap->drawable.depth != depth) ||
@@ -954,7 +943,7 @@ ScreenSaverSetAttributes(ClientPtr client)
             }
             else {
                 ret =
-                    dixLookupResourceByType((pointer *) &pPixmap, pixID,
+                    dixLookupResourceByType((void **) &pPixmap, pixID,
                                             RT_PIXMAP, client, DixReadAccess);
                 if (ret == Success) {
                     if ((pPixmap->drawable.depth != depth) ||
@@ -1038,7 +1027,7 @@ ScreenSaverSetAttributes(ClientPtr client)
             break;
         case CWColormap:
             cmap = (Colormap) * pVlist;
-            ret = dixLookupResourceByType((pointer *) &pCmap, cmap, RT_COLORMAP,
+            ret = dixLookupResourceByType((void **) &pCmap, cmap, RT_COLORMAP,
                                           client, DixUseAccess);
             if (ret != Success) {
                 client->errorValue = cmap;
@@ -1057,14 +1046,13 @@ ScreenSaverSetAttributes(ClientPtr client)
                 *values++ = None;
             }
             else {
-                ret = dixLookupResourceByType((pointer *) &pCursor, cursorID,
+                ret = dixLookupResourceByType((void **) &pCursor, cursorID,
                                               RT_CURSOR, client, DixUseAccess);
                 if (ret != Success) {
                     client->errorValue = cursorID;
                     goto PatchUp;
                 }
-                pCursor->refcnt++;
-                pAttr->pCursor = pCursor;
+                pAttr->pCursor = RefCursor(pCursor);
                 pAttr->mask &= ~CWCursor;
             }
             break;
@@ -1079,7 +1067,7 @@ ScreenSaverSetAttributes(ClientPtr client)
         FreeScreenAttr(pPriv->attr);
     pPriv->attr = pAttr;
     pAttr->resource = FakeClientID(client->index);
-    if (!AddResource(pAttr->resource, AttrType, (pointer) pAttr))
+    if (!AddResource(pAttr->resource, AttrType, (void *) pAttr))
         return BadAlloc;
     return Success;
  PatchUp:
@@ -1131,7 +1119,7 @@ ProcScreenSaverSetAttributes(ClientPtr client)
 
         REQUEST_AT_LEAST_SIZE(xScreenSaverSetAttributesReq);
 
-        status = dixLookupResourceByClass((pointer *) &draw, stuff->drawable,
+        status = dixLookupResourceByClass((void **) &draw, stuff->drawable,
                                           XRC_DRAWABLE, client, DixWriteAccess);
         if (status != Success)
             return (status == BadValue) ? BadDrawable : status;
@@ -1146,7 +1134,7 @@ ProcScreenSaverSetAttributes(ClientPtr client)
             pback_offset = Ones((Mask) stuff->mask & (CWBackPixmap - 1));
             tmp = *((CARD32 *) &stuff[1] + pback_offset);
             if ((tmp != None) && (tmp != ParentRelative)) {
-                status = dixLookupResourceByType((pointer *) &backPix, tmp,
+                status = dixLookupResourceByType((void **) &backPix, tmp,
                                                  XRT_PIXMAP, client,
                                                  DixReadAccess);
                 if (status != Success)
@@ -1158,7 +1146,7 @@ ProcScreenSaverSetAttributes(ClientPtr client)
             pbord_offset = Ones((Mask) stuff->mask & (CWBorderPixmap - 1));
             tmp = *((CARD32 *) &stuff[1] + pbord_offset);
             if (tmp != CopyFromParent) {
-                status = dixLookupResourceByType((pointer *) &bordPix, tmp,
+                status = dixLookupResourceByType((void **) &bordPix, tmp,
                                                  XRT_PIXMAP, client,
                                                  DixReadAccess);
                 if (status != Success)
@@ -1170,7 +1158,7 @@ ProcScreenSaverSetAttributes(ClientPtr client)
             cmap_offset = Ones((Mask) stuff->mask & (CWColormap - 1));
             tmp = *((CARD32 *) &stuff[1] + cmap_offset);
             if ((tmp != CopyFromParent) && (tmp != None)) {
-                status = dixLookupResourceByType((pointer *) &cmap, tmp,
+                status = dixLookupResourceByType((void **) &cmap, tmp,
                                                  XRT_COLORMAP, client,
                                                  DixReadAccess);
                 if (status != Success)
@@ -1211,7 +1199,7 @@ ProcScreenSaverUnsetAttributes(ClientPtr client)
         PanoramiXRes *draw;
         int rc, i;
 
-        rc = dixLookupResourceByClass((pointer *) &draw, stuff->drawable,
+        rc = dixLookupResourceByClass((void **) &draw, stuff->drawable,
                                       XRC_DRAWABLE, client, DixWriteAccess);
         if (rc != Success)
             return (rc == BadValue) ? BadDrawable : rc;
@@ -1270,7 +1258,7 @@ ProcScreenSaverSuspend(ClientPtr client)
     this->count = 1;
     this->clientResource = FakeClientID(client->index);
 
-    if (!AddResource(this->clientResource, SuspendType, (pointer) this)) {
+    if (!AddResource(this->clientResource, SuspendType, (void *) this)) {
         free(this);
         return BadAlloc;
     }
index 6cc9aa0..421b252 100644 (file)
@@ -57,8 +57,9 @@ static DevPrivateKeyRec stateKeyRec;
 
 /* This is what we store as client security state */
 typedef struct {
-    int haveState;
-    unsigned int trustLevel;
+    unsigned int haveState  :1;
+    unsigned int live       :1;
+    unsigned int trustLevel :2;
     XID authId;
 } SecurityStateRec;
 
@@ -141,6 +142,7 @@ SecurityLabelInitial(void)
     state = dixLookupPrivate(&serverClient->devPrivates, stateKey);
     state->trustLevel = XSecurityClientTrusted;
     state->haveState = TRUE;
+    state->live = FALSE;
 }
 
 /*
@@ -165,7 +167,7 @@ SecurityLookupRequestName(ClientPtr client)
  */
 
 static int
-SecurityDeleteAuthorization(pointer value, XID id)
+SecurityDeleteAuthorization(void *value, XID id)
 {
     SecurityAuthorizationPtr pAuth = (SecurityAuthorizationPtr) value;
     unsigned short name_len, data_len;
@@ -219,7 +221,7 @@ SecurityDeleteAuthorization(pointer value, XID id)
 
 /* resource delete function for RTEventClient */
 static int
-SecurityDeleteAuthorizationEventClient(pointer value, XID id)
+SecurityDeleteAuthorizationEventClient(void *value, XID id)
 {
     OtherClientsPtr pEventClient, prev = NULL;
     SecurityAuthorizationPtr pAuth = (SecurityAuthorizationPtr) value;
@@ -292,7 +294,7 @@ SecurityComputeAuthorizationTimeout(SecurityAuthorizationPtr pAuth,
  */
 
 static CARD32
-SecurityAuthorizationExpired(OsTimerPtr timer, CARD32 time, pointer pval)
+SecurityAuthorizationExpired(OsTimerPtr timer, CARD32 time, void *pval)
 {
     SecurityAuthorizationPtr pAuth = (SecurityAuthorizationPtr) pval;
 
@@ -380,7 +382,7 @@ SecurityEventSelectForAuthorization(SecurityAuthorizationPtr pAuth,
     pEventClient->mask = mask;
     pEventClient->resource = FakeClientID(client->index);
     pEventClient->next = pAuth->eventClients;
-    if (!AddResource(pEventClient->resource, RTEventClient, (pointer) pAuth)) {
+    if (!AddResource(pEventClient->resource, RTEventClient, (void *) pAuth)) {
         free(pEventClient);
         return BadAlloc;
     }
@@ -452,7 +454,7 @@ ProcSecurityGenerateAuthorization(ClientPtr client)
 
             vgi.group = group;
             vgi.valid = FALSE;
-            CallCallbacks(&SecurityValidateGroupCallback, (pointer) &vgi);
+            CallCallbacks(&SecurityValidateGroupCallback, (void *) &vgi);
 
             /* if nobody said they recognized it, it's an error */
 
@@ -573,7 +575,7 @@ ProcSecurityRevokeAuthorization(ClientPtr client)
 
     REQUEST_SIZE_MATCH(xSecurityRevokeAuthorizationReq);
 
-    rc = dixLookupResourceByType((pointer *) &pAuth, stuff->authId,
+    rc = dixLookupResourceByType((void **) &pAuth, stuff->authId,
                                  SecurityAuthorizationResType, client,
                                  DixDestroyAccess);
     if (rc != Success)
@@ -691,7 +693,7 @@ SwapSecurityAuthorizationRevokedEvent(xSecurityAuthorizationRevokedEvent * from,
  */
 
 static void
-SecurityDevice(CallbackListPtr *pcbl, pointer unused, pointer calldata)
+SecurityDevice(CallbackListPtr *pcbl, void *unused, void *calldata)
 {
     XaceDeviceAccessRec *rec = calldata;
     SecurityStateRec *subj, *obj;
@@ -735,7 +737,7 @@ SecurityDevice(CallbackListPtr *pcbl, pointer unused, pointer calldata)
  */
 
 static void
-SecurityResource(CallbackListPtr *pcbl, pointer unused, pointer calldata)
+SecurityResource(CallbackListPtr *pcbl, void *unused, void *calldata)
 {
     XaceResourceAccessRec *rec = calldata;
     SecurityStateRec *subj, *obj;
@@ -783,7 +785,7 @@ SecurityResource(CallbackListPtr *pcbl, pointer unused, pointer calldata)
 }
 
 static void
-SecurityExtension(CallbackListPtr *pcbl, pointer unused, pointer calldata)
+SecurityExtension(CallbackListPtr *pcbl, void *unused, void *calldata)
 {
     XaceExtAccessRec *rec = calldata;
     SecurityStateRec *subj;
@@ -806,7 +808,7 @@ SecurityExtension(CallbackListPtr *pcbl, pointer unused, pointer calldata)
 }
 
 static void
-SecurityServer(CallbackListPtr *pcbl, pointer unused, pointer calldata)
+SecurityServer(CallbackListPtr *pcbl, void *unused, void *calldata)
 {
     XaceServerAccessRec *rec = calldata;
     SecurityStateRec *subj, *obj;
@@ -825,7 +827,7 @@ SecurityServer(CallbackListPtr *pcbl, pointer unused, pointer calldata)
 }
 
 static void
-SecurityClient(CallbackListPtr *pcbl, pointer unused, pointer calldata)
+SecurityClient(CallbackListPtr *pcbl, void *unused, void *calldata)
 {
     XaceClientAccessRec *rec = calldata;
     SecurityStateRec *subj, *obj;
@@ -844,7 +846,7 @@ SecurityClient(CallbackListPtr *pcbl, pointer unused, pointer calldata)
 }
 
 static void
-SecurityProperty(CallbackListPtr *pcbl, pointer unused, pointer calldata)
+SecurityProperty(CallbackListPtr *pcbl, void *unused, void *calldata)
 {
     XacePropertyAccessRec *rec = calldata;
     SecurityStateRec *subj, *obj;
@@ -866,7 +868,7 @@ SecurityProperty(CallbackListPtr *pcbl, pointer unused, pointer calldata)
 }
 
 static void
-SecuritySend(CallbackListPtr *pcbl, pointer unused, pointer calldata)
+SecuritySend(CallbackListPtr *pcbl, void *unused, void *calldata)
 {
     XaceSendAccessRec *rec = calldata;
     SecurityStateRec *subj, *obj;
@@ -898,7 +900,7 @@ SecuritySend(CallbackListPtr *pcbl, pointer unused, pointer calldata)
 }
 
 static void
-SecurityReceive(CallbackListPtr *pcbl, pointer unused, pointer calldata)
+SecurityReceive(CallbackListPtr *pcbl, void *unused, void *calldata)
 {
     XaceReceiveAccessRec *rec = calldata;
     SecurityStateRec *subj, *obj;
@@ -939,7 +941,7 @@ SecurityReceive(CallbackListPtr *pcbl, pointer unused, pointer calldata)
  */
 
 static void
-SecurityClientState(CallbackListPtr *pcbl, pointer unused, pointer calldata)
+SecurityClientState(CallbackListPtr *pcbl, void *unused, void *calldata)
 {
     NewClientInfoRec *pci = calldata;
     SecurityStateRec *state;
@@ -953,16 +955,18 @@ SecurityClientState(CallbackListPtr *pcbl, pointer unused, pointer calldata)
         state->trustLevel = XSecurityClientTrusted;
         state->authId = None;
         state->haveState = TRUE;
+        state->live = FALSE;
         break;
 
     case ClientStateRunning:
         state->authId = AuthorizationIDOfClient(pci->client);
-        rc = dixLookupResourceByType((pointer *) &pAuth, state->authId,
+        rc = dixLookupResourceByType((void **) &pAuth, state->authId,
                                      SecurityAuthorizationResType, serverClient,
                                      DixGetAttrAccess);
         if (rc == Success) {
             /* it is a generated authorization */
             pAuth->refcnt++;
+            state->live = TRUE;
             if (pAuth->refcnt == 1 && pAuth->timer)
                 TimerCancel(pAuth->timer);
 
@@ -972,12 +976,13 @@ SecurityClientState(CallbackListPtr *pcbl, pointer unused, pointer calldata)
 
     case ClientStateGone:
     case ClientStateRetained:
-        rc = dixLookupResourceByType((pointer *) &pAuth, state->authId,
+        rc = dixLookupResourceByType((void **) &pAuth, state->authId,
                                      SecurityAuthorizationResType, serverClient,
                                      DixGetAttrAccess);
-        if (rc == Success) {
+        if (rc == Success && state->live) {
             /* it is a generated authorization */
             pAuth->refcnt--;
+            state->live = FALSE;
             if (pAuth->refcnt == 0)
                 SecurityStartAuthorizationTimer(pAuth);
         }
index d36867c..bb479b1 100644 (file)
@@ -50,11 +50,11 @@ in this Software without prior written authorization from The Open Group.
 typedef RegionPtr (*CreateDftPtr) (WindowPtr    /* pWin */
     );
 
-static int ShapeFreeClient(pointer /* data */ ,
-                           XID  /* id */
+static int ShapeFreeClient(void * /* data */ ,
+                           XID    /* id */
     );
-static int ShapeFreeEvents(pointer /* data */ ,
-                           XID  /* id */
+static int ShapeFreeEvents(void * /* data */ ,
+                           XID    /* id */
     );
 static void SShapeNotifyEvent(xShapeNotifyEvent * /* from */ ,
                               xShapeNotifyEvent *       /* to */
@@ -306,7 +306,7 @@ ProcPanoramiXShapeRectangles(ClientPtr client)
 
     REQUEST_AT_LEAST_SIZE(xShapeRectanglesReq);
 
-    result = dixLookupResourceByType((pointer *) &win, stuff->dest, XRT_WINDOW,
+    result = dixLookupResourceByType((void **) &win, stuff->dest, XRT_WINDOW,
                                      client, DixWriteAccess);
     if (result != Success)
         return result;
@@ -361,7 +361,7 @@ ProcShapeMask(ClientPtr client)
     if (stuff->src == None)
         srcRgn = 0;
     else {
-        rc = dixLookupResourceByType((pointer *) &pPixmap, stuff->src,
+        rc = dixLookupResourceByType((void **) &pPixmap, stuff->src,
                                      RT_PIXMAP, client, DixReadAccess);
         if (rc != Success)
             return rc;
@@ -404,13 +404,13 @@ ProcPanoramiXShapeMask(ClientPtr client)
 
     REQUEST_SIZE_MATCH(xShapeMaskReq);
 
-    result = dixLookupResourceByType((pointer *) &win, stuff->dest, XRT_WINDOW,
+    result = dixLookupResourceByType((void **) &win, stuff->dest, XRT_WINDOW,
                                      client, DixWriteAccess);
     if (result != Success)
         return result;
 
     if (stuff->src != None) {
-        result = dixLookupResourceByType((pointer *) &pmap, stuff->src,
+        result = dixLookupResourceByType((void **) &pmap, stuff->src,
                                          XRT_PIXMAP, client, DixReadAccess);
         if (result != Success)
             return result;
@@ -532,12 +532,12 @@ ProcPanoramiXShapeCombine(ClientPtr client)
 
     REQUEST_AT_LEAST_SIZE(xShapeCombineReq);
 
-    result = dixLookupResourceByType((pointer *) &win, stuff->dest, XRT_WINDOW,
+    result = dixLookupResourceByType((void **) &win, stuff->dest, XRT_WINDOW,
                                      client, DixWriteAccess);
     if (result != Success)
         return result;
 
-    result = dixLookupResourceByType((pointer *) &win2, stuff->src, XRT_WINDOW,
+    result = dixLookupResourceByType((void **) &win2, stuff->src, XRT_WINDOW,
                                      client, DixReadAccess);
     if (result != Success)
         return result;
@@ -603,7 +603,7 @@ ProcPanoramiXShapeOffset(ClientPtr client)
 
     REQUEST_AT_LEAST_SIZE(xShapeOffsetReq);
 
-    result = dixLookupResourceByType((pointer *) &win, stuff->dest, XRT_WINDOW,
+    result = dixLookupResourceByType((void **) &win, stuff->dest, XRT_WINDOW,
                                      client, DixWriteAccess);
     if (result != Success)
         return result;
@@ -686,7 +686,7 @@ ProcShapeQueryExtents(ClientPtr client)
 }
 
  /*ARGSUSED*/ static int
-ShapeFreeClient(pointer data, XID id)
+ShapeFreeClient(void *data, XID id)
 {
     ShapeEventPtr pShapeEvent;
     WindowPtr pWin;
@@ -695,7 +695,7 @@ ShapeFreeClient(pointer data, XID id)
 
     pShapeEvent = (ShapeEventPtr) data;
     pWin = pShapeEvent->window;
-    rc = dixLookupResourceByType((pointer *) &pHead, pWin->drawable.id,
+    rc = dixLookupResourceByType((void **) &pHead, pWin->drawable.id,
                                  ShapeEventType, serverClient, DixReadAccess);
     if (rc == Success) {
         pPrev = 0;
@@ -708,12 +708,12 @@ ShapeFreeClient(pointer data, XID id)
                 *pHead = pShapeEvent->next;
         }
     }
-    free((pointer) pShapeEvent);
+    free((void *) pShapeEvent);
     return 1;
 }
 
  /*ARGSUSED*/ static int
-ShapeFreeEvents(pointer data, XID id)
+ShapeFreeEvents(void *data, XID id)
 {
     ShapeEventPtr *pHead, pCur, pNext;
 
@@ -721,9 +721,9 @@ ShapeFreeEvents(pointer data, XID id)
     for (pCur = *pHead; pCur; pCur = pNext) {
         pNext = pCur->next;
         FreeResource(pCur->clientResource, ClientType);
-        free((pointer) pCur);
+        free((void *) pCur);
     }
-    free((pointer) pHead);
+    free((void *) pHead);
     return 1;
 }
 
@@ -740,7 +740,7 @@ ProcShapeSelectInput(ClientPtr client)
     rc = dixLookupWindow(&pWin, stuff->window, client, DixReceiveAccess);
     if (rc != Success)
         return rc;
-    rc = dixLookupResourceByType((pointer *) &pHead, pWin->drawable.id,
+    rc = dixLookupResourceByType((void **) &pHead, pWin->drawable.id,
                                  ShapeEventType, client, DixWriteAccess);
     if (rc != Success && rc != BadValue)
         return rc;
@@ -770,10 +770,10 @@ ProcShapeSelectInput(ClientPtr client)
          */
         clientResource = FakeClientID(client->index);
         pNewShapeEvent->clientResource = clientResource;
-        if (!AddResource(clientResource, ClientType, (pointer) pNewShapeEvent))
+        if (!AddResource(clientResource, ClientType, (void *) pNewShapeEvent))
             return BadAlloc;
         /*
-         * create a resource to contain a pointer to the list
+         * create a resource to contain a void *to the list
          * of clients selecting input.  This must be indirect as
          * the list may be arbitrarily rearranged which cannot be
          * done through the resource database.
@@ -782,7 +782,7 @@ ProcShapeSelectInput(ClientPtr client)
             pHead = malloc(sizeof(ShapeEventPtr));
             if (!pHead ||
                 !AddResource(pWin->drawable.id, ShapeEventType,
-                             (pointer) pHead)) {
+                             (void *) pHead)) {
                 FreeResource(clientResource, RT_NONE);
                 return BadAlloc;
             }
@@ -831,7 +831,7 @@ SendShapeNotify(WindowPtr pWin, int which)
     BYTE shaped;
     int rc;
 
-    rc = dixLookupResourceByType((pointer *) &pHead, pWin->drawable.id,
+    rc = dixLookupResourceByType((void **) &pHead, pWin->drawable.id,
                                  ShapeEventType, serverClient, DixReadAccess);
     if (rc != Success)
         return;
@@ -910,7 +910,7 @@ ProcShapeInputSelected(ClientPtr client)
     rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
     if (rc != Success)
         return rc;
-    rc = dixLookupResourceByType((pointer *) &pHead, pWin->drawable.id,
+    rc = dixLookupResourceByType((void **) &pHead, pWin->drawable.id,
                                  ShapeEventType, client, DixReadAccess);
     if (rc != Success && rc != BadValue)
         return rc;
index 3fa04b9..4dad8b6 100644 (file)
@@ -37,6 +37,7 @@ in this Software without prior written authorization from The Open Group.
 #include <sys/shm.h>
 #include <unistd.h>
 #include <sys/stat.h>
+#include <fcntl.h>
 #include <X11/X.h>
 #include <X11/Xproto.h>
 #include "misc.h"
@@ -53,7 +54,9 @@ in this Software without prior written authorization from The Open Group.
 #include "xace.h"
 #include <X11/extensions/shmproto.h>
 #include <X11/Xfuncproto.h>
+#include <sys/mman.h>
 #include "protocol-versions.h"
+#include "busfault.h"
 
 /* Needed for Solaris cross-zone shared memory extension */
 #ifdef HAVE_SHMCTL64
@@ -89,15 +92,6 @@ in this Software without prior written authorization from The Open Group.
 
 #include "extinit.h"
 
-typedef struct _ShmDesc {
-    struct _ShmDesc *next;
-    int shmid;
-    int refcnt;
-    char *addr;
-    Bool writable;
-    unsigned long size;
-} ShmDescRec, *ShmDescPtr;
-
 typedef struct _ShmScrPrivateRec {
     CloseScreenProcPtr CloseScreen;
     ShmFuncsPtr shmFuncs;
@@ -105,14 +99,10 @@ typedef struct _ShmScrPrivateRec {
 } ShmScrPrivateRec;
 
 static PixmapPtr fbShmCreatePixmap(XSHM_CREATE_PIXMAP_ARGS);
-static int ShmDetachSegment(pointer /* value */ ,
-                            XID /* shmseg */
-    );
-static void ShmResetProc(ExtensionEntry *       /* extEntry */
-    );
-static void SShmCompletionEvent(xShmCompletionEvent * /* from */ ,
-                                xShmCompletionEvent *   /* to */
-    );
+static int ShmDetachSegment(void *value, XID shmseg);
+static void ShmResetProc(ExtensionEntry *extEntry);
+static void SShmCompletionEvent(xShmCompletionEvent *from,
+                                xShmCompletionEvent *to);
 
 static Bool ShmDestroyPixmap(PixmapPtr pPixmap);
 
@@ -135,11 +125,11 @@ static ShmFuncs fbFuncs = { fbShmCreatePixmap, NULL };
 
 #define VERIFY_SHMSEG(shmseg,shmdesc,client) \
 { \
-    int rc; \
-    rc = dixLookupResourceByType((pointer *)&(shmdesc), shmseg, ShmSegType, \
-                                 client, DixReadAccess); \
-    if (rc != Success) \
-       return rc; \
+    int tmprc; \
+    tmprc = dixLookupResourceByType((void **)&(shmdesc), shmseg, ShmSegType, \
+                                    client, DixReadAccess); \
+    if (tmprc != Success) \
+       return tmprc; \
 }
 
 #define VERIFY_SHMPTR(shmseg,offset,needwrite,shmdesc,client) \
@@ -266,7 +256,7 @@ ShmDestroyPixmap(PixmapPtr pPixmap)
         shmdesc = (ShmDescPtr) dixLookupPrivate(&pPixmap->devPrivates,
                                                 shmPixmapPrivateKey);
         if (shmdesc)
-            ShmDetachSegment((pointer) shmdesc, pPixmap->drawable.id);
+            ShmDetachSegment((void *) shmdesc, pPixmap->drawable.id);
     }
 
     pScreen->DestroyPixmap = screen_priv->destroyPixmap;
@@ -391,8 +381,10 @@ ProcShmAttach(ClientPtr client)
         client->errorValue = stuff->readOnly;
         return BadValue;
     }
-    for (shmdesc = Shmsegs;
-         shmdesc && (shmdesc->shmid != stuff->shmid); shmdesc = shmdesc->next);
+    for (shmdesc = Shmsegs; shmdesc; shmdesc = shmdesc->next) {
+        if (!SHMDESC_IS_FD(shmdesc) && shmdesc->shmid == stuff->shmid)
+            break;
+    }
     if (shmdesc) {
         if (!stuff->readOnly && !shmdesc->writable)
             return BadAccess;
@@ -402,6 +394,9 @@ ProcShmAttach(ClientPtr client)
         shmdesc = malloc(sizeof(ShmDescRec));
         if (!shmdesc)
             return BadAlloc;
+#ifdef SHM_FD_PASSING
+        shmdesc->is_fd = FALSE;
+#endif
         shmdesc->addr = shmat(stuff->shmid, 0,
                               stuff->readOnly ? SHM_RDONLY : 0);
         if ((shmdesc->addr == ((char *) -1)) || SHMSTAT(stuff->shmid, &buf)) {
@@ -426,13 +421,13 @@ ProcShmAttach(ClientPtr client)
         shmdesc->next = Shmsegs;
         Shmsegs = shmdesc;
     }
-    if (!AddResource(stuff->shmseg, ShmSegType, (pointer) shmdesc))
+    if (!AddResource(stuff->shmseg, ShmSegType, (void *) shmdesc))
         return BadAlloc;
     return Success;
 }
 
  /*ARGSUSED*/ static int
-ShmDetachSegment(pointer value, /* must conform to DeleteType */
+ShmDetachSegment(void *value, /* must conform to DeleteType */
                  XID shmseg)
 {
     ShmDescPtr shmdesc = (ShmDescPtr) value;
@@ -440,7 +435,14 @@ ShmDetachSegment(pointer value, /* must conform to DeleteType */
 
     if (--shmdesc->refcnt)
         return TRUE;
-    shmdt(shmdesc->addr);
+#if SHM_FD_PASSING
+    if (shmdesc->is_fd) {
+        if (shmdesc->busfault)
+            busfault_unregister(shmdesc->busfault);
+        munmap(shmdesc->addr, shmdesc->size);
+    } else
+#endif
+        shmdt(shmdesc->addr);
     for (prev = &Shmsegs; *prev != shmdesc; prev = &(*prev)->next);
     *prev = shmdesc->next;
     free(shmdesc);
@@ -723,12 +725,12 @@ ProcPanoramiXShmPutImage(ClientPtr client)
     REQUEST(xShmPutImageReq);
     REQUEST_SIZE_MATCH(xShmPutImageReq);
 
-    result = dixLookupResourceByClass((pointer *) &draw, stuff->drawable,
+    result = dixLookupResourceByClass((void **) &draw, stuff->drawable,
                                       XRC_DRAWABLE, client, DixWriteAccess);
     if (result != Success)
         return (result == BadValue) ? BadDrawable : result;
 
-    result = dixLookupResourceByType((pointer *) &gc, stuff->gc,
+    result = dixLookupResourceByType((void **) &gc, stuff->gc,
                                      XRT_GC, client, DixReadAccess);
     if (result != Success)
         return result;
@@ -777,7 +779,7 @@ ProcPanoramiXShmGetImage(ClientPtr client)
         return BadValue;
     }
 
-    rc = dixLookupResourceByClass((pointer *) &draw, stuff->drawable,
+    rc = dixLookupResourceByClass((void **) &draw, stuff->drawable,
                                   XRC_DRAWABLE, client, DixWriteAccess);
     if (rc != Success)
         return (rc == BadValue) ? BadDrawable : rc;
@@ -974,7 +976,7 @@ ProcPanoramiXShmCreatePixmap(ClientPtr client)
             shmdesc->refcnt++;
             pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
             pMap->drawable.id = newPix->info[j].id;
-            if (!AddResource(newPix->info[j].id, RT_PIXMAP, (pointer) pMap)) {
+            if (!AddResource(newPix->info[j].id, RT_PIXMAP, (void *) pMap)) {
                 result = BadAlloc;
                 break;
             }
@@ -1010,7 +1012,7 @@ fbShmCreatePixmap(ScreenPtr pScreen,
     if (!(*pScreen->ModifyPixmapHeader) (pPixmap, width, height, depth,
                                          BitsPerPixel(depth),
                                          PixmapBytePad(width, depth),
-                                         (pointer) addr)) {
+                                         (void *) addr)) {
         (*pScreen->DestroyPixmap) (pPixmap);
         return NullPixmap;
     }
@@ -1089,13 +1091,189 @@ ProcShmCreatePixmap(ClientPtr client)
         shmdesc->refcnt++;
         pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
         pMap->drawable.id = stuff->pid;
-        if (AddResource(stuff->pid, RT_PIXMAP, (pointer) pMap)) {
+        if (AddResource(stuff->pid, RT_PIXMAP, (void *) pMap)) {
             return Success;
         }
     }
     return BadAlloc;
 }
 
+#ifdef SHM_FD_PASSING
+
+static void
+ShmBusfaultNotify(void *context)
+{
+    ShmDescPtr shmdesc = context;
+
+    ErrorF("shared memory 0x%x truncated by client\n",
+           (unsigned int) shmdesc->resource);
+    busfault_unregister(shmdesc->busfault);
+    shmdesc->busfault = NULL;
+    FreeResource (shmdesc->resource, RT_NONE);
+}
+
+static int
+ProcShmAttachFd(ClientPtr client)
+{
+    int fd;
+    ShmDescPtr shmdesc;
+    REQUEST(xShmAttachFdReq);
+    struct stat statb;
+
+    SetReqFds(client, 1);
+    REQUEST_SIZE_MATCH(xShmAttachFdReq);
+    LEGAL_NEW_RESOURCE(stuff->shmseg, client);
+    if ((stuff->readOnly != xTrue) && (stuff->readOnly != xFalse)) {
+        client->errorValue = stuff->readOnly;
+        return BadValue;
+    }
+    fd = ReadFdFromClient(client);
+    if (fd < 0)
+        return BadMatch;
+
+    if (fstat(fd, &statb) < 0 || statb.st_size == 0) {
+        close(fd);
+        return BadMatch;
+    }
+
+    shmdesc = malloc(sizeof(ShmDescRec));
+    if (!shmdesc) {
+        close(fd);
+        return BadAlloc;
+    }
+    shmdesc->is_fd = TRUE;
+    shmdesc->addr = mmap(NULL, statb.st_size,
+                         stuff->readOnly ? PROT_READ : PROT_READ|PROT_WRITE,
+                         MAP_SHARED,
+                         fd, 0);
+
+    close(fd);
+    if ((shmdesc->addr == ((char *) -1))) {
+        free(shmdesc);
+        return BadAccess;
+    }
+
+    shmdesc->refcnt = 1;
+    shmdesc->writable = !stuff->readOnly;
+    shmdesc->size = statb.st_size;
+    shmdesc->resource = stuff->shmseg;
+
+    shmdesc->busfault = busfault_register_mmap(shmdesc->addr, shmdesc->size, ShmBusfaultNotify, shmdesc);
+    if (!shmdesc->busfault) {
+        munmap(shmdesc->addr, shmdesc->size);
+        free(shmdesc);
+        return BadAlloc;
+    }
+
+    shmdesc->next = Shmsegs;
+    Shmsegs = shmdesc;
+
+    if (!AddResource(stuff->shmseg, ShmSegType, (void *) shmdesc))
+        return BadAlloc;
+    return Success;
+}
+
+static int
+shm_tmpfile(void)
+{
+#ifdef SHMDIR
+       int     fd;
+       int     flags;
+       char    template[] = SHMDIR "/shmfd-XXXXXX";
+#ifdef O_TMPFILE
+       fd = open(SHMDIR, O_TMPFILE|O_RDWR|O_CLOEXEC|O_EXCL, 0666);
+       if (fd >= 0) {
+               ErrorF ("Using O_TMPFILE\n");
+               return fd;
+       }
+       ErrorF ("Not using O_TMPFILE\n");
+#endif
+       fd = mkstemp(template);
+       if (fd < 0)
+               return -1;
+       unlink(template);
+       if (fcntl(fd, F_GETFD, &flags) >= 0) {
+               flags |= FD_CLOEXEC;
+               (void) fcntl(fd, F_SETFD, &flags);
+       }
+       return fd;
+#else
+        return -1;
+#endif
+}
+
+static int
+ProcShmCreateSegment(ClientPtr client)
+{
+    int fd;
+    ShmDescPtr shmdesc;
+    REQUEST(xShmCreateSegmentReq);
+    xShmCreateSegmentReply rep = {
+        .type = X_Reply,
+        .nfd = 1,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+    };
+
+    REQUEST_SIZE_MATCH(xShmCreateSegmentReq);
+    if ((stuff->readOnly != xTrue) && (stuff->readOnly != xFalse)) {
+        client->errorValue = stuff->readOnly;
+        return BadValue;
+    }
+    fd = shm_tmpfile();
+    if (fd < 0)
+        return BadAlloc;
+    if (ftruncate(fd, stuff->size) < 0) {
+        close(fd);
+        return BadAlloc;
+    }
+    shmdesc = malloc(sizeof(ShmDescRec));
+    if (!shmdesc) {
+        close(fd);
+        return BadAlloc;
+    }
+    shmdesc->is_fd = TRUE;
+    shmdesc->addr = mmap(NULL, stuff->size,
+                         stuff->readOnly ? PROT_READ : PROT_READ|PROT_WRITE,
+                         MAP_SHARED,
+                         fd, 0);
+
+    if ((shmdesc->addr == ((char *) -1))) {
+        close(fd);
+        free(shmdesc);
+        return BadAccess;
+    }
+
+    shmdesc->refcnt = 1;
+    shmdesc->writable = !stuff->readOnly;
+    shmdesc->size = stuff->size;
+
+    shmdesc->busfault = busfault_register_mmap(shmdesc->addr, shmdesc->size, ShmBusfaultNotify, shmdesc);
+    if (!shmdesc->busfault) {
+        close(fd);
+        munmap(shmdesc->addr, shmdesc->size);
+        free(shmdesc);
+        return BadAlloc;
+    }
+
+    shmdesc->next = Shmsegs;
+    Shmsegs = shmdesc;
+
+    if (!AddResource(stuff->shmseg, ShmSegType, (void *) shmdesc)) {
+        close(fd);
+        return BadAlloc;
+    }
+
+    if (WriteFdToClient(client, fd, TRUE) < 0) {
+        FreeResource(stuff->shmseg, RT_NONE);
+        close(fd);
+        return BadAlloc;
+    }
+    WriteToClient(client, sizeof (xShmCreateSegmentReply), &rep);
+    return Success;
+}
+#endif /* SHM_FD_PASSING */
+
 static int
 ProcShmDispatch(ClientPtr client)
 {
@@ -1125,6 +1303,12 @@ ProcShmDispatch(ClientPtr client)
             return ProcPanoramiXShmCreatePixmap(client);
 #endif
         return ProcShmCreatePixmap(client);
+#ifdef SHM_FD_PASSING
+    case X_ShmAttachFd:
+        return ProcShmAttachFd(client);
+    case X_ShmCreateSegment:
+        return ProcShmCreateSegment(client);
+#endif
     default:
         return BadRequest;
     }
@@ -1225,6 +1409,30 @@ SProcShmCreatePixmap(ClientPtr client)
     return ProcShmCreatePixmap(client);
 }
 
+#ifdef SHM_FD_PASSING
+static int
+SProcShmAttachFd(ClientPtr client)
+{
+    REQUEST(xShmAttachFdReq);
+    SetReqFds(client, 1);
+    swaps(&stuff->length);
+    REQUEST_SIZE_MATCH(xShmAttachFdReq);
+    swapl(&stuff->shmseg);
+    return ProcShmAttachFd(client);
+}
+
+static int
+SProcShmCreateSegment(ClientPtr client)
+{
+    REQUEST(xShmCreateSegmentReq);
+    swaps(&stuff->length);
+    REQUEST_SIZE_MATCH(xShmCreateSegmentReq);
+    swapl(&stuff->shmseg);
+    swapl(&stuff->size);
+    return ProcShmCreateSegment(client);
+}
+#endif  /* SHM_FD_PASSING */
+
 static int
 SProcShmDispatch(ClientPtr client)
 {
@@ -1242,6 +1450,12 @@ SProcShmDispatch(ClientPtr client)
         return SProcShmGetImage(client);
     case X_ShmCreatePixmap:
         return SProcShmCreatePixmap(client);
+#ifdef SHM_FD_PASSING
+    case X_ShmAttachFd:
+        return SProcShmAttachFd(client);
+    case X_ShmCreateSegment:
+        return SProcShmCreateSegment(client);
+#endif
     default:
         return BadRequest;
     }
index fa6941c..9dadea7 100644 (file)
@@ -56,6 +56,30 @@ typedef struct _ShmFuncs {
     void (*PutImage) (XSHM_PUT_IMAGE_ARGS);
 } ShmFuncs, *ShmFuncsPtr;
 
+#if XTRANS_SEND_FDS
+#define SHM_FD_PASSING  1
+#endif
+
+typedef struct _ShmDesc {
+    struct _ShmDesc *next;
+    int shmid;
+    int refcnt;
+    char *addr;
+    Bool writable;
+    unsigned long size;
+#ifdef SHM_FD_PASSING
+    Bool is_fd;
+    struct busfault *busfault;
+    XID resource;
+#endif
+} ShmDescRec, *ShmDescPtr;
+
+#ifdef SHM_FD_PASSING
+#define SHMDESC_IS_FD(shmdesc)  ((shmdesc)->is_fd)
+#else
+#define SHMDESC_IS_FD(shmdesc)  (0)
+#endif
+
 extern _X_EXPORT void
  ShmRegisterFuncs(ScreenPtr pScreen, ShmFuncsPtr funcs);
 
index 52e22b4..993c028 100644 (file)
@@ -46,10 +46,10 @@ typedef struct _Sertafied {
     ClientPtr pClient;
     XID id;
     void (*notifyFunc) (ClientPtr /* client */ ,
-                        pointer /* closure */
+                        void *    /* closure */
         );
 
-    pointer closure;
+    void *closure;
 } SertafiedRec, *SertafiedPtr;
 
 static SertafiedPtr pPending;
@@ -58,24 +58,24 @@ static Bool BlockHandlerRegistered;
 static int SertafiedGeneration;
 
 static void ClientAwaken(ClientPtr /* client */ ,
-                         pointer        /* closure */
+                         void *    /* closure */
     );
-static int SertafiedDelete(pointer /* value */ ,
-                           XID  /* id */
+static int SertafiedDelete(void *  /* value */ ,
+                           XID     /* id */
     );
-static void SertafiedBlockHandler(pointer /* data */ ,
+static void SertafiedBlockHandler(void *    /* data */ ,
                                   OSTimePtr /* wt */ ,
-                                  pointer       /* LastSelectMask */
+                                  void *    /* LastSelectMask */
     );
-static void SertafiedWakeupHandler(pointer /* data */ ,
-                                   int /* i */ ,
-                                   pointer      /* LastSelectMask */
+static void SertafiedWakeupHandler(void *   /* data */ ,
+                                   int      /* i */ ,
+                                   void *   /* LastSelectMask */
     );
 
 int
 ClientSleepUntil(ClientPtr client,
                  TimeStamp *revive,
-                 void (*notifyFunc) (ClientPtr, pointer), pointer closure)
+                 void (*notifyFunc) (ClientPtr, void *), void *closure)
 {
     SertafiedPtr pRequest, pReq, pPrev;
 
@@ -97,14 +97,14 @@ ClientSleepUntil(ClientPtr client,
     if (!BlockHandlerRegistered) {
         if (!RegisterBlockAndWakeupHandlers(SertafiedBlockHandler,
                                             SertafiedWakeupHandler,
-                                            (pointer) 0)) {
+                                            (void *) 0)) {
             free(pRequest);
             return FALSE;
         }
         BlockHandlerRegistered = TRUE;
     }
     pRequest->notifyFunc = 0;
-    if (!AddResource(pRequest->id, SertafiedResType, (pointer) pRequest))
+    if (!AddResource(pRequest->id, SertafiedResType, (void *) pRequest))
         return FALSE;
     if (!notifyFunc)
         notifyFunc = ClientAwaken;
@@ -126,14 +126,14 @@ ClientSleepUntil(ClientPtr client,
 }
 
 static void
-ClientAwaken(ClientPtr client, pointer closure)
+ClientAwaken(ClientPtr client, void *closure)
 {
     if (!client->clientGone)
         AttendClient(client);
 }
 
 static int
-SertafiedDelete(pointer value, XID id)
+SertafiedDelete(void *value, XID id)
 {
     SertafiedPtr pRequest = (SertafiedPtr) value;
     SertafiedPtr pReq, pPrev;
@@ -154,7 +154,7 @@ SertafiedDelete(pointer value, XID id)
 }
 
 static void
-SertafiedBlockHandler(pointer data, OSTimePtr wt, pointer LastSelectMask)
+SertafiedBlockHandler(void *data, OSTimePtr wt, void *LastSelectMask)
 {
     SertafiedPtr pReq, pNext;
     unsigned long delay;
@@ -186,7 +186,7 @@ SertafiedBlockHandler(pointer data, OSTimePtr wt, pointer LastSelectMask)
 }
 
 static void
-SertafiedWakeupHandler(pointer data, int i, pointer LastSelectMask)
+SertafiedWakeupHandler(void *data, int i, void *LastSelectMask)
 {
     SertafiedPtr pReq, pNext;
     TimeStamp now;
@@ -203,7 +203,7 @@ SertafiedWakeupHandler(pointer data, int i, pointer LastSelectMask)
     }
     if (!pPending) {
         RemoveBlockAndWakeupHandlers(SertafiedBlockHandler,
-                                     SertafiedWakeupHandler, (pointer) 0);
+                                     SertafiedWakeupHandler, (void *) 0);
         BlockHandlerRegistered = FALSE;
     }
 }
index 5c70848..e9b8388 100644 (file)
@@ -36,7 +36,7 @@
 extern int ClientSleepUntil(ClientPtr client,
                             TimeStamp *revive,
                             void (*notifyFunc) (ClientPtr /* client */ ,
-                                                pointer /* closure */
-                            ), pointer Closure);
+                                                void *    /* closure */
+                            ), void *Closure);
 
 #endif
diff --git a/Xext/smack_util.c b/Xext/smack_util.c
new file mode 100644 (file)
index 0000000..be6e29a
--- /dev/null
@@ -0,0 +1,217 @@
+/*
+ * Copyright (c) 2015 Samsung
+ * Copyright (c) 2011 Intel Corporation
+ * Copyright (c) 2011 Casey Schaufler
+ *
+ * Author: JengHyun Kang <jhyuni.kang@samsung.com>
+ *             Casey Schaufler <casey@schaufler-ca.com>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * this permission notice appear in supporting documentation.  This permission
+ * notice 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
+ * AUTHOR 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.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <sys/socket.h>
+#include <sys/stat.h>
+#include <sys/xattr.h>
+#include <stdio.h>
+#include <stdarg.h>
+
+#include <X11/Xatom.h>
+#include "selection.h"
+#include "inputstr.h"
+#include "scrnintstr.h"
+#include "windowstr.h"
+#include "propertyst.h"
+#include "extnsionst.h"
+#include "xacestr.h"
+#include "client.h"
+#include "../os/osdep.h"
+#include "smack_util.h"
+
+#include <fcntl.h>
+#include <unistd.h>
+
+char access_buff[ABSIZE];
+int does_not_have_smack;
+
+static inline char *
+SmackUtilString(SmackUtilLabel *label)
+{
+    return (char *)&label->label;
+}
+
+static inline void
+SmackUtilCopyString(SmackUtilLabel *to, const char *from)
+{
+    strncpy(SmackUtilString(to), from, SMACK_SIZE);
+}
+
+static int
+SmackUtilHaveAccess (SmackUtilSubjectRec *subj, const char *object,
+                 const char *access)
+{
+    int ret;
+    int access_fd;
+
+    if (does_not_have_smack)
+        return 1;
+
+    snprintf (access_buff, ABSIZE, "%s %s %s", (char *)&subj->smack, object, access);
+
+    access_fd = open("/sys/fs/smackfs/access2", O_RDWR);
+    if (access_fd < 0)
+        access_fd = open("/smack/access2", O_RDWR);
+    if (access_fd < 0)
+    {
+        ErrorF ("Smack access checking is unavailable.\n");
+        does_not_have_smack = 1;
+        return 1;
+    }
+
+    ret = write(access_fd, access_buff, strlen(access_buff) + 1);
+    if (ret < 0)
+    {
+        ErrorF ("(\"%s\") fd=%d = %d \"%s\"\n",
+                    access_buff, access_fd, ret, subj->command);
+        close(access_fd);
+        return -1;
+    }
+
+    ret = read(access_fd, access_buff, ABSIZE);
+    if (ret < 0)
+    {
+        ErrorF ("(\"%s %s %s\") %d \"%s\"\n",
+                    (char *)&subj->smack, object, access, ret, subj->command);
+        close(access_fd);
+        return -1;
+    }
+#ifdef SMACK_UTIL_DEBUG
+    ErrorF ("(\"%s %s %s\") '%c' \"%s\"\n",
+               (char *)&subj->smack, object, access, access_buff[0], subj->command);
+#endif //SMACK_UTIL_DEBUG
+
+    close(access_fd);
+
+    return access_buff[0] == '1';
+}
+
+static int
+SmackUtilDoCheck(SmackUtilSubjectRec *subj, const char *object, Mask mode)
+{
+    char *subject = SmackUtilString(&subj->smack);
+    char access[6] = "-----";
+    int rc;
+
+    access[0] = (mode & DixReadAccess) ? 'r' : '-';
+    access[1] = (mode & DixWriteAccess) ? 'w' : '-';
+
+#ifdef SMACK_UTIL_DEBUG
+    ErrorF("(\"%s %s %s\") \"%s\" privileged('%s')\n",
+               (char *)&subj->smack, object, access, subj->command,
+               (subj->privileged)?"yes":"no");
+#endif //SMACK_UTIL_DEBUG
+
+    /* Privileged subjects get access */
+#ifndef _F_DO_NOT_PASS_PRIVILEGE_CHECK_FROM_ROOT_
+    if (subj->privileged)
+    {
+        return Success;
+    }
+#endif //_F_PASS_PRIVILEGE_CHECK_FROM_ROOT_
+    rc = SmackUtilHaveAccess(subj, object, access);
+    if (rc <= 0)
+        return BadValue;
+
+    return Success;
+}
+
+static void
+SmackUtilClientLabel(ClientPtr client, SmackUtilSubjectRec *subj)
+{
+    int fd = XaceGetConnectionNumber(client);
+    const char *cmdname;
+    Bool cached;
+    pid_t pid;
+    char path[SMACK_SIZE];
+    struct ucred peercred;
+    socklen_t len;
+    int rc;
+
+    /*
+     * What to use where nothing can be discovered
+     */
+    SmackUtilCopyString(&subj->smack, "_");
+
+    /*
+     * First try is to get the Smack label from
+     * the packet label.
+     */
+    len = SMACK_SIZE;
+    rc = getsockopt(fd, SOL_SOCKET, SO_PEERSEC, path, &len);
+
+    if (rc >= 0 && len > 0 && !(len == 1 && path[0] == '\0'))
+    {
+        path[len] = '\0';
+        SmackUtilCopyString(&subj->smack, path);
+    }
+
+    len = sizeof(peercred);
+    rc = getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &peercred, &len);
+    if (rc >= 0)
+    {
+        if (peercred.uid == 0)
+            subj->privileged = 1;
+    }
+
+    /* For local clients, try and determine the executable name */
+    if (XaceIsLocal(client))
+    {
+        /* Get cached command name if CLIENTIDS is enabled. */
+        cmdname = GetClientCmdName(client);
+        cached = (cmdname != NULL);
+        /* If CLIENTIDS is disabled, figure out the command name from
+        * scratch. */
+        if (!cmdname)
+        {
+            pid = DetermineClientPid(client);
+            if (pid != -1)
+                DetermineClientCmd(pid, &cmdname, NULL);
+        }
+
+        if (!cmdname)
+            return;
+
+        strncpy(subj->command, cmdname, COMMAND_LEN - 1);
+
+        if (!cached)
+            free((void *) cmdname); /* const char * */
+    }
+}
+
+int
+SmackUtilHaveAuthority(ClientPtr client, const char *object, Mask mode)
+{
+    int res = 0;
+    SmackUtilSubjectRec subj;
+
+    SmackUtilClientLabel(client, &subj);
+
+    res = SmackUtilDoCheck(&subj, object, mode);
+
+    return res;
+}
+
diff --git a/Xext/smack_util.h b/Xext/smack_util.h
new file mode 100644 (file)
index 0000000..f5ce358
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2015 Samsung
+ * Copyright (c) 2011 Intel Corporation
+ * Copyright (c) 2011 Casey Schaufler
+ *
+ * Author: JengHyun Kang <jhyuni.kang@samsung.com>
+ *             Casey Schaufler <casey@schaufler-ca.com>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * this permission notice appear in supporting documentation.  This permission
+ * notice 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
+ * AUTHOR 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 _SMACK_UTIL_H
+#define _SMACK_UTIL_H
+
+#define COMMAND_LEN 64
+#define SMACK_SIZE 256
+#define ABSIZE SMACK_SIZE + SMACK_SIZE + 10
+
+typedef struct {
+    CARD8   label[SMACK_SIZE];
+} SmackUtilLabel;
+
+/* subject state (clients and devices only) */
+typedef struct {
+    SmackUtilLabel smack;
+    char command[COMMAND_LEN];
+    int privileged;
+} SmackUtilSubjectRec;
+
+int SmackUtilHaveAuthority(ClientPtr client, const char *object, Mask mode);
+
+#endif /* _SMACK_UTIL_H */
index 4d11992..755ed94 100644 (file)
@@ -141,7 +141,7 @@ SyncCheckWarnIsCounter(const SyncObject * pSync, const char *warning)
  *  interested in the counter.  The two functions below are used to
  *  delete and add triggers on this list.
  */
-static void
+void
 SyncDeleteTriggerFromSyncObject(SyncTrigger * pTrigger)
 {
     SyncTriggerList *pCur;
@@ -184,7 +184,7 @@ SyncDeleteTriggerFromSyncObject(SyncTrigger * pTrigger)
     }
 }
 
-static int
+int
 SyncAddTriggerToSyncObject(SyncTrigger * pTrigger)
 {
     SyncTriggerList *pCur;
@@ -324,7 +324,7 @@ SyncInitTrigger(ClientPtr client, SyncTrigger * pTrigger, XID syncObject,
     if (changes & XSyncCACounter) {
         if (syncObject == None)
             pSync = NULL;
-        else if (Success != (rc = dixLookupResourceByType((pointer *) &pSync,
+        else if (Success != (rc = dixLookupResourceByType((void **) &pSync,
                                                           syncObject, resType,
                                                           client,
                                                           DixReadAccess))) {
@@ -344,7 +344,7 @@ SyncInitTrigger(ClientPtr client, SyncTrigger * pTrigger, XID syncObject,
         pCounter = (SyncCounter *) pSync;
 
         if (IsSystemCounter(pCounter)) {
-            (*pCounter->pSysCounterInfo->QueryValue) ((pointer) pCounter,
+            (*pCounter->pSysCounterInfo->QueryValue) ((void *) pCounter,
                                                       &pCounter->value);
         }
     }
@@ -699,6 +699,14 @@ SyncAwaitTriggerFired(SyncTrigger * pTrigger)
     FreeResource(pAwaitUnion->header.delete_id, RT_NONE);
 }
 
+static CARD64
+SyncUpdateCounter(SyncCounter *pCounter, CARD64 newval)
+{
+    CARD64 oldval = pCounter->value;
+    pCounter->value = newval;
+    return oldval;
+}
+
 /*  This function should always be used to change a counter's value so that
  *  any triggers depending on the counter will be checked.
  */
@@ -708,8 +716,7 @@ SyncChangeCounter(SyncCounter * pCounter, CARD64 newval)
     SyncTriggerList *ptl, *pnext;
     CARD64 oldval;
 
-    oldval = pCounter->value;
-    pCounter->value = newval;
+    oldval = SyncUpdateCounter(pCounter, newval);
 
     /* run through triggers to see if any become true */
     for (ptl = pCounter->sync.pTriglist; ptl; ptl = pnext) {
@@ -909,6 +916,42 @@ SyncCreate(ClientPtr client, XID id, unsigned char type)
     return pSync;
 }
 
+int
+SyncCreateFenceFromFD(ClientPtr client, DrawablePtr pDraw, XID id, int fd, BOOL initially_triggered)
+{
+#if HAVE_XSHMFENCE
+    SyncFence  *pFence;
+    int         status;
+
+    pFence = (SyncFence *) SyncCreate(client, id, SYNC_FENCE);
+    if (!pFence)
+        return BadAlloc;
+
+    status = miSyncInitFenceFromFD(pDraw, pFence, fd, initially_triggered);
+    if (status != Success) {
+        dixFreeObjectWithPrivates(pFence, PRIVATE_SYNC_FENCE);
+        return status;
+    }
+
+    if (!AddResource(id, RTFence, (void *) pFence))
+        return BadAlloc;
+
+    return Success;
+#else
+    return BadImplementation;
+#endif
+}
+
+int
+SyncFDFromFence(ClientPtr client, DrawablePtr pDraw, SyncFence *pFence)
+{
+#if HAVE_XSHMFENCE
+    return miSyncFDFromFence(pDraw, pFence);
+#else
+    return BadImplementation;
+#endif
+}
+
 static SyncCounter *
 SyncCreateCounter(ClientPtr client, XSyncCounter id, CARD64 initialvalue)
 {
@@ -920,7 +963,7 @@ SyncCreateCounter(ClientPtr client, XSyncCounter id, CARD64 initialvalue)
     pCounter->value = initialvalue;
     pCounter->pSysCounterInfo = NULL;
 
-    if (!AddResource(id, RTCounter, (pointer) pCounter))
+    if (!AddResource(id, RTCounter, (void *) pCounter))
         return NULL;
 
     return pCounter;
@@ -980,7 +1023,7 @@ SyncCreateSystemCounter(const char *name,
 }
 
 void
-SyncDestroySystemCounter(pointer pSysCounter)
+SyncDestroySystemCounter(void *pSysCounter)
 {
     SyncCounter *pCounter = (SyncCounter *) pSysCounter;
 
@@ -1019,6 +1062,11 @@ SyncComputeBracketValues(SyncCounter * pCounter)
                 psci->bracket_greater = pTrigger->test_value;
                 pnewgtval = &psci->bracket_greater;
             }
+            else if (XSyncValueGreaterThan(pCounter->value, pTrigger->test_value) &&
+                     XSyncValueGreaterThan(pTrigger->test_value, psci->bracket_less)) {
+                    psci->bracket_less = pTrigger->test_value;
+                    pnewltval = &psci->bracket_less;
+            }
         }
         else if (pTrigger->test_type == XSyncNegativeComparison &&
                  ct != XSyncCounterNeverDecreases) {
@@ -1028,52 +1076,53 @@ SyncComputeBracketValues(SyncCounter * pCounter)
                 psci->bracket_less = pTrigger->test_value;
                 pnewltval = &psci->bracket_less;
             }
+            else if (XSyncValueLessThan(pCounter->value, pTrigger->test_value) &&
+                     XSyncValueLessThan(pTrigger->test_value, psci->bracket_greater)) {
+                    psci->bracket_greater = pTrigger->test_value;
+                    pnewgtval = &psci->bracket_greater;
+            }
         }
         else if (pTrigger->test_type == XSyncNegativeTransition &&
                  ct != XSyncCounterNeverIncreases) {
-            if (XSyncValueGreaterThan(pCounter->value, pTrigger->test_value) &&
-                XSyncValueGreaterThan(pTrigger->test_value, psci->bracket_less))
-            {
-                psci->bracket_less = pTrigger->test_value;
-                pnewltval = &psci->bracket_less;
+            if (XSyncValueGreaterOrEqual(pCounter->value, pTrigger->test_value) &&
+                XSyncValueGreaterThan(pTrigger->test_value, psci->bracket_less)) {
+                    /*
+                     * If the value is exactly equal to our threshold, we want one
+                     * more event in the negative direction to ensure we pick up
+                     * when the value is less than this threshold.
+                     */
+                    psci->bracket_less = pTrigger->test_value;
+                    pnewltval = &psci->bracket_less;
             }
-            else if (XSyncValueEqual(pCounter->value, pTrigger->test_value) &&
-                     XSyncValueGreaterThan(pTrigger->test_value,
-                                           psci->bracket_less)) {
-                /*
-                 * The value is exactly equal to our threshold.  We want one
-                 * more event in the negative direction to ensure we pick up
-                 * when the value is less than this threshold.
-                 */
-                psci->bracket_less = pTrigger->test_value;
-                pnewltval = &psci->bracket_less;
+            else if (XSyncValueLessThan(pCounter->value, pTrigger->test_value) &&
+                     XSyncValueLessThan(pTrigger->test_value, psci->bracket_greater)) {
+                    psci->bracket_greater = pTrigger->test_value;
+                    pnewgtval = &psci->bracket_greater;
             }
         }
         else if (pTrigger->test_type == XSyncPositiveTransition &&
                  ct != XSyncCounterNeverDecreases) {
-            if (XSyncValueLessThan(pCounter->value, pTrigger->test_value) &&
-                XSyncValueLessThan(pTrigger->test_value, psci->bracket_greater))
-            {
-                psci->bracket_greater = pTrigger->test_value;
-                pnewgtval = &psci->bracket_greater;
+            if (XSyncValueLessOrEqual(pCounter->value, pTrigger->test_value) &&
+                XSyncValueLessThan(pTrigger->test_value, psci->bracket_greater)) {
+                    /*
+                     * If the value is exactly equal to our threshold, we
+                     * want one more event in the positive direction to
+                     * ensure we pick up when the value *exceeds* this
+                     * threshold.
+                     */
+                    psci->bracket_greater = pTrigger->test_value;
+                    pnewgtval = &psci->bracket_greater;
             }
-            else if (XSyncValueEqual(pCounter->value, pTrigger->test_value) &&
-                     XSyncValueLessThan(pTrigger->test_value,
-                                        psci->bracket_greater)) {
-                /*
-                 * The value is exactly equal to our threshold.  We want one
-                 * more event in the positive direction to ensure we pick up
-                 * when the value *exceeds* this threshold.
-                 */
-                psci->bracket_greater = pTrigger->test_value;
-                pnewgtval = &psci->bracket_greater;
+            else if (XSyncValueGreaterThan(pCounter->value, pTrigger->test_value) &&
+                     XSyncValueGreaterThan(pTrigger->test_value, psci->bracket_less)) {
+                    psci->bracket_less = pTrigger->test_value;
+                    pnewltval = &psci->bracket_less;
             }
         }
     }                           /* end for each trigger */
 
-    if (pnewgtval || pnewltval) {
-        (*psci->BracketValues) ((pointer) pCounter, pnewltval, pnewgtval);
-    }
+    (*psci->BracketValues) ((void *) pCounter, pnewltval, pnewgtval);
+
 }
 
 /*
@@ -1382,7 +1431,7 @@ ProcSyncSetCounter(ClientPtr client)
 
     REQUEST_SIZE_MATCH(xSyncSetCounterReq);
 
-    rc = dixLookupResourceByType((pointer *) &pCounter, stuff->cid, RTCounter,
+    rc = dixLookupResourceByType((void **) &pCounter, stuff->cid, RTCounter,
                                  client, DixWriteAccess);
     if (rc != Success)
         return rc;
@@ -1411,7 +1460,7 @@ ProcSyncChangeCounter(ClientPtr client)
 
     REQUEST_SIZE_MATCH(xSyncChangeCounterReq);
 
-    rc = dixLookupResourceByType((pointer *) &pCounter, stuff->cid, RTCounter,
+    rc = dixLookupResourceByType((void **) &pCounter, stuff->cid, RTCounter,
                                  client, DixWriteAccess);
     if (rc != Success)
         return rc;
@@ -1444,7 +1493,7 @@ ProcSyncDestroyCounter(ClientPtr client)
 
     REQUEST_SIZE_MATCH(xSyncDestroyCounterReq);
 
-    rc = dixLookupResourceByType((pointer *) &pCounter, stuff->counter,
+    rc = dixLookupResourceByType((void **) &pCounter, stuff->counter,
                                  RTCounter, client, DixDestroyAccess);
     if (rc != Success)
         return rc;
@@ -1605,14 +1654,14 @@ ProcSyncQueryCounter(ClientPtr client)
 
     REQUEST_SIZE_MATCH(xSyncQueryCounterReq);
 
-    rc = dixLookupResourceByType((pointer *) &pCounter, stuff->counter,
+    rc = dixLookupResourceByType((void **) &pCounter, stuff->counter,
                                  RTCounter, client, DixReadAccess);
     if (rc != Success)
         return rc;
 
     /* if system counter, ask it what the current value is */
     if (IsSystemCounter(pCounter)) {
-        (*pCounter->pSysCounterInfo->QueryValue) ((pointer) pCounter,
+        (*pCounter->pSysCounterInfo->QueryValue) ((void *) pCounter,
                                                   &pCounter->value);
     }
 
@@ -1731,7 +1780,7 @@ ProcSyncChangeAlarm(ClientPtr client)
 
     REQUEST_AT_LEAST_SIZE(xSyncChangeAlarmReq);
 
-    status = dixLookupResourceByType((pointer *) &pAlarm, stuff->alarm, RTAlarm,
+    status = dixLookupResourceByType((void **) &pAlarm, stuff->alarm, RTAlarm,
                                      client, DixWriteAccess);
     if (status != Success)
         return status;
@@ -1772,7 +1821,7 @@ ProcSyncQueryAlarm(ClientPtr client)
 
     REQUEST_SIZE_MATCH(xSyncQueryAlarmReq);
 
-    rc = dixLookupResourceByType((pointer *) &pAlarm, stuff->alarm, RTAlarm,
+    rc = dixLookupResourceByType((void **) &pAlarm, stuff->alarm, RTAlarm,
                                  client, DixReadAccess);
     if (rc != Success)
         return rc;
@@ -1830,7 +1879,7 @@ ProcSyncDestroyAlarm(ClientPtr client)
 
     REQUEST_SIZE_MATCH(xSyncDestroyAlarmReq);
 
-    rc = dixLookupResourceByType((pointer *) &pAlarm, stuff->alarm, RTAlarm,
+    rc = dixLookupResourceByType((void **) &pAlarm, stuff->alarm, RTAlarm,
                                  client, DixDestroyAccess);
     if (rc != Success)
         return rc;
@@ -1860,7 +1909,7 @@ ProcSyncCreateFence(ClientPtr client)
 
     miSyncInitFence(pDraw->pScreen, pFence, stuff->initially_triggered);
 
-    if (!AddResource(stuff->fid, RTFence, (pointer) pFence))
+    if (!AddResource(stuff->fid, RTFence, (void *) pFence))
         return BadAlloc;
 
     return client->noClientException;
@@ -1879,7 +1928,7 @@ FreeFence(void *obj, XID id)
 int
 SyncVerifyFence(SyncFence ** ppSyncFence, XID fid, ClientPtr client, Mask mode)
 {
-    int rc = dixLookupResourceByType((pointer *) ppSyncFence, fid, RTFence,
+    int rc = dixLookupResourceByType((void **) ppSyncFence, fid, RTFence,
                                      client, mode);
 
     if (rc != Success)
@@ -1897,7 +1946,7 @@ ProcSyncTriggerFence(ClientPtr client)
 
     REQUEST_SIZE_MATCH(xSyncTriggerFenceReq);
 
-    rc = dixLookupResourceByType((pointer *) &pFence, stuff->fid, RTFence,
+    rc = dixLookupResourceByType((void **) &pFence, stuff->fid, RTFence,
                                  client, DixWriteAccess);
     if (rc != Success)
         return rc;
@@ -1916,7 +1965,7 @@ ProcSyncResetFence(ClientPtr client)
 
     REQUEST_SIZE_MATCH(xSyncResetFenceReq);
 
-    rc = dixLookupResourceByType((pointer *) &pFence, stuff->fid, RTFence,
+    rc = dixLookupResourceByType((void **) &pFence, stuff->fid, RTFence,
                                  client, DixWriteAccess);
     if (rc != Success)
         return rc;
@@ -1938,7 +1987,7 @@ ProcSyncDestroyFence(ClientPtr client)
 
     REQUEST_SIZE_MATCH(xSyncDestroyFenceReq);
 
-    rc = dixLookupResourceByType((pointer *) &pFence, stuff->fid, RTFence,
+    rc = dixLookupResourceByType((void **) &pFence, stuff->fid, RTFence,
                                  client, DixDestroyAccess);
     if (rc != Success)
         return rc;
@@ -1957,7 +2006,7 @@ ProcSyncQueryFence(ClientPtr client)
 
     REQUEST_SIZE_MATCH(xSyncQueryFenceReq);
 
-    rc = dixLookupResourceByType((pointer *) &pFence, stuff->fid,
+    rc = dixLookupResourceByType((void **) &pFence, stuff->fid,
                                  RTFence, client, DixReadAccess);
     if (rc != Success)
         return rc;
@@ -2506,7 +2555,7 @@ SyncExtensionInit(void)
  * ***** SERVERTIME implementation - should go in its own file in OS directory?
  */
 
-static pointer ServertimeCounter;
+static void *ServertimeCounter;
 static XSyncValue Now;
 static XSyncValue *pnext_time;
 
@@ -2607,7 +2656,7 @@ typedef struct {
 } IdleCounterPriv;
 
 static void
-IdleTimeQueryValue(pointer pCounter, CARD64 * pValue_return)
+IdleTimeQueryValue(void *pCounter, CARD64 * pValue_return)
 {
     int deviceid;
     CARD32 idle;
@@ -2619,12 +2668,12 @@ IdleTimeQueryValue(pointer pCounter, CARD64 * pValue_return)
     }
     else
         deviceid = XIAllDevices;
-    idle = GetTimeInMillis() - lastDeviceEventTime[deviceid].milliseconds;
+    idle = GetTimeInMillis() - LastEventTime(deviceid).milliseconds;
     XSyncIntsToValue(pValue_return, idle, 0);
 }
 
 static void
-IdleTimeBlockHandler(pointer pCounter, struct timeval **wt, pointer LastSelectMask)
+IdleTimeBlockHandler(void *pCounter, struct timeval **wt, void *LastSelectMask)
 {
     SyncCounter *counter = pCounter;
     IdleCounterPriv *priv = SysCounterGetPrivate(counter);
@@ -2638,10 +2687,19 @@ IdleTimeBlockHandler(pointer pCounter, struct timeval **wt, pointer LastSelectMa
         return;
 
     old_idle = counter->value;
-    IdleTimeQueryValue(NULL, &idle);
+    IdleTimeQueryValue(counter, &idle);
     counter->value = idle;      /* push, so CheckTrigger works */
 
-    if (less && XSyncValueLessOrEqual(idle, *less)) {
+    /**
+     * There's an indefinite amount of time between ProcessInputEvents()
+     * where the idle time is reset and the time we actually get here. idle
+     * may be past the lower bracket if we dawdled with the events, so
+     * check for whether we did reset and bomb out of select immediately.
+     */
+    if (less && XSyncValueGreaterThan(idle, *less) &&
+        LastEventTimeWasReset(priv->deviceid)) {
+        AdjustWaitForDelay(wt, 0);
+    } else if (less && XSyncValueLessOrEqual(idle, *less)) {
         /*
          * We've been idle for less than the threshold value, and someone
          * wants to know about that, but now we need to know whether they
@@ -2673,34 +2731,42 @@ IdleTimeBlockHandler(pointer pCounter, struct timeval **wt, pointer LastSelectMa
          * If we've been idle more than it, and someone wants to know about
          * that level-triggered, schedule an immediate wakeup.
          */
-        unsigned long timeout = -1;
 
         if (XSyncValueLessThan(idle, *greater)) {
             XSyncValue value;
             Bool overflow;
 
             XSyncValueSubtract(&value, *greater, idle, &overflow);
-            timeout = min(timeout, XSyncValueLow32(value));
+            AdjustWaitForDelay(wt, XSyncValueLow32(value));
         }
         else {
             for (list = counter->sync.pTriglist; list;
                  list = list->next) {
                 trig = list->pTrigger;
                 if (trig->CheckTrigger(trig, old_idle)) {
-                    timeout = min(timeout, 0);
+                    AdjustWaitForDelay(wt, 0);
                     break;
                 }
             }
         }
-
-        AdjustWaitForDelay(wt, timeout);
     }
 
     counter->value = old_idle;  /* pop */
 }
 
 static void
-IdleTimeWakeupHandler(pointer pCounter, int rc, pointer LastSelectMask)
+IdleTimeCheckBrackets(SyncCounter *counter, XSyncValue idle, XSyncValue *less, XSyncValue *greater)
+{
+    if ((greater && XSyncValueGreaterOrEqual(idle, *greater)) ||
+        (less && XSyncValueLessOrEqual(idle, *less))) {
+        SyncChangeCounter(counter, idle);
+    }
+    else
+        SyncUpdateCounter(counter, idle);
+}
+
+static void
+IdleTimeWakeupHandler(void *pCounter, int rc, void *LastSelectMask)
 {
     SyncCounter *counter = pCounter;
     IdleCounterPriv *priv = SysCounterGetPrivate(counter);
@@ -2713,14 +2779,28 @@ IdleTimeWakeupHandler(pointer pCounter, int rc, pointer LastSelectMask)
 
     IdleTimeQueryValue(pCounter, &idle);
 
-    if ((greater && XSyncValueGreaterOrEqual(idle, *greater)) ||
-        (less && XSyncValueLessOrEqual(idle, *less))) {
-        SyncChangeCounter(counter, idle);
+    /*
+      There is no guarantee for the WakeupHandler to be called within a specific
+      timeframe. Idletime may go to 0, but by the time we get here, it may be
+      non-zero and alarms for a pos. transition on 0 won't get triggered.
+      https://bugs.freedesktop.org/show_bug.cgi?id=70476
+      */
+    if (LastEventTimeWasReset(priv->deviceid)) {
+        LastEventTimeToggleResetFlag(priv->deviceid, FALSE);
+        if (!XSyncValueIsZero(idle)) {
+            XSyncValue zero;
+            XSyncIntsToValue(&zero, 0, 0);
+            IdleTimeCheckBrackets(counter, zero, less, greater);
+            less = priv->value_less;
+            greater = priv->value_greater;
+        }
     }
+
+    IdleTimeCheckBrackets(counter, idle, less, greater);
 }
 
 static void
-IdleTimeBracketValues(pointer pCounter, CARD64 * pbracket_less,
+IdleTimeBracketValues(void *pCounter, CARD64 * pbracket_less,
                       CARD64 * pbracket_greater)
 {
     SyncCounter *counter = pCounter;
@@ -2734,6 +2814,9 @@ IdleTimeBracketValues(pointer pCounter, CARD64 * pbracket_less,
                                      IdleTimeWakeupHandler, pCounter);
     }
     else if (!registered && (pbracket_less || pbracket_greater)) {
+        /* Reset flag must be zero so we don't force a idle timer reset on
+           the first wakeup */
+        LastEventTimeToggleResetAll(FALSE);
         RegisterBlockAndWakeupHandlers(IdleTimeBlockHandler,
                                        IdleTimeWakeupHandler, pCounter);
     }
@@ -2747,7 +2830,6 @@ init_system_idle_counter(const char *name, int deviceid)
 {
     CARD64 resolution;
     XSyncValue idle;
-    IdleCounterPriv *priv = malloc(sizeof(IdleCounterPriv));
     SyncCounter *idle_time_counter;
 
     IdleTimeQueryValue(NULL, &idle);
@@ -2758,10 +2840,14 @@ init_system_idle_counter(const char *name, int deviceid)
                                                 IdleTimeQueryValue,
                                                 IdleTimeBracketValues);
 
-    priv->deviceid = deviceid;
-    priv->value_less = priv->value_greater = NULL;
+    if (idle_time_counter != NULL) {
+        IdleCounterPriv *priv = malloc(sizeof(IdleCounterPriv));
 
-    idle_time_counter->pSysCounterInfo->private = priv;
+        priv->value_less = priv->value_greater = NULL;
+        priv->deviceid = deviceid;
+
+        idle_time_counter->pSysCounterInfo->private = priv;
+    }
 
     return idle_time_counter;
 }
@@ -2786,6 +2872,6 @@ void SyncRemoveDeviceIdleTime(SyncCounter *counter)
     /* FreeAllResources() frees all system counters before the devices are
        shut down, check if there are any left before freeing the device's
        counter */
-    if (!xorg_list_is_empty(&SysCounterList))
+    if (counter && !xorg_list_is_empty(&SysCounterList))
         xorg_list_del(&counter->pSysCounterInfo->entry);
 }
index c68229f..8c2c00d 100644 (file)
@@ -66,10 +66,10 @@ typedef enum {
     XSyncCounterUnrestricted
 } SyncCounterType;
 
-typedef void (*SyncSystemCounterQueryValue)(pointer counter,
+typedef void (*SyncSystemCounterQueryValue)(void *counter,
                                             CARD64 *value_return
     );
-typedef void (*SyncSystemCounterBracketValues)(pointer counter,
+typedef void (*SyncSystemCounterBracketValues)(void *counter,
                                                CARD64 *pbracket_less,
                                                CARD64 *pbracket_greater
     );
@@ -132,8 +132,21 @@ extern void SyncChangeCounter(SyncCounter *pCounter,
                               CARD64 new_value
     );
 
-extern void SyncDestroySystemCounter(pointer pCounter);
+extern void SyncDestroySystemCounter(void *pCounter);
 
 extern SyncCounter *SyncInitDeviceIdleTime(DeviceIntPtr dev);
 extern void SyncRemoveDeviceIdleTime(SyncCounter *counter);
+
+int
+SyncCreateFenceFromFD(ClientPtr client, DrawablePtr pDraw, XID id, int fd, BOOL initially_triggered);
+
+int
+SyncFDFromFence(ClientPtr client, DrawablePtr pDraw, SyncFence *fence);
+
+void
+SyncDeleteTriggerFromSyncObject(SyncTrigger * pTrigger);
+
+int
+SyncAddTriggerToSyncObject(SyncTrigger * pTrigger);
+
 #endif                          /* _SYNCSRV_H_ */
index b2e7dda..d77b312 100644 (file)
@@ -47,18 +47,18 @@ XaceHookDispatch(ClientPtr client, int major)
 
     if (major < 128) {
         /* Call the core dispatch hook */
-        XaceCoreDispatchRec rec = { client, Success /* default allow */  };
-        CallCallbacks(&XaceHooks[XACE_CORE_DISPATCH], &rec);
-        return rec.status;
+        XaceCoreDispatchRec drec = { client, Success /* default allow */  };
+        CallCallbacks(&XaceHooks[XACE_CORE_DISPATCH], &drec);
+        return drec.status;
     }
     else {
         /* Call the extension dispatch hook */
         ExtensionEntry *ext = GetExtensionEntry(major);
-        XaceExtAccessRec rec = { client, ext, DixUseAccess, Success };
+        XaceExtAccessRec erec = { client, ext, DixUseAccess, Success };
         if (ext)
-            CallCallbacks(&XaceHooks[XACE_EXT_DISPATCH], &rec);
+            CallCallbacks(&XaceHooks[XACE_EXT_DISPATCH], &erec);
         /* On error, pretend extension doesn't exist */
-        return (rec.status == Success) ? Success : BadRequest;
+        return (erec.status == Success) ? Success : BadRequest;
     }
 }
 
@@ -122,9 +122,9 @@ XaceHook(int hook, ...)
         u.res.client = va_arg(ap, ClientPtr);
         u.res.id = va_arg(ap, XID);
         u.res.rtype = va_arg(ap, RESTYPE);
-        u.res.res = va_arg(ap, pointer);
+        u.res.res = va_arg(ap, void *);
         u.res.ptype = va_arg(ap, RESTYPE);
-        u.res.parent = va_arg(ap, pointer);
+        u.res.parent = va_arg(ap, void *);
         u.res.access_mode = va_arg(ap, Mask);
 
         u.res.status = Success; /* default allow */
@@ -288,7 +288,7 @@ XaceCensorImage(ClientPtr client,
 
         pPix = GetScratchPixmapHeader(pDraw->pScreen, w, h,
                                       depth, bitsPerPixel,
-                                      widthBytesLine, (pointer) pBuf);
+                                      widthBytesLine, (void *) pBuf);
         if (!pPix) {
             failed = TRUE;
             goto failSafe;
index 989b033..6fe8eec 100644 (file)
@@ -40,9 +40,9 @@ typedef struct {
     ClientPtr client;
     XID id;
     RESTYPE rtype;
-    pointer res;
+    void *res;
     RESTYPE ptype;
-    pointer parent;
+    void *parent;
     Mask access_mode;
     int status;
 } XaceResourceAccessRec;
index b4ef5e4..46b3242 100644 (file)
@@ -288,7 +288,7 @@ ProcXF86BigfontQueryVersion(ClientPtr client)
         .gid = getegid(),
 #ifdef HAS_SHM
         .signature = signature,
-        .capabilities = (LocalClient(client) && !client->swapped)
+        .capabilities = (client->local && !client->swapped)
                          ? XF86Bigfont_CAP_LocalShm : 0
 #else
         .signature = 0,
@@ -296,8 +296,6 @@ ProcXF86BigfontQueryVersion(ClientPtr client)
 #endif
     };
     if (client->swapped) {
-        char tmp;
-
         swaps(&reply.sequenceNumber);
         swapl(&reply.length);
         swaps(&reply.majorVersion);
@@ -313,8 +311,6 @@ ProcXF86BigfontQueryVersion(ClientPtr client)
 static void
 swapCharInfo(xCharInfo * pCI)
 {
-    char tmp;
-
     swaps(&pCI->leftSideBearing);
     swaps(&pCI->rightSideBearing);
     swaps(&pCI->characterWidth);
@@ -357,7 +353,7 @@ ProcXF86BigfontQueryFont(ClientPtr client)
 #else
     switch (client->req_len) {
     case 2:                    /* client with version 1.0 libX11 */
-        stuff_flags = (LocalClient(client) &&
+        stuff_flags = (client->local &&
                        !client->swapped ? XF86Bigfont_FLAGS_Shm : 0);
         break;
     case 3:                    /* client with version 1.1 libX11 */
@@ -585,8 +581,6 @@ ProcXF86BigfontQueryFont(ClientPtr client)
         reply->shmid = shmid;
         reply->shmsegoffset = 0;
         if (client->swapped) {
-            char tmp;
-
             swaps(&reply->sequenceNumber);
             swapl(&reply->length);
             swapCharInfo(&reply->minBounds);
@@ -613,8 +607,6 @@ ProcXF86BigfontQueryFont(ClientPtr client)
                 prFP->name = pFP->name;
                 prFP->value = pFP->value;
                 if (client->swapped) {
-                    char tmp;
-
                     swapl(&prFP->name);
                     swapl(&prFP->value);
                 }
@@ -636,8 +628,6 @@ ProcXF86BigfontQueryFont(ClientPtr client)
             for (j = 0; j < nCharInfos; j++, ps++) {
                 *ps = pIndex2UniqIndex[j];
                 if (client->swapped) {
-                    char tmp;
-
                     swaps(ps);
                 }
             }
@@ -673,7 +663,6 @@ static int
 SProcXF86BigfontQueryVersion(ClientPtr client)
 {
     REQUEST(xXF86BigfontQueryVersionReq);
-    char tmp;
 
     swaps(&stuff->length);
     return ProcXF86BigfontQueryVersion(client);
@@ -683,7 +672,6 @@ static int
 SProcXF86BigfontQueryFont(ClientPtr client)
 {
     REQUEST(xXF86BigfontQueryFontReq);
-    char tmp;
 
     swaps(&stuff->length);
     REQUEST_SIZE_MATCH(xXF86BigfontQueryFontReq);
index 7d21ad7..546b942 100644 (file)
@@ -190,12 +190,9 @@ DestroyConstructResourceBytesCtx(ConstructResourceBytesCtx *ctx)
     ht_destroy(ctx->visitedResources);
 }
 
-extern void ResExtensionInit(void);
-
 static int
 ProcXResQueryVersion(ClientPtr client)
 {
-    REQUEST(xXResQueryVersionReq);
     xXResQueryVersionReply rep = {
         .type = X_Reply,
         .sequenceNumber = client->sequence,
@@ -270,7 +267,7 @@ ProcXResQueryClients(ClientPtr client)
 }
 
 static void
-ResFindAllRes(pointer value, XID id, RESTYPE type, pointer cdata)
+ResFindAllRes(void *value, XID id, RESTYPE type, void *cdata)
 {
     int *counts = (int *) cdata;
 
@@ -356,9 +353,9 @@ static unsigned long
 ResGetApproxPixmapBytes(PixmapPtr pix)
 {
     unsigned long nPixels;
-    int bytesPerPixel;
+    float bytesPerPixel;
 
-    bytesPerPixel = pix->drawable.bitsPerPixel >> 3;
+    bytesPerPixel = (float)pix->drawable.bitsPerPixel / 8.0;
     nPixels = pix->drawable.width * pix->drawable.height;
 
     /* Divide by refcnt as pixmap could be shared between clients,  
@@ -368,7 +365,7 @@ ResGetApproxPixmapBytes(PixmapPtr pix)
 }
 
 static void
-ResFindResourcePixmaps(pointer value, XID id, RESTYPE type, pointer cdata)
+ResFindResourcePixmaps(void *value, XID id, RESTYPE type, void *cdata)
 {
     SizeType sizeFunc = GetResourceTypeSizeFunc(type);
     ResourceSizeRec size = { 0, 0, 0 };
@@ -379,7 +376,7 @@ ResFindResourcePixmaps(pointer value, XID id, RESTYPE type, pointer cdata)
 }
 
 static void 
-ResFindPixmaps(pointer value, XID id, pointer cdata)
+ResFindPixmaps(void *value, XID id, void *cdata)
 {
     unsigned long *bytes = (unsigned long *) cdata;
     PixmapPtr pix = (PixmapPtr) value;
@@ -388,7 +385,7 @@ ResFindPixmaps(pointer value, XID id, pointer cdata)
 }
 
 static void
-ResFindWindowPixmaps(pointer value, XID id, pointer cdata)
+ResFindWindowPixmaps(void *value, XID id, void *cdata)
 {
     unsigned long *bytes = (unsigned long *) cdata;
     WindowPtr pWin = (WindowPtr) value;
@@ -401,7 +398,7 @@ ResFindWindowPixmaps(pointer value, XID id, pointer cdata)
 }
 
 static void
-ResFindGCPixmaps(pointer value, XID id, pointer cdata)
+ResFindGCPixmaps(void *value, XID id, void *cdata)
 {
     unsigned long *bytes = (unsigned long *) cdata;
     GCPtr pGC = (GCPtr) value;
@@ -414,7 +411,7 @@ ResFindGCPixmaps(pointer value, XID id, pointer cdata)
 }
 
 static void
-ResFindPicturePixmaps(pointer value, XID id, pointer cdata)
+ResFindPicturePixmaps(void *value, XID id, void *cdata)
 {
 #ifdef RENDER
     ResFindResourcePixmaps(value, id, PictureType, cdata);
@@ -422,7 +419,7 @@ ResFindPicturePixmaps(pointer value, XID id, pointer cdata)
 }
 
 static void
-ResFindCompositeClientWindowPixmaps (pointer value, XID id, pointer cdata)
+ResFindCompositeClientWindowPixmaps (void *value, XID id, void *cdata)
 {
 #ifdef COMPOSITE
     ResFindResourcePixmaps(value, id, CompositeClientWindowType, cdata);
@@ -449,32 +446,32 @@ ProcXResQueryClientPixmapBytes(ClientPtr client)
     bytes = 0;
 
     FindClientResourcesByType(clients[clientID], RT_PIXMAP, ResFindPixmaps,
-                              (pointer) (&bytes));
+                              (void *) (&bytes));
 
     /* 
      * Make sure win background pixmaps also held to account. 
      */
     FindClientResourcesByType(clients[clientID], RT_WINDOW,
-                              ResFindWindowPixmaps, (pointer) (&bytes));
+                              ResFindWindowPixmaps, (void *) (&bytes));
 
     /* 
      * GC Tile & Stipple pixmaps too.
      */
     FindClientResourcesByType(clients[clientID], RT_GC,
-                              ResFindGCPixmaps, (pointer) (&bytes));
+                              ResFindGCPixmaps, (void *) (&bytes));
 
 #ifdef RENDER
     /* Render extension picture pixmaps. */
     FindClientResourcesByType(clients[clientID], PictureType,
                               ResFindPicturePixmaps,
-                              (pointer)(&bytes));
+                              (void *)(&bytes));
 #endif
 
 #ifdef COMPOSITE
     /* Composite extension client window pixmaps. */
     FindClientResourcesByType(clients[clientID], CompositeClientWindowType,
                               ResFindCompositeClientWindowPixmaps,
-                              (pointer)(&bytes));
+                              (void *)(&bytes));
 #endif
 
     rep = (xXResQueryClientPixmapBytesReply) {
@@ -756,10 +753,10 @@ SwapXResQueryResourceBytes(struct xorg_list *response)
                         FindRes
 */
 static void
-AddSubResourceSizeSpec(pointer value,
+AddSubResourceSizeSpec(void *value,
                        XID id,
                        RESTYPE type,
-                       pointer cdata)
+                       void *cdata)
 {
     ConstructResourceBytesCtx *ctx = cdata;
 
@@ -821,7 +818,7 @@ AddSubResourceSizeSpec(pointer value,
                         FindRes
 */
 static void
-AddResourceSizeValue(pointer ptr, XID id, RESTYPE type, pointer cdata)
+AddResourceSizeValue(void *ptr, XID id, RESTYPE type, void *cdata)
 {
     ConstructResourceBytesCtx *ctx = cdata;
     if (ctx->status == Success &&
@@ -891,7 +888,7 @@ AddResourceSizeValue(pointer ptr, XID id, RESTYPE type, pointer cdata)
    @param[in/out] cdata  The context object that contains the resource type
 */
 static void
-AddResourceSizeValueWithResType(pointer ptr, XID id, pointer cdata)
+AddResourceSizeValueWithResType(void *ptr, XID id, void *cdata)
 {
     ConstructResourceBytesCtx *ctx = cdata;
     AddResourceSizeValue(ptr, id, ctx->resType, cdata);
@@ -909,7 +906,7 @@ AddResourceSizeValueWithResType(pointer ptr, XID id, pointer cdata)
                          type FindAllRes
 */
 static void
-AddResourceSizeValueByResource(pointer ptr, XID id, RESTYPE type, pointer cdata)
+AddResourceSizeValueByResource(void *ptr, XID id, RESTYPE type, void *cdata)
 {
     ConstructResourceBytesCtx *ctx = cdata;
     xXResResourceIdSpec *spec = ctx->curSpec;
@@ -1105,7 +1102,6 @@ ProcResDispatch(ClientPtr client)
 static int
 SProcXResQueryVersion(ClientPtr client)
 {
-    REQUEST(xXResQueryVersionReq);
     REQUEST_SIZE_MATCH(xXResQueryVersionReq);
     return ProcXResQueryVersion(client);
 }
index 3115f03..fb7b2d5 100644 (file)
@@ -245,7 +245,7 @@ ProcSELinuxGetDrawableContext(ClientPtr client)
 }
 
 static int
-ProcSELinuxGetPropertyContext(ClientPtr client, pointer privKey)
+ProcSELinuxGetPropertyContext(ClientPtr client, void *privKey)
 {
     WindowPtr pWin;
     PropertyPtr pProp;
@@ -269,7 +269,7 @@ ProcSELinuxGetPropertyContext(ClientPtr client, pointer privKey)
 }
 
 static int
-ProcSELinuxGetSelectionContext(ClientPtr client, pointer privKey)
+ProcSELinuxGetSelectionContext(ClientPtr client, void *privKey)
 {
     Selection *pSel;
     SELinuxObjectRec *obj;
@@ -576,7 +576,7 @@ SProcSELinuxGetDrawableContext(ClientPtr client)
 }
 
 static int
-SProcSELinuxGetPropertyContext(ClientPtr client, pointer privKey)
+SProcSELinuxGetPropertyContext(ClientPtr client, void *privKey)
 {
     REQUEST(SELinuxGetPropertyContextReq);
 
@@ -587,7 +587,7 @@ SProcSELinuxGetPropertyContext(ClientPtr client, pointer privKey)
 }
 
 static int
-SProcSELinuxGetSelectionContext(ClientPtr client, pointer privKey)
+SProcSELinuxGetSelectionContext(ClientPtr client, void *privKey)
 {
     REQUEST(SELinuxGetContextReq);
 
index e9c7e93..48219a9 100644 (file)
@@ -74,10 +74,10 @@ static Atom atom_client_ctx;
 static security_id_t unlabeled_sid;
 
 /* forward declarations */
-static void SELinuxScreen(CallbackListPtr *, pointer, pointer);
+static void SELinuxScreen(CallbackListPtr *, void *, void *);
 
 /* "true" pointer value for use as callback data */
-static pointer truep = (pointer) 1;
+static void *truep = (void *) 1;
 
 /*
  * Performs an SELinux permission check.
@@ -147,7 +147,7 @@ SELinuxLabelClient(ClientPtr client)
         strncpy(subj->command, cmdname, COMMAND_LEN - 1);
 
         if (!cached)
-            free((void *) cmdname);     /* const char * */
+            free(cmdname);     /* const char * */
     }
 
  finish:
@@ -171,7 +171,7 @@ SELinuxLabelInitial(void)
     SELinuxSubjectRec *subj;
     SELinuxObjectRec *obj;
     security_context_t ctx;
-    pointer unused;
+    void *unused;
 
     /* Do the serverClient */
     subj = dixLookupPrivate(&serverClient->devPrivates, subjectKey);
@@ -326,7 +326,7 @@ SELinuxLog(int type, const char *fmt, ...)
  */
 
 static void
-SELinuxDevice(CallbackListPtr *pcbl, pointer unused, pointer calldata)
+SELinuxDevice(CallbackListPtr *pcbl, void *unused, void *calldata)
 {
     XaceDeviceAccessRec *rec = calldata;
     SELinuxSubjectRec *subj;
@@ -363,7 +363,7 @@ SELinuxDevice(CallbackListPtr *pcbl, pointer unused, pointer calldata)
 }
 
 static void
-SELinuxSend(CallbackListPtr *pcbl, pointer unused, pointer calldata)
+SELinuxSend(CallbackListPtr *pcbl, void *unused, void *calldata)
 {
     XaceSendAccessRec *rec = calldata;
     SELinuxSubjectRec *subj;
@@ -405,7 +405,7 @@ SELinuxSend(CallbackListPtr *pcbl, pointer unused, pointer calldata)
 }
 
 static void
-SELinuxReceive(CallbackListPtr *pcbl, pointer unused, pointer calldata)
+SELinuxReceive(CallbackListPtr *pcbl, void *unused, void *calldata)
 {
     XaceReceiveAccessRec *rec = calldata;
     SELinuxSubjectRec *subj;
@@ -443,7 +443,7 @@ SELinuxReceive(CallbackListPtr *pcbl, pointer unused, pointer calldata)
 }
 
 static void
-SELinuxExtension(CallbackListPtr *pcbl, pointer unused, pointer calldata)
+SELinuxExtension(CallbackListPtr *pcbl, void *unused, void *calldata)
 {
     XaceExtAccessRec *rec = calldata;
     SELinuxSubjectRec *subj, *serv;
@@ -484,7 +484,7 @@ SELinuxExtension(CallbackListPtr *pcbl, pointer unused, pointer calldata)
 }
 
 static void
-SELinuxSelection(CallbackListPtr *pcbl, pointer unused, pointer calldata)
+SELinuxSelection(CallbackListPtr *pcbl, void *unused, void *calldata)
 {
     XaceSelectionAccessRec *rec = calldata;
     SELinuxSubjectRec *subj;
@@ -544,7 +544,7 @@ SELinuxSelection(CallbackListPtr *pcbl, pointer unused, pointer calldata)
 }
 
 static void
-SELinuxProperty(CallbackListPtr *pcbl, pointer unused, pointer calldata)
+SELinuxProperty(CallbackListPtr *pcbl, void *unused, void *calldata)
 {
     XacePropertyAccessRec *rec = calldata;
     SELinuxSubjectRec *subj;
@@ -608,7 +608,7 @@ SELinuxProperty(CallbackListPtr *pcbl, pointer unused, pointer calldata)
 }
 
 static void
-SELinuxResource(CallbackListPtr *pcbl, pointer unused, pointer calldata)
+SELinuxResource(CallbackListPtr *pcbl, void *unused, void *calldata)
 {
     XaceResourceAccessRec *rec = calldata;
     SELinuxSubjectRec *subj;
@@ -667,7 +667,7 @@ SELinuxResource(CallbackListPtr *pcbl, pointer unused, pointer calldata)
 }
 
 static void
-SELinuxScreen(CallbackListPtr *pcbl, pointer is_saver, pointer calldata)
+SELinuxScreen(CallbackListPtr *pcbl, void *is_saver, void *calldata)
 {
     XaceScreenAccessRec *rec = calldata;
     SELinuxSubjectRec *subj;
@@ -699,7 +699,7 @@ SELinuxScreen(CallbackListPtr *pcbl, pointer is_saver, pointer calldata)
 }
 
 static void
-SELinuxClient(CallbackListPtr *pcbl, pointer unused, pointer calldata)
+SELinuxClient(CallbackListPtr *pcbl, void *unused, void *calldata)
 {
     XaceClientAccessRec *rec = calldata;
     SELinuxSubjectRec *subj;
@@ -717,7 +717,7 @@ SELinuxClient(CallbackListPtr *pcbl, pointer unused, pointer calldata)
 }
 
 static void
-SELinuxServer(CallbackListPtr *pcbl, pointer unused, pointer calldata)
+SELinuxServer(CallbackListPtr *pcbl, void *unused, void *calldata)
 {
     XaceServerAccessRec *rec = calldata;
     SELinuxSubjectRec *subj;
@@ -739,7 +739,7 @@ SELinuxServer(CallbackListPtr *pcbl, pointer unused, pointer calldata)
  */
 
 static void
-SELinuxClientState(CallbackListPtr *pcbl, pointer unused, pointer calldata)
+SELinuxClientState(CallbackListPtr *pcbl, void *unused, void *calldata)
 {
     NewClientInfoRec *pci = calldata;
 
@@ -754,7 +754,7 @@ SELinuxClientState(CallbackListPtr *pcbl, pointer unused, pointer calldata)
 }
 
 static void
-SELinuxResourceState(CallbackListPtr *pcbl, pointer unused, pointer calldata)
+SELinuxResourceState(CallbackListPtr *pcbl, void *unused, void *calldata)
 {
     ResourceStateInfoRec *rec = calldata;
     SELinuxSubjectRec *subj;
@@ -812,9 +812,9 @@ SELinuxBlockHandler(void *data, struct timeval **tv, void *read_mask)
 }
 
 static void
-SELinuxWakeupHandler(void *data, int err, void *read_mask)
+SELinuxWakeupHandler(void *data, int num_fds, void *read_mask)
 {
-    if (FD_ISSET(netlink_fd, (fd_set *) read_mask))
+    if (num_fds > 0 && FD_ISSET(netlink_fd, (fd_set *) read_mask))
         avc_netlink_check_nb();
 }
 
index c593372..1d499eb 100644 (file)
@@ -57,8 +57,6 @@
 
 #include "extinit.h"
 
-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 */
@@ -81,6 +79,18 @@ DeviceIntPtr xtestpointer, xtestkeyboard;
 #include "panoramiXsrv.h"
 #endif
 
+#ifdef _F_SUPPORT_XTEST_TOUCH_EVENT_
+#ifndef XI_TouchBegin
+#define XI_TouchBegin 18
+#endif
+#ifndef XI_TouchUpdate
+#define XI_TouchUpdate 19
+#endif
+#ifndef XI_TouchEnd
+#define XI_TouchEnd 20
+#endif
+#endif //_F_SUPPORT_XTEST_TOUCH_EVENT_
+
 static int XTestSwapFakeInput(ClientPtr /* client */ ,
                               xReq *    /* req */
     );
@@ -129,7 +139,7 @@ ProcXTestCompareCursor(ClientPtr client)
     else if (stuff->cursor == XTestCurrentCursor)
         pCursor = GetSpriteCursor(ptr);
     else {
-        rc = dixLookupResourceByType((pointer *) &pCursor, stuff->cursor,
+        rc = dixLookupResourceByType((void **) &pCursor, stuff->cursor,
                                      RT_CURSOR, client, DixReadAccess);
         if (rc != Success) {
             client->errorValue = stuff->cursor;
@@ -158,7 +168,6 @@ ProcXTestFakeInput(ClientPtr client)
     DeviceIntPtr dev = NULL;
     WindowPtr root;
     Bool extension = FALSE;
-    deviceValuator *dv = NULL;
     ValuatorMask mask;
     int valuators[MAX_VALUATORS] = { 0 };
     int numValuators = 0;
@@ -168,6 +177,10 @@ ProcXTestFakeInput(ClientPtr client)
     int base = 0;
     int flags = 0;
     int need_ptr_update = 1;
+#ifdef _ENABLE_PRIVILEGE_CHECK_ON_XTEST_DEVICE_API_
+    xXTestFakeInputReply rep;
+    int res = 0;
+#endif //_ENABLE_PRIVILEGE_CHECK_ON_XTEST_DEVICE_API_
 
     nev = (stuff->length << 2) - sizeof(xReq);
     if ((nev % sizeof(xEvent)) || !nev)
@@ -197,6 +210,28 @@ ProcXTestFakeInput(ClientPtr client)
                 client->errorValue = ev->u.u.type;
                 return BadValue;
             }
+#ifdef _ENABLE_PRIVILEGE_CHECK_ON_XTEST_DEVICE_API_
+            res = SmackUtilHaveAuthority(client, "xorg::inputgen", DixReadAccess | DixWriteAccess);
+            rep = (xXTestFakeInputReply) {
+                .type = X_Reply,
+                .accepted = xTrue,
+                .sequenceNumber = client->sequence,
+                .length = 0
+            };
+
+            if (res == Success) {
+                rep.accepted = xTrue;
+            } else {
+                rep.accepted = xFalse;
+            }
+
+            if (client->swapped) {
+                swaps(&rep.sequenceNumber);
+            }
+
+            WriteToClient(client, sizeof(xXTestFakeInputReply), &rep);
+            if (res != Success) return BadAccess;
+#endif //_ENABLE_PRIVILEGE_CHECK_ON_XTEST_DEVICE_API_
             break;
         case XI_DeviceButtonPress:
         case XI_DeviceButtonRelease:
@@ -211,6 +246,38 @@ ProcXTestFakeInput(ClientPtr client)
                 return BadValue;
             }
             break;
+#ifdef _F_SUPPORT_XTEST_TOUCH_EVENT_
+        case XI_TouchBegin:
+        case XI_TouchUpdate:
+        case XI_TouchEnd:
+            if (!dev->touch) {
+                client->errorValue = ev->u.u.type;
+                return BadValue;
+            }
+#ifdef _ENABLE_PRIVILEGE_CHECK_ON_XTEST_DEVICE_API_
+            res = SmackUtilHaveAuthority(client, "xorg::inputgen", DixReadAccess | DixWriteAccess);
+            rep = (xXTestFakeInputReply) {
+                .type = X_Reply,
+                .accepted = xTrue,
+                .sequenceNumber = client->sequence,
+                .length = 0
+            };
+
+            if (res == Success) {
+                rep.accepted = xTrue;
+            } else {
+                rep.accepted = xFalse;
+            }
+
+            if (client->swapped) {
+                swaps(&rep.sequenceNumber);
+            }
+
+            WriteToClient(client, sizeof(xXTestFakeInputReply), &rep);
+            if (res != Success) return BadAccess;
+#endif //_ENABLE_PRIVILEGE_CHECK_ON_XTEST_DEVICE_API_
+            break;
+#endif //_F_SUPPORT_XTEST_TOUCH_EVENT_
         case XI_ProximityIn:
         case XI_ProximityOut:
             if (!dev->proximity) {
@@ -227,7 +294,11 @@ ProcXTestFakeInput(ClientPtr client)
         if (nev == 1 && type == XI_DeviceMotionNotify)
             return BadLength;   /* DevMotion must be followed by DevValuator */
 
-        if (type == XI_DeviceMotionNotify) {
+        if (type == XI_DeviceMotionNotify
+#ifdef _F_SUPPORT_XTEST_TOUCH_EVENT_
+        || type == XI_TouchBegin || type == XI_TouchUpdate || type == XI_TouchEnd
+#endif //_F_SUPPORT_XTEST_TOUCH_EVENT_
+        ){
             firstValuator = ((deviceValuator *) (ev + 1))->first_valuator;
             if (firstValuator > dev->valuator->numAxes) {
                 client->errorValue = ev->u.u.type;
@@ -243,14 +314,14 @@ ProcXTestFakeInput(ClientPtr client)
         }
 
         if (nev > 1 && !dev->valuator) {
-            client->errorValue = dv->first_valuator;
+            client->errorValue = firstValuator;
             return BadValue;
         }
 
         /* check validity of valuator events */
         base = firstValuator;
         for (n = 1; n < nev; n++) {
-            dv = (deviceValuator *) (ev + n);
+            deviceValuator *dv = (deviceValuator *) (ev + n);
             if (dv->type != DeviceValuator) {
                 client->errorValue = dv->type;
                 return BadValue;
@@ -286,8 +357,10 @@ ProcXTestFakeInput(ClientPtr client)
                 return BadValue;
             }
         }
-        type = type - XI_DeviceKeyPress + KeyPress;
-
+#ifdef _F_SUPPORT_XTEST_TOUCH_EVENT_
+        if (type != XI_TouchBegin && type != XI_TouchUpdate && type != XI_TouchEnd)
+#endif //_F_SUPPORT_XTEST_TOUCH_EVENT_
+            type = type - XI_DeviceKeyPress + KeyPress;
     }
     else {
         if (nev != 1)
@@ -308,7 +381,7 @@ ProcXTestFakeInput(ClientPtr client)
             numValuators = 2;
             firstValuator = 0;
             if (ev->u.u.detail == xFalse)
-                flags = POINTER_ABSOLUTE | POINTER_SCREEN;
+                flags = POINTER_ABSOLUTE | POINTER_DESKTOP;
             break;
         default:
             client->errorValue = ev->u.u.type;
@@ -355,6 +428,8 @@ ProcXTestFakeInput(ClientPtr client)
     switch (type) {
     case KeyPress:
     case KeyRelease:
+        if (!dev)
+            return BadDevice;
         if (!dev->key)
             return BadDevice;
 
@@ -379,6 +454,14 @@ ProcXTestFakeInput(ClientPtr client)
                 client->errorValue = ev->u.keyButtonPointer.root;
                 return BadValue;
             }
+
+            /* Add the root window's offset to the valuators */
+            if ((flags & POINTER_ABSOLUTE) && firstValuator <= 1 && numValuators > 0) {
+                if (firstValuator == 0)
+                    valuators[0] += root->drawable.pScreen->x;
+                if (firstValuator < 2 && firstValuator + numValuators > 1)
+                    valuators[1 - firstValuator] += root->drawable.pScreen->y;
+            }
         }
         if (ev->u.u.detail != xTrue && ev->u.u.detail != xFalse) {
             client->errorValue = ev->u.u.detail;
@@ -398,6 +481,19 @@ ProcXTestFakeInput(ClientPtr client)
             return BadValue;
         }
         break;
+#ifdef _F_SUPPORT_XTEST_TOUCH_EVENT_
+    case XI_TouchBegin:
+    case XI_TouchUpdate:
+    case XI_TouchEnd:
+        if (!dev->touch)
+            return BadDevice;
+
+        if (ev->u.u.detail < 0) {
+            client->errorValue = ev->u.u.detail;
+            return BadValue;
+        }
+        break;
+#endif //_F_SUPPORT_XTEST_TOUCH_EVENT_
     }
     if (screenIsSaved == SCREEN_SAVER_ON)
         dixSaveScreens(serverClient, SCREEN_SAVER_OFF, ScreenSaverReset);
@@ -418,10 +514,19 @@ ProcXTestFakeInput(ClientPtr client)
         nevents =
             GetKeyboardEvents(xtest_evlist, dev, type, ev->u.u.detail, NULL);
         break;
+#ifdef _F_SUPPORT_XTEST_TOUCH_EVENT_
+    case XI_TouchBegin:
+    case XI_TouchUpdate:
+    case XI_TouchEnd:
+        valuator_mask_set_range(&mask, firstValuator, numValuators, valuators);
+        nevents =
+            GetTouchEvents(xtest_evlist, dev, ev->u.u.detail, type, 0, &mask);
+        break;
+#endif //_F_SUPPORT_XTEST_TOUCH_EVENT_
     }
 
     for (i = 0; i < nevents; i++)
-        mieqProcessDeviceEvent(dev, &xtest_evlist[i], NULL);
+        mieqProcessDeviceEvent(dev, &xtest_evlist[i], miPointerGetScreen(inputInfo.pointer));
 
     if (need_ptr_update)
         miPointerUpdateSprite(dev);
@@ -574,6 +679,28 @@ InitXTestDevices(void)
     AttachDevice(NULL, xtestkeyboard, inputInfo.keyboard);
 }
 
+#ifdef _F_SUPPORT_XTEST_TOUCH_EVENT_
+void
+InitXTestHWKeyTouchDevices(void)
+{
+    DeviceIntPtr xtestTouch, xtestHWKey;
+    if (AllocXTestHWKeyTouchDevice(serverClient, "Virtual core",
+                         &xtestTouch, &xtestHWKey,
+                         inputInfo.pointer, inputInfo.keyboard) != Success)
+         FatalError("Failed to allocate XTest HWKeyTouch devices");
+
+    if (ActivateDevice(xtestTouch, TRUE) != Success ||
+        ActivateDevice(xtestHWKey, TRUE) != Success)
+        FatalError("Failed to activate XTest HWKeyTouch core devices.");
+    if (!EnableDevice(xtestTouch, TRUE) || !EnableDevice(xtestHWKey, TRUE))
+        FatalError("Failed to enable XTest HWKeyTouch core devices.");
+
+    AttachDevice(NULL, xtestTouch, inputInfo.pointer);
+
+    AttachDevice(NULL, xtestHWKey, inputInfo.keyboard);
+}
+#endif //_F_SUPPORT_XTEST_TOUCH_EVENT_
+
 /**
  * Don't allow changing the XTest property.
  */
@@ -634,6 +761,48 @@ AllocXTestDevice(ClientPtr client, const char *name,
     return retval;
 }
 
+#ifdef _F_SUPPORT_XTEST_TOUCH_EVENT_
+int
+AllocXTestHWKeyTouchDevice(ClientPtr client, const char *name,
+                 DeviceIntPtr *ptr, DeviceIntPtr *keybd,
+                 DeviceIntPtr master_ptr, DeviceIntPtr master_keybd)
+{
+    int retval;
+    char *xtestname;
+    char dummy = 1;
+
+    if (asprintf(&xtestname, "%s XTEST", name) == -1)
+        return BadAlloc;
+
+    retval =
+        AllocHWKeyTouchDevicePair(client, xtestname, ptr, keybd, CoreTouchProc,
+                        CoreKeyboardProc, FALSE);
+    if (retval == Success) {
+        (*ptr)->xtest_master_id = master_ptr->id;
+        (*keybd)->xtest_master_id = master_keybd->id;
+
+        XIChangeDeviceProperty(*ptr, XIGetKnownProperty(XI_PROP_XTEST_DEVICE),
+                               XA_INTEGER, 8, PropModeReplace, 1, &dummy,
+                               FALSE);
+        XISetDevicePropertyDeletable(*ptr,
+                                     XIGetKnownProperty(XI_PROP_XTEST_DEVICE),
+                                     FALSE);
+        XIRegisterPropertyHandler(*ptr, DeviceSetXTestProperty, NULL, NULL);
+        XIChangeDeviceProperty(*keybd, XIGetKnownProperty(XI_PROP_XTEST_DEVICE),
+                               XA_INTEGER, 8, PropModeReplace, 1, &dummy,
+                               FALSE);
+        XISetDevicePropertyDeletable(*keybd,
+                                     XIGetKnownProperty(XI_PROP_XTEST_DEVICE),
+                                     FALSE);
+        XIRegisterPropertyHandler(*keybd, DeviceSetXTestProperty, NULL, NULL);
+    }
+
+    free(xtestname);
+
+    return retval;
+}
+#endif //_F_SUPPORT_XTEST_TOUCH_EVENT_
+
 /**
  * If master is NULL, return TRUE if the given device is an xtest device or
  * FALSE otherwise.
index 31b7783..fd88fd7 100644 (file)
@@ -43,6 +43,7 @@ SOFTWARE.
 #include "xvdix.h"
 #ifdef MITSHM
 #include <X11/extensions/shmproto.h>
+#include "shmint.h"
 #endif
 
 #include "xvdisp.h"
@@ -54,6 +55,10 @@ SOFTWARE.
 unsigned long XvXRTPort;
 #endif
 
+#ifdef _F_XV_PUTSTILL_CHECK_PRIVILEGE_
+#include "extinit.h"
+#endif
+
 static int
 SWriteQueryExtensionReply(ClientPtr client, xvQueryExtensionReply * rep)
 {
@@ -512,6 +517,11 @@ ProcXvPutStill(ClientPtr client)
     XvPortPtr pPort;
     GCPtr pGC;
     int status;
+    int result;
+#ifdef _F_XV_PUTSTILL_CHECK_PRIVILEGE_
+    int ret = 0;
+#endif
+    TTRACE_VIDEO_BEGIN("XORG:XV:DISP_PUTSTILL");
 
     REQUEST(xvPutStillReq);
     REQUEST_SIZE_MATCH(xvPutStillReq);
@@ -521,23 +531,38 @@ ProcXvPutStill(ClientPtr client)
 
     if ((status = _AllocatePort(stuff->port, pPort)) != Success) {
         client->errorValue = stuff->port;
+        TTRACE_VIDEO_END();
         return status;
     }
 
     if (!(pPort->pAdaptor->type & XvInputMask) ||
         !(pPort->pAdaptor->type & XvStillMask)) {
         client->errorValue = stuff->port;
+        TTRACE_VIDEO_END();
         return BadMatch;
     }
 
     status = XvdiMatchPort(pPort, pDraw);
     if (status != Success) {
+        TTRACE_VIDEO_END();
         return status;
     }
 
-    return XvdiPutStill(client, pDraw, pPort, pGC, stuff->vid_x, stuff->vid_y,
+#ifdef _F_XV_PUTSTILL_CHECK_PRIVILEGE_
+    ret = SmackUtilHaveAuthority(client, "xorg::screencapture", DixReadAccess);
+    if (ret != Success) {
+        TTRACE_VIDEO_END();
+        return BadAccess;
+    }
+#endif
+
+    result =  XvdiPutStill(client, pDraw, pPort, pGC, stuff->vid_x, stuff->vid_y,
                         stuff->vid_w, stuff->vid_h, stuff->drw_x, stuff->drw_y,
                         stuff->drw_w, stuff->drw_h);
+
+    TTRACE_VIDEO_END();
+
+    return result;
 }
 
 static int
@@ -702,7 +727,7 @@ ProcXvUngrabPort(ClientPtr client)
 static int
 ProcXvStopVideo(ClientPtr client)
 {
-    int status, rc;
+    int status, ret;
     DrawablePtr pDraw;
     XvPortPtr pPort;
 
@@ -716,9 +741,9 @@ ProcXvStopVideo(ClientPtr client)
         return status;
     }
 
-    rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0, DixWriteAccess);
-    if (rc != Success)
-        return rc;
+    ret = dixLookupDrawable(&pDraw, stuff->drawable, client, 0, DixWriteAccess);
+    if (ret != Success)
+        return ret;
 
     return XvdiStopVideo(client, pPort, pDraw);
 }
@@ -894,6 +919,9 @@ ProcXvPutImage(ClientPtr client)
     GCPtr pGC;
     int status, i, size;
     CARD16 width, height;
+    int result;
+
+    TTRACE_VIDEO_BEGIN("XORG:XV:DISP_PUTIMAGE");
 
     REQUEST(xvPutImageReq);
     REQUEST_AT_LEAST_SIZE(xvPutImageReq);
@@ -903,17 +931,20 @@ ProcXvPutImage(ClientPtr client)
 
     if ((status = _AllocatePort(stuff->port, pPort)) != Success) {
         client->errorValue = stuff->port;
+        TTRACE_VIDEO_END();
         return status;
     }
 
     if (!(pPort->pAdaptor->type & XvImageMask) ||
         !(pPort->pAdaptor->type & XvInputMask)) {
         client->errorValue = stuff->port;
+        TTRACE_VIDEO_END();
         return BadMatch;
     }
 
     status = XvdiMatchPort(pPort, pDraw);
     if (status != Success) {
+        TTRACE_VIDEO_END();
         return status;
     }
 
@@ -925,7 +956,10 @@ ProcXvPutImage(ClientPtr client)
     }
 
     if (!pImage)
+    {
+        TTRACE_VIDEO_END();
         return BadMatch;
+    }
 
     width = stuff->width;
     height = stuff->height;
@@ -936,31 +970,29 @@ ProcXvPutImage(ClientPtr client)
     size = bytes_to_int32(size);
 
     if ((width < stuff->width) || (height < stuff->height))
+    {
+        TTRACE_VIDEO_END();
         return BadValue;
+    }
 
     if (client->req_len < size)
+    {
+        TTRACE_VIDEO_END();
         return BadLength;
+    }
 
-    return XvdiPutImage(client, pDraw, pPort, pGC, stuff->src_x, stuff->src_y,
+    result = XvdiPutImage(client, pDraw, pPort, pGC, stuff->src_x, stuff->src_y,
                         stuff->src_w, stuff->src_h, stuff->drw_x, stuff->drw_y,
                         stuff->drw_w, stuff->drw_h, pImage,
                         (unsigned char *) (&stuff[1]), FALSE,
                         stuff->width, stuff->height);
+
+    TTRACE_VIDEO_END();
+
+    return result;
 }
 
 #ifdef MITSHM
-/* redefined here since it's not in any header file */
-typedef struct _ShmDesc {
-    struct _ShmDesc *next;
-    int shmid;
-    int refcnt;
-    char *addr;
-    Bool writable;
-    unsigned long size;
-} ShmDescRec, *ShmDescPtr;
-
-extern RESTYPE ShmSegType;
-extern int ShmCompletionCode;
 
 static int
 ProcXvShmPutImage(ClientPtr client)
@@ -973,6 +1005,8 @@ ProcXvShmPutImage(ClientPtr client)
     int status, size_needed, i;
     CARD16 width, height;
 
+    TTRACE_VIDEO_BEGIN("XORG:XV:DISP_SHMPUTIMAGE");
+
     REQUEST(xvShmPutImageReq);
     REQUEST_SIZE_MATCH(xvShmPutImageReq);
 
@@ -981,17 +1015,20 @@ ProcXvShmPutImage(ClientPtr client)
 
     if ((status = _AllocatePort(stuff->port, pPort)) != Success) {
         client->errorValue = stuff->port;
+        TTRACE_VIDEO_END();
         return status;
     }
 
     if (!(pPort->pAdaptor->type & XvImageMask) ||
         !(pPort->pAdaptor->type & XvInputMask)) {
         client->errorValue = stuff->port;
+        TTRACE_VIDEO_END();
         return BadMatch;
     }
 
     status = XvdiMatchPort(pPort, pDraw);
     if (status != Success) {
+        TTRACE_VIDEO_END();
         return status;
     }
 
@@ -1003,12 +1040,18 @@ ProcXvShmPutImage(ClientPtr client)
     }
 
     if (!pImage)
+    {
+        TTRACE_VIDEO_END();
         return BadMatch;
+    }
 
-    status = dixLookupResourceByType((pointer *) &shmdesc, stuff->shmseg,
+    status = dixLookupResourceByType((void **) &shmdesc, stuff->shmseg,
                                      ShmSegType, serverClient, DixReadAccess);
     if (status != Success)
+    {
+        TTRACE_VIDEO_END();
         return status;
+    }
 
     width = stuff->width;
     height = stuff->height;
@@ -1017,10 +1060,16 @@ ProcXvShmPutImage(ClientPtr client)
                                                               &width, &height,
                                                               NULL, NULL);
     if ((size_needed + stuff->offset) > shmdesc->size)
+    {
+        TTRACE_VIDEO_END();
         return BadAccess;
+    }
 
     if ((width < stuff->width) || (height < stuff->height))
+    {
+        TTRACE_VIDEO_END();
         return BadValue;
+    }
 
     status = XvdiPutImage(client, pDraw, pPort, pGC, stuff->src_x, stuff->src_y,
                           stuff->src_w, stuff->src_h, stuff->drw_x,
@@ -1040,6 +1089,8 @@ ProcXvShmPutImage(ClientPtr client)
         WriteEventsToClient(client, 1, (xEvent *) &ev);
     }
 
+    TTRACE_VIDEO_END();
+
     return status;
 }
 #else                           /* !MITSHM */
@@ -1523,12 +1574,12 @@ XineramaXvStopVideo(ClientPtr client)
     REQUEST(xvStopVideoReq);
     REQUEST_SIZE_MATCH(xvStopVideoReq);
 
-    result = dixLookupResourceByClass((pointer *) &draw, stuff->drawable,
+    result = dixLookupResourceByClass((void **) &draw, stuff->drawable,
                                       XRC_DRAWABLE, client, DixWriteAccess);
     if (result != Success)
         return (result == BadValue) ? BadDrawable : result;
 
-    result = dixLookupResourceByType((pointer *) &port, stuff->port,
+    result = dixLookupResourceByType((void **) &port, stuff->port,
                                      XvXRTPort, client, DixReadAccess);
     if (result != Success)
         return result;
@@ -1553,7 +1604,7 @@ XineramaXvSetPortAttribute(ClientPtr client)
 
     REQUEST_SIZE_MATCH(xvSetPortAttributeReq);
 
-    result = dixLookupResourceByType((pointer *) &port, stuff->port,
+    result = dixLookupResourceByType((void **) &port, stuff->port,
                                      XvXRTPort, client, DixReadAccess);
     if (result != Success)
         return result;
@@ -1579,17 +1630,17 @@ XineramaXvShmPutImage(ClientPtr client)
 
     REQUEST_SIZE_MATCH(xvShmPutImageReq);
 
-    result = dixLookupResourceByClass((pointer *) &draw, stuff->drawable,
+    result = dixLookupResourceByClass((void **) &draw, stuff->drawable,
                                       XRC_DRAWABLE, client, DixWriteAccess);
     if (result != Success)
         return (result == BadValue) ? BadDrawable : result;
 
-    result = dixLookupResourceByType((pointer *) &gc, stuff->gc,
+    result = dixLookupResourceByType((void **) &gc, stuff->gc,
                                      XRT_GC, client, DixReadAccess);
     if (result != Success)
         return result;
 
-    result = dixLookupResourceByType((pointer *) &port, stuff->port,
+    result = dixLookupResourceByType((void **) &port, stuff->port,
                                      XvXRTPort, client, DixReadAccess);
     if (result != Success)
         return result;
@@ -1631,17 +1682,17 @@ XineramaXvPutImage(ClientPtr client)
 
     REQUEST_AT_LEAST_SIZE(xvPutImageReq);
 
-    result = dixLookupResourceByClass((pointer *) &draw, stuff->drawable,
+    result = dixLookupResourceByClass((void **) &draw, stuff->drawable,
                                       XRC_DRAWABLE, client, DixWriteAccess);
     if (result != Success)
         return (result == BadValue) ? BadDrawable : result;
 
-    result = dixLookupResourceByType((pointer *) &gc, stuff->gc,
+    result = dixLookupResourceByType((void **) &gc, stuff->gc,
                                      XRT_GC, client, DixReadAccess);
     if (result != Success)
         return result;
 
-    result = dixLookupResourceByType((pointer *) &port, stuff->port,
+    result = dixLookupResourceByType((void **) &port, stuff->port,
                                      XvXRTPort, client, DixReadAccess);
     if (result != Success)
         return result;
@@ -1679,17 +1730,17 @@ XineramaXvPutVideo(ClientPtr client)
 
     REQUEST_AT_LEAST_SIZE(xvPutVideoReq);
 
-    result = dixLookupResourceByClass((pointer *) &draw, stuff->drawable,
+    result = dixLookupResourceByClass((void **) &draw, stuff->drawable,
                                       XRC_DRAWABLE, client, DixWriteAccess);
     if (result != Success)
         return (result == BadValue) ? BadDrawable : result;
 
-    result = dixLookupResourceByType((pointer *) &gc, stuff->gc,
+    result = dixLookupResourceByType((void **) &gc, stuff->gc,
                                      XRT_GC, client, DixReadAccess);
     if (result != Success)
         return result;
 
-    result = dixLookupResourceByType((pointer *) &port, stuff->port,
+    result = dixLookupResourceByType((void **) &port, stuff->port,
                                      XvXRTPort, client, DixReadAccess);
     if (result != Success)
         return result;
@@ -1727,17 +1778,17 @@ XineramaXvPutStill(ClientPtr client)
 
     REQUEST_AT_LEAST_SIZE(xvPutImageReq);
 
-    result = dixLookupResourceByClass((pointer *) &draw, stuff->drawable,
+    result = dixLookupResourceByClass((void **) &draw, stuff->drawable,
                                       XRC_DRAWABLE, client, DixWriteAccess);
     if (result != Success)
         return (result == BadValue) ? BadDrawable : result;
 
-    result = dixLookupResourceByType((pointer *) &gc, stuff->gc,
+    result = dixLookupResourceByType((void **) &gc, stuff->gc,
                                      XRT_GC, client, DixReadAccess);
     if (result != Success)
         return result;
 
-    result = dixLookupResourceByType((pointer *) &port, stuff->port,
+    result = dixLookupResourceByType((void **) &port, stuff->port,
                                      XvXRTPort, client, DixReadAccess);
     if (result != Success)
         return result;
index 40309c1..0a83ef3 100644 (file)
@@ -204,7 +204,7 @@ typedef struct _XvPortRec {
 
 #define VALIDATE_XV_PORT(portID, pPort, mode)\
     {\
-       int rc = dixLookupResourceByType((pointer *)&(pPort), portID,\
+       int rc = dixLookupResourceByType((void **)&(pPort), portID,\
                                         XvRTPort, client, mode);\
        if (rc != Success)\
            return rc;\
index 1ea3ac2..ffe2eea 100644 (file)
@@ -134,12 +134,12 @@ static Bool XvCloseScreen(ScreenPtr);
 static Bool XvDestroyPixmap(PixmapPtr);
 static Bool XvDestroyWindow(WindowPtr);
 static void XvResetProc(ExtensionEntry *);
-static int XvdiDestroyGrab(pointer, XID);
-static int XvdiDestroyEncoding(pointer, XID);
-static int XvdiDestroyVideoNotify(pointer, XID);
-static int XvdiDestroyPortNotify(pointer, XID);
-static int XvdiDestroyVideoNotifyList(pointer, XID);
-static int XvdiDestroyPort(pointer, XID);
+static int XvdiDestroyGrab(void *, XID);
+static int XvdiDestroyEncoding(void *, XID);
+static int XvdiDestroyVideoNotify(void *, XID);
+static int XvdiDestroyPortNotify(void *, XID);
+static int XvdiDestroyVideoNotifyList(void *, XID);
+static int XvdiDestroyPort(void *, XID);
 static int XvdiSendVideoNotify(XvPortPtr, DrawablePtr, int);
 
 /*
@@ -156,8 +156,8 @@ XvExtensionInit(void)
     if (!dixRegisterPrivateKey(&XvScreenKeyRec, PRIVATE_SCREEN, 0))
         return;
 
-    /* LOOK TO SEE IF ANY SCREENS WERE INITIALIZED; IF NOT THEN
-       INIT GLOBAL VARIABLES SO THE EXTENSION CAN FUNCTION */
+    /* Look to see if any screens were initialized; if not then
+       init global variables so the extension can function */
     if (XvScreenGeneration != serverGeneration) {
         if (!CreateResourceTypes()) {
             ErrorF("XvExtensionInit: Unable to allocate resource types\n");
@@ -450,20 +450,20 @@ XvdiVideoStopped(XvPortPtr pPort, int reason)
 }
 
 static int
-XvdiDestroyPort(pointer pPort, XID id)
+XvdiDestroyPort(void *pPort, XID id)
 {
     return (*((XvPortPtr) pPort)->pAdaptor->ddFreePort) (pPort);
 }
 
 static int
-XvdiDestroyGrab(pointer pGrab, XID id)
+XvdiDestroyGrab(void *pGrab, XID id)
 {
     ((XvGrabPtr) pGrab)->client = NULL;
     return Success;
 }
 
 static int
-XvdiDestroyVideoNotify(pointer pn, XID id)
+XvdiDestroyVideoNotify(void *pn, XID id)
 {
     /* JUST CLEAR OUT THE client POINTER FIELD */
 
@@ -472,7 +472,7 @@ XvdiDestroyVideoNotify(pointer pn, XID id)
 }
 
 static int
-XvdiDestroyPortNotify(pointer pn, XID id)
+XvdiDestroyPortNotify(void *pn, XID id)
 {
     /* JUST CLEAR OUT THE client POINTER FIELD */
 
@@ -481,7 +481,7 @@ XvdiDestroyPortNotify(pointer pn, XID id)
 }
 
 static int
-XvdiDestroyVideoNotifyList(pointer pn, XID id)
+XvdiDestroyVideoNotifyList(void *pn, XID id)
 {
     XvVideoNotifyPtr npn, cpn;
 
@@ -500,7 +500,7 @@ XvdiDestroyVideoNotifyList(pointer pn, XID id)
 }
 
 static int
-XvdiDestroyEncoding(pointer value, XID id)
+XvdiDestroyEncoding(void *value, XID id)
 {
     return Success;
 }
@@ -510,7 +510,7 @@ XvdiSendVideoNotify(XvPortPtr pPort, DrawablePtr pDraw, int reason)
 {
     XvVideoNotifyPtr pn;
 
-    dixLookupResourceByType((pointer *) &pn, pDraw->id, XvRTVideoNotifyList,
+    dixLookupResourceByType((void **) &pn, pDraw->id, XvRTVideoNotifyList,
                             serverClient, DixReadAccess);
 
     while (pn) {
@@ -843,7 +843,7 @@ XvdiSelectVideoNotify(ClientPtr client, DrawablePtr pDraw, BOOL onoff)
 
     /* FIND VideoNotify LIST */
 
-    rc = dixLookupResourceByType((pointer *) &pn, pDraw->id,
+    rc = dixLookupResourceByType((void **) &pn, pDraw->id,
                                  XvRTVideoNotifyList, client, DixWriteAccess);
     if (rc != Success && rc != BadValue)
         return rc;
@@ -1035,10 +1035,22 @@ XvdiMatchPort(XvPortPtr pPort, DrawablePtr pDraw)
     nf = pa->nFormats;
     pf = pa->pFormats;
 
-    while (nf--) {
-        if (pf->depth == pDraw->depth)
-            return Success;
-        pf++;
+#ifdef _F_SKIP_DEPTH_CHECK_OF_DRAWABLE_WINDOW_
+    if (pDraw->type == DRAWABLE_WINDOW) {
+        /* In case of Tizen TV, Xwindow is just used for layout setting of
+           video resolution.
+           So, This exception handling was added in order to 32 bit window.
+           window depth is not related with video play of TV decoder. */
+        return Success;
+    }
+    else
+#endif
+    {
+        while (nf--) {
+            if (pf->depth == pDraw->depth)
+                return Success;
+            pf++;
+        }
     }
 
     return BadMatch;
index 5f0123b..64eda92 100644 (file)
@@ -61,7 +61,7 @@ typedef struct {
     (XvMCScreenPtr)(dixLookupPrivate(&(pScreen)->devPrivates, XvMCScreenKey))
 
 static int
-XvMCDestroyContextRes(pointer data, XID id)
+XvMCDestroyContextRes(void *data, XID id)
 {
     XvMCContextPtr pContext = (XvMCContextPtr) data;
 
@@ -78,7 +78,7 @@ XvMCDestroyContextRes(pointer data, XID id)
 }
 
 static int
-XvMCDestroySurfaceRes(pointer data, XID id)
+XvMCDestroySurfaceRes(void *data, XID id)
 {
     XvMCSurfacePtr pSurface = (XvMCSurfacePtr) data;
     XvMCContextPtr pContext = pSurface->context;
@@ -87,13 +87,13 @@ XvMCDestroySurfaceRes(pointer data, XID id)
     (*pScreenPriv->adaptors[pContext->adapt_num].DestroySurface) (pSurface);
     free(pSurface);
 
-    XvMCDestroyContextRes((pointer) pContext, pContext->context_id);
+    XvMCDestroyContextRes((void *) pContext, pContext->context_id);
 
     return Success;
 }
 
 static int
-XvMCDestroySubpictureRes(pointer data, XID id)
+XvMCDestroySubpictureRes(void *data, XID id)
 {
     XvMCSubpicturePtr pSubpict = (XvMCSubpicturePtr) data;
     XvMCContextPtr pContext = pSubpict->context;
@@ -102,7 +102,7 @@ XvMCDestroySubpictureRes(pointer data, XID id)
     (*pScreenPriv->adaptors[pContext->adapt_num].DestroySubpicture) (pSubpict);
     free(pSubpict);
 
-    XvMCDestroyContextRes((pointer) pContext, pContext->context_id);
+    XvMCDestroyContextRes((void *) pContext, pContext->context_id);
 
     return Success;
 }
@@ -276,7 +276,7 @@ ProcXvMCCreateContext(ClientPtr client)
 static int
 ProcXvMCDestroyContext(ClientPtr client)
 {
-    pointer val;
+    void *val;
     int rc;
 
     REQUEST(xvmcDestroyContextReq);
@@ -306,7 +306,7 @@ ProcXvMCCreateSurface(ClientPtr client)
     REQUEST(xvmcCreateSurfaceReq);
     REQUEST_SIZE_MATCH(xvmcCreateSurfaceReq);
 
-    result = dixLookupResourceByType((pointer *) &pContext, stuff->context_id,
+    result = dixLookupResourceByType((void **) &pContext, stuff->context_id,
                                      XvMCRTContext, client, DixUseAccess);
     if (result != Success)
         return result;
@@ -350,7 +350,7 @@ ProcXvMCCreateSurface(ClientPtr client)
 static int
 ProcXvMCDestroySurface(ClientPtr client)
 {
-    pointer val;
+    void *val;
     int rc;
 
     REQUEST(xvmcDestroySurfaceReq);
@@ -382,7 +382,7 @@ ProcXvMCCreateSubpicture(ClientPtr client)
     REQUEST(xvmcCreateSubpictureReq);
     REQUEST_SIZE_MATCH(xvmcCreateSubpictureReq);
 
-    result = dixLookupResourceByType((pointer *) &pContext, stuff->context_id,
+    result = dixLookupResourceByType((void **) &pContext, stuff->context_id,
                                      XvMCRTContext, client, DixUseAccess);
     if (result != Success)
         return result;
@@ -474,7 +474,7 @@ ProcXvMCCreateSubpicture(ClientPtr client)
 static int
 ProcXvMCDestroySubpicture(ClientPtr client)
 {
-    pointer val;
+    void *val;
     int rc;
 
     REQUEST(xvmcDestroySubpictureReq);
@@ -800,8 +800,8 @@ XvMCFindXvImage(XvPortPtr pPort, CARD32 id)
 }
 
 int
-xf86XvMCRegisterDRInfo(ScreenPtr pScreen, char *name,
-                       char *busID, int major, int minor, int patchLevel)
+xf86XvMCRegisterDRInfo(ScreenPtr pScreen, const char *name,
+                       const char *busID, int major, int minor, int patchLevel)
 {
     XvMCScreenPtr pScreenPriv = XVMC_GET_PRIVATE(pScreen);
 
index 2201d7b..e8a6dae 100644 (file)
@@ -31,15 +31,15 @@ typedef struct {
     unsigned short height;
     CARD32 flags;
     int refcnt;
-    pointer port_priv;
-    pointer driver_priv;
+    void *port_priv;
+    void *driver_priv;
 } XvMCContextRec, *XvMCContextPtr;
 
 typedef struct {
     XID surface_id;
     int surface_type_id;
     XvMCContextPtr context;
-    pointer driver_priv;
+    void *driver_priv;
 } XvMCSurfaceRec, *XvMCSurfacePtr;
 
 typedef struct {
@@ -51,7 +51,7 @@ typedef struct {
     int entry_bytes;
     char component_order[4];
     XvMCContextPtr context;
-    pointer driver_priv;
+    void *driver_priv;
 } XvMCSubpictureRec, *XvMCSubpicturePtr;
 
 typedef int (*XvMCCreateContextProcPtr) (XvPortPtr port,
@@ -91,8 +91,8 @@ extern _X_EXPORT int XvMCScreenInit(ScreenPtr pScreen,
 
 extern _X_EXPORT XvImagePtr XvMCFindXvImage(XvPortPtr pPort, CARD32 id);
 
-extern _X_EXPORT int xf86XvMCRegisterDRInfo(ScreenPtr pScreen, char *name,
-                                            char *busID, int major, int minor,
+extern _X_EXPORT int xf86XvMCRegisterDRInfo(ScreenPtr pScreen, const char *name,
+                                            const char *busID, int major, int minor,
                                             int patchLevel);
 
 #endif                          /* _XVMC_H */
index 69c7886..6c456c4 100644 (file)
@@ -1,4 +1,4 @@
-noinst_LTLIBRARIES = libXi.la
+noinst_LTLIBRARIES = libXi.la libXistubs.la
 
 AM_CFLAGS = $(DIX_CFLAGS)
 
@@ -78,6 +78,8 @@ libXi_la_SOURCES =    \
        ungrdevk.h \
        xiallowev.c \
        xiallowev.h \
+       xibarriers.c \
+       xibarriers.h \
        xichangecursor.c \
        xichangecursor.h \
        xichangehierarchy.c \
@@ -105,4 +107,5 @@ libXi_la_SOURCES =  \
        xiwarppointer.c \
        xiwarppointer.h
 
-EXTRA_DIST = stubs.c
+libXistubs_la_SOURCES =        \
+       stubs.c
index 9fe69a5..d078aa2 100644 (file)
@@ -122,11 +122,18 @@ ProcXChangeDeviceControl(ClientPtr client)
     if (ret != Success)
         goto out;
 
+    /* XTest devices are special, none of the below apply to them anyway */
+    if (IsXTestDevice(dev, NULL)) {
+        ret = BadMatch;
+        goto out;
+    }
+
     rep = (xChangeDeviceControlReply) {
         .repType = X_Reply,
         .RepType = X_ChangeDeviceControl,
         .sequenceNumber = client->sequence,
-        .length = 0
+        .length = 0,
+        .status = Success,
     };
 
     switch (stuff->control) {
@@ -186,7 +193,10 @@ ProcXChangeDeviceControl(ClientPtr client)
     case DEVICE_ENABLE:
         e = (xDeviceEnableCtl *) &stuff[1];
 
-        status = ChangeDeviceControl(client, dev, (xDeviceCtl *) e);
+        if (IsXTestDevice(dev, NULL))
+            status = !Success;
+        else
+            status = ChangeDeviceControl(client, dev, (xDeviceCtl *) e);
 
         if (status == Success) {
             if (e->enable)
index c75b94d..07865d2 100644 (file)
@@ -91,7 +91,7 @@ ProcXDeviceBell(ClientPtr client)
     int rc, base;
     int newpercent;
     CARD8 class;
-    pointer ctrl;
+    void *ctrl;
     BellProcPtr proc;
 
     REQUEST(xDeviceBellReq);
@@ -117,7 +117,7 @@ ProcXDeviceBell(ClientPtr client)
         }
         base = k->ctrl.bell;
         proc = k->BellProc;
-        ctrl = (pointer) &(k->ctrl);
+        ctrl = (void *) &(k->ctrl);
         class = KbdFeedbackClass;
     }
     else if (stuff->feedbackclass == BellFeedbackClass) {
@@ -130,7 +130,7 @@ ProcXDeviceBell(ClientPtr client)
         }
         base = b->ctrl.percent;
         proc = b->BellProc;
-        ctrl = (pointer) &(b->ctrl);
+        ctrl = (void *) &(b->ctrl);
         class = BellFeedbackClass;
     }
     else {
@@ -142,7 +142,8 @@ ProcXDeviceBell(ClientPtr client)
         newpercent = base + newpercent;
     else
         newpercent = base - newpercent + stuff->percent;
+    if (proc == NULL)
+        return BadValue;
     (*proc) (newpercent, dev, ctrl, class);
-
     return Success;
 }
index eaab167..9e044b2 100644 (file)
@@ -122,6 +122,26 @@ Bool ShouldFreeInputMasks(WindowPtr /* pWin */ ,
 static Bool MakeInputMasks(WindowPtr    /* pWin */
     );
 
+#ifdef _F_MULTI_PASSIVE_GRAB_
+#include "../hw/xfree86/common/xf86Xinput.h"
+
+typedef struct _ActivatedKeyList
+{
+    CARD8 keycode;
+    struct _ActivatedKeyList *next;
+} ActivatedKeyList;
+
+typedef struct {
+    ActivatedKeyList *activatedkeylist;
+
+    unsigned short id_vendor;
+    unsigned short id_product;
+
+    char *device;
+} PrivatedevRec, *PrivatedevPtr;
+
+#endif //_F_MULTI_PASSIVE_GRAB_
+
 /*
  * Only let the given client know of core events which will affect its
  * interpretation of input events, if the client's ClientPointer (or the
@@ -147,7 +167,6 @@ IsPointerEvent(InternalEvent *event)
     case ET_ButtonRelease:
     case ET_Motion:
         /* XXX: enter/leave ?? */
-    case ET_TouchCancel:
         return TRUE;
     default:
         break;
@@ -231,7 +250,7 @@ CopyKeyClass(DeviceIntPtr device, DeviceIntPtr master)
 
     mk->sourceid = device->id;
 
-    if (!XkbCopyDeviceKeymap(master, device))
+    if (!XkbDeviceApplyKeymap(master, device->key->xkbInfo->desc))
         FatalError("Couldn't pivot keymap from device to core!\n");
 }
 
@@ -662,6 +681,8 @@ void
 DeepCopyDeviceClasses(DeviceIntPtr from, DeviceIntPtr to,
                       DeviceChangedEvent *dce)
 {
+    OsBlockSIGIO();
+
     /* generic feedback classes, not tied to pointer and/or keyboard */
     DeepCopyFeedbackClasses(from, to);
 
@@ -669,6 +690,8 @@ DeepCopyDeviceClasses(DeviceIntPtr from, DeviceIntPtr to,
         DeepCopyKeyboardClasses(from, to);
     if ((dce->flags & DEVCHANGE_POINTER_EVENT))
         DeepCopyPointerClasses(from, to);
+
+    OsReleaseSIGIO();
 }
 
 /**
@@ -950,8 +973,6 @@ UpdateDeviceState(DeviceIntPtr device, DeviceEvent *event)
 
         if (!(event->flags & TOUCH_POINTER_EMULATED))
             return DONT_PROCESS;
-        if (!(event->flags & TOUCH_END))
-            return DONT_PROCESS;
 
         DecreaseButtonCount(device, key, &t->buttonsDown, &t->motionMask,
                             &t->state);
@@ -1039,57 +1060,22 @@ DeliverOneTouchEvent(ClientPtr client, DeviceIntPtr dev, TouchPointInfoPtr ti,
 static void
 ActivateEarlyAccept(DeviceIntPtr dev, TouchPointInfoPtr ti)
 {
-    int rc;
     ClientPtr client;
     XID error;
+    GrabPtr grab = ti->listeners[0].grab;
 
-    rc = dixLookupClient(&client, ti->listeners[0].listener, serverClient,
-                         DixSendAccess);
-    if (rc != Success) {
-        ErrorF("[Xi] Failed to lookup early accepting client.\n");
-        return;
-    }
+    BUG_RETURN(ti->listeners[0].type != LISTENER_GRAB &&
+               ti->listeners[0].type != LISTENER_POINTER_GRAB);
+    BUG_RETURN(!grab);
+
+    client = rClient(grab);
 
     if (TouchAcceptReject(client, dev, XIAcceptTouch, ti->client_id,
-                          ti->listeners[0].window->drawable.id, &error) !=
-        Success)
+                          ti->listeners[0].window->drawable.id, &error) != Success)
         ErrorF("[Xi] Failed to accept touch grab after early acceptance.\n");
 }
 
 /**
- * Generate and deliver a TouchEnd event.
- *
- * @param dev The device to deliver the event for.
- * @param ti The touch point record to deliver the event for.
- * @param flags Internal event flags. The called does not need to provide
- *        TOUCH_CLIENT_ID and TOUCH_POINTER_EMULATED, this function will ensure
- *        they are set appropriately.
- * @param resource The client resource to deliver to, or 0 for all clients.
- */
-static void
-EmitTouchEnd(DeviceIntPtr dev, TouchPointInfoPtr ti, int flags, XID resource)
-{
-    InternalEvent *tel = InitEventList(GetMaximumEventsNum());
-    ValuatorMask *mask = valuator_mask_new(2);
-    int i, nev;
-
-    valuator_mask_set_double(mask, 0,
-                             valuator_mask_get_double(ti->valuators, 0));
-    valuator_mask_set_double(mask, 1,
-                             valuator_mask_get_double(ti->valuators, 1));
-
-    flags |= TOUCH_CLIENT_ID;
-    if (ti->emulate_pointer)
-        flags |= TOUCH_POINTER_EMULATED;
-    nev = GetTouchEvents(tel, dev, ti->client_id, XI_TouchEnd, flags, mask);
-    for (i = 0; i < nev; i++)
-        DeliverTouchEvents(dev, ti, tel + i, resource);
-
-    valuator_mask_free(&mask);
-    FreeEventList(tel, GetMaximumEventsNum());
-}
-
-/**
  * Find the oldest touch that still has a pointer emulation client.
  *
  * Pointer emulation can only be performed for the oldest touch. Otherwise, the
@@ -1139,31 +1125,42 @@ static void
 TouchPuntToNextOwner(DeviceIntPtr dev, TouchPointInfoPtr ti,
                      TouchOwnershipEvent *ev)
 {
+    TouchListener *listener = &ti->listeners[0]; /* new owner */
+    int accepted_early = listener->state == LISTENER_EARLY_ACCEPT;
+
     /* Deliver the ownership */
-    if (ti->listeners[0].state == LISTENER_AWAITING_OWNER ||
-        ti->listeners[0].state == LISTENER_EARLY_ACCEPT)
+    if (listener->state == LISTENER_AWAITING_OWNER || accepted_early)
         DeliverTouchEvents(dev, ti, (InternalEvent *) ev,
-                           ti->listeners[0].listener);
-    else if (ti->listeners[0].state == LISTENER_AWAITING_BEGIN) {
+                           listener->listener);
+    else if (listener->state == LISTENER_AWAITING_BEGIN) {
         /* We can't punt to a pointer listener unless all older pointer
          * emulated touches have been seen already. */
-        if ((ti->listeners[0].type == LISTENER_POINTER_GRAB ||
-             ti->listeners[0].type == LISTENER_POINTER_REGULAR) &&
+        if ((listener->type == LISTENER_POINTER_GRAB ||
+             listener->type == LISTENER_POINTER_REGULAR) &&
             ti != FindOldestPointerEmulatedTouch(dev))
             return;
 
-        TouchEventHistoryReplay(ti, dev, ti->listeners[0].listener);
+        TouchEventHistoryReplay(ti, dev, listener->listener);
     }
 
-    /* If we've just removed the last grab and the touch has physically
-     * ended, send a TouchEnd event too and finalise the touch. */
-    if (ti->num_listeners == 1 && ti->num_grabs == 0 && ti->pending_finish) {
-        EmitTouchEnd(dev, ti, 0, 0);
-        TouchEndTouch(dev, ti);
-        return;
+    /* New owner has Begin/Update but not end. If touch is pending_finish,
+     * emulate the TouchEnd now */
+    if (ti->pending_finish) {
+        TouchEmitTouchEnd(dev, ti, 0, 0);
+
+        /* If the last owner is not a touch grab, finalise the touch, we
+           won't get more correspondence on this.
+         */
+        if (ti->num_listeners == 1 &&
+            (ti->num_grabs == 0 ||
+             listener->grab->grabtype != XI2 ||
+             !xi2mask_isset(listener->grab->xi2mask, dev, XI_TouchBegin))) {
+            TouchEndTouch(dev, ti);
+            return;
+        }
     }
 
-    if (ti->listeners[0].state == LISTENER_EARLY_ACCEPT)
+    if (accepted_early)
         ActivateEarlyAccept(dev, ti);
 }
 
@@ -1207,7 +1204,7 @@ TouchRejected(DeviceIntPtr sourcedev, TouchPointInfoPtr ti, XID resource,
     for (i = 0; i < ti->num_listeners; i++) {
         if (ti->listeners[i].listener == resource) {
             if (ti->listeners[i].state != LISTENER_HAS_END)
-                EmitTouchEnd(sourcedev, ti, TOUCH_REJECT, resource);
+                TouchEmitTouchEnd(sourcedev, ti, TOUCH_REJECT, resource);
             break;
         }
     }
@@ -1227,25 +1224,11 @@ TouchRejected(DeviceIntPtr sourcedev, TouchPointInfoPtr ti, XID resource,
 }
 
 static void
-ProcessTouchCancelEvent(InternalEvent *event, DeviceIntPtr device)
+ProcessTouchCancelEvent(TouchCancelEvent *ev, DeviceIntPtr dev)
 {
-    TouchCancelEvent *tce;
-    GrabPtr grab;
-
-    grab = device->deviceGrab.grab;
-
-    if (grab)
-        DeliverGrabbedEvent((InternalEvent *) event, device,
-                            FALSE);
-    else
-        DeliverDeviceEvents(GetSpriteWindow(device), (InternalEvent *) event,
-                            NullGrab, NullWindow, device);
-
-#if 0
     TouchPointInfoPtr ti = TouchFindBySourceID(dev, ev->sourceid);
 
     DeliverTouchEvents(dev, ti, (InternalEvent *) ev, ev->resource);
-#endif
 }
 
 /**
@@ -1256,25 +1239,36 @@ ProcessTouchCancelEvent(InternalEvent *event, DeviceIntPtr device)
  * touchpoint if it is pending finish.
  */
 static void
-ProcessTouchOwnershipEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
-                           TouchOwnershipEvent *ev)
+ProcessTouchOwnershipEvent(TouchOwnershipEvent *ev,
+                           DeviceIntPtr dev)
 {
+    TouchPointInfoPtr ti = TouchFindByClientID(dev, ev->touchid);
+
+    if (!ti) {
+        DebugF("[Xi] %s: Failed to get event %d for touchpoint %d\n",
+               dev->name, ev->type, ev->touchid);
+        return;
+    }
 
     if (ev->reason == XIRejectTouch)
         TouchRejected(dev, ti, ev->resource, ev);
     else if (ev->reason == XIAcceptTouch) {
         int i;
 
-        /* Go through the motions of ending the touch if the listener has
+
+        /* For pointer-emulated listeners that ungrabbed the active grab,
+         * the state was forced to LISTENER_HAS_END. Still go
+         * through the motions of ending the touch if the listener has
          * already seen the end. This ensures that the touch record is ended in
-         * the server. */
+         * the server.
+         */
         if (ti->listeners[0].state == LISTENER_HAS_END)
-            EmitTouchEnd(dev, ti, TOUCH_ACCEPT, ti->listeners[0].listener);
+            TouchEmitTouchEnd(dev, ti, TOUCH_ACCEPT, ti->listeners[0].listener);
 
         /* The touch owner has accepted the touch.  Send TouchEnd events to
          * everyone else, and truncate the list of listeners. */
         for (i = 1; i < ti->num_listeners; i++)
-            EmitTouchEnd(dev, ti, TOUCH_ACCEPT, ti->listeners[i].listener);
+            TouchEmitTouchEnd(dev, ti, TOUCH_ACCEPT, ti->listeners[i].listener);
 
         while (ti->num_listeners > 1)
             TouchRemoveListener(ti, ti->listeners[1].listener);
@@ -1298,7 +1292,7 @@ TouchCopyValuatorData(DeviceEvent *ev, TouchPointInfoPtr ti)
 {
     int i;
 
-    for (i = 0; i < sizeof(ev->valuators.mask) * 8; i++)
+    for (i = 0; i < ARRAY_SIZE(ev->valuators.data); i++)
         if (BitIsOn(ev->valuators.mask, i))
             valuator_mask_set_double(ti->valuators, i, ev->valuators.data[i]);
 }
@@ -1340,7 +1334,7 @@ RetrieveTouchDeliveryData(DeviceIntPtr dev, TouchPointInfoPtr ti,
         *mask = (*grab)->xi2mask;
     }
     else {
-        rc = dixLookupResourceByType((pointer *) win, listener->listener,
+        rc = dixLookupResourceByType((void **) win, listener->listener,
                                      listener->resource_type,
                                      serverClient, DixSendAccess);
         if (rc != Success)
@@ -1411,7 +1405,7 @@ DeliverTouchEmulatedEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
 
     /* We don't deliver pointer events to non-owners */
     if (!TouchResourceIsOwner(ti, listener->listener))
-        return Success;
+        return !Success;
 
     nevents = TouchConvertToPointerEvent(ev, &motion, &button);
     BUG_RETURN_VAL(nevents == 0, BadValue);
@@ -1424,7 +1418,7 @@ DeliverTouchEmulatedEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
     ptrev->device_event.corestate = event_get_corestate(dev, kbd);
 
     if (grab) {
-        /* this side-steps the usual activation mechansims, but... */
+        /* this side-steps the usual activation mechanisms, but... */
         if (ev->any.type == ET_TouchBegin && !dev->deviceGrab.grab)
             ActivatePassiveGrab(dev, grab, ptrev, ev);  /* also delivers the event */
         else {
@@ -1433,7 +1427,7 @@ DeliverTouchEmulatedEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
             /* 'grab' is the passive grab, but if the grab isn't active,
              * don't deliver */
             if (!dev->deviceGrab.grab)
-                return Success;
+                return !Success;
 
             if (grab->ownerEvents) {
                 WindowPtr focus = NullWindow;
@@ -1443,7 +1437,7 @@ DeliverTouchEmulatedEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
             }
 
             if (!deliveries)
-                DeliverOneGrabbedEvent(ptrev, dev, grab->grabtype);
+                deliveries = DeliverOneGrabbedEvent(ptrev, dev, grab->grabtype);
 
             /* We must accept the touch sequence once a pointer listener has
              * received one event past ButtonPress. */
@@ -1452,7 +1446,7 @@ DeliverTouchEmulatedEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
                 TouchListenerAcceptReject(dev, ti, 0, XIAcceptTouch);
 
             if (ev->any.type == ET_TouchEnd &&
-                !(ev->device_event.flags & TOUCH_CLIENT_ID) &&
+                ti->num_listeners == 1 &&
                 !dev->button->buttonsDown &&
                 dev->deviceGrab.fromPassiveGrab && GrabIsPointerGrab(grab)) {
                 (*dev->deviceGrab.DeactivateGrab) (dev);
@@ -1471,8 +1465,11 @@ DeliverTouchEmulatedEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
          */
         if (!devgrab && dev->deviceGrab.grab && dev->deviceGrab.implicitGrab) {
             TouchListener *l;
+            GrabPtr g;
 
             devgrab = dev->deviceGrab.grab;
+            g = AllocGrab(devgrab);
+            BUG_WARN(!g);
 
             *dev->deviceGrab.sync.event = ev->device_event;
 
@@ -1481,8 +1478,8 @@ DeliverTouchEmulatedEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
              * event selection. Thus, we update the last listener in the array.
              */
             l = &ti->listeners[ti->num_listeners - 1];
-            l->listener = devgrab->resource;
-            l->grab = devgrab;
+            l->listener = g->resource;
+            l->grab = g;
             //l->resource_type = RT_NONE;
 
             if (devgrab->grabtype != XI2 || devgrab->type != XI_TouchBegin)
@@ -1504,7 +1501,7 @@ static void
 DeliverEmulatedMotionEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
                            InternalEvent *ev)
 {
-    InternalEvent motion;
+    DeviceEvent motion;
 
     if (ti->num_listeners) {
         ClientPtr client;
@@ -1512,15 +1509,15 @@ DeliverEmulatedMotionEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
         GrabPtr grab;
         XI2Mask *mask;
 
-        if (ti->listeners[0].type != LISTENER_POINTER_REGULAR ||
+        if (ti->listeners[0].type != LISTENER_POINTER_REGULAR &&
             ti->listeners[0].type != LISTENER_POINTER_GRAB)
             return;
 
-        motion = *ev;
-        motion.any.type = ET_TouchUpdate;
-        motion.device_event.detail.button = 0;
+        motion = ev->device_event;
+        motion.type = ET_TouchUpdate;
+        motion.detail.button = 0;
 
-        if (!RetrieveTouchDeliveryData(dev, ti, &motion,
+        if (!RetrieveTouchDeliveryData(dev, ti, (InternalEvent*)&motion,
                                        &ti->listeners[0], &client, &win, &grab,
                                        &mask))
             return;
@@ -1535,18 +1532,18 @@ DeliverEmulatedMotionEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
             }
         }
 
-        DeliverTouchEmulatedEvent(dev, ti, &motion, &ti->listeners[0], client,
+        DeliverTouchEmulatedEvent(dev, ti, (InternalEvent*)&motion, &ti->listeners[0], client,
                                   win, grab, mask);
     }
     else {
         InternalEvent button;
         int converted;
 
-        converted = TouchConvertToPointerEvent(ev, &motion, &button);
+        converted = TouchConvertToPointerEvent(ev, (InternalEvent*)&motion, &button);
 
         BUG_WARN(converted == 0);
         if (converted)
-            ProcessOtherEvent(&motion, dev);
+            ProcessOtherEvent((InternalEvent*)&motion, dev);
     }
 }
 
@@ -1566,56 +1563,66 @@ ProcessTouchEvent(InternalEvent *ev, DeviceIntPtr dev)
     uint32_t touchid;
     int type = ev->any.type;
     int emulate_pointer = ! !(ev->device_event.flags & TOUCH_POINTER_EMULATED);
+    DeviceIntPtr kbd;
 
-    if (!t)
-        return;
+    TTRACE_INPUT_BEGIN("XORG:SERVER:ProcessTouchEvent");
 
-    if (ev->any.type == ET_TouchOwnership)
-        touchid = ev->touch_ownership_event.touchid;
-    else
-        touchid = ev->device_event.touchid;
+    if (!t) {
+        TTRACE_INPUT_END();
+        return;
+    }
 
-    if (emulate_pointer)
-        UpdateDeviceState(dev, &ev->device_event);
+    touchid = ev->device_event.touchid;
 
-    if (type == ET_TouchBegin) {
+    if (type == ET_TouchBegin && !(ev->device_event.flags & TOUCH_REPLAYING)) {
         ti = TouchBeginTouch(dev, ev->device_event.sourceid, touchid,
                              emulate_pointer);
     }
     else
         ti = TouchFindByClientID(dev, touchid);
 
-    /* Under the following circumstances we create a new touch record for an
-     * existing touch:
-     *
-     * - The touch may be pointer emulated
-     * - An explicit grab is active on the device
-     * - The grab is a pointer grab
-     *
-     * This allows for an explicit grab to receive pointer events for an already
-     * active touch.
-     */
-    if (!ti && type != ET_TouchBegin && emulate_pointer &&
-        dev->deviceGrab.grab && !dev->deviceGrab.fromPassiveGrab &&
+    /* Active pointer grab */
+    if (emulate_pointer && dev->deviceGrab.grab && !dev->deviceGrab.fromPassiveGrab &&
         (dev->deviceGrab.grab->grabtype == CORE ||
          dev->deviceGrab.grab->grabtype == XI ||
-         !xi2mask_isset(dev->deviceGrab.grab->xi2mask, dev, XI_TouchBegin))) {
-        ti = TouchBeginTouch(dev, ev->device_event.sourceid, touchid,
-                             emulate_pointer);
-        if (!ti) {
-            DebugF("[Xi] %s: Failed to create new dix record for explicitly "
-                   "grabbed touchpoint %d\n",
-                   dev->name, type, touchid);
-            return;
-        }
+         !xi2mask_isset(dev->deviceGrab.grab->xi2mask, dev, XI_TouchBegin)))
+    {
+        /* Active pointer grab on touch point and we get a TouchEnd - claim this
+         * touchpoint accepted, otherwise clients waiting for ownership will
+         * wait on this touchpoint until this client ungrabs, or the cows come
+         * home, whichever is earlier */
+        if (ti && type == ET_TouchEnd)
+            TouchListenerAcceptReject(dev, ti, 0, XIAcceptTouch);
+        else if (!ti && type != ET_TouchBegin) {
+            /* Under the following circumstances we create a new touch record for an
+             * existing touch:
+             *
+             * - The touch may be pointer emulated
+             * - An explicit grab is active on the device
+             * - The grab is a pointer grab
+             *
+             * This allows for an explicit grab to receive pointer events for an already
+             * active touch.
+             */
+            ti = TouchBeginTouch(dev, ev->device_event.sourceid, touchid,
+                                 emulate_pointer);
+            if (!ti) {
+                DebugF("[Xi] %s: Failed to create new dix record for explicitly "
+                       "grabbed touchpoint %d\n",
+                       dev->name, touchid);
+                TTRACE_INPUT_END();
+                return;
+            }
 
-        TouchBuildSprite(dev, ti, ev);
-        TouchSetupListeners(dev, ti, ev);
+            TouchBuildSprite(dev, ti, ev);
+            TouchSetupListeners(dev, ti, ev);
+        }
     }
 
     if (!ti) {
         DebugF("[Xi] %s: Failed to get event %d for touchpoint %d\n",
                dev->name, type, touchid);
+        TTRACE_INPUT_END();
         return;
     }
 
@@ -1624,32 +1631,224 @@ ProcessTouchEvent(InternalEvent *ev, DeviceIntPtr dev)
      * events which _only_ emulate motion just work normally */
     if (emulate_pointer && ev->any.type != ET_TouchUpdate)
         DeliverEmulatedMotionEvent(dev, ti, ev);
+
     if (emulate_pointer && IsMaster(dev))
         CheckMotion(&ev->device_event, dev);
 
+    kbd = GetMaster(dev, KEYBOARD_OR_FLOAT);
+    event_set_state(NULL, kbd, &ev->device_event);
+    ev->device_event.corestate = event_get_corestate(NULL, kbd);
+
     /* Make sure we have a valid window trace for event delivery; must be
      * called after event type mutation. Touch end events are always processed
      * in order to end touch records. */
     /* FIXME: check this */
-    if ((type == ET_TouchBegin && !TouchBuildSprite(dev, ti, ev)) ||
-        (type != ET_TouchEnd && ti->sprite.spriteTraceGood == 0))
+    if ((type == ET_TouchBegin &&
+         !(ev->device_event.flags & TOUCH_REPLAYING) &&
+         !TouchBuildSprite(dev, ti, ev)) ||
+        (type != ET_TouchEnd && ti->sprite.spriteTraceGood == 0)) {
+        TTRACE_INPUT_END();
         return;
+    }
 
-    /* TouchOwnership events are handled separately from the rest, as they
-     * have more complex semantics. */
-    if (ev->any.type == ET_TouchOwnership)
-        ProcessTouchOwnershipEvent(dev, ti, &ev->touch_ownership_event);
-    else {
-        TouchCopyValuatorData(&ev->device_event, ti);
-        /* WARNING: the event type may change to TouchUpdate in
-         * DeliverTouchEvents if a TouchEnd was delivered to a grabbing
-         * owner */
-        DeliverTouchEvents(dev, ti, (InternalEvent *) ev, 0);
-        if (ev->any.type == ET_TouchEnd)
-            TouchEndTouch(dev, ti);
+    TouchCopyValuatorData(&ev->device_event, ti);
+    /* WARNING: the event type may change to TouchUpdate in
+     * DeliverTouchEvents if a TouchEnd was delivered to a grabbing
+     * owner */
+    DeliverTouchEvents(dev, ti, ev, ev->device_event.resource);
+    if (ev->any.type == ET_TouchEnd)
+        TouchEndTouch(dev, ti);
+
+    if (emulate_pointer)
+        UpdateDeviceState(dev, &ev->device_event);
+    TTRACE_INPUT_END();
+}
+
+static void
+ProcessBarrierEvent(InternalEvent *e, DeviceIntPtr dev)
+{
+    Mask filter;
+    WindowPtr pWin;
+    BarrierEvent *be = &e->barrier_event;
+    xEvent *ev;
+    int rc;
+    GrabPtr grab = dev->deviceGrab.grab;
+
+    if (!IsMaster(dev))
+        return;
+
+    if (dixLookupWindow(&pWin, be->window, serverClient, DixReadAccess) != Success)
+        return;
+
+    if (grab)
+        be->flags |= XIBarrierDeviceIsGrabbed;
+
+    rc = EventToXI2(e, &ev);
+    if (rc != Success) {
+        ErrorF("[Xi] event conversion from %s failed with code %d\n", __func__, rc);
+        return;
+    }
+
+    /* A client has a grab, deliver to this client if the grab_window is the
+       barrier window.
+
+       Otherwise, deliver normally to the client.
+     */
+    if (grab &&
+        CLIENT_ID(be->barrierid) == CLIENT_ID(grab->resource) &&
+        grab->window->drawable.id == be->window) {
+        DeliverGrabbedEvent(e, dev, FALSE);
+    } else {
+        filter = GetEventFilter(dev, ev);
+
+        DeliverEventsToWindow(dev, pWin, ev, 1,
+                              filter, NullGrab);
+    }
+    free(ev);
+}
+
+#ifdef _F_MULTI_PASSIVE_GRAB_
+void
+freekeylist(DeviceIntPtr device)
+{
+    InputInfoPtr pInfo  = device->public.devicePrivate;
+    PrivatedevPtr pEvdev = pInfo->private;
+    ActivatedKeyList *curItem=NULL, *freeItem=NULL;
+
+    if (!pEvdev->activatedkeylist) return;
+
+    for (curItem=pEvdev->activatedkeylist; curItem;)
+    {
+        freeItem = curItem;
+        curItem = curItem->next;
+        free(freeItem);
+        freeItem = NULL;
+    }
+
+    pEvdev->activatedkeylist = NULL;
+}
+
+void
+InsertActiveKeyToList(PrivatedevPtr dev, int keycode)
+{
+    ActivatedKeyList *keylist=NULL, *newItem=NULL, *curItem=NULL;
+    if (!dev) {
+        ErrorF("[InsertActiveKeyToList] dev was NULL\n");
+        return;
+    }
+    keylist = dev->activatedkeylist;
+
+    newItem = (ActivatedKeyList *)calloc(1, sizeof(ActivatedKeyList));
+    if (!newItem) {
+        ErrorF("[InsertActiveKeyToList] Failed to calloc to newItem\n");
+        return;
+    }
+
+    newItem->keycode = (CARD8)keycode;
+    newItem->next = NULL;
+    if (keylist) {
+        newItem->next = keylist->next;
+        keylist->next = newItem;
+    }
+    else keylist = newItem;
+    dev->activatedkeylist = keylist;
+}
+
+void
+RemoveActiveKeyToList(PrivatedevPtr dev, int keycode)
+{
+    ActivatedKeyList *curItem=NULL, *beforeItem=NULL;
+    ActivatedKeyList *keylist=NULL;
+
+    if (!dev) {
+        ErrorF("[RemoveActiveKeyToList] dev was NULL\n");
+        return;
+    }
+
+    keylist = dev->activatedkeylist;
+
+    if (!keylist) {
+        ErrorF("[RemoveActiveKeyToList] keylist was NULL\n");
+        return;
+    }
+
+    if (keylist->next == NULL) /* has only one item */
+    {
+        if (keylist->keycode == (CARD8)keycode) {
+            free(keylist);
+            keylist = NULL;
+        }
+        dev->activatedkeylist = keylist;
+        return;
+    }
+
+    for (curItem = keylist; curItem; curItem = curItem->next)
+    {
+        if (curItem->keycode == (CARD8)keycode) {
+            if (beforeItem) {
+                beforeItem->next = curItem->next;
+            } else {
+                keylist = curItem->next;
+            }
+            free(curItem);
+            curItem = NULL;
+            break;
+        }
+        beforeItem = curItem;
     }
+
+    dev->activatedkeylist = keylist;
 }
 
+void
+GrabbedDeviceEvents(DeviceIntPtr device, GrabPtr grab, DeviceEvent *event)
+{
+    InputInfoPtr pInfo;
+    PrivatedevPtr pEvdev;
+    GrabPtr tempGrab=NULL;
+
+    if (!device || !grab)
+        goto out;
+
+    pInfo  = device->public.devicePrivate;
+    if(!pInfo)
+        goto out;
+    pEvdev = pInfo->private;
+    if(!pEvdev)
+        goto out;
+
+    if (event->type == ET_KeyPress) {
+                InsertActiveKeyToList(pEvdev, event->detail.key);
+                goto out;
+    }
+    else if (event->type == ET_KeyRelease) {
+                RemoveActiveKeyToList(pEvdev, event->detail.key);
+                goto out;
+    }
+
+out:
+    return;
+}
+
+Bool
+IsGrabbedEventsEmpty(DeviceIntPtr device)
+{
+    InputInfoPtr pInfo  = device->public.devicePrivate;
+    PrivatedevPtr pEvdev = pInfo->private;
+
+    if (!pEvdev) {
+        ErrorF("[IsGrabbedEventsEmpty] pEvdev was NULL\n");
+        return FALSE;
+    }
+
+    if (!pEvdev->activatedkeylist)
+        return TRUE;
+
+    return FALSE;
+}
+
+#endif //_F_MULTI_PASSIVE_GRAB_
+
 /**
  * Process DeviceEvents and DeviceChangedEvents.
  */
@@ -1665,6 +1864,8 @@ ProcessDeviceEvent(InternalEvent *ev, DeviceIntPtr device)
     DeviceIntPtr mouse = NULL, kbd = NULL;
     DeviceEvent *event = &ev->device_event;
 
+    TTRACE_INPUT_BEGIN("XORG:SERVER:ProcessDeviceEvent");
+
     if (IsPointerDevice(device)) {
         kbd = GetMaster(device, KEYBOARD_OR_FLOAT);
         mouse = device;
@@ -1682,8 +1883,10 @@ ProcessDeviceEvent(InternalEvent *ev, DeviceIntPtr device)
     event_set_state(mouse, kbd, event);
 
     ret = UpdateDeviceState(device, event);
-    if (ret == DONT_PROCESS)
+    if (ret == DONT_PROCESS) {
+        TTRACE_INPUT_END();
         return;
+    }
 
     b = device->button;
 
@@ -1719,35 +1922,69 @@ ProcessDeviceEvent(InternalEvent *ev, DeviceIntPtr device)
 
         eventinfo.device = device;
         eventinfo.event = ev;
-        CallCallbacks(&DeviceEventCallback, (pointer) &eventinfo);
+        CallCallbacks(&DeviceEventCallback, (void *) &eventinfo);
     }
 
     grab = device->deviceGrab.grab;
 
     switch (event->type) {
     case ET_KeyPress:
-        if (!grab && CheckDeviceGrabs(device, event, 0))
+        if (!grab && CheckDeviceGrabs(device, event, 0)) {
+            TTRACE_INPUT_END();
             return;
+        }
+#ifdef _F_MULTI_PASSIVE_GRAB_
+        if (grab && device->deviceGrab.fromPassiveGrab &&
+            GrabIsKeyboardGrab(device->deviceGrab.grab))
+            GrabbedDeviceEvents(device, grab, event);
+#endif //_F_MULTI_PASSIVE_GRAB_
         break;
     case ET_KeyRelease:
+#ifdef _F_MULTI_PASSIVE_GRAB_
+        if (grab && device->deviceGrab.fromPassiveGrab &&
+            (key != device->deviceGrab.activatingKey) &&
+            GrabIsKeyboardGrab(device->deviceGrab.grab)) {
+            GrabbedDeviceEvents(device, grab, event);
+            if (device->deviceGrab.activatingKey == 0 && IsGrabbedEventsEmpty(device))
+                deactivateDeviceGrab = TRUE;
+                freekeylist(device);
+        }
+        else if (grab && device->deviceGrab.fromPassiveGrab &&
+#else //_F_MULTI_PASSIVE_GRAB_
         if (grab && device->deviceGrab.fromPassiveGrab &&
+#endif //_F_MULTI_PASSIVE_GRAB_
             (key == device->deviceGrab.activatingKey) &&
             GrabIsKeyboardGrab(device->deviceGrab.grab))
-            deactivateDeviceGrab = TRUE;
+        {
+#ifdef _F_MULTI_PASSIVE_GRAB_
+            device->deviceGrab.activatingKey = 0;
+            if (IsGrabbedEventsEmpty(device)) {
+                freekeylist(device);
+#endif //_F_MULTI_PASSIVE_GRAB_
+                deactivateDeviceGrab = TRUE;
+#ifdef _F_MULTI_PASSIVE_GRAB_
+            }
+#endif //_F_MULTI_PASSIVE_GRAB_
+        }
         break;
     case ET_ButtonPress:
-        if (b->map[key] == 0)   /* there's no button 0 */
+        if (b->map[key] == 0) {   /* there's no button 0 */
+            TTRACE_INPUT_END();
             return;
+        }
         event->detail.button = b->map[key];
         if (!grab && CheckDeviceGrabs(device, event, 0)) {
             /* if a passive grab was activated, the event has been sent
              * already */
+            TTRACE_INPUT_END();
             return;
         }
         break;
     case ET_ButtonRelease:
-        if (b->map[key] == 0)   /* there's no button 0 */
+        if (b->map[key] == 0) {  /* there's no button 0 */
+            TTRACE_INPUT_END();
             return;
+        }
         event->detail.button = b->map[key];
         if (grab && !b->buttonsDown &&
             device->deviceGrab.fromPassiveGrab &&
@@ -1767,9 +2004,27 @@ ProcessDeviceEvent(InternalEvent *ev, DeviceIntPtr device)
         DeliverDeviceEvents(GetSpriteWindow(device), (InternalEvent *) event,
                             NullGrab, NullWindow, device);
 
-    if (deactivateDeviceGrab == TRUE)
+    if (deactivateDeviceGrab == TRUE) {
         (*device->deviceGrab.DeactivateGrab) (device);
+
+        if (!IsMaster (device) && !IsFloating (device)) {
+            int flags, num_events = 0;
+            InternalEvent dce;
+
+            flags = (IsPointerDevice (device)) ?
+                DEVCHANGE_POINTER_EVENT : DEVCHANGE_KEYBOARD_EVENT;
+            UpdateFromMaster (&dce, device, flags, &num_events);
+            BUG_WARN(num_events > 1);
+
+            if (num_events == 1)
+                ChangeMasterDeviceClasses(GetMaster (device, MASTER_ATTACHED),
+                                          &dce.changed_event);
+        }
+
+    }
+
     event->detail.key = key;
+    TTRACE_INPUT_END();
 }
 
 /**
@@ -1780,6 +2035,8 @@ ProcessDeviceEvent(InternalEvent *ev, DeviceIntPtr device)
 void
 ProcessOtherEvent(InternalEvent *ev, DeviceIntPtr device)
 {
+    TTRACE_INPUT_BEGIN("XORG:SERVER:ProcessOtherEvent");
+
     verify_internal_event(ev);
 
     switch (ev->any.type) {
@@ -1795,17 +2052,26 @@ ProcessOtherEvent(InternalEvent *ev, DeviceIntPtr device)
         break;
     case ET_TouchBegin:
     case ET_TouchUpdate:
-    case ET_TouchOwnership:
     case ET_TouchEnd:
         ProcessTouchEvent(ev, device);
         break;
     case ET_TouchCancel:
-        ProcessTouchCancelEvent(ev, device);
+        ProcessTouchCancelEvent(&ev->touch_cancel_event, device);
+        break;
+    case ET_TouchOwnership:
+        /* TouchOwnership events are handled separately from the rest, as they
+         * have more complex semantics. */
+        ProcessTouchOwnershipEvent(&ev->touch_ownership_event, device);
+        break;
+    case ET_BarrierHit:
+    case ET_BarrierLeave:
+        ProcessBarrierEvent(ev, device);
         break;
     default:
         ProcessDeviceEvent(ev, device);
         break;
     }
+    TTRACE_INPUT_END();
 }
 
 static int
@@ -1822,6 +2088,15 @@ DeliverTouchBeginEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
         listener->type == LISTENER_POINTER_GRAB) {
         rc = DeliverTouchEmulatedEvent(dev, ti, ev, listener, client, win,
                                        grab, xi2mask);
+        if (rc == Success) {
+            listener->state = LISTENER_IS_OWNER;
+            /* async grabs cannot replay, so automatically accept this touch */
+            if (listener->type == LISTENER_POINTER_GRAB &&
+                dev->deviceGrab.grab &&
+                dev->deviceGrab.fromPassiveGrab &&
+                dev->deviceGrab.grab->pointerMode == GrabModeAsync)
+                ActivateEarlyAccept(dev, ti);
+        }
         goto out;
     }
 
@@ -1839,7 +2114,7 @@ DeliverTouchBeginEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
         if (has_ownershipmask)
             TouchSendOwnershipEvent(dev, ti, 0, listener->listener);
 
-        if (!has_ownershipmask || listener->type == LISTENER_REGULAR)
+        if (listener->type == LISTENER_REGULAR)
             state = LISTENER_HAS_ACCEPTED;
         else
             state = LISTENER_IS_OWNER;
@@ -1859,21 +2134,36 @@ DeliverTouchEndEvent(DeviceIntPtr dev, TouchPointInfoPtr ti, InternalEvent *ev,
 
     if (listener->type == LISTENER_POINTER_REGULAR ||
         listener->type == LISTENER_POINTER_GRAB) {
-        rc = DeliverTouchEmulatedEvent(dev, ti, ev, listener, client, win,
-                                       grab, xi2mask);
-
-        if (ti->num_listeners > 1) {
-            ev->any.type = ET_TouchUpdate;
-            ev->device_event.flags |= TOUCH_PENDING_END;
-            if (!(ev->device_event.flags & TOUCH_CLIENT_ID))
-                ti->pending_finish = TRUE;
+        /* Note: If the active grab was ungrabbed, we already changed the
+         * state to LISTENER_HAS_END but still get here. So we mustn't
+         * actually send the event.
+         * This is part two of the hack in DeactivatePointerGrab
+         */
+        if (listener->state != LISTENER_HAS_END) {
+            rc = DeliverTouchEmulatedEvent(dev, ti, ev, listener, client, win,
+                                           grab, xi2mask);
+
+             /* Once we send a TouchEnd to a legacy listener, we're already well
+              * past the accepting/rejecting stage (can only happen on
+              * GrabModeSync + replay. This listener now gets the end event,
+              * and we can continue.
+              */
+            if (rc == Success)
+                listener->state = LISTENER_HAS_END;
         }
+        goto out;
+    }
 
+    /* A client is waiting for the begin, don't give it a TouchEnd */
+    if (listener->state == LISTENER_AWAITING_BEGIN) {
+        listener->state = LISTENER_HAS_END;
         goto out;
     }
 
     /* Event in response to reject */
-    if (ev->device_event.flags & TOUCH_REJECT) {
+    if (ev->device_event.flags & TOUCH_REJECT ||
+        (ev->device_event.flags & TOUCH_ACCEPT && !TouchResourceIsOwner(ti, listener->listener))) {
+        /* Touch has been rejected, or accepted by its owner which is not this listener */
         if (listener->state != LISTENER_HAS_END)
             rc = DeliverOneTouchEvent(client, dev, ti, grab, win, ev);
         listener->state = LISTENER_HAS_END;
@@ -1886,7 +2176,7 @@ DeliverTouchEndEvent(DeviceIntPtr dev, TouchPointInfoPtr ti, InternalEvent *ev,
             rc = DeliverOneTouchEvent(client, dev, ti, grab, win, ev);
 
         if ((ti->num_listeners > 1 ||
-             listener->state != LISTENER_HAS_ACCEPTED) &&
+             (ti->num_grabs > 0 && listener->state != LISTENER_HAS_ACCEPTED)) &&
             (ev->device_event.flags & (TOUCH_ACCEPT | TOUCH_REJECT)) == 0) {
             ev->any.type = ET_TouchUpdate;
             ev->device_event.flags |= TOUCH_PENDING_END;
@@ -1896,12 +2186,6 @@ DeliverTouchEndEvent(DeviceIntPtr dev, TouchPointInfoPtr ti, InternalEvent *ev,
         if (normal_end)
             listener->state = LISTENER_HAS_END;
     }
-    else if (ev->device_event.flags & TOUCH_ACCEPT) {
-        /* Touch has been accepted by its owner, which is not this listener */
-        if (listener->state != LISTENER_HAS_END)
-            rc = DeliverOneTouchEvent(client, dev, ti, grab, win, ev);
-        listener->state = LISTENER_HAS_END;
-    }
 
  out:
     return rc;
@@ -1997,6 +2281,9 @@ InitProximityClassDeviceStruct(DeviceIntPtr dev)
 {
     ProximityClassPtr proxc;
 
+    BUG_RETURN_VAL(dev == NULL, FALSE);
+    BUG_RETURN_VAL(dev->proximity != NULL, FALSE);
+
     proxc = (ProximityClassPtr) malloc(sizeof(ProximityClassRec));
     if (!proxc)
         return FALSE;
@@ -2022,10 +2309,10 @@ InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, Atom label, int minval,
 {
     AxisInfoPtr ax;
 
-    if (!dev || !dev->valuator || (minval > maxval && mode == Absolute))
-        return FALSE;
-    if (axnum >= dev->valuator->numAxes)
-        return FALSE;
+    BUG_RETURN_VAL(dev == NULL, FALSE);
+    BUG_RETURN_VAL(dev->valuator == NULL, FALSE);
+    BUG_RETURN_VAL(axnum >= dev->valuator->numAxes, FALSE);
+    BUG_RETURN_VAL(minval > maxval && mode == Absolute, FALSE);
 
     ax = dev->valuator->axes + axnum;
 
@@ -2055,8 +2342,9 @@ SetScrollValuator(DeviceIntPtr dev, int axnum, enum ScrollType type,
     InternalEvent dce;
     DeviceIntPtr master;
 
-    if (!dev || !dev->valuator || axnum >= dev->valuator->numAxes)
-        return FALSE;
+    BUG_RETURN_VAL(dev == NULL, FALSE);
+    BUG_RETURN_VAL(dev->valuator == NULL, FALSE);
+    BUG_RETURN_VAL(axnum >= dev->valuator->numAxes, FALSE);
 
     switch (type) {
     case SCROLL_TYPE_VERTICAL:
@@ -2127,7 +2415,8 @@ CheckGrabValues(ClientPtr client, GrabParameters *param)
         return BadValue;
     }
 
-    if (param->grabtype != XI2 && (param->modifiers != AnyModifier) &&
+    if (param->modifiers != AnyModifier &&
+        param->modifiers != XIAnyModifier &&
         (param->modifiers & ~AllModifiersMask)) {
         client->errorValue = param->modifiers;
         return BadValue;
@@ -2165,7 +2454,7 @@ GrabButton(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr modifier_device,
     if (param->cursor == None)
         cursor = NullCursor;
     else {
-        rc = dixLookupResourceByType((pointer *) &cursor, param->cursor,
+        rc = dixLookupResourceByType((void **) &cursor, param->cursor,
                                      RT_CURSOR, client, DixUseAccess);
         if (rc != Success) {
             client->errorValue = param->cursor;
@@ -2196,8 +2485,7 @@ GrabButton(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr modifier_device,
 }
 
 /**
- * Grab the given key. If grabtype is XI, the key is a keycode. If
- * grabtype is XI2, the key is a keysym.
+ * Grab the given key.
  */
 int
 GrabKey(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr modifier_device,
@@ -2265,7 +2553,7 @@ GrabWindow(ClientPtr client, DeviceIntPtr dev, int type,
     if (param->cursor == None)
         cursor = NullCursor;
     else {
-        rc = dixLookupResourceByType((pointer *) &cursor, param->cursor,
+        rc = dixLookupResourceByType((void **) &cursor, param->cursor,
                                      RT_CURSOR, client, DixUseAccess);
         if (rc != Success) {
             client->errorValue = param->cursor;
@@ -2408,7 +2696,7 @@ AddExtensionClient(WindowPtr pWin, ClientPtr client, Mask mask, int mskidx)
     others->resource = FakeClientID(client->index);
     others->next = pWin->optional->inputMasks->inputClients;
     pWin->optional->inputMasks->inputClients = others;
-    if (!AddResource(others->resource, RT_INPUTCLIENT, (pointer) pWin))
+    if (!AddResource(others->resource, RT_INPUTCLIENT, (void *) pWin))
         goto bail;
     return Success;
 
@@ -2510,7 +2798,7 @@ InputClientGone(WindowPtr pWin, XID id)
                 else {
                     other->resource = FakeClientID(0);
                     if (!AddResource(other->resource, RT_INPUTCLIENT,
-                                     (pointer) pWin))
+                                     (void *) pWin))
                         return BadAlloc;
                 }
             }
@@ -2821,7 +3109,7 @@ CheckDeviceGrabAndHintWindow(WindowPtr pWin, int type,
              (deliveryMask & DeviceButtonGrabMask)) {
         GrabPtr tempGrab;
 
-        tempGrab = AllocGrab();
+        tempGrab = AllocGrab(NULL);
         if (!tempGrab)
             return;
 
index e4b1d5a..bf2f7c0 100644 (file)
@@ -122,6 +122,7 @@ SOFTWARE.
 #include "xiqueryversion.h"
 #include "xisetclientpointer.h"
 #include "xiwarppointer.h"
+#include "xibarriers.h"
 
 /* Masks for XI events have to be aligned with core event (partially anyway).
  * If DeviceButtonMotionMask is != ButtonMotionMask, event delivery
@@ -251,7 +252,8 @@ static int (*ProcIVector[]) (ClientPtr) = {
         ProcXIChangeProperty,   /* 57 */
         ProcXIDeleteProperty,   /* 58 */
         ProcXIGetProperty,      /* 59 */
-        ProcXIGetSelectedEvents /* 60 */
+        ProcXIGetSelectedEvents, /* 60 */
+        ProcXIBarrierReleasePointer /* 61 */
 };
 
 /* For swapped clients */
@@ -316,7 +318,8 @@ static int (*SProcIVector[]) (ClientPtr) = {
         SProcXIChangeProperty,  /* 57 */
         SProcXIDeleteProperty,  /* 58 */
         SProcXIGetProperty,     /* 59 */
-        SProcXIGetSelectedEvents        /* 60 */
+        SProcXIGetSelectedEvents,       /* 60 */
+        SProcXIBarrierReleasePointer /* 61 */
 };
 
 /*****************************************************************
@@ -378,7 +381,7 @@ DevPrivateKeyRec XIClientPrivateKeyRec;
  */
 
 static void
-XIClientCallback(CallbackListPtr *list, pointer closure, pointer data)
+XIClientCallback(CallbackListPtr *list, void *closure, void *data)
 {
     NewClientInfoRec *clientinfo = (NewClientInfoRec *) data;
     ClientPtr pClient = clientinfo->client;
@@ -646,7 +649,7 @@ SDeviceChangedEvent(xXIDeviceChangedEvent * from, xXIDeviceChangedEvent * to)
     *to = *from;
     memcpy(&to[1], &from[1], from->length * 4);
 
-    any = (xXIAnyInfo *) & to[1];
+    any = (xXIAnyInfo *) &to[1];
     for (i = 0; i < to->num_classes; i++) {
         int length = any->length;
 
@@ -654,7 +657,7 @@ SDeviceChangedEvent(xXIDeviceChangedEvent * from, xXIDeviceChangedEvent * to)
         case KeyClass:
         {
             xXIKeyInfo *ki = (xXIKeyInfo *) any;
-            uint32_t *key = (uint32_t *) & ki[1];
+            uint32_t *key = (uint32_t *) &ki[1];
 
             for (j = 0; j < ki->num_keycodes; j++, key++)
                 swapl(key);
@@ -765,7 +768,7 @@ SDeviceHierarchyEvent(xXIHierarchyEvent * from, xXIHierarchyEvent * to)
     swapl(&to->flags);
     swaps(&to->num_info);
 
-    info = (xXIHierarchyInfo *) & to[1];
+    info = (xXIHierarchyInfo *) &to[1];
     for (i = 0; i < from->num_info; i++) {
         swaps(&info->deviceid);
         swaps(&info->attachment);
@@ -855,6 +858,32 @@ STouchCancelEvent(xXITouchCancelEvent * from, xXITouchCancelEvent * to)
     swapl(&to->child);
 }
 
+static void
+SBarrierEvent(xXIBarrierEvent * from,
+              xXIBarrierEvent * to) {
+
+    *to = *from;
+
+    swaps(&to->sequenceNumber);
+    swapl(&to->length);
+    swaps(&to->evtype);
+    swapl(&to->time);
+    swaps(&to->deviceid);
+    swaps(&to->sourceid);
+    swapl(&to->event);
+    swapl(&to->root);
+    swapl(&to->root_x);
+    swapl(&to->root_y);
+
+    swapl(&to->dx.integral);
+    swapl(&to->dx.frac);
+    swapl(&to->dy.integral);
+    swapl(&to->dy.frac);
+    swapl(&to->dtime);
+    swapl(&to->barrier);
+    swapl(&to->eventid);
+}
+
 /** Event swapping function for XI2 events. */
 void
 XI2EventSwap(xGenericEvent *from, xGenericEvent *to)
@@ -904,6 +933,11 @@ XI2EventSwap(xGenericEvent *from, xGenericEvent *to)
     case XI_RawTouchEnd:
         SRawEvent((xXIRawEvent *) from, (xXIRawEvent *) to);
         break;
+    case XI_BarrierHit:
+    case XI_BarrierLeave:
+        SBarrierEvent((xXIBarrierEvent *) from,
+                      (xXIBarrierEvent *) to);
+        break;
     default:
         ErrorF("[Xi] Unknown event type to swap. This is a bug.\n");
         break;
@@ -1156,6 +1190,8 @@ IResetProc(ExtensionEntry * unused)
 
     free(xi_all_devices.name);
     free(xi_all_master_devices.name);
+
+    XIBarrierReset();
 }
 
 /***********************************************************************
@@ -1282,6 +1318,9 @@ XInputExtensionInit(void)
     if (!AddCallback(&ClientStateCallback, XIClientCallback, 0))
         FatalError("Failed to add callback to XI.\n");
 
+    if (!XIBarrierInit())
+        FatalError("Could not initialize barriers.\n");
+
     extEntry = AddExtension(INAME, IEVENTS, IERRORS, ProcIDispatch,
                             SProcIDispatch, IResetProc, StandardMinorOpcode);
     if (extEntry) {
index 443ef56..0900438 100644 (file)
@@ -175,10 +175,7 @@ CreateMaskFromList(ClientPtr client, XEventClass * list, int count,
     int device;
     DeviceIntPtr tdev;
 
-    for (i = 0; i < EMASKSIZE; i++) {
-        mask[i].mask = 0;
-        mask[i].dev = NULL;
-    }
+    memset(mask, 0, EMASKSIZE * sizeof(struct tmask));
 
     for (i = 0; i < count; i++, list++) {
         device = *list >> 8;
@@ -194,7 +191,7 @@ CreateMaskFromList(ClientPtr client, XEventClass * list, int count,
         for (j = 0; j < ExtEventIndex; j++)
             if (EventInfo[j].type == (*list & 0xff)) {
                 mask[device].mask |= EventInfo[j].mask;
-                mask[device].dev = (Pointer) tdev;
+                mask[device].dev = (void *) tdev;
                 break;
             }
     }
index 4642b19..cde5351 100644 (file)
@@ -131,7 +131,7 @@ ProcXGetDeviceMotionEvents(ClientPtr client)
     num_events = v->numMotionEvents;
     if (num_events) {
         size = sizeof(Time) + (axes * sizeof(INT32));
-        rep.nEvents = GetMotionHistory(dev, (xTimecoord **) & coords,   /* XXX */
+        rep.nEvents = GetMotionHistory(dev, (xTimecoord **) &coords,   /* XXX */
                                        start.milliseconds, stop.milliseconds,
                                        (ScreenPtr) NULL, FALSE);
     }
index 014c61d..6a10091 100644 (file)
@@ -119,9 +119,9 @@ SizeDeviceInfo(DeviceIntPtr d, int *namesize, int *size)
  */
 
 static void
-CopyDeviceName(char **namebuf, char *name)
+CopyDeviceName(char **namebuf, const char *name)
 {
-    char *nameptr = (char *) *namebuf;
+    char *nameptr = *namebuf;
 
     if (name) {
         *nameptr++ = strlen(name);
index 4c9c99f..463e4f3 100644 (file)
@@ -110,6 +110,9 @@ ProcXSetDeviceValuators(ClientPtr client)
     if (dev->valuator == NULL)
         return BadMatch;
 
+    if (IsXTestDevice(dev, NULL))
+        return BadMatch;
+
     if (stuff->first_valuator + stuff->num_valuators > dev->valuator->numAxes)
         return BadValue;
 
index 5356552..5ed0913 100644 (file)
@@ -104,6 +104,10 @@ ProcXSetDeviceMode(ClientPtr client)
         return rc;
     if (dev->valuator == NULL)
         return BadMatch;
+
+    if (IsXTestDevice(dev, NULL))
+        return BadMatch;
+
     if ((dev->deviceGrab.grab) && !SameClient(dev->deviceGrab.grab, client))
         rep.status = AlreadyGrabbed;
     else
index c4632fa..b02510e 100644 (file)
@@ -127,7 +127,7 @@ ProcXUngrabDeviceButton(ClientPtr client)
         (stuff->modifiers & ~AllModifiersMask))
         return BadValue;
 
-    temporaryGrab = AllocGrab();
+    temporaryGrab = AllocGrab(NULL);
     if (!temporaryGrab)
         return BadAlloc;
 
index 3273878..f981171 100644 (file)
@@ -134,7 +134,7 @@ ProcXUngrabDeviceKey(ClientPtr client)
         (stuff->modifiers & ~AllModifiersMask))
         return BadValue;
 
-    temporaryGrab = AllocGrab();
+    temporaryGrab = AllocGrab(NULL);
     if (!temporaryGrab)
         return BadAlloc;
 
index 62a0727..ebef233 100644 (file)
@@ -81,7 +81,7 @@ ProcXIAllowEvents(ClientPtr client)
         have_xi22 = TRUE;
     }
     else {
-        REQUEST_SIZE_MATCH(xXIAllowEventsReq);
+        REQUEST_AT_LEAST_SIZE(xXIAllowEventsReq);
     }
 
     ret = dixLookupDevice(&dev, stuff->deviceid, client, DixGetAttrAccess);
diff --git a/Xi/xibarriers.c b/Xi/xibarriers.c
new file mode 100644 (file)
index 0000000..a8b92cc
--- /dev/null
@@ -0,0 +1,931 @@
+/*
+ * Copyright 2012 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * 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.
+ *
+ * Copyright Â© 2002 Keith Packard
+ *
+ * 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 Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission.  Keith Packard makes no
+ * representations about the suitability of this software for any purpose.  It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD 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_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "xibarriers.h"
+#include "scrnintstr.h"
+#include "cursorstr.h"
+#include "dixevents.h"
+#include "servermd.h"
+#include "mipointer.h"
+#include "inputstr.h"
+#include "windowstr.h"
+#include "xace.h"
+#include "list.h"
+#include "exglobals.h"
+#include "eventstr.h"
+#include "mi.h"
+
+RESTYPE PointerBarrierType;
+
+static DevPrivateKeyRec BarrierScreenPrivateKeyRec;
+
+#define BarrierScreenPrivateKey (&BarrierScreenPrivateKeyRec)
+
+typedef struct PointerBarrierClient *PointerBarrierClientPtr;
+
+struct PointerBarrierDevice {
+    struct xorg_list entry;
+    int deviceid;
+    Time last_timestamp;
+    int barrier_event_id;
+    int release_event_id;
+    Bool hit;
+    Bool seen;
+};
+
+struct PointerBarrierClient {
+    XID id;
+    ScreenPtr screen;
+    Window window;
+    struct PointerBarrier barrier;
+    struct xorg_list entry;
+    /* num_devices/device_ids are devices the barrier applies to */
+    int num_devices;
+    int *device_ids; /* num_devices */
+
+    /* per_device keeps track of devices actually blocked by barriers */
+    struct xorg_list per_device;
+};
+
+typedef struct _BarrierScreen {
+    struct xorg_list barriers;
+} BarrierScreenRec, *BarrierScreenPtr;
+
+#define GetBarrierScreen(s) ((BarrierScreenPtr)dixLookupPrivate(&(s)->devPrivates, BarrierScreenPrivateKey))
+#define GetBarrierScreenIfSet(s) GetBarrierScreen(s)
+#define SetBarrierScreen(s,p) dixSetPrivate(&(s)->devPrivates, BarrierScreenPrivateKey, p)
+
+static struct PointerBarrierDevice *AllocBarrierDevice(void)
+{
+    struct PointerBarrierDevice *pbd = NULL;
+
+    pbd = malloc(sizeof(struct PointerBarrierDevice));
+    if (!pbd)
+        return NULL;
+
+    pbd->deviceid = -1; /* must be set by caller */
+    pbd->barrier_event_id = 1;
+    pbd->release_event_id = 0;
+    pbd->hit = FALSE;
+    pbd->seen = FALSE;
+    xorg_list_init(&pbd->entry);
+
+    return pbd;
+}
+
+static void FreePointerBarrierClient(struct PointerBarrierClient *c)
+{
+    struct PointerBarrierDevice *pbd = NULL, *tmp = NULL;
+
+    xorg_list_for_each_entry_safe(pbd, tmp, &c->per_device, entry) {
+        free(pbd);
+    }
+    free(c);
+}
+
+static struct PointerBarrierDevice *GetBarrierDevice(struct PointerBarrierClient *c, int deviceid)
+{
+    struct PointerBarrierDevice *pbd = NULL;
+
+    xorg_list_for_each_entry(pbd, &c->per_device, entry) {
+        if (pbd->deviceid == deviceid)
+            break;
+    }
+
+    BUG_WARN(!pbd);
+    return pbd;
+}
+
+static BOOL
+barrier_is_horizontal(const struct PointerBarrier *barrier)
+{
+    return barrier->y1 == barrier->y2;
+}
+
+static BOOL
+barrier_is_vertical(const struct PointerBarrier *barrier)
+{
+    return barrier->x1 == barrier->x2;
+}
+
+/**
+ * @return The set of barrier movement directions the movement vector
+ * x1/y1 â†’ x2/y2 represents.
+ */
+int
+barrier_get_direction(int x1, int y1, int x2, int y2)
+{
+    int direction = 0;
+
+    /* which way are we trying to go */
+    if (x2 > x1)
+        direction |= BarrierPositiveX;
+    if (x2 < x1)
+        direction |= BarrierNegativeX;
+    if (y2 > y1)
+        direction |= BarrierPositiveY;
+    if (y2 < y1)
+        direction |= BarrierNegativeY;
+
+    return direction;
+}
+
+/**
+ * Test if the barrier may block movement in the direction defined by
+ * x1/y1 â†’ x2/y2. This function only tests whether the directions could be
+ * blocked, it does not test if the barrier actually blocks the movement.
+ *
+ * @return TRUE if the barrier blocks the direction of movement or FALSE
+ * otherwise.
+ */
+BOOL
+barrier_is_blocking_direction(const struct PointerBarrier * barrier,
+                              int direction)
+{
+    /* Barriers define which way is ok, not which way is blocking */
+    return (barrier->directions & direction) != direction;
+}
+
+static BOOL
+inside_segment(int v, int v1, int v2)
+{
+    if (v1 < 0 && v2 < 0) /* line */
+        return TRUE;
+    else if (v1 < 0)      /* ray */
+        return v <= v2;
+    else if (v2 < 0)      /* ray */
+        return v >= v1;
+    else                  /* line segment */
+        return v >= v1 && v <= v2;
+}
+
+#define T(v, a, b) (((float)v) - (a)) / ((b) - (a))
+#define F(t, a, b) ((t) * ((a) - (b)) + (a))
+
+/**
+ * Test if the movement vector x1/y1 â†’ x2/y2 is intersecting with the
+ * barrier. A movement vector with the startpoint or endpoint adjacent to
+ * the barrier itself counts as intersecting.
+ *
+ * @param x1 X start coordinate of movement vector
+ * @param y1 Y start coordinate of movement vector
+ * @param x2 X end coordinate of movement vector
+ * @param y2 Y end coordinate of movement vector
+ * @param[out] distance The distance between the start point and the
+ * intersection with the barrier (if applicable).
+ * @return TRUE if the barrier intersects with the given vector
+ */
+BOOL
+barrier_is_blocking(const struct PointerBarrier * barrier,
+                    int x1, int y1, int x2, int y2, double *distance)
+{
+    if (barrier_is_vertical(barrier)) {
+        float t, y;
+        t = T(barrier->x1, x1, x2);
+        if (t < 0 || t > 1)
+            return FALSE;
+
+        /* Edge case: moving away from barrier. */
+        if (x2 > x1 && t == 0)
+            return FALSE;
+
+        y = F(t, y1, y2);
+        if (!inside_segment(y, barrier->y1, barrier->y2))
+            return FALSE;
+
+        *distance = sqrt((pow(y - y1, 2) + pow(barrier->x1 - x1, 2)));
+        return TRUE;
+    }
+    else {
+        float t, x;
+        t = T(barrier->y1, y1, y2);
+        if (t < 0 || t > 1)
+            return FALSE;
+
+        /* Edge case: moving away from barrier. */
+        if (y2 > y1 && t == 0)
+            return FALSE;
+
+        x = F(t, x1, x2);
+        if (!inside_segment(x, barrier->x1, barrier->x2))
+            return FALSE;
+
+        *distance = sqrt((pow(x - x1, 2) + pow(barrier->y1 - y1, 2)));
+        return TRUE;
+    }
+}
+
+#define HIT_EDGE_EXTENTS 2
+static BOOL
+barrier_inside_hit_box(struct PointerBarrier *barrier, int x, int y)
+{
+    int x1, x2, y1, y2;
+    int dir;
+
+    x1 = barrier->x1;
+    x2 = barrier->x2;
+    y1 = barrier->y1;
+    y2 = barrier->y2;
+    dir = ~(barrier->directions);
+
+    if (barrier_is_vertical(barrier)) {
+        if (dir & BarrierPositiveX)
+            x1 -= HIT_EDGE_EXTENTS;
+        if (dir & BarrierNegativeX)
+            x2 += HIT_EDGE_EXTENTS;
+    }
+    if (barrier_is_horizontal(barrier)) {
+        if (dir & BarrierPositiveY)
+            y1 -= HIT_EDGE_EXTENTS;
+        if (dir & BarrierNegativeY)
+            y2 += HIT_EDGE_EXTENTS;
+    }
+
+    return x >= x1 && x <= x2 && y >= y1 && y <= y2;
+}
+
+static BOOL
+barrier_blocks_device(struct PointerBarrierClient *client,
+                      DeviceIntPtr dev)
+{
+    int i;
+    int master_id;
+
+    /* Clients with no devices are treated as
+     * if they specified XIAllDevices. */
+    if (client->num_devices == 0)
+        return TRUE;
+
+    master_id = GetMaster(dev, POINTER_OR_FLOAT)->id;
+
+    for (i = 0; i < client->num_devices; i++) {
+        int device_id = client->device_ids[i];
+        if (device_id == XIAllDevices ||
+            device_id == XIAllMasterDevices ||
+            device_id == master_id)
+            return TRUE;
+    }
+
+    return FALSE;
+}
+
+/**
+ * Find the nearest barrier client that is blocking movement from x1/y1 to x2/y2.
+ *
+ * @param dir Only barriers blocking movement in direction dir are checked
+ * @param x1 X start coordinate of movement vector
+ * @param y1 Y start coordinate of movement vector
+ * @param x2 X end coordinate of movement vector
+ * @param y2 Y end coordinate of movement vector
+ * @return The barrier nearest to the movement origin that blocks this movement.
+ */
+static struct PointerBarrierClient *
+barrier_find_nearest(BarrierScreenPtr cs, DeviceIntPtr dev,
+                     int dir,
+                     int x1, int y1, int x2, int y2)
+{
+    struct PointerBarrierClient *c, *nearest = NULL;
+    double min_distance = INT_MAX;      /* can't get higher than that in X anyway */
+
+    xorg_list_for_each_entry(c, &cs->barriers, entry) {
+        struct PointerBarrier *b = &c->barrier;
+        struct PointerBarrierDevice *pbd;
+        double distance;
+
+        pbd = GetBarrierDevice(c, dev->id);
+        if (pbd->seen)
+            continue;
+
+        if (!barrier_is_blocking_direction(b, dir))
+            continue;
+
+        if (!barrier_blocks_device(c, dev))
+            continue;
+
+        if (barrier_is_blocking(b, x1, y1, x2, y2, &distance)) {
+            if (min_distance > distance) {
+                min_distance = distance;
+                nearest = c;
+            }
+        }
+    }
+
+    return nearest;
+}
+
+/**
+ * Clamp to the given barrier given the movement direction specified in dir.
+ *
+ * @param barrier The barrier to clamp to
+ * @param dir The movement direction
+ * @param[out] x The clamped x coordinate.
+ * @param[out] y The clamped x coordinate.
+ */
+void
+barrier_clamp_to_barrier(struct PointerBarrier *barrier, int dir, int *x,
+                         int *y)
+{
+    if (barrier_is_vertical(barrier)) {
+        if ((dir & BarrierNegativeX) & ~barrier->directions)
+            *x = barrier->x1;
+        if ((dir & BarrierPositiveX) & ~barrier->directions)
+            *x = barrier->x1 - 1;
+    }
+    if (barrier_is_horizontal(barrier)) {
+        if ((dir & BarrierNegativeY) & ~barrier->directions)
+            *y = barrier->y1;
+        if ((dir & BarrierPositiveY) & ~barrier->directions)
+            *y = barrier->y1 - 1;
+    }
+}
+
+void
+input_constrain_cursor(DeviceIntPtr dev, ScreenPtr screen,
+                       int current_x, int current_y,
+                       int dest_x, int dest_y,
+                       int *out_x, int *out_y,
+                       int *nevents, InternalEvent* events)
+{
+    /* Clamped coordinates here refer to screen edge clamping. */
+    BarrierScreenPtr cs = GetBarrierScreen(screen);
+    int x = dest_x,
+        y = dest_y;
+    int dir;
+    struct PointerBarrier *nearest = NULL;
+    PointerBarrierClientPtr c;
+    Time ms = GetTimeInMillis();
+    BarrierEvent ev = {
+        .header = ET_Internal,
+        .type = 0,
+        .length = sizeof (BarrierEvent),
+        .time = ms,
+        .deviceid = dev->id,
+        .sourceid = dev->id,
+        .dx = dest_x - current_x,
+        .dy = dest_y - current_y,
+        .root = screen->root->drawable.id,
+    };
+    InternalEvent *barrier_events = events;
+    DeviceIntPtr master;
+
+    if (nevents)
+        *nevents = 0;
+
+    if (xorg_list_is_empty(&cs->barriers) || IsFloating(dev))
+        goto out;
+
+    /**
+     * This function is only called for slave devices, but pointer-barriers
+     * are for master-devices only. Flip the device to the master here,
+     * continue with that.
+     */
+    master = GetMaster(dev, MASTER_POINTER);
+
+    /* How this works:
+     * Given the origin and the movement vector, get the nearest barrier
+     * to the origin that is blocking the movement.
+     * Clamp to that barrier.
+     * Then, check from the clamped intersection to the original
+     * destination, again finding the nearest barrier and clamping.
+     */
+    dir = barrier_get_direction(current_x, current_y, x, y);
+
+    while (dir != 0) {
+        int new_sequence;
+        struct PointerBarrierDevice *pbd;
+
+        c = barrier_find_nearest(cs, master, dir, current_x, current_y, x, y);
+        if (!c)
+            break;
+
+        nearest = &c->barrier;
+
+        pbd = GetBarrierDevice(c, master->id);
+        new_sequence = !pbd->hit;
+
+        pbd->seen = TRUE;
+        pbd->hit = TRUE;
+
+        if (pbd->barrier_event_id == pbd->release_event_id)
+            continue;
+
+        ev.type = ET_BarrierHit;
+        barrier_clamp_to_barrier(nearest, dir, &x, &y);
+
+        if (barrier_is_vertical(nearest)) {
+            dir &= ~(BarrierNegativeX | BarrierPositiveX);
+            current_x = x;
+        }
+        else if (barrier_is_horizontal(nearest)) {
+            dir &= ~(BarrierNegativeY | BarrierPositiveY);
+            current_y = y;
+        }
+
+        ev.flags = 0;
+        ev.event_id = pbd->barrier_event_id;
+        ev.barrierid = c->id;
+
+        ev.dt = new_sequence ? 0 : ms - pbd->last_timestamp;
+        ev.window = c->window;
+        pbd->last_timestamp = ms;
+
+        /* root x/y is filled in later */
+
+        barrier_events->barrier_event = ev;
+        barrier_events++;
+        *nevents += 1;
+    }
+
+    xorg_list_for_each_entry(c, &cs->barriers, entry) {
+        struct PointerBarrierDevice *pbd;
+        int flags = 0;
+
+        pbd = GetBarrierDevice(c, master->id);
+        pbd->seen = FALSE;
+        if (!pbd->hit)
+            continue;
+
+        if (barrier_inside_hit_box(&c->barrier, x, y))
+            continue;
+
+        pbd->hit = FALSE;
+
+        ev.type = ET_BarrierLeave;
+
+        if (pbd->barrier_event_id == pbd->release_event_id)
+            flags |= XIBarrierPointerReleased;
+
+        ev.flags = flags;
+        ev.event_id = pbd->barrier_event_id;
+        ev.barrierid = c->id;
+
+        ev.dt = ms - pbd->last_timestamp;
+        ev.window = c->window;
+        pbd->last_timestamp = ms;
+
+        /* root x/y is filled in later */
+
+        barrier_events->barrier_event = ev;
+        barrier_events++;
+        *nevents += 1;
+
+        /* If we've left the hit box, this is the
+         * start of a new event ID. */
+        pbd->barrier_event_id++;
+    }
+
+ out:
+    *out_x = x;
+    *out_y = y;
+}
+
+static void
+sort_min_max(INT16 *a, INT16 *b)
+{
+    INT16 A, B;
+    if (*a < 0 || *b < 0)
+        return;
+    A = *a;
+    B = *b;
+    *a = min(A, B);
+    *b = max(A, B);
+}
+
+static int
+CreatePointerBarrierClient(ClientPtr client,
+                           xXFixesCreatePointerBarrierReq * stuff,
+                           PointerBarrierClientPtr *client_out)
+{
+    WindowPtr pWin;
+    ScreenPtr screen;
+    BarrierScreenPtr cs;
+    int err;
+    int size;
+    int i;
+    struct PointerBarrierClient *ret;
+    CARD16 *in_devices;
+    DeviceIntPtr dev;
+
+    size = sizeof(*ret) + sizeof(DeviceIntPtr) * stuff->num_devices;
+    ret = malloc(size);
+
+    if (!ret) {
+        return BadAlloc;
+    }
+
+    xorg_list_init(&ret->per_device);
+
+    err = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess);
+    if (err != Success) {
+        client->errorValue = stuff->window;
+        goto error;
+    }
+
+    screen = pWin->drawable.pScreen;
+    cs = GetBarrierScreen(screen);
+
+    ret->screen = screen;
+    ret->window = stuff->window;
+    ret->num_devices = stuff->num_devices;
+    if (ret->num_devices > 0)
+        ret->device_ids = (int*)&ret[1];
+    else
+        ret->device_ids = NULL;
+
+    in_devices = (CARD16 *) &stuff[1];
+    for (i = 0; i < stuff->num_devices; i++) {
+        int device_id = in_devices[i];
+        DeviceIntPtr device;
+
+        if ((err = dixLookupDevice (&device, device_id,
+                                    client, DixReadAccess))) {
+            client->errorValue = device_id;
+            goto error;
+        }
+
+        if (!IsMaster (device)) {
+            client->errorValue = device_id;
+            err = BadDevice;
+            goto error;
+        }
+
+        ret->device_ids[i] = device_id;
+    }
+
+    /* Alloc one per master pointer, they're the ones that can be blocked */
+    xorg_list_init(&ret->per_device);
+    nt_list_for_each_entry(dev, inputInfo.devices, next) {
+        struct PointerBarrierDevice *pbd;
+
+        if (dev->type != MASTER_POINTER)
+            continue;
+
+        pbd = AllocBarrierDevice();
+        if (!pbd) {
+            err = BadAlloc;
+            goto error;
+        }
+        pbd->deviceid = dev->id;
+
+        xorg_list_add(&pbd->entry, &ret->per_device);
+    }
+
+    ret->id = stuff->barrier;
+    ret->barrier.x1 = stuff->x1;
+    ret->barrier.x2 = stuff->x2;
+    ret->barrier.y1 = stuff->y1;
+    ret->barrier.y2 = stuff->y2;
+    sort_min_max(&ret->barrier.x1, &ret->barrier.x2);
+    sort_min_max(&ret->barrier.y1, &ret->barrier.y2);
+    ret->barrier.directions = stuff->directions & 0x0f;
+    if (barrier_is_horizontal(&ret->barrier))
+        ret->barrier.directions &= ~(BarrierPositiveX | BarrierNegativeX);
+    if (barrier_is_vertical(&ret->barrier))
+        ret->barrier.directions &= ~(BarrierPositiveY | BarrierNegativeY);
+    xorg_list_add(&ret->entry, &cs->barriers);
+
+    *client_out = ret;
+    return Success;
+
+ error:
+    *client_out = NULL;
+    FreePointerBarrierClient(ret);
+    return err;
+}
+
+static int
+BarrierFreeBarrier(void *data, XID id)
+{
+    struct PointerBarrierClient *c;
+    Time ms = GetTimeInMillis();
+    DeviceIntPtr dev = NULL;
+    ScreenPtr screen;
+
+    c = container_of(data, struct PointerBarrierClient, barrier);
+    screen = c->screen;
+
+    for (dev = inputInfo.devices; dev; dev = dev->next) {
+        struct PointerBarrierDevice *pbd;
+        int root_x, root_y;
+        BarrierEvent ev = {
+            .header = ET_Internal,
+            .type = ET_BarrierLeave,
+            .length = sizeof (BarrierEvent),
+            .time = ms,
+            /* .deviceid */
+            .sourceid = 0,
+            .barrierid = c->id,
+            .window = c->window,
+            .root = screen->root->drawable.id,
+            .dx = 0,
+            .dy = 0,
+            /* .root_x */
+            /* .root_y */
+            /* .dt */
+            /* .event_id */
+            .flags = XIBarrierPointerReleased,
+        };
+
+
+        if (dev->type != MASTER_POINTER)
+            continue;
+
+        pbd = GetBarrierDevice(c, dev->id);
+        if (!pbd->hit)
+            continue;
+
+        ev.deviceid = dev->id;
+        ev.event_id = pbd->barrier_event_id;
+        ev.dt = ms - pbd->last_timestamp;
+
+        GetSpritePosition(dev, &root_x, &root_y);
+        ev.root_x = root_x;
+        ev.root_y = root_y;
+
+        mieqEnqueue(dev, (InternalEvent *) &ev);
+    }
+
+    xorg_list_del(&c->entry);
+
+    FreePointerBarrierClient(c);
+    return Success;
+}
+
+static void add_master_func(void *res, XID id, void *devid)
+{
+    struct PointerBarrier *b;
+    struct PointerBarrierClient *barrier;
+    struct PointerBarrierDevice *pbd;
+    int *deviceid = devid;
+
+    b = res;
+    barrier = container_of(b, struct PointerBarrierClient, barrier);
+
+
+    pbd = AllocBarrierDevice();
+    pbd->deviceid = *deviceid;
+
+    xorg_list_add(&pbd->entry, &barrier->per_device);
+}
+
+static void remove_master_func(void *res, XID id, void *devid)
+{
+    struct PointerBarrierDevice *pbd;
+    struct PointerBarrierClient *barrier;
+    struct PointerBarrier *b;
+    DeviceIntPtr dev;
+    int *deviceid = devid;
+    int rc;
+    Time ms = GetTimeInMillis();
+
+    rc = dixLookupDevice(&dev, *deviceid, serverClient, DixSendAccess);
+    if (rc != Success)
+        return;
+
+    b = res;
+    barrier = container_of(b, struct PointerBarrierClient, barrier);
+
+    pbd = GetBarrierDevice(barrier, *deviceid);
+
+    if (pbd->hit) {
+        BarrierEvent ev = {
+            .header = ET_Internal,
+            .type =ET_BarrierLeave,
+            .length = sizeof (BarrierEvent),
+            .time = ms,
+            .deviceid = *deviceid,
+            .sourceid = 0,
+            .dx = 0,
+            .dy = 0,
+            .root = barrier->screen->root->drawable.id,
+            .window = barrier->window,
+            .dt = ms - pbd->last_timestamp,
+            .flags = XIBarrierPointerReleased,
+            .event_id = pbd->barrier_event_id,
+            .barrierid = barrier->id,
+        };
+
+        mieqEnqueue(dev, (InternalEvent *) &ev);
+    }
+
+    xorg_list_del(&pbd->entry);
+    free(pbd);
+}
+
+void XIBarrierNewMasterDevice(ClientPtr client, int deviceid)
+{
+    FindClientResourcesByType(client, PointerBarrierType, add_master_func, &deviceid);
+}
+
+void XIBarrierRemoveMasterDevice(ClientPtr client, int deviceid)
+{
+    FindClientResourcesByType(client, PointerBarrierType, remove_master_func, &deviceid);
+}
+
+int
+XICreatePointerBarrier(ClientPtr client,
+                       xXFixesCreatePointerBarrierReq * stuff)
+{
+    int err;
+    struct PointerBarrierClient *barrier;
+    struct PointerBarrier b;
+
+    b.x1 = stuff->x1;
+    b.x2 = stuff->x2;
+    b.y1 = stuff->y1;
+    b.y2 = stuff->y2;
+
+    if (!barrier_is_horizontal(&b) && !barrier_is_vertical(&b))
+        return BadValue;
+
+    /* no 0-sized barriers */
+    if (barrier_is_horizontal(&b) && barrier_is_vertical(&b))
+        return BadValue;
+
+    /* no infinite barriers on the wrong axis */
+    if (barrier_is_horizontal(&b) && (b.y1 < 0 || b.y2 < 0))
+        return BadValue;
+
+    if (barrier_is_vertical(&b) && (b.x1 < 0 || b.x2 < 0))
+        return BadValue;
+
+    if ((err = CreatePointerBarrierClient(client, stuff, &barrier)))
+        return err;
+
+    if (!AddResource(stuff->barrier, PointerBarrierType, &barrier->barrier))
+        return BadAlloc;
+
+    return Success;
+}
+
+int
+XIDestroyPointerBarrier(ClientPtr client,
+                        xXFixesDestroyPointerBarrierReq * stuff)
+{
+    int err;
+    void *barrier;
+
+    err = dixLookupResourceByType((void **) &barrier, stuff->barrier,
+                                  PointerBarrierType, client, DixDestroyAccess);
+    if (err != Success) {
+        client->errorValue = stuff->barrier;
+        return err;
+    }
+
+    if (CLIENT_ID(stuff->barrier) != client->index)
+        return BadAccess;
+
+    FreeResource(stuff->barrier, RT_NONE);
+    return Success;
+}
+
+int
+SProcXIBarrierReleasePointer(ClientPtr client)
+{
+    xXIBarrierReleasePointerInfo *info;
+    REQUEST(xXIBarrierReleasePointerReq);
+    int i;
+
+    info = (xXIBarrierReleasePointerInfo*) &stuff[1];
+
+    swaps(&stuff->length);
+    swapl(&stuff->num_barriers);
+    for (i = 0; i < stuff->num_barriers; i++, info++) {
+        swaps(&info->deviceid);
+        swapl(&info->barrier);
+        swapl(&info->eventid);
+    }
+
+    return (ProcXIBarrierReleasePointer(client));
+}
+
+int
+ProcXIBarrierReleasePointer(ClientPtr client)
+{
+    int i;
+    int err;
+    struct PointerBarrierClient *barrier;
+    struct PointerBarrier *b;
+    xXIBarrierReleasePointerInfo *info;
+
+    REQUEST(xXIBarrierReleasePointerReq);
+    REQUEST_AT_LEAST_SIZE(xXIBarrierReleasePointerReq);
+
+    info = (xXIBarrierReleasePointerInfo*) &stuff[1];
+    for (i = 0; i < stuff->num_barriers; i++, info++) {
+        struct PointerBarrierDevice *pbd;
+        DeviceIntPtr dev;
+        CARD32 barrier_id, event_id;
+        _X_UNUSED CARD32 device_id;
+
+        barrier_id = info->barrier;
+        event_id = info->eventid;
+
+        err = dixLookupDevice(&dev, info->deviceid, client, DixReadAccess);
+        if (err != Success) {
+            client->errorValue = BadDevice;
+            return err;
+        }
+
+        err = dixLookupResourceByType((void **) &b, barrier_id,
+                                      PointerBarrierType, client, DixReadAccess);
+        if (err != Success) {
+            client->errorValue = barrier_id;
+            return err;
+        }
+
+        if (CLIENT_ID(barrier_id) != client->index)
+            return BadAccess;
+
+
+        barrier = container_of(b, struct PointerBarrierClient, barrier);
+
+        pbd = GetBarrierDevice(barrier, dev->id);
+
+        if (pbd->barrier_event_id == event_id)
+            pbd->release_event_id = event_id;
+    }
+
+    return Success;
+}
+
+Bool
+XIBarrierInit(void)
+{
+    int i;
+
+    if (!dixRegisterPrivateKey(&BarrierScreenPrivateKeyRec, PRIVATE_SCREEN, 0))
+        return FALSE;
+
+    for (i = 0; i < screenInfo.numScreens; i++) {
+        ScreenPtr pScreen = screenInfo.screens[i];
+        BarrierScreenPtr cs;
+
+        cs = (BarrierScreenPtr) calloc(1, sizeof(BarrierScreenRec));
+        if (!cs)
+            return FALSE;
+        xorg_list_init(&cs->barriers);
+        SetBarrierScreen(pScreen, cs);
+    }
+
+    PointerBarrierType = CreateNewResourceType(BarrierFreeBarrier,
+                                               "XIPointerBarrier");
+
+    return PointerBarrierType;
+}
+
+void
+XIBarrierReset(void)
+{
+    int i;
+    for (i = 0; i < screenInfo.numScreens; i++) {
+        ScreenPtr pScreen = screenInfo.screens[i];
+        BarrierScreenPtr cs = GetBarrierScreen(pScreen);
+        free(cs);
+        SetBarrierScreen(pScreen, NULL);
+    }
+}
diff --git a/Xi/xibarriers.h b/Xi/xibarriers.h
new file mode 100644 (file)
index 0000000..f61b482
--- /dev/null
@@ -0,0 +1,48 @@
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#ifndef _XIBARRIERS_H_
+#define _XIBARRIERS_H_
+
+#include "resource.h"
+
+extern _X_EXPORT RESTYPE PointerBarrierType;
+
+struct PointerBarrier {
+    INT16 x1, x2, y1, y2;
+    CARD32 directions;
+};
+
+int
+barrier_get_direction(int, int, int, int);
+BOOL
+barrier_is_blocking(const struct PointerBarrier *, int, int, int, int,
+                        double *);
+BOOL
+barrier_is_blocking_direction(const struct PointerBarrier *, int);
+void
+barrier_clamp_to_barrier(struct PointerBarrier *barrier, int dir, int *x,
+                             int *y);
+
+#include <xfixesint.h>
+
+int
+XICreatePointerBarrier(ClientPtr client,
+                       xXFixesCreatePointerBarrierReq * stuff);
+
+int
+XIDestroyPointerBarrier(ClientPtr client,
+                        xXFixesDestroyPointerBarrierReq * stuff);
+
+Bool XIBarrierInit(void);
+void XIBarrierReset(void);
+
+int SProcXIBarrierReleasePointer(ClientPtr client);
+int ProcXIBarrierReleasePointer(ClientPtr client);
+
+void XIBarrierNewMasterDevice(ClientPtr client, int deviceid);
+void XIBarrierRemoveMasterDevice(ClientPtr client, int deviceid);
+
+#endif /* _XIBARRIERS_H_ */
index 0be6bc0..7a1bb7a 100644 (file)
@@ -96,7 +96,7 @@ ProcXIChangeCursor(ClientPtr client)
             pCursor = (CursorPtr) None;
     }
     else {
-        rc = dixLookupResourceByType((pointer *) &pCursor, stuff->cursor,
+        rc = dixLookupResourceByType((void **) &pCursor, stuff->cursor,
                                      RT_CURSOR, client, DixUseAccess);
         if (rc != Success)
             return rc;
index 89f16d8..9e36354 100644 (file)
@@ -52,6 +52,7 @@
 #include "xkbsrv.h"
 
 #include "xichangehierarchy.h"
+#include "xibarriers.h"
 
 /**
  * Send the current state of the device hierarchy to all clients.
@@ -79,7 +80,7 @@ XISendDeviceHierarchyEvent(int flags[MAXDEVICES])
     ev->flags = 0;
     ev->num_info = inputInfo.numDevices;
 
-    info = (xXIHierarchyInfo *) & ev[1];
+    info = (xXIHierarchyInfo *) &ev[1];
     for (dev = inputInfo.devices; dev; dev = dev->next) {
         info->deviceid = dev->id;
         info->enabled = dev->enabled;
@@ -142,6 +143,10 @@ add_master(ClientPtr client, xXIAddMasterInfo * c, int flags[MAXDEVICES])
     int rc;
 
     name = calloc(c->name_len + 1, sizeof(char));
+    if (name == NULL) {
+        rc = BadAlloc;
+        goto unwind;
+    }
     strncpy(name, (char *) &c[1], c->name_len);
 
     rc = AllocDevicePair(client, name, &ptr, &keybd,
@@ -189,6 +194,8 @@ add_master(ClientPtr client, xXIAddMasterInfo * c, int flags[MAXDEVICES])
     flags[XTestptr->id] |= XISlaveAttached;
     flags[XTestkeybd->id] |= XISlaveAttached;
 
+    XIBarrierNewMasterDevice(client, ptr->id);
+
  unwind:
     free(name);
     return rc;
@@ -293,6 +300,8 @@ remove_master(ClientPtr client, xXIRemoveMasterInfo * r, int flags[MAXDEVICES])
         }
     }
 
+    XIBarrierRemoveMasterDevice(client, ptr->id);
+
     /* disable the remove the devices, XTest devices must be done first
        else the sprites they rely on will be destroyed  */
     DisableDevice(XTestptr, FALSE);
@@ -304,15 +313,16 @@ remove_master(ClientPtr client, xXIRemoveMasterInfo * r, int flags[MAXDEVICES])
     flags[keybd->id] |= XIDeviceDisabled;
     flags[ptr->id] |= XIDeviceDisabled;
 
-    RemoveDevice(XTestptr, FALSE);
-    RemoveDevice(XTestkeybd, FALSE);
-    RemoveDevice(keybd, FALSE);
-    RemoveDevice(ptr, FALSE);
     flags[XTestptr->id] |= XISlaveRemoved;
     flags[XTestkeybd->id] |= XISlaveRemoved;
     flags[keybd->id] |= XIMasterRemoved;
     flags[ptr->id] |= XIMasterRemoved;
 
+    RemoveDevice(XTestptr, FALSE);
+    RemoveDevice(XTestkeybd, FALSE);
+    RemoveDevice(keybd, FALSE);
+    RemoveDevice(ptr, FALSE);
+
  unwind:
     return rc;
 }
index 09186e8..63d95bc 100644 (file)
@@ -67,6 +67,8 @@ ProcXIGrabDevice(ClientPtr client)
     uint8_t status;
     GrabMask mask = { 0 };
     int mask_len;
+    unsigned int keyboard_mode;
+    unsigned int pointer_mode;
 
     REQUEST(xXIGrabDeviceReq);
     REQUEST_AT_LEAST_SIZE(xXIGrabDeviceReq);
@@ -78,6 +80,15 @@ ProcXIGrabDevice(ClientPtr client)
     if (!IsMaster(dev))
         stuff->paired_device_mode = GrabModeAsync;
 
+    if (IsKeyboardDevice(dev)) {
+        keyboard_mode = stuff->grab_mode;
+        pointer_mode = stuff->paired_device_mode;
+    }
+    else {
+        keyboard_mode = stuff->paired_device_mode;
+        pointer_mode = stuff->grab_mode;
+    }
+
     if (XICheckInvalidMaskBits(client, (unsigned char *) &stuff[1],
                                stuff->mask_len * 4) != Success)
         return BadValue;
@@ -91,8 +102,8 @@ ProcXIGrabDevice(ClientPtr client)
     xi2mask_set_one_mask(mask.xi2mask, dev->id, (unsigned char *) &stuff[1],
                          mask_len);
 
-    ret = GrabDevice(client, dev, stuff->grab_mode,
-                     stuff->paired_device_mode,
+    ret = GrabDevice(client, dev, pointer_mode,
+                     keyboard_mode,
                      stuff->grab_window,
                      stuff->owner_events,
                      stuff->time,
index ddab53d..700622d 100644 (file)
@@ -50,7 +50,7 @@ int
 SProcXIPassiveGrabDevice(ClientPtr client)
 {
     int i;
-    xXIModifierInfo *mods;
+    uint32_t *mods;
 
     REQUEST(xXIPassiveGrabDeviceReq);
 
@@ -63,12 +63,10 @@ SProcXIPassiveGrabDevice(ClientPtr client)
     swaps(&stuff->mask_len);
     swaps(&stuff->num_modifiers);
 
-    mods = (xXIModifierInfo *) &stuff[1];
+    mods = (uint32_t *) &stuff[1] + stuff->mask_len;
 
     for (i = 0; i < stuff->num_modifiers; i++, mods++) {
-        swapl(&mods->base_mods);
-        swapl(&mods->latched_mods);
-        swapl(&mods->locked_mods);
+        swapl(mods);
     }
 
     return ProcXIPassiveGrabDevice(client);
@@ -191,6 +189,10 @@ ProcXIPassiveGrabDevice(ClientPtr client)
         uint8_t status = Success;
 
         param.modifiers = *modifiers;
+        ret = CheckGrabValues(client, &param);
+        if (ret != Success)
+            goto out;
+
         switch (stuff->grab_type) {
         case XIGrabtypeButton:
             status = GrabButton(client, dev, mod_dev, stuff->detail,
@@ -309,7 +311,7 @@ ProcXIPassiveUngrabDevice(ClientPtr client)
 
     mod_dev = (IsFloating(dev)) ? dev : GetMaster(dev, MASTER_KEYBOARD);
 
-    tempGrab = AllocGrab();
+    tempGrab = AllocGrab(NULL);
     if (!tempGrab)
         return BadAlloc;
 
old mode 100644 (file)
new mode 100755 (executable)
index 930ae73..8a29ac8
 #include "xiproperty.h"
 #include "xserver-properties.h"
 
+#ifdef _F_PREVENT_CURSOR_FLICKER_
+static Atom atomXMouseExist;
+int is_enable_cursor = 0;
+#endif //_F_PREVENT_CURSOR_FLICKER_
+
 /**
  * Properties used or alloced from inside the server.
  */
@@ -724,10 +729,10 @@ XIChangeDeviceProperty(DeviceIntPtr dev, Atom property, Atom type,
         total_len = prop_value->size + len;
 
     if (mode == PropModeReplace || len > 0) {
-        pointer new_data = NULL, old_data = NULL;
+        void *new_data = NULL, *old_data = NULL;
 
         total_size = total_len * size_in_bytes;
-        new_value.data = (pointer) malloc(total_size);
+        new_value.data = (void *) malloc(total_size);
         if (!new_value.data && total_size) {
             if (add)
                 XIDestroyDeviceProperty(prop);
@@ -743,13 +748,13 @@ XIChangeDeviceProperty(DeviceIntPtr dev, Atom property, Atom type,
             old_data = NULL;
             break;
         case PropModeAppend:
-            new_data = (pointer) (((char *) new_value.data) +
+            new_data = (void *) (((char *) new_value.data) +
                                   (prop_value->size * size_in_bytes));
             old_data = new_value.data;
             break;
         case PropModePrepend:
             new_data = new_value.data;
-            old_data = (pointer) (((char *) new_value.data) +
+            old_data = (void *) (((char *) new_value.data) +
                                   (prop_value->size * size_in_bytes));
             break;
         }
@@ -795,7 +800,16 @@ XIChangeDeviceProperty(DeviceIntPtr dev, Atom property, Atom type,
         prop->next = dev->properties.properties;
         dev->properties.properties = prop;
     }
-
+#ifdef _F_PREVENT_CURSOR_FLICKER_
+    if (!atomXMouseExist)
+    {
+       atomXMouseExist = MakeAtom("X Mouse Exist", strlen("X Mouse Exist"), TRUE);
+    }
+    if (property == atomXMouseExist)
+    {
+       memcpy((char *) &is_enable_cursor, (char *) prop_value->data, prop_value->size * size_in_bytes);
+    }
+#endif //_F_PREVENT_CURSOR_FLICKER_
     if (sendevent)
         send_property_event(dev, prop->propertyName,
                             (add) ? XIPropertyCreated : XIPropertyModified);
index 85c1dd8..4e544f0 100644 (file)
@@ -304,7 +304,7 @@ ListKeyInfo(DeviceIntPtr dev, xXIKeyInfo * info)
     info->length = sizeof(xXIKeyInfo) / 4 + info->num_keycodes;
     info->sourceid = dev->key->sourceid;
 
-    kc = (uint32_t *) & info[1];
+    kc = (uint32_t *) &info[1];
     for (i = xkb->min_key_code; i <= xkb->max_key_code; i++, kc++)
         *kc = i;
 
@@ -321,7 +321,7 @@ SwapKeyInfo(DeviceIntPtr dev, xXIKeyInfo * info)
     swaps(&info->length);
     swaps(&info->sourceid);
 
-    for (i = 0, key = (uint32_t *) & info[1]; i < info->num_keycodes;
+    for (i = 0, key = (uint32_t *) &info[1]; i < info->num_keycodes;
          i++, key++)
         swapl(key);
 
index 7e6852d..e9bdd42 100644 (file)
@@ -50,6 +50,7 @@
 #include "panoramiXsrv.h"
 #endif
 
+#include "inpututils.h"
 #include "xiquerypointer.h"
 
 /***********************************************************************
@@ -127,8 +128,8 @@ ProcXIQueryPointer(ClientPtr client)
         .sequenceNumber = client->sequence,
         .length = 6,
         .root = (GetCurrentRootWindow(pDev))->drawable.id,
-        .root_x = FP1616(pSprite->hot.x, 0),
-        .root_y = FP1616(pSprite->hot.y, 0),
+        .root_x = double_to_fp1616(pSprite->hot.x),
+        .root_y = double_to_fp1616(pSprite->hot.y),
         .child = None
     };
 
@@ -166,8 +167,8 @@ ProcXIQueryPointer(ClientPtr client)
 
     if (pSprite->hot.pScreen == pWin->drawable.pScreen) {
         rep.same_screen = xTrue;
-        rep.win_x = FP1616(pSprite->hot.x - pWin->drawable.x, 0);
-        rep.win_y = FP1616(pSprite->hot.y - pWin->drawable.y, 0);
+        rep.win_x = double_to_fp1616(pSprite->hot.x - pWin->drawable.x);
+        rep.win_y = double_to_fp1616(pSprite->hot.y - pWin->drawable.y);
         for (t = pSprite->win; t; t = t->parent)
             if (t->parent == pWin) {
                 rep.child = t->drawable.id;
@@ -182,11 +183,11 @@ ProcXIQueryPointer(ClientPtr client)
 
 #ifdef PANORAMIX
     if (!noPanoramiXExtension) {
-        rep.root_x += FP1616(screenInfo.screens[0]->x, 0);
-        rep.root_y += FP1616(screenInfo.screens[0]->y, 0);
+        rep.root_x += double_to_fp1616(screenInfo.screens[0]->x);
+        rep.root_y += double_to_fp1616(screenInfo.screens[0]->y);
         if (stuff->win == rep.root) {
-            rep.win_x += FP1616(screenInfo.screens[0]->x, 0);
-            rep.win_y += FP1616(screenInfo.screens[0]->y, 0);
+            rep.win_x += double_to_fp1616(screenInfo.screens[0]->x);
+            rep.win_y += double_to_fp1616(screenInfo.screens[0]->y);
         }
     }
 #endif
index b807a53..c705f78 100644 (file)
@@ -70,25 +70,46 @@ ProcXIQueryVersion(ClientPtr client)
 
     pXIClient = dixLookupPrivate(&client->devPrivates, XIClientPrivateKey);
 
+    if (version_compare(XIVersion.major_version, XIVersion.minor_version,
+                stuff->major_version, stuff->minor_version) > 0) {
+        major = stuff->major_version;
+        minor = stuff->minor_version;
+    } else {
+        major = XIVersion.major_version;
+        minor = XIVersion.minor_version;
+    }
+
     if (pXIClient->major_version) {
-        if (version_compare(stuff->major_version, stuff->minor_version,
-                            pXIClient->major_version, pXIClient->minor_version) < 0) {
-            client->errorValue = stuff->major_version;
-            return BadValue;
+
+        /* Check to see if the client has only ever asked
+         * for version 2.2 or higher
+         */
+        if (version_compare(major, minor, 2, 2) >= 0 &&
+            version_compare(pXIClient->major_version, pXIClient->minor_version, 2, 2) >= 0)
+        {
+
+            /* As of version 2.2, Peter promises to never again break
+             * backward compatibility, so we'll return the requested
+             * version to the client but leave the server internal
+             * version set to the highest requested value
+             */
+            if (version_compare(major, minor,
+                                pXIClient->major_version, pXIClient->minor_version) > 0)
+            {
+                pXIClient->major_version = major;
+                pXIClient->minor_version = minor;
+            }
+        } else {
+            if (version_compare(major, minor,
+                                pXIClient->major_version, pXIClient->minor_version) < 0) {
+
+                client->errorValue = stuff->major_version;
+                return BadValue;
+            }
+            major = pXIClient->major_version;
+            minor = pXIClient->minor_version;
         }
-        major = pXIClient->major_version;
-        minor = pXIClient->minor_version;
     } else {
-        if (version_compare(XIVersion.major_version, XIVersion.minor_version,
-                    stuff->major_version, stuff->minor_version) > 0) {
-            major = stuff->major_version;
-            minor = stuff->minor_version;
-        }
-        else {
-            major = XIVersion.major_version;
-            minor = XIVersion.minor_version;
-        }
-
         pXIClient->major_version = major;
         pXIClient->minor_version = minor;
     }
index 0e45cb8..45a996e 100644 (file)
 #include "xiselectev.h"
 
 /**
+ * Ruleset:
+ * - if A has XIAllDevices, B may select on device X
+ * - If A has XIAllDevices, B may select on XIAllMasterDevices
+ * - If A has XIAllMasterDevices, B may select on device X
+ * - If A has XIAllMasterDevices, B may select on XIAllDevices
+ * - if A has device X, B may select on XIAllDevices/XIAllMasterDevices
+ */
+static int check_for_touch_selection_conflicts(ClientPtr B, WindowPtr win, int deviceid)
+{
+    OtherInputMasks *inputMasks = wOtherInputMasks(win);
+    InputClients *A = NULL;
+
+    if (inputMasks)
+        A = inputMasks->inputClients;
+    for (; A; A = A->next) {
+        DeviceIntPtr tmp;
+
+        if (CLIENT_ID(A->resource) == B->index)
+            continue;
+
+        if (deviceid == XIAllDevices)
+            tmp = inputInfo.all_devices;
+        else if (deviceid == XIAllMasterDevices)
+            tmp = inputInfo.all_master_devices;
+        else
+            dixLookupDevice(&tmp, deviceid, serverClient, DixReadAccess);
+        if (!tmp)
+            return BadImplementation;       /* this shouldn't happen */
+
+        /* A has XIAllDevices */
+        if (xi2mask_isset_for_device(A->xi2mask, inputInfo.all_devices, XI_TouchBegin)) {
+            if (deviceid == XIAllDevices)
+                return BadAccess;
+        }
+
+        /* A has XIAllMasterDevices */
+        if (xi2mask_isset_for_device(A->xi2mask, inputInfo.all_master_devices, XI_TouchBegin)) {
+            if (deviceid == XIAllMasterDevices)
+                return BadAccess;
+        }
+
+        /* A has this device */
+        if (xi2mask_isset_for_device(A->xi2mask, tmp, XI_TouchBegin))
+            return BadAccess;
+    }
+
+    return Success;
+}
+
+
+/**
  * Check the given mask (in len bytes) for invalid mask bits.
  * Invalid mask bits are any bits above XI2LastEvent.
  *
@@ -169,25 +220,11 @@ ProcXISelectEvents(ClientPtr client)
              * same devices, including master devices.
              * XXX: This breaks if a device goes from floating to attached. */
             if (BitIsOn(bits, XI_TouchBegin)) {
-                OtherInputMasks *inputMasks = wOtherInputMasks(win);
-                InputClients *iclient = NULL;
-
-                if (inputMasks)
-                    iclient = inputMasks->inputClients;
-                for (; iclient; iclient = iclient->next) {
-                    DeviceIntPtr tmp;
-
-                    if (CLIENT_ID(iclient->resource) == client->index)
-                        continue;
-
-                    dixLookupDevice(&tmp, evmask->deviceid, serverClient,
-                                    DixReadAccess);
-                    if (!tmp)
-                        return BadImplementation;       /* this shouldn't happen */
-
-                    if (xi2mask_isset(iclient->xi2mask, tmp, XI_TouchBegin))
-                        return BadAccess;
-                }
+                rc = check_for_touch_selection_conflicts(client,
+                                                         win,
+                                                         evmask->deviceid);
+                if (rc != Success)
+                    return rc;
             }
         }
 
index b80cf37..4e8b11b 100755 (executable)
@@ -9,4 +9,4 @@ cd $srcdir
 autoreconf --force -v --install || exit 1
 cd $ORIGDIR || exit $?
 
-#$srcdir/configure --enable-maintainer-mode "$@"
+$srcdir/configure --enable-maintainer-mode "$@"
index c2f5123..0ff5868 100644 (file)
@@ -1,6 +1,10 @@
 noinst_LTLIBRARIES = libcomposite.la
 
-AM_CFLAGS = $(DIX_CFLAGS)
+#AM_CFLAGS = $(DIX_CFLAGS)
+AM_CFLAGS = \
+       -DHAVE_XORG_CONFIG_H \
+       @DIX_CFLAGS@ @XORG_CFLAGS@
+
 
 if XORG
 sdk_HEADERS = compositeext.h
@@ -12,4 +16,4 @@ libcomposite_la_SOURCES =     \
        compint.h               \
        compinit.c              \
        compoverlay.c           \
-       compwindow.c            
+       compwindow.c
index 45200e1..f0f64fd 100644 (file)
 #include <dix-config.h>
 #endif
 
+#ifdef ENABLE_DLOG
+#define LOG_TAG "XORG_PIXMAP"
+#include <dlog.h>
+#endif
+
+
 #include "compint.h"
 
 static void
@@ -55,7 +61,7 @@ compScreenUpdate(ScreenPtr pScreen)
 }
 
 static void
-compBlockHandler(ScreenPtr pScreen, pointer pTimeout, pointer pReadmask)
+compBlockHandler(ScreenPtr pScreen, void *pTimeout, void *pReadmask)
 {
     CompScreenPtr cs = GetCompScreen(pScreen);
 
@@ -160,7 +166,7 @@ compRedirectWindow(ClientPtr pClient, WindowPtr pWin, int update)
                 return BadAccess;
 
     /*
-     * Allocate per-client per-window structure 
+     * Allocate per-client per-window structure
      * The client *could* allocate multiple, but while supported,
      * it is not expected to be common
      */
@@ -213,7 +219,7 @@ compRedirectWindow(ClientPtr pClient, WindowPtr pWin, int update)
             anyMarked = compMarkWindows(pWin, &pLayerWin);
 
         if (cw->damageRegistered) {
-            DamageUnregister(&pWin->drawable, cw->damage);
+            DamageUnregister(cw->damage);
             cw->damageRegistered = FALSE;
         }
         cw->update = CompositeRedirectManual;
@@ -317,6 +323,19 @@ compFreeClientWindow(WindowPtr pWin, XID id)
 
     if (pPixmap) {
         compRestoreWindow(pWin, pPixmap);
+#ifdef ENABLE_DLOG
+        SLOG(LOG_INFO, "XORG_PIXMAP", "pix_id:%p, pixmap:%p (%dx%d) refcnt:%d-1 win_id:%p win:%p (%dx%d) view:%d\n",
+            pPixmap->drawable.id,
+            pPixmap,
+            pPixmap->drawable.width,
+            pPixmap->drawable.height,
+            pPixmap->refcnt,
+            pWin->drawable.id,
+            pWin,
+            pWin->drawable.width,
+            pWin->drawable.height,
+            pWin->viewable);
+#endif
         (*pScreen->DestroyPixmap) (pPixmap);
     }
 }
@@ -361,7 +380,7 @@ compRedirectSubwindows(ClientPtr pClient, WindowPtr pWin, int update)
             if (ccw->update == CompositeRedirectManual)
                 return BadAccess;
     /*
-     * Allocate per-client per-window structure 
+     * Allocate per-client per-window structure
      * The client *could* allocate multiple, but while supported,
      * it is not expected to be common
      */
@@ -409,7 +428,7 @@ compRedirectSubwindows(ClientPtr pClient, WindowPtr pWin, int update)
         return BadAlloc;
     if (ccw->update == CompositeRedirectManual) {
         csw->update = CompositeRedirectManual;
-        /* 
+        /*
          * tell damage extension that damage events for this client are
          * critical output
          */
@@ -438,7 +457,7 @@ compFreeClientSubwindows(WindowPtr pWin, XID id)
 
             *prev = ccw->next;
             if (ccw->update == CompositeRedirectManual) {
-                /* 
+                /*
                  * tell damage extension that damage events for this client are
                  * critical output
                  */
@@ -563,6 +582,10 @@ compNewPixmap(WindowPtr pWin, int x, int y, int w, int h)
     pPixmap->screen_y = y;
 
     if (pParent->drawable.depth == pWin->drawable.depth) {
+#ifdef _F_TV_DEFECT_DO_NOT_COPY_PARENT_
+         /*change for the top-bottom stereo defect DF141212-01637*/
+        if(pWin->viewable == TRUE && pWin->redirectDraw == RedirectDrawNone) {
+#endif
         GCPtr pGC = GetScratchGC(pWin->drawable.depth, pScreen);
 
         if (pGC) {
@@ -578,39 +601,57 @@ compNewPixmap(WindowPtr pWin, int x, int y, int w, int h)
                                    y - pParent->drawable.y, w, h, 0, 0);
             FreeScratchGC(pGC);
         }
+#ifdef _F_TV_DEFECT_DO_NOT_COPY_PARENT_
+        }
+#endif
     }
     else {
         PictFormatPtr pSrcFormat = PictureWindowFormat(pParent);
         PictFormatPtr pDstFormat = PictureWindowFormat(pWin);
         XID inferiors = IncludeInferiors;
         int error;
-
-        PicturePtr pSrcPicture = CreatePicture(None,
-                                               &pParent->drawable,
-                                               pSrcFormat,
-                                               CPSubwindowMode,
-                                               &inferiors,
-                                               serverClient, &error);
-
-        PicturePtr pDstPicture = CreatePicture(None,
-                                               &pPixmap->drawable,
-                                               pDstFormat,
-                                               0, 0,
-                                               serverClient, &error);
+        PicturePtr pSrcPicture = NULL;
+        PicturePtr pDstPicture = NULL;
+
+        if (pSrcFormat)
+            pSrcPicture = CreatePicture(None,
+                                       &pParent->drawable,
+                                       pSrcFormat,
+                                       CPSubwindowMode,
+                                       &inferiors,
+                                       serverClient, &error);
+
+        if (pDstFormat)
+            pDstPicture = CreatePicture(None,
+                                       &pPixmap->drawable,
+                                       pDstFormat,
+                                       0, 0,
+                                       serverClient, &error);
 
         if (pSrcPicture && pDstPicture) {
+#ifdef _F_CLEAR_NEW_COMP_PIXMAP_
             CompositePicture(PictOpClear,
                              pSrcPicture,
                              NULL,
                              pDstPicture,
                              x - pParent->drawable.x,
                              y - pParent->drawable.y, 0, 0, 0, 0, w, h);
+#else
+            CompositePicture(PictOpSrc,
+                             pSrcPicture,
+                             NULL,
+                             pDstPicture,
+                             x - pParent->drawable.x,
+                             y - pParent->drawable.y, 0, 0, 0, 0, w, h);
+
+#endif
         }
         if (pSrcPicture)
             FreePicture(pSrcPicture, 0);
         if (pDstPicture)
             FreePicture(pDstPicture, 0);
     }
+
     return pPixmap;
 }
 
@@ -658,7 +699,7 @@ compSetParentPixmap(WindowPtr pWin)
     CompWindowPtr cw = GetCompWindow(pWin);
 
     if (cw->damageRegistered) {
-        DamageUnregister(&pWin->drawable, cw->damage);
+        DamageUnregister(cw->damage);
         cw->damageRegistered = FALSE;
         DamageEmpty(cw->damage);
     }
index 1b245cf..4f08fbe 100644 (file)
@@ -67,7 +67,7 @@ typedef struct _CompositeClient {
     dixLookupPrivate(&(pClient)->devPrivates, CompositeClientPrivateKey))
 
 static void
-CompositeClientCallback(CallbackListPtr *list, pointer closure, pointer data)
+CompositeClientCallback(CallbackListPtr *list, void *closure, void *data)
 {
     NewClientInfoRec *clientinfo = (NewClientInfoRec *) data;
     ClientPtr pClient = clientinfo->client;
@@ -78,7 +78,7 @@ CompositeClientCallback(CallbackListPtr *list, pointer closure, pointer data)
 }
 
 static int
-FreeCompositeClientWindow(pointer value, XID ccwid)
+FreeCompositeClientWindow(void *value, XID ccwid)
 {
     WindowPtr pWin = value;
 
@@ -87,7 +87,7 @@ FreeCompositeClientWindow(pointer value, XID ccwid)
 }
 
 static int
-FreeCompositeClientSubwindows(pointer value, XID ccwid)
+FreeCompositeClientSubwindows(void *value, XID ccwid)
 {
     WindowPtr pWin = value;
 
@@ -96,7 +96,7 @@ FreeCompositeClientSubwindows(pointer value, XID ccwid)
 }
 
 static int
-FreeCompositeClientOverlay(pointer value, XID ccwid)
+FreeCompositeClientOverlay(void *value, XID ccwid)
 {
     CompOverlayClientPtr pOc = (CompOverlayClientPtr) value;
 
@@ -117,7 +117,8 @@ ProcCompositeQueryVersion(ClientPtr client)
     REQUEST(xCompositeQueryVersionReq);
 
     REQUEST_SIZE_MATCH(xCompositeQueryVersionReq);
-    if (stuff->majorVersion < SERVER_COMPOSITE_MAJOR_VERSION) {
+    if ((stuff->majorVersion * 1000 + stuff->minorVersion) <
+        (SERVER_COMPOSITE_MAJOR_VERSION * 1000 + SERVER_COMPOSITE_MINOR_VERSION)) {
         rep.majorVersion = stuff->majorVersion;
         rep.minorVersion = stuff->minorVersion;
     }
@@ -140,7 +141,7 @@ ProcCompositeQueryVersion(ClientPtr client)
 #define VERIFY_WINDOW(pWindow, wid, client, mode)                      \
     do {                                                               \
        int err;                                                        \
-       err = dixLookupResourceByType((pointer *) &pWindow, wid,        \
+       err = dixLookupResourceByType((void **) &pWindow, wid,  \
                                      RT_WINDOW, client, mode);         \
        if (err != Success) {                                           \
            client->errorValue = wid;                                   \
@@ -159,6 +160,17 @@ ProcCompositeRedirectWindow(ClientPtr client)
     VERIFY_WINDOW(pWin, stuff->window, client,
                   DixSetAttrAccess | DixManageAccess | DixBlendAccess);
 
+#ifdef _F_ADD_HOOK_PROC_COMP_REDIRECT_UNREDIRECT_
+    if (pWin->drawable.pScreen->ProcCompRedirectWindow) {
+        int ret;
+
+        ret = (*pWin->drawable.pScreen->ProcCompRedirectWindow) (pWin, stuff->update);
+        if (ret) {
+            return ret;
+        }
+    }
+#endif //_F_ADD_HOOK__PROC_COMP_REDIRECT_UNREDIRECT_
+
     return compRedirectWindow(client, pWin, stuff->update);
 }
 
@@ -187,9 +199,21 @@ ProcCompositeUnredirectWindow(ClientPtr client)
     VERIFY_WINDOW(pWin, stuff->window, client,
                   DixSetAttrAccess | DixManageAccess | DixBlendAccess);
 
+#ifdef _F_ADD_HOOK_PROC_COMP_REDIRECT_UNREDIRECT_
+    if (pWin->drawable.pScreen->ProcCompUnredirectWindow) {
+        int ret;
+
+        ret = (*pWin->drawable.pScreen->ProcCompUnredirectWindow) (pWin, stuff->update);
+        if (ret) {
+            return ret;
+        }
+    }
+#endif //_F_ADD_HOOK_PROC_COMP_REDIRECT_UNREDIRECT_
+
     return compUnredirectWindow(client, pWin, stuff->update);
 }
 
+
 static int
 ProcCompositeUnredirectSubwindows(ClientPtr client)
 {
@@ -227,7 +251,7 @@ ProcCompositeCreateRegionFromBorderClip(ClientPtr client)
         return BadAlloc;
     RegionTranslate(pRegion, -pWin->drawable.x, -pWin->drawable.y);
 
-    if (!AddResource(stuff->region, RegionResType, (pointer) pRegion))
+    if (!AddResource(stuff->region, RegionResType, (void *) pRegion))
         return BadAlloc;
 
     return Success;
@@ -239,6 +263,7 @@ ProcCompositeNameWindowPixmap(ClientPtr client)
     WindowPtr pWin;
     CompWindowPtr cw;
     PixmapPtr pPixmap;
+    ScreenPtr pScreen;
     int rc;
 
     REQUEST(xCompositeNameWindowPixmapReq);
@@ -246,6 +271,8 @@ ProcCompositeNameWindowPixmap(ClientPtr client)
     REQUEST_SIZE_MATCH(xCompositeNameWindowPixmapReq);
     VERIFY_WINDOW(pWin, stuff->window, client, DixGetAttrAccess);
 
+    pScreen = pWin->drawable.pScreen;
+
     if (!pWin->viewable)
         return BadMatch;
 
@@ -255,7 +282,7 @@ ProcCompositeNameWindowPixmap(ClientPtr client)
     if (!cw)
         return BadMatch;
 
-    pPixmap = (*pWin->drawable.pScreen->GetWindowPixmap) (pWin);
+    pPixmap = (*pScreen->GetWindowPixmap) (pWin);
     if (!pPixmap)
         return BadMatch;
 
@@ -267,9 +294,17 @@ ProcCompositeNameWindowPixmap(ClientPtr client)
 
     ++pPixmap->refcnt;
 
-    if (!AddResource(stuff->pixmap, RT_PIXMAP, (pointer) pPixmap))
+    if (!AddResource(stuff->pixmap, RT_PIXMAP, (void *) pPixmap))
         return BadAlloc;
 
+    if (pScreen->NameWindowPixmap) {
+        rc = pScreen->NameWindowPixmap(pWin, pPixmap, stuff->pixmap);
+        if (rc != Success) {
+            FreeResource(stuff->pixmap, RT_NONE);
+            return rc;
+        }
+    }
+
     return Success;
 }
 
@@ -335,12 +370,10 @@ ProcCompositeReleaseOverlayWindow(ClientPtr client)
 {
     REQUEST(xCompositeReleaseOverlayWindowReq);
     WindowPtr pWin;
-    ScreenPtr pScreen;
     CompOverlayClientPtr pOc;
 
     REQUEST_SIZE_MATCH(xCompositeReleaseOverlayWindowReq);
     VERIFY_WINDOW(pWin, stuff->window, client, DixGetAttrAccess);
-    pScreen = pWin->drawable.pScreen;
 
     /* 
      * Has client queried a reference to the overlay window
@@ -388,8 +421,9 @@ ProcCompositeSetCoordinateTransform (ClientPtr client)
        ErrorF("[%s] return status(=%d)\n", __FUNCTION__, status);
        return status;
     }
-
+#ifdef _PRINT_INPUT_REDIRECT_MATRIX_
     ErrorF("[%s] return client->noClientException(=%d)\n", __FUNCTION__, client->noClientException);
+#endif //_PRINT_INPUT_REDIRECT_MATRIX_
     return client->noClientException;
 }
 #endif //_F_INPUT_REDIRECTION_
@@ -575,7 +609,7 @@ SProcCompositeDispatch(ClientPtr client)
 
 /** @see GetDefaultBytes */
 static void
-GetCompositeClientWindowBytes(pointer value, XID id, ResourceSizePtr size)
+GetCompositeClientWindowBytes(void *value, XID id, ResourceSizePtr size)
 {
     WindowPtr window = value;
 
@@ -829,13 +863,15 @@ PanoramiXCompositeNameWindowPixmap(ClientPtr client)
             return BadMatch;
         }
 
-        if (!AddResource(newPix->info[i].id, RT_PIXMAP, (pointer) pPixmap))
+        if (!AddResource(newPix->info[i].id, RT_PIXMAP, (void *) pPixmap)) {
+            free(newPix);
             return BadAlloc;
+        }
 
         ++pPixmap->refcnt;
     }
 
-    if (!AddResource(stuff->pixmap, XRT_PIXMAP, (pointer) newPix))
+    if (!AddResource(stuff->pixmap, XRT_PIXMAP, (void *) newPix))
         return BadAlloc;
 
     return Success;
@@ -872,10 +908,11 @@ PanoramiXCompositeGetOverlayWindow(ClientPtr client)
     }
 
     FOR_NSCREENS_BACKWARD(i) {
-        rc = dixLookupResourceByType((pointer *) &pWin, win->info[i].id,
+        rc = dixLookupResourceByType((void **) &pWin, win->info[i].id,
                                      RT_WINDOW, client, DixGetAttrAccess);
         if (rc != Success) {
             client->errorValue = stuff->window;
+            free(overlayWin);
             return rc;
         }
         pScreen = pWin->drawable.pScreen;
@@ -885,8 +922,10 @@ PanoramiXCompositeGetOverlayWindow(ClientPtr client)
          * interest in the overlay window
          */
         pOc = compCreateOverlayClient(pScreen, client);
-        if (pOc == NULL)
+        if (pOc == NULL) {
+            free(overlayWin);
             return BadAlloc;
+        }
 
         /*
          * Make sure the overlay window exists
@@ -895,6 +934,7 @@ PanoramiXCompositeGetOverlayWindow(ClientPtr client)
         if (cs->pOverlayWin == NULL)
             if (!compCreateOverlayWindow(pScreen)) {
                 FreeResource(pOc->resource, RT_NONE);
+                free(overlayWin);
                 return BadAlloc;
             }
 
@@ -904,6 +944,7 @@ PanoramiXCompositeGetOverlayWindow(ClientPtr client)
                       DixGetAttrAccess);
         if (rc != Success) {
             FreeResource(pOc->resource, RT_NONE);
+            free(overlayWin);
             return rc;
         }
     }
@@ -941,7 +982,6 @@ PanoramiXCompositeReleaseOverlayWindow(ClientPtr client)
 {
     REQUEST(xCompositeReleaseOverlayWindowReq);
     WindowPtr pWin;
-    ScreenPtr pScreen;
     CompOverlayClientPtr pOc;
     PanoramiXRes *win;
     int i, rc;
@@ -961,7 +1001,6 @@ PanoramiXCompositeReleaseOverlayWindow(ClientPtr client)
             client->errorValue = stuff->window;
             return rc;
         }
-        pScreen = pWin->drawable.pScreen;
 
         /*
          * Has client queried a reference to the overlay window
index bc1130e..48e938f 100644 (file)
@@ -117,11 +117,11 @@ compChangeWindowAttributes(WindowPtr pWin, unsigned long mask)
 
     if (ret && (mask & CWBackingStore) &&
         pScreen->backingStoreSupport != NotUseful) {
-        if (pWin->backingStore != NotUseful) {
+        if (pWin->backingStore != NotUseful && !pWin->backStorage) {
             compRedirectWindow(serverClient, pWin, CompositeRedirectAutomatic);
-            pWin->backStorage = (pointer) (intptr_t) 1;
+            pWin->backStorage = (void *) (intptr_t) 1;
         }
-        else {
+        else if (pWin->backingStore == NotUseful && pWin->backStorage) {
             compUnredirectWindow(serverClient, pWin,
                                  CompositeRedirectAutomatic);
             pWin->backStorage = NULL;
@@ -229,6 +229,28 @@ CompositeRegisterAlternateVisuals(ScreenPtr pScreen, VisualID * vids,
     return compRegisterAlternateVisuals(cs, vids, nVisuals);
 }
 
+Bool
+CompositeRegisterImplicitRedirectionException(ScreenPtr pScreen,
+                                              VisualID parentVisual,
+                                              VisualID winVisual)
+{
+    CompScreenPtr cs = GetCompScreen(pScreen);
+    CompImplicitRedirectException *p;
+
+    p = realloc(cs->implicitRedirectExceptions,
+                sizeof(p[0]) * (cs->numImplicitRedirectExceptions + 1));
+    if (p == NULL)
+        return FALSE;
+
+    p[cs->numImplicitRedirectExceptions].parentVisual = parentVisual;
+    p[cs->numImplicitRedirectExceptions].winVisual = winVisual;
+
+    cs->implicitRedirectExceptions = p;
+    cs->numImplicitRedirectExceptions++;
+
+    return TRUE;
+}
+
 typedef struct _alternateVisual {
     int depth;
     CARD32 format;
@@ -349,12 +371,17 @@ compScreenInit(ScreenPtr pScreen)
 
     cs->numAlternateVisuals = 0;
     cs->alternateVisuals = NULL;
+    cs->numImplicitRedirectExceptions = 0;
+    cs->implicitRedirectExceptions = NULL;
 
     if (!compAddAlternateVisuals(pScreen, cs)) {
         free(cs);
         return FALSE;
     }
 
+    if (!disableBackingStore)
+        pScreen->backingStoreSupport = WhenMapped;
+
     cs->PositionWindow = pScreen->PositionWindow;
     pScreen->PositionWindow = compPositionWindow;
 
old mode 100644 (file)
new mode 100755 (executable)
index 817405f..2b9657f
@@ -76,7 +76,7 @@
 
 /*
  *  enable this for debugging
+
     #define COMPOSITE_DEBUG
  */
 
@@ -123,6 +123,11 @@ typedef struct _CompOverlayClientRec {
     XID resource;
 } CompOverlayClientRec;
 
+typedef struct _CompImplicitRedirectException {
+    XID parentVisual;
+    XID winVisual;
+} CompImplicitRedirectException;
+
 typedef struct _CompScreen {
     PositionWindowProcPtr PositionWindow;
     CopyWindowProcPtr CopyWindow;
@@ -159,6 +164,8 @@ typedef struct _CompScreen {
     CloseScreenProcPtr CloseScreen;
     int numAlternateVisuals;
     VisualID *alternateVisuals;
+    int numImplicitRedirectExceptions;
+    CompImplicitRedirectException *implicitRedirectExceptions;
 
     WindowPtr pOverlayWin;
     Window overlayWid;
@@ -323,7 +330,7 @@ WindowPtr
  CompositeRealChildHead(WindowPtr pWin);
 
 int
- DeleteWindowNoInputDevices(pointer value, XID wid);
+ DeleteWindowNoInputDevices(void *value, XID wid);
 
 int
 
@@ -358,6 +365,16 @@ CompositeXYScreenFromWindowRootCoordinate (WindowPtr pWin,
                                           int       y,
                                           int       *screenX,
                                           int       *screenY);
+
+#ifdef _F_STEREOSCOPIC_LEFT_BUFFER_COODINATE_
+void
+CompositeXYScreenFromWindowLeftBufferCoordinate (WindowPtr pWin,
+                                          int       x,
+                                          int       y,
+                                          int       *screenX,
+                                          int       *screenY);
+#endif  // _F_STEREOSCOPIC_LEFT_BUFFER_COODINATE_
+
 int
 CompositeSetCoordinateTransform (ClientPtr pClient, WindowPtr pWin, PictTransformPtr pTransform);
 #endif //_F_INPUT_REDIRECTION_
old mode 100644 (file)
new mode 100755 (executable)
index 1394d51..2653cb0
@@ -35,6 +35,10 @@ extern _X_EXPORT Bool CompositeRegisterAlternateVisuals(ScreenPtr pScreen,
                                                         VisualID * vids,
                                                         int nVisuals);
 
+extern _X_EXPORT Bool CompositeRegisterImplicitRedirectionException(ScreenPtr pScreen,
+                                                                    VisualID parentVisual,
+                                                                    VisualID winVisual);
+
 extern _X_EXPORT RESTYPE CompositeClientWindowType;
 
 #ifdef _F_INPUT_REDIRECTION_
@@ -58,7 +62,27 @@ extern _X_EXPORT void CompositeXYScreenFromWindowRootCoordinate (WindowPtr pWin,
                          int       y,
                          int       *screenX,
                          int       *screenY);
+
+#ifdef _F_STEREOSCOPIC_LEFT_BUFFER_COODINATE_
+extern _X_EXPORT void CompositeXYScreenFromWindowLeftBufferCoordinate (WindowPtr pWin,
+                         int       x,
+                         int       y,
+                         int       *screenX,
+                         int       *screenY);
+#endif  // _F_STEREOSCOPIC_LEFT_BUFFER_COODINATE_
+
 extern _X_EXPORT int CompositeSetCoordinateTransform (ClientPtr pClient, WindowPtr pWin, PictTransformPtr pTransform);
+
+typedef int (*CompositeSetTransformPtr) (WindowPtr pWin,
+                                         PictTransformPtr pTransform);
+
+typedef struct {
+    CompositeSetTransformPtr SetTransform;
+} CompositeInfoRec, *CompositeInfoPtr;
+
+extern _X_EXPORT Bool CompositeScreenInit(ScreenPtr pScreen, CompositeInfoPtr info);
+extern _X_EXPORT void CompositeCloseScreen(ScreenPtr pScreen);
+
 #endif //_F_INPUT_REDIRECTION_
 
 #endif                          /* _COMPOSITEEXT_H_ */
index d3cfaf0..7932dda 100644 (file)
@@ -114,7 +114,7 @@ compCreateOverlayClient(ScreenPtr pScreen, ClientPtr pClient)
      * Create a resource for this element so it can be deleted
      * when the client goes away.
      */
-    if (!AddResource(pOc->resource, CompositeClientOverlayType, (pointer) pOc))
+    if (!AddResource(pOc->resource, CompositeClientOverlayType, (void *) pOc))
         return NULL;
 
     return pOc;
@@ -133,23 +133,26 @@ compCreateOverlayWindow(ScreenPtr pScreen)
     int result;
     int w = pScreen->width;
     int h = pScreen->height;
+    int x = 0, y = 0;
 
 #ifdef PANORAMIX
     if (!noPanoramiXExtension) {
+        x = -pScreen->x;
+        y = -pScreen->y;
         w = PanoramiXPixWidth;
         h = PanoramiXPixHeight;
     }
 #endif
 
     pWin = cs->pOverlayWin =
-        CreateWindow(cs->overlayWid, pRoot, 0, 0, w, h, 0,
+        CreateWindow(cs->overlayWid, pRoot, x, y, w, h, 0,
                      InputOutput, CWBackPixmap | CWOverrideRedirect, &attrs[0],
                      pRoot->drawable.depth,
                      serverClient, pScreen->rootVisual, &result);
     if (pWin == NULL)
         return FALSE;
 
-    if (!AddResource(pWin->drawable.id, RT_WINDOW, (pointer) pWin))
+    if (!AddResource(pWin->drawable.id, RT_WINDOW, (void *) pWin))
         return FALSE;
 
     MapWindow(pWin, serverClient);
index a921d52..f8b4db8 100644 (file)
 #include "panoramiXsrv.h"
 #endif
 
+#ifdef _F_STEREOSCOPIC_LEFT_BUFFER_COODINATE_
+static int prefered_w = 0 ;
+static int prefered_h = 0 ;
+
+#define IS_NOT_SET 0
+#define IS_SET 1
+#endif  // _F_STEREOSCOPIC_LEFT_BUFFER_COODINATE_
+
+#ifdef ENABLE_DLOG
+#define LOG_TAG "XORG_PIXMAP"
+#include <dlog.h>
+#endif
+
 #ifdef COMPOSITE_DEBUG
 static int
-compCheckWindow(WindowPtr pWin, pointer data)
+compCheckWindow(WindowPtr pWin, void *data)
 {
     ScreenPtr pScreen = pWin->drawable.pScreen;
     PixmapPtr pWinPixmap = (*pScreen->GetWindowPixmap) (pWin);
@@ -92,7 +105,7 @@ typedef struct _compPixmapVisit {
 } CompPixmapVisitRec, *CompPixmapVisitPtr;
 
 static Bool
-compRepaintBorder(ClientPtr pClient, pointer closure)
+compRepaintBorder(ClientPtr pClient, void *closure)
 {
     WindowPtr pWindow;
     int rc =
@@ -111,7 +124,7 @@ compRepaintBorder(ClientPtr pClient, pointer closure)
 }
 
 static int
-compSetPixmapVisitWindow(WindowPtr pWindow, pointer data)
+compSetPixmapVisitWindow(WindowPtr pWindow, void *data)
 {
     CompPixmapVisitPtr pVisit = (CompPixmapVisitPtr) data;
     ScreenPtr pScreen = pWindow->drawable.pScreen;
@@ -128,7 +141,7 @@ compSetPixmapVisitWindow(WindowPtr pWindow, pointer data)
     SetBorderSize(pWindow);
     if (HasBorder(pWindow))
         QueueWorkProc(compRepaintBorder, serverClient,
-                      (pointer) (intptr_t) pWindow->drawable.id);
+                      (void *) (intptr_t) pWindow->drawable.id);
     return WT_WALKCHILDREN;
 }
 
@@ -139,7 +152,7 @@ compSetPixmap(WindowPtr pWindow, PixmapPtr pPixmap)
 
     visitRec.pWindow = pWindow;
     visitRec.pPixmap = pPixmap;
-    TraverseTree(pWindow, compSetPixmapVisitWindow, (pointer) &visitRec);
+    TraverseTree(pWindow, compSetPixmapVisitWindow, (void *) &visitRec);
     compCheckTree(pWindow->drawable.pScreen);
 }
 
@@ -149,6 +162,9 @@ compCheckRedirect(WindowPtr pWin)
     CompWindowPtr cw = GetCompWindow(pWin);
     CompScreenPtr cs = GetCompScreen(pWin->drawable.pScreen);
     Bool should;
+    ScreenPtr pScreen = NULL;
+    PixmapPtr pPixmap = NULL;
+    Bool ret = FALSE;
 
     should = pWin->realized && (pWin->drawable.class != InputOnly) &&
         (cw != NULL) && (pWin->parent != NULL);
@@ -161,14 +177,48 @@ compCheckRedirect(WindowPtr pWin)
     }
 
     if (should != (pWin->redirectDraw != RedirectDrawNone)) {
-        if (should)
-            return compAllocPixmap(pWin);
+        if (should) {
+            ret = compAllocPixmap(pWin);
+            pScreen = pWin->drawable.pScreen;
+            pPixmap = (*pScreen->GetWindowPixmap) (pWin);
+
+#ifdef ENABLE_DLOG
+            SLOG(LOG_INFO, "XORG_PIXMAP", "pix_id:%p, pixmap:%p (%dx%d) refcnt:%d win_id:%p win:%p (%dx%d) view:%d\n",
+                pPixmap->drawable.id,
+                pPixmap,
+                pPixmap->drawable.width,
+                pPixmap->drawable.height,
+                pPixmap->refcnt,
+                pWin->drawable.id,
+                pWin,
+                pWin->drawable.width,
+                pWin->drawable.height,
+                pWin->viewable);
+#endif
+
+            return ret;
+        }
         else {
-            ScreenPtr pScreen = pWin->drawable.pScreen;
-            PixmapPtr pPixmap = (*pScreen->GetWindowPixmap) (pWin);
+            pScreen = pWin->drawable.pScreen;
+            pPixmap = (*pScreen->GetWindowPixmap) (pWin);
 
             compSetParentPixmap(pWin);
             compRestoreWindow(pWin, pPixmap);
+
+#ifdef ENABLE_DLOG
+            SLOG(LOG_INFO, "XORG_PIXMAP", "pix_id:%p, pixmap:%p (%dx%d) refcnt:%d-1 win_id:%p win:%p (%dx%d) view:%d\n",
+                pPixmap->drawable.id,
+                pPixmap,
+                pPixmap->drawable.width,
+                pPixmap->drawable.height,
+                pPixmap->refcnt,
+                pWin->drawable.id,
+                pWin,
+                pWin->drawable.width,
+                pWin->drawable.height,
+                pWin->viewable);
+
+#endif
             (*pScreen->DestroyPixmap) (pPixmap);
         }
     }
@@ -178,6 +228,26 @@ compCheckRedirect(WindowPtr pWin)
         else
             pWin->redirectDraw = RedirectDrawManual;
     }
+
+#ifdef ENABLE_DLOG
+    if (!pPixmap) {
+        pScreen = pWin->drawable.pScreen;
+        pPixmap = (*pScreen->GetWindowPixmap) (pWin);
+    }
+
+    SLOG(LOG_INFO, "XORG_PIXMAP", "pix_id:%p, pixmap:%p (%dx%d) refcnt:%d win_id:%p win:%p (%dx%d) view:%d\n",
+        pPixmap->drawable.id,
+        pPixmap,
+        pPixmap->drawable.width,
+        pPixmap->drawable.height,
+        pPixmap->refcnt,
+        pWin->drawable.id,
+        pWin,
+        pWin->drawable.width,
+        pWin->drawable.height,
+        pWin->viewable);
+#endif
+
     return TRUE;
 }
 
@@ -336,13 +406,39 @@ compIsAlternateVisual(ScreenPtr pScreen, XID visual)
 }
 
 static Bool
+compIsImplicitRedirectException(ScreenPtr pScreen,
+                                XID parentVisual, XID winVisual)
+{
+    CompScreenPtr cs = GetCompScreen(pScreen);
+    int i;
+
+    for (i = 0; i < cs->numImplicitRedirectExceptions; i++)
+        if (cs->implicitRedirectExceptions[i].parentVisual == parentVisual &&
+            cs->implicitRedirectExceptions[i].winVisual == winVisual)
+            return TRUE;
+
+    return FALSE;
+}
+
+static Bool
 compImplicitRedirect(WindowPtr pWin, WindowPtr pParent)
 {
+#ifdef _F_NO_IMPLICIT_REDIRECT_
+    /*
+    Xserver redirect windows inside when the visuals(ex.depth) between parent of a window and the window is different.
+    Do not check the visuals between them in the composite extension when xserver redirect a window.
+    This make the 32 depth window get the root pixmap when compositor unredirect the 32 depth toplevel window.
+    */
+    return FALSE;
+#endif
     if (pParent) {
         ScreenPtr pScreen = pWin->drawable.pScreen;
         XID winVisual = wVisual(pWin);
         XID parentVisual = wVisual(pParent);
 
+        if (compIsImplicitRedirectException(pScreen, parentVisual, winVisual))
+            return FALSE;
+
         if (winVisual != parentVisual &&
             (compIsAlternateVisual(pScreen, winVisual) ||
              compIsAlternateVisual(pScreen, parentVisual)))
@@ -360,6 +456,20 @@ compFreeOldPixmap(WindowPtr pWin)
         CompWindowPtr cw = GetCompWindow(pWin);
 
         if (cw->pOldPixmap) {
+#ifdef ENABLE_DLOG
+            SLOG(LOG_INFO, "XORG_PIXMAP", "pix_id:%p, pixmap:%p (%dx%d) refcnt:%d-1 win_id:%p win:%p (%dx%d) view:%d\n",
+                cw->pOldPixmap->drawable.id,
+                cw->pOldPixmap,
+                cw->pOldPixmap->drawable.width,
+                cw->pOldPixmap->drawable.height,
+                cw->pOldPixmap->refcnt,
+                pWin->drawable.id,
+                pWin,
+                pWin->drawable.width,
+                pWin->drawable.height,
+                pWin->viewable);
+
+#endif
             (*pScreen->DestroyPixmap) (cw->pOldPixmap);
             cw->pOldPixmap = NullPixmap;
         }
@@ -475,7 +585,6 @@ compCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
              * need to be copied to pNewPixmap.
              */
             RegionRec rgnDst;
-            PixmapPtr pPixmap = (*pScreen->GetWindowPixmap) (pWin);
             GCPtr pGC;
 
             dx = ptOldOrg.x - pWin->drawable.x;
@@ -508,6 +617,7 @@ compCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
                 }
                 FreeScratchGC(pGC);
             }
+            RegionUninit(&rgnDst);
             return;
         }
         dx = pPixmap->screen_x - cw->oldx;
@@ -585,6 +695,19 @@ compDestroyWindow(WindowPtr pWin)
         PixmapPtr pPixmap = (*pScreen->GetWindowPixmap) (pWin);
 
         compSetParentPixmap(pWin);
+#ifdef ENABLE_DLOG
+        SLOG(LOG_INFO, "XORG_PIXMAP", "pix_id:%p, pixmap:%p (%dx%d) refcnt:%d-1 win_id:%p win:%p (%dx%d) view:%d\n",
+            pPixmap->drawable.id,
+            pPixmap,
+            pPixmap->drawable.width,
+            pPixmap->drawable.height,
+            pPixmap->refcnt,
+            pWin->drawable.id,
+            pWin,
+            pWin->drawable.width,
+            pWin->drawable.height,
+            pWin->viewable);
+#endif
         (*pScreen->DestroyPixmap) (pPixmap);
     }
     ret = (*pScreen->DestroyWindow) (pWin);
@@ -641,20 +764,26 @@ compWindowUpdateAutomatic(WindowPtr pWin)
     PixmapPtr pSrcPixmap = (*pScreen->GetWindowPixmap) (pWin);
     PictFormatPtr pSrcFormat = PictureWindowFormat(pWin);
     PictFormatPtr pDstFormat = PictureWindowFormat(pWin->parent);
+    PicturePtr pSrcPicture = NULL;
+    PicturePtr pDstPicture = NULL;
     int error;
     RegionPtr pRegion = DamageRegion(cw->damage);
-    PicturePtr pSrcPicture = CreatePicture(0, &pSrcPixmap->drawable,
-                                           pSrcFormat,
-                                           0, 0,
-                                           serverClient,
-                                           &error);
     XID subwindowMode = IncludeInferiors;
-    PicturePtr pDstPicture = CreatePicture(0, &pParent->drawable,
-                                           pDstFormat,
-                                           CPSubwindowMode,
-                                           &subwindowMode,
-                                           serverClient,
-                                           &error);
+
+    if (pSrcFormat)
+        pSrcPicture = CreatePicture(0, &pSrcPixmap->drawable,
+                                   pSrcFormat,
+                                   0, 0,
+                                   serverClient,
+                                   &error);
+
+    if (pDstFormat)
+        pDstPicture = CreatePicture(0, &pParent->drawable,
+                                   pDstFormat,
+                                   CPSubwindowMode,
+                                   &subwindowMode,
+                                   serverClient,
+                                   &error);
 
     /*
      * First move the region from window to screen coordinates
@@ -674,19 +803,23 @@ compWindowUpdateAutomatic(WindowPtr pWin)
     /*
      * Clip the picture
      */
-    SetPictureClipRegion(pDstPicture, 0, 0, pRegion);
+    if (pDstPicture)
+        SetPictureClipRegion(pDstPicture, 0, 0, pRegion);
 
     /*
      * And paint
      */
-    CompositePicture(PictOpSrc, pSrcPicture, 0, pDstPicture,
-                     0, 0,      /* src_x, src_y */
-                     0, 0,      /* msk_x, msk_y */
-                     pSrcPixmap->screen_x - pParent->drawable.x,
-                     pSrcPixmap->screen_y - pParent->drawable.y,
-                     pSrcPixmap->drawable.width, pSrcPixmap->drawable.height);
-    FreePicture(pSrcPicture, 0);
-    FreePicture(pDstPicture, 0);
+    if (pSrcPicture && pDstPicture)
+        CompositePicture(PictOpSrc, pSrcPicture, 0, pDstPicture,
+                         0, 0,      /* src_x, src_y */
+                         0, 0,      /* msk_x, msk_y */
+                         pSrcPixmap->screen_x - pParent->drawable.x,
+                         pSrcPixmap->screen_y - pParent->drawable.y,
+                         pSrcPixmap->drawable.width, pSrcPixmap->drawable.height);
+    if (pSrcPicture)
+        FreePicture(pSrcPicture, 0);
+    if (pDstPicture)
+        FreePicture(pDstPicture, 0);
     /*
      * Empty the damage region.  This has the nice effect of
      * rendering the translations above harmless
@@ -795,6 +928,7 @@ compConfigNotify(WindowPtr pWin, int x, int y, int w, int h,
 static void
 print_matrix(char* name, pixman_transform_t* t)
 {
+#ifdef _PRINT_INPUT_REDIRECT_MATRIX_
         int i;
         ErrorF("[%s] %s = \n", __FUNCTION__, name);
         for(i=0; i<3; i++)
@@ -804,7 +938,57 @@ print_matrix(char* name, pixman_transform_t* t)
                         , pixman_fixed_to_double(t->matrix[i][1])
                         , pixman_fixed_to_double(t->matrix[i][2]));
         }
+#endif //_PRINT_INPUT_REDIRECT_MATRIX_
+}
+
+typedef struct {
+    CompositeSetTransformPtr SetTransform;
+} CompositeScreenRec, *CompositeScreenPtr;
+
+static DevPrivateKeyRec compositePrivateKeyRec;
+#define compositePrivatePrivateKey (&compositePrivateKeyRec)
+
+static CompositeScreenPtr
+CompositeGetScreen(ScreenPtr pScreen)
+{
+    if (!dixPrivateKeyRegistered(compositePrivatePrivateKey))
+        return NULL;
+    return dixLookupPrivate(&pScreen->devPrivates, compositePrivatePrivateKey);
 }
+
+Bool
+CompositeScreenInit (ScreenPtr pScreen, CompositeInfoPtr info)
+{
+    CompositeScreenPtr cs = NULL;
+
+    if (!pScreen || !info)
+        return FALSE;
+
+    if (!dixRegisterPrivateKey(&compositePrivateKeyRec, PRIVATE_SCREEN, 0))
+        return FALSE;
+
+    cs = calloc(1, sizeof *cs);
+    if (!cs)
+        return FALSE;
+
+    cs->SetTransform = info->SetTransform;
+
+    dixSetPrivate(&pScreen->devPrivates, compositePrivatePrivateKey, cs);
+
+    ErrorF ("[%s] setup complete\n", __FUNCTION__);
+
+    return TRUE;
+}
+
+void
+CompositeCloseScreen (ScreenPtr pScreen)
+{
+    CompositeScreenPtr cs = CompositeGetScreen(pScreen);
+
+    if (cs)
+        free (cs);
+}
+
 Bool
 CompositeGetTransformPoint (WindowPtr pChild,
                          int      x,
@@ -850,6 +1034,8 @@ CompositeGetInvTransformPoint (WindowPtr pChild,
                          int      *tx,
                          int      *ty)
 {
+    if(!pChild)
+        return FALSE;
     CompWindowPtr cw = GetCompWindow (pChild);
 
     if (cw && cw->pInvTransform)
@@ -909,6 +1095,18 @@ CompositeXYScreenFromWindowRootCoordinate (WindowPtr pWin,
                                           int       *screenX,
                                           int       *screenY)
 {
+#ifdef _F_STEREOSCOPIC_LEFT_BUFFER_COODINATE_
+    static Bool preferred_resolution_set = IS_NOT_SET;
+    if(!preferred_resolution_set)
+    {
+        ScreenPtr pScreen = pWin->drawable.pScreen;
+        WindowPtr rootWin = pScreen->root;
+        prefered_w = rootWin->drawable.width ;
+        prefered_h = rootWin->drawable.height ;
+        preferred_resolution_set = IS_SET;
+    }
+#endif
+
     if (!pWin->parent)
     {
        *screenX = x;
@@ -922,15 +1120,56 @@ CompositeXYScreenFromWindowRootCoordinate (WindowPtr pWin,
     }
 }
 
+#ifdef _F_STEREOSCOPIC_LEFT_BUFFER_COODINATE_
+void
+CompositeXYScreenFromWindowLeftBufferCoordinate (WindowPtr pWin,
+                                          int       x,
+                                          int       y,
+                                          int       *screenX,
+                                          int       *screenY)
+{
+
+    CompositeXYScreenFromWindowRootCoordinate (pWin,x, y, screenX, screenY);
+
+    int fbW, fbH ;
+    ScreenPtr pScreen = pWin->drawable.pScreen;
+    WindowPtr rootWin = pScreen->root;
+    fbW = rootWin->drawable.width ;
+    fbH = rootWin->drawable.height ;
+
+    *screenX = (*screenX * prefered_w)/fbW ;
+    *screenY = (*screenY * prefered_h)/fbH ;
+
+
+}
+#endif
+
 int
 CompositeSetCoordinateTransform (ClientPtr pClient,
                                      WindowPtr pWin,
                                      PictTransformPtr pTransform)
 {
-    CompSubwindowsPtr   csw = GetCompSubwindows (pWin->parent);
-    CompWindowPtr      cw = GetCompWindow (pWin);
+    CompSubwindowsPtr   csw = NULL;
+    CompWindowPtr      cw = NULL;
     CompClientWindowPtr        ccw;
     PictTransform inv;
+    CompositeScreenPtr cs = CompositeGetScreen(pWin->drawable.pScreen);
+
+    if (!dixPrivateKeyRegistered(CompSubwindowsPrivateKey))
+    {
+        ErrorF("[%s:%d] Failed to CompSubwindowsPrivateKey\n", __FUNCTION__, __LINE__);
+        return BadAccess;
+    }
+
+    csw = GetCompSubwindows (pWin->parent);
+
+    if (!dixPrivateKeyRegistered(CompWindowPrivateKey))
+    {
+        ErrorF("[%s:%d] Failed to CompWindowPrivateKey\n", __FUNCTION__, __LINE__);
+        return BadAccess;
+    }
+
+    cw = GetCompWindow (pWin);
 
     /*
      * sub-window must be Manual update
@@ -954,16 +1193,20 @@ CompositeSetCoordinateTransform (ClientPtr pClient,
 
     if (pTransform && pixman_transform_is_identity(pTransform))
     {
+#ifdef _PRINT_INPUT_REDIRECT_MATRIX_
         ErrorF("[%s] pTransform=0 : pTransform && pixman_transform_is_identity(pTransform)\n", __FUNCTION__);
+#endif //_PRINT_INPUT_REDIRECT_MATRIX_
         pTransform = 0;
     }
 
-    if(pTransform && pTransform->matrix)
+    if (pTransform)
         print_matrix("pTransform", pTransform);
+#ifdef _PRINT_INPUT_REDIRECT_MATRIX_
     else
         ErrorF("[%s] pTransform or pTransform->matrix is NULL !\n", __FUNCTION__);
+#endif //_PRINT_INPUT_REDIRECT_MATRIX_
 
-    if(pTransform && !pixman_transform_invert(&inv, pTransform))
+    if (pTransform && !pixman_transform_invert(&inv, pTransform))
     {
         ErrorF("[%s] BadRequest : !pixman_transform_invert(&inv, pTransform)\n", __FUNCTION__);
         return BadRequest;
@@ -1005,13 +1248,26 @@ CompositeSetCoordinateTransform (ClientPtr pClient,
            cw->pTransform = 0;
        }
 
-       if(cw->pInvTransform)
+       if (cw->pInvTransform)
        {
            xfree(cw->pInvTransform);
            cw->pInvTransform = 0;
        }
     }
 
+    if (cs && cs->SetTransform)
+    {
+        int ret = cs->SetTransform(pWin, pTransform);
+
+        if (ret != Success)
+        {
+            ErrorF("[%s] SetTransform return %d \n", __FUNCTION__, ret);
+            return BadImplementation;
+        }
+    }
+
+    CheckCursorConfinement(pWin);
+
     return 0;
 }
-#endif //_F_INPUT_REDIRECTION_
\ No newline at end of file
+#endif //_F_INPUT_REDIRECTION_
diff --git a/config/10-quirks.conf b/config/10-quirks.conf
new file mode 100644 (file)
index 0000000..47907d8
--- /dev/null
@@ -0,0 +1,38 @@
+# Collection of quirks and blacklist/whitelists for specific devices.
+
+
+# Accelerometer device, posts data through ABS_X/ABS_Y, making X unusable
+# http://bugs.freedesktop.org/show_bug.cgi?id=22442 
+Section "InputClass"
+        Identifier "ThinkPad HDAPS accelerometer blacklist"
+        MatchProduct "ThinkPad HDAPS accelerometer data"
+        Option "Ignore" "on"
+EndSection
+
+# https://bugzilla.redhat.com/show_bug.cgi?id=523914
+# Mouse does not move in PV Xen guest
+# Explicitly tell evdev to not ignore the absolute axes.
+Section "InputClass"
+        Identifier "Xen Virtual Pointer axis blacklist"
+        MatchProduct "Xen Virtual Pointer"
+        Option "IgnoreAbsoluteAxes" "off"
+        Option "IgnoreRelativeAxes" "off"
+EndSection
+
+# https://bugs.freedesktop.org/show_bug.cgi?id=55867
+# Bug 55867 - Doesn't know how to tag XI_TRACKBALL
+Section "InputClass"
+        Identifier "Tag trackballs as XI_TRACKBALL"
+        MatchProduct "trackball"
+        MatchDriver "evdev"
+        Option "TypeName" "TRACKBALL"
+EndSection
+
+# https://bugs.freedesktop.org/show_bug.cgi?id=62831
+# Bug 62831 - Mionix Naos 5000 mouse detected incorrectly
+Section "InputClass"
+        Identifier "Tag Mionix Naos 5000 mouse XI_MOUSE"
+        MatchProduct "La-VIEW Technology Naos 5000 Mouse"
+        MatchDriver "evdev"
+        Option "TypeName" "MOUSE"
+EndSection
index 69bdcf7..0e20e8b 100644 (file)
@@ -2,37 +2,31 @@ AM_CFLAGS = $(DIX_CFLAGS)
 
 noinst_LTLIBRARIES = libconfig.la
 libconfig_la_SOURCES = config.c config-backends.h
+libconfig_la_LIBADD =
+
+if NEED_DBUS
+AM_CFLAGS += $(DBUS_CFLAGS)
+libconfig_la_SOURCES += dbus-core.c
+libconfig_la_LIBADD += $(DBUS_LIBS)
+endif
 
 if CONFIG_UDEV
 
 AM_CFLAGS += $(UDEV_CFLAGS)
 libconfig_la_SOURCES += udev.c
-libconfig_la_LIBADD = $(UDEV_LIBS)
+libconfig_la_LIBADD += $(UDEV_LIBS)
 
 if XORG
 xorgconfddir = $(datadir)/X11/$(XF86CONFIGDIR)
-xorgconfd_DATA = 10-evdev.conf
+xorgconfd_DATA = 10-evdev.conf 10-quirks.conf
 endif
 
 else
 
-if CONFIG_NEED_DBUS
-AM_CFLAGS += $(DBUS_CFLAGS)
-libconfig_la_SOURCES += dbus-core.c
-libconfig_la_LIBADD = $(DBUS_LIBS)
-
-if CONFIG_DBUS_API
-dbusconfigdir = $(sysconfdir)/dbus-1/system.d
-dbusconfig_DATA = xorg-server.conf
-
-libconfig_la_SOURCES += dbus.c
-endif
-
 if CONFIG_HAL
 AM_CFLAGS += $(HAL_CFLAGS)
 libconfig_la_SOURCES += hal.c
 libconfig_la_LIBADD += $(HAL_LIBS)
-endif
 
 else
 
@@ -40,8 +34,8 @@ if CONFIG_WSCONS
 libconfig_la_SOURCES += wscons.c
 endif # CONFIG_WSCONS
 
-endif # CONFIG_NEED_DBUS
+endif # !CONFIG_HAL
 
 endif # !CONFIG_UDEV
 
-EXTRA_DIST = xorg-server.conf x11-input.fdi 10-evdev.conf fdi2iclass.py
+EXTRA_DIST = x11-input.fdi 10-evdev.conf fdi2iclass.py 10-quirks.conf
index 6423701..5f07557 100644 (file)
@@ -37,41 +37,10 @@ int config_udev_pre_init(void);
 int config_udev_init(void);
 void config_udev_fini(void);
 void config_udev_odev_probe(config_odev_probe_proc_ptr probe_callback);
-#else
-
-#ifdef CONFIG_NEED_DBUS
-#include <dbus/dbus.h>
-
-typedef void (*config_dbus_core_connect_hook) (DBusConnection * connection,
-                                               void *data);
-typedef void (*config_dbus_core_disconnect_hook) (void *data);
-
-struct config_dbus_core_hook {
-    config_dbus_core_connect_hook connect;
-    config_dbus_core_disconnect_hook disconnect;
-    void *data;
-
-    struct config_dbus_core_hook *next;
-};
-
-int config_dbus_core_init(void);
-void config_dbus_core_fini(void);
-int config_dbus_core_add_hook(struct config_dbus_core_hook *hook);
-void config_dbus_core_remove_hook(struct config_dbus_core_hook *hook);
-#endif
-
-#ifdef CONFIG_DBUS_API
-int config_dbus_init(void);
-void config_dbus_fini(void);
-#endif
-
-#ifdef CONFIG_HAL
+#elif defined(CONFIG_HAL)
 int config_hal_init(void);
 void config_hal_fini(void);
-#endif
-#endif
-
-#ifdef CONFIG_WSCONS
+#elif defined(CONFIG_WSCONS)
 int config_wscons_init(void);
 void config_wscons_fini(void);
 #endif
index d0889a3..a26d835 100644 (file)
 #include <dix-config.h>
 #endif
 
+#include <unistd.h>
 #include "os.h"
 #include "inputstr.h"
 #include "hotplug.h"
 #include "config-backends.h"
+#include "systemd-logind.h"
 
 void
 config_pre_init(void)
@@ -47,20 +49,9 @@ config_init(void)
 #ifdef CONFIG_UDEV
     if (!config_udev_init())
         ErrorF("[config] failed to initialise udev\n");
-#elif defined(CONFIG_NEED_DBUS)
-    if (config_dbus_core_init()) {
-#ifdef CONFIG_DBUS_API
-        if (!config_dbus_init())
-            ErrorF("[config] failed to initialise D-Bus API\n");
-#endif
-#ifdef CONFIG_HAL
-        if (!config_hal_init())
-            ErrorF("[config] failed to initialise HAL\n");
-#endif
-    }
-    else {
-        ErrorF("[config] failed to initialise D-Bus core\n");
-    }
+#elif defined(CONFIG_HAL)
+    if (!config_hal_init())
+        ErrorF("[config] failed to initialise HAL\n");
 #elif defined(CONFIG_WSCONS)
     if (!config_wscons_init())
         ErrorF("[config] failed to initialise wscons\n");
@@ -72,14 +63,8 @@ config_fini(void)
 {
 #if defined(CONFIG_UDEV)
     config_udev_fini();
-#elif defined(CONFIG_NEED_DBUS)
-#ifdef CONFIG_HAL
+#elif defined(CONFIG_HAL)
     config_hal_fini();
-#endif
-#ifdef CONFIG_DBUS_API
-    config_dbus_fini();
-#endif
-    config_dbus_core_fini();
 #elif defined(CONFIG_WSCONS)
     config_wscons_fini();
 #endif
@@ -147,10 +132,7 @@ config_odev_allocate_attribute_list(void)
 {
     struct OdevAttributes *attriblist;
 
-    attriblist = malloc(sizeof(struct OdevAttributes));
-    if (!attriblist)
-        return NULL;
-
+    attriblist = XNFalloc(sizeof(struct OdevAttributes));
     xorg_list_init(&attriblist->list);
     return attriblist;
 }
@@ -162,30 +144,144 @@ config_odev_free_attribute_list(struct OdevAttributes *attribs)
     free(attribs);
 }
 
+static struct OdevAttribute *
+config_odev_find_attribute(struct OdevAttributes *attribs, int attrib_id)
+{
+    struct OdevAttribute *oa;
+
+    xorg_list_for_each_entry(oa, &attribs->list, member) {
+        if (oa->attrib_id == attrib_id)
+          return oa;
+    }
+    return NULL;
+}
+
+static struct OdevAttribute *
+config_odev_find_or_add_attribute(struct OdevAttributes *attribs, int attrib)
+{
+    struct OdevAttribute *oa;
+
+    oa = config_odev_find_attribute(attribs, attrib);
+    if (oa)
+        return oa;
+
+    oa = XNFcalloc(sizeof(struct OdevAttribute));
+    oa->attrib_id = attrib;
+    xorg_list_append(&oa->member, &attribs->list);
+
+    return oa;
+}
+
+static int config_odev_get_attribute_type(int attrib)
+{
+    switch (attrib) {
+    case ODEV_ATTRIB_PATH:
+    case ODEV_ATTRIB_SYSPATH:
+    case ODEV_ATTRIB_BUSID:
+        return ODEV_ATTRIB_STRING;
+    case ODEV_ATTRIB_FD:
+    case ODEV_ATTRIB_MAJOR:
+    case ODEV_ATTRIB_MINOR:
+        return ODEV_ATTRIB_INT;
+    case ODEV_ATTRIB_DRIVER:
+        return ODEV_ATTRIB_STRING;
+    default:
+        LogMessage(X_ERROR, "Error %s called for unknown attribute %d\n",
+                   __func__, attrib);
+        return ODEV_ATTRIB_UNKNOWN;
+    }
+}
+
 Bool
 config_odev_add_attribute(struct OdevAttributes *attribs, int attrib,
                           const char *attrib_name)
 {
     struct OdevAttribute *oa;
 
-    oa = malloc(sizeof(struct OdevAttribute));
-    if (!oa)
+    if (config_odev_get_attribute_type(attrib) != ODEV_ATTRIB_STRING) {
+        LogMessage(X_ERROR, "Error %s called for non string attrib %d\n",
+                   __func__, attrib);
         return FALSE;
+    }
 
-    oa->attrib_id = attrib;
-    oa->attrib_name = strdup(attrib_name);
-    xorg_list_append(&oa->member, &attribs->list);
+    oa = config_odev_find_or_add_attribute(attribs, attrib);
+    free(oa->attrib_name);
+    oa->attrib_name = XNFstrdup(attrib_name);
+    oa->attrib_type = ODEV_ATTRIB_STRING;
     return TRUE;
 }
 
+Bool
+config_odev_add_int_attribute(struct OdevAttributes *attribs, int attrib,
+                              int attrib_value)
+{
+    struct OdevAttribute *oa;
+
+    if (config_odev_get_attribute_type(attrib) != ODEV_ATTRIB_INT) {
+        LogMessage(X_ERROR, "Error %s called for non integer attrib %d\n",
+                   __func__, attrib);
+        return FALSE;
+    }
+
+    oa = config_odev_find_or_add_attribute(attribs, attrib);
+    oa->attrib_value = attrib_value;
+    oa->attrib_type = ODEV_ATTRIB_INT;
+    return TRUE;
+}
+
+char *
+config_odev_get_attribute(struct OdevAttributes *attribs, int attrib_id)
+{
+    struct OdevAttribute *oa;
+
+    oa = config_odev_find_attribute(attribs, attrib_id);
+    if (!oa)
+        return NULL;
+
+    if (oa->attrib_type != ODEV_ATTRIB_STRING) {
+        LogMessage(X_ERROR, "Error %s called for non string attrib %d\n",
+                   __func__, attrib_id);
+        return NULL;
+    }
+    return oa->attrib_name;
+}
+
+int
+config_odev_get_int_attribute(struct OdevAttributes *attribs, int attrib_id, int def)
+{
+    struct OdevAttribute *oa;
+
+    oa = config_odev_find_attribute(attribs, attrib_id);
+    if (!oa)
+        return def;
+
+    if (oa->attrib_type != ODEV_ATTRIB_INT) {
+        LogMessage(X_ERROR, "Error %s called for non integer attrib %d\n",
+                   __func__, attrib_id);
+        return def;
+    }
+
+    return oa->attrib_value;
+}
+
 void
 config_odev_free_attributes(struct OdevAttributes *attribs)
 {
     struct OdevAttribute *iter, *safe;
+    int major = 0, minor = 0, fd = -1;
 
     xorg_list_for_each_entry_safe(iter, safe, &attribs->list, member) {
+        switch (iter->attrib_id) {
+        case ODEV_ATTRIB_MAJOR: major = iter->attrib_value; break;
+        case ODEV_ATTRIB_MINOR: minor = iter->attrib_value; break;
+        case ODEV_ATTRIB_FD: fd = iter->attrib_value; break;
+        }
         xorg_list_del(&iter->member);
-        free(iter->attrib_name);
+        if (iter->attrib_type == ODEV_ATTRIB_STRING)
+            free(iter->attrib_name);
         free(iter);
     }
+
+    if (fd != -1)
+        systemd_logind_release_fd(major, minor, fd);
 }
index 3242587..8351ea4 100644 (file)
@@ -30,9 +30,9 @@
 #include <dbus/dbus.h>
 #include <sys/select.h>
 
-#include "config-backends.h"
 #include "dix.h"
 #include "os.h"
+#include "dbus-core.h"
 
 /* How often to attempt reconnecting when we get booted off the bus. */
 #define RECONNECT_DELAY (10 * 1000)     /* in ms */
@@ -41,18 +41,18 @@ struct dbus_core_info {
     int fd;
     DBusConnection *connection;
     OsTimerPtr timer;
-    struct config_dbus_core_hook *hooks;
+    struct dbus_core_hook *hooks;
 };
 static struct dbus_core_info bus_info;
 
-static CARD32 reconnect_timer(OsTimerPtr timer, CARD32 time, pointer arg);
+static CARD32 reconnect_timer(OsTimerPtr timer, CARD32 time, void *arg);
 
 static void
-wakeup_handler(pointer data, int err, pointer read_mask)
+wakeup_handler(void *data, int num_fds, void *read_mask)
 {
     struct dbus_core_info *info = data;
 
-    if (info->connection && FD_ISSET(info->fd, (fd_set *) read_mask)) {
+    if (info->connection && num_fds > 0 && FD_ISSET(info->fd, (fd_set *) read_mask)) {
         do {
             dbus_connection_read_write_dispatch(info->connection, 0);
         } while (info->connection &&
@@ -63,7 +63,7 @@ wakeup_handler(pointer data, int err, pointer read_mask)
 }
 
 static void
-block_handler(pointer data, struct timeval **tv, pointer read_mask)
+block_handler(void *data, struct timeval **tv, void *read_mask)
 {
 }
 
@@ -74,7 +74,7 @@ block_handler(pointer data, struct timeval **tv, pointer read_mask)
 static void
 teardown(void)
 {
-    struct config_dbus_core_hook *hook;
+    struct dbus_core_hook *hook;
 
     if (bus_info.timer) {
         TimerFree(bus_info.timer);
@@ -112,7 +112,7 @@ message_filter(DBusConnection * connection, DBusMessage * message, void *data)
      * reconnect immediately (assuming it's just a restart).  The
      * connection isn't valid at this point, so throw it out immediately. */
     if (dbus_message_is_signal(message, DBUS_INTERFACE_LOCAL, "Disconnected")) {
-        DebugF("[config/dbus-core] disconnected from bus\n");
+        DebugF("[dbus-core] disconnected from bus\n");
         bus_info.connection = NULL;
         teardown();
 
@@ -136,12 +136,12 @@ static int
 connect_to_bus(void)
 {
     DBusError error;
-    struct config_dbus_core_hook *hook;
+    struct dbus_core_hook *hook;
 
     dbus_error_init(&error);
     bus_info.connection = dbus_bus_get(DBUS_BUS_SYSTEM, &error);
     if (!bus_info.connection || dbus_error_is_set(&error)) {
-        DebugF("[config/dbus-core] error connecting to system bus: %s (%s)\n",
+        LogMessage(X_ERROR, "dbus-core: error connecting to system bus: %s (%s)\n",
                error.name, error.message);
         goto err_begin;
     }
@@ -150,13 +150,13 @@ connect_to_bus(void)
     dbus_connection_set_exit_on_disconnect(bus_info.connection, FALSE);
 
     if (!dbus_connection_get_unix_fd(bus_info.connection, &bus_info.fd)) {
-        ErrorF("[config/dbus-core] couldn't get fd for system bus\n");
+        ErrorF("[dbus-core] couldn't get fd for system bus\n");
         goto err_unref;
     }
 
     if (!dbus_connection_add_filter(bus_info.connection, message_filter,
                                     &bus_info, NULL)) {
-        ErrorF("[config/dbus-core] couldn't add filter: %s (%s)\n", error.name,
+        ErrorF("[dbus-core] couldn't add filter: %s (%s)\n", error.name,
                error.message);
         goto err_fd;
     }
@@ -185,7 +185,7 @@ connect_to_bus(void)
 }
 
 static CARD32
-reconnect_timer(OsTimerPtr timer, CARD32 time, pointer arg)
+reconnect_timer(OsTimerPtr timer, CARD32 time, void *arg)
 {
     if (connect_to_bus()) {
         TimerFree(bus_info.timer);
@@ -198,9 +198,9 @@ reconnect_timer(OsTimerPtr timer, CARD32 time, pointer arg)
 }
 
 int
-config_dbus_core_add_hook(struct config_dbus_core_hook *hook)
+dbus_core_add_hook(struct dbus_core_hook *hook)
 {
-    struct config_dbus_core_hook **prev;
+    struct dbus_core_hook **prev;
 
     for (prev = &bus_info.hooks; *prev; prev = &(*prev)->next);
 
@@ -215,9 +215,9 @@ config_dbus_core_add_hook(struct config_dbus_core_hook *hook)
 }
 
 void
-config_dbus_core_remove_hook(struct config_dbus_core_hook *hook)
+dbus_core_remove_hook(struct dbus_core_hook *hook)
 {
-    struct config_dbus_core_hook **prev;
+    struct dbus_core_hook **prev;
 
     for (prev = &bus_info.hooks; *prev; prev = &(*prev)->next) {
         if (*prev == hook) {
@@ -228,19 +228,19 @@ config_dbus_core_remove_hook(struct config_dbus_core_hook *hook)
 }
 
 int
-config_dbus_core_init(void)
+dbus_core_init(void)
 {
     memset(&bus_info, 0, sizeof(bus_info));
     bus_info.fd = -1;
     bus_info.hooks = NULL;
-    bus_info.connection = NULL;
-    bus_info.timer = TimerSet(NULL, 0, 1, reconnect_timer, NULL);
+    if (!connect_to_bus())
+        bus_info.timer = TimerSet(NULL, 0, 1, reconnect_timer, NULL);
 
     return 1;
 }
 
 void
-config_dbus_core_fini(void)
+dbus_core_fini(void)
 {
     teardown();
 }
diff --git a/config/dbus.c b/config/dbus.c
deleted file mode 100644 (file)
index 99a1537..0000000
+++ /dev/null
@@ -1,407 +0,0 @@
-/*
- * Copyright Â© 2006-2007 Daniel Stone
- *
- * 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.
- *
- * Author: Daniel Stone <daniel@fooishbar.org>
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <dbus/dbus.h>
-#include <string.h>
-
-#include <X11/X.h>
-
-#include "config-backends.h"
-#include "opaque.h"             /* for 'display': there should be a better way. */
-#include "input.h"
-#include "inputstr.h"
-
-#define API_VERSION 2
-
-#define MATCH_RULE "type='method_call',interface='org.x.config.input'"
-
-#define MALFORMED_MSG "[config/dbus] malformed message, dropping"
-#define MALFORMED_MESSAGE() { DebugF(MALFORMED_MSG "\n"); \
-                            ret = BadValue; \
-                            goto unwind; }
-#define MALFORMED_MESSAGE_ERROR() { DebugF(MALFORMED_MSG ": %s, %s", \
-                                       error->name, error->message); \
-                                  ret = BadValue; \
-                                  goto unwind; }
-
-struct connection_info {
-    char busobject[32];
-    char busname[64];
-    DBusConnection *connection;
-};
-
-static void
-reset_info(struct connection_info *info)
-{
-    info->connection = NULL;
-    info->busname[0] = '\0';
-    info->busobject[0] = '\0';
-}
-
-static int
-add_device(DBusMessage * message, DBusMessage * reply, DBusError * error)
-{
-    DBusMessageIter iter, reply_iter, subiter;
-    InputOption *input_options = NULL;
-    int ret, err;
-    DeviceIntPtr dev = NULL;
-
-    dbus_message_iter_init_append(reply, &reply_iter);
-
-    if (!dbus_message_iter_init(message, &iter)) {
-        ErrorF("[config/dbus] couldn't initialise iterator\n");
-        MALFORMED_MESSAGE();
-    }
-
-    input_options = input_option_new(input_options, "_source", "client/dbus");
-    if (!input_options) {
-        ErrorF("[config/dbus] couldn't allocate first key/value pair\n");
-        ret = BadAlloc;
-        goto unwind;
-    }
-
-    /* signature should be [ss][ss]... */
-    while (dbus_message_iter_get_arg_type(&iter) == DBUS_TYPE_ARRAY) {
-        char *key, *value;
-
-        dbus_message_iter_recurse(&iter, &subiter);
-
-        if (dbus_message_iter_get_arg_type(&subiter) != DBUS_TYPE_STRING)
-            MALFORMED_MESSAGE();
-
-        dbus_message_iter_get_basic(&subiter, &key);
-        if (!key)
-            MALFORMED_MESSAGE();
-        /* The _ prefix refers to internal settings, and may not be given by
-         * the client. */
-        if (key[0] == '_') {
-            ErrorF("[config/dbus] attempted subterfuge: option name %s given\n",
-                   key);
-            MALFORMED_MESSAGE();
-        }
-
-        if (!dbus_message_iter_has_next(&subiter))
-            MALFORMED_MESSAGE();
-        dbus_message_iter_next(&subiter);
-        if (dbus_message_iter_get_arg_type(&subiter) != DBUS_TYPE_STRING)
-            MALFORMED_MESSAGE();
-
-        dbus_message_iter_get_basic(&subiter, &value);
-        if (!value)
-            MALFORMED_MESSAGE();
-
-        input_options = input_option_new(input_options, key, value);
-
-        dbus_message_iter_next(&iter);
-    }
-
-    ret = NewInputDeviceRequest(input_options, NULL, &dev);
-    if (ret != Success) {
-        DebugF("[config/dbus] NewInputDeviceRequest failed\n");
-        goto unwind;
-    }
-
-    if (!dev) {
-        DebugF("[config/dbus] NewInputDeviceRequest provided no device\n");
-        ret = BadImplementation;
-        goto unwind;
-    }
-
-    /* XXX: If we fail halfway through, we don't seem to have any way to
-     *      empty the iterator, so you'll end up with some device IDs,
-     *      plus an error.  This seems to be a shortcoming in the D-Bus
-     *      API. */
-    for (; dev; dev = dev->next) {
-        if (!dbus_message_iter_append_basic(&reply_iter, DBUS_TYPE_INT32,
-                                            &dev->id)) {
-            ErrorF("[config/dbus] couldn't append to iterator\n");
-            ret = BadAlloc;
-            goto unwind;
-        }
-    }
-
- unwind:
-    if (ret != Success) {
-        if (dev)
-            RemoveDevice(dev, TRUE);
-
-        err = -ret;
-        dbus_message_iter_append_basic(&reply_iter, DBUS_TYPE_INT32, &err);
-    }
-
-    input_option_free_list(&input_options);
-
-    return ret;
-}
-
-static int
-remove_device(DBusMessage * message, DBusMessage * reply, DBusError * error)
-{
-    int deviceid, ret, err;
-    DeviceIntPtr dev;
-    DBusMessageIter iter, reply_iter;
-
-    dbus_message_iter_init_append(reply, &reply_iter);
-
-    if (!dbus_message_iter_init(message, &iter)) {
-        ErrorF("[config/dbus] failed to init iterator\n");
-        MALFORMED_MESSAGE();
-    }
-
-    if (!dbus_message_get_args(message, error, DBUS_TYPE_UINT32,
-                               &deviceid, DBUS_TYPE_INVALID)) {
-        MALFORMED_MESSAGE_ERROR();
-    }
-
-    dixLookupDevice(&dev, deviceid, serverClient, DixDestroyAccess);
-    if (!dev) {
-        DebugF("[config/dbus] bogus device id %d given\n", deviceid);
-        ret = BadMatch;
-        goto unwind;
-    }
-
-    DebugF("[config/dbus] removing device %s (id %d)\n", dev->name, deviceid);
-
-    /* Call PIE here so we don't try to dereference a device that's
-     * already been removed. */
-    OsBlockSignals();
-    ProcessInputEvents();
-    DeleteInputDeviceRequest(dev);
-    OsReleaseSignals();
-
-    ret = Success;
-
- unwind:
-    err = (ret == Success) ? ret : -ret;
-    dbus_message_iter_append_basic(&reply_iter, DBUS_TYPE_INT32, &err);
-
-    return ret;
-}
-
-static int
-list_devices(DBusMessage * message, DBusMessage * reply, DBusError * error)
-{
-    DeviceIntPtr dev;
-    DBusMessageIter iter, subiter;
-
-    dbus_message_iter_init_append(reply, &iter);
-
-    for (dev = inputInfo.devices; dev; dev = dev->next) {
-        if (!dbus_message_iter_open_container(&iter, DBUS_TYPE_STRUCT, NULL,
-                                              &subiter)) {
-            ErrorF("[config/dbus] couldn't init container\n");
-            return BadAlloc;
-        }
-        if (!dbus_message_iter_append_basic(&subiter, DBUS_TYPE_UINT32,
-                                            &dev->id)) {
-            ErrorF("[config/dbus] couldn't append to iterator\n");
-            return BadAlloc;
-        }
-        if (!dbus_message_iter_append_basic(&subiter, DBUS_TYPE_STRING,
-                                            &dev->name)) {
-            ErrorF("[config/dbus] couldn't append to iterator\n");
-            return BadAlloc;
-        }
-        if (!dbus_message_iter_close_container(&iter, &subiter)) {
-            ErrorF("[config/dbus] couldn't close container\n");
-            return BadAlloc;
-        }
-    }
-
-    return Success;
-}
-
-static int
-get_version(DBusMessage * message, DBusMessage * reply, DBusError * error)
-{
-    DBusMessageIter iter;
-    unsigned int version = API_VERSION;
-
-    dbus_message_iter_init_append(reply, &iter);
-    if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_UINT32, &version)) {
-        ErrorF("[config/dbus] couldn't append version\n");
-        return BadAlloc;
-    }
-
-    return Success;
-}
-
-static DBusHandlerResult
-message_handler(DBusConnection * connection, DBusMessage * message, void *data)
-{
-    DBusError error;
-    DBusMessage *reply;
-    struct connection_info *info = data;
-
-    /* ret is the overall D-Bus handler result, whereas err is the internal
-     * X error from our individual functions. */
-    int ret = DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-    int err;
-
-    DebugF("[config/dbus] received a message for %s\n",
-           dbus_message_get_interface(message));
-
-    dbus_error_init(&error);
-
-    reply = dbus_message_new_method_return(message);
-    if (!reply) {
-        ErrorF("[config/dbus] failed to create reply\n");
-        ret = DBUS_HANDLER_RESULT_NEED_MEMORY;
-        goto err_start;
-    }
-
-    if (strcmp(dbus_message_get_member(message), "add") == 0)
-        err = add_device(message, reply, &error);
-    else if (strcmp(dbus_message_get_member(message), "remove") == 0)
-        err = remove_device(message, reply, &error);
-    else if (strcmp(dbus_message_get_member(message), "listDevices") == 0)
-        err = list_devices(message, reply, &error);
-    else if (strcmp(dbus_message_get_member(message), "version") == 0)
-        err = get_version(message, reply, &error);
-    else
-        goto err_reply;
-
-    /* Failure to allocate is a special case. */
-    if (err == BadAlloc) {
-        ret = DBUS_HANDLER_RESULT_NEED_MEMORY;
-        goto err_reply;
-    }
-
-    /* While failure here is always an OOM, we don't return that,
-     * since that would result in devices being double-added/removed. */
-    if (dbus_connection_send(info->connection, reply, NULL))
-        dbus_connection_flush(info->connection);
-    else
-        ErrorF("[config/dbus] failed to send reply\n");
-
-    ret = DBUS_HANDLER_RESULT_HANDLED;
-
- err_reply:
-    dbus_message_unref(reply);
- err_start:
-    dbus_error_free(&error);
-
-    return ret;
-}
-
-static void
-connect_hook(DBusConnection * connection, void *data)
-{
-    DBusError error;
-    DBusObjectPathVTable vtable = {.message_function = message_handler, };
-    struct connection_info *info = data;
-
-    info->connection = connection;
-
-    dbus_error_init(&error);
-
-    dbus_bus_request_name(info->connection, info->busname, 0, &error);
-    if (dbus_error_is_set(&error)) {
-        ErrorF("[config/dbus] couldn't take over org.x.config: %s (%s)\n",
-               error.name, error.message);
-        goto err_start;
-    }
-
-    /* blocks until we get a reply. */
-    dbus_bus_add_match(info->connection, MATCH_RULE, &error);
-    if (dbus_error_is_set(&error)) {
-        ErrorF("[config/dbus] couldn't add match: %s (%s)\n", error.name,
-               error.message);
-        goto err_name;
-    }
-
-    if (!dbus_connection_register_object_path(info->connection,
-                                              info->busobject, &vtable, info)) {
-        ErrorF("[config/dbus] couldn't register object path\n");
-        goto err_match;
-    }
-
-    DebugF("[dbus] registered %s, %s\n", info->busname, info->busobject);
-
-    dbus_error_free(&error);
-
-    return;
-
- err_match:
-    dbus_bus_remove_match(info->connection, MATCH_RULE, &error);
- err_name:
-    dbus_bus_release_name(info->connection, info->busname, &error);
- err_start:
-    dbus_error_free(&error);
-
-    reset_info(info);
-}
-
-static void
-disconnect_hook(void *data)
-{
-}
-
-#if 0
-void
-pre_disconnect_hook(void)
-{
-    DBusError error;
-
-    dbus_error_init(&error);
-    dbus_connection_unregister_object_path(connection_data->connection,
-                                           connection_data->busobject);
-    dbus_bus_remove_match(connection_data->connection, MATCH_RULE, &error);
-    dbus_bus_release_name(connection_data->connection,
-                          connection_data->busname, &error);
-    dbus_error_free(&error);
-}
-#endif
-
-static struct connection_info connection_data;
-
-static struct config_dbus_core_hook core_hook = {
-    .connect = connect_hook,
-    .disconnect = disconnect_hook,
-    .data = &connection_data,
-};
-
-int
-config_dbus_init(void)
-{
-    snprintf(connection_data.busname, sizeof(connection_data.busname),
-             "org.x.config.display%d", atoi(display));
-    snprintf(connection_data.busobject, sizeof(connection_data.busobject),
-             "/org/x/config/%d", atoi(display));
-
-    return config_dbus_core_add_hook(&core_hook);
-}
-
-void
-config_dbus_fini(void)
-{
-    config_dbus_core_remove_hook(&core_hook);
-    connection_data.busname[0] = '\0';
-    connection_data.busobject[0] = '\0';
-}
index 2ead556..ea574ca 100644 (file)
@@ -33,6 +33,7 @@
 #include <string.h>
 #include <sys/select.h>
 
+#include "dbus-core.h"
 #include "input.h"
 #include "inputstr.h"
 #include "hotplug.h"
@@ -184,8 +185,7 @@ device_added(LibHalContext * hal_ctx, const char *udi)
     parent = get_prop_string(hal_ctx, udi, "info.parent");
     if (parent) {
         int usb_vendor, usb_product;
-
-        attrs.pnp_id = get_prop_string(hal_ctx, parent, "pnp.id");
+        char *old_parent;
 
         /* construct USB ID in lowercase - "0000:ffff" */
         usb_vendor = libhal_device_get_property_int(hal_ctx, parent,
@@ -203,7 +203,18 @@ device_added(LibHalContext * hal_ctx, const char *udi)
                 == -1)
                 attrs.usb_id = NULL;
 
-        free(parent);
+        attrs.pnp_id = get_prop_string(hal_ctx, parent, "pnp.id");
+        old_parent = parent;
+
+        while (!attrs.pnp_id &&
+               (parent = get_prop_string(hal_ctx, parent, "info.parent"))) {
+            attrs.pnp_id = get_prop_string(hal_ctx, parent, "pnp.id");
+
+            free(old_parent);
+            old_parent = parent;
+        }
+
+        free(old_parent);
     }
 
     input_options = input_option_new(NULL, "_source", "server/hal");
@@ -631,7 +642,7 @@ connect_hook(DBusConnection * connection, void *data)
 
 static struct config_hal_info hal_info;
 
-static struct config_dbus_core_hook hook = {
+static struct dbus_core_hook hook = {
     .connect = connect_hook,
     .disconnect = disconnect_hook,
     .data = &hal_info,
@@ -644,7 +655,7 @@ config_hal_init(void)
     hal_info.system_bus = NULL;
     hal_info.hal_ctx = NULL;
 
-    if (!config_dbus_core_add_hook(&hook)) {
+    if (!dbus_core_add_hook(&hook)) {
         LogMessage(X_ERROR, "config/hal: failed to add D-Bus hook\n");
         return 0;
     }
@@ -658,5 +669,5 @@ config_hal_init(void)
 void
 config_hal_fini(void)
 {
-    config_dbus_core_remove_hook(&hook);
+    dbus_core_remove_hook(&hook);
 }
old mode 100644 (file)
new mode 100755 (executable)
index 6b30e2c..91bc123
@@ -29,6 +29,7 @@
 
 #include <libudev.h>
 #include <ctype.h>
+#include <unistd.h>
 
 #include "input.h"
 #include "inputstr.h"
@@ -36,6 +37,7 @@
 #include "config-backends.h"
 #include "os.h"
 #include "globals.h"
+#include "systemd-logind.h"
 
 #define UDEV_XKB_PROP_KEY "xkb"
 
 static struct udev_monitor *udev_monitor;
 
 #ifdef CONFIG_UDEV_KMS
-static Bool
+static void
 config_udev_odev_setup_attribs(const char *path, const char *syspath,
+                               int major, int minor,
                                config_odev_probe_proc_ptr probe_callback);
 #endif
 
+static char itoa_buf[16];
+
+static const char *itoa(int i)
+{
+    snprintf(itoa_buf, sizeof(itoa_buf), "%d", i);
+    return itoa_buf;
+}
+
 static void
 device_added(struct udev_device *udev_device)
 {
@@ -73,6 +84,11 @@ device_added(struct udev_device *udev_device)
     struct udev_device *parent;
     int rc;
     const char *dev_seat;
+    dev_t devnum;
+#ifdef _F_UDEV_MONITORING_WITH_KERNEL_UEVENT_
+    if (input_set_default_property(udev_device) < 0)
+       return;
+#endif
 
     path = udev_device_get_devnode(udev_device);
 
@@ -91,6 +107,8 @@ device_added(struct udev_device *udev_device)
     if (!SeatId && strcmp(dev_seat, "seat0"))
         return;
 
+    devnum = udev_device_get_devnum(udev_device);
+
 #ifdef CONFIG_UDEV_KMS
     if (!strcmp(udev_device_get_subsystem(udev_device), "drm")) {
         const char *sysname = udev_device_get_sysname(udev_device);
@@ -98,9 +116,14 @@ device_added(struct udev_device *udev_device)
         if (strncmp(sysname, "card", 4) != 0)
             return;
 
+        /* Check for devices already added through xf86platformProbe() */
+        if (xf86_find_platform_device_by_devnum(major(devnum), minor(devnum)))
+            return;
+
         LogMessage(X_INFO, "config/udev: Adding drm device (%s)\n", path);
 
-        config_udev_odev_setup_attribs(path, syspath, NewGPUDeviceRequest);
+        config_udev_odev_setup_attribs(path, syspath, major(devnum),
+                                       minor(devnum), NewGPUDeviceRequest);
         return;
     }
 #endif
@@ -130,19 +153,28 @@ device_added(struct udev_device *udev_device)
             LOG_PROPERTY(ppath, "NAME", name);
         }
 
-        if (pnp_id)
-            attrs.pnp_id = strdup(pnp_id);
-        LOG_SYSATTR(ppath, "id", pnp_id);
-
         /* construct USB ID in lowercase hex - "0000:ffff" */
         if (product &&
             sscanf(product, "%*x/%4x/%4x/%*x", &usb_vendor, &usb_model) == 2) {
-            if (asprintf(&attrs.usb_id, "%04x:%04x", usb_vendor, usb_model)
+            char *usb_id;
+            if (asprintf(&usb_id, "%04x:%04x", usb_vendor, usb_model)
                 == -1)
-                attrs.usb_id = NULL;
+                usb_id = NULL;
             else
                 LOG_PROPERTY(ppath, "PRODUCT", product);
+            attrs.usb_id = usb_id;
         }
+
+        while (!pnp_id && (parent = udev_device_get_parent(parent))) {
+            pnp_id = udev_device_get_sysattr_value(parent, "id");
+            if (!pnp_id)
+                continue;
+
+            attrs.pnp_id = strdup(pnp_id);
+            ppath = udev_device_get_devnode(parent);
+            LOG_SYSATTR(ppath, "id", pnp_id);
+        }
+
     }
     if (!name)
         name = "(unnamed)";
@@ -151,6 +183,8 @@ device_added(struct udev_device *udev_device)
     input_options = input_option_new(input_options, "name", name);
     input_options = input_option_new(input_options, "path", path);
     input_options = input_option_new(input_options, "device", path);
+    input_options = input_option_new(input_options, "major", itoa(major(devnum)));
+    input_options = input_option_new(input_options, "minor", itoa(minor(devnum)));
     if (path)
         attrs.device = strdup(path);
 
@@ -226,6 +260,10 @@ device_added(struct udev_device *udev_device)
 
     input_options = input_option_new(input_options, "config_info", config_info);
 
+    /* Default setting needed for non-seat0 seats */
+    if (ServerIsNotSeat0())
+        input_options = input_option_new(input_options, "GrabDevice", "on");
+
     LogMessage(X_INFO, "config/udev: Adding input device %s (%s)\n",
                name, path);
     rc = NewInputDeviceRequest(input_options, &attrs, &dev);
@@ -284,14 +322,18 @@ device_removed(struct udev_device *device)
     if (!strcmp(udev_device_get_subsystem(device), "drm")) {
         const char *sysname = udev_device_get_sysname(device);
         const char *path = udev_device_get_devnode(device);
+        dev_t devnum = udev_device_get_devnum(device);
 
         if (strncmp(sysname,"card", 4) != 0)
             return;
-        ErrorF("removing GPU device %s %d\n", syspath, path);
+        ErrorF("removing GPU device %s %s\n", syspath, path);
         if (!path)
             return;
 
-        config_udev_odev_setup_attribs(path, syspath, DeleteGPUDeviceRequest);
+        config_udev_odev_setup_attribs(path, syspath, major(devnum),
+                                       minor(devnum), DeleteGPUDeviceRequest);
+        /* Retry vtenter after a drm node removal */
+        systemd_logind_vtenter();
         return;
     }
 #endif
@@ -305,7 +347,7 @@ device_removed(struct udev_device *device)
 }
 
 static void
-wakeup_handler(pointer data, int err, pointer read_mask)
+wakeup_handler(void *data, int err, void *read_mask)
 {
     int udev_fd = udev_monitor_get_fd(udev_monitor);
     struct udev_device *udev_device;
@@ -320,11 +362,19 @@ wakeup_handler(pointer data, int err, pointer read_mask)
             return;
         action = udev_device_get_action(udev_device);
         if (action) {
-            if (!strcmp(action, "add") || !strcmp(action, "change")) {
+            if (!strcmp(action, "add")) {
 #ifndef _F_NOT_TO_REMOVE_DEVICE_BY_UDEV_ADD_EVENT_
                 device_removed(udev_device);
 #endif
                 device_added(udev_device);
+            } else if (!strcmp(action, "change")) {
+                /* ignore change for the drm devices */
+                if (strcmp(udev_device_get_subsystem(udev_device), "drm")) {
+#ifndef _F_NOT_TO_REMOVE_DEVICE_BY_UDEV_ADD_EVENT_
+                    device_removed(udev_device);
+#endif
+                    device_added(udev_device);
+                }
             }
             else if (!strcmp(action, "remove"))
                 device_removed(udev_device);
@@ -334,7 +384,7 @@ wakeup_handler(pointer data, int err, pointer read_mask)
 }
 
 static void
-block_handler(pointer data, struct timeval **tv, pointer read_mask)
+block_handler(void *data, struct timeval **tv, void *read_mask)
 {
 }
 
@@ -347,7 +397,11 @@ config_udev_pre_init(void)
     if (!udev)
         return 0;
 
+#ifdef _F_UDEV_MONITORING_WITH_KERNEL_UEVENT_
+    udev_monitor = udev_monitor_new_from_netlink(udev, "kernel");
+#else
     udev_monitor = udev_monitor_new_from_netlink(udev, "udev");
+#endif
     if (!udev_monitor)
         return 0;
 
@@ -435,31 +489,20 @@ config_udev_fini(void)
 
 #ifdef CONFIG_UDEV_KMS
 
-static Bool
+static void
 config_udev_odev_setup_attribs(const char *path, const char *syspath,
+                               int major, int minor,
                                config_odev_probe_proc_ptr probe_callback)
 {
     struct OdevAttributes *attribs = config_odev_allocate_attribute_list();
-    int ret;
 
-    if (!attribs)
-        return FALSE;
-
-    ret = config_odev_add_attribute(attribs, ODEV_ATTRIB_PATH, path);
-    if (ret == FALSE)
-        goto fail;
-
-    ret = config_odev_add_attribute(attribs, ODEV_ATTRIB_SYSPATH, syspath);
-    if (ret == FALSE)
-        goto fail;
+    config_odev_add_attribute(attribs, ODEV_ATTRIB_PATH, path);
+    config_odev_add_attribute(attribs, ODEV_ATTRIB_SYSPATH, syspath);
+    config_odev_add_int_attribute(attribs, ODEV_ATTRIB_MAJOR, major);
+    config_odev_add_int_attribute(attribs, ODEV_ATTRIB_MINOR, minor);
 
     /* ownership of attribs is passed to probe layer */
     probe_callback(attribs);
-    return TRUE;
-fail:
-    config_odev_free_attributes(attribs);
-    free(attribs);
-    return FALSE;
 }
 
 void
@@ -487,6 +530,7 @@ config_udev_odev_probe(config_odev_probe_proc_ptr probe_callback)
         struct udev_device *udev_device = udev_device_new_from_syspath(udev, syspath);
         const char *path = udev_device_get_devnode(udev_device);
         const char *sysname = udev_device_get_sysname(udev_device);
+        dev_t devnum = udev_device_get_devnum(udev_device);
 
         if (!path || !syspath)
             goto no_probe;
@@ -495,8 +539,8 @@ config_udev_odev_probe(config_odev_probe_proc_ptr probe_callback)
         else if (strncmp(sysname, "card", 4) != 0)
             goto no_probe;
 
-        config_udev_odev_setup_attribs(path, syspath, probe_callback);
-
+        config_udev_odev_setup_attribs(path, syspath, major(devnum),
+                                       minor(devnum), probe_callback);
     no_probe:
         udev_device_unref(udev_device);
     }
diff --git a/config/xorg-server.conf b/config/xorg-server.conf
deleted file mode 100644 (file)
index 47a9a78..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-<!DOCTYPE busconfig PUBLIC
- "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
- "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
-<busconfig>
-       <policy context="default">
-               <allow own="org.x.config.display0"/>
-               <allow send_destination="org.x.config.display0"/>
-               <allow send_interface="org.x.config.display0"/>
-               <allow own="org.x.config.display1"/>
-               <allow send_destination="org.x.config.display1"/>
-               <allow send_interface="org.x.config.display1"/>
-       </policy>
-</busconfig>
old mode 100755 (executable)
new mode 100644 (file)
index 3b00f23..c911941
@@ -26,12 +26,13 @@ dnl
 dnl Process this file with autoconf to create configure.
 
 AC_PREREQ(2.60)
-AC_INIT([xorg-server], 1.13.0, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
-RELEASE_DATE="2012-09-05"
-RELEASE_NAME="Iced Tea"
+AC_INIT([xorg-server], 1.16.0, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
+RELEASE_DATE="2014-07-16"
+RELEASE_NAME="Marionberry Pie"
 AC_CONFIG_SRCDIR([Makefile.am])
+AC_CONFIG_MACRO_DIR([m4])
 AM_INIT_AUTOMAKE([foreign dist-bzip2])
-AM_MAINTAINER_MODE
+AC_USE_SYSTEM_EXTENSIONS
 
 # Require xorg-macros minimum of 1.14 for XORG_COMPILER_BRAND in XORG_DEFAULT_OPTIONS
 m4_ifndef([XORG_MACROS_VERSION],
@@ -48,7 +49,7 @@ XORG_WITH_XSLTPROC
 XORG_ENABLE_UNIT_TESTS
 XORG_LD_WRAP([optional])
 
-m4_ifndef([XORG_FONT_MACROS_VERSION], [m4_fatal([must install fontutil 1.1 or later before running autoconf/autogen])])
+m4_ifndef([XORG_FONT_MACROS_VERSION], [m4_fatal([must install font-util 1.1 or later before running autoconf/autogen])])
 XORG_FONT_MACROS_VERSION(1.1)
 
 dnl this gets generated by autoheader, and thus contains all the defines.  we
@@ -74,9 +75,8 @@ AC_CONFIG_HEADERS(include/version-config.h)
 
 AM_PROG_AS
 AC_PROG_LN_S
-AC_LIBTOOL_WIN32_DLL
-AC_DISABLE_STATIC
-AC_PROG_LIBTOOL
+LT_PREREQ([2.2])
+LT_INIT([disable-static win32-dll])
 PKG_PROG_PKG_CONFIG
 AC_PROG_LEX
 AC_PROG_YACC
@@ -94,7 +94,7 @@ if  test "x$GCC" = xyes ; then
 fi
 
 dnl Check for dtrace program (needed to build Xserver dtrace probes)
-dnl Also checks for <sys/sdt.h>, since some Linux distros have an 
+dnl Also checks for <sys/sdt.h>, since some Linux distros have an
 dnl ISDN trace program named dtrace
 AC_ARG_WITH(dtrace, AS_HELP_STRING([--with-dtrace=PATH],
             [Enable dtrace probes (default: enabled if dtrace found)]),
@@ -114,7 +114,7 @@ if test "x$WDTRACE" = "xyes" -o "x$WDTRACE" = "xauto" ; then
        fi
 fi
 if test "x$WDTRACE" != "xno" ; then
-  AC_DEFINE(XSERVER_DTRACE, 1, 
+  AC_DEFINE(XSERVER_DTRACE, 1,
       [Define to 1 if the DTrace Xserver provider probes should be built in.])
 
 # Solaris/OpenSolaris require dtrace -G to build dtrace probe information into
@@ -133,7 +133,8 @@ AM_CONDITIONAL(SPECIAL_DTRACE_OBJECTS, [test "x$SPECIAL_DTRACE_OBJECTS" = "xyes"
 
 AC_HEADER_DIRENT
 AC_HEADER_STDC
-AC_CHECK_HEADERS([fcntl.h stdlib.h string.h unistd.h dlfcn.h stropts.h fnmatch.h sys/utsname.h])
+AC_CHECK_HEADERS([fcntl.h stdlib.h string.h unistd.h dlfcn.h stropts.h \
+ fnmatch.h sys/mkdev.h sys/utsname.h])
 
 dnl Checks for typedefs, structures, and compiler characteristics.
 AC_C_CONST
@@ -186,7 +187,7 @@ b = bswap16(a);
        if test "$SYS_ENDIAN_BSWAP" = "yes" ; then
                USE_SYS_ENDIAN_H=yes
                BSWAP=bswap
-       else    
+       else
                if test "$SYS_ENDIAN__SWAP" = "yes" ; then
                        USE_SYS_ENDIAN_H=yes
                        BSWAP=__swap
@@ -196,13 +197,13 @@ b = bswap16(a);
        fi
 
        if test "$USE_SYS_ENDIAN_H" = "yes" ; then
-           AC_DEFINE([USE_SYS_ENDIAN_H], 1, 
+           AC_DEFINE([USE_SYS_ENDIAN_H], 1,
                [Define to use byteswap macros from <sys/endian.h>])
-           AC_DEFINE_UNQUOTED([bswap_16], ${BSWAP}16, 
+           AC_DEFINE_UNQUOTED([bswap_16], ${BSWAP}16,
                        [Define to 16-bit byteswap macro])
-           AC_DEFINE_UNQUOTED([bswap_32], ${BSWAP}32, 
+           AC_DEFINE_UNQUOTED([bswap_32], ${BSWAP}32,
                        [Define to 32-bit byteswap macro])
-           AC_DEFINE_UNQUOTED([bswap_64], ${BSWAP}64, 
+           AC_DEFINE_UNQUOTED([bswap_64], ${BSWAP}64,
                        [Define to 64-bit byteswap macro])
        fi
 fi
@@ -216,7 +217,7 @@ AC_SUBST(DLOPEN_LIBS)
 dnl Checks for library functions.
 AC_CHECK_FUNCS([backtrace ffs geteuid getuid issetugid getresuid \
        getdtablesize getifaddrs getpeereid getpeerucred getzoneid \
-       mmap shmctl64 strncasecmp vasprintf vsnprintf walkcontext])
+       mmap seteuid shmctl64 strncasecmp vasprintf vsnprintf walkcontext])
 AC_REPLACE_FUNCS([strcasecmp strcasestr strlcat strlcpy strndup])
 
 dnl Find the math libary, then check for cbrt function in it.
@@ -229,10 +230,6 @@ dnl AGPGART headers
 AC_CHECK_HEADERS([linux/agpgart.h sys/agpio.h sys/agpgart.h], AGP=yes)
 AM_CONDITIONAL(AGP, [test "x$AGP" = xyes])
 
-dnl APM header
-AC_CHECK_HEADERS([linux/apm_bios.h], LNXAPM=yes)
-AM_CONDITIONAL(LNXAPM, [test "x$LNXAPM" = xyes])
-
 dnl fbdev header
 AC_CHECK_HEADERS([linux/fb.h], FBDEV=yes)
 AM_CONDITIONAL(FBDEVHW, [test "x$FBDEV" = xyes])
@@ -269,30 +266,30 @@ AM_CONDITIONAL(FREEBSD_KLDLOAD, [test "x$ac_cv_sys_linker_h" = xyes])
 
 AC_CACHE_CHECK([for SYSV IPC],
                ac_cv_sysv_ipc,
-               [AC_TRY_LINK([
+               [AC_LINK_IFELSE([AC_LANG_PROGRAM([[
 #include <sys/types.h>
 #include <sys/ipc.h>
 #include <sys/shm.h>
 #include <sys/stat.h>
-],[
-{ 
+]],[[
+{
     int id;
     id = shmget(IPC_PRIVATE, 512, S_IRUSR | S_IWUSR);
     if (id < 0) return -1;
     return shmctl(id, IPC_RMID, 0);
-}],
-       [ac_cv_sysv_ipc=yes],
-       [ac_cv_sysv_ipc=no])])
+}]])],
+       [ac_cv_sysv_ipc=yes],
+       [ac_cv_sysv_ipc=no])])
 if test "x$ac_cv_sysv_ipc" = xyes; then
        AC_DEFINE(HAVE_SYSV_IPC, 1, [Define to 1 if SYSV IPC is available])
 fi
 
-dnl OpenBSD /dev/xf86 aperture driver 
+dnl OpenBSD /dev/xf86 aperture driver
 if test -c /dev/xf86 ; then
        AC_DEFINE(HAS_APERTURE_DRV, 1, [System has /dev/xf86 aperture driver])
 fi
 
-dnl BSD APM support 
+dnl BSD APM support
 AC_CHECK_HEADER([machine/apmvar.h],[
        AC_CHECK_HEADER([sys/event.h],
                ac_cv_BSD_KQUEUE_APM=yes,
@@ -300,14 +297,20 @@ AC_CHECK_HEADER([machine/apmvar.h],[
 
 AM_CONDITIONAL(BSD_APM, [test "x$ac_cv_BSD_APM" = xyes])
 AM_CONDITIONAL(BSD_KQUEUE_APM, [test "x$ac_cv_BSD_KQUEUE_APM" = xyes])
-       
-dnl glibc backtrace support check (hw/xfree86/common/xf86Events.c)
+
+dnl glibc backtrace support check
+AC_ARG_ENABLE(supportbacktrace,      AS_HELP_STRING([--disable-backtrace],
+                               [Do not use backtrace with execinfo.h when xorg-backtrace (default: enabled)]),
+                               [SUPPORT_BACKTRACE=no], [SUPPORT_BACKTRACE=yes])
+
+if test $SUPPORT_BACKTRACE = xyes; then
 AC_CHECK_HEADER([execinfo.h],[
     AC_CHECK_LIB(c, backtrace, [
         AC_DEFINE(HAVE_BACKTRACE, 1, [Has backtrace support])
         AC_DEFINE(HAVE_EXECINFO_H, 1, [Have execinfo.h])
     ])]
 )
+fi
 
 dnl ---------------------------------------------------------------------------
 dnl Bus options and CPU capabilities.  Replaces logic in
@@ -328,6 +331,7 @@ case $host_cpu in
        ;;
   arm*)
        ARM_VIDEO=yes
+       DEFAULT_INT10="stub"
        ;;
   i*86)
        I386_VIDEO=yes
@@ -337,7 +341,7 @@ case $host_cpu in
                *netbsd*)       AC_DEFINE(USE_I386_IOPL)
                                SYS_LIBS=-li386
                                ;;
-               *openbsd*)      AC_DEFINE(USE_I386_IOPL) 
+               *openbsd*)      AC_DEFINE(USE_I386_IOPL)
                                SYS_LIBS=-li386
                                ;;
        esac
@@ -421,7 +425,7 @@ case $host_os in
   darwin*)
        AC_DEFINE(CSRG_BASED, 1, [System is BSD-like])
        ;;
-  cygwin*)
+  cygwin*|mingw*)
        CFLAGS="$CFLAGS -DFD_SETSIZE=256"
        ;;
 esac
@@ -441,7 +445,12 @@ VENDOR_NAME="The X.Org Foundation"
 VENDOR_NAME_SHORT="X.Org"
 VENDOR_WEB="http://wiki.x.org"
 
-m4_ifdef([AS_HELP_STRING], , [m4_define([AS_HELP_STRING], m4_defn([AC_HELP_STRING]))])
+dnl Tizen IR Build option
+AC_ARG_ENABLE(ir,             AS_HELP_STRING([--enable-ir], [Build Xorg with input redirection support (default: disabled)]), [IR=$enableval],[IR=no])
+dnl Tizen XKB Build option (from opensource patch)
+AC_ARG_ENABLE(xkb-cache,      AS_HELP_STRING([--disable-xkb-cache],
+                               [Cache xkbcomp output when possible (default: enabled)]),
+                               [XKBCACHE=$enableval], [XKBCACHE=yes])
 
 dnl Build options.
 AC_ARG_ENABLE(werror,        AS_HELP_STRING([--enable-werror],
@@ -497,17 +506,14 @@ XORG_FONTSUBDIR(FONTTYPE1DIR, fonttype1dir, Type1)
 XORG_FONTSUBDIR(FONT75DPIDIR, font75dpidir, 75dpi)
 XORG_FONTSUBDIR(FONT100DPIDIR, font100dpidir, 100dpi)
 
-dnl Uses --default-font-path if set, otherwise checks for /etc/X11/fontpath.d,
-dnl otherwise uses standard subdirectories of FONTROOTDIR. When cross
-dnl compiling, assume default font path uses standard FONTROOTDIR directories.
+dnl Uses --with-default-font-path if set, otherwise uses standard
+dnl subdirectories of FONTROOTDIR. Some distros set the default font path to
+dnl "catalogue:/etc/X11/fontpath.d,built-ins"
 DEFAULT_FONT_PATH="${FONTMISCDIR}/,${FONTTTFDIR}/,${FONTOTFDIR}/,${FONTTYPE1DIR}/,${FONT100DPIDIR}/,${FONT75DPIDIR}/"
-if test "$cross_compiling" != yes; then
-       AC_CHECK_FILE([${sysconfdir}/X11/fontpath.d],
-               [DEFAULT_FONT_PATH='catalogue:${sysconfdir}/X11/fontpath.d'],
-               [case $host_os in
-                       darwin*) DEFAULT_FONT_PATH="${DEFAULT_FONT_PATH},/Library/Fonts,/System/Library/Fonts" ;;
-               esac])
-fi
+case $host_os in
+    darwin*) DEFAULT_FONT_PATH="${DEFAULT_FONT_PATH},/Library/Fonts,/System/Library/Fonts" ;;
+esac
+
 AC_ARG_WITH(default-font-path, AS_HELP_STRING([--with-default-font-path=PATH], [Comma separated list of font dirs]),
                                [ FONTPATH="$withval" ],
                                [ FONTPATH="${DEFAULT_FONT_PATH}" ])
@@ -515,24 +521,20 @@ AC_ARG_WITH(default-font-path, AS_HELP_STRING([--with-default-font-path=PATH], [
 AC_MSG_CHECKING([for default font path])
 AC_MSG_RESULT([$FONTPATH])
 
-AC_ARG_ENABLE(ir,             AS_HELP_STRING([--enable-ir], [Build Xorg with input redirection support (default: disabled)]), [IR=$enableval],[IR=no])
 AC_ARG_WITH(xkb-path,         AS_HELP_STRING([--with-xkb-path=PATH], [Path to XKB base dir (default: ${datadir}/X11/xkb)]),
                                [ XKBPATH="$withval" ],
                                [ XKBPATH="${datadir}/X11/xkb" ])
 AC_ARG_WITH(xkb-output,       AS_HELP_STRING([--with-xkb-output=PATH], [Path to XKB output dir (default: ${datadir}/X11/xkb/compiled)]),
                                [ XKBOUTPUT="$withval" ],
                                [ XKBOUTPUT="compiled" ])
-AC_ARG_ENABLE(xkb-cache,      AS_HELP_STRING([--disable-xkb-cache],
-                               [Cache xkbcomp output when possible (default: enabled)]),
-                               [XKBCACHE=$enableval], [XKBCACHE=yes])
 AC_ARG_WITH(default-xkb-rules, AS_HELP_STRING([--with-default-xkb-rules=RULES],
                                    [Keyboard ruleset (default: base/evdev)]),
                                 [ XKB_DFLT_RULES="$withval" ],
                                 [ XKB_DFLT_RULES="" ])
 AC_ARG_WITH(default-xkb-model, AS_HELP_STRING([--with-default-xkb-model=MODEL],
-                                   [Keyboard model (default: evdev)]),
+                                   [Keyboard model (default: pc105)]),
                                 [ XKB_DFLT_MODEL="$withval" ],
-                                [ XKB_DFLT_MODEL="evdev" ])
+                                [ XKB_DFLT_MODEL="pc105" ])
 AC_ARG_WITH(default-xkb-layout, AS_HELP_STRING([--with-default-xkb-layout=LAYOUT],
                                    [Keyboard layout (default: us)]),
                                 [ XKB_DFLT_LAYOUT="$withval" ],
@@ -573,7 +575,7 @@ AC_ARG_ENABLE(install-libxf86config,
                                [Install libxf86config (default: disabled)]),
                                [INSTALL_LIBXF86CONFIG=$enableval],
                                [INSTALL_LIBXF86CONFIG=no])
-AC_ARG_ENABLE(visibility,     AC_HELP_STRING([--enable-visibility], [Enable symbol visibility (default: auto)]),
+AC_ARG_ENABLE(visibility,     AS_HELP_STRING([--enable-visibility], [Enable symbol visibility (default: auto)]),
                                [SYMBOL_VISIBILITY=$enableval],
                                [SYMBOL_VISIBILITY=auto])
 
@@ -596,11 +598,25 @@ AC_ARG_WITH(khronos-spec-dir, AS_HELP_STRING([--with-khronos-spec-dir=PATH], [Pa
                                [KHRONOS_SPEC_DIR="${withval}"],
                                [KHRONOS_SPEC_DIR=auto])
 
+dnl Tizen Gesture Extensions
+AC_ARG_ENABLE(gesture,       AS_HELP_STRING([--disable-gesture], [Build Gesture extension (default: enabled)]), [GESTURE=$enableval], [GESTURE=yes])
+dnl Tizen HWC Extensions
+AC_ARG_ENABLE(hwc,           AS_HELP_STRING([--disable-hwc], [Build HWC extension (default: enabled)]), [HWC=$enableval], [HWC=yes])
+dnl Tizen HWA Extensions
+AC_ARG_ENABLE(hwa,           AS_HELP_STRING([--disable-hwa], [Build HWA extension (default: enabled)]), [HWA=$enableval], [HWA=yes])
+dnl Tizen xsmack Extensions (from opensource patch)
+AC_ARG_ENABLE(xsmack,         AS_HELP_STRING([--enable-xsmack], [Build SMACK extension (default: disabled)]), [XSMACK=$enableval], [XSMACK=no])
+dnl Tizen container Extensions (from opensource patch)
+AC_ARG_ENABLE(container,         AS_HELP_STRING([--disable-container], [Build CONTAINER extension (default: enabled)]), [CONTAINER=$enableval], [CONTAINER=yes])
+
+dnl Tizen dlog enable
+AC_ARG_ENABLE(dlog,         AS_HELP_STRING([--disable-dlog], [Build dlog (default: disable)]), [XDLOG=$enableval], [XDLOG=yes])
+dnl Tizen smack utility
+AC_ARG_ENABLE(smack-util,         AS_HELP_STRING([--enable-smack-util], [Build with Smack Utility funtions (default: disabled)]), [SMACK_UTIL=$enableval], [SMACK_UTIL=no])
+
 dnl Extensions.
 AC_ARG_ENABLE(registry,       AS_HELP_STRING([--disable-registry], [Build string registry module (default: enabled)]), [XREGISTRY=$enableval], [XREGISTRY=yes])
 AC_ARG_ENABLE(composite,      AS_HELP_STRING([--disable-composite], [Build Composite extension (default: enabled)]), [COMPOSITE=$enableval], [COMPOSITE=yes])
-AC_ARG_ENABLE(gesture,       AS_HELP_STRING([--disable-gesture], [Build Gesture extension (default: enabled)]), [GESTURE=$enableval], [GESTURE=yes])
-AC_ARG_ENABLE(hwc,           AS_HELP_STRING([--disable-hwc], [Build HWC extension (default: enabled)]), [HWC=$enableval], [HWC=yes])
 AC_ARG_ENABLE(mitshm,         AS_HELP_STRING([--disable-mitshm], [Build SHM extension (default: auto)]), [MITSHM=$enableval], [MITSHM=auto])
 AC_ARG_ENABLE(xres,           AS_HELP_STRING([--disable-xres], [Build XRes extension (default: enabled)]), [RES=$enableval], [RES=yes])
 AC_ARG_ENABLE(record,         AS_HELP_STRING([--disable-record], [Build Record extension (default: enabled)]), [RECORD=$enableval], [RECORD=yes])
@@ -613,11 +629,12 @@ AC_ARG_ENABLE(xdm-auth-1,     AS_HELP_STRING([--disable-xdm-auth-1], [Build XDM-
 AC_ARG_ENABLE(glx,            AS_HELP_STRING([--disable-glx], [Build GLX extension (default: enabled)]), [GLX=$enableval], [GLX=yes])
 AC_ARG_ENABLE(dri,            AS_HELP_STRING([--enable-dri], [Build DRI extension (default: auto)]), [DRI=$enableval])
 AC_ARG_ENABLE(dri2,           AS_HELP_STRING([--enable-dri2], [Build DRI2 extension (default: auto)]), [DRI2=$enableval], [DRI2=auto])
+AC_ARG_ENABLE(dri3,           AS_HELP_STRING([--enable-dri3], [Build DRI3 extension (default: auto)]), [DRI3=$enableval], [DRI3=auto])
+AC_ARG_ENABLE(present,       AS_HELP_STRING([--disable-present], [Build Present extension (default: enabled)]), [PRESENT=$enableval], [PRESENT=yes])
 AC_ARG_ENABLE(xinerama,              AS_HELP_STRING([--disable-xinerama], [Build Xinerama extension (default: enabled)]), [XINERAMA=$enableval], [XINERAMA=yes])
 AC_ARG_ENABLE(xf86vidmode,    AS_HELP_STRING([--disable-xf86vidmode], [Build XF86VidMode extension (default: auto)]), [XF86VIDMODE=$enableval], [XF86VIDMODE=auto])
 AC_ARG_ENABLE(xace,           AS_HELP_STRING([--disable-xace], [Build X-ACE extension (default: enabled)]), [XACE=$enableval], [XACE=yes])
 AC_ARG_ENABLE(xselinux,       AS_HELP_STRING([--enable-xselinux], [Build SELinux extension (default: disabled)]), [XSELINUX=$enableval], [XSELINUX=no])
-AC_ARG_ENABLE(xsmack,         AS_HELP_STRING([--enable-xsmack], [Build SMACK extension (default: disabled)]), [XSMACK=$enableval], [XSMACK=no])
 AC_ARG_ENABLE(xcsecurity,     AS_HELP_STRING([--enable-xcsecurity], [Build Security extension (default: disabled)]), [XCSECURITY=$enableval], [XCSECURITY=no])
 AC_ARG_ENABLE(tslib,          AS_HELP_STRING([--enable-tslib], [Build kdrive tslib touchscreen support (default: disabled)]), [TSLIB=$enableval], [TSLIB=no])
 AC_ARG_ENABLE(dbe,            AS_HELP_STRING([--disable-dbe], [Build DBE extension (default: enabled)]), [DBE=$enableval], [DBE=yes])
@@ -625,7 +642,6 @@ AC_ARG_ENABLE(xf86bigfont,    AS_HELP_STRING([--enable-xf86bigfont], [Build XF86
 AC_ARG_ENABLE(dpms,           AS_HELP_STRING([--disable-dpms], [Build DPMS extension (default: enabled)]), [DPMSExtension=$enableval], [DPMSExtension=yes])
 AC_ARG_ENABLE(config-udev,    AS_HELP_STRING([--enable-config-udev], [Build udev support (default: auto)]), [CONFIG_UDEV=$enableval], [CONFIG_UDEV=auto])
 AC_ARG_ENABLE(config-udev-kms,    AS_HELP_STRING([--enable-config-udev-kms], [Build udev kms support (default: auto)]), [CONFIG_UDEV_KMS=$enableval], [CONFIG_UDEV_KMS=auto])
-AC_ARG_ENABLE(config-dbus,    AS_HELP_STRING([--enable-config-dbus], [Build D-BUS API support (default: no)]), [CONFIG_DBUS_API=$enableval], [CONFIG_DBUS_API=no])
 AC_ARG_ENABLE(config-hal,     AS_HELP_STRING([--disable-config-hal], [Build HAL support (default: auto)]), [CONFIG_HAL=$enableval], [CONFIG_HAL=auto])
 AC_ARG_ENABLE(config-wscons,  AS_HELP_STRING([--enable-config-wscons], [Build wscons config support (default: auto)]), [CONFIG_WSCONS=$enableval], [CONFIG_WSCONS=auto])
 AC_ARG_ENABLE(xfree86-utils,     AS_HELP_STRING([--enable-xfree86-utils], [Build xfree86 DDX utilities (default: enabled)]), [XF86UTILS=$enableval], [XF86UTILS=yes])
@@ -636,15 +652,21 @@ AC_ARG_ENABLE(windowswm,      AS_HELP_STRING([--enable-windowswm], [Build XWin w
 AC_ARG_ENABLE(libdrm,         AS_HELP_STRING([--enable-libdrm], [Build Xorg with libdrm support (default: enabled)]), [DRM=$enableval],[DRM=yes])
 AC_ARG_ENABLE(clientids,      AS_HELP_STRING([--disable-clientids], [Build Xorg with client ID tracking (default: enabled)]), [CLIENTIDS=$enableval], [CLIENTIDS=yes])
 AC_ARG_ENABLE(pciaccess, AS_HELP_STRING([--enable-pciaccess], [Build Xorg with pciaccess library (default: enabled)]), [PCI=$enableval], [PCI=yes])
+AC_ARG_ENABLE(linux_acpi, AS_HELP_STRING([--disable-linux-acpi], [Disable building ACPI support on Linux (if available).]), [enable_linux_acpi=$enableval], [enable_linux_acpi=yes])
+AC_ARG_ENABLE(linux_apm, AS_HELP_STRING([--disable-linux-apm], [Disable building APM support on Linux (if available).]), [enable_linux_apm=$enableval], [enable_linux_apm=yes])
+AC_ARG_ENABLE(systemd-logind, AS_HELP_STRING([--enable-systemd-logind], [Build systemd-logind support (default: auto)]), [SYSTEMD_LOGIND=$enableval], [SYSTEMD_LOGIND=auto])
+AC_ARG_ENABLE(suid-wrapper, AS_HELP_STRING([--enable-suid-wrapper], [Build suid-root wrapper for legacy driver support on rootless xserver systems (default: no)]), [SUID_WRAPPER=$enableval], [SUID_WRAPPER=no])
 
 dnl DDXes.
 AC_ARG_ENABLE(xorg,                  AS_HELP_STRING([--enable-xorg], [Build Xorg server (default: auto)]), [XORG=$enableval], [XORG=auto])
-AC_ARG_ENABLE(dmx,           AS_HELP_STRING([--enable-dmx], [Build DMX server (default: auto)]), [DMX=$enableval], [DMX=auto])
+AC_ARG_ENABLE(dmx,           AS_HELP_STRING([--enable-dmx], [Build DMX server (default: no)]), [DMX=$enableval], [DMX=no])
 AC_ARG_ENABLE(xvfb,                  AS_HELP_STRING([--enable-xvfb], [Build Xvfb server (default: yes)]), [XVFB=$enableval], [XVFB=yes])
 AC_ARG_ENABLE(xnest,                 AS_HELP_STRING([--enable-xnest], [Build Xnest server (default: auto)]), [XNEST=$enableval], [XNEST=auto])
 AC_ARG_ENABLE(xquartz,        AS_HELP_STRING([--enable-xquartz], [Build Xquartz server for OS-X (default: auto)]), [XQUARTZ=$enableval], [XQUARTZ=auto])
+AC_ARG_ENABLE(xwayland,       AS_HELP_STRING([--enable-xwayland], [Build Xwayland server (default: auto)]), [XWAYLAND=$enableval], [XWAYLAND=auto])
 AC_ARG_ENABLE(standalone-xpbproxy, AS_HELP_STRING([--enable-standalone-xpbproxy], [Build a standalone xpbproxy (in addition to the one integrated into Xquartz as a separate thread) (default: no)]), [STANDALONE_XPBPROXY=$enableval], [STANDALONE_XPBPROXY=no])
 AC_ARG_ENABLE(xwin,                  AS_HELP_STRING([--enable-xwin], [Build XWin server (default: auto)]), [XWIN=$enableval], [XWIN=auto])
+AC_ARG_ENABLE(glamor,         AS_HELP_STRING([--enable-glamor], [Build glamor dix module (default: no)]), [GLAMOR=$enableval], [GLAMOR=no])
 dnl kdrive and its subsystems
 AC_ARG_ENABLE(kdrive,         AS_HELP_STRING([--enable-kdrive], [Build kdrive servers (default: no)]), [KDRIVE=$enableval], [KDRIVE=no])
 AC_ARG_ENABLE(xephyr,         AS_HELP_STRING([--enable-xephyr], [Build the kdrive Xephyr server (default: auto)]), [XEPHYR=$enableval], [XEPHYR=auto])
@@ -652,13 +674,14 @@ AC_ARG_ENABLE(xfake,          AS_HELP_STRING([--enable-xfake], [Build the kdrive
 AC_ARG_ENABLE(xfbdev,         AS_HELP_STRING([--enable-xfbdev], [Build the kdrive framebuffer device server (default: auto)]), [XFBDEV=$enableval], [XFBDEV=auto])
 dnl kdrive options
 AC_ARG_ENABLE(kdrive-kbd,     AS_HELP_STRING([--enable-kdrive-kbd], [Build kbd driver for kdrive (default: auto)]), [KDRIVE_KBD=$enableval], [KDRIVE_KBD=auto])
-AC_ARG_ENABLE(kdrive-mouse,   AC_HELP_STRING([--enable-kdrive-mouse], [Build mouse driver for kdrive (default: auto)]), [KDRIVE_MOUSE=$enableval], [KDRIVE_MOUSE=auto])
-AC_ARG_ENABLE(kdrive-evdev,   AC_HELP_STRING([--enable-kdrive-evdev], [Build evdev driver for kdrive (default: auto)]), [KDRIVE_EVDEV=$enableval], [KDRIVE_EVDEV=auto])
+AC_ARG_ENABLE(kdrive-mouse,   AS_HELP_STRING([--enable-kdrive-mouse], [Build mouse driver for kdrive (default: auto)]), [KDRIVE_MOUSE=$enableval], [KDRIVE_MOUSE=auto])
+AC_ARG_ENABLE(kdrive-evdev,   AS_HELP_STRING([--enable-kdrive-evdev], [Build evdev driver for kdrive (default: auto)]), [KDRIVE_EVDEV=$enableval], [KDRIVE_EVDEV=auto])
+AC_ARG_ENABLE(libunwind,      AS_HELP_STRING([--enable-libunwind], [Use libunwind for backtracing (default: auto)]), [LIBUNWIND="$enableval"], [LIBUNWIND="auto"])
 
 
 dnl chown/chmod to be setuid root as part of build
 dnl Replaces InstallXserverSetUID in imake
-AC_ARG_ENABLE(install-setuid, 
+AC_ARG_ENABLE(install-setuid,
     AS_HELP_STRING([--enable-install-setuid],
        [Install Xorg server as owned by root with setuid bit (default: auto)]),
     [SETUID=$enableval], [SETUID=auto])
@@ -710,12 +733,12 @@ dnl DDX Detection... Yes, it's ugly to have it here... but we need to
 dnl handle this early on so that we don't require unsupported extensions
 case $host_os in
        cygwin* | mingw*)
-               CONFIG_DBUS_API=no
                CONFIG_HAL=no
                CONFIG_UDEV=no
                CONFIG_UDEV_KMS=no
                DGA=no
                DRI2=no
+               DRI3=no
                INT10MODULE=no
                PCI=no
                VGAHW=no
@@ -733,6 +756,7 @@ case $host_os in
                VBE=no
                DRM=no
                DRI2=no
+               DRI3=no
 
                if test x$XQUARTZ = xauto; then
                        AC_CACHE_CHECK([whether to build Xquartz],xorg_cv_Carbon_framework,[
@@ -742,7 +766,7 @@ case $host_os in
                                               [xorg_cv_Carbon_framework=yes],
                                               [xorg_cv_Carbon_framework=no])
                                LDFLAGS=$save_LDFLAGS])
-                
+
                        if test "X$xorg_cv_Carbon_framework" = Xyes; then
                                XQUARTZ=yes
                        else
@@ -758,6 +782,7 @@ case $host_os in
                        XQUARTZ=yes
                        XVFB=no
                        XNEST=no
+                       XWAYLAND=no
 
                        COMPOSITE=no
                        DGA=no
@@ -774,44 +799,54 @@ dnl ---------------------------------------------------------------------------
 XEXT_INC='-I$(top_srcdir)/Xext'
 XEXT_LIB='$(top_builddir)/Xext/libXext.la'
 
+dnl Tizen gesture Optional modules
+GESTUREPROTO="gestureproto >= 0.1.0"
+dnl Tizen hwc Optional modules
+HWCPROTO="hwcproto >= 0.1.0"
+dnl Tizen hwa Optional modules
+HWAPROTO="hwaproto >= 0.1.0"
+
 dnl Optional modules
 VIDEOPROTO="videoproto"
 COMPOSITEPROTO="compositeproto >= 0.4"
-GESTUREPROTO="gestureproto >= 0.1.0"
-HWCPROTO="hwcproto >= 0.1.0"
 RECORDPROTO="recordproto >= 1.13.99.1"
 SCRNSAVERPROTO="scrnsaverproto >= 1.1"
 RESOURCEPROTO="resourceproto >= 1.2.0"
 DRIPROTO="xf86driproto >= 2.1.0"
 DRI2PROTO="dri2proto >= 2.8"
+DRI3PROTO="dri3proto >= 1.0"
 XINERAMAPROTO="xineramaproto"
 BIGFONTPROTO="xf86bigfontproto >= 1.2.0"
 DGAPROTO="xf86dgaproto >= 2.0.99.1"
-GLPROTO="glproto >= 1.4.16"
+GLPROTO="glproto >= 1.4.17"
 DMXPROTO="dmxproto >= 2.2.99.1"
 VIDMODEPROTO="xf86vidmodeproto >= 2.2.99.1"
 WINDOWSWMPROTO="windowswmproto"
 APPLEWMPROTO="applewmproto >= 1.4"
+XSHMFENCE="xshmfence >= 1.1"
 
 dnl Required modules
-XPROTO="xproto >= 7.0.22"
+XPROTO="xproto >= 7.0.26"
 RANDRPROTO="randrproto >= 1.4.0"
 RENDERPROTO="renderproto >= 0.11"
-XEXTPROTO="xextproto >= 7.1.99"
-INPUTPROTO="inputproto >= 2.1.99.6"
+XEXTPROTO="xextproto >= 7.2.99.901"
+INPUTPROTO="inputproto >= 2.3"
 KBPROTO="kbproto >= 1.0.3"
-FONTSPROTO="fontsproto"
+FONTSPROTO="fontsproto >= 2.1.3"
 FIXESPROTO="fixesproto >= 5.0"
 DAMAGEPROTO="damageproto >= 1.1"
 XCMISCPROTO="xcmiscproto >= 1.2.0"
 BIGREQSPROTO="bigreqsproto >= 1.1.0"
-XTRANS="xtrans >= 1.2.2"
+XTRANS="xtrans >= 1.3.3"
+PRESENTPROTO="presentproto >= 1.0"
 
 dnl List of libraries that require a specific version
 LIBAPPLEWM="applewm >= 1.4"
 LIBDMX="dmx >= 1.0.99.1"
 LIBDRI="dri >= 7.8.0"
 LIBDRM="libdrm >= 2.3.0"
+LIBEGL="egl"
+LIBGBM="gbm >= 10.2.0"
 LIBGL="gl >= 7.1.0"
 LIBXEXT="xext >= 1.0.99.4"
 LIBXFONT="xfont >= 1.4.2"
@@ -821,7 +856,7 @@ LIBPCIACCESS="pciaccess >= 0.12.901"
 LIBUDEV="libudev >= 143"
 LIBSELINUX="libselinux >= 2.0.86"
 LIBDBUS="dbus-1 >= 1.0"
-LIBPIXMAN="pixman-1 >= 0.21.8"
+LIBPIXMAN="pixman-1 >= 0.27.2"
 
 dnl Pixman is always required, but we separate it out so we can link
 dnl specific modules against it
@@ -841,23 +876,22 @@ AC_ARG_WITH([systemd-daemon],
        AS_HELP_STRING([--with-systemd-daemon],
                [support systemd socket activation (default: auto)]),
        [WITH_SYSTEMD_DAEMON=$withval], [WITH_SYSTEMD_DAEMON=auto])
-PKG_CHECK_MODULES([SYSTEMD_DAEMON], [libsystemd-daemon], [HAVE_SYSTEMD_DAEMON=yes],
-               [HAVE_SYSTEMD_DAEMON=no])
+PKG_CHECK_MODULES([SYSTEMD_DAEMON], [libsystemd-daemon],
+                  [HAVE_SYSTEMD_DAEMON=yes], [HAVE_SYSTEMD_DAEMON=no])
 if test "x$WITH_SYSTEMD_DAEMON" = xauto; then
        WITH_SYSTEMD_DAEMON="$HAVE_SYSTEMD_DAEMON"
 fi
 if test "x$WITH_SYSTEMD_DAEMON" = xyes; then
-       if "x$HAVE_SYSTEMD_DAEMON" = xno; then
+       if test "x$HAVE_SYSTEMD_DAEMON" = xno; then
                AC_MSG_ERROR([systemd support requested but no library has been found])
        fi
-       AC_DEFINE(HAVE_SYSTEMD_DAEMON, 1, [Define if libsystemd-daemon is available])
+       AC_DEFINE(HAVE_SYSTEMD_DAEMON, 1, [Define to 1 if libsystemd-daemon is available])
        REQUIRED_LIBS="$REQUIRED_LIBS libsystemd-daemon"
 fi
 AM_CONDITIONAL([HAVE_SYSTEMD_DAEMON], [test "x$HAVE_SYSTEMD_DAEMON" = "xyes"])
 
-if test "x$CONFIG_UDEV" = xyes &&
- { test "x$CONFIG_DBUS_API" = xyes || test "x$CONFIG_HAL" = xyes; }; then
-       AC_MSG_ERROR([Hotplugging through both libudev and dbus/hal not allowed])
+if test "x$CONFIG_UDEV" = xyes && test "x$CONFIG_HAL" = xyes; then
+       AC_MSG_ERROR([Hotplugging through both libudev and hal not allowed])
 fi
 
 PKG_CHECK_MODULES(UDEV, $LIBUDEV, [HAVE_LIBUDEV=yes], [HAVE_LIBUDEV=no])
@@ -866,7 +900,6 @@ if test "x$CONFIG_UDEV" = xauto; then
 fi
 AM_CONDITIONAL(CONFIG_UDEV, [test "x$CONFIG_UDEV" = xyes])
 if test "x$CONFIG_UDEV" = xyes; then
-       CONFIG_DBUS_API=no
        CONFIG_HAL=no
        if test "x$CONFIG_UDEV_KMS" = xauto; then
                CONFIG_UDEV_KMS="$HAVE_LIBUDEV"
@@ -889,28 +922,12 @@ if test "x$CONFIG_UDEV" = xyes; then
 fi
 AM_CONDITIONAL(CONFIG_UDEV_KMS, [test "x$CONFIG_UDEV_KMS" = xyes])
 
-dnl HAVE_DBUS is true if we actually have the D-Bus library, whereas
-dnl CONFIG_DBUS_API is true if we want to enable the D-Bus config
-dnl API.
 PKG_CHECK_MODULES(DBUS, $LIBDBUS, [HAVE_DBUS=yes], [HAVE_DBUS=no])
 if test "x$HAVE_DBUS" = xyes; then
        AC_DEFINE(HAVE_DBUS, 1, [Have D-Bus support])
 fi
 AM_CONDITIONAL(HAVE_DBUS, [test "x$HAVE_DBUS" = xyes])
 
-if test "x$CONFIG_DBUS_API" = xauto; then
-       CONFIG_DBUS_API="$HAVE_DBUS"
-fi
-if test "x$CONFIG_DBUS_API" = xyes; then
-       if ! test "x$HAVE_DBUS" = xyes; then
-               AC_MSG_ERROR([D-Bus configuration API requested, but D-Bus is not installed.])
-       fi
-
-       AC_DEFINE(CONFIG_DBUS_API, 1, [Use the D-Bus input configuration API])
-       CONFIG_NEED_DBUS="yes"
-fi
-AM_CONDITIONAL(CONFIG_DBUS_API, [test "x$CONFIG_DBUS_API" = xyes])
-
 PKG_CHECK_MODULES(HAL, hal, [HAVE_HAL=yes], [HAVE_HAL=no])
 if test "x$CONFIG_HAL" = xauto; then
        CONFIG_HAL="$HAVE_HAL"
@@ -921,14 +938,44 @@ if test "x$CONFIG_HAL" = xyes; then
        fi
 
        AC_DEFINE(CONFIG_HAL, 1, [Use the HAL hotplug API])
-       CONFIG_NEED_DBUS="yes"
+       NEED_DBUS="yes"
 fi
 AM_CONDITIONAL(CONFIG_HAL, [test "x$CONFIG_HAL" = xyes])
 
-if test "x$CONFIG_NEED_DBUS" = xyes; then
-        AC_DEFINE(CONFIG_NEED_DBUS, 1, [Use D-Bus for input hotplug])
+if test "x$SYSTEMD_LOGIND" = xauto; then
+        if test "x$HAVE_DBUS" = xyes -a "x$CONFIG_UDEV" = xyes ; then
+                SYSTEMD_LOGIND=yes
+        else
+                SYSTEMD_LOGIND=no
+        fi
+fi
+if test "x$SYSTEMD_LOGIND" = xyes; then
+        if ! test "x$HAVE_DBUS" = xyes; then
+                AC_MSG_ERROR([systemd-logind requested, but D-Bus is not installed.])
+        fi
+        if ! test "x$CONFIG_UDEV" = xyes ; then
+                AC_MSG_ERROR([systemd-logind is only supported in combination with udev configuration.])
+        fi
+
+        AC_DEFINE(SYSTEMD_LOGIND, 1, [Enable systemd-logind integration])
+        NEED_DBUS="yes"
+fi
+AM_CONDITIONAL(SYSTEMD_LOGIND, [test "x$SYSTEMD_LOGIND" = xyes])
+
+if test "x$SUID_WRAPPER" = xyes; then
+        dnl The wrapper uses libdrm headers, so ensure they are available
+        PKG_CHECK_MODULES([LIBDRM], $LIBDRM)
+        dnl This is a define so that if some platforms want to put the wrapper
+        dnl somewhere else this can be easily changed
+        AC_DEFINE_DIR(SUID_WRAPPER_DIR, libexecdir, [Where to install Xorg.bin and Xorg.wrap])
+        SETUID="no"
+fi
+AM_CONDITIONAL(SUID_WRAPPER, [test "x$SUID_WRAPPER" = xyes])
+
+if test "x$NEED_DBUS" = xyes; then
+        AC_DEFINE(NEED_DBUS, 1, [Enable D-Bus core])
 fi
-AM_CONDITIONAL(CONFIG_NEED_DBUS, [test "x$CONFIG_NEED_DBUS" = xyes])
+AM_CONDITIONAL(NEED_DBUS, [test "x$NEED_DBUS" = xyes])
 
 if test "x$CONFIG_WSCONS" = xauto; then
        case $host_os in
@@ -1030,6 +1077,7 @@ if test "x$XREGISTRY" = xyes; then
        AC_DEFINE(XREGISTRY, 1, [Build registry module])
 fi
 
+dnl Tizen gesture extension
 AM_CONDITIONAL(GESTURE, [test "x$GESTURE" = xyes])
 if test "x$GESTURE" = xyes; then
        AC_DEFINE(GESTURE, 1, [Support Gesture Extension])
@@ -1039,6 +1087,7 @@ if test "x$GESTURE" = xyes; then
        GESTURE_INC='-I$(top_srcdir)/gesture'
 fi
 
+dnl Tizen hwc extension
 AM_CONDITIONAL(HWC, [test "x$HWC" = xyes])
 if test "x$HWC" = xyes; then
        AC_DEFINE(HWC, 1, [Support HWC Extension])
@@ -1048,6 +1097,31 @@ if test "x$HWC" = xyes; then
        HWC_INC='-I$(top_srcdir)/hwc'
 fi
 
+dnl Tizen hwa extension
+AM_CONDITIONAL(HWA, [test "x$HWA" = xyes])
+if test "x$HWA" = xyes; then
+       AC_DEFINE(HWA, 1, [Support HWA Extension])
+       REQUIRED_MODULES="$REQUIRED_MODULES $HWAPROTO"
+       SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES $HWAPROTO"
+       HWA_LIB='$(top_builddir)/hwa/libhwa.la'
+       HWA_INC='-I$(top_srcdir)/hwa'
+fi
+
+dnl Tizen Container extension
+AM_CONDITIONAL(CONTAINER, [test "x$CONTAINER" = xyes])
+if test "x$CONTAINER" = xyes; then
+       if test "x$XACE" != xyes; then
+               AC_MSG_ERROR([cannot build Container extension without X-ACE])
+       fi
+       AC_DEFINE(CONTAINER, 1, [Support Container Extension])
+       REQUIRED_MODULES="$REQUIRED_MODULES vasum "
+       REQUIRED_LIBS="$REQUIRED_LIBS vasum "
+       CONTAINER_LIB='$(top_builddir)/container/libcontainer.la'
+       CONTAINER_INC='-I$(top_srcdir)/container'
+fi
+
+
+
 AM_CONDITIONAL(COMPOSITE, [test "x$COMPOSITE" = xyes])
 if test "x$COMPOSITE" = xyes; then
        AC_DEFINE(COMPOSITE, 1, [Support Composite Extension])
@@ -1076,12 +1150,14 @@ AM_CONDITIONAL(SCREENSAVER, [test "x$SCREENSAVER" = xyes])
 if test "x$SCREENSAVER" = xyes; then
        AC_DEFINE(SCREENSAVER, 1, [Support MIT-SCREEN-SAVER extension])
        REQUIRED_MODULES="$REQUIRED_MODULES $SCRNSAVERPROTO"
+       SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES $SCRNSAVERPROTO"
 fi
 
 AM_CONDITIONAL(RES, [test "x$RES" = xyes])
 if test "x$RES" = xyes; then
        AC_DEFINE(RES, 1, [Support X resource extension])
        REQUIRED_MODULES="$REQUIRED_MODULES $RESOURCEPROTO"
+       SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES $RESOURCEPROTO"
 fi
 
 # The XRes extension may support client ID tracking only if it has
@@ -1103,34 +1179,7 @@ fi
 AC_MSG_RESULT([$CLIENTIDS])
 AM_CONDITIONAL(CLIENTIDS, [test "x$CLIENTIDS" = xyes])
 
-if test "x$GLX" = xyes; then
-       PKG_CHECK_MODULES([XLIB], [x11])
-       PKG_CHECK_MODULES([GL], $GLPROTO $LIBGL)
-       AC_SUBST(XLIB_CFLAGS)
-       AC_DEFINE(GLXEXT, 1, [Build GLX extension])
-       GLX_LIBS='$(top_builddir)/glx/libglx.la'
-       GLX_SYS_LIBS="$GLX_SYS_LIBS"
-else
-        GLX=no
-fi
-AM_CONDITIONAL(GLX, test "x$GLX" = xyes)
-
-if test "x$GLX" = xno; then
-        AIGLX=no
-fi
-
-if test "x$AIGLX" = xyes -a \( "x$DRI" = xyes -o "x$DRI2" = xyes \); then
-       AC_DEFINE(AIGLX, 1, [Build AIGLX loader])
-fi
-AM_CONDITIONAL(AIGLX_DRI_LOADER, { test "x$DRI" = xyes || test "x$DRI2" = xyes; } && test "x$AIGLX" = xyes)
-
-if test "x$GLX_USE_TLS" = xyes ; then
-       GLX_DEFINES="-DGLX_USE_TLS -DPTHREADS"
-       GLX_SYS_LIBS="$GLX_SYS_LIBS -lpthread"
-fi
-AC_SUBST([GLX_DEFINES])
-AC_SUBST([GLX_SYS_LIBS])
-
+dnl Tizen IR feature
 #AM_CONDITIONAL(IR, test "x$IR" = xyes)
 if test "x$IR" = xyes; then
        IR_CFLAGS="-D_F_INPUT_REDIRECTION_"
@@ -1153,12 +1202,168 @@ case "$DRI2,$HAVE_DRI2PROTO" in
        yes,yes | auto,yes)
                AC_DEFINE(DRI2, 1, [Build DRI2 extension])
                DRI2=yes
+               LIBGL="gl >= 9.2.0"
                SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES $DRI2PROTO"
                ;;
 esac
 AM_CONDITIONAL(DRI2, test "x$DRI2" = xyes)
 
-if test "x$DRI" = xyes || test "x$DRI2" = xyes || test "x$CONFIG_UDEV_KMS" = xyes; then
+dnl
+dnl Locate a suitable tmp file system for creating shared memeory files
+dnl
+
+AC_ARG_WITH(shared-memory-dir, AS_HELP_STRING([--with-shared-memory-dir=PATH], [Path to directory in a world-writable temporary directory for anonymous shared memory (default: auto)]),
+[],
+[with_shared_memory_dir=yes])
+
+shmdirs="/run/shm /var/tmp /tmp"
+
+case x"$with_shared_memory_dir" in
+xyes)
+       for dir in $shmdirs; do
+               case x"$with_shared_memory_dir" in
+               xyes)
+                       echo Checking temp dir "$dir"
+                       if test -d "$dir"; then
+                               with_shared_memory_dir="$dir"
+                       fi
+                       ;;
+               esac
+       done
+       ;;
+x/*)
+       ;;
+xno)
+       ;;
+*)
+       AC_MSG_ERROR([Invalid directory specified for --with-shared-memory-dir: $with_shared_memory_dir])
+       ;;
+esac
+
+case x"$with_shared_memory_dir" in
+xyes)
+       AC_MSG_ERROR([No directory found for shared memory temp files.])
+       ;;
+xno)
+       ;;
+*)
+       AC_DEFINE_UNQUOTED(SHMDIR, ["$with_shared_memory_dir"], [Directory for shared memory temp files])
+       ;;
+esac
+
+AC_ARG_ENABLE(xtrans-send-fds, AS_HELP_STRING([--disable-xtrans-send-fds], [Use Xtrans support for fd passing (default: auto)]), [XTRANS_SEND_FDS=$enableval], [XTRANS_SEND_FDS=auto])
+
+case "x$XTRANS_SEND_FDS" in
+xauto)
+       case "$host_os" in
+       linux*|solaris*)
+               XTRANS_SEND_FDS=yes
+               ;;
+       *)
+               XTRANS_SEND_FDS=no
+               ;;
+       esac
+esac
+
+case "x$XTRANS_SEND_FDS" in
+xyes)
+       AC_DEFINE(XTRANS_SEND_FDS, 1, [Enable xtrans fd passing support])
+       ;;
+esac
+
+case "$DRI3,$XTRANS_SEND_FDS" in
+       yes,yes | auto,yes)
+               ;;
+       yes,no)
+               AC_MSG_ERROR([DRI3 requested, but xtrans fd passing support not found.])
+               DRI3=no
+               ;;
+       no,*)
+               ;;
+       *)
+               AC_MSG_NOTICE([DRI3 disabled because xtrans fd passing support not found.])
+               DRI3=no
+               ;;
+esac
+
+PKG_CHECK_MODULES([DRI3PROTO], $DRI3PROTO,
+                  [HAVE_DRI3PROTO=yes], [HAVE_DRI3PROTO=no])
+
+case "$DRI3,$HAVE_DRI3PROTO" in
+       yes,yes | auto,yes)
+               ;;
+       yes,no)
+               AC_MSG_ERROR([DRI3 requested, but dri3proto not found.])
+               DRI3=no
+               ;;
+       no,*)
+               ;;
+       *)
+               AC_MSG_NOTICE([DRI3 disabled because dri3proto not found.])
+               DRI3=no
+               ;;
+esac
+
+AC_CHECK_FUNCS([sigaction])
+
+BUSFAULT=no
+
+case x"$ac_cv_func_sigaction" in
+       xyes)
+               AC_DEFINE(HAVE_SIGACTION, 1, [Have sigaction function])
+               BUSFAULT=yes
+               ;;
+esac
+
+case x"$BUSFAULT" in
+       xyes)
+               AC_DEFINE(BUSFAULT, 1, [Include busfault OS API])
+               ;;
+esac
+
+AM_CONDITIONAL(BUSFAULT, test x"$BUSFAULT" = xyes)
+
+PKG_CHECK_MODULES([XSHMFENCE], $XSHMFENCE,
+                 [HAVE_XSHMFENCE=yes], [HAVE_XSHMFENCE=no])
+
+AM_CONDITIONAL(XSHMFENCE, test "x$HAVE_XSHMFENCE" = xyes)
+
+case x"$HAVE_XSHMFENCE" in
+       xyes)
+               AC_DEFINE(HAVE_XSHMFENCE, 1, [Have X Shared Memory Fence library])
+               REQUIRED_LIBS="$REQUIRED_LIBS xshmfence"
+               ;;
+esac
+
+
+case "$DRI3,$HAVE_XSHMFENCE" in
+       yes,yes | auto,yes)
+               ;;
+       yes,no)
+               AC_MSG_ERROR([DRI3 requested, but xshmfence not found.])
+               DRI3=no
+               ;;
+       no,*)
+               ;;
+       *)
+               AC_MSG_NOTICE([DRI3 disabled because xshmfence not found.])
+               DRI3=no
+               ;;
+esac
+
+case x"$DRI3" in
+       xyes|xauto)
+               DRI3=yes
+               AC_DEFINE(DRI3, 1, [Build DRI3 extension])
+               DRI3_LIB='$(top_builddir)/dri3/libdri3.la'
+               SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES $DRI3PROTO"
+               AC_MSG_NOTICE([DRI3 enabled]);
+               ;;
+esac
+
+AM_CONDITIONAL(DRI3, test "x$DRI3" = xyes)
+
+if test "x$DRI" = xyes || test "x$DRI2" = xyes || test "x$DRI3" = xyes || test "x$CONFIG_UDEV_KMS" = xyes; then
        if test "x$DRM" = xyes; then
                AC_DEFINE(WITH_LIBDRM, 1, [Building with libdrm support])
                PKG_CHECK_MODULES([LIBDRM], $LIBDRM)
@@ -1186,6 +1391,42 @@ if test "x$DRI2" = xyes; then
 fi
 AM_CONDITIONAL(DRI2_AIGLX, test "x$DRI2_AIGLX" = xyes)
 
+if test "x$GLX" = xyes; then
+       PKG_CHECK_MODULES([XLIB], [x11])
+       PKG_CHECK_MODULES([GL], $GLPROTO $LIBGL)
+       AC_SUBST(XLIB_CFLAGS)
+       AC_DEFINE(GLXEXT, 1, [Build GLX extension])
+       GLX_LIBS='$(top_builddir)/glx/libglx.la'
+       GLX_SYS_LIBS="$GLX_SYS_LIBS $GL_LIBS"
+else
+        GLX=no
+fi
+AM_CONDITIONAL(GLX, test "x$GLX" = xyes)
+
+if test "x$GLX" = xno; then
+        AIGLX=no
+fi
+
+if test "x$AIGLX" = xyes -a \( "x$DRI2" = xyes \); then
+       AC_DEFINE(AIGLX, 1, [Build AIGLX loader])
+fi
+AM_CONDITIONAL(AIGLX_DRI_LOADER, { test "x$DRI2" = xyes; } && test "x$AIGLX" = xyes)
+
+if test "x$GLX_USE_TLS" = xyes ; then
+       GLX_DEFINES="-DGLX_USE_TLS -DPTHREADS"
+       GLX_SYS_LIBS="$GLX_SYS_LIBS -lpthread"
+fi
+AC_SUBST([GLX_DEFINES])
+AC_SUBST([GLX_SYS_LIBS])
+
+AM_CONDITIONAL(PRESENT, [test "x$PRESENT" = xyes])
+if test "x$PRESENT" = xyes; then
+       AC_DEFINE(PRESENT, 1, [Support Present extension])
+       REQUIRED_MODULES="$REQUIRED_MODULES $PRESENTPROTO"
+       SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES $PRESENTPROTO"
+       PRESENT_INC='-I$(top_srcdir)/present'
+       PRESENT_LIB='$(top_builddir)/present/libpresent.la'
+fi
 
 AM_CONDITIONAL(XINERAMA, [test "x$XINERAMA" = xyes])
 if test "x$XINERAMA" = xyes; then
@@ -1212,6 +1453,7 @@ if test "x$XSELINUX" = xyes; then
        AC_DEFINE(XSELINUX, 1, [Build SELinux extension])
 fi
 
+dnl Tizen Xsmack extension (from opensource patch)
 AM_CONDITIONAL(XSMACK, [test "x$XSMACK" = xyes])
 if test "x$XSMACK" = xyes; then
        if test "x$XACE" != xyes; then
@@ -1221,6 +1463,16 @@ if test "x$XSMACK" = xyes; then
        AC_DEFINE(XSMACK, 1, [Build Smack extension])
 fi
 
+dnl Tizen Smack Utility
+AM_CONDITIONAL(SMACK_UTIL, [test "x$SMACK_UTIL" = xyes])
+if test "x$SMACK_UTIL" = xyes; then
+       if test "x$XACE" != xyes; then
+               AC_MSG_ERROR([cannot build Smack Util without X-ACE])
+       fi
+       SMACK_UTIL_LIBS="$SMACK_UTIL_LIBS -lsmack_util"
+       AC_DEFINE(SMACK_UTIL, 1, [Build Smack Util])
+fi
+
 AM_CONDITIONAL(XCSECURITY, [test "x$XCSECURITY" = xyes])
 if test "x$XCSECURITY" = xyes; then
        if test "x$XACE" != xyes; then
@@ -1240,6 +1492,7 @@ AM_CONDITIONAL(XF86BIGFONT, [test "x$XF86BIGFONT" = xyes])
 if test "x$XF86BIGFONT" = xyes; then
        AC_DEFINE(XF86BIGFONT, 1, [Support XF86 Big font extension])
        REQUIRED_MODULES="$REQUIRED_MODULES $BIGFONTPROTO"
+       SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES $BIGFONTPROTO"
 fi
 
 AM_CONDITIONAL(DPMSExtension, [test "x$DPMSExtension" = xyes])
@@ -1279,7 +1532,7 @@ AC_DEFINE(SHAPE, 1, [Support SHAPE extension])
 
 AC_DEFINE_DIR(XKB_BASE_DIRECTORY, XKBPATH, [Path to XKB data])
 AC_ARG_WITH(xkb-bin-directory,
-                               AS_HELP_STRING([--with-xkb-bin-directory=DIR], [Directory containing xkbcomp program]),
+                               AS_HELP_STRING([--with-xkb-bin-directory=DIR], [Directory containing xkbcomp program (default: ${bindir})]),
                                [XKB_BIN_DIRECTORY="$withval"],
                                [XKB_BIN_DIRECTORY="$bindir"])
 
@@ -1291,6 +1544,7 @@ if [[ x$XKBOUTPUT_FIRSTCHAR != x/ -a x$XKBOUTPUT_FIRSTCHAR != 'x$' ]] ; then
    XKBOUTPUT="$XKB_BASE_DIRECTORY/$XKBOUTPUT"
 fi
 
+dnl Tizen xkbcache feature ( from opensource patch )
 echo "XKBCACHE is $XKBCACHE"
 if test "x$XKBCACHE" = xyes; then
        AC_DEFINE(XKM_CACHE_FILES, 1, [Cache xkbcomp output files])
@@ -1326,6 +1580,24 @@ AC_SUBST([XKB_DFLT_LAYOUT])
 AC_SUBST([XKB_DFLT_VARIANT])
 AC_SUBST([XKB_DFLT_OPTIONS])
 
+dnl Tizen dlog
+if test "x$XDLOG" = xyes; then
+    PKG_CHECK_MODULES(DLOG, [dlog], [HAVE_DLOG=yes], [HAVE_DLOG=no])
+    if test x"$HAVE_DLOG" = xyes; then
+        AC_DEFINE(ENABLE_DLOG, 1, [use dlog])
+           AC_SUBST([ENABLE_DLOG])
+           REQUIRED_LIBS="$REQUIRED_LIBS dlog"
+    fi
+fi
+
+d
+# ttrace support
+PKG_CHECK_MODULES(TTRACE, [ttrace],    [HAVE_TTRACE=yes], [HAVE_TTRACE=no])
+if test "x$HAVE_TTRACE" = xyes; then
+    AC_DEFINE(ENABLE_TTRACE, 1, [ttrace available])
+       AC_SUBST([ENABLE_TTRACE])
+fi
+
 XKB_LIB='$(top_builddir)/xkb/libxkb.la'
 XKB_STUB_LIB='$(top_builddir)/xkb/libxkbstubs.la'
 REQUIRED_MODULES="$REQUIRED_MODULES xkbfile"
@@ -1404,7 +1676,7 @@ AC_DEFINE(BIGREQS, 1, [Support BigRequests extension])
 
 if test "x$SPECIAL_DTRACE_OBJECTS" = "xyes" ; then
   DIX_LIB='$(top_builddir)/dix/dix.O'
-  OS_LIB='$(top_builddir)/os/os.O $(SHA1_LIBS) $(DLOPEN_LIBS)'
+  OS_LIB='$(top_builddir)/os/os.O $(SHA1_LIBS) $(DLOPEN_LIBS) $(LIBUNWIND_LIBS)'
 else
   DIX_LIB='$(top_builddir)/dix/libdix.la'
   OS_LIB='$(top_builddir)/os/libos.la'
@@ -1428,7 +1700,7 @@ CORE_INCS='-I$(top_srcdir)/include -I$(top_builddir)/include'
 
 # SHA1 hashing
 AC_ARG_WITH([sha1],
-            [AS_HELP_STRING([--with-sha1=libc|libmd|libgcrypt|libcrypto|libsha1|CommonCrypto|CryptoAPI],
+            [AS_HELP_STRING([--with-sha1=libc|libmd|libnettle|libgcrypt|libcrypto|libsha1|CommonCrypto|CryptoAPI],
                             [choose SHA1 implementation])])
 AC_CHECK_FUNC([SHA1Init], [HAVE_SHA1_IN_LIBC=yes])
 if test "x$with_sha1" = x && test "x$HAVE_SHA1_IN_LIBC" = xyes; then
@@ -1491,6 +1763,18 @@ if test "x$with_sha1" = xlibsha1; then
                  [Use libsha1 for SHA1])
        SHA1_LIBS=-lsha1
 fi
+AC_CHECK_LIB([nettle], [nettle_sha1_init], [HAVE_LIBNETTLE=yes])
+if test "x$with_sha1" = x && test "x$HAVE_LIBNETTLE" = xyes; then
+       with_sha1=libnettle
+fi
+if test "x$with_sha1" = xlibnettle && test "x$HAVE_LIBNETTLE" != xyes; then
+       AC_MSG_ERROR([libnettle requested but not found])
+fi
+if test "x$with_sha1" = xlibnettle; then
+       AC_DEFINE([HAVE_SHA1_IN_LIBNETTLE], [1],
+                 [Use libnettle SHA1 functions])
+       SHA1_LIBS=-lnettle
+fi
 AC_CHECK_LIB([gcrypt], [gcry_md_open], [HAVE_LIBGCRYPT=yes])
 if test "x$with_sha1" = x && test "x$HAVE_LIBGCRYPT" = xyes; then
        with_sha1=libgcrypt
@@ -1535,6 +1819,20 @@ AC_SUBST(SHA1_CFLAGS)
 PKG_CHECK_MODULES([XSERVERCFLAGS], [$REQUIRED_MODULES $REQUIRED_LIBS])
 PKG_CHECK_MODULES([XSERVERLIBS], [$REQUIRED_LIBS])
 
+PKG_CHECK_MODULES(LIBUNWIND, libunwind, [HAVE_LIBUNWIND=yes], [HAVE_LIBUNWIND=no])
+if test "x$LIBUNWIND" = "xauto"; then
+    LIBUNWIND="$HAVE_LIBUNWIND"
+fi
+
+if test "x$LIBUNWIND" = "xyes"; then
+    if test "x$HAVE_LIBUNWIND" != "xyes"; then
+        AC_MSG_ERROR([libunwind requested but not installed.])
+    fi
+    AC_DEFINE(HAVE_LIBUNWIND, 1, [Have libunwind support])
+fi
+
+AM_CONDITIONAL(HAVE_LIBUNWIND, [test "x$LIBUNWIND" = xyes])
+
 # Autotools has some unfortunate issues with library handling.  In order to
 # get a server to rebuild when a dependency in the tree is changed, it must
 # be listed in SERVERNAME_DEPENDENCIES.  However, no system libraries may be
@@ -1610,7 +1908,10 @@ AC_EGREP_CPP([I_AM_SVR4],[
 AC_DEFINE([SVR4],1,[Define to 1 on systems derived from System V Release 4])
 AC_MSG_RESULT([yes])], AC_MSG_RESULT([no]))
 
-XSERVER_CFLAGS="$XSERVER_CFLAGS $CORE_INCS $XEXT_INC $GESTURE_INC $HWC_INC $COMPOSITE_INC $DAMAGE_INC $FIXES_INC $XI_INC $MI_INC $MIEXT_SYNC_INC $MIEXT_SHADOW_INC $MIEXT_LAYER_INC $MIEXT_DAMAGE_INC $RENDER_INC $RANDR_INC $FB_INC $DBE_INC"
+XSERVER_CFLAGS="$XSERVER_CFLAGS $CORE_INCS $XEXT_INC $COMPOSITE_INC $DAMAGE_INC $FIXES_INC $XI_INC $MI_INC $MIEXT_SYNC_INC $MIEXT_SHADOW_INC $MIEXT_LAYER_INC $MIEXT_DAMAGE_INC $RENDER_INC $RANDR_INC $FB_INC $DBE_INC $PRESENT_INC"
+
+dnl Tizen extensions CFLAGS
+XSERVER_CFLAGS="$XSERVER_CFLAGS $GESTURE_INC $HWC_INC $HWA_INC $CONTAINER_INC "
 
 dnl ---------------------------------------------------------------------------
 dnl DDX section.
@@ -1623,7 +1924,7 @@ AC_MSG_RESULT([$XVFB])
 AM_CONDITIONAL(XVFB, [test "x$XVFB" = xyes])
 
 if test "x$XVFB" = xyes; then
-       XVFB_LIBS="$FB_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $RECORD_LIB $GLX_LIBS $RANDR_LIB $RENDER_LIB $DAMAGE_LIB $MIEXT_SYNC_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB"
+       XVFB_LIBS="$FB_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $RECORD_LIB $GLX_LIBS $RANDR_LIB $RENDER_LIB $DAMAGE_LIB $DRI3_LIB $PRESENT_LIB $MIEXT_SYNC_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB"
        XVFB_SYS_LIBS="$XVFBMODULES_LIBS $GLX_SYS_LIBS"
        AC_SUBST([XVFB_LIBS])
        AC_SUBST([XVFB_SYS_LIBS])
@@ -1644,7 +1945,7 @@ if test "x$XNEST" = xyes; then
        if test "x$have_xnest" = xno; then
                AC_MSG_ERROR([Xnest build explicitly requested, but required modules not found.])
        fi
-       XNEST_LIBS="$FB_LIB $FIXES_LIB $MI_LIB $XEXT_LIB $DBE_LIB $RECORD_LIB $GLX_LIBS $RANDR_LIB $RENDER_LIB $DAMAGE_LIB $MIEXT_SYNC_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $MAIN_LIB $DIX_LIB $OS_LIB"
+       XNEST_LIBS="$FB_LIB $FIXES_LIB $MI_LIB $XEXT_LIB $DBE_LIB $RECORD_LIB $GLX_LIBS $RANDR_LIB $RENDER_LIB $DAMAGE_LIB  $DRI3_LIB $PRESENT_LIB $MIEXT_SYNC_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $MAIN_LIB $DIX_LIB $OS_LIB"
        XNEST_SYS_LIBS="$XNESTMODULES_LIBS $GLX_SYS_LIBS"
        AC_SUBST([XNEST_LIBS])
        AC_SUBST([XNEST_SYS_LIBS])
@@ -1669,7 +1970,10 @@ if test "x$XORG" = xyes; then
        XORG_OSINCS='-I$(top_srcdir)/hw/xfree86/os-support -I$(top_srcdir)/hw/xfree86/os-support/bus -I$(top_srcdir)/os'
        XORG_INCS="$XORG_DDXINCS $XORG_OSINCS"
        XORG_CFLAGS="$XORGSERVER_CFLAGS -DHAVE_XORG_CONFIG_H"
-       XORG_LIBS="$GESTURE_LIB $HWC_LIB $COMPOSITE_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $RECORD_LIB $RANDR_LIB $RENDER_LIB $DAMAGE_LIB $MIEXT_SYNC_LIB $MIEXT_DAMAGE_LIB $XI_LIB $XKB_LIB"
+       XORG_LIBS="$COMPOSITE_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $RECORD_LIB $RANDR_LIB $RENDER_LIB $DAMAGE_LIB $DRI3_LIB $PRESENT_LIB $MIEXT_SYNC_LIB $MIEXT_DAMAGE_LIB $XI_LIB $XKB_LIB"
+
+    dnl Tizen feature libs
+    XORG_LIBS="$XORG_LIBS $GESTURE_LIB $HWC_LIB $HWA_LIB $CONTAINER_LIB "
 
        dnl ==================================================================
        dnl symbol visibility
@@ -1690,13 +1994,13 @@ if test "x$XORG" = xyes; then
                save_CFLAGS="$CFLAGS"
                proto_inc=`$PKG_CONFIG --cflags xproto`
                CFLAGS="$CFLAGS $VISIBILITY_CFLAGS $proto_inc"
-               AC_TRY_COMPILE(
+               AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
                    [#include <X11/Xfuncproto.h>
                     extern _X_HIDDEN int hidden_int;
                     extern _X_EXPORT int public_int;
                     extern _X_HIDDEN int hidden_int_func(void);
-                    extern _X_EXPORT int public_int_func(void);],
-                   [],
+                    extern _X_EXPORT int public_int_func(void);]],
+                   [])],
                    have_visibility=yes,
                    have_visibility=no)
                CFLAGS=$save_CFLAGS
@@ -1720,24 +2024,30 @@ if test "x$XORG" = xyes; then
 
        AC_MSG_CHECKING([whether to build Xorg PCI functions])
        if test "x$PCI" = xyes; then
-
-       PKG_CHECK_MODULES([PCIACCESS], $LIBPCIACCESS)
-       SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES $LIBPCIACCESS"
-       XORG_SYS_LIBS="$XORG_SYS_LIBS $PCIACCESS_LIBS $GLX_SYS_LIBS $LIBDRM_LIBS"
-       XORG_CFLAGS="$XORG_CFLAGS $PCIACCESS_CFLAGS $LIBDRM_CFLAGS"
-
-       AC_DEFINE(XSERVER_LIBPCIACCESS, 1, [Use libpciaccess for all pci manipulation])
-       AC_DEFINE_DIR(PCI_TXT_IDS_PATH, PCI_TXT_IDS_DIR, [Default PCI text file ID path])
-       case $host_os in
-         gnu* | freebsd* | kfreebsd*-gnu | netbsd* | openbsd* | solaris* | dragonfly*)
-               xorg_bus_bsdpci="yes"
-               ;;
-       esac
-       case $host_cpu in
-         sparc*)
-               xorg_bus_sparc="yes"
-               ;;
-       esac
+               PKG_CHECK_MODULES([PCIACCESS], $LIBPCIACCESS)
+               SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES $LIBPCIACCESS"
+               XORG_SYS_LIBS="$XORG_SYS_LIBS $PCIACCESS_LIBS $LIBDRM_LIBS"
+               XORG_CFLAGS="$XORG_CFLAGS $PCIACCESS_CFLAGS $LIBDRM_CFLAGS"
+
+               AC_DEFINE(XSERVER_LIBPCIACCESS, 1, [Use libpciaccess for all pci manipulation])
+               AC_DEFINE_DIR(PCI_TXT_IDS_PATH, PCI_TXT_IDS_DIR, [Default PCI text file ID path])
+               case $host_os in
+                 gnu* | freebsd* | kfreebsd*-gnu | netbsd* | openbsd* | solaris* | dragonfly*)
+                       xorg_bus_bsdpci="yes"
+                       ;;
+               esac
+               case $host_cpu in
+                 sparc*)
+                       xorg_bus_sparc="yes"
+                       ;;
+               esac
+       else
+               if test "x$CONFIG_UDEV_KMS" = xyes; then
+                       AC_MSG_ERROR([Platform device enumeration requires libpciaccess])
+               fi
+               if test "x$INT10MODULE" = xyes && test "x$INT10" != xstub; then
+                       AC_MSG_ERROR([Cannot build int10 without libpciaccess])
+               fi
        fi
        AC_MSG_RESULT([$PCI])
 
@@ -1751,9 +2061,6 @@ if test "x$XORG" = xyes; then
 
        case $host_os in
          linux*)
-               if test "x$LNXAPM" = xyes; then
-                       XORG_CFLAGS="$XORG_CFLAGS -DXF86PM"
-               fi
                XORG_OS_SUBDIR="linux"
                linux_acpi="no"
                case $host_cpu in
@@ -1761,11 +2068,16 @@ if test "x$XORG" = xyes; then
                        linux_alpha=yes
                        ;;
                  i*86|amd64*|x86_64*|ia64*)
-                       linux_acpi="yes"
+                       linux_acpi=$enable_linux_acpi
                        ;;
                  *)
                        ;;
                esac
+               dnl APM header
+               AC_CHECK_HEADERS([linux/apm_bios.h], [linux_apm=$enable_linux_apm])
+               if test "x$linux_apm" = xyes -o "x$linux_acpi" = xyes; then
+                       AC_DEFINE(XF86PM, 1, [Support APM/ACPI power management in the server])
+               fi
                ;;
          freebsd* | kfreebsd*-gnu | dragonfly*)
                XORG_OS_SUBDIR="bsd"
@@ -1796,16 +2108,13 @@ if test "x$XORG" = xyes; then
                if test "${OS_MINOR}" -lt 8 ; then
                        AC_MSG_ERROR([This release no longer supports Solaris versions older than Solaris 8.])
                fi
-               if test "x$SUNCC" = "xyes"; then
-                       solaris_asm_inline="yes"
-               fi
                AC_CHECK_DECL([_LP64], [SOLARIS_64="yes"], [SOLARIS_64="no"])
-                       
+
                case $host_cpu in
-                 sparc*)       
+                 sparc*)
                        SOLARIS_INOUT_ARCH="sparcv8plus"
                        ;;
-                 i*86) 
+                 i*86)
                        if test x$SOLARIS_64 = xyes ; then
                                SOLARIS_INOUT_ARCH="amd64"
                        else
@@ -1819,11 +2128,6 @@ if test "x$XORG" = xyes; then
                        xorg@lists.freedesktop.org.]) ;;
                esac
                AC_SUBST([SOLARIS_INOUT_ARCH])
-               if test x$solaris_asm_inline = xyes ; then
-                       SOLARIS_ASM_CFLAGS='$(top_srcdir)/hw/xfree86/os-support/solaris/solaris-$(SOLARIS_INOUT_ARCH).il'
-                       XORG_CFLAGS="${XORG_CFLAGS} "'$(SOLARIS_ASM_CFLAGS)'
-               fi
-               AC_SUBST([SOLARIS_ASM_CFLAGS])
                ;;
          gnu*)
                XORG_OS_SUBDIR="hurd"
@@ -1879,7 +2183,9 @@ if test "x$XORG" = xyes; then
        XF86CONFIGDIR="xorg.conf.d"
        AC_SUBST(XF86CONFIGDIR)
        CONFIGFILE="$sysconfdir/$XF86CONFIGFILE"
-       LOGPREFIX="$logdir/Xorg."
+       LOGPREFIX="Xorg."
+       XDG_DATA_HOME=".local/share"
+       XDG_DATA_HOME_LOGDIR="xorg"
        AC_DEFINE(XORG_SERVER, 1, [Building Xorg server])
        AC_DEFINE(XORGSERVER, 1, [Building Xorg server])
        AC_DEFINE(XFree86Server, 1, [Building XFree86 server])
@@ -1892,7 +2198,10 @@ if test "x$XORG" = xyes; then
        AC_DEFINE_DIR(__XCONFIGDIR__, XF86CONFIGDIR, [Name of configuration directory])
        AC_DEFINE_DIR(DEFAULT_MODULE_PATH, moduledir, [Default module search path])
        AC_DEFINE_DIR(DEFAULT_LIBRARY_PATH, libdir, [Default library install path])
-       AC_DEFINE_DIR(DEFAULT_LOGPREFIX, LOGPREFIX, [Default log location])
+       AC_DEFINE_DIR(DEFAULT_LOGDIR, logdir, [Default log location])
+       AC_DEFINE_DIR(DEFAULT_LOGPREFIX, LOGPREFIX, [Default logfile prefix])
+       AC_DEFINE_DIR(DEFAULT_XDG_DATA_HOME, XDG_DATA_HOME, [Default XDG_DATA dir under HOME])
+       AC_DEFINE_DIR(DEFAULT_XDG_DATA_HOME_LOGDIR, XDG_DATA_HOME_LOGDIR, [Default log dir under XDG_DATA_HOME])
        AC_DEFINE_UNQUOTED(__VENDORDWEBSUPPORT__, ["$VENDOR_WEB"], [Vendor web address for support])
        if test "x$VGAHW" = xyes; then
                AC_DEFINE(WITH_VGAHW, 1, [Building vgahw module])
@@ -1928,11 +2237,27 @@ AM_CONDITIONAL([XORG_BUS_BSDPCI], [test "x$xorg_bus_bsdpci" = xyes])
 AM_CONDITIONAL([XORG_BUS_SPARC], [test "x$xorg_bus_sparc" = xyes])
 AM_CONDITIONAL([LINUX_ALPHA], [test "x$linux_alpha" = xyes])
 AM_CONDITIONAL([LNXACPI], [test "x$linux_acpi" = xyes])
-AM_CONDITIONAL([SOLARIS_ASM_INLINE], [test "x$solaris_asm_inline" = xyes])
+AM_CONDITIONAL([LNXAPM], [test "x$linux_apm" = xyes])
 AM_CONDITIONAL([SOLARIS_VT], [test "x$solaris_vt" = xyes])
 AM_CONDITIONAL([DGA], [test "x$DGA" = xyes])
 AM_CONDITIONAL([XF86VIDMODE], [test "x$XF86VIDMODE" = xyes])
 AM_CONDITIONAL([XORG_BUS_PLATFORM], [test "x$CONFIG_UDEV_KMS" = xyes])
+
+dnl glamor
+AM_CONDITIONAL([GLAMOR], [test "x$GLAMOR" = xyes])
+if test "x$GLAMOR" = xyes; then
+       AC_DEFINE(GLAMOR, 1, [Build glamor])
+       PKG_CHECK_MODULES([GLAMOR], [epoxy])
+
+       PKG_CHECK_MODULES(GBM, "$LIBGBM", [GBM=yes], [GBM=no])
+       if test "x$GBM" = xyes; then
+               AC_DEFINE(GLAMOR_HAS_GBM, 1,
+                         [Build glamor with GBM-based EGL support])
+       fi
+
+fi
+AM_CONDITIONAL([GLAMOR_EGL], [test "x$GBM" = xyes])
+
 dnl XWin DDX
 
 AC_MSG_CHECKING([whether to build XWin DDX])
@@ -1946,7 +2271,6 @@ fi
 AC_MSG_RESULT([$XWIN])
 
 if test "x$XWIN" = xyes; then
-       AC_DEFINE_DIR(SYSCONFDIR, sysconfdir, [Location of system.XWinrc])
        AC_DEFINE_DIR(DEFAULT_LOGDIR, logdir, [Default log location])
        AC_DEFINE_UNQUOTED(XORG_VERSION_CURRENT, [$VENDOR_RELEASE], [Current Xorg version])
        AC_DEFINE_UNQUOTED(__VENDORDWEBSUPPORT__, ["$VENDOR_WEB"], [Vendor web address for support])
@@ -1972,12 +2296,12 @@ if test "x$XWIN" = xyes; then
                        XWIN_SERVER_NAME=Xming
                        AC_DEFINE(RELOCATE_PROJECTROOT,1,[Make PROJECT_ROOT relative to the xserver location])
                        AC_DEFINE(HAS_WINSOCK,1,[Use Windows sockets])
-                       XWIN_SYS_LIBS=-lws2_32
+                       XWIN_SYS_LIBS="-lpthread -lws2_32"
                        ;;
        esac
 
-       XWIN_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $RANDR_LIB $RENDER_LIB $DBE_LIB $RECORD_LIB $GLX_LIBS $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $DAMAGE_LIB $MIEXT_SYNC_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $OS_LIB"
-       XWIN_SYS_LIBS="$XWIN_SYS_LIBS $XWINMODULES_LIBS $GLX_SYS_LIBS"
+       XWIN_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $RANDR_LIB $RENDER_LIB $DBE_LIB $RECORD_LIB $GLX_LIBS $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $DAMAGE_LIB $PRESENT_LIB $MIEXT_SYNC_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $OS_LIB"
+       XWIN_SYS_LIBS="$XWIN_SYS_LIBS $XWINMODULES_LIBS"
        AC_SUBST(XWIN_LIBS)
        AC_SUBST(XWIN_SERVER_NAME)
        AC_SUBST(XWIN_SYS_LIBS)
@@ -1993,6 +2317,16 @@ if test "x$XWIN" = xyes; then
 
 dnl XWin with AIGLX requires OpenGL spec files in order to generate wrapper code for native GL functions
        if [test "x$XWIN" = xyes && test "x$AIGLX" = xyes] ; then
+           AC_CHECK_PROG(PYTHON3, python3, python3)
+           if test -z "$PYTHON3"; then
+                AC_MSG_ERROR([python3 not found])
+           fi
+           AC_MSG_CHECKING(for python module lxml)
+           $PYTHON3 -c "import lxml;"
+           if test $? -ne 0 ; then
+                AC_MSG_ERROR([not found])
+           fi
+           AC_MSG_RESULT(yes)
            if test "x$KHRONOS_SPEC_DIR" = "xauto" ; then
                PKG_CHECK_MODULES([KHRONOS_OPENGL_REGISTRY], [khronos-opengl-registry])
                KHRONOS_SPEC_DIR=`pkg-config khronos-opengl-registry --variable=specdir`
@@ -2016,7 +2350,7 @@ if test "x$XQUARTZ" = xyes; then
        AC_DEFINE(XQUARTZ,1,[Have Quartz])
        AC_DEFINE(ROOTLESS,1,[Build Rootless code])
 
-       XQUARTZ_LIBS="$MAIN_LIB $FB_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $RECORD_LIB $RANDR_LIB $RENDER_LIB $DAMAGE_LIB $MIEXT_SYNC_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $XPSTUBS_LIB"
+       XQUARTZ_LIBS="$FB_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $RECORD_LIB $RANDR_LIB $RENDER_LIB $DAMAGE_LIB $MIEXT_SYNC_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $XPSTUBS_LIB $PRESENT_LIB"
        AC_SUBST([XQUARTZ_LIBS])
 
        AC_CHECK_LIB([Xplugin],[xp_init],[:])
@@ -2034,6 +2368,8 @@ if test "x$XQUARTZ" = xyes; then
        fi
 fi
 
+AM_CONDITIONAL(PSEUDORAMIX, [test "x$XQUARTZ" = xyes -o "x$XWIN" = xyes ])
+
 # Support for objc in autotools is minimal and not documented.
 OBJC='$(CC)'
 OBJCLD='$(CCLD)'
@@ -2052,7 +2388,7 @@ AM_CONDITIONAL(STANDALONE_XPBPROXY, [test "x$STANDALONE_XPBPROXY" = xyes])
 dnl DMX DDX
 PKG_CHECK_MODULES(
        [DMXMODULES],
-       [xmuu $LIBXEXT x11 xrender xfixes $LIBXI $DMXPROTO xau $XDMCP_MODULES],
+       [xmuu $LIBXEXT x11 >= 1.6 xrender xfixes $LIBXI $DMXPROTO xau $XDMCP_MODULES],
        [PKG_CHECK_MODULES(
                [XDMXCONFIG_DEP],
                [xaw7 xmu xt xpm x11],
@@ -2078,7 +2414,7 @@ if test "x$DMX" = xyes; then
        fi
        DMX_INCLUDES="$XEXT_INC $RENDER_INC $RECORD_INC"
        XDMX_CFLAGS="$DMXMODULES_CFLAGS"
-       XDMX_LIBS="$FB_LIB $MI_LIB $XEXT_LIB $RENDER_LIB $RECORD_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $MIEXT_SYNC_LIB $MIEXT_SHADOW_LIB $MIEXT_DAMAGE_LIB $COMPOSITE_LIB $DAMAGE_LIB $MAIN_LIB $DIX_LIB $CONFIG_LIB $OS_LIB $FIXES_LIB"
+       XDMX_LIBS="$FB_LIB $MI_LIB $XEXT_LIB $RENDER_LIB $RECORD_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB  $DRI3_LIB $PRESENT_LIB $MIEXT_SYNC_LIB $MIEXT_SHADOW_LIB $MIEXT_DAMAGE_LIB $COMPOSITE_LIB $DAMAGE_LIB $MAIN_LIB $DIX_LIB $CONFIG_LIB $OS_LIB $FIXES_LIB"
        XDMX_SYS_LIBS="$DMXMODULES_LIBS"
        AC_SUBST([XDMX_CFLAGS])
        AC_SUBST([XDMX_LIBS])
@@ -2161,12 +2497,15 @@ if test "$KDRIVE" = yes; then
        AC_DEFINE(KDRIVE_MOUSE, 1, [Enable KDrive mouse driver])
     fi
 
-    XEPHYR_REQUIRED_LIBS="x11 $LIBXEXT xau xdmcp"
+    XEPHYR_REQUIRED_LIBS="xau xdmcp xcb xcb-shape xcb-aux xcb-image xcb-icccm xcb-shm xcb-keysyms"
     if test "x$XV" = xyes; then
-        XEPHYR_REQUIRED_LIBS="$XEPHYR_REQUIRED_LIBS xv"
+        XEPHYR_REQUIRED_LIBS="$XEPHYR_REQUIRED_LIBS xcb-xv"
     fi
     if test "x$DRI" = xyes && test "x$GLX" = xyes; then
-        XEPHYR_REQUIRED_LIBS="$XEPHYR_REQUIRED_LIBS $LIBGL libdrm"
+        XEPHYR_REQUIRED_LIBS="$XEPHYR_REQUIRED_LIBS libdrm xcb-glx xcb-xf86dri > 1.6"
+    fi
+    if test "x$GLAMOR" = xyes; then
+        XEPHYR_REQUIRED_LIBS="$XEPHYR_REQUIRED_LIBS x11-xcb"
     fi
 
     if test "x$XEPHYR" = xauto; then
@@ -2178,16 +2517,16 @@ if test "$KDRIVE" = yes; then
     # Xephyr needs nanosleep() which is in librt on Solaris
     AC_CHECK_FUNC([nanosleep], [],
         AC_CHECK_LIB([rt], [nanosleep], XEPHYR_LIBS="$XEPHYR_LIBS -lrt"))
-    
+
     # damage shadow extension glx (NOTYET) fb mi
     KDRIVE_INC='-I$(top_srcdir)/hw/kdrive/src'
     KDRIVE_PURE_INCS="$KDRIVE_INC $MIEXT_SYNC_INC $MIEXT_DAMAGE_INC $MIEXT_SHADOW_INC $XEXT_INC $FB_INC $MI_INC"
     KDRIVE_OS_INC='-I$(top_srcdir)/hw/kdrive/linux'
     KDRIVE_INCS="$KDRIVE_PURE_INCS $KDRIVE_OS_INC"
-    
+
     KDRIVE_CFLAGS="$XSERVER_CFLAGS -DHAVE_KDRIVE_CONFIG_H $TSLIB_CFLAGS"
 
-    KDRIVE_PURE_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $RECORD_LIB $GLX_LIBS $RANDR_LIB $RENDER_LIB $DAMAGE_LIB $MIEXT_SYNC_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $OS_LIB"
+    KDRIVE_PURE_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $RECORD_LIB $GLX_LIBS $RANDR_LIB $RENDER_LIB $DAMAGE_LIB $DRI3_LIB $PRESENT_LIB $MIEXT_SYNC_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $OS_LIB"
     KDRIVE_LIB='$(top_builddir)/hw/kdrive/src/libkdrive.la'
     case $host_os in
        *linux*)
@@ -2215,8 +2554,7 @@ if test "$KDRIVE" = yes; then
            fi
            ;;
     esac
-    KDRIVE_STUB_LIB='$(top_builddir)/hw/kdrive/src/libkdrivestubs.la'
-    KDRIVE_LOCAL_LIBS="$MAIN_LIB $DIX_LIB $KDRIVE_LIB $KDRIVE_STUB_LIB"
+    KDRIVE_LOCAL_LIBS="$MAIN_LIB $DIX_LIB $KDRIVE_LIB"
     KDRIVE_LOCAL_LIBS="$KDRIVE_LOCAL_LIBS $FB_LIB $MI_LIB $KDRIVE_PURE_LIBS"
     KDRIVE_LOCAL_LIBS="$KDRIVE_LOCAL_LIBS $KDRIVE_OS_LIB"
     KDRIVE_LIBS="$KDRIVE_LOCAL_LIBS $XSERVER_SYS_LIBS $GLX_SYS_LIBS $DLOPEN_LIBS $TSLIB_LIBS"
@@ -2240,21 +2578,48 @@ AM_CONDITIONAL(XEPHYR, [test "x$KDRIVE" = xyes && test "x$XEPHYR" = xyes])
 AM_CONDITIONAL(BUILD_KDRIVEFBDEVLIB, [test "x$KDRIVE" = xyes && test "x$KDRIVEFBDEVLIB" = xyes])
 AM_CONDITIONAL(XFAKESERVER, [test "x$KDRIVE" = xyes && test "x$XFAKE" = xyes])
 
+dnl Xwayland DDX
+
+PKG_CHECK_MODULES(XWAYLANDMODULES, [wayland-client >= 1.3.0 libdrm epoxy], [have_xwayland=yes], [have_xwayland=no])
+AC_MSG_CHECKING([whether to build Xwayland DDX])
+if test "x$XWAYLAND" = xauto; then
+   XWAYLAND="$have_xwayland"
+fi
+AC_MSG_RESULT([$XWAYLAND])
+AM_CONDITIONAL(XWAYLAND, [test "x$XWAYLAND" = xyes])
+
+if test "x$XWAYLAND" = xyes; then
+       if test "x$have_xwayland" = xno; then
+               AC_MSG_ERROR([Xwayland build explicitly requested, but required modules not found.])
+       fi
+
+       XWAYLAND_LIBS="$FB_LIB $FIXES_LIB $MI_LIB $XEXT_LIB $DBE_LIB $RECORD_LIB $GLX_LIBS $RANDR_LIB $RENDER_LIB $DAMAGE_LIB $DRI3_LIB $PRESENT_LIB $MIEXT_SYNC_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $MAIN_LIB $DIX_LIB $OS_LIB"
+       XWAYLAND_SYS_LIBS="$XWAYLANDMODULES_LIBS $GLX_SYS_LIBS"
+       AC_SUBST([XWAYLAND_LIBS])
+       AC_SUBST([XWAYLAND_SYS_LIBS])
+
+       WAYLAND_PREFIX=`$PKG_CONFIG --variable=prefix wayland-client`
+       AC_PATH_PROG([WAYLAND_SCANNER], [wayland-scanner],,
+                    [${WAYLAND_PREFIX}/bin$PATH_SEPARATOR$PATH])
+fi
+
+
 dnl and the rest of these are generic, so they're in config.h
-dnl 
+dnl
 dnl though, thanks to the passing of some significant amount of time, the
 dnl above is probably a complete fallacy, and you should not rely on it.
 dnl but this is still actually better than imake, honest. -daniels
 
-AC_TRY_COMPILE([
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
 #include <features.h>
 #ifndef __GLIBC__
 #error not glibc
 #endif
-], [], [AC_DEFINE(_GNU_SOURCE, 1,
+]], [])], [AC_DEFINE(_GNU_SOURCE, 1,
        [ Enable GNU and other extensions to the C environment for glibc])])
 
 AC_DEFINE_DIR(PROJECTROOT, prefix, [Overall prefix])
+AC_DEFINE_DIR(SYSCONFDIR, sysconfdir, [sysconfdir])
 
 AC_SUBST([RELEASE_DATE])
 BUILD_DATE="`date +'%Y%m%d'`"
@@ -2272,12 +2637,22 @@ AC_SUBST([prefix])
 
 AC_CONFIG_COMMANDS([sdksyms], [touch hw/xfree86/sdksyms.dep])
 
-AC_OUTPUT([
+if test "x$CONFIG_HAL" = xno && test "x$CONFIG_UDEV" = xno; then
+    AC_MSG_WARN([
+             ***********************************************
+             Neither HAL nor udev backend will be enabled.
+             Input device hotplugging will not be available!
+             ***********************************************])
+fi
+
+AC_CONFIG_FILES([
 Makefile
 glx/Makefile
 include/Makefile
 gesture/Makefile
 hwc/Makefile
+hwa/Makefile
+container/Makefile
 composite/Makefile
 damageext/Makefile
 dbe/Makefile
@@ -2286,6 +2661,7 @@ doc/Makefile
 doc/dtrace/Makefile
 man/Makefile
 fb/Makefile
+glamor/Makefile
 record/Makefile
 config/Makefile
 mi/Makefile
@@ -2295,6 +2671,7 @@ miext/damage/Makefile
 miext/shadow/Makefile
 miext/rootless/Makefile
 os/Makefile
+pseudoramiX/Makefile
 randr/Makefile
 render/Makefile
 xkb/Makefile
@@ -2303,8 +2680,11 @@ Xext/Makefile
 Xi/Makefile
 xfixes/Makefile
 exa/Makefile
+dri3/Makefile
+present/Makefile
 hw/Makefile
 hw/xfree86/Makefile
+hw/xfree86/Xorg.sh
 hw/xfree86/common/Makefile
 hw/xfree86/common/xf86Build.h
 hw/xfree86/ddc/Makefile
@@ -2316,6 +2696,7 @@ hw/xfree86/exa/Makefile
 hw/xfree86/exa/man/Makefile
 hw/xfree86/fbdevhw/Makefile
 hw/xfree86/fbdevhw/man/Makefile
+hw/xfree86/glamor_egl/Makefile
 hw/xfree86/i2c/Makefile
 hw/xfree86/int10/Makefile
 hw/xfree86/loader/Makefile
@@ -2370,8 +2751,10 @@ hw/kdrive/fake/Makefile
 hw/kdrive/fbdev/Makefile
 hw/kdrive/linux/Makefile
 hw/kdrive/src/Makefile
+hw/xwayland/Makefile
 test/Makefile
 test/xi2/Makefile
 xserver.ent
 xorg-server.pc
 ], [chmod +x xkb/xserver-keymap-dir])
+AC_OUTPUT
diff --git a/container/Makefile.am b/container/Makefile.am
new file mode 100644 (file)
index 0000000..8631384
--- /dev/null
@@ -0,0 +1,9 @@
+noinst_LTLIBRARIES = libcontainer.la
+
+AM_CFLAGS = $(DIX_CFLAGS)
+
+sdk_HEADERS = container.h
+
+libcontainer_la_SOURCES = \
+       container.c \
+       container.h
diff --git a/container/container.c b/container/container.c
new file mode 100755 (executable)
index 0000000..cc58ce9
--- /dev/null
@@ -0,0 +1,567 @@
+/*
+ * Copyright 2014 Samsung Electronics co., Ltd. All Rights Reserved.
+ *
+ * Contact:
+ *     SooChan Lim <sc1.lim@samsung.com>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * this permission notice appear in supporting documentation.  This permission
+ * notice 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
+ * AUTHOR 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.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <sys/socket.h>
+#include <sys/stat.h>
+#include <sys/xattr.h>
+#include <stdio.h>
+#include <stdarg.h>
+
+#include <X11/Xdefs.h>
+#include <X11/Xatom.h>
+#include "selection.h"
+#include "inputstr.h"
+#include "scrnintstr.h"
+#include "windowstr.h"
+#include "propertyst.h"
+#include "extnsionst.h"
+#include "xacestr.h"
+#include "client.h"
+#include "../os/osdep.h"
+#include "gcstruct.h"
+#include "cursorstr.h"
+#include "colormapst.h"
+#include "container.h"
+#include <vasum.h>
+
+/* private state keys */
+DevPrivateKeyRec containerClientKeyRec;
+DevPrivateKeyRec containerScreenKeyRec;
+DevPrivateKeyRec containerResKeyRec;
+
+#define containerClientKey (&containerClientKeyRec)
+#define containerScreenKey (&containerScreenKeyRec)
+#define containerResKey (&containerResKeyRec)
+
+#define GetContainerScreen(s) ((ContainerScreenPtr) \
+    dixLookupPrivate(&(s)->devPrivates, containerScreenKey))
+
+//#define CONTAINER_DEBUG 1
+
+static char *str_res[11] = {
+    "null",
+    "RT_WINDOW",
+    "RT_PIXMAP",
+    "RT_GC",
+    "RT_FONT",
+    "RT_CURSOR",
+    "RT_COLORMAP",
+    "RT_CMAPENTRY",
+    "RT_OTHERCLIENT",
+    "RT_PASSIVEGRAB",
+    "RT_LASTPREDEF",
+};
+
+static char *
+_get_str_res(RESTYPE rtype)
+{
+    char *str = NULL;
+
+    switch (rtype) {
+        case RT_WINDOW:
+            str = str_res[1];
+            break;
+        case RT_PIXMAP:
+            str = str_res[2];
+            break;
+        case RT_GC:
+            str = str_res[3];
+            break;
+        case RT_FONT:
+            str = str_res[4];
+            break;
+        case RT_CURSOR:
+            str = str_res[5];
+            break;
+        case RT_COLORMAP:
+            str = str_res[6];
+            break;
+        case RT_CMAPENTRY:
+            str = str_res[7];
+            break;
+        case RT_OTHERCLIENT:
+            str = str_res[8];
+            break;
+        case RT_PASSIVEGRAB:
+            str = str_res[9];
+            break;
+        case RT_LASTPREDEF:
+            str = str_res[10];
+            break;
+        default:
+            str = str_res[0];
+            break;
+    }
+
+    return str;
+}
+
+/*
+ * DIX Callbacks
+ */
+static void
+ContainerClientState(CallbackListPtr *pcbl, void * data, void * calldata)
+{
+    NewClientInfoRec *pci = calldata;
+    ClientPtr pClient = pci->client;
+    ScreenPtr pScreen = screenInfo.screens[0];
+    ContainerClientPtr pClientInfo = NULL;
+    ContainerScreenPtr pContainerScreen = NULL;
+    vsm_zone_h zone = 0;
+
+    pClientInfo = dixLookupPrivate(&pClient->devPrivates, containerClientKey);
+    if (!pClientInfo) {
+        ErrorF ("[Container] Error: no client info.\n");
+        return;
+    }
+
+    pContainerScreen = GetContainerScreen(pScreen);
+    if (!pContainerScreen) {
+        ErrorF ("[Container] Error: no client info.\n");
+        return;
+    }
+
+    switch (pClient->clientState) {
+        case ClientStateInitial:       /* new client */
+        case ClientStateRunning:
+            pClientInfo->pid = DetermineClientPid(pClient);
+            zone = vsm_lookup_zone_by_pid (pContainerScreen->vsm_ctx, pClientInfo->pid);
+            pClientInfo->zone_id = vsm_get_zone_id(zone);
+#if CONTAINER_DEBUG
+            ErrorF ("[Container:%s,%d] pid:%d, client_zone:%d\n", __func__, __LINE__, pClientInfo->pid, pClientInfo->zone_id);
+#endif
+            break;
+        case ClientStateGone:       /* client disconnected */
+        case ClientStateRetained:
+            break;
+        default:
+            break;
+    }
+}
+
+static void
+ContainerClientAccess(CallbackListPtr *pcbl, void * data, void * calldata)
+{
+    XaceClientAccessRec *rec = calldata;
+    ClientPtr pClient = rec->client;
+    ClientPtr pTarget = rec->target;
+    ContainerClientPtr pClientInfo = dixLookupPrivate(&pClient->devPrivates, containerClientKey);
+    ContainerClientPtr pTargetInfo = dixLookupPrivate(&pTarget->devPrivates, containerClientKey);
+
+    if (pClient == serverClient)
+        return;
+
+    /* zone_id=0 means that the client is host clients.
+        The host client access all resources. */
+    if (pClientInfo->zone_id == 0)
+        return;
+
+    if (pClientInfo->zone_id != pTargetInfo->zone_id) {
+            rec->status = BadAccess;
+
+            ErrorF ("[Container:%s,%d] Error: Wrong Access (client_zone:%d, target_zone_id:%d)\n",
+                __func__, __LINE__, pClientInfo->zone_id, pTargetInfo->zone_id);
+    }
+}
+
+static void
+ContainerResourceAccess(CallbackListPtr *pcbl, void * data, void * calldata)
+{
+    XaceResourceAccessRec *rec = calldata;
+    ClientPtr pClient = rec->client;
+    ScreenPtr pScreen = screenInfo.screens[0];
+    ContainerClientPtr pClientInfo = NULL;
+    ContainerResPtr pResInfo = NULL;
+    ContainerScreenPtr pContainerScreen = NULL;
+    vsm_zone_h zone = 0;
+    WindowPtr pWin = NULL;
+    PixmapPtr pPix = NULL;
+    GCPtr pGc = NULL;
+    FontPtr pFont = NULL;
+    CursorPtr pCursor = NULL;
+    ColormapPtr pColormap = NULL;
+
+    if (pClient == serverClient)
+        return;
+
+    /* compare the client zone_id with the resource zone_id */
+    pClientInfo = dixLookupPrivate(&pClient->devPrivates, containerClientKey);
+
+    /* zone_id=0 means that the client is host clients.
+        The host client access all resources. */
+    if (pClientInfo->zone_id == 0)
+        return;
+
+    pContainerScreen = GetContainerScreen(pScreen);
+    if (!pContainerScreen) {
+        ErrorF ("[Container] Error: no client info.\n");
+        return;
+    }
+
+    switch (rec->rtype) {
+        case RT_WINDOW:
+            pWin = (WindowPtr)rec->res;
+            pResInfo = dixLookupPrivate(&pWin->devPrivates, containerResKey);
+
+            /* check the root window.
+                 The root window access is dealt per request(api) level.
+                 For example, resign the shmGetImage of root window.*/
+            if (!pWin->parent) {
+#if CONTAINER_DEBUG
+                ErrorF("[Container] try to access the root window(id:%p).\n", rec->id);
+                if (pClientInfo && pResInfo)
+                    ErrorF ("[Container:%s,%d] pid:%d, client_zone:%d, res:%s, res_id:%p, res_zone:%d\n",
+                        __func__, __LINE__, pClientInfo->pid, pClientInfo->zone_id, _get_str_res(rec->rtype), rec->id, pResInfo->zone_id);
+#endif
+                return;
+
+            }
+            break;
+        case RT_PIXMAP:
+            pPix = (PixmapPtr)rec->res;
+            pResInfo = dixLookupPrivate(&pPix->devPrivates, containerResKey);
+            break;
+        case RT_GC:
+            pGc = (GCPtr)rec->res;
+            pResInfo = dixLookupPrivate(&pGc->devPrivates, containerResKey);
+            break;
+        case RT_FONT:
+        case RT_CURSOR:
+        case RT_COLORMAP:
+        case RT_CMAPENTRY:
+        case RT_OTHERCLIENT:
+        case RT_PASSIVEGRAB:
+        case RT_LASTPREDEF:
+        default:
+#if CONTAINER_DEBUG
+            if (pClientInfo && pResInfo)
+                ErrorF ("[Container:%s,%d] Not check resource : pid:%d, client_zone:%d, res:%s, res_id:%p, res_zone:%d\n",
+                    __func__, __LINE__, pClientInfo->pid, pClientInfo->zone_id, _get_str_res(rec->rtype), rec->id, pResInfo->zone_id);
+#endif
+            /* do not check the null resources */
+            return;
+            break;
+    }
+
+    if (pClientInfo && pResInfo) {
+        /* set zone_id to resource private at inital time to access resource(create reource..ResourceStateAdding) */
+        if (!pResInfo->zone_id) {
+            zone = vsm_lookup_zone_by_pid (pContainerScreen->vsm_ctx, pClientInfo->pid);
+            pResInfo->zone_id = vsm_get_zone_id(zone);
+        }
+
+        /* check the wrong access with comparing zone_ids */
+        if (pClientInfo->zone_id != pResInfo->zone_id) {
+            rec->status = BadAccess;
+            ErrorF ("[Container:%s,%d] Error: Wrong Access (pid:%d, client_zone:%d, res:%s, res_id:%p, res_zone:%d)\n",
+                __func__, __LINE__, pClientInfo->pid, pClientInfo->zone_id, _get_str_res(rec->rtype), rec->id, pResInfo->zone_id);
+        }
+    }
+
+#if CONTAINER_DEBUG
+    if (pClientInfo && pResInfo)
+        ErrorF ("[Container:%s,%d] pid:%d, client_zone:%d, res:%s, res_id:%p, res_zone:%d\n",
+            __func__, __LINE__, pClientInfo->pid, pClientInfo->zone_id, _get_str_res(rec->rtype), rec->id, pResInfo->zone_id);
+#endif
+}
+
+static void
+ContainerSendAccess(CallbackListPtr *pcbl, void *unused, void *calldata)
+{
+    XaceSendAccessRec *rec = calldata;
+    ClientPtr pClient = rec->client;
+    ScreenPtr pScreen = screenInfo.screens[0];
+    ContainerResPtr pResInfo = NULL;
+    ContainerScreenPtr pContainerScreen = NULL;
+    WindowPtr pWin = NULL;
+
+    if (rec->client) {
+        int i;
+
+        for (i = 0; i < rec->count; i++)
+            switch (rec->events[i].u.u.type)
+            {
+            case KeyPress:
+            case KeyRelease:
+            case ButtonPress:
+            case ButtonRelease:
+                pContainerScreen = GetContainerScreen(pScreen);
+                pWin = (WindowPtr)rec->pWin;
+                pResInfo = dixLookupPrivate(&pWin->devPrivates, containerResKey);
+                if (pContainerScreen->foreground_zone_id != pResInfo->zone_id) {
+                    rec->status = BadAccess;
+                    ErrorF ("[Container:%s,%d] Error: Wrong Event Access (foreground_zone:%d, res_zone:%d)\n",
+                        __func__, __LINE__, pContainerScreen->foreground_zone_id, pResInfo->zone_id);
+                }
+
+                break;
+            case GenericEvent:
+                // TODO: deal with generic events
+                break;
+            default:
+                break;
+            }
+        }
+}
+
+static int check = 0;
+
+static void
+ConatinerWakeupHanlder(void * data, int err, void * p)
+{
+    fd_set *read_mask;
+    ScreenPtr pScreen = NULL;
+    ContainerScreenPtr pContainerScreen = NULL;
+    int ret = VSM_ERROR_NONE;
+
+    if (data == NULL || err < 0)
+        return;
+
+    pScreen = (ScreenPtr) data;
+    pContainerScreen = GetContainerScreen(pScreen);
+    if (!pContainerScreen)
+        return;
+
+    /* decalre files and link for x11 socket and files */
+    if (!check) {
+        const char *x11_unix = "/tmp/.X11-unix";
+        const char *xim_unix = "/tmp/.XIM-unix";
+        if (!access(x11_unix, R_OK) && !access(xim_unix, R_OK)) {
+            ErrorF("#####[soolm] file exist.\n");
+            const char *x0_lock = "/tmp/.X0-lock";
+            const char *x11_unix_x0 = "/tmp/.X11-unix/X0";
+
+            ret = vsm_declare_link(pContainerScreen->vsm_ctx, x0_lock, x0_lock);
+            if (ret != VSM_ERROR_NONE) {
+                ErrorF("[Container]: Error. vsm_declare_link.(%s)\n", x0_lock);
+            }
+
+            //files
+            ret = vsm_declare_file(pContainerScreen->vsm_ctx, VSM_FSO_TYPE_DIR, x11_unix, O_CREAT|O_RDWR, 0777);
+            if (ret != VSM_ERROR_NONE) {
+                ErrorF("[Container]: Error. vsm_declare_file.(%s)\n", x11_unix);
+            }
+            // links
+            ret = vsm_declare_link(pContainerScreen->vsm_ctx, x11_unix_x0, x11_unix_x0);
+            if (ret != VSM_ERROR_NONE) {
+                ErrorF("[Container]: Error. vsm_declare_link.(%s)\n", x11_unix_x0);
+            }
+
+            //files
+            ret = vsm_declare_file(pContainerScreen->vsm_ctx, VSM_FSO_TYPE_DIR, xim_unix, O_CREAT|O_RDWR, 0777);
+            if (ret != VSM_ERROR_NONE) {
+                ErrorF("[Container]: Error. vsm_declare_file.(%s)\n", xim_unix);
+            }
+
+            check = 1;
+        }
+    }
+
+    read_mask = p;
+    if (FD_ISSET (pContainerScreen->vsm_fd, read_mask)) {
+        vsm_enter_eventloop(pContainerScreen->vsm_ctx, 0, 0);
+    }
+}
+
+static int
+ProcContainerDispatch(ClientPtr client)
+{
+#ifdef CONTAINER_DEBUG
+    REQUEST(xReq);
+
+    ErrorF("%s(%d)\n", __func__, stuff->data);
+#endif /* CONTAINER_DEBUG */
+    return 0;
+}
+
+static int
+SProcContainerDispatch(ClientPtr client)
+{
+#ifdef CONTAINER_DEBUG
+    REQUEST(xReq);
+
+    ErrorF("%s(%d)\n", __func__, stuff->data);
+#endif /* CONTAINER_DEBUG */
+    return 0;
+}
+
+static void
+ContainerResetProc(ExtensionEntry *extEntry)
+{
+#ifdef CONTAINER_DEBUG
+    ErrorF("%s(...)\n", __func__);
+#endif /* CONTAINER_DEBUG */
+}
+
+static Bool
+containerCloseScreen(ScreenPtr pScreen)
+{
+    ContainerScreenPtr cs = GetContainerScreen(pScreen);
+    Bool ret;
+
+    vsm_del_event_callback(cs->vsm_ctx, cs->vsm_event_handle);
+    vsm_cleanup_context(cs->vsm_ctx);
+
+    pScreen->CloseScreen = cs->CloseScreen;
+
+    free(cs);
+    dixSetPrivate(&pScreen->devPrivates, containerScreenKey, NULL);
+    ret = (*pScreen->CloseScreen) (pScreen);
+
+    return ret;
+}
+
+static int
+ContainerVsmZoneEvent (vsm_zone_h zone, vsm_zone_event_t event, void *user_data)
+{
+    ScreenPtr pScreen = screenInfo.screens[0];
+    ContainerScreenPtr pContainerScreen = NULL;
+    int foreground_zone_id = -1;
+    vsm_zone_h vsm_zone;
+
+    /* we care about only foreground switch */
+    if (event != VSM_ZONE_EVENT_SWITCHED)
+        return TRUE;
+
+    if (GetContainerScreen(pScreen))
+        return FALSE;
+
+    vsm_zone = vsm_get_foreground (pContainerScreen->vsm_ctx);
+    foreground_zone_id = vsm_get_zone_id (vsm_zone);
+    if (foreground_zone_id != pContainerScreen->foreground_zone_id) {
+        ErrorF ("[Container:%s,%d] Change the foreground zone id (before : %d ==> after : %d)\n",
+            __func__, __LINE__, pContainerScreen->foreground_zone_id, foreground_zone_id);
+
+        pContainerScreen->foreground_zone_id = foreground_zone_id;
+    }
+
+    return TRUE;
+}
+
+
+static Bool
+containerScreenInit(ScreenPtr pScreen)
+{
+    ContainerScreenPtr cs;
+    int vsm_fd;
+    vsm_context_h vsm_ctx;
+    vsm_zone_h vsm_zone;
+    int vsm_event_handle;
+
+    vsm_ctx = vsm_create_context();
+    if (vsm_ctx == NULL) {
+        ErrorF ("[Container] Error : fail to create vsm_ctx.\n");
+        return FALSE;
+    }
+
+    vsm_fd = vsm_get_poll_fd (vsm_ctx);
+    if (vsm_fd < 0) {
+        ErrorF ("[Container] Error : fail to get vsm_ctx fd.\n");
+        return FALSE;
+    }
+
+    vsm_event_handle = vsm_add_event_callback(vsm_ctx, ContainerVsmZoneEvent, NULL);
+
+    if (!dixRegisterPrivateKey(containerScreenKey, PRIVATE_SCREEN, 0))
+        return FALSE;
+
+    if (GetContainerScreen(pScreen))
+        return TRUE;
+
+    cs = (ContainerScreenPtr) calloc(1, sizeof(ContainerScreenRec));
+    if (!cs)
+        return FALSE;
+
+    cs->vsm_fd = vsm_fd;
+    cs->vsm_ctx = vsm_ctx;
+    cs->vsm_event_handle = vsm_event_handle;
+    vsm_zone = vsm_get_foreground (vsm_ctx);
+    cs->foreground_zone_id = vsm_get_zone_id (vsm_zone);
+
+    cs->CloseScreen = pScreen->CloseScreen;
+    pScreen->CloseScreen = containerCloseScreen;
+
+    dixSetPrivate(&pScreen->devPrivates, containerScreenKey, cs);
+
+    AddGeneralSocket(vsm_fd);
+
+    RegisterBlockAndWakeupHandlers((BlockHandlerProcPtr)NoopDDA,
+                                   ConatinerWakeupHanlder, pScreen);
+
+    return TRUE;
+}
+
+
+void
+ContainerExtensionInit(void)
+{
+    ExtensionEntry *extEntry;
+    int ret = TRUE;
+    ScreenPtr pScreen = NULL;
+
+    /* Allocate private storage */
+    if (!dixRegisterPrivateKey(containerClientKey, PRIVATE_XCONTAINER_CLIENT, sizeof(ContainerClientRec)))
+        FatalError("Container: Failed to allocate private container client storage.\n");
+    if (!dixRegisterPrivateKey(containerResKey, PRIVATE_XCONTAINER_RES, sizeof(ContainerResRec)))
+        FatalError("Container: Failed to allocate private container client storage.\n");
+
+    /* vsm context is only one in xserver. Therefore, store the vsm context information in the screen 0. */
+    pScreen = screenInfo.screens[0];
+    if (!containerScreenInit(pScreen))
+        FatalError("[Container] Error : Failed to initialize screen private.\n");
+
+    /* Register callbacks */
+    ret &= AddCallback(&ClientStateCallback, ContainerClientState, NULL);
+    ret &= XaceRegisterCallback(XACE_CLIENT_ACCESS, ContainerClientAccess, NULL);
+    ret &= XaceRegisterCallback(XACE_RESOURCE_ACCESS, ContainerResourceAccess, NULL);
+    ret &= XaceRegisterCallback(XACE_SEND_ACCESS, ContainerSendAccess, NULL);
+
+#if 0
+    ret &= XaceDeleteCallback (XACE_CORE_DISPATCH, ContainerCoreEvents, NULL);
+    ret &= XaceDeleteCallback (XACE_EXT_DISPATCH, ContainerExtEvents, NULL);
+    ret &= XaceDeleteCallback (XACE_AUDIT_END, ContainerAuditEndEvents, NULL);
+
+//    ret &= XaceRegisterCallback(XACE_DEVICE_ACCESS, ContainerDevice, NULL);
+//    ret &= XaceRegisterCallback(XACE_PROPERTY_ACCESS, ContainerProperty, NULL);
+//    ret &= XaceRegisterCallback(XACE_RECEIVE_ACCESS, ContainerReceive, NULL);
+//    ret &= XaceRegisterCallback(XACE_EXT_ACCESS, ContainerExtension, NULL);
+//    ret &= XaceRegisterCallback(XACE_SERVER_ACCESS, ContainerServer, NULL);
+//    ret &= XaceRegisterCallback(XACE_SELECTION_ACCESS, ContainerSelection, NULL);
+//    ret &= XaceRegisterCallback(XACE_SCREEN_ACCESS, ContainerScreen, NULL);
+//    ret &= XaceRegisterCallback(XACE_SCREENSAVER_ACCESS, ContainerScreen, NULL);
+#endif
+
+    if (!ret)
+        FatalError("[Container] Error : Failed to register one or more callbacks\n");
+
+    extEntry = AddExtension(CONTAINER_EXTENSION_NAME,
+            ContainerNumberEvents, ContainerNumberErrors,
+            ProcContainerDispatch, SProcContainerDispatch,
+            ContainerResetProc, StandardMinorOpcode);
+
+    if (!extEntry)
+        FatalError("[Container] Error : Failed to add extension.\n");
+
+}
+
diff --git a/container/container.h b/container/container.h
new file mode 100755 (executable)
index 0000000..08b2634
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2011 Samsung Electronics co., Ltd. All Rights Reserved.
+ *
+ * Contact:
+ *     SooChan Lim <sc1.lim@samsung.com>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * this permission notice appear in supporting documentation.  This permission
+ * notice 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
+ * AUTHOR 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 _CONTAINER_H
+#define _CONTAINER_H
+
+//#define _GNU_SOURCE // for vasum.
+#include "scrnintstr.h"
+
+/* Extension info */
+#define CONTAINER_EXTENSION_NAME       "Container"
+#define CONTAINER_MAJOR_VERSION        1
+#define CONTAINER_MINOR_VERSION        0
+#define ContainerNumberEvents          0
+#define ContainerNumberErrors          0
+
+/*
+ * Steal the SELinux private property.
+ */
+#define PRIVATE_XCONTAINER_CLIENT PRIVATE_XSELINUX
+#define PRIVATE_XCONTAINER_RES PRIVATE_XSELINUX
+
+typedef struct {
+    int vsm_fd;
+    void * vsm_ctx;
+    int vsm_event_handle;
+    int foreground_zone_id;
+
+    CloseScreenProcPtr CloseScreen;
+} ContainerScreenRec, *ContainerScreenPtr;
+
+/* client info*/
+typedef struct {
+    unsigned int pid;
+    unsigned int zone_id;
+} ContainerClientRec, *ContainerClientPtr;
+
+/* resource info */
+typedef struct {
+    unsigned int zone_id;
+} ContainerResRec, *ContainerResPtr;
+
+#endif /* _CONTAINER_H */
index a942ffa..886f56d 100644 (file)
@@ -1,5 +1,6 @@
 /*
  * Copyright Â© 2002 Keith Packard
+ * Copyright 2013 Red Hat, Inc.
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
 #endif
 
 #include "damageextint.h"
+#include "damagestr.h"
 #include "protocol-versions.h"
 #include "extinit.h"
 
+#ifdef PANORAMIX
+#include "panoramiX.h"
+#include "panoramiXsrv.h"
+
+typedef struct {
+    DamageExtPtr ext;
+    DamagePtr damage[MAXSCREENS];
+} PanoramiXDamageRes;
+
+static RESTYPE XRT_DAMAGE;
+static int (*PanoramiXSaveDamageCreate) (ClientPtr);
+
+#endif
+
 static unsigned char DamageReqCode;
 static int DamageEventBase;
 static RESTYPE DamageExtType;
-static RESTYPE DamageExtWinType;
 
 static DevPrivateKeyRec DamageClientPrivateKeyRec;
 
 #define DamageClientPrivateKey (&DamageClientPrivateKeyRec)
 
 static void
+DamageNoteCritical(ClientPtr pClient)
+{
+    DamageClientPtr pDamageClient = GetDamageClient(pClient);
+
+    /* Composite extension marks clients with manual Subwindows as critical */
+    if (pDamageClient->critical > 0) {
+        SetCriticalOutputPending();
+        pClient->smart_priority = SMART_MAX_PRIORITY;
+    }
+}
+
+static void
+damageGetGeometry(DrawablePtr draw, int *x, int *y, int *w, int *h)
+{
+#ifdef PANORAMIX
+    if (!noPanoramiXExtension && draw->type == DRAWABLE_WINDOW) {
+        WindowPtr win = (WindowPtr)draw;
+
+        if (!win->parent) {
+            *x = screenInfo.x;
+            *y = screenInfo.y;
+            *w = screenInfo.width;
+            *h = screenInfo.height;
+            return;
+        }
+    }
+#endif
+
+    *x = draw->x;
+    *y = draw->y;
+    *w = draw->width;
+    *h = draw->height;
+}
+
+static void
 DamageExtNotify(DamageExtPtr pDamageExt, BoxPtr pBoxes, int nBoxes)
 {
     ClientPtr pClient = pDamageExt->pClient;
-    DamageClientPtr pDamageClient = GetDamageClient(pClient);
     DrawablePtr pDrawable = pDamageExt->pDrawable;
     xDamageNotifyEvent ev;
-    int i;
+    int i, x, y, w, h;
+
+    damageGetGeometry(pDrawable, &x, &y, &w, &h);
 
     UpdateCurrentTimeIf();
     ev = (xDamageNotifyEvent) {
@@ -53,10 +104,10 @@ DamageExtNotify(DamageExtPtr pDamageExt, BoxPtr pBoxes, int nBoxes)
         .drawable = pDamageExt->drawable,
         .damage = pDamageExt->id,
         .timestamp = currentTime.milliseconds,
-        .geometry.x = pDrawable->x,
-        .geometry.y = pDrawable->y,
-        .geometry.width = pDrawable->width,
-        .geometry.height = pDrawable->height
+        .geometry.x = x,
+        .geometry.y = y,
+        .geometry.width = w,
+        .geometry.height = h
     };
     if (pBoxes) {
         for (i = 0; i < nBoxes; i++) {
@@ -73,15 +124,12 @@ DamageExtNotify(DamageExtPtr pDamageExt, BoxPtr pBoxes, int nBoxes)
     else {
         ev.area.x = 0;
         ev.area.y = 0;
-        ev.area.width = pDrawable->width;
-        ev.area.height = pDrawable->height;
+        ev.area.width = w;
+        ev.area.height = h;
         WriteEventsToClient(pClient, 1, (xEvent *) &ev);
     }
-    /* Composite extension marks clients with manual Subwindows as critical */
-    if (pDamageClient->critical > 0) {
-        SetCriticalOutputPending();
-        pClient->smart_priority = SMART_MAX_PRIORITY;
-    }
+
+    DamageNoteCritical(pClient);
 }
 
 static void
@@ -163,23 +211,62 @@ ProcDamageQueryVersion(ClientPtr client)
     return Success;
 }
 
-static int
-ProcDamageCreate(ClientPtr client)
+static void
+DamageExtRegister(DrawablePtr pDrawable, DamagePtr pDamage, Bool report)
+{
+    DamageSetReportAfterOp(pDamage, TRUE);
+    DamageRegister(pDrawable, pDamage);
+
+    if (report) {
+        RegionPtr pRegion = &((WindowPtr) pDrawable)->borderClip;
+        RegionTranslate(pRegion, -pDrawable->x, -pDrawable->y);
+        DamageReportDamage(pDamage, pRegion);
+        RegionTranslate(pRegion, pDrawable->x, pDrawable->y);
+    }
+}
+
+static DamageExtPtr
+DamageExtCreate(DrawablePtr pDrawable, DamageReportLevel level,
+                ClientPtr client, XID id, XID drawable)
+{
+    DamageExtPtr pDamageExt = malloc(sizeof(DamageExtRec));
+    if (!pDamageExt)
+        return NULL;
+
+    pDamageExt->id = id;
+    pDamageExt->drawable = drawable;
+    pDamageExt->pDrawable = pDrawable;
+    pDamageExt->level = level;
+    pDamageExt->pClient = client;
+    pDamageExt->pDamage = DamageCreate(DamageExtReport, DamageExtDestroy, level,
+                                       FALSE, pDrawable->pScreen, pDamageExt);
+    if (!pDamageExt->pDamage) {
+        free(pDamageExt);
+        return NULL;
+    }
+
+    if (!AddResource(id, DamageExtType, (void *) pDamageExt))
+        return NULL;
+
+    DamageExtRegister(pDrawable, pDamageExt->pDamage,
+                      pDrawable->type == DRAWABLE_WINDOW);
+
+    return pDamageExt;
+}
+
+static DamageExtPtr
+doDamageCreate(ClientPtr client, int *rc)
 {
     DrawablePtr pDrawable;
     DamageExtPtr pDamageExt;
     DamageReportLevel level;
-    RegionPtr pRegion;
-    int rc;
 
     REQUEST(xDamageCreateReq);
 
-    REQUEST_SIZE_MATCH(xDamageCreateReq);
-    LEGAL_NEW_RESOURCE(stuff->damage, client);
-    rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0,
-                           DixGetAttrAccess | DixReadAccess);
-    if (rc != Success)
-        return rc;
+    *rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0,
+                            DixGetAttrAccess | DixReadAccess);
+    if (*rc != Success)
+        return NULL;
 
     switch (stuff->level) {
     case XDamageReportRawRectangles:
@@ -196,37 +283,27 @@ ProcDamageCreate(ClientPtr client)
         break;
     default:
         client->errorValue = stuff->level;
-        return BadValue;
+        *rc = BadValue;
+        return NULL;
     }
 
-    pDamageExt = malloc(sizeof(DamageExtRec));
+    pDamageExt = DamageExtCreate(pDrawable, level, client, stuff->damage,
+                                 stuff->drawable);
     if (!pDamageExt)
-        return BadAlloc;
-    pDamageExt->id = stuff->damage;
-    pDamageExt->drawable = stuff->drawable;
-    pDamageExt->pDrawable = pDrawable;
-    pDamageExt->level = level;
-    pDamageExt->pClient = client;
-    pDamageExt->pDamage = DamageCreate(DamageExtReport,
-                                       DamageExtDestroy,
-                                       level,
-                                       FALSE, pDrawable->pScreen, pDamageExt);
-    if (!pDamageExt->pDamage) {
-        free(pDamageExt);
-        return BadAlloc;
-    }
-    if (!AddResource(stuff->damage, DamageExtType, (pointer) pDamageExt))
-        return BadAlloc;
-
-    DamageSetReportAfterOp(pDamageExt->pDamage, TRUE);
-    DamageRegister(pDamageExt->pDrawable, pDamageExt->pDamage);
+        *rc = BadAlloc;
 
-    if (pDrawable->type == DRAWABLE_WINDOW) {
-        pRegion = &((WindowPtr) pDrawable)->borderClip;
-        DamageReportDamage(pDamageExt->pDamage, pRegion);
-    }
+    return pDamageExt;
+}
 
-    return Success;
+static int
+ProcDamageCreate(ClientPtr client)
+{
+    int rc;
+    REQUEST(xDamageCreateReq);
+    REQUEST_SIZE_MATCH(xDamageCreateReq);
+    LEGAL_NEW_RESOURCE(stuff->damage, client);
+    doDamageCreate(client, &rc);
+    return rc;
 }
 
 static int
@@ -241,6 +318,88 @@ ProcDamageDestroy(ClientPtr client)
     return Success;
 }
 
+#ifdef PANORAMIX
+static RegionPtr
+DamageExtSubtractWindowClip(DamageExtPtr pDamageExt)
+{
+    WindowPtr win = (WindowPtr)pDamageExt->pDrawable;
+    PanoramiXRes *res = NULL;
+    RegionPtr ret;
+    int i;
+
+    if (!win->parent)
+        return &PanoramiXScreenRegion;
+
+    dixLookupResourceByType((void **)&res, win->drawable.id, XRT_WINDOW,
+                            serverClient, DixReadAccess);
+    if (!res)
+        return NULL;
+
+    ret = RegionCreate(NULL, 0);
+    if (!ret)
+        return NULL;
+
+    FOR_NSCREENS_FORWARD(i) {
+        ScreenPtr screen;
+        if (Success != dixLookupWindow(&win, res->info[i].id, serverClient,
+                                       DixReadAccess))
+            goto out;
+
+        screen = win->drawable.pScreen;
+
+        RegionTranslate(ret, -screen->x, -screen->y);
+        if (!RegionUnion(ret, ret, &win->borderClip))
+            goto out;
+        RegionTranslate(ret, screen->x, screen->y);
+    }
+
+    return ret;
+
+out:
+    RegionDestroy(ret);
+    return NULL;
+}
+
+static void
+DamageExtFreeWindowClip(RegionPtr reg)
+{
+    if (reg != &PanoramiXScreenRegion)
+        RegionDestroy(reg);
+}
+#endif
+
+/*
+ * DamageSubtract intersects with borderClip, so we must reconstruct the
+ * protocol's perspective of same...
+ */
+static Bool
+DamageExtSubtract(DamageExtPtr pDamageExt, const RegionPtr pRegion)
+{
+    DamagePtr pDamage = pDamageExt->pDamage;
+
+#ifdef PANORAMIX
+    if (!noPanoramiXExtension) {
+        RegionPtr damage = DamageRegion(pDamage);
+        RegionSubtract(damage, damage, pRegion);
+
+        if (pDamageExt->pDrawable->type == DRAWABLE_WINDOW) {
+            DrawablePtr pDraw = pDamageExt->pDrawable;
+            RegionPtr clip = DamageExtSubtractWindowClip(pDamageExt);
+            if (clip) {
+                RegionTranslate(clip, -pDraw->x, -pDraw->y);
+                RegionIntersect(damage, damage, clip);
+                RegionTranslate(clip, pDraw->x, pDraw->y);
+                DamageExtFreeWindowClip(clip);
+            }
+        }
+
+        return RegionNotEmpty(damage);
+    }
+#endif
+
+    return DamageSubtract(pDamage, pRegion);
+}
+
 static int
 ProcDamageSubtract(ClientPtr client)
 {
@@ -260,7 +419,7 @@ ProcDamageSubtract(ClientPtr client)
         if (pRepair) {
             if (pParts)
                 RegionIntersect(pParts, DamageRegion(pDamage), pRepair);
-            if (DamageSubtract(pDamage, pRepair))
+            if (DamageExtSubtract(pDamageExt, pRepair))
                 DamageExtReport(pDamage, DamageRegion(pDamage),
                                 (void *) pDamageExt);
         }
@@ -270,6 +429,7 @@ ProcDamageSubtract(ClientPtr client)
             DamageEmpty(pDamage);
         }
     }
+
     return Success;
 }
 
@@ -307,11 +467,14 @@ static const int version_requests[] = {
 #define NUM_VERSION_REQUESTS   (sizeof (version_requests) / sizeof (version_requests[0]))
 
 static int (*ProcDamageVector[XDamageNumberRequests]) (ClientPtr) = {
-/*************** Version 1 ******************/
+    /*************** Version 1 ******************/
     ProcDamageQueryVersion,
-        ProcDamageCreate, ProcDamageDestroy, ProcDamageSubtract,
-/*************** Version 1.1 ****************/
-ProcDamageAdd,};
+    ProcDamageCreate,
+    ProcDamageDestroy,
+    ProcDamageSubtract,
+    /*************** Version 1.1 ****************/
+    ProcDamageAdd,
+};
 
 static int
 ProcDamageDispatch(ClientPtr client)
@@ -387,11 +550,14 @@ SProcDamageAdd(ClientPtr client)
 }
 
 static int (*SProcDamageVector[XDamageNumberRequests]) (ClientPtr) = {
-/*************** Version 1 ******************/
+    /*************** Version 1 ******************/
     SProcDamageQueryVersion,
-        SProcDamageCreate, SProcDamageDestroy, SProcDamageSubtract,
-/*************** Version 1.1 ****************/
-SProcDamageAdd,};
+    SProcDamageCreate,
+    SProcDamageDestroy,
+    SProcDamageSubtract,
+    /*************** Version 1.1 ****************/
+    SProcDamageAdd,
+};
 
 static int
 SProcDamageDispatch(ClientPtr client)
@@ -403,7 +569,7 @@ SProcDamageDispatch(ClientPtr client)
 }
 
 static void
-DamageClientCallback(CallbackListPtr *list, pointer closure, pointer data)
+DamageClientCallback(CallbackListPtr *list, void *closure, void *data)
 {
     NewClientInfoRec *clientinfo = (NewClientInfoRec *) data;
     ClientPtr pClient = clientinfo->client;
@@ -421,7 +587,7 @@ DamageResetProc(ExtensionEntry * extEntry)
 }
 
 static int
-FreeDamageExt(pointer value, XID did)
+FreeDamageExt(void *value, XID did)
 {
     DamageExtPtr pDamageExt = (DamageExtPtr) value;
 
@@ -429,26 +595,13 @@ FreeDamageExt(pointer value, XID did)
      * Get rid of the resource table entry hanging from the window id
      */
     pDamageExt->id = 0;
-    if (WindowDrawable(pDamageExt->pDrawable->type))
-        FreeResourceByType(pDamageExt->pDrawable->id, DamageExtWinType, TRUE);
     if (pDamageExt->pDamage) {
-        DamageUnregister(pDamageExt->pDrawable, pDamageExt->pDamage);
         DamageDestroy(pDamageExt->pDamage);
     }
     free(pDamageExt);
     return Success;
 }
 
-static int
-FreeDamageExtWin(pointer value, XID wid)
-{
-    DamageExtPtr pDamageExt = (DamageExtPtr) value;
-
-    if (pDamageExt->id)
-        FreeResource(pDamageExt->id, RT_NONE);
-    return Success;
-}
-
 static void
 SDamageNotifyEvent(xDamageNotifyEvent * from, xDamageNotifyEvent * to)
 {
@@ -466,6 +619,127 @@ SDamageNotifyEvent(xDamageNotifyEvent * from, xDamageNotifyEvent * to)
     cpswaps(from->geometry.height, to->geometry.height);
 }
 
+#ifdef PANORAMIX
+
+static void
+PanoramiXDamageReport(DamagePtr pDamage, RegionPtr pRegion, void *closure)
+{
+    PanoramiXDamageRes *res = closure;
+    DamageExtPtr pDamageExt = res->ext;
+    WindowPtr pWin = (WindowPtr)pDamage->pDrawable;
+    ScreenPtr pScreen = pDamage->pScreen;
+
+    /* happens on unmap? sigh xinerama */
+    if (RegionNil(pRegion))
+        return;
+
+    /* translate root windows if necessary */
+    if (!pWin->parent)
+        RegionTranslate(pRegion, pScreen->x, pScreen->y);
+
+    /* add our damage to the protocol view */
+    DamageReportDamage(pDamageExt->pDamage, pRegion);
+
+    /* empty our view */
+    DamageEmpty(pDamage);
+}
+
+static void
+PanoramiXDamageExtDestroy(DamagePtr pDamage, void *closure)
+{
+    PanoramiXDamageRes *damage = closure;
+    damage->damage[pDamage->pScreen->myNum] = NULL;
+}
+
+static int
+PanoramiXDamageCreate(ClientPtr client)
+{
+    PanoramiXDamageRes *damage;
+    PanoramiXRes *draw;
+    int i, rc;
+
+    REQUEST(xDamageCreateReq);
+
+    REQUEST_SIZE_MATCH(xDamageCreateReq);
+    LEGAL_NEW_RESOURCE(stuff->damage, client);
+    rc = dixLookupResourceByClass((void **)&draw, stuff->drawable, XRC_DRAWABLE,
+                                  client, DixGetAttrAccess | DixReadAccess);
+    if (rc != Success)
+        return rc;
+
+    if (!(damage = calloc(1, sizeof(PanoramiXDamageRes))))
+        return BadAlloc;
+
+    if (!AddResource(stuff->damage, XRT_DAMAGE, damage))
+        return BadAlloc;
+
+    damage->ext = doDamageCreate(client, &rc);
+    if (rc == Success && draw->type == XRT_WINDOW) {
+        FOR_NSCREENS_FORWARD(i) {
+            DrawablePtr pDrawable;
+            DamagePtr pDamage = DamageCreate(PanoramiXDamageReport,
+                                             PanoramiXDamageExtDestroy,
+                                             DamageReportRawRegion,
+                                             FALSE,
+                                             screenInfo.screens[i],
+                                             damage);
+            if (!pDamage) {
+                rc = BadAlloc;
+            } else {
+                damage->damage[i] = pDamage;
+                rc = dixLookupDrawable(&pDrawable, draw->info[i].id, client,
+                                       M_WINDOW,
+                                       DixGetAttrAccess | DixReadAccess);
+            }
+            if (rc != Success)
+                break;
+
+            DamageExtRegister(pDrawable, pDamage, i != 0);
+        }
+    }
+
+    if (rc != Success)
+        FreeResource(stuff->damage, RT_NONE);
+
+    return rc;
+}
+
+static int
+PanoramiXDamageDelete(void *res, XID id)
+{
+    int i;
+    PanoramiXDamageRes *damage = res;
+
+    FOR_NSCREENS_BACKWARD(i) {
+        if (damage->damage[i]) {
+            DamageDestroy(damage->damage[i]);
+            damage->damage[i] = NULL;
+        }
+    }
+
+    free(damage);
+    return 1;
+}
+
+void
+PanoramiXDamageInit(void)
+{
+    XRT_DAMAGE = CreateNewResourceType(PanoramiXDamageDelete, "XineramaDamage");
+    if (!XRT_DAMAGE)
+        FatalError("Couldn't Xineramify Damage extension\n");
+
+    PanoramiXSaveDamageCreate = ProcDamageVector[X_DamageCreate];
+    ProcDamageVector[X_DamageCreate] = PanoramiXDamageCreate;
+}
+
+void
+PanoramiXDamageReset(void)
+{
+    ProcDamageVector[X_DamageCreate] = PanoramiXSaveDamageCreate;
+}
+
+#endif /* PANORAMIX */
+
 void
 DamageExtensionInit(void)
 {
@@ -479,10 +753,6 @@ DamageExtensionInit(void)
     if (!DamageExtType)
         return;
 
-    DamageExtWinType = CreateNewResourceType(FreeDamageExtWin, "DamageExtWin");
-    if (!DamageExtWinType)
-        return;
-
     if (!dixRegisterPrivateKey
         (&DamageClientPrivateKeyRec, PRIVATE_CLIENT, sizeof(DamageClientRec)))
         return;
@@ -500,5 +770,10 @@ DamageExtensionInit(void)
             (EventSwapPtr) SDamageNotifyEvent;
         SetResourceTypeErrorValue(DamageExtType,
                                   extEntry->errorBase + BadDamage);
+#ifdef PANORAMIX
+        if (XRT_DAMAGE)
+            SetResourceTypeErrorValue(XRT_DAMAGE,
+                                      extEntry->errorBase + BadDamage);
+#endif
     }
 }
index 2723379..7a7096d 100644 (file)
@@ -58,7 +58,7 @@ typedef struct _DamageExt {
 } DamageExtRec, *DamageExtPtr;
 
 #define VERIFY_DAMAGEEXT(pDamageExt, rid, client, mode) { \
-    int rc = dixLookupResourceByType((pointer *)&(pDamageExt), rid, \
+    int rc = dixLookupResourceByType((void **)&(pDamageExt), rid, \
                                      DamageExtType, client, mode); \
     if (rc != Success) \
         return rc; \
@@ -67,4 +67,7 @@ typedef struct _DamageExt {
 void
  DamageExtSetCritical(ClientPtr pClient, Bool critical);
 
+void PanoramiXDamageInit(void);
+void PanoramiXDamageReset(void);
+
 #endif                          /* _DAMAGEEXTINT_H_ */
index 043555b..7d034c7 100644 (file)
@@ -9,5 +9,4 @@ endif
 libdbe_la_SOURCES = \
         dbe.c \
         midbe.c \
-        midbe.h \
-        midbestr.h
+        midbe.h
index 9039d80..8896720 100644 (file)
--- a/dbe/dbe.c
+++ b/dbe/dbe.c
@@ -90,10 +90,7 @@ DbeStubScreen(DbeScreenPrivPtr pDbeScreenPriv, int *nStubbedScreens)
     pDbeScreenPriv->GetVisualInfo = NULL;
     pDbeScreenPriv->AllocBackBufferName = NULL;
     pDbeScreenPriv->SwapBuffers = NULL;
-    pDbeScreenPriv->BeginIdiom = NULL;
-    pDbeScreenPriv->EndIdiom = NULL;
     pDbeScreenPriv->WinPrivDelete = NULL;
-    pDbeScreenPriv->ResetProc = NULL;
 
     (*nStubbedScreens)++;
 
@@ -232,8 +229,7 @@ ProcDbeAllocateBackBufferName(ClientPtr client)
          * Allocate a window priv.
          */
 
-        pDbeWindowPriv =
-            dixAllocateObjectWithPrivates(DbeWindowPrivRec, PRIVATE_DBE_WINDOW);
+        pDbeWindowPriv = calloc(1, sizeof(DbeWindowPrivRec));
         if (!pDbeWindowPriv)
             return BadAlloc;
 
@@ -326,7 +322,7 @@ ProcDbeAllocateBackBufferName(ClientPtr client)
     if (status == Success) {
         pDbeWindowPriv->IDs[add_index] = stuff->buffer;
         if (!AddResource(stuff->buffer, dbeWindowPrivResType,
-                         (pointer) pDbeWindowPriv)) {
+                         (void *) pDbeWindowPriv)) {
             pDbeWindowPriv->IDs[add_index] = DBE_FREE_ID_ELEMENT;
 
             if (pDbeWindowPriv->nBufferIDs == 0) {
@@ -382,12 +378,12 @@ ProcDbeDeallocateBackBufferName(ClientPtr client)
     REQUEST(xDbeDeallocateBackBufferNameReq);
     DbeWindowPrivPtr pDbeWindowPriv;
     int rc, i;
-    pointer val;
+    void *val;
 
     REQUEST_SIZE_MATCH(xDbeDeallocateBackBufferNameReq);
 
     /* Buffer name must be valid */
-    rc = dixLookupResourceByType((pointer *) &pDbeWindowPriv, stuff->buffer,
+    rc = dixLookupResourceByType((void **) &pDbeWindowPriv, stuff->buffer,
                                  dbeWindowPrivResType, client,
                                  DixDestroyAccess);
     if (rc != Success)
@@ -545,44 +541,6 @@ ProcDbeSwapBuffers(ClientPtr client)
 \f
 /******************************************************************************
  *
- * DBE DIX Procedure: ProcDbeBeginIdiom
- *
- * Description:
- *
- *     This function is for processing a DbeBeginIdiom request.
- *     This request informs the server that a complex swap will immediately
- *     follow this request.
- *
- * Return Values:
- *
- *     Success
- *
- *****************************************************************************/
-
-static int
-ProcDbeBeginIdiom(ClientPtr client)
-{
-    /* REQUEST(xDbeBeginIdiomReq); */
-    DbeScreenPrivPtr pDbeScreenPriv;
-    register int i;
-
-    REQUEST_SIZE_MATCH(xDbeBeginIdiomReq);
-
-    for (i = 0; i < screenInfo.numScreens; i++) {
-        pDbeScreenPriv = DBE_SCREEN_PRIV(screenInfo.screens[i]);
-
-        /* Call the DDX begin idiom procedure if there is one. */
-        if (pDbeScreenPriv->BeginIdiom) {
-            (*pDbeScreenPriv->BeginIdiom) (client);
-        }
-    }
-
-    return Success;
-
-}                               /* ProcDbeBeginIdiom() */
-\f
-/******************************************************************************
- *
  * DBE DIX Procedure: ProcDbeGetVisualInfo
  *
  * Description:
@@ -768,7 +726,7 @@ ProcDbeGetBackBufferAttributes(ClientPtr client)
 
     REQUEST_SIZE_MATCH(xDbeGetBackBufferAttributesReq);
 
-    rc = dixLookupResourceByType((pointer *) &pDbeWindowPriv, stuff->buffer,
+    rc = dixLookupResourceByType((void **) &pDbeWindowPriv, stuff->buffer,
                                  dbeWindowPrivResType, client,
                                  DixGetAttrAccess);
     if (rc == Success) {
@@ -818,7 +776,7 @@ ProcDbeDispatch(ClientPtr client)
         return (ProcDbeSwapBuffers(client));
 
     case X_DbeBeginIdiom:
-        return (ProcDbeBeginIdiom(client));
+        return Success;
 
     case X_DbeEndIdiom:
         return Success;
@@ -982,32 +940,6 @@ SProcDbeSwapBuffers(ClientPtr client)
 \f
 /******************************************************************************
  *
- * DBE DIX Procedure: SProcDbeBeginIdiom
- *
- * Description:
- *
- *     This function is for processing a DbeBeginIdiom request on a swapped
- *     server.  This request informs the server that a complex swap will
- *     immediately follow this request.
- *
- * Return Values:
- *
- *     Success
- *
- *****************************************************************************/
-
-static int
-SProcDbeBeginIdiom(ClientPtr client)
-{
-    REQUEST(xDbeBeginIdiomReq);
-
-    swaps(&stuff->length);
-    return (ProcDbeBeginIdiom(client));
-
-}                               /* SProcDbeBeginIdiom() */
-\f
-/******************************************************************************
- *
  * DBE DIX Procedure: SProcDbeGetVisualInfo
  *
  * Description:
@@ -1097,7 +1029,7 @@ SProcDbeDispatch(ClientPtr client)
         return (SProcDbeSwapBuffers(client));
 
     case X_DbeBeginIdiom:
-        return (SProcDbeBeginIdiom(client));
+        return Success;
 
     case X_DbeEndIdiom:
         return Success;
@@ -1193,7 +1125,7 @@ DbeSetupBackgroundPainter(WindowPtr pWin, GCPtr pGC)
  *
  *****************************************************************************/
 static int
-DbeDrawableDelete(pointer pDrawable, XID id)
+DbeDrawableDelete(void *pDrawable, XID id)
 {
     return Success;
 
@@ -1211,7 +1143,7 @@ DbeDrawableDelete(pointer pDrawable, XID id)
  *
  *****************************************************************************/
 static int
-DbeWindowPrivDelete(pointer pDbeWinPriv, XID id)
+DbeWindowPrivDelete(void *pDbeWinPriv, XID id)
 {
     DbeScreenPrivPtr pDbeScreenPriv;
     DbeWindowPrivPtr pDbeWindowPriv = (DbeWindowPrivPtr) pDbeWinPriv;
@@ -1289,7 +1221,7 @@ DbeWindowPrivDelete(pointer pDbeWinPriv, XID id)
                       NULL);
 
         /* We are done with the window priv. */
-        dixFreeObjectWithPrivates(pDbeWindowPriv, PRIVATE_DBE_WINDOW);
+        free(pDbeWindowPriv);
     }
 
     return Success;
@@ -1321,10 +1253,7 @@ DbeResetProc(ExtensionEntry * extEntry)
         if (pDbeScreenPriv) {
             /* Unwrap DestroyWindow, which was wrapped in DbeExtensionInit(). */
             pScreen->DestroyWindow = pDbeScreenPriv->DestroyWindow;
-
-            if (pDbeScreenPriv->ResetProc)
-                (*pDbeScreenPriv->ResetProc) (pScreen);
-
+            pScreen->PositionWindow = pDbeScreenPriv->PositionWindow;
             free(pDbeScreenPriv);
         }
     }
index f9d938a..2002066 100644 (file)
@@ -143,6 +143,20 @@ typedef struct _DbeWindowPrivRec {
      */
     XID initIDs[DBE_INIT_MAX_IDS];
 
+    /* Pointer to a drawable that contains the contents of the back buffer.
+     */
+    PixmapPtr pBackBuffer;
+
+    /* Pointer to a drawable that contains the contents of the front buffer.
+     * This pointer is only used for the XdbeUntouched swap action.  For that
+     * swap action, we need to copy the front buffer (window) contents into
+     * this drawable, copy the contents of current back buffer drawable (the
+     * back buffer) into the window, swap the front and back drawable pointers,
+     * and then swap the drawable/resource associations in the resource
+     * database.
+     */
+    PixmapPtr pFrontBuffer;
+
     /* Device-specific private information.
      */
     PrivateRec *devPrivates;
@@ -180,16 +194,9 @@ typedef struct _DbeScreenPrivRec {
                         int * /*pNumWindows */ ,
                         DbeSwapInfoPtr  /*swapInfo */
         );
-    void (*BeginIdiom) (ClientPtr       /*client */
-        );
-    void (*EndIdiom) (ClientPtr /*client */
-        );
     void (*WinPrivDelete) (DbeWindowPrivPtr /*pDbeWindowPriv */ ,
                            XID  /*bufId */
         );
-    void (*ResetProc) (ScreenPtr        /*pScreen */
-        );
-
 } DbeScreenPrivRec, *DbeScreenPrivPtr;
 
 #endif                          /* DBE_STRUCT_H */
index d810d99..0479ecc 100644 (file)
@@ -48,7 +48,6 @@
 #include "resource.h"
 #include "opaque.h"
 #include "dbestruct.h"
-#include "midbestr.h"
 #include "regionstr.h"
 #include "gcstruct.h"
 #include "inputstr.h"
@@ -57,9 +56,6 @@
 
 #include <stdio.h>
 
-static DevPrivateKeyRec miDbeWindowPrivPrivKeyRec;
-
-#define miDbeWindowPrivPrivKey (&miDbeWindowPrivPrivKeyRec)
 \f
 /******************************************************************************
  *
@@ -138,7 +134,6 @@ miDbeAllocBackBufferName(WindowPtr pWin, XID bufId, int swapAction)
 {
     ScreenPtr pScreen;
     DbeWindowPrivPtr pDbeWindowPriv;
-    MiDbeWindowPrivPrivPtr pDbeWindowPrivPriv;
     DbeScreenPrivPtr pDbeScreenPriv;
     GCPtr pGC;
     xRectangle clearRect;
@@ -156,12 +151,8 @@ miDbeAllocBackBufferName(WindowPtr pWin, XID bufId, int swapAction)
 
         pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen);
 
-        /* Setup the window priv priv. */
-        pDbeWindowPrivPriv = MI_DBE_WINDOW_PRIV_PRIV(pDbeWindowPriv);
-        pDbeWindowPrivPriv->pDbeWindowPriv = pDbeWindowPriv;
-
         /* Get a front pixmap. */
-        if (!(pDbeWindowPrivPriv->pFrontBuffer =
+        if (!(pDbeWindowPriv->pFrontBuffer =
               (*pScreen->CreatePixmap) (pScreen, pDbeWindowPriv->width,
                                         pDbeWindowPriv->height,
                                         pWin->drawable.depth, 0))) {
@@ -169,22 +160,22 @@ miDbeAllocBackBufferName(WindowPtr pWin, XID bufId, int swapAction)
         }
 
         /* Get a back pixmap. */
-        if (!(pDbeWindowPrivPriv->pBackBuffer =
+        if (!(pDbeWindowPriv->pBackBuffer =
               (*pScreen->CreatePixmap) (pScreen, pDbeWindowPriv->width,
                                         pDbeWindowPriv->height,
                                         pWin->drawable.depth, 0))) {
-            (*pScreen->DestroyPixmap) (pDbeWindowPrivPriv->pFrontBuffer);
+            (*pScreen->DestroyPixmap) (pDbeWindowPriv->pFrontBuffer);
             return BadAlloc;
         }
 
         /* Security creation/labeling check. */
         rc = XaceHook(XACE_RESOURCE_ACCESS, serverClient, bufId,
-                      dbeDrawableResType, pDbeWindowPrivPriv->pBackBuffer,
+                      dbeDrawableResType, pDbeWindowPriv->pBackBuffer,
                       RT_WINDOW, pWin, DixCreateAccess);
 
         /* Make the back pixmap a DBE drawable resource. */
         if (rc != Success || !AddResource(bufId, dbeDrawableResType,
-                                          pDbeWindowPrivPriv->pBackBuffer)) {
+                                          pDbeWindowPriv->pBackBuffer)) {
             /* free the buffer and the drawable resource */
             FreeResource(bufId, RT_NONE);
             return (rc == Success) ? BadAlloc : rc;
@@ -193,11 +184,11 @@ miDbeAllocBackBufferName(WindowPtr pWin, XID bufId, int swapAction)
         /* Clear the back buffer. */
         pGC = GetScratchGC(pWin->drawable.depth, pWin->drawable.pScreen);
         if ((*pDbeScreenPriv->SetupBackgroundPainter) (pWin, pGC)) {
-            ValidateGC((DrawablePtr) pDbeWindowPrivPriv->pBackBuffer, pGC);
+            ValidateGC((DrawablePtr) pDbeWindowPriv->pBackBuffer, pGC);
             clearRect.x = clearRect.y = 0;
-            clearRect.width = pDbeWindowPrivPriv->pBackBuffer->drawable.width;
-            clearRect.height = pDbeWindowPrivPriv->pBackBuffer->drawable.height;
-            (*pGC->ops->PolyFillRect) ((DrawablePtr) pDbeWindowPrivPriv->
+            clearRect.width = pDbeWindowPriv->pBackBuffer->drawable.width;
+            clearRect.height = pDbeWindowPriv->pBackBuffer->drawable.height;
+            (*pGC->ops->PolyFillRect) ((DrawablePtr) pDbeWindowPriv->
                                        pBackBuffer, pGC, 1, &clearRect);
         }
         FreeScratchGC(pGC);
@@ -210,9 +201,8 @@ miDbeAllocBackBufferName(WindowPtr pWin, XID bufId, int swapAction)
          */
 
         /* Associate the new ID with an existing pixmap. */
-        pDbeWindowPrivPriv = MI_DBE_WINDOW_PRIV_PRIV(pDbeWindowPriv);
         if (!AddResource(bufId, dbeDrawableResType,
-                         (pointer) pDbeWindowPrivPriv->pBackBuffer)) {
+                         (void *) pDbeWindowPriv->pBackBuffer)) {
             return BadAlloc;
         }
 
@@ -237,12 +227,10 @@ static void
 miDbeAliasBuffers(DbeWindowPrivPtr pDbeWindowPriv)
 {
     int i;
-    MiDbeWindowPrivPrivPtr pDbeWindowPrivPriv =
-        MI_DBE_WINDOW_PRIV_PRIV(pDbeWindowPriv);
 
     for (i = 0; i < pDbeWindowPriv->nBufferIDs; i++) {
         ChangeResourceValue(pDbeWindowPriv->IDs[i], dbeDrawableResType,
-                            (pointer) pDbeWindowPrivPriv->pBackBuffer);
+                            (void *) pDbeWindowPriv->pBackBuffer);
     }
 
 }                               /* miDbeAliasBuffers() */
@@ -261,15 +249,15 @@ static int
 miDbeSwapBuffers(ClientPtr client, int *pNumWindows, DbeSwapInfoPtr swapInfo)
 {
     DbeScreenPrivPtr pDbeScreenPriv;
+    DbeWindowPrivPtr pDbeWindowPriv;
     GCPtr pGC;
     WindowPtr pWin;
-    MiDbeWindowPrivPrivPtr pDbeWindowPrivPriv;
     PixmapPtr pTmpBuffer;
     xRectangle clearRect;
 
     pWin = swapInfo[0].pWindow;
     pDbeScreenPriv = DBE_SCREEN_PRIV_FROM_WINDOW(pWin);
-    pDbeWindowPrivPriv = MI_DBE_WINDOW_PRIV_PRIV_FROM_WINDOW(pWin);
+    pDbeWindowPriv = DBE_WINDOW_PRIV(pWin);
     pGC = GetScratchGC(pWin->drawable.depth, pWin->drawable.pScreen);
 
     /*
@@ -286,9 +274,9 @@ miDbeSwapBuffers(ClientPtr client, int *pNumWindows, DbeSwapInfoPtr swapInfo)
         break;
 
     case XdbeUntouched:
-        ValidateGC((DrawablePtr) pDbeWindowPrivPriv->pFrontBuffer, pGC);
+        ValidateGC((DrawablePtr) pDbeWindowPriv->pFrontBuffer, pGC);
         (*pGC->ops->CopyArea) ((DrawablePtr) pWin,
-                               (DrawablePtr) pDbeWindowPrivPriv->pFrontBuffer,
+                               (DrawablePtr) pDbeWindowPriv->pFrontBuffer,
                                pGC, 0, 0, pWin->drawable.width,
                                pWin->drawable.height, 0, 0);
         break;
@@ -305,7 +293,7 @@ miDbeSwapBuffers(ClientPtr client, int *pNumWindows, DbeSwapInfoPtr swapInfo)
      */
 
     ValidateGC((DrawablePtr) pWin, pGC);
-    (*pGC->ops->CopyArea) ((DrawablePtr) pDbeWindowPrivPriv->pBackBuffer,
+    (*pGC->ops->CopyArea) ((DrawablePtr) pDbeWindowPriv->pBackBuffer,
                            (DrawablePtr) pWin, pGC, 0, 0,
                            pWin->drawable.width, pWin->drawable.height, 0, 0);
 
@@ -321,23 +309,23 @@ miDbeSwapBuffers(ClientPtr client, int *pNumWindows, DbeSwapInfoPtr swapInfo)
 
     case XdbeBackground:
         if ((*pDbeScreenPriv->SetupBackgroundPainter) (pWin, pGC)) {
-            ValidateGC((DrawablePtr) pDbeWindowPrivPriv->pBackBuffer, pGC);
+            ValidateGC((DrawablePtr) pDbeWindowPriv->pBackBuffer, pGC);
             clearRect.x = 0;
             clearRect.y = 0;
-            clearRect.width = pDbeWindowPrivPriv->pBackBuffer->drawable.width;
-            clearRect.height = pDbeWindowPrivPriv->pBackBuffer->drawable.height;
-            (*pGC->ops->PolyFillRect) ((DrawablePtr) pDbeWindowPrivPriv->
+            clearRect.width = pDbeWindowPriv->pBackBuffer->drawable.width;
+            clearRect.height = pDbeWindowPriv->pBackBuffer->drawable.height;
+            (*pGC->ops->PolyFillRect) ((DrawablePtr) pDbeWindowPriv->
                                        pBackBuffer, pGC, 1, &clearRect);
         }
         break;
 
     case XdbeUntouched:
         /* Swap pixmap pointers. */
-        pTmpBuffer = pDbeWindowPrivPriv->pBackBuffer;
-        pDbeWindowPrivPriv->pBackBuffer = pDbeWindowPrivPriv->pFrontBuffer;
-        pDbeWindowPrivPriv->pFrontBuffer = pTmpBuffer;
+        pTmpBuffer = pDbeWindowPriv->pBackBuffer;
+        pDbeWindowPriv->pBackBuffer = pDbeWindowPriv->pFrontBuffer;
+        pDbeWindowPriv->pFrontBuffer = pTmpBuffer;
 
-        miDbeAliasBuffers(pDbeWindowPrivPriv->pDbeWindowPriv);
+        miDbeAliasBuffers(pDbeWindowPriv);
 
         break;
 
@@ -427,8 +415,6 @@ miDbeSwapBuffers(ClientPtr client, int *pNumWindows, DbeSwapInfoPtr swapInfo)
 static void
 miDbeWinPrivDelete(DbeWindowPrivPtr pDbeWindowPriv, XID bufId)
 {
-    MiDbeWindowPrivPrivPtr pDbeWindowPrivPriv;
-
     if (pDbeWindowPriv->nBufferIDs != 0) {
         /* We still have at least one more buffer ID associated with this
          * window.
@@ -440,18 +426,15 @@ miDbeWinPrivDelete(DbeWindowPrivPtr pDbeWindowPriv, XID bufId)
      * free some stuff.
      */
 
-    pDbeWindowPrivPriv = MI_DBE_WINDOW_PRIV_PRIV(pDbeWindowPriv);
-
     /* Destroy the front and back pixmaps. */
-    if (pDbeWindowPrivPriv->pFrontBuffer) {
+    if (pDbeWindowPriv->pFrontBuffer) {
         (*pDbeWindowPriv->pWindow->drawable.pScreen->
-         DestroyPixmap) (pDbeWindowPrivPriv->pFrontBuffer);
+         DestroyPixmap) (pDbeWindowPriv->pFrontBuffer);
     }
-    if (pDbeWindowPrivPriv->pBackBuffer) {
+    if (pDbeWindowPriv->pBackBuffer) {
         (*pDbeWindowPriv->pWindow->drawable.pScreen->
-         DestroyPixmap) (pDbeWindowPrivPriv->pBackBuffer);
+         DestroyPixmap) (pDbeWindowPriv->pBackBuffer);
     }
-
 }                               /* miDbeWinPrivDelete() */
 \f
 /******************************************************************************
@@ -627,10 +610,6 @@ miDbePositionWindow(WindowPtr pWin, int x, int y)
     else {
         /* Clear out the new DBE buffer pixmaps. */
 
-        MiDbeWindowPrivPrivPtr pDbeWindowPrivPriv;
-
-        pDbeWindowPrivPriv = MI_DBE_WINDOW_PRIV_PRIV(pDbeWindowPriv);
-
         /* I suppose this could avoid quite a bit of work if
          * it computed the minimal area required.
          */
@@ -641,9 +620,9 @@ miDbePositionWindow(WindowPtr pWin, int x, int y)
         }
         /* Copy the contents of the old front pixmap to the new one. */
         if (pWin->bitGravity != ForgetGravity) {
-            (*pGC->ops->CopyArea) ((DrawablePtr) pDbeWindowPrivPriv->
-                                   pFrontBuffer, (DrawablePtr) pFrontBuffer,
-                                   pGC, sourcex, sourcey, savewidth, saveheight,
+            (*pGC->ops->CopyArea) ((DrawablePtr) pDbeWindowPriv->pFrontBuffer,
+                                  (DrawablePtr) pFrontBuffer, pGC,
+                                  sourcex, sourcey, savewidth, saveheight,
                                    destx, desty);
         }
 
@@ -654,8 +633,8 @@ miDbePositionWindow(WindowPtr pWin, int x, int y)
         }
         /* Copy the contents of the old back pixmap to the new one. */
         if (pWin->bitGravity != ForgetGravity) {
-            (*pGC->ops->CopyArea) ((DrawablePtr) pDbeWindowPrivPriv->
-                                   pBackBuffer, (DrawablePtr) pBackBuffer, pGC,
+            (*pGC->ops->CopyArea) ((DrawablePtr) pDbeWindowPriv->pBackBuffer,
+                                  (DrawablePtr) pBackBuffer, pGC,
                                    sourcex, sourcey, savewidth, saveheight,
                                    destx, desty);
         }
@@ -664,11 +643,11 @@ miDbePositionWindow(WindowPtr pWin, int x, int y)
          * pixmaps.
          */
 
-        (*pScreen->DestroyPixmap) (pDbeWindowPrivPriv->pFrontBuffer);
-        (*pScreen->DestroyPixmap) (pDbeWindowPrivPriv->pBackBuffer);
+        (*pScreen->DestroyPixmap) (pDbeWindowPriv->pFrontBuffer);
+        (*pScreen->DestroyPixmap) (pDbeWindowPriv->pBackBuffer);
 
-        pDbeWindowPrivPriv->pFrontBuffer = pFrontBuffer;
-        pDbeWindowPrivPriv->pBackBuffer = pBackBuffer;
+        pDbeWindowPriv->pFrontBuffer = pFrontBuffer;
+        pDbeWindowPriv->pBackBuffer = pBackBuffer;
 
         /* Make sure all XID are associated with the new back pixmap. */
         miDbeAliasBuffers(pDbeWindowPriv);
@@ -682,30 +661,6 @@ miDbePositionWindow(WindowPtr pWin, int x, int y)
 \f
 /******************************************************************************
  *
- * DBE MI Procedure: miDbeResetProc
- *
- * Description:
- *
- *     This function is called from DbeResetProc(), which is called at the end
- *     of every server generation.  This function peforms any MI-specific
- *     shutdown tasks.
- *
- *****************************************************************************/
-
-static void
-miDbeResetProc(ScreenPtr pScreen)
-{
-    DbeScreenPrivPtr pDbeScreenPriv;
-
-    pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen);
-
-    /* Unwrap wrappers */
-    pScreen->PositionWindow = pDbeScreenPriv->PositionWindow;
-
-}                               /* miDbeResetProc() */
-\f
-/******************************************************************************
- *
  * DBE MI Procedure: miDbeInit
  *
  * Description:
@@ -717,10 +672,6 @@ miDbeResetProc(ScreenPtr pScreen)
 Bool
 miDbeInit(ScreenPtr pScreen, DbeScreenPrivPtr pDbeScreenPriv)
 {
-    if (!dixRegisterPrivateKey(&miDbeWindowPrivPrivKeyRec, PRIVATE_DBE_WINDOW,
-                               sizeof(MiDbeWindowPrivPrivRec)))
-        return FALSE;
-
     /* Wrap functions. */
     pDbeScreenPriv->PositionWindow = pScreen->PositionWindow;
     pScreen->PositionWindow = miDbePositionWindow;
@@ -729,9 +680,6 @@ miDbeInit(ScreenPtr pScreen, DbeScreenPrivPtr pDbeScreenPriv)
     pDbeScreenPriv->GetVisualInfo = miDbeGetVisualInfo;
     pDbeScreenPriv->AllocBackBufferName = miDbeAllocBackBufferName;
     pDbeScreenPriv->SwapBuffers = miDbeSwapBuffers;
-    pDbeScreenPriv->BeginIdiom = 0;
-    pDbeScreenPriv->EndIdiom = 0;
-    pDbeScreenPriv->ResetProc = miDbeResetProc;
     pDbeScreenPriv->WinPrivDelete = miDbeWinPrivDelete;
 
     return TRUE;
diff --git a/dbe/midbestr.h b/dbe/midbestr.h
deleted file mode 100644 (file)
index 70017b0..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-/******************************************************************************
- * 
- * Copyright (c) 1994, 1995  Hewlett-Packard Company
- *
- * 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 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 HEWLETT-PACKARD COMPANY 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.
- * 
- * Except as contained in this notice, the name of the Hewlett-Packard
- * Company shall not be used in advertising or otherwise to promote the
- * sale, use or other dealings in this Software without prior written
- * authorization from the Hewlett-Packard Company.
- * 
- *     Header file for users of machine-independent DBE code
- * 
- *****************************************************************************/
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#ifndef MIDBE_STRUCT_H
-#define MIDBE_STRUCT_H
-
-/* DEFINES */
-
-#define MI_DBE_WINDOW_PRIV_PRIV(pDbeWindowPriv) \
-    (!(pDbeWindowPriv) ? NULL : (MiDbeWindowPrivPrivPtr) \
-     dixLookupPrivate(&(pDbeWindowPriv)->devPrivates, miDbeWindowPrivPrivKey))
-
-#define MI_DBE_WINDOW_PRIV_PRIV_FROM_WINDOW(pWin)\
-    MI_DBE_WINDOW_PRIV_PRIV(DBE_WINDOW_PRIV(pWin))
-
-/* TYPEDEFS */
-
-typedef struct _MiDbeWindowPrivPrivRec {
-    /* Place machine-specific fields in here.
-     * Since this is mi code, we do not really have machine-specific fields.
-     */
-
-    /* Pointer to a drawable that contains the contents of the back buffer.
-     */
-    PixmapPtr pBackBuffer;
-
-    /* Pointer to a drawable that contains the contents of the front buffer.
-     * This pointer is only used for the XdbeUntouched swap action.  For that
-     * swap action, we need to copy the front buffer (window) contents into
-     * this drawable, copy the contents of current back buffer drawable (the
-     * back buffer) into the window, swap the front and back drawable pointers,
-     * and then swap the drawable/resource associations in the resource
-     * database.
-     */
-    PixmapPtr pFrontBuffer;
-
-    /* Pointer back to our window private with which we are associated. */
-    DbeWindowPrivPtr pDbeWindowPriv;
-
-} MiDbeWindowPrivPrivRec, *MiDbeWindowPrivPrivPtr;
-
-#endif                          /* MIDBE_STRUCT_H */
index b7358aa..e7ca236 100644 (file)
@@ -4,7 +4,7 @@ AM_CPPFLAGS = -I$(top_srcdir)/include
 AM_CFLAGS = $(DIX_CFLAGS)
 
 libmain_la_SOURCES =    \
-       main.c
+       stubmain.c
 
 libdix_la_SOURCES =    \
        atom.c          \
@@ -14,6 +14,7 @@ libdix_la_SOURCES =   \
        dispatch.c      \
        dispatch.h      \
        dixfonts.c      \
+       main.c          \
        dixutils.c      \
        enterleave.c    \
        enterleave.h    \
index a43e279..c1ff88e 100644 (file)
@@ -367,7 +367,7 @@ CreateColormap(Colormap mid, ScreenPtr pScreen, VisualPtr pVisual,
     }
     pmap->flags |= BeingCreated;
 
-    if (!AddResource(mid, RT_COLORMAP, (pointer) pmap))
+    if (!AddResource(mid, RT_COLORMAP, (void *) pmap))
         return BadAlloc;
 
     /*  
@@ -397,7 +397,7 @@ CreateColormap(Colormap mid, ScreenPtr pScreen, VisualPtr pVisual,
  * \param value  must conform to DeleteType
  */
 int
-FreeColormap(pointer value, XID mid)
+FreeColormap(void *value, XID mid)
 {
     int i;
     EntryPtr pent;
@@ -405,7 +405,7 @@ FreeColormap(pointer value, XID mid)
 
     if (CLIENT_ID(mid) != SERVER_ID) {
         (*pmap->pScreen->UninstallColormap) (pmap);
-        WalkTree(pmap->pScreen, (VisitWindowProcPtr) TellNoMap, (pointer) &mid);
+        WalkTree(pmap->pScreen, (VisitWindowProcPtr) TellNoMap, (void *) &mid);
     }
 
     /* This is the device's chance to undo anything it needs to, especially
@@ -474,7 +474,7 @@ TellNoMap(WindowPtr pwin, Colormap * pmid)
 
 /* Tell window that pmid got uninstalled */
 int
-TellLostMap(WindowPtr pwin, pointer value)
+TellLostMap(WindowPtr pwin, void *value)
 {
     Colormap *pmid = (Colormap *) value;
 
@@ -499,7 +499,7 @@ TellLostMap(WindowPtr pwin, pointer value)
 
 /* Tell window that pmid got installed */
 int
-TellGainedMap(WindowPtr pwin, pointer value)
+TellGainedMap(WindowPtr pwin, void *value)
 {
     Colormap *pmid = (Colormap *) value;
 
@@ -658,15 +658,15 @@ FreeCell(ColormapPtr pmap, Pixel i, int channel)
     default:         /* so compiler can see that everything gets initialized */
     case PSEUDOMAP:
     case REDMAP:
-        pent = (EntryPtr) & pmap->red[i];
+        pent = (EntryPtr) &pmap->red[i];
         pCount = &pmap->freeRed;
         break;
     case GREENMAP:
-        pent = (EntryPtr) & pmap->green[i];
+        pent = (EntryPtr) &pmap->green[i];
         pCount = &pmap->freeGreen;
         break;
     case BLUEMAP:
-        pent = (EntryPtr) & pmap->blue[i];
+        pent = (EntryPtr) &pmap->blue[i];
         pCount = &pmap->freeBlue;
         break;
     }
@@ -845,7 +845,7 @@ AllocColor(ColormapPtr pmap,
             pmap->pVisual->vid == pmap->pScreen->rootVisual) {
             ColormapPtr prootmap;
 
-            dixLookupResourceByType((pointer *) &prootmap,
+            dixLookupResourceByType((void **) &prootmap,
                                     pmap->pScreen->defColormap, RT_COLORMAP,
                                     clients[client], DixReadAccess);
 
@@ -863,7 +863,7 @@ AllocColor(ColormapPtr pmap,
             pmap->pVisual->vid == pmap->pScreen->rootVisual) {
             ColormapPtr prootmap;
 
-            dixLookupResourceByType((pointer *) &prootmap,
+            dixLookupResourceByType((void **) &prootmap,
                                     pmap->pScreen->defColormap, RT_COLORMAP,
                                     clients[client], DixReadAccess);
 
@@ -917,7 +917,7 @@ AllocColor(ColormapPtr pmap,
         }
         pcr->mid = pmap->mid;
         pcr->client = client;
-        if (!AddResource(FakeClientID(client), RT_CMAPENTRY, (pointer) pcr))
+        if (!AddResource(FakeClientID(client), RT_CMAPENTRY, (void *) pcr))
             return BadAlloc;
     }
     return Success;
@@ -1400,7 +1400,7 @@ QueryColors(ColormapPtr pmap, int count, Pixel * ppixIn, xrgb * prgbList,
                 errVal = BadValue;
             }
             else {
-                pent = (EntryPtr) & pmap->red[pixel];
+                pent = (EntryPtr) &pmap->red[pixel];
                 if (pent->fShared) {
                     prgb->red = pent->co.shco.red->color;
                     prgb->green = pent->co.shco.green->color;
@@ -1463,9 +1463,9 @@ FreePixels(ColormapPtr pmap, int client)
  *  \unused fakeid
  */
 int
-FreeClientPixels(pointer value, XID fakeid)
+FreeClientPixels(void *value, XID fakeid)
 {
-    pointer pmap;
+    void *pmap;
     colorResource *pcr = value;
     int rc;
 
@@ -1532,7 +1532,7 @@ AllocColorCells(int client, ColormapPtr pmap, int colors, int planes,
     if ((ok == Success) && pcr) {
         pcr->mid = pmap->mid;
         pcr->client = client;
-        if (!AddResource(FakeClientID(client), RT_CMAPENTRY, (pointer) pcr))
+        if (!AddResource(FakeClientID(client), RT_CMAPENTRY, (void *) pcr))
             ok = BadAlloc;
     }
     else
@@ -1614,7 +1614,7 @@ AllocColorPlanes(int client, ColormapPtr pmap, int colors,
     if ((ok == Success) && pcr) {
         pcr->mid = pmap->mid;
         pcr->client = client;
-        if (!AddResource(FakeClientID(client), RT_CMAPENTRY, (pointer) pcr))
+        if (!AddResource(FakeClientID(client), RT_CMAPENTRY, (void *) pcr))
             ok = BadAlloc;
     }
     else
@@ -2492,7 +2492,7 @@ struct colormap_lookup_data {
 };
 
 static void
-_colormap_find_resource(pointer value, XID id, pointer cdata)
+_colormap_find_resource(void *value, XID id, void *cdata)
 {
     struct colormap_lookup_data *cmap_data = cdata;
     VisualPtr visuals = cmap_data->visuals;
index 1ee127a..56c5606 100644 (file)
@@ -71,9 +71,7 @@ static GlyphSharePtr sharedGlyphs = (GlyphSharePtr) NULL;
 
 DevScreenPrivateKeyRec cursorScreenDevPriv;
 
-#ifdef XFIXES
 static CARD32 cursorSerial;
-#endif
 
 static void
 FreeCursorBits(CursorBitsPtr bits)
@@ -106,7 +104,7 @@ FreeCursorBits(CursorBitsPtr bits)
  *  \param value must conform to DeleteType
  */
 int
-FreeCursor(pointer value, XID cid)
+FreeCursor(void *value, XID cid)
 {
     int nscr;
     CursorPtr pCurs = (CursorPtr) value;
@@ -114,9 +112,13 @@ FreeCursor(pointer value, XID cid)
     ScreenPtr pscr;
     DeviceIntPtr pDev = NULL;   /* unused anyway */
 
-    if (--pCurs->refcnt != 0)
+
+    UnrefCursor(pCurs);
+    if (CursorRefCount(pCurs) != 0)
         return Success;
 
+    BUG_WARN(CursorRefCount(pCurs) < 0);
+
     for (nscr = 0; nscr < screenInfo.numScreens; nscr++) {
         pscr = screenInfo.screens[nscr];
         (void) (*pscr->UnrealizeCursor) (pDev, pscr, pCurs);
@@ -127,6 +129,29 @@ FreeCursor(pointer value, XID cid)
     return Success;
 }
 
+CursorPtr
+RefCursor(CursorPtr cursor)
+{
+    if (cursor)
+        cursor->refcnt++;
+    return cursor;
+}
+
+CursorPtr
+UnrefCursor(CursorPtr cursor)
+{
+    if (cursor)
+        cursor->refcnt--;
+    return cursor;
+}
+
+int
+CursorRefCount(const CursorPtr cursor)
+{
+    return cursor ? cursor->refcnt : 0;
+}
+
+
 /*
  * We check for empty cursors so that we won't have to display them
  */
@@ -245,10 +270,8 @@ AllocARGBCursor(unsigned char *psrcbits, unsigned char *pmaskbits,
     bits->refcnt = -1;
     CheckForEmptyMask(bits);
     pCurs->bits = bits;
-#ifdef XFIXES
     pCurs->serialNumber = ++cursorSerial;
     pCurs->name = None;
-#endif
 
     pCurs->foreRed = foreRed;
     pCurs->foreGreen = foreGreen;
@@ -296,13 +319,13 @@ AllocGlyphCursor(Font source, unsigned sourceChar, Font mask, unsigned maskChar,
     CursorPtr pCurs;
     GlyphSharePtr pShare;
 
-    rc = dixLookupResourceByType((pointer *) &sourcefont, source, RT_FONT,
+    rc = dixLookupResourceByType((void **) &sourcefont, source, RT_FONT,
                                  client, DixUseAccess);
     if (rc != Success) {
         client->errorValue = source;
         return rc;
     }
-    rc = dixLookupResourceByType((pointer *) &maskfont, mask, RT_FONT, client,
+    rc = dixLookupResourceByType((void **) &maskfont, mask, RT_FONT, client,
                                  DixUseAccess);
     if (rc != Success && mask != None) {
         client->errorValue = mask;
@@ -406,10 +429,8 @@ AllocGlyphCursor(Font source, unsigned sourceChar, Font mask, unsigned maskChar,
     CheckForEmptyMask(bits);
     pCurs->bits = bits;
     pCurs->refcnt = 1;
-#ifdef XFIXES
     pCurs->serialNumber = ++cursorSerial;
     pCurs->name = None;
-#endif
 
     pCurs->foreRed = foreRed;
     pCurs->foreGreen = foreGreen;
@@ -465,7 +486,7 @@ CreateRootCursor(char *unused1, unsigned int unused2)
     if (err != Success)
         return NullCursor;
 
-    err = dixLookupResourceByType((pointer *) &cursorfont, fontID, RT_FONT,
+    err = dixLookupResourceByType((void **) &cursorfont, fontID, RT_FONT,
                                   serverClient, DixReadAccess);
     if (err != Success)
         return NullCursor;
@@ -473,7 +494,7 @@ CreateRootCursor(char *unused1, unsigned int unused2)
                          &curs, serverClient, (XID) 0) != Success)
         return NullCursor;
 
-    if (!AddResource(FakeClientID(0), RT_CURSOR, (pointer) curs))
+    if (!AddResource(FakeClientID(0), RT_CURSOR, (void *) curs))
         return NullCursor;
 
     return curs;
old mode 100644 (file)
new mode 100755 (executable)
index 9cf04ed..e2fbe16
@@ -93,9 +93,10 @@ SOFTWARE.
 static void RecalculateMasterButtons(DeviceIntPtr slave);
 
 static void
-DeviceSetTransform(DeviceIntPtr dev, float *transform)
+DeviceSetTransform(DeviceIntPtr dev, float *transform_data)
 {
     struct pixman_f_transform scale;
+    struct pixman_f_transform transform;
     double sx, sy;
     int x, y;
 
@@ -111,8 +112,8 @@ DeviceSetTransform(DeviceIntPtr dev, float *transform)
      *  Transform is the user supplied (affine) transform
      *  InvScale scales coordinates back up into their native range
      */
-    sx = dev->valuator->axes[0].max_value - dev->valuator->axes[0].min_value;
-    sy = dev->valuator->axes[1].max_value - dev->valuator->axes[1].min_value;
+    sx = dev->valuator->axes[0].max_value - dev->valuator->axes[0].min_value + 1;
+    sy = dev->valuator->axes[1].max_value - dev->valuator->axes[1].min_value + 1;
 
     /* invscale */
     pixman_f_transform_init_scale(&scale, sx, sy);
@@ -122,16 +123,21 @@ DeviceSetTransform(DeviceIntPtr dev, float *transform)
     /* transform */
     for (y = 0; y < 3; y++)
         for (x = 0; x < 3; x++)
-            dev->transform.m[y][x] = *transform++;
+            transform.m[y][x] = *transform_data++;
 
-    pixman_f_transform_multiply(&dev->transform, &scale, &dev->transform);
+    pixman_f_transform_multiply(&dev->scale_and_transform, &scale, &transform);
 
     /* scale */
     pixman_f_transform_init_scale(&scale, 1.0 / sx, 1.0 / sy);
     scale.m[0][2] = -dev->valuator->axes[0].min_value / sx;
     scale.m[1][2] = -dev->valuator->axes[1].min_value / sy;
 
-    pixman_f_transform_multiply(&dev->transform, &dev->transform, &scale);
+    pixman_f_transform_multiply(&dev->scale_and_transform, &dev->scale_and_transform, &scale);
+
+    /* remove translation component for relative movements */
+    dev->relative_transform = transform;
+    dev->relative_transform.m[0][2] = 0;
+    dev->relative_transform.m[1][2] = 0;
 }
 
 /**
@@ -145,9 +151,11 @@ DeviceSetProperty(DeviceIntPtr dev, Atom property, XIPropertyValuePtr prop,
         if (prop->format != 8 || prop->type != XA_INTEGER || prop->size != 1)
             return BadValue;
 
-        /* Don't allow disabling of VCP/VCK */
-        if ((dev == inputInfo.pointer ||dev ==
-             inputInfo.keyboard) &&!(*(CARD8 *) prop->data))
+        /* Don't allow disabling of VCP/VCK or XTest devices */
+        if ((dev == inputInfo.pointer ||
+             dev == inputInfo.keyboard ||
+             IsXTestDevice(dev, NULL))
+            &&!(*(CARD8 *) prop->data))
             return BadAccess;
 
         if (!checkonly) {
@@ -273,7 +281,6 @@ AddInputDevice(ClientPtr client, DeviceProc deviceProc, Bool autoStart)
     dev->deviceGrab.grabTime = currentTime;
     dev->deviceGrab.ActivateGrab = ActivateKeyboardGrab;
     dev->deviceGrab.DeactivateGrab = DeactivateKeyboardGrab;
-    dev->deviceGrab.activeGrab = AllocGrab();
     dev->deviceGrab.sync.event = calloc(1, sizeof(DeviceEvent));
 
     XkbSetExtension(dev, ProcessKeyboardEvent);
@@ -281,7 +288,7 @@ AddInputDevice(ClientPtr client, DeviceProc deviceProc, Bool autoStart)
     dev->coreEvents = TRUE;
 
     /* sprite defaults */
-    dev->spriteInfo = (SpriteInfoPtr) & dev[1];
+    dev->spriteInfo = (SpriteInfoPtr) &dev[1];
 
     /*  security creation/labeling check
      */
@@ -306,6 +313,10 @@ AddInputDevice(ClientPtr client, DeviceProc deviceProc, Bool autoStart)
     /* unity matrix */
     memset(transform, 0, sizeof(transform));
     transform[0] = transform[4] = transform[8] = 1.0f;
+    dev->relative_transform.m[0][0] = 1.0;
+    dev->relative_transform.m[1][1] = 1.0;
+    dev->relative_transform.m[2][2] = 1.0;
+    dev->scale_and_transform = dev->relative_transform;
 
     XIChangeDeviceProperty(dev, XIGetKnownProperty(XI_PROP_TRANSFORM),
                            XIGetKnownProperty(XATOM_FLOAT), 32,
@@ -375,7 +386,7 @@ EnableDevice(DeviceIntPtr dev, BOOL sendevent)
         }
         else {
             if (dev->coreEvents)
-                other = (IsPointerDevice(dev)) ? inputInfo.pointer :
+                other = (IsPointerDevice(dev)) ? inputInfo.pointer:
                     inputInfo.keyboard;
             else
                 other = NULL;   /* auto-float non-core devices */
@@ -405,6 +416,10 @@ EnableDevice(DeviceIntPtr dev, BOOL sendevent)
         XISendDeviceHierarchyEvent(flags);
     }
 
+    // IsFloating condition was brought from latest version at freedesktop xserver
+    if (!IsMaster(dev) && !IsFloating(dev))
+        XkbPushLockedStateToSlaves(GetMaster(dev, MASTER_KEYBOARD), 0, 0);
+
     RecalculateMasterButtons(dev);
 
     /* initialise an idle timer for this device*/
@@ -440,6 +455,7 @@ DisableDevice(DeviceIntPtr dev, BOOL sendevent)
     if (*prev != dev)
         return FALSE;
 
+    TouchEndPhysicallyActiveTouches(dev);
     ReleaseButtonsAndKeys(dev);
     SyncRemoveDeviceIdleTime(dev->idle_counter);
     dev->idle_counter = NULL;
@@ -510,6 +526,12 @@ DisableAllDevices(void)
 {
     DeviceIntPtr dev, tmp;
 
+    /* Disable slave devices first, excluding XTest devices */
+    nt_list_for_each_entry_safe(dev, tmp, inputInfo.devices, next) {
+        if (!IsXTestDevice(dev, NULL) && !IsMaster(dev))
+            DisableDevice(dev, FALSE);
+    }
+    /* Disable XTest devices */
     nt_list_for_each_entry_safe(dev, tmp, inputInfo.devices, next) {
         if (!IsMaster(dev))
             DisableDevice(dev, FALSE);
@@ -568,7 +590,7 @@ ActivateDevice(DeviceIntPtr dev, BOOL sendevent)
  * The actual task of ringing the bell is the job of the DDX.
  */
 static void
-CoreKeyboardBell(int volume, DeviceIntPtr pDev, pointer arg, int something)
+CoreKeyboardBell(int volume, DeviceIntPtr pDev, void *arg, int something)
 {
     KeybdCtrl *ctrl = arg;
 
@@ -668,6 +690,133 @@ CorePointerProc(DeviceIntPtr pDev, int what)
 #undef NAXES
 }
 
+#ifdef _F_SUPPORT_XTEST_TOUCH_EVENT_
+int
+CoreTouchProc(DeviceIntPtr pDev, int what)
+{
+#define NBUTTONS 10
+#define NTOUCHES 10
+#define NAXES MAX_VALUATORS
+    int i = 0;
+    Atom axes_labels[NAXES] = { 0 };
+    Atom atom = None;
+    Atom btn_labels[NBUTTONS] = { 0 };
+    BYTE map[NBUTTONS + 1] = { 0 };
+    ScreenPtr scr = screenInfo.screens[0];
+    static char* abs_labels[] = {
+        AXIS_LABEL_PROP_ABS_X,              /* 0x00 */
+        AXIS_LABEL_PROP_ABS_Y,              /* 0x01 */
+        AXIS_LABEL_PROP_ABS_Z,              /* 0x02 */
+        AXIS_LABEL_PROP_ABS_RX,             /* 0x03 */
+        AXIS_LABEL_PROP_ABS_RY,             /* 0x04 */
+        AXIS_LABEL_PROP_ABS_RZ,             /* 0x05 */
+        AXIS_LABEL_PROP_ABS_THROTTLE,       /* 0x06 */
+        AXIS_LABEL_PROP_ABS_RUDDER,         /* 0x07 */
+        AXIS_LABEL_PROP_ABS_WHEEL,          /* 0x08 */
+        AXIS_LABEL_PROP_ABS_GAS,            /* 0x09 */
+        AXIS_LABEL_PROP_ABS_BRAKE,          /* 0x0a */
+        AXIS_LABEL_PROP_ABS_MISC,           /* undefined */
+        AXIS_LABEL_PROP_ABS_MISC,           /* undefined */
+        AXIS_LABEL_PROP_ABS_MISC,           /* undefined */
+        AXIS_LABEL_PROP_ABS_MISC,           /* undefined */
+        AXIS_LABEL_PROP_ABS_MISC,           /* undefined */
+        AXIS_LABEL_PROP_ABS_HAT0X,          /* 0x10 */
+        AXIS_LABEL_PROP_ABS_HAT0Y,          /* 0x11 */
+        AXIS_LABEL_PROP_ABS_HAT1X,          /* 0x12 */
+        AXIS_LABEL_PROP_ABS_HAT1Y,          /* 0x13 */
+        AXIS_LABEL_PROP_ABS_HAT2X,          /* 0x14 */
+        AXIS_LABEL_PROP_ABS_HAT2Y,          /* 0x15 */
+        AXIS_LABEL_PROP_ABS_HAT3X,          /* 0x16 */
+        AXIS_LABEL_PROP_ABS_HAT3Y,          /* 0x17 */
+        AXIS_LABEL_PROP_ABS_PRESSURE,       /* 0x18 */
+        AXIS_LABEL_PROP_ABS_DISTANCE,       /* 0x19 */
+        AXIS_LABEL_PROP_ABS_TILT_X,         /* 0x1a */
+        AXIS_LABEL_PROP_ABS_TILT_Y,         /* 0x1b */
+        AXIS_LABEL_PROP_ABS_TOOL_WIDTH,     /* 0x1c */
+        AXIS_LABEL_PROP_ABS_MISC,           /* undefined */
+        AXIS_LABEL_PROP_ABS_MISC,           /* undefined */
+        AXIS_LABEL_PROP_ABS_MISC,           /* undefined */
+        AXIS_LABEL_PROP_ABS_VOLUME          /* 0x20 */
+        AXIS_LABEL_PROP_ABS_MISC,           /* undefined */
+        AXIS_LABEL_PROP_ABS_MISC,           /* undefined */
+        AXIS_LABEL_PROP_ABS_MISC,           /* undefined */
+        AXIS_LABEL_PROP_ABS_MISC,           /* undefined */
+        AXIS_LABEL_PROP_ABS_MISC,           /* undefined */
+        AXIS_LABEL_PROP_ABS_MISC,           /* undefined */
+        AXIS_LABEL_PROP_ABS_MISC,           /* undefined */
+        AXIS_LABEL_PROP_ABS_MISC,           /* undefined */
+        AXIS_LABEL_PROP_ABS_MISC,           /* undefined */
+        AXIS_LABEL_PROP_ABS_MISC,           /* undefined */
+        AXIS_LABEL_PROP_ABS_MISC,           /* undefined */
+        AXIS_LABEL_PROP_ABS_MISC,           /* undefined */
+        AXIS_LABEL_PROP_ABS_MISC,           /* undefined */
+        AXIS_LABEL_PROP_ABS_MISC,           /* undefined */
+        AXIS_LABEL_PROP_ABS_MISC,           /* undefined */
+        AXIS_LABEL_PROP_ABS_MISC,           /* undefined */
+        AXIS_LABEL_PROP_ABS_MT_TOUCH_MAJOR, /* 0x30 */
+        AXIS_LABEL_PROP_ABS_MT_TOUCH_MINOR, /* 0x31 */
+        AXIS_LABEL_PROP_ABS_MT_WIDTH_MAJOR, /* 0x32 */
+        AXIS_LABEL_PROP_ABS_MT_WIDTH_MINOR, /* 0x33 */
+        AXIS_LABEL_PROP_ABS_MT_ORIENTATION, /* 0x34 */
+        AXIS_LABEL_PROP_ABS_MT_POSITION_X,  /* 0x35 */
+        AXIS_LABEL_PROP_ABS_MT_POSITION_Y,  /* 0x36 */
+        AXIS_LABEL_PROP_ABS_MT_TOOL_TYPE,   /* 0x37 */
+        AXIS_LABEL_PROP_ABS_MT_BLOB_ID,     /* 0x38 */
+        AXIS_LABEL_PROP_ABS_MT_TRACKING_ID, /* 0x39 */
+        AXIS_LABEL_PROP_ABS_MT_PRESSURE,    /* 0x3a */
+    };
+
+    switch (what) {
+    case DEVICE_INIT:
+    for (i = 1; i <= NBUTTONS; i++)
+            map[i] = i;
+
+        btn_labels[0] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_LEFT);
+        btn_labels[1] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_MIDDLE);
+        btn_labels[2] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_RIGHT);
+        btn_labels[3] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_UP);
+        btn_labels[4] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_DOWN);
+        btn_labels[5] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_HWHEEL_LEFT);
+        btn_labels[6] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_HWHEEL_RIGHT);
+
+        for (i = 0; i < NAXES; i++) {
+            atom = XIGetKnownProperty(abs_labels[i]);
+            if (!atom) { /* Should not happen */
+                continue;
+            }
+            axes_labels[i] = atom;
+        }
+
+        if (!InitTouchDeviceStruct(pDev, MAX_VALUATORS, axes_labels,
+                    GetMotionHistorySize(), Absolute, NTOUCHES, XIDirectTouch,
+                    NBUTTONS, btn_labels, map)) {
+                    ErrorF("[CoreTouchProc] Could not initialize touch device '%s'. Out of memory.\n",
+                    pDev->name);
+                    return BadAlloc;
+        }
+
+        /* axisVal is per-screen, last.valuators is desktop-wide */
+        pDev->valuator->axisVal[0] = scr->width / 2;
+        pDev->last.valuators[0] = pDev->valuator->axisVal[0] + scr->x;
+        pDev->valuator->axisVal[1] = scr->height / 2;
+        pDev->last.valuators[1] = pDev->valuator->axisVal[1] + scr->y;
+        break;
+
+    case DEVICE_CLOSE:
+        break;
+
+    default:
+        break;
+    }
+
+    return Success;
+
+#undef NBUTTONS
+#undef NTOUCHES
+#undef NAXES
+}
+#endif //_F_SUPPORT_XTEST_TOUCH_EVENT_
+
 /**
  * Initialise the two core devices, VCP and VCK (see events.c).
  * Both devices are not tied to physical devices, but guarantee that there is
@@ -692,6 +841,9 @@ InitCoreDevices(void)
          FatalError("Failed to enable core devices.");
 
     InitXTestDevices();
+#ifdef _F_SUPPORT_XTEST_TOUCH_EVENT_
+    InitXTestHWKeyTouchDevices();
+#endif //_F_SUPPORT_XTEST_TOUCH_EVENT_
 }
 
 /**
@@ -732,7 +884,7 @@ InitAndStartDevices(void)
  * Free the given device class and reset the pointer to NULL.
  */
 static void
-FreeDeviceClass(int type, pointer *class)
+FreeDeviceClass(int type, void **class)
 {
     if (!(*class))
         return;
@@ -776,6 +928,7 @@ FreeDeviceClass(int type, pointer *class)
             free((*t)->touches[i].valuators);
         }
 
+        free((*t)->touches);
         free((*t));
         break;
     }
@@ -799,7 +952,7 @@ FreeDeviceClass(int type, pointer *class)
 }
 
 static void
-FreeFeedbackClass(int type, pointer *class)
+FreeFeedbackClass(int type, void **class)
 {
     if (!(*class))
         return;
@@ -887,19 +1040,19 @@ FreeAllDeviceClasses(ClassesPtr classes)
     if (!classes)
         return;
 
-    FreeDeviceClass(KeyClass, (pointer) &classes->key);
-    FreeDeviceClass(ValuatorClass, (pointer) &classes->valuator);
-    FreeDeviceClass(XITouchClass, (pointer) &classes->touch);
-    FreeDeviceClass(ButtonClass, (pointer) &classes->button);
-    FreeDeviceClass(FocusClass, (pointer) &classes->focus);
-    FreeDeviceClass(ProximityClass, (pointer) &classes->proximity);
+    FreeDeviceClass(KeyClass, (void *) &classes->key);
+    FreeDeviceClass(ValuatorClass, (void *) &classes->valuator);
+    FreeDeviceClass(XITouchClass, (void *) &classes->touch);
+    FreeDeviceClass(ButtonClass, (void *) &classes->button);
+    FreeDeviceClass(FocusClass, (void *) &classes->focus);
+    FreeDeviceClass(ProximityClass, (void *) &classes->proximity);
 
-    FreeFeedbackClass(KbdFeedbackClass, (pointer) &classes->kbdfeed);
-    FreeFeedbackClass(PtrFeedbackClass, (pointer) &classes->ptrfeed);
-    FreeFeedbackClass(IntegerFeedbackClass, (pointer) &classes->intfeed);
-    FreeFeedbackClass(StringFeedbackClass, (pointer) &classes->stringfeed);
-    FreeFeedbackClass(BellFeedbackClass, (pointer) &classes->bell);
-    FreeFeedbackClass(LedFeedbackClass, (pointer) &classes->leds);
+    FreeFeedbackClass(KbdFeedbackClass, (void *) &classes->kbdfeed);
+    FreeFeedbackClass(PtrFeedbackClass, (void *) &classes->ptrfeed);
+    FreeFeedbackClass(IntegerFeedbackClass, (void *) &classes->intfeed);
+    FreeFeedbackClass(StringFeedbackClass, (void *) &classes->stringfeed);
+    FreeFeedbackClass(BellFeedbackClass, (void *) &classes->bell);
+    FreeFeedbackClass(LedFeedbackClass, (void *) &classes->leds);
 
 }
 
@@ -925,8 +1078,9 @@ CloseDevice(DeviceIntPtr dev)
     if (dev->inited)
         (void) (*dev->deviceProc) (dev, DEVICE_CLOSE);
 
-    /* free sprite memory */
-    if (IsMaster(dev) && dev->spriteInfo->sprite)
+    FreeSprite(dev);
+
+    if (IsMaster(dev))
         screen->DeviceCursorCleanup(dev, screen);
 
     /* free acceleration info */
@@ -938,7 +1092,7 @@ CloseDevice(DeviceIntPtr dev)
 
     free(dev->name);
 
-    classes = (ClassesPtr) & dev->key;
+    classes = (ClassesPtr) &dev->key;
     FreeAllDeviceClasses(classes);
 
     if (IsMaster(dev)) {
@@ -947,8 +1101,6 @@ CloseDevice(DeviceIntPtr dev)
         free(classes);
     }
 
-    FreeSprite(dev);
-
     /* a client may have the device set as client pointer */
     for (j = 0; j < currentMaxClients; j++) {
         if (clients[j] && clients[j]->clientPtr == dev) {
@@ -957,7 +1109,8 @@ CloseDevice(DeviceIntPtr dev)
         }
     }
 
-    FreeGrab(dev->deviceGrab.activeGrab);
+    if (dev->deviceGrab.grab)
+        FreeGrab(dev->deviceGrab.grab);
     free(dev->deviceGrab.sync.event);
     free(dev->config_info);     /* Allocated in xf86ActivateDevice. */
     free(dev->last.scroll);
@@ -1032,11 +1185,31 @@ CloseDownDevices(void)
     inputInfo.pointer = NULL;
 
     XkbDeleteRulesDflts();
+    XkbDeleteRulesUsed();
 
     OsReleaseSignals();
 }
 
 /**
+ * Signal all devices that we're in the process of aborting.
+ * This function is called from a signal handler.
+ */
+void
+AbortDevices(void)
+{
+    DeviceIntPtr dev;
+    nt_list_for_each_entry(dev, inputInfo.devices, next) {
+        if (!IsMaster(dev))
+            (*dev->deviceProc) (dev, DEVICE_ABORT);
+    }
+
+    nt_list_for_each_entry(dev, inputInfo.off_devices, next) {
+        if (!IsMaster(dev))
+            (*dev->deviceProc) (dev, DEVICE_ABORT);
+    }
+}
+
+/**
  * Remove the cursor sprite for all devices. This needs to be done before any
  * resources are freed or any device is deleted.
  */
@@ -1237,6 +1410,10 @@ InitButtonClassDeviceStruct(DeviceIntPtr dev, int numButtons, Atom *labels,
     ButtonClassPtr butc;
     int i;
 
+    BUG_RETURN_VAL(dev == NULL, FALSE);
+    BUG_RETURN_VAL(dev->button != NULL, FALSE);
+    BUG_RETURN_VAL(numButtons >= MAX_BUTTONS, FALSE);
+
     butc = calloc(1, sizeof(ButtonClassRec));
     if (!butc)
         return FALSE;
@@ -1297,8 +1474,7 @@ InitValuatorClassDeviceStruct(DeviceIntPtr dev, int numAxes, Atom *labels,
     int i;
     ValuatorClassPtr valc;
 
-    if (!dev)
-        return FALSE;
+    BUG_RETURN_VAL(dev == NULL, FALSE);
 
     if (numAxes > MAX_VALUATORS) {
         LogMessage(X_WARNING,
@@ -1327,7 +1503,7 @@ InitValuatorClassDeviceStruct(DeviceIntPtr dev, int numAxes, Atom *labels,
     valc->numMotionEvents = numMotionEvents;
     valc->motionHintWindow = NullWindow;
 
-    if (mode & OutOfProximity)
+    if ((mode & OutOfProximity) && !dev->proximity)
         InitProximityClassDeviceStruct(dev);
 
     dev->valuator = valc;
@@ -1407,6 +1583,9 @@ InitFocusClassDeviceStruct(DeviceIntPtr dev)
 {
     FocusClassPtr focc;
 
+    BUG_RETURN_VAL(dev == NULL, FALSE);
+    BUG_RETURN_VAL(dev->focus != NULL, FALSE);
+
     focc = malloc(sizeof(FocusClassRec));
     if (!focc)
         return FALSE;
@@ -1426,6 +1605,8 @@ InitPtrFeedbackClassDeviceStruct(DeviceIntPtr dev, PtrCtrlProcPtr controlProc)
 {
     PtrFeedbackPtr feedc;
 
+    BUG_RETURN_VAL(dev == NULL, FALSE);
+
     feedc = malloc(sizeof(PtrFeedbackClassRec));
     if (!feedc)
         return FALSE;
@@ -1467,6 +1648,8 @@ InitStringFeedbackClassDeviceStruct(DeviceIntPtr dev,
     int i;
     StringFeedbackPtr feedc;
 
+    BUG_RETURN_VAL(dev == NULL, FALSE);
+
     feedc = malloc(sizeof(StringFeedbackClassRec));
     if (!feedc)
         return FALSE;
@@ -1501,6 +1684,8 @@ InitBellFeedbackClassDeviceStruct(DeviceIntPtr dev, BellProcPtr bellProc,
 {
     BellFeedbackPtr feedc;
 
+    BUG_RETURN_VAL(dev == NULL, FALSE);
+
     feedc = malloc(sizeof(BellFeedbackClassRec));
     if (!feedc)
         return FALSE;
@@ -1520,6 +1705,8 @@ InitLedFeedbackClassDeviceStruct(DeviceIntPtr dev, LedCtrlProcPtr controlProc)
 {
     LedFeedbackPtr feedc;
 
+    BUG_RETURN_VAL(dev == NULL, FALSE);
+
     feedc = malloc(sizeof(LedFeedbackClassRec));
     if (!feedc)
         return FALSE;
@@ -1540,6 +1727,8 @@ InitIntegerFeedbackClassDeviceStruct(DeviceIntPtr dev,
 {
     IntegerFeedbackPtr feedc;
 
+    BUG_RETURN_VAL(dev == NULL, FALSE);
+
     feedc = malloc(sizeof(IntegerFeedbackClassRec));
     if (!feedc)
         return FALSE;
@@ -1560,12 +1749,36 @@ InitPointerDeviceStruct(DevicePtr device, CARD8 *map, int numButtons,
 {
     DeviceIntPtr dev = (DeviceIntPtr) device;
 
+    BUG_RETURN_VAL(dev == NULL, FALSE);
+    BUG_RETURN_VAL(dev->button != NULL, FALSE);
+    BUG_RETURN_VAL(dev->valuator != NULL, FALSE);
+    BUG_RETURN_VAL(dev->ptrfeed != NULL, FALSE);
+
     return (InitButtonClassDeviceStruct(dev, numButtons, btn_labels, map) &&
             InitValuatorClassDeviceStruct(dev, numAxes, axes_labels,
                                           numMotionEvents, Relative) &&
             InitPtrFeedbackClassDeviceStruct(dev, controlProc));
 }
 
+#ifdef _F_SUPPORT_XTEST_TOUCH_EVENT_
+Bool
+InitTouchDeviceStruct(DeviceIntPtr device, int numAxes,
+                    Atom *axes_labels, int numMotionEvents, int valuatormode, int numTouches,
+                    unsigned int touchMode, int numButtons, Atom *btn_labels, CARD8 *map)
+{
+    BUG_RETURN_VAL(device == NULL, FALSE);
+    BUG_RETURN_VAL(device->button != NULL, FALSE);
+    BUG_RETURN_VAL(device->valuator != NULL, FALSE);
+    BUG_RETURN_VAL(device->ptrfeed != NULL, FALSE);
+
+    return (InitValuatorClassDeviceStruct(device, numAxes, axes_labels,
+                                          numMotionEvents, valuatormode) &&
+                 InitTouchClassDeviceStruct(device, numTouches, touchMode, numAxes) &&
+                 InitButtonClassDeviceStruct(device, numButtons, btn_labels, map));
+}
+#endif //_F_SUPPORT_XTEST_TOUCH_EVENT_
+
+
 /**
  * Sets up multitouch capabilities on @device.
  *
@@ -1580,14 +1793,13 @@ InitTouchClassDeviceStruct(DeviceIntPtr device, unsigned int max_touches,
     TouchClassPtr touch;
     int i;
 
-    if (device->touch || !device->valuator)
-        return FALSE;
+    BUG_RETURN_VAL(device == NULL, FALSE);
+    BUG_RETURN_VAL(device->touch != NULL, FALSE);
+    BUG_RETURN_VAL(device->valuator == NULL, FALSE);
 
     /* Check the mode is valid, and at least X and Y axes. */
-    if (mode != XIDirectTouch && mode != XIDependentTouch)
-        return FALSE;
-    if (num_axes < 2)
-        return FALSE;
+    BUG_RETURN_VAL(mode != XIDirectTouch && mode != XIDependentTouch, FALSE);
+    BUG_RETURN_VAL(num_axes < 2, FALSE);
 
     if (num_axes > MAX_VALUATORS) {
         LogMessage(X_WARNING,
@@ -2584,6 +2796,7 @@ AttachDevice(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr master)
         dev->spriteInfo->paired = master;
         dev->spriteInfo->spriteOwner = FALSE;
 
+        XkbPushLockedStateToSlaves(GetMaster(dev, MASTER_KEYBOARD), 0, 0);
         RecalculateMasterButtons(master);
     }
 
@@ -2671,6 +2884,7 @@ AllocDevicePair(ClientPtr client, const char *name,
 {
     DeviceIntPtr pointer;
     DeviceIntPtr keyboard;
+    char *dev_name;
 
     *ptr = *keybd = NULL;
 
@@ -2681,12 +2895,12 @@ AllocDevicePair(ClientPtr client, const char *name,
     if (!pointer)
         return BadAlloc;
 
-    if (asprintf(&pointer->name, "%s pointer", name) == -1) {
-        pointer->name = NULL;
+    if (asprintf(&dev_name, "%s pointer", name) == -1) {
         RemoveDevice(pointer, FALSE);
 
         return BadAlloc;
     }
+    pointer->name = dev_name;
 
     pointer->public.processInputProc = ProcessOtherEvent;
     pointer->public.realInputProc = ProcessOtherEvent;
@@ -2707,13 +2921,13 @@ AllocDevicePair(ClientPtr client, const char *name,
         return BadAlloc;
     }
 
-    if (asprintf(&keyboard->name, "%s keyboard", name) == -1) {
-        keyboard->name = NULL;
+    if (asprintf(&dev_name, "%s keyboard", name) == -1) {
         RemoveDevice(keyboard, FALSE);
         RemoveDevice(pointer, FALSE);
 
         return BadAlloc;
     }
+    keyboard->name = dev_name;
 
     keyboard->public.processInputProc = ProcessOtherEvent;
     keyboard->public.realInputProc = ProcessOtherEvent;
@@ -2728,9 +2942,89 @@ AllocDevicePair(ClientPtr client, const char *name,
     keyboard->type = (master) ? MASTER_KEYBOARD : SLAVE;
 
     /* The ClassesRec stores the device classes currently not used. */
-    pointer->unused_classes = calloc(1, sizeof(ClassesRec));
+    if (IsMaster(pointer)) {
+        pointer->unused_classes = calloc(1, sizeof(ClassesRec));
+        keyboard->unused_classes = calloc(1, sizeof(ClassesRec));
+    }
+
+    *ptr = pointer;
+
+    *keybd = keyboard;
+
+    return Success;
+}
+
+#ifdef _F_SUPPORT_XTEST_TOUCH_EVENT_
+int
+AllocHWKeyTouchDevicePair(ClientPtr client, const char *name,
+                DeviceIntPtr *ptr,
+                DeviceIntPtr *keybd,
+                DeviceProc ptr_proc, DeviceProc keybd_proc, Bool master)
+{
+    DeviceIntPtr pointer;
+    DeviceIntPtr keyboard;
+    char *dev_name;
+
+    *ptr = *keybd = NULL;
+
+    XkbInitPrivates();
+
+    pointer = AddInputDevice(client, ptr_proc, TRUE);
+
+    if (!pointer)
+        return BadAlloc;
+
+    if (asprintf(&dev_name, "%s touch", name) == -1) {
+        RemoveDevice(pointer, FALSE);
+
+        return BadAlloc;
+    }
+    pointer->name = dev_name;
 
-    keyboard->unused_classes = calloc(1, sizeof(ClassesRec));
+    pointer->public.processInputProc = ProcessOtherEvent;
+    pointer->public.realInputProc = ProcessOtherEvent;
+    XkbSetExtension(pointer, ProcessPointerEvent);
+    pointer->deviceGrab.ActivateGrab = ActivatePointerGrab;
+    pointer->deviceGrab.DeactivateGrab = DeactivatePointerGrab;
+    pointer->coreEvents = TRUE;
+    pointer->spriteInfo->spriteOwner = TRUE;
+
+    pointer->lastSlave = NULL;
+    pointer->last.slave = NULL;
+    pointer->type = (master) ? MASTER_POINTER : SLAVE;
+
+    keyboard = AddInputDevice(client, keybd_proc, TRUE);
+    if (!keyboard) {
+        RemoveDevice(pointer, FALSE);
+
+        return BadAlloc;
+    }
+
+    if (asprintf(&dev_name, "%s functionkeys", name) == -1) {
+        RemoveDevice(keyboard, FALSE);
+        RemoveDevice(pointer, FALSE);
+
+        return BadAlloc;
+    }
+    keyboard->name = dev_name;
+
+    keyboard->public.processInputProc = ProcessOtherEvent;
+    keyboard->public.realInputProc = ProcessOtherEvent;
+    XkbSetExtension(keyboard, ProcessKeyboardEvent);
+    keyboard->deviceGrab.ActivateGrab = ActivateKeyboardGrab;
+    keyboard->deviceGrab.DeactivateGrab = DeactivateKeyboardGrab;
+    keyboard->coreEvents = TRUE;
+    keyboard->spriteInfo->spriteOwner = FALSE;
+
+    keyboard->lastSlave = NULL;
+    keyboard->last.slave = NULL;
+    keyboard->type = (master) ? MASTER_KEYBOARD : SLAVE;
+
+    /* The ClassesRec stores the device classes currently not used. */
+    if (IsMaster(pointer)) {
+        pointer->unused_classes = calloc(1, sizeof(ClassesRec));
+        keyboard->unused_classes = calloc(1, sizeof(ClassesRec));
+    }
 
     *ptr = pointer;
 
@@ -2738,6 +3032,7 @@ AllocDevicePair(ClientPtr client, const char *name,
 
     return Success;
 }
+#endif //_F_SUPPORT_XTEST_TOUCH_EVENT_
 
 /**
  * Return Relative or Absolute for the device.
old mode 100644 (file)
new mode 100755 (executable)
index b838554..e3b5538
@@ -26,13 +26,13 @@ Copyright 1987, 1989 by Digital Equipment Corporation, Maynard, Massachusetts.
 
                         All Rights Reserved
 
-Permission to use, copy, modify, and distribute this software and its 
-documentation for any purpose and without fee is hereby granted, 
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
 provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in 
+both that copyright notice and this permission notice appear in
 supporting documentation, and that the name of Digital not be
 used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.  
+software without specific, written prior permission.
 
 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
@@ -101,6 +101,11 @@ Equipment Corporation.
 #include <version-config.h>
 #endif
 
+#ifdef ENABLE_DLOG
+#define LOG_TAG "XORG_PIXMAP"
+#include <dlog.h>
+#endif
+
 #ifdef PANORAMIX_DEBUG
 #include <stdio.h>
 int ProcInitialConnection();
@@ -224,10 +229,15 @@ UpdateCurrentTimeIf(void)
 
 #undef SMART_DEBUG
 
-#define SMART_SCHEDULE_DEFAULT_INTERVAL        20      /* ms */
-#define SMART_SCHEDULE_MAX_SLICE       200     /* ms */
+/* in milliseconds */
+#define SMART_SCHEDULE_DEFAULT_INTERVAL        5
+#define SMART_SCHEDULE_MAX_SLICE       15
 
+#if defined(WIN32) && !defined(__CYGWIN__)
+Bool SmartScheduleDisable = TRUE;
+#else
 Bool SmartScheduleDisable = FALSE;
+#endif
 long SmartScheduleSlice = SMART_SCHEDULE_DEFAULT_INTERVAL;
 long SmartScheduleInterval = SMART_SCHEDULE_DEFAULT_INTERVAL;
 long SmartScheduleMaxSlice = SMART_SCHEDULE_MAX_SLICE;
@@ -259,12 +269,11 @@ SmartScheduleClient(int *clientReady, int nready)
     for (i = 0; i < nready; i++) {
         client = clientReady[i];
         pClient = clients[client];
-        /* Praise clients which are idle */
-        if ((now - pClient->smart_check_tick) >= idle) {
+        /* Praise clients which haven't run in a while */
+        if ((now - pClient->smart_stop_tick) >= idle) {
             if (pClient->smart_priority < 0)
                 pClient->smart_priority++;
         }
-        pClient->smart_check_tick = now;
 
         /* check priority to select best client */
         robin =
@@ -364,9 +373,9 @@ Dispatch(void)
             clientReady[0] = SmartScheduleClient(clientReady, nready);
             nready = 1;
         }
-       /***************** 
-       *  Handle events in round robin fashion, doing input between 
-       *  each round 
+       /*****************
+       *  Handle events in round robin fashion, doing input between
+       *  each round
        *****************/
 
         while (!dispatchException && (--nready >= 0)) {
@@ -465,10 +474,11 @@ Dispatch(void)
     free(clientReady);
     dispatchException &= ~DE_RESET;
     SmartScheduleLatencyLimited = 0;
+    ResetOsBuffers();
 }
 
 static int VendorRelease = VENDOR_RELEASE;
-static char *VendorString = VENDOR_NAME;
+static const char *VendorString = VENDOR_NAME;
 
 void
 SetVendorRelease(int release)
@@ -477,9 +487,9 @@ SetVendorRelease(int release)
 }
 
 void
-SetVendorString(char *string)
+SetVendorString(const char *vendor)
 {
-    VendorString = string;
+    VendorString = vendor;
 }
 
 Bool
@@ -650,7 +660,7 @@ ProcCreateWindow(ClientPtr client)
         Mask mask = pWin->eventMask;
 
         pWin->eventMask = 0;    /* subterfuge in case AddResource fails */
-        if (!AddResource(stuff->wid, RT_WINDOW, (pointer) pWin))
+        if (!AddResource(stuff->wid, RT_WINDOW, (void *) pWin))
             return BadAlloc;
         pWin->eventMask = mask;
     }
@@ -1067,7 +1077,7 @@ ProcGrabServer(ClientPtr client)
 
         grabinfo.client = client;
         grabinfo.grabstate = SERVER_GRABBED;
-        CallCallbacks(&ServerGrabCallback, (pointer) &grabinfo);
+        CallCallbacks(&ServerGrabCallback, (void *) &grabinfo);
     }
 
     return Success;
@@ -1094,7 +1104,7 @@ UngrabServer(ClientPtr client)
 
         grabinfo.client = client;
         grabinfo.grabstate = SERVER_UNGRABBED;
-        CallCallbacks(&ServerGrabCallback, (pointer) &grabinfo);
+        CallCallbacks(&ServerGrabCallback, (void *) &grabinfo);
     }
 }
 
@@ -1239,7 +1249,7 @@ ProcCloseFont(ClientPtr client)
     REQUEST(xResourceReq);
 
     REQUEST_SIZE_MATCH(xResourceReq);
-    rc = dixLookupResourceByType((pointer *) &pFont, stuff->id, RT_FONT,
+    rc = dixLookupResourceByType((void **) &pFont, stuff->id, RT_FONT,
                                  client, DixDestroyAccess);
     if (rc == Success) {
         FreeResource(stuff->id, RT_NONE);
@@ -1366,10 +1376,22 @@ ProcListFontsWithInfo(ClientPtr client)
  *  \param value must conform to DeleteType
  */
 int
-dixDestroyPixmap(pointer value, XID pid)
+dixDestroyPixmap(void *value, XID pid)
 {
     PixmapPtr pPixmap = (PixmapPtr) value;
 
+#ifdef ENABLE_DLOG
+    SLOG(LOG_INFO, "XORG_PIXMAP", "pix_id:%p, pixmap:%p (%dx%d) refcnt:%d-1\n",
+        pPixmap->drawable.id,
+        pPixmap,
+        pPixmap->drawable.width,
+        pPixmap->drawable.height,
+        pPixmap->refcnt);
+#endif
+#if defined (_F_PRESENT_PIXMAP_SWAP_) || defined (_F_PRESENT_HWC_FLIP_)
+    pPixmap->destroy_pixmap_id = pid;
+#endif //_F_PRESENT_PIXMAP_SWAP_
+
     return (*pPixmap->drawable.pScreen->DestroyPixmap) (pPixmap);
 }
 
@@ -1433,7 +1455,7 @@ ProcCreatePixmap(ClientPtr client)
             (*pDraw->pScreen->DestroyPixmap) (pMap);
             return rc;
         }
-        if (AddResource(stuff->pid, RT_PIXMAP, (pointer) pMap))
+        if (AddResource(stuff->pid, RT_PIXMAP, (void *) pMap))
             return Success;
     }
     return BadAlloc;
@@ -1448,7 +1470,7 @@ ProcFreePixmap(ClientPtr client)
     REQUEST(xResourceReq);
     REQUEST_SIZE_MATCH(xResourceReq);
 
-    rc = dixLookupResourceByType((pointer *) &pMap, stuff->id, RT_PIXMAP,
+    rc = dixLookupResourceByType((void **) &pMap, stuff->id, RT_PIXMAP,
                                  client, DixDestroyAccess);
     if (rc == Success) {
         FreeResource(stuff->id, RT_NONE);
@@ -1485,7 +1507,7 @@ ProcCreateGC(ClientPtr client)
                           stuff->gc, client);
     if (error != Success)
         return error;
-    if (!AddResource(stuff->gc, RT_GC, (pointer) pGC))
+    if (!AddResource(stuff->gc, RT_GC, (void *) pGC))
         return BadAlloc;
     return Success;
 }
@@ -2006,7 +2028,7 @@ ProcPutImage(ClientPtr client)
 static int
 DoGetImage(ClientPtr client, int format, Drawable drawable,
            int x, int y, int width, int height,
-           Mask planemask, xGetImageReply ** im_return)
+           Mask planemask)
 {
     DrawablePtr pDraw, pBoundingDraw;
     int nlines, linesPerBuf, rc;
@@ -2106,46 +2128,32 @@ DoGetImage(ClientPtr client, int format, Drawable drawable,
 
     xgi.length = length;
 
-    if (im_return) {
-        pBuf = calloc(1, sz_xGetImageReply + length);
-        if (!pBuf)
-            return BadAlloc;
-        if (widthBytesLine == 0)
-            linesPerBuf = 0;
-        else
+    xgi.length = bytes_to_int32(xgi.length);
+    if (widthBytesLine == 0 || height == 0)
+        linesPerBuf = 0;
+    else if (widthBytesLine >= IMAGE_BUFSIZE)
+        linesPerBuf = 1;
+    else {
+        linesPerBuf = IMAGE_BUFSIZE / widthBytesLine;
+        if (linesPerBuf > height)
             linesPerBuf = height;
-        *im_return = (xGetImageReply *) pBuf;
-        *(xGetImageReply *) pBuf = xgi;
-        pBuf += sz_xGetImageReply;
     }
-    else {
-        xgi.length = bytes_to_int32(xgi.length);
-        if (widthBytesLine == 0 || height == 0)
-            linesPerBuf = 0;
-        else if (widthBytesLine >= IMAGE_BUFSIZE)
-            linesPerBuf = 1;
-        else {
-            linesPerBuf = IMAGE_BUFSIZE / widthBytesLine;
-            if (linesPerBuf > height)
-                linesPerBuf = height;
+    length = linesPerBuf * widthBytesLine;
+    if (linesPerBuf < height) {
+        /* we have to make sure intermediate buffers don't need padding */
+        while ((linesPerBuf > 1) &&
+               (length & ((1L << LOG2_BYTES_PER_SCANLINE_PAD) - 1))) {
+            linesPerBuf--;
+            length -= widthBytesLine;
         }
-        length = linesPerBuf * widthBytesLine;
-        if (linesPerBuf < height) {
-            /* we have to make sure intermediate buffers don't need padding */
-            while ((linesPerBuf > 1) &&
-                   (length & ((1L << LOG2_BYTES_PER_SCANLINE_PAD) - 1))) {
-                linesPerBuf--;
-                length -= widthBytesLine;
-            }
-            while (length & ((1L << LOG2_BYTES_PER_SCANLINE_PAD) - 1)) {
-                linesPerBuf++;
-                length += widthBytesLine;
-            }
+        while (length & ((1L << LOG2_BYTES_PER_SCANLINE_PAD) - 1)) {
+            linesPerBuf++;
+            length += widthBytesLine;
         }
-        if (!(pBuf = calloc(1, length)))
-            return BadAlloc;
-        WriteReplyToClient(client, sizeof(xGetImageReply), &xgi);
     }
+    if (!(pBuf = calloc(1, length)))
+        return BadAlloc;
+    WriteReplyToClient(client, sizeof(xGetImageReply), &xgi);
 
     if (pDraw->type == DRAWABLE_WINDOW) {
         pVisibleRegion = NotClippedByChildren((WindowPtr) pDraw);
@@ -2166,7 +2174,7 @@ DoGetImage(ClientPtr client, int format, Drawable drawable,
                                          y + linesDone,
                                          width,
                                          nlines,
-                                         format, planemask, (pointer) pBuf);
+                                         format, planemask, (void *) pBuf);
             if (pVisibleRegion)
                 XaceCensorImage(client, pVisibleRegion, widthBytesLine,
                                 pDraw, x, y + linesDone, width,
@@ -2174,13 +2182,10 @@ DoGetImage(ClientPtr client, int format, Drawable drawable,
 
             /* Note that this is NOT a call to WriteSwappedDataToClient,
                as we do NOT byte swap */
-            if (!im_return) {
-                ReformatImage(pBuf, (int) (nlines * widthBytesLine),
-                              BitsPerPixel(pDraw->depth), ClientOrder(client));
+            ReformatImage(pBuf, (int) (nlines * widthBytesLine),
+                          BitsPerPixel(pDraw->depth), ClientOrder(client));
 
-/* Don't split me, gcc pukes when you do */
-                WriteToClient(client, (int) (nlines * widthBytesLine), pBuf);
-            }
+            WriteToClient(client, (int) (nlines * widthBytesLine), pBuf);
             linesDone += nlines;
         }
     }
@@ -2196,7 +2201,7 @@ DoGetImage(ClientPtr client, int format, Drawable drawable,
                                                  y + linesDone,
                                                  width,
                                                  nlines,
-                                                 format, plane, (pointer) pBuf);
+                                                 format, plane, (void *) pBuf);
                     if (pVisibleRegion)
                         XaceCensorImage(client, pVisibleRegion,
                                         widthBytesLine,
@@ -2205,18 +2210,10 @@ DoGetImage(ClientPtr client, int format, Drawable drawable,
 
                     /* Note: NOT a call to WriteSwappedDataToClient,
                        as we do NOT byte swap */
-                    if (im_return) {
-                        pBuf += nlines * widthBytesLine;
-                    }
-                    else {
-                        ReformatImage(pBuf,
-                                      (int) (nlines * widthBytesLine),
-                                      1, ClientOrder(client));
-
-/* Don't split me, gcc pukes when you do */
-                        WriteToClient(client, (int) (nlines * widthBytesLine),
-                                     pBuf);
-                    }
+                    ReformatImage(pBuf, (int) (nlines * widthBytesLine),
+                                  1, ClientOrder(client));
+
+                    WriteToClient(client, (int)(nlines * widthBytesLine), pBuf);
                     linesDone += nlines;
                 }
             }
@@ -2224,8 +2221,7 @@ DoGetImage(ClientPtr client, int format, Drawable drawable,
     }
     if (pVisibleRegion)
         RegionDestroy(pVisibleRegion);
-    if (!im_return)
-        free(pBuf);
+    free(pBuf);
     return Success;
 }
 
@@ -2239,7 +2235,7 @@ ProcGetImage(ClientPtr client)
     return DoGetImage(client, stuff->format, stuff->drawable,
                       stuff->x, stuff->y,
                       (int) stuff->width, (int) stuff->height,
-                      stuff->planeMask, (xGetImageReply **) NULL);
+                      stuff->planeMask);
 }
 
 int
@@ -2365,7 +2361,7 @@ ProcFreeColormap(ClientPtr client)
     REQUEST(xResourceReq);
 
     REQUEST_SIZE_MATCH(xResourceReq);
-    rc = dixLookupResourceByType((pointer *) &pmap, stuff->id, RT_COLORMAP,
+    rc = dixLookupResourceByType((void **) &pmap, stuff->id, RT_COLORMAP,
                                  client, DixDestroyAccess);
     if (rc == Success) {
         /* Freeing a default colormap is a no-op */
@@ -2391,7 +2387,7 @@ ProcCopyColormapAndFree(ClientPtr client)
     REQUEST_SIZE_MATCH(xCopyColormapAndFreeReq);
     mid = stuff->mid;
     LEGAL_NEW_RESOURCE(mid, client);
-    rc = dixLookupResourceByType((pointer *) &pSrcMap, stuff->srcCmap,
+    rc = dixLookupResourceByType((void **) &pSrcMap, stuff->srcCmap,
                                  RT_COLORMAP, client,
                                  DixReadAccess | DixRemoveAccess);
     if (rc == Success)
@@ -2409,7 +2405,7 @@ ProcInstallColormap(ClientPtr client)
     REQUEST(xResourceReq);
     REQUEST_SIZE_MATCH(xResourceReq);
 
-    rc = dixLookupResourceByType((pointer *) &pcmp, stuff->id, RT_COLORMAP,
+    rc = dixLookupResourceByType((void **) &pcmp, stuff->id, RT_COLORMAP,
                                  client, DixInstallAccess);
     if (rc != Success)
         goto out;
@@ -2438,7 +2434,7 @@ ProcUninstallColormap(ClientPtr client)
     REQUEST(xResourceReq);
     REQUEST_SIZE_MATCH(xResourceReq);
 
-    rc = dixLookupResourceByType((pointer *) &pcmp, stuff->id, RT_COLORMAP,
+    rc = dixLookupResourceByType((void **) &pcmp, stuff->id, RT_COLORMAP,
                                  client, DixUninstallAccess);
     if (rc != Success)
         goto out;
@@ -2487,7 +2483,7 @@ ProcListInstalledColormaps(ClientPtr client)
     preply->type = X_Reply;
     preply->sequenceNumber = client->sequence;
     nummaps = (*pWin->drawable.pScreen->ListInstalledColormaps)
-        (pWin->drawable.pScreen, (Colormap *) & preply[1]);
+        (pWin->drawable.pScreen, (Colormap *) &preply[1]);
     preply->nColormaps = nummaps;
     preply->length = nummaps;
     WriteReplyToClient(client, sizeof(xListInstalledColormapsReply), preply);
@@ -2506,7 +2502,7 @@ ProcAllocColor(ClientPtr client)
     REQUEST(xAllocColorReq);
 
     REQUEST_SIZE_MATCH(xAllocColorReq);
-    rc = dixLookupResourceByType((pointer *) &pmap, stuff->cmap, RT_COLORMAP,
+    rc = dixLookupResourceByType((void **) &pmap, stuff->cmap, RT_COLORMAP,
                                  client, DixAddAccess);
     if (rc == Success) {
         xAllocColorReply acr = {
@@ -2543,7 +2539,7 @@ ProcAllocNamedColor(ClientPtr client)
     REQUEST(xAllocNamedColorReq);
 
     REQUEST_FIXED_SIZE(xAllocNamedColorReq, stuff->nbytes);
-    rc = dixLookupResourceByType((pointer *) &pcmp, stuff->cmap, RT_COLORMAP,
+    rc = dixLookupResourceByType((void **) &pcmp, stuff->cmap, RT_COLORMAP,
                                  client, DixAddAccess);
     if (rc == Success) {
         xAllocNamedColorReply ancr = {
@@ -2588,7 +2584,7 @@ ProcAllocColorCells(ClientPtr client)
     REQUEST(xAllocColorCellsReq);
 
     REQUEST_SIZE_MATCH(xAllocColorCellsReq);
-    rc = dixLookupResourceByType((pointer *) &pcmp, stuff->cmap, RT_COLORMAP,
+    rc = dixLookupResourceByType((void **) &pcmp, stuff->cmap, RT_COLORMAP,
                                  client, DixAddAccess);
     if (rc == Success) {
         int npixels, nmasks;
@@ -2649,7 +2645,7 @@ ProcAllocColorPlanes(ClientPtr client)
     REQUEST(xAllocColorPlanesReq);
 
     REQUEST_SIZE_MATCH(xAllocColorPlanesReq);
-    rc = dixLookupResourceByType((pointer *) &pcmp, stuff->cmap, RT_COLORMAP,
+    rc = dixLookupResourceByType((void **) &pcmp, stuff->cmap, RT_COLORMAP,
                                  client, DixAddAccess);
     if (rc == Success) {
         xAllocColorPlanesReply acpr;
@@ -2711,7 +2707,7 @@ ProcFreeColors(ClientPtr client)
     REQUEST(xFreeColorsReq);
 
     REQUEST_AT_LEAST_SIZE(xFreeColorsReq);
-    rc = dixLookupResourceByType((pointer *) &pcmp, stuff->cmap, RT_COLORMAP,
+    rc = dixLookupResourceByType((void **) &pcmp, stuff->cmap, RT_COLORMAP,
                                  client, DixRemoveAccess);
     if (rc == Success) {
         int count;
@@ -2737,7 +2733,7 @@ ProcStoreColors(ClientPtr client)
     REQUEST(xStoreColorsReq);
 
     REQUEST_AT_LEAST_SIZE(xStoreColorsReq);
-    rc = dixLookupResourceByType((pointer *) &pcmp, stuff->cmap, RT_COLORMAP,
+    rc = dixLookupResourceByType((void **) &pcmp, stuff->cmap, RT_COLORMAP,
                                  client, DixWriteAccess);
     if (rc == Success) {
         int count;
@@ -2763,7 +2759,7 @@ ProcStoreNamedColor(ClientPtr client)
     REQUEST(xStoreNamedColorReq);
 
     REQUEST_FIXED_SIZE(xStoreNamedColorReq, stuff->nbytes);
-    rc = dixLookupResourceByType((pointer *) &pcmp, stuff->cmap, RT_COLORMAP,
+    rc = dixLookupResourceByType((void **) &pcmp, stuff->cmap, RT_COLORMAP,
                                  client, DixWriteAccess);
     if (rc == Success) {
         xColorItem def;
@@ -2791,7 +2787,7 @@ ProcQueryColors(ClientPtr client)
     REQUEST(xQueryColorsReq);
 
     REQUEST_AT_LEAST_SIZE(xQueryColorsReq);
-    rc = dixLookupResourceByType((pointer *) &pcmp, stuff->cmap, RT_COLORMAP,
+    rc = dixLookupResourceByType((void **) &pcmp, stuff->cmap, RT_COLORMAP,
                                  client, DixReadAccess);
     if (rc == Success) {
         int count;
@@ -2838,7 +2834,7 @@ ProcLookupColor(ClientPtr client)
     REQUEST(xLookupColorReq);
 
     REQUEST_FIXED_SIZE(xLookupColorReq, stuff->nbytes);
-    rc = dixLookupResourceByType((pointer *) &pcmp, stuff->cmap, RT_COLORMAP,
+    rc = dixLookupResourceByType((void **) &pcmp, stuff->cmap, RT_COLORMAP,
                                  client, DixReadAccess);
     if (rc == Success) {
         CARD16 exactRed, exactGreen, exactBlue;
@@ -2889,25 +2885,32 @@ ProcCreateCursor(ClientPtr client)
     REQUEST_SIZE_MATCH(xCreateCursorReq);
     LEGAL_NEW_RESOURCE(stuff->cid, client);
 
-    rc = dixLookupResourceByType((pointer *) &src, stuff->source, RT_PIXMAP,
+    rc = dixLookupResourceByType((void **) &src, stuff->source, RT_PIXMAP,
                                  client, DixReadAccess);
     if (rc != Success) {
         client->errorValue = stuff->source;
         return rc;
     }
 
-    rc = dixLookupResourceByType((pointer *) &msk, stuff->mask, RT_PIXMAP,
-                                 client, DixReadAccess);
-    if (rc != Success) {
-        if (stuff->mask != None) {
+    if (src->drawable.depth != 1)
+        return (BadMatch);
+
+    /* Find and validate cursor mask pixmap, if one is provided */
+    if (stuff->mask != None) {
+        rc = dixLookupResourceByType((void **) &msk, stuff->mask, RT_PIXMAP,
+                                     client, DixReadAccess);
+        if (rc != Success) {
             client->errorValue = stuff->mask;
             return rc;
         }
+
+        if (src->drawable.width != msk->drawable.width
+            || src->drawable.height != msk->drawable.height
+            || src->drawable.depth != 1 || msk->drawable.depth != 1)
+            return BadMatch;
     }
-    else if (src->drawable.width != msk->drawable.width
-             || src->drawable.height != msk->drawable.height
-             || src->drawable.depth != 1 || msk->drawable.depth != 1)
-        return BadMatch;
+    else
+        msk = NULL;
 
     width = src->drawable.width;
     height = src->drawable.height;
@@ -2926,7 +2929,7 @@ ProcCreateCursor(ClientPtr client)
     }
 
     (*src->drawable.pScreen->GetImage) ((DrawablePtr) src, 0, 0, width, height,
-                                        XYPixmap, 1, (pointer) srcbits);
+                                        XYPixmap, 1, (void *) srcbits);
     if (msk == (PixmapPtr) NULL) {
         unsigned char *bits = mskbits;
 
@@ -2938,7 +2941,7 @@ ProcCreateCursor(ClientPtr client)
         memset((char *) mskbits, 0, n);
         (*msk->drawable.pScreen->GetImage) ((DrawablePtr) msk, 0, 0, width,
                                             height, XYPixmap, 1,
-                                            (pointer) mskbits);
+                                            (void *) mskbits);
     }
     cm.width = width;
     cm.height = height;
@@ -2951,7 +2954,7 @@ ProcCreateCursor(ClientPtr client)
 
     if (rc != Success)
         goto bail;
-    if (!AddResource(stuff->cid, RT_CURSOR, (pointer) pCursor)) {
+    if (!AddResource(stuff->cid, RT_CURSOR, (void *) pCursor)) {
         rc = BadAlloc;
         goto bail;
     }
@@ -2981,7 +2984,7 @@ ProcCreateGlyphCursor(ClientPtr client)
                            &pCursor, client, stuff->cid);
     if (res != Success)
         return res;
-    if (AddResource(stuff->cid, RT_CURSOR, (pointer) pCursor))
+    if (AddResource(stuff->cid, RT_CURSOR, (void *) pCursor))
         return Success;
     return BadAlloc;
 }
@@ -2995,7 +2998,7 @@ ProcFreeCursor(ClientPtr client)
     REQUEST(xResourceReq);
 
     REQUEST_SIZE_MATCH(xResourceReq);
-    rc = dixLookupResourceByType((pointer *) &pCursor, stuff->id, RT_CURSOR,
+    rc = dixLookupResourceByType((void **) &pCursor, stuff->id, RT_CURSOR,
                                  client, DixDestroyAccess);
     if (rc == Success) {
         FreeResource(stuff->id, RT_NONE);
@@ -3144,10 +3147,10 @@ ProcChangeHosts(ClientPtr client)
 
     if (stuff->mode == HostInsert)
         return AddHost(client, (int) stuff->hostFamily,
-                       stuff->hostLength, (pointer) &stuff[1]);
+                       stuff->hostLength, (void *) &stuff[1]);
     if (stuff->mode == HostDelete)
         return RemoveHost(client, (int) stuff->hostFamily,
-                          stuff->hostLength, (pointer) &stuff[1]);
+                          stuff->hostLength, (void *) &stuff[1]);
     client->errorValue = stuff->mode;
     return BadValue;
 }
@@ -3158,7 +3161,7 @@ ProcListHosts(ClientPtr client)
     xListHostsReply reply;
     int len, nHosts, result;
     BOOL enabled;
-    pointer pdata;
+    void *pdata;
 
     /* REQUEST(xListHostsReq); */
 
@@ -3205,7 +3208,7 @@ ProcChangeAccessControl(ClientPtr client)
 /*********************
  * CloseDownRetainedResources
  *
- *    Find all clients that are gone and have terminated in RetainTemporary 
+ *    Find all clients that are gone and have terminated in RetainTemporary
  *    and destroy their resources.
  *********************/
 
@@ -3399,7 +3402,7 @@ CloseDownClient(ClientPtr client)
                 clientinfo.client = client;
                 clientinfo.prefix = (xConnSetupPrefix *) NULL;
                 clientinfo.setup = (xConnSetup *) NULL;
-                CallCallbacks((&ClientStateCallback), (pointer) &clientinfo);
+                CallCallbacks((&ClientStateCallback), (void *) &clientinfo);
             }
         }
         client->clientGone = TRUE;      /* so events aren't sent to client */
@@ -3429,8 +3432,9 @@ CloseDownClient(ClientPtr client)
             clientinfo.client = client;
             clientinfo.prefix = (xConnSetupPrefix *) NULL;
             clientinfo.setup = (xConnSetup *) NULL;
-            CallCallbacks((&ClientStateCallback), (pointer) &clientinfo);
+            CallCallbacks((&ClientStateCallback), (void *) &clientinfo);
         }
+        TouchListenerGone(client->clientAsMask);
         FreeClientResources(client);
         /* Disable client ID tracking. This must be done after
          * ClientStateCallback. */
@@ -3463,7 +3467,7 @@ KillAllClients(void)
 }
 
 void
-InitClient(ClientPtr client, int i, pointer ospriv)
+InitClient(ClientPtr client, int i, void *ospriv)
 {
     client->index = i;
     client->clientAsMask = ((Mask) i) << CLIENTOFFSET;
@@ -3473,7 +3477,6 @@ InitClient(ClientPtr client, int i, pointer ospriv)
     QueryMinMaxKeyCodes(&client->minKC, &client->maxKC);
     client->smart_start_tick = SmartScheduleTime;
     client->smart_stop_tick = SmartScheduleTime;
-    client->smart_check_tick = SmartScheduleTime;
     client->clientIds = NULL;
 }
 
@@ -3485,7 +3488,7 @@ InitClient(ClientPtr client, int i, pointer ospriv)
  *************************/
 
 ClientPtr
-NextAvailableClient(pointer ospriv)
+NextAvailableClient(void *ospriv)
 {
     int i;
     ClientPtr client;
@@ -3525,7 +3528,7 @@ NextAvailableClient(pointer ospriv)
         clientinfo.client = client;
         clientinfo.prefix = (xConnSetupPrefix *) NULL;
         clientinfo.setup = (xConnSetup *) NULL;
-        CallCallbacks((&ClientStateCallback), (pointer) &clientinfo);
+        CallCallbacks((&ClientStateCallback), (void *) &clientinfo);
     }
     return client;
 }
@@ -3536,14 +3539,16 @@ ProcInitialConnection(ClientPtr client)
     REQUEST(xReq);
     xConnClientPrefix *prefix;
     int whichbyte = 1;
+    char order;
 
-    prefix = (xConnClientPrefix *) ((char *) stuff + sz_xReq);
-    if ((prefix->byteOrder != 'l') && (prefix->byteOrder != 'B'))
-        return client->noClientException = -1;
-    if (((*(char *) &whichbyte) && (prefix->byteOrder == 'B')) ||
-        (!(*(char *) &whichbyte) && (prefix->byteOrder == 'l'))) {
-        client->swapped = TRUE;
-        SwapConnClientPrefix(prefix);
+    prefix = (xConnClientPrefix *) ((char *)stuff + sz_xReq);
+    order = prefix->byteOrder;
+    if (order != 'l' && order != 'B' && order != 'r' && order != 'R')
+       return client->noClientException = -1;
+    if (((*(char *) &whichbyte) && (order == 'B' || order == 'R')) ||
+       (!(*(char *) &whichbyte) && (order == 'l' || order == 'r'))) {
+       client->swapped = TRUE;
+       SwapConnClientPrefix(prefix);
     }
     stuff->reqType = 2;
     stuff->length += bytes_to_int32(prefix->nbytesAuthProto) +
@@ -3551,6 +3556,9 @@ ProcInitialConnection(ClientPtr client)
     if (client->swapped) {
         swaps(&stuff->length);
     }
+    if (order == 'r' || order == 'R') {
+       client->local = FALSE;
+    }
     ResetCurrentRequest(client);
     return Success;
 }
@@ -3640,7 +3648,7 @@ SendConnSetup(ClientPtr client, const char *reason)
         clientinfo.client = client;
         clientinfo.prefix = lconnSetupPrefix;
         clientinfo.setup = (xConnSetup *) lConnectionInfo;
-        CallCallbacks((&ClientStateCallback), (pointer) &clientinfo);
+        CallCallbacks((&ClientStateCallback), (void *) &clientinfo);
     }
     return Success;
 }
@@ -3970,7 +3978,6 @@ void
 AttachOutputGPU(ScreenPtr pScreen, ScreenPtr new)
 {
     assert(new->isGPU);
-    assert(!new->current_master);
     xorg_list_add(&new->output_head, &pScreen->output_slave_list);
     new->current_master = pScreen;
 }
@@ -3987,7 +3994,6 @@ void
 AttachOffloadGPU(ScreenPtr pScreen, ScreenPtr new)
 {
     assert(new->isGPU);
-    assert(!new->current_master);
     xorg_list_add(&new->offload_head, &pScreen->offload_slave_list);
     new->current_master = pScreen;
 }
index ad21860..1c6442c 100644 (file)
@@ -70,7 +70,7 @@ Equipment Corporation.
 #include "xf86bigfontsrv.h"
 #endif
 
-extern pointer fosNaturalParams;
+extern void *fosNaturalParams;
 extern FontPtr defaultFont;
 
 static FontPathElementPtr *font_path_elements = (FontPathElementPtr *) 0;
@@ -128,7 +128,7 @@ dixGetGlyphs(FontPtr font, unsigned long count, unsigned char *chars,
  * adding RT_FONT prevents conflict with default cursor font
  */
 Bool
-SetDefaultFont(char *defaultfontname)
+SetDefaultFont(const char *defaultfontname)
 {
     int err;
     FontPtr pf;
@@ -139,7 +139,7 @@ SetDefaultFont(char *defaultfontname)
                    (unsigned) strlen(defaultfontname), defaultfontname);
     if (err != Success)
         return FALSE;
-    err = dixLookupResourceByType((pointer *) &pf, fid, RT_FONT, serverClient,
+    err = dixLookupResourceByType((void **) &pf, fid, RT_FONT, serverClient,
                                   DixReadAccess);
     if (err != Success)
         return FALSE;
@@ -197,7 +197,7 @@ RemoveFontWakeup(FontPathElementPtr fpe)
 }
 
 void
-FontWakeup(pointer data, int count, pointer LastSelectMask)
+FontWakeup(void *data, int count, void *LastSelectMask)
 {
     int i;
     FontPathElementPtr fpe;
@@ -224,7 +224,7 @@ FreeFPE(FontPathElementPtr fpe)
     fpe->refcount--;
     if (fpe->refcount == 0) {
         (*fpe_functions[fpe->type].free_fpe) (fpe);
-        free(fpe->name);
+        free((void *) fpe->name);
         free(fpe);
     }
 }
@@ -267,7 +267,7 @@ doOpenFont(ClientPtr client, OFclosurePtr c)
     if (client->clientGone) {
         if (c->current_fpe < c->num_fpes) {
             fpe = c->fpe_list[c->current_fpe];
-            (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe);
+            (*fpe_functions[fpe->type].client_died) ((void *) client, fpe);
         }
         err = Successful;
         goto bail;
@@ -275,7 +275,7 @@ doOpenFont(ClientPtr client, OFclosurePtr c)
     while (c->current_fpe < c->num_fpes) {
         fpe = c->fpe_list[c->current_fpe];
         err = (*fpe_functions[fpe->type].open_font)
-            ((pointer) client, fpe, c->flags,
+            ((void *) client, fpe, c->flags,
              c->fontname, c->fnamelen, FontFormat,
              BitmapFormatMaskByte |
              BitmapFormatMaskBit |
@@ -288,7 +288,7 @@ doOpenFont(ClientPtr client, OFclosurePtr c)
 
         if (err == FontNameAlias && alias) {
             newlen = strlen(alias);
-            newname = (char *) realloc(c->fontname, newlen);
+            newname = (char *) realloc((char *) c->fontname, newlen);
             if (!newname) {
                 err = AllocError;
                 break;
@@ -350,7 +350,7 @@ doOpenFont(ClientPtr client, OFclosurePtr c)
             }
         }
     }
-    if (!AddResource(c->fontid, RT_FONT, (pointer) pfont)) {
+    if (!AddResource(c->fontid, RT_FONT, (void *) pfont)) {
         err = AllocError;
         goto bail;
     }
@@ -368,14 +368,14 @@ doOpenFont(ClientPtr client, OFclosurePtr c)
         FreeFPE(c->fpe_list[i]);
     }
     free(c->fpe_list);
-    free(c->fontname);
+    free((void *) c->fontname);
     free(c);
     return TRUE;
 }
 
 int
 OpenFont(ClientPtr client, XID fid, Mask flags, unsigned lenfname,
-         char *pfontname)
+         const char *pfontname)
 {
     OFclosurePtr c;
     int i;
@@ -404,7 +404,7 @@ OpenFont(ClientPtr client, XID fid, Mask flags, unsigned lenfname,
 
         cached = FindCachedFontPattern(patternCache, pfontname, lenfname);
         if (cached && cached->info.cachable) {
-            if (!AddResource(fid, RT_FONT, (pointer) cached))
+            if (!AddResource(fid, RT_FONT, (void *) cached))
                 return BadAlloc;
             cached->refcnt++;
             return Success;
@@ -426,7 +426,7 @@ OpenFont(ClientPtr client, XID fid, Mask flags, unsigned lenfname,
      */
     c->fpe_list = malloc(sizeof(FontPathElementPtr) * num_fpes);
     if (!c->fpe_list) {
-        free(c->fontname);
+        free((void *) c->fontname);
         free(c);
         return BadAlloc;
     }
@@ -453,7 +453,7 @@ OpenFont(ClientPtr client, XID fid, Mask flags, unsigned lenfname,
  *  \param value must conform to DeleteType
  */
 int
-CloseFont(pointer value, XID fid)
+CloseFont(void *value, XID fid)
 {
     int nscr;
     ScreenPtr pscr;
@@ -571,7 +571,7 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c)
     if (client->clientGone) {
         if (c->current.current_fpe < c->num_fpes) {
             fpe = c->fpe_list[c->current.current_fpe];
-            (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe);
+            (*fpe_functions[fpe->type].client_died) ((void *) client, fpe);
         }
         err = Successful;
         goto bail;
@@ -588,7 +588,7 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c)
             /* This FPE doesn't support/require list_fonts_and_aliases */
 
             err = (*fpe_functions[fpe->type].list_fonts)
-                ((pointer) c->client, fpe, c->current.pattern,
+                ((void *) c->client, fpe, c->current.pattern,
                  c->current.patlen, c->current.max_names - c->names->nnames,
                  c->names);
 
@@ -615,7 +615,7 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c)
 
             if (!c->current.list_started) {
                 err = (*fpe_functions[fpe->type].start_list_fonts_and_aliases)
-                    ((pointer) c->client, fpe, c->current.pattern,
+                    ((void *) c->client, fpe, c->current.pattern,
                      c->current.patlen, c->current.max_names - c->names->nnames,
                      &c->current.private);
                 if (err == Suspended) {
@@ -635,7 +635,7 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c)
 
                 name = 0;
                 err = (*fpe_functions[fpe->type].list_next_font_or_alias)
-                    ((pointer) c->client, fpe, &name, &namelen, &tmpname,
+                    ((void *) c->client, fpe, &name, &namelen, &tmpname,
                      &resolvedlen, c->current.private);
                 if (err == Suspended) {
                     if (!ClientIsAsleep(client))
@@ -687,7 +687,7 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c)
 
                     tmpname = 0;
                     (void) (*fpe_functions[fpe->type].list_next_font_or_alias)
-                        ((pointer) c->client, fpe, &tmpname, &tmpnamelen,
+                        ((void *) c->client, fpe, &tmpname, &tmpnamelen,
                          &tmpname, &tmpnamelen, c->current.private);
                     if (--aliascount <= 0) {
                         err = BadFontName;
@@ -869,7 +869,7 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c)
     if (client->clientGone) {
         if (c->current.current_fpe < c->num_fpes) {
             fpe = c->fpe_list[c->current.current_fpe];
-            (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe);
+            (*fpe_functions[fpe->type].client_died) ((void *) client, fpe);
         }
         err = Successful;
         goto bail;
@@ -1118,12 +1118,12 @@ doPolyText(ClientPtr client, PTclosurePtr c)
 
     if (client->clientGone) {
         fpe = c->pGC->font->fpe;
-        (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe);
+        (*fpe_functions[fpe->type].client_died) ((void *) client, fpe);
 
         if (ClientIsAsleep(client)) {
             /* Client has died, but we cannot bail out right now.  We
                need to clean up after the work we did when going to
-               sleep.  Setting the drawable pointer to 0 makes this
+               sleep.  Setting the drawable poiner to 0 makes this
                happen without any attempts to render or perform other
                unnecessary activities.  */
             c->pDraw = (DrawablePtr) 0;
@@ -1144,7 +1144,7 @@ doPolyText(ClientPtr client, PTclosurePtr c)
                the FPE code to clean up after client and avoid further
                rendering while we clean up after ourself.  */
             fpe = c->pGC->font->fpe;
-            (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe);
+            (*fpe_functions[fpe->type].client_died) ((void *) client, fpe);
             c->pDraw = (DrawablePtr) 0;
         }
     }
@@ -1165,7 +1165,7 @@ doPolyText(ClientPtr client, PTclosurePtr c)
             fid = ((Font) *(c->pElt + 4))       /* big-endian */
                 |((Font) *(c->pElt + 3)) << 8
                 | ((Font) *(c->pElt + 2)) << 16 | ((Font) *(c->pElt + 1)) << 24;
-            err = dixLookupResourceByType((pointer *) &pFont, fid, RT_FONT,
+            err = dixLookupResourceByType((void **) &pFont, fid, RT_FONT,
                                           client, DixUseAccess);
             if (err != Success) {
                 /* restore pFont for step 4 (described below) */
@@ -1399,7 +1399,7 @@ doImageText(ClientPtr client, ITclosurePtr c)
 
     if (client->clientGone) {
         fpe = c->pGC->font->fpe;
-        (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe);
+        (*fpe_functions[fpe->type].client_died) ((void *) client, fpe);
         err = Success;
         goto bail;
     }
@@ -1413,7 +1413,7 @@ doImageText(ClientPtr client, ITclosurePtr c)
             /* Our drawable has disappeared.  Treat like client died... ask
                the FPE code to clean up after client. */
             fpe = c->pGC->font->fpe;
-            (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe);
+            (*fpe_functions[fpe->type].client_died) ((void *) client, fpe);
             err = Success;
             goto bail;
         }
@@ -1425,6 +1425,7 @@ doImageText(ClientPtr client, ITclosurePtr c)
             GC *pGC;
             unsigned char *data;
             ITclosurePtr new_closure;
+            ITclosurePtr old_closure;
 
             /* We're putting the client to sleep.  We need to
                save some state.  Similar problem to that handled
@@ -1436,12 +1437,14 @@ doImageText(ClientPtr client, ITclosurePtr c)
                 err = BadAlloc;
                 goto bail;
             }
+            old_closure = c;
             *new_closure = *c;
             c = new_closure;
 
             data = malloc(c->nChars * itemSize);
             if (!data) {
                 free(c);
+                c = old_closure;
                 err = BadAlloc;
                 goto bail;
             }
@@ -1452,6 +1455,7 @@ doImageText(ClientPtr client, ITclosurePtr c)
             if (!pGC) {
                 free(c->data);
                 free(c);
+                c = old_closure;
                 err = BadAlloc;
                 goto bail;
             }
@@ -1464,6 +1468,7 @@ doImageText(ClientPtr client, ITclosurePtr c)
                 FreeScratchGC(pGC);
                 free(c->data);
                 free(c);
+                c = old_closure;
                 err = BadAlloc;
                 goto bail;
             }
@@ -1532,7 +1537,7 @@ ImageText(ClientPtr client, DrawablePtr pDraw, GC * pGC, int nChars,
 
 /* does the necessary magic to figure out the fpe type */
 static int
-DetermineFPEType(char *pathname)
+DetermineFPEType(const char *pathname)
 {
     int i;
 
@@ -1628,21 +1633,23 @@ SetFontPathElements(int npaths, unsigned char *paths, int *bad, Bool persist)
             }
             /* if error or can't do it, act like it's a new one */
             if (!fpe) {
+                char *name;
                 fpe = malloc(sizeof(FontPathElementRec));
                 if (!fpe) {
                     err = BadAlloc;
                     goto bail;
                 }
-                fpe->name = malloc(len + 1);
-                if (!fpe->name) {
+                name = malloc(len + 1);
+                if (!name) {
                     free(fpe);
                     err = BadAlloc;
                     goto bail;
                 }
                 fpe->refcount = 1;
 
-                strncpy(fpe->name, (char *) cp, (int) len);
-                fpe->name[len] = '\0';
+                strncpy(name, (char *) cp, (int) len);
+                name[len] = '\0';
+                fpe->name = name;
                 fpe->name_length = len;
                 fpe->type = DetermineFPEType(fpe->name);
                 if (fpe->type == -1)
@@ -1651,11 +1658,11 @@ SetFontPathElements(int npaths, unsigned char *paths, int *bad, Bool persist)
                     err = (*fpe_functions[fpe->type].init_fpe) (fpe);
                 if (err != Successful) {
                     if (persist) {
-                        ErrorF
+                        DebugF
                             ("[dix] Could not init font path element %s, removing from list!\n",
                              fpe->name);
                     }
-                    free(fpe->name);
+                    free((void *) fpe->name);
                     free(fpe);
                 }
             }
@@ -1707,9 +1714,10 @@ SetFontPath(ClientPtr client, int npaths, unsigned char *paths)
 }
 
 int
-SetDefaultFontPath(char *path)
+SetDefaultFontPath(const char *path)
 {
-    char *temp_path, *start, *end;
+    const char *start, *end;
+    char *temp_path;
     unsigned char *cp, *pp, *nump, *newpath;
     int num = 1, len, err, size = 0, bad;
 
@@ -1784,11 +1792,14 @@ GetFontPath(ClientPtr client, int *count, int *length, unsigned char **result)
         fpe = font_path_elements[i];
         len += fpe->name_length + 1;
     }
-    font_path_string = (unsigned char *) realloc(font_path_string, len);
-    if (!font_path_string)
+    c = realloc(font_path_string, len);
+    if (c == NULL) {
+        free(font_path_string);
+        font_path_string = NULL;
         return BadAlloc;
+    }
 
-    c = font_path_string;
+    font_path_string = c;
     *length = 0;
     for (i = 0; i < num_fpes; i++) {
         fpe = font_path_elements[i];
@@ -1811,7 +1822,7 @@ DeleteClientFontStuff(ClientPtr client)
     for (i = 0; i < num_fpes; i++) {
         fpe = font_path_elements[i];
         if (fpe_functions[fpe->type].client_died)
-            (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe);
+            (*fpe_functions[fpe->type].client_died) ((void *) client, fpe);
     }
 }
 
@@ -1823,12 +1834,14 @@ InitFonts(void)
     register_fpe_functions();
 }
 
+_X_EXPORT
 int
 GetDefaultPointSize(void)
 {
     return 120;
 }
 
+_X_EXPORT
 FontResolutionPtr
 GetClientResolutions(int *num)
 {
@@ -1861,6 +1874,7 @@ GetClientResolutions(int *num)
  * should be called (only once!) by each type of fpe when initialized
  */
 
+_X_EXPORT
 int
 RegisterFPEFunctions(NameCheckFunc name_func,
                      InitFpeFunc init_func,
@@ -1926,30 +1940,34 @@ FreeFonts(void)
 FontPtr
 find_old_font(XID id)
 {
-    pointer pFont;
+    void *pFont;
 
     dixLookupResourceByType(&pFont, id, RT_NONE, serverClient, DixReadAccess);
     return (FontPtr) pFont;
 }
 
+_X_EXPORT
 Font
 GetNewFontClientID(void)
 {
     return FakeClientID(0);
 }
 
+_X_EXPORT
 int
 StoreFontClientFont(FontPtr pfont, Font id)
 {
-    return AddResource(id, RT_NONE, (pointer) pfont);
+    return AddResource(id, RT_NONE, (void *) pfont);
 }
 
+_X_EXPORT
 void
 DeleteFontClientID(Font id)
 {
     FreeResource(id, RT_NONE);
 }
 
+_X_EXPORT
 int
 client_auth_generation(ClientPtr client)
 {
@@ -1959,6 +1977,7 @@ client_auth_generation(ClientPtr client)
 static int fs_handlers_installed = 0;
 static unsigned int last_server_gen;
 
+_X_EXPORT
 int
 init_fs_handlers(FontPathElementPtr fpe, BlockHandlerProcPtr block_handler)
 {
@@ -1969,7 +1988,7 @@ init_fs_handlers(FontPathElementPtr fpe, BlockHandlerProcPtr block_handler)
     }
     if (fs_handlers_installed == 0) {
         if (!RegisterBlockAndWakeupHandlers(block_handler,
-                                            FontWakeup, (pointer) 0))
+                                            FontWakeup, (void *) 0))
             return AllocError;
         fs_handlers_installed++;
     }
@@ -1977,6 +1996,7 @@ init_fs_handlers(FontPathElementPtr fpe, BlockHandlerProcPtr block_handler)
     return Successful;
 }
 
+_X_EXPORT
 void
 remove_fs_handlers(FontPathElementPtr fpe, BlockHandlerProcPtr block_handler,
                    Bool all)
@@ -1985,7 +2005,7 @@ remove_fs_handlers(FontPathElementPtr fpe, BlockHandlerProcPtr block_handler,
         /* remove the handlers if no one else is using them */
         if (--fs_handlers_installed == 0) {
             RemoveBlockAndWakeupHandlers(block_handler, FontWakeup,
-                                         (pointer) 0);
+                                         (void *) 0);
         }
     }
     RemoveFontWakeup(fpe);
index 3f24629..cdd370b 100644 (file)
@@ -199,7 +199,7 @@ dixLookupDrawable(DrawablePtr *pDraw, XID id, ClientPtr client,
 
     *pDraw = NULL;
 
-    rc = dixLookupResourceByClass((pointer *) &pTmp, id, RC_DRAWABLE, client,
+    rc = dixLookupResourceByClass((void **) &pTmp, id, RC_DRAWABLE, client,
                                   access);
 
     if (rc != Success)
@@ -236,7 +236,7 @@ dixLookupWindow(WindowPtr *pWin, XID id, ClientPtr client, Mask access)
 int
 dixLookupGC(GCPtr *pGC, XID id, ClientPtr client, Mask access)
 {
-    return dixLookupResourceByType((pointer *) pGC, id, RT_GC, client, access);
+    return dixLookupResourceByType((void **) pGC, id, RT_GC, client, access);
 }
 
 int
@@ -246,11 +246,11 @@ dixLookupFontable(FontPtr *pFont, XID id, ClientPtr client, Mask access)
     GC *pGC;
 
     client->errorValue = id;    /* EITHER font or gc */
-    rc = dixLookupResourceByType((pointer *) pFont, id, RT_FONT, client,
+    rc = dixLookupResourceByType((void **) pFont, id, RT_FONT, client,
                                  access);
     if (rc != BadFont)
         return rc;
-    rc = dixLookupResourceByType((pointer *) &pGC, id, RT_GC, client, access);
+    rc = dixLookupResourceByType((void **) &pGC, id, RT_GC, client, access);
     if (rc == BadGC)
         return BadFont;
     if (rc == Success)
@@ -261,7 +261,7 @@ dixLookupFontable(FontPtr *pFont, XID id, ClientPtr client, Mask access)
 int
 dixLookupClient(ClientPtr *pClient, XID rid, ClientPtr client, Mask access)
 {
-    pointer pRes;
+    void *pRes;
     int rc = BadValue, clientIndex = CLIENT_ID(rid);
 
     if (!clientIndex || !clients[clientIndex] || (rid & SERVER_BIT))
@@ -296,7 +296,7 @@ AlterSaveSetForClient(ClientPtr client, WindowPtr pWin, unsigned mode,
     j = 0;
     if (numnow) {
         pTmp = client->saveSet;
-        while ((j < numnow) && (SaveSetWindow(pTmp[j]) != (pointer) pWin))
+        while ((j < numnow) && (SaveSetWindow(pTmp[j]) != (void *) pWin))
             j++;
     }
     if (mode == SetModeInsert) {
@@ -362,7 +362,7 @@ NoopDDA(void)
 typedef struct _BlockHandler {
     BlockHandlerProcPtr BlockHandler;
     WakeupHandlerProcPtr WakeupHandler;
-    pointer blockData;
+    void *blockData;
     Bool deleted;
 } BlockHandlerRec, *BlockHandlerPtr;
 
@@ -378,7 +378,7 @@ static Bool handlerDeleted;
  *  \param pReadMask  nor how it represents the det of descriptors
  */
 void
-BlockHandler(pointer pTimeout, pointer pReadmask)
+BlockHandler(void *pTimeout, void *pReadmask)
 {
     int i, j;
 
@@ -413,7 +413,7 @@ BlockHandler(pointer pTimeout, pointer pReadmask)
  *  \param pReadmask the resulting descriptor mask
  */
 void
-WakeupHandler(int result, pointer pReadmask)
+WakeupHandler(int result, void *pReadmask)
 {
     int i, j;
 
@@ -449,7 +449,7 @@ WakeupHandler(int result, pointer pReadmask)
 Bool
 RegisterBlockAndWakeupHandlers(BlockHandlerProcPtr blockHandler,
                                WakeupHandlerProcPtr wakeupHandler,
-                               pointer blockData)
+                               void *blockData)
 {
     BlockHandlerPtr new;
 
@@ -472,7 +472,7 @@ RegisterBlockAndWakeupHandlers(BlockHandlerProcPtr blockHandler,
 void
 RemoveBlockAndWakeupHandlers(BlockHandlerProcPtr blockHandler,
                              WakeupHandlerProcPtr wakeupHandler,
-                             pointer blockData)
+                             void *blockData)
 {
     int i;
 
@@ -556,9 +556,8 @@ ProcessWorkQueueZombies(void)
 }
 
 Bool
-QueueWorkProc(Bool (*function)
-              (ClientPtr /* pClient */ , pointer /* closure */ ),
-              ClientPtr client, pointer closure)
+QueueWorkProc(Bool (*function) (ClientPtr pClient, void *closure),
+              ClientPtr client, void *closure)
 {
     WorkQueuePtr q;
 
@@ -586,13 +585,13 @@ typedef struct _SleepQueue {
     struct _SleepQueue *next;
     ClientPtr client;
     ClientSleepProcPtr function;
-    pointer closure;
+    void *closure;
 } SleepQueueRec, *SleepQueuePtr;
 
 static SleepQueuePtr sleepQueue = NULL;
 
 Bool
-ClientSleep(ClientPtr client, ClientSleepProcPtr function, pointer closure)
+ClientSleep(ClientPtr client, ClientSleepProcPtr function, void *closure)
 {
     SleepQueuePtr q;
 
@@ -666,7 +665,7 @@ static int numCallbackListsToCleanup = 0;
 static CallbackListPtr **listsToCleanup = NULL;
 
 static Bool
-_AddCallback(CallbackListPtr *pcbl, CallbackProcPtr callback, pointer data)
+_AddCallback(CallbackListPtr *pcbl, CallbackProcPtr callback, void *data)
 {
     CallbackPtr cbr;
 
@@ -682,7 +681,7 @@ _AddCallback(CallbackListPtr *pcbl, CallbackProcPtr callback, pointer data)
 }
 
 static Bool
-_DeleteCallback(CallbackListPtr *pcbl, CallbackProcPtr callback, pointer data)
+_DeleteCallback(CallbackListPtr *pcbl, CallbackProcPtr callback, void *data)
 {
     CallbackListPtr cbl = *pcbl;
     CallbackPtr cbr, pcbr;
@@ -709,7 +708,7 @@ _DeleteCallback(CallbackListPtr *pcbl, CallbackProcPtr callback, pointer data)
 }
 
 void
-_CallCallbacks(CallbackListPtr *pcbl, pointer call_data)
+_CallCallbacks(CallbackListPtr *pcbl, void *call_data)
 {
     CallbackListPtr cbl = *pcbl;
     CallbackPtr cbr, pcbr;
@@ -821,7 +820,7 @@ CreateCallbackList(CallbackListPtr *pcbl)
 /* ===== Public Procedures ===== */
 
 Bool
-AddCallback(CallbackListPtr *pcbl, CallbackProcPtr callback, pointer data)
+AddCallback(CallbackListPtr *pcbl, CallbackProcPtr callback, void *data)
 {
     if (!pcbl)
         return FALSE;
@@ -833,7 +832,7 @@ AddCallback(CallbackListPtr *pcbl, CallbackProcPtr callback, pointer data)
 }
 
 Bool
-DeleteCallback(CallbackListPtr *pcbl, CallbackProcPtr callback, pointer data)
+DeleteCallback(CallbackListPtr *pcbl, CallbackProcPtr callback, void *data)
 {
     if (!pcbl || !*pcbl)
         return FALSE;
@@ -849,7 +848,7 @@ DeleteCallbackList(CallbackListPtr *pcbl)
 }
 
 void
-InitCallbackManager(void)
+DeleteCallbackManager(void)
 {
     int i;
 
@@ -861,3 +860,34 @@ InitCallbackManager(void)
     numCallbackListsToCleanup = 0;
     listsToCleanup = NULL;
 }
+
+void
+InitCallbackManager(void)
+{
+    DeleteCallbackManager();
+}
+
+/**
+ * Coordinates the global GL context used by modules in the X Server
+ * doing rendering with OpenGL.
+ *
+ * When setting a GL context (glXMakeCurrent() or eglMakeCurrent()),
+ * there is an expensive implied glFlush() required by the GLX and EGL
+ * APIs, so modules don't want to have to do it on every request.  But
+ * the individual modules using GL also don't know about each other,
+ * so they have to coordinate who owns the current context.
+ *
+ * When you're about to do a MakeCurrent, you should set this variable
+ * to your context's address, and you can skip MakeCurrent if it's
+ * already set to yours.
+ *
+ * When you're about to do a DestroyContext, you should set this to
+ * NULL if it's set to your context.
+ *
+ * When you're about to do an unbindContext on a DRI driver, you
+ * should set this to NULL.  Despite the unbindContext interface
+ * sounding like it only unbinds the passed in context, it actually
+ * unconditionally clears the dispatch table even if the given
+ * context wasn't current.
+ */
+void *lastGLContext = NULL;
index 431566f..54f4b85 100644 (file)
@@ -39,6 +39,7 @@
 #include "enterleave.h"
 #include "eventconvert.h"
 #include "xkbsrv.h"
+#include "inpututils.h"
 
 /**
  * @file
@@ -799,8 +800,8 @@ DeviceFocusEvent(DeviceIntPtr dev, int type, int mode, int detail,
     xi2event->deviceid = dev->id;
     xi2event->sourceid = dev->id;       /* a device doesn't change focus by itself */
     xi2event->mode = mode;
-    xi2event->root_x = FP1616(mouse->spriteInfo->sprite->hot.x, 0);
-    xi2event->root_y = FP1616(mouse->spriteInfo->sprite->hot.y, 0);
+    xi2event->root_x = double_to_fp1616(mouse->spriteInfo->sprite->hot.x);
+    xi2event->root_y = double_to_fp1616(mouse->spriteInfo->sprite->hot.y);
 
     for (i = 0; mouse && mouse->button && i < mouse->button->numButtons; i++)
         if (BitIsOn(mouse->button->down, i))
index 241e60d..bd96173 100644 (file)
@@ -57,6 +57,7 @@ static int eventToKeyButtonPointer(DeviceEvent *ev, xEvent **xi, int *count);
 static int eventToDeviceChanged(DeviceChangedEvent *ev, xEvent **dcce);
 static int eventToDeviceEvent(DeviceEvent *ev, xEvent **xi);
 static int eventToRawEvent(RawDeviceEvent *ev, xEvent **xi);
+static int eventToBarrierEvent(BarrierEvent *ev, xEvent **xi);
 static int eventToTouchOwnershipEvent(TouchOwnershipEvent *ev, xEvent **xi);
 static int eventToTouchCancelEvent(TouchCancelEvent *ev, xEvent **xi);
 
@@ -162,6 +163,8 @@ EventToCore(InternalEvent *event, xEvent **core_out, int *count_out)
     case ET_TouchEnd:
     case ET_TouchOwnership:
     case ET_TouchCancel:
+    case ET_BarrierHit:
+    case ET_BarrierLeave:
         ret = BadMatch;
         break;
     default:
@@ -219,6 +222,8 @@ EventToXI(InternalEvent *ev, xEvent **xi, int *count)
     case ET_TouchEnd:
     case ET_TouchOwnership:
     case ET_TouchCancel:
+    case ET_BarrierHit:
+    case ET_BarrierLeave:
         *count = 0;
         *xi = NULL;
         return BadMatch;
@@ -282,6 +287,9 @@ EventToXI2(InternalEvent *ev, xEvent **xi)
     case ET_RawTouchUpdate:
     case ET_RawTouchEnd:
         return eventToRawEvent(&ev->raw_event, xi);
+    case ET_BarrierHit:
+    case ET_BarrierLeave:
+        return eventToBarrierEvent(&ev->barrier_event, xi);
     default:
         break;
     }
@@ -456,7 +464,7 @@ appendKeyInfo(DeviceChangedEvent *dce, xXIKeyInfo * info)
     info->length = sizeof(xXIKeyInfo) / 4 + info->num_keycodes;
     info->sourceid = dce->sourceid;
 
-    kc = (uint32_t *) & info[1];
+    kc = (uint32_t *) &info[1];
     for (i = 0; i < info->num_keycodes; i++)
         *kc++ = i + dce->keys.min_keycode;
 
@@ -498,9 +506,7 @@ appendValuatorInfo(DeviceChangedEvent *dce, xXIValuatorInfo * info,
     info->min.frac = 0;
     info->max.integral = dce->valuators[axisnumber].max;
     info->max.frac = 0;
-    /* FIXME: value */
-    info->value.integral = 0;
-    info->value.frac = 0;
+    info->value = double_to_fp3232(dce->valuators[axisnumber].value);
     info->resolution = dce->valuators[axisnumber].resolution;
     info->number = axisnumber;
     info->mode = dce->valuators[axisnumber].mode;
@@ -678,20 +684,21 @@ eventToDeviceEvent(DeviceEvent *ev, xEvent **xi)
     xde->valuators_len = vallen;
     xde->deviceid = ev->deviceid;
     xde->sourceid = ev->sourceid;
-    xde->root_x = FP1616(ev->root_x, ev->root_x_frac);
-    xde->root_y = FP1616(ev->root_y, ev->root_y_frac);
+    xde->root_x = double_to_fp1616(ev->root_x + ev->root_x_frac);
+    xde->root_y = double_to_fp1616(ev->root_y + ev->root_y_frac);
 
-    if (ev->type == ET_TouchUpdate)
-        xde->flags |= (ev->flags & TOUCH_PENDING_END) ? XITouchPendingEnd : 0;
-    else
-        xde->flags = ev->flags;
+    if (IsTouchEvent((InternalEvent *)ev)) {
+        if (ev->type == ET_TouchUpdate)
+            xde->flags |= (ev->flags & TOUCH_PENDING_END) ? XITouchPendingEnd : 0;
 
-    if (IsTouchEvent((InternalEvent *) ev) &&
-        ev->flags & TOUCH_POINTER_EMULATED)
-        xde->flags |= XITouchEmulatingPointer;
+        if (ev->flags & TOUCH_POINTER_EMULATED)
+            xde->flags |= XITouchEmulatingPointer;
+    } else {
+        xde->flags = ev->flags;
 
-    if (ev->key_repeat)
-        xde->flags |= XIKeyRepeat;
+        if (ev->key_repeat)
+            xde->flags |= XIKeyRepeat;
+    }
 
     xde->mods.base_mods = ev->mods.base;
     xde->mods.latched_mods = ev->mods.latched;
@@ -807,6 +814,35 @@ eventToRawEvent(RawDeviceEvent *ev, xEvent **xi)
     return Success;
 }
 
+static int
+eventToBarrierEvent(BarrierEvent *ev, xEvent **xi)
+{
+    xXIBarrierEvent *barrier;
+    int len = sizeof(xXIBarrierEvent);
+
+    *xi = calloc(1, len);
+    barrier = (xXIBarrierEvent*) *xi;
+    barrier->type = GenericEvent;
+    barrier->extension = IReqCode;
+    barrier->evtype = GetXI2Type(ev->type);
+    barrier->length = bytes_to_int32(len - sizeof(xEvent));
+    barrier->deviceid = ev->deviceid;
+    barrier->sourceid = ev->sourceid;
+    barrier->time = ev->time;
+    barrier->event = ev->window;
+    barrier->root = ev->root;
+    barrier->dx = double_to_fp3232(ev->dx);
+    barrier->dy = double_to_fp3232(ev->dy);
+    barrier->dtime = ev->dt;
+    barrier->flags = ev->flags;
+    barrier->eventid = ev->event_id;
+    barrier->barrier = ev->barrierid;
+    barrier->root_x = double_to_fp1616(ev->root_x);
+    barrier->root_y = double_to_fp1616(ev->root_y);
+
+    return Success;
+}
+
 /**
  * Return the corresponding core type for the given event or 0 if no core
  * equivalent exists.
@@ -954,6 +990,12 @@ GetXI2Type(enum EventType type)
     case ET_TouchOwnership:
         xi2type = XI_TouchOwnership;
         break;
+    case ET_BarrierHit:
+        xi2type = XI_BarrierHit;
+        break;
+    case ET_BarrierLeave:
+        xi2type = XI_BarrierLeave;
+        break;
     case ET_TouchCancel:
         xi2type = XI_TouchCancel;
         break;
@@ -973,7 +1015,7 @@ DeviceIntPtr GetDeviceInfoFromID(int devid)
         return NULL;
     }
 
-    for( dev = inputInfo.pointer ; dev; dev = dev->next )
+    for (dev = inputInfo.pointer; dev; dev = dev->next)
     {
         if (dev->id == devid)
         {
@@ -1017,4 +1059,4 @@ int GetValuatorIndexFromAtomName(DeviceIntPtr dev, char *aname)
     }
     return index;
 }
-#endif //_F_INPUT_REDIRECTION_
\ No newline at end of file
+#endif //_F_INPUT_REDIRECTION_
index 7631c64..9f9caeb 100755 (executable)
@@ -157,6 +157,16 @@ typedef const char *string;
 #include "eventconvert.h"
 #include "mi.h"
 
+//#ifdef _ADD_HOOK_FOR_WARP_POINTER_
+CallbackListPtr WarpPointerCallback = NULL;
+//#endif
+
+#ifdef _F_PREVENT_CURSOR_FLICKER_
+static int isCursorChanged = 0;
+static int prev_is_enable_cursor = 0;
+extern int is_enable_cursor;
+#endif
+
 /* Extension events type numbering starts at EXTENSION_EVENT_BASE.  */
 #define NoSuchEvent 0x80000000  /* so doesn't match NoEventMask */
 #define StructureAndSubMask ( StructureNotifyMask | SubstructureNotifyMask )
@@ -180,6 +190,17 @@ typedef const char *string;
 #define LastEventMask OwnerGrabButtonMask
 #define AllEventMasks (LastEventMask|(LastEventMask-1))
 
+#ifdef _F_EVK_INPUT_RELAY_ECHOP
+#include "mipointer.h"
+#include "xf86Xinput.h"
+
+InternalEvent* xf86InputEvents = NULL;
+static void
+SendPointerEvent(InternalEvent *pEvent_list, DeviceIntPtr pDev, int nType, int nButtons,
+                 int nFlags, int nFirst_Valuator, int nNumValuators, int *pValuators);
+static int DeliverInputDeviceEvents(xEvent *pEvents);
+#endif //_F_EVK_INPUT_RELAY_ECHOP
+
 /* @return the core event type or 0 if the event is not a core event */
 static inline int
 core_get_type(const xEvent *event)
@@ -222,6 +243,9 @@ static void CheckVirtualMotion(DeviceIntPtr pDev, QdEventPtr qe,
 static void CheckPhysLimits(DeviceIntPtr pDev, CursorPtr cursor,
                             Bool generateEvents, Bool confineToScreen,
                             ScreenPtr pScreen);
+static Bool IsWrongPointerBarrierClient(ClientPtr client,
+                                        DeviceIntPtr dev,
+                                        xEvent *event);
 
 /** Key repeat hack. Do not use but in TryClientEvents */
 extern BOOL EventIsKeyRepeat(xEvent *event);
@@ -262,6 +286,11 @@ InputInfo inputInfo;
 
 EventSyncInfoRec syncEvents;
 
+static struct DeviceEventTime {
+    Bool reset;
+    TimeStamp time;
+} lastDeviceEventTime[MAXDEVICES];
+
 /**
  * The root window the given device is currently on.
  */
@@ -575,7 +604,7 @@ XineramaSetWindowPntrs(DeviceIntPtr pDev, WindowPtr pWin)
         PanoramiXRes *win;
         int rc, i;
 
-        rc = dixLookupResourceByType((pointer *) &win, pWin->drawable.id,
+        rc = dixLookupResourceByType((void **) &win, pWin->drawable.id,
                                      XRT_WINDOW, serverClient, DixReadAccess);
         if (rc != Success)
             return FALSE;
@@ -890,6 +919,16 @@ ConfineCursorToWindow(DeviceIntPtr pDev, WindowPtr pWin, Bool generateEvents,
         }
 #endif
         pSprite->hotLimits = *RegionExtents(&pWin->borderSize);
+#ifdef _F_INPUT_REDIRECTION_
+        int cx1=0, cx2=0, cy1=0, cy2=0;
+        CompositeXYScreenFromWindowRootCoordinate(pWin, pSprite->hotLimits.x1, pSprite->hotLimits.y1, &cx1, &cy1);
+        CompositeXYScreenFromWindowRootCoordinate(pWin, pSprite->hotLimits.x2, pSprite->hotLimits.y2, &cx2, &cy2);
+
+        pSprite->hotLimits.x1 = cx1;
+        pSprite->hotLimits.x2 = cx2;
+        pSprite->hotLimits.y1 = cy1;
+        pSprite->hotLimits.y2 = cy2;
+#endif //_F_INPUT_REDIRECTION_
         pSprite->hotShape = wBoundingShape(pWin) ? &pWin->borderSize
             : NullRegion;
         CheckPhysLimits(pDev, pSprite->current, generateEvents,
@@ -931,8 +970,7 @@ ChangeToCursor(DeviceIntPtr pDev, CursorPtr cursor)
 
         (*pScreen->DisplayCursor) (pDev, pScreen, cursor);
         FreeCursor(pSprite->current, (Cursor) 0);
-        pSprite->current = cursor;
-        pSprite->current->refcnt++;
+        pSprite->current = RefCursor(cursor);
     }
 }
 
@@ -956,6 +994,10 @@ IsParent(WindowPtr a, WindowPtr b)
 static void
 PostNewCursor(DeviceIntPtr pDev)
 {
+#ifdef _F_PREVENT_CURSOR_FLICKER_
+    if (is_enable_cursor)
+    {
+#endif
     WindowPtr win;
     GrabPtr grab = pDev->deviceGrab.grab;
     SpritePtr pSprite = pDev->spriteInfo->sprite;
@@ -986,6 +1028,9 @@ PostNewCursor(DeviceIntPtr pDev)
             }
         }
     }
+#ifdef _F_PREVENT_CURSOR_FLICKER_
+    }
+#endif
 }
 
 /**
@@ -1044,33 +1089,73 @@ XineramaGetCursorScreen(DeviceIntPtr pDev)
 #define TIMESLOP (5 * 60 * 1000)        /* 5 minutes */
 
 static void
-MonthChangedOrBadTime(InternalEvent *ev)
+MonthChangedOrBadTime(CARD32 *ms)
 {
     /* If the ddx/OS is careless about not processing timestamped events from
      * different sources in sorted order, then it's possible for time to go
      * backwards when it should not.  Here we ensure a decent time.
      */
-    if ((currentTime.milliseconds - ev->any.time) > TIMESLOP)
+    if ((currentTime.milliseconds - *ms) > TIMESLOP)
         currentTime.months++;
     else
-        ev->any.time = currentTime.milliseconds;
+        *ms = currentTime.milliseconds;
+}
+
+void
+NoticeTime(const DeviceIntPtr dev, TimeStamp time)
+{
+    lastDeviceEventTime[XIAllDevices].time = currentTime;
+    lastDeviceEventTime[dev->id].time = currentTime;
+
+    LastEventTimeToggleResetFlag(dev->id, TRUE);
+    LastEventTimeToggleResetFlag(XIAllDevices, TRUE);
 }
 
 static void
-NoticeTime(InternalEvent *ev, DeviceIntPtr dev)
+NoticeTimeMillis(const DeviceIntPtr dev, CARD32 *ms)
 {
-    if (ev->any.time < currentTime.milliseconds)
-        MonthChangedOrBadTime(ev);
-    currentTime.milliseconds = ev->any.time;
-    lastDeviceEventTime[XIAllDevices] = currentTime;
-    lastDeviceEventTime[dev->id] = currentTime;
+    TimeStamp time;
+    if (*ms < currentTime.milliseconds)
+        MonthChangedOrBadTime(ms);
+    time.months = currentTime.months;
+    time.milliseconds = *ms;
+    NoticeTime(dev, time);
 }
 
 void
 NoticeEventTime(InternalEvent *ev, DeviceIntPtr dev)
 {
     if (!syncEvents.playingEvents)
-        NoticeTime(ev, dev);
+        NoticeTimeMillis(dev, &ev->any.time);
+}
+
+TimeStamp
+LastEventTime(int deviceid)
+{
+    return lastDeviceEventTime[deviceid].time;
+}
+
+Bool
+LastEventTimeWasReset(int deviceid)
+{
+    return lastDeviceEventTime[deviceid].reset;
+}
+
+void
+LastEventTimeToggleResetFlag(int deviceid, Bool state)
+{
+    lastDeviceEventTime[deviceid].reset = state;
+}
+
+void
+LastEventTimeToggleResetAll(Bool state)
+{
+    DeviceIntPtr dev;
+    nt_list_for_each_entry(dev, inputInfo.devices, next) {
+        LastEventTimeToggleResetFlag(dev->id, FALSE);
+    }
+    LastEventTimeToggleResetFlag(XIAllDevices, FALSE);
+    LastEventTimeToggleResetFlag(XIAllMasterDevices, FALSE);
 }
 
 /**************************************************************************
@@ -1094,7 +1179,7 @@ EnqueueEvent(InternalEvent *ev, DeviceIntPtr device)
     if (!xorg_list_is_empty(&syncEvents.pending))
         tail = xorg_list_last_entry(&syncEvents.pending, QdEventRec, next);
 
-    NoticeTime((InternalEvent *)event, device);
+    NoticeTimeMillis(device, &ev->any.time);
 
     /* Fix for key repeating bug. */
     if (device->key != NULL && device->key->xkbInfo != NULL &&
@@ -1118,7 +1203,7 @@ EnqueueEvent(InternalEvent *ev, DeviceIntPtr device)
 
         eventinfo.event = ev;
         eventinfo.device = device;
-        CallCallbacks(&DeviceEventCallback, (pointer) &eventinfo);
+        CallCallbacks(&DeviceEventCallback, (void *) &eventinfo);
     }
 
     if (event->type == ET_Motion) {
@@ -1200,6 +1285,9 @@ PlayReleasedEvents(void)
                 case ET_KeyRelease:
                 case ET_ProximityIn:
                 case ET_ProximityOut:
+                case ET_TouchBegin:
+                case ET_TouchUpdate:
+                case ET_TouchEnd:
                     ev->root_x += screenInfo.screens[0]->x -
                         pDev->spriteInfo->sprite->screen->x;
                     ev->root_y += screenInfo.screens[0]->y -
@@ -1424,21 +1512,24 @@ UpdateTouchesForGrab(DeviceIntPtr mouse)
 
     for (i = 0; i < mouse->touch->num_touches; i++) {
         TouchPointInfoPtr ti = mouse->touch->touches + i;
+        TouchListener *listener = &ti->listeners[0];
         GrabPtr grab = mouse->deviceGrab.grab;
 
         if (ti->active &&
-            CLIENT_BITS(ti->listeners[0].listener) == grab->resource) {
-            ti->listeners[0].listener = grab->resource;
-            ti->listeners[0].level = grab->grabtype;
-            ti->listeners[0].state = LISTENER_IS_OWNER;
-            ti->listeners[0].window = grab->window;
+            CLIENT_BITS(listener->listener) == grab->resource) {
+            listener->listener = grab->resource;
+            listener->level = grab->grabtype;
+            listener->state = LISTENER_IS_OWNER;
+            listener->window = grab->window;
 
             if (grab->grabtype == CORE || grab->grabtype == XI ||
                 !xi2mask_isset(grab->xi2mask, mouse, XI_TouchBegin))
-                ti->listeners[0].type = LISTENER_POINTER_GRAB;
+                listener->type = LISTENER_POINTER_GRAB;
             else
-                ti->listeners[0].type = LISTENER_GRAB;
-            ti->listeners[0].grab = grab;
+                listener->type = LISTENER_GRAB;
+            if (listener->grab)
+                FreeGrab(listener->grab);
+            listener->grab = AllocGrab(grab);
         }
     }
 }
@@ -1463,6 +1554,7 @@ ActivatePointerGrab(DeviceIntPtr mouse, GrabPtr grab,
                     TimeStamp time, Bool autoGrab)
 {
     GrabInfoPtr grabinfo = &mouse->deviceGrab;
+    GrabPtr oldgrab = grabinfo->grab;
     WindowPtr oldWin = (grabinfo->grab) ?
         grabinfo->grab->window : mouse->spriteInfo->sprite->win;
     Bool isPassive = autoGrab & ~ImplicitGrabMask;
@@ -1485,16 +1577,15 @@ ActivatePointerGrab(DeviceIntPtr mouse, GrabPtr grab,
         grabinfo->grabTime = syncEvents.time;
     else
         grabinfo->grabTime = time;
-    if (grab->cursor)
-        grab->cursor->refcnt++;
-    CopyGrab(grabinfo->activeGrab, grab);
-    grabinfo->grab = grabinfo->activeGrab;
+    grabinfo->grab = AllocGrab(grab);
     grabinfo->fromPassiveGrab = isPassive;
     grabinfo->implicitGrab = autoGrab & ImplicitGrabMask;
     PostNewCursor(mouse);
     UpdateTouchesForGrab(mouse);
     CheckGrabForSyncs(mouse, (Bool) grab->pointerMode,
                       (Bool) grab->keyboardMode);
+    if (oldgrab)
+        FreeGrab(oldgrab);
 }
 
 /**
@@ -1507,26 +1598,31 @@ DeactivatePointerGrab(DeviceIntPtr mouse)
 {
     GrabPtr grab = mouse->deviceGrab.grab;
     DeviceIntPtr dev;
+    Bool wasPassive = mouse->deviceGrab.fromPassiveGrab;
     Bool wasImplicit = (mouse->deviceGrab.fromPassiveGrab &&
                         mouse->deviceGrab.implicitGrab);
     XID grab_resource = grab->resource;
     int i;
 
-    Bool wasPassive = mouse->deviceGrab.fromPassiveGrab;
-
     /* If an explicit grab was deactivated, we must remove it from the head of
      * all the touches' listener lists. */
     for (i = 0; !wasPassive && mouse->touch && i < mouse->touch->num_touches; i++) {
         TouchPointInfoPtr ti = mouse->touch->touches + i;
         if (ti->active && TouchResourceIsOwner(ti, grab_resource)) {
+            int mode = XIRejectTouch;
             /* Rejecting will generate a TouchEnd, but we must not
                emulate a ButtonRelease here. So pretend the listener
                already has the end event */
             if (grab->grabtype == CORE || grab->grabtype == XI ||
-                    !xi2mask_isset(mouse->deviceGrab.grab->xi2mask, mouse, XI_TouchBegin))
+                    !xi2mask_isset(mouse->deviceGrab.grab->xi2mask, mouse, XI_TouchBegin)) {
+                mode = XIAcceptTouch;
+                /* NOTE: we set the state here, but
+                 * ProcessTouchOwnershipEvent() will still call
+                 * TouchEmitTouchEnd for this listener. The other half of
+                 * this hack is in DeliverTouchEndEvent */
                 ti->listeners[0].state = LISTENER_HAS_END;
-            //Commented temporarily for a bug
-            //TouchListenerAcceptReject(mouse, ti, 0, XIRejectTouch);
+            }
+            TouchListenerAcceptReject(mouse, ti, 0, mode);
         }
     }
 
@@ -1546,13 +1642,13 @@ DeactivatePointerGrab(DeviceIntPtr mouse)
     if (grab->confineTo)
         ConfineCursorToWindow(mouse, GetCurrentRootWindow(mouse), FALSE, FALSE);
     PostNewCursor(mouse);
-    if (grab->cursor)
-        FreeCursor(grab->cursor, (Cursor) 0);
 
     if (!wasImplicit && grab->grabtype == XI2)
         ReattachToOldMaster(mouse);
 
     ComputeFreezes();
+
+    FreeGrab(grab);
 }
 
 /**
@@ -1565,14 +1661,17 @@ ActivateKeyboardGrab(DeviceIntPtr keybd, GrabPtr grab, TimeStamp time,
                      Bool passive)
 {
     GrabInfoPtr grabinfo = &keybd->deviceGrab;
+    GrabPtr oldgrab = grabinfo->grab;
     WindowPtr oldWin;
 
     /* slave devices need to float for the duration of the grab. */
-    if (grab->grabtype == XI2 &&
+    if (grab->grabtype == XI2 && keybd->enabled &&
         !(passive & ImplicitGrabMask) && !IsMaster(keybd))
         DetachFromMaster(keybd);
 
-    if (grabinfo->grab)
+    if (!keybd->enabled)
+        oldWin = NULL;
+    else if (grabinfo->grab)
         oldWin = grabinfo->grab->window;
     else if (keybd->focus)
         oldWin = keybd->focus->win;
@@ -1582,17 +1681,19 @@ ActivateKeyboardGrab(DeviceIntPtr keybd, GrabPtr grab, TimeStamp time,
         oldWin = keybd->focus->win;
     if (keybd->valuator)
         keybd->valuator->motionHintWindow = NullWindow;
-    DoFocusEvents(keybd, oldWin, grab->window, NotifyGrab);
+    if (oldWin)
+        DoFocusEvents(keybd, oldWin, grab->window, NotifyGrab);
     if (syncEvents.playingEvents)
         grabinfo->grabTime = syncEvents.time;
     else
         grabinfo->grabTime = time;
-    CopyGrab(grabinfo->activeGrab, grab);
-    grabinfo->grab = grabinfo->activeGrab;
+    grabinfo->grab = AllocGrab(grab);
     grabinfo->fromPassiveGrab = passive;
     grabinfo->implicitGrab = passive & ImplicitGrabMask;
     CheckGrabForSyncs(keybd, (Bool) grab->keyboardMode,
                       (Bool) grab->pointerMode);
+    if (oldgrab)
+        FreeGrab(oldgrab);
 }
 
 /**
@@ -1603,13 +1704,10 @@ DeactivateKeyboardGrab(DeviceIntPtr keybd)
 {
     GrabPtr grab = keybd->deviceGrab.grab;
     DeviceIntPtr dev;
-    WindowPtr focusWin = keybd->focus ? keybd->focus->win
-        : keybd->spriteInfo->sprite->win;
+    WindowPtr focusWin;
     Bool wasImplicit = (keybd->deviceGrab.fromPassiveGrab &&
                         keybd->deviceGrab.implicitGrab);
 
-    if (focusWin == FollowKeyboardWin)
-        focusWin = inputInfo.keyboard->focus->win;
     if (keybd->valuator)
         keybd->valuator->motionHintWindow = NullWindow;
     keybd->deviceGrab.grab = NullGrab;
@@ -1620,12 +1718,25 @@ DeactivateKeyboardGrab(DeviceIntPtr keybd)
         if (dev->deviceGrab.sync.other == grab)
             dev->deviceGrab.sync.other = NullGrab;
     }
+
+    if (keybd->focus)
+        focusWin = keybd->focus->win;
+    else if (keybd->spriteInfo->sprite)
+        focusWin = keybd->spriteInfo->sprite->win;
+    else
+        focusWin = NullWindow;
+
+    if (focusWin == FollowKeyboardWin)
+        focusWin = inputInfo.keyboard->focus->win;
+
     DoFocusEvents(keybd, grab->window, focusWin, NotifyUngrab);
 
     if (!wasImplicit && grab->grabtype == XI2)
         ReattachToOldMaster(keybd);
 
     ComputeFreezes();
+
+    FreeGrab(grab);
 }
 
 void
@@ -1732,6 +1843,16 @@ AllowSome(ClientPtr client, TimeStamp time, DeviceIntPtr thisDev, int newState)
         }
         break;
     }
+
+    /* We've unfrozen the grab. If the grab was a touch grab, we're now the
+     * owner and expected to accept/reject it. Reject == ReplayPointer which
+     * we've handled in ComputeFreezes() (during DeactivateGrab) above,
+     * anything else is accept.
+     */
+    if (newState != NOT_GRABBED /* Replay */ &&
+        IsTouchEvent((InternalEvent*)grabinfo->sync.event)) {
+        TouchAcceptAndEnd(thisDev, grabinfo->sync.event->touchid);
+    }
 }
 
 /**
@@ -1966,7 +2087,7 @@ ActivateImplicitGrab(DeviceIntPtr dev, ClientPtr client, WindowPtr win,
     else
         return FALSE;
 
-    tempGrab = AllocGrab();
+    tempGrab = AllocGrab(NULL);
     if (!tempGrab)
         return FALSE;
     tempGrab->next = NULL;
@@ -2033,19 +2154,19 @@ DeliverToWindowOwner(DeviceIntPtr dev, WindowPtr win,
  */
 static Bool
 GetClientsForDelivery(DeviceIntPtr dev, WindowPtr win,
-                      xEvent *events, Mask filter, InputClients ** clients)
+                      xEvent *events, Mask filter, InputClients ** iclients)
 {
     int rc = 0;
 
     if (core_get_type(events) != 0)
-        *clients = (InputClients *) wOtherClients(win);
+        *iclients = (InputClients *) wOtherClients(win);
     else if (xi2_get_type(events) != 0) {
         OtherInputMasks *inputMasks = wOtherInputMasks(win);
 
         /* Has any client selected for the event? */
         if (!WindowXI2MaskIsset(dev, win, events))
             goto out;
-        *clients = inputMasks->inputClients;
+        *iclients = inputMasks->inputClients;
     }
     else {
         OtherInputMasks *inputMasks = wOtherInputMasks(win);
@@ -2054,7 +2175,7 @@ GetClientsForDelivery(DeviceIntPtr dev, WindowPtr win,
         if (!inputMasks || !(inputMasks->inputEvents[dev->id] & filter))
             goto out;
 
-        *clients = inputMasks->inputClients;
+        *iclients = inputMasks->inputClients;
     }
 
     rc = 1;
@@ -2074,6 +2195,7 @@ DeliverEventToInputClients(DeviceIntPtr dev, InputClients * inputclients,
 {
     int attempt;
     enum EventDeliveryState rc = EVENT_NOT_DELIVERED;
+    Bool have_device_button_grab_class_client = FALSE;
 
     for (; inputclients; inputclients = inputclients->next) {
         Mask mask;
@@ -2082,6 +2204,9 @@ DeliverEventToInputClients(DeviceIntPtr dev, InputClients * inputclients,
         if (IsInterferingGrab(client, dev, events))
             continue;
 
+        if (IsWrongPointerBarrierClient(client, dev, events))
+            continue;
+
         mask = GetEventMask(dev, events, inputclients);
 
         if (XaceHook(XACE_RECEIVE_ACCESS, client, win, events, count))
@@ -2090,13 +2215,21 @@ DeliverEventToInputClients(DeviceIntPtr dev, InputClients * inputclients,
                                             events, count,
                                             mask, filter, grab))) {
             if (attempt > 0) {
-                rc = EVENT_DELIVERED;
-                *client_return = client;
-                *mask_return = mask;
-                /* Success overrides non-success, so if we've been
-                 * successful on one client, return that */
-            }
-            else if (rc == EVENT_NOT_DELIVERED)
+                /*
+                 * The order of clients is arbitrary therefore if one
+                 * client belongs to DeviceButtonGrabClass make sure to
+                 * catch it.
+                 */
+                if (!have_device_button_grab_class_client) {
+                    rc = EVENT_DELIVERED;
+                    *client_return = client;
+                    *mask_return = mask;
+                    /* Success overrides non-success, so if we've been
+                     * successful on one client, return that */
+                    if (mask & DeviceButtonGrabMask)
+                        have_device_button_grab_class_client = TRUE;
+                }
+            } else if (rc == EVENT_NOT_DELIVERED)
                 rc = EVENT_REJECTED;
         }
     }
@@ -2116,12 +2249,12 @@ DeliverEventToWindowMask(DeviceIntPtr dev, WindowPtr win, xEvent *events,
                          int count, Mask filter, GrabPtr grab,
                          ClientPtr *client_return, Mask *mask_return)
 {
-    InputClients *clients;
+    InputClients *iclients;
 
-    if (!GetClientsForDelivery(dev, win, events, filter, &clients))
+    if (!GetClientsForDelivery(dev, win, events, filter, &iclients))
         return EVENT_SKIP;
 
-    return DeliverEventToInputClients(dev, clients, win, events, count, filter,
+    return DeliverEventToInputClients(dev, iclients, win, events, count, filter,
                                       grab, client_return, mask_return);
 
 }
@@ -2230,7 +2363,7 @@ DeliverEventsToWindow(DeviceIntPtr pDev, WindowPtr pWin, xEvent
  * @return TRUE if the event should be discarded, FALSE otherwise.
  */
 static BOOL
-FilterRawEvents(const ClientPtr client, const GrabPtr grab)
+FilterRawEvents(const ClientPtr client, const GrabPtr grab, WindowPtr root)
 {
     XIClientPtr client_xi_version;
     int cmp;
@@ -2246,7 +2379,10 @@ FilterRawEvents(const ClientPtr client, const GrabPtr grab)
                           client_xi_version->minor_version, 2, 0);
     /* XI 2.0: if device is grabbed, skip
        XI 2.1: if device is grabbed by us, skip, we've already delivered */
-    return (cmp == 0) ? TRUE : SameClient(grab, client);
+    if (cmp == 0)
+        return TRUE;
+
+    return (grab->window != root) ? FALSE : SameClient(grab, client);
 }
 
 /**
@@ -2266,6 +2402,8 @@ DeliverRawEvent(RawDeviceEvent *ev, DeviceIntPtr device)
     int i, rc;
     int filter;
 
+    TTRACE_INPUT_BEGIN("XORG:SERVER:DeliverRawEvent");
+
     rc = EventToXI2((InternalEvent *) ev, (xEvent **) &xi);
     if (rc != Success) {
         ErrorF("[Xi] %s: XI2 conversion failed in %s (%d)\n",
@@ -2299,13 +2437,14 @@ DeliverRawEvent(RawDeviceEvent *ev, DeviceIntPtr device)
              */
             ic.next = NULL;
 
-            if (!FilterRawEvents(rClient(&ic), grab))
+            if (!FilterRawEvents(rClient(&ic), grab, root))
                 DeliverEventToInputClients(device, &ic, root, xi, 1,
                                            filter, NULL, &c, &m);
         }
     }
 
     free(xi);
+    TTRACE_INPUT_END();
 }
 
 /* If the event goes to dontClient, don't send it and return 0.  if
@@ -2436,6 +2575,8 @@ FixUpEventFromWindow(SpritePtr pSprite,
         case XI_DeviceChanged:
         case XI_HierarchyChanged:
         case XI_PropertyEvent:
+        case XI_BarrierHit:
+        case XI_BarrierLeave:
             return;
         default:
             break;
@@ -2450,8 +2591,8 @@ FixUpEventFromWindow(SpritePtr pSprite,
         }
 
         if (pSprite->hot.pScreen == pWin->drawable.pScreen) {
-            event->event_x = event->root_x - FP1616(pWin->drawable.x, 0);
-            event->event_y = event->root_y - FP1616(pWin->drawable.y, 0);
+            event->event_x = event->root_x - double_to_fp1616(pWin->drawable.x);
+            event->event_y = event->root_y - double_to_fp1616(pWin->drawable.y);
             event->child = child;
         }
         else {
@@ -2578,6 +2719,9 @@ DeliverOneEvent(InternalEvent *event, DeviceIntPtr dev, enum InputLevel level,
     case CORE:
         rc = EventToCore(event, &xE, &count);
         break;
+    default:
+        rc = BadImplementation;
+        break;
     }
 
     if (rc == Success) {
@@ -2618,6 +2762,8 @@ DeliverDeviceEvents(WindowPtr pWin, InternalEvent *event, GrabPtr grab,
     int deliveries = 0;
     int mask;
 
+    TTRACE_INPUT_BEGIN("XORG:SERVER:DeliverDeviceEvent");
+
     verify_internal_event(event);
 
     while (pWin) {
@@ -2657,6 +2803,8 @@ DeliverDeviceEvents(WindowPtr pWin, InternalEvent *event, GrabPtr grab,
         pWin = pWin->parent;
     }
 
+    TTRACE_INPUT_END();
+
     return deliveries;
 }
 
@@ -2739,7 +2887,7 @@ DeliverEvents(WindowPtr pWin, xEvent *xE, int count, WindowPtr otherParent)
     return deliveries;
 }
 
-static Bool
+Bool
 PointInBorderSize(WindowPtr pWin, int x, int y)
 {
     BoxRec box;
@@ -2780,58 +2928,9 @@ PointInBorderSize(WindowPtr pWin, int x, int y)
 WindowPtr
 XYToWindow(SpritePtr pSprite, int x, int y)
 {
-    WindowPtr pWin;
-    BoxRec box;
-#ifdef _F_INPUT_REDIRECTION_
-    int rootX,rootY;
-
-    rootX = x;
-    rootY = y;
-#endif //_F_INPUT_REDIRECTION_
+    ScreenPtr pScreen = RootWindow(pSprite)->drawable.pScreen;
 
-    pSprite->spriteTraceGood = 1;       /* root window still there */
-    pWin = RootWindow(pSprite)->firstChild;
-    while (pWin) {
-#ifdef _F_INPUT_REDIRECTION_
-        CompositeGetInvTransformPoint(pWin, rootX, rootY, &x, &y);
-#endif //_F_INPUT_REDIRECTION_
-        if ((pWin->mapped) &&
-            (x >= pWin->drawable.x - wBorderWidth(pWin)) &&
-            (x < pWin->drawable.x + (int) pWin->drawable.width +
-             wBorderWidth(pWin)) &&
-            (y >= pWin->drawable.y - wBorderWidth(pWin)) &&
-            (y < pWin->drawable.y + (int) pWin->drawable.height +
-             wBorderWidth(pWin))
-            /* When a window is shaped, a further check
-             * is made to see if the point is inside
-             * borderSize
-             */
-            && (!wBoundingShape(pWin) || PointInBorderSize(pWin, x, y))
-            && (!wInputShape(pWin) ||
-                RegionContainsPoint(wInputShape(pWin),
-                                    x - pWin->drawable.x,
-                                    y - pWin->drawable.y, &box))
-#ifdef ROOTLESS
-            /* In rootless mode windows may be offscreen, even when
-             * they're in X's stack. (E.g. if the native window system
-             * implements some form of virtual desktop system).
-             */
-            && !pWin->rootlessUnhittable
-#endif
-            ) {
-            if (pSprite->spriteTraceGood >= pSprite->spriteTraceSize) {
-                pSprite->spriteTraceSize += 10;
-                pSprite->spriteTrace = realloc(pSprite->spriteTrace,
-                                               pSprite->spriteTraceSize *
-                                               sizeof(WindowPtr));
-            }
-            pSprite->spriteTrace[pSprite->spriteTraceGood++] = pWin;
-            pWin = pWin->firstChild;
-        }
-        else
-            pWin = pWin->nextSib;
-    }
-    return DeepestSpriteWin(pSprite);
+    return (*pScreen->XYToWindow)(pScreen, pSprite, x, y);
 }
 
 /**
@@ -3011,6 +3110,14 @@ CheckMotion(DeviceEvent *ev, DeviceIntPtr pDev)
 
     newSpriteWin = XYToWindow(pSprite, pSprite->hot.x, pSprite->hot.y);
 
+#ifdef _F_PREVENT_CURSOR_FLICKER_
+    if (prev_is_enable_cursor != is_enable_cursor)
+    {
+       isCursorChanged = 1;
+       prev_is_enable_cursor = is_enable_cursor;
+    }
+#endif
+
     if (newSpriteWin != prevSpriteWin) {
         int sourceid;
 
@@ -3030,9 +3137,23 @@ CheckMotion(DeviceEvent *ev, DeviceIntPtr pDev)
            sprite window == grab_window and no enter/leave events are
            sent. */
         pSprite->win = newSpriteWin;
+#ifdef _F_PREVENT_CURSOR_FLICKER_
+        if (is_enable_cursor)
+        {
+           PostNewCursor(pDev);
+        }
+#else
         PostNewCursor(pDev);
+#endif
         return FALSE;
     }
+#ifdef _F_PREVENT_CURSOR_FLICKER_
+    else if (isCursorChanged == 1)
+    {
+       PostNewCursor(pDev);
+       isCursorChanged = 0;
+    }
+#endif
     return TRUE;
 }
 
@@ -3187,8 +3308,7 @@ InitializeSprite(DeviceIntPtr pDev, WindowPtr pWin)
         pSprite->pEnqueueScreen = screenInfo.screens[0];
         pSprite->pDequeueScreen = pSprite->pEnqueueScreen;
     }
-    if (pCursor)
-        pCursor->refcnt++;
+    pCursor = RefCursor(pCursor);
     if (pSprite->current)
         FreeCursor(pSprite->current, None);
     pSprite->current = pCursor;
@@ -3270,9 +3390,7 @@ UpdateSpriteForScreen(DeviceIntPtr pDev, ScreenPtr pScreen)
     pSprite->hotLimits.x2 = pScreen->width;
     pSprite->hotLimits.y2 = pScreen->height;
     pSprite->win = win;
-    pCursor = wCursor(win);
-    if (pCursor)
-        pCursor->refcnt++;
+    pCursor = RefCursor(wCursor(win));
     if (pSprite->current)
         FreeCursor(pSprite->current, 0);
     pSprite->current = pCursor;
@@ -3473,6 +3591,7 @@ XineramaWarpPointer(ClientPtr client)
  * Server-side protocol handling for WarpPointer request.
  * Warps the cursor position to the coordinates given in the request.
  */
+
 int
 ProcWarpPointer(ClientPtr client)
 {
@@ -3486,6 +3605,8 @@ ProcWarpPointer(ClientPtr client)
     REQUEST_SIZE_MATCH(xWarpPointerReq);
 
     dev = PickPointer(client);
+    if (!dev)
+        return BadAccess;
 
     for (tmp = inputInfo.devices; tmp; tmp = tmp->next) {
         if (GetMaster(tmp, MASTER_ATTACHED) == dev) {
@@ -3569,6 +3690,16 @@ ProcWarpPointer(ClientPtr client)
     else if (!PointerConfinedToScreen(dev)) {
         NewCurrentScreen(dev, newScreen, x, y);
     }
+#ifdef _ADD_HOOK_FOR_WARP_POINTER_
+    if (WarpPointerCallback) {
+        WarpPointerInfoRec data;
+        data.x = x;
+        data.y = y;
+        data.width = dev->spriteInfo->sprite->hot.pScreen->width;
+        data.height = dev->spriteInfo->sprite->hot.pScreen->height;
+        CallCallbacks(&WarpPointerCallback, &data);
+    }
+#endif
     return Success;
 }
 
@@ -3747,6 +3878,8 @@ MatchForType(const GrabPtr grab, GrabPtr tmp, enum InputLevel level,
         match = CORE_MATCH;
         ignore_device = TRUE;
         break;
+    default:
+        return NO_MATCH;
     }
 
     tmp->grabtype = grabtype;
@@ -3874,7 +4007,9 @@ CheckPassiveGrabsOnWindow(WindowPtr pWin,
     if (!grab)
         return NULL;
 
-    tempGrab = AllocGrab();
+    tempGrab = AllocGrab(NULL);
+    if (tempGrab == NULL)
+        return NULL;
 
     /* Fill out the grab details, but leave the type for later before
      * comparing */
@@ -4019,17 +4154,24 @@ DeliverFocusedEvent(DeviceIntPtr keybd, InternalEvent *event, WindowPtr window)
     int count, rc;
     int deliveries = 0;
 
+    TTRACE_INPUT_BEGIN("XORG:SERVER:DeliverFocusedEvent");
+
     if (focus == FollowKeyboardWin)
         focus = inputInfo.keyboard->focus->win;
-    if (!focus)
+    if (!focus) {
+        TTRACE_INPUT_END();
         return;
+    }
     if (focus == PointerRootWin) {
         DeliverDeviceEvents(window, event, NullGrab, NullWindow, keybd);
+        TTRACE_INPUT_END();
         return;
     }
     if ((focus == window) || IsParent(focus, window)) {
-        if (DeliverDeviceEvents(window, event, NullGrab, focus, keybd))
+        if (DeliverDeviceEvents(window, event, NullGrab, focus, keybd)) {
+            TTRACE_INPUT_END();
             return;
+        }
     }
 
     /* just deliver it to the focus window */
@@ -4089,6 +4231,7 @@ DeliverFocusedEvent(DeviceIntPtr keybd, InternalEvent *event, WindowPtr window)
     free(core);
     free(xE);
     free(xi2);
+    TTRACE_INPUT_END();
     return;
 }
 
@@ -4106,6 +4249,9 @@ DeliverOneGrabbedEvent(InternalEvent *event, DeviceIntPtr dev,
     GrabPtr grab = grabinfo->grab;
     Mask filter;
 
+    if (grab->grabtype != level)
+        return 0;
+
     switch (level) {
     case XI2:
         rc = EventToXI2(event, &xE);
@@ -4178,6 +4324,8 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev,
     SpritePtr pSprite = thisDev->spriteInfo->sprite;
     BOOL sendCore = FALSE;
 
+    TTRACE_INPUT_BEGIN("XORG:SERVER:DeliverGrabbedEvent");
+
     grabinfo = &thisDev->deviceGrab;
     grab = grabinfo->grab;
 
@@ -4222,22 +4370,17 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev,
 
         sendCore = (IsMaster(thisDev) && thisDev->coreEvents);
         /* try core event */
-        if (sendCore && grab->grabtype == CORE) {
-            deliveries = DeliverOneGrabbedEvent(event, thisDev, CORE);
-        }
-
-        if (!deliveries) {
-            deliveries = DeliverOneGrabbedEvent(event, thisDev, XI2);
-        }
+        if ((sendCore && grab->grabtype == CORE) || grab->grabtype != CORE)
+            deliveries = DeliverOneGrabbedEvent(event, thisDev, grab->grabtype);
 
-        if (!deliveries) {
-            deliveries = DeliverOneGrabbedEvent(event, thisDev, XI);
-        }
-
-        if (deliveries && (event->any.type == ET_Motion && event->any.type == ET_TouchCancel)) /* JEON */
+        if (deliveries && (event->any.type == ET_Motion))
             thisDev->valuator->motionHintWindow = grab->window;
     }
-    if (deliveries && !deactivateGrab && event->any.type != ET_Motion) {
+    if (deliveries && !deactivateGrab &&
+        (event->any.type == ET_KeyPress ||
+         event->any.type == ET_KeyRelease ||
+         event->any.type == ET_ButtonPress ||
+         event->any.type == ET_ButtonRelease)) {
         switch (grabinfo->sync.state) {
         case FREEZE_BOTH_NEXT_EVENT:
             dev = GetPairedDevice(thisDev);
@@ -4259,6 +4402,8 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev,
         }
     }
 
+    TTRACE_INPUT_END();
+
     return deliveries;
 }
 
@@ -4338,7 +4483,7 @@ RecalculateDeliverableEvents(WindowPtr pWin)
  *  \param value must conform to DeleteType
  */
 int
-OtherClientGone(pointer value, XID id)
+OtherClientGone(void *value, XID id)
 {
     OtherClientsPtr other, prev;
     WindowPtr pWin = (WindowPtr) value;
@@ -4419,7 +4564,7 @@ EventSelectForWindow(WindowPtr pWin, ClientPtr client, Mask mask)
         others->resource = FakeClientID(client->index);
         others->next = pWin->optional->otherClients;
         pWin->optional->otherClients = others;
-        if (!AddResource(others->resource, RT_OTHERCLIENT, (pointer) pWin))
+        if (!AddResource(others->resource, RT_OTHERCLIENT, (void *) pWin))
             return BadAlloc;
     }
  maskSet:
@@ -4437,7 +4582,7 @@ int
 EventSuppressForWindow(WindowPtr pWin, ClientPtr client,
                        Mask mask, Bool *checkOptional)
 {
-    int i, free;
+    int i, freed;
 
     if (mask & ~PropagateMask) {
         client->errorValue = mask;
@@ -4448,14 +4593,14 @@ EventSuppressForWindow(WindowPtr pWin, ClientPtr client,
     if (!mask)
         i = 0;
     else {
-        for (i = DNPMCOUNT, free = 0; --i > 0;) {
+        for (i = DNPMCOUNT, freed = 0; --i > 0;) {
             if (!DontPropagateRefCnts[i])
-                free = i;
+                freed = i;
             else if (mask == DontPropagateMasks[i])
                 break;
         }
-        if (!i && free) {
-            i = free;
+        if (!i && freed) {
+            i = freed;
             DontPropagateMasks[i] = mask;
         }
     }
@@ -4570,6 +4715,7 @@ DeviceEnterLeaveEvent(DeviceIntPtr mouse,
 {
     GrabPtr grab = mouse->deviceGrab.grab;
     xXIEnterEvent *event;
+    WindowPtr focus;
     int filter;
     int btlen, len, i;
     DeviceIntPtr kbd;
@@ -4593,8 +4739,8 @@ DeviceEnterLeaveEvent(DeviceIntPtr mouse,
     event->deviceid = mouse->id;
     event->sourceid = sourceid;
     event->mode = mode;
-    event->root_x = FP1616(mouse->spriteInfo->sprite->hot.x, 0);
-    event->root_y = FP1616(mouse->spriteInfo->sprite->hot.y, 0);
+    event->root_x = double_to_fp1616(mouse->spriteInfo->sprite->hot.x);
+    event->root_y = double_to_fp1616(mouse->spriteInfo->sprite->hot.y);
 
     for (i = 0; mouse && mouse->button && i < mouse->button->numButtons; i++)
         if (BitIsOn(mouse->button->down, i))
@@ -4611,12 +4757,17 @@ DeviceEnterLeaveEvent(DeviceIntPtr mouse,
         event->group.locked_group = kbd->key->xkbInfo->state.locked_group;
     }
 
+    focus = (kbd) ? kbd->focus->win : None;
+    if ((focus != NoneWin) &&
+        ((pWin == focus) || (focus == PointerRootWin) || IsParent(focus, pWin)))
+        event->focus = TRUE;
+
     FixUpEventFromWindow(mouse->spriteInfo->sprite, (xEvent *) event, pWin,
                          None, FALSE);
 
     filter = GetEventFilter(mouse, (xEvent *) event);
 
-    if (grab) {
+    if (grab && grab->grabtype == XI2) {
         Mask mask;
 
         mask = xi2mask_isset(grab->xi2mask, mouse, type);
@@ -4831,7 +4982,6 @@ ProcGrabPointer(ClientPtr client)
     GrabPtr grab;
     GrabMask mask;
     WindowPtr confineTo;
-    CursorPtr oldCursor;
     BYTE status;
 
     REQUEST(xGrabPointerReq);
@@ -4854,15 +5004,10 @@ ProcGrabPointer(ClientPtr client)
             return rc;
     }
 
-    oldCursor = NullCursor;
     grab = device->deviceGrab.grab;
 
-    if (grab) {
-        if (grab->confineTo && !confineTo)
-            ConfineCursorToWindow(device, GetCurrentRootWindow(device), FALSE,
-                                  FALSE);
-        oldCursor = grab->cursor;
-    }
+    if (grab && grab->confineTo && !confineTo)
+        ConfineCursorToWindow(device, GetCurrentRootWindow(device), FALSE, FALSE);
 
     mask.core = stuff->eventMask;
 
@@ -4872,9 +5017,6 @@ ProcGrabPointer(ClientPtr client)
     if (rc != Success)
         return rc;
 
-    if (oldCursor && status == GrabSuccess)
-        FreeCursor(oldCursor, (Cursor) 0);
-
     rep = (xGrabPointerReply) {
         .type = X_Reply,
         .status = status,
@@ -4909,7 +5051,7 @@ ProcChangeActivePointerGrab(ClientPtr client)
     if (stuff->cursor == None)
         newCursor = NullCursor;
     else {
-        int rc = dixLookupResourceByType((pointer *) &newCursor, stuff->cursor,
+        int rc = dixLookupResourceByType((void **) &newCursor, stuff->cursor,
                                          RT_CURSOR, client, DixUseAccess);
 
         if (rc != Success) {
@@ -4930,9 +5072,7 @@ ProcChangeActivePointerGrab(ClientPtr client)
         (CompareTimeStamps(time, device->deviceGrab.grabTime) == EARLIER))
         return Success;
     oldCursor = grab->cursor;
-    grab->cursor = newCursor;
-    if (newCursor)
-        newCursor->refcnt++;
+    grab->cursor = RefCursor(newCursor);
     PostNewCursor(device);
     if (oldCursor)
         FreeCursor(oldCursor, (Cursor) 0);
@@ -4982,7 +5122,7 @@ ProcUngrabPointer(ClientPtr client)
  * @param other_mode GrabModeSync or GrabModeAsync
  * @param status Return code to be returned to the caller.
  *
- * @returns Success or BadValue.
+ * @returns Success or BadValue or BadAlloc.
  */
 int
 GrabDevice(ClientPtr client, DeviceIntPtr dev,
@@ -5028,7 +5168,7 @@ GrabDevice(ClientPtr client, DeviceIntPtr dev,
     if (curs == None)
         cursor = NullCursor;
     else {
-        rc = dixLookupResourceByType((pointer *) &cursor, curs, RT_CURSOR,
+        rc = dixLookupResourceByType((void **) &cursor, curs, RT_CURSOR,
                                      client, DixUseAccess);
         if (rc != Success) {
             client->errorValue = curs;
@@ -5047,7 +5187,7 @@ GrabDevice(ClientPtr client, DeviceIntPtr dev,
     grab = grabInfo->grab;
     if (grab && grab->grabtype != grabtype)
         *status = AlreadyGrabbed;
-    if (grab && !SameClient(grab, client))
+    else if (grab && !SameClient(grab, client))
         *status = AlreadyGrabbed;
     else if ((!pWin->realized) ||
              (confineTo &&
@@ -5062,7 +5202,9 @@ GrabDevice(ClientPtr client, DeviceIntPtr dev,
     else {
         GrabPtr tempGrab;
 
-        tempGrab = AllocGrab();
+        tempGrab = AllocGrab(NULL);
+        if (tempGrab == NULL)
+            return BadAlloc;
 
         tempGrab->next = NULL;
         tempGrab->window = pWin;
@@ -5077,7 +5219,7 @@ GrabDevice(ClientPtr client, DeviceIntPtr dev,
         else
             xi2mask_merge(tempGrab->xi2mask, mask->xi2mask);
         tempGrab->device = dev;
-        tempGrab->cursor = cursor;
+        tempGrab->cursor = RefCursor(cursor);
         tempGrab->confineTo = confineTo;
         tempGrab->grabtype = grabtype;
         (*grabInfo->ActivateGrab) (dev, tempGrab, time, FALSE);
@@ -5272,8 +5414,12 @@ InitEvents(void)
     inputInfo.pointer = (DeviceIntPtr) NULL;
 
     for (i = 0; i < MAXDEVICES; i++) {
+        DeviceIntRec dummy;
         memcpy(&event_filters[i], default_filter, sizeof(default_filter));
-        lastDeviceEventTime[i] = currentTime;
+
+        dummy.id = i;
+        NoticeTime(&dummy, currentTime);
+        LastEventTimeToggleResetFlag(i, FALSE);
     }
 
     syncEvents.replayDev = (DeviceIntPtr) NULL;
@@ -5320,6 +5466,8 @@ ProcSendEvent(ClientPtr client)
     DeviceIntPtr keybd = GetMaster(dev, MASTER_KEYBOARD);
     SpritePtr pSprite = dev->spriteInfo->sprite;
 
+    TTRACE_INPUT_BEGIN("XORG:SERVER:ProcSendEvent");
+
     REQUEST(xSendEventReq);
 
     REQUEST_SIZE_MATCH(xSendEventReq);
@@ -5342,16 +5490,19 @@ ProcSendEvent(ClientPtr client)
           (stuff->event.u.u.type >= EXTENSION_EVENT_BASE &&
            stuff->event.u.u.type < (unsigned) lastEvent))) {
         client->errorValue = stuff->event.u.u.type;
+        TTRACE_INPUT_END();
         return BadValue;
     }
     if (stuff->event.u.u.type == ClientMessage &&
         stuff->event.u.u.detail != 8 &&
         stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
         client->errorValue = stuff->event.u.u.detail;
+        TTRACE_INPUT_END();
         return BadValue;
     }
     if (stuff->eventMask & ~AllEventMasks) {
         client->errorValue = stuff->eventMask;
+        TTRACE_INPUT_END();
         return BadValue;
     }
 
@@ -5360,8 +5511,10 @@ ProcSendEvent(ClientPtr client)
     else if (stuff->destination == InputFocus) {
         WindowPtr inputFocus = (keybd) ? keybd->focus->win : NoneWin;
 
-        if (inputFocus == NoneWin)
+        if (inputFocus == NoneWin) {
+            TTRACE_INPUT_END();
             return Success;
+        }
 
         /* If the input focus is PointerRootWin, send the event to where
            the pointer is if possible, then perhaps propogate up to root. */
@@ -5378,24 +5531,55 @@ ProcSendEvent(ClientPtr client)
     else
         dixLookupWindow(&pWin, stuff->destination, client, DixSendAccess);
 
-    if (!pWin)
+    if (!pWin) {
+        TTRACE_INPUT_END();
         return BadWindow;
+    }
     if ((stuff->propagate != xFalse) && (stuff->propagate != xTrue)) {
         client->errorValue = stuff->propagate;
+        TTRACE_INPUT_END();
         return BadValue;
     }
+#ifdef _F_EVK_INPUT_RELAY_ECHOP
+    int rc;
+    Mask prop_mode = DixReadAccess;
+    static Atom input_relay_atom;
+    PropertyPtr pProp;
+    if(!input_relay_atom)
+    {
+        char evk_string[35] = "_ECHOP_EVK_INPUT_RELAY_WINDOW_ATOM";
+        unsigned length = strlen(evk_string);
+        input_relay_atom = MakeAtom(evk_string, length, xFalse);
+    }
+    if (ValidAtom(input_relay_atom))
+    {
+        rc = dixLookupProperty(&pProp, pWin, input_relay_atom, client, prop_mode);
+        if (rc == Success)
+        {
+            int ret_val = 0;
+            ret_val = DeliverInputDeviceEvents(&stuff->event);
+            return ret_val;
+        }
+    }
+#endif //_F_EVK_INPUT_RELAY_ECHOP
     stuff->event.u.u.type |= SEND_EVENT_BIT;
     if (stuff->propagate) {
         for (; pWin; pWin = pWin->parent) {
             if (XaceHook(XACE_SEND_ACCESS, client, NULL, pWin,
-                         &stuff->event, 1))
+                         &stuff->event, 1)) {
+                TTRACE_INPUT_END();
                 return Success;
+            }
             if (DeliverEventsToWindow(dev, pWin,
                                       &stuff->event, 1, stuff->eventMask,
-                                      NullGrab))
+                                      NullGrab)) {
+                TTRACE_INPUT_END();
                 return Success;
-            if (pWin == effectiveFocus)
+            }
+            if (pWin == effectiveFocus) {
+                TTRACE_INPUT_END();
                 return Success;
+            }
             stuff->eventMask &= ~wDontPropagateMask(pWin);
             if (!stuff->eventMask)
                 break;
@@ -5404,6 +5588,7 @@ ProcSendEvent(ClientPtr client)
     else if (!XaceHook(XACE_SEND_ACCESS, client, NULL, pWin, &stuff->event, 1))
         DeliverEventsToWindow(dev, pWin, &stuff->event,
                               1, stuff->eventMask, NullGrab);
+    TTRACE_INPUT_END();
     return Success;
 }
 
@@ -5438,7 +5623,7 @@ ProcUngrabKey(ClientPtr client)
         client->errorValue = stuff->modifiers;
         return BadValue;
     }
-    tempGrab = AllocGrab();
+    tempGrab = AllocGrab(NULL);
     if (!tempGrab)
         return BadAlloc;
     tempGrab->resource = client->clientAsMask;
@@ -5570,7 +5755,7 @@ ProcGrabButton(ClientPtr client)
     if (stuff->cursor == None)
         cursor = NullCursor;
     else {
-        rc = dixLookupResourceByType((pointer *) &cursor, stuff->cursor,
+        rc = dixLookupResourceByType((void **) &cursor, stuff->cursor,
                                      RT_CURSOR, client, DixUseAccess);
         if (rc != Success) {
             client->errorValue = stuff->cursor;
@@ -5632,7 +5817,7 @@ ProcUngrabButton(ClientPtr client)
 
     ptr = PickPointer(client);
 
-    tempGrab = AllocGrab();
+    tempGrab = AllocGrab(NULL);
     if (!tempGrab)
         return BadAlloc;
     tempGrab->resource = client->clientAsMask;
@@ -5824,7 +6009,7 @@ ProcRecolorCursor(ClientPtr client)
     REQUEST(xRecolorCursorReq);
 
     REQUEST_SIZE_MATCH(xRecolorCursorReq);
-    rc = dixLookupResourceByType((pointer *) &pCursor, stuff->cursor, RT_CURSOR,
+    rc = dixLookupResourceByType((void **) &pCursor, stuff->cursor, RT_CURSOR,
                                  client, DixWriteAccess);
     if (rc != Success) {
         client->errorValue = stuff->cursor;
@@ -5930,7 +6115,7 @@ WriteEventsToClient(ClientPtr pClient, int count, xEvent *events)
        case KeyRelease:
        case EnterNotify:
        case LeaveNotify:
-           dixLookupResourceByType((pointer) &pWin, events[i].u.keyButtonPointer.event, RT_WINDOW, NullClient, DixUnknownAccess);
+           dixLookupResourceByType((void *) &pWin, events[i].u.keyButtonPointer.event, RT_WINDOW, NullClient, DixUnknownAccess);
 
            if (pWin)
            {
@@ -5951,6 +6136,11 @@ WriteEventsToClient(ClientPtr pClient, int count, xEvent *events)
                events[i].u.keyButtonPointer.rootY  += dy;
                events[i].u.keyButtonPointer.eventX += dx;
                events[i].u.keyButtonPointer.eventY += dy;
+
+               if (events[i].u.keyButtonPointer.rootX < 0) events[i].u.keyButtonPointer.rootX = 0;
+               if (events[i].u.keyButtonPointer.rootY < 0) events[i].u.keyButtonPointer.rootY = 0;
+               if (events[i].u.keyButtonPointer.eventX < 0) events[i].u.keyButtonPointer.eventX = 0;
+               if (events[i].u.keyButtonPointer.eventY < 0) events[i].u.keyButtonPointer.eventY = 0;
            }
            break;
 
@@ -5976,7 +6166,7 @@ WriteEventsToClient(ClientPtr pClient, int count, xEvent *events)
                case XI_Leave:
                case XI_FocusIn:
                case XI_FocusOut:
-                   dixLookupResourceByType((pointer) &pWin, xde->event, RT_WINDOW, NullClient, DixUnknownAccess);
+                   dixLookupResourceByType((void *) &pWin, xde->event, RT_WINDOW, NullClient, DixUnknownAccess);
 
                    if (pWin)
                    {
@@ -5997,6 +6187,11 @@ WriteEventsToClient(ClientPtr pClient, int count, xEvent *events)
                        xde->root_y   += double_to_fp1616((dy*1.0));
                        xde->event_x += double_to_fp1616((dx*1.0));
                        xde->event_y += double_to_fp1616((dy*1.0));
+
+                       if ((int)FP1616toDBL(xde->root_x) < 0.0) xde->root_x = double_to_fp1616((0.0));
+                       if ((int)FP1616toDBL(xde->root_y) < 0.0) xde->root_y = double_to_fp1616((0.0));
+                       if ((int)FP1616toDBL(xde->event_x) < 0.0) xde->event_x = double_to_fp1616((0.0));
+                       if ((int)FP1616toDBL(xde->event_y) < 0.0) xde->event_y = double_to_fp1616((0.0));
                    }
 
                    /* change valuator's values related to coordinations to composite coordinations */
@@ -6060,7 +6255,7 @@ WriteEventsToClient(ClientPtr pClient, int count, xEvent *events)
            {
                deviceEvent = (deviceKeyButtonPointer *) &events[i];
 
-               dixLookupResourceByType((pointer) &pWin, deviceEvent->event, RT_WINDOW, NullClient, DixUnknownAccess);
+               dixLookupResourceByType((void *) &pWin, deviceEvent->event, RT_WINDOW, NullClient, DixUnknownAccess);
 
                if (pWin)
                {
@@ -6077,6 +6272,11 @@ WriteEventsToClient(ClientPtr pClient, int count, xEvent *events)
                    deviceEvent->root_y  += dy;
                    deviceEvent->event_x += dx;
                    deviceEvent->event_y += dy;
+
+                   if (deviceEvent->root_x < 0) deviceEvent->root_x = 0;
+                   if (deviceEvent->root_y < 0) deviceEvent->root_y = 0;
+                   if (deviceEvent->event_x < 0) deviceEvent->event_x = 0;
+                   if (deviceEvent->event_y < 0) deviceEvent->event_y = 0;
                }
            }
            break;
@@ -6128,7 +6328,7 @@ end_of_patches:
         eventinfo.client = pClient;
         eventinfo.events = events;
         eventinfo.count = count;
-        CallCallbacks(&EventCallback, (pointer) &eventinfo);
+        CallCallbacks(&EventCallback, (void *) &eventinfo);
     }
 #ifdef XSERVER_DTRACE
     if (XSERVER_SEND_EVENT_ENABLED()) {
@@ -6142,6 +6342,12 @@ end_of_patches:
     for (i = 1; i < count; i++) {
         if (events[i].u.u.type == GenericEvent) {
             ErrorF("[dix] TryClientEvents: Only one GenericEvent at a time.\n");
+#ifdef _F_INPUT_REDIRECTION_
+ #ifdef COMPOSITE
+            if(compEventCopy != &stackCopy)
+                xfree(compEventCopy );
+ #endif
+#endif //_F_INPUT_REDIRECTION_
             return;
         }
     }
@@ -6156,6 +6362,12 @@ end_of_patches:
             swapEvent = realloc(swapEvent, swapEventLen);
             if (!swapEvent) {
                 FatalError("WriteEventsToClient: Out of memory.\n");
+#ifdef _F_INPUT_REDIRECTION_
+ #ifdef COMPOSITE
+                if(compEventCopy != &stackCopy)
+                    xfree(compEventCopy );
+ #endif
+#endif //_F_INPUT_REDIRECTION_
                 return;
             }
         }
@@ -6182,7 +6394,7 @@ end_of_patches:
 #ifdef _F_INPUT_REDIRECTION_
  #ifdef COMPOSITE
     if(compEventCopy != &stackCopy)
-       xfree(compEventCopy );
+        xfree(compEventCopy );
  #endif
 #endif //_F_INPUT_REDIRECTION_
 
@@ -6315,3 +6527,121 @@ IsInterferingGrab(ClientPtr client, DeviceIntPtr dev, xEvent *event)
 
     return FALSE;
 }
+
+/* PointerBarrier events are only delivered to the client that created that
+ * barrier */
+static Bool
+IsWrongPointerBarrierClient(ClientPtr client, DeviceIntPtr dev, xEvent *event)
+{
+    xXIBarrierEvent *ev = (xXIBarrierEvent*)event;
+
+    if (ev->type != GenericEvent || ev->extension != IReqCode)
+        return FALSE;
+
+    if (ev->evtype != XI_BarrierHit && ev->evtype != XI_BarrierLeave)
+        return FALSE;
+
+    return client->index != CLIENT_ID(ev->barrier);
+}
+
+#ifdef _F_EVK_INPUT_RELAY_ECHOP
+static void
+SendPointerEvent(InternalEvent *pEvent_list, DeviceIntPtr pDev, int nType, int nButtons,
+        int nFlags, int nFirst_Valuator, int nNumValuators, int *pValuators)
+{
+   int nIndex=0;
+   ValuatorMask mask;
+   valuator_mask_set_range(&mask, nFirst_Valuator, nNumValuators, pValuators);
+   int nEvents = GetPointerEvents(pEvent_list, pDev, nType, nButtons, nFlags, &mask);
+   for (nIndex = 0; nIndex < nEvents; nIndex++)
+   {
+      mieqProcessDeviceEvent(pDev, &pEvent_list[nIndex], NULL);
+   }
+   miPointerUpdateSprite(pDev);
+}
+
+static int
+DeliverInputDeviceEvents(xEvent *pEvents)
+{
+   static int bInitEventList=1;
+   DeviceIntPtr dev_pointer, dev_keyboard;
+   dev_keyboard = inputInfo.keyboard;
+   dev_pointer = inputInfo.pointer;
+
+   if ((dev_keyboard==NULL) || (dev_pointer==NULL))
+   {
+      return BadImplementation;
+   }
+
+   if (bInitEventList)
+   {
+      xf86InputEvents = InitEventList(GetMaximumEventsNum());
+      bInitEventList=0;
+   }
+
+   unsigned long ulFlags=0;
+   int nXEeventType=-1, nPtrBtnCode=-1;
+   int nFirstValuator=0, nNumValuators=2, arValuators[MAX_VALUATORS] = {0};
+   unsigned int NUM_LOCK_KEYCODE = 77;
+   static int nFirstKey=0;
+
+   nXEeventType = pEvents->u.u.type;
+   switch(nXEeventType)
+   {
+      case KeyPress:
+      {
+         if (0 == nFirstKey)
+         {
+            xf86PostKeyboardEvent(dev_keyboard,NUM_LOCK_KEYCODE, TRUE);
+            xf86PostKeyboardEvent(dev_keyboard,NUM_LOCK_KEYCODE, FALSE);
+            nFirstKey=1;
+         }
+         if (pEvents->u.u.detail < 0 || pEvents->u.u.detail > 127 || pEvents->u.u.detail == NUM_LOCK_KEYCODE/*ignore NumLock Key*/ )
+         {
+            break;
+         }
+         else
+         {
+            xf86PostKeyboardEvent(dev_keyboard, pEvents->u.u.detail, TRUE);
+         }
+         break;
+      }
+      case KeyRelease:
+      {
+         if (pEvents->u.u.detail < 0 || pEvents->u.u.detail > 127 || pEvents->u.u.detail == NUM_LOCK_KEYCODE/*ignore NumLock Key*/ )
+         {
+            break;
+         }
+         xf86PostKeyboardEvent(dev_keyboard, pEvents->u.u.detail, FALSE);
+         break;
+      }
+      case ButtonPress:
+      {
+         arValuators[0] = arValuators[1] = ulFlags = 0;
+         nPtrBtnCode =  pEvents->u.u.detail;
+         SendPointerEvent(xf86InputEvents, dev_pointer, ButtonPress, nPtrBtnCode, ulFlags, nFirstValuator, nNumValuators, arValuators);
+         break;
+      }
+      case ButtonRelease:
+      {
+         arValuators[0] = arValuators[1] = ulFlags = 0;
+         nPtrBtnCode =  pEvents->u.u.detail;
+         SendPointerEvent(xf86InputEvents, dev_pointer, ButtonRelease, nPtrBtnCode, ulFlags, nFirstValuator, nNumValuators, arValuators);
+         break;
+      }
+      case MotionNotify:
+      {
+         arValuators[0] = pEvents->u.keyButtonPointer.rootX;
+         arValuators[1] = pEvents->u.keyButtonPointer.rootY;
+         ulFlags = POINTER_ABSOLUTE;
+         SendPointerEvent(xf86InputEvents, dev_pointer, MotionNotify, 0, ulFlags, nFirstValuator, nNumValuators, arValuators);
+         break;
+      }
+      default:
+      {
+         break;
+      }
+   }
+   return Success;
+}
+#endif //_F_EVK_INPUT_RELAY_ECHOP
index 6380db3..ede4bf5 100644 (file)
@@ -96,7 +96,7 @@ AddExtension(const char *name, int NumEvents, int NumErrors,
     }
     ext->name = strdup(name);
     ext->num_aliases = 0;
-    ext->aliases = (char **) NULL;
+    ext->aliases = (const char **) NULL;
     if (!ext->name) {
         dixFreePrivates(ext->devPrivates, PRIVATE_EXTENSION);
         free(ext);
@@ -106,7 +106,7 @@ AddExtension(const char *name, int NumEvents, int NumErrors,
     newexts = (ExtensionEntry **) realloc(extensions,
                                           (i + 1) * sizeof(ExtensionEntry *));
     if (!newexts) {
-        free(ext->name);
+        free((void *) ext->name);
         dixFreePrivates(ext->devPrivates, PRIVATE_EXTENSION);
         free(ext);
         return ((ExtensionEntry *) NULL);
@@ -147,12 +147,12 @@ Bool
 AddExtensionAlias(const char *alias, ExtensionEntry * ext)
 {
     char *name;
-    char **aliases;
+    const char **aliases;
 
     if (!ext)
         return FALSE;
-    aliases = (char **) realloc(ext->aliases,
-                                (ext->num_aliases + 1) * sizeof(char *));
+    aliases = realloc(ext->aliases,
+                      (ext->num_aliases + 1) * sizeof(char *));
     if (!aliases)
         return FALSE;
     ext->aliases = aliases;
@@ -229,9 +229,9 @@ CloseDownExtensions(void)
         if (extensions[i]->CloseDown)
             extensions[i]->CloseDown(extensions[i]);
         NumExtensions = i;
-        free(extensions[i]->name);
+        free((void *) extensions[i]->name);
         for (j = extensions[i]->num_aliases; --j >= 0;)
-            free(extensions[i]->aliases[j]);
+            free((void *) extensions[i]->aliases[j]);
         free(extensions[i]->aliases);
         dixFreePrivates(extensions[i]->devPrivates, PRIVATE_EXTENSION);
         free(extensions[i]);
index f46e0dd..88d6501 100644 (file)
--- a/dix/gc.c
+++ b/dix/gc.c
@@ -261,12 +261,14 @@ ChangeGC(ClientPtr client, GC * pGC, BITS32 mask, ChangeGCValPtr pUnion)
         case GCStipple:
             NEXT_PTR(PixmapPtr, pPixmap);
 
-            if ((pPixmap->drawable.depth != 1) ||
-                (pPixmap->drawable.pScreen != pGC->pScreen)) {
+            if (pPixmap && ((pPixmap->drawable.depth != 1) ||
+                            (pPixmap->drawable.pScreen != pGC->pScreen)))
+            {
                 error = BadMatch;
             }
             else {
-                pPixmap->refcnt++;
+                if (pPixmap)
+                    pPixmap->refcnt++;
                 if (pGC->stipple)
                     (*pGC->pScreen->DestroyPixmap) (pGC->stipple);
                 pGC->stipple = pPixmap;
@@ -339,7 +341,7 @@ ChangeGC(ClientPtr client, GC * pGC, BITS32 mask, ChangeGCValPtr pUnion)
                 pPixmap->refcnt++;
             }
             (*pGC->funcs->ChangeClip) (pGC, pPixmap ? CT_PIXMAP : CT_NONE,
-                                       (pointer) pPixmap, 0);
+                                       (void *) pPixmap, 0);
             break;
         case GCDashOffset:
             NEXTVAL(INT16, pGC->dashOffset);
@@ -494,7 +496,7 @@ NewGCObject(ScreenPtr pScreen, int depth)
     pGC->clipOrg.x = 0;
     pGC->clipOrg.y = 0;
     pGC->clientClipType = CT_NONE;
-    pGC->clientClip = (pointer) NULL;
+    pGC->clientClip = (void *) NULL;
     pGC->numInDashList = 2;
     pGC->dash = DefaultDash;
     pGC->dashOffset = 0;
@@ -764,7 +766,7 @@ CopyGC(GC * pgcSrc, GC * pgcDst, BITS32 mask)
  *  \param value  must conform to DeleteType
  */
 int
-FreeGC(pointer value, XID gid)
+FreeGC(void *value, XID gid)
 {
     GCPtr pGC = (GCPtr) value;
 
@@ -1023,7 +1025,7 @@ SetClipRects(GCPtr pGC, int xOrigin, int yOrigin, int nrects,
 
     if (size)
         memmove((char *) prectsNew, (char *) prects, size);
-    (*pGC->funcs->ChangeClip) (pGC, newct, (pointer) prectsNew, nrects);
+    (*pGC->funcs->ChangeClip) (pGC, newct, (void *) prectsNew, nrects);
     if (pGC->funcs->ChangeGC)
         (*pGC->funcs->ChangeGC) (pGC,
                                  GCClipXOrigin | GCClipYOrigin | GCClipMask);
index 0e27604..5759258 100755 (executable)
@@ -164,17 +164,6 @@ key_autorepeats(DeviceIntPtr pDev, int key_code)
 }
 
 static void
-init_event(DeviceIntPtr dev, DeviceEvent *event, Time ms)
-{
-    memset(event, 0, sizeof(DeviceEvent));
-    event->header = ET_Internal;
-    event->length = sizeof(DeviceEvent);
-    event->time = ms;
-    event->deviceid = dev->id;
-    event->sourceid = dev->id;
-}
-
-static void
 init_touch_ownership(DeviceIntPtr dev, TouchOwnershipEvent *event, Time ms)
 {
     memset(event, 0, sizeof(TouchOwnershipEvent));
@@ -250,7 +239,7 @@ set_valuators(DeviceIntPtr dev, DeviceEvent *event, ValuatorMask *mask)
                 SetBit(event->valuators.mode, i);
             event->valuators.data[i] = valuator_mask_get_double(mask, i);
         }
-        else if (valuator_get_mode(dev, i) == Absolute)
+        else
             event->valuators.data[i] = dev->valuator->axisVal[i];
     }
 }
@@ -288,6 +277,7 @@ CreateClassesChangedEvent(InternalEvent *event,
             dce->valuators[i].mode = slave->valuator->axes[i].mode;
             dce->valuators[i].name = slave->valuator->axes[i].label;
             dce->valuators[i].scroll = slave->valuator->axes[i].scroll;
+            dce->valuators[i].value = slave->valuator->axisVal[i];
         }
     }
     if (slave->key) {
@@ -308,11 +298,11 @@ rescaleValuatorAxis(double coord, AxisInfoPtr from, AxisInfoPtr to,
 
     if (from && from->min_value < from->max_value) {
         fmin = from->min_value;
-        fmax = from->max_value;
+        fmax = from->max_value + 1;
     }
     if (to && to->min_value < to->max_value) {
         tmin = to->min_value;
-        tmax = to->max_value;
+        tmax = to->max_value + 1;
     }
 
     if (fmin == tmin && fmax == tmax)
@@ -780,6 +770,29 @@ add_to_scroll_valuator(DeviceIntPtr dev, ValuatorMask *mask, int valuator, doubl
 }
 
 
+static void
+scale_for_device_resolution(DeviceIntPtr dev, ValuatorMask *mask)
+{
+    double y;
+    ValuatorClassPtr v = dev->valuator;
+    int xrange = v->axes[0].max_value - v->axes[0].min_value + 1;
+    int yrange = v->axes[1].max_value - v->axes[1].min_value + 1;
+
+    double screen_ratio = 1.0 * screenInfo.width/screenInfo.height;
+    double device_ratio = 1.0 * xrange/yrange;
+    double resolution_ratio = 1.0;
+    double ratio;
+
+    if (!valuator_mask_fetch_double(mask, 1, &y))
+        return;
+
+    if (v->axes[0].resolution != 0 && v->axes[1].resolution != 0)
+        resolution_ratio = 1.0 * v->axes[0].resolution/v->axes[1].resolution;
+
+    ratio = device_ratio/resolution_ratio/screen_ratio;
+    valuator_mask_set_double(mask, 1, y / ratio);
+}
+
 /**
  * Move the device's pointer by the values given in @valuators.
  *
@@ -787,10 +800,19 @@ add_to_scroll_valuator(DeviceIntPtr dev, ValuatorMask *mask, int valuator, doubl
  * @param[in,out] mask Valuator data for this event, modified in-place.
  */
 static void
-moveRelative(DeviceIntPtr dev, ValuatorMask *mask)
+moveRelative(DeviceIntPtr dev, int flags, ValuatorMask *mask)
 {
     int i;
     Bool clip_xy = IsMaster(dev) || !IsFloating(dev);
+    ValuatorClassPtr v = dev->valuator;
+
+    /* for abs devices in relative mode, we've just scaled wrong, since we
+       mapped the device's shape into the screen shape. Undo this. */
+    if ((flags & POINTER_ABSOLUTE) == 0 && v && v->numAxes > 1 &&
+        v->axes[0].min_value < v->axes[0].max_value &&
+        v->axes[1].min_value < v->axes[1].max_value) {
+        scale_for_device_resolution(dev, mask);
+    }
 
     /* calc other axes, clip, drop back into valuators */
     for (i = 0; i < valuator_mask_size(mask); i++) {
@@ -831,27 +853,33 @@ accelPointer(DeviceIntPtr dev, ValuatorMask *valuators, CARD32 ms)
  * device's coordinate range.
  *
  * @param dev The device to scale for.
- * @param[in, out] mask The mask in desktop coordinates, modified in place
+ * @param[in, out] mask The mask in desktop/screen coordinates, modified in place
  * to contain device coordinate range.
+ * @param flags If POINTER_SCREEN is set, mask is in per-screen coordinates.
+ *              Otherwise, mask is in desktop coords.
  */
 static void
-scale_from_screen(DeviceIntPtr dev, ValuatorMask *mask)
+scale_from_screen(DeviceIntPtr dev, ValuatorMask *mask, int flags)
 {
     double scaled;
     ScreenPtr scr = miPointerGetScreen(dev);
 
     if (valuator_mask_isset(mask, 0)) {
-        scaled = valuator_mask_get_double(mask, 0) + scr->x;
+        scaled = valuator_mask_get_double(mask, 0);
+        if (flags & POINTER_SCREEN)
+            scaled += scr->x;
         scaled = rescaleValuatorAxis(scaled,
                                      NULL, dev->valuator->axes + 0,
-                                     0, scr->width);
+                                     screenInfo.x, screenInfo.width);
         valuator_mask_set_double(mask, 0, scaled);
     }
     if (valuator_mask_isset(mask, 1)) {
-        scaled = valuator_mask_get_double(mask, 1) + scr->y;
+        scaled = valuator_mask_get_double(mask, 1);
+        if (flags & POINTER_SCREEN)
+            scaled += scr->y;
         scaled = rescaleValuatorAxis(scaled,
                                      NULL, dev->valuator->axes + 1,
-                                     0, scr->height);
+                                     screenInfo.y, screenInfo.height);
         valuator_mask_set_double(mask, 1, scaled);
     }
 }
@@ -947,10 +975,13 @@ scale_to_desktop(DeviceIntPtr dev, ValuatorMask *mask,
  * @param[in,out] devy y desktop-wide coordinate in device coordinate system
  * @param[in,out] screenx x coordinate in desktop coordinate system
  * @param[in,out] screeny y coordinate in desktop coordinate system
+ * @param[out] nevents Number of barrier events added to events
+ * @param[in,out] events List of events barrier events are added to
  */
 static ScreenPtr
 positionSprite(DeviceIntPtr dev, int mode, ValuatorMask *mask,
-               double *devx, double *devy, double *screenx, double *screeny)
+               double *devx, double *devy, double *screenx, double *screeny,
+               int *nevents, InternalEvent* events)
 {
     ScreenPtr scr = miPointerGetScreen(dev);
     double tmpx, tmpy;
@@ -969,7 +1000,7 @@ positionSprite(DeviceIntPtr dev, int mode, ValuatorMask *mask,
     /* miPointerSetPosition takes care of crossing screens for us, as well as
      * clipping to the current screen. Coordinates returned are in desktop
      * coord system */
-    scr = miPointerSetPosition(dev, mode, screenx, screeny);
+    scr = miPointerSetPosition(dev, mode, screenx, screeny, nevents, events);
 
     /* If we were constrained, rescale x/y from the screen coordinates so
      * the device valuators reflect the correct position. For screen
@@ -1207,6 +1238,27 @@ transform(struct pixman_f_transform *m, double *x, double *y)
     *y = p.v[1];
 }
 
+static void
+transformRelative(DeviceIntPtr dev, ValuatorMask *mask)
+{
+    double x = 0, y = 0;
+
+    valuator_mask_fetch_double(mask, 0, &x);
+    valuator_mask_fetch_double(mask, 1, &y);
+
+    transform(&dev->relative_transform, &x, &y);
+
+    if (x)
+        valuator_mask_set_double(mask, 0, x);
+    else
+        valuator_mask_unset(mask, 0);
+
+    if (y)
+        valuator_mask_set_double(mask, 1, y);
+    else
+        valuator_mask_unset(mask, 1);
+}
+
 /**
  * Apply the device's transformation matrix to the valuator mask and replace
  * the scaled values in mask. This transformation only applies to valuators
@@ -1234,7 +1286,7 @@ transformAbsolute(DeviceIntPtr dev, ValuatorMask *mask)
         ox = dev->last.valuators[0];
         oy = dev->last.valuators[1];
 
-        pixman_f_transform_invert(&invert, &dev->transform);
+        pixman_f_transform_invert(&invert, &dev->scale_and_transform);
         transform(&invert, &ox, &oy);
 
         x = ox;
@@ -1247,7 +1299,7 @@ transformAbsolute(DeviceIntPtr dev, ValuatorMask *mask)
     if (valuator_mask_isset(mask, 1))
         oy = y = valuator_mask_get_double(mask, 1);
 
-    transform(&dev->transform, &x, &y);
+    transform(&dev->scale_and_transform, &x, &y);
 
     if (valuator_mask_isset(mask, 0) || ox != x)
         valuator_mask_set_double(mask, 0, x);
@@ -1339,6 +1391,12 @@ QueuePointerEvents(DeviceIntPtr device, int type,
  * is the last coordinate on the first screen and must be rescaled for the
  * event to be m. XI2 clients that do their own coordinate mapping would
  * otherwise interpret the position of the device elsewere to the cursor.
+ * However, this scaling leads to losses:
+ * if we have two ScreenRecs we scale from e.g. [0..44704]  (Wacom I4) to
+ * [0..2048[. that gives us 2047.954 as desktop coord, or the per-screen
+ * coordinate 1023.954. Scaling that back into the device coordinate range
+ * gives us 44703. So off by one device unit. It's a bug, but we'll have to
+ * live with it because with all this scaling, we just cannot win.
  *
  * @return the number of events written into events.
  */
@@ -1349,12 +1407,13 @@ fill_pointer_events(InternalEvent *events, DeviceIntPtr pDev, int type,
 {
     int num_events = 1;
     DeviceEvent *event;
-    RawDeviceEvent *raw;
+    RawDeviceEvent *raw = NULL;
     double screenx = 0.0, screeny = 0.0;        /* desktop coordinate system */
     double devx = 0.0, devy = 0.0;      /* desktop-wide in device coords */
-    int sx, sy;                         /* for POINTER_SCREEN */
+    int sx = 0, sy = 0;                 /* for POINTER_SCREEN */
     ValuatorMask mask;
     ScreenPtr scr;
+    int num_barrier_events = 0;
 
     switch (type) {
     case MotionNotify:
@@ -1395,24 +1454,26 @@ fill_pointer_events(InternalEvent *events, DeviceIntPtr pDev, int type,
     /* valuators are in driver-native format (rel or abs) */
 
     if (flags & POINTER_ABSOLUTE) {
-        if (flags & POINTER_SCREEN) {    /* valuators are in screen coords */
+        if (flags & (POINTER_SCREEN | POINTER_DESKTOP)) {    /* valuators are in screen/desktop coords */
             sx = valuator_mask_get(&mask, 0);
             sy = valuator_mask_get(&mask, 1);
-            scale_from_screen(pDev, &mask);
+            scale_from_screen(pDev, &mask, flags);
         }
 
         transformAbsolute(pDev, &mask);
         clipAbsolute(pDev, &mask);
-        if ((flags & POINTER_NORAW) == 0)
+        if ((flags & POINTER_NORAW) == 0 && raw)
             set_raw_valuators(raw, &mask, raw->valuators.data);
     }
     else {
+        transformRelative(pDev, &mask);
+
         if (flags & POINTER_ACCELERATE)
             accelPointer(pDev, &mask, ms);
-        if ((flags & POINTER_NORAW) == 0)
+        if ((flags & POINTER_NORAW) == 0 && raw)
             set_raw_valuators(raw, &mask, raw->valuators.data);
 
-        moveRelative(pDev, &mask);
+        moveRelative(pDev, flags, &mask);
     }
 
     /* valuators are in device coordinate system in absolute coordinates */
@@ -1425,12 +1486,16 @@ fill_pointer_events(InternalEvent *events, DeviceIntPtr pDev, int type,
        coordinates were.
      */
     if (flags & POINTER_SCREEN) {
-        screenx = sx;
-        screeny = sy;
+        scr = miPointerGetScreen(pDev);
+        screenx = sx + scr->x;
+        screeny = sy + scr->y;
     }
 
     scr = positionSprite(pDev, (flags & POINTER_ABSOLUTE) ? Absolute : Relative,
-                         &mask, &devx, &devy, &screenx, &screeny);
+                         &mask, &devx, &devy, &screenx, &screeny,
+                         &num_barrier_events, events);
+    num_events += num_barrier_events;
+    events += num_barrier_events;
 
     /* screenx, screeny are in desktop coordinates,
        mask is in device coordinates per-screen (the event data)
@@ -1472,7 +1537,8 @@ fill_pointer_events(InternalEvent *events, DeviceIntPtr pDev, int type,
     event_set_root_coordinates(event, screenx - scr->x, screeny - scr->y);
 
     if (flags & POINTER_EMULATED) {
-        raw->flags = XIPointerEmulated;
+        if (raw)
+            raw->flags = XIPointerEmulated;
         event->flags = XIPointerEmulated;
     }
 
@@ -1614,6 +1680,8 @@ GetPointerEvents(InternalEvent *events, DeviceIntPtr pDev, int type,
     }
 #endif
 
+    BUG_RETURN_VAL(buttons >= MAX_BUTTONS, 0);
+
     /* refuse events from disabled devices */
     if (!pDev->enabled)
         return 0;
@@ -1868,10 +1936,7 @@ GetTouchEvents(InternalEvent *events, DeviceIntPtr dev, uint32_t ddx_touchid,
     int i;
     int num_events = 0;
     RawDeviceEvent *raw;
-    union touch {
-        TouchPointInfoPtr dix_ti;
-        DDXTouchPointInfoPtr ti;
-    } touchpoint;
+    DDXTouchPointInfoPtr ti;
     int need_rawevent = TRUE;
     Bool emulate_pointer = FALSE;
     int client_id = 0;
@@ -1890,37 +1955,15 @@ GetTouchEvents(InternalEvent *events, DeviceIntPtr dev, uint32_t ddx_touchid,
 
     /* Find and/or create the DDX touch info */
 
-    if (flags & TOUCH_CLIENT_ID) {      /* A DIX-submitted TouchEnd */
-        touchpoint.dix_ti = TouchFindByClientID(dev, ddx_touchid);
-        BUG_RETURN_VAL(!touchpoint.dix_ti, 0);
-
-        if (!mask_in ||
-            !valuator_mask_isset(mask_in, 0) ||
-            !valuator_mask_isset(mask_in, 1)) {
-            ErrorF
-                ("[dix] dix-submitted events must have x/y valuator information.\n");
-            return 0;
-        }
-
-        need_rawevent = FALSE;
-        client_id = touchpoint.dix_ti->client_id;
-    }
-    else {                      /* a DDX-submitted touch */
-
-        touchpoint.ti =
-            TouchFindByDDXID(dev, ddx_touchid, (type == XI_TouchBegin));
-        if (!touchpoint.ti) {
-            ErrorFSigSafe("[dix] %s: unable to %s touch point %u\n", dev->name,
-                          type == XI_TouchBegin ? "begin" : "find", ddx_touchid);
-            return 0;
-        }
-        client_id = touchpoint.ti->client_id;
+    ti = TouchFindByDDXID(dev, ddx_touchid, (type == XI_TouchBegin));
+    if (!ti) {
+        ErrorFSigSafe("[dix] %s: unable to %s touch point %u\n", dev->name,
+                      type == XI_TouchBegin ? "begin" : "find", ddx_touchid);
+        return 0;
     }
+    client_id = ti->client_id;
 
-    if (!(flags & TOUCH_CLIENT_ID))
-        emulate_pointer = touchpoint.ti->emulate_pointer;
-    else
-        emulate_pointer = ! !(flags & TOUCH_POINTER_EMULATED);
+    emulate_pointer = ti->emulate_pointer;
 
     if (!IsMaster(dev))
         events =
@@ -1939,12 +1982,7 @@ GetTouchEvents(InternalEvent *events, DeviceIntPtr dev, uint32_t ddx_touchid,
     event = &events->device_event;
     num_events++;
 
-    init_event(dev, event, ms);
-    /* if submitted for master device, get the sourceid from there */
-    if (flags & TOUCH_CLIENT_ID) {
-        event->sourceid = touchpoint.dix_ti->sourceid;
-        /* TOUCH_CLIENT_ID implies norawevent */
-    }
+    init_device_event(event, dev, ms);
 
     switch (type) {
     case XI_TouchBegin:
@@ -1953,54 +1991,46 @@ GetTouchEvents(InternalEvent *events, DeviceIntPtr dev, uint32_t ddx_touchid,
         if (!mask_in ||
             !valuator_mask_isset(mask_in, 0) ||
             !valuator_mask_isset(mask_in, 1)) {
-            ErrorF("%s: Attempted to start touch without x/y (driver bug)\n",
-                   dev->name);
+            ErrorFSigSafe("%s: Attempted to start touch without x/y "
+                          "(driver bug)\n", dev->name);
             return 0;
         }
         break;
     case XI_TouchUpdate:
         event->type = ET_TouchUpdate;
         if (!mask_in || valuator_mask_num_valuators(mask_in) <= 0) {
-            ErrorF("%s: TouchUpdate with no valuators? Driver bug\n",
-                   dev->name);
+            ErrorFSigSafe("%s: TouchUpdate with no valuators? Driver bug\n",
+                          dev->name);
         }
         break;
     case XI_TouchEnd:
         event->type = ET_TouchEnd;
         /* We can end the DDX touch here, since we don't use the active
          * field below */
-        if (!(flags & TOUCH_CLIENT_ID))
-            TouchEndDDXTouch(dev, touchpoint.ti);
+        TouchEndDDXTouch(dev, ti);
         break;
     default:
         return 0;
     }
-    if (t->mode == XIDirectTouch && !(flags & TOUCH_CLIENT_ID)) {
-        if (!valuator_mask_isset(&mask, 0))
-            valuator_mask_set_double(&mask, 0,
-                                     valuator_mask_get_double(touchpoint.ti->
-                                                              valuators, 0));
-        if (!valuator_mask_isset(&mask, 1))
-            valuator_mask_set_double(&mask, 1,
-                                     valuator_mask_get_double(touchpoint.ti->
-                                                              valuators, 1));
-    }
 
     /* Get our screen event co-ordinates (root_x/root_y/event_x/event_y):
      * these come from the touchpoint in Absolute mode, or the sprite in
      * Relative. */
     if (t->mode == XIDirectTouch) {
-        transformAbsolute(dev, &mask);
-
-        if (!(flags & TOUCH_CLIENT_ID)) {
-            for (i = 0; i < valuator_mask_size(&mask); i++) {
-                double val;
-
-                if (valuator_mask_fetch_double(&mask, i, &val))
-                    valuator_mask_set_double(touchpoint.ti->valuators, i, val);
-            }
+        for (i = 0; i < max(valuator_mask_size(&mask), 2); i++) {
+            double val;
+
+            if (valuator_mask_fetch_double(&mask, i, &val))
+                valuator_mask_set_double(ti->valuators, i, val);
+            /* If the device doesn't post new X and Y axis values,
+             * use the last values posted.
+             */
+            else if (i < 2 &&
+                valuator_mask_fetch_double(ti->valuators, i, &val))
+                valuator_mask_set_double(&mask, i, val);
         }
 
+        transformAbsolute(dev, &mask);
         clipAbsolute(dev, &mask);
     }
     else {
@@ -2018,7 +2048,7 @@ GetTouchEvents(InternalEvent *events, DeviceIntPtr dev, uint32_t ddx_touchid,
         scr = scale_to_desktop(dev, &mask, &devx, &devy, &screenx, &screeny);
     if (emulate_pointer)
         scr = positionSprite(dev, Absolute, &mask,
-                             &devx, &devy, &screenx, &screeny);
+                             &devx, &devy, &screenx, &screeny, NULL, NULL);
 
     /* see fill_pointer_events for coordinate systems */
     if (emulate_pointer)
@@ -2029,6 +2059,14 @@ GetTouchEvents(InternalEvent *events, DeviceIntPtr dev, uint32_t ddx_touchid,
     if (emulate_pointer)
         storeLastValuators(dev, &mask, 0, 1, devx, devy);
 
+    /* Update the MD's co-ordinates, which are always in desktop space. */
+    if (emulate_pointer && !IsMaster(dev) && !IsFloating(dev)) {
+           DeviceIntPtr master = GetMaster(dev, MASTER_POINTER);
+
+           master->last.valuators[0] = screenx;
+           master->last.valuators[1] = screeny;
+    }
+
     event->root = scr->root->drawable.id;
 
     event_set_root_coordinates(event, screenx, screeny);
@@ -2049,6 +2087,37 @@ GetTouchEvents(InternalEvent *events, DeviceIntPtr dev, uint32_t ddx_touchid,
     return num_events;
 }
 
+void
+GetDixTouchEnd(InternalEvent *ievent, DeviceIntPtr dev, TouchPointInfoPtr ti,
+               uint32_t flags)
+{
+    ScreenPtr scr = dev->spriteInfo->sprite->hotPhys.pScreen;
+    DeviceEvent *event = &ievent->device_event;
+    CARD32 ms = GetTimeInMillis();
+
+    BUG_WARN(!dev->enabled);
+
+    init_device_event(event, dev, ms);
+
+    event->sourceid = ti->sourceid;
+    event->type = ET_TouchEnd;
+
+    event->root = scr->root->drawable.id;
+
+    /* Get screen event coordinates from the sprite.  Is this really the best
+     * we can do? */
+    event_set_root_coordinates(event,
+                               dev->last.valuators[0],
+                               dev->last.valuators[1]);
+    event->touchid = ti->client_id;
+    event->flags = flags;
+
+    if (flags & TOUCH_POINTER_EMULATED) {
+        event->flags |= TOUCH_POINTER_EMULATED;
+        event->detail.button = 1;
+    }
+}
+
 /**
  * Synthesize a single motion event for the core pointer.
  *
index 921fdbd..a1f66fa 100755 (executable)
@@ -120,9 +120,9 @@ int defaultScreenSaverAllowExposures = DEFAULT_SCREEN_SAVER_EXPOSURES;
 Bool screenSaverSuspended = FALSE;
 #endif
 
-char *defaultFontPath = COMPILEDDEFAULTFONTPATH;
-char *defaultTextFont = COMPILEDDEFAULTFONT;
-char *defaultCursorFont = COMPILEDCURSORFONT;
+const char *defaultFontPath = COMPILEDDEFAULTFONTPATH;
+const char *defaultTextFont = COMPILEDDEFAULTFONT;
+const char *defaultCursorFont = COMPILEDCURSORFONT;
 FontPtr defaultFont;            /* not declared in dix.h to avoid including font.h in
                                    every compilation of dix code */
 CursorPtr rootCursor;
@@ -130,13 +130,13 @@ Bool party_like_its_1989 = FALSE;
 Bool whiteRoot = FALSE;
 
 TimeStamp currentTime;
-TimeStamp lastDeviceEventTime[MAXDEVICES];
 
 int defaultColorVisualClass = -1;
 int monitorResolution = 0;
 
-char *display;
-int displayfd;
+const char *display;
+int displayfd = -1;
+Bool explicit_display = FALSE;
 char *ConnectionInfo;
 
 CARD32 TimeOutValue = DEFAULT_TIMEOUT * MILLI_PER_SECOND;
index 9004cb1..5404025 100644 (file)
@@ -114,7 +114,7 @@ ServerBitsFromGlyph(FontPtr pfont, unsigned ch, CursorMetricPtr cm,
     /* fill the pixmap with 0 */
     gcval[0].val = GXcopy;
     gcval[1].val = 0;
-    gcval[2].ptr = (pointer) pfont;
+    gcval[2].ptr = (void *) pfont;
     ChangeGC(NullClient, pGC, GCFunction | GCForeground | GCFont, gcval);
     ValidateGC((DrawablePtr) ppix, pGC);
     (*pGC->ops->PolyFillRect) ((DrawablePtr) ppix, pGC, 1, &rect);
index 55bf64f..e3fc38b 100644 (file)
@@ -179,7 +179,7 @@ UngrabAllDevices(Bool kill_client)
             continue;
         PrintDeviceGrabInfo(dev);
         client = clients[CLIENT_ID(dev->deviceGrab.grab->resource)];
-        if (!client || client->clientGone)
+        if (!kill_client || !client || client->clientGone)
             dev->deviceGrab.DeactivateGrab(dev);
         if (kill_client)
             CloseDownClient(client);
@@ -189,7 +189,7 @@ UngrabAllDevices(Bool kill_client)
 }
 
 GrabPtr
-AllocGrab(void)
+AllocGrab(const GrabPtr src)
 {
     GrabPtr grab = calloc(1, sizeof(GrabRec));
 
@@ -199,6 +199,11 @@ AllocGrab(void)
             free(grab);
             grab = NULL;
         }
+        else if (src && !CopyGrab(grab, src)) {
+            free(grab->xi2mask);
+            free(grab);
+            grab = NULL;
+        }
     }
 
     return grab;
@@ -213,13 +218,16 @@ CreateGrab(int client, DeviceIntPtr device, DeviceIntPtr modDevice,
 {
     GrabPtr grab;
 
-    grab = AllocGrab();
+    grab = AllocGrab(NULL);
     if (!grab)
         return (GrabPtr) NULL;
     grab->resource = FakeClientID(client);
     grab->device = device;
     grab->window = window;
-    grab->eventMask = mask->core;       /* same for XI */
+    if (grabtype == CORE || grabtype == XI)
+        grab->eventMask = mask->core;       /* same for XI */
+    else
+        grab->eventMask = 0;
     grab->deviceMask = 0;
     grab->ownerEvents = param->ownerEvents;
     grab->keyboardMode = param->this_device_mode;
@@ -232,13 +240,11 @@ CreateGrab(int client, DeviceIntPtr device, DeviceIntPtr modDevice,
     grab->detail.exact = keybut;
     grab->detail.pMask = NULL;
     grab->confineTo = confineTo;
-    grab->cursor = cursor;
+    grab->cursor = RefCursor(cursor);
     grab->next = NULL;
 
     if (grabtype == XI2)
         xi2mask_merge(grab->xi2mask, mask->xi2mask);
-    if (cursor)
-        cursor->refcnt++;
     return grab;
 
 }
@@ -246,8 +252,7 @@ CreateGrab(int client, DeviceIntPtr device, DeviceIntPtr modDevice,
 void
 FreeGrab(GrabPtr pGrab)
 {
-    if (pGrab->grabtype == XI2 && pGrab->type == XI_TouchBegin)
-        TouchListenerGone(pGrab->resource);
+    BUG_RETURN(!pGrab);
 
     free(pGrab->modifiersDetail.pMask);
     free(pGrab->detail.pMask);
@@ -266,9 +271,6 @@ CopyGrab(GrabPtr dst, const GrabPtr src)
     Mask *details_mask = NULL;
     XI2Mask *xi2mask;
 
-    if (src->cursor)
-        src->cursor->refcnt++;
-
     if (src->modifiersDetail.pMask) {
         int len = MasksPerDetailMask * sizeof(Mask);
 
@@ -306,6 +308,7 @@ CopyGrab(GrabPtr dst, const GrabPtr src)
     dst->modifiersDetail.pMask = mdetails_mask;
     dst->detail.pMask = details_mask;
     dst->xi2mask = xi2mask;
+    dst->cursor = RefCursor(src->cursor);
 
     xi2mask_merge(dst->xi2mask, src->xi2mask);
 
@@ -313,7 +316,7 @@ CopyGrab(GrabPtr dst, const GrabPtr src)
 }
 
 int
-DeletePassiveGrab(pointer value, XID id)
+DeletePassiveGrab(void *value, XID id)
 {
     GrabPtr g, prev;
     GrabPtr pGrab = (GrabPtr) value;
@@ -560,7 +563,7 @@ AddPassiveGrabToList(ClientPtr client, GrabPtr pGrab)
 
     pGrab->next = pGrab->window->optional->passiveGrabs;
     pGrab->window->optional->passiveGrabs = pGrab;
-    if (AddResource(pGrab->resource, RT_PASSIVEGRAB, (pointer) pGrab))
+    if (AddResource(pGrab->resource, RT_PASSIVEGRAB, (void *) pGrab))
         return Success;
     return BadAlloc;
 }
@@ -658,7 +661,7 @@ DeletePassiveGrabFromList(GrabPtr pMinuendGrab)
                 ok = FALSE;
             }
             else if (!AddResource(pNewGrab->resource, RT_PASSIVEGRAB,
-                                  (pointer) pNewGrab))
+                                  (void *) pNewGrab))
                 ok = FALSE;
             else
                 adds[nadds++] = pNewGrab;
index f01e9a7..e5bcc31 100644 (file)
@@ -60,7 +60,8 @@ check_butmap_change(DeviceIntPtr dev, CARD8 *map, int len, CARD32 *errval_out,
     }
 
     for (i = 0; i < len; i++) {
-        if (dev->button->map[i + 1] != map[i] && dev->button->down[i + 1])
+        if (dev->button->map[i + 1] != map[i] &&
+            button_is_down(dev, i + 1, BUTTON_PROCESSED))
             return MappingBusy;
     }
 
@@ -910,11 +911,7 @@ input_option_set_value(InputOption *opt, const char *value)
 double
 fp1616_to_double(FP1616 in)
 {
-    double ret;
-
-    ret = (double) (in >> 16);
-    ret += (double) (in & 0xffff) * (1.0 / (1UL << 16));        /* Optimized: ldexp((double)(in & 0xffff), -16); */
-    return ret;
+    return pixman_fixed_to_double(in);
 }
 
 double
@@ -930,20 +927,7 @@ fp3232_to_double(FP3232 in)
 FP1616
 double_to_fp1616(double in)
 {
-    FP1616 ret;
-    int32_t integral;
-    double tmp;
-    uint32_t frac_d;
-
-    tmp = floor(in);
-    integral = (int32_t) tmp;
-
-    tmp = (in - integral) * (1UL << 16);        /* Optimized: ldexp(in - integral, 16) */
-    frac_d = (uint16_t) tmp;
-
-    ret = integral << 16;
-    ret |= frac_d & 0xffff;
-    return ret;
+    return pixman_double_to_fixed(in);
 }
 
 FP3232
@@ -977,8 +961,15 @@ XI2Mask *
 xi2mask_new_with_size(size_t nmasks, size_t size)
 {
     int i;
+    int alloc_size;
+    unsigned char *cursor;
+    XI2Mask *mask;
 
-    XI2Mask *mask = calloc(1, sizeof(*mask));
+    alloc_size = sizeof(struct _XI2Mask)
+              + nmasks * sizeof(unsigned char *)
+              + nmasks * size;
+
+    mask = calloc(1, alloc_size);
 
     if (!mask)
         return NULL;
@@ -986,20 +977,14 @@ xi2mask_new_with_size(size_t nmasks, size_t size)
     mask->nmasks = nmasks;
     mask->mask_size = size;
 
-    mask->masks = calloc(mask->nmasks, sizeof(*mask->masks));
-    if (!mask->masks)
-        goto unwind;
+    mask->masks = (unsigned char **)(mask + 1);
+    cursor = (unsigned char *)(mask + 1) + nmasks * sizeof(unsigned char *);
 
-    for (i = 0; i < mask->nmasks; i++) {
-        mask->masks[i] = calloc(1, mask->mask_size);
-        if (!mask->masks[i])
-            goto unwind;
+    for (i = 0; i < nmasks; i++) {
+        mask->masks[i] = cursor;
+       cursor += size;
     }
     return mask;
-
- unwind:
-    xi2mask_free(&mask);
-    return NULL;
 }
 
 /**
@@ -1020,19 +1005,29 @@ xi2mask_new(void)
 void
 xi2mask_free(XI2Mask **mask)
 {
-    int i;
-
     if (!(*mask))
         return;
 
-    for (i = 0; (*mask)->masks && i < (*mask)->nmasks; i++)
-        free((*mask)->masks[i]);
-    free((*mask)->masks);
     free((*mask));
     *mask = NULL;
 }
 
 /**
+ * Test if the bit for event type is set for this device only.
+ *
+ * @return TRUE if the bit is set, FALSE otherwise
+ */
+Bool
+xi2mask_isset_for_device(XI2Mask *mask, const DeviceIntPtr dev, int event_type)
+{
+    BUG_WARN(dev->id < 0);
+    BUG_WARN(dev->id >= mask->nmasks);
+    BUG_WARN(bits_to_bytes(event_type + 1) > mask->mask_size);
+
+    return BitIsOn(mask->masks[dev->id], event_type);
+}
+
+/**
  * Test if the bit for event type is set for this device, or the
  * XIAllDevices/XIAllMasterDevices (if applicable) is set.
  *
@@ -1043,15 +1038,12 @@ xi2mask_isset(XI2Mask *mask, const DeviceIntPtr dev, int event_type)
 {
     int set = 0;
 
-    BUG_WARN(dev->id < 0);
-    BUG_WARN(dev->id >= mask->nmasks);
-    BUG_WARN(bits_to_bytes(event_type + 1) > mask->mask_size);
-
-    set = ! !BitIsOn(mask->masks[XIAllDevices], event_type);
-    if (!set)
-        set = ! !BitIsOn(mask->masks[dev->id], event_type);
-    if (!set && IsMaster(dev))
-        set = ! !BitIsOn(mask->masks[XIAllMasterDevices], event_type);
+    if (xi2mask_isset_for_device(mask, inputInfo.all_devices, event_type))
+        set = 1;
+    else if (xi2mask_isset_for_device(mask, dev, event_type))
+        set = 1;
+    else if (IsMaster(dev) && xi2mask_isset_for_device(mask, inputInfo.all_master_devices, event_type))
+        set = 1;
 
     return set;
 }
index 25eb9b0..7d8e757 100755 (executable)
@@ -125,18 +125,16 @@ BOOL serverRunning = FALSE;
 pthread_mutex_t serverRunningMutex = PTHREAD_MUTEX_INITIALIZER;
 pthread_cond_t serverRunningCond = PTHREAD_COND_INITIALIZER;
 
-int dix_main(int argc, char *argv[], char *envp[]);
+#endif
 
 int
 dix_main(int argc, char *argv[], char *envp[])
-#else
-int
-main(int argc, char *argv[], char *envp[])
-#endif
 {
     int i;
     HWEventQueueType alwaysCheckForInput[2];
 
+    TTRACE_INPUT_BEGIN("XORG:SERVER:INIT");
+
     display = "0";
 
     InitRegions();
@@ -172,13 +170,16 @@ main(int argc, char *argv[], char *envp[])
             serverClient = calloc(sizeof(ClientRec), 1);
             if (!serverClient)
                 FatalError("couldn't create server client");
-            InitClient(serverClient, 0, (pointer) NULL);
+            InitClient(serverClient, 0, (void *) NULL);
         }
         else
             ResetWellKnownSockets();
         clients[0] = serverClient;
         currentMaxClients = 1;
 
+        /* clear any existing selections */
+        InitSelections();
+
         /* Initialize privates before first allocation */
         dixResetPrivates();
 
@@ -196,12 +197,14 @@ main(int argc, char *argv[], char *envp[])
 
         InitAtoms();
         InitEvents();
-        InitSelections();
         InitGlyphCaching();
         dixResetRegistry();
         ResetFontPrivateIndex();
         InitCallbackManager();
+
+        TTRACE_INPUT_BEGIN("XORG:SERVER:INITOUTPUT");
         InitOutput(&screenInfo, argc, argv);
+        TTRACE_INPUT_END();
 
         if (screenInfo.numScreens < 1)
             FatalError("no screens found");
@@ -211,6 +214,9 @@ main(int argc, char *argv[], char *envp[])
             ScreenPtr pScreen = screenInfo.gpuscreens[i];
             if (!CreateScratchPixmapsForScreen(pScreen))
                 FatalError("failed to create scratch pixmaps");
+            if (pScreen->CreateScreenResources &&
+                !(*pScreen->CreateScreenResources) (pScreen))
+                FatalError("failed to create screen resources");
         }
 
         for (i = 0; i < screenInfo.numScreens; i++) {
@@ -261,16 +267,26 @@ main(int argc, char *argv[], char *envp[])
         for (i = 0; i < screenInfo.numScreens; i++)
             InitRootWindow(screenInfo.screens[i]->root);
 
+        TTRACE_INPUT_BEGIN("XORG:SERVER:INITCoreDevices");
         InitCoreDevices();
+        TTRACE_INPUT_END();
+
 #ifdef _F_NO_INPUT_INIT_
-       if(!noInputInit)
-       {
-               InitInput(argc, argv);
-       }
+        if(!noInputInit)
+        {
+            TTRACE_INPUT_BEGIN("XORG:SERVER:INITINPUT");
+            InitInput(argc, argv);
+            TTRACE_INPUT_END();
+        }
 #else
+        TTRACE_INPUT_BEGIN("XORG:SERVER:INITINPUT");
         InitInput(argc, argv);
+        TTRACE_INPUT_END();
 #endif
+        TTRACE_INPUT_BEGIN("XORG:SERVER:INITAndStartDevices");
         InitAndStartDevices();
+        TTRACE_INPUT_END();
+
         ReserveClientIds(serverClient);
 
         dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset);
@@ -299,6 +315,8 @@ main(int argc, char *argv[], char *envp[])
 
         NotifyParentProcess();
 
+        TTRACE_INPUT_END();
+
         Dispatch();
 
 #ifdef XQUARTZ
@@ -362,10 +380,16 @@ main(int argc, char *argv[], char *envp[])
         dixFreePrivates(serverClient->devPrivates, PRIVATE_CLIENT);
         serverClient->devPrivates = NULL;
 
+       dixFreeRegistry();
+
         FreeFonts();
 
+        FreeAllAtoms();
+
         FreeAuditTimer();
 
+        DeleteCallbackManager();
+
         if (dispatchException & DE_TERMINATE) {
             CloseWellKnownConnections();
         }
index 2418812..4b880af 100644 (file)
@@ -49,7 +49,7 @@ from The Open Group.
 /* callable by ddx */
 PixmapPtr
 GetScratchPixmapHeader(ScreenPtr pScreen, int width, int height, int depth,
-                       int bitsPerPixel, int devKind, pointer pPixData)
+                       int bitsPerPixel, int devKind, void *pPixData)
 {
     PixmapPtr pPixmap = pScreen->pScratchPixmap;
 
@@ -202,7 +202,6 @@ PixmapStopDirtyTracking(PixmapPtr src, PixmapPtr slave_dst)
 
     xorg_list_for_each_entry_safe(ent, safe, &screen->pixmap_dirty_list, ent) {
         if (ent->src == src && ent->slave_dst == slave_dst) {
-            DamageUnregister(&src->drawable, ent->damage);
             DamageDestroy(ent->damage);
             xorg_list_del(&ent->ent);
             free(ent);
@@ -243,6 +242,8 @@ Bool PixmapSyncDirtyHelper(PixmapDirtyUpdatePtr dirty, RegionPtr dirty_region)
     }
 
     dst = dirty->slave_dst->master_pixmap;
+    if (!dst)
+        dst = dirty->slave_dst;
 
     RegionTranslate(dirty_region, -dirty->x, -dirty->y);
     n = RegionNumRects(dirty_region);
index 55b9345..e03b225 100644 (file)
@@ -105,7 +105,6 @@ static const char *key_names[PRIVATE_LAST] = {
     [PRIVATE_CURSOR_BITS] = "CURSOR_BITS",
 
     /* extension privates */
-    [PRIVATE_DBE_WINDOW] = "DBE_WINDOW",
     [PRIVATE_DAMAGE] = "DAMAGE",
     [PRIVATE_GLYPH] = "GLYPH",
     [PRIVATE_GLYPHSET] = "GLYPHSET",
@@ -260,7 +259,7 @@ fixupDefaultColormaps(FixupFunc fixup, unsigned bytes)
     for (s = 0; s < screenInfo.numScreens; s++) {
         ColormapPtr cmap;
 
-        dixLookupResourceByType((pointer *) &cmap,
+        dixLookupResourceByType((void **) &cmap,
                                 screenInfo.screens[s]->defColormap, RT_COLORMAP,
                                 serverClient, DixCreateAccess);
         if (cmap &&
@@ -349,7 +348,7 @@ dixRegisterPrivateKey(DevPrivateKey key, DevPrivateType type, unsigned size)
     if (size == 0)
         bytes = sizeof(void *);
 
-    /* align to void * size */
+    /* align to pointer size */
     bytes = (bytes + sizeof(void *) - 1) & ~(sizeof(void *) - 1);
 
     /* Update offsets for all affected keys */
@@ -698,7 +697,7 @@ _dixAllocateScreenObjectWithPrivates(ScreenPtr pScreen,
         privates_size = pScreen->screenSpecificPrivates[type].offset;
     else
         privates_size = global_keys[type].offset;
-    /* round up so that void * is aligned */
+    /* round up so that pointer is aligned */
     baseSize = (baseSize + sizeof(void *) - 1) & ~(sizeof(void *) - 1);
     totalSize = baseSize + privates_size;
     object = malloc(totalSize);
old mode 100644 (file)
new mode 100755 (executable)
index dec4090..2c31ea2
@@ -26,13 +26,13 @@ Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
 
                         All Rights Reserved
 
-Permission to use, copy, modify, and distribute this software and its 
-documentation for any purpose and without fee is hereby granted, 
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
 provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in 
+both that copyright notice and this permission notice appear in
 supporting documentation, and that the name of Digital not be
 used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.  
+software without specific, written prior permission.
 
 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
@@ -57,6 +57,24 @@ SOFTWARE.
 #include "swaprep.h"
 #include "xace.h"
 
+#ifdef _F_GLOBAL_CURSOR_STATE_
+#include "xf86drm.h"
+#include "drm/sdp_drm.h"
+
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+/* Defined to manage global cursor state show/hide */
+int global_cursor_state = 0;
+/* Defined to block/unblock core  devices  */
+int global_device_state=0;
+
+
+#define DRM_SDP_QPI_SET_GP_SYNCONOFF 0x56
+#define DRM_IOCTL_SDP_QPI_SET_GP_SYNCONOFF DRM_IOWR(DRM_COMMAND_BASE+DRM_SDP_QPI_SET_GP_SYNCONOFF,uint32_t)
+#endif
+
 /*****************************************************************
  * Property Stuff
  *
@@ -230,6 +248,66 @@ ProcChangeProperty(ClientPtr client)
         return BadAtom;
     }
 
+#ifdef _F_GLOBAL_CURSOR_STATE_
+    Atom mute_atom;
+    mute_atom = MakeAtom("WM_PLANE_MUTE_REQUEST",strlen("WM_PLANE_MUTE_REQUEST"), TRUE);
+
+    if(mute_atom == stuff->property)
+    {
+        int prop_val = 0;
+        memcpy(&prop_val, (int *)&stuff[1], sizeof(int));
+
+        int status = 0;
+        int value = 0;
+        /* open drm connection */
+        int fd = open("/dev/dri/card0", O_RDWR);
+        if (fd >= 0)  /* Prevent Fix for DF150120-00405*/
+        {
+            if (prop_val)
+            {
+                value = 1;   /* 1: mute off */
+                status = drmIoctl(fd, DRM_IOCTL_SDP_QPI_SET_GP_SYNCONOFF, &value);
+            }
+            else
+            {
+                value = 0;   /* 0 :mute on */
+                status = drmIoctl(fd, DRM_IOCTL_SDP_QPI_SET_GP_SYNCONOFF, &value);
+            }
+            close(fd);
+        }
+    }
+
+    Atom cursor_atom;
+    cursor_atom = MakeAtom("_CURSOR_SHOW_STATE",strlen("_CURSOR_SHOW_STATE"), TRUE);
+
+
+    if(cursor_atom == stuff->property) {
+        int prop_val = 0;
+        memcpy(&prop_val, (int *)&stuff[1], sizeof(int));
+        if (prop_val) {
+                global_cursor_state = TRUE;
+        }
+        else {
+                global_cursor_state = FALSE;
+        }
+    }
+
+    Atom check_coredevice_atom;
+    check_coredevice_atom = MakeAtom("_BLOCK_CORE_DEVICE",strlen("_BLOCK_CORE_DEVICE"), TRUE);
+
+
+    if(check_coredevice_atom == stuff->property) {
+        int prop_value = 0;
+        memcpy(&prop_value, (int *)&stuff[1], sizeof(int));
+        if (prop_value) {
+                global_device_state = TRUE;
+        }
+        else {
+                global_device_state = FALSE;
+        }
+    }
+#endif
+
     err = dixChangeWindowProperty(client, pWin, stuff->property, stuff->type,
                                   (int) format, (int) mode, len, &stuff[1],
                                   TRUE);
@@ -242,7 +320,7 @@ ProcChangeProperty(ClientPtr client)
 int
 dixChangeWindowProperty(ClientPtr pClient, WindowPtr pWin, Atom property,
                         Atom type, int format, int mode, unsigned long len,
-                        pointer value, Bool sendevent)
+                        void *value, Bool sendevent)
 {
     PropertyPtr pProp;
     PropertyRec savedProp;
@@ -356,7 +434,7 @@ dixChangeWindowProperty(ClientPtr pClient, WindowPtr pWin, Atom property,
 
 int
 ChangeWindowProperty(WindowPtr pWin, Atom property, Atom type, int format,
-                     int mode, unsigned long len, pointer value, Bool sendevent)
+                     int mode, unsigned long len, void *value, Bool sendevent)
 {
     return dixChangeWindowProperty(serverClient, pWin, property, type, format,
                                    mode, len, value, sendevent);
index 1fadc10..c5726c2 100644 (file)
@@ -58,6 +58,7 @@ R005 Composite:CompositeCreateRegionFromBorderClip
 R006 Composite:CompositeNameWindowPixmap
 R007 Composite:CompositeGetOverlayWindow
 R008 Composite:CompositeReleaseOverlayWindow
+R009 Composite:CompositeSetCoordinateTransform
 R000 DAMAGE:QueryVersion
 R001 DAMAGE:Create
 R002 DAMAGE:Destroy
@@ -133,6 +134,12 @@ R013 DRI2:GetParam
 R050 DRI2:SwapBuffersWithRegion
 V000 DRI2:BufferSwapComplete
 V001 DRI2:InvalidateBuffers
+R000 DRI3:QueryVersion
+R001 DRI3:Open
+R002 DRI3:PixmapFromBuffer
+R003 DRI3:BufferFromPixmap
+R004 DRI3:FenceFromFD
+R005 DRI3:FDFromFence
 R000 Extended-Visual-Information:QueryVersion
 R001 Extended-Visual-Information:GetVisualInfo
 R000 FontCache:QueryVersion
@@ -217,6 +224,13 @@ R002 HWC:Open
 R003 HWC:SetDrawables
 R004 HWC:SelectInput
 V000 HWC:ConfigureNotify
+R000 HWA:QueryVersion
+R001 HWA:CursorEnable
+R002 HWA:CursorRotate
+R003 HWA:ScreenInvertNegative
+R004 HWA:ScreenScale
+R005 HWA:OverlayShowLayer
+R006 HWA:OverlayHideLayer
 R000 LBX:QueryVersion
 R001 LBX:StartProxy
 R002 LBX:StopProxy
@@ -293,6 +307,11 @@ R010 Multi-Buffering:ClearImageBufferArea
 V000 Multi-Buffering:ClobberNotify
 V001 Multi-Buffering:UpdateNotify
 E000 Multi-Buffering:BadBuffer
+R000 Present:QueryVersion
+R001 Present:Pixmap
+R002 Present:NotifyMSC
+R003 Present:SelectInput
+R004 Present:QueryCapablilities
 R000 RANDR:QueryVersion
 R001 RANDR:OldGetScreenInfo
 R002 RANDR:SetScreenConfig
@@ -325,11 +344,22 @@ R028 RANDR:GetPanning
 R029 RANDR:SetPanning
 R030 RANDR:SetOutputPrimary
 R031 RANDR:GetOutputPrimary
+R032 RANDR:RRGetProviders
+R033 RANDR:RRGetProviderInfo
+R034 RANDR:RRSetProviderOffloadSink
+R035 RANDR:RRSetProviderOutputSource
+R036 RANDR:RRListProviderProperties
+R037 RANDR:RRQueryProviderProperty
+R038 RANDR:RRConfigureProviderProperty
+R039 RANDR:RRChangeProviderProperty
+R040 RANDR:RRDeleteProviderProperty
+R041 RANDR:RRGetProviderProperty
 V000 RANDR:ScreenChangeNotify
 V001 RANDR:Notify
 E000 RANDR:BadRROutput
 E001 RANDR:BadRRCrtc
 E002 RANDR:BadRRMode
+E003 RANDR:BadRRProvider
 R000 RECORD:QueryVersion
 R001 RECORD:CreateContext
 R002 RECORD:RegisterClients
@@ -899,6 +929,21 @@ E003 XFree86-VidModeExtension:ModeUnsuitable
 E004 XFree86-VidModeExtension:ExtensionDisabled
 E005 XFree86-VidModeExtension:ClientNotLocal
 E006 XFree86-VidModeExtension:ZoomLocked
+R000 XGestureExtension:GestureQueryVersion
+R001 XGestureExtension:GestureSelectEvents
+R002 XGestureExtension:GestureGetSelectedEvents
+R003 XGestureExtension:GestureGrabEvent
+R004 XGestureExtension:GestureUngrabEvent
+V000 XGestureExtension:GestureNotifyFlick
+V001 XGestureExtension:GestureNotifyPan
+V002 XGestureExtension:GestureNotifyPinchRotation
+V003 XGestureExtension:GestureNotifyTap
+V004 XGestureExtension:GestureNotifyTapNHold
+V005 XGestureExtension:GestureNotifyHold
+V006 XGestureExtension:GestureNotifyGroup
+E000 XGestureExtension:GestureClientNotLocal
+E001 XGestureExtension:GestureInValidMask
+E002 XGestureExtension:GestureOperationNotSupported
 R001 XIE:QueryImageExtension
 R002 XIE:QueryTechniques
 R003 XIE:CreateColorList
index 338f415..e75300a 100644 (file)
@@ -77,7 +77,7 @@ DeletePredictableAccelerationProperties(DeviceIntPtr,
 /*#define PTRACCEL_DEBUGGING*/
 
 #ifdef PTRACCEL_DEBUGGING
-#define DebugAccelF ErrorF
+#define DebugAccelF(...) ErrorFSigSafe("dix/ptraccel: " __VA_ARGS__)
 #else
 #define DebugAccelF(...)        /* */
 #endif
@@ -245,11 +245,10 @@ AccelSetDecelProperty(DeviceIntPtr dev, Atom atom,
     if (checkOnly) {
         if (rc)
             return rc;
-        return (v >= 1.0f) ? Success : BadValue;
+        return (v > 0) ? Success : BadValue;
     }
 
-    if (v >= 1.0f)
-        vel->const_acceleration = 1 / v;
+    vel->const_acceleration = 1 / v;
 
     return Success;
 }
@@ -421,7 +420,7 @@ void
 InitTrackers(DeviceVelocityPtr vel, int ntracker)
 {
     if (ntracker < 1) {
-        ErrorF("(dix ptracc) invalid number of trackers\n");
+        ErrorF("invalid number of trackers\n");
         return;
     }
     free(vel->tracker);
@@ -566,7 +565,7 @@ FeedTrackers(DeviceVelocityPtr vel, double dx, double dy, int cur_t)
     vel->tracker[n].dy = 0.0;
     vel->tracker[n].time = cur_t;
     vel->tracker[n].dir = GetDirection(dx, dy);
-    DebugAccelF("(dix prtacc) motion [dx: %i dy: %i dir:%i diff: %i]\n",
+    DebugAccelF("motion [dx: %f dy: %f dir:%d diff: %d]\n",
                 dx, dy, vel->tracker[n].dir,
                 cur_t - vel->tracker[vel->cur_tracker].time);
     vel->cur_tracker = n;
@@ -614,7 +613,8 @@ QueryTrackers(DeviceVelocityPtr vel, int cur_t)
 
         /* bail out if data is too old and protect from overrun */
         if (age_ms >= vel->reset_time || age_ms < 0) {
-            DebugAccelF("(dix prtacc) query: tracker too old\n");
+            DebugAccelF("query: tracker too old (reset after %d, age is %d)\n",
+                        vel->reset_time, age_ms);
             break;
         }
 
@@ -626,7 +626,7 @@ QueryTrackers(DeviceVelocityPtr vel, int cur_t)
          */
         dir &= tracker->dir;
         if (dir == 0) {         /* we've changed octant of movement (e.g. NE â†’ NW) */
-            DebugAccelF("(dix prtacc) query: no longer linear\n");
+            DebugAccelF("query: no longer linear\n");
             /* instead of breaking it we might also inspect the partition after,
              * but actual improvement with this is probably rare. */
             break;
@@ -647,7 +647,7 @@ QueryTrackers(DeviceVelocityPtr vel, int cur_t)
                 velocity_diff / (initial_velocity + tracker_velocity) >=
                 vel->max_rel_diff) {
                 /* we're not in range, quit - it won't get better. */
-                DebugAccelF("(dix prtacc) query: tracker too different:"
+                DebugAccelF("query: tracker too different:"
                             " old %2.2f initial %2.2f diff: %2.2f\n",
                             tracker_velocity, initial_velocity, velocity_diff);
                 break;
@@ -660,14 +660,14 @@ QueryTrackers(DeviceVelocityPtr vel, int cur_t)
         }
     }
     if (offset == vel->num_tracker) {
-        DebugAccelF("(dix prtacc) query: last tracker in effect\n");
+        DebugAccelF("query: last tracker in effect\n");
         used_offset = vel->num_tracker - 1;
     }
     if (used_offset >= 0) {
 #ifdef PTRACCEL_DEBUGGING
         MotionTracker *tracker = TRACKER(vel, used_offset);
 
-        DebugAccelF("(dix prtacc) result: offset %i [dx: %i dy: %i diff: %i]\n",
+        DebugAccelF("result: offset %i [dx: %f dy: %f diff: %i]\n",
                     used_offset, tracker->dx, tracker->dy,
                     cur_t - tracker->time);
 #endif
@@ -693,6 +693,8 @@ ProcessVelocityData2D(DeviceVelocityPtr vel, double dx, double dy, int time)
 
     velocity = QueryTrackers(vel, time);
 
+    DebugAccelF("velocity is %f\n", velocity);
+
     vel->velocity = velocity;
     return velocity == 0;
 }
@@ -738,7 +740,7 @@ ApplyConstantDeceleration(DeviceVelocityPtr vel, double *fdx, double *fdy)
 }
 
 /*
- * compute the acceleration for given velocity and enforce min_acceleartion
+ * compute the acceleration for given velocity and enforce min_acceleration
  */
 double
 BasicComputeAcceleration(DeviceIntPtr dev,
@@ -768,7 +770,7 @@ ComputeAcceleration(DeviceIntPtr dev,
     double result;
 
     if (vel->velocity <= 0) {
-        DebugAccelF("(dix ptracc) profile skipped\n");
+        DebugAccelF("profile skipped\n");
         /*
          * If we have no idea about device velocity, don't pretend it.
          */
@@ -792,14 +794,14 @@ ComputeAcceleration(DeviceIntPtr dev,
                                             threshold,
                                             acc);
         result /= 6.0f;
-        DebugAccelF("(dix ptracc) profile average [%.2f ... %.2f] is %.3f\n",
+        DebugAccelF("profile average [%.2f ... %.2f] is %.3f\n",
                     vel->velocity, vel->last_velocity, result);
     }
     else {
         result = BasicComputeAcceleration(dev, vel,
                                           vel->velocity, threshold, acc);
-        DebugAccelF("(dix ptracc) profile sample [%.2f] is %.3f\n",
-                    vel->velocity, res);
+        DebugAccelF("profile sample [%.2f] is %.3f\n",
+                    vel->velocity, result);
     }
 
     return result;
@@ -1050,11 +1052,8 @@ SetDeviceSpecificAccelerationProfile(DeviceVelocityPtr vel,
 DeviceVelocityPtr
 GetDevicePredictableAccelData(DeviceIntPtr dev)
 {
-    /*sanity check */
-    if (!dev) {
-        ErrorF("[dix] accel: DeviceIntPtr was NULL");
-        return NULL;
-    }
+    BUG_RETURN_VAL(!dev, NULL);
+
     if (dev->valuator &&
         dev->valuator->accelScheme.AccelSchemeProc ==
         acceleratePointerPredictable &&
@@ -1113,6 +1112,7 @@ acceleratePointerPredictable(DeviceIntPtr dev, ValuatorMask *val, CARD32 evtime)
                                        (double) dev->ptrfeed->ctrl.num /
                                        (double) dev->ptrfeed->ctrl.den);
 
+            DebugAccelF("mult is %f\n", mult);
             if (mult != 1.0f || velocitydata->const_acceleration != 1.0f) {
                 if (mult > 1.0f && soften)
                     ApplySoftening(velocitydata, &dx, &dy);
@@ -1122,8 +1122,7 @@ acceleratePointerPredictable(DeviceIntPtr dev, ValuatorMask *val, CARD32 evtime)
                     valuator_mask_set_double(val, 0, mult * dx);
                 if (dy != 0.0)
                     valuator_mask_set_double(val, 1, mult * dy);
-                DebugAccelF("pos (%i | %i) delta x:%.3f y:%.3f\n", mult * dx,
-                            mult * dy);
+                DebugAccelF("delta x:%.3f y:%.3f\n", mult * dx, mult * dy);
             }
         }
     }
index 737d2a8..15f3d01 100644 (file)
@@ -255,6 +255,21 @@ RegionDestroy(RegionPtr pReg)
         free(pReg);
 }
 
+RegionPtr
+RegionDuplicate(RegionPtr pOld)
+{
+    RegionPtr   pNew;
+
+    pNew = RegionCreate(&pOld->extents, 0);
+    if (!pNew)
+        return NULL;
+    if (!RegionCopy(pNew, pOld)) {
+        RegionDestroy(pNew);
+        return NULL;
+    }
+    return pNew;
+}
+
 void
 RegionPrint(RegionPtr rgn)
 {
index 5bad0fd..82a3340 100644 (file)
@@ -280,14 +280,9 @@ LookupResourceName(RESTYPE resource)
     return resources[resource] ? resources[resource] : XREGISTRY_UNKNOWN;
 }
 
-/*
- * Setup and teardown
- */
 void
-dixResetRegistry(void)
+dixFreeRegistry(void)
 {
-    ExtensionEntry extEntry = { .name = CORE };
-
     /* Free all memory */
     while (nmajor--) {
         while (nminor[nmajor])
@@ -315,9 +310,23 @@ dixResetRegistry(void)
 
     nmajor = nevent = nerror = nresource = 0;
 
+    if (fh) {
+       fclose(fh);
+        fh = NULL;
+    }
+}
+
+/*
+ * Setup and teardown
+ */
+void
+dixResetRegistry(void)
+{
+    ExtensionEntry extEntry = { .name = CORE };
+
+    dixFreeRegistry();
+
     /* Open the protocol file */
-    if (fh)
-        fclose(fh);
     fh = fopen(FILENAME, "r");
     if (!fh)
         LogMessage(X_WARNING,
index 2aafa34..623d862 100644 (file)
@@ -165,7 +165,7 @@ typedef struct _Resource {
     struct _Resource *next;
     XID id;
     RESTYPE type;
-    pointer value;
+    void *value;
 } ResourceRec, *ResourcePtr;
 
 typedef struct _ClientResource {
@@ -203,7 +203,7 @@ struct ResourceType {
  *                  resource can't be determined.
  */
 static void
-GetDefaultBytes(pointer value, XID id, ResourceSizePtr size)
+GetDefaultBytes(void *value, XID id, ResourceSizePtr size)
 {
     size->resourceSize = 0;
     size->pixmapRefSize = 0;
@@ -224,7 +224,7 @@ GetDefaultBytes(pointer value, XID id, ResourceSizePtr size)
  * @param[out] cdata Pointer to opaque data.
  */
 static void
-DefaultFindSubRes(pointer value, FindAllRes func, pointer cdata)
+DefaultFindSubRes(void *value, FindAllRes func, void *cdata)
 {
     /* do nothing */
 }
@@ -268,7 +268,7 @@ GetDrawableBytes(DrawablePtr drawable)
  *                  pixmap reference.
  */
 static void
-GetPixmapBytes(pointer value, XID id, ResourceSizePtr size)
+GetPixmapBytes(void *value, XID id, ResourceSizePtr size)
 {
     PixmapPtr pixmap = value;
 
@@ -297,7 +297,7 @@ GetPixmapBytes(pointer value, XID id, ResourceSizePtr size)
  *                  pixmap references of a window.
  */
 static void
-GetWindowBytes(pointer value, XID id, ResourceSizePtr size)
+GetWindowBytes(void *value, XID id, ResourceSizePtr size)
 {
     SizeType pixmapSizeFunc = GetResourceTypeSizeFunc(RT_PIXMAP);
     ResourceSizeRec pixmapSize = { 0, 0, 0 };
@@ -339,7 +339,7 @@ GetWindowBytes(pointer value, XID id, ResourceSizePtr size)
  * @param[out] cdata Pointer to opaque data
  */
 static void
-FindWindowSubRes(pointer value, FindAllRes func, pointer cdata)
+FindWindowSubRes(void *value, FindAllRes func, void *cdata)
 {
     WindowPtr window = value;
 
@@ -370,7 +370,7 @@ FindWindowSubRes(pointer value, FindAllRes func, pointer cdata)
  *                  pixmap references of a graphics context.
  */
 static void
-GetGcBytes(pointer value, XID id, ResourceSizePtr size)
+GetGcBytes(void *value, XID id, ResourceSizePtr size)
 {
     SizeType pixmapSizeFunc = GetResourceTypeSizeFunc(RT_PIXMAP);
     ResourceSizeRec pixmapSize = { 0, 0, 0 };
@@ -411,7 +411,7 @@ GetGcBytes(pointer value, XID id, ResourceSizePtr size)
  * @param[out] cdata Pointer to opaque data
  */
 static void
-FindGCSubRes(pointer value, FindAllRes func, pointer cdata)
+FindGCSubRes(void *value, FindAllRes func, void *cdata)
 {
     GCPtr gc = value;
 
@@ -743,7 +743,7 @@ GetXIDList(ClientPtr pClient, unsigned count, XID *pids)
     unsigned int found = 0;
     XID rc, id = pClient->clientAsMask;
     XID maxid;
-    pointer val;
+    void *val;
 
     maxid = id | RESOURCE_ID_MASK;
     while ((found < count) && (id <= maxid)) {
@@ -787,7 +787,7 @@ FakeClientID(int client)
 }
 
 Bool
-AddResource(XID id, RESTYPE type, pointer value)
+AddResource(XID id, RESTYPE type, void *value)
 {
     int client;
     ClientResourceRec *rrec;
@@ -948,7 +948,7 @@ FreeResourceByType(XID id, RESTYPE type, Bool skipFree)
  */
 
 Bool
-ChangeResourceValue(XID id, RESTYPE rtype, pointer value)
+ChangeResourceValue(XID id, RESTYPE rtype, void *value)
 {
     int cid;
     ResourcePtr res;
@@ -973,7 +973,7 @@ ChangeResourceValue(XID id, RESTYPE rtype, pointer value)
 
 void
 FindClientResourcesByType(ClientPtr client,
-                          RESTYPE type, FindResType func, pointer cdata)
+                          RESTYPE type, FindResType func, void *cdata)
 {
     ResourcePtr *resources;
     ResourcePtr this, next;
@@ -998,17 +998,17 @@ FindClientResourcesByType(ClientPtr client,
     }
 }
 
-void FindSubResources(pointer    resource,
+void FindSubResources(void *resource,
                       RESTYPE    type,
                       FindAllRes func,
-                      pointer    cdata)
+                      void *cdata)
 {
     struct ResourceType rtype = resourceTypes[type & TypeMask];
     rtype.findSubResFunc(resource, func, cdata);
 }
 
 void
-FindAllClientResources(ClientPtr client, FindAllRes func, pointer cdata)
+FindAllClientResources(ClientPtr client, FindAllRes func, void *cdata)
 {
     ResourcePtr *resources;
     ResourcePtr this, next;
@@ -1031,14 +1031,14 @@ FindAllClientResources(ClientPtr client, FindAllRes func, pointer cdata)
     }
 }
 
-pointer
+void *
 LookupClientResourceComplex(ClientPtr client,
                             RESTYPE type,
-                            FindComplexResType func, pointer cdata)
+                            FindComplexResType func, void *cdata)
 {
     ResourcePtr *resources;
     ResourcePtr this, next;
-    pointer value;
+    void *value;
     int i;
 
     if (!client)
@@ -1158,7 +1158,7 @@ FreeAllResources(void)
 Bool
 LegalNewID(XID id, ClientPtr client)
 {
-    pointer val;
+    void *val;
     int rc;
 
 #ifdef PANORAMIX
@@ -1181,7 +1181,7 @@ LegalNewID(XID id, ClientPtr client)
 }
 
 int
-dixLookupResourceByType(pointer *result, XID id, RESTYPE rtype,
+dixLookupResourceByType(void **result, XID id, RESTYPE rtype,
                         ClientPtr client, Mask mode)
 {
     int cid = CLIENT_ID(id);
@@ -1216,7 +1216,7 @@ dixLookupResourceByType(pointer *result, XID id, RESTYPE rtype,
 }
 
 int
-dixLookupResourceByClass(pointer *result, XID id, RESTYPE rclass,
+dixLookupResourceByClass(void **result, XID id, RESTYPE rclass,
                          ClientPtr client, Mask mode)
 {
     int cid = CLIENT_ID(id);
diff --git a/dix/stubmain.c b/dix/stubmain.c
new file mode 100644 (file)
index 0000000..7efb4b8
--- /dev/null
@@ -0,0 +1,35 @@
+/***********************************************************
+
+Copyright 2012 Jon TURNEY
+
+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.
+
+******************************************************************/
+
+int dix_main(int argc, char *argv[], char *envp[]);
+
+/*
+  A default implementation of main, which can be overridden by the DDX
+ */
+int
+main(int argc, char *argv[], char *envp[])
+{
+    return dix_main(argc, argv, envp);
+}
index 849ab3a..018c847 100644 (file)
@@ -75,7 +75,7 @@ static unsigned char resize_waiting[(MAXDEVICES + 7) / 8];
  * anyway and re-executing this won't help.
  */
 static Bool
-TouchResizeQueue(ClientPtr client, pointer closure)
+TouchResizeQueue(ClientPtr client, void *closure)
 {
     int i;
 
@@ -263,6 +263,7 @@ void
 TouchFreeTouchPoint(DeviceIntPtr device, int index)
 {
     TouchPointInfoPtr ti;
+    int i;
 
     if (!device->touch || index >= device->touch->num_touches)
         return;
@@ -271,6 +272,9 @@ TouchFreeTouchPoint(DeviceIntPtr device, int index)
     if (ti->active)
         TouchEndTouch(device, ti);
 
+    for (i = 0; i < ti->num_listeners; i++)
+        TouchRemoveListener(ti, ti->listeners[0].listener);
+
     valuator_mask_free(&ti->valuators);
     free(ti->sprite.spriteTrace);
     ti->sprite.spriteTrace = NULL;
@@ -388,6 +392,8 @@ TouchBeginTouch(DeviceIntPtr dev, int sourceid, uint32_t touchid,
 void
 TouchEndTouch(DeviceIntPtr dev, TouchPointInfoPtr ti)
 {
+    int i;
+
     if (ti->emulate_pointer) {
         GrabPtr grab;
 
@@ -399,6 +405,9 @@ TouchEndTouch(DeviceIntPtr dev, TouchPointInfoPtr ti)
         }
     }
 
+    for (i = 0; i < ti->num_listeners; i++)
+        TouchRemoveListener(ti, ti->listeners[0].listener);
+
     ti->active = FALSE;
     ti->pending_finish = FALSE;
     ti->sprite.spriteTraceGood = 0;
@@ -486,49 +495,56 @@ TouchEventHistoryPush(TouchPointInfoPtr ti, const DeviceEvent *ev)
 void
 TouchEventHistoryReplay(TouchPointInfoPtr ti, DeviceIntPtr dev, XID resource)
 {
-    InternalEvent *tel;
-    ValuatorMask *mask;
-    int i, nev;
-    int flags;
+    int i;
 
     if (!ti->history)
         return;
 
-    tel = InitEventList(GetMaximumEventsNum());
-    mask = valuator_mask_new(0);
+    TouchDeliverDeviceClassesChangedEvent(ti, ti->history[0].time, resource);
 
-    valuator_mask_set_double(mask, 0, ti->history[0].valuators.data[0]);
-    valuator_mask_set_double(mask, 1, ti->history[0].valuators.data[1]);
+    for (i = 0; i < ti->history_elements; i++) {
+        DeviceEvent *ev = &ti->history[i];
 
-    flags = TOUCH_CLIENT_ID | TOUCH_REPLAYING;
-    if (ti->emulate_pointer)
-        flags |= TOUCH_POINTER_EMULATED;
-    /* Generate events based on a fake touch begin event to get DCCE events if
-     * needed */
-    /* FIXME: This needs to be cleaned up */
-    nev = GetTouchEvents(tel, dev, ti->client_id, XI_TouchBegin, flags, mask);
-    for (i = 0; i < nev; i++) {
-        /* Send saved touch begin event */
-        if (tel[i].any.type == ET_TouchBegin) {
-            DeviceEvent *ev = &ti->history[0];
-            ev->flags |= TOUCH_REPLAYING;
-            DeliverTouchEvents(dev, ti, (InternalEvent*)ev, resource);
-        }
-        else {/* Send DCCE event */
-            tel[i].any.time = ti->history[0].time;
-            DeliverTouchEvents(dev, ti, tel + i, resource);
-        }
+        ev->flags |= TOUCH_REPLAYING;
+        ev->resource = resource;
+        /* FIXME:
+           We're replaying ti->history which contains the TouchBegin +
+           all TouchUpdates for ti. This needs to be passed on to the next
+           listener. If that is a touch listener, everything is dandy.
+           If the TouchBegin however triggers a sync passive grab, the
+           TouchUpdate events must be sent to EnqueueEvent so the events end
+           up in syncEvents.pending to be forwarded correctly in a
+           subsequent ComputeFreeze().
+
+           However, if we just send them to EnqueueEvent the sync'ing device
+           prevents handling of touch events for ownership listeners who
+           want the events right here, right now.
+         */
+        dev->public.processInputProc((InternalEvent*)ev, dev);
     }
+}
 
-    valuator_mask_free(&mask);
-    FreeEventList(tel, GetMaximumEventsNum());
+void
+TouchDeliverDeviceClassesChangedEvent(TouchPointInfoPtr ti, Time time,
+                                      XID resource)
+{
+    DeviceIntPtr dev;
+    int num_events = 0;
+    InternalEvent dcce;
 
-    /* First event was TouchBegin, already replayed that one */
-    for (i = 1; i < ti->history_elements; i++) {
-        DeviceEvent *ev = &ti->history[i];
+    dixLookupDevice(&dev, ti->sourceid, serverClient, DixWriteAccess);
 
-        ev->flags |= TOUCH_REPLAYING;
-        DeliverTouchEvents(dev, ti, (InternalEvent *) ev, resource);
+    if (!dev)
+        return;
+
+    /* UpdateFromMaster generates at most one event */
+    UpdateFromMaster(&dcce, dev, DEVCHANGE_POINTER_EVENT, &num_events);
+    BUG_WARN(num_events > 1);
+
+    if (num_events) {
+        dcce.any.time = time;
+        /* FIXME: This doesn't do anything */
+        dev->public.processInputProc(&dcce, dev);
     }
 }
 
@@ -595,8 +611,8 @@ TouchBuildSprite(DeviceIntPtr sourcedev, TouchPointInfoPtr ti,
         return FALSE;
 
     /* Mark which grabs/event selections we're delivering to: max one grab per
-     * window plus the bottom-most event selection. */
-    ti->listeners = calloc(sprite->spriteTraceGood + 1, sizeof(*ti->listeners));
+     * window plus the bottom-most event selection, plus any active grab. */
+    ti->listeners = calloc(sprite->spriteTraceGood + 2, sizeof(*ti->listeners));
     if (!ti->listeners) {
         sprite->spriteTraceGood = 0;
         return FALSE;
@@ -650,14 +666,14 @@ TouchConvertToPointerEvent(const InternalEvent *event,
     BUG_WARN_MSG(!(event->device_event.flags & TOUCH_POINTER_EMULATED),
                  "Non-emulating touch event\n");
 
-    *motion_event = *event;
+    motion_event->device_event = event->device_event;
     motion_event->any.type = ET_Motion;
     motion_event->device_event.detail.button = 0;
     motion_event->device_event.flags = XIPointerEmulated;
 
     if (nevents > 1) {
         BUG_RETURN_VAL(!button_event, 0);
-        *button_event = *event;
+        button_event->device_event = event->device_event;
         button_event->any.type = ptrtype;
         button_event->device_event.flags = XIPointerEmulated;
         /* detail is already correct */
@@ -708,15 +724,23 @@ void
 TouchAddListener(TouchPointInfoPtr ti, XID resource, int resource_type,
                  enum InputLevel level, enum TouchListenerType type,
                  enum TouchListenerState state, WindowPtr window,
-                 GrabPtr grab)
+                 const GrabPtr grab)
 {
+    GrabPtr g = NULL;
+
+    /* We need a copy of the grab, not the grab itself since that may be
+     * deleted by a UngrabButton request and leaves us with a dangling
+     * pointer */
+    if (grab)
+        g = AllocGrab(grab);
+
     ti->listeners[ti->num_listeners].listener = resource;
     ti->listeners[ti->num_listeners].resource_type = resource_type;
     ti->listeners[ti->num_listeners].level = level;
     ti->listeners[ti->num_listeners].state = state;
     ti->listeners[ti->num_listeners].type = type;
     ti->listeners[ti->num_listeners].window = window;
-    ti->listeners[ti->num_listeners].grab = grab;
+    ti->listeners[ti->num_listeners].grab = g;
     if (grab)
         ti->num_grabs++;
     ti->num_listeners++;
@@ -734,21 +758,25 @@ TouchRemoveListener(TouchPointInfoPtr ti, XID resource)
     int i;
 
     for (i = 0; i < ti->num_listeners; i++) {
-        if (ti->listeners[i].listener == resource) {
-            int j;
+        int j;
+        TouchListener *listener = &ti->listeners[i];
 
-            if (ti->listeners[i].grab) {
-                ti->listeners[i].grab = NULL;
-                ti->num_grabs--;
-            }
+        if (listener->listener != resource)
+            continue;
 
-            for (j = i; j < ti->num_listeners - 1; j++)
-                ti->listeners[j] = ti->listeners[j + 1];
-            ti->num_listeners--;
-            ti->listeners[ti->num_listeners].listener = 0;
-            ti->listeners[ti->num_listeners].state = LISTENER_AWAITING_BEGIN;
-            return TRUE;
+        if (listener->grab) {
+            FreeGrab(listener->grab);
+            listener->grab = NULL;
+            ti->num_grabs--;
         }
+
+        for (j = i; j < ti->num_listeners - 1; j++)
+            ti->listeners[j] = ti->listeners[j + 1];
+        ti->num_listeners--;
+        ti->listeners[ti->num_listeners].listener = 0;
+        ti->listeners[ti->num_listeners].state = LISTENER_AWAITING_BEGIN;
+
+        return TRUE;
     }
     return FALSE;
 }
@@ -890,8 +918,7 @@ TouchAddActiveGrabListener(DeviceIntPtr dev, TouchPointInfoPtr ti,
 
     if (!ti->emulate_pointer &&
         grab->grabtype == XI2 &&
-        (grab->type != XI_TouchBegin && grab->type != XI_TouchEnd &&
-         grab->type != XI_TouchUpdate))
+        !xi2mask_isset(grab->xi2mask, dev, XI_TouchBegin))
         return;
 
     TouchAddGrabListener(dev, ti, ev, grab);
@@ -904,7 +931,7 @@ TouchSetupListeners(DeviceIntPtr dev, TouchPointInfoPtr ti, InternalEvent *ev)
     SpritePtr sprite = &ti->sprite;
     WindowPtr win;
 
-    if (dev->deviceGrab.grab)
+    if (dev->deviceGrab.grab && !dev->deviceGrab.fromPassiveGrab)
         TouchAddActiveGrabListener(dev, ti, ev, dev->deviceGrab.grab);
 
     /* We set up an active touch listener for existing touches, but not any
@@ -932,7 +959,8 @@ TouchSetupListeners(DeviceIntPtr dev, TouchPointInfoPtr ti, InternalEvent *ev)
 }
 
 /**
- * Remove the touch pointer grab from the device. Called from AllowSome()
+ * Remove the touch pointer grab from the device. Called from
+ * DeactivatePointerGrab()
  */
 void
 TouchRemovePointerGrab(DeviceIntPtr dev)
@@ -955,6 +983,8 @@ TouchRemovePointerGrab(DeviceIntPtr dev)
     ti = TouchFindByClientID(dev, ev->touchid);
     if (!ti)
         return;
+
+    /* FIXME: missing a bit of code here... */
 }
 
 /* As touch grabs don't turn into active grabs with their own resources, we
@@ -981,11 +1011,11 @@ TouchListenerGone(XID resource)
                 continue;
 
             for (j = 0; j < ti->num_listeners; j++) {
-                if (ti->listeners[j].listener != resource)
+                if (CLIENT_BITS(ti->listeners[j].listener) != resource)
                     continue;
 
                 nev = GetTouchOwnershipEvents(events, dev, ti, XIRejectTouch,
-                                              resource, 0);
+                                              ti->listeners[j].listener, 0);
                 for (k = 0; k < nev; k++)
                     mieqProcessDeviceEvent(dev, events + k, NULL);
 
@@ -1027,9 +1057,6 @@ TouchListenerAcceptReject(DeviceIntPtr dev, TouchPointInfoPtr ti, int listener,
     for (i = 0; i < nev; i++)
         mieqProcessDeviceEvent(dev, events + i, NULL);
 
-    //Commented temporarily for a bug
-    //ProcessInputEvents();
-
     FreeEventList(events, GetMaximumEventsNum());
 
     return nev ? Success : BadMatch;
@@ -1063,3 +1090,74 @@ TouchAcceptReject(ClientPtr client, DeviceIntPtr dev, int mode,
 
     return TouchListenerAcceptReject(dev, ti, i, mode);
 }
+
+/**
+ * End physically active touches for a device.
+ */
+void
+TouchEndPhysicallyActiveTouches(DeviceIntPtr dev)
+{
+    InternalEvent *eventlist = InitEventList(GetMaximumEventsNum());
+    int i;
+
+    OsBlockSignals();
+    mieqProcessInputEvents();
+    for (i = 0; i < dev->last.num_touches; i++) {
+        DDXTouchPointInfoPtr ddxti = dev->last.touches + i;
+
+        if (ddxti->active) {
+            int j;
+            int nevents = GetTouchEvents(eventlist, dev, ddxti->ddx_id,
+                                         XI_TouchEnd, 0, NULL);
+
+            for (j = 0; j < nevents; j++)
+                mieqProcessDeviceEvent(dev, eventlist + j, NULL);
+        }
+    }
+    OsReleaseSignals();
+
+    FreeEventList(eventlist, GetMaximumEventsNum());
+}
+
+/**
+ * Generate and deliver a TouchEnd event.
+ *
+ * @param dev The device to deliver the event for.
+ * @param ti The touch point record to deliver the event for.
+ * @param flags Internal event flags. The called does not need to provide
+ *        TOUCH_CLIENT_ID and TOUCH_POINTER_EMULATED, this function will ensure
+ *        they are set appropriately.
+ * @param resource The client resource to deliver to, or 0 for all clients.
+ */
+void
+TouchEmitTouchEnd(DeviceIntPtr dev, TouchPointInfoPtr ti, int flags, XID resource)
+{
+    InternalEvent event;
+
+    /* We're not processing a touch end for a frozen device */
+    if (dev->deviceGrab.sync.frozen)
+        return;
+
+    flags |= TOUCH_CLIENT_ID;
+    if (ti->emulate_pointer)
+        flags |= TOUCH_POINTER_EMULATED;
+    TouchDeliverDeviceClassesChangedEvent(ti, GetTimeInMillis(), resource);
+    GetDixTouchEnd(&event, dev, ti, flags);
+    DeliverTouchEvents(dev, ti, &event, resource);
+    if (ti->num_grabs == 0)
+        UpdateDeviceState(dev, &event.device_event);
+}
+
+void
+TouchAcceptAndEnd(DeviceIntPtr dev, int touchid)
+{
+    TouchPointInfoPtr ti = TouchFindByClientID(dev, touchid);
+    if (!ti)
+        return;
+
+    TouchListenerAcceptReject(dev, ti, 0, XIAcceptTouch);
+    if (ti->pending_finish)
+        TouchEmitTouchEnd(dev, ti, 0, 0);
+    if (ti->num_listeners <= 1)
+        TouchEndTouch(dev, ti);
+}
old mode 100644 (file)
new mode 100755 (executable)
index cdd12dc..12e39d5
@@ -49,13 +49,13 @@ Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
 
                        All Rights Reserved
 
-Permission to use, copy, modify, and distribute this software and its 
-documentation for any purpose and without fee is hereby granted, 
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
 provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in 
+both that copyright notice and this permission notice appear in
 supporting documentation, and that the name of Digital not be
 used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.  
+software without specific, written prior permission.
 
 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
@@ -126,6 +126,7 @@ Equipment Corporation.
 #ifdef COMPOSITE
 #include "compint.h"
 #endif
+#include "selection.h"
 
 #include "privates.h"
 #include "xace.h"
@@ -134,7 +135,7 @@ Equipment Corporation.
 #include <X11/Xatom.h>          /* must come after server includes */
 
 /******
- * Window stuff for server 
+ * Window stuff for server
  *
  *    CreateRootWindow, CreateWindow, ChangeWindowAttributes,
  *    GetWindowAttributes, DeleteWindow, DestroySubWindows,
@@ -226,7 +227,7 @@ log_window_info(WindowPtr pWin, int depth)
 
     win_name = get_window_name(pWin);
     ErrorF("win 0x%.8x (%s), [%d, %d] to [%d, %d]",
-           pWin->drawable.id,
+           (unsigned) pWin->drawable.id,
            win_name ? win_name : "no name",
            pWin->drawable.x, pWin->drawable.y,
            pWin->drawable.x + pWin->drawable.width,
@@ -239,7 +240,7 @@ log_window_info(WindowPtr pWin, int depth)
         ErrorF(" (%s compositing: pixmap %x)",
                (pWin->redirectDraw == RedirectDrawAutomatic) ?
                "automatic" : "manual",
-               pScreen->GetWindowPixmap(pWin)->drawable.id);
+               (unsigned) pScreen->GetWindowPixmap(pWin)->drawable.id);
 #endif
 
     switch (pWin->visibility) {
@@ -282,7 +283,7 @@ PrintWindowTree(void)
     for (scrnum = 0; scrnum < screenInfo.numScreens; scrnum++) {
         pScreen = screenInfo.screens[scrnum];
         ErrorF("[dix] Dumping windows for screen %d (pixmap %x):\n", scrnum,
-               pScreen->GetScreenPixmap(pScreen)->drawable.id);
+               (unsigned) pScreen->GetScreenPixmap(pScreen)->drawable.id);
         pWin = pScreen->root;
         depth = 1;
         while (pWin) {
@@ -304,7 +305,7 @@ PrintWindowTree(void)
 }
 
 int
-TraverseTree(WindowPtr pWin, VisitWindowProcPtr func, pointer data)
+TraverseTree(WindowPtr pWin, VisitWindowProcPtr func, void *data)
 {
     int result;
     WindowPtr pChild;
@@ -337,7 +338,7 @@ TraverseTree(WindowPtr pWin, VisitWindowProcPtr func, pointer data)
  *****/
 
 int
-WalkTree(ScreenPtr pScreen, VisitWindowProcPtr func, pointer data)
+WalkTree(ScreenPtr pScreen, VisitWindowProcPtr func, void *data)
 {
     return (TraverseTree(pScreen->root, func, data));
 }
@@ -362,7 +363,7 @@ SetWindowToDefaults(WindowPtr pWin)
 
     pWin->backingStore = NotUseful;
     pWin->DIXsaveUnder = FALSE;
-    pWin->backStorage = (pointer) NULL;
+    pWin->backStorage = (void *) NULL;
 
     pWin->mapped = FALSE;       /* off */
     pWin->realized = FALSE;     /* off */
@@ -523,13 +524,17 @@ CreateRootWindow(ScreenPtr pScreen)
                  RT_WINDOW, pWin, RT_NONE, NULL, DixCreateAccess))
         return FALSE;
 
-    if (!AddResource(pWin->drawable.id, RT_WINDOW, (pointer) pWin))
+    if (!AddResource(pWin->drawable.id, RT_WINDOW, (void *) pWin))
         return FALSE;
 
     if (disableBackingStore)
         pScreen->backingStoreSupport = NotUseful;
     if (enableBackingStore)
-        pScreen->backingStoreSupport = Always;
+        pScreen->backingStoreSupport = WhenMapped;
+#ifdef COMPOSITE
+    if (noCompositeExtension)
+        pScreen->backingStoreSupport = NotUseful;
+#endif
 
     pScreen->saveUnderSupport = NotUseful;
 
@@ -547,8 +552,7 @@ InitRootWindow(WindowPtr pWin)
     (*pScreen->PositionWindow) (pWin, 0, 0);
 
     pWin->cursorIsNone = FALSE;
-    pWin->optional->cursor = rootCursor;
-    rootCursor->refcnt++;
+    pWin->optional->cursor = RefCursor(rootCursor);
 
     if (party_like_its_1989) {
         MakeRootTile(pWin);
@@ -630,7 +634,7 @@ RealChildHead(WindowPtr pWin)
 
 /*****
  * CreateWindow
- *    Makes a window in response to client request 
+ *    Makes a window in response to client request
  *****/
 
 WindowPtr
@@ -680,7 +684,7 @@ CreateWindow(Window wid, WindowPtr pParent, int x, int y, unsigned w,
     if ((visual != ancwopt->visual) || (depth != pParent->drawable.depth)) {
         fOK = FALSE;
         for (idepth = 0; idepth < pScreen->numDepths; idepth++) {
-            pDepth = (DepthPtr) & pScreen->allowedDepths[idepth];
+            pDepth = (DepthPtr) &pScreen->allowedDepths[idepth];
             if ((depth == pDepth->depth) || (depth == 0)) {
                 for (ivisual = 0; ivisual < pDepth->numVids; ivisual++) {
                     if (visual == pDepth->vids[ivisual]) {
@@ -955,7 +959,7 @@ CrushTree(WindowPtr pWin)
  *****/
 
 int
-DeleteWindow(pointer value, XID wid)
+DeleteWindow(void *value, XID wid)
 {
     WindowPtr pParent;
     WindowPtr pWin = (WindowPtr) value;
@@ -1035,10 +1039,10 @@ SetRootWindowBackground(WindowPtr pWin, ScreenPtr pScreen, Mask *index2)
 
 /*****
  *  ChangeWindowAttributes
- *   
+ *
  *  The value-mask specifies which attributes are to be changed; the
  *  value-list contains one value for each one bit in the mask, from least
- *  to most significant bit in the mask.  
+ *  to most significant bit in the mask.
  *****/
 
 int
@@ -1103,7 +1107,7 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client)
                  * incremented. */
             }
             else {
-                rc = dixLookupResourceByType((pointer *) &pPixmap, pixID,
+                rc = dixLookupResourceByType((void **) &pPixmap, pixID,
                                              RT_PIXMAP, client, DixReadAccess);
                 if (rc == Success) {
                     if ((pPixmap->drawable.depth != pWin->drawable.depth) ||
@@ -1157,7 +1161,7 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client)
                     pixID = pWin->parent->border.pixmap->drawable.id;
                 }
             }
-            rc = dixLookupResourceByType((pointer *) &pPixmap, pixID, RT_PIXMAP,
+            rc = dixLookupResourceByType((void **) &pPixmap, pixID, RT_PIXMAP,
                                          client, DixReadAccess);
             if (rc == Success) {
                 if ((pPixmap->drawable.depth != pWin->drawable.depth) ||
@@ -1304,7 +1308,7 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client)
                 error = BadMatch;
                 goto PatchUp;
             }
-            rc = dixLookupResourceByType((pointer *) &pCmap, cmap, RT_COLORMAP,
+            rc = dixLookupResourceByType((void **) &pCmap, cmap, RT_COLORMAP,
                                          client, DixUseAccess);
             if (rc != Success) {
                 error = rc;
@@ -1374,7 +1378,7 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client)
                     pCursor = (CursorPtr) None;
             }
             else {
-                rc = dixLookupResourceByType((pointer *) &pCursor, cursorID,
+                rc = dixLookupResourceByType((void **) &pCursor, cursorID,
                                              RT_CURSOR, client, DixUseAccess);
                 if (rc != Success) {
                     error = rc;
@@ -1416,8 +1420,7 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client)
                     else if (pWin->parent && pCursor == wCursor(pWin->parent))
                         checkOptional = TRUE;
                     pOldCursor = pWin->optional->cursor;
-                    pWin->optional->cursor = pCursor;
-                    pCursor->refcnt++;
+                    pWin->optional->cursor = RefCursor(pCursor);
                     pWin->cursorIsNone = FALSE;
                     /*
                      * check on any children now matching the new cursor
@@ -1431,6 +1434,8 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client)
                     }
                 }
 
+                CursorVisible = TRUE;
+
                 if (pWin->realized)
                     WindowHasNewCursor(pWin);
 
@@ -1455,8 +1460,8 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client)
     /* We SHOULD check for an error value here XXX */
     (*pScreen->ChangeWindowAttributes) (pWin, vmaskCopy);
 
-    /* 
-       If the border contents have changed, redraw the border. 
+    /*
+       If the border contents have changed, redraw the border.
        Note that this has to be done AFTER pScreen->ChangeWindowAttributes
        for the tile to be rotated, and the correct function selected.
      */
@@ -1812,7 +1817,7 @@ ResizeChildrenWinSize(WindowPtr pWin, int dx, int dy, int dw, int dh)
 
 /*
  * IsSiblingAboveMe
- *     returns Above if pSib above pMe in stack or Below otherwise 
+ *     returns Above if pSib above pMe in stack or Below otherwise
  */
 
 static int
@@ -1886,8 +1891,7 @@ AnyWindowOverlapsMe(WindowPtr pWin, WindowPtr pHead, BoxPtr box)
         if (pSib->mapped) {
             sbox = WindowExtents(pSib, &sboxrec);
             if (BOXES_OVERLAP(sbox, box)
-                && ShapeOverlap(pWin, box, pSib, sbox)
-                )
+                && ShapeOverlap(pWin, box, pSib, sbox))
                 return TRUE;
         }
     }
@@ -1905,8 +1909,7 @@ IOverlapAnyWindow(WindowPtr pWin, BoxPtr box)
         if (pSib->mapped) {
             sbox = WindowExtents(pSib, &sboxrec);
             if (BOXES_OVERLAP(sbox, box)
-                && ShapeOverlap(pWin, box, pSib, sbox)
-                )
+                && ShapeOverlap(pWin, box, pSib, sbox))
                 return TRUE;
         }
     }
@@ -1914,7 +1917,7 @@ IOverlapAnyWindow(WindowPtr pWin, BoxPtr box)
 }
 
 /*
- *   WhereDoIGoInTheStack() 
+ *   WhereDoIGoInTheStack()
  *       Given pWin and pSib and the relationshipe smode, return
  *       the window that pWin should go ABOVE.
  *       If a pSib is specified:
@@ -1922,7 +1925,7 @@ IOverlapAnyWindow(WindowPtr pWin, BoxPtr box)
  *           Below:  pWin is placed just below pSib
  *           TopIf:  if pSib occludes pWin, then pWin is placed
  *                   at the top of the stack
- *           BottomIf:  if pWin occludes pSib, then pWin is 
+ *           BottomIf:  if pWin occludes pSib, then pWin is
  *                      placed at the bottom of the stack
  *           Opposite: if pSib occludes pWin, then pWin is placed at the
  *                     top of the stack, else if pWin occludes pSib, then
@@ -2174,8 +2177,7 @@ ConfigureWindow(WindowPtr pWin, Mask mask, XID *vlist, ClientPtr client)
     else
         pSib = pWin->nextSib;
 
-    if ((!pWin->overrideRedirect) && (RedirectSend(pParent)
-        )) {
+    if ((!pWin->overrideRedirect) && (RedirectSend(pParent))) {
         xEvent event = {
             .u.configureRequest.window = pWin->drawable.id,
             .u.configureRequest.sibling = (mask & CWSibling) ? sibwid : None,
@@ -2318,7 +2320,7 @@ ConfigureWindow(WindowPtr pWin, Mask mask, XID *vlist, ClientPtr client)
  *    For RaiseLowest, raises the lowest mapped child (if any) that is
  *    obscured by another child to the top of the stack.  For LowerHighest,
  *    lowers the highest mapped child (if any) that is obscuring another
- *    child to the bottom of the stack.         Exposure processing is performed 
+ *    child to the bottom of the stack.         Exposure processing is performed
  *
  ******/
 
@@ -2375,7 +2377,7 @@ CirculateWindow(WindowPtr pParent, int direction, ClientPtr client)
 }
 
 static int
-CompareWIDs(WindowPtr pWin, pointer value)
+CompareWIDs(WindowPtr pWin, void *value)
 {                               /* must conform to VisitWindowProcPtr */
     Window *wid = (Window *) value;
 
@@ -2400,7 +2402,7 @@ ReparentWindow(WindowPtr pWin, WindowPtr pParent,
     ScreenPtr pScreen;
 
     pScreen = pWin->drawable.pScreen;
-    if (TraverseTree(pWin, CompareWIDs, (pointer) &pParent->drawable.id) ==
+    if (TraverseTree(pWin, CompareWIDs, (void *) &pParent->drawable.id) ==
         WT_STOPWALKING)
         return BadMatch;
     if (!MakeWindowOptional(pWin))
@@ -2493,8 +2495,14 @@ RealizeTree(WindowPtr pWin)
     while (1) {
         if (pChild->mapped) {
             pChild->realized = TRUE;
+#ifdef _F_REALIZETREE_REALIZE_BEFORE_SET_VIEWABLE_
+            /*change for the top-bottom stereo defect DF141212-01637*/
+            (*Realize) (pChild);
+            pChild->viewable = (pChild->drawable.class == InputOutput);
+#else
             pChild->viewable = (pChild->drawable.class == InputOutput);
             (*Realize) (pChild);
+#endif
             if (pChild->firstChild) {
                 pChild = pChild->firstChild;
                 continue;
@@ -2508,28 +2516,29 @@ RealizeTree(WindowPtr pWin)
     }
 }
 
-static WindowPtr windowDisableMapUnmapEvents;
-
-void
-DisableMapUnmapEvents(WindowPtr pWin)
-{
-    assert(windowDisableMapUnmapEvents == NULL);
-
-    windowDisableMapUnmapEvents = pWin;
-}
-
-void
-EnableMapUnmapEvents(WindowPtr pWin)
+static Bool
+MaybeDeliverMapRequest(WindowPtr pWin, WindowPtr pParent, ClientPtr client)
 {
-    assert(windowDisableMapUnmapEvents != NULL);
+    xEvent event = {
+        .u.mapRequest.window = pWin->drawable.id,
+        .u.mapRequest.parent = pParent->drawable.id
+    };
+    event.u.u.type = MapRequest;
 
-    windowDisableMapUnmapEvents = NULL;
+    return MaybeDeliverEventsToClient(pParent, &event, 1,
+                                      SubstructureRedirectMask,
+                                      client) == 1;
 }
 
-static Bool
-MapUnmapEventsEnabled(WindowPtr pWin)
+static void
+DeliverMapNotify(WindowPtr pWin)
 {
-    return pWin != windowDisableMapUnmapEvents;
+    xEvent event = {
+        .u.mapNotify.window = pWin->drawable.id,
+        .u.mapNotify.override = pWin->overrideRedirect,
+    };
+    event.u.u.type = MapNotify;
+    DeliverEvents(pWin, &event, 1, NullWindow);
 }
 
 /*****
@@ -2551,7 +2560,7 @@ MapWindow(WindowPtr pWin, ClientPtr client)
     if (pWin->mapped)
         return Success;
 
-    /*  general check for permission to map window */
+    /* general check for permission to map window */
     if (XaceHook(XACE_RESOURCE_ACCESS, client, pWin->drawable.id, RT_WINDOW,
                  pWin, RT_NONE, NULL, DixShowAccess) != Success)
         return Success;
@@ -2560,29 +2569,13 @@ MapWindow(WindowPtr pWin, ClientPtr client)
     if ((pParent = pWin->parent)) {
         Bool anyMarked;
 
-        if ((!pWin->overrideRedirect) && (RedirectSend(pParent)
-            )) {
-            xEvent event = {
-                .u.mapRequest.window = pWin->drawable.id,
-                .u.mapRequest.parent = pParent->drawable.id
-            };
-            event.u.u.type = MapRequest;
-
-            if (MaybeDeliverEventsToClient(pParent, &event, 1,
-                                           SubstructureRedirectMask,
-                                           client) == 1)
+        if ((!pWin->overrideRedirect) && (RedirectSend(pParent)))
+            if (MaybeDeliverMapRequest(pWin, pParent, client))
                 return Success;
-        }
 
         pWin->mapped = TRUE;
-        if (SubStrSend(pWin, pParent) && MapUnmapEventsEnabled(pWin)) {
-            xEvent event = {
-                .u.mapNotify.window = pWin->drawable.id,
-                .u.mapNotify.override = pWin->overrideRedirect,
-            };
-            event.u.u.type = MapNotify;
-            DeliverEvents(pWin, &event, 1, NullWindow);
-        }
+        if (SubStrSend(pWin, pParent))
+            DeliverMapNotify(pWin);
 
         if (!pParent->realized)
             return Success;
@@ -2644,28 +2637,13 @@ MapSubwindows(WindowPtr pParent, ClientPtr client)
     anyMarked = FALSE;
     for (pWin = pParent->firstChild; pWin; pWin = pWin->nextSib) {
         if (!pWin->mapped) {
-            if (parentRedirect && !pWin->overrideRedirect) {
-                xEvent event = {
-                    .u.mapRequest.window = pWin->drawable.id,
-                    .u.mapRequest.parent = pParent->drawable.id
-                };
-                event.u.u.type = MapRequest;
-
-                if (MaybeDeliverEventsToClient(pParent, &event, 1,
-                                               SubstructureRedirectMask,
-                                               client) == 1)
+            if (parentRedirect && !pWin->overrideRedirect)
+                if (MaybeDeliverMapRequest(pWin, pParent, client))
                     continue;
-            }
 
             pWin->mapped = TRUE;
-            if (parentNotify || StrSend(pWin)) {
-                xEvent event = {
-                    .u.mapNotify.window = pWin->drawable.id,
-                    .u.mapNotify.override = pWin->overrideRedirect
-                };
-                event.u.u.type = MapNotify;
-                DeliverEvents(pWin, &event, 1, NullWindow);
-            }
+            if (parentNotify || StrSend(pWin))
+                DeliverMapNotify(pWin);
 
             if (!pFirstMapped)
                 pFirstMapped = pWin;
@@ -2716,7 +2694,7 @@ UnrealizeTree(WindowPtr pWin, Bool fromConfigure)
 #ifdef PANORAMIX
             if (!noPanoramiXExtension && !pChild->drawable.pScreen->myNum) {
                 PanoramiXRes *win;
-                int rc = dixLookupResourceByType((pointer *) &win,
+                int rc = dixLookupResourceByType((void **) &win,
                                                  pChild->drawable.id,
                                                  XRT_WINDOW,
                                                  serverClient, DixWriteAccess);
@@ -2726,8 +2704,7 @@ UnrealizeTree(WindowPtr pWin, Bool fromConfigure)
             }
 #endif
             (*Unrealize) (pChild);
-            if (MapUnmapEventsEnabled(pWin))
-                DeleteWindowFromAnyEvents(pChild, FALSE);
+            DeleteWindowFromAnyEvents(pChild, FALSE);
             if (pChild->viewable) {
                 pChild->viewable = FALSE;
                 (*MarkUnrealizedWindow) (pChild, pWin, fromConfigure);
@@ -2746,6 +2723,17 @@ UnrealizeTree(WindowPtr pWin, Bool fromConfigure)
     }
 }
 
+static void
+DeliverUnmapNotify(WindowPtr pWin, Bool fromConfigure)
+{
+    xEvent event = {
+        .u.unmapNotify.window = pWin->drawable.id,
+        .u.unmapNotify.fromConfigure = fromConfigure
+    };
+    event.u.u.type = UnmapNotify;
+    DeliverEvents(pWin, &event, 1, NullWindow);
+}
+
 /*****
  * UnmapWindow
  *    If the window is already unmapped, this request has no effect.
@@ -2764,14 +2752,8 @@ UnmapWindow(WindowPtr pWin, Bool fromConfigure)
 
     if ((!pWin->mapped) || (!(pParent = pWin->parent)))
         return Success;
-    if (SubStrSend(pWin, pParent) && MapUnmapEventsEnabled(pWin)) {
-        xEvent event = {
-            .u.unmapNotify.window = pWin->drawable.id,
-            .u.unmapNotify.fromConfigure = fromConfigure
-        };
-        event.u.u.type = UnmapNotify;
-        DeliverEvents(pWin, &event, 1, NullWindow);
-    }
+    if (SubStrSend(pWin, pParent))
+        DeliverUnmapNotify(pWin, fromConfigure);
     if (wasViewable && !fromConfigure) {
         pWin->valdata = UnmapValData;
         (*pScreen->MarkOverlappedWindows) (pWin, pWin->nextSib, &pLayerWin);
@@ -2822,14 +2804,8 @@ UnmapSubwindows(WindowPtr pWin)
 
     for (pChild = pWin->lastChild; pChild != pHead; pChild = pChild->prevSib) {
         if (pChild->mapped) {
-            if (parentNotify || StrSend(pChild)) {
-                xEvent event = {
-                    .u.unmapNotify.window = pChild->drawable.id,
-                    .u.unmapNotify.fromConfigure = xFalse
-                };
-                event.u.u.type = UnmapNotify;
-                DeliverEvents(pChild, &event, 1, NullWindow);
-            }
+            if (parentNotify || StrSend(pChild))
+                DeliverUnmapNotify(pChild, xFalse);
             if (pChild->viewable) {
                 pChild->valdata = UnmapValData;
                 anyMarked = TRUE;
@@ -2881,11 +2857,9 @@ HandleSaveSet(ClientPtr client)
 
     for (j = 0; j < client->numSaved; j++) {
         pWin = SaveSetWindow(client->saveSet[j]);
-#ifdef XFIXES
         if (SaveSetToRoot(client->saveSet[j]))
             pParent = pWin->drawable.pScreen->root;
         else
-#endif
         {
             pParent = pWin->parent;
             while (pParent && (wClient(pParent) == client))
@@ -2893,11 +2867,9 @@ HandleSaveSet(ClientPtr client)
         }
         if (pParent) {
             if (pParent != pWin->parent) {
-#ifdef XFIXES
                 /* unmap first so that ReparentWindow doesn't remap */
                 if (!SaveSetShouldMap(client->saveSet[j]))
                     UnmapWindow(pWin, FALSE);
-#endif
                 ReparentWindow(pWin, pParent,
                                pWin->drawable.x - wBorderWidth(pWin) -
                                pParent->drawable.x,
@@ -2906,9 +2878,7 @@ HandleSaveSet(ClientPtr client)
                 if (!pWin->realized && pWin->mapped)
                     pWin->mapped = FALSE;
             }
-#ifdef XFIXES
             if (SaveSetShouldMap(client->saveSet[j]))
-#endif
                 MapWindow(pWin, client);
         }
     }
@@ -2956,8 +2926,6 @@ SendVisibilityNotify(WindowPtr pWin)
     xEvent event;
     unsigned int visibility = pWin->visibility;
 
-    if (!MapUnmapEventsEnabled(pWin))
-        return;
 #ifdef PANORAMIX
     /* This is not quite correct yet, but it's close */
     if (!noPanoramiXExtension) {
@@ -3131,7 +3099,7 @@ dixSaveScreens(ClientPtr client, int on, int mode)
             DeviceIntPtr dev;
             UpdateCurrentTimeIf();
             nt_list_for_each_entry(dev, inputInfo.devices, next)
-                lastDeviceEventTime[dev->id] = currentTime;
+                NoticeTime(dev, currentTime);
         }
         SetScreenSaverTimer();
     }
@@ -3205,7 +3173,7 @@ TileScreenSaver(ScreenPtr pScreen, int kind)
                                  &cursor, serverClient, (XID) 0);
         if (cursor) {
             cursorID = FakeClientID(0);
-            if (AddResource(cursorID, RT_CURSOR, (pointer) cursor)) {
+            if (AddResource(cursorID, RT_CURSOR, (void *) cursor)) {
                 attributes[attri] = cursorID;
                 mask |= CWCursor;
             }
@@ -3234,7 +3202,7 @@ TileScreenSaver(ScreenPtr pScreen, int kind)
         return FALSE;
 
     if (!AddResource(pWin->drawable.id, RT_WINDOW,
-                     (pointer) pScreen->screensaver.pWindow))
+                     (void *) pScreen->screensaver.pWindow))
         return FALSE;
 
     if (mask & CWBackPixmap) {
@@ -3356,8 +3324,7 @@ MakeWindowOptional(WindowPtr pWin)
     parentOptional = FindWindowWithOptional(pWin)->optional;
     optional->visual = parentOptional->visual;
     if (!pWin->cursorIsNone) {
-        optional->cursor = parentOptional->cursor;
-        optional->cursor->refcnt++;
+        optional->cursor = RefCursor(parentOptional->cursor);
     }
     else {
         optional->cursor = None;
@@ -3374,9 +3341,9 @@ MakeWindowOptional(WindowPtr pWin)
  * changing the window cursor (e.g. using XDefineCursor()) will not have any
  * visible effect. Only when one of the device cursors is set to None again,
  * this device's cursor will display the changed standard cursor.
- * 
+ *
  * CursorIsNone of the window struct is NOT modified if you set a device
- * cursor. 
+ * cursor.
  *
  * Assumption: If there is a node for a device in the list, the device has a
  * cursor. If the cursor is set to None, it is inherited by the parent.
@@ -3445,8 +3412,7 @@ ChangeWindowDeviceCursor(WindowPtr pWin, DeviceIntPtr pDev, CursorPtr pCursor)
     if (pCursor && WindowParentHasDeviceCursor(pWin, pDev, pCursor))
         pNode->cursor = None;
     else {
-        pNode->cursor = pCursor;
-        pCursor->refcnt++;
+        pNode->cursor = RefCursor(pCursor);
     }
 
     pNode = pPrev = NULL;
@@ -3454,8 +3420,7 @@ ChangeWindowDeviceCursor(WindowPtr pWin, DeviceIntPtr pDev, CursorPtr pCursor)
     for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib) {
         if (WindowSeekDeviceCursor(pChild, pDev, &pNode, &pPrev)) {
             if (pNode->cursor == None) {        /* inherited from parent */
-                pNode->cursor = pOldCursor;
-                pOldCursor->refcnt++;
+                pNode->cursor = RefCursor(pOldCursor);
             }
             else if (pNode->cursor == pCursor) {
                 pNode->cursor = None;
@@ -3465,13 +3430,15 @@ ChangeWindowDeviceCursor(WindowPtr pWin, DeviceIntPtr pDev, CursorPtr pCursor)
     }
 
  out:
+    CursorVisible = TRUE;
+
     if (pWin->realized)
         WindowHasNewCursor(pWin);
 
     if (pOldCursor)
         FreeCursor(pOldCursor, (Cursor) 0);
 
-    /* FIXME: We SHOULD check for an error value here XXX  
+    /* FIXME: We SHOULD check for an error value here XXX
        (comment taken from ChangeWindowAttributes) */
     (*pScreen->ChangeWindowAttributes) (pWin, CWCursor);
 
@@ -3538,7 +3505,7 @@ WindowSeekDeviceCursor(WindowPtr pWin,
 }
 
 /* Return True if a parent has the same device cursor set or False if
- * otherwise 
+ * otherwise
  */
 static Bool
 WindowParentHasDeviceCursor(WindowPtr pWin,
index eb33e27..4a90061 100644 (file)
@@ -35,7 +35,7 @@ The server will not build if your toolchain does not support these extensions.
     * interleaved code and declarations: { foo = TRUE; int bar; do_stuff(); }
 
 
-Use of OS and library facilities throughout the X server tree
+Use of library facilities throughout the X server tree
 -------------------------------------------------------------
 
 Non-OS-dependent code can assume facilities at least as good as
@@ -44,6 +44,17 @@ be C99, but even gcc+glibc doesn't implement that yet.
 
 Unix-like systems are assumed to be at least as good as UNIX03.
 
+Note that there are two Windows ports, Cygwin and MinGW:
+- Cygwin is more or less like Linux.
+- MinGW is more restrictive. Windows does not provide the required
+POSIX facilities, so some non-OS-dependent code is stubbed out or
+has an alternate implementation if WIN32 is defined.  Code that
+needs to be portable to Windows should be careful to, well, be portable.
+
+
+Required OS facilities
+-------------------------------------------------------------
+
 Linux systems must be at least 2.4 or later.  As a practical matter
 though, 2.4 kernels never receive any testing.  Use 2.6 already.
 
@@ -51,11 +62,7 @@ TODO: Solaris.
 
 TODO: *BSD.
 
-Code that needs to be portable to Windows should be careful to,
-well, be portable.  Note that there are two Windows ports, cygwin and
-mingw.  Cygwin is more or less like Linux, but mingw is a bit more
-restrictive.  TODO: document which versions of Windows we actually care
-about.
+Windows-dependent code assumes at least NT 5.1.
 
 OSX support is generally limited to the most recent version.  Currently
 that means 10.5.
diff --git a/dri3/Makefile.am b/dri3/Makefile.am
new file mode 100644 (file)
index 0000000..e47a734
--- /dev/null
@@ -0,0 +1,13 @@
+noinst_LTLIBRARIES = libdri3.la
+AM_CFLAGS = \
+       -DHAVE_XORG_CONFIG_H \
+       @DIX_CFLAGS@ @XORG_CFLAGS@
+
+libdri3_la_SOURCES = \
+       dri3.h \
+       dri3_priv.h \
+       dri3.c \
+       dri3_request.c \
+       dri3_screen.c
+
+sdk_HEADERS = dri3.h
diff --git a/dri3/dri3.c b/dri3/dri3.c
new file mode 100644 (file)
index 0000000..76e07b4
--- /dev/null
@@ -0,0 +1,92 @@
+/*
+ * Copyright Â© 2013 Keith Packard
+ *
+ * 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 the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  The copyright holders make no representations
+ * about the suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS 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_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "dri3_priv.h"
+
+int dri3_request;
+DevPrivateKeyRec dri3_screen_private_key;
+DevPrivateKeyRec dri3_window_private_key;
+
+static Bool
+dri3_close_screen(ScreenPtr screen)
+{
+    dri3_screen_priv_ptr screen_priv = dri3_screen_priv(screen);
+
+    unwrap(screen_priv, screen, CloseScreen);
+
+    free(screen_priv);
+    return (*screen->CloseScreen) (screen);
+}
+
+Bool
+dri3_screen_init(ScreenPtr screen, dri3_screen_info_ptr info)
+{
+    if (!dixRegisterPrivateKey(&dri3_screen_private_key, PRIVATE_SCREEN, 0))
+        return FALSE;
+
+    if (!dri3_screen_priv(screen)) {
+        dri3_screen_priv_ptr screen_priv = calloc(1, sizeof (dri3_screen_priv_rec));
+        if (!screen_priv)
+            return FALSE;
+
+        wrap(screen_priv, screen, CloseScreen, dri3_close_screen);
+
+        screen_priv->info = info;
+
+        dixSetPrivate(&screen->devPrivates, &dri3_screen_private_key, screen_priv);
+    }
+
+    return TRUE;
+}
+
+void
+dri3_extension_init(void)
+{
+    ExtensionEntry *extension;
+    int i;
+
+#ifdef PANORAMIX
+    if (!noPanoramiXExtension)
+        return;
+#endif
+
+    extension = AddExtension(DRI3_NAME, DRI3NumberEvents, DRI3NumberErrors,
+                             proc_dri3_dispatch, sproc_dri3_dispatch,
+                             NULL, StandardMinorOpcode);
+    if (!extension)
+        goto bail;
+
+    dri3_request = extension->base;
+
+    for (i = 0; i < screenInfo.numScreens; i++) {
+        if (!dri3_screen_init(screenInfo.screens[i], NULL))
+            goto bail;
+    }
+    return;
+
+bail:
+    FatalError("Cannot initialize DRI3 extension");
+}
diff --git a/dri3/dri3.h b/dri3/dri3.h
new file mode 100644 (file)
index 0000000..edc7fa2
--- /dev/null
@@ -0,0 +1,77 @@
+/*
+ * Copyright Â© 2013 Keith Packard
+ *
+ * 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 the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  The copyright holders make no representations
+ * about the suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS 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.
+ */
+
+#ifndef _DRI3_H_
+#define _DRI3_H_
+
+#include <xorg-server.h>
+
+#ifdef DRI3
+
+#include <X11/extensions/dri3proto.h>
+#include <randrstr.h>
+
+#define DRI3_SCREEN_INFO_VERSION        1
+
+typedef int (*dri3_open_proc)(ScreenPtr screen,
+                              RRProviderPtr provider,
+                              int *fd);
+
+typedef int (*dri3_open_client_proc)(ClientPtr client,
+                                     ScreenPtr screen,
+                                     RRProviderPtr provider,
+                                     int *fd);
+
+typedef PixmapPtr (*dri3_pixmap_from_fd_proc) (ScreenPtr screen,
+                                               int fd,
+                                               CARD16 width,
+                                               CARD16 height,
+                                               CARD16 stride,
+                                               CARD8 depth,
+                                               CARD8 bpp);
+
+typedef int (*dri3_fd_from_pixmap_proc) (ScreenPtr screen,
+                                         PixmapPtr pixmap,
+                                         CARD16 *stride,
+                                         CARD32 *size);
+
+typedef struct dri3_screen_info {
+    uint32_t                    version;
+
+    dri3_open_proc              open;
+    dri3_pixmap_from_fd_proc    pixmap_from_fd;
+    dri3_fd_from_pixmap_proc    fd_from_pixmap;
+
+    /* Version 1 */
+    dri3_open_client_proc       open_client;
+
+} dri3_screen_info_rec, *dri3_screen_info_ptr;
+
+extern _X_EXPORT Bool
+dri3_screen_init(ScreenPtr screen, dri3_screen_info_ptr info);
+
+extern _X_EXPORT int
+dri3_send_open_reply(ClientPtr client, int fd);
+
+#endif
+
+#endif /* _DRI3_H_ */
diff --git a/dri3/dri3_event.c b/dri3/dri3_event.c
new file mode 100644 (file)
index 0000000..cb509a2
--- /dev/null
@@ -0,0 +1,163 @@
+/*
+ * Copyright Â© 2013 Keith Packard
+ *
+ * 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 the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  The copyright holders make no representations
+ * about the suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS 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_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "dri3_priv.h"
+
+RESTYPE dri3_event_type;
+
+static int
+dri3_free_event(void *data, XID id)
+{
+    dri3_event_ptr dri3_event = (dri3_event_ptr) data;
+    dri3_window_priv_ptr window_priv = dri3_window_priv(dri3_event->window);
+    dri3_event_ptr *previous, current;
+
+    for (previous = &window_priv->events; (current = *previous); previous = &current->next) {
+        if (current == dri3_event) {
+            *previous = dri3_event->next;
+            break;
+        }
+    }
+    free((void *) dri3_event);
+    return 1;
+
+}
+
+void
+dri3_free_events(WindowPtr window)
+{
+    dri3_window_priv_ptr window_priv = dri3_window_priv(window);
+    dri3_event_ptr event;
+
+    if (!window_priv)
+        return;
+
+    while ((event = window_priv->events))
+        FreeResource(event->id, RT_NONE);
+}
+
+static void
+dri3_event_swap(xGenericEvent *from, xGenericEvent *to)
+{
+    *to = *from;
+    swaps(&to->sequenceNumber);
+    swapl(&to->length);
+    swaps(&to->evtype);
+    switch (from->evtype) {
+    case DRI3_ConfigureNotify: {
+        xDRI3ConfigureNotify *c = (xDRI3ConfigureNotify *) to;
+
+        swapl(&c->eid);
+        swapl(&c->window);
+        swaps(&c->x);
+        swaps(&c->y);
+        swaps(&c->width);
+        swaps(&c->height);
+        swaps(&c->off_x);
+        swaps(&c->off_y);
+        swaps(&c->pixmap_width);
+        swaps(&c->pixmap_height);
+        swapl(&c->pixmap_flags);
+        break;
+    }
+    }
+}
+
+void
+dri3_send_config_notify(WindowPtr window, int x, int y, int w, int h, int bw, WindowPtr sibling)
+{
+    dri3_window_priv_ptr window_priv = dri3_window_priv(window);
+
+    if (window_priv) {
+        xDRI3ConfigureNotify cn = {
+            .type = GenericEvent,
+            .extension = dri3_request,
+            .length = (sizeof(xDRI3ConfigureNotify) - 32) >> 2,
+            .evtype = DRI3_ConfigureNotify,
+            .eid = 0,
+            .window = window->drawable.id,
+            .x = x,
+            .y = y,
+            .width = w,
+            .height = h,
+            .off_x = 0,
+            .off_y = 0,
+            .pixmap_width = w,
+            .pixmap_height = h,
+            .pixmap_flags = 0
+        };
+        dri3_event_ptr event;
+        dri3_screen_priv_ptr screen_priv = dri3_screen_priv(window->drawable.pScreen);
+
+        if (screen_priv->info && screen_priv->info->driver_config)
+            screen_priv->info->driver_config(window, &cn);
+
+        for (event = window_priv->events; event; event = event->next) {
+            if (event->mask & (1 << DRI3ConfigureNotify)) {
+                cn.eid = event->id;
+                WriteEventsToClient(event->client, 1, (xEvent *) &cn);
+            }
+        }
+    }
+}
+
+int
+dri3_select_input(ClientPtr client, XID eid, WindowPtr window, CARD32 mask)
+{
+    dri3_window_priv_ptr window_priv = dri3_window_priv(window);
+    dri3_event_ptr event;
+
+    if (!window_priv)
+        return BadAlloc;
+
+    event = calloc (1, sizeof (dri3_event_rec));
+    if (!event)
+        return BadAlloc;
+
+    event->client = client;
+    event->window = window;
+    event->id = eid;
+    event->mask = mask;
+
+    event->next = window_priv->events;
+    window_priv->events = event;
+
+    if (!AddResource(event->id, dri3_event_type, (void *) event))
+        return BadAlloc;
+
+    return Success;
+}
+
+Bool
+dri3_event_init(void)
+{
+    dri3_event_type = CreateNewResourceType(dri3_free_event, "DRI3Event");
+    if (!dri3_event_type)
+        return FALSE;
+
+    GERegisterExtension(dri3_request, dri3_event_swap);
+    return TRUE;
+}
diff --git a/dri3/dri3_priv.h b/dri3/dri3_priv.h
new file mode 100644 (file)
index 0000000..e2fed83
--- /dev/null
@@ -0,0 +1,80 @@
+/*
+ * Copyright Â© 2013 Keith Packard
+ *
+ * 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 the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  The copyright holders make no representations
+ * about the suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS 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.
+ */
+
+#ifndef _DRI3PRIV_H_
+#define _DRI3PRIV_H_
+
+#include <X11/X.h>
+#include "scrnintstr.h"
+#include "misc.h"
+#include "list.h"
+#include "windowstr.h"
+#include "dixstruct.h"
+#include <randrstr.h>
+#include "dri3.h"
+
+extern int dri3_request;
+
+extern DevPrivateKeyRec dri3_screen_private_key;
+
+typedef struct dri3_screen_priv {
+    CloseScreenProcPtr          CloseScreen;
+    ConfigNotifyProcPtr         ConfigNotify;
+    DestroyWindowProcPtr        DestroyWindow;
+
+    dri3_screen_info_ptr        info;
+} dri3_screen_priv_rec, *dri3_screen_priv_ptr;
+
+#define wrap(priv,real,mem,func) {\
+    priv->mem = real->mem; \
+    real->mem = func; \
+}
+
+#define unwrap(priv,real,mem) {\
+    real->mem = priv->mem; \
+}
+
+static inline dri3_screen_priv_ptr
+dri3_screen_priv(ScreenPtr screen)
+{
+    return (dri3_screen_priv_ptr)dixLookupPrivate(&(screen)->devPrivates, &dri3_screen_private_key);
+}
+
+int
+proc_dri3_dispatch(ClientPtr client);
+
+int
+sproc_dri3_dispatch(ClientPtr client);
+
+/* DDX interface */
+
+int
+dri3_open(ClientPtr client, ScreenPtr screen, RRProviderPtr provider, int *fd);
+
+int
+dri3_pixmap_from_fd(PixmapPtr *ppixmap, ScreenPtr screen, int fd,
+                    CARD16 width, CARD16 height, CARD16 stride, CARD8 depth, CARD8 bpp);
+
+int
+dri3_fd_from_pixmap(int *pfd, PixmapPtr pixmap, CARD16 *stride, CARD32 *size);
+
+#endif /* _DRI3PRIV_H_ */
diff --git a/dri3/dri3_request.c b/dri3/dri3_request.c
new file mode 100644 (file)
index 0000000..fe45620
--- /dev/null
@@ -0,0 +1,405 @@
+/*
+ * Copyright Â© 2013 Keith Packard
+ *
+ * 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 the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  The copyright holders make no representations
+ * about the suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS 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_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "dri3_priv.h"
+#include <syncsrv.h>
+#include <unistd.h>
+#include <xace.h>
+#include "../Xext/syncsdk.h"
+#include <protocol-versions.h>
+
+static int
+proc_dri3_query_version(ClientPtr client)
+{
+    REQUEST(xDRI3QueryVersionReq);
+    xDRI3QueryVersionReply rep = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .majorVersion = SERVER_DRI3_MAJOR_VERSION,
+        .minorVersion = SERVER_DRI3_MINOR_VERSION
+    };
+
+    REQUEST_SIZE_MATCH(xDRI3QueryVersionReq);
+    (void) stuff;
+    if (client->swapped) {
+        swaps(&rep.sequenceNumber);
+        swapl(&rep.length);
+        swapl(&rep.majorVersion);
+        swapl(&rep.minorVersion);
+    }
+    WriteToClient(client, sizeof(rep), &rep);
+    return Success;
+}
+
+int
+dri3_send_open_reply(ClientPtr client, int fd)
+{
+    xDRI3OpenReply rep = {
+        .type = X_Reply,
+        .nfd = 1,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+    };
+
+    if (client->swapped) {
+        swaps(&rep.sequenceNumber);
+        swapl(&rep.length);
+    }
+
+    if (WriteFdToClient(client, fd, TRUE) < 0) {
+        close(fd);
+        return BadAlloc;
+    }
+
+    WriteToClient(client, sizeof (rep), &rep);
+
+    return Success;
+}
+
+static int
+proc_dri3_open(ClientPtr client)
+{
+    REQUEST(xDRI3OpenReq);
+    RRProviderPtr provider;
+    DrawablePtr drawable;
+    ScreenPtr screen;
+    int fd;
+    int status;
+
+    REQUEST_SIZE_MATCH(xDRI3OpenReq);
+
+    status = dixLookupDrawable(&drawable, stuff->drawable, client, 0, DixReadAccess);
+    if (status != Success)
+        return status;
+
+    if (stuff->provider == None)
+        provider = NULL;
+    else if (!RRProviderType) {
+        return BadMatch;
+    } else {
+        VERIFY_RR_PROVIDER(stuff->provider, provider, DixReadAccess);
+        if (drawable->pScreen != provider->pScreen)
+            return BadMatch;
+    }
+    screen = drawable->pScreen;
+
+    status = dri3_open(client, screen, provider, &fd);
+    if (status != Success)
+        return status;
+
+    if (client->ignoreCount == 0)
+        return dri3_send_open_reply(client, fd);
+
+    return Success;
+}
+
+static int
+proc_dri3_pixmap_from_buffer(ClientPtr client)
+{
+    REQUEST(xDRI3PixmapFromBufferReq);
+    int fd;
+    DrawablePtr drawable;
+    PixmapPtr pixmap;
+    int rc;
+
+    SetReqFds(client, 1);
+    REQUEST_SIZE_MATCH(xDRI3PixmapFromBufferReq);
+    LEGAL_NEW_RESOURCE(stuff->pixmap, client);
+    rc = dixLookupDrawable(&drawable, stuff->drawable, client, M_ANY, DixGetAttrAccess);
+    if (rc != Success) {
+        client->errorValue = stuff->drawable;
+        return rc;
+    }
+
+    if (!stuff->width || !stuff->height) {
+        client->errorValue = 0;
+        return BadValue;
+    }
+
+    if (stuff->width > 32767 || stuff->height > 32767)
+        return BadAlloc;
+
+    if (stuff->depth != 1) {
+        DepthPtr depth = drawable->pScreen->allowedDepths;
+        int i;
+        for (i = 0; i < drawable->pScreen->numDepths; i++, depth++)
+            if (depth->depth == stuff->depth)
+                break;
+        if (i == drawable->pScreen->numDepths) {
+            client->errorValue = stuff->depth;
+            return BadValue;
+        }
+    }
+
+    fd = ReadFdFromClient(client);
+    if (fd < 0)
+        return BadValue;
+
+    rc = dri3_pixmap_from_fd(&pixmap,
+                             drawable->pScreen, fd,
+                             stuff->width, stuff->height,
+                             stuff->stride, stuff->depth,
+                             stuff->bpp);
+    close (fd);
+    if (rc != Success)
+        return rc;
+
+    pixmap->drawable.id = stuff->pixmap;
+
+    /* security creation/labeling check */
+    rc = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pixmap, RT_PIXMAP,
+                  pixmap, RT_NONE, NULL, DixCreateAccess);
+
+    if (rc != Success) {
+        (*drawable->pScreen->DestroyPixmap) (pixmap);
+        return rc;
+    }
+    if (AddResource(stuff->pixmap, RT_PIXMAP, (void *) pixmap))
+        return Success;
+
+    return Success;
+}
+
+static int
+proc_dri3_buffer_from_pixmap(ClientPtr client)
+{
+    REQUEST(xDRI3BufferFromPixmapReq);
+    xDRI3BufferFromPixmapReply rep = {
+        .type = X_Reply,
+        .nfd = 1,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+    };
+    int rc;
+    int fd;
+    PixmapPtr pixmap;
+
+    REQUEST_SIZE_MATCH(xDRI3BufferFromPixmapReq);
+    rc = dixLookupResourceByType((void **) &pixmap, stuff->pixmap, RT_PIXMAP,
+                                 client, DixWriteAccess);
+    if (rc != Success) {
+        client->errorValue = stuff->pixmap;
+        return rc;
+    }
+
+    rep.width = pixmap->drawable.width;
+    rep.height = pixmap->drawable.height;
+    rep.depth = pixmap->drawable.depth;
+    rep.bpp = pixmap->drawable.bitsPerPixel;
+
+    rc = dri3_fd_from_pixmap(&fd, pixmap, &rep.stride, &rep.size);
+    if (rc != Success)
+        return rc;
+
+    if (client->swapped) {
+        swaps(&rep.sequenceNumber);
+        swapl(&rep.length);
+        swapl(&rep.size);
+        swaps(&rep.width);
+        swaps(&rep.height);
+        swaps(&rep.stride);
+    }
+    if (WriteFdToClient(client, fd, TRUE) < 0) {
+        close(fd);
+        return BadAlloc;
+    }
+
+    WriteToClient(client, sizeof(rep), &rep);
+
+    return client->noClientException;
+}
+
+static int
+proc_dri3_fence_from_fd(ClientPtr client)
+{
+    REQUEST(xDRI3FenceFromFDReq);
+    DrawablePtr drawable;
+    int fd;
+    int status;
+
+    SetReqFds(client, 1);
+    REQUEST_SIZE_MATCH(xDRI3FenceFromFDReq);
+    LEGAL_NEW_RESOURCE(stuff->fence, client);
+
+    status = dixLookupDrawable(&drawable, stuff->drawable, client, M_ANY, DixGetAttrAccess);
+    if (status != Success)
+        return status;
+
+    fd = ReadFdFromClient(client);
+    if (fd < 0)
+        return BadValue;
+
+    status = SyncCreateFenceFromFD(client, drawable, stuff->fence,
+                                   fd, stuff->initially_triggered);
+
+    return status;
+}
+
+static int
+proc_dri3_fd_from_fence(ClientPtr client)
+{
+    REQUEST(xDRI3FDFromFenceReq);
+    xDRI3FDFromFenceReply rep = {
+        .type = X_Reply,
+        .nfd = 1,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+    };
+    DrawablePtr drawable;
+    int fd;
+    int status;
+    SyncFence *fence;
+
+    REQUEST_SIZE_MATCH(xDRI3FDFromFenceReq);
+
+    status = dixLookupDrawable(&drawable, stuff->drawable, client, M_ANY, DixGetAttrAccess);
+    if (status != Success)
+        return status;
+    status = SyncVerifyFence(&fence, stuff->fence, client, DixWriteAccess);
+    if (status != Success)
+        return status;
+
+    fd = SyncFDFromFence(client, drawable, fence);
+    if (fd < 0)
+        return BadMatch;
+
+    if (client->swapped) {
+        swaps(&rep.sequenceNumber);
+        swapl(&rep.length);
+    }
+    if (WriteFdToClient(client, fd, FALSE) < 0)
+        return BadAlloc;
+
+    WriteToClient(client, sizeof(rep), &rep);
+
+    return client->noClientException;
+}
+
+int (*proc_dri3_vector[DRI3NumberRequests]) (ClientPtr) = {
+    proc_dri3_query_version,            /* 0 */
+    proc_dri3_open,                     /* 1 */
+    proc_dri3_pixmap_from_buffer,       /* 2 */
+    proc_dri3_buffer_from_pixmap,       /* 3 */
+    proc_dri3_fence_from_fd,            /* 4 */
+    proc_dri3_fd_from_fence,            /* 5 */
+};
+
+int
+proc_dri3_dispatch(ClientPtr client)
+{
+    REQUEST(xReq);
+    if (stuff->data >= DRI3NumberRequests || !proc_dri3_vector[stuff->data])
+        return BadRequest;
+    return (*proc_dri3_vector[stuff->data]) (client);
+}
+
+static int
+sproc_dri3_query_version(ClientPtr client)
+{
+    REQUEST(xDRI3QueryVersionReq);
+
+    swaps(&stuff->length);
+    swapl(&stuff->majorVersion);
+    swapl(&stuff->minorVersion);
+    return (*proc_dri3_vector[stuff->dri3ReqType]) (client);
+}
+
+static int
+sproc_dri3_open(ClientPtr client)
+{
+    REQUEST(xDRI3OpenReq);
+
+    swaps(&stuff->length);
+    swapl(&stuff->drawable);
+    swapl(&stuff->provider);
+    return (*proc_dri3_vector[stuff->dri3ReqType]) (client);
+}
+
+static int
+sproc_dri3_pixmap_from_buffer(ClientPtr client)
+{
+    REQUEST(xDRI3PixmapFromBufferReq);
+
+    swaps(&stuff->length);
+    swapl(&stuff->pixmap);
+    swapl(&stuff->drawable);
+    swapl(&stuff->size);
+    swaps(&stuff->width);
+    swaps(&stuff->height);
+    swaps(&stuff->stride);
+    return (*proc_dri3_vector[stuff->dri3ReqType]) (client);
+}
+
+static int
+sproc_dri3_buffer_from_pixmap(ClientPtr client)
+{
+    REQUEST(xDRI3BufferFromPixmapReq);
+
+    swaps(&stuff->length);
+    swapl(&stuff->pixmap);
+    return (*proc_dri3_vector[stuff->dri3ReqType]) (client);
+}
+
+static int
+sproc_dri3_fence_from_fd(ClientPtr client)
+{
+    REQUEST(xDRI3FenceFromFDReq);
+
+    swaps(&stuff->length);
+    swapl(&stuff->drawable);
+    swapl(&stuff->fence);
+    return (*proc_dri3_vector[stuff->dri3ReqType]) (client);
+}
+
+static int
+sproc_dri3_fd_from_fence(ClientPtr client)
+{
+    REQUEST(xDRI3FDFromFenceReq);
+
+    swaps(&stuff->length);
+    swapl(&stuff->drawable);
+    swapl(&stuff->fence);
+    return (*proc_dri3_vector[stuff->dri3ReqType]) (client);
+}
+
+int (*sproc_dri3_vector[DRI3NumberRequests]) (ClientPtr) = {
+    sproc_dri3_query_version,           /* 0 */
+    sproc_dri3_open,                    /* 1 */
+    sproc_dri3_pixmap_from_buffer,      /* 2 */
+    sproc_dri3_buffer_from_pixmap,      /* 3 */
+    sproc_dri3_fence_from_fd,           /* 4 */
+    sproc_dri3_fd_from_fence,           /* 5 */
+};
+
+int
+sproc_dri3_dispatch(ClientPtr client)
+{
+    REQUEST(xReq);
+    if (stuff->data >= DRI3NumberRequests || !sproc_dri3_vector[stuff->data])
+        return BadRequest;
+    return (*sproc_dri3_vector[stuff->data]) (client);
+}
diff --git a/dri3/dri3_screen.c b/dri3/dri3_screen.c
new file mode 100644 (file)
index 0000000..6c0c60c
--- /dev/null
@@ -0,0 +1,98 @@
+/*
+ * Copyright Â© 2013 Keith Packard
+ *
+ * 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 the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  The copyright holders make no representations
+ * about the suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS 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_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "dri3_priv.h"
+#include <syncsdk.h>
+#include <misync.h>
+#include <misyncshm.h>
+#include <randrstr.h>
+
+static inline Bool has_open(dri3_screen_info_ptr info) {
+    if (info == NULL)
+        return FALSE;
+
+    return info->open != NULL ||
+        (info->version >= 1 && info->open_client != NULL);
+}
+
+int
+dri3_open(ClientPtr client, ScreenPtr screen, RRProviderPtr provider, int *fd)
+{
+    dri3_screen_priv_ptr        ds = dri3_screen_priv(screen);
+    dri3_screen_info_ptr        info = ds->info;
+    int                         rc;
+
+    if (!has_open(info))
+        return BadMatch;
+
+    if (info->version >= 1 && info->open_client != NULL)
+        rc = (*info->open_client) (client, screen, provider, fd);
+    else
+        rc = (*info->open) (screen, provider, fd);
+
+    if (rc != Success)
+        return rc;
+
+    return Success;
+}
+
+int
+dri3_pixmap_from_fd(PixmapPtr *ppixmap, ScreenPtr screen, int fd,
+                    CARD16 width, CARD16 height, CARD16 stride, CARD8 depth, CARD8 bpp)
+{
+    dri3_screen_priv_ptr        ds = dri3_screen_priv(screen);
+    dri3_screen_info_ptr        info = ds->info;
+    PixmapPtr                   pixmap;
+
+    if (!info || !info->pixmap_from_fd)
+        return BadImplementation;
+
+    pixmap = (*info->pixmap_from_fd) (screen, fd, width, height, stride, depth, bpp);
+    if (!pixmap)
+        return BadAlloc;
+
+    *ppixmap = pixmap;
+    return Success;
+}
+
+int
+dri3_fd_from_pixmap(int *pfd, PixmapPtr pixmap, CARD16 *stride, CARD32 *size)
+{
+    ScreenPtr                   screen = pixmap->drawable.pScreen;
+    dri3_screen_priv_ptr        ds = dri3_screen_priv(screen);
+    dri3_screen_info_ptr        info = ds->info;
+    int                         fd;
+
+    if (!info || !info->fd_from_pixmap)
+        return BadImplementation;
+
+    fd = (*info->fd_from_pixmap)(screen, pixmap, stride, size);
+    if (fd < 0)
+        return BadAlloc;
+    *pfd = fd;
+    return Success;
+}
+
similarity index 66%
rename from mi/mibstore.c
rename to dri3/dri3int.h
index 6cadb2b..7f53eba 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Red Hat, Inc.
+ * Copyright Â© 2011 Daniel Stone
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
  * 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.
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-#include "scrnintstr.h"
-#include "mibstore.h"
-
-/*
- * There is no longer an mi implementation of backing store.  This function
- * is only for source compatibility with old drivers.
  *
- * Note though that you do get backing store for free if your server has
- * Composite enabled, since the automatic redirection mechanism provides
- * essentially the same functionality.  See compChangeWindowAttributes()
- * for the implementation.
+ * Author: Daniel Stone <daniel@fooishbar.org>
  */
 
-void
-miInitializeBackingStore(ScreenPtr pScreen)
-{
-}
+extern Bool DRI2ModuleSetup(void);
index 8b759cd..6a09966 100644 (file)
@@ -1,14 +1,10 @@
 noinst_LTLIBRARIES = libexa.la
 
-# Override these since EXA doesn't need them and the needed files aren't
-# built (in hw/xfree86/os-support/solaris) until after EXA is built
-SOLARIS_ASM_CFLAGS=""
-
 if XORG
 sdk_HEADERS = exa.h
 endif
 
-INCLUDES = \
+AM_CPPFLAGS = \
        $(XORG_INCS) \
        -I$(srcdir)/../miext/cw
 
index d12344f..a2995db 100644 (file)
--- a/exa/exa.c
+++ b/exa/exa.c
@@ -475,7 +475,7 @@ static void
  exaCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst);
 
 static void
- exaChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects);
+ exaChangeClip(GCPtr pGC, int type, void *pvalue, int nrects);
 
 static void
  exaCopyClip(GCPtr pGCDst, GCPtr pGCSrc);
@@ -579,7 +579,7 @@ exaCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst)
 }
 
 static void
-exaChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects)
+exaChangeClip(GCPtr pGC, int type, void *pvalue, int nrects)
 {
     ExaGCPriv(pGC);
     swap(pExaGC, pGC, funcs);
@@ -620,8 +620,8 @@ exaCreateGC(GCPtr pGC)
 
     swap(pExaScr, pScreen, CreateGC);
     if ((ret = (*pScreen->CreateGC) (pGC))) {
-        wrap(pExaGC, pGC, funcs, (GCFuncs *) & exaGCFuncs);
-        wrap(pExaGC, pGC, ops, (GCOps *) & exaOps);
+        wrap(pExaGC, pGC, funcs, &exaGCFuncs);
+        wrap(pExaGC, pGC, ops, &exaOps);
     }
     swap(pExaScr, pScreen, CreateGC);
 
@@ -702,8 +702,8 @@ exaCreateScreenResources(ScreenPtr pScreen)
 }
 
 static void
-ExaBlockHandler(ScreenPtr pScreen, pointer pTimeout,
-                pointer pReadmask)
+ExaBlockHandler(ScreenPtr pScreen, void *pTimeout,
+                void *pReadmask)
 {
     ExaScreenPriv(pScreen);
 
@@ -733,7 +733,7 @@ ExaBlockHandler(ScreenPtr pScreen, pointer pTimeout,
 
 static void
 ExaWakeupHandler(ScreenPtr pScreen, unsigned long result,
-                 pointer pReadmask)
+                 void *pReadmask)
 {
     ExaScreenPriv(pScreen);
 
index be022b2..98d094d 100644 (file)
--- a/exa/exa.h
+++ b/exa/exa.h
@@ -58,7 +58,7 @@ struct _ExaOffscreenArea {
     int offset;                 /* aligned offset */
     int size;                   /* total allocation size */
     unsigned last_use;
-    pointer privData;
+    void *privData;
 
     ExaOffscreenSaveProc save;
 
@@ -685,7 +685,7 @@ typedef struct _ExaDriver {
      */
     Bool (*ModifyPixmapHeader) (PixmapPtr pPixmap, int width, int height,
                                 int depth, int bitsPerPixel, int devKind,
-                                pointer pPixData);
+                                void *pPixData);
 
     /* hooks for drivers with tiling support:
      * driver MUST fill out new_fb_pitch with valid pitch of pixmap
@@ -784,7 +784,7 @@ extern _X_EXPORT ExaOffscreenArea *exaOffscreenAlloc(ScreenPtr pScreen,
                                                      int size, int align,
                                                      Bool locked,
                                                      ExaOffscreenSaveProc save,
-                                                     pointer privData);
+                                                     void *privData);
 
 extern _X_EXPORT ExaOffscreenArea *exaOffscreenFree(ScreenPtr pScreen,
                                                     ExaOffscreenArea * area);
index 0e948f4..9c742bd 100644 (file)
@@ -1039,7 +1039,6 @@ exaFillRegionSolid(DrawablePtr pDrawable, RegionPtr pRegion, Pixel pixel,
             pExaPixmap->sys_ptr && pDrawable->type == DRAWABLE_PIXMAP &&
             pDrawable->width == 1 && pDrawable->height == 1 &&
             pDrawable->bitsPerPixel != 24) {
-            ExaPixmapPriv(pPixmap);
             RegionPtr pending_damage = DamagePendingRegion(pExaPixmap->pDamage);
 
             switch (pDrawable->bitsPerPixel) {
index 1fa534b..a6a60e5 100644 (file)
@@ -147,7 +147,7 @@ exaCreatePixmap_classic(ScreenPtr pScreen, int w, int h, int depth,
 Bool
 exaModifyPixmapHeader_classic(PixmapPtr pPixmap, int width, int height,
                               int depth, int bitsPerPixel, int devKind,
-                              pointer pPixData)
+                              void *pPixData)
 {
     ScreenPtr pScreen;
     ExaScreenPrivPtr pExaScr;
@@ -192,7 +192,6 @@ exaModifyPixmapHeader_classic(PixmapPtr pPixmap, int width, int height,
          * gpu memory, so there's no need to track damage.
          */
         if (pExaPixmap->pDamage) {
-            DamageUnregister(&pPixmap->drawable, pExaPixmap->pDamage);
             DamageDestroy(pExaPixmap->pDamage);
             pExaPixmap->pDamage = NULL;
         }
index d467ca9..8799a79 100644 (file)
@@ -130,7 +130,7 @@ exaCreatePixmap_driver(ScreenPtr pScreen, int w, int h, int depth,
 Bool
 exaModifyPixmapHeader_driver(PixmapPtr pPixmap, int width, int height,
                              int depth, int bitsPerPixel, int devKind,
-                             pointer pPixData)
+                             void *pPixData)
 {
     ScreenPtr pScreen;
     ExaScreenPrivPtr pExaScr;
@@ -218,7 +218,7 @@ exaPixmapHasGpuCopy_driver(PixmapPtr pPixmap)
     ScreenPtr pScreen = pPixmap->drawable.pScreen;
 
     ExaScreenPriv(pScreen);
-    pointer saved_ptr;
+    void *saved_ptr;
     Bool ret;
 
     saved_ptr = pPixmap->devPrivate.ptr;
index 71f750f..aa71b21 100644 (file)
@@ -127,7 +127,7 @@ exaUnrealizeGlyphCaches(ScreenPtr pScreen, unsigned int format)
             continue;
 
         if (cache->picture) {
-            FreePicture((pointer) cache->picture, (XID) 0);
+            FreePicture((void *) cache->picture, (XID) 0);
             cache->picture = NULL;
         }
 
@@ -225,7 +225,7 @@ exaRealizeGlyphCaches(ScreenPtr pScreen, unsigned int format)
     }
 
     /* Each cache references the picture individually */
-    FreePicture((pointer) pPicture, (XID) 0);
+    FreePicture((void *) pPicture, (XID) 0);
     return TRUE;
 
  bail:
@@ -737,7 +737,7 @@ exaGlyphs(CARD8 op,
 
             /* The driver can't seem to composite to a8, let's try argb (but
              * without component-alpha) */
-            FreePicture((pointer) pMask, (XID) 0);
+            FreePicture((void *) pMask, (XID) 0);
 
             argbFormat = PictureMatchFormat(pScreen, 32, PICT_a8r8g8b8);
 
@@ -833,7 +833,7 @@ exaGlyphs(CARD8 op,
                          pDst,
                          xSrc + x - first_xOff,
                          ySrc + y - first_yOff, 0, 0, x, y, width, height);
-        FreePicture((pointer) pMask, (XID) 0);
+        FreePicture((void *) pMask, (XID) 0);
         (*pScreen->DestroyPixmap) (pMaskPixmap);
     }
 }
index e890f67..f712e19 100644 (file)
@@ -350,7 +350,7 @@ exaDoMoveInPixmap(ExaMigrationPtr migrate)
         pExaPixmap->area =
             exaOffscreenAlloc(pScreen, pExaPixmap->fb_size,
                               pExaScr->info->pixmapOffsetAlign, FALSE,
-                              exaPixmapSave, (pointer) pPixmap);
+                              exaPixmapSave, (void *) pPixmap);
         if (pExaPixmap->area == NULL)
             return;
 
@@ -465,12 +465,12 @@ exaMigrateTowardFb(ExaMigrationPtr migrate)
 
     if (pExaPixmap->score == EXA_PIXMAP_SCORE_PINNED) {
         DBG_MIGRATE(("UseScreen: not migrating pinned pixmap %p\n",
-                     (pointer) pPixmap));
+                     (void *) pPixmap));
         return;
     }
 
     DBG_MIGRATE(("UseScreen %p score %d\n",
-                 (pointer) pPixmap, pExaPixmap->score));
+                 (void *) pPixmap, pExaPixmap->score));
 
     if (pExaPixmap->score == EXA_PIXMAP_SCORE_INIT) {
         exaDoMoveInPixmap(migrate);
@@ -504,7 +504,7 @@ exaMigrateTowardSys(ExaMigrationPtr migrate)
 
     ExaPixmapPriv(pPixmap);
 
-    DBG_MIGRATE(("UseMem: %p score %d\n", (pointer) pPixmap,
+    DBG_MIGRATE(("UseMem: %p score %d\n", (void *) pPixmap,
                  pExaPixmap->score));
 
     if (pExaPixmap->score == EXA_PIXMAP_SCORE_PINNED)
index 445c4fc..cf66327 100644 (file)
@@ -190,7 +190,6 @@ exaPrepareAccessReg_mixed(PixmapPtr pPixmap, int index, RegionPtr pReg)
              * copy anymore. Drivers that prefer DFS, should fail prepare
              * access.
              */
-            DamageUnregister(&pPixmap->drawable, pExaPixmap->pDamage);
             DamageDestroy(pExaPixmap->pDamage);
             pExaPixmap->pDamage = NULL;
 
@@ -234,10 +233,13 @@ exaPrepareAccessReg_mixed(PixmapPtr pPixmap, int index, RegionPtr pReg)
                                                pPixmap->drawable.pScreen,
                                                pPixmap);
 
-            DamageRegister(&pPixmap->drawable, pExaPixmap->pDamage);
-            /* This ensures that pending damage reflects the current operation. */
-            /* This is used by exa to optimize migration. */
-            DamageSetReportAfterOp(pExaPixmap->pDamage, TRUE);
+            if (pExaPixmap->pDamage) {
+                DamageRegister(&pPixmap->drawable, pExaPixmap->pDamage);
+                /* This ensures that pending damage reflects the current
+                 * operation. This is used by exa to optimize migration.
+                 */
+                DamageSetReportAfterOp(pExaPixmap->pDamage, TRUE);
+            }
 
             if (has_gpu_copy) {
                 exaPixmapDirty(pPixmap, 0, 0, pPixmap->drawable.width,
index 0fb4091..f618a1e 100644 (file)
@@ -106,10 +106,13 @@ exaCreatePixmap_mixed(ScreenPtr pScreen, int w, int h, int depth,
                                                pPixmap->drawable.pScreen,
                                                pPixmap);
 
-            DamageRegister(&pPixmap->drawable, pExaPixmap->pDamage);
-            /* This ensures that pending damage reflects the current operation. */
-            /* This is used by exa to optimize migration. */
-            DamageSetReportAfterOp(pExaPixmap->pDamage, TRUE);
+            if (pExaPixmap->pDamage) {
+                DamageRegister(&pPixmap->drawable, pExaPixmap->pDamage);
+                /* This ensures that pending damage reflects the current
+                 * operation. This is used by exa to optimize migration.
+                 */
+                DamageSetReportAfterOp(pExaPixmap->pDamage, TRUE);
+            }
         }
     }
 
@@ -122,7 +125,7 @@ exaCreatePixmap_mixed(ScreenPtr pScreen, int w, int h, int depth,
 
 Bool
 exaModifyPixmapHeader_mixed(PixmapPtr pPixmap, int width, int height, int depth,
-                            int bitsPerPixel, int devKind, pointer pPixData)
+                            int bitsPerPixel, int devKind, void *pPixData)
 {
     ScreenPtr pScreen;
     ExaScreenPrivPtr pExaScr;
@@ -139,7 +142,6 @@ exaModifyPixmapHeader_mixed(PixmapPtr pPixmap, int width, int height, int depth,
     if (pPixData) {
         if (pExaPixmap->driverPriv) {
             if (pExaPixmap->pDamage) {
-                DamageUnregister(&pPixmap->drawable, pExaPixmap->pDamage);
                 DamageDestroy(pExaPixmap->pDamage);
                 pExaPixmap->pDamage = NULL;
             }
@@ -189,7 +191,6 @@ exaModifyPixmapHeader_mixed(PixmapPtr pPixmap, int width, int height, int depth,
             if (pExaPixmap->sys_ptr) {
                 free(pExaPixmap->sys_ptr);
                 pExaPixmap->sys_ptr = NULL;
-                DamageUnregister(&pPixmap->drawable, pExaPixmap->pDamage);
                 DamageDestroy(pExaPixmap->pDamage);
                 pExaPixmap->pDamage = NULL;
                 RegionEmpty(&pExaPixmap->validSys);
@@ -281,7 +282,7 @@ exaPixmapHasGpuCopy_mixed(PixmapPtr pPixmap)
 
     ExaScreenPriv(pScreen);
     ExaPixmapPriv(pPixmap);
-    pointer saved_ptr;
+    void *saved_ptr;
     Bool ret;
 
     if (!pExaPixmap->driverPriv)
index 1f571cf..e287348 100644 (file)
@@ -160,7 +160,7 @@ exaFindAreaToEvict(ExaScreenPrivPtr pExaScr, int size, int align)
  */
 ExaOffscreenArea *
 exaOffscreenAlloc(ScreenPtr pScreen, int size, int align,
-                  Bool locked, ExaOffscreenSaveProc save, pointer privData)
+                  Bool locked, ExaOffscreenSaveProc save, void *privData)
 {
     ExaOffscreenArea *area;
 
index ea7e7fa..61a1f4c 100644 (file)
@@ -41,7 +41,6 @@
 #include "pixmapstr.h"
 #include "windowstr.h"
 #include "servermd.h"
-#include "mibstore.h"
 #include "colormapst.h"
 #include "gcstruct.h"
 #include "input.h"
@@ -209,6 +208,7 @@ typedef struct {
     RegionRec srcReg;
     RegionRec maskReg;
     PixmapPtr srcPix;
+    PixmapPtr maskPix;
 
     DevPrivateKeyRec pixmapPrivateKeyRec;
     DevPrivateKeyRec gcPrivateKeyRec;
@@ -248,11 +248,19 @@ extern DevPrivateKeyRec exaScreenPrivateKeyRec;
     real->mem = priv->Saved##mem; \
 }
 
+#ifdef HAVE_TYPEOF
+#define swap(priv, real, mem) {\
+    typeof(real->mem) tmp = priv->Saved##mem; \
+    priv->Saved##mem = real->mem; \
+    real->mem = tmp; \
+}
+#else
 #define swap(priv, real, mem) {\
     void *tmp = priv->Saved##mem; \
     priv->Saved##mem = real->mem; \
     real->mem = tmp; \
 }
+#endif
 
 #define EXA_PRE_FALLBACK(_screen_) \
     ExaScreenPriv(_screen_); \
@@ -333,8 +341,8 @@ typedef struct {
 
 typedef struct {
     /* GC values from the layer below. */
-    GCOps *Savedops;
-    GCFuncs *Savedfuncs;
+    const GCOps *Savedops;
+    const GCFuncs *Savedfuncs;
 } ExaGCPrivRec, *ExaGCPrivPtr;
 
 typedef struct {
@@ -422,13 +430,13 @@ void
 
 ExaCheckImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
                       int x, int y, unsigned int nglyph,
-                      CharInfoPtr * ppci, pointer pglyphBase);
+                      CharInfoPtr * ppci, void *pglyphBase);
 
 void
 
 ExaCheckPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
                      int x, int y, unsigned int nglyph,
-                     CharInfoPtr * ppci, pointer pglyphBase);
+                     CharInfoPtr * ppci, void *pglyphBase);
 
 void
 
@@ -601,7 +609,7 @@ Bool
 
 exaModifyPixmapHeader_classic(PixmapPtr pPixmap, int width, int height,
                               int depth, int bitsPerPixel, int devKind,
-                              pointer pPixData);
+                              void *pPixData);
 
 Bool
  exaDestroyPixmap_classic(PixmapPtr pPixmap);
@@ -619,7 +627,7 @@ Bool
 
 exaModifyPixmapHeader_driver(PixmapPtr pPixmap, int width, int height,
                              int depth, int bitsPerPixel, int devKind,
-                             pointer pPixData);
+                             void *pPixData);
 
 Bool
  exaDestroyPixmap_driver(PixmapPtr pPixmap);
@@ -636,7 +644,7 @@ exaCreatePixmap_mixed(ScreenPtr pScreen, int w, int h, int depth,
 Bool
 
 exaModifyPixmapHeader_mixed(PixmapPtr pPixmap, int width, int height, int depth,
-                            int bitsPerPixel, int devKind, pointer pPixData);
+                            int bitsPerPixel, int devKind, void *pPixData);
 
 Bool
  exaDestroyPixmap_mixed(PixmapPtr pPixmap);
index 172e2b5..c4edf40 100644 (file)
@@ -915,7 +915,7 @@ exaComposite(CARD8 op,
             if (!pSrc->repeat && xSrc >= 0 && ySrc >= 0 &&
                 (xSrc + width <= pSrc->pDrawable->width) &&
                 (ySrc + height <= pSrc->pDrawable->height)) {
-                Bool ret;
+                Bool suc;
 
                 xDst += pDst->pDrawable->x;
                 yDst += pDst->pDrawable->y;
@@ -927,7 +927,7 @@ exaComposite(CARD8 op,
                                               yDst, width, height))
                     goto done;
 
-                ret = exaHWCopyNtoN(pSrc->pDrawable, pDst->pDrawable, NULL,
+                suc = exaHWCopyNtoN(pSrc->pDrawable, pDst->pDrawable, NULL,
                                     RegionRects(&region),
                                     RegionNumRects(&region), xSrc - xDst,
                                     ySrc - yDst, FALSE, FALSE);
@@ -939,7 +939,7 @@ exaComposite(CARD8 op,
                 xSrc -= pSrc->pDrawable->x;
                 ySrc -= pSrc->pDrawable->y;
 
-                if (!ret)
+                if (!suc)
                     goto fallback;
 
                 goto done;
index 5716138..b0c6344 100644 (file)
@@ -319,7 +319,7 @@ ExaCheckPolyFillRect(DrawablePtr pDrawable, GCPtr pGC,
 void
 ExaCheckImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
                       int x, int y, unsigned int nglyph,
-                      CharInfoPtr * ppci, pointer pglyphBase)
+                      CharInfoPtr * ppci, void *pglyphBase)
 {
     EXA_PRE_FALLBACK_GC(pGC);
     EXA_FALLBACK(("to %p (%c)\n", pDrawable, exaDrawableLocation(pDrawable)));
@@ -334,7 +334,7 @@ ExaCheckImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
 void
 ExaCheckPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
                      int x, int y, unsigned int nglyph,
-                     CharInfoPtr * ppci, pointer pglyphBase)
+                     CharInfoPtr * ppci, void *pglyphBase)
 {
     EXA_PRE_FALLBACK_GC(pGC);
     EXA_FALLBACK(("to %p (%c), style %d alu %d\n", pDrawable,
@@ -442,6 +442,13 @@ ExaSrcValidate(DrawablePtr pDrawable,
     RegionPtr dst;
     int xoff, yoff;
 
+    if (pExaScr->srcPix == pPix)
+        dst = &pExaScr->srcReg;
+    else if (pExaScr->maskPix == pPix)
+        dst = &pExaScr->maskReg;
+    else
+        return;
+
     exaGetDrawableDeltas(pDrawable, pPix, &xoff, &yoff);
 
     box.x1 = x + xoff;
@@ -449,8 +456,6 @@ ExaSrcValidate(DrawablePtr pDrawable,
     box.x2 = box.x1 + width;
     box.y2 = box.y1 + height;
 
-    dst = (pExaScr->srcPix == pPix) ? &pExaScr->srcReg : &pExaScr->maskReg;
-
     RegionInit(&reg, &box, 1);
     RegionUnion(dst, dst, &reg);
     RegionUninit(&reg);
@@ -495,16 +500,19 @@ ExaPrepareCompositeReg(ScreenPtr pScreen,
         if (pSrc != pDst)
             RegionTranslate(pSrc->pCompositeClip,
                             -pSrc->pDrawable->x, -pSrc->pDrawable->y);
-    }
+    } else
+        pExaScr->srcPix = NULL;
 
     if (pMask && pMask->pDrawable) {
         pMaskPix = exaGetDrawablePixmap(pMask->pDrawable);
         RegionNull(&pExaScr->maskReg);
         maskReg = &pExaScr->maskReg;
+        pExaScr->maskPix = pMaskPix;
         if (pMask != pDst && pMask != pSrc)
             RegionTranslate(pMask->pCompositeClip,
                             -pMask->pDrawable->x, -pMask->pDrawable->y);
-    }
+    } else
+        pExaScr->maskPix = NULL;
 
     RegionTranslate(pDst->pCompositeClip,
                     -pDst->pDrawable->x, -pDst->pDrawable->y);
@@ -677,7 +685,7 @@ ExaCheckAddTraps(PicturePtr pPicture,
 
     EXA_PRE_FALLBACK(pScreen);
 
-    EXA_FALLBACK(("to pict %p (%c)\n",
+    EXA_FALLBACK(("to pict %p (%c)\n", pPicture,
                   exaDrawableLocation(pPicture->pDrawable)));
     exaPrepareAccess(pPicture->pDrawable, EXA_PREPARE_DEST);
     swap(pExaScr, ps, AddTraps);
index 89f3bab..752eabe 100644 (file)
@@ -22,6 +22,7 @@ libfb_la_SOURCES =    \
        fbbits.h        \
        fbblt.c         \
        fbbltone.c      \
+       fbcmap_mi.c     \
        fbcopy.c        \
        fbfill.c        \
        fbfillrect.c    \
@@ -50,5 +51,3 @@ libfb_la_SOURCES =    \
        fbwindow.c
 
 libwfb_la_SOURCES = $(libfb_la_SOURCES)
-
-EXTRA_DIST = fbcmap_mi.c
diff --git a/fb/fb.h b/fb/fb.h
index 40a7e38..9057767 100644 (file)
--- a/fb/fb.h
+++ b/fb/fb.h
@@ -39,7 +39,6 @@
 #include "privates.h"
 #include "mi.h"
 #include "migc.h"
-#include "mibstore.h"
 #include "picturestr.h"
 
 #ifdef FB_ACCESS_WRAPPER
@@ -777,7 +776,7 @@ fb24_32ModifyPixmapHeader(PixmapPtr pPixmap,
                           int width,
                           int height,
                           int depth,
-                          int bitsPerPixel, int devKind, pointer pPixData);
+                          int bitsPerPixel, int devKind, void *pPixData);
 
 /*
  * fballpriv.c
@@ -1112,17 +1111,6 @@ fbInitVisuals(VisualPtr * visualp,
  * fbcopy.c
  */
 
-/* Compatibility definition, to be removed at next ABI change. */
-typedef void (*fbCopyProc) (DrawablePtr pSrcDrawable,
-                            DrawablePtr pDstDrawable,
-                            GCPtr pGC,
-                            BoxPtr pDstBox,
-                            int nbox,
-                            int dx,
-                            int dy,
-                            Bool reverse,
-                            Bool upsidedown, Pixel bitplane, void *closure);
-
 extern _X_EXPORT void
 
 fbCopyNtoN(DrawablePtr pSrcDrawable,
@@ -1134,29 +1122,6 @@ fbCopyNtoN(DrawablePtr pSrcDrawable,
            int dy,
            Bool reverse, Bool upsidedown, Pixel bitplane, void *closure);
 
-/* Compatibility wrapper, to be removed at next ABI change. */
-extern _X_EXPORT void
-
-fbCopyRegion(DrawablePtr pSrcDrawable,
-             DrawablePtr pDstDrawable,
-             GCPtr pGC,
-             RegionPtr pDstRegion,
-             int dx,
-             int dy, fbCopyProc copyProc, Pixel bitPlane, void *closure);
-
-/* Compatibility wrapper, to be removed at next ABI change. */
-extern _X_EXPORT RegionPtr
-
-fbDoCopy(DrawablePtr pSrcDrawable,
-         DrawablePtr pDstDrawable,
-         GCPtr pGC,
-         int xIn,
-         int yIn,
-         int widthSrc,
-         int heightSrc,
-         int xOut,
-         int yOut, fbCopyProc copyProc, Pixel bitplane, void *closure);
-
 extern _X_EXPORT void
 
 fbCopy1toN(DrawablePtr pSrcDrawable,
@@ -1264,7 +1229,7 @@ fbPolyGlyphBlt(DrawablePtr pDrawable,
                GCPtr pGC,
                int x,
                int y,
-               unsigned int nglyph, CharInfoPtr * ppci, pointer pglyphBase);
+               unsigned int nglyph, CharInfoPtr * ppci, void *pglyphBase);
 
 extern _X_EXPORT void
 
@@ -1272,7 +1237,7 @@ fbImageGlyphBlt(DrawablePtr pDrawable,
                 GCPtr pGC,
                 int x,
                 int y,
-                unsigned int nglyph, CharInfoPtr * ppci, pointer pglyphBase);
+                unsigned int nglyph, CharInfoPtr * ppci, void *pglyphBase);
 
 /*
  * fbimage.c
@@ -1345,6 +1310,9 @@ extern _X_EXPORT void
 extern _X_EXPORT Bool
  fbPictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats);
 
+extern _X_EXPORT void
+fbDestroyGlyphCache(void);
+
 /*
  * fbpixmap.c
  */
@@ -1441,7 +1409,7 @@ extern _X_EXPORT void
  _fbSetWindowPixmap(WindowPtr pWindow, PixmapPtr pPixmap);
 
 extern _X_EXPORT Bool
- fbSetupScreen(ScreenPtr pScreen, pointer pbits,        /* pointer to screen bitmap */
+ fbSetupScreen(ScreenPtr pScreen, void *pbits,        /* pointer to screen bitmap */
                int xsize,       /* in pixels */
                int ysize, int dpix,     /* dots per inch */
                int dpiy, int width,     /* pixel width of frame buffer */
@@ -1450,7 +1418,7 @@ extern _X_EXPORT Bool
 extern _X_EXPORT Bool
 
 wfbFinishScreenInit(ScreenPtr pScreen,
-                    pointer pbits,
+                    void *pbits,
                     int xsize,
                     int ysize,
                     int dpix,
@@ -1462,7 +1430,7 @@ wfbFinishScreenInit(ScreenPtr pScreen,
 extern _X_EXPORT Bool
 
 wfbScreenInit(ScreenPtr pScreen,
-              pointer pbits,
+              void *pbits,
               int xsize,
               int ysize,
               int dpix,
@@ -1474,14 +1442,14 @@ wfbScreenInit(ScreenPtr pScreen,
 extern _X_EXPORT Bool
 
 fbFinishScreenInit(ScreenPtr pScreen,
-                   pointer pbits,
+                   void *pbits,
                    int xsize,
                    int ysize, int dpix, int dpiy, int width, int bpp);
 
 extern _X_EXPORT Bool
 
 fbScreenInit(ScreenPtr pScreen,
-             pointer pbits,
+             void *pbits,
              int xsize, int ysize, int dpix, int dpiy, int width, int bpp);
 
 /*
index 5eb81e8..ecb3951 100644 (file)
@@ -495,7 +495,7 @@ fb24_32ReformatTile(PixmapPtr pOldTile, int bitsPerPixel)
 }
 
 typedef struct {
-    pointer pbits;
+    void *pbits;
     int width;
 } miScreenInitParmsRec, *miScreenInitParmsPtr;
 
@@ -526,7 +526,7 @@ fb24_32ModifyPixmapHeader(PixmapPtr pPixmap,
                           int width,
                           int height,
                           int depth,
-                          int bitsPerPixel, int devKind, pointer pPixData)
+                          int bitsPerPixel, int devKind, void *pPixData)
 {
     int bpp, w;
 
index 1bec00b..b357edf 100644 (file)
 Bool
 
 fb24_32FinishScreenInit(ScreenPtr pScreen,
-                        pointer pbits,
+                        void *pbits,
                         int xsize,
                         int ysize, int dpix, int dpiy, int width, int bpp);
 
 Bool
 
 fb24_32ScreenInit(ScreenPtr pScreen,
-                  pointer pbits,
+                  void *pbits,
                   int xsize, int ysize, int dpix, int dpiy, int width, int bpp);
 
 #endif
index 17bd698..c615106 100644 (file)
@@ -56,42 +56,48 @@ fbBlt(FbBits * srcLine,
     int n, nmiddle;
     Bool destInvarient;
     int startbyte, endbyte;
-    int careful;
 
     FbDeclareMergeRop();
 
+    if (alu == GXcopy && pm == FB_ALLONES &&
+        !(srcX & 7) && !(dstX & 7) && !(width & 7))
+    {
+        CARD8           *src_byte = (CARD8 *) srcLine + (srcX >> 3);
+        CARD8           *dst_byte = (CARD8 *) dstLine + (dstX >> 3);
+        FbStride        src_byte_stride = srcStride << (FB_SHIFT - 3);
+        FbStride        dst_byte_stride = dstStride << (FB_SHIFT - 3);
+        int             width_byte = (width >> 3);
+
+        /* Make sure there's no overlap; we can't use memcpy in that
+         * case as it's not well defined, so fall through to the
+         * general code
+         */
+        if (src_byte + width_byte <= dst_byte ||
+            dst_byte + width_byte <= src_byte)
+        {
+            int i;
+
+            if (!upsidedown)
+                for (i = 0; i < height; i++)
+                    MEMCPY_WRAPPED(dst_byte + i * dst_byte_stride,
+                                   src_byte + i * src_byte_stride,
+                                   width_byte);
+            else
+                for (i = height - 1; i >= 0; i--)
+                    MEMCPY_WRAPPED(dst_byte + i * dst_byte_stride,
+                                   src_byte + i * src_byte_stride,
+                                   width_byte);
+
+            return;
+        }
+    }
+
     if (bpp == 24 && !FbCheck24Pix(pm)) {
         fbBlt24(srcLine, srcStride, srcX, dstLine, dstStride, dstX,
                 width, height, alu, pm, reverse, upsidedown);
         return;
     }
 
-    careful = !((srcLine < dstLine && srcLine + width * (bpp >> 3) > dstLine) ||
-                (dstLine < srcLine && dstLine + width * (bpp >> 3) > srcLine))
-        || (bpp & 7);
-
-    if (alu == GXcopy && pm == FB_ALLONES && !careful &&
-        !(srcX & 7) && !(dstX & 7) && !(width & 7)) {
-        int i;
-        CARD8 *src = (CARD8 *) srcLine;
-        CARD8 *dst = (CARD8 *) dstLine;
-
-        srcStride *= sizeof(FbBits);
-        dstStride *= sizeof(FbBits);
-        width >>= 3;
-        src += (srcX >> 3);
-        dst += (dstX >> 3);
-
-        if (!upsidedown)
-            for (i = 0; i < height; i++)
-                MEMCPY_WRAPPED(dst + i * dstStride, src + i * srcStride, width);
-        else
-            for (i = height - 1; i >= 0; i--)
-                MEMCPY_WRAPPED(dst + i * dstStride, src + i * srcStride, width);
-
-        return;
-    }
-
     FbInitializeMergeRop(alu, pm);
     destInvarient = FbDestInvarientMergeRop();
     if (upsidedown) {
index eb7cf94..bfcb5a2 100644 (file)
@@ -739,12 +739,12 @@ fbBltPlane(FbBits * src,
 
     pm = fbReplicatePixel(planeMask, srcBpp);
     if (srcBpp == 24) {
-        int w = 24;
+        int tmpw = 24;
 
         rot0 = FbFirst24Rot(srcX);
-        if (srcX + w > FB_UNIT)
-            w = FB_UNIT - srcX;
-        srcMaskFirst = FbRot24(pm, rot0) & FbBitsMask(srcX, w);
+        if (srcX + tmpw > FB_UNIT)
+            tmpw = FB_UNIT - srcX;
+        srcMaskFirst = FbRot24(pm, rot0) & FbBitsMask(srcX, tmpw);
     }
     else {
         rot0 = 0;
index e9c252a..541ef71 100644 (file)
 
 #include "fb.h"
 
-/* Compatibility wrapper, to be removed at next ABI change. */
-void
-fbCopyRegion(DrawablePtr pSrcDrawable,
-             DrawablePtr pDstDrawable,
-             GCPtr pGC,
-             RegionPtr pDstRegion,
-             int dx, int dy, fbCopyProc copyProc, Pixel bitPlane, void *closure)
-{
-    miCopyRegion(pSrcDrawable, pDstDrawable, pGC, pDstRegion, dx, dy, copyProc,
-                 bitPlane, closure);
-}
-
-/* Compatibility wrapper, to be removed at next ABI change. */
-RegionPtr
-fbDoCopy(DrawablePtr pSrcDrawable,
-         DrawablePtr pDstDrawable,
-         GCPtr pGC,
-         int xIn,
-         int yIn,
-         int widthSrc,
-         int heightSrc,
-         int xOut, int yOut, fbCopyProc copyProc, Pixel bitPlane, void *closure)
-{
-    return miDoCopy(pSrcDrawable, pDstDrawable, pGC, xIn, yIn, widthSrc,
-                    heightSrc, xOut, yOut, copyProc, bitPlane, closure);
-}
-
 void
 fbCopyNtoN(DrawablePtr pSrcDrawable,
            DrawablePtr pDstDrawable,
index e6f8279..f4d7f3a 100644 (file)
--- a/fb/fbgc.c
+++ b/fb/fbgc.c
@@ -64,8 +64,8 @@ const GCOps fbGCOps = {
 Bool
 fbCreateGC(GCPtr pGC)
 {
-    pGC->ops = (GCOps *) & fbGCOps;
-    pGC->funcs = (GCFuncs *) & fbGCFuncs;
+    pGC->ops = (GCOps *) &fbGCOps;
+    pGC->funcs = (GCFuncs *) &fbGCFuncs;
 
     /* fb wants to translate before scan conversion */
     pGC->miTranslate = 1;
index 3080a77..4f2904c 100644 (file)
@@ -241,7 +241,7 @@ fbPolyGlyphBlt(DrawablePtr pDrawable,
                GCPtr pGC,
                int x,
                int y,
-               unsigned int nglyph, CharInfoPtr * ppci, pointer pglyphBase)
+               unsigned int nglyph, CharInfoPtr * ppci, void *pglyphBase)
 {
     FbGCPrivPtr pPriv = fbGetGCPrivate(pGC);
     CharInfoPtr pci;
@@ -309,7 +309,7 @@ fbImageGlyphBlt(DrawablePtr pDrawable,
                 GCPtr pGC,
                 int x,
                 int y,
-                unsigned int nglyph, CharInfoPtr * ppciInit, pointer pglyphBase)
+                unsigned int nglyph, CharInfoPtr * ppciInit, void *pglyphBase)
 {
     FbGCPrivPtr pPriv = fbGetGCPrivate(pGC);
     CharInfoPtr *ppci;
index c6802e4..935bf1b 100644 (file)
@@ -104,7 +104,7 @@ fbOverlayWindowLayer(WindowPtr pWin)
 
     for (i = 0; i < pScrPriv->nlayers; i++)
         if (dixLookupPrivate(&pWin->devPrivates, fbGetWinPrivateKey(pWin)) ==
-            (pointer) pScrPriv->layer[i].u.run.pixmap)
+            (void *) pScrPriv->layer[i].u.run.pixmap)
             return i;
     return 0;
 }
@@ -115,7 +115,7 @@ fbOverlayCreateScreenResources(ScreenPtr pScreen)
     int i;
     FbOverlayScrPrivPtr pScrPriv = fbOverlayGetScrPriv(pScreen);
     PixmapPtr pPixmap;
-    pointer pbits;
+    void *pbits;
     int width;
     int depth;
     BoxRec box;
@@ -250,8 +250,8 @@ fbOverlayWindowExposures(WindowPtr pWin,
 
 Bool
 fbOverlaySetupScreen(ScreenPtr pScreen,
-                     pointer pbits1,
-                     pointer pbits2,
+                     void *pbits1,
+                     void *pbits2,
                      int xsize,
                      int ysize,
                      int dpix,
@@ -287,8 +287,8 @@ fb24_32OverlayCreateScreenResources(ScreenPtr pScreen)
 
 Bool
 fbOverlayFinishScreenInit(ScreenPtr pScreen,
-                          pointer pbits1,
-                          pointer pbits2,
+                          void *pbits1,
+                          void *pbits2,
                           int xsize,
                           int ysize,
                           int dpix,
index 9a93457..57c9873 100644 (file)
@@ -38,7 +38,7 @@ typedef void (*fbOverlayPaintKeyProc) (DrawablePtr, RegionPtr, CARD32, int);
 typedef struct _fbOverlayLayer {
     union {
         struct {
-            pointer pbits;
+            void *pbits;
             int width;
             int depth;
         } init;
@@ -89,8 +89,8 @@ fbOverlayWindowExposures(WindowPtr pWin,
 extern _X_EXPORT Bool
 
 fbOverlaySetupScreen(ScreenPtr pScreen,
-                     pointer pbits1,
-                     pointer pbits2,
+                     void *pbits1,
+                     void *pbits2,
                      int xsize,
                      int ysize,
                      int dpix,
@@ -99,8 +99,8 @@ fbOverlaySetupScreen(ScreenPtr pScreen,
 extern _X_EXPORT Bool
 
 fbOverlayFinishScreenInit(ScreenPtr pScreen,
-                          pointer pbits1,
-                          pointer pbits2,
+                          void *pbits1,
+                          void *pbits2,
                           int xsize,
                           int ysize,
                           int dpix,
index 097a1a6..21baf89 100644 (file)
@@ -70,6 +70,152 @@ fbComposite(CARD8 op,
     free_pixman_pict(pDst, dest);
 }
 
+static pixman_glyph_cache_t *glyphCache;
+
+void
+fbDestroyGlyphCache(void)
+{
+    if (glyphCache)
+    {
+       pixman_glyph_cache_destroy (glyphCache);
+       glyphCache = NULL;
+    }
+}
+
+void
+fbUnrealizeGlyph(ScreenPtr pScreen,
+                GlyphPtr pGlyph)
+{
+    if (glyphCache)
+       pixman_glyph_cache_remove (glyphCache, pGlyph, NULL);
+}
+
+void
+fbGlyphs(CARD8 op,
+        PicturePtr pSrc,
+        PicturePtr pDst,
+        PictFormatPtr maskFormat,
+        INT16 xSrc,
+        INT16 ySrc, int nlist,
+        GlyphListPtr list,
+        GlyphPtr *glyphs)
+{
+#define N_STACK_GLYPHS 512
+    ScreenPtr pScreen = pDst->pDrawable->pScreen;
+    pixman_glyph_t stack_glyphs[N_STACK_GLYPHS];
+    pixman_glyph_t *pglyphs = stack_glyphs;
+    pixman_image_t *srcImage, *dstImage;
+    int srcXoff, srcYoff, dstXoff, dstYoff;
+    GlyphPtr glyph;
+    int n_glyphs;
+    int x, y;
+    int i, n;
+    int xDst = list->xOff, yDst = list->yOff;
+
+    miCompositeSourceValidate(pSrc);
+    
+    n_glyphs = 0;
+    for (i = 0; i < nlist; ++i)
+       n_glyphs += list[i].len;
+
+    if (!glyphCache)
+       glyphCache = pixman_glyph_cache_create();
+
+    pixman_glyph_cache_freeze (glyphCache);
+    
+    if (n_glyphs > N_STACK_GLYPHS) {
+       if (!(pglyphs = malloc (n_glyphs * sizeof (pixman_glyph_t))))
+           goto out;
+    }
+    
+    i = 0;
+    x = y = 0;
+    while (nlist--) {
+        x += list->xOff;
+        y += list->yOff;
+        n = list->len;
+        while (n--) {
+           const void *g;
+
+            glyph = *glyphs++;
+
+           if (!(g = pixman_glyph_cache_lookup (glyphCache, glyph, NULL))) {
+               pixman_image_t *glyphImage;
+               PicturePtr pPicture;
+               int xoff, yoff;
+
+               pPicture = GetGlyphPicture(glyph, pScreen);
+               if (!pPicture) {
+                   n_glyphs--;
+                   goto next;
+               }
+
+               if (!(glyphImage = image_from_pict(pPicture, FALSE, &xoff, &yoff)))
+                   goto out;
+
+               g = pixman_glyph_cache_insert(glyphCache, glyph, NULL,
+                                             glyph->info.x,
+                                             glyph->info.y,
+                                             glyphImage);
+
+               free_pixman_pict(pPicture, glyphImage);
+
+               if (!g)
+                   goto out;
+           }
+
+           pglyphs[i].x = x;
+           pglyphs[i].y = y;
+           pglyphs[i].glyph = g;
+           i++;
+
+       next:
+            x += glyph->info.xOff;
+            y += glyph->info.yOff;
+       }
+       list++;
+    }
+
+    if (!(srcImage = image_from_pict(pSrc, FALSE, &srcXoff, &srcYoff)))
+       goto out;
+
+    if (!(dstImage = image_from_pict(pDst, TRUE, &dstXoff, &dstYoff)))
+       goto out_free_src;
+
+    if (maskFormat) {
+       pixman_format_code_t format;
+       pixman_box32_t extents;
+
+       format = maskFormat->format | (maskFormat->depth << 24);
+
+       pixman_glyph_get_extents(glyphCache, n_glyphs, pglyphs, &extents);
+
+       pixman_composite_glyphs(op, srcImage, dstImage, format,
+                               xSrc + srcXoff + extents.x1 - xDst, ySrc + srcYoff + extents.y1 - yDst,
+                               extents.x1, extents.y1,
+                               extents.x1 + dstXoff, extents.y1 + dstYoff,
+                               extents.x2 - extents.x1,
+                               extents.y2 - extents.y1,
+                               glyphCache, n_glyphs, pglyphs);
+    }
+    else {
+       pixman_composite_glyphs_no_mask(op, srcImage, dstImage,
+                                       xSrc + srcXoff - xDst, ySrc + srcYoff - yDst,
+                                       dstXoff, dstYoff,
+                                       glyphCache, n_glyphs, pglyphs);
+    }
+
+    free_pixman_pict(pDst, dstImage);
+
+out_free_src:
+    free_pixman_pict(pSrc, srcImage);
+
+out:
+    pixman_glyph_cache_thaw(glyphCache);
+    if (pglyphs != stack_glyphs)
+       free(pglyphs);
+}
+
 static pixman_image_t *
 create_solid_fill_image(PicturePtr pict)
 {
@@ -357,7 +503,8 @@ fbPictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats)
         return FALSE;
     ps = GetPictureScreen(pScreen);
     ps->Composite = fbComposite;
-    ps->Glyphs = miGlyphs;
+    ps->Glyphs = fbGlyphs;
+    ps->UnrealizeGlyph = fbUnrealizeGlyph;
     ps->CompositeRects = miCompositeRects;
     ps->RasterizeTrapezoid = fbRasterizeTrapezoid;
     ps->Trapezoids = fbTrapezoids;
index 110f32d..8b0f59f 100644 (file)
@@ -65,11 +65,24 @@ fbTrapezoids(CARD8 op,
              INT16 xSrc, INT16 ySrc, int ntrap, xTrapezoid * traps);
 
 extern _X_EXPORT void
-
 fbTriangles(CARD8 op,
             PicturePtr pSrc,
             PicturePtr pDst,
             PictFormatPtr maskFormat,
             INT16 xSrc, INT16 ySrc, int ntris, xTriangle * tris);
 
+extern _X_EXPORT void
+fbUnrealizeGlyph(ScreenPtr pScreen,
+                GlyphPtr pGlyph);
+
+extern _X_EXPORT void
+fbGlyphs(CARD8 op,
+        PicturePtr pSrc,
+        PicturePtr pDst,
+        PictFormatPtr maskFormat,
+        INT16 xSrc,
+        INT16 ySrc, int nlist,
+        GlyphListPtr list,
+        GlyphPtr *glyphs);
+
 #endif                          /* _FBPICT_H_ */
index fbcdca9..677f28a 100644 (file)
@@ -66,7 +66,8 @@ fbCreatePixmapBpp(ScreenPtr pScreen, int width, int height, int depth, int bpp,
     pPixmap->drawable.height = height;
     pPixmap->devKind = paddedWidth;
     pPixmap->refcnt = 1;
-    pPixmap->devPrivate.ptr = (pointer) ((char *) pPixmap + base + adjust);
+    pPixmap->devPrivate.ptr = (void *) ((char *) pPixmap + base + adjust);
+    pPixmap->master_pixmap = NULL;
 
 #ifdef FB_DEBUG
     pPixmap->devPrivate.ptr =
index 7c7d656..0d4d87f 100644 (file)
@@ -32,11 +32,13 @@ fbCloseScreen(ScreenPtr pScreen)
     int d;
     DepthPtr depths = pScreen->allowedDepths;
 
+    fbDestroyGlyphCache();
     for (d = 0; d < pScreen->numDepths; d++)
         free(depths[d].vids);
     free(depths);
     free(pScreen->visuals);
-    free(pScreen->devPrivate);
+    if (pScreen->devPrivate)
+        FreePixmap((PixmapPtr)pScreen->devPrivate);
     return TRUE;
 }
 
@@ -89,7 +91,7 @@ _fbSetWindowPixmap(WindowPtr pWindow, PixmapPtr pPixmap)
 }
 
 Bool
-fbSetupScreen(ScreenPtr pScreen, pointer pbits, /* pointer to screen bitmap */
+fbSetupScreen(ScreenPtr pScreen, void *pbits, /* pointer to screen bitmap */
               int xsize,        /* in pixels */
               int ysize, int dpix,      /* dots per inch */
               int dpiy, int width,      /* pixel width of frame buffer */
@@ -134,7 +136,7 @@ fbSetupScreen(ScreenPtr pScreen, pointer pbits, /* pointer to screen bitmap */
 #ifdef FB_ACCESS_WRAPPER
 Bool
 wfbFinishScreenInit(ScreenPtr pScreen,
-                    pointer pbits,
+                    void *pbits,
                     int xsize,
                     int ysize,
                     int dpix,
@@ -145,7 +147,7 @@ wfbFinishScreenInit(ScreenPtr pScreen,
 #else
 Bool
 fbFinishScreenInit(ScreenPtr pScreen,
-                   pointer pbits,
+                   void *pbits,
                    int xsize, int ysize, int dpix, int dpiy, int width, int bpp)
 #endif
 {
@@ -223,7 +225,7 @@ fbFinishScreenInit(ScreenPtr pScreen,
 #ifdef FB_ACCESS_WRAPPER
 Bool
 wfbScreenInit(ScreenPtr pScreen,
-              pointer pbits,
+              void *pbits,
               int xsize,
               int ysize,
               int dpix,
@@ -241,7 +243,7 @@ wfbScreenInit(ScreenPtr pScreen,
 #else
 Bool
 fbScreenInit(ScreenPtr pScreen,
-             pointer pbits,
+             void *pbits,
              int xsize, int ysize, int dpix, int dpiy, int width, int bpp)
 {
     if (!fbSetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy, width, bpp))
index 588440c..54d00d0 100644 (file)
@@ -52,6 +52,7 @@
 #define fbCreatePixmap wfbCreatePixmap
 #define fbCreatePixmapBpp wfbCreatePixmapBpp
 #define fbCreateWindow wfbCreateWindow
+#define fbDestroyGlyphCache wfbDestroyGlyphCache
 #define fbDestroyPixmap wfbDestroyPixmap
 #define fbDestroyWindow wfbDestroyWindow
 #define fbDoCopy wfbDoCopy
index 0613b9b..20229a0 100644 (file)
@@ -1,6 +1,6 @@
 /**************************************************************************
 
-gesture/gesture.c\r
+gesture/gesture.c
 
 Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
 
@@ -27,114 +27,114 @@ 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.
 
-**************************************************************************/\r
-\r
-#ifdef HAVE_DIX_CONFIG_H\r
-#include <dix-config.h>\r
-#endif\r
-\r
-#include "misc.h"\r
-#include "dixstruct.h"\r
-#include "globals.h"\r
-#include "extnsionst.h"\r
-#include "windowstr.h"\r
-#include "servermd.h"\r
-#include "swaprep.h"\r
-#include <X11/extensions/gestureproto.h>\r
-#include "gestureext.h"\r
-#include "protocol-versions.h"\r
-#include "inputstr.h"\r
+**************************************************************************/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "misc.h"
+#include "dixstruct.h"
+#include "globals.h"
+#include "extnsionst.h"
+#include "windowstr.h"
+#include "servermd.h"
+#include "swaprep.h"
+#include <X11/extensions/gestureproto.h>
+#include "gestureext.h"
+#include "protocol-versions.h"
+#include "inputstr.h"
 #include "list.h"
-\r
-//#define __DEBUG_GESTURE_EXT__\r
-\r
-DevPrivateKeyRec gestureWindowPrivateKeyRec;\r
-#define gestureWindowPrivateKey (&gestureWindowPrivateKeyRec)\r
-\r
-static Mask grabbed_events_mask = 0;\r
-static int max_num_finger = 0;\r
-static GestureGrabEventRec grabbed_events[GestureNumberEvents];\r
-\r
+
+//#define __DEBUG_GESTURE_EXT__
+
+DevPrivateKeyRec gestureWindowPrivateKeyRec;
+#define gestureWindowPrivateKey (&gestureWindowPrivateKeyRec)
+
+static Mask grabbed_events_mask = 0;
+static int max_num_finger = 0;
+static GestureGrabEventRec grabbed_events[GestureNumberEvents];
+
 static Bool selected_win_exist = 0;
 static struct xorg_list selectedWinList;
 void (*gpGestureEventsGrabbed)(Mask *pGrabMask, GestureGrabEventPtr *pGrabEvent);
 void (*gpGestureEventsSelected)(Window win, Mask *pEventMask);
 
-extern CallbackListPtr ResourceStateCallback;\r
-\r
-static unsigned char GestureReqCode = 0;\r
-static int GestureEventBase = 0;\r
-static int GestureErrorBase;\r
-\r
-static GestureProcsPtr GestureProcs;\r
-static GestureProcsRec GestureExtProcs = {\r
-};\r
-\r
-static DISPATCH_PROC(ProcGestureDispatch);\r
-static DISPATCH_PROC(ProcGestureQueryVersion);\r
-static DISPATCH_PROC(ProcGestureSelectEvents);\r
-static DISPATCH_PROC(ProcGestureGetSelectedEvents);\r
-static DISPATCH_PROC(ProcGestureGrabEvent);\r
-static DISPATCH_PROC(ProcGestureUngrabEvent);\r
-static DISPATCH_PROC(SProcGestureDispatch);\r
-static DISPATCH_PROC(SProcGestureQueryVersion);\r
-static DISPATCH_PROC(SProcGestureSelectEvents);\r
-static DISPATCH_PROC(SProcGestureGetSelectedEvents);\r
-static DISPATCH_PROC(SProcGestureGrabEvent);\r
-static DISPATCH_PROC(SProcGestureUngrabEvent);\r
-\r
-//event swap functions\r
-static void SGestureNotifyGroupEvent(xGestureNotifyGroupEvent *from, xGestureNotifyGroupEvent *to);\r
-static void SGestureNotifyFlickEvent(xGestureNotifyFlickEvent *from, xGestureNotifyFlickEvent *to);\r
-static void SGestureNotifyPanEvent(xGestureNotifyPanEvent *from, xGestureNotifyPanEvent *to);\r
-static void SGestureNotifyPinchRotationEvent(xGestureNotifyPinchRotationEvent *from, xGestureNotifyPinchRotationEvent *to);\r
-static void SGestureNotifyTapEvent(xGestureNotifyTapEvent *from, xGestureNotifyTapEvent *to);\r
-static void SGestureNotifyTapNHoldEvent(xGestureNotifyTapNHoldEvent *from, xGestureNotifyTapNHoldEvent *to);\r
-static void SGestureNotifyHoldEvent(xGestureNotifyHoldEvent *from, xGestureNotifyHoldEvent *to);\r
-static void SGestureNotifyEvent(xEvent * from, xEvent * to);\r
-\r
+extern CallbackListPtr ResourceStateCallback;
+
+static unsigned char GestureReqCode = 0;
+static int GestureEventBase = 0;
+static int GestureErrorBase;
+
+static GestureProcsPtr GestureProcs;
+static GestureProcsRec GestureExtProcs = {
+};
+
+static DISPATCH_PROC(ProcGestureDispatch);
+static DISPATCH_PROC(ProcGestureQueryVersion);
+static DISPATCH_PROC(ProcGestureSelectEvents);
+static DISPATCH_PROC(ProcGestureGetSelectedEvents);
+static DISPATCH_PROC(ProcGestureGrabEvent);
+static DISPATCH_PROC(ProcGestureUngrabEvent);
+static DISPATCH_PROC(SProcGestureDispatch);
+static DISPATCH_PROC(SProcGestureQueryVersion);
+static DISPATCH_PROC(SProcGestureSelectEvents);
+static DISPATCH_PROC(SProcGestureGetSelectedEvents);
+static DISPATCH_PROC(SProcGestureGrabEvent);
+static DISPATCH_PROC(SProcGestureUngrabEvent);
+
+//event swap functions
+static void SGestureNotifyGroupEvent(xGestureNotifyGroupEvent *from, xGestureNotifyGroupEvent *to);
+static void SGestureNotifyFlickEvent(xGestureNotifyFlickEvent *from, xGestureNotifyFlickEvent *to);
+static void SGestureNotifyPanEvent(xGestureNotifyPanEvent *from, xGestureNotifyPanEvent *to);
+static void SGestureNotifyPinchRotationEvent(xGestureNotifyPinchRotationEvent *from, xGestureNotifyPinchRotationEvent *to);
+static void SGestureNotifyTapEvent(xGestureNotifyTapEvent *from, xGestureNotifyTapEvent *to);
+static void SGestureNotifyTapNHoldEvent(xGestureNotifyTapNHoldEvent *from, xGestureNotifyTapNHoldEvent *to);
+static void SGestureNotifyHoldEvent(xGestureNotifyHoldEvent *from, xGestureNotifyHoldEvent *to);
+static void SGestureNotifyEvent(xEvent * from, xEvent * to);
+
 static winInfo *GestureAddWindowToList(Window win, struct xorg_list *winlst);
 static int GestureRemoveWindowFromList(Window win, struct xorg_list *winlst);
-\r
-void GestureExtInit(void)\r
-{\r
-    GestureExtensionInit();\r
-}\r
-\r
-Bool\r
-GestureExtensionInit(void)\r
-{\r
-    ExtensionEntry* extEntry;\r
-\r
-    if (extEntry = AddExtension(GESTURE_EXT_NAME,\r
-                                 GestureNumberEvents,\r
-                                 GestureNumberErrors,\r
-                                 ProcGestureDispatch,\r
-                                 SProcGestureDispatch,\r
-                                 NULL,\r
-                                 StandardMinorOpcode))\r
-    {\r
-        GestureReqCode = (unsigned char)extEntry->base;\r
-        GestureErrorBase = extEntry->errorBase;\r
-        GestureEventBase = extEntry->eventBase;\r
-        EventSwapVector[GestureEventBase] = (EventSwapPtr) SGestureNotifyEvent;\r
-\r
-        if (!dixRegisterPrivateKey(&gestureWindowPrivateKeyRec, PRIVATE_WINDOW, 0))\r
-        {\r
-               ErrorF("[X11][GestureExtensionInit] Failed to register private key object !\n");\r
-               return FALSE;\r
-        }\r
-\r
-       memset(grabbed_events, 0, sizeof(GestureGrabEventRec)*GestureNumberEvents);\r
+
+void GestureExtInit(void)
+{
+    GestureExtensionInit();
+}
+
+Bool
+GestureExtensionInit(void)
+{
+    ExtensionEntry* extEntry;
+
+    if (extEntry = AddExtension(GESTURE_EXT_NAME,
+                                 GestureNumberEvents,
+                                 GestureNumberErrors,
+                                 ProcGestureDispatch,
+                                 SProcGestureDispatch,
+                                 NULL,
+                                 StandardMinorOpcode))
+    {
+        GestureReqCode = (unsigned char)extEntry->base;
+        GestureErrorBase = extEntry->errorBase;
+        GestureEventBase = extEntry->eventBase;
+        EventSwapVector[GestureEventBase] = (EventSwapPtr) SGestureNotifyEvent;
+
+        if (!dixRegisterPrivateKey(&gestureWindowPrivateKeyRec, PRIVATE_WINDOW, 0))
+        {
+               ErrorF("[X11][GestureExtensionInit] Failed to register private key object !\n");
+               return FALSE;
+        }
+
+       memset(grabbed_events, 0, sizeof(GestureGrabEventRec)*GestureNumberEvents);
        gpGestureEventsGrabbed = gpGestureEventsSelected = NULL;
        xorg_list_init(&selectedWinList);
 
-       return TRUE;\r
-    }\r
-\r
-    return FALSE;\r
-}\r
-\r
+       return TRUE;
+    }
+
+    return FALSE;
+}
+
 Bool
 GestureRegisterCallbacks(void (*GestureEventsGrabbed)(Mask *pGrabMask, GestureGrabEventPtr *pGrabEvent),
        void (*GestureEventsSelected)(Window win, Mask *pEventMask))
@@ -204,131 +204,131 @@ GestureRemoveWindowFromList(Window win, struct xorg_list *winlst)
        return 0;
 }
 
-/*\r
- * functions for gesture driver\r
- */ \r
-Bool GestureSetMaxNumberOfFingers(int num_finger)\r
-{\r
-       int i;\r
-\r
-       if( max_num_finger )\r
-               return TRUE;\r
-\r
-       max_num_finger = num_finger + 1;\r
-#ifdef __DEBUG_GESTURE_EXT__\r
-       ErrorF("[X11][GestureSetMaxNumberOfFingers] num_finger=%d, max_num_finger=%d\n", num_finger, max_num_finger);\r
-#endif//__DEBUG_GESTURE_EXT__\r
-\r
-       for( i = 0 ;  i < GestureNumberEvents ;  i++ )\r
-       {\r
-               grabbed_events[i].pGestureGrabWinInfo = malloc(sizeof(GestureGrabWinInfoRec)*max_num_finger);\r
-               if( !grabbed_events[i].pGestureGrabWinInfo )\r
-               {\r
-                       ErrorF("[X11][GestureSetMaxNumberOfFingers] Failed to allocate memory for grabbed_events[%d].pGestureGrabWinInfo !\n", i);\r
-                       return FALSE;\r
-               }\r
-               memset(grabbed_events[i].pGestureGrabWinInfo, 0, sizeof(GestureGrabWinInfoRec)*max_num_finger);\r
-       }\r
-\r
-       return TRUE;\r
-}\r
-\r
-Bool GestureUnsetMaxNumberOfFingers(void)\r
-{\r
-       int i;\r
-\r
-\r
-       for( i = 0 ;  i < GestureNumberEvents ;  i++ )\r
-       {\r
-               if( grabbed_events[i].pGestureGrabWinInfo )\r
-               {\r
-                       free(grabbed_events[i].pGestureGrabWinInfo);\r
-               }\r
-       }\r
-       max_num_finger = 0;\r
-\r
-#ifdef __DEBUG_GESTURE_EXT__\r
-       ErrorF("[X11][GestureUnsetMaxNumberOfFingers] max_num_finger=%d\n", max_num_finger);\r
-#endif//__DEBUG_GESTURE_EXT__\r
-\r
-       return TRUE;\r
-}\r
-\r
-Bool GestureHasGrabbedEvents(Mask *pGrabMask, GestureGrabEventPtr *pGrabEvent)\r
-{\r
-       int i, j;\r
-\r
-       if( !pGrabEvent || !pGrabMask )\r
-       {\r
-               ErrorF("[X11][GestureHasGrabbedEvents] pGrabEvent or pGrabMask is NULL !\n");\r
-               return FALSE;\r
-       }\r
-\r
-       *pGrabMask = grabbed_events_mask;\r
-       *pGrabEvent = grabbed_events;\r
-\r
-       if( !grabbed_events_mask )\r
-       {\r
-#ifdef __DEBUG_GESTURE_EXT__\r
-               ErrorF("[X11][GestureHasGrabbedEvents] grabbed_events_mask is zero !\n");\r
-#endif//__DEBUG_GESTURE_EXT__\r
-               return FALSE;\r
-       }\r
-#ifdef __DEBUG_GESTURE_EXT__\r
-       else\r
-       {\r
-               ErrorF("[X11][GestureHasGrabbedEvents] grabbed_events_mask=0x%x\n", *pGrabMask);\r
-       }\r
-#endif//__DEBUG_GESTURE_EXT__\r
-\r
-       return TRUE;\r
-}\r
-\r
-Bool GestureHasSelectedEvents(WindowPtr pWin, Mask *pEventMask)\r
-{\r
-       int rc;\r
-       GestureWindowPrivatePtr pPriv;\r
-\r
-       if( !pWin || !pEventMask )\r
-       {\r
-               ErrorF("[X11][GestureHasSelectedEvents] pWin or pEventMask is NULL !\n");\r
-               return FALSE;\r
-       }\r
-\r
-       pPriv = dixLookupPrivate(&pWin->devPrivates, gestureWindowPrivateKey);\r
-\r
-        if( !pPriv )\r
-       {\r
-#ifdef __DEBUG_GESTURE_EXT__\r
-               ErrorF("[X11][GestureHasSelectedEvents] no mask exist on window(0x%x)\n", pWin->drawable.id);\r
-#endif//__DEBUG_GESTURE_EXT__\r
-               *pEventMask = 0;\r
-               return FALSE;\r
-       }\r
-\r
-#ifdef __DEBUG_GESTURE_EXT__\r
-       ErrorF("[X11][GestureHasSelectedEvents] mask=0x%x on window(0x%x)\n", pPriv->mask, pWin->drawable.id);\r
-#endif//__DEBUG_GESTURE_EXT__\r
-\r
-       *pEventMask = pPriv->mask;\r
-\r
-       return TRUE;\r
-}\r
-\r
-/*\r
-  * Hooking functions for tracing destroy of grab window(s)\r
-  */\r
-static void GestureResourceStateCallback(CallbackListPtr *pcbl, pointer closure, pointer calldata)\r
-{\r
-       int i, j, none_win_count;\r
-       GestureWindowPrivatePtr pPriv;\r
-       ResourceStateInfoRec *rec = calldata;\r
-       WindowPtr pWin = (WindowPtr)rec->value;\r
-\r
-       if (rec->type != RT_WINDOW)\r
-               return;\r
-       if (rec->state != ResourceStateFreeing)\r
-               return;\r
+/*
+ * functions for gesture driver
+ */
+Bool GestureSetMaxNumberOfFingers(int num_finger)
+{
+       int i;
+
+       if( max_num_finger )
+               return TRUE;
+
+       max_num_finger = num_finger + 1;
+#ifdef __DEBUG_GESTURE_EXT__
+       ErrorF("[X11][GestureSetMaxNumberOfFingers] num_finger=%d, max_num_finger=%d\n", num_finger, max_num_finger);
+#endif//__DEBUG_GESTURE_EXT__
+
+       for( i = 0 ;  i < GestureNumberEvents ;  i++ )
+       {
+               grabbed_events[i].pGestureGrabWinInfo = malloc(sizeof(GestureGrabWinInfoRec)*max_num_finger);
+               if( !grabbed_events[i].pGestureGrabWinInfo )
+               {
+                       ErrorF("[X11][GestureSetMaxNumberOfFingers] Failed to allocate memory for grabbed_events[%d].pGestureGrabWinInfo !\n", i);
+                       return FALSE;
+               }
+               memset(grabbed_events[i].pGestureGrabWinInfo, 0, sizeof(GestureGrabWinInfoRec)*max_num_finger);
+       }
+
+       return TRUE;
+}
+
+Bool GestureUnsetMaxNumberOfFingers(void)
+{
+       int i;
+
+
+       for( i = 0 ;  i < GestureNumberEvents ;  i++ )
+       {
+               if( grabbed_events[i].pGestureGrabWinInfo )
+               {
+                       free(grabbed_events[i].pGestureGrabWinInfo);
+               }
+       }
+       max_num_finger = 0;
+
+#ifdef __DEBUG_GESTURE_EXT__
+       ErrorF("[X11][GestureUnsetMaxNumberOfFingers] max_num_finger=%d\n", max_num_finger);
+#endif//__DEBUG_GESTURE_EXT__
+
+       return TRUE;
+}
+
+Bool GestureHasGrabbedEvents(Mask *pGrabMask, GestureGrabEventPtr *pGrabEvent)
+{
+       int i, j;
+
+       if( !pGrabEvent || !pGrabMask )
+       {
+               ErrorF("[X11][GestureHasGrabbedEvents] pGrabEvent or pGrabMask is NULL !\n");
+               return FALSE;
+       }
+
+       *pGrabMask = grabbed_events_mask;
+       *pGrabEvent = grabbed_events;
+
+       if( !grabbed_events_mask )
+       {
+#ifdef __DEBUG_GESTURE_EXT__
+               ErrorF("[X11][GestureHasGrabbedEvents] grabbed_events_mask is zero !\n");
+#endif//__DEBUG_GESTURE_EXT__
+               return FALSE;
+       }
+#ifdef __DEBUG_GESTURE_EXT__
+       else
+       {
+               ErrorF("[X11][GestureHasGrabbedEvents] grabbed_events_mask=0x%x\n", *pGrabMask);
+       }
+#endif//__DEBUG_GESTURE_EXT__
+
+       return TRUE;
+}
+
+Bool GestureHasSelectedEvents(WindowPtr pWin, Mask *pEventMask)
+{
+       int rc;
+       GestureWindowPrivatePtr pPriv;
+
+       if( !pWin || !pEventMask )
+       {
+               ErrorF("[X11][GestureHasSelectedEvents] pWin or pEventMask is NULL !\n");
+               return FALSE;
+       }
+
+       pPriv = dixLookupPrivate(&pWin->devPrivates, gestureWindowPrivateKey);
+
+        if( !pPriv )
+       {
+#ifdef __DEBUG_GESTURE_EXT__
+               ErrorF("[X11][GestureHasSelectedEvents] no mask exist on window(0x%x)\n", pWin->drawable.id);
+#endif//__DEBUG_GESTURE_EXT__
+               *pEventMask = 0;
+               return FALSE;
+       }
+
+#ifdef __DEBUG_GESTURE_EXT__
+       ErrorF("[X11][GestureHasSelectedEvents] mask=0x%x on window(0x%x)\n", pPriv->mask, pWin->drawable.id);
+#endif//__DEBUG_GESTURE_EXT__
+
+       *pEventMask = pPriv->mask;
+
+       return TRUE;
+}
+
+/*
+  * Hooking functions for tracing destroy of grab window(s)
+  */
+static void GestureResourceStateCallback(CallbackListPtr *pcbl, void *closure, void *calldata)
+{
+       int i, j, none_win_count;
+       GestureWindowPrivatePtr pPriv;
+       ResourceStateInfoRec *rec = calldata;
+       WindowPtr pWin = (WindowPtr)rec->value;
+
+       if (rec->type != RT_WINDOW)
+               return;
+       if (rec->state != ResourceStateFreeing)
+               return;
 
        if(selected_win_exist && gpGestureEventsSelected)
        {
@@ -339,424 +339,424 @@ static void GestureResourceStateCallback(CallbackListPtr *pcbl, pointer closure,
                        gpGestureEventsSelected(None, NULL);
        }
 
-       if( !grabbed_events_mask )\r
-               return;\r
-\r
+       if( !grabbed_events_mask )
+               return;
+
        Mask prev_grabbed_events_mask = grabbed_events_mask;
 
-#ifdef __DEBUG_GESTURE_EXT__\r
-       ErrorF("[X11][GestureResourceStateCallback] rec->id=0x%x, pWin->drawable.id=0x%x\n", rec->id, pWin->drawable.id);\r
-       ErrorF("[X11][GestureResourceStateCallback][start] grabbed_events_mask=0x%x\n", grabbed_events_mask);\r
-#endif//__DEBUG_GESTURE_EXT__\r
-\r
-       for( i = 0 ; i < GestureNumberEvents ; i++ )\r
-       {\r
-               none_win_count = 0;\r
-               for( j = 0 ; j < max_num_finger ; j++ )\r
-               {\r
-                       if( grabbed_events[i].pGestureGrabWinInfo[j].window == pWin->drawable.id )\r
-                       {\r
-#ifdef __DEBUG_GESTURE_EXT__\r
-               ErrorF("[X11][GestureResourceStateCallback][1.5] i=%d, j=%d\n", i, j);\r
-#endif//__DEBUG_GESTURE_EXT__\r
-                               grabbed_events[i].pGestureGrabWinInfo[j].window = None;\r
-                               grabbed_events[i].pGestureGrabWinInfo[j].pWin = NULL;\r
-                       }\r
-\r
-                       if( None == grabbed_events[i].pGestureGrabWinInfo[j].window )\r
-                       {\r
-                               none_win_count++;\r
-                       }\r
-               }\r
-\r
-               if( none_win_count == max_num_finger )\r
-               {\r
-#ifdef __DEBUG_GESTURE_EXT__\r
-                       ErrorF("[X11][GestureResourceStateCallback][before] grabbed_events_mask=0x%x\n", grabbed_events_mask);\r
-#endif//__DEBUG_GESTURE_EXT__\r
-                       grabbed_events_mask = grabbed_events_mask & ~(1 << i);\r
-#ifdef __DEBUG_GESTURE_EXT__\r
-                       ErrorF("[X11][GestureResourceStateCallback][after] grabbed_events_mask=0x%x\n", grabbed_events_mask);\r
-#endif//__DEBUG_GESTURE_EXT__\r
-               }               \r
-       }\r
+#ifdef __DEBUG_GESTURE_EXT__
+       ErrorF("[X11][GestureResourceStateCallback] rec->id=0x%x, pWin->drawable.id=0x%x\n", rec->id, pWin->drawable.id);
+       ErrorF("[X11][GestureResourceStateCallback][start] grabbed_events_mask=0x%x\n", grabbed_events_mask);
+#endif//__DEBUG_GESTURE_EXT__
+
+       for( i = 0 ; i < GestureNumberEvents ; i++ )
+       {
+               none_win_count = 0;
+               for( j = 0 ; j < max_num_finger ; j++ )
+               {
+                       if( grabbed_events[i].pGestureGrabWinInfo[j].window == pWin->drawable.id )
+                       {
+#ifdef __DEBUG_GESTURE_EXT__
+               ErrorF("[X11][GestureResourceStateCallback][1.5] i=%d, j=%d\n", i, j);
+#endif//__DEBUG_GESTURE_EXT__
+                               grabbed_events[i].pGestureGrabWinInfo[j].window = None;
+                               grabbed_events[i].pGestureGrabWinInfo[j].pWin = NULL;
+                       }
+
+                       if( None == grabbed_events[i].pGestureGrabWinInfo[j].window )
+                       {
+                               none_win_count++;
+                       }
+               }
+
+               if( none_win_count == max_num_finger )
+               {
+#ifdef __DEBUG_GESTURE_EXT__
+                       ErrorF("[X11][GestureResourceStateCallback][before] grabbed_events_mask=0x%x\n", grabbed_events_mask);
+#endif//__DEBUG_GESTURE_EXT__
+                       grabbed_events_mask = grabbed_events_mask & ~(1 << i);
+#ifdef __DEBUG_GESTURE_EXT__
+                       ErrorF("[X11][GestureResourceStateCallback][after] grabbed_events_mask=0x%x\n", grabbed_events_mask);
+#endif//__DEBUG_GESTURE_EXT__
+               }
+       }
 
        if((grabbed_events_mask != prev_grabbed_events_mask) && gpGestureEventsGrabbed)
     {
         gpGestureEventsGrabbed(&grabbed_events_mask, &grabbed_events);
     }
-\r
-#ifdef __DEBUG_GESTURE_EXT__\r
-       ErrorF("[X11][GestureResourceStateCallback][end] grabbed_events_mask=0x%x\n", grabbed_events_mask);\r
-#endif//__DEBUG_GESTURE_EXT__\r
-\r
-       return;\r
-}\r
-\r
-Bool\r
-GestureInstallResourceStateHooks(void)\r
-{\r
-       Bool res = TRUE;\r
-\r
-       res = AddCallback(&ResourceStateCallback, GestureResourceStateCallback, NULL);\r
-\r
-       if(!res)\r
-       {\r
-               ErrorF("[X11][GestureInstallResourceStateHooks] Failed to register one or more callbacks ! (res=%d)\n", res);\r
-               return FALSE;\r
-       }\r
-\r
-#ifdef __DEBUG_GESTURE_EXT__\r
-       ErrorF("[X11][GestureInstallResourceStateHooks] AddCallback result = %d\n", res);\r
-#endif//__DEBUG_GESTURE_EXT__\r
-       return TRUE;\r
-}\r
-\r
-Bool\r
-GestureUninstallResourceStateHooks(void)\r
-{\r
-       Bool res;\r
-\r
-       res = DeleteCallback(&ResourceStateCallback, GestureResourceStateCallback, NULL);\r
-\r
-#ifdef __DEBUG_GESTURE_EXT__\r
-       ErrorF("[X11][GestureUninstallResourceStateHooks] DeleteCallback result = %d\n", res);\r
-#endif//__DEBUG_GESTURE_EXT__\r
-       return res;\r
-}\r
-\r
-/*\r
- * deliver the event\r
- */\r
-void\r
-GestureSendEvent (WindowPtr pWin, int type, unsigned int mask, xGestureCommonEvent *gce)\r
-{\r
-    int rc;\r
-    Mask access_mode = 0;\r
-    GestureWindowPrivatePtr pPriv;\r
-    WindowPtr pTmp = NULL;\r
-\r
-    if( NULL == pWin )\r
-    {\r
-       access_mode |= DixReceiveAccess;\r
-       rc = dixLookupWindow(&pWin, gce->any.window, serverClient, access_mode);\r
-       if( rc != Success || !pWin )\r
-       {\r
-               ErrorF("[X11][GestureSendEvent] Failed to lookup window !\n");\r
-               return;\r
-       }\r
-\r
-       pPriv = dixLookupPrivate(&pWin->devPrivates, gestureWindowPrivateKey);\r
-\r
-       if( !pPriv )\r
-       {\r
-#ifdef __DEBUG_GESTURE_EXT__\r
-               ErrorF("[X11][GestureSendEvent] no mask exist on win(0x%x)\n", pWin->drawable.id);\r
-#endif//__DEBUG_GESTURE_EXT__\r
-               return;\r
-       }\r
-\r
-#ifdef __DEBUG_GESTURE_EXT__\r
-       ErrorF("[X11][GestureSendEvent] type=%d, mask=%d\n", type, mask);\r
-#endif//__DEBUG_GESTURE_EXT__\r
-\r
-       if( !(pPriv->mask & mask) )\r
-       {\r
-#ifdef __DEBUG_GESTURE_EXT__\r
-               ErrorF("[X11][GestureSendEvent] selected window doesn't have valid event mask ! (pPriv->mask=0x%x, mask=0x%x)\n", pPriv->mask, mask);\r
-#endif//__DEBUG_GESTURE_EXT__       \r
-               return;\r
-       }\r
-    }\r
-\r
-    gce->any.type = type + GestureEventBase;\r
-    gce->any.time = currentTime.milliseconds;\r
-    WriteEventsToClient(wClient(pWin), 1, (xEvent *) gce);\r
-#ifdef __DEBUG_GESTURE_EXT__\r
-    ErrorF("[X11][GestureSendEvent] Send gesture event(type:%x) to win(0x%x)\n", type, pWin->drawable.id);\r
-#endif//__DEBUG_GESTURE_EXT__\r
-}\r
-\r
-static void\r
-SGestureNotifyGroupEvent(xGestureNotifyGroupEvent *from, xGestureNotifyGroupEvent *to)\r
-{\r
-       to->type = from->type;\r
-       to->kind = from->kind;\r
-       cpswaps(from->sequenceNumber, to->sequenceNumber);\r
-       cpswapl(from->window, to->window);\r
-       cpswapl(from->time, to->time);\r
-       to->groupid = from->groupid;\r
-       to->num_group = from->num_group;\r
-       /* pad1 */\r
-       /* pad2 */\r
-       /* pad3 */\r
-       /* pad4 */\r
-       /* pad5 */\r
-}\r
-\r
-static void\r
-SGestureNotifyFlickEvent(xGestureNotifyFlickEvent *from, xGestureNotifyFlickEvent *to)\r
-{\r
-       to->type = from->type;\r
-       to->kind = from->kind;\r
-       cpswaps(from->sequenceNumber, to->sequenceNumber);\r
-       cpswapl(from->window, to->window);\r
-       cpswapl(from->time, to->time);\r
-       to->num_finger = from->num_finger;\r
-       to->direction = from->direction;\r
-       cpswaps(from->distance, to->distance);\r
-       cpswapl(from->duration, to->duration);\r
-       cpswapl(from->angle, to->angle);\r
-       /* pad1 */\r
-       /* pad2 */\r
-}\r
-\r
-static void\r
-SGestureNotifyPanEvent(xGestureNotifyPanEvent *from, xGestureNotifyPanEvent *to)\r
-{\r
-       to->type = from->type;\r
-       to->kind = from->kind;\r
-       cpswaps(from->sequenceNumber, to->sequenceNumber);\r
-       cpswapl(from->window, to->window);\r
-       cpswapl(from->time, to->time);\r
-       to->num_finger = from->num_finger;\r
-       to->direction = from->direction;\r
-       cpswaps(from->distance, to->distance);\r
-       cpswapl(from->duration, to->duration);\r
-       cpswaps(from->dx, to->dx);\r
-       cpswaps(from->dy, to->dy);\r
-       /* pad1 */\r
-       /* pad2 */\r
-}\r
-\r
-static void\r
-SGestureNotifyPinchRotationEvent(xGestureNotifyPinchRotationEvent *from, xGestureNotifyPinchRotationEvent *to)\r
-{\r
-       to->type = from->type;\r
-       to->kind = from->kind;\r
-       cpswaps(from->sequenceNumber, to->sequenceNumber);\r
-       cpswapl(from->window, to->window);\r
-       cpswapl(from->time, to->time);\r
-       to->num_finger = from->num_finger;\r
-       /* pad1 */\r
-       cpswaps(from->distance, to->distance);\r
-       cpswaps(from->cx, to->cx);\r
-       cpswaps(from->cy, to->cy);\r
-       cpswapl(from->zoom, to->zoom);\r
-       cpswapl(from->angle, to->angle);\r
-       /* pad2 */\r
-}\r
-\r
-static void\r
-SGestureNotifyTapEvent(xGestureNotifyTapEvent *from, xGestureNotifyTapEvent *to)\r
-{\r
-       to->type = from->type;\r
-       to->kind = from->kind;\r
-       cpswaps(from->sequenceNumber, to->sequenceNumber);\r
-       cpswapl(from->window, to->window);\r
-       cpswapl(from->time, to->time);\r
-       to->num_finger = from->num_finger;\r
-       /* pad1 */\r
-       cpswaps(from->cx, to->cx);\r
-       cpswaps(from->cy, to->cy);\r
-       to->tap_repeat = from->tap_repeat;\r
-       /* pad2 */\r
-       cpswapl(from->interval, to->interval);\r
-       /* pad3 */\r
-       /* pad4 */\r
-}\r
-\r
-static void\r
-SGestureNotifyTapNHoldEvent(xGestureNotifyTapNHoldEvent *from, xGestureNotifyTapNHoldEvent *to)\r
-{\r
-       to->type = from->type;\r
-       to->kind = from->kind;\r
-       cpswaps(from->sequenceNumber, to->sequenceNumber);\r
-       cpswapl(from->window, to->window);\r
-       cpswapl(from->time, to->time);\r
-       to->num_finger = from->num_finger;\r
-       /* pad1 */\r
-       cpswaps(from->cx, to->cx);\r
-       cpswaps(from->cy, to->cy);\r
-       /* pad2 */\r
-       cpswapl(from->interval, to->interval);\r
-       cpswapl(from->holdtime, to->holdtime);\r
-       /* pad3 */\r
-}\r
-\r
-static void\r
-SGestureNotifyHoldEvent(xGestureNotifyHoldEvent *from, xGestureNotifyHoldEvent *to)\r
-{\r
-       to->type = from->type;\r
-       to->kind = from->kind;\r
-       cpswaps(from->sequenceNumber, to->sequenceNumber);\r
-       cpswapl(from->window, to->window);\r
-       cpswapl(from->time, to->time);\r
-       to->num_finger = from->num_finger;\r
-       /* pad1 */\r
-       cpswaps(from->cx, to->cx);\r
-       cpswaps(from->cy, to->cy);\r
-       /* pad2 */\r
-       cpswapl(from->holdtime, to->holdtime);\r
-       /* pad3 */\r
-       /* pad4 */\r
-}\r
-\r
-static void\r
-SGestureNotifyEvent(xEvent * from, xEvent * to)\r
-{\r
-    switch (from->u.u.detail) {\r
-       case GestureNotifyGroup:\r
-               SGestureNotifyGroupEvent((xGestureNotifyGroupEvent *)from,\r
-                       (xGestureNotifyGroupEvent *)to);\r
-               break;\r
-       case GestureNotifyFlick:\r
-               SGestureNotifyFlickEvent((xGestureNotifyFlickEvent *)from,\r
-                       (xGestureNotifyFlickEvent *)to);\r
-               break;\r
-       case GestureNotifyPan:\r
-               SGestureNotifyPanEvent((xGestureNotifyPanEvent *)from,\r
-                       (xGestureNotifyPanEvent *)to);\r
-               break;\r
-       case GestureNotifyPinchRotation:\r
-               SGestureNotifyPinchRotationEvent((xGestureNotifyPinchRotationEvent *)from,\r
-                       (xGestureNotifyPinchRotationEvent *)to);\r
-               break;\r
-       case GestureNotifyTap:\r
-               SGestureNotifyTapEvent((xGestureNotifyTapEvent *)from,\r
-                       (xGestureNotifyTapEvent *)to);\r
-               break;\r
-       case GestureNotifyTapNHold:\r
-               SGestureNotifyTapNHoldEvent((xGestureNotifyTapNHoldEvent *)from,\r
-                       (xGestureNotifyTapNHoldEvent *)to);\r
-               break;\r
-       case GestureNotifyHold:\r
-               SGestureNotifyHoldEvent((xGestureNotifyHoldEvent *)from,\r
-                       (xGestureNotifyHoldEvent *)to);\r
-               break;\r
-    }\r
-#ifdef __DEBUG_GESTURE_EXT__\r
-    ErrorF("[X11][SGestureNotifyEvent] ...\n");\r
-#endif//__DEBUG_GESTURE_EXT__\r
-}\r
-\r
-static int\r
-ProcGestureQueryVersion(register ClientPtr client)\r
-{\r
-    xGestureQueryVersionReply rep;\r
-    register int n;\r
-\r
-    REQUEST_SIZE_MATCH(xGestureQueryVersionReq);\r
-    rep.type = X_Reply;\r
-    rep.length = 0;\r
-    rep.sequenceNumber = client->sequence;\r
-    rep.majorVersion = SERVER_GESTURE_MAJOR_VERSION;\r
-    rep.minorVersion = SERVER_GESTURE_MINOR_VERSION;\r
-    rep.patchVersion = SERVER_GESTURE_PATCH_VERSION;\r
-    if (client->swapped)\r
-    {\r
-        swaps(&rep.sequenceNumber);\r
-        swapl(&rep.length);\r
-        swaps(&rep.majorVersion);\r
-        swaps(&rep.minorVersion);\r
-        swapl(&rep.patchVersion);\r
-    }\r
-    WriteToClient(client, sizeof(xGestureQueryVersionReply), (char *)&rep);\r
-\r
-#ifdef __DEBUG_GESTURE_EXT__\r
-    ErrorF("[X11][ProcGestureQueryVersion] return Success !\n");\r
-#endif//__DEBUG_GESTURE_EXT__\r
-\r
-    return Success;\r
-}\r
-\r
-static int\r
-SProcGestureQueryVersion(register ClientPtr  client)\r
-{\r
-    register int n;\r
-    REQUEST(xGestureQueryVersionReq);\r
-    swaps(&stuff->length);\r
-    return ProcGestureQueryVersion(client);\r
-}\r
-\r
-static int\r
-SProcGestureSelectEvents(register ClientPtr client)\r
-{\r
-    register int n;\r
-    REQUEST(xGestureSelectEventsReq);\r
-    swaps(&stuff->length);\r
-    swapl(&stuff->window);\r
-    swapl(&stuff->mask);\r
-    return ProcGestureSelectEvents(client);\r
-}\r
-\r
-static int\r
-ProcGestureSelectEvents (register ClientPtr client)\r
-{\r
-    int rc;\r
-    WindowPtr pWin;\r
-    Mask access_mode = 0;\r
-    GestureWindowPrivatePtr pPriv;\r
-\r
-    REQUEST(xGestureSelectEventsReq);\r
-    REQUEST_SIZE_MATCH (xGestureSelectEventsReq);\r
-\r
-#ifdef __DEBUG_GESTURE_EXT__\r
-    ErrorF("[X11][ProcGestureSelectEvents] after REQUEST_SIZE_MATCH !\n");\r
-#endif//__DEBUG_GESTURE_EXT__\r
-\r
-    access_mode |= DixReceiveAccess;\r
-    rc = dixLookupWindow(&pWin, stuff->window, client, access_mode);\r
-    if( rc != Success || !pWin )\r
-    {\r
-        ErrorF("[X11][ProcGestureSelectEvents] Failed to lookup window !\n");\r
-        return BadWindow;\r
-    }\r
-\r
-#ifdef __DEBUG_GESTURE_EXT__\r
-    ErrorF("[X11][ProcGestureSelectEvents] pWin->drawable.id=0x%x\n", pWin->drawable.id);\r
-#endif//__DEBUG_GESTURE_EXT__\r
-\r
-    pPriv = dixLookupPrivate(&pWin->devPrivates, gestureWindowPrivateKey);\r
-\r
-    if( NULL == pPriv )//no mask was set\r
-    {\r
-       if( stuff->mask != 0 )\r
-       {\r
-               pPriv = malloc(sizeof *pPriv);\r
-               if( !pPriv )\r
-               {\r
-                       ErrorF("[X11][ProcGestureSelectEvents] Failed to allocate memory !\n");\r
-                       return BadAlloc;\r
-               }\r
-\r
-               pPriv->mask = stuff->mask;\r
-               dixSetPrivate(&pWin->devPrivates, gestureWindowPrivateKey, pPriv);\r
-#ifdef __DEBUG_GESTURE_EXT__\r
-               ErrorF("[X11][ProcGestureSelectEvents] mask(0x%x) was addded on win(0x%x) !\n", stuff->mask, stuff->window);\r
-#endif//__DEBUG_GESTURE_EXT__\r
-       }\r
-    }\r
-    else//mask was set already\r
-    {\r
-       if( stuff->mask == 0 )\r
-       {\r
-               free(pPriv);\r
-               dixSetPrivate(&pWin->devPrivates, gestureWindowPrivateKey, NULL);\r
-#ifdef __DEBUG_GESTURE_EXT__\r
-               ErrorF("[X11][ProcGestureSelectEvents] mask was removed on win(0x%x) !\n", stuff->window);\r
-#endif//__DEBUG_GESTURE_EXT__\r
-       }\r
-       else\r
-       {\r
-               pPriv->mask = stuff->mask;\r
-               dixSetPrivate(&pWin->devPrivates, gestureWindowPrivateKey, pPriv);\r
-#ifdef __DEBUG_GESTURE_EXT__\r
-               ErrorF("[X11][ProcGestureSelectEvents] mask(0x%x) was updated on win(0x%x) !\n", stuff->mask, stuff->window);\r
-#endif//__DEBUG_GESTURE_EXT__\r
-       }\r
-    }\r
-\r
+
+#ifdef __DEBUG_GESTURE_EXT__
+       ErrorF("[X11][GestureResourceStateCallback][end] grabbed_events_mask=0x%x\n", grabbed_events_mask);
+#endif//__DEBUG_GESTURE_EXT__
+
+       return;
+}
+
+Bool
+GestureInstallResourceStateHooks(void)
+{
+       Bool res = TRUE;
+
+       res = AddCallback(&ResourceStateCallback, GestureResourceStateCallback, NULL);
+
+       if(!res)
+       {
+               ErrorF("[X11][GestureInstallResourceStateHooks] Failed to register one or more callbacks ! (res=%d)\n", res);
+               return FALSE;
+       }
+
+#ifdef __DEBUG_GESTURE_EXT__
+       ErrorF("[X11][GestureInstallResourceStateHooks] AddCallback result = %d\n", res);
+#endif//__DEBUG_GESTURE_EXT__
+       return TRUE;
+}
+
+Bool
+GestureUninstallResourceStateHooks(void)
+{
+       Bool res;
+
+       res = DeleteCallback(&ResourceStateCallback, GestureResourceStateCallback, NULL);
+
+#ifdef __DEBUG_GESTURE_EXT__
+       ErrorF("[X11][GestureUninstallResourceStateHooks] DeleteCallback result = %d\n", res);
+#endif//__DEBUG_GESTURE_EXT__
+       return res;
+}
+
+/*
+ * deliver the event
+ */
+void
+GestureSendEvent (WindowPtr pWin, int type, unsigned int mask, xGestureCommonEvent *gce)
+{
+    int rc;
+    Mask access_mode = 0;
+    GestureWindowPrivatePtr pPriv;
+    WindowPtr pTmp = NULL;
+
+    if( NULL == pWin )
+    {
+       access_mode |= DixReceiveAccess;
+       rc = dixLookupWindow(&pWin, gce->any.window, serverClient, access_mode);
+       if( rc != Success || !pWin )
+       {
+               ErrorF("[X11][GestureSendEvent] Failed to lookup window !\n");
+               return;
+       }
+
+       pPriv = dixLookupPrivate(&pWin->devPrivates, gestureWindowPrivateKey);
+
+       if( !pPriv )
+       {
+#ifdef __DEBUG_GESTURE_EXT__
+               ErrorF("[X11][GestureSendEvent] no mask exist on win(0x%x)\n", pWin->drawable.id);
+#endif//__DEBUG_GESTURE_EXT__
+               return;
+       }
+
+#ifdef __DEBUG_GESTURE_EXT__
+       ErrorF("[X11][GestureSendEvent] type=%d, mask=%d\n", type, mask);
+#endif//__DEBUG_GESTURE_EXT__
+
+       if( !(pPriv->mask & mask) )
+       {
+#ifdef __DEBUG_GESTURE_EXT__
+               ErrorF("[X11][GestureSendEvent] selected window doesn't have valid event mask ! (pPriv->mask=0x%x, mask=0x%x)\n", pPriv->mask, mask);
+#endif//__DEBUG_GESTURE_EXT__
+               return;
+       }
+    }
+
+    gce->any.type = type + GestureEventBase;
+    gce->any.time = currentTime.milliseconds;
+    WriteEventsToClient(wClient(pWin), 1, (xEvent *) gce);
+#ifdef __DEBUG_GESTURE_EXT__
+    ErrorF("[X11][GestureSendEvent] Send gesture event(type:%x) to win(0x%x)\n", type, pWin->drawable.id);
+#endif//__DEBUG_GESTURE_EXT__
+}
+
+static void
+SGestureNotifyGroupEvent(xGestureNotifyGroupEvent *from, xGestureNotifyGroupEvent *to)
+{
+       to->type = from->type;
+       to->kind = from->kind;
+       cpswaps(from->sequenceNumber, to->sequenceNumber);
+       cpswapl(from->window, to->window);
+       cpswapl(from->time, to->time);
+       to->groupid = from->groupid;
+       to->num_group = from->num_group;
+       /* pad1 */
+       /* pad2 */
+       /* pad3 */
+       /* pad4 */
+       /* pad5 */
+}
+
+static void
+SGestureNotifyFlickEvent(xGestureNotifyFlickEvent *from, xGestureNotifyFlickEvent *to)
+{
+       to->type = from->type;
+       to->kind = from->kind;
+       cpswaps(from->sequenceNumber, to->sequenceNumber);
+       cpswapl(from->window, to->window);
+       cpswapl(from->time, to->time);
+       to->num_finger = from->num_finger;
+       to->direction = from->direction;
+       cpswaps(from->distance, to->distance);
+       cpswapl(from->duration, to->duration);
+       cpswapl(from->angle, to->angle);
+       /* pad1 */
+       /* pad2 */
+}
+
+static void
+SGestureNotifyPanEvent(xGestureNotifyPanEvent *from, xGestureNotifyPanEvent *to)
+{
+       to->type = from->type;
+       to->kind = from->kind;
+       cpswaps(from->sequenceNumber, to->sequenceNumber);
+       cpswapl(from->window, to->window);
+       cpswapl(from->time, to->time);
+       to->num_finger = from->num_finger;
+       to->direction = from->direction;
+       cpswaps(from->distance, to->distance);
+       cpswapl(from->duration, to->duration);
+       cpswaps(from->dx, to->dx);
+       cpswaps(from->dy, to->dy);
+       /* pad1 */
+       /* pad2 */
+}
+
+static void
+SGestureNotifyPinchRotationEvent(xGestureNotifyPinchRotationEvent *from, xGestureNotifyPinchRotationEvent *to)
+{
+       to->type = from->type;
+       to->kind = from->kind;
+       cpswaps(from->sequenceNumber, to->sequenceNumber);
+       cpswapl(from->window, to->window);
+       cpswapl(from->time, to->time);
+       to->num_finger = from->num_finger;
+       /* pad1 */
+       cpswaps(from->distance, to->distance);
+       cpswaps(from->cx, to->cx);
+       cpswaps(from->cy, to->cy);
+       cpswapl(from->zoom, to->zoom);
+       cpswapl(from->angle, to->angle);
+       /* pad2 */
+}
+
+static void
+SGestureNotifyTapEvent(xGestureNotifyTapEvent *from, xGestureNotifyTapEvent *to)
+{
+       to->type = from->type;
+       to->kind = from->kind;
+       cpswaps(from->sequenceNumber, to->sequenceNumber);
+       cpswapl(from->window, to->window);
+       cpswapl(from->time, to->time);
+       to->num_finger = from->num_finger;
+       /* pad1 */
+       cpswaps(from->cx, to->cx);
+       cpswaps(from->cy, to->cy);
+       to->tap_repeat = from->tap_repeat;
+       /* pad2 */
+       cpswapl(from->interval, to->interval);
+       /* pad3 */
+       /* pad4 */
+}
+
+static void
+SGestureNotifyTapNHoldEvent(xGestureNotifyTapNHoldEvent *from, xGestureNotifyTapNHoldEvent *to)
+{
+       to->type = from->type;
+       to->kind = from->kind;
+       cpswaps(from->sequenceNumber, to->sequenceNumber);
+       cpswapl(from->window, to->window);
+       cpswapl(from->time, to->time);
+       to->num_finger = from->num_finger;
+       /* pad1 */
+       cpswaps(from->cx, to->cx);
+       cpswaps(from->cy, to->cy);
+       /* pad2 */
+       cpswapl(from->interval, to->interval);
+       cpswapl(from->holdtime, to->holdtime);
+       /* pad3 */
+}
+
+static void
+SGestureNotifyHoldEvent(xGestureNotifyHoldEvent *from, xGestureNotifyHoldEvent *to)
+{
+       to->type = from->type;
+       to->kind = from->kind;
+       cpswaps(from->sequenceNumber, to->sequenceNumber);
+       cpswapl(from->window, to->window);
+       cpswapl(from->time, to->time);
+       to->num_finger = from->num_finger;
+       /* pad1 */
+       cpswaps(from->cx, to->cx);
+       cpswaps(from->cy, to->cy);
+       /* pad2 */
+       cpswapl(from->holdtime, to->holdtime);
+       /* pad3 */
+       /* pad4 */
+}
+
+static void
+SGestureNotifyEvent(xEvent * from, xEvent * to)
+{
+    switch (from->u.u.detail) {
+       case GestureNotifyGroup:
+               SGestureNotifyGroupEvent((xGestureNotifyGroupEvent *)from,
+                       (xGestureNotifyGroupEvent *)to);
+               break;
+       case GestureNotifyFlick:
+               SGestureNotifyFlickEvent((xGestureNotifyFlickEvent *)from,
+                       (xGestureNotifyFlickEvent *)to);
+               break;
+       case GestureNotifyPan:
+               SGestureNotifyPanEvent((xGestureNotifyPanEvent *)from,
+                       (xGestureNotifyPanEvent *)to);
+               break;
+       case GestureNotifyPinchRotation:
+               SGestureNotifyPinchRotationEvent((xGestureNotifyPinchRotationEvent *)from,
+                       (xGestureNotifyPinchRotationEvent *)to);
+               break;
+       case GestureNotifyTap:
+               SGestureNotifyTapEvent((xGestureNotifyTapEvent *)from,
+                       (xGestureNotifyTapEvent *)to);
+               break;
+       case GestureNotifyTapNHold:
+               SGestureNotifyTapNHoldEvent((xGestureNotifyTapNHoldEvent *)from,
+                       (xGestureNotifyTapNHoldEvent *)to);
+               break;
+       case GestureNotifyHold:
+               SGestureNotifyHoldEvent((xGestureNotifyHoldEvent *)from,
+                       (xGestureNotifyHoldEvent *)to);
+               break;
+    }
+#ifdef __DEBUG_GESTURE_EXT__
+    ErrorF("[X11][SGestureNotifyEvent] ...\n");
+#endif//__DEBUG_GESTURE_EXT__
+}
+
+static int
+ProcGestureQueryVersion(register ClientPtr client)
+{
+    xGestureQueryVersionReply rep;
+    register int n;
+
+    REQUEST_SIZE_MATCH(xGestureQueryVersionReq);
+    rep.type = X_Reply;
+    rep.length = 0;
+    rep.sequenceNumber = client->sequence;
+    rep.majorVersion = SERVER_GESTURE_MAJOR_VERSION;
+    rep.minorVersion = SERVER_GESTURE_MINOR_VERSION;
+    rep.patchVersion = SERVER_GESTURE_PATCH_VERSION;
+    if (client->swapped)
+    {
+        swaps(&rep.sequenceNumber);
+        swapl(&rep.length);
+        swaps(&rep.majorVersion);
+        swaps(&rep.minorVersion);
+        swapl(&rep.patchVersion);
+    }
+    WriteToClient(client, sizeof(xGestureQueryVersionReply), (char *)&rep);
+
+#ifdef __DEBUG_GESTURE_EXT__
+    ErrorF("[X11][ProcGestureQueryVersion] return Success !\n");
+#endif//__DEBUG_GESTURE_EXT__
+
+    return Success;
+}
+
+static int
+SProcGestureQueryVersion(register ClientPtr  client)
+{
+    register int n;
+    REQUEST(xGestureQueryVersionReq);
+    swaps(&stuff->length);
+    return ProcGestureQueryVersion(client);
+}
+
+static int
+SProcGestureSelectEvents(register ClientPtr client)
+{
+    register int n;
+    REQUEST(xGestureSelectEventsReq);
+    swaps(&stuff->length);
+    swapl(&stuff->window);
+    swapl(&stuff->mask);
+    return ProcGestureSelectEvents(client);
+}
+
+static int
+ProcGestureSelectEvents (register ClientPtr client)
+{
+    int rc;
+    WindowPtr pWin;
+    Mask access_mode = 0;
+    GestureWindowPrivatePtr pPriv;
+
+    REQUEST(xGestureSelectEventsReq);
+    REQUEST_SIZE_MATCH (xGestureSelectEventsReq);
+
+#ifdef __DEBUG_GESTURE_EXT__
+    ErrorF("[X11][ProcGestureSelectEvents] after REQUEST_SIZE_MATCH !\n");
+#endif//__DEBUG_GESTURE_EXT__
+
+    access_mode |= DixReceiveAccess;
+    rc = dixLookupWindow(&pWin, stuff->window, client, access_mode);
+    if( rc != Success || !pWin )
+    {
+        ErrorF("[X11][ProcGestureSelectEvents] Failed to lookup window !\n");
+        return BadWindow;
+    }
+
+#ifdef __DEBUG_GESTURE_EXT__
+    ErrorF("[X11][ProcGestureSelectEvents] pWin->drawable.id=0x%x\n", pWin->drawable.id);
+#endif//__DEBUG_GESTURE_EXT__
+
+    pPriv = dixLookupPrivate(&pWin->devPrivates, gestureWindowPrivateKey);
+
+    if( NULL == pPriv )//no mask was set
+    {
+       if( stuff->mask != 0 )
+       {
+               pPriv = malloc(sizeof *pPriv);
+               if( !pPriv )
+               {
+                       ErrorF("[X11][ProcGestureSelectEvents] Failed to allocate memory !\n");
+                       return BadAlloc;
+               }
+
+               pPriv->mask = stuff->mask;
+               dixSetPrivate(&pWin->devPrivates, gestureWindowPrivateKey, pPriv);
+#ifdef __DEBUG_GESTURE_EXT__
+               ErrorF("[X11][ProcGestureSelectEvents] mask(0x%x) was addded on win(0x%x) !\n", stuff->mask, stuff->window);
+#endif//__DEBUG_GESTURE_EXT__
+       }
+    }
+    else//mask was set already
+    {
+       if( stuff->mask == 0 )
+       {
+               free(pPriv);
+               dixSetPrivate(&pWin->devPrivates, gestureWindowPrivateKey, NULL);
+#ifdef __DEBUG_GESTURE_EXT__
+               ErrorF("[X11][ProcGestureSelectEvents] mask was removed on win(0x%x) !\n", stuff->window);
+#endif//__DEBUG_GESTURE_EXT__
+       }
+       else
+       {
+               pPriv->mask = stuff->mask;
+               dixSetPrivate(&pWin->devPrivates, gestureWindowPrivateKey, pPriv);
+#ifdef __DEBUG_GESTURE_EXT__
+               ErrorF("[X11][ProcGestureSelectEvents] mask(0x%x) was updated on win(0x%x) !\n", stuff->mask, stuff->window);
+#endif//__DEBUG_GESTURE_EXT__
+       }
+    }
+
     if(stuff->mask)
     {
         GestureAddWindowToList(pWin->drawable.id, &selectedWinList);
@@ -776,477 +776,477 @@ ProcGestureSelectEvents (register ClientPtr client)
                gpGestureEventsSelected(None, &stuff->mask);
     }
 
-#ifdef __DEBUG_GESTURE_EXT__\r
-    ErrorF("[X11][ProcGestureSelectEvents] Success !\n");\r
-#endif//__DEBUG_GESTURE_EXT__\r
-\r
-    return Success;\r
-}\r
-\r
-static int\r
-SProcGestureGetSelectedEvents(register ClientPtr client)\r
-{\r
-    register int n;\r
-    REQUEST(xGestureGetSelectedEventsReq);\r
-    swaps(&stuff->length);\r
-    swapl(&stuff->window);\r
-    return ProcGestureGetSelectedEvents(client);\r
-}\r
-\r
-static int\r
-ProcGestureGetSelectedEvents (register ClientPtr client)\r
-{\r
-    register int n;\r
-    int rc, ret = Success;\r
-    WindowPtr pWin;\r
-    Mask access_mode = 0;\r
-    Mask mask_out = 0;\r
-    GestureWindowPrivatePtr pPriv;\r
-    xGestureGetSelectedEventsReply rep;\r
-\r
-    REQUEST(xGestureGetSelectedEventsReq);\r
-    REQUEST_SIZE_MATCH (xGestureGetSelectedEventsReq);\r
-\r
-#ifdef __DEBUG_GESTURE_EXT__\r
-    ErrorF("[X11][ProcGestureGetSelectedEvents] after REQUEST_SIZE_MATCH !\n");\r
-#endif//__DEBUG_GESTURE_EXT__\r
-\r
-    rep.type = X_Reply;\r
-    rep.length = 0;\r
-    rep.sequenceNumber = client->sequence;\r
-\r
-    access_mode |= DixReceiveAccess;\r
-    rc = dixLookupWindow(&pWin, stuff->window, client, access_mode);\r
-    if( rc != Success || !pWin )\r
-    {\r
-        ErrorF("[X11][ProcGestureGetSelectedEvents] Failed to lookup window !\n");\r
-        ret = BadWindow;\r
-        goto failed;\r
-    }\r
-\r
-#ifdef __DEBUG_GESTURE_EXT__\r
-    ErrorF("[X11][ProcGestureGetSelectedEvents] pWin->drawable.id=0x%x\n", pWin->drawable.id);\r
-#endif//__DEBUG_GESTURE_EXT__\r
-\r
-    pPriv = dixLookupPrivate(&pWin->devPrivates, gestureWindowPrivateKey);\r
-\r
-    if( NULL == pPriv )//no mask was set\r
-    {\r
-       mask_out = 0;\r
-    }\r
-    else//mask was set already\r
-    {\r
-       mask_out = pPriv->mask;\r
-    }\r
-\r
-    rep.mask = mask_out;\r
-    if (client->swapped)\r
-    {\r
-        swaps(&rep.sequenceNumber);\r
-        swapl(&rep.length);\r
-        swapl(&rep.mask);\r
-    }\r
-    WriteToClient(client, sizeof(xGestureGetSelectedEventsReply), (char *)&rep);\r
-\r
-#ifdef __DEBUG_GESTURE_EXT__\r
-    ErrorF("[X11][ProcGestureGetSelectedEvents] Success !\n");\r
-#endif//__DEBUG_GESTURE_EXT__\r
-\r
-    return ret;\r
-\r
-failed:\r
-\r
-    rep.mask = 0;\r
-    if (client->swapped)\r
-    {\r
-        swaps(&rep.sequenceNumber);\r
-        swapl(&rep.length);\r
-        swapl(&rep.mask);\r
-    }\r
-    WriteToClient(client, sizeof(xGestureGetSelectedEventsReply), (char *)&rep);\r
-\r
-#ifdef __DEBUG_GESTURE_EXT__\r
-    ErrorF("[X11][ProcGestureGetSelectedEvents] Failed !\n");\r
-#endif//__DEBUG_GESTURE_EXT__\r
-\r
-    return ret;        \r
-}\r
-\r
-static int\r
-SProcGestureGrabEvent(register ClientPtr client)\r
-{\r
-    register int n;\r
-    REQUEST(xGestureGrabEventReq);\r
-    swaps(&stuff->length);\r
-    swapl(&stuff->window);\r
-    swapl(&stuff->eventType);\r
-    //swapl(&stuff->num_finger);\r
-    swapl(&stuff->time);\r
-    return ProcGestureGrabEvent(client);\r
-}\r
-\r
-static int\r
-ProcGestureGrabEvent (register ClientPtr client)\r
-{\r
-    register int n;\r
-    int i, rc, ret = Success;\r
-    TimeStamp ctime;\r
-    WindowPtr pWin;\r
-    Mask eventmask;\r
-    Mask access_mode = 0;\r
-    GestureWindowPrivatePtr pPriv;\r
-    xGestureGrabEventReply rep;\r
-\r
-    REQUEST(xGestureGrabEventReq);\r
-    REQUEST_SIZE_MATCH (xGestureGrabEventReq);\r
-\r
-    eventmask = (1L << stuff->eventType);\r
-\r
-#ifdef __DEBUG_GESTURE_EXT__\r
-    ErrorF("[X11][ProcGestureGrabEvent] after REQUEST_SIZE_MATCH !\n");\r
-    ErrorF("[X11][ProcGestureGrabEvent] stuff->window=0x%x, stuff->eventType=%d, stuff->num_finger=%d\n", stuff->window, stuff->eventType, stuff->num_finger);\r
-#endif//__DEBUG_GESTURE_EXT__\r
-\r
-    //prepare to reply\r
-    rep.type = X_Reply;\r
-    rep.length = 0;\r
-    rep.sequenceNumber = client->sequence;\r
-\r
-    if( stuff->eventType >= GestureNumberEvents )\r
-    {\r
-       ErrorF("[X11][ProcGestureGrabEvent] GestureGrabAbnormal !(eventType(%d) >= GestureNumberEvents(%d))\n", stuff->eventType, (int)GestureNumberEvents);\r
-       rep.status = GestureGrabAbnormal;\r
-       ret = BadValue;\r
-       goto grab_failed;\r
-    }\r
-\r
-    if( stuff->num_finger >= max_num_finger )\r
-    {\r
-       ErrorF("[X11][ProcGestureGrabEvent] GestureGrabAbnormal !(num_finger(%d) >= max num finger(%d))\n", stuff->num_finger, max_num_finger);\r
-       rep.status = GestureGrabAbnormal;\r
-       ret = BadValue;\r
-       goto grab_failed;\r
-    }\r
-\r
-    ctime = ClientTimeToServerTime((CARD32)stuff->time);\r
-#if 1\r
-    if ( CompareTimeStamps(ctime, currentTime) == LATER )\r
-#else\r
-    if ( (CompareTimeStamps(ctime, currentTime) == LATER ) ||\r
-    (CompareTimeStamps(ctime, grabInfo->grabTime) == EARLIER) )\r
-#endif\r
-    {\r
-       ErrorF("[X11][ProcGestureGrabEvent] GestureGrabInvalidTime !(ctime=%d, currentTime=%d)\n", ctime, currentTime);\r
-       rep.status = GestureGrabInvalidTime;\r
-       ret = BadAccess;\r
-       goto grab_failed;\r
-    }\r
-\r
-    //check the event was grabbed already\r
-    if( grabbed_events_mask & eventmask )\r
-    {\r
-       if( grabbed_events[stuff->eventType].pGestureGrabWinInfo[stuff->num_finger].window != None &&\r
-               grabbed_events[stuff->eventType].pGestureGrabWinInfo[stuff->num_finger].window != stuff->window )\r
-       {\r
-               ErrorF("[X11][ProcGestureGrabEvent] GestureGrabbedAlready ! (org_mask=0x%x, eventmask=0x%x)\n",\r
-                               grabbed_events_mask, eventmask);\r
-               rep.status = GestureGrabbedAlready;\r
-               ret = BadAccess;\r
-               goto grab_failed;\r
-       }\r
-    }\r
-\r
-#ifdef __DEBUG_GESTURE_EXT__\r
-    ErrorF("[X11][ProcGestureGrabEvent] Gesture(s) are available ! (org_mask=0x%x, eventmask=0x%x, eventType=%d, num_finger=%d)\n",\r
-                       grabbed_events_mask, eventmask, stuff->eventType, stuff->num_finger);\r
-#endif//__DEBUG_GESTURE_EXT__\r
-\r
-    access_mode |= DixReceiveAccess;\r
-    rc = dixLookupWindow(&pWin, stuff->window, client, access_mode);\r
-    if( rc != Success || !pWin )\r
-    {\r
-        ErrorF("[X11][ProcGestureGrabEvent] Failed to lookup window !\n");\r
-        rep.status = GestureGrabAbnormal;\r
-        ret = BadWindow;\r
-        goto grab_failed;\r
-    }\r
-\r
-#ifdef __DEBUG_GESTURE_EXT__\r
-    ErrorF("[X11][ProcGestureGrabEvent] pWin->drawable.id=0x%x\n", pWin->drawable.id);\r
-    ErrorF("[X11][ProcGestureGrabEvent][before] grabbed_events_mask=0x%x\n", grabbed_events_mask);\r
-#endif//__DEBUG_GESTURE_EXT__\r
-\r
-    //set to grab\r
-    grabbed_events_mask |= eventmask;\r
-    grabbed_events[stuff->eventType].pGestureGrabWinInfo[stuff->num_finger].pWin = pWin;\r
-    grabbed_events[stuff->eventType].pGestureGrabWinInfo[stuff->num_finger].window = stuff->window;\r
-\r
+#ifdef __DEBUG_GESTURE_EXT__
+    ErrorF("[X11][ProcGestureSelectEvents] Success !\n");
+#endif//__DEBUG_GESTURE_EXT__
+
+    return Success;
+}
+
+static int
+SProcGestureGetSelectedEvents(register ClientPtr client)
+{
+    register int n;
+    REQUEST(xGestureGetSelectedEventsReq);
+    swaps(&stuff->length);
+    swapl(&stuff->window);
+    return ProcGestureGetSelectedEvents(client);
+}
+
+static int
+ProcGestureGetSelectedEvents (register ClientPtr client)
+{
+    register int n;
+    int rc, ret = Success;
+    WindowPtr pWin;
+    Mask access_mode = 0;
+    Mask mask_out = 0;
+    GestureWindowPrivatePtr pPriv;
+    xGestureGetSelectedEventsReply rep;
+
+    REQUEST(xGestureGetSelectedEventsReq);
+    REQUEST_SIZE_MATCH (xGestureGetSelectedEventsReq);
+
+#ifdef __DEBUG_GESTURE_EXT__
+    ErrorF("[X11][ProcGestureGetSelectedEvents] after REQUEST_SIZE_MATCH !\n");
+#endif//__DEBUG_GESTURE_EXT__
+
+    rep.type = X_Reply;
+    rep.length = 0;
+    rep.sequenceNumber = client->sequence;
+
+    access_mode |= DixReceiveAccess;
+    rc = dixLookupWindow(&pWin, stuff->window, client, access_mode);
+    if( rc != Success || !pWin )
+    {
+        ErrorF("[X11][ProcGestureGetSelectedEvents] Failed to lookup window !\n");
+        ret = BadWindow;
+        goto failed;
+    }
+
+#ifdef __DEBUG_GESTURE_EXT__
+    ErrorF("[X11][ProcGestureGetSelectedEvents] pWin->drawable.id=0x%x\n", pWin->drawable.id);
+#endif//__DEBUG_GESTURE_EXT__
+
+    pPriv = dixLookupPrivate(&pWin->devPrivates, gestureWindowPrivateKey);
+
+    if( NULL == pPriv )//no mask was set
+    {
+       mask_out = 0;
+    }
+    else//mask was set already
+    {
+       mask_out = pPriv->mask;
+    }
+
+    rep.mask = mask_out;
+    if (client->swapped)
+    {
+        swaps(&rep.sequenceNumber);
+        swapl(&rep.length);
+        swapl(&rep.mask);
+    }
+    WriteToClient(client, sizeof(xGestureGetSelectedEventsReply), (char *)&rep);
+
+#ifdef __DEBUG_GESTURE_EXT__
+    ErrorF("[X11][ProcGestureGetSelectedEvents] Success !\n");
+#endif//__DEBUG_GESTURE_EXT__
+
+    return ret;
+
+failed:
+
+    rep.mask = 0;
+    if (client->swapped)
+    {
+        swaps(&rep.sequenceNumber);
+        swapl(&rep.length);
+        swapl(&rep.mask);
+    }
+    WriteToClient(client, sizeof(xGestureGetSelectedEventsReply), (char *)&rep);
+
+#ifdef __DEBUG_GESTURE_EXT__
+    ErrorF("[X11][ProcGestureGetSelectedEvents] Failed !\n");
+#endif//__DEBUG_GESTURE_EXT__
+
+    return ret;
+}
+
+static int
+SProcGestureGrabEvent(register ClientPtr client)
+{
+    register int n;
+    REQUEST(xGestureGrabEventReq);
+    swaps(&stuff->length);
+    swapl(&stuff->window);
+    swapl(&stuff->eventType);
+    //swapl(&stuff->num_finger);
+    swapl(&stuff->time);
+    return ProcGestureGrabEvent(client);
+}
+
+static int
+ProcGestureGrabEvent (register ClientPtr client)
+{
+    register int n;
+    int i, rc, ret = Success;
+    TimeStamp ctime;
+    WindowPtr pWin;
+    Mask eventmask;
+    Mask access_mode = 0;
+    GestureWindowPrivatePtr pPriv;
+    xGestureGrabEventReply rep;
+
+    REQUEST(xGestureGrabEventReq);
+    REQUEST_SIZE_MATCH (xGestureGrabEventReq);
+
+    eventmask = (1L << stuff->eventType);
+
+#ifdef __DEBUG_GESTURE_EXT__
+    ErrorF("[X11][ProcGestureGrabEvent] after REQUEST_SIZE_MATCH !\n");
+    ErrorF("[X11][ProcGestureGrabEvent] stuff->window=0x%x, stuff->eventType=%d, stuff->num_finger=%d\n", stuff->window, stuff->eventType, stuff->num_finger);
+#endif//__DEBUG_GESTURE_EXT__
+
+    //prepare to reply
+    rep.type = X_Reply;
+    rep.length = 0;
+    rep.sequenceNumber = client->sequence;
+
+    if( stuff->eventType >= GestureNumberEvents )
+    {
+       ErrorF("[X11][ProcGestureGrabEvent] GestureGrabAbnormal !(eventType(%d) >= GestureNumberEvents(%d))\n", stuff->eventType, (int)GestureNumberEvents);
+       rep.status = GestureGrabAbnormal;
+       ret = BadValue;
+       goto grab_failed;
+    }
+
+    if( stuff->num_finger >= max_num_finger )
+    {
+       ErrorF("[X11][ProcGestureGrabEvent] GestureGrabAbnormal !(num_finger(%d) >= max num finger(%d))\n", stuff->num_finger, max_num_finger);
+       rep.status = GestureGrabAbnormal;
+       ret = BadValue;
+       goto grab_failed;
+    }
+
+    ctime = ClientTimeToServerTime((CARD32)stuff->time);
+#if 1
+    if ( CompareTimeStamps(ctime, currentTime) == LATER )
+#else
+    if ( (CompareTimeStamps(ctime, currentTime) == LATER ) ||
+    (CompareTimeStamps(ctime, grabInfo->grabTime) == EARLIER) )
+#endif
+    {
+       ErrorF("[X11][ProcGestureGrabEvent] GestureGrabInvalidTime !(ctime=%d, currentTime=%d)\n", ctime, currentTime);
+       rep.status = GestureGrabInvalidTime;
+       ret = BadAccess;
+       goto grab_failed;
+    }
+
+    //check the event was grabbed already
+    if( grabbed_events_mask & eventmask )
+    {
+       if( grabbed_events[stuff->eventType].pGestureGrabWinInfo[stuff->num_finger].window != None &&
+               grabbed_events[stuff->eventType].pGestureGrabWinInfo[stuff->num_finger].window != stuff->window )
+       {
+               ErrorF("[X11][ProcGestureGrabEvent] GestureGrabbedAlready ! (org_mask=0x%x, eventmask=0x%x)\n",
+                               grabbed_events_mask, eventmask);
+               rep.status = GestureGrabbedAlready;
+               ret = BadAccess;
+               goto grab_failed;
+       }
+    }
+
+#ifdef __DEBUG_GESTURE_EXT__
+    ErrorF("[X11][ProcGestureGrabEvent] Gesture(s) are available ! (org_mask=0x%x, eventmask=0x%x, eventType=%d, num_finger=%d)\n",
+                       grabbed_events_mask, eventmask, stuff->eventType, stuff->num_finger);
+#endif//__DEBUG_GESTURE_EXT__
+
+    access_mode |= DixReceiveAccess;
+    rc = dixLookupWindow(&pWin, stuff->window, client, access_mode);
+    if( rc != Success || !pWin )
+    {
+        ErrorF("[X11][ProcGestureGrabEvent] Failed to lookup window !\n");
+        rep.status = GestureGrabAbnormal;
+        ret = BadWindow;
+        goto grab_failed;
+    }
+
+#ifdef __DEBUG_GESTURE_EXT__
+    ErrorF("[X11][ProcGestureGrabEvent] pWin->drawable.id=0x%x\n", pWin->drawable.id);
+    ErrorF("[X11][ProcGestureGrabEvent][before] grabbed_events_mask=0x%x\n", grabbed_events_mask);
+#endif//__DEBUG_GESTURE_EXT__
+
+    //set to grab
+    grabbed_events_mask |= eventmask;
+    grabbed_events[stuff->eventType].pGestureGrabWinInfo[stuff->num_finger].pWin = pWin;
+    grabbed_events[stuff->eventType].pGestureGrabWinInfo[stuff->num_finger].window = stuff->window;
+
     if(gpGestureEventsGrabbed)
     {
         gpGestureEventsGrabbed(&grabbed_events_mask, &grabbed_events);
     }
-\r
-#ifdef __DEBUG_GESTURE_EXT__\r
-    ErrorF("[X11][ProcGestureGrabEvent][after] grabbed_events_mask=0x%x\n", grabbed_events_mask);\r
-#endif//__DEBUG_GESTURE_EXT__\r
-\r
-    rep.status = GestureGrabSuccess;\r
-\r
-    if (client->swapped)\r
-    {\r
-        swaps(&rep.sequenceNumber);\r
-        swapl(&rep.length);\r
-    }\r
-    WriteToClient(client, sizeof(xGestureGrabEventReply), (char *)&rep);\r
-\r
-#ifdef __DEBUG_GESTURE_EXT__\r
-    ErrorF("[X11][ProcGestureGrabEvent] Success !\n");\r
-#endif//__DEBUG_GESTURE_EXT__\r
-\r
-    return Success;\r
-\r
-grab_failed:\r
-\r
-    if (client->swapped)\r
-    {\r
-        swaps(&rep.sequenceNumber);\r
-        swapl(&rep.length);\r
-    }\r
-\r
-    WriteToClient(client, sizeof(xGestureGrabEventReply), (char *)&rep);\r
-\r
-#ifdef __DEBUG_GESTURE_EXT__\r
-    ErrorF("[X11][ProcGestureGrabEvent] Failed !\n");\r
-#endif//__DEBUG_GESTURE_EXT__\r
-\r
-    return ret;\r
-}\r
-\r
-static int\r
-SProcGestureUngrabEvent(register ClientPtr client)\r
-{\r
-    register int n;\r
-    REQUEST(xGestureUngrabEventReq);\r
-    swaps(&stuff->length);\r
-    swapl(&stuff->window);\r
-    swapl(&stuff->eventType);\r
-    //swapl(&stuff->num_finger);\r
-    swapl(&stuff->time);\r
-    return ProcGestureUngrabEvent(client);\r
-}\r
-\r
-static int\r
-ProcGestureUngrabEvent (register ClientPtr client)\r
-{\r
-    register int n;\r
-    int i, none_win_count, rc, ret = Success;\r
-    TimeStamp ctime;\r
-    WindowPtr pWin;\r
-    Mask eventmask;\r
-    Mask access_mode = 0;\r
-    GestureWindowPrivatePtr pPriv;\r
-    xGestureUngrabEventReply rep;\r
-\r
-    REQUEST(xGestureUngrabEventReq);\r
-    REQUEST_SIZE_MATCH (xGestureUngrabEventReq);\r
-\r
-    eventmask = (1L << stuff->eventType);\r
-\r
-#ifdef __DEBUG_GESTURE_EXT__\r
-    ErrorF("[X11][ProcGestureUngrabEvent] after REQUEST_SIZE_MATCH !\n");\r
-#endif//__DEBUG_GESTURE_EXT__\r
-\r
-    //prepare to reply\r
-    rep.type = X_Reply;\r
-    rep.length = 0;\r
-    rep.sequenceNumber = client->sequence;\r
-    rep.status = GestureUngrabNotGrabbed;\r
-\r
-    if( stuff->eventType >= GestureNumberEvents )\r
-    {\r
-       ErrorF("[X11][ProcGestureUngrabEvent] GestureGrabAbnormal !(eventType(%d) >= GestureNumberEvents(%d))\n", stuff->eventType, (int)GestureNumberEvents);\r
-       rep.status = GestureUngrabAbnormal;\r
-       ret = BadValue;\r
-       goto ungrab_failed;\r
-    }\r
-\r
-    if( stuff->num_finger >= max_num_finger )\r
-    {\r
-       ErrorF("[X11][ProcGestureUngrabEvent] GestureGrabAbnormal !(num_finger(%d) >= max num finger(%d))\n", stuff->num_finger, max_num_finger);\r
-       rep.status = GestureUngrabAbnormal;\r
-       ret = BadValue;\r
-       goto ungrab_failed;\r
-    }\r
-\r
-    ctime = ClientTimeToServerTime((CARD32)stuff->time);\r
-#if 1\r
-    if ( CompareTimeStamps(ctime, currentTime) == LATER )\r
-#else\r
-    if ( (CompareTimeStamps(ctime, currentTime) == LATER ) ||\r
-    (CompareTimeStamps(ctime, grabInfo->grabTime) == EARLIER) )\r
-#endif\r
-    {\r
-       ErrorF("[X11][ProcGestureUngrabEvent] GestureGrabInvalidTime !(ctime=%d, currentTime=%d)\n", ctime, currentTime);\r
-       rep.status = GestureGrabInvalidTime;\r
-       ret = BadAccess;\r
-       goto ungrab_failed;\r
-    }\r
-\r
-    if( grabbed_events_mask & eventmask )\r
-    {\r
-       if( grabbed_events[stuff->eventType].pGestureGrabWinInfo[stuff->num_finger].window == stuff->window )\r
-       {\r
-               grabbed_events[stuff->eventType].pGestureGrabWinInfo[stuff->num_finger].window = None;\r
-               grabbed_events[stuff->eventType].pGestureGrabWinInfo[stuff->num_finger].pWin = NULL;\r
-       }\r
-\r
-       none_win_count = 0;\r
-       for( i = 0 ; i < max_num_finger ; i++ )\r
-       {\r
-               if( None == grabbed_events[stuff->eventType].pGestureGrabWinInfo[i].window )\r
-               {\r
-                       none_win_count++;\r
-               }\r
-       }\r
-\r
-       if( none_win_count == max_num_finger )\r
-       {\r
-#ifdef __DEBUG_GESTURE_EXT__\r
-               ErrorF("[X11][ProcGestureUngrabEvent][before] grabbed_events_mask=0x%x\n", grabbed_events_mask);\r
-#endif//__DEBUG_GESTURE_EXT__\r
-               grabbed_events_mask = grabbed_events_mask & ~(1<< stuff->eventType);\r
-#ifdef __DEBUG_GESTURE_EXT__\r
-               ErrorF("[X11][ProcGestureUngrabEvent][after] grabbed_events_mask=0x%x\n", grabbed_events_mask);\r
-#endif//__DEBUG_GESTURE_EXT__\r
-       }       \r
-       rep.status = GestureUngrabSuccess;\r
-    }\r
-\r
-    if( rep.status == GestureUngrabNotGrabbed )\r
-    {\r
-       ErrorF("[X11][ProcGestureUngrabEvent] No event(s) were grabbed by window(0x%x) !\n", stuff->window);\r
-       ret = BadAccess;\r
-       goto ungrab_failed;\r
-    }\r
-\r
-    //rep.status == GestureUngrabSuccess )\r
-#ifdef __DEBUG_GESTURE_EXT__\r
-    ErrorF("[X11][ProcGestureUngrabEvent] Event(s) were grabbed by window(0x%x) exist !\n", stuff->window);\r
-#endif//__DEBUG_GESTURE_EXT__\r
-\r
-    access_mode |= DixReceiveAccess;\r
-    rc = dixLookupWindow(&pWin, stuff->window, client, access_mode);\r
-    if( rc != Success || !pWin )\r
-    {\r
-        ErrorF("[X11][ProcGestureUngrabEvent] Failed to lookup window !\n");\r
-        rep.status = GestureUngrabAbnormal;\r
-        ret = BadWindow;\r
-        goto ungrab_failed;\r
-    }\r
+
+#ifdef __DEBUG_GESTURE_EXT__
+    ErrorF("[X11][ProcGestureGrabEvent][after] grabbed_events_mask=0x%x\n", grabbed_events_mask);
+#endif//__DEBUG_GESTURE_EXT__
+
+    rep.status = GestureGrabSuccess;
+
+    if (client->swapped)
+    {
+        swaps(&rep.sequenceNumber);
+        swapl(&rep.length);
+    }
+    WriteToClient(client, sizeof(xGestureGrabEventReply), (char *)&rep);
+
+#ifdef __DEBUG_GESTURE_EXT__
+    ErrorF("[X11][ProcGestureGrabEvent] Success !\n");
+#endif//__DEBUG_GESTURE_EXT__
+
+    return Success;
+
+grab_failed:
+
+    if (client->swapped)
+    {
+        swaps(&rep.sequenceNumber);
+        swapl(&rep.length);
+    }
+
+    WriteToClient(client, sizeof(xGestureGrabEventReply), (char *)&rep);
+
+#ifdef __DEBUG_GESTURE_EXT__
+    ErrorF("[X11][ProcGestureGrabEvent] Failed !\n");
+#endif//__DEBUG_GESTURE_EXT__
+
+    return ret;
+}
+
+static int
+SProcGestureUngrabEvent(register ClientPtr client)
+{
+    register int n;
+    REQUEST(xGestureUngrabEventReq);
+    swaps(&stuff->length);
+    swapl(&stuff->window);
+    swapl(&stuff->eventType);
+    //swapl(&stuff->num_finger);
+    swapl(&stuff->time);
+    return ProcGestureUngrabEvent(client);
+}
+
+static int
+ProcGestureUngrabEvent (register ClientPtr client)
+{
+    register int n;
+    int i, none_win_count, rc, ret = Success;
+    TimeStamp ctime;
+    WindowPtr pWin;
+    Mask eventmask;
+    Mask access_mode = 0;
+    GestureWindowPrivatePtr pPriv;
+    xGestureUngrabEventReply rep;
+
+    REQUEST(xGestureUngrabEventReq);
+    REQUEST_SIZE_MATCH (xGestureUngrabEventReq);
+
+    eventmask = (1L << stuff->eventType);
+
+#ifdef __DEBUG_GESTURE_EXT__
+    ErrorF("[X11][ProcGestureUngrabEvent] after REQUEST_SIZE_MATCH !\n");
+#endif//__DEBUG_GESTURE_EXT__
+
+    //prepare to reply
+    rep.type = X_Reply;
+    rep.length = 0;
+    rep.sequenceNumber = client->sequence;
+    rep.status = GestureUngrabNotGrabbed;
+
+    if( stuff->eventType >= GestureNumberEvents )
+    {
+       ErrorF("[X11][ProcGestureUngrabEvent] GestureGrabAbnormal !(eventType(%d) >= GestureNumberEvents(%d))\n", stuff->eventType, (int)GestureNumberEvents);
+       rep.status = GestureUngrabAbnormal;
+       ret = BadValue;
+       goto ungrab_failed;
+    }
+
+    if( stuff->num_finger >= max_num_finger )
+    {
+       ErrorF("[X11][ProcGestureUngrabEvent] GestureGrabAbnormal !(num_finger(%d) >= max num finger(%d))\n", stuff->num_finger, max_num_finger);
+       rep.status = GestureUngrabAbnormal;
+       ret = BadValue;
+       goto ungrab_failed;
+    }
+
+    ctime = ClientTimeToServerTime((CARD32)stuff->time);
+#if 1
+    if ( CompareTimeStamps(ctime, currentTime) == LATER )
+#else
+    if ( (CompareTimeStamps(ctime, currentTime) == LATER ) ||
+    (CompareTimeStamps(ctime, grabInfo->grabTime) == EARLIER) )
+#endif
+    {
+       ErrorF("[X11][ProcGestureUngrabEvent] GestureGrabInvalidTime !(ctime=%d, currentTime=%d)\n", ctime, currentTime);
+       rep.status = GestureGrabInvalidTime;
+       ret = BadAccess;
+       goto ungrab_failed;
+    }
+
+    if( grabbed_events_mask & eventmask )
+    {
+       if( grabbed_events[stuff->eventType].pGestureGrabWinInfo[stuff->num_finger].window == stuff->window )
+       {
+               grabbed_events[stuff->eventType].pGestureGrabWinInfo[stuff->num_finger].window = None;
+               grabbed_events[stuff->eventType].pGestureGrabWinInfo[stuff->num_finger].pWin = NULL;
+       }
+
+       none_win_count = 0;
+       for( i = 0 ; i < max_num_finger ; i++ )
+       {
+               if( None == grabbed_events[stuff->eventType].pGestureGrabWinInfo[i].window )
+               {
+                       none_win_count++;
+               }
+       }
+
+       if( none_win_count == max_num_finger )
+       {
+#ifdef __DEBUG_GESTURE_EXT__
+               ErrorF("[X11][ProcGestureUngrabEvent][before] grabbed_events_mask=0x%x\n", grabbed_events_mask);
+#endif//__DEBUG_GESTURE_EXT__
+               grabbed_events_mask = grabbed_events_mask & ~(1<< stuff->eventType);
+#ifdef __DEBUG_GESTURE_EXT__
+               ErrorF("[X11][ProcGestureUngrabEvent][after] grabbed_events_mask=0x%x\n", grabbed_events_mask);
+#endif//__DEBUG_GESTURE_EXT__
+       }
+       rep.status = GestureUngrabSuccess;
+    }
+
+    if( rep.status == GestureUngrabNotGrabbed )
+    {
+       ErrorF("[X11][ProcGestureUngrabEvent] No event(s) were grabbed by window(0x%x) !\n", stuff->window);
+       ret = BadAccess;
+       goto ungrab_failed;
+    }
+
+    //rep.status == GestureUngrabSuccess )
+#ifdef __DEBUG_GESTURE_EXT__
+    ErrorF("[X11][ProcGestureUngrabEvent] Event(s) were grabbed by window(0x%x) exist !\n", stuff->window);
+#endif//__DEBUG_GESTURE_EXT__
+
+    access_mode |= DixReceiveAccess;
+    rc = dixLookupWindow(&pWin, stuff->window, client, access_mode);
+    if( rc != Success || !pWin )
+    {
+        ErrorF("[X11][ProcGestureUngrabEvent] Failed to lookup window !\n");
+        rep.status = GestureUngrabAbnormal;
+        ret = BadWindow;
+        goto ungrab_failed;
+    }
 
     if(gpGestureEventsGrabbed)
     {
         gpGestureEventsGrabbed(&grabbed_events_mask, &grabbed_events);
-    }\r
-\r
-#ifdef __DEBUG_GESTURE_EXT__\r
-    ErrorF("[X11][ProcGestureUngrabEvent] pWin->drawable.id=0x%x\n", pWin->drawable.id);\r
-#endif//__DEBUG_GESTURE_EXT__\r
-\r
-    rep.status = GestureUngrabSuccess;\r
-\r
-    if (client->swapped)\r
-    {\r
-        swaps(&rep.sequenceNumber);\r
-        swapl(&rep.length);\r
-    }\r
-    WriteToClient(client, sizeof(xGestureUngrabEventReply), (char *)&rep);\r
-\r
-#ifdef __DEBUG_GESTURE_EXT__\r
-    ErrorF("[X11][ProcGestureUngrabEvent] Success !\n");\r
-#endif//__DEBUG_GESTURE_EXT__\r
-\r
-    return Success;\r
-\r
-ungrab_failed:\r
-\r
-    if (client->swapped)\r
-    {\r
-        swaps(&rep.sequenceNumber);\r
-        swapl(&rep.length);\r
-    }\r
-    WriteToClient(client, sizeof(xGestureUngrabEventReply), (char *)&rep);\r
-\r
-#ifdef __DEBUG_GESTURE_EXT__\r
-    ErrorF("[X11][ProcGestureUngrabEvent] Failed !\n");\r
-#endif//__DEBUG_GESTURE_EXT__\r
-\r
-    return ret;\r
-}\r
-\r
-/* dispatch */\r
-static int\r
-ProcGestureDispatch(register ClientPtr  client)\r
-{\r
-    REQUEST(xReq);\r
-\r
-    switch (stuff->data)\r
-    {\r
-           case X_GestureQueryVersion:\r
-               return ProcGestureQueryVersion(client);\r
-    }\r
-\r
-#ifdef _F_GESTURE_DENY_REMOTE_CLIENT_\r
-    if (!LocalClient(client))\r
-        return GestureErrorBase + GestureClientNotLocal;\r
-#endif//_F_GESTURE_DENY_REMOTE_CLIENT_\r
-\r
-    switch (stuff->data)\r
-    {\r
-           case X_GestureSelectEvents:\r
-               return ProcGestureSelectEvents(client);\r
-           case X_GestureGetSelectedEvents:\r
-               return ProcGestureGetSelectedEvents(client);\r
-           case X_GestureGrabEvent:\r
-               return ProcGestureGrabEvent(client);\r
-           case X_GestureUngrabEvent:\r
-               return ProcGestureUngrabEvent(client);\r
-           default:\r
-               return BadRequest;\r
-    }\r
-}\r
-\r
-\r
-static int\r
-SProcGestureDispatch (register ClientPtr  client)\r
-{\r
-    REQUEST(xReq);\r
-\r
-    switch (stuff->data)\r
-    {\r
-    case X_GestureQueryVersion:\r
-        return SProcGestureQueryVersion(client);\r
-    }\r
-\r
-#ifdef _F_GESTURE_DENY_REMOTE_CLIENT_\r
-    /* It is bound to be non-local when there is byte swapping */\r
-    if (!LocalClient(client))\r
-        return GestureErrorBase + GestureClientNotLocal;\r
-#endif//_F_GESTURE_DENY_REMOTE_CLIENT_\r
-\r
-    /* only local clients are allowed Gesture access */\r
-    switch (stuff->data)\r
-    {\r
-    case X_GestureSelectEvents:\r
-        return SProcGestureSelectEvents(client);\r
-    case X_GestureGetSelectedEvents:\r
-        return SProcGestureGetSelectedEvents(client);\r
-    case X_GestureGrabEvent:\r
-        return SProcGestureGrabEvent(client);\r
-    case X_GestureUngrabEvent:\r
-        return SProcGestureUngrabEvent(client);\r
-    default:\r
-        return BadRequest;\r
-    }\r
-}\r
-\r
+    }
+
+#ifdef __DEBUG_GESTURE_EXT__
+    ErrorF("[X11][ProcGestureUngrabEvent] pWin->drawable.id=0x%x\n", pWin->drawable.id);
+#endif//__DEBUG_GESTURE_EXT__
+
+    rep.status = GestureUngrabSuccess;
+
+    if (client->swapped)
+    {
+        swaps(&rep.sequenceNumber);
+        swapl(&rep.length);
+    }
+    WriteToClient(client, sizeof(xGestureUngrabEventReply), (char *)&rep);
+
+#ifdef __DEBUG_GESTURE_EXT__
+    ErrorF("[X11][ProcGestureUngrabEvent] Success !\n");
+#endif//__DEBUG_GESTURE_EXT__
+
+    return Success;
+
+ungrab_failed:
+
+    if (client->swapped)
+    {
+        swaps(&rep.sequenceNumber);
+        swapl(&rep.length);
+    }
+    WriteToClient(client, sizeof(xGestureUngrabEventReply), (char *)&rep);
+
+#ifdef __DEBUG_GESTURE_EXT__
+    ErrorF("[X11][ProcGestureUngrabEvent] Failed !\n");
+#endif//__DEBUG_GESTURE_EXT__
+
+    return ret;
+}
+
+/* dispatch */
+static int
+ProcGestureDispatch(register ClientPtr  client)
+{
+    REQUEST(xReq);
+
+    switch (stuff->data)
+    {
+           case X_GestureQueryVersion:
+               return ProcGestureQueryVersion(client);
+    }
+
+#ifdef _F_GESTURE_DENY_REMOTE_CLIENT_
+    if (!LocalClient(client))
+        return GestureErrorBase + GestureClientNotLocal;
+#endif//_F_GESTURE_DENY_REMOTE_CLIENT_
+
+    switch (stuff->data)
+    {
+           case X_GestureSelectEvents:
+               return ProcGestureSelectEvents(client);
+           case X_GestureGetSelectedEvents:
+               return ProcGestureGetSelectedEvents(client);
+           case X_GestureGrabEvent:
+               return ProcGestureGrabEvent(client);
+           case X_GestureUngrabEvent:
+               return ProcGestureUngrabEvent(client);
+           default:
+               return BadRequest;
+    }
+}
+
+
+static int
+SProcGestureDispatch (register ClientPtr  client)
+{
+    REQUEST(xReq);
+
+    switch (stuff->data)
+    {
+    case X_GestureQueryVersion:
+        return SProcGestureQueryVersion(client);
+    }
+
+#ifdef _F_GESTURE_DENY_REMOTE_CLIENT_
+    /* It is bound to be non-local when there is byte swapping */
+    if (!LocalClient(client))
+        return GestureErrorBase + GestureClientNotLocal;
+#endif//_F_GESTURE_DENY_REMOTE_CLIENT_
+
+    /* only local clients are allowed Gesture access */
+    switch (stuff->data)
+    {
+    case X_GestureSelectEvents:
+        return SProcGestureSelectEvents(client);
+    case X_GestureGetSelectedEvents:
+        return SProcGestureGetSelectedEvents(client);
+    case X_GestureGrabEvent:
+        return SProcGestureGrabEvent(client);
+    case X_GestureUngrabEvent:
+        return SProcGestureUngrabEvent(client);
+    default:
+        return BadRequest;
+    }
+}
+
diff --git a/glamor/Makefile.am b/glamor/Makefile.am
new file mode 100644 (file)
index 0000000..bde58b6
--- /dev/null
@@ -0,0 +1,53 @@
+noinst_LTLIBRARIES = libglamor.la libglamor_egl_stubs.la
+
+libglamor_la_LIBADD = $(GLAMOR_LIBS)
+
+AM_CFLAGS = $(CWARNFLAGS) $(DIX_CFLAGS) $(GLAMOR_CFLAGS)
+
+libglamor_la_SOURCES = \
+       glamor.c \
+       glamor_context.h \
+       glamor_copyarea.c \
+       glamor_copywindow.c \
+       glamor_core.c \
+       glamor_debug.h \
+       glamor_fill.c \
+       glamor_font.c \
+       glamor_font.h \
+       glamor_glx.c \
+       glamor_glyphs.c \
+       glamor_polylines.c \
+       glamor_segment.c \
+       glamor_image.c \
+       glamor_render.c \
+       glamor_gradient.c \
+       glamor_program.c \
+       glamor_program.h \
+       glamor_rects.c \
+       glamor_spans.c \
+       glamor_text.c \
+       glamor_transfer.c \
+       glamor_transfer.h \
+       glamor_transform.c \
+       glamor_transform.h \
+       glamor_trapezoid.c \
+       glamor_tile.c \
+       glamor_triangles.c\
+       glamor_addtraps.c\
+       glamor_copyplane.c\
+       glamor_glyphblt.c\
+       glamor_points.c\
+       glamor_priv.h\
+       glamor_pixmap.c\
+       glamor_largepixmap.c\
+       glamor_picture.c\
+       glamor_vbo.c \
+       glamor_window.c\
+       glamor_fbo.c\
+       glamor_compositerects.c\
+       glamor_utils.h\
+       glamor.h
+
+libglamor_egl_stubs_la_SOURCES = glamor_egl_stubs.c
+
+sdk_HEADERS = glamor.h
diff --git a/glamor/glamor.c b/glamor/glamor.c
new file mode 100644 (file)
index 0000000..3588903
--- /dev/null
@@ -0,0 +1,699 @@
+/*
+ * Copyright Â© 2008 Intel 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.
+ *
+ * Authors:
+ *    Eric Anholt <eric@anholt.net>
+ *    Zhigang Gong <zhigang.gong@linux.intel.com>
+ *
+ */
+
+/** @file glamor.c
+ * This file covers the initialization and teardown of glamor, and has various
+ * functions not responsible for performing rendering.
+ */
+
+#include <stdlib.h>
+
+#include "glamor_priv.h"
+
+static DevPrivateKeyRec glamor_screen_private_key_index;
+DevPrivateKey glamor_screen_private_key = &glamor_screen_private_key_index;
+static DevPrivateKeyRec glamor_pixmap_private_key_index;
+DevPrivateKey glamor_pixmap_private_key = &glamor_pixmap_private_key_index;
+
+/**
+ * glamor_get_drawable_pixmap() returns a backing pixmap for a given drawable.
+ *
+ * @param drawable the drawable being requested.
+ *
+ * This function returns the backing pixmap for a drawable, whether it is a
+ * redirected window, unredirected window, or already a pixmap.  Note that
+ * coordinate translation is needed when drawing to the backing pixmap of a
+ * redirected window, and the translation coordinates are provided by calling
+ * exaGetOffscreenPixmap() on the drawable.
+ */
+PixmapPtr
+glamor_get_drawable_pixmap(DrawablePtr drawable)
+{
+    if (drawable->type == DRAWABLE_WINDOW)
+        return drawable->pScreen->GetWindowPixmap((WindowPtr) drawable);
+    else
+        return (PixmapPtr) drawable;
+}
+
+_X_EXPORT void
+glamor_set_pixmap_type(PixmapPtr pixmap, glamor_pixmap_type_t type)
+{
+    glamor_pixmap_private *pixmap_priv;
+    glamor_screen_private *glamor_priv =
+        glamor_get_screen_private(pixmap->drawable.pScreen);
+
+    pixmap_priv = dixLookupPrivate(&pixmap->devPrivates,
+                                   glamor_pixmap_private_key);
+    if (pixmap_priv == NULL) {
+        pixmap_priv = calloc(sizeof(*pixmap_priv), 1);
+        glamor_set_pixmap_private(pixmap, pixmap_priv);
+        pixmap_priv->base.pixmap = pixmap;
+        pixmap_priv->base.glamor_priv = glamor_priv;
+    }
+    pixmap_priv->type = type;
+    pixmap_priv->base.box.x1 = 0;
+    pixmap_priv->base.box.x2 = pixmap->drawable.width;
+    pixmap_priv->base.box.y1 = 0;
+    pixmap_priv->base.box.y2 = pixmap->drawable.height;
+}
+
+_X_EXPORT void
+glamor_set_pixmap_texture(PixmapPtr pixmap, unsigned int tex)
+{
+    ScreenPtr screen = pixmap->drawable.pScreen;
+    glamor_pixmap_private *pixmap_priv;
+    glamor_screen_private *glamor_priv;
+    glamor_pixmap_fbo *fbo;
+    GLenum format;
+
+    glamor_priv = glamor_get_screen_private(screen);
+    pixmap_priv = glamor_get_pixmap_private(pixmap);
+
+    if (pixmap_priv->base.fbo) {
+        fbo = glamor_pixmap_detach_fbo(pixmap_priv);
+        glamor_destroy_fbo(fbo);
+    }
+
+    format = gl_iformat_for_pixmap(pixmap);
+    fbo = glamor_create_fbo_from_tex(glamor_priv, pixmap->drawable.width,
+                                     pixmap->drawable.height, format, tex, 0);
+
+    if (fbo == NULL) {
+        ErrorF("XXX fail to create fbo.\n");
+        return;
+    }
+
+    glamor_pixmap_attach_fbo(pixmap, fbo);
+}
+
+void
+glamor_set_screen_pixmap(PixmapPtr screen_pixmap, PixmapPtr *back_pixmap)
+{
+    glamor_pixmap_private *pixmap_priv;
+    glamor_screen_private *glamor_priv;
+
+    glamor_priv = glamor_get_screen_private(screen_pixmap->drawable.pScreen);
+    pixmap_priv = glamor_get_pixmap_private(screen_pixmap);
+    glamor_priv->screen_fbo = pixmap_priv->base.fbo->fb;
+
+    pixmap_priv->base.fbo->width = screen_pixmap->drawable.width;
+    pixmap_priv->base.fbo->height = screen_pixmap->drawable.height;
+
+    glamor_priv->back_pixmap = back_pixmap;
+}
+
+uint32_t
+glamor_get_pixmap_texture(PixmapPtr pixmap)
+{
+    glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap);
+
+    if (pixmap_priv->type != GLAMOR_TEXTURE_ONLY)
+        return 0;
+
+    return pixmap_priv->base.fbo->tex;
+}
+
+PixmapPtr
+glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth,
+                     unsigned int usage)
+{
+    PixmapPtr pixmap;
+    glamor_pixmap_type_t type = GLAMOR_TEXTURE_ONLY;
+    glamor_pixmap_private *pixmap_priv;
+    glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
+    glamor_pixmap_fbo *fbo = NULL;
+    int pitch;
+    GLenum format;
+
+    if (w > 32767 || h > 32767)
+        return NullPixmap;
+
+    if ((usage == GLAMOR_CREATE_PIXMAP_CPU
+         || (usage == CREATE_PIXMAP_USAGE_GLYPH_PICTURE && w <= 64 && h <= 64)
+         || (w == 0 && h == 0)
+         || !glamor_check_pixmap_fbo_depth(depth))
+        || (!GLAMOR_TEXTURED_LARGE_PIXMAP &&
+            !glamor_check_fbo_size(glamor_priv, w, h)))
+        return fbCreatePixmap(screen, w, h, depth, usage);
+    else
+        pixmap = fbCreatePixmap(screen, 0, 0, depth, usage);
+
+    pixmap_priv = calloc(1, sizeof(*pixmap_priv));
+
+    if (!pixmap_priv) {
+        fbDestroyPixmap(pixmap);
+        return fbCreatePixmap(screen, w, h, depth, usage);
+    }
+    glamor_set_pixmap_private(pixmap, pixmap_priv);
+
+    if (usage == GLAMOR_CREATE_PIXMAP_MAP)
+        type = GLAMOR_MEMORY_MAP;
+
+    pixmap_priv->base.pixmap = pixmap;
+    pixmap_priv->base.glamor_priv = glamor_priv;
+
+    format = gl_iformat_for_pixmap(pixmap);
+
+    pitch = (((w * pixmap->drawable.bitsPerPixel + 7) / 8) + 3) & ~3;
+    screen->ModifyPixmapHeader(pixmap, w, h, 0, 0, pitch, NULL);
+
+    if (usage == GLAMOR_CREATE_PIXMAP_NO_TEXTURE) {
+        pixmap_priv->type = GLAMOR_TEXTURE_ONLY;
+        pixmap_priv->base.box.x1 = 0;
+        pixmap_priv->base.box.y1 = 0;
+        pixmap_priv->base.box.x2 = w;
+        pixmap_priv->base.box.y2 = h;
+        return pixmap;
+    }
+    else if (type == GLAMOR_MEMORY_MAP || usage == GLAMOR_CREATE_NO_LARGE ||
+        glamor_check_fbo_size(glamor_priv, w, h))
+    {
+        pixmap_priv->type = type;
+        pixmap_priv->base.box.x1 = 0;
+        pixmap_priv->base.box.y1 = 0;
+        pixmap_priv->base.box.x2 = w;
+        pixmap_priv->base.box.y2 = h;
+        fbo = glamor_create_fbo(glamor_priv, w, h, format, usage);
+    } else {
+        int tile_size = glamor_priv->max_fbo_size;
+        DEBUGF("Create LARGE pixmap %p width %d height %d, tile size %d\n", pixmap, w, h, tile_size);
+        pixmap_priv->type = GLAMOR_TEXTURE_LARGE;
+        fbo = glamor_create_fbo_array(glamor_priv, w, h, format, usage,
+                                      tile_size, tile_size, pixmap_priv);
+    }
+
+    if (fbo == NULL) {
+        fbDestroyPixmap(pixmap);
+        free(pixmap_priv);
+        return fbCreatePixmap(screen, w, h, depth, usage);
+    }
+
+    glamor_pixmap_attach_fbo(pixmap, fbo);
+
+    return pixmap;
+}
+
+void
+glamor_destroy_textured_pixmap(PixmapPtr pixmap)
+{
+    if (pixmap->refcnt == 1) {
+        glamor_pixmap_private *pixmap_priv;
+
+        pixmap_priv = glamor_get_pixmap_private(pixmap);
+        if (pixmap_priv != NULL)
+            glamor_pixmap_destroy_fbo(pixmap_priv);
+    }
+}
+
+Bool
+glamor_destroy_pixmap(PixmapPtr pixmap)
+{
+    glamor_screen_private
+        *glamor_priv = glamor_get_screen_private(pixmap->drawable.pScreen);
+    if (glamor_priv->dri3_enabled)
+        glamor_egl_destroy_textured_pixmap(pixmap);
+    else
+        glamor_destroy_textured_pixmap(pixmap);
+    return fbDestroyPixmap(pixmap);
+}
+
+void
+glamor_block_handler(ScreenPtr screen)
+{
+    glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
+
+    glamor_make_current(glamor_priv);
+    glamor_priv->tick++;
+    glFlush();
+    glamor_fbo_expire(glamor_priv);
+    if (glamor_priv->state == RENDER_STATE
+        && glamor_priv->render_idle_cnt++ > RENDER_IDEL_MAX) {
+        glamor_priv->state = IDLE_STATE;
+        glamor_priv->render_idle_cnt = 0;
+    }
+}
+
+static void
+_glamor_block_handler(void *data, OSTimePtr timeout, void *last_select_mask)
+{
+    glamor_screen_private *glamor_priv = data;
+
+    glamor_make_current(glamor_priv);
+    glFlush();
+}
+
+static void
+_glamor_wakeup_handler(void *data, int result, void *last_select_mask)
+{
+}
+
+static void
+glamor_set_debug_level(int *debug_level)
+{
+    char *debug_level_string;
+
+    debug_level_string = getenv("GLAMOR_DEBUG");
+    if (debug_level_string
+        && sscanf(debug_level_string, "%d", debug_level) == 1)
+        return;
+    *debug_level = 0;
+}
+
+int glamor_debug_level;
+
+/**
+ * Creates any pixmaps used internally by glamor, since those can't be
+ * allocated at ScreenInit time.
+ */
+static Bool
+glamor_create_screen_resources(ScreenPtr screen)
+{
+    glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
+    Bool ret = TRUE;
+
+    screen->CreateScreenResources =
+        glamor_priv->saved_procs.create_screen_resources;
+    if (screen->CreateScreenResources)
+        ret = screen->CreateScreenResources(screen);
+    screen->CreateScreenResources = glamor_create_screen_resources;
+
+    if (!glamor_realize_glyph_caches(screen)) {
+        ErrorF("Failed to initialize glyph cache\n");
+        ret = FALSE;
+    }
+
+    return ret;
+}
+
+/** Set up glamor for an already-configured GL context. */
+Bool
+glamor_init(ScreenPtr screen, unsigned int flags)
+{
+    glamor_screen_private *glamor_priv;
+    int gl_version;
+    int max_viewport_size[2];
+
+#ifdef RENDER
+    PictureScreenPtr ps = GetPictureScreenIfSet(screen);
+#endif
+    if (flags & ~GLAMOR_VALID_FLAGS) {
+        ErrorF("glamor_init: Invalid flags %x\n", flags);
+        return FALSE;
+    }
+    glamor_priv = calloc(1, sizeof(*glamor_priv));
+    if (glamor_priv == NULL)
+        return FALSE;
+
+    glamor_priv->flags = flags;
+    if (flags & GLAMOR_INVERTED_Y_AXIS) {
+        glamor_priv->yInverted = TRUE;
+    }
+    else
+        glamor_priv->yInverted = FALSE;
+
+    if (!dixRegisterPrivateKey(glamor_screen_private_key, PRIVATE_SCREEN, 0)) {
+        LogMessage(X_WARNING,
+                   "glamor%d: Failed to allocate screen private\n",
+                   screen->myNum);
+        goto fail;
+    }
+
+    glamor_set_screen_private(screen, glamor_priv);
+
+    if (!dixRegisterPrivateKey(glamor_pixmap_private_key, PRIVATE_PIXMAP, 0)) {
+        LogMessage(X_WARNING,
+                   "glamor%d: Failed to allocate pixmap private\n",
+                   screen->myNum);
+        goto fail;;
+    }
+
+    if (epoxy_is_desktop_gl())
+        glamor_priv->gl_flavor = GLAMOR_GL_DESKTOP;
+    else
+        glamor_priv->gl_flavor = GLAMOR_GL_ES2;
+
+    gl_version = epoxy_gl_version();
+
+    /* Would be nice to have a cleaner test for GLSL 1.30 support,
+     * but for now this should suffice
+     */
+    if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP && gl_version >= 30)
+        glamor_priv->glsl_version = 130;
+    else
+        glamor_priv->glsl_version = 120;
+
+
+    /* We'd like to require GL_ARB_map_buffer_range or
+     * GL_OES_map_buffer_range, since it offers more information to
+     * the driver than plain old glMapBuffer() or glBufferSubData().
+     * It's been supported on Mesa on the desktop since 2009 and on
+     * GLES2 since October 2012.  It's supported on Apple's iOS
+     * drivers for SGX535 and A7, but apparently not on most Android
+     * devices (the OES extension spec wasn't released until June
+     * 2012).
+     *
+     * 82% of 0 A.D. players (desktop GL) submitting hardware reports
+     * have support for it, with most of the ones lacking it being on
+     * Windows with Intel 4-series (G45) graphics or older.
+     */
+    if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) {
+        if (gl_version < 21) {
+            ErrorF("Require OpenGL version 2.1 or later.\n");
+            goto fail;
+        }
+    } else {
+        if (gl_version < 20) {
+            ErrorF("Require Open GLES2.0 or later.\n");
+            goto fail;
+        }
+
+        if (!epoxy_has_gl_extension("GL_EXT_texture_format_BGRA8888")) {
+            ErrorF("GL_EXT_texture_format_BGRA8888 required\n");
+            goto fail;
+        }
+    }
+
+    glamor_priv->has_khr_debug = epoxy_has_gl_extension("GL_KHR_debug");
+    glamor_priv->has_pack_invert =
+        epoxy_has_gl_extension("GL_MESA_pack_invert");
+    glamor_priv->has_fbo_blit =
+        epoxy_has_gl_extension("GL_EXT_framebuffer_blit");
+    glamor_priv->has_map_buffer_range =
+        epoxy_has_gl_extension("GL_ARB_map_buffer_range");
+    glamor_priv->has_buffer_storage =
+        epoxy_has_gl_extension("GL_ARB_buffer_storage");
+    glGetIntegerv(GL_MAX_TEXTURE_SIZE, &glamor_priv->max_fbo_size);
+    glGetIntegerv(GL_MAX_VIEWPORT_DIMS, max_viewport_size);
+    glamor_priv->max_fbo_size = MIN(glamor_priv->max_fbo_size, max_viewport_size[0]);
+    glamor_priv->max_fbo_size = MIN(glamor_priv->max_fbo_size, max_viewport_size[1]);
+#ifdef MAX_FBO_SIZE
+    glamor_priv->max_fbo_size = MAX_FBO_SIZE;
+#endif
+
+    glamor_set_debug_level(&glamor_debug_level);
+
+    /* If we are using egl screen, call egl screen init to
+     * register correct close screen function. */
+    if (flags & GLAMOR_USE_EGL_SCREEN) {
+        glamor_egl_screen_init(screen, &glamor_priv->ctx);
+    } else {
+        if (!glamor_glx_screen_init(&glamor_priv->ctx))
+            goto fail;
+    }
+
+    glamor_priv->saved_procs.close_screen = screen->CloseScreen;
+    screen->CloseScreen = glamor_close_screen;
+
+    glamor_priv->saved_procs.create_screen_resources =
+        screen->CreateScreenResources;
+    screen->CreateScreenResources = glamor_create_screen_resources;
+
+    if (!glamor_font_init(screen))
+        goto fail;
+
+    if (flags & GLAMOR_USE_SCREEN) {
+        if (!RegisterBlockAndWakeupHandlers(_glamor_block_handler,
+                                            _glamor_wakeup_handler,
+                                            glamor_priv)) {
+            goto fail;
+        }
+
+        glamor_priv->saved_procs.create_gc = screen->CreateGC;
+        screen->CreateGC = glamor_create_gc;
+
+        glamor_priv->saved_procs.create_pixmap = screen->CreatePixmap;
+        screen->CreatePixmap = glamor_create_pixmap;
+
+        glamor_priv->saved_procs.destroy_pixmap = screen->DestroyPixmap;
+        screen->DestroyPixmap = glamor_destroy_pixmap;
+
+        glamor_priv->saved_procs.get_spans = screen->GetSpans;
+        screen->GetSpans = glamor_get_spans;
+
+        glamor_priv->saved_procs.get_image = screen->GetImage;
+        screen->GetImage = glamor_get_image;
+
+        glamor_priv->saved_procs.change_window_attributes =
+            screen->ChangeWindowAttributes;
+        screen->ChangeWindowAttributes = glamor_change_window_attributes;
+
+        glamor_priv->saved_procs.copy_window = screen->CopyWindow;
+        screen->CopyWindow = glamor_copy_window;
+
+        glamor_priv->saved_procs.bitmap_to_region = screen->BitmapToRegion;
+        screen->BitmapToRegion = glamor_bitmap_to_region;
+    }
+#ifdef RENDER
+    if (flags & GLAMOR_USE_PICTURE_SCREEN) {
+        glamor_priv->saved_procs.composite = ps->Composite;
+        ps->Composite = glamor_composite;
+
+        glamor_priv->saved_procs.trapezoids = ps->Trapezoids;
+        ps->Trapezoids = glamor_trapezoids;
+
+        glamor_priv->saved_procs.triangles = ps->Triangles;
+        ps->Triangles = glamor_triangles;
+
+        glamor_priv->saved_procs.addtraps = ps->AddTraps;
+        ps->AddTraps = glamor_add_traps;
+
+    }
+
+    glamor_priv->saved_procs.composite_rects = ps->CompositeRects;
+    ps->CompositeRects = glamor_composite_rectangles;
+
+    glamor_priv->saved_procs.glyphs = ps->Glyphs;
+    ps->Glyphs = glamor_glyphs;
+
+    glamor_priv->saved_procs.unrealize_glyph = ps->UnrealizeGlyph;
+    ps->UnrealizeGlyph = glamor_glyph_unrealize;
+
+    glamor_priv->saved_procs.create_picture = ps->CreatePicture;
+    ps->CreatePicture = glamor_create_picture;
+
+    glamor_priv->saved_procs.destroy_picture = ps->DestroyPicture;
+    ps->DestroyPicture = glamor_destroy_picture;
+    glamor_init_composite_shaders(screen);
+#endif
+    glamor_priv->saved_procs.set_window_pixmap = screen->SetWindowPixmap;
+    screen->SetWindowPixmap = glamor_set_window_pixmap;
+
+    glamor_init_vbo(screen);
+    glamor_init_pixmap_fbo(screen);
+    glamor_init_solid_shader(screen);
+    glamor_init_tile_shader(screen);
+#ifdef GLAMOR_TRAPEZOID_SHADER
+    glamor_init_trapezoid_shader(screen);
+#endif
+    glamor_init_finish_access_shaders(screen);
+#ifdef GLAMOR_GRADIENT_SHADER
+    glamor_init_gradient_shader(screen);
+#endif
+    glamor_pixmap_init(screen);
+    glamor_glyphs_init(screen);
+
+    glamor_priv->screen = screen;
+
+    return TRUE;
+
+ fail:
+    free(glamor_priv);
+    glamor_set_screen_private(screen, NULL);
+    return FALSE;
+}
+
+static void
+glamor_release_screen_priv(ScreenPtr screen)
+{
+    glamor_screen_private *glamor_priv;
+
+    glamor_priv = glamor_get_screen_private(screen);
+#ifdef RENDER
+    glamor_fini_composite_shaders(screen);
+#endif
+    glamor_fini_vbo(screen);
+    glamor_fini_pixmap_fbo(screen);
+    glamor_fini_solid_shader(screen);
+    glamor_fini_tile_shader(screen);
+#ifdef GLAMOR_TRAPEZOID_SHADER
+    glamor_fini_trapezoid_shader(screen);
+#endif
+    glamor_fini_finish_access_shaders(screen);
+#ifdef GLAMOR_GRADIENT_SHADER
+    glamor_fini_gradient_shader(screen);
+#endif
+    glamor_pixmap_fini(screen);
+    free(glamor_priv);
+
+    glamor_set_screen_private(screen, NULL);
+}
+
+_X_EXPORT void
+glamor_set_pixmap_private(PixmapPtr pixmap, glamor_pixmap_private *priv)
+{
+    glamor_pixmap_private *old_priv;
+    glamor_pixmap_fbo *fbo;
+
+    old_priv = dixGetPrivate(&pixmap->devPrivates, glamor_pixmap_private_key);
+
+    if (priv) {
+        assert(old_priv == NULL);
+    }
+    else {
+        if (old_priv == NULL)
+            return;
+        fbo = glamor_pixmap_detach_fbo(old_priv);
+        glamor_purge_fbo(fbo);
+        free(old_priv);
+    }
+
+    dixSetPrivate(&pixmap->devPrivates, glamor_pixmap_private_key, priv);
+}
+
+Bool
+glamor_close_screen(ScreenPtr screen)
+{
+    glamor_screen_private *glamor_priv;
+    PixmapPtr screen_pixmap;
+    int flags;
+
+#ifdef RENDER
+    PictureScreenPtr ps = GetPictureScreenIfSet(screen);
+#endif
+    glamor_priv = glamor_get_screen_private(screen);
+    flags = glamor_priv->flags;
+    glamor_glyphs_fini(screen);
+    screen->CloseScreen = glamor_priv->saved_procs.close_screen;
+    screen->CreateScreenResources =
+        glamor_priv->saved_procs.create_screen_resources;
+    if (flags & GLAMOR_USE_SCREEN) {
+
+        screen->CreateGC = glamor_priv->saved_procs.create_gc;
+        screen->CreatePixmap = glamor_priv->saved_procs.create_pixmap;
+        screen->DestroyPixmap = glamor_priv->saved_procs.destroy_pixmap;
+        screen->GetSpans = glamor_priv->saved_procs.get_spans;
+        screen->ChangeWindowAttributes =
+            glamor_priv->saved_procs.change_window_attributes;
+        screen->CopyWindow = glamor_priv->saved_procs.copy_window;
+        screen->BitmapToRegion = glamor_priv->saved_procs.bitmap_to_region;
+    }
+#ifdef RENDER
+    if (ps && (flags & GLAMOR_USE_PICTURE_SCREEN)) {
+
+        ps->Composite = glamor_priv->saved_procs.composite;
+        ps->Trapezoids = glamor_priv->saved_procs.trapezoids;
+        ps->Triangles = glamor_priv->saved_procs.triangles;
+        ps->CreatePicture = glamor_priv->saved_procs.create_picture;
+    }
+    ps->CompositeRects = glamor_priv->saved_procs.composite_rects;
+    ps->Glyphs = glamor_priv->saved_procs.glyphs;
+    ps->UnrealizeGlyph = glamor_priv->saved_procs.unrealize_glyph;
+    screen->SetWindowPixmap = glamor_priv->saved_procs.set_window_pixmap;
+#endif
+    screen_pixmap = screen->GetScreenPixmap(screen);
+    glamor_set_pixmap_private(screen_pixmap, NULL);
+    if (glamor_priv->back_pixmap && *glamor_priv->back_pixmap)
+        glamor_set_pixmap_private(*glamor_priv->back_pixmap, NULL);
+
+    glamor_release_screen_priv(screen);
+
+    return screen->CloseScreen(screen);
+}
+
+void
+glamor_fini(ScreenPtr screen)
+{
+    /* Do nothing currently. */
+}
+
+void
+glamor_enable_dri3(ScreenPtr screen)
+{
+    glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
+
+    glamor_priv->dri3_enabled = TRUE;
+}
+
+Bool
+glamor_supports_pixmap_import_export(ScreenPtr screen)
+{
+    glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
+
+    return glamor_priv->dri3_enabled;
+}
+
+_X_EXPORT int
+glamor_fd_from_pixmap(ScreenPtr screen,
+                      PixmapPtr pixmap, CARD16 *stride, CARD32 *size)
+{
+    glamor_pixmap_private *pixmap_priv;
+    glamor_screen_private *glamor_priv =
+        glamor_get_screen_private(pixmap->drawable.pScreen);
+
+    pixmap_priv = glamor_get_pixmap_private(pixmap);
+    if (pixmap_priv == NULL || !glamor_priv->dri3_enabled)
+        return -1;
+    switch (pixmap_priv->type) {
+    case GLAMOR_TEXTURE_DRM:
+    case GLAMOR_TEXTURE_ONLY:
+        if (!glamor_pixmap_ensure_fbo(pixmap, GL_RGBA, 0))
+            return -1;
+        return glamor_egl_dri3_fd_name_from_tex(screen,
+                                                pixmap,
+                                                pixmap_priv->base.fbo->tex,
+                                                FALSE, stride, size);
+    default:
+        break;
+    }
+    return -1;
+}
+
+int
+glamor_name_from_pixmap(PixmapPtr pixmap, CARD16 *stride, CARD32 *size)
+{
+    glamor_pixmap_private *pixmap_priv;
+    glamor_screen_private *glamor_priv =
+        glamor_get_screen_private(pixmap->drawable.pScreen);
+
+    pixmap_priv = glamor_get_pixmap_private(pixmap);
+    if (pixmap_priv == NULL || !glamor_priv->dri3_enabled)
+        return -1;
+    switch (pixmap_priv->type) {
+    case GLAMOR_TEXTURE_DRM:
+    case GLAMOR_TEXTURE_ONLY:
+        if (!glamor_pixmap_ensure_fbo(pixmap, GL_RGBA, 0))
+            return -1;
+        return glamor_egl_dri3_fd_name_from_tex(pixmap->drawable.pScreen,
+                                                pixmap,
+                                                pixmap_priv->base.fbo->tex,
+                                                TRUE, stride, size);
+    default:
+        break;
+    }
+    return -1;
+}
diff --git a/glamor/glamor.h b/glamor/glamor.h
new file mode 100644 (file)
index 0000000..b0f2212
--- /dev/null
@@ -0,0 +1,463 @@
+/*
+ * Copyright Â© 2008 Intel 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.
+ *
+ * Authors:
+ *    Eric Anholt <eric@anholt.net>
+ *    Zhigang Gong <zhigang.gong@linux.intel.com>
+ *
+ */
+
+#ifndef GLAMOR_H
+#define GLAMOR_H
+
+#include <scrnintstr.h>
+#include <pixmapstr.h>
+#include <gcstruct.h>
+#include <picturestr.h>
+#include <fb.h>
+#include <fbpict.h>
+#ifdef GLAMOR_FOR_XORG
+#include <xf86xv.h>
+#endif
+
+struct glamor_context;
+
+/*
+ * glamor_pixmap_type : glamor pixmap's type.
+ * @MEMORY: pixmap is in memory.
+ * @TEXTURE_DRM: pixmap is in a texture created from a DRM buffer.
+ * @SEPARATE_TEXTURE: The texture is created from a DRM buffer, but
+ *                   the format is incompatible, so this type of pixmap
+ *                   will never fallback to DDX layer.
+ * @DRM_ONLY: pixmap is in a external DRM buffer.
+ * @TEXTURE_ONLY: pixmap is in an internal texture.
+ */
+typedef enum glamor_pixmap_type {
+    GLAMOR_MEMORY,
+    GLAMOR_MEMORY_MAP,
+    GLAMOR_TEXTURE_DRM,
+    GLAMOR_SEPARATE_TEXTURE,
+    GLAMOR_DRM_ONLY,
+    GLAMOR_TEXTURE_ONLY,
+    GLAMOR_TEXTURE_LARGE,
+    GLAMOR_TEXTURE_PACK
+} glamor_pixmap_type_t;
+
+#define GLAMOR_EGL_EXTERNAL_BUFFER 3
+#define GLAMOR_INVERTED_Y_AXIS         1
+#define GLAMOR_USE_SCREEN              (1 << 1)
+#define GLAMOR_USE_PICTURE_SCREEN      (1 << 2)
+#define GLAMOR_USE_EGL_SCREEN          (1 << 3)
+#define GLAMOR_NO_DRI3                 (1 << 4)
+#define GLAMOR_VALID_FLAGS      (GLAMOR_INVERTED_Y_AXIS                \
+                                | GLAMOR_USE_SCREEN                    \
+                                 | GLAMOR_USE_PICTURE_SCREEN           \
+                                | GLAMOR_USE_EGL_SCREEN                \
+                                 | GLAMOR_NO_DRI3)
+
+/* @glamor_init: Initialize glamor internal data structure.
+ *
+ * @screen: Current screen pointer.
+ * @flags:  Please refer the flags description above.
+ *
+ *     @GLAMOR_INVERTED_Y_AXIS:
+ *     set 1 means the GL env's origin (0,0) is at top-left.
+ *     EGL/DRM platform is an example need to set this bit.
+ *     glx platform's origin is at bottom-left thus need to
+ *     clear this bit.
+ *
+ *     @GLAMOR_USE_SCREEN:
+ *     If running in an pre-existing X environment, and the
+ *     gl context is GLX, then you should set this bit and
+ *     let the glamor to handle all the screen related
+ *     functions such as GC ops and CreatePixmap/DestroyPixmap.
+ *
+ *     @GLAMOR_USE_PICTURE_SCREEN:
+ *     If don't use any other underlying DDX driver to handle
+ *     the picture related rendering functions, please set this
+ *     bit on. Otherwise, clear this bit. And then it is the DDX
+ *     driver's responsibility to determine how/when to jump to
+ *     glamor's picture compositing path.
+ *
+ *     @GLAMOR_USE_EGL_SCREEN:
+ *     If you are using EGL layer, then please set this bit
+ *     on, otherwise, clear it.
+ *
+ * This function initializes necessary internal data structure
+ * for glamor. And before calling into this function, the OpenGL
+ * environment should be ready. Should be called before any real
+ * glamor rendering or texture allocation functions. And should
+ * be called after the DDX's screen initialization or at the last
+ * step of the DDX's screen initialization.
+ */
+extern _X_EXPORT Bool glamor_init(ScreenPtr screen, unsigned int flags);
+extern _X_EXPORT void glamor_fini(ScreenPtr screen);
+
+/* This function is used to free the glamor private screen's
+ * resources. If the DDX driver is not set GLAMOR_USE_SCREEN,
+ * then, DDX need to call this function at proper stage, if
+ * it is the xorg DDX driver,then it should be called at free
+ * screen stage not the close screen stage. The reason is after
+ * call to this function, the xorg DDX may need to destroy the
+ * screen pixmap which must be a glamor pixmap and requires
+ * the internal data structure still exist at that time.
+ * Otherwise, the glamor internal structure will not be freed.*/
+extern _X_EXPORT Bool glamor_close_screen(ScreenPtr screen);
+
+/* Let glamor to know the screen's fbo. The low level
+ * driver should already assign a tex
+ * to this pixmap through the set_pixmap_texture. */
+extern _X_EXPORT void glamor_set_screen_pixmap(PixmapPtr screen_pixmap,
+                                               PixmapPtr *back_pixmap);
+
+extern _X_EXPORT uint32_t glamor_get_pixmap_texture(PixmapPtr pixmap);
+
+extern _X_EXPORT Bool glamor_glyphs_init(ScreenPtr pScreen);
+
+extern _X_EXPORT void glamor_set_pixmap_texture(PixmapPtr pixmap,
+                                                unsigned int tex);
+
+extern _X_EXPORT void glamor_set_pixmap_type(PixmapPtr pixmap,
+                                             glamor_pixmap_type_t type);
+extern _X_EXPORT void glamor_destroy_textured_pixmap(PixmapPtr pixmap);
+extern _X_EXPORT void glamor_block_handler(ScreenPtr screen);
+
+extern _X_EXPORT PixmapPtr glamor_create_pixmap(ScreenPtr screen, int w, int h,
+                                                int depth, unsigned int usage);
+extern _X_EXPORT Bool glamor_destroy_pixmap(PixmapPtr pixmap);
+
+#define GLAMOR_CREATE_PIXMAP_CPU        0x100
+#define GLAMOR_CREATE_PIXMAP_FIXUP      0x101
+#define GLAMOR_CREATE_FBO_NO_FBO        0x103
+#define GLAMOR_CREATE_PIXMAP_MAP        0x104
+#define GLAMOR_CREATE_NO_LARGE          0x105
+#define GLAMOR_CREATE_PIXMAP_NO_TEXTURE 0x106
+
+/* @glamor_egl_exchange_buffers: Exchange the underlying buffers(KHR image,fbo).
+ *
+ * @front: front pixmap.
+ * @back: back pixmap.
+ *
+ * Used by the DRI2 page flip. This function will exchange the KHR images and
+ * fbos of the two pixmaps.
+ * */
+extern _X_EXPORT void glamor_egl_exchange_buffers(PixmapPtr front,
+                                                  PixmapPtr back);
+
+extern _X_EXPORT void glamor_pixmap_exchange_fbos(PixmapPtr front,
+                                                  PixmapPtr back);
+
+/* The DDX is not supposed to call these three functions */
+extern _X_EXPORT void glamor_enable_dri3(ScreenPtr screen);
+extern _X_EXPORT unsigned int glamor_egl_create_argb8888_based_texture(ScreenPtr
+                                                                       screen,
+                                                                       int w,
+                                                                       int h);
+extern _X_EXPORT int glamor_egl_dri3_fd_name_from_tex(ScreenPtr, PixmapPtr,
+                                                      unsigned int, Bool,
+                                                      CARD16 *, CARD32 *);
+
+/* @glamor_supports_pixmap_import_export: Returns whether
+ * glamor_fd_from_pixmap(), glamor_name_from_pixmap(), and
+ * glamor_pixmap_from_fd() are supported.
+ *
+ * @screen: Current screen pointer.
+ *
+ * To have DRI3 support enabled, glamor and glamor_egl need to be
+ * initialized. glamor also has to be compiled with gbm support.
+ *
+ * The EGL layer needs to have the following extensions working:
+ *
+ * .EGL_KHR_gl_texture_2D_image
+ * .EGL_EXT_image_dma_buf_import
+ * */
+extern _X_EXPORT Bool glamor_supports_pixmap_import_export(ScreenPtr screen);
+
+/* @glamor_fd_from_pixmap: Get a dma-buf fd from a pixmap.
+ *
+ * @screen: Current screen pointer.
+ * @pixmap: The pixmap from which we want the fd.
+ * @stride, @size: Pointers to fill the stride and size of the
+ *                buffer associated to the fd.
+ *
+ * the pixmap and the buffer associated by the fd will share the same
+ * content.
+ * Returns the fd on success, -1 on error.
+ * */
+extern _X_EXPORT int glamor_fd_from_pixmap(ScreenPtr screen,
+                                           PixmapPtr pixmap,
+                                           CARD16 *stride, CARD32 *size);
+
+/**
+ * @glamor_name_from_pixmap: Gets a gem name from a pixmap.
+ *
+ * @pixmap: The pixmap from which we want the gem name.
+ *
+ * the pixmap and the buffer associated by the gem name will share the
+ * same content. This function can be used by the DDX to support DRI2,
+ * and needs the same set of buffer export GL extensions as DRI3
+ * support.
+ *
+ * Returns the name on success, -1 on error.
+ * */
+extern _X_EXPORT int glamor_name_from_pixmap(PixmapPtr pixmap,
+                                             CARD16 *stride, CARD32 *size);
+
+/* @glamor_pixmap_from_fd: Creates a pixmap to wrap a dma-buf fd.
+ *
+ * @screen: Current screen pointer.
+ * @fd: The dma-buf fd to import.
+ * @width: The width of the buffer.
+ * @height: The height of the buffer.
+ * @stride: The stride of the buffer.
+ * @depth: The depth of the buffer.
+ * @bpp: The number of bpp of the buffer.
+ *
+ * Returns a valid pixmap if the import succeeded, else NULL.
+ * */
+extern _X_EXPORT PixmapPtr glamor_pixmap_from_fd(ScreenPtr screen,
+                                                 int fd,
+                                                 CARD16 width,
+                                                 CARD16 height,
+                                                 CARD16 stride,
+                                                 CARD8 depth,
+                                                 CARD8 bpp);
+
+#ifdef GLAMOR_FOR_XORG
+
+#define GLAMOR_EGL_MODULE_NAME  "glamoregl"
+
+/* @glamor_egl_init: Initialize EGL environment.
+ *
+ * @scrn: Current screen info pointer.
+ * @fd:   Current drm fd.
+ *
+ * This function creates and intialize EGL contexts.
+ * Should be called from DDX's preInit function.
+ * Return TRUE if success, otherwise return FALSE.
+ * */
+extern _X_EXPORT Bool glamor_egl_init(ScrnInfoPtr scrn, int fd);
+
+extern _X_EXPORT Bool glamor_egl_init_textured_pixmap(ScreenPtr screen);
+
+/* @glamor_egl_create_textured_screen: Create textured screen pixmap.
+ *
+ * @screen: screen pointer to be processed.
+ * @handle: screen pixmap's BO handle.
+ * @stride: screen pixmap's stride in bytes.
+ *
+ * This function is similar with the create_textured_pixmap. As the
+ * screen pixmap is a special, we handle it separately in this function.
+ */
+extern _X_EXPORT Bool glamor_egl_create_textured_screen(ScreenPtr screen,
+                                                        int handle, int stride);
+
+/* @glamor_egl_create_textured_screen_ext:
+ *
+ * extent one parameter to track the pointer of the DDX layer's back pixmap.
+ * We need this pointer during the closing screen stage. As before back to
+ * the DDX's close screen, we have to free all the glamor related resources.
+ */
+extern _X_EXPORT Bool glamor_egl_create_textured_screen_ext(ScreenPtr screen,
+                                                            int handle,
+                                                            int stride,
+                                                            PixmapPtr
+                                                            *back_pixmap);
+
+/*
+ * @glamor_egl_create_textured_pixmap: Try to create a textured pixmap from
+ *                                    a BO handle.
+ *
+ * @pixmap: The pixmap need to be processed.
+ * @handle: The BO's handle attached to this pixmap at DDX layer.
+ * @stride: Stride in bytes for this pixmap.
+ *
+ * This function try to create a texture from the handle and attach
+ * the texture to the pixmap , thus glamor can render to this pixmap
+ * as well. Return true if successful, otherwise return FALSE.
+ */
+extern _X_EXPORT Bool glamor_egl_create_textured_pixmap(PixmapPtr pixmap,
+                                                        int handle, int stride);
+
+/*
+ * @glamor_egl_create_textured_pixmap_from_bo: Try to create a textured pixmap
+ *                                            from a gbm_bo.
+ *
+ * @pixmap: The pixmap need to be processed.
+ * @bo: a pointer on a gbm_bo structure attached to this pixmap at DDX layer.
+ *
+ * This function is similar to glamor_egl_create_textured_pixmap.
+ */
+extern _X_EXPORT Bool
+ glamor_egl_create_textured_pixmap_from_gbm_bo(PixmapPtr pixmap, void *bo);
+
+#endif
+
+extern _X_EXPORT void glamor_egl_screen_init(ScreenPtr screen,
+                                             struct glamor_context *glamor_ctx);
+extern _X_EXPORT void glamor_egl_destroy_textured_pixmap(PixmapPtr pixmap);
+
+extern _X_EXPORT int glamor_create_gc(GCPtr gc);
+
+extern _X_EXPORT void glamor_validate_gc(GCPtr gc, unsigned long changes,
+                                         DrawablePtr drawable);
+
+extern Bool _X_EXPORT glamor_change_window_attributes(WindowPtr pWin, unsigned long mask);
+extern void _X_EXPORT glamor_copy_window(WindowPtr window, DDXPointRec old_origin, RegionPtr src_region);
+
+/* Glamor rendering/drawing functions with XXX_nf.
+ * nf means no fallback within glamor internal if possible. If glamor
+ * fail to accelerate the operation, glamor will return a false, and the
+ * caller need to implement fallback method. Return a true means the
+ * rendering request get done successfully. */
+extern _X_EXPORT Bool glamor_fill_spans_nf(DrawablePtr drawable,
+                                           GCPtr gc,
+                                           int n, DDXPointPtr points,
+                                           int *widths, int sorted);
+
+extern _X_EXPORT Bool glamor_poly_fill_rect_nf(DrawablePtr drawable,
+                                               GCPtr gc,
+                                               int nrect, xRectangle *prect);
+
+extern _X_EXPORT Bool glamor_put_image_nf(DrawablePtr drawable,
+                                          GCPtr gc, int depth, int x, int y,
+                                          int w, int h, int left_pad,
+                                          int image_format, char *bits);
+
+extern _X_EXPORT Bool glamor_copy_n_to_n_nf(DrawablePtr src,
+                                            DrawablePtr dst,
+                                            GCPtr gc,
+                                            BoxPtr box,
+                                            int nbox,
+                                            int dx,
+                                            int dy,
+                                            Bool reverse,
+                                            Bool upsidedown, Pixel bitplane,
+                                            void *closure);
+
+extern _X_EXPORT Bool glamor_composite_nf(CARD8 op,
+                                          PicturePtr source,
+                                          PicturePtr mask,
+                                          PicturePtr dest,
+                                          INT16 x_source,
+                                          INT16 y_source,
+                                          INT16 x_mask,
+                                          INT16 y_mask,
+                                          INT16 x_dest, INT16 y_dest,
+                                          CARD16 width, CARD16 height);
+
+extern _X_EXPORT Bool glamor_trapezoids_nf(CARD8 op,
+                                           PicturePtr src, PicturePtr dst,
+                                           PictFormatPtr mask_format,
+                                           INT16 x_src, INT16 y_src,
+                                           int ntrap, xTrapezoid *traps);
+
+extern _X_EXPORT Bool glamor_glyphs_nf(CARD8 op,
+                                       PicturePtr src,
+                                       PicturePtr dst,
+                                       PictFormatPtr mask_format,
+                                       INT16 x_src,
+                                       INT16 y_src, int nlist,
+                                       GlyphListPtr list, GlyphPtr *glyphs);
+
+extern _X_EXPORT Bool glamor_triangles_nf(CARD8 op,
+                                          PicturePtr pSrc,
+                                          PicturePtr pDst,
+                                          PictFormatPtr maskFormat,
+                                          INT16 xSrc, INT16 ySrc,
+                                          int ntris, xTriangle *tris);
+
+extern _X_EXPORT void glamor_glyph_unrealize(ScreenPtr screen, GlyphPtr glyph);
+
+extern _X_EXPORT Bool glamor_set_spans_nf(DrawablePtr drawable, GCPtr gc,
+                                          char *src, DDXPointPtr points,
+                                          int *widths, int n, int sorted);
+
+extern _X_EXPORT Bool glamor_get_spans_nf(DrawablePtr drawable, int wmax,
+                                          DDXPointPtr points, int *widths,
+                                          int count, char *dst);
+
+extern _X_EXPORT Bool glamor_composite_rects_nf(CARD8 op,
+                                                PicturePtr pDst,
+                                                xRenderColor *color,
+                                                int nRect, xRectangle *rects);
+
+extern _X_EXPORT Bool glamor_get_image_nf(DrawablePtr pDrawable, int x, int y,
+                                          int w, int h, unsigned int format,
+                                          unsigned long planeMask, char *d);
+
+extern _X_EXPORT Bool glamor_add_traps_nf(PicturePtr pPicture,
+                                          INT16 x_off,
+                                          INT16 y_off, int ntrap,
+                                          xTrap *traps);
+
+extern _X_EXPORT Bool glamor_copy_plane_nf(DrawablePtr pSrc, DrawablePtr pDst,
+                                           GCPtr pGC, int srcx, int srcy, int w,
+                                           int h, int dstx, int dsty,
+                                           unsigned long bitPlane,
+                                           RegionPtr *pRegion);
+
+extern _X_EXPORT Bool glamor_image_glyph_blt_nf(DrawablePtr pDrawable,
+                                                GCPtr pGC, int x, int y,
+                                                unsigned int nglyph,
+                                                CharInfoPtr *ppci,
+                                                void *pglyphBase);
+
+extern _X_EXPORT Bool glamor_poly_glyph_blt_nf(DrawablePtr pDrawable, GCPtr pGC,
+                                               int x, int y,
+                                               unsigned int nglyph,
+                                               CharInfoPtr *ppci,
+                                               void *pglyphBase);
+
+extern _X_EXPORT Bool glamor_push_pixels_nf(GCPtr pGC, PixmapPtr pBitmap,
+                                            DrawablePtr pDrawable, int w, int h,
+                                            int x, int y);
+
+extern _X_EXPORT Bool glamor_poly_point_nf(DrawablePtr pDrawable, GCPtr pGC,
+                                           int mode, int npt, DDXPointPtr ppt);
+
+extern _X_EXPORT Bool glamor_poly_segment_nf(DrawablePtr pDrawable, GCPtr pGC,
+                                             int nseg, xSegment *pSeg);
+
+extern _X_EXPORT Bool glamor_poly_lines_nf(DrawablePtr drawable, GCPtr gc,
+                                           int mode, int n, DDXPointPtr points);
+
+extern _X_EXPORT Bool glamor_poly_text8_nf(DrawablePtr drawable, GCPtr gc,
+                                           int x, int y, int count, char *chars, int *final_pos);
+
+extern _X_EXPORT Bool glamor_poly_text16_nf(DrawablePtr drawable, GCPtr gc,
+                                            int x, int y, int count, unsigned short *chars, int *final_pos);
+
+extern _X_EXPORT Bool glamor_image_text8_nf(DrawablePtr drawable, GCPtr gc,
+                                            int x, int y, int count, char *chars);
+
+extern _X_EXPORT Bool glamor_image_text16_nf(DrawablePtr drawable, GCPtr gc,
+                                             int x, int y, int count, unsigned short *chars);
+
+#define HAS_GLAMOR_TEXT 1
+
+#ifdef GLAMOR_FOR_XORG
+extern _X_EXPORT XF86VideoAdaptorPtr glamor_xv_init(ScreenPtr pScreen,
+                                                    int num_texture_ports);
+#endif
+
+#endif                          /* GLAMOR_H */
diff --git a/glamor/glamor_addtraps.c b/glamor/glamor_addtraps.c
new file mode 100644 (file)
index 0000000..fdc0f42
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * Copyright Â© 2009 Intel Corporation
+ * Copyright Â© 1998 Keith Packard
+ *
+ * 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.
+ *
+ * Authors:
+ *    Zhigang Gong <zhigang.gong@gmail.com>
+ *
+ */
+
+#include "glamor_priv.h"
+
+static Bool
+_glamor_add_traps(PicturePtr pPicture,
+                  INT16 x_off,
+                  INT16 y_off, int ntrap, xTrap *traps, Bool fallback)
+{
+    if (!fallback
+        && (!pPicture->pDrawable
+            || glamor_ddx_fallback_check_pixmap(pPicture->pDrawable)))
+        return FALSE;
+
+    if (glamor_prepare_access_picture(pPicture, GLAMOR_ACCESS_RW)) {
+        fbAddTraps(pPicture, x_off, y_off, ntrap, traps);
+    }
+    glamor_finish_access_picture(pPicture);
+
+    return TRUE;
+}
+
+void
+glamor_add_traps(PicturePtr pPicture,
+                 INT16 x_off, INT16 y_off, int ntrap, xTrap *traps)
+{
+    _glamor_add_traps(pPicture, x_off, y_off, ntrap, traps, TRUE);
+}
+
+Bool
+glamor_add_traps_nf(PicturePtr pPicture,
+                    INT16 x_off, INT16 y_off, int ntrap, xTrap *traps)
+{
+    return _glamor_add_traps(pPicture, x_off, y_off, ntrap, traps, FALSE);
+}
diff --git a/glamor/glamor_compositerects.c b/glamor/glamor_compositerects.c
new file mode 100644 (file)
index 0000000..3b6b2ed
--- /dev/null
@@ -0,0 +1,276 @@
+/*
+ * Copyright Â© 2009 Intel 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.
+ *
+ * Authors:
+ *     Zhigang Gong <zhigang.gong@linux.intel.com>
+ *
+ *     original author is Chris Wilson at sna.
+ *
+ */
+
+#include "glamor_priv.h"
+#include "mipict.h"
+#include "damage.h"
+
+/** @file glamor_compositerects.
+ *
+ * compositeRects acceleration implementation
+ */
+
+static int16_t
+bound(int16_t a, uint16_t b)
+{
+    int v = (int) a + (int) b;
+
+    if (v > MAXSHORT)
+        return MAXSHORT;
+    return v;
+}
+
+static Bool
+_pixman_region_init_clipped_rectangles(pixman_region16_t * region,
+                                       unsigned int num_rects,
+                                       xRectangle *rects,
+                                       int tx, int ty, BoxPtr extents)
+{
+    pixman_box16_t stack_boxes[64], *boxes = stack_boxes;
+    pixman_bool_t ret;
+    unsigned int i, j;
+
+    if (num_rects > ARRAY_SIZE(stack_boxes)) {
+        boxes = malloc(sizeof(pixman_box16_t) * num_rects);
+        if (boxes == NULL)
+            return FALSE;
+    }
+
+    for (i = j = 0; i < num_rects; i++) {
+        boxes[j].x1 = rects[i].x + tx;
+        if (boxes[j].x1 < extents->x1)
+            boxes[j].x1 = extents->x1;
+
+        boxes[j].y1 = rects[i].y + ty;
+        if (boxes[j].y1 < extents->y1)
+            boxes[j].y1 = extents->y1;
+
+        boxes[j].x2 = bound(rects[i].x + tx, rects[i].width);
+        if (boxes[j].x2 > extents->x2)
+            boxes[j].x2 = extents->x2;
+
+        boxes[j].y2 = bound(rects[i].y + ty, rects[i].height);
+        if (boxes[j].y2 > extents->y2)
+            boxes[j].y2 = extents->y2;
+
+        if (boxes[j].x2 > boxes[j].x1 && boxes[j].y2 > boxes[j].y1)
+            j++;
+    }
+
+    ret = FALSE;
+    if (j)
+        ret = pixman_region_init_rects(region, boxes, j);
+
+    if (boxes != stack_boxes)
+        free(boxes);
+
+    DEBUGF("%s: nrects=%d, region=(%d, %d), (%d, %d) x %d\n",
+           __FUNCTION__, num_rects,
+           region->extents.x1, region->extents.y1,
+           region->extents.x2, region->extents.y2, j);
+    return ret;
+}
+
+void
+glamor_composite_rectangles(CARD8 op,
+                            PicturePtr dst,
+                            xRenderColor * color,
+                            int num_rects, xRectangle *rects)
+{
+    PixmapPtr pixmap;
+    struct glamor_pixmap_private *priv;
+    pixman_region16_t region;
+    pixman_box16_t *boxes;
+    int dst_x, dst_y;
+    int num_boxes;
+    PicturePtr source = NULL;
+    Bool need_free_region = FALSE;
+
+    DEBUGF("%s(op=%d, %08x x %d [(%d, %d)x(%d, %d) ...])\n",
+           __FUNCTION__, op,
+           (color->alpha >> 8 << 24) |
+           (color->red >> 8 << 16) |
+           (color->green >> 8 << 8) |
+           (color->blue >> 8 << 0),
+           num_rects, rects[0].x, rects[0].y, rects[0].width, rects[0].height);
+
+    if (!num_rects)
+        return;
+
+    if (RegionNil(dst->pCompositeClip)) {
+        DEBUGF("%s: empty clip, skipping\n", __FUNCTION__);
+        return;
+    }
+
+    if ((color->red | color->green | color->blue | color->alpha) <= 0x00ff) {
+        switch (op) {
+        case PictOpOver:
+        case PictOpOutReverse:
+        case PictOpAdd:
+            return;
+        case PictOpInReverse:
+        case PictOpSrc:
+            op = PictOpClear;
+            break;
+        case PictOpAtopReverse:
+            op = PictOpOut;
+            break;
+        case PictOpXor:
+            op = PictOpOverReverse;
+            break;
+        }
+    }
+    if (color->alpha <= 0x00ff) {
+        switch (op) {
+        case PictOpOver:
+        case PictOpOutReverse:
+            return;
+        case PictOpInReverse:
+            op = PictOpClear;
+            break;
+        case PictOpAtopReverse:
+            op = PictOpOut;
+            break;
+        case PictOpXor:
+            op = PictOpOverReverse;
+            break;
+        }
+    }
+    else if (color->alpha >= 0xff00) {
+        switch (op) {
+        case PictOpOver:
+            op = PictOpSrc;
+            break;
+        case PictOpInReverse:
+            return;
+        case PictOpOutReverse:
+            op = PictOpClear;
+            break;
+        case PictOpAtopReverse:
+            op = PictOpOverReverse;
+            break;
+        case PictOpXor:
+            op = PictOpOut;
+            break;
+        }
+    }
+    DEBUGF("%s: converted to op %d\n", __FUNCTION__, op);
+
+    if (!_pixman_region_init_clipped_rectangles(&region,
+                                                num_rects, rects,
+                                                dst->pDrawable->x,
+                                                dst->pDrawable->y,
+                                                &dst->pCompositeClip->extents))
+    {
+        DEBUGF("%s: allocation failed for region\n", __FUNCTION__);
+        return;
+    }
+
+    pixmap = glamor_get_drawable_pixmap(dst->pDrawable);
+    priv = glamor_get_pixmap_private(pixmap);
+
+    if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(priv))
+        goto fallback;
+    if (dst->alphaMap) {
+        DEBUGF("%s: fallback, dst has an alpha-map\n", __FUNCTION__);
+        goto fallback;
+    }
+
+    need_free_region = TRUE;
+
+    DEBUGF("%s: drawable extents (%d, %d),(%d, %d) x %d\n",
+           __FUNCTION__,
+           RegionExtents(&region)->x1, RegionExtents(&region)->y1,
+           RegionExtents(&region)->x2, RegionExtents(&region)->y2,
+           RegionNumRects(&region));
+
+    if (dst->pCompositeClip->data &&
+        (!pixman_region_intersect(&region, &region, dst->pCompositeClip) ||
+         RegionNil(&region))) {
+        DEBUGF("%s: zero-intersection between rectangles and clip\n",
+               __FUNCTION__);
+        pixman_region_fini(&region);
+        return;
+    }
+
+    DEBUGF("%s: clipped extents (%d, %d),(%d, %d) x %d\n",
+           __FUNCTION__,
+           RegionExtents(&region)->x1, RegionExtents(&region)->y1,
+           RegionExtents(&region)->x2, RegionExtents(&region)->y2,
+           RegionNumRects(&region));
+
+    glamor_get_drawable_deltas(dst->pDrawable, pixmap, &dst_x, &dst_y);
+    pixman_region_translate(&region, dst_x, dst_y);
+
+    DEBUGF("%s: pixmap +(%d, %d) extents (%d, %d),(%d, %d)\n",
+           __FUNCTION__, dst_x, dst_y,
+           RegionExtents(&region)->x1, RegionExtents(&region)->y1,
+           RegionExtents(&region)->x2, RegionExtents(&region)->y2);
+
+    boxes = pixman_region_rectangles(&region, &num_boxes);
+    if (op == PictOpSrc || op == PictOpClear) {
+        CARD32 pixel;
+
+        if (op == PictOpClear)
+            pixel = 0;
+        else
+            miRenderColorToPixel(dst->pFormat, color, &pixel);
+        glamor_solid_boxes(pixmap, boxes, num_boxes, pixel);
+
+        goto done;
+    }
+    else {
+        if (_X_LIKELY(priv->type != GLAMOR_TEXTURE_LARGE)) {
+            int error;
+
+            source = CreateSolidPicture(0, color, &error);
+            if (!source)
+                goto done;
+            if (glamor_composite_clipped_region(op, source,
+                                                NULL, dst,
+                                                NULL, NULL, priv,
+                                                &region, 0, 0, 0, 0, 0, 0))
+                goto done;
+        }
+    }
+ fallback:
+    miCompositeRects(op, dst, color, num_rects, rects);
+ done:
+    /* XXX xserver-1.8: CompositeRects is not tracked by Damage, so we must
+     * manually append the damaged regions ourselves.
+     */
+    DamageRegionAppend(&pixmap->drawable, &region);
+    DamageRegionProcessPending(&pixmap->drawable);
+
+    if (need_free_region)
+        pixman_region_fini(&region);
+    if (source)
+        FreePicture(source, 0);
+    return;
+}
diff --git a/glamor/glamor_context.h b/glamor/glamor_context.h
new file mode 100644 (file)
index 0000000..47b87e6
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * Copyright Â© 2013 Intel 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.
+ */
+
+/**
+ * @file glamor_context.h
+ *
+ * This is the struct of state required for context switching in
+ * glamor.  It has to use types that don't require including either
+ * server headers or Xlib headers, since it will be included by both
+ * the server and the GLX (xlib) code.
+ */
+
+struct glamor_context {
+    /** Either an EGLDisplay or an Xlib Display */
+    void *display;
+
+    /** Either a GLXContext or an EGLContext. */
+    void *ctx;
+
+    /** The EGLSurface we should MakeCurrent to */
+    void *drawable;
+
+    /** The GLXDrawable we should MakeCurrent to */
+    uint32_t drawable_xid;
+
+    void (*make_current)(struct glamor_context *glamor_ctx);
+};
+
+Bool glamor_glx_screen_init(struct glamor_context *glamor_ctx);
diff --git a/glamor/glamor_copyarea.c b/glamor/glamor_copyarea.c
new file mode 100644 (file)
index 0000000..e198822
--- /dev/null
@@ -0,0 +1,626 @@
+/*
+ * Copyright Â© 2008 Intel Corporation
+ * Copyright Â© 1998 Keith Packard
+ *
+ * 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 Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission.  Keith Packard makes no
+ * representations about the suitability of this software for any purpose.  It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD 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.
+ *
+ * Authors:
+ *    Eric Anholt <eric@anholt.net>
+ *    Zhigang Gong <zhigang.gong@linux.intel.com>
+ */
+
+#include "glamor_priv.h"
+
+/** @file glamor_copyarea.c
+ *
+ * GC CopyArea implementation
+ */
+static Bool
+glamor_copy_n_to_n_fbo_blit(DrawablePtr src,
+                            DrawablePtr dst,
+                            GCPtr gc, BoxPtr box, int nbox, int dx, int dy)
+{
+    ScreenPtr screen = dst->pScreen;
+    PixmapPtr dst_pixmap = glamor_get_drawable_pixmap(dst);
+    PixmapPtr src_pixmap = glamor_get_drawable_pixmap(src);
+    glamor_pixmap_private *src_pixmap_priv, *dst_pixmap_priv;
+    glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
+    int dst_x_off, dst_y_off, src_x_off, src_y_off, i;
+    int fbo_x_off, fbo_y_off;
+    int src_fbo_x_off, src_fbo_y_off;
+
+    if (!glamor_priv->has_fbo_blit) {
+        glamor_delayed_fallback(screen, "no EXT_framebuffer_blit\n");
+        return FALSE;
+    }
+    src_pixmap_priv = glamor_get_pixmap_private(src_pixmap);
+    dst_pixmap_priv = glamor_get_pixmap_private(dst_pixmap);
+
+    if (gc) {
+        if (gc->alu != GXcopy) {
+            glamor_delayed_fallback(screen, "non-copy ALU\n");
+            return FALSE;
+        }
+    }
+
+    if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(src_pixmap_priv)) {
+        glamor_delayed_fallback(screen, "no src fbo\n");
+        return FALSE;
+    }
+
+    if (glamor_set_destination_pixmap(dst_pixmap))
+        return FALSE;
+
+    pixmap_priv_get_fbo_off(dst_pixmap_priv, &fbo_x_off, &fbo_y_off);
+    pixmap_priv_get_fbo_off(src_pixmap_priv, &src_fbo_x_off, &src_fbo_y_off);
+
+    glamor_make_current(glamor_priv);
+    glBindFramebuffer(GL_READ_FRAMEBUFFER_EXT, src_pixmap_priv->base.fbo->fb);
+    glamor_get_drawable_deltas(dst, dst_pixmap, &dst_x_off, &dst_y_off);
+    glamor_get_drawable_deltas(src, src_pixmap, &src_x_off, &src_y_off);
+    dst_x_off += fbo_x_off;
+    dst_y_off += fbo_y_off;
+    src_y_off += dy + src_fbo_y_off;
+    src_x_off += src_fbo_x_off;
+
+    for (i = 0; i < nbox; i++) {
+        if (glamor_priv->yInverted) {
+            glBlitFramebuffer(box[i].x1 + dx + src_x_off,
+                              box[i].y1 + src_y_off,
+                              box[i].x2 + dx + src_x_off,
+                              box[i].y2 + src_y_off,
+                              box[i].x1 + dst_x_off,
+                              box[i].y1 + dst_y_off,
+                              box[i].x2 + dst_x_off,
+                              box[i].y2 + dst_y_off,
+                              GL_COLOR_BUFFER_BIT, GL_NEAREST);
+        }
+        else {
+            int flip_dst_y1 =
+                dst_pixmap->drawable.height - (box[i].y2 + dst_y_off);
+            int flip_dst_y2 =
+                dst_pixmap->drawable.height - (box[i].y1 + dst_y_off);
+            int flip_src_y1 =
+                src_pixmap->drawable.height - (box[i].y2 + src_y_off);
+            int flip_src_y2 =
+                src_pixmap->drawable.height - (box[i].y1 + src_y_off);
+
+            glBlitFramebuffer(box[i].x1 + dx + src_x_off,
+                              flip_src_y1,
+                              box[i].x2 + dx + src_x_off,
+                              flip_src_y2,
+                              box[i].x1 + dst_x_off,
+                              flip_dst_y1,
+                              box[i].x2 + dst_x_off,
+                              flip_dst_y2,
+                              GL_COLOR_BUFFER_BIT, GL_NEAREST);
+        }
+    }
+    glamor_priv->state = BLIT_STATE;
+    return TRUE;
+}
+
+static Bool
+glamor_copy_n_to_n_textured(DrawablePtr src,
+                            DrawablePtr dst,
+                            GCPtr gc, BoxPtr box, int nbox, int dx, int dy)
+{
+    glamor_screen_private *glamor_priv =
+        glamor_get_screen_private(dst->pScreen);
+    PixmapPtr src_pixmap = glamor_get_drawable_pixmap(src);
+    PixmapPtr dst_pixmap = glamor_get_drawable_pixmap(dst);
+    int i;
+    float vertices[8], texcoords[8];
+    glamor_pixmap_private *src_pixmap_priv;
+    glamor_pixmap_private *dst_pixmap_priv;
+    int src_x_off, src_y_off, dst_x_off, dst_y_off;
+    enum glamor_pixmap_status src_status = GLAMOR_NONE;
+    GLfloat dst_xscale, dst_yscale, src_xscale, src_yscale;
+
+    src_pixmap_priv = glamor_get_pixmap_private(src_pixmap);
+    dst_pixmap_priv = glamor_get_pixmap_private(dst_pixmap);
+
+    if (src_pixmap_priv->base.gl_fbo == GLAMOR_FBO_UNATTACHED) {
+#ifndef GLAMOR_PIXMAP_DYNAMIC_UPLOAD
+        glamor_delayed_fallback(dst->pScreen, "src has no fbo.\n");
+        return FALSE;
+#else
+        src_status = glamor_upload_pixmap_to_texture(src_pixmap);
+        if (src_status != GLAMOR_UPLOAD_DONE)
+            return FALSE;
+
+        src_pixmap_priv = glamor_get_pixmap_private(src_pixmap);
+#endif
+    }
+
+    pixmap_priv_get_dest_scale(dst_pixmap_priv, &dst_xscale, &dst_yscale);
+    pixmap_priv_get_scale(src_pixmap_priv, &src_xscale, &src_yscale);
+
+    glamor_get_drawable_deltas(dst, dst_pixmap, &dst_x_off, &dst_y_off);
+
+    glamor_make_current(glamor_priv);
+
+    glamor_set_destination_pixmap_priv_nc(dst_pixmap_priv);
+    glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT,
+                          GL_FALSE, 2 * sizeof(float), vertices);
+    glEnableVertexAttribArray(GLAMOR_VERTEX_POS);
+
+    glamor_get_drawable_deltas(src, src_pixmap, &src_x_off, &src_y_off);
+    dx += src_x_off;
+    dy += src_y_off;
+
+    glActiveTexture(GL_TEXTURE0);
+    glBindTexture(GL_TEXTURE_2D, src_pixmap_priv->base.fbo->tex);
+    if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) {
+        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
+        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
+    }
+    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+
+    glVertexAttribPointer(GLAMOR_VERTEX_SOURCE, 2, GL_FLOAT, GL_FALSE,
+                          2 * sizeof(float), texcoords);
+    glEnableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
+    glUseProgram(glamor_priv->finish_access_prog[0]);
+    glUniform1i(glamor_priv->finish_access_revert[0], REVERT_NONE);
+    glUniform1i(glamor_priv->finish_access_swap_rb[0], SWAP_NONE_UPLOADING);
+
+    for (i = 0; i < nbox; i++) {
+
+        glamor_set_normalize_vcoords(dst_pixmap_priv,
+                                     dst_xscale, dst_yscale,
+                                     box[i].x1 + dst_x_off,
+                                     box[i].y1 + dst_y_off,
+                                     box[i].x2 + dst_x_off,
+                                     box[i].y2 + dst_y_off,
+                                     glamor_priv->yInverted, vertices);
+
+        glamor_set_normalize_tcoords(src_pixmap_priv,
+                                     src_xscale,
+                                     src_yscale,
+                                     box[i].x1 + dx,
+                                     box[i].y1 + dy,
+                                     box[i].x2 + dx,
+                                     box[i].y2 + dy,
+                                     glamor_priv->yInverted, texcoords);
+        glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
+    }
+
+    glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
+    glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
+    /* The source texture is bound to a fbo, we have to flush it here. */
+    glamor_priv->state = RENDER_STATE;
+    glamor_priv->render_idle_cnt = 0;
+    return TRUE;
+}
+
+static Bool
+__glamor_copy_n_to_n(DrawablePtr src,
+                     DrawablePtr dst,
+                     GCPtr gc,
+                     BoxPtr box,
+                     int nbox,
+                     int dx,
+                     int dy,
+                     Bool reverse,
+                     Bool upsidedown, Pixel bitplane, void *closure)
+{
+    PixmapPtr dst_pixmap, src_pixmap, temp_pixmap = NULL;
+    DrawablePtr temp_src = src;
+    glamor_pixmap_private *dst_pixmap_priv, *src_pixmap_priv;
+    glamor_screen_private *glamor_priv;
+    BoxRec bound;
+    ScreenPtr screen;
+    int temp_dx = dx;
+    int temp_dy = dy;
+    int src_x_off, src_y_off, dst_x_off, dst_y_off;
+    int i;
+    int overlaped = 0;
+    Bool ret = FALSE;
+
+    dst_pixmap = glamor_get_drawable_pixmap(dst);
+    dst_pixmap_priv = glamor_get_pixmap_private(dst_pixmap);
+    src_pixmap = glamor_get_drawable_pixmap(src);
+    src_pixmap_priv = glamor_get_pixmap_private(src_pixmap);
+    screen = dst_pixmap->drawable.pScreen;
+    glamor_priv = glamor_get_screen_private(dst->pScreen);
+    glamor_get_drawable_deltas(src, src_pixmap, &src_x_off, &src_y_off);
+
+    glamor_get_drawable_deltas(dst, dst_pixmap, &dst_x_off, &dst_y_off);
+
+    if (src_pixmap_priv->base.fbo
+        && src_pixmap_priv->base.fbo->fb == dst_pixmap_priv->base.fbo->fb) {
+        int x_shift = abs(src_x_off - dx - dst_x_off);
+        int y_shift = abs(src_y_off - dy - dst_y_off);
+
+        for (i = 0; i < nbox; i++) {
+            if (x_shift < abs(box[i].x2 - box[i].x1)
+                && y_shift < abs(box[i].y2 - box[i].y1)) {
+                overlaped = 1;
+                break;
+            }
+        }
+    }
+    DEBUGF("Copy %d %d %dx%d dx %d dy %d from %p to %p \n",
+           box[0].x1, box[0].y1,
+           box[0].x2 - box[0].x1, box[0].y2 - box[0].y1,
+           dx, dy, src_pixmap, dst_pixmap);
+    if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP &&
+        !overlaped &&
+        (glamor_priv->state != RENDER_STATE
+         || !src_pixmap_priv->base.gl_tex || !dst_pixmap_priv->base.gl_tex)
+        && glamor_copy_n_to_n_fbo_blit(src, dst, gc, box, nbox, dx, dy)) {
+        ret = TRUE;
+        goto done;
+    }
+    glamor_calculate_boxes_bound(&bound, box, nbox);
+
+    /*  Overlaped indicate the src and dst are the same pixmap. */
+    if (overlaped || (!GLAMOR_PIXMAP_PRIV_HAS_FBO(src_pixmap_priv)
+                      && (((bound.x2 - bound.x1) * (bound.y2 - bound.y1)
+                           * 4 >
+                           src_pixmap->drawable.width *
+                           src_pixmap->drawable.height)
+                          || !(glamor_check_fbo_size(glamor_priv,
+                                                     src_pixmap->drawable.width,
+                                                     src_pixmap->drawable.
+                                                     height))))) {
+
+        temp_pixmap = glamor_create_pixmap(screen,
+                                           bound.x2 - bound.x1,
+                                           bound.y2 - bound.y1,
+                                           src_pixmap->drawable.depth,
+                                           overlaped ? 0 :
+                                           GLAMOR_CREATE_PIXMAP_CPU);
+        assert(bound.x2 - bound.x1 <= glamor_priv->max_fbo_size);
+        assert(bound.y2 - bound.y1 <= glamor_priv->max_fbo_size);
+        if (!temp_pixmap)
+            goto done;
+        glamor_translate_boxes(box, nbox, -bound.x1, -bound.y1);
+        temp_src = &temp_pixmap->drawable;
+
+        if (overlaped)
+            glamor_copy_n_to_n_textured(src, temp_src, gc, box,
+                                        nbox,
+                                        temp_dx + bound.x1, temp_dy + bound.y1);
+        else
+            fbCopyNtoN(src, temp_src, gc, box, nbox,
+                       temp_dx + bound.x1, temp_dy + bound.y1,
+                       reverse, upsidedown, bitplane, closure);
+        glamor_translate_boxes(box, nbox, bound.x1, bound.y1);
+        temp_dx = -bound.x1;
+        temp_dy = -bound.y1;
+    }
+    else {
+        temp_dx = dx;
+        temp_dy = dy;
+        temp_src = src;
+    }
+
+    if (glamor_copy_n_to_n_textured
+        (temp_src, dst, gc, box, nbox, temp_dx, temp_dy)) {
+        ret = TRUE;
+    }
+ done:
+    if (temp_src != src)
+        glamor_destroy_pixmap(temp_pixmap);
+    return ret;
+}
+
+static Bool
+_glamor_copy_n_to_n(DrawablePtr src,
+                    DrawablePtr dst,
+                    GCPtr gc,
+                    BoxPtr box,
+                    int nbox,
+                    int dx,
+                    int dy,
+                    Bool reverse,
+                    Bool upsidedown, Pixel bitplane,
+                    void *closure, Bool fallback)
+{
+    ScreenPtr screen = dst->pScreen;
+    PixmapPtr dst_pixmap, src_pixmap;
+    glamor_pixmap_private *dst_pixmap_priv, *src_pixmap_priv;
+    glamor_screen_private *glamor_priv;
+    BoxPtr extent;
+    RegionRec region;
+    int src_x_off, src_y_off, dst_x_off, dst_y_off;
+    Bool ok = FALSE;
+    int force_clip = 0;
+
+    if (nbox == 0)
+        return TRUE;
+    dst_pixmap = glamor_get_drawable_pixmap(dst);
+    dst_pixmap_priv = glamor_get_pixmap_private(dst_pixmap);
+    src_pixmap = glamor_get_drawable_pixmap(src);
+    src_pixmap_priv = glamor_get_pixmap_private(src_pixmap);
+
+    glamor_priv = glamor_get_screen_private(screen);
+
+    DEBUGF("Copy %d %d %dx%d dx %d dy %d from %p to %p \n",
+           box[0].x1, box[0].y1,
+           box[0].x2 - box[0].x1, box[0].y2 - box[0].y1,
+           dx, dy, src_pixmap, dst_pixmap);
+
+    if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(dst_pixmap_priv))
+        goto fall_back;
+
+    if (gc) {
+        if (!glamor_set_planemask(dst_pixmap, gc->planemask))
+            goto fall_back;
+        glamor_make_current(glamor_priv);
+        if (!glamor_set_alu(screen, gc->alu)) {
+            goto fail_noregion;
+        }
+    }
+
+    if (!src_pixmap_priv) {
+        glamor_set_pixmap_type(src_pixmap, GLAMOR_MEMORY);
+        src_pixmap_priv = glamor_get_pixmap_private(src_pixmap);
+    }
+
+    glamor_get_drawable_deltas(src, src_pixmap, &src_x_off, &src_y_off);
+    glamor_get_drawable_deltas(dst, dst_pixmap, &dst_x_off, &dst_y_off);
+
+    RegionInitBoxes(&region, box, nbox);
+    extent = RegionExtents(&region);
+
+    if (!glamor_check_fbo_size(glamor_priv,
+                               extent->x2 - extent->x1, extent->y2 - extent->y1)
+        && (src_pixmap_priv->type == GLAMOR_MEMORY
+            || (src_pixmap_priv == dst_pixmap_priv))) {
+        force_clip = 1;
+    }
+
+    if (force_clip || dst_pixmap_priv->type == GLAMOR_TEXTURE_LARGE
+        || src_pixmap_priv->type == GLAMOR_TEXTURE_LARGE) {
+        glamor_pixmap_clipped_regions *clipped_dst_regions;
+        int n_dst_region, i, j;
+        PixmapPtr temp_source_pixmap;
+        glamor_pixmap_private *temp_source_priv = NULL;
+
+        RegionTranslate(&region, dst_x_off, dst_y_off);
+        if (!force_clip)
+            clipped_dst_regions =
+                glamor_compute_clipped_regions(dst_pixmap_priv, &region,
+                                               &n_dst_region, 0, reverse,
+                                               upsidedown);
+        else
+            clipped_dst_regions =
+                glamor_compute_clipped_regions_ext(dst_pixmap_priv, &region,
+                                                   &n_dst_region,
+                                                   glamor_priv->max_fbo_size,
+                                                   glamor_priv->max_fbo_size,
+                                                   reverse, upsidedown);
+        for (i = 0; i < n_dst_region; i++) {
+            int n_src_region;
+            glamor_pixmap_clipped_regions *clipped_src_regions;
+            BoxPtr current_boxes;
+            int n_current_boxes;
+
+            SET_PIXMAP_FBO_CURRENT(dst_pixmap_priv,
+                                   clipped_dst_regions[i].block_idx);
+
+            temp_source_pixmap = NULL;
+            if (src_pixmap_priv->type == GLAMOR_TEXTURE_LARGE) {
+                RegionTranslate(clipped_dst_regions[i].region,
+                                -dst_x_off + src_x_off + dx,
+                                -dst_y_off + src_y_off + dy);
+                clipped_src_regions =
+                    glamor_compute_clipped_regions(src_pixmap_priv,
+                                                   clipped_dst_regions[i].
+                                                   region, &n_src_region, 0,
+                                                   reverse, upsidedown);
+                DEBUGF("Source is large pixmap.\n");
+                for (j = 0; j < n_src_region; j++) {
+                    if (src_pixmap_priv != dst_pixmap_priv)
+                        SET_PIXMAP_FBO_CURRENT(src_pixmap_priv,
+                                               clipped_src_regions[j].
+                                               block_idx);
+                    else if (src_pixmap_priv == dst_pixmap_priv &&
+                             clipped_src_regions[j].block_idx !=
+                             clipped_dst_regions[i].block_idx) {
+                        /* source and the dest are the same, but need different block_idx.
+                         * we create a empty pixmap and fill the required source fbo and box to
+                         * it. It's a little hacky, but avoid extra copy. */
+                        temp_source_pixmap =
+                            glamor_create_pixmap(src->pScreen, 0, 0, src->depth,
+                                                 0);
+                        if (!temp_source_pixmap) {
+                            ok = FALSE;
+                            goto fail;
+                        }
+                        src->pScreen->ModifyPixmapHeader(temp_source_pixmap,
+                                                         src_pixmap->drawable.
+                                                         width,
+                                                         src_pixmap->drawable.
+                                                         height, 0, 0,
+                                                         src_pixmap->devKind,
+                                                         NULL);
+                        temp_source_priv =
+                            glamor_get_pixmap_private(temp_source_pixmap);
+                        *temp_source_priv = *src_pixmap_priv;
+                        temp_source_priv->large.box =
+                            src_pixmap_priv->large.
+                            box_array[clipped_src_regions[j].block_idx];
+                        temp_source_priv->base.fbo =
+                            src_pixmap_priv->large.
+                            fbo_array[clipped_src_regions[j].block_idx];
+                        temp_source_priv->base.pixmap = temp_source_pixmap;
+                    }
+                    assert(temp_source_pixmap ||
+                           !(src_pixmap_priv == dst_pixmap_priv &&
+                             (clipped_src_regions[j].block_idx !=
+                              clipped_dst_regions[i].block_idx)));
+
+                    RegionTranslate(clipped_src_regions[j].region,
+                                    -src_x_off - dx, -src_y_off - dy);
+                    current_boxes = RegionRects(clipped_src_regions[j].region);
+                    n_current_boxes =
+                        RegionNumRects(clipped_src_regions[j].region);
+                    DEBUGF("dst pixmap fbo idx %d src pixmap fbo idx %d \n",
+                           clipped_dst_regions[i].block_idx,
+                           clipped_src_regions[j].block_idx);
+                    DEBUGF("Copy %d %d %d %d dx %d dy %d from %p to %p \n",
+                           current_boxes[0].x1, current_boxes[0].y1,
+                           current_boxes[0].x2, current_boxes[0].y2, dx, dy,
+                           src_pixmap, dst_pixmap);
+                    if (!temp_source_pixmap)
+                        ok = __glamor_copy_n_to_n(src, dst, gc, current_boxes,
+                                                  n_current_boxes, dx, dy,
+                                                  reverse, upsidedown, bitplane,
+                                                  closure);
+                    else {
+                        ok = __glamor_copy_n_to_n(&temp_source_pixmap->drawable,
+                                                  dst, gc, current_boxes,
+                                                  n_current_boxes, dx, dy,
+                                                  reverse, upsidedown, bitplane,
+                                                  closure);
+                        temp_source_priv->type = GLAMOR_MEMORY;
+                        temp_source_priv->base.fbo = NULL;
+                        glamor_destroy_pixmap(temp_source_pixmap);
+                        temp_source_pixmap = NULL;
+                    }
+
+                    RegionDestroy(clipped_src_regions[j].region);
+                    if (!ok) {
+                        assert(0);
+                        goto fail;
+                    }
+                }
+
+                if (n_src_region == 0)
+                    ok = TRUE;
+                free(clipped_src_regions);
+            }
+            else {
+                RegionTranslate(clipped_dst_regions[i].region,
+                                -dst_x_off, -dst_y_off);
+                current_boxes = RegionRects(clipped_dst_regions[i].region);
+                n_current_boxes = RegionNumRects(clipped_dst_regions[i].region);
+
+                DEBUGF("dest pixmap fbo idx %d \n",
+                       clipped_dst_regions[i].block_idx);
+                DEBUGF("Copy %d %d %d %d dx %d dy %d from %p to %p \n",
+                       current_boxes[0].x1, current_boxes[0].y1,
+                       current_boxes[0].x2, current_boxes[0].y2,
+                       dx, dy, src_pixmap, dst_pixmap);
+
+                ok = __glamor_copy_n_to_n(src, dst, gc, current_boxes,
+                                          n_current_boxes, dx, dy, reverse,
+                                          upsidedown, bitplane, closure);
+
+            }
+            RegionDestroy(clipped_dst_regions[i].region);
+        }
+        if (n_dst_region == 0)
+            ok = TRUE;
+        free(clipped_dst_regions);
+    }
+    else {
+        ok = __glamor_copy_n_to_n(src, dst, gc, box, nbox, dx, dy,
+                                  reverse, upsidedown, bitplane, closure);
+    }
+
+ fail:
+    RegionUninit(&region);
+ fail_noregion:
+    glamor_make_current(glamor_priv);
+    glamor_set_alu(screen, GXcopy);
+
+    if (ok)
+        return TRUE;
+ fall_back:
+    if (!fallback && glamor_ddx_fallback_check_pixmap(src)
+        && glamor_ddx_fallback_check_pixmap(dst))
+        goto done;
+
+    if (src_pixmap_priv->type == GLAMOR_DRM_ONLY
+        || dst_pixmap_priv->type == GLAMOR_DRM_ONLY) {
+        LogMessage(X_WARNING,
+                   "Access a DRM only pixmap is not allowed within glamor.\n");
+        return TRUE;
+    }
+    glamor_report_delayed_fallbacks(src->pScreen);
+    glamor_report_delayed_fallbacks(dst->pScreen);
+
+    glamor_fallback("from %p to %p (%c,%c)\n", src, dst,
+                    glamor_get_drawable_location(src),
+                    glamor_get_drawable_location(dst));
+
+    if (glamor_prepare_access(dst, GLAMOR_ACCESS_RW) &&
+        glamor_prepare_access(src, GLAMOR_ACCESS_RO) &&
+        glamor_prepare_access_gc(gc)) {
+        fbCopyNtoN(src, dst, gc, box, nbox,
+                   dx, dy, reverse, upsidedown, bitplane, closure);
+    }
+    glamor_finish_access_gc(gc);
+    glamor_finish_access(src);
+    glamor_finish_access(dst);
+    ok = TRUE;
+
+ done:
+    glamor_clear_delayed_fallbacks(src->pScreen);
+    glamor_clear_delayed_fallbacks(dst->pScreen);
+    return ok;
+}
+
+RegionPtr
+glamor_copy_area(DrawablePtr src, DrawablePtr dst, GCPtr gc,
+                 int srcx, int srcy, int width, int height, int dstx, int dsty)
+{
+    RegionPtr region;
+
+    region = miDoCopy(src, dst, gc,
+                      srcx, srcy, width, height,
+                      dstx, dsty, glamor_copy_n_to_n, 0, NULL);
+
+    return region;
+}
+
+void
+glamor_copy_n_to_n(DrawablePtr src,
+                   DrawablePtr dst,
+                   GCPtr gc,
+                   BoxPtr box,
+                   int nbox,
+                   int dx,
+                   int dy,
+                   Bool reverse, Bool upsidedown, Pixel bitplane, void *closure)
+{
+    _glamor_copy_n_to_n(src, dst, gc, box, nbox, dx,
+                        dy, reverse, upsidedown, bitplane, closure, TRUE);
+}
+
+Bool
+glamor_copy_n_to_n_nf(DrawablePtr src,
+                      DrawablePtr dst,
+                      GCPtr gc,
+                      BoxPtr box,
+                      int nbox,
+                      int dx,
+                      int dy,
+                      Bool reverse,
+                      Bool upsidedown, Pixel bitplane, void *closure)
+{
+    return _glamor_copy_n_to_n(src, dst, gc, box, nbox, dx,
+                               dy, reverse, upsidedown, bitplane, closure,
+                               FALSE);
+}
diff --git a/glamor/glamor_copyplane.c b/glamor/glamor_copyplane.c
new file mode 100644 (file)
index 0000000..2bd2de3
--- /dev/null
@@ -0,0 +1,75 @@
+/*
+ * Copyright Â© 2009 Intel Corporation
+ * Copyright Â© 1998 Keith Packard
+ *
+ * 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.
+ *
+ * Authors:
+ *    Zhigang Gong <zhigang.gong@gmail.com>
+ *
+ */
+
+#include "glamor_priv.h"
+
+static Bool
+_glamor_copy_plane(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
+                   int srcx, int srcy, int w, int h, int dstx, int dsty,
+                   unsigned long bitPlane, RegionPtr *pRegion, Bool fallback)
+{
+    if (!fallback && glamor_ddx_fallback_check_gc(pGC)
+        && glamor_ddx_fallback_check_pixmap(pSrc)
+        && glamor_ddx_fallback_check_pixmap(pDst))
+        goto fail;
+
+    if (glamor_prepare_access(pDst, GLAMOR_ACCESS_RW) &&
+        glamor_prepare_access(pSrc, GLAMOR_ACCESS_RO) &&
+        glamor_prepare_access_gc(pGC)) {
+        *pRegion = fbCopyPlane(pSrc, pDst, pGC, srcx, srcy, w, h,
+                               dstx, dsty, bitPlane);
+    }
+    glamor_finish_access_gc(pGC);
+    glamor_finish_access(pSrc);
+    glamor_finish_access(pDst);
+    return TRUE;
+
+ fail:
+    return FALSE;
+}
+
+RegionPtr
+glamor_copy_plane(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
+                  int srcx, int srcy, int w, int h, int dstx, int dsty,
+                  unsigned long bitPlane)
+{
+    RegionPtr ret;
+
+    _glamor_copy_plane(pSrc, pDst, pGC, srcx, srcy, w, h,
+                       dstx, dsty, bitPlane, &ret, TRUE);
+    return ret;
+}
+
+Bool
+glamor_copy_plane_nf(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
+                     int srcx, int srcy, int w, int h, int dstx, int dsty,
+                     unsigned long bitPlane, RegionPtr *pRegion)
+{
+    return _glamor_copy_plane(pSrc, pDst, pGC, srcx, srcy, w, h,
+                              dstx, dsty, bitPlane, pRegion, FALSE);
+}
diff --git a/glamor/glamor_copywindow.c b/glamor/glamor_copywindow.c
new file mode 100644 (file)
index 0000000..1ced4b3
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * Copyright Â© 2008 Intel Corporation
+ * Copyright Â© 1998 Keith Packard
+ *
+ * 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 Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission.  Keith Packard makes no
+ * representations about the suitability of this software for any purpose.  It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD 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.
+ */
+
+#include "glamor_priv.h"
+
+/** @file glamor_copywindow.c
+ *
+ * Screen CopyWindow implementation.
+ */
+
+void
+glamor_copy_window(WindowPtr win, DDXPointRec old_origin, RegionPtr src_region)
+{
+    RegionRec dst_region;
+    int dx, dy;
+    PixmapPtr pixmap = win->drawable.pScreen->GetWindowPixmap(win);
+
+    dx = old_origin.x - win->drawable.x;
+    dy = old_origin.y - win->drawable.y;
+    REGION_TRANSLATE(win->drawable.pScreen, src_region, -dx, -dy);
+
+    REGION_INIT(win->drawable.pScreen, &dst_region, NullBox, 0);
+
+    REGION_INTERSECT(win->drawable.pScreen, &dst_region,
+                     &win->borderClip, src_region);
+#ifdef COMPOSITE
+    if (pixmap->screen_x || pixmap->screen_y)
+        REGION_TRANSLATE(win->drawable.pScreen, &dst_region,
+                         -pixmap->screen_x, -pixmap->screen_y);
+#endif
+
+    miCopyRegion(&pixmap->drawable, &pixmap->drawable,
+                 NULL, &dst_region, dx, dy, glamor_copy_n_to_n, 0, NULL);
+
+    REGION_UNINIT(win->drawable.pScreen, &dst_region);
+}
diff --git a/glamor/glamor_core.c b/glamor/glamor_core.c
new file mode 100644 (file)
index 0000000..b349437
--- /dev/null
@@ -0,0 +1,558 @@
+/*
+ * Copyright Â© 2001 Keith Packard
+ * Copyright Â© 2008 Intel 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.
+ *
+ * Authors:
+ *    Eric Anholt <eric@anholt.net>
+ *
+ */
+
+/** @file glamor_core.c
+ *
+ * This file covers core X rendering in glamor.
+ */
+
+#include <stdlib.h>
+
+#include "glamor_priv.h"
+
+const Bool
+glamor_get_drawable_location(const DrawablePtr drawable)
+{
+    PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable);
+    glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap);
+    glamor_screen_private *glamor_priv =
+        glamor_get_screen_private(drawable->pScreen);
+    if (pixmap_priv == NULL ||
+        pixmap_priv->base.gl_fbo == GLAMOR_FBO_UNATTACHED)
+        return 'm';
+    if (pixmap_priv->base.fbo->fb == glamor_priv->screen_fbo)
+        return 's';
+    else
+        return 'f';
+}
+
+GLint
+glamor_compile_glsl_prog(GLenum type, const char *source)
+{
+    GLint ok;
+    GLint prog;
+
+    prog = glCreateShader(type);
+    glShaderSource(prog, 1, (const GLchar **) &source, NULL);
+    glCompileShader(prog);
+    glGetShaderiv(prog, GL_COMPILE_STATUS, &ok);
+    if (!ok) {
+        GLchar *info;
+        GLint size;
+
+        glGetShaderiv(prog, GL_INFO_LOG_LENGTH, &size);
+        info = malloc(size);
+        if (info) {
+            glGetShaderInfoLog(prog, size, NULL, info);
+            ErrorF("Failed to compile %s: %s\n",
+                   type == GL_FRAGMENT_SHADER ? "FS" : "VS", info);
+            ErrorF("Program source:\n%s", source);
+            free(info);
+        }
+        else
+            ErrorF("Failed to get shader compilation info.\n");
+        FatalError("GLSL compile failure\n");
+    }
+
+    return prog;
+}
+
+void
+glamor_link_glsl_prog(ScreenPtr screen, GLint prog, const char *format, ...)
+{
+    GLint ok;
+    glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
+
+    glLinkProgram(prog);
+    glGetProgramiv(prog, GL_LINK_STATUS, &ok);
+    if (!ok) {
+        GLchar *info;
+        GLint size;
+
+        glGetProgramiv(prog, GL_INFO_LOG_LENGTH, &size);
+        info = malloc(size);
+
+        glGetProgramInfoLog(prog, size, NULL, info);
+        ErrorF("Failed to link: %s\n", info);
+        FatalError("GLSL link failure\n");
+    }
+
+    if (glamor_priv->has_khr_debug) {
+        char *label;
+        va_list va;
+
+        va_start(va, format);
+        XNFvasprintf(&label, format, va);
+        glObjectLabel(GL_PROGRAM, prog, -1, label);
+        free(label);
+        va_end(va);
+    }
+}
+
+Bool
+glamor_prepare_access(DrawablePtr drawable, glamor_access_t access)
+{
+    PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable);
+    glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap);
+
+    if (pixmap->devPrivate.ptr) {
+        /* Already mapped, nothing needs to be done.  Note that we
+         * aren't allowing promotion from RO to RW, because it would
+         * require re-mapping the PBO.
+         */
+        assert(!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv) ||
+               access == GLAMOR_ACCESS_RO ||
+               pixmap_priv->base.map_access == GLAMOR_ACCESS_RW);
+        return TRUE;
+    }
+    pixmap_priv->base.map_access = access;
+
+    return glamor_download_pixmap_to_cpu(pixmap, access);
+}
+
+/*
+ *  When downloading a unsupported color format to CPU memory,
+    we need to shuffle the color elements and then use a supported
+    color format to read it back to CPU memory.
+
+    For an example, the picture's format is PICT_b8g8r8a8,
+    Then the expecting color layout is as below (little endian):
+    0  1       2       3   : address
+    a  r       g       b
+
+    Now the in GLES2 the supported color format is GL_RGBA, type is
+    GL_UNSIGNED_TYPE, then we need to shuffle the fragment
+    color as :
+       frag_color = sample(texture).argb;
+    before we use glReadPixel to get it back.
+
+    For the uploading process, the shuffle is a revert shuffle.
+    We still use GL_RGBA, GL_UNSIGNED_BYTE to upload the color
+    to a texture, then let's see
+    0  1       2       3   : address
+    a  r       g       b   : correct colors
+    R  G       B       A   : GL_RGBA with GL_UNSIGNED_BYTE
+
+    Now we need to shuffle again, the mapping rule is
+    r = G, g = B, b = A, a = R. Then the uploading shuffle is as
+    below:
+       frag_color = sample(texture).gbar;
+*/
+
+void
+glamor_init_finish_access_shaders(ScreenPtr screen)
+{
+    glamor_screen_private *glamor_priv;
+    const char *vs_source =
+        "attribute vec4 v_position;\n"
+        "attribute vec4 v_texcoord0;\n"
+        "varying vec2 source_texture;\n"
+        "void main()\n"
+        "{\n"
+        "      gl_Position = v_position;\n"
+        "      source_texture = v_texcoord0.xy;\n"
+        "}\n";
+
+    const char *common_source =
+        GLAMOR_DEFAULT_PRECISION
+        "varying vec2 source_texture;\n"
+        "uniform sampler2D sampler;\n"
+        "uniform int revert;\n"
+        "uniform int swap_rb;\n"
+        "#define REVERT_NONE                           0\n"
+        "#define REVERT_NORMAL                         1\n"
+        "#define SWAP_NONE_DOWNLOADING                 0\n"
+        "#define SWAP_DOWNLOADING                      1\n"
+        "#define SWAP_UPLOADING                        2\n"
+        "#define SWAP_NONE_UPLOADING           3\n";
+
+    const char *fs_source =
+        "void main()\n"
+        "{\n"
+        "   if (revert == REVERT_NONE) \n"
+        "    { \n"
+        "     if ((swap_rb != SWAP_NONE_DOWNLOADING) && (swap_rb != SWAP_NONE_UPLOADING))   \n"
+        "              gl_FragColor = texture2D(sampler, source_texture).bgra;\n"
+        "     else \n"
+        "              gl_FragColor = texture2D(sampler, source_texture).rgba;\n"
+        "    } \n"
+        "   else \n"
+        "    { \n"
+        "     if (swap_rb == SWAP_DOWNLOADING)   \n"
+        "              gl_FragColor = texture2D(sampler, source_texture).argb;\n"
+        "     else if (swap_rb == SWAP_NONE_DOWNLOADING)\n"
+        "              gl_FragColor = texture2D(sampler, source_texture).abgr;\n"
+        "     else if (swap_rb == SWAP_UPLOADING)\n"
+        "              gl_FragColor = texture2D(sampler, source_texture).gbar;\n"
+        "     else if (swap_rb == SWAP_NONE_UPLOADING)\n"
+        "              gl_FragColor = texture2D(sampler, source_texture).abgr;\n"
+        "    } \n"
+        "}\n";
+
+    const char *set_alpha_source =
+        "void main()\n"
+        "{\n"
+        "   if (revert == REVERT_NONE) \n"
+        "    { \n"
+        "     if ((swap_rb != SWAP_NONE_DOWNLOADING) && (swap_rb != SWAP_NONE_UPLOADING))   \n"
+        "              gl_FragColor = vec4(texture2D(sampler, source_texture).bgr, 1);\n"
+        "     else \n"
+        "              gl_FragColor = vec4(texture2D(sampler, source_texture).rgb, 1);\n"
+        "    } \n"
+        "   else \n"
+        "    { \n"
+        "     if (swap_rb == SWAP_DOWNLOADING)   \n"
+        "              gl_FragColor = vec4(1, texture2D(sampler, source_texture).rgb);\n"
+        "     else if (swap_rb == SWAP_NONE_DOWNLOADING)\n"
+        "              gl_FragColor = vec4(1, texture2D(sampler, source_texture).bgr);\n"
+        "     else if (swap_rb == SWAP_UPLOADING)\n"
+        "              gl_FragColor = vec4(texture2D(sampler, source_texture).gba, 1);\n"
+        "     else if (swap_rb == SWAP_NONE_UPLOADING)\n"
+        "              gl_FragColor = vec4(texture2D(sampler, source_texture).abg, 1);\n"
+        "    } \n"
+        "}\n";
+    GLint fs_prog, vs_prog, avs_prog, set_alpha_prog;
+    GLint sampler_uniform_location;
+    char *source;
+
+    glamor_priv = glamor_get_screen_private(screen);
+    glamor_make_current(glamor_priv);
+    glamor_priv->finish_access_prog[0] = glCreateProgram();
+    glamor_priv->finish_access_prog[1] = glCreateProgram();
+
+    vs_prog = glamor_compile_glsl_prog(GL_VERTEX_SHADER, vs_source);
+
+    XNFasprintf(&source, "%s%s", common_source, fs_source);
+    fs_prog = glamor_compile_glsl_prog(GL_FRAGMENT_SHADER, source);
+    free(source);
+
+    glAttachShader(glamor_priv->finish_access_prog[0], vs_prog);
+    glAttachShader(glamor_priv->finish_access_prog[0], fs_prog);
+
+    avs_prog = glamor_compile_glsl_prog(GL_VERTEX_SHADER, vs_source);
+
+    XNFasprintf(&source, "%s%s", common_source, set_alpha_source);
+    set_alpha_prog = glamor_compile_glsl_prog(GL_FRAGMENT_SHADER,
+                                              source);
+    free(source);
+
+    glAttachShader(glamor_priv->finish_access_prog[1], avs_prog);
+    glAttachShader(glamor_priv->finish_access_prog[1], set_alpha_prog);
+
+    glBindAttribLocation(glamor_priv->finish_access_prog[0],
+                         GLAMOR_VERTEX_POS, "v_position");
+    glBindAttribLocation(glamor_priv->finish_access_prog[0],
+                         GLAMOR_VERTEX_SOURCE, "v_texcoord0");
+    glamor_link_glsl_prog(screen, glamor_priv->finish_access_prog[0],
+                          "finish access 0");
+
+    glBindAttribLocation(glamor_priv->finish_access_prog[1],
+                         GLAMOR_VERTEX_POS, "v_position");
+    glBindAttribLocation(glamor_priv->finish_access_prog[1],
+                         GLAMOR_VERTEX_SOURCE, "v_texcoord0");
+    glamor_link_glsl_prog(screen, glamor_priv->finish_access_prog[1],
+                          "finish access 1");
+
+    glamor_priv->finish_access_revert[0] =
+        glGetUniformLocation(glamor_priv->finish_access_prog[0], "revert");
+
+    glamor_priv->finish_access_swap_rb[0] =
+        glGetUniformLocation(glamor_priv->finish_access_prog[0], "swap_rb");
+    sampler_uniform_location =
+        glGetUniformLocation(glamor_priv->finish_access_prog[0], "sampler");
+    glUseProgram(glamor_priv->finish_access_prog[0]);
+    glUniform1i(sampler_uniform_location, 0);
+    glUniform1i(glamor_priv->finish_access_revert[0], 0);
+    glUniform1i(glamor_priv->finish_access_swap_rb[0], 0);
+
+    glamor_priv->finish_access_revert[1] =
+        glGetUniformLocation(glamor_priv->finish_access_prog[1], "revert");
+    glamor_priv->finish_access_swap_rb[1] =
+        glGetUniformLocation(glamor_priv->finish_access_prog[1], "swap_rb");
+    sampler_uniform_location =
+        glGetUniformLocation(glamor_priv->finish_access_prog[1], "sampler");
+    glUseProgram(glamor_priv->finish_access_prog[1]);
+    glUniform1i(glamor_priv->finish_access_revert[1], 0);
+    glUniform1i(sampler_uniform_location, 0);
+    glUniform1i(glamor_priv->finish_access_swap_rb[1], 0);
+}
+
+void
+glamor_fini_finish_access_shaders(ScreenPtr screen)
+{
+    glamor_screen_private *glamor_priv;
+
+    glamor_priv = glamor_get_screen_private(screen);
+    glamor_make_current(glamor_priv);
+    glDeleteProgram(glamor_priv->finish_access_prog[0]);
+    glDeleteProgram(glamor_priv->finish_access_prog[1]);
+}
+
+void
+glamor_finish_access(DrawablePtr drawable)
+{
+    PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable);
+    glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap);
+    glamor_screen_private *glamor_priv =
+        glamor_get_screen_private(drawable->pScreen);
+
+    if (!GLAMOR_PIXMAP_PRIV_HAS_FBO_DOWNLOADED(pixmap_priv))
+        return;
+
+    /* If we are doing a series of unmaps from a nested map, we're
+     * done.  None of the callers do any rendering to maps after
+     * starting an unmap sequence, so we don't need to delay until the
+     * last nested unmap.
+     */
+    if (!pixmap->devPrivate.ptr)
+        return;
+
+    if (pixmap_priv->base.map_access == GLAMOR_ACCESS_RW) {
+        glamor_restore_pixmap_to_texture(pixmap);
+    }
+
+    if (pixmap_priv->base.fbo->pbo != 0 && pixmap_priv->base.fbo->pbo_valid) {
+        assert(glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP);
+
+        glamor_make_current(glamor_priv);
+        glBindBuffer(GL_PIXEL_PACK_BUFFER, 0);
+        glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
+        glDeleteBuffers(1, &pixmap_priv->base.fbo->pbo);
+
+        pixmap_priv->base.fbo->pbo_valid = FALSE;
+        pixmap_priv->base.fbo->pbo = 0;
+    }
+    else {
+        free(pixmap->devPrivate.ptr);
+    }
+
+    if (pixmap_priv->type == GLAMOR_TEXTURE_DRM)
+        pixmap->devKind = pixmap_priv->base.drm_stride;
+
+    if (pixmap_priv->base.gl_fbo == GLAMOR_FBO_DOWNLOADED)
+        pixmap_priv->base.gl_fbo = GLAMOR_FBO_NORMAL;
+
+    pixmap->devPrivate.ptr = NULL;
+}
+
+/**
+ * Calls uxa_prepare_access with UXA_PREPARE_SRC for the tile, if that is the
+ * current fill style.
+ *
+ * Solid doesn't use an extra pixmap source, so we don't worry about them.
+ * Stippled/OpaqueStippled are 1bpp and can be in fb, so we should worry
+ * about them.
+ */
+Bool
+glamor_prepare_access_gc(GCPtr gc)
+{
+    if (gc->stipple) {
+        if (!glamor_prepare_access(&gc->stipple->drawable, GLAMOR_ACCESS_RO))
+            return FALSE;
+    }
+    if (gc->fillStyle == FillTiled) {
+        if (!glamor_prepare_access(&gc->tile.pixmap->drawable,
+                                   GLAMOR_ACCESS_RO)) {
+            if (gc->stipple)
+                glamor_finish_access(&gc->stipple->drawable);
+            return FALSE;
+        }
+    }
+    return TRUE;
+}
+
+/**
+ * Finishes access to the tile in the GC, if used.
+ */
+void
+glamor_finish_access_gc(GCPtr gc)
+{
+    if (gc->fillStyle == FillTiled)
+        glamor_finish_access(&gc->tile.pixmap->drawable);
+    if (gc->stipple)
+        glamor_finish_access(&gc->stipple->drawable);
+}
+
+Bool
+glamor_stipple(PixmapPtr pixmap, PixmapPtr stipple,
+               int x, int y, int width, int height,
+               unsigned char alu, unsigned long planemask,
+               unsigned long fg_pixel, unsigned long bg_pixel,
+               int stipple_x, int stipple_y)
+{
+    glamor_fallback("stubbed out stipple depth %d\n", pixmap->drawable.depth);
+    return FALSE;
+}
+
+GCOps glamor_gc_ops = {
+    .FillSpans = glamor_fill_spans,
+    .SetSpans = glamor_set_spans,
+    .PutImage = glamor_put_image,
+    .CopyArea = glamor_copy_area,
+    .CopyPlane = glamor_copy_plane,
+    .PolyPoint = glamor_poly_point,
+    .Polylines = glamor_poly_lines,
+    .PolySegment = glamor_poly_segment,
+    .PolyRectangle = miPolyRectangle,
+    .PolyArc = miPolyArc,
+    .FillPolygon = miFillPolygon,
+    .PolyFillRect = glamor_poly_fill_rect,
+    .PolyFillArc = miPolyFillArc,
+    .PolyText8 = glamor_poly_text8,
+    .PolyText16 = glamor_poly_text16,
+    .ImageText8 = glamor_image_text8,
+    .ImageText16 = glamor_image_text16,
+    .ImageGlyphBlt = miImageGlyphBlt,
+    .PolyGlyphBlt = glamor_poly_glyph_blt,
+    .PushPixels = glamor_push_pixels,
+};
+
+/**
+ * uxa_validate_gc() sets the ops to glamor's implementations, which may be
+ * accelerated or may sync the card and fall back to fb.
+ */
+void
+glamor_validate_gc(GCPtr gc, unsigned long changes, DrawablePtr drawable)
+{
+    /* fbValidateGC will do direct access to pixmaps if the tiling has changed.
+     * Preempt fbValidateGC by doing its work and masking the change out, so
+     * that we can do the Prepare/finish_access.
+     */
+#ifdef FB_24_32BIT
+    if ((changes & GCTile) && fbGetRotatedPixmap(gc)) {
+        gc->pScreen->DestroyPixmap(fbGetRotatedPixmap(gc));
+        fbGetRotatedPixmap(gc) = 0;
+    }
+
+    if (gc->fillStyle == FillTiled) {
+        PixmapPtr old_tile, new_tile;
+
+        old_tile = gc->tile.pixmap;
+        if (old_tile->drawable.bitsPerPixel != drawable->bitsPerPixel) {
+            new_tile = fbGetRotatedPixmap(gc);
+            if (!new_tile ||
+                new_tile->drawable.bitsPerPixel != drawable->bitsPerPixel) {
+                if (new_tile)
+                    gc->pScreen->DestroyPixmap(new_tile);
+                /* fb24_32ReformatTile will do direct access of a newly-
+                 * allocated pixmap.
+                 */
+                glamor_fallback
+                    ("GC %p tile FB_24_32 transformat %p.\n", gc, old_tile);
+
+                if (glamor_prepare_access
+                    (&old_tile->drawable, GLAMOR_ACCESS_RO)) {
+                    new_tile =
+                        fb24_32ReformatTile(old_tile, drawable->bitsPerPixel);
+                    glamor_finish_access(&old_tile->drawable);
+                }
+            }
+            if (new_tile) {
+                fbGetRotatedPixmap(gc) = old_tile;
+                gc->tile.pixmap = new_tile;
+                changes |= GCTile;
+            }
+        }
+    }
+#endif
+    if (changes & GCTile) {
+        if (!gc->tileIsPixel) {
+            glamor_pixmap_private *pixmap_priv =
+                glamor_get_pixmap_private(gc->tile.pixmap);
+            if ((!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv))
+                && FbEvenTile(gc->tile.pixmap->drawable.width *
+                              drawable->bitsPerPixel)) {
+                glamor_fallback
+                    ("GC %p tile changed %p.\n", gc, gc->tile.pixmap);
+                if (glamor_prepare_access
+                    (&gc->tile.pixmap->drawable, GLAMOR_ACCESS_RW)) {
+                    fbPadPixmap(gc->tile.pixmap);
+                    glamor_finish_access(&gc->tile.pixmap->drawable);
+                }
+            }
+        }
+        /* Mask out the GCTile change notification, now that we've done FB's
+         * job for it.
+         */
+        changes &= ~GCTile;
+    }
+
+    if (changes & GCStipple && gc->stipple) {
+        /* We can't inline stipple handling like we do for GCTile because
+         * it sets fbgc privates.
+         */
+        if (glamor_prepare_access(&gc->stipple->drawable, GLAMOR_ACCESS_RW)) {
+            fbValidateGC(gc, changes, drawable);
+            glamor_finish_access(&gc->stipple->drawable);
+        }
+    }
+    else {
+        fbValidateGC(gc, changes, drawable);
+    }
+
+    gc->ops = &glamor_gc_ops;
+}
+
+static GCFuncs glamor_gc_funcs = {
+    glamor_validate_gc,
+    miChangeGC,
+    miCopyGC,
+    miDestroyGC,
+    miChangeClip,
+    miDestroyClip,
+    miCopyClip
+};
+
+/**
+ * exaCreateGC makes a new GC and hooks up its funcs handler, so that
+ * exaValidateGC() will get called.
+ */
+int
+glamor_create_gc(GCPtr gc)
+{
+    if (!fbCreateGC(gc))
+        return FALSE;
+
+    gc->funcs = &glamor_gc_funcs;
+
+    return TRUE;
+}
+
+RegionPtr
+glamor_bitmap_to_region(PixmapPtr pixmap)
+{
+    RegionPtr ret;
+
+    glamor_fallback("pixmap %p \n", pixmap);
+    if (!glamor_prepare_access(&pixmap->drawable, GLAMOR_ACCESS_RO))
+        return NULL;
+    ret = fbPixmapToRegion(pixmap);
+    glamor_finish_access(&pixmap->drawable);
+    return ret;
+}
+
diff --git a/glamor/glamor_debug.h b/glamor/glamor_debug.h
new file mode 100644 (file)
index 0000000..638bee2
--- /dev/null
@@ -0,0 +1,107 @@
+/*
+ * Copyright Â© 2009 Intel Corporation
+ * Copyright Â© 1998 Keith Packard
+ *
+ * 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.
+ *
+ * Authors:
+ *    Zhigang Gong <zhigang.gong@gmail.com>
+ *
+ */
+
+#ifndef __GLAMOR_DEBUG_H__
+#define __GLAMOR_DEBUG_H__
+
+#define GLAMOR_DELAYED_STRING_MAX 64
+
+#define GLAMOR_DEBUG_NONE                     0
+#define GLAMOR_DEBUG_UNIMPL                   0
+#define GLAMOR_DEBUG_FALLBACK                 1
+#define GLAMOR_DEBUG_TEXTURE_DOWNLOAD         2
+#define GLAMOR_DEBUG_TEXTURE_DYNAMIC_UPLOAD   3
+
+extern void
+AbortServer(void)
+    _X_NORETURN;
+
+#define GLAMOR_PANIC(_format_, ...)                    \
+  do {                                                 \
+    LogMessageVerb(X_NONE, 0, "Glamor Fatal Error"     \
+                  " at %32s line %d: " _format_ "\n",  \
+                  __FUNCTION__, __LINE__,              \
+                  ##__VA_ARGS__ );                     \
+    exit(1);                                            \
+  } while(0)
+
+#define __debug_output_message(_format_, _prefix_, ...) \
+  LogMessageVerb(X_NONE, 0,                            \
+                "%32s:\t" _format_ ,           \
+                /*_prefix_,*/                          \
+                __FUNCTION__,                          \
+                ##__VA_ARGS__)
+
+#define glamor_debug_output(_level_, _format_,...)     \
+  do {                                                 \
+    if (glamor_debug_level >= _level_)                 \
+      __debug_output_message(_format_,                 \
+                            "Glamor debug",            \
+                            ##__VA_ARGS__);            \
+  } while(0)
+
+#define glamor_fallback(_format_,...)                  \
+  do {                                                 \
+    if (glamor_debug_level >= GLAMOR_DEBUG_FALLBACK)   \
+      __debug_output_message(_format_,                 \
+                            "Glamor fallback",         \
+                            ##__VA_ARGS__);} while(0)
+
+#define glamor_delayed_fallback(_screen_, _format_,...)                        \
+  do {                                                                 \
+    if (glamor_debug_level >= GLAMOR_DEBUG_FALLBACK)  {                        \
+      glamor_screen_private *_glamor_priv_;                            \
+      _glamor_priv_ = glamor_get_screen_private(_screen_);             \
+      _glamor_priv_->delayed_fallback_pending = 1;                     \
+      snprintf(_glamor_priv_->delayed_fallback_string,                 \
+              GLAMOR_DELAYED_STRING_MAX,                               \
+              "glamor delayed fallback: \t%s " _format_ ,              \
+               __FUNCTION__, ##__VA_ARGS__); } } while(0)
+
+#define glamor_clear_delayed_fallbacks(_screen_)                       \
+  do {                                                                 \
+    if (glamor_debug_level >= GLAMOR_DEBUG_FALLBACK) {                 \
+      glamor_screen_private *_glamor_priv_;                            \
+       _glamor_priv_ = glamor_get_screen_private(_screen_);            \
+      _glamor_priv_->delayed_fallback_pending = 0;  } } while(0)
+
+#define glamor_report_delayed_fallbacks(_screen_)                      \
+  do {                                                                 \
+    if (glamor_debug_level >= GLAMOR_DEBUG_FALLBACK) {                 \
+      glamor_screen_private *_glamor_priv_;                            \
+      _glamor_priv_ = glamor_get_screen_private(_screen_);             \
+      LogMessageVerb(X_INFO, 0, "%s",                                  \
+                    _glamor_priv_->delayed_fallback_string);           \
+      _glamor_priv_->delayed_fallback_pending = 0;  } } while(0)
+
+#define DEBUGF(str, ...)  do {} while(0)
+//#define DEBUGF(str, ...) ErrorF(str, ##__VA_ARGS__)
+#define DEBUGRegionPrint(x) do {} while (0)
+//#define DEBUGRegionPrint RegionPrint
+
+#endif
diff --git a/glamor/glamor_egl.c b/glamor/glamor_egl.c
new file mode 100644 (file)
index 0000000..54af275
--- /dev/null
@@ -0,0 +1,833 @@
+/*
+ * Copyright Â© 2010 Intel 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.
+ *
+ * Authors:
+ *    Zhigang Gong <zhigang.gong@linux.intel.com>
+ *
+ */
+
+#include "dix-config.h"
+
+#define GLAMOR_FOR_XORG
+#include <xorg-server.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <errno.h>
+#include <xf86.h>
+#include <xf86drm.h>
+#define EGL_DISPLAY_NO_X_MESA
+
+#ifdef GLAMOR_HAS_GBM
+#include <gbm.h>
+#include <drm_fourcc.h>
+#endif
+
+#define MESA_EGL_NO_X11_HEADERS
+#include <epoxy/gl.h>
+#include <epoxy/egl.h>
+
+#include "glamor.h"
+#include "glamor_priv.h"
+#include "dri3.h"
+
+static const char glamor_name[] = "glamor";
+
+static void
+glamor_identify(int flags)
+{
+    xf86Msg(X_INFO, "%s: OpenGL accelerated X.org driver based.\n",
+            glamor_name);
+}
+
+struct glamor_egl_screen_private {
+    EGLDisplay display;
+    EGLContext context;
+    EGLint major, minor;
+    char *device_path;
+
+    CreateScreenResourcesProcPtr CreateScreenResources;
+    CloseScreenProcPtr CloseScreen;
+    int fd;
+    EGLImageKHR front_image;
+    PixmapPtr *back_pixmap;
+    int cpp;
+#ifdef GLAMOR_HAS_GBM
+    struct gbm_device *gbm;
+#endif
+    int has_gem;
+    int gl_context_depth;
+    int dri3_capable;
+
+    CloseScreenProcPtr saved_close_screen;
+    xf86FreeScreenProc *saved_free_screen;
+};
+
+int xf86GlamorEGLPrivateIndex = -1;
+
+
+static struct glamor_egl_screen_private *
+glamor_egl_get_screen_private(ScrnInfoPtr scrn)
+{
+    return (struct glamor_egl_screen_private *)
+        scrn->privates[xf86GlamorEGLPrivateIndex].ptr;
+}
+
+static void
+glamor_egl_make_current(struct glamor_context *glamor_ctx)
+{
+    /* There's only a single global dispatch table in Mesa.  EGL, GLX,
+     * and AIGLX's direct dispatch table manipulation don't talk to
+     * each other.  We need to set the context to NULL first to avoid
+     * EGL's no-op context change fast path when switching back to
+     * EGL.
+     */
+    eglMakeCurrent(glamor_ctx->display, EGL_NO_SURFACE,
+                   EGL_NO_SURFACE, EGL_NO_CONTEXT);
+
+    if (!eglMakeCurrent(glamor_ctx->display,
+                        EGL_NO_SURFACE, EGL_NO_SURFACE,
+                        glamor_ctx->ctx)) {
+        FatalError("Failed to make EGL context current\n");
+    }
+}
+
+static EGLImageKHR
+_glamor_egl_create_image(struct glamor_egl_screen_private *glamor_egl,
+                         int width, int height, int stride, int name, int depth)
+{
+    EGLImageKHR image;
+
+    EGLint attribs[] = {
+        EGL_WIDTH, 0,
+        EGL_HEIGHT, 0,
+        EGL_DRM_BUFFER_STRIDE_MESA, 0,
+        EGL_DRM_BUFFER_FORMAT_MESA,
+        EGL_DRM_BUFFER_FORMAT_ARGB32_MESA,
+        EGL_DRM_BUFFER_USE_MESA,
+        EGL_DRM_BUFFER_USE_SHARE_MESA | EGL_DRM_BUFFER_USE_SCANOUT_MESA,
+        EGL_NONE
+    };
+    attribs[1] = width;
+    attribs[3] = height;
+    attribs[5] = stride;
+    if (depth != 32 && depth != 24)
+        return EGL_NO_IMAGE_KHR;
+    image = eglCreateImageKHR(glamor_egl->display,
+                              glamor_egl->context,
+                              EGL_DRM_BUFFER_MESA,
+                              (void *) (uintptr_t) name,
+                              attribs);
+    if (image == EGL_NO_IMAGE_KHR)
+        return EGL_NO_IMAGE_KHR;
+
+    return image;
+}
+
+static int
+glamor_get_flink_name(int fd, int handle, int *name)
+{
+    struct drm_gem_flink flink;
+
+    flink.handle = handle;
+    if (ioctl(fd, DRM_IOCTL_GEM_FLINK, &flink) < 0)
+        return FALSE;
+    *name = flink.name;
+    return TRUE;
+}
+
+static Bool
+glamor_create_texture_from_image(ScreenPtr screen,
+                                 EGLImageKHR image, GLuint * texture)
+{
+    struct glamor_screen_private *glamor_priv =
+        glamor_get_screen_private(screen);
+
+    glamor_make_current(glamor_priv);
+
+    glGenTextures(1, texture);
+    glBindTexture(GL_TEXTURE_2D, *texture);
+    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+
+    glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, image);
+    glBindTexture(GL_TEXTURE_2D, 0);
+
+    return TRUE;
+}
+
+unsigned int
+glamor_egl_create_argb8888_based_texture(ScreenPtr screen, int w, int h)
+{
+    ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
+    struct glamor_egl_screen_private *glamor_egl;
+    EGLImageKHR image;
+    GLuint texture;
+
+#ifdef GLAMOR_HAS_GBM
+    struct gbm_bo *bo;
+    EGLNativePixmapType native_pixmap;
+
+    glamor_egl = glamor_egl_get_screen_private(scrn);
+    bo = gbm_bo_create(glamor_egl->gbm, w, h, GBM_FORMAT_ARGB8888,
+                       GBM_BO_USE_RENDERING | GBM_BO_USE_SCANOUT);
+    if (!bo)
+        return 0;
+
+    /* If the following assignment raises an error or a warning
+     * then that means EGLNativePixmapType is not struct gbm_bo *
+     * on your platform: This code won't work and you should not
+     * compile with dri3 support enabled */
+    native_pixmap = bo;
+
+    image = eglCreateImageKHR(glamor_egl->display,
+                              EGL_NO_CONTEXT,
+                              EGL_NATIVE_PIXMAP_KHR,
+                              native_pixmap, NULL);
+    gbm_bo_destroy(bo);
+    if (image == EGL_NO_IMAGE_KHR)
+        return 0;
+    glamor_create_texture_from_image(screen, image, &texture);
+    eglDestroyImageKHR(glamor_egl->display, image);
+
+    return texture;
+#else
+    return 0;                   /* this path should never happen */
+#endif
+}
+
+Bool
+glamor_egl_create_textured_screen(ScreenPtr screen, int handle, int stride)
+{
+    ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
+    struct glamor_pixmap_private *pixmap_priv;
+    struct glamor_egl_screen_private *glamor_egl;
+    PixmapPtr screen_pixmap;
+
+    glamor_egl = glamor_egl_get_screen_private(scrn);
+    screen_pixmap = screen->GetScreenPixmap(screen);
+    pixmap_priv = glamor_get_pixmap_private(screen_pixmap);
+
+    if (!glamor_egl_create_textured_pixmap(screen_pixmap, handle, stride)) {
+        xf86DrvMsg(scrn->scrnIndex, X_ERROR,
+                   "Failed to create textured screen.");
+        return FALSE;
+    }
+
+    glamor_egl->front_image = pixmap_priv->base.image;
+    glamor_set_screen_pixmap(screen_pixmap, glamor_egl->back_pixmap);
+    return TRUE;
+}
+
+Bool
+glamor_egl_create_textured_screen_ext(ScreenPtr screen,
+                                      int handle,
+                                      int stride, PixmapPtr *back_pixmap)
+{
+    ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
+    struct glamor_egl_screen_private *glamor_egl;
+
+    glamor_egl = glamor_egl_get_screen_private(scrn);
+
+    glamor_egl->back_pixmap = back_pixmap;
+    if (!glamor_egl_create_textured_screen(screen, handle, stride))
+        return FALSE;
+    return TRUE;
+}
+
+static Bool
+glamor_egl_check_has_gem(int fd)
+{
+    struct drm_gem_flink flink;
+
+    flink.handle = 0;
+
+    ioctl(fd, DRM_IOCTL_GEM_FLINK, &flink);
+    if (errno == ENOENT || errno == EINVAL)
+        return TRUE;
+    return FALSE;
+}
+
+Bool
+glamor_egl_create_textured_pixmap(PixmapPtr pixmap, int handle, int stride)
+{
+    ScreenPtr screen = pixmap->drawable.pScreen;
+    ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
+    struct glamor_screen_private *glamor_priv =
+        glamor_get_screen_private(screen);
+    struct glamor_pixmap_private *pixmap_priv =
+        glamor_get_pixmap_private(pixmap);
+    struct glamor_egl_screen_private *glamor_egl;
+    EGLImageKHR image;
+    GLuint texture;
+    int name;
+    Bool ret = FALSE;
+
+    glamor_egl = glamor_egl_get_screen_private(scrn);
+
+    glamor_make_current(glamor_priv);
+    if (glamor_egl->has_gem) {
+        if (!glamor_get_flink_name(glamor_egl->fd, handle, &name)) {
+            xf86DrvMsg(scrn->scrnIndex, X_ERROR,
+                       "Couldn't flink pixmap handle\n");
+            glamor_set_pixmap_type(pixmap, GLAMOR_DRM_ONLY);
+            assert(0);
+            return FALSE;
+        }
+    }
+    else
+        name = handle;
+
+    image = _glamor_egl_create_image(glamor_egl,
+                                     pixmap->drawable.width,
+                                     pixmap->drawable.height,
+                                     ((stride * 8 +
+                                       7) / pixmap->drawable.bitsPerPixel),
+                                     name, pixmap->drawable.depth);
+    if (image == EGL_NO_IMAGE_KHR) {
+        glamor_set_pixmap_type(pixmap, GLAMOR_DRM_ONLY);
+        goto done;
+    }
+    glamor_create_texture_from_image(screen, image, &texture);
+    glamor_set_pixmap_type(pixmap, GLAMOR_TEXTURE_DRM);
+    glamor_set_pixmap_texture(pixmap, texture);
+    pixmap_priv->base.image = image;
+    ret = TRUE;
+
+ done:
+    return ret;
+}
+
+Bool
+glamor_egl_create_textured_pixmap_from_gbm_bo(PixmapPtr pixmap, void *bo)
+{
+    ScreenPtr screen = pixmap->drawable.pScreen;
+    ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
+    struct glamor_screen_private *glamor_priv =
+        glamor_get_screen_private(screen);
+    struct glamor_pixmap_private *pixmap_priv =
+        glamor_get_pixmap_private(pixmap);
+    struct glamor_egl_screen_private *glamor_egl;
+    EGLImageKHR image;
+    GLuint texture;
+    Bool ret = FALSE;
+
+    glamor_egl = glamor_egl_get_screen_private(scrn);
+
+    glamor_make_current(glamor_priv);
+
+    image = eglCreateImageKHR(glamor_egl->display,
+                              glamor_egl->context,
+                              EGL_NATIVE_PIXMAP_KHR, bo, NULL);
+    if (image == EGL_NO_IMAGE_KHR) {
+        glamor_set_pixmap_type(pixmap, GLAMOR_DRM_ONLY);
+        goto done;
+    }
+    glamor_create_texture_from_image(screen, image, &texture);
+    glamor_set_pixmap_type(pixmap, GLAMOR_TEXTURE_DRM);
+    glamor_set_pixmap_texture(pixmap, texture);
+    pixmap_priv->base.image = image;
+    ret = TRUE;
+
+ done:
+    return ret;
+}
+
+#ifdef GLAMOR_HAS_GBM
+int glamor_get_fd_from_bo(int gbm_fd, struct gbm_bo *bo, int *fd);
+void glamor_get_name_from_bo(int gbm_fd, struct gbm_bo *bo, int *name);
+int
+glamor_get_fd_from_bo(int gbm_fd, struct gbm_bo *bo, int *fd)
+{
+    union gbm_bo_handle handle;
+    struct drm_prime_handle args;
+
+    handle = gbm_bo_get_handle(bo);
+    args.handle = handle.u32;
+    args.flags = DRM_CLOEXEC;
+    if (ioctl(gbm_fd, DRM_IOCTL_PRIME_HANDLE_TO_FD, &args))
+        return FALSE;
+    *fd = args.fd;
+    return TRUE;
+}
+
+void
+glamor_get_name_from_bo(int gbm_fd, struct gbm_bo *bo, int *name)
+{
+    union gbm_bo_handle handle;
+
+    handle = gbm_bo_get_handle(bo);
+    if (!glamor_get_flink_name(gbm_fd, handle.u32, name))
+        *name = -1;
+}
+#endif
+
+int
+glamor_egl_dri3_fd_name_from_tex(ScreenPtr screen,
+                                 PixmapPtr pixmap,
+                                 unsigned int tex,
+                                 Bool want_name, CARD16 *stride, CARD32 *size)
+{
+#ifdef GLAMOR_HAS_GBM
+    ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
+    struct glamor_pixmap_private *pixmap_priv =
+        glamor_get_pixmap_private(pixmap);
+    struct glamor_screen_private *glamor_priv =
+        glamor_get_screen_private(screen);
+    struct glamor_egl_screen_private *glamor_egl;
+    EGLImageKHR image;
+    struct gbm_bo *bo;
+    int fd = -1;
+
+    EGLint attribs[] = {
+        EGL_IMAGE_PRESERVED_KHR, EGL_TRUE,
+        EGL_GL_TEXTURE_LEVEL_KHR, 0,
+        EGL_NONE
+    };
+
+    glamor_egl = glamor_egl_get_screen_private(scrn);
+
+    glamor_make_current(glamor_priv);
+
+    image = pixmap_priv->base.image;
+    if (!image) {
+        image = eglCreateImageKHR(glamor_egl->display,
+                                  glamor_egl->context,
+                                  EGL_GL_TEXTURE_2D_KHR,
+                                  (EGLClientBuffer) (uintptr_t)
+                                  tex, attribs);
+        if (image == EGL_NO_IMAGE_KHR)
+            goto failure;
+
+        pixmap_priv->base.image = image;
+        glamor_set_pixmap_type(pixmap, GLAMOR_TEXTURE_DRM);
+    }
+
+    bo = gbm_bo_import(glamor_egl->gbm, GBM_BO_IMPORT_EGL_IMAGE, image, 0);
+    if (!bo)
+        goto failure;
+
+    pixmap->devKind = gbm_bo_get_stride(bo);
+
+    if (want_name) {
+        if (glamor_egl->has_gem)
+            glamor_get_name_from_bo(glamor_egl->fd, bo, &fd);
+    }
+    else {
+        if (glamor_get_fd_from_bo(glamor_egl->fd, bo, &fd)) {
+        }
+    }
+    *stride = pixmap->devKind;
+    *size = pixmap->devKind * gbm_bo_get_height(bo);
+
+    gbm_bo_destroy(bo);
+ failure:
+    return fd;
+#else
+    return -1;
+#endif
+}
+
+_X_EXPORT PixmapPtr
+glamor_pixmap_from_fd(ScreenPtr screen,
+                      int fd,
+                      CARD16 width,
+                      CARD16 height,
+                      CARD16 stride, CARD8 depth, CARD8 bpp)
+{
+#ifdef GLAMOR_HAS_GBM
+    ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
+    struct glamor_egl_screen_private *glamor_egl;
+    struct gbm_bo *bo;
+    EGLImageKHR image;
+    PixmapPtr pixmap;
+    Bool ret = FALSE;
+
+    EGLint attribs[] = {
+        EGL_WIDTH, 0,
+        EGL_HEIGHT, 0,
+        EGL_LINUX_DRM_FOURCC_EXT, DRM_FORMAT_ARGB8888,
+        EGL_DMA_BUF_PLANE0_FD_EXT, 0,
+        EGL_DMA_BUF_PLANE0_OFFSET_EXT, 0,
+        EGL_DMA_BUF_PLANE0_PITCH_EXT, 0,
+        EGL_NONE
+    };
+
+    glamor_egl = glamor_egl_get_screen_private(scrn);
+
+    if (!glamor_egl->dri3_capable)
+        return NULL;
+
+    if (bpp != 32 || !(depth == 24 || depth == 32) || width == 0 || height == 0)
+        return NULL;
+
+    attribs[1] = width;
+    attribs[3] = height;
+    attribs[7] = fd;
+    attribs[11] = stride;
+    image = eglCreateImageKHR(glamor_egl->display,
+                              EGL_NO_CONTEXT,
+                              EGL_LINUX_DMA_BUF_EXT,
+                              NULL, attribs);
+
+    if (image == EGL_NO_IMAGE_KHR)
+        return NULL;
+
+    /* EGL_EXT_image_dma_buf_import can impose restrictions on the
+     * usage of the image. Use gbm_bo to bypass the limitations. */
+
+    bo = gbm_bo_import(glamor_egl->gbm, GBM_BO_IMPORT_EGL_IMAGE, image, 0);
+    eglDestroyImageKHR(glamor_egl->display, image);
+
+    if (!bo)
+        return NULL;
+
+    pixmap = screen->CreatePixmap(screen, 0, 0, depth, 0);
+    screen->ModifyPixmapHeader(pixmap, width, height, 0, 0, stride, NULL);
+
+    ret = glamor_egl_create_textured_pixmap_from_gbm_bo(pixmap, bo);
+    gbm_bo_destroy(bo);
+
+    if (ret)
+        return pixmap;
+    else {
+        screen->DestroyPixmap(pixmap);
+        return NULL;
+    }
+#else
+    return NULL;
+#endif
+}
+
+static void
+_glamor_egl_destroy_pixmap_image(PixmapPtr pixmap)
+{
+    ScrnInfoPtr scrn = xf86ScreenToScrn(pixmap->drawable.pScreen);
+    struct glamor_egl_screen_private *glamor_egl =
+        glamor_egl_get_screen_private(scrn);
+    struct glamor_pixmap_private *pixmap_priv =
+        glamor_get_pixmap_private(pixmap);
+
+    if (pixmap_priv->base.image) {
+        /* Before destroy an image which was attached to
+         * a texture. we must call glFlush to make sure the
+         * operation on that texture has been done.*/
+        glamor_block_handler(pixmap->drawable.pScreen);
+        eglDestroyImageKHR(glamor_egl->display, pixmap_priv->base.image);
+        pixmap_priv->base.image = NULL;
+    }
+}
+
+_X_EXPORT void
+glamor_egl_exchange_buffers(PixmapPtr front, PixmapPtr back)
+{
+    ScrnInfoPtr scrn = xf86ScreenToScrn(front->drawable.pScreen);
+    struct glamor_egl_screen_private *glamor_egl =
+        glamor_egl_get_screen_private(scrn);
+    EGLImageKHR temp;
+    struct glamor_pixmap_private *front_priv =
+        glamor_get_pixmap_private(front);
+    struct glamor_pixmap_private *back_priv =
+        glamor_get_pixmap_private(back);
+
+    glamor_pixmap_exchange_fbos(front, back);
+
+    temp = back_priv->base.image;
+    back_priv->base.image = front_priv->base.image;
+    front_priv->base.image = temp;
+
+    glamor_set_pixmap_type(front, GLAMOR_TEXTURE_DRM);
+    glamor_set_pixmap_type(back, GLAMOR_TEXTURE_DRM);
+    glamor_egl->front_image = front_priv->base.image;
+
+}
+
+void
+glamor_egl_destroy_textured_pixmap(PixmapPtr pixmap)
+{
+    if (pixmap->refcnt == 1)
+        _glamor_egl_destroy_pixmap_image(pixmap);
+    glamor_destroy_textured_pixmap(pixmap);
+}
+
+static Bool
+glamor_egl_close_screen(ScreenPtr screen)
+{
+    ScrnInfoPtr scrn;
+    struct glamor_egl_screen_private *glamor_egl;
+    struct glamor_pixmap_private *pixmap_priv;
+    PixmapPtr screen_pixmap;
+
+    scrn = xf86ScreenToScrn(screen);
+    glamor_egl = glamor_egl_get_screen_private(scrn);
+    screen_pixmap = screen->GetScreenPixmap(screen);
+    pixmap_priv = glamor_get_pixmap_private(screen_pixmap);
+
+    eglDestroyImageKHR(glamor_egl->display, glamor_egl->front_image);
+    pixmap_priv->base.image = NULL;
+    glamor_egl->front_image = NULL;
+
+    if (glamor_egl->back_pixmap && *glamor_egl->back_pixmap) {
+        pixmap_priv = glamor_get_pixmap_private(*glamor_egl->back_pixmap);
+        if (pixmap_priv->base.image) {
+            eglDestroyImageKHR(glamor_egl->display, pixmap_priv->base.image);
+            pixmap_priv->base.image = NULL;
+        }
+    }
+
+    screen->CloseScreen = glamor_egl->saved_close_screen;
+
+    return screen->CloseScreen(screen);
+}
+
+static int
+glamor_dri3_open_client(ClientPtr client,
+                        ScreenPtr screen,
+                        RRProviderPtr provider,
+                        int *fdp)
+{
+    ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
+    struct glamor_egl_screen_private *glamor_egl =
+        glamor_egl_get_screen_private(scrn);
+    int fd;
+    drm_magic_t magic;
+
+    fd = open(glamor_egl->device_path, O_RDWR|O_CLOEXEC);
+    if (fd < 0)
+        return BadAlloc;
+
+    /* Before FD passing in the X protocol with DRI3 (and increased
+     * security of rendering with per-process address spaces on the
+     * GPU), the kernel had to come up with a way to have the server
+     * decide which clients got to access the GPU, which was done by
+     * each client getting a unique (magic) number from the kernel,
+     * passing it to the server, and the server then telling the
+     * kernel which clients were authenticated for using the device.
+     *
+     * Now that we have FD passing, the server can just set up the
+     * authentication on its own and hand the prepared FD off to the
+     * client.
+     */
+    if (drmGetMagic(fd, &magic) < 0) {
+        if (errno == EACCES) {
+            /* Assume that we're on a render node, and the fd is
+             * already as authenticated as it should be.
+             */
+            *fdp = fd;
+            return Success;
+        } else {
+            close(fd);
+            return BadMatch;
+        }
+    }
+
+    if (drmAuthMagic(glamor_egl->fd, magic) < 0) {
+        close(fd);
+        return BadMatch;
+    }
+
+    *fdp = fd;
+    return Success;
+}
+
+static dri3_screen_info_rec glamor_dri3_info = {
+    .version = 1,
+    .open_client = glamor_dri3_open_client,
+    .pixmap_from_fd = glamor_pixmap_from_fd,
+    .fd_from_pixmap = glamor_fd_from_pixmap,
+};
+
+void
+glamor_egl_screen_init(ScreenPtr screen, struct glamor_context *glamor_ctx)
+{
+    ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
+    glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
+    struct glamor_egl_screen_private *glamor_egl =
+        glamor_egl_get_screen_private(scrn);
+
+    glamor_egl->saved_close_screen = screen->CloseScreen;
+    screen->CloseScreen = glamor_egl_close_screen;
+
+    glamor_ctx->ctx = glamor_egl->context;
+    glamor_ctx->display = glamor_egl->display;
+
+    glamor_ctx->make_current = glamor_egl_make_current;
+
+    if (glamor_egl->dri3_capable) {
+        /* Tell the core that we have the interfaces for import/export
+         * of pixmaps.
+         */
+        glamor_enable_dri3(screen);
+
+        /* If the driver wants to do its own auth dance (e.g. Xwayland
+         * on pre-3.15 kernels that don't have render nodes and thus
+         * has the wayland compositor as a master), then it needs us
+         * to stay out of the way and let it init DRI3 on its own.
+         */
+        if (!(glamor_priv->flags & GLAMOR_NO_DRI3)) {
+            /* To do DRI3 device FD generation, we need to open a new fd
+             * to the same device we were handed in originally.
+             */
+            glamor_egl->device_path = drmGetDeviceNameFromFd(glamor_egl->fd);
+
+            if (!dri3_screen_init(screen, &glamor_dri3_info)) {
+                xf86DrvMsg(scrn->scrnIndex, X_ERROR,
+                           "Failed to initialize DRI3.\n");
+            }
+        }
+    }
+}
+
+static void
+glamor_egl_free_screen(ScrnInfoPtr scrn)
+{
+    struct glamor_egl_screen_private *glamor_egl;
+
+    glamor_egl = glamor_egl_get_screen_private(scrn);
+    if (glamor_egl != NULL) {
+
+        eglMakeCurrent(glamor_egl->display,
+                       EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
+#ifdef GLAMOR_HAS_GBM
+        if (glamor_egl->gbm)
+            gbm_device_destroy(glamor_egl->gbm);
+#endif
+        free(glamor_egl->device_path);
+
+        scrn->FreeScreen = glamor_egl->saved_free_screen;
+        free(glamor_egl);
+        scrn->FreeScreen(scrn);
+    }
+}
+
+Bool
+glamor_egl_init(ScrnInfoPtr scrn, int fd)
+{
+    struct glamor_egl_screen_private *glamor_egl;
+    const char *version;
+
+    EGLint config_attribs[] = {
+#ifdef GLAMOR_GLES2
+        EGL_CONTEXT_CLIENT_VERSION, 2,
+#endif
+        EGL_NONE
+    };
+
+    glamor_identify(0);
+    glamor_egl = calloc(sizeof(*glamor_egl), 1);
+    if (glamor_egl == NULL)
+        return FALSE;
+    if (xf86GlamorEGLPrivateIndex == -1)
+        xf86GlamorEGLPrivateIndex = xf86AllocateScrnInfoPrivateIndex();
+
+    scrn->privates[xf86GlamorEGLPrivateIndex].ptr = glamor_egl;
+    glamor_egl->fd = fd;
+#ifdef GLAMOR_HAS_GBM
+    glamor_egl->gbm = gbm_create_device(glamor_egl->fd);
+    if (glamor_egl->gbm == NULL) {
+        ErrorF("couldn't get display device\n");
+        return FALSE;
+    }
+    glamor_egl->display = eglGetDisplay(glamor_egl->gbm);
+#else
+    glamor_egl->display = eglGetDisplay((EGLNativeDisplayType) (intptr_t) fd);
+#endif
+
+    glamor_egl->has_gem = glamor_egl_check_has_gem(fd);
+
+#ifndef GLAMOR_GLES2
+    eglBindAPI(EGL_OPENGL_API);
+#else
+    eglBindAPI(EGL_OPENGL_ES_API);
+#endif
+    if (!eglInitialize
+        (glamor_egl->display, &glamor_egl->major, &glamor_egl->minor)) {
+        xf86DrvMsg(scrn->scrnIndex, X_ERROR, "eglInitialize() failed\n");
+        return FALSE;
+    }
+
+    version = eglQueryString(glamor_egl->display, EGL_VERSION);
+    xf86Msg(X_INFO, "%s: EGL version %s:\n", glamor_name, version);
+
+#define GLAMOR_CHECK_EGL_EXTENSION(EXT)  \
+       if (!epoxy_has_egl_extension(glamor_egl->display, "EGL_" #EXT)) {  \
+               ErrorF("EGL_" #EXT " required.\n");  \
+               return FALSE;  \
+       }
+
+#define GLAMOR_CHECK_EGL_EXTENSIONS(EXT1, EXT2)         \
+       if (!epoxy_has_egl_extension(glamor_egl->display, "EGL_" #EXT1) &&  \
+           !epoxy_has_egl_extension(glamor_egl->display, "EGL_" #EXT2)) {  \
+               ErrorF("EGL_" #EXT1 " or EGL_" #EXT2 " required.\n");  \
+               return FALSE;  \
+       }
+
+    GLAMOR_CHECK_EGL_EXTENSION(MESA_drm_image);
+    GLAMOR_CHECK_EGL_EXTENSION(KHR_gl_renderbuffer_image);
+#ifdef GLAMOR_GLES2
+    GLAMOR_CHECK_EGL_EXTENSIONS(KHR_surfaceless_context, KHR_surfaceless_gles2);
+#else
+    GLAMOR_CHECK_EGL_EXTENSIONS(KHR_surfaceless_context,
+                                KHR_surfaceless_opengl);
+#endif
+
+#ifdef GLAMOR_HAS_GBM
+    if (epoxy_has_egl_extension(glamor_egl->display,
+                                "EGL_KHR_gl_texture_2D_image") &&
+        epoxy_has_egl_extension(glamor_egl->display,
+                                "EGL_EXT_image_dma_buf_import"))
+        glamor_egl->dri3_capable = TRUE;
+#endif
+
+    glamor_egl->context = eglCreateContext(glamor_egl->display,
+                                           NULL, EGL_NO_CONTEXT,
+                                           config_attribs);
+    if (glamor_egl->context == EGL_NO_CONTEXT) {
+        xf86DrvMsg(scrn->scrnIndex, X_ERROR, "Failed to create EGL context\n");
+        return FALSE;
+    }
+
+    if (!eglMakeCurrent(glamor_egl->display,
+                        EGL_NO_SURFACE, EGL_NO_SURFACE, glamor_egl->context)) {
+        xf86DrvMsg(scrn->scrnIndex, X_ERROR,
+                   "Failed to make EGL context current\n");
+        return FALSE;
+    }
+    glamor_egl->saved_free_screen = scrn->FreeScreen;
+    scrn->FreeScreen = glamor_egl_free_screen;
+#ifdef GLAMOR_GLES2
+    xf86DrvMsg(scrn->scrnIndex, X_INFO, "Using GLES2.\n");
+    xf86DrvMsg(scrn->scrnIndex, X_WARNING,
+               "Glamor is using GLES2 but GLX needs GL. "
+               "Indirect GLX may not work correctly.\n");
+#endif
+    return TRUE;
+}
+
+/** Stub to retain compatibility with pre-server-1.16 ABI. */
+Bool
+glamor_egl_init_textured_pixmap(ScreenPtr screen)
+{
+    return TRUE;
+}
diff --git a/glamor/glamor_egl_stubs.c b/glamor/glamor_egl_stubs.c
new file mode 100644 (file)
index 0000000..028d1cc
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * Copyright Â© 2013 Intel 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.
+ */
+
+/** @file glamor_egl_stubs.c
+ *
+ * Stubbed out glamor_egl.c functions for servers other than Xorg.
+ */
+
+#include "dix-config.h"
+
+#include "glamor.h"
+
+void
+glamor_egl_screen_init(ScreenPtr screen, struct glamor_context *glamor_ctx)
+{
+}
+
+void
+glamor_egl_destroy_textured_pixmap(PixmapPtr pixmap)
+{
+}
+
+int
+glamor_egl_dri3_fd_name_from_tex(ScreenPtr screen,
+                                 PixmapPtr pixmap,
+                                 unsigned int tex,
+                                 Bool want_name, CARD16 *stride, CARD32 *size)
+{
+    return 0;
+}
+
+unsigned int
+glamor_egl_create_argb8888_based_texture(ScreenPtr screen, int w, int h)
+{
+    return 0;
+}
diff --git a/glamor/glamor_eglmodule.c b/glamor/glamor_eglmodule.c
new file mode 100644 (file)
index 0000000..d7e1836
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 1998 The XFree86 Project, Inc.  All Rights Reserved.
+ *
+ * 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 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
+ * XFREE86 PROJECT 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.
+ *
+ * Except as contained in this notice, the name of the XFree86 Project shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from the
+ * XFree86 Project.
+ *
+ * Authors:
+ *    Zhigang Gong <zhigang.gong@gmail.com>
+ */
+
+#include "dix-config.h"
+
+#include <xorg-server.h>
+#include <xf86.h>
+#define GLAMOR_FOR_XORG
+#include <xf86Module.h>
+#include "glamor.h"
+
+static XF86ModuleVersionInfo VersRec = {
+    GLAMOR_EGL_MODULE_NAME,
+    MODULEVENDORSTRING,
+    MODINFOSTRING1,
+    MODINFOSTRING2,
+    XORG_VERSION_CURRENT,
+    1, 0, 0, /* version */
+    ABI_CLASS_ANSIC,            /* Only need the ansic layer */
+    ABI_ANSIC_VERSION,
+    MOD_CLASS_NONE,
+    {0, 0, 0, 0}                /* signature, to be patched into the file by a tool */
+};
+
+_X_EXPORT XF86ModuleData glamoreglModuleData = { &VersRec, NULL, NULL };
diff --git a/glamor/glamor_fbo.c b/glamor/glamor_fbo.c
new file mode 100644 (file)
index 0000000..090dfd8
--- /dev/null
@@ -0,0 +1,590 @@
+/*
+ * Copyright Â© 2009 Intel Corporation
+ * Copyright Â© 1998 Keith Packard
+ *
+ * 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.
+ *
+ * Authors:
+ *    Zhigang Gong <zhigang.gong@gmail.com>
+ *
+ */
+
+#include <stdlib.h>
+
+#include "glamor_priv.h"
+
+#define GLAMOR_CACHE_EXPIRE_MAX 100
+
+#define GLAMOR_CACHE_DEFAULT    0
+#define GLAMOR_CACHE_EXACT_SIZE 1
+
+//#define NO_FBO_CACHE 1
+#define FBO_CACHE_THRESHOLD  (256*1024*1024)
+
+/* Loop from the tail to the head. */
+#define xorg_list_for_each_entry_reverse(pos, head, member)             \
+    for (pos = __container_of((head)->prev, pos, member);               \
+         &pos->member != (head);                                        \
+         pos = __container_of(pos->member.prev, pos, member))
+
+#define xorg_list_for_each_entry_safe_reverse(pos, tmp, head, member)   \
+    for (pos = __container_of((head)->prev, pos, member),               \
+         tmp = __container_of(pos->member.prev, pos, member);           \
+         &pos->member != (head);                                        \
+         pos = tmp, tmp = __container_of(pos->member.prev, tmp, member))
+
+inline static int
+cache_wbucket(int size)
+{
+    int order = __fls(size / 32);
+
+    if (order >= CACHE_BUCKET_WCOUNT)
+        order = CACHE_BUCKET_WCOUNT - 1;
+    return order;
+}
+
+inline static int
+cache_hbucket(int size)
+{
+    int order = __fls(size / 32);
+
+    if (order >= CACHE_BUCKET_HCOUNT)
+        order = CACHE_BUCKET_HCOUNT - 1;
+    return order;
+}
+
+static glamor_pixmap_fbo *
+glamor_pixmap_fbo_cache_get(glamor_screen_private *glamor_priv,
+                            int w, int h, GLenum format, int flag)
+{
+    struct xorg_list *cache;
+    glamor_pixmap_fbo *fbo_entry, *ret_fbo = NULL;
+    int n_format;
+
+#ifdef NO_FBO_CACHE
+    return NULL;
+#else
+    n_format = cache_format(format);
+    if (n_format == -1)
+        return NULL;
+    cache = &glamor_priv->fbo_cache[n_format]
+        [cache_wbucket(w)]
+        [cache_hbucket(h)];
+    if (!(flag & GLAMOR_CACHE_EXACT_SIZE)) {
+        xorg_list_for_each_entry(fbo_entry, cache, list) {
+            if (fbo_entry->width >= w && fbo_entry->height >= h) {
+
+                DEBUGF("Request w %d h %d format %x \n", w, h, format);
+                DEBUGF("got cache entry %p w %d h %d fbo %d tex %d format %x\n",
+                       fbo_entry, fbo_entry->width, fbo_entry->height,
+                       fbo_entry->fb, fbo_entry->tex);
+                xorg_list_del(&fbo_entry->list);
+                ret_fbo = fbo_entry;
+                break;
+            }
+        }
+    }
+    else {
+        xorg_list_for_each_entry(fbo_entry, cache, list) {
+            if (fbo_entry->width == w && fbo_entry->height == h) {
+
+                DEBUGF("Request w %d h %d format %x \n", w, h, format);
+                DEBUGF("got cache entry %p w %d h %d fbo %d tex %d format %x\n",
+                       fbo_entry, fbo_entry->width, fbo_entry->height,
+                       fbo_entry->fb, fbo_entry->tex, fbo_entry->format);
+                assert(format == fbo_entry->format);
+                xorg_list_del(&fbo_entry->list);
+                ret_fbo = fbo_entry;
+                break;
+            }
+        }
+    }
+
+    if (ret_fbo)
+        glamor_priv->fbo_cache_watermark -= ret_fbo->width * ret_fbo->height;
+
+    assert(glamor_priv->fbo_cache_watermark >= 0);
+
+    return ret_fbo;
+#endif
+}
+
+void
+glamor_purge_fbo(glamor_pixmap_fbo *fbo)
+{
+    glamor_make_current(fbo->glamor_priv);
+
+    if (fbo->fb)
+        glDeleteFramebuffers(1, &fbo->fb);
+    if (fbo->tex)
+        glDeleteTextures(1, &fbo->tex);
+    if (fbo->pbo)
+        glDeleteBuffers(1, &fbo->pbo);
+
+    free(fbo);
+}
+
+static void
+glamor_pixmap_fbo_cache_put(glamor_pixmap_fbo *fbo)
+{
+    struct xorg_list *cache;
+    int n_format;
+
+#ifdef NO_FBO_CACHE
+    glamor_purge_fbo(fbo);
+    return;
+#else
+    n_format = cache_format(fbo->format);
+
+    if (fbo->fb == 0 || n_format == -1
+        || fbo->glamor_priv->fbo_cache_watermark >= FBO_CACHE_THRESHOLD) {
+        fbo->glamor_priv->tick += GLAMOR_CACHE_EXPIRE_MAX;
+        glamor_fbo_expire(fbo->glamor_priv);
+        glamor_purge_fbo(fbo);
+        return;
+    }
+
+    cache = &fbo->glamor_priv->fbo_cache[n_format]
+        [cache_wbucket(fbo->width)]
+        [cache_hbucket(fbo->height)];
+    DEBUGF
+        ("Put cache entry %p to cache %p w %d h %d format %x fbo %d tex %d \n",
+         fbo, cache, fbo->width, fbo->height, fbo->format, fbo->fb, fbo->tex);
+
+    fbo->glamor_priv->fbo_cache_watermark += fbo->width * fbo->height;
+    xorg_list_add(&fbo->list, cache);
+    fbo->expire = fbo->glamor_priv->tick + GLAMOR_CACHE_EXPIRE_MAX;
+#endif
+}
+
+static int
+glamor_pixmap_ensure_fb(glamor_pixmap_fbo *fbo)
+{
+    int status, err = 0;
+
+    glamor_make_current(fbo->glamor_priv);
+
+    if (fbo->fb == 0)
+        glGenFramebuffers(1, &fbo->fb);
+    assert(fbo->tex != 0);
+    glBindFramebuffer(GL_FRAMEBUFFER, fbo->fb);
+    glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
+                           GL_TEXTURE_2D, fbo->tex, 0);
+    status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
+    if (status != GL_FRAMEBUFFER_COMPLETE) {
+        const char *str;
+
+        switch (status) {
+        case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT:
+            str = "incomplete attachment";
+            break;
+        case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:
+            str = "incomplete/missing attachment";
+            break;
+        case GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER:
+            str = "incomplete draw buffer";
+            break;
+        case GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER:
+            str = "incomplete read buffer";
+            break;
+        case GL_FRAMEBUFFER_UNSUPPORTED:
+            str = "unsupported";
+            break;
+        case GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE:
+            str = "incomplete multiple";
+            break;
+        default:
+            str = "unknown error";
+            break;
+        }
+
+        glamor_fallback("glamor: Failed to create fbo, %s\n", str);
+        err = -1;
+    }
+
+    return err;
+}
+
+glamor_pixmap_fbo *
+glamor_create_fbo_from_tex(glamor_screen_private *glamor_priv,
+                           int w, int h, GLenum format, GLint tex, int flag)
+{
+    glamor_pixmap_fbo *fbo;
+
+    fbo = calloc(1, sizeof(*fbo));
+    if (fbo == NULL)
+        return NULL;
+
+    xorg_list_init(&fbo->list);
+
+    fbo->tex = tex;
+    fbo->width = w;
+    fbo->height = h;
+    fbo->format = format;
+    fbo->glamor_priv = glamor_priv;
+
+    if (flag == GLAMOR_CREATE_PIXMAP_MAP) {
+        glamor_make_current(glamor_priv);
+        glGenBuffers(1, &fbo->pbo);
+        goto done;
+    }
+
+    if (flag != GLAMOR_CREATE_FBO_NO_FBO) {
+        if (glamor_pixmap_ensure_fb(fbo) != 0) {
+            glamor_purge_fbo(fbo);
+            fbo = NULL;
+        }
+    }
+
+ done:
+    return fbo;
+}
+
+void
+glamor_fbo_expire(glamor_screen_private *glamor_priv)
+{
+    struct xorg_list *cache;
+    glamor_pixmap_fbo *fbo_entry, *tmp;
+    int i, j, k;
+
+    for (i = 0; i < CACHE_FORMAT_COUNT; i++)
+        for (j = 0; j < CACHE_BUCKET_WCOUNT; j++)
+            for (k = 0; k < CACHE_BUCKET_HCOUNT; k++) {
+                cache = &glamor_priv->fbo_cache[i][j][k];
+                xorg_list_for_each_entry_safe_reverse(fbo_entry, tmp, cache,
+                                                      list) {
+                    if (GLAMOR_TICK_AFTER(fbo_entry->expire, glamor_priv->tick)) {
+                        break;
+                    }
+
+                    glamor_priv->fbo_cache_watermark -=
+                        fbo_entry->width * fbo_entry->height;
+                    xorg_list_del(&fbo_entry->list);
+                    DEBUGF("cache %p fbo %p expired %d current %d \n", cache,
+                           fbo_entry, fbo_entry->expire, glamor_priv->tick);
+                    glamor_purge_fbo(fbo_entry);
+                }
+            }
+
+}
+
+void
+glamor_init_pixmap_fbo(ScreenPtr screen)
+{
+    glamor_screen_private *glamor_priv;
+    int i, j, k;
+
+    glamor_priv = glamor_get_screen_private(screen);
+    for (i = 0; i < CACHE_FORMAT_COUNT; i++)
+        for (j = 0; j < CACHE_BUCKET_WCOUNT; j++)
+            for (k = 0; k < CACHE_BUCKET_HCOUNT; k++) {
+                xorg_list_init(&glamor_priv->fbo_cache[i][j][k]);
+            }
+    glamor_priv->fbo_cache_watermark = 0;
+}
+
+void
+glamor_fini_pixmap_fbo(ScreenPtr screen)
+{
+    struct xorg_list *cache;
+    glamor_screen_private *glamor_priv;
+    glamor_pixmap_fbo *fbo_entry, *tmp;
+    int i, j, k;
+
+    glamor_priv = glamor_get_screen_private(screen);
+    for (i = 0; i < CACHE_FORMAT_COUNT; i++)
+        for (j = 0; j < CACHE_BUCKET_WCOUNT; j++)
+            for (k = 0; k < CACHE_BUCKET_HCOUNT; k++) {
+                cache = &glamor_priv->fbo_cache[i][j][k];
+                xorg_list_for_each_entry_safe_reverse(fbo_entry, tmp, cache,
+                                                      list) {
+                    xorg_list_del(&fbo_entry->list);
+                    glamor_purge_fbo(fbo_entry);
+                }
+            }
+}
+
+void
+glamor_destroy_fbo(glamor_pixmap_fbo *fbo)
+{
+    xorg_list_del(&fbo->list);
+    glamor_pixmap_fbo_cache_put(fbo);
+
+}
+
+static int
+_glamor_create_tex(glamor_screen_private *glamor_priv,
+                   int w, int h, GLenum format)
+{
+    unsigned int tex = 0;
+
+    /* With dri3, we want to allocate ARGB8888 pixmaps only.
+     * Depending on the implementation, GL_RGBA might not
+     * give us ARGB8888. We ask glamor_egl to use get
+     * an ARGB8888 based texture for us. */
+    if (glamor_priv->dri3_enabled && format == GL_RGBA) {
+        tex = glamor_egl_create_argb8888_based_texture(glamor_priv->screen,
+                                                       w, h);
+    }
+    if (!tex) {
+        glamor_make_current(glamor_priv);
+        glGenTextures(1, &tex);
+        glBindTexture(GL_TEXTURE_2D, tex);
+        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);
+        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+        glTexImage2D(GL_TEXTURE_2D, 0, format, w, h, 0,
+                     format, GL_UNSIGNED_BYTE, NULL);
+    }
+    return tex;
+}
+
+glamor_pixmap_fbo *
+glamor_create_fbo(glamor_screen_private *glamor_priv,
+                  int w, int h, GLenum format, int flag)
+{
+    glamor_pixmap_fbo *fbo;
+    GLint tex = 0;
+    int cache_flag;
+
+    if (flag == GLAMOR_CREATE_FBO_NO_FBO)
+        goto new_fbo;
+
+    if (flag == GLAMOR_CREATE_PIXMAP_MAP)
+        goto no_tex;
+
+    /* Tiling from textures requires exact pixmap sizes. As we don't
+     * know which pixmaps will be used as tiles, just allocate
+     * everything at the requested size
+     */
+    cache_flag = GLAMOR_CACHE_EXACT_SIZE;
+
+    fbo = glamor_pixmap_fbo_cache_get(glamor_priv, w, h, format, cache_flag);
+    if (fbo)
+        return fbo;
+ new_fbo:
+    tex = _glamor_create_tex(glamor_priv, w, h, format);
+ no_tex:
+    fbo = glamor_create_fbo_from_tex(glamor_priv, w, h, format, tex, flag);
+
+    return fbo;
+}
+
+static glamor_pixmap_fbo *
+_glamor_create_fbo_array(glamor_screen_private *glamor_priv,
+                         int w, int h, GLenum format, int flag,
+                         int block_w, int block_h,
+                         glamor_pixmap_private *pixmap_priv, int has_fbo)
+{
+    int block_wcnt;
+    int block_hcnt;
+    glamor_pixmap_fbo **fbo_array;
+    BoxPtr box_array;
+    int i, j;
+    glamor_pixmap_private_large_t *priv;
+
+    priv = &pixmap_priv->large;
+
+    block_wcnt = (w + block_w - 1) / block_w;
+    block_hcnt = (h + block_h - 1) / block_h;
+
+    box_array = calloc(block_wcnt * block_hcnt, sizeof(box_array[0]));
+    if (box_array == NULL)
+        return NULL;
+
+    fbo_array = calloc(block_wcnt * block_hcnt, sizeof(glamor_pixmap_fbo *));
+    if (fbo_array == NULL) {
+        free(box_array);
+        return FALSE;
+    }
+    for (i = 0; i < block_hcnt; i++) {
+        int block_y1, block_y2;
+        int fbo_w, fbo_h;
+
+        block_y1 = i * block_h;
+        block_y2 = (block_y1 + block_h) > h ? h : (block_y1 + block_h);
+        fbo_h = block_y2 - block_y1;
+
+        for (j = 0; j < block_wcnt; j++) {
+            box_array[i * block_wcnt + j].x1 = j * block_w;
+            box_array[i * block_wcnt + j].y1 = block_y1;
+            box_array[i * block_wcnt + j].x2 =
+                (j + 1) * block_w > w ? w : (j + 1) * block_w;
+            box_array[i * block_wcnt + j].y2 = block_y2;
+            fbo_w =
+                box_array[i * block_wcnt + j].x2 - box_array[i * block_wcnt +
+                                                             j].x1;
+            if (!has_fbo)
+                fbo_array[i * block_wcnt + j] = glamor_create_fbo(glamor_priv,
+                                                                  fbo_w, fbo_h,
+                                                                  format,
+                                                                  GLAMOR_CREATE_PIXMAP_FIXUP);
+            else
+                fbo_array[i * block_wcnt + j] = priv->base.fbo;
+            if (fbo_array[i * block_wcnt + j] == NULL)
+                goto cleanup;
+        }
+    }
+
+    priv->box = box_array[0];
+    priv->box_array = box_array;
+    priv->fbo_array = fbo_array;
+    priv->block_wcnt = block_wcnt;
+    priv->block_hcnt = block_hcnt;
+    return fbo_array[0];
+
+ cleanup:
+    for (i = 0; i < block_wcnt * block_hcnt; i++)
+        if ((fbo_array)[i])
+            glamor_destroy_fbo((fbo_array)[i]);
+    free(box_array);
+    free(fbo_array);
+    return NULL;
+}
+
+/* Create a fbo array to cover the w*h region, by using block_w*block_h
+ * block.*/
+glamor_pixmap_fbo *
+glamor_create_fbo_array(glamor_screen_private *glamor_priv,
+                        int w, int h, GLenum format, int flag,
+                        int block_w, int block_h,
+                        glamor_pixmap_private *pixmap_priv)
+{
+    pixmap_priv->large.block_w = block_w;
+    pixmap_priv->large.block_h = block_h;
+    return _glamor_create_fbo_array(glamor_priv, w, h, format, flag,
+                                    block_w, block_h, pixmap_priv, 0);
+}
+
+glamor_pixmap_fbo *
+glamor_pixmap_detach_fbo(glamor_pixmap_private *pixmap_priv)
+{
+    glamor_pixmap_fbo *fbo;
+
+    if (pixmap_priv == NULL)
+        return NULL;
+
+    fbo = pixmap_priv->base.fbo;
+    if (fbo == NULL)
+        return NULL;
+
+    pixmap_priv->base.fbo = NULL;
+    return fbo;
+}
+
+/* The pixmap must not be attached to another fbo. */
+void
+glamor_pixmap_attach_fbo(PixmapPtr pixmap, glamor_pixmap_fbo *fbo)
+{
+    glamor_pixmap_private *pixmap_priv;
+
+    pixmap_priv = glamor_get_pixmap_private(pixmap);
+
+    if (pixmap_priv->base.fbo)
+        return;
+
+    pixmap_priv->base.fbo = fbo;
+
+    switch (pixmap_priv->type) {
+    case GLAMOR_TEXTURE_LARGE:
+    case GLAMOR_TEXTURE_ONLY:
+    case GLAMOR_TEXTURE_DRM:
+        pixmap_priv->base.gl_fbo = GLAMOR_FBO_NORMAL;
+        if (fbo->tex != 0)
+            pixmap_priv->base.gl_tex = 1;
+        else {
+            /* XXX For the Xephyr only, may be broken now. */
+            pixmap_priv->base.gl_tex = 0;
+        }
+    case GLAMOR_MEMORY_MAP:
+        pixmap->devPrivate.ptr = NULL;
+        break;
+    default:
+        break;
+    }
+}
+
+void
+glamor_pixmap_destroy_fbo(glamor_pixmap_private *priv)
+{
+    glamor_pixmap_fbo *fbo;
+
+    if (priv->type == GLAMOR_TEXTURE_LARGE) {
+        int i;
+        glamor_pixmap_private_large_t *large = &priv->large;
+
+        for (i = 0; i < large->block_wcnt * large->block_hcnt; i++)
+            glamor_destroy_fbo(large->fbo_array[i]);
+        free(large->fbo_array);
+    }
+    else {
+        fbo = glamor_pixmap_detach_fbo(priv);
+        if (fbo)
+            glamor_destroy_fbo(fbo);
+    }
+
+    free(priv);
+}
+
+Bool
+glamor_pixmap_ensure_fbo(PixmapPtr pixmap, GLenum format, int flag)
+{
+    glamor_screen_private *glamor_priv;
+    glamor_pixmap_private *pixmap_priv;
+    glamor_pixmap_fbo *fbo;
+
+    glamor_priv = glamor_get_screen_private(pixmap->drawable.pScreen);
+    pixmap_priv = glamor_get_pixmap_private(pixmap);
+    if (pixmap_priv->base.fbo == NULL) {
+
+        fbo = glamor_create_fbo(glamor_priv, pixmap->drawable.width,
+                                pixmap->drawable.height, format, flag);
+        if (fbo == NULL)
+            return FALSE;
+
+        glamor_pixmap_attach_fbo(pixmap, fbo);
+    }
+    else {
+        /* We do have a fbo, but it may lack of fb or tex. */
+        if (!pixmap_priv->base.fbo->tex)
+            pixmap_priv->base.fbo->tex =
+                _glamor_create_tex(glamor_priv, pixmap->drawable.width,
+                                   pixmap->drawable.height, format);
+
+        if (flag != GLAMOR_CREATE_FBO_NO_FBO && pixmap_priv->base.fbo->fb == 0)
+            if (glamor_pixmap_ensure_fb(pixmap_priv->base.fbo) != 0)
+                return FALSE;
+    }
+
+    return TRUE;
+}
+
+_X_EXPORT void
+glamor_pixmap_exchange_fbos(PixmapPtr front, PixmapPtr back)
+{
+    glamor_pixmap_private *front_priv, *back_priv;
+    glamor_pixmap_fbo *temp_fbo;
+
+    front_priv = glamor_get_pixmap_private(front);
+    back_priv = glamor_get_pixmap_private(back);
+    temp_fbo = front_priv->base.fbo;
+    front_priv->base.fbo = back_priv->base.fbo;
+    back_priv->base.fbo = temp_fbo;
+}
diff --git a/glamor/glamor_fill.c b/glamor/glamor_fill.c
new file mode 100644 (file)
index 0000000..073904d
--- /dev/null
@@ -0,0 +1,356 @@
+/*
+ * Copyright Â© 2008 Intel Corporation
+ * Copyright Â© 1998 Keith Packard
+ *
+ * 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 Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission.  Keith Packard makes no
+ * representations about the suitability of this software for any purpose.  It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD 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.
+ *
+ * Authors:
+ *    Eric Anholt <eric@anholt.net>
+ *    Zhigang Gong <zhigang.gong@linux.intel.com>
+ */
+
+#include "glamor_priv.h"
+
+/** @file glamor_fill.c
+ *
+ * GC fill implementation, based loosely on fb_fill.c
+ */
+
+/**
+ * Fills the given rectangle of a drawable with the GC's fill style.
+ */
+Bool
+glamor_fill(DrawablePtr drawable,
+            GCPtr gc, int x, int y, int width, int height, Bool fallback)
+{
+    PixmapPtr dst_pixmap = glamor_get_drawable_pixmap(drawable);
+    int off_x, off_y;
+    PixmapPtr sub_pixmap = NULL;
+    glamor_access_t sub_pixmap_access;
+    DrawablePtr saved_drawable = NULL;
+    int saved_x = x, saved_y = y;
+
+    glamor_get_drawable_deltas(drawable, dst_pixmap, &off_x, &off_y);
+
+    switch (gc->fillStyle) {
+    case FillSolid:
+        if (!glamor_solid(dst_pixmap,
+                          x + off_x,
+                          y + off_y,
+                          width, height, gc->alu, gc->planemask, gc->fgPixel))
+            goto fail;
+        break;
+    case FillStippled:
+    case FillOpaqueStippled:
+        if (!glamor_stipple(dst_pixmap,
+                            gc->stipple,
+                            x + off_x,
+                            y + off_y,
+                            width,
+                            height,
+                            gc->alu,
+                            gc->planemask,
+                            gc->fgPixel,
+                            gc->bgPixel, gc->patOrg.x, gc->patOrg.y))
+            goto fail;
+        break;
+    case FillTiled:
+        if (!glamor_tile(dst_pixmap,
+                         gc->tile.pixmap,
+                         x + off_x,
+                         y + off_y,
+                         width,
+                         height,
+                         gc->alu,
+                         gc->planemask,
+                         x - drawable->x - gc->patOrg.x,
+                         y - drawable->y - gc->patOrg.y))
+            goto fail;
+        break;
+    }
+    return TRUE;
+
+ fail:
+    if (!fallback) {
+        if (glamor_ddx_fallback_check_pixmap(&dst_pixmap->drawable)
+            && glamor_ddx_fallback_check_gc(gc))
+            return FALSE;
+    }
+    /* Is it possible to set the access as WO? */
+
+    sub_pixmap_access = GLAMOR_ACCESS_RW;
+
+    sub_pixmap = glamor_get_sub_pixmap(dst_pixmap, x + off_x,
+                                       y + off_y, width, height,
+                                       sub_pixmap_access);
+
+    if (sub_pixmap != NULL) {
+        if (gc->fillStyle != FillSolid) {
+            gc->patOrg.x += (drawable->x - x);
+            gc->patOrg.y += (drawable->y - y);
+        }
+        saved_drawable = drawable;
+        drawable = &sub_pixmap->drawable;
+        saved_x = x;
+        saved_y = y;
+        x = 0;
+        y = 0;
+    }
+    if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RW) &&
+        glamor_prepare_access_gc(gc)) {
+        fbFill(drawable, gc, x, y, width, height);
+    }
+    glamor_finish_access_gc(gc);
+    glamor_finish_access(drawable);
+
+    if (sub_pixmap != NULL) {
+        if (gc->fillStyle != FillSolid) {
+            gc->patOrg.x -= (saved_drawable->x - saved_x);
+            gc->patOrg.y -= (saved_drawable->y - saved_y);
+        }
+
+        x = saved_x;
+        y = saved_y;
+
+        glamor_put_sub_pixmap(sub_pixmap, dst_pixmap,
+                              x + off_x, y + off_y,
+                              width, height, sub_pixmap_access);
+    }
+
+    return TRUE;
+}
+
+void
+glamor_init_solid_shader(ScreenPtr screen)
+{
+    glamor_screen_private *glamor_priv;
+    const char *solid_vs =
+        "attribute vec4 v_position;"
+        "void main()\n"
+        "{\n"
+        "       gl_Position = v_position;\n"
+        "}\n";
+    const char *solid_fs =
+        GLAMOR_DEFAULT_PRECISION
+        "uniform vec4 color;\n"
+        "void main()\n"
+        "{\n"
+        "      gl_FragColor = color;\n"
+        "}\n";
+    GLint fs_prog, vs_prog;
+
+    glamor_priv = glamor_get_screen_private(screen);
+    glamor_make_current(glamor_priv);
+    glamor_priv->solid_prog = glCreateProgram();
+    vs_prog = glamor_compile_glsl_prog(GL_VERTEX_SHADER, solid_vs);
+    fs_prog = glamor_compile_glsl_prog(GL_FRAGMENT_SHADER, solid_fs);
+    glAttachShader(glamor_priv->solid_prog, vs_prog);
+    glAttachShader(glamor_priv->solid_prog, fs_prog);
+
+    glBindAttribLocation(glamor_priv->solid_prog,
+                         GLAMOR_VERTEX_POS, "v_position");
+    glamor_link_glsl_prog(screen, glamor_priv->solid_prog, "solid");
+
+    glamor_priv->solid_color_uniform_location =
+        glGetUniformLocation(glamor_priv->solid_prog, "color");
+}
+
+void
+glamor_fini_solid_shader(ScreenPtr screen)
+{
+    glamor_screen_private *glamor_priv;
+
+    glamor_priv = glamor_get_screen_private(screen);
+    glamor_make_current(glamor_priv);
+    glDeleteProgram(glamor_priv->solid_prog);
+}
+
+static void
+_glamor_solid_boxes(PixmapPtr pixmap, BoxPtr box, int nbox, float *color)
+{
+    ScreenPtr screen = pixmap->drawable.pScreen;
+    glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
+    glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap);
+    GLfloat xscale, yscale;
+    float stack_vertices[32];
+    float *vertices = stack_vertices;
+    int valid_nbox = ARRAY_SIZE(stack_vertices) / (4 * 2);
+
+    glamor_set_destination_pixmap_priv_nc(pixmap_priv);
+
+    glamor_make_current(glamor_priv);
+    glUseProgram(glamor_priv->solid_prog);
+
+    glUniform4fv(glamor_priv->solid_color_uniform_location, 1, color);
+
+    pixmap_priv_get_dest_scale(pixmap_priv, &xscale, &yscale);
+
+    if (nbox > valid_nbox) {
+        int allocated_nbox;
+        float *new_vertices;
+
+        if (nbox > GLAMOR_COMPOSITE_VBO_VERT_CNT / 6)
+            allocated_nbox = GLAMOR_COMPOSITE_VBO_VERT_CNT / 6;
+        else
+            allocated_nbox = nbox;
+        new_vertices = malloc(allocated_nbox * 4 * 2 * sizeof(float));
+        if (new_vertices) {
+            vertices = new_vertices;
+            valid_nbox = allocated_nbox;
+        }
+    }
+
+    glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT,
+                          GL_FALSE, 2 * sizeof(float), vertices);
+    glEnableVertexAttribArray(GLAMOR_VERTEX_POS);
+
+    while (nbox) {
+        int box_cnt, i;
+        float *next_box;
+
+        next_box = vertices;
+        box_cnt = nbox > valid_nbox ? valid_nbox : nbox;
+        for (i = 0; i < box_cnt; i++) {
+            glamor_set_normalize_vcoords(pixmap_priv, xscale, yscale,
+                                         box[i].x1, box[i].y1,
+                                         box[i].x2, box[i].y2,
+                                         glamor_priv->yInverted,
+                                         next_box);
+            next_box += 4 * 2;
+        }
+        if (box_cnt == 1)
+            glDrawArrays(GL_TRIANGLE_FAN, 0, box_cnt * 4);
+        else {
+            if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) {
+                glDrawRangeElements(GL_TRIANGLES, 0, box_cnt * 4, box_cnt * 6,
+                                    GL_UNSIGNED_SHORT, NULL);
+            } else {
+                glDrawElements(GL_TRIANGLES, box_cnt * 6, GL_UNSIGNED_SHORT,
+                               NULL);
+            }
+        }
+        nbox -= box_cnt;
+        box += box_cnt;
+    }
+
+    if (vertices != stack_vertices)
+        free(vertices);
+
+    glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
+    glamor_priv->state = RENDER_STATE;
+    glamor_priv->render_idle_cnt = 0;
+}
+
+/**
+ * Fills the given rectangles of pixmap with an X pixel value.
+ *
+ * This is a helper used by other code after clipping and translation
+ * of coordinates to a glamor backing pixmap.
+ */
+Bool
+glamor_solid_boxes(PixmapPtr pixmap,
+                   BoxPtr box, int nbox, unsigned long fg_pixel)
+{
+    glamor_pixmap_private *pixmap_priv;
+    GLfloat color[4];
+
+    pixmap_priv = glamor_get_pixmap_private(pixmap);
+
+    if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv))
+        return FALSE;
+
+    glamor_get_rgba_from_pixel(fg_pixel,
+                               &color[0],
+                               &color[1],
+                               &color[2], &color[3], format_for_pixmap(pixmap));
+
+    if (pixmap_priv->type == GLAMOR_TEXTURE_LARGE) {
+        RegionRec region;
+        int n_region;
+        glamor_pixmap_clipped_regions *clipped_regions;
+        int i;
+
+        RegionInitBoxes(&region, box, nbox);
+        clipped_regions =
+            glamor_compute_clipped_regions(pixmap_priv, &region, &n_region, 0,
+                                           0, 0);
+        for (i = 0; i < n_region; i++) {
+            BoxPtr inner_box;
+            int inner_nbox;
+
+            SET_PIXMAP_FBO_CURRENT(pixmap_priv, clipped_regions[i].block_idx);
+
+            inner_box = RegionRects(clipped_regions[i].region);
+            inner_nbox = RegionNumRects(clipped_regions[i].region);
+            _glamor_solid_boxes(pixmap, inner_box, inner_nbox, color);
+            RegionDestroy(clipped_regions[i].region);
+        }
+        free(clipped_regions);
+        RegionUninit(&region);
+    }
+    else
+        _glamor_solid_boxes(pixmap, box, nbox, color);
+
+    return TRUE;
+}
+
+/**
+ * Fills a rectangle of a pixmap with an X pixel value.
+ *
+ * This is a helper used by other glamor code mostly for clearing of
+ * buffers to 0.
+ */
+Bool
+glamor_solid(PixmapPtr pixmap, int x, int y, int width, int height,
+             unsigned char alu, unsigned long planemask, unsigned long fg_pixel)
+{
+    ScreenPtr screen = pixmap->drawable.pScreen;
+    glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
+    glamor_pixmap_private *pixmap_priv;
+    BoxRec box;
+
+    pixmap_priv = glamor_get_pixmap_private(pixmap);
+
+    if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv))
+        return FALSE;
+
+    if (!glamor_set_planemask(pixmap, planemask)) {
+        glamor_fallback("Failedto set planemask  in glamor_solid.\n");
+        return FALSE;
+    }
+
+    glamor_make_current(glamor_priv);
+    if (!glamor_set_alu(screen, alu)) {
+        if (alu == GXclear)
+            fg_pixel = 0;
+        else {
+            glamor_fallback("unsupported alu %x\n", alu);
+            return FALSE;
+        }
+    }
+    box.x1 = x;
+    box.y1 = y;
+    box.x2 = x + width;
+    box.y2 = y + height;
+    glamor_solid_boxes(pixmap, &box, 1, fg_pixel);
+
+    glamor_set_alu(screen, GXcopy);
+
+    return TRUE;
+}
diff --git a/glamor/glamor_font.c b/glamor/glamor_font.c
new file mode 100644 (file)
index 0000000..57c607d
--- /dev/null
@@ -0,0 +1,184 @@
+/*
+ * Copyright Â© 2014 Keith Packard
+ *
+ * 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 the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  The copyright holders make no representations
+ * about the suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS 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.
+ */
+
+#include "glamor_priv.h"
+#include "glamor_font.h"
+#include <dixfontstr.h>
+
+static int glamor_font_generation;
+static int glamor_font_private_index;
+static int glamor_font_screen_count;
+
+glamor_font_t *
+glamor_font_get(ScreenPtr screen, FontPtr font)
+{
+    glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
+
+    glamor_font_t       *privates;
+    glamor_font_t       *glamor_font;
+    int                 overall_width, overall_height;
+    int                 num_rows;
+    int                 num_cols;
+    int                 glyph_width_pixels;
+    int                 glyph_width_bytes;
+    int                 glyph_height;
+    int                 row, col;
+    unsigned char       c[2];
+    CharInfoPtr         glyph;
+    unsigned long       count;
+
+
+    privates = FontGetPrivate(font, glamor_font_private_index);
+    if (!privates) {
+        privates = calloc(glamor_font_screen_count, sizeof (glamor_font_t));
+        if (!privates)
+            return NULL;
+        FontSetPrivate(font, glamor_font_private_index, privates);
+    }
+
+    glamor_font = &privates[screen->myNum];
+
+    if (glamor_font->realized)
+        return glamor_font;
+
+    glamor_font->realized = TRUE;
+
+    /* Figure out how many glyphs are in the font */
+    num_cols = font->info.lastCol - font->info.firstCol + 1;
+    num_rows = font->info.lastRow - font->info.firstRow + 1;
+
+    /* Figure out the size of each glyph */
+    glyph_width_pixels = font->info.maxbounds.rightSideBearing - font->info.minbounds.leftSideBearing;
+    glyph_height = font->info.maxbounds.ascent + font->info.maxbounds.descent;
+
+    glyph_width_bytes = (glyph_width_pixels + 7) >> 3;
+
+    glamor_font->glyph_width_pixels = glyph_width_pixels;
+    glamor_font->glyph_width_bytes = glyph_width_bytes;
+    glamor_font->glyph_height = glyph_height;
+
+    overall_width = glyph_width_bytes * num_cols;
+    overall_height = glyph_height * num_rows;
+
+    /* Check whether the font has a default character */
+    c[0] = font->info.lastRow + 1;
+    c[1] = font->info.lastCol + 1;
+    (*font->get_glyphs)(font, 1, c, TwoD16Bit, &count, &glyph);
+
+    glamor_font->default_char = count ? glyph : NULL;
+    glamor_font->default_row = font->info.defaultCh >> 8;
+    glamor_font->default_col = font->info.defaultCh;
+
+    glamor_priv = glamor_get_screen_private(screen);
+    glamor_make_current(glamor_priv);
+
+    glGenTextures(1, &glamor_font->texture_id);
+    glActiveTexture(GL_TEXTURE0);
+    glBindTexture(GL_TEXTURE_2D, glamor_font->texture_id);
+
+    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);
+    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+
+    /* Allocate storage */
+    glTexImage2D(GL_TEXTURE_2D, 0, GL_R8UI, overall_width, overall_height,
+                 0, GL_RED_INTEGER, GL_UNSIGNED_BYTE, NULL);
+
+    glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
+
+    /* Paint all of the glyphs */
+    for (row = 0; row < num_rows; row++) {
+        for (col = 0; col < num_cols; col++) {
+            c[0] = row + font->info.firstRow;
+            c[1] = col + font->info.firstCol;
+
+            (*font->get_glyphs)(font, 1, c, TwoD16Bit, &count, &glyph);
+
+            if (count)
+                glTexSubImage2D(GL_TEXTURE_2D, 0, col * glyph_width_bytes, row * glyph_height,
+                                GLYPHWIDTHBYTES(glyph), GLYPHHEIGHTPIXELS(glyph),
+                                GL_RED_INTEGER, GL_UNSIGNED_BYTE, glyph->bits);
+        }
+    }
+
+    return glamor_font;
+}
+
+static Bool
+glamor_realize_font(ScreenPtr screen, FontPtr font)
+{
+    return TRUE;
+}
+
+static Bool
+glamor_unrealize_font(ScreenPtr screen, FontPtr font)
+{
+    glamor_screen_private       *glamor_priv;
+    glamor_font_t               *privates = FontGetPrivate(font, glamor_font_private_index);
+    glamor_font_t               *glamor_font;
+    int                         s;
+
+    if (!privates)
+        return TRUE;
+
+    glamor_font = &privates[screen->myNum];
+
+    if (!glamor_font->realized)
+        return TRUE;
+
+    /* Unrealize the font, freeing the allocated texture */
+    glamor_font->realized = FALSE;
+
+    glamor_priv = glamor_get_screen_private(screen);
+    glamor_make_current(glamor_priv);
+    glDeleteTextures(1, &glamor_font->texture_id);
+
+    /* Check to see if all of the screens are  done with this font
+     * and free the private when that happens
+     */
+    for (s = 0; s < glamor_font_screen_count; s++)
+        if (privates[s].realized)
+            return TRUE;
+
+    free(privates);
+    FontSetPrivate(font, glamor_font_private_index, NULL);
+    return TRUE;
+}
+
+Bool
+glamor_font_init(ScreenPtr screen)
+{
+    if (glamor_font_generation != serverGeneration) {
+        glamor_font_private_index = AllocateFontPrivateIndex();
+        if (glamor_font_private_index == -1)
+            return FALSE;
+        glamor_font_screen_count = 0;
+        glamor_font_generation = serverGeneration;
+    }
+
+    if (screen->myNum >= glamor_font_screen_count)
+        glamor_font_screen_count = screen->myNum + 1;
+
+    screen->RealizeFont = glamor_realize_font;
+    screen->UnrealizeFont = glamor_unrealize_font;
+    return TRUE;
+}
diff --git a/glamor/glamor_font.h b/glamor/glamor_font.h
new file mode 100644 (file)
index 0000000..36d2062
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * Copyright Â© 2014 Keith Packard
+ *
+ * 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 the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  The copyright holders make no representations
+ * about the suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS 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.
+ */
+
+#ifndef _GLAMOR_FONT_H_
+#define _GLAMOR_FONT_H_
+
+typedef struct {
+    Bool        realized;
+    CharInfoPtr default_char;
+    CARD8       default_row;
+    CARD8       default_col;
+
+    GLuint      texture_id;
+
+    CARD16      glyph_width_bytes;
+    CARD16      glyph_width_pixels;
+    CARD16      glyph_height;
+
+} glamor_font_t;
+
+glamor_font_t *
+glamor_font_get(ScreenPtr screen, FontPtr font);
+
+Bool
+glamor_font_init(ScreenPtr screen);
+
+void
+glamor_fini_glyph_shader(ScreenPtr screen);
+
+#endif /* _GLAMOR_FONT_H_ */
diff --git a/glamor/glamor_glx.c b/glamor/glamor_glx.c
new file mode 100644 (file)
index 0000000..7107c7c
--- /dev/null
@@ -0,0 +1,68 @@
+/*
+ * Copyright Â© 2013 Intel 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.
+ */
+
+#include <epoxy/glx.h>
+#include "glamor_context.h"
+
+/**
+ * @file glamor_glx.c
+ *
+ * GLX context management for glamor.
+ *
+ * This has to be kept separate from the server sources because of
+ * Xlib's conflicting definition of CARD32 and similar typedefs.
+ */
+
+static void
+glamor_glx_make_current(struct glamor_context *glamor_ctx)
+{
+    /* There's only a single global dispatch table in Mesa.  EGL, GLX,
+     * and AIGLX's direct dispatch table manipulation don't talk to
+     * each other.  We need to set the context to NULL first to avoid
+     * GLX's no-op context change fast path when switching back to
+     * GLX.
+     */
+    glXMakeCurrent(glamor_ctx->display, None, None);
+
+    glXMakeCurrent(glamor_ctx->display, glamor_ctx->drawable_xid,
+                   glamor_ctx->ctx);
+}
+
+
+Bool
+glamor_glx_screen_init(struct glamor_context *glamor_ctx)
+{
+    glamor_ctx->ctx = glXGetCurrentContext();
+    if (!glamor_ctx->ctx)
+        return False;
+
+    glamor_ctx->display = glXGetCurrentDisplay();
+    if (!glamor_ctx->display)
+        return False;
+
+    glamor_ctx->drawable_xid = glXGetCurrentDrawable();
+
+    glamor_ctx->make_current = glamor_glx_make_current;
+
+    return True;
+}
diff --git a/glamor/glamor_glyphblt.c b/glamor/glamor_glyphblt.c
new file mode 100644 (file)
index 0000000..1c511ff
--- /dev/null
@@ -0,0 +1,317 @@
+/*
+ * Copyright Â© 2009 Intel Corporation
+ * Copyright Â© 1998 Keith Packard
+ *
+ * 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.
+ *
+ * Authors:
+ *    Zhigang Gong <zhigang.gong@gmail.com>
+ *
+ */
+
+#include "glamor_priv.h"
+#include <dixfontstr.h>
+#include "glamor_transform.h"
+
+static const glamor_facet glamor_facet_poly_glyph_blt = {
+    .name = "poly_glyph_blt",
+    .vs_vars = "attribute vec2 primitive;\n",
+    .vs_exec = ("       vec2 pos = vec2(0,0);\n"
+                GLAMOR_POS(gl_Position, primitive)),
+};
+
+static Bool
+glamor_poly_glyph_blt_gl(DrawablePtr drawable, GCPtr gc,
+                         int start_x, int y, unsigned int nglyph,
+                         CharInfoPtr *ppci, void *pglyph_base)
+{
+    ScreenPtr screen = drawable->pScreen;
+    glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
+    PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable);
+    glamor_pixmap_private *pixmap_priv;
+    glamor_program *prog;
+    RegionPtr clip = gc->pCompositeClip;
+    int box_x, box_y;
+
+    pixmap_priv = glamor_get_pixmap_private(pixmap);
+    if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv))
+        goto bail;
+
+    glamor_make_current(glamor_priv);
+
+    prog = glamor_use_program_fill(pixmap, gc, &glamor_priv->poly_glyph_blt_progs,
+                                   &glamor_facet_poly_glyph_blt);
+    if (!prog)
+        goto bail_ctx;
+
+    glEnableVertexAttribArray(GLAMOR_VERTEX_POS);
+
+    start_x += drawable->x;
+    y += drawable->y;
+
+    glamor_pixmap_loop(pixmap_priv, box_x, box_y) {
+        int x;
+        int n;
+        int num_points, max_points;
+        INT16 *points = NULL;
+        int off_x, off_y;
+        char *vbo_offset;
+
+        glamor_set_destination_drawable(drawable, box_x, box_y, FALSE, TRUE, prog->matrix_uniform, &off_x, &off_y);
+
+        max_points = 500;
+        num_points = 0;
+        x = start_x;
+        for (n = 0; n < nglyph; n++) {
+            CharInfoPtr charinfo = ppci[n];
+            int w = GLYPHWIDTHPIXELS(charinfo);
+            int h = GLYPHHEIGHTPIXELS(charinfo);
+            uint8_t *glyphbits = FONTGLYPHBITS(NULL, charinfo);
+
+            if (w && h) {
+                int glyph_x = x + charinfo->metrics.leftSideBearing;
+                int glyph_y = y - charinfo->metrics.ascent;
+                int glyph_stride = GLYPHWIDTHBYTESPADDED(charinfo);
+                int xx, yy;
+
+                for (yy = 0; yy < h; yy++) {
+                    uint8_t *glyph = glyphbits;
+                    for (xx = 0; xx < w; glyph += ((xx&7) == 7), xx++) {
+                        int pt_x_i = glyph_x + xx;
+                        int pt_y_i = glyph_y + yy;
+
+                        if (!(*glyph & (1 << (xx & 7))))
+                            continue;
+
+                        if (!RegionContainsPoint(clip, pt_x_i, pt_y_i, NULL))
+                            continue;
+
+                        if (!num_points) {
+                            points = glamor_get_vbo_space(screen,
+                                                          max_points * (2 * sizeof (INT16)),
+                                                          &vbo_offset);
+
+                            glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_SHORT,
+                                                  GL_FALSE, 0, vbo_offset);
+                        }
+
+                        *points++ = pt_x_i;
+                        *points++ = pt_y_i;
+                        num_points++;
+
+                        if (num_points == max_points) {
+                            glamor_put_vbo_space(screen);
+                            glDrawArrays(GL_POINTS, 0, num_points);
+                            num_points = 0;
+                        }
+                    }
+                    glyphbits += glyph_stride;
+                }
+            }
+            x += charinfo->metrics.characterWidth;
+        }
+
+        if (num_points) {
+            glamor_put_vbo_space(screen);
+            glDrawArrays(GL_POINTS, 0, num_points);
+        }
+    }
+
+    glDisable(GL_COLOR_LOGIC_OP);
+    glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
+
+    return TRUE;
+bail_ctx:
+    glDisable(GL_COLOR_LOGIC_OP);
+bail:
+    return FALSE;
+}
+
+void
+glamor_poly_glyph_blt(DrawablePtr drawable, GCPtr gc,
+                      int start_x, int y, unsigned int nglyph,
+                      CharInfoPtr *ppci, void *pglyph_base)
+{
+    if (glamor_poly_glyph_blt_gl(drawable, gc, start_x, y, nglyph, ppci, pglyph_base))
+        return;
+    miPolyGlyphBlt(drawable, gc, start_x, y, nglyph,
+                   ppci, pglyph_base);
+}
+
+Bool
+glamor_poly_glyph_blt_nf(DrawablePtr drawable, GCPtr gc,
+                         int start_x, int y, unsigned int nglyph,
+                         CharInfoPtr *ppci, void *pglyph_base)
+{
+    if (glamor_poly_glyph_blt_gl(drawable, gc, start_x, y, nglyph, ppci, pglyph_base))
+        return TRUE;
+    if (glamor_ddx_fallback_check_pixmap(drawable) && glamor_ddx_fallback_check_gc(gc))
+        return FALSE;
+    miPolyGlyphBlt(drawable, gc, start_x, y, nglyph,
+                   ppci, pglyph_base);
+    return TRUE;
+}
+
+Bool
+glamor_image_glyph_blt_nf(DrawablePtr drawable, GCPtr gc,
+                          int start_x, int y, unsigned int nglyph,
+                          CharInfoPtr *ppci, void *pglyph_base)
+{
+    miImageGlyphBlt(drawable, gc, start_x, y, nglyph, ppci, pglyph_base);
+    return TRUE;
+}
+
+static Bool
+glamor_push_pixels_points(GCPtr gc, PixmapPtr bitmap,
+                          DrawablePtr drawable, int w, int h, int x, int y)
+{
+    ScreenPtr screen = drawable->pScreen;
+    glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
+    PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable);
+    glamor_pixmap_private *pixmap_priv;
+    uint8_t *bitmap_data = bitmap->devPrivate.ptr;
+    int bitmap_stride = bitmap->devKind;
+    int off_x, off_y;
+    int yy, xx;
+    GLfloat xscale, yscale;
+    float color[4];
+    unsigned long fg_pixel = gc->fgPixel;
+    float *points, *next_point;
+    int num_points = 0;
+    char *vbo_offset;
+    RegionPtr clip;
+
+    if (w * h > MAXINT / (2 * sizeof(float)))
+        return FALSE;
+
+    if (gc->fillStyle != FillSolid) {
+        glamor_fallback("gc fillstyle not solid\n");
+        return FALSE;
+    }
+
+    pixmap_priv = glamor_get_pixmap_private(pixmap);
+    if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv))
+        return FALSE;
+
+    glamor_make_current(glamor_priv);
+    if (!glamor_set_alu(screen, gc->alu)) {
+        if (gc->alu == GXclear)
+            fg_pixel = 0;
+        else {
+            glamor_fallback("unsupported alu %x\n", gc->alu);
+            return FALSE;
+        }
+    }
+
+    if (!glamor_set_planemask(pixmap, gc->planemask)) {
+        glamor_fallback("Failed to set planemask in %s.\n", __FUNCTION__);
+        return FALSE;
+    }
+
+    glamor_get_drawable_deltas(drawable, pixmap, &off_x, &off_y);
+
+    glamor_set_destination_pixmap_priv_nc(pixmap_priv);
+    pixmap_priv_get_dest_scale(pixmap_priv, &xscale, &yscale);
+
+    glUseProgram(glamor_priv->solid_prog);
+
+    glamor_get_rgba_from_pixel(fg_pixel,
+                               &color[0], &color[1], &color[2], &color[3],
+                               format_for_pixmap(pixmap));
+    glUniform4fv(glamor_priv->solid_color_uniform_location, 1, color);
+
+    points = glamor_get_vbo_space(screen, w * h * sizeof(float) * 2,
+                                  &vbo_offset);
+    next_point = points;
+
+    clip = fbGetCompositeClip(gc);
+
+    /* Note that because fb sets miTranslate in the GC, our incoming X
+     * and Y are in screen coordinate space (same for spans, but not
+     * other operations).
+     */
+    for (yy = 0; yy < h; yy++) {
+        uint8_t *bitmap_row = bitmap_data + yy * bitmap_stride;
+        for (xx = 0; xx < w; xx++) {
+            if (bitmap_row[xx / 8] & (1 << xx % 8) &&
+                RegionContainsPoint(clip,
+                                    x + xx,
+                                    y + yy,
+                                    NULL)) {
+                next_point[0] = v_from_x_coord_x(xscale, x + xx + off_x + 0.5);
+                if (glamor_priv->yInverted)
+                    next_point[1] = v_from_x_coord_y_inverted(yscale, y + yy + off_y + 0.5);
+                else
+                    next_point[1] = v_from_x_coord_y(yscale, y + yy + off_y + 0.5);
+
+                next_point += 2;
+                num_points++;
+            }
+        }
+    }
+    glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT,
+                          GL_FALSE, 2 * sizeof(float),
+                          vbo_offset);
+    glEnableVertexAttribArray(GLAMOR_VERTEX_POS);
+
+    glamor_put_vbo_space(screen);
+
+    glDrawArrays(GL_POINTS, 0, num_points);
+
+    glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
+
+    return TRUE;
+}
+
+static Bool
+_glamor_push_pixels(GCPtr pGC, PixmapPtr pBitmap,
+                    DrawablePtr pDrawable, int w, int h, int x, int y,
+                    Bool fallback)
+{
+    glamor_pixmap_private *pixmap_priv;
+
+    if (!fallback && glamor_ddx_fallback_check_pixmap(pDrawable)
+        && glamor_ddx_fallback_check_pixmap(&pBitmap->drawable)
+        && glamor_ddx_fallback_check_gc(pGC))
+        return FALSE;
+
+    pixmap_priv = glamor_get_pixmap_private(pBitmap);
+    if (pixmap_priv->type == GLAMOR_MEMORY) {
+        if (glamor_push_pixels_points(pGC, pBitmap, pDrawable, w, h, x, y))
+            return TRUE;
+    }
+
+    miPushPixels(pGC, pBitmap, pDrawable, w, h, x, y);
+    return TRUE;
+}
+
+void
+glamor_push_pixels(GCPtr pGC, PixmapPtr pBitmap,
+                   DrawablePtr pDrawable, int w, int h, int x, int y)
+{
+    _glamor_push_pixels(pGC, pBitmap, pDrawable, w, h, x, y, TRUE);
+}
+
+Bool
+glamor_push_pixels_nf(GCPtr pGC, PixmapPtr pBitmap,
+                      DrawablePtr pDrawable, int w, int h, int x, int y)
+{
+    return _glamor_push_pixels(pGC, pBitmap, pDrawable, w, h, x, y, FALSE);
+}
diff --git a/glamor/glamor_glyphs.c b/glamor/glamor_glyphs.c
new file mode 100644 (file)
index 0000000..42f5f65
--- /dev/null
@@ -0,0 +1,1807 @@
+/*
+ * Copyright Â© 2008 Red Hat, Inc.
+ * Partly based on code Copyright Â© 2000 SuSE, Inc.
+ *
+ * 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 Red Hat not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  Red Hat makes no representations about the
+ * suitability of this software for any purpose.  It is provided "as is"
+ * without express or implied warranty.
+ *
+ * Red Hat DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL Red Hat
+ * 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.
+ *
+ * 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 SuSE not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  SuSE makes no representations about the
+ * suitability of this software for any purpose.  It is provided "as is"
+ * without express or implied warranty.
+ *
+ * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
+ * 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.
+ *
+ * Author: Owen Taylor <otaylor@fishsoup.net>
+ * Based on code by: Keith Packard
+ */
+
+#include <stdlib.h>
+
+#include "glamor_priv.h"
+
+#include <mipict.h>
+
+#if DEBUG_GLYPH_CACHE
+#define DBG_GLYPH_CACHE(a) ErrorF a
+#else
+#define DBG_GLYPH_CACHE(a)
+#endif
+
+/* Width of the pixmaps we use for the caches; this should be less than
+ * max texture size of the driver; this may need to actually come from
+ * the driver.
+ */
+
+/* Maximum number of glyphs we buffer on the stack before flushing
+ * rendering to the mask or destination surface.
+ */
+#define GLYPH_BUFFER_SIZE 1024
+
+#define CACHE_PICTURE_SIZE 1024
+#define GLYPH_MIN_SIZE 8
+#define GLYPH_MAX_SIZE 64
+#define GLYPH_CACHE_SIZE ((CACHE_PICTURE_SIZE) * CACHE_PICTURE_SIZE / (GLYPH_MIN_SIZE * GLYPH_MIN_SIZE))
+#define MASK_CACHE_MAX_SIZE 32
+#define MASK_CACHE_WIDTH (CACHE_PICTURE_SIZE / MASK_CACHE_MAX_SIZE)
+#define MASK_CACHE_MASK ((1LL << (MASK_CACHE_WIDTH)) - 1)
+
+typedef struct {
+    PicturePtr source;
+    glamor_composite_rect_t rects[GLYPH_BUFFER_SIZE + 4];
+    int count;
+} glamor_glyph_buffer_t;
+
+struct glamor_glyph {
+    glamor_glyph_cache_t *cache;
+    uint16_t x, y;
+    uint16_t size, pos;
+    unsigned long long left_x1_map, left_x2_map;
+    unsigned long long right_x1_map, right_x2_map;      /* Use to check real intersect or not. */
+    Bool has_edge_map;
+    Bool cached;
+};
+
+typedef enum {
+    GLAMOR_GLYPH_SUCCESS,       /* Glyph added to render buffer */
+    GLAMOR_GLYPH_FAIL,          /* out of memory, etc */
+    GLAMOR_GLYPH_NEED_FLUSH,    /* would evict a glyph already in the buffer */
+} glamor_glyph_cache_result_t;
+
+#define NeedsComponent(f) (PICT_FORMAT_A(f) != 0 && PICT_FORMAT_RGB(f) != 0)
+static DevPrivateKeyRec glamor_glyph_key;
+
+static inline struct glamor_glyph *
+glamor_glyph_get_private(GlyphPtr glyph)
+{
+    return (struct glamor_glyph *) glyph->devPrivates;
+}
+
+/*
+ * Mask cache is located at the corresponding cache picture's last row.
+ * and is deadicated for the mask picture when do the glyphs_via_mask.
+ *
+ * As we split the glyphs list according to its overlapped or non-overlapped,
+ * we can reduce the length of glyphs to do the glyphs_via_mask to 2 or 3
+ * glyphs one time for most cases. Thus it give us a case to allocate a
+ * small portion of the corresponding cache directly as the mask picture.
+ * Then we can rendering the glyphs to this mask picture, and latter we
+ * can accumulate the second steps, composite the mask to the dest with
+ * the other non-overlapped glyphs's rendering process.
+ * Another major benefit is we now only need to clear a relatively small mask
+ * region then before. It also make us implement a bunch mask picture clearing
+ * algorithm to avoid too frequently small region clearing.
+ *
+ * If there is no any overlapping, this method will not get performance gain.
+ * If there is some overlapping, then this algorithm can get about 15% performance
+ * gain.
+ */
+
+struct glamor_glyph_mask_cache_entry {
+    int idx;
+    int width;
+    int height;
+    int x;
+    int y;
+};
+
+static struct glamor_glyph_mask_cache {
+    PixmapPtr pixmap;
+    struct glamor_glyph_mask_cache_entry mcache[MASK_CACHE_WIDTH];
+    unsigned int free_bitmap;
+    unsigned int cleared_bitmap;
+} *mask_cache[GLAMOR_NUM_GLYPH_CACHE_FORMATS] = {
+NULL};
+
+static void
+clear_mask_cache_bitmap(struct glamor_glyph_mask_cache *maskcache,
+                        unsigned int clear_mask_bits)
+{
+    unsigned int i = 0;
+    BoxRec box[MASK_CACHE_WIDTH];
+    int box_cnt = 0;
+
+    assert((clear_mask_bits & ~MASK_CACHE_MASK) == 0);
+    for (i = 0; i < MASK_CACHE_WIDTH; i++) {
+        if (clear_mask_bits & (1 << i)) {
+            box[box_cnt].x1 = maskcache->mcache[i].x;
+            box[box_cnt].x2 = maskcache->mcache[i].x + MASK_CACHE_MAX_SIZE;
+            box[box_cnt].y1 = maskcache->mcache[i].y;
+            box[box_cnt].y2 = maskcache->mcache[i].y + MASK_CACHE_MAX_SIZE;
+            box_cnt++;
+        }
+    }
+    glamor_solid_boxes(maskcache->pixmap, box, box_cnt, 0);
+    maskcache->cleared_bitmap |= clear_mask_bits;
+}
+
+static void
+clear_mask_cache(struct glamor_glyph_mask_cache *maskcache)
+{
+    int x = 0;
+    int cnt = MASK_CACHE_WIDTH;
+    unsigned int i = 0;
+    struct glamor_glyph_mask_cache_entry *mce;
+
+    glamor_solid(maskcache->pixmap, 0, CACHE_PICTURE_SIZE, CACHE_PICTURE_SIZE,
+                 MASK_CACHE_MAX_SIZE, GXcopy, 0xFFFFFFFF, 0);
+    mce = &maskcache->mcache[0];
+    while (cnt--) {
+        mce->width = 0;
+        mce->height = 0;
+        mce->x = x;
+        mce->y = CACHE_PICTURE_SIZE;
+        mce->idx = i++;
+        x += MASK_CACHE_MAX_SIZE;
+        mce++;
+    }
+    maskcache->free_bitmap = MASK_CACHE_MASK;
+    maskcache->cleared_bitmap = MASK_CACHE_MASK;
+}
+
+static int
+find_continuous_bits(unsigned int bits, int bits_cnt, unsigned int *pbits_mask)
+{
+    int idx = 0;
+    unsigned int bits_mask;
+
+    bits_mask = ((1LL << bits_cnt) - 1);
+
+    if (_X_UNLIKELY(bits_cnt > 56)) {
+        while (bits) {
+            if ((bits & bits_mask) == bits_mask) {
+                *pbits_mask = bits_mask << idx;
+                return idx;
+            }
+            bits >>= 1;
+            idx++;
+        }
+    }
+    else {
+        idx = __fls(bits);
+        while (bits) {
+            unsigned int temp_bits;
+
+            temp_bits = bits_mask << (idx - bits_cnt + 1);
+            if ((bits & temp_bits) == temp_bits) {
+                *pbits_mask = temp_bits;
+                return (idx - bits_cnt + 1);
+            }
+            /* Find first zero. And clear the tested bit. */
+            bits &= ~(1LL << idx);
+            idx = __fls(~bits);
+            bits &= ~((1LL << idx) - 1);
+            idx--;
+        }
+    }
+    return -1;
+}
+
+static struct glamor_glyph_mask_cache_entry *
+get_mask_cache(struct glamor_glyph_mask_cache *maskcache, int blocks)
+{
+    int free_cleared_bit, idx = -1;
+    int retry_cnt = 0;
+    unsigned int bits_mask = 0;
+
+    if (maskcache->free_bitmap == 0)
+        return NULL;
+ retry:
+    free_cleared_bit = maskcache->free_bitmap & maskcache->cleared_bitmap;
+    if (free_cleared_bit && blocks == 1) {
+        idx = __fls(free_cleared_bit);
+        bits_mask = 1 << idx;
+    }
+    else if (free_cleared_bit && blocks > 1) {
+        idx = find_continuous_bits(free_cleared_bit, blocks, &bits_mask);
+    }
+
+    if (idx < 0) {
+        clear_mask_cache_bitmap(maskcache, maskcache->free_bitmap);
+        if (retry_cnt++ > 2)
+            return NULL;
+        goto retry;
+    }
+
+    maskcache->cleared_bitmap &= ~bits_mask;
+    maskcache->free_bitmap &= ~bits_mask;
+    DEBUGF("get idx %d free %x clear %x \n",
+           idx, maskcache->free_bitmap, maskcache->cleared_bitmap);
+    return &maskcache->mcache[idx];
+}
+
+static void
+put_mask_cache_bitmap(struct glamor_glyph_mask_cache *maskcache,
+                      unsigned int bitmap)
+{
+    maskcache->free_bitmap |= bitmap;
+    DEBUGF("put bitmap %x free %x clear %x \n",
+           bitmap, maskcache->free_bitmap, maskcache->cleared_bitmap);
+}
+
+static void
+glamor_unrealize_glyph_caches(ScreenPtr pScreen)
+{
+    glamor_screen_private *glamor = glamor_get_screen_private(pScreen);
+    int i;
+
+    if (!glamor->glyph_cache_initialized)
+        return;
+
+    for (i = 0; i < GLAMOR_NUM_GLYPH_CACHE_FORMATS; i++) {
+        glamor_glyph_cache_t *cache = &glamor->glyphCaches[i];
+
+        if (cache->picture)
+            FreePicture(cache->picture, 0);
+
+        if (cache->glyphs)
+            free(cache->glyphs);
+
+        if (mask_cache[i])
+            free(mask_cache[i]);
+    }
+    glamor->glyph_cache_initialized = FALSE;
+}
+
+void
+glamor_glyphs_fini(ScreenPtr pScreen)
+{
+    glamor_unrealize_glyph_caches(pScreen);
+}
+
+/* All caches for a single format share a single pixmap for glyph storage,
+ * allowing mixing glyphs of different sizes without paying a penalty
+ * for switching between source pixmaps. (Note that for a size of font
+ * right at the border between two sizes, we might be switching for almost
+ * every glyph.)
+ *
+ * This function allocates the storage pixmap, and then fills in the
+ * rest of the allocated structures for all caches with the given format.
+ */
+
+Bool
+glamor_realize_glyph_caches(ScreenPtr pScreen)
+{
+    glamor_screen_private *glamor = glamor_get_screen_private(pScreen);
+
+    unsigned int formats[] = {
+        PIXMAN_a8,
+        PIXMAN_a8r8g8b8,
+    };
+    int i;
+
+    memset(glamor->glyphCaches, 0, sizeof(glamor->glyphCaches));
+
+    for (i = 0; i < sizeof(formats) / sizeof(formats[0]); i++) {
+        glamor_glyph_cache_t *cache = &glamor->glyphCaches[i];
+        PixmapPtr pixmap;
+        PicturePtr picture;
+        XID component_alpha;
+        int depth = PIXMAN_FORMAT_DEPTH(formats[i]);
+        int error;
+        PictFormatPtr pPictFormat =
+            PictureMatchFormat(pScreen, depth, formats[i]);
+        if (!pPictFormat)
+            goto bail;
+
+        /* Now allocate the pixmap and picture */
+        pixmap = pScreen->CreatePixmap(pScreen,
+                                       CACHE_PICTURE_SIZE,
+                                       CACHE_PICTURE_SIZE + MASK_CACHE_MAX_SIZE,
+                                       depth, GLAMOR_CREATE_NO_LARGE);
+        if (!pixmap)
+            goto bail;
+
+        component_alpha = NeedsComponent(pPictFormat->format);
+        picture = CreatePicture(0, &pixmap->drawable, pPictFormat,
+                                CPComponentAlpha, &component_alpha,
+                                serverClient, &error);
+
+        pScreen->DestroyPixmap(pixmap);
+        if (!picture)
+            goto bail;
+
+        ValidatePicture(picture);
+
+        cache->picture = picture;
+        cache->glyphs = calloc(sizeof(GlyphPtr), GLYPH_CACHE_SIZE);
+        if (!cache->glyphs)
+            goto bail;
+
+        cache->evict = rand() % GLYPH_CACHE_SIZE;
+        mask_cache[i] = calloc(1, sizeof(*mask_cache[i]));
+        mask_cache[i]->pixmap = pixmap;
+        clear_mask_cache(mask_cache[i]);
+    }
+    assert(i == GLAMOR_NUM_GLYPH_CACHE_FORMATS);
+
+    return TRUE;
+
+ bail:
+    glamor_unrealize_glyph_caches(pScreen);
+    return FALSE;
+}
+
+/**
+ * Called by glamor_create_screen_resources() to set up the glyph cache.
+ *
+ * This was previously required to be called by the drivers, but not
+ * as of the xserver 1.16 ABI.
+ */
+Bool
+glamor_glyphs_init(ScreenPtr pScreen)
+{
+    glamor_screen_private *glamor = glamor_get_screen_private(pScreen);
+
+    if (glamor->glyph_cache_initialized)
+        return TRUE;
+
+    if (!dixRegisterPrivateKey(&glamor_glyph_key,
+                               PRIVATE_GLYPH, sizeof(struct glamor_glyph)))
+        return FALSE;
+
+    glamor->glyph_cache_initialized = TRUE;
+
+    return TRUE;
+}
+
+/* The most efficient thing to way to upload the glyph to the screen
+ * is to use CopyArea; glamor pixmaps are always offscreen.
+ */
+static void
+glamor_glyph_cache_upload_glyph(ScreenPtr screen,
+                                glamor_glyph_cache_t *cache,
+                                GlyphPtr glyph, int x, int y)
+{
+    PicturePtr pGlyphPicture = GlyphPicture(glyph)[screen->myNum];
+    PixmapPtr pGlyphPixmap = (PixmapPtr) pGlyphPicture->pDrawable;
+    PixmapPtr pCachePixmap = (PixmapPtr) cache->picture->pDrawable;
+    PixmapPtr scratch;
+    BoxRec box;
+    GCPtr gc;
+
+    gc = GetScratchGC(pCachePixmap->drawable.depth, screen);
+    if (!gc)
+        return;
+
+    ValidateGC(&pCachePixmap->drawable, gc);
+
+    scratch = pGlyphPixmap;
+    if (pGlyphPixmap->drawable.depth != pCachePixmap->drawable.depth) {
+
+        scratch = glamor_create_pixmap(screen,
+                                       glyph->info.width,
+                                       glyph->info.height,
+                                       pCachePixmap->drawable.depth, 0);
+        if (scratch) {
+            PicturePtr picture;
+            int error;
+
+            picture =
+                CreatePicture(0,
+                              &scratch->drawable,
+                              PictureMatchFormat
+                              (screen,
+                               pCachePixmap->drawable.depth,
+                               cache->picture->format),
+                              0, NULL, serverClient, &error);
+            if (picture) {
+                ValidatePicture(picture);
+                glamor_composite(PictOpSrc,
+                                 pGlyphPicture,
+                                 NULL, picture,
+                                 0, 0, 0, 0, 0,
+                                 0, glyph->info.width, glyph->info.height);
+                FreePicture(picture, 0);
+            }
+        }
+        else {
+            scratch = pGlyphPixmap;
+        }
+    }
+
+    box.x1 = x;
+    box.y1 = y;
+    box.x2 = x + glyph->info.width;
+    box.y2 = y + glyph->info.height;
+    glamor_copy_n_to_n_nf(&scratch->drawable,
+                          &pCachePixmap->drawable, NULL,
+                          &box, 1, -x, -y, FALSE, FALSE, 0, NULL);
+    if (scratch != pGlyphPixmap)
+        screen->DestroyPixmap(scratch);
+
+    FreeScratchGC(gc);
+}
+
+void
+glamor_glyph_unrealize(ScreenPtr screen, GlyphPtr glyph)
+{
+    struct glamor_glyph *priv;
+
+    /* Use Lookup in case we have not attached to this glyph. */
+    priv = glamor_glyph_get_private(glyph);
+
+    if (priv->cached)
+        priv->cache->glyphs[priv->pos] = NULL;
+}
+
+/* Cut and paste from render/glyph.c - probably should export it instead */
+static void
+glamor_glyph_extents(int nlist,
+                     GlyphListPtr list, GlyphPtr *glyphs, BoxPtr extents)
+{
+    int x1, x2, y1, y2;
+    int x, y, n;
+
+    x1 = y1 = MAXSHORT;
+    x2 = y2 = MINSHORT;
+    x = y = 0;
+    while (nlist--) {
+        x += list->xOff;
+        y += list->yOff;
+        n = list->len;
+        list++;
+        while (n--) {
+            GlyphPtr glyph = *glyphs++;
+            int v;
+
+            v = x - glyph->info.x;
+            if (v < x1)
+                x1 = v;
+            v += glyph->info.width;
+            if (v > x2)
+                x2 = v;
+
+            v = y - glyph->info.y;
+            if (v < y1)
+                y1 = v;
+            v += glyph->info.height;
+            if (v > y2)
+                y2 = v;
+
+            x += glyph->info.xOff;
+            y += glyph->info.yOff;
+        }
+    }
+
+    extents->x1 = x1 < MINSHORT ? MINSHORT : x1;
+    extents->x2 = x2 > MAXSHORT ? MAXSHORT : x2;
+    extents->y1 = y1 < MINSHORT ? MINSHORT : y1;
+    extents->y2 = y2 > MAXSHORT ? MAXSHORT : y2;
+}
+
+static void
+glamor_glyph_priv_get_edge_map(GlyphPtr glyph, struct glamor_glyph *priv,
+                               PicturePtr glyph_picture)
+{
+    PixmapPtr glyph_pixmap = (PixmapPtr) glyph_picture->pDrawable;
+    int j;
+    unsigned long long left_x1_map = 0, left_x2_map = 0;
+    unsigned long long right_x1_map = 0, right_x2_map = 0;
+    int bitsPerPixel;
+    int stride;
+    void *bits;
+    int width;
+    unsigned int left_x1_data = 0, left_x2_data = 0;
+    unsigned int right_x1_data = 0, right_x2_data = 0;
+
+    bitsPerPixel = glyph_pixmap->drawable.bitsPerPixel;
+    stride = glyph_pixmap->devKind;
+    bits = glyph_pixmap->devPrivate.ptr;
+    width = glyph->info.width;
+
+    if (glyph_pixmap->drawable.width < 2
+        || !(glyph_pixmap->drawable.depth == 8
+             || glyph_pixmap->drawable.depth == 1
+             || glyph_pixmap->drawable.depth == 32)) {
+        priv->has_edge_map = FALSE;
+        return;
+    }
+
+    left_x1_map = left_x2_map = 0;
+    right_x1_map = right_x2_map = 0;
+
+    for (j = 0; j < glyph_pixmap->drawable.height; j++) {
+        if (bitsPerPixel == 8) {
+            unsigned char *data;
+
+            data = (unsigned char *) ((unsigned char *) bits + stride * j);
+            left_x1_data = *data++;
+            left_x2_data = *data;
+            data =
+                (unsigned char *) ((unsigned char *) bits + stride * j + width -
+                                   2);
+            right_x1_data = *data++;
+            right_x2_data = *data;
+        }
+        else if (bitsPerPixel == 32) {
+            left_x1_data = *((unsigned int *) bits + stride / 4 * j);
+            left_x2_data = *((unsigned int *) bits + stride / 4 * j + 1);
+            right_x1_data =
+                *((unsigned int *) bits + stride / 4 * j + width - 2);
+            right_x2_data =
+                *((unsigned int *) bits + stride / 4 * j + width - 1);
+        }
+        else if (bitsPerPixel == 1) {
+            unsigned char temp;
+
+            temp = *((unsigned char *) glyph_pixmap->devPrivate.ptr
+                     + glyph_pixmap->devKind * j) & 0x3;
+            left_x1_data = temp & 0x1;
+            left_x2_data = temp & 0x2;
+
+            temp = *((unsigned char *) glyph_pixmap->devPrivate.ptr
+                     + glyph_pixmap->devKind * j
+                     + (glyph_pixmap->drawable.width - 2) / 8);
+            right_x1_data = temp
+                & (1 << ((glyph_pixmap->drawable.width - 2) % 8));
+            temp = *((unsigned char *) glyph_pixmap->devPrivate.ptr
+                     + glyph_pixmap->devKind * j
+                     + (glyph_pixmap->drawable.width - 1) / 8);
+            right_x2_data = temp
+                & (1 << ((glyph_pixmap->drawable.width - 1) % 8));
+        }
+        left_x1_map |= (left_x1_data != 0) << j;
+        left_x2_map |= (left_x2_data != 0) << j;
+        right_x1_map |= (right_x1_data != 0) << j;
+        right_x2_map |= (right_x2_data != 0) << j;
+    }
+
+    priv->left_x1_map = left_x1_map;
+    priv->left_x2_map = left_x2_map;
+    priv->right_x1_map = right_x1_map;
+    priv->right_x2_map = right_x2_map;
+    priv->has_edge_map = TRUE;
+    return;
+}
+
+/**
+ * Returns TRUE if the glyphs in the lists intersect.  Only checks based on
+ * bounding box, which appears to be good enough to catch most cases at least.
+ */
+
+#define INTERSECTED_TYPE_MASK 1
+#define NON_INTERSECTED 0
+#define INTERSECTED 1
+
+struct glamor_glyph_list {
+    int nlist;
+    GlyphListPtr list;
+    GlyphPtr *glyphs;
+    int type;
+};
+
+static Bool
+glyph_new_fixed_list(struct glamor_glyph_list *fixed_list,
+                     GlyphPtr *cur_glyphs,
+                     GlyphPtr ** head_glyphs,
+                     GlyphListPtr cur_list,
+                     int cur_pos, int cur_x, int cur_y,
+                     int x1, int y1, int x2, int y2,
+                     GlyphListPtr *head_list,
+                     int *head_pos,
+                     int *head_x,
+                     int *head_y, int *fixed_cnt, int type, BoxPtr prev_extents)
+{
+    int x_off = 0;
+    int y_off = 0;
+    int n_off = 0;
+    int list_cnt;
+
+    if (type == NON_INTERSECTED) {
+        if (x1 < prev_extents->x2 && x2 > prev_extents->x1
+            && y1 < prev_extents->y2 && y2 > prev_extents->y1)
+            return FALSE;
+        x_off = (*(cur_glyphs - 1))->info.xOff;
+        y_off = (*(cur_glyphs - 1))->info.yOff;
+        n_off = 1;
+    }
+
+    list_cnt = cur_list - *head_list + 1;
+    if (cur_pos <= n_off) {
+        DEBUGF("break at %d n_off %d\n", cur_pos, n_off);
+        list_cnt--;
+        if (cur_pos < n_off) {
+            /* we overlap with previous list's last glyph. */
+            x_off += cur_list->xOff;
+            y_off += cur_list->yOff;
+            cur_list--;
+            cur_pos = cur_list->len;
+            if (cur_pos <= n_off) {
+                list_cnt--;
+            }
+        }
+    }
+    DEBUGF("got %d lists\n", list_cnt);
+    if (list_cnt != 0) {
+        fixed_list->list = malloc(list_cnt * sizeof(*cur_list));
+        memcpy(fixed_list->list, *head_list, list_cnt * sizeof(*cur_list));
+        fixed_list->list[0].xOff = *head_x;
+        fixed_list->list[0].yOff = *head_y;
+        fixed_list->glyphs = *head_glyphs;
+        fixed_list->type = type & INTERSECTED_TYPE_MASK;
+        fixed_list->nlist = list_cnt;
+        if (cur_list != *head_list) {
+            fixed_list->list[0].len = (*head_list)->len - *head_pos;
+            if (cur_pos != n_off)
+                fixed_list->list[list_cnt - 1].len = cur_pos - n_off;
+        }
+        else
+            fixed_list->list[0].len = cur_pos - *head_pos - n_off;
+        (*fixed_cnt)++;
+    }
+
+    if (type <= INTERSECTED) {
+        *head_list = cur_list;
+        *head_pos = cur_pos - n_off;
+        *head_x = cur_x - x_off;
+        *head_y = cur_y - y_off;
+        *head_glyphs = cur_glyphs - n_off;
+    }
+    return TRUE;
+}
+
+/*
+ * This function detects glyph lists's overlapping.
+ *
+ * If check_fake_overlap is set, then it will check the glyph's left
+ * and right small boxes's real overlapping pixels. And if there is
+ * no real pixel overlapping, then it will not be treated as overlapped
+ * case. And we also can configured it to ignore less than 2 pixels
+ * overlappig.
+ *
+ * This function analyzes all the lists and split the list to multiple
+ * lists which are pure overlapped glyph lists or pure non-overlapped
+ * list if the overlapping only ocurr on the two adjacent glyphs.
+ * Otherwise, it return -1.
+ *
+ **/
+
+static int
+glamor_glyphs_intersect(int nlist, GlyphListPtr list, GlyphPtr *glyphs,
+                        PictFormatShort mask_format,
+                        ScreenPtr screen, Bool check_fake_overlap,
+                        struct glamor_glyph_list *fixed_list, int fixed_size)
+{
+    int x1, x2, y1, y2;
+    int n;
+    int x, y;
+    BoxPtr extents;
+    BoxRec prev_extents;
+    Bool first = TRUE, first_list = TRUE;
+    Bool need_free_list_region = FALSE;
+    Bool need_free_fixed_list = FALSE;
+    struct glamor_glyph *priv = NULL;
+    Bool in_non_intersected_list = -1;
+    GlyphListPtr head_list;
+    int head_x, head_y, head_pos;
+    int fixed_cnt = 0;
+    GlyphPtr *head_glyphs;
+    GlyphListPtr cur_list = list;
+    RegionRec list_region;
+    RegionRec current_region;
+    BoxRec current_box;
+
+    if (nlist > 1) {
+        pixman_region_init(&list_region);
+        need_free_list_region = TRUE;
+    }
+
+    pixman_region_init(&current_region);
+
+    extents = pixman_region_extents(&current_region);
+
+    x = 0;
+    y = 0;
+    x1 = x2 = y1 = y2 = 0;
+    n = 0;
+    extents->x1 = 0;
+    extents->y1 = 0;
+    extents->x2 = 0;
+    extents->y2 = 0;
+
+    head_list = list;
+    DEBUGF("has %d lists.\n", nlist);
+    while (nlist--) {
+        BoxRec left_box, right_box = { 0 };
+        Bool has_left_edge_box = FALSE, has_right_edge_box = FALSE;
+        Bool left_to_right;
+        struct glamor_glyph *left_priv = NULL, *right_priv = NULL;
+
+        x += list->xOff;
+        y += list->yOff;
+        n = list->len;
+        left_to_right = TRUE;
+        cur_list = list++;
+
+        if (_X_UNLIKELY(!first_list)) {
+            pixman_region_init_with_extents(&current_region, extents);
+            pixman_region_union(&list_region, &list_region, &current_region);
+            first = TRUE;
+        }
+        else {
+            head_list = cur_list;
+            head_pos = cur_list->len - n;
+            head_x = x;
+            head_y = y;
+            head_glyphs = glyphs;
+        }
+
+        DEBUGF("current list %p has %d glyphs\n", cur_list, n);
+        while (n--) {
+            GlyphPtr glyph = *glyphs++;
+
+            DEBUGF("the %dth glyph\n", cur_list->len - n - 1);
+            if (glyph->info.width == 0 || glyph->info.height == 0) {
+                x += glyph->info.xOff;
+                y += glyph->info.yOff;
+                continue;
+            }
+            if (mask_format
+                && mask_format != GlyphPicture(glyph)[screen->myNum]->format) {
+                need_free_fixed_list = TRUE;
+                goto done;
+            }
+
+            x1 = x - glyph->info.x;
+            if (x1 < MINSHORT)
+                x1 = MINSHORT;
+            y1 = y - glyph->info.y;
+            if (y1 < MINSHORT)
+                y1 = MINSHORT;
+            if (check_fake_overlap)
+                priv = glamor_glyph_get_private(glyph);
+
+            x2 = x1 + glyph->info.width;
+            y2 = y1 + glyph->info.height;
+
+            if (x2 > MAXSHORT)
+                x2 = MAXSHORT;
+            if (y2 > MAXSHORT)
+                y2 = MAXSHORT;
+
+            if (first) {
+                extents->x1 = x1;
+                extents->y1 = y1;
+                extents->x2 = x2;
+                extents->y2 = y2;
+
+                prev_extents = *extents;
+
+                first = FALSE;
+                if (check_fake_overlap && priv
+                    && priv->has_edge_map && glyph->info.yOff == 0) {
+                    left_box.x1 = x1;
+                    left_box.x2 = x1 + 1;
+                    left_box.y1 = y1;
+
+                    right_box.x1 = x2 - 2;
+                    right_box.x2 = x2 - 1;
+                    right_box.y1 = y1;
+                    left_priv = right_priv = priv;
+                    has_left_edge_box = TRUE;
+                    has_right_edge_box = TRUE;
+                }
+            }
+            else {
+                if (_X_UNLIKELY(!first_list)) {
+                    current_box.x1 = x1;
+                    current_box.y1 = y1;
+                    current_box.x2 = x2;
+                    current_box.y2 = y2;
+                    if (pixman_region_contains_rectangle
+                        (&list_region, &current_box) != PIXMAN_REGION_OUT) {
+                        need_free_fixed_list = TRUE;
+                        goto done;
+                    }
+                }
+
+                if (x1 < extents->x2 && x2 > extents->x1
+                    && y1 < extents->y2 && y2 > extents->y1) {
+
+                    if (check_fake_overlap &&
+                        (has_left_edge_box || has_right_edge_box)
+                        && priv->has_edge_map && glyph->info.yOff == 0) {
+                        int left_dx, right_dx;
+                        unsigned long long intersected;
+
+                        left_dx = has_left_edge_box ? 1 : 0;
+                        right_dx = has_right_edge_box ? 1 : 0;
+                        if (x1 + 1 < extents->x2 - right_dx &&
+                            x2 - 1 > extents->x1 + left_dx)
+                            goto real_intersected;
+
+                        if (left_to_right && has_right_edge_box) {
+                            if (x1 == right_box.x1) {
+                                intersected =
+                                    ((priv->left_x1_map & right_priv->
+                                      right_x1_map)
+                                     | (priv->left_x2_map & right_priv->
+                                        right_x2_map));
+                                if (intersected)
+                                    goto real_intersected;
+                            }
+                            else if (x1 == right_box.x2) {
+                                intersected =
+                                    (priv->left_x1_map & right_priv->
+                                     right_x2_map);
+                                if (intersected) {
+#ifdef  GLYPHS_EDEGE_OVERLAP_LOOSE_CHECK
+                                    /* tolerate with two pixels overlap. */
+                                    intersected &= ~(1 << __fls(intersected));
+                                    if ((intersected & (intersected - 1)))
+#endif
+                                        goto real_intersected;
+                                }
+                            }
+                        }
+                        else if (!left_to_right && has_left_edge_box) {
+                            if (x2 - 1 == left_box.x1) {
+                                intersected =
+                                    (priv->right_x2_map & left_priv->
+                                     left_x1_map);
+                                if (intersected) {
+#ifdef  GLYPHS_EDEGE_OVERLAP_LOOSE_CHECK
+                                    /* tolerate with two pixels overlap. */
+                                    intersected &= ~(1 << __fls(intersected));
+                                    if ((intersected & (intersected - 1)))
+#endif
+                                        goto real_intersected;
+                                }
+                            }
+                            else if (x2 - 1 == right_box.x2) {
+                                if ((priv->right_x1_map & left_priv->
+                                     left_x1_map)
+                                    || (priv->right_x2_map & left_priv->
+                                        left_x2_map))
+                                    goto real_intersected;
+                            }
+                        }
+                        else {
+                            if (x1 < extents->x2 && x1 + 2 > extents->x1)
+                                goto real_intersected;
+                        }
+                        goto non_intersected;
+                    }
+                    else {
+ real_intersected:
+                        DEBUGF("overlap with previous glyph.\n");
+                        if (in_non_intersected_list == 1) {
+                            if (fixed_cnt >= fixed_size) {
+                                need_free_fixed_list = TRUE;
+                                goto done;
+                            }
+                            if (!glyph_new_fixed_list(&fixed_list[fixed_cnt],
+                                                      glyphs - 1,
+                                                      &head_glyphs,
+                                                      cur_list,
+                                                      cur_list->len - (n + 1),
+                                                      x, y, x1, y1, x2, y2,
+                                                      &head_list, &head_pos,
+                                                      &head_x, &head_y,
+                                                      &fixed_cnt,
+                                                      NON_INTERSECTED,
+                                                      &prev_extents)) {
+                                need_free_fixed_list = TRUE;
+                                goto done;
+                            }
+                        }
+
+                        in_non_intersected_list = 0;
+
+                    }
+                }
+                else {
+ non_intersected:
+                    DEBUGF("doesn't overlap with previous glyph.\n");
+                    if (in_non_intersected_list == 0) {
+                        if (fixed_cnt >= fixed_size) {
+                            need_free_fixed_list = TRUE;
+                            goto done;
+                        }
+                        if (!glyph_new_fixed_list(&fixed_list[fixed_cnt],
+                                                  glyphs - 1,
+                                                  &head_glyphs,
+                                                  cur_list,
+                                                  cur_list->len - (n + 1), x, y,
+                                                  x1, y1, x2, y2,
+                                                  &head_list,
+                                                  &head_pos,
+                                                  &head_x,
+                                                  &head_y, &fixed_cnt,
+                                                  INTERSECTED, &prev_extents)) {
+                            need_free_fixed_list = TRUE;
+                            goto done;
+                        }
+                    }
+                    in_non_intersected_list = 1;
+                }
+                prev_extents = *extents;
+            }
+
+            if (check_fake_overlap && priv
+                && priv->has_edge_map && glyph->info.yOff == 0) {
+                if (!has_left_edge_box || x1 < extents->x1) {
+                    left_box.x1 = x1;
+                    left_box.x2 = x1 + 1;
+                    left_box.y1 = y1;
+                    has_left_edge_box = TRUE;
+                    left_priv = priv;
+                }
+
+                if (!has_right_edge_box || x2 > extents->x2) {
+                    right_box.x1 = x2 - 2;
+                    right_box.x2 = x2 - 1;
+                    right_box.y1 = y1;
+                    has_right_edge_box = TRUE;
+                    right_priv = priv;
+                }
+            }
+
+            if (x1 < extents->x1)
+                extents->x1 = x1;
+            if (x2 > extents->x2)
+                extents->x2 = x2;
+
+            if (y1 < extents->y1)
+                extents->y1 = y1;
+            if (y2 > extents->y2)
+                extents->y2 = y2;
+
+            x += glyph->info.xOff;
+            y += glyph->info.yOff;
+        }
+        first_list = FALSE;
+    }
+
+    if (in_non_intersected_list == 0 && fixed_cnt == 0) {
+        fixed_cnt = -1;
+        goto done;
+    }
+
+    if ((in_non_intersected_list != -1 || head_pos != n) && (fixed_cnt > 0)) {
+        if (fixed_cnt >= fixed_size) {
+            need_free_fixed_list = TRUE;
+            goto done;
+        }
+        if (!glyph_new_fixed_list(&fixed_list[fixed_cnt],
+                                  glyphs - 1,
+                                  &head_glyphs,
+                                  cur_list,
+                                  cur_list->len - (n + 1), x, y,
+                                  x1, y1, x2, y2,
+                                  &head_list,
+                                  &head_pos,
+                                  &head_x,
+                                  &head_y, &fixed_cnt,
+                                  (!in_non_intersected_list) | 0x80,
+                                  &prev_extents)) {
+            need_free_fixed_list = TRUE;
+            goto done;
+        }
+    }
+
+ done:
+    if (need_free_list_region)
+        pixman_region_fini(&list_region);
+    pixman_region_fini(&current_region);
+
+    if (need_free_fixed_list && fixed_cnt >= 0) {
+        while (fixed_cnt--) {
+            free(fixed_list[fixed_cnt].list);
+        }
+    }
+
+    DEBUGF("Got %d fixed list \n", fixed_cnt);
+    return fixed_cnt;
+}
+
+static inline unsigned int
+glamor_glyph_size_to_count(int size)
+{
+    size /= GLYPH_MIN_SIZE;
+    return size * size;
+}
+
+static inline unsigned int
+glamor_glyph_count_to_mask(int count)
+{
+    return ~(count - 1);
+}
+
+static inline unsigned int
+glamor_glyph_size_to_mask(int size)
+{
+    return glamor_glyph_count_to_mask(glamor_glyph_size_to_count(size));
+}
+
+static PicturePtr
+glamor_glyph_cache(glamor_screen_private *glamor, GlyphPtr glyph, int *out_x,
+                   int *out_y)
+{
+    ScreenPtr screen = glamor->screen;
+    PicturePtr glyph_picture = GlyphPicture(glyph)[screen->myNum];
+    glamor_glyph_cache_t *cache =
+        &glamor->glyphCaches[PICT_FORMAT_RGB(glyph_picture->format) != 0];
+    struct glamor_glyph *priv = NULL, *evicted_priv = NULL;
+    int size, mask, pos, s;
+
+    if (glyph->info.width > GLYPH_MAX_SIZE
+        || glyph->info.height > GLYPH_MAX_SIZE)
+        return NULL;
+
+    for (size = GLYPH_MIN_SIZE; size <= GLYPH_MAX_SIZE; size *= 2)
+        if (glyph->info.width <= size && glyph->info.height <= size)
+            break;
+
+    s = glamor_glyph_size_to_count(size);
+    mask = glamor_glyph_count_to_mask(s);
+    pos = (cache->count + s - 1) & mask;
+
+    priv = glamor_glyph_get_private(glyph);
+    if (pos < GLYPH_CACHE_SIZE) {
+        cache->count = pos + s;
+    }
+    else {
+        for (s = size; s <= GLYPH_MAX_SIZE; s *= 2) {
+            int i = cache->evict & glamor_glyph_size_to_mask(s);
+            GlyphPtr evicted = cache->glyphs[i];
+
+            if (evicted == NULL)
+                continue;
+
+            evicted_priv = glamor_glyph_get_private(evicted);
+            assert(evicted_priv->pos == i);
+            if (evicted_priv->size >= s) {
+                cache->glyphs[i] = NULL;
+                evicted_priv->cached = FALSE;
+                pos = cache->evict & glamor_glyph_size_to_mask(size);
+            }
+            else
+                evicted_priv = NULL;
+            break;
+        }
+        if (evicted_priv == NULL) {
+            int count = glamor_glyph_size_to_count(size);
+
+            mask = glamor_glyph_count_to_mask(count);
+            pos = cache->evict & mask;
+            for (s = 0; s < count; s++) {
+                GlyphPtr evicted = cache->glyphs[pos + s];
+
+                if (evicted != NULL) {
+
+                    evicted_priv = glamor_glyph_get_private(evicted);
+
+                    assert(evicted_priv->pos == pos + s);
+                    evicted_priv->cached = FALSE;
+                    cache->glyphs[pos + s] = NULL;
+                }
+            }
+
+        }
+        /* And pick a new eviction position */
+        cache->evict = rand() % GLYPH_CACHE_SIZE;
+    }
+
+    cache->glyphs[pos] = glyph;
+
+    priv->cache = cache;
+    priv->size = size;
+    priv->pos = pos;
+    s = pos / ((GLYPH_MAX_SIZE / GLYPH_MIN_SIZE) *
+               (GLYPH_MAX_SIZE / GLYPH_MIN_SIZE));
+    priv->x = s % (CACHE_PICTURE_SIZE / GLYPH_MAX_SIZE) * GLYPH_MAX_SIZE;
+    priv->y = (s / (CACHE_PICTURE_SIZE / GLYPH_MAX_SIZE)) * GLYPH_MAX_SIZE;
+    for (s = GLYPH_MIN_SIZE; s < GLYPH_MAX_SIZE; s *= 2) {
+        if (pos & 1)
+            priv->x += s;
+        if (pos & 2)
+            priv->y += s;
+        pos >>= 2;
+    }
+
+    glamor_glyph_cache_upload_glyph(screen, cache, glyph, priv->x, priv->y);
+#ifndef GLYPHS_NO_EDEGEMAP_OVERLAP_CHECK
+    if (priv->has_edge_map == FALSE && glyph->info.width >= 2)
+        glamor_glyph_priv_get_edge_map(glyph, priv, glyph_picture);
+#endif
+    priv->cached = TRUE;
+
+    *out_x = priv->x;
+    *out_y = priv->y;
+    return cache->picture;
+}
+
+typedef void (*glyphs_flush_func) (void *arg);
+struct glyphs_flush_dst_arg {
+    CARD8 op;
+    PicturePtr src;
+    PicturePtr dst;
+    glamor_glyph_buffer_t *buffer;
+    int x_src, y_src;
+    int x_dst, y_dst;
+};
+
+static struct glyphs_flush_dst_arg dst_arg;
+static struct glyphs_flush_mask_arg mask_arg;
+static glamor_glyph_buffer_t dst_buffer;
+static glamor_glyph_buffer_t mask_buffer;
+unsigned long long mask_glyphs_cnt = 0;
+unsigned long long dst_glyphs_cnt = 0;
+
+#define GLYPHS_DST_MODE_VIA_MASK               0
+#define GLYPHS_DST_MODE_VIA_MASK_CACHE         1
+#define GLYPHS_DST_MODE_TO_DST                 2
+#define GLYPHS_DST_MODE_MASK_TO_DST            3
+
+struct glyphs_flush_mask_arg {
+    PicturePtr mask;
+    glamor_glyph_buffer_t *buffer;
+    struct glamor_glyph_mask_cache *maskcache;
+    unsigned int used_bitmap;
+};
+
+static void
+glamor_glyphs_flush_mask(struct glyphs_flush_mask_arg *arg)
+{
+    if (arg->buffer->count > 0) {
+#ifdef RENDER
+        glamor_composite_glyph_rects(PictOpAdd, arg->buffer->source,
+                                     NULL, arg->mask,
+                                     arg->buffer->count, arg->buffer->rects);
+#endif
+    }
+    arg->buffer->count = 0;
+    arg->buffer->source = NULL;
+
+}
+
+static void
+glamor_glyphs_flush_dst(struct glyphs_flush_dst_arg *arg)
+{
+    if (!arg->buffer)
+        return;
+
+    if (mask_buffer.count > 0) {
+        glamor_glyphs_flush_mask(&mask_arg);
+    }
+    if (mask_arg.used_bitmap) {
+        put_mask_cache_bitmap(mask_arg.maskcache, mask_arg.used_bitmap);
+        mask_arg.used_bitmap = 0;
+    }
+
+    if (arg->buffer->count > 0) {
+        glamor_composite_glyph_rects(arg->op, arg->src,
+                                     arg->buffer->source, arg->dst,
+                                     arg->buffer->count,
+                                     &arg->buffer->rects[0]);
+        arg->buffer->count = 0;
+        arg->buffer->source = NULL;
+    }
+}
+
+static glamor_glyph_cache_result_t
+glamor_buffer_glyph(glamor_screen_private *glamor_priv,
+                    glamor_glyph_buffer_t *buffer,
+                    PictFormatShort format,
+                    GlyphPtr glyph, struct glamor_glyph *priv,
+                    int x_glyph, int y_glyph,
+                    int dx, int dy, int w, int h,
+                    int glyphs_dst_mode,
+                    glyphs_flush_func glyphs_flush, void *flush_arg)
+{
+    ScreenPtr screen = glamor_priv->screen;
+    glamor_composite_rect_t *rect;
+    PicturePtr source;
+    int x, y;
+    glamor_glyph_cache_t *cache;
+
+    if (glyphs_dst_mode != GLYPHS_DST_MODE_MASK_TO_DST)
+        priv = glamor_glyph_get_private(glyph);
+
+    if (PICT_FORMAT_BPP(format) == 1)
+        format = PICT_a8;
+
+    cache = &glamor_priv->glyphCaches[PICT_FORMAT_RGB(format) != 0];
+
+    if (buffer->source && buffer->source != cache->picture && glyphs_flush) {
+        (*glyphs_flush) (flush_arg);
+        glyphs_flush = NULL;
+    }
+
+    if (buffer->count == GLYPH_BUFFER_SIZE && glyphs_flush) {
+        (*glyphs_flush) (flush_arg);
+        glyphs_flush = NULL;
+    }
+
+    if (priv && priv->cached) {
+        rect = &buffer->rects[buffer->count++];
+        rect->x_src = priv->x + dx;
+        rect->y_src = priv->y + dy;
+        if (buffer->source == NULL)
+            buffer->source = priv->cache->picture;
+        if (glyphs_dst_mode <= GLYPHS_DST_MODE_VIA_MASK_CACHE)
+            assert(priv->cache->glyphs[priv->pos] == glyph);
+    }
+    else {
+        assert(glyphs_dst_mode != GLYPHS_DST_MODE_MASK_TO_DST);
+        if (glyphs_flush)
+            (*glyphs_flush) (flush_arg);
+        source = glamor_glyph_cache(glamor_priv, glyph, &x, &y);
+
+        if (source != NULL) {
+            rect = &buffer->rects[buffer->count++];
+            rect->x_src = x + dx;
+            rect->y_src = y + dy;
+            if (buffer->source == NULL)
+                buffer->source = source;
+            if (glyphs_dst_mode == GLYPHS_DST_MODE_VIA_MASK_CACHE) {
+                /* mode 1 means we are using global mask cache,
+                 * thus we have to composite from the cache picture
+                 * to the cache picture, we need a flush here to make
+                 * sure latter we get the corret glyphs data.*/
+                glamor_make_current(glamor_priv);
+                glFlush();
+            }
+        }
+        else {
+            /* Couldn't find the glyph in the cache, use the glyph picture directly */
+            source = GlyphPicture(glyph)[screen->myNum];
+            if (buffer->source && buffer->source != source && glyphs_flush)
+                (*glyphs_flush) (flush_arg);
+            buffer->source = source;
+
+            rect = &buffer->rects[buffer->count++];
+            rect->x_src = 0 + dx;
+            rect->y_src = 0 + dy;
+        }
+        priv = glamor_glyph_get_private(glyph);
+    }
+
+    rect->x_dst = x_glyph;
+    rect->y_dst = y_glyph;
+    if (glyphs_dst_mode != GLYPHS_DST_MODE_MASK_TO_DST) {
+        rect->x_dst -= glyph->info.x;
+        rect->y_dst -= glyph->info.y;
+    }
+    rect->width = w;
+    rect->height = h;
+    if (glyphs_dst_mode > GLYPHS_DST_MODE_VIA_MASK_CACHE) {
+        rect->x_mask = rect->x_src;
+        rect->y_mask = rect->y_src;
+        rect->x_src = dst_arg.x_src + rect->x_dst - dst_arg.x_dst;
+        rect->y_src = dst_arg.y_src + rect->y_dst - dst_arg.y_dst;
+    }
+
+    return GLAMOR_GLYPH_SUCCESS;
+}
+
+static void
+glamor_buffer_glyph_clip(glamor_screen_private *glamor_priv,
+                         BoxPtr rects,
+                         int nrect, PictFormatShort format,
+                         GlyphPtr glyph, struct glamor_glyph *priv,
+                         int glyph_x, int glyph_y,
+                         int glyph_dx, int glyph_dy,
+                         int width, int height,
+                         int glyphs_mode,
+                         glyphs_flush_func flush_func, void *arg)
+{
+    int i;
+
+    for (i = 0; i < nrect; i++) {
+        int dst_x, dst_y;
+        int dx, dy;
+        int x2, y2;
+
+        dst_x = glyph_x - glyph_dx;
+        dst_y = glyph_y - glyph_dy;
+        x2 = dst_x + width;
+        y2 = dst_y + height;
+        dx = dy = 0;
+        if (rects[i].y1 >= y2)
+            break;
+
+        if (dst_x < rects[i].x1)
+            dx = rects[i].x1 - dst_x, dst_x = rects[i].x1;
+        if (x2 > rects[i].x2)
+            x2 = rects[i].x2;
+        if (dst_y < rects[i].y1)
+            dy = rects[i].y1 - dst_y, dst_y = rects[i].y1;
+        if (y2 > rects[i].y2)
+            y2 = rects[i].y2;
+        if (dst_x < x2 && dst_y < y2) {
+
+            glamor_buffer_glyph(glamor_priv,
+                                &dst_buffer,
+                                format,
+                                glyph, priv,
+                                dst_x + glyph_dx,
+                                dst_y + glyph_dy,
+                                dx, dy,
+                                x2 - dst_x, y2 - dst_y,
+                                glyphs_mode, flush_func, arg);
+        }
+    }
+}
+
+static void
+glamor_glyphs_via_mask(CARD8 op,
+                       PicturePtr src,
+                       PicturePtr dst,
+                       PictFormatPtr mask_format,
+                       INT16 x_src,
+                       INT16 y_src,
+                       int nlist, GlyphListPtr list, GlyphPtr *glyphs,
+                       Bool use_mask_cache)
+{
+    PixmapPtr mask_pixmap = 0;
+    PicturePtr mask;
+    ScreenPtr screen = dst->pDrawable->pScreen;
+    int width = 0, height = 0;
+    int x, y;
+    int x_dst = list->xOff, y_dst = list->yOff;
+    int n;
+    GlyphPtr glyph;
+    int error;
+    BoxRec extents = { 0, 0, 0, 0 };
+    XID component_alpha;
+    glamor_screen_private *glamor_priv;
+    int need_free_mask = FALSE;
+    glamor_glyph_buffer_t buffer;
+    struct glyphs_flush_mask_arg arg;
+    glamor_glyph_buffer_t *pmask_buffer;
+    struct glyphs_flush_mask_arg *pmask_arg;
+    struct glamor_glyph_mask_cache_entry *mce = NULL;
+    struct glamor_glyph_mask_cache *maskcache;
+    glamor_glyph_cache_t *cache;
+    int glyphs_dst_mode;
+
+    glamor_glyph_extents(nlist, list, glyphs, &extents);
+
+    if (extents.x2 <= extents.x1 || extents.y2 <= extents.y1)
+        return;
+    glamor_priv = glamor_get_screen_private(screen);
+    width = extents.x2 - extents.x1;
+    height = extents.y2 - extents.y1;
+
+    if (mask_format->depth == 1) {
+        PictFormatPtr a8Format = PictureMatchFormat(screen, 8, PICT_a8);
+
+        if (a8Format)
+            mask_format = a8Format;
+    }
+
+    cache = &glamor_priv->glyphCaches
+        [PICT_FORMAT_RGB(mask_format->format) != 0];
+    maskcache = mask_cache[PICT_FORMAT_RGB(mask_format->format) != 0];
+
+    x = -extents.x1;
+    y = -extents.y1;
+    if (!use_mask_cache || width > (CACHE_PICTURE_SIZE / 4)
+        || height > MASK_CACHE_MAX_SIZE) {
+ new_mask_pixmap:
+        mask_pixmap = glamor_create_pixmap(screen, width, height,
+                                           mask_format->depth,
+                                           CREATE_PIXMAP_USAGE_SCRATCH);
+        if (!mask_pixmap) {
+            glamor_destroy_pixmap(mask_pixmap);
+            return;
+        }
+        glamor_solid(mask_pixmap, 0, 0, width, height, GXcopy, 0xFFFFFFFF, 0);
+        component_alpha = NeedsComponent(mask_format->format);
+        mask = CreatePicture(0, &mask_pixmap->drawable,
+                             mask_format, CPComponentAlpha,
+                             &component_alpha, serverClient, &error);
+        if (!mask)
+            return;
+        need_free_mask = TRUE;
+        pmask_arg = &arg;
+        pmask_buffer = &buffer;
+        pmask_buffer->count = 0;
+        pmask_buffer->source = NULL;
+        pmask_arg->used_bitmap = 0;
+        glyphs_dst_mode = GLYPHS_DST_MODE_VIA_MASK;
+    }
+    else {
+        int retry_cnt = 0;
+
+ retry:
+        mce = get_mask_cache(maskcache,
+                             (width + MASK_CACHE_MAX_SIZE -
+                              1) / MASK_CACHE_MAX_SIZE);
+
+        if (mce == NULL) {
+            glamor_glyphs_flush_dst(&dst_arg);
+            retry_cnt++;
+            if (retry_cnt > 2) {
+                assert(0);
+                goto new_mask_pixmap;
+            }
+            goto retry;
+        }
+
+        mask = cache->picture;
+        x += mce->x;
+        y += mce->y;
+        mce->width = (width + MASK_CACHE_MAX_SIZE - 1) / MASK_CACHE_MAX_SIZE;
+        mce->height = 1;
+        if (mask_arg.mask && mask_arg.mask != mask && mask_buffer.count != 0)
+            glamor_glyphs_flush_dst(&dst_arg);
+        pmask_arg = &mask_arg;
+        pmask_buffer = &mask_buffer;
+        pmask_arg->maskcache = maskcache;
+        glyphs_dst_mode = GLYPHS_DST_MODE_VIA_MASK_CACHE;
+    }
+    pmask_arg->mask = mask;
+    pmask_arg->buffer = pmask_buffer;
+    while (nlist--) {
+        x += list->xOff;
+        y += list->yOff;
+        n = list->len;
+        mask_glyphs_cnt += n;
+        while (n--) {
+            glyph = *glyphs++;
+            if (glyph->info.width > 0 && glyph->info.height > 0) {
+                glyphs_flush_func flush_func;
+                void *temp_arg;
+
+                if (need_free_mask) {
+                    if (pmask_buffer->count)
+                        flush_func =
+                            (glyphs_flush_func) glamor_glyphs_flush_mask;
+                    else
+                        flush_func = NULL;
+                    temp_arg = pmask_arg;
+                }
+                else {
+                    /* If we are using global mask cache, then we need to
+                     * flush dst instead of mask. As some dst depends on the
+                     * previous mask result. Just flush mask can't get all previous's
+                     * overlapped glyphs.*/
+                    if (dst_buffer.count || mask_buffer.count)
+                        flush_func =
+                            (glyphs_flush_func) glamor_glyphs_flush_dst;
+                    else
+                        flush_func = NULL;
+                    temp_arg = &dst_arg;
+                }
+                glamor_buffer_glyph(glamor_priv, pmask_buffer,
+                                    mask_format->format,
+                                    glyph, NULL, x, y,
+                                    0, 0,
+                                    glyph->info.width, glyph->info.height,
+                                    glyphs_dst_mode,
+                                    flush_func, (void *) temp_arg);
+            }
+            x += glyph->info.xOff;
+            y += glyph->info.yOff;
+        }
+        list++;
+    }
+
+    x = extents.x1;
+    y = extents.y1;
+    if (need_free_mask) {
+        glamor_glyphs_flush_mask(pmask_arg);
+        CompositePicture(op,
+                         src,
+                         mask,
+                         dst,
+                         x_src + x - x_dst,
+                         y_src + y - y_dst, 0, 0, x, y, width, height);
+        FreePicture(mask, 0);
+        glamor_destroy_pixmap(mask_pixmap);
+    }
+    else {
+        struct glamor_glyph priv;
+        glyphs_flush_func flush_func;
+        BoxPtr rects;
+        int nrect;
+
+        priv.cache = cache;
+        priv.x = mce->x;
+        priv.y = mce->y;
+        priv.cached = TRUE;
+        rects = REGION_RECTS(dst->pCompositeClip);
+        nrect = REGION_NUM_RECTS(dst->pCompositeClip);
+
+        pmask_arg->used_bitmap |= ((1 << mce->width) - 1) << mce->idx;
+        dst_arg.op = op;
+        dst_arg.src = src;
+        dst_arg.dst = dst;
+        dst_arg.buffer = &dst_buffer;
+        dst_arg.x_src = x_src;
+        dst_arg.y_src = y_src;
+        dst_arg.x_dst = x_dst;
+        dst_arg.y_dst = y_dst;
+
+        if (dst_buffer.source == NULL) {
+            dst_buffer.source = cache->picture;
+        }
+        else if (dst_buffer.source != cache->picture) {
+            glamor_glyphs_flush_dst(&dst_arg);
+            dst_buffer.source = cache->picture;
+        }
+
+        x += dst->pDrawable->x;
+        y += dst->pDrawable->y;
+
+        if (dst_buffer.count || mask_buffer.count)
+            flush_func = (glyphs_flush_func) glamor_glyphs_flush_dst;
+        else
+            flush_func = NULL;
+
+        glamor_buffer_glyph_clip(glamor_priv,
+                                 rects, nrect,
+                                 mask_format->format,
+                                 NULL, &priv,
+                                 x, y,
+                                 0, 0,
+                                 width, height,
+                                 GLYPHS_DST_MODE_MASK_TO_DST,
+                                 flush_func, (void *) &dst_arg);
+    }
+}
+
+static void
+glamor_glyphs_to_dst(CARD8 op,
+                     PicturePtr src,
+                     PicturePtr dst,
+                     INT16 x_src,
+                     INT16 y_src,
+                     int nlist, GlyphListPtr list, GlyphPtr *glyphs)
+{
+    ScreenPtr screen = dst->pDrawable->pScreen;
+    int x = 0, y = 0;
+    int x_dst = list->xOff, y_dst = list->yOff;
+    int n;
+    GlyphPtr glyph;
+    BoxPtr rects;
+    int nrect;
+    glamor_screen_private *glamor_priv;
+
+    rects = REGION_RECTS(dst->pCompositeClip);
+    nrect = REGION_NUM_RECTS(dst->pCompositeClip);
+
+    glamor_priv = glamor_get_screen_private(screen);
+
+    dst_arg.op = op;
+    dst_arg.src = src;
+    dst_arg.dst = dst;
+    dst_arg.buffer = &dst_buffer;
+    dst_arg.x_src = x_src;
+    dst_arg.y_src = y_src;
+    dst_arg.x_dst = x_dst;
+    dst_arg.y_dst = y_dst;
+
+    x = dst->pDrawable->x;
+    y = dst->pDrawable->y;
+
+    while (nlist--) {
+        x += list->xOff;
+        y += list->yOff;
+        n = list->len;
+        dst_glyphs_cnt += n;
+        while (n--) {
+            glyph = *glyphs++;
+
+            if (glyph->info.width > 0 && glyph->info.height > 0) {
+                glyphs_flush_func flush_func;
+
+                if (dst_buffer.count || mask_buffer.count)
+                    flush_func = (glyphs_flush_func) glamor_glyphs_flush_dst;
+                else
+                    flush_func = NULL;
+                glamor_buffer_glyph_clip(glamor_priv,
+                                         rects, nrect,
+                                         (GlyphPicture(glyph)[screen->myNum])->
+                                         format, glyph, NULL, x, y,
+                                         glyph->info.x, glyph->info.y,
+                                         glyph->info.width, glyph->info.height,
+                                         GLYPHS_DST_MODE_TO_DST, flush_func,
+                                         (void *) &dst_arg);
+            }
+
+            x += glyph->info.xOff;
+            y += glyph->info.yOff;
+        }
+        list++;
+    }
+}
+
+#define MAX_FIXED_SIZE
+static void
+glamor_glyphs_reset_buffer(glamor_glyph_buffer_t *buffer)
+{
+    buffer->count = 0;
+    buffer->source = NULL;
+}
+
+static Bool
+_glamor_glyphs(CARD8 op,
+               PicturePtr src,
+               PicturePtr dst,
+               PictFormatPtr mask_format,
+               INT16 x_src,
+               INT16 y_src, int nlist, GlyphListPtr list,
+               GlyphPtr *glyphs, Bool fallback)
+{
+    PictFormatShort format;
+    int fixed_size, fixed_cnt = 0;
+    struct glamor_glyph_list *fixed_list = NULL;
+    Bool need_free_list = FALSE;
+
+#ifndef GLYPHS_NO_EDEGEMAP_OVERLAP_CHECK
+    Bool check_fake_overlap = TRUE;
+
+    if (!(op == PictOpOver || op == PictOpAdd || op == PictOpXor)) {
+        /* C = (0,0,0,0) D = glyphs , SRC = A, DEST = B (faked overlapped glyphs, overlapped with (0,0,0,0)).
+         * For those op, (A IN (C ADD D)) OP B !=  (A IN D) OP ((A IN C) OP B)
+         *              or (A IN (D ADD C)) OP B != (A IN C) OP ((A IN D) OP B)
+         * We need to split the faked regions to three or two, and composite the disoverlapped small
+         * boxes one by one. For other Ops, it's safe to composite the whole box.  */
+        check_fake_overlap = FALSE;
+    }
+#else
+    Bool check_fake_overlap = FALSE;
+#endif
+    if (mask_format)
+        format = mask_format->depth << 24 | mask_format->format;
+    else
+        format = 0;
+
+    fixed_size = 32;
+    glamor_glyphs_reset_buffer(&dst_buffer);
+
+    if (!mask_format || (((nlist == 1 && list->len == 1) || op == PictOpAdd)
+                         && (dst->format ==
+                             ((mask_format->depth << 24) | mask_format->
+                              format)))) {
+        glamor_glyphs_to_dst(op, src, dst, x_src, y_src, nlist, list, glyphs);
+        goto last_flush;
+    }
+
+    glamor_glyphs_reset_buffer(&mask_buffer);
+
+    /* We have mask_format. Need to check the real overlap or not. */
+    format = mask_format->depth << 24 | mask_format->format;
+
+    fixed_list = calloc(fixed_size, sizeof(*fixed_list));
+    if (_X_UNLIKELY(fixed_list == NULL))
+        fixed_size = 0;
+    fixed_cnt = glamor_glyphs_intersect(nlist, list, glyphs,
+                                        format, dst->pDrawable->pScreen,
+                                        check_fake_overlap,
+                                        fixed_list, fixed_size);
+    if (fixed_cnt == 0)
+        mask_format = NULL;
+    need_free_list = TRUE;
+
+    if (fixed_cnt <= 0) {
+        if (mask_format == NULL) {
+            glamor_glyphs_to_dst(op, src, dst, x_src, y_src, nlist,
+                                 list, glyphs);
+            goto last_flush;
+        }
+        else {
+            glamor_glyphs_via_mask(op, src, dst, mask_format,
+                                   x_src, y_src, nlist, list, glyphs, FALSE);
+            goto free_fixed_list;
+        }
+    }
+    else {
+
+        /* We have splitted the original list to serval list, some are overlapped
+         * and some are non-overlapped. For the non-overlapped, we render it to
+         * dst directly. For the overlapped, we render it to mask picture firstly,
+         * then render the mask to dst. If we can use mask cache which is in the
+         * glyphs cache's last row, we can accumulate the rendering of mask to dst
+         * with the other dst_buffer's rendering operations thus can reduce the call
+         * of glDrawElements.
+         *
+         * */
+        struct glamor_glyph_list *saved_list;
+
+        saved_list = fixed_list;
+        mask_arg.used_bitmap = 0;
+        while (fixed_cnt--) {
+            if (fixed_list->type == NON_INTERSECTED) {
+                glamor_glyphs_to_dst(op, src, dst,
+                                     x_src, y_src,
+                                     fixed_list->nlist,
+                                     fixed_list->list, fixed_list->glyphs);
+            }
+            else
+                glamor_glyphs_via_mask(op, src, dst,
+                                       mask_format, x_src, y_src,
+                                       fixed_list->nlist,
+                                       fixed_list->list,
+                                       fixed_list->glyphs, TRUE);
+
+            free(fixed_list->list);
+            fixed_list++;
+        }
+        free(saved_list);
+        need_free_list = FALSE;
+    }
+
+ last_flush:
+    if (dst_buffer.count || mask_buffer.count)
+        glamor_glyphs_flush_dst(&dst_arg);
+ free_fixed_list:
+    if (need_free_list) {
+        assert(fixed_cnt <= 0);
+        free(fixed_list);
+    }
+    return TRUE;
+}
+
+void
+glamor_glyphs(CARD8 op,
+              PicturePtr src,
+              PicturePtr dst,
+              PictFormatPtr mask_format,
+              INT16 x_src,
+              INT16 y_src, int nlist, GlyphListPtr list, GlyphPtr *glyphs)
+{
+    _glamor_glyphs(op, src, dst, mask_format, x_src,
+                   y_src, nlist, list, glyphs, TRUE);
+}
+
+Bool
+glamor_glyphs_nf(CARD8 op,
+                 PicturePtr src,
+                 PicturePtr dst,
+                 PictFormatPtr mask_format,
+                 INT16 x_src,
+                 INT16 y_src, int nlist, GlyphListPtr list, GlyphPtr *glyphs)
+{
+    return _glamor_glyphs(op, src, dst, mask_format, x_src,
+                          y_src, nlist, list, glyphs, FALSE);
+}
diff --git a/glamor/glamor_gradient.c b/glamor/glamor_gradient.c
new file mode 100644 (file)
index 0000000..28d6691
--- /dev/null
@@ -0,0 +1,1482 @@
+/*
+ * Copyright Â© 2009 Intel 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.
+ *
+ * Authors:
+ *    Junyan He <junyan.he@linux.intel.com>
+ *
+ */
+
+/** @file glamor_gradient.c
+ *
+ * Gradient acceleration implementation
+ */
+
+#include "glamor_priv.h"
+
+#ifdef RENDER
+
+#define LINEAR_SMALL_STOPS (6 + 2)
+#define LINEAR_LARGE_STOPS (16 + 2)
+
+#define RADIAL_SMALL_STOPS (6 + 2)
+#define RADIAL_LARGE_STOPS (16 + 2)
+
+#ifdef GLAMOR_GRADIENT_SHADER
+
+static const char *
+_glamor_create_getcolor_fs_source(ScreenPtr screen, int stops_count,
+                                  int use_array)
+{
+    char *gradient_fs = NULL;
+
+#define gradient_fs_getcolor\
+           GLAMOR_DEFAULT_PRECISION\
+           "uniform int n_stop;\n"\
+           "uniform float stops[%d];\n"\
+           "uniform vec4 stop_colors[%d];\n"\
+           "vec4 get_color(float stop_len)\n"\
+           "{\n"\
+           "    int i = 0;\n"\
+           "    float new_alpha; \n"\
+           "    vec4 gradient_color;\n"\
+           "    float percentage; \n"\
+           "    for(i = 0; i < n_stop - 1; i++) {\n"\
+           "        if(stop_len < stops[i])\n"\
+           "            break; \n"\
+           "    }\n"\
+           "    \n"\
+           "    if(stops[i] - stops[i-1] > 2.0)\n"\
+           "        percentage = 0.0;\n" /*For comply with pixman, walker->stepper overflow.*/\
+           "    else if(stops[i] - stops[i-1] < 0.000001)\n"\
+           "        percentage = 0.0;\n"\
+           "    else \n"\
+           "        percentage = (stop_len - stops[i-1])/(stops[i] - stops[i-1]);\n"\
+           "    new_alpha = percentage * stop_colors[i].a + \n"\
+           "                       (1.0-percentage) * stop_colors[i-1].a; \n"\
+           "    gradient_color = vec4((percentage * stop_colors[i].rgb \n"\
+           "                          + (1.0-percentage) * stop_colors[i-1].rgb)*new_alpha, \n"\
+           "                          new_alpha);\n"\
+           "    \n"\
+           "    return gradient_color;\n"\
+           "}\n"
+
+    /* Because the array access for shader is very slow, the performance is very low
+       if use array. So use global uniform to replace for it if the number of n_stops is small. */
+    const char *gradient_fs_getcolor_no_array =
+        GLAMOR_DEFAULT_PRECISION
+        "uniform int n_stop;\n"
+        "uniform float stop0;\n"
+        "uniform float stop1;\n"
+        "uniform float stop2;\n"
+        "uniform float stop3;\n"
+        "uniform float stop4;\n"
+        "uniform float stop5;\n"
+        "uniform float stop6;\n"
+        "uniform float stop7;\n"
+        "uniform vec4 stop_color0;\n"
+        "uniform vec4 stop_color1;\n"
+        "uniform vec4 stop_color2;\n"
+        "uniform vec4 stop_color3;\n"
+        "uniform vec4 stop_color4;\n"
+        "uniform vec4 stop_color5;\n"
+        "uniform vec4 stop_color6;\n"
+        "uniform vec4 stop_color7;\n"
+        "\n"
+        "vec4 get_color(float stop_len)\n"
+        "{\n"
+        "    float stop_after;\n"
+        "    float stop_before;\n"
+        "    vec4 stop_color_before;\n"
+        "    vec4 stop_color_after;\n"
+        "    float new_alpha; \n"
+        "    vec4 gradient_color;\n"
+        "    float percentage; \n"
+        "    \n"
+        "    if((stop_len < stop0) && (n_stop >= 1)) {\n"
+        "        stop_color_before = stop_color0;\n"
+        "        stop_color_after = stop_color0;\n"
+        "        stop_after = stop0;\n"
+        "        stop_before = stop0;\n"
+        "    } else if((stop_len < stop1) && (n_stop >= 2)) {\n"
+        "        stop_color_before = stop_color0;\n"
+        "        stop_color_after = stop_color1;\n"
+        "        stop_after = stop1;\n"
+        "        stop_before = stop0;\n"
+        "    } else if((stop_len < stop2) && (n_stop >= 3)) {\n"
+        "        stop_color_before = stop_color1;\n"
+        "        stop_color_after = stop_color2;\n"
+        "        stop_after = stop2;\n"
+        "        stop_before = stop1;\n"
+        "    } else if((stop_len < stop3) && (n_stop >= 4)){\n"
+        "        stop_color_before = stop_color2;\n"
+        "        stop_color_after = stop_color3;\n"
+        "        stop_after = stop3;\n"
+        "        stop_before = stop2;\n"
+        "    } else if((stop_len < stop4) && (n_stop >= 5)){\n"
+        "        stop_color_before = stop_color3;\n"
+        "        stop_color_after = stop_color4;\n"
+        "        stop_after = stop4;\n"
+        "        stop_before = stop3;\n"
+        "    } else if((stop_len < stop5) && (n_stop >= 6)){\n"
+        "        stop_color_before = stop_color4;\n"
+        "        stop_color_after = stop_color5;\n"
+        "        stop_after = stop5;\n"
+        "        stop_before = stop4;\n"
+        "    } else if((stop_len < stop6) && (n_stop >= 7)){\n"
+        "        stop_color_before = stop_color5;\n"
+        "        stop_color_after = stop_color6;\n"
+        "        stop_after = stop6;\n"
+        "        stop_before = stop5;\n"
+        "    } else if((stop_len < stop7) && (n_stop >= 8)){\n"
+        "        stop_color_before = stop_color6;\n"
+        "        stop_color_after = stop_color7;\n"
+        "        stop_after = stop7;\n"
+        "        stop_before = stop6;\n"
+        "    } else {\n"
+        "        stop_color_before = stop_color7;\n"
+        "        stop_color_after = stop_color7;\n"
+        "        stop_after = stop7;\n"
+        "        stop_before = stop7;\n"
+        "    }\n"
+        "    if(stop_after - stop_before > 2.0)\n"
+        "        percentage = 0.0;\n" //For comply with pixman, walker->stepper overflow.
+        "    else if(stop_after - stop_before < 0.000001)\n"
+        "        percentage = 0.0;\n"
+        "    else \n"
+        "        percentage = (stop_len - stop_before)/(stop_after - stop_before);\n"
+        "    new_alpha = percentage * stop_color_after.a + \n"
+        "                       (1.0-percentage) * stop_color_before.a; \n"
+        "    gradient_color = vec4((percentage * stop_color_after.rgb \n"
+        "                          + (1.0-percentage) * stop_color_before.rgb)*new_alpha, \n"
+        "                          new_alpha);\n"
+        "    \n"
+        "    return gradient_color;\n"
+        "}\n";
+
+    if (use_array) {
+        XNFasprintf(&gradient_fs,
+                    gradient_fs_getcolor, stops_count, stops_count);
+        return gradient_fs;
+    }
+    else {
+        return XNFstrdup(gradient_fs_getcolor_no_array);
+    }
+}
+
+static void
+_glamor_create_radial_gradient_program(ScreenPtr screen, int stops_count,
+                                       int dyn_gen)
+{
+    glamor_screen_private *glamor_priv;
+    int index;
+
+    GLint gradient_prog = 0;
+    char *gradient_fs = NULL;
+    GLint fs_prog, vs_prog;
+
+    const char *gradient_vs =
+        GLAMOR_DEFAULT_PRECISION
+        "attribute vec4 v_position;\n"
+        "attribute vec4 v_texcoord;\n"
+        "varying vec2 source_texture;\n"
+        "\n"
+        "void main()\n"
+        "{\n"
+        "    gl_Position = v_position;\n"
+        "    source_texture = v_texcoord.xy;\n"
+        "}\n";
+
+    /*
+     *     Refer to pixman radial gradient.
+     *
+     *     The problem is given the two circles of c1 and c2 with the radius of r1 and
+     *     r1, we need to caculate the t, which is used to do interpolate with stops,
+     *     using the fomula:
+     *     length((1-t)*c1 + t*c2 - p) = (1-t)*r1 + t*r2
+     *     expand the fomula with xy coond, get the following:
+     *     sqrt(sqr((1-t)*c1.x + t*c2.x - p.x) + sqr((1-t)*c1.y + t*c2.y - p.y))
+     *           = (1-t)r1 + t*r2
+     *     <====> At*t- 2Bt + C = 0
+     *     where A = sqr(c2.x - c1.x) + sqr(c2.y - c1.y) - sqr(r2 -r1)
+     *           B = (p.x - c1.x)*(c2.x - c1.x) + (p.y - c1.y)*(c2.y - c1.y) + r1*(r2 -r1)
+     *           C = sqr(p.x - c1.x) + sqr(p.y - c1.y) - r1*r1
+     *
+     *     solve the fomula and we get the result of
+     *     t = (B + sqrt(B*B - A*C)) / A  or
+     *     t = (B - sqrt(B*B - A*C)) / A  (quadratic equation have two solutions)
+     *
+     *     The solution we are going to prefer is the bigger one, unless the
+     *     radius associated to it is negative (or it falls outside the valid t range)
+     */
+
+#define gradient_radial_fs_template\
+           GLAMOR_DEFAULT_PRECISION\
+           "uniform mat3 transform_mat;\n"\
+           "uniform int repeat_type;\n"\
+           "uniform float A_value;\n"\
+           "uniform vec2 c1;\n"\
+           "uniform float r1;\n"\
+           "uniform vec2 c2;\n"\
+           "uniform float r2;\n"\
+           "varying vec2 source_texture;\n"\
+           "\n"\
+           "vec4 get_color(float stop_len);\n"\
+           "\n"\
+           "int t_invalid;\n"\
+           "\n"\
+           "float get_stop_len()\n"\
+           "{\n"\
+           "    float t = 0.0;\n"\
+           "    float sqrt_value;\n"\
+           "    t_invalid = 0;\n"\
+           "    \n"\
+           "    vec3 tmp = vec3(source_texture.x, source_texture.y, 1.0);\n"\
+           "    vec3 source_texture_trans = transform_mat * tmp;\n"\
+           "    source_texture_trans.xy = source_texture_trans.xy/source_texture_trans.z;\n"\
+           "    float B_value = (source_texture_trans.x - c1.x) * (c2.x - c1.x)\n"\
+           "                     + (source_texture_trans.y - c1.y) * (c2.y - c1.y)\n"\
+           "                     + r1 * (r2 - r1);\n"\
+           "    float C_value = (source_texture_trans.x - c1.x) * (source_texture_trans.x - c1.x)\n"\
+           "                     + (source_texture_trans.y - c1.y) * (source_texture_trans.y - c1.y)\n"\
+           "                     - r1*r1;\n"\
+           "    if(abs(A_value) < 0.00001) {\n"\
+           "        if(B_value == 0.0) {\n"\
+           "            t_invalid = 1;\n"\
+           "            return t;\n"\
+           "        }\n"\
+           "        t = 0.5 * C_value / B_value;"\
+           "    } else {\n"\
+           "        sqrt_value = B_value * B_value - A_value * C_value;\n"\
+           "        if(sqrt_value < 0.0) {\n"\
+           "            t_invalid = 1;\n"\
+           "            return t;\n"\
+           "        }\n"\
+           "        sqrt_value = sqrt(sqrt_value);\n"\
+           "        t = (B_value + sqrt_value) / A_value;\n"\
+           "    }\n"\
+           "    if(repeat_type == %d) {\n" /* RepeatNone case. */\
+           "        if((t <= 0.0) || (t > 1.0))\n"\
+           /*           try another if first one invalid*/\
+           "            t = (B_value - sqrt_value) / A_value;\n"\
+           "        \n"\
+           "        if((t <= 0.0) || (t > 1.0)) {\n" /*still invalid, return.*/\
+           "            t_invalid = 1;\n"\
+           "            return t;\n"\
+           "        }\n"\
+           "    } else {\n"\
+           "        if(t * (r2 - r1) <= -1.0 * r1)\n"\
+           /*           try another if first one invalid*/\
+           "            t = (B_value - sqrt_value) / A_value;\n"\
+           "        \n"\
+           "        if(t * (r2 -r1) <= -1.0 * r1) {\n" /*still invalid, return.*/\
+           "            t_invalid = 1;\n"\
+           "            return t;\n"\
+           "        }\n"\
+           "    }\n"\
+           "    \n"\
+           "    if(repeat_type == %d){\n" /* repeat normal*/\
+           "        t = fract(t);\n"\
+           "    }\n"\
+           "    \n"\
+           "    if(repeat_type == %d) {\n" /* repeat reflect*/\
+           "        t = abs(fract(t * 0.5 + 0.5) * 2.0 - 1.0);\n"\
+           "    }\n"\
+           "    \n"\
+           "    return t;\n"\
+           "}\n"\
+           "\n"\
+           "void main()\n"\
+           "{\n"\
+           "    float stop_len = get_stop_len();\n"\
+           "    if(t_invalid == 1) {\n"\
+           "        gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n"\
+           "    } else {\n"\
+           "        gl_FragColor = get_color(stop_len);\n"\
+           "    }\n"\
+           "}\n"\
+           "\n"\
+            "%s\n" /* fs_getcolor_source */
+    const char *fs_getcolor_source;
+
+    glamor_priv = glamor_get_screen_private(screen);
+
+    if ((glamor_priv->radial_max_nstops >= stops_count) && (dyn_gen)) {
+        /* Very Good, not to generate again. */
+        return;
+    }
+
+    glamor_make_current(glamor_priv);
+
+    if (dyn_gen && glamor_priv->gradient_prog[SHADER_GRADIENT_RADIAL][2]) {
+        glDeleteProgram(glamor_priv->gradient_prog[SHADER_GRADIENT_RADIAL][2]);
+        glamor_priv->gradient_prog[SHADER_GRADIENT_RADIAL][2] = 0;
+    }
+
+    gradient_prog = glCreateProgram();
+
+    vs_prog = glamor_compile_glsl_prog(GL_VERTEX_SHADER, gradient_vs);
+
+    fs_getcolor_source =
+        _glamor_create_getcolor_fs_source(screen, stops_count,
+                                          (stops_count > 0));
+
+    XNFasprintf(&gradient_fs,
+                gradient_radial_fs_template,
+                PIXMAN_REPEAT_NONE, PIXMAN_REPEAT_NORMAL,
+                PIXMAN_REPEAT_REFLECT,
+                fs_getcolor_source);
+
+    fs_prog = glamor_compile_glsl_prog(GL_FRAGMENT_SHADER, gradient_fs);
+
+    free(gradient_fs);
+
+    glAttachShader(gradient_prog, vs_prog);
+    glAttachShader(gradient_prog, fs_prog);
+    glDeleteShader(vs_prog);
+    glDeleteShader(fs_prog);
+
+    glBindAttribLocation(gradient_prog, GLAMOR_VERTEX_POS, "v_position");
+    glBindAttribLocation(gradient_prog, GLAMOR_VERTEX_SOURCE, "v_texcoord");
+
+    glamor_link_glsl_prog(screen, gradient_prog, "radial gradient");
+
+    if (dyn_gen) {
+        index = 2;
+        glamor_priv->radial_max_nstops = stops_count;
+    }
+    else if (stops_count) {
+        index = 1;
+    }
+    else {
+        index = 0;
+    }
+
+    glamor_priv->gradient_prog[SHADER_GRADIENT_RADIAL][index] = gradient_prog;
+}
+
+static void
+_glamor_create_linear_gradient_program(ScreenPtr screen, int stops_count,
+                                       int dyn_gen)
+{
+    glamor_screen_private *glamor_priv;
+
+    int index = 0;
+    GLint gradient_prog = 0;
+    char *gradient_fs = NULL;
+    GLint fs_prog, vs_prog;
+
+    const char *gradient_vs =
+        GLAMOR_DEFAULT_PRECISION
+        "attribute vec4 v_position;\n"
+        "attribute vec4 v_texcoord;\n"
+        "varying vec2 source_texture;\n"
+        "\n"
+        "void main()\n"
+        "{\n"
+        "    gl_Position = v_position;\n"
+        "    source_texture = v_texcoord.xy;\n"
+        "}\n";
+
+    /*
+     *                                      |
+     *                                      |\
+     *                                      | \
+     *                                      |  \
+     *                                      |   \
+     *                                      |\   \
+     *                                      | \   \
+     *     cos_val =                        |\ p1d \   /
+     *      sqrt(1/(slope*slope+1.0))  ------>\ \   \ /
+     *                                      |  \ \   \
+     *                                      |   \ \ / \
+     *                                      |    \ *Pt1\
+     *         *p1                          |     \     \     *P
+     *          \                           |    / \     \   /
+     *           \                          |   /   \     \ /
+     *            \                         |       pd     \
+     *             \                        |         \   / \
+     *            p2*                       |          \ /   \       /
+     *        slope = (p2.y - p1.y) /       |           /     p2d   /
+     *                    (p2.x - p1.x)     |          /       \   /
+     *                                      |         /         \ /
+     *                                      |        /           /
+     *                                      |       /           /
+     *                                      |      /           *Pt2
+     *                                      |                 /
+     *                                      |                /
+     *                                      |               /
+     *                                      |              /
+     *                                      |             /
+     *                               -------+---------------------------------
+     *                                     O|
+     *                                      |
+     *                                      |
+     *
+     *      step 1: compute the distance of p, pt1 and pt2 in the slope direction.
+     *              Caculate the distance on Y axis first and multiply cos_val to
+     *              get the value on slope direction(pd, p1d and p2d represent the
+     *              distance of p, pt1, and pt2 respectively).
+     *
+     *      step 2: caculate the percentage of (pd - p1d)/(p2d - p1d).
+     *              If (pd - p1d) > (p2d - p1d) or < 0, then sub or add (p2d - p1d)
+     *              to make it in the range of [0, (p2d - p1d)].
+     *
+     *      step 3: compare the percentage to every stop and find the stpos just
+     *              before and after it. Use the interpolation fomula to compute RGBA.
+     */
+
+#define gradient_fs_template   \
+           GLAMOR_DEFAULT_PRECISION\
+           "uniform mat3 transform_mat;\n"\
+           "uniform int repeat_type;\n"\
+           "uniform int hor_ver;\n"\
+           "uniform float pt_slope;\n"\
+           "uniform float cos_val;\n"\
+           "uniform float p1_distance;\n"\
+           "uniform float pt_distance;\n"\
+           "varying vec2 source_texture;\n"\
+           "\n"\
+           "vec4 get_color(float stop_len);\n"\
+           "\n"\
+           "float get_stop_len()\n"\
+           "{\n"\
+           "    vec3 tmp = vec3(source_texture.x, source_texture.y, 1.0);\n"\
+           "    float len_percentage;\n"\
+           "    float distance;\n"\
+           "    float _p1_distance;\n"\
+           "    float _pt_distance;\n"\
+           "    float y_dist;\n"\
+           "    float stop_after;\n"\
+           "    float stop_before;\n"\
+           "    vec4 stop_color_before;\n"\
+           "    vec4 stop_color_after;\n"\
+           "    float new_alpha; \n"\
+           "    vec4 gradient_color;\n"\
+           "    float percentage; \n"\
+           "    vec3 source_texture_trans = transform_mat * tmp;\n"\
+           "    \n"\
+           "    if(hor_ver == 0) { \n" /*Normal case.*/\
+           "        y_dist = source_texture_trans.y - source_texture_trans.x*pt_slope;\n"\
+           "        distance = y_dist * cos_val;\n"\
+           "        _p1_distance = p1_distance * source_texture_trans.z;\n"\
+           "        _pt_distance = pt_distance * source_texture_trans.z;\n"\
+           "        \n"\
+           "    } else if (hor_ver == 1) {\n"/*horizontal case.*/\
+           "        distance = source_texture_trans.x;\n"\
+           "        _p1_distance = p1_distance * source_texture_trans.z;\n"\
+           "        _pt_distance = pt_distance * source_texture_trans.z;\n"\
+           "    } \n"\
+           "    \n"\
+           "    distance = distance - _p1_distance; \n"\
+           "    \n"\
+           "    if(repeat_type == %d){\n" /* repeat normal*/\
+           "        distance = mod(distance, _pt_distance);\n"\
+           "    }\n"\
+           "    \n"\
+           "    if(repeat_type == %d) {\n" /* repeat reflect*/\
+           "        distance = abs(mod(distance + _pt_distance, 2.0 * _pt_distance) - _pt_distance);\n"\
+           "    }\n"\
+           "    \n"\
+           "    len_percentage = distance/(_pt_distance);\n"\
+           "    \n"\
+           "    return len_percentage;\n"\
+           "}\n"\
+           "\n"\
+           "void main()\n"\
+           "{\n"\
+           "    float stop_len = get_stop_len();\n"\
+           "    gl_FragColor = get_color(stop_len);\n"\
+           "}\n"\
+           "\n"\
+            "%s" /* fs_getcolor_source */
+    const char *fs_getcolor_source;
+
+    glamor_priv = glamor_get_screen_private(screen);
+
+    if ((glamor_priv->linear_max_nstops >= stops_count) && (dyn_gen)) {
+        /* Very Good, not to generate again. */
+        return;
+    }
+
+    glamor_make_current(glamor_priv);
+    if (dyn_gen && glamor_priv->gradient_prog[SHADER_GRADIENT_LINEAR][2]) {
+        glDeleteProgram(glamor_priv->gradient_prog[SHADER_GRADIENT_LINEAR][2]);
+        glamor_priv->gradient_prog[SHADER_GRADIENT_LINEAR][2] = 0;
+    }
+
+    gradient_prog = glCreateProgram();
+
+    vs_prog = glamor_compile_glsl_prog(GL_VERTEX_SHADER, gradient_vs);
+
+    fs_getcolor_source =
+        _glamor_create_getcolor_fs_source(screen, stops_count, stops_count > 0);
+
+    XNFasprintf(&gradient_fs,
+                gradient_fs_template,
+                PIXMAN_REPEAT_NORMAL, PIXMAN_REPEAT_REFLECT,
+                fs_getcolor_source);
+
+    fs_prog = glamor_compile_glsl_prog(GL_FRAGMENT_SHADER, gradient_fs);
+    free(gradient_fs);
+
+    glAttachShader(gradient_prog, vs_prog);
+    glAttachShader(gradient_prog, fs_prog);
+    glDeleteShader(vs_prog);
+    glDeleteShader(fs_prog);
+
+    glBindAttribLocation(gradient_prog, GLAMOR_VERTEX_POS, "v_position");
+    glBindAttribLocation(gradient_prog, GLAMOR_VERTEX_SOURCE, "v_texcoord");
+
+    glamor_link_glsl_prog(screen, gradient_prog, "linear gradient");
+
+    if (dyn_gen) {
+        index = 2;
+        glamor_priv->linear_max_nstops = stops_count;
+    }
+    else if (stops_count) {
+        index = 1;
+    }
+    else {
+        index = 0;
+    }
+
+    glamor_priv->gradient_prog[SHADER_GRADIENT_LINEAR][index] = gradient_prog;
+}
+
+void
+glamor_init_gradient_shader(ScreenPtr screen)
+{
+    glamor_screen_private *glamor_priv;
+    int i;
+
+    glamor_priv = glamor_get_screen_private(screen);
+
+    for (i = 0; i < 3; i++) {
+        glamor_priv->gradient_prog[SHADER_GRADIENT_LINEAR][i] = 0;
+        glamor_priv->gradient_prog[SHADER_GRADIENT_RADIAL][i] = 0;
+    }
+    glamor_priv->linear_max_nstops = 0;
+    glamor_priv->radial_max_nstops = 0;
+
+    _glamor_create_linear_gradient_program(screen, 0, 0);
+    _glamor_create_linear_gradient_program(screen, LINEAR_LARGE_STOPS, 0);
+
+    _glamor_create_radial_gradient_program(screen, 0, 0);
+    _glamor_create_radial_gradient_program(screen, RADIAL_LARGE_STOPS, 0);
+}
+
+void
+glamor_fini_gradient_shader(ScreenPtr screen)
+{
+    glamor_screen_private *glamor_priv;
+    int i = 0;
+
+    glamor_priv = glamor_get_screen_private(screen);
+    glamor_make_current(glamor_priv);
+
+    for (i = 0; i < 3; i++) {
+        /* Linear Gradient */
+        if (glamor_priv->gradient_prog[SHADER_GRADIENT_LINEAR][i])
+            glDeleteProgram(glamor_priv->gradient_prog
+                            [SHADER_GRADIENT_LINEAR][i]);
+
+        if (glamor_priv->gradient_prog[SHADER_GRADIENT_RADIAL][i])
+            glDeleteProgram(glamor_priv->gradient_prog
+                            [SHADER_GRADIENT_RADIAL][i]);
+    }
+}
+
+static void
+_glamor_gradient_convert_trans_matrix(PictTransform *from, float to[3][3],
+                                      int width, int height, int normalize)
+{
+    /*
+     * Because in the shader program, we normalize all the pixel cood to [0, 1],
+     * so with the transform matrix, the correct logic should be:
+     * v_s = A*T*v
+     * v_s: point vector in shader after normalized.
+     * A: The transition matrix from   width X height --> 1.0 X 1.0
+     * T: The transform matrix.
+     * v: point vector in width X height space.
+     *
+     * result is OK if we use this fomula. But for every point in width X height space,
+     * we can just use their normalized point vector in shader, namely we can just
+     * use the result of A*v in shader. So we have no chance to insert T in A*v.
+     * We can just convert v_s = A*T*v to v_s = A*T*inv(A)*A*v, where inv(A) is the
+     * inverse matrix of A. Now, v_s = (A*T*inv(A)) * (A*v)
+     * So, to get the correct v_s, we need to cacula1 the matrix: (A*T*inv(A)), and
+     * we name this matrix T_s.
+     *
+     * Firstly, because A is for the scale convertion, we find
+     *      --         --
+     *      |1/w  0   0 |
+     * A =  | 0  1/h  0 |
+     *      | 0   0  1.0|
+     *      --         --
+     * so T_s = A*T*inv(a) and result
+     *
+     *       --                      --
+     *       | t11      h*t12/w  t13/w|
+     * T_s = | w*t21/h  t22      t23/h|
+     *       | w*t31    h*t32    t33  |
+     *       --                      --
+     */
+
+    to[0][0] = (float) pixman_fixed_to_double(from->matrix[0][0]);
+    to[0][1] = (float) pixman_fixed_to_double(from->matrix[0][1])
+        * (normalize ? (((float) height) / ((float) width)) : 1.0);
+    to[0][2] = (float) pixman_fixed_to_double(from->matrix[0][2])
+        / (normalize ? ((float) width) : 1.0);
+
+    to[1][0] = (float) pixman_fixed_to_double(from->matrix[1][0])
+        * (normalize ? (((float) width) / ((float) height)) : 1.0);
+    to[1][1] = (float) pixman_fixed_to_double(from->matrix[1][1]);
+    to[1][2] = (float) pixman_fixed_to_double(from->matrix[1][2])
+        / (normalize ? ((float) height) : 1.0);
+
+    to[2][0] = (float) pixman_fixed_to_double(from->matrix[2][0])
+        * (normalize ? ((float) width) : 1.0);
+    to[2][1] = (float) pixman_fixed_to_double(from->matrix[2][1])
+        * (normalize ? ((float) height) : 1.0);
+    to[2][2] = (float) pixman_fixed_to_double(from->matrix[2][2]);
+
+    DEBUGF("the transform matrix is:\n%f\t%f\t%f\n%f\t%f\t%f\n%f\t%f\t%f\n",
+           to[0][0], to[0][1], to[0][2],
+           to[1][0], to[1][1], to[1][2], to[2][0], to[2][1], to[2][2]);
+}
+
+static int
+_glamor_gradient_set_pixmap_destination(ScreenPtr screen,
+                                        glamor_screen_private *glamor_priv,
+                                        PicturePtr dst_picture,
+                                        GLfloat *xscale, GLfloat *yscale,
+                                        int x_source, int y_source,
+                                        float vertices[8],
+                                        float tex_vertices[8],
+                                        int tex_normalize)
+{
+    glamor_pixmap_private *pixmap_priv;
+    PixmapPtr pixmap = NULL;
+
+    pixmap = glamor_get_drawable_pixmap(dst_picture->pDrawable);
+    pixmap_priv = glamor_get_pixmap_private(pixmap);
+
+    if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv)) {     /* should always have here. */
+        return 0;
+    }
+
+    glamor_set_destination_pixmap_priv_nc(pixmap_priv);
+
+    pixmap_priv_get_dest_scale(pixmap_priv, xscale, yscale);
+
+    DEBUGF("xscale = %f, yscale = %f,"
+           " x_source = %d, y_source = %d, width = %d, height = %d\n",
+           *xscale, *yscale, x_source, y_source,
+           dst_picture->pDrawable->width, dst_picture->pDrawable->height);
+
+    glamor_set_normalize_vcoords_tri_strip(*xscale, *yscale,
+                                           0, 0,
+                                           (INT16) (dst_picture->pDrawable->
+                                                    width),
+                                           (INT16) (dst_picture->pDrawable->
+                                                    height),
+                                           glamor_priv->yInverted, vertices);
+
+    if (tex_normalize) {
+        glamor_set_normalize_tcoords_tri_stripe(*xscale, *yscale,
+                                                x_source, y_source,
+                                                (INT16) (dst_picture->
+                                                         pDrawable->width +
+                                                         x_source),
+                                                (INT16) (dst_picture->
+                                                         pDrawable->height +
+                                                         y_source),
+                                                glamor_priv->yInverted,
+                                                tex_vertices);
+    }
+    else {
+        glamor_set_tcoords_tri_strip((INT16) (dst_picture->pDrawable->width),
+                                     (INT16) (dst_picture->pDrawable->height),
+                                     x_source, y_source,
+                                     (INT16) (dst_picture->pDrawable->width) +
+                                     x_source,
+                                     (INT16) (dst_picture->pDrawable->height) +
+                                     y_source, glamor_priv->yInverted,
+                                     tex_vertices);
+    }
+
+    DEBUGF("vertices --> leftup : %f X %f, rightup: %f X %f,"
+           "rightbottom: %f X %f, leftbottom : %f X %f\n",
+           vertices[0], vertices[1], vertices[2], vertices[3],
+           vertices[4], vertices[5], vertices[6], vertices[7]);
+    DEBUGF("tex_vertices --> leftup : %f X %f, rightup: %f X %f,"
+           "rightbottom: %f X %f, leftbottom : %f X %f\n",
+           tex_vertices[0], tex_vertices[1], tex_vertices[2], tex_vertices[3],
+           tex_vertices[4], tex_vertices[5], tex_vertices[6], tex_vertices[7]);
+
+    glamor_make_current(glamor_priv);
+
+    glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT,
+                          GL_FALSE, 0, vertices);
+    glVertexAttribPointer(GLAMOR_VERTEX_SOURCE, 2, GL_FLOAT,
+                          GL_FALSE, 0, tex_vertices);
+
+    glEnableVertexAttribArray(GLAMOR_VERTEX_POS);
+    glEnableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
+
+    return 1;
+}
+
+static int
+_glamor_gradient_set_stops(PicturePtr src_picture, PictGradient *pgradient,
+                           GLfloat *stop_colors, GLfloat *n_stops)
+{
+    int i;
+    int count = 1;
+
+    for (i = 0; i < pgradient->nstops; i++) {
+        stop_colors[count * 4] =
+            pixman_fixed_to_double(pgradient->stops[i].color.red);
+        stop_colors[count * 4 + 1] =
+            pixman_fixed_to_double(pgradient->stops[i].color.green);
+        stop_colors[count * 4 + 2] =
+            pixman_fixed_to_double(pgradient->stops[i].color.blue);
+        stop_colors[count * 4 + 3] =
+            pixman_fixed_to_double(pgradient->stops[i].color.alpha);
+
+        n_stops[count] =
+            (GLfloat) pixman_fixed_to_double(pgradient->stops[i].x);
+        count++;
+    }
+
+    /* for the end stop. */
+    count++;
+
+    switch (src_picture->repeatType) {
+#define REPEAT_FILL_STOPS(m, n) \
+                       stop_colors[(m)*4 + 0] = stop_colors[(n)*4 + 0]; \
+                       stop_colors[(m)*4 + 1] = stop_colors[(n)*4 + 1]; \
+                       stop_colors[(m)*4 + 2] = stop_colors[(n)*4 + 2]; \
+                       stop_colors[(m)*4 + 3] = stop_colors[(n)*4 + 3];
+
+    default:
+    case PIXMAN_REPEAT_NONE:
+        stop_colors[0] = 0.0;   //R
+        stop_colors[1] = 0.0;   //G
+        stop_colors[2] = 0.0;   //B
+        stop_colors[3] = 0.0;   //Alpha
+        n_stops[0] = -(float) INT_MAX;  //should be small enough.
+
+        stop_colors[0 + (count - 1) * 4] = 0.0; //R
+        stop_colors[1 + (count - 1) * 4] = 0.0; //G
+        stop_colors[2 + (count - 1) * 4] = 0.0; //B
+        stop_colors[3 + (count - 1) * 4] = 0.0; //Alpha
+        n_stops[count - 1] = (float) INT_MAX;   //should be large enough.
+        break;
+    case PIXMAN_REPEAT_NORMAL:
+        REPEAT_FILL_STOPS(0, count - 2);
+        n_stops[0] = n_stops[count - 2] - 1.0;
+
+        REPEAT_FILL_STOPS(count - 1, 1);
+        n_stops[count - 1] = n_stops[1] + 1.0;
+        break;
+    case PIXMAN_REPEAT_REFLECT:
+        REPEAT_FILL_STOPS(0, 1);
+        n_stops[0] = -n_stops[1];
+
+        REPEAT_FILL_STOPS(count - 1, count - 2);
+        n_stops[count - 1] = 1.0 + 1.0 - n_stops[count - 2];
+        break;
+    case PIXMAN_REPEAT_PAD:
+        REPEAT_FILL_STOPS(0, 1);
+        n_stops[0] = -(float) INT_MAX;
+
+        REPEAT_FILL_STOPS(count - 1, count - 2);
+        n_stops[count - 1] = (float) INT_MAX;
+        break;
+#undef REPEAT_FILL_STOPS
+    }
+
+    for (i = 0; i < count; i++) {
+        DEBUGF("n_stops[%d] = %f, color = r:%f g:%f b:%f a:%f\n",
+               i, n_stops[i],
+               stop_colors[i * 4], stop_colors[i * 4 + 1],
+               stop_colors[i * 4 + 2], stop_colors[i * 4 + 3]);
+    }
+
+    return count;
+}
+
+PicturePtr
+glamor_generate_radial_gradient_picture(ScreenPtr screen,
+                                        PicturePtr src_picture,
+                                        int x_source, int y_source,
+                                        int width, int height,
+                                        PictFormatShort format)
+{
+    glamor_screen_private *glamor_priv;
+    PicturePtr dst_picture = NULL;
+    PixmapPtr pixmap = NULL;
+    GLint gradient_prog = 0;
+    int error;
+    float tex_vertices[8];
+    int stops_count = 0;
+    int count = 0;
+    GLfloat *stop_colors = NULL;
+    GLfloat *n_stops = NULL;
+    GLfloat xscale, yscale;
+    float vertices[8];
+    float transform_mat[3][3];
+    static const float identity_mat[3][3] = { {1.0, 0.0, 0.0},
+    {0.0, 1.0, 0.0},
+    {0.0, 0.0, 1.0}
+    };
+    GLfloat stop_colors_st[RADIAL_SMALL_STOPS * 4];
+    GLfloat n_stops_st[RADIAL_SMALL_STOPS];
+    GLfloat A_value;
+    GLfloat cxy[4];
+    float c1x, c1y, c2x, c2y, r1, r2;
+
+    GLint transform_mat_uniform_location = 0;
+    GLint repeat_type_uniform_location = 0;
+    GLint n_stop_uniform_location = 0;
+    GLint stops_uniform_location = 0;
+    GLint stop_colors_uniform_location = 0;
+    GLint stop0_uniform_location = 0;
+    GLint stop1_uniform_location = 0;
+    GLint stop2_uniform_location = 0;
+    GLint stop3_uniform_location = 0;
+    GLint stop4_uniform_location = 0;
+    GLint stop5_uniform_location = 0;
+    GLint stop6_uniform_location = 0;
+    GLint stop7_uniform_location = 0;
+    GLint stop_color0_uniform_location = 0;
+    GLint stop_color1_uniform_location = 0;
+    GLint stop_color2_uniform_location = 0;
+    GLint stop_color3_uniform_location = 0;
+    GLint stop_color4_uniform_location = 0;
+    GLint stop_color5_uniform_location = 0;
+    GLint stop_color6_uniform_location = 0;
+    GLint stop_color7_uniform_location = 0;
+    GLint A_value_uniform_location = 0;
+    GLint c1_uniform_location = 0;
+    GLint r1_uniform_location = 0;
+    GLint c2_uniform_location = 0;
+    GLint r2_uniform_location = 0;
+
+    glamor_priv = glamor_get_screen_private(screen);
+    glamor_make_current(glamor_priv);
+
+    /* Create a pixmap with VBO. */
+    pixmap = glamor_create_pixmap(screen,
+                                  width, height,
+                                  PIXMAN_FORMAT_DEPTH(format), 0);
+    if (!pixmap)
+        goto GRADIENT_FAIL;
+
+    dst_picture = CreatePicture(0, &pixmap->drawable,
+                                PictureMatchFormat(screen,
+                                                   PIXMAN_FORMAT_DEPTH(format),
+                                                   format), 0, 0, serverClient,
+                                &error);
+
+    /* Release the reference, picture will hold the last one. */
+    glamor_destroy_pixmap(pixmap);
+
+    if (!dst_picture)
+        goto GRADIENT_FAIL;
+
+    ValidatePicture(dst_picture);
+
+    stops_count = src_picture->pSourcePict->radial.nstops + 2;
+
+    /* Because the max value of nstops is unkown, so create a program
+       when nstops > LINEAR_LARGE_STOPS. */
+    if (stops_count <= RADIAL_SMALL_STOPS) {
+        gradient_prog = glamor_priv->gradient_prog[SHADER_GRADIENT_RADIAL][0];
+    }
+    else if (stops_count <= RADIAL_LARGE_STOPS) {
+        gradient_prog = glamor_priv->gradient_prog[SHADER_GRADIENT_RADIAL][1];
+    }
+    else {
+        _glamor_create_radial_gradient_program(screen,
+                                               src_picture->pSourcePict->linear.
+                                               nstops + 2, 1);
+        gradient_prog = glamor_priv->gradient_prog[SHADER_GRADIENT_RADIAL][2];
+    }
+
+    /* Bind all the uniform vars . */
+    transform_mat_uniform_location = glGetUniformLocation(gradient_prog,
+                                                          "transform_mat");
+    repeat_type_uniform_location = glGetUniformLocation(gradient_prog,
+                                                        "repeat_type");
+    n_stop_uniform_location = glGetUniformLocation(gradient_prog, "n_stop");
+    A_value_uniform_location = glGetUniformLocation(gradient_prog, "A_value");
+    c1_uniform_location = glGetUniformLocation(gradient_prog, "c1");
+    r1_uniform_location = glGetUniformLocation(gradient_prog, "r1");
+    c2_uniform_location = glGetUniformLocation(gradient_prog, "c2");
+    r2_uniform_location = glGetUniformLocation(gradient_prog, "r2");
+
+    if (src_picture->pSourcePict->radial.nstops + 2 <= RADIAL_SMALL_STOPS) {
+        stop0_uniform_location =
+            glGetUniformLocation(gradient_prog, "stop0");
+        stop1_uniform_location =
+            glGetUniformLocation(gradient_prog, "stop1");
+        stop2_uniform_location =
+            glGetUniformLocation(gradient_prog, "stop2");
+        stop3_uniform_location =
+            glGetUniformLocation(gradient_prog, "stop3");
+        stop4_uniform_location =
+            glGetUniformLocation(gradient_prog, "stop4");
+        stop5_uniform_location =
+            glGetUniformLocation(gradient_prog, "stop5");
+        stop6_uniform_location =
+            glGetUniformLocation(gradient_prog, "stop6");
+        stop7_uniform_location =
+            glGetUniformLocation(gradient_prog, "stop7");
+
+        stop_color0_uniform_location =
+            glGetUniformLocation(gradient_prog, "stop_color0");
+        stop_color1_uniform_location =
+            glGetUniformLocation(gradient_prog, "stop_color1");
+        stop_color2_uniform_location =
+            glGetUniformLocation(gradient_prog, "stop_color2");
+        stop_color3_uniform_location =
+            glGetUniformLocation(gradient_prog, "stop_color3");
+        stop_color4_uniform_location =
+            glGetUniformLocation(gradient_prog, "stop_color4");
+        stop_color5_uniform_location =
+            glGetUniformLocation(gradient_prog, "stop_color5");
+        stop_color6_uniform_location =
+            glGetUniformLocation(gradient_prog, "stop_color6");
+        stop_color7_uniform_location =
+            glGetUniformLocation(gradient_prog, "stop_color7");
+    }
+    else {
+        stops_uniform_location =
+            glGetUniformLocation(gradient_prog, "stops");
+        stop_colors_uniform_location =
+            glGetUniformLocation(gradient_prog, "stop_colors");
+    }
+
+    glUseProgram(gradient_prog);
+
+    glUniform1i(repeat_type_uniform_location, src_picture->repeatType);
+
+    if (src_picture->transform) {
+        _glamor_gradient_convert_trans_matrix(src_picture->transform,
+                                              transform_mat, width, height, 0);
+        glUniformMatrix3fv(transform_mat_uniform_location,
+                           1, 1, &transform_mat[0][0]);
+    }
+    else {
+        glUniformMatrix3fv(transform_mat_uniform_location,
+                           1, 1, &identity_mat[0][0]);
+    }
+
+    if (!_glamor_gradient_set_pixmap_destination
+        (screen, glamor_priv, dst_picture, &xscale, &yscale, x_source, y_source,
+         vertices, tex_vertices, 0))
+        goto GRADIENT_FAIL;
+
+    /* Set all the stops and colors to shader. */
+    if (stops_count > RADIAL_SMALL_STOPS) {
+        stop_colors = malloc(4 * stops_count * sizeof(float));
+        if (stop_colors == NULL) {
+            ErrorF("Failed to allocate stop_colors memory.\n");
+            goto GRADIENT_FAIL;
+        }
+
+        n_stops = malloc(stops_count * sizeof(float));
+        if (n_stops == NULL) {
+            ErrorF("Failed to allocate n_stops memory.\n");
+            goto GRADIENT_FAIL;
+        }
+    }
+    else {
+        stop_colors = stop_colors_st;
+        n_stops = n_stops_st;
+    }
+
+    count =
+        _glamor_gradient_set_stops(src_picture,
+                                   &src_picture->pSourcePict->gradient,
+                                   stop_colors, n_stops);
+
+    if (src_picture->pSourcePict->linear.nstops + 2 <= RADIAL_SMALL_STOPS) {
+        int j = 0;
+
+        glUniform4f(stop_color0_uniform_location,
+                    stop_colors[4 * j + 0], stop_colors[4 * j + 1],
+                    stop_colors[4 * j + 2], stop_colors[4 * j + 3]);
+        j++;
+        glUniform4f(stop_color1_uniform_location,
+                    stop_colors[4 * j + 0], stop_colors[4 * j + 1],
+                    stop_colors[4 * j + 2], stop_colors[4 * j + 3]);
+        j++;
+        glUniform4f(stop_color2_uniform_location,
+                    stop_colors[4 * j + 0], stop_colors[4 * j + 1],
+                    stop_colors[4 * j + 2], stop_colors[4 * j + 3]);
+        j++;
+        glUniform4f(stop_color3_uniform_location,
+                    stop_colors[4 * j + 0], stop_colors[4 * j + 1],
+                    stop_colors[4 * j + 2], stop_colors[4 * j + 3]);
+        j++;
+        glUniform4f(stop_color4_uniform_location,
+                    stop_colors[4 * j + 0], stop_colors[4 * j + 1],
+                    stop_colors[4 * j + 2], stop_colors[4 * j + 3]);
+        j++;
+        glUniform4f(stop_color5_uniform_location,
+                    stop_colors[4 * j + 0], stop_colors[4 * j + 1],
+                    stop_colors[4 * j + 2], stop_colors[4 * j + 3]);
+        j++;
+        glUniform4f(stop_color6_uniform_location,
+                    stop_colors[4 * j + 0], stop_colors[4 * j + 1],
+                    stop_colors[4 * j + 2], stop_colors[4 * j + 3]);
+        j++;
+        glUniform4f(stop_color7_uniform_location,
+                    stop_colors[4 * j + 0], stop_colors[4 * j + 1],
+                    stop_colors[4 * j + 2], stop_colors[4 * j + 3]);
+
+        j = 0;
+        glUniform1f(stop0_uniform_location, n_stops[j++]);
+        glUniform1f(stop1_uniform_location, n_stops[j++]);
+        glUniform1f(stop2_uniform_location, n_stops[j++]);
+        glUniform1f(stop3_uniform_location, n_stops[j++]);
+        glUniform1f(stop4_uniform_location, n_stops[j++]);
+        glUniform1f(stop5_uniform_location, n_stops[j++]);
+        glUniform1f(stop6_uniform_location, n_stops[j++]);
+        glUniform1f(stop7_uniform_location, n_stops[j++]);
+        glUniform1i(n_stop_uniform_location, count);
+    }
+    else {
+        glUniform4fv(stop_colors_uniform_location, count, stop_colors);
+        glUniform1fv(stops_uniform_location, count, n_stops);
+        glUniform1i(n_stop_uniform_location, count);
+    }
+
+    c1x = (float) pixman_fixed_to_double(src_picture->pSourcePict->radial.c1.x);
+    c1y = (float) pixman_fixed_to_double(src_picture->pSourcePict->radial.c1.y);
+    c2x = (float) pixman_fixed_to_double(src_picture->pSourcePict->radial.c2.x);
+    c2y = (float) pixman_fixed_to_double(src_picture->pSourcePict->radial.c2.y);
+
+    r1 = (float) pixman_fixed_to_double(src_picture->pSourcePict->radial.c1.
+                                        radius);
+    r2 = (float) pixman_fixed_to_double(src_picture->pSourcePict->radial.c2.
+                                        radius);
+
+    glamor_set_circle_centre(width, height, c1x, c1y, glamor_priv->yInverted,
+                             cxy);
+    glUniform2fv(c1_uniform_location, 1, cxy);
+    glUniform1f(r1_uniform_location, r1);
+
+    glamor_set_circle_centre(width, height, c2x, c2y, glamor_priv->yInverted,
+                             cxy);
+    glUniform2fv(c2_uniform_location, 1, cxy);
+    glUniform1f(r2_uniform_location, r2);
+
+    A_value =
+        (c2x - c1x) * (c2x - c1x) + (c2y - c1y) * (c2y - c1y) - (r2 -
+                                                                 r1) * (r2 -
+                                                                        r1);
+    glUniform1f(A_value_uniform_location, A_value);
+
+    DEBUGF("C1:(%f, %f) R1:%f\nC2:(%f, %f) R2:%f\nA = %f\n",
+           c1x, c1y, r1, c2x, c2y, r2, A_value);
+
+    /* Now rendering. */
+    glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
+
+    /* Do the clear logic. */
+    if (stops_count > RADIAL_SMALL_STOPS) {
+        free(n_stops);
+        free(stop_colors);
+    }
+
+    glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
+    glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
+
+    return dst_picture;
+
+ GRADIENT_FAIL:
+    if (dst_picture) {
+        FreePicture(dst_picture, 0);
+    }
+
+    if (stops_count > RADIAL_SMALL_STOPS) {
+        if (n_stops)
+            free(n_stops);
+        if (stop_colors)
+            free(stop_colors);
+    }
+
+    glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
+    glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
+    return NULL;
+}
+
+PicturePtr
+glamor_generate_linear_gradient_picture(ScreenPtr screen,
+                                        PicturePtr src_picture,
+                                        int x_source, int y_source,
+                                        int width, int height,
+                                        PictFormatShort format)
+{
+    glamor_screen_private *glamor_priv;
+    PicturePtr dst_picture = NULL;
+    PixmapPtr pixmap = NULL;
+    GLint gradient_prog = 0;
+    int error;
+    float pt_distance;
+    float p1_distance;
+    GLfloat cos_val;
+    float tex_vertices[8];
+    int stops_count = 0;
+    GLfloat *stop_colors = NULL;
+    GLfloat *n_stops = NULL;
+    int count = 0;
+    float slope;
+    GLfloat xscale, yscale;
+    GLfloat pt1[2], pt2[2];
+    float vertices[8];
+    float transform_mat[3][3];
+    static const float identity_mat[3][3] = { {1.0, 0.0, 0.0},
+    {0.0, 1.0, 0.0},
+    {0.0, 0.0, 1.0}
+    };
+    GLfloat stop_colors_st[LINEAR_SMALL_STOPS * 4];
+    GLfloat n_stops_st[LINEAR_SMALL_STOPS];
+
+    GLint transform_mat_uniform_location = 0;
+    GLint n_stop_uniform_location = 0;
+    GLint stops_uniform_location = 0;
+    GLint stop0_uniform_location = 0;
+    GLint stop1_uniform_location = 0;
+    GLint stop2_uniform_location = 0;
+    GLint stop3_uniform_location = 0;
+    GLint stop4_uniform_location = 0;
+    GLint stop5_uniform_location = 0;
+    GLint stop6_uniform_location = 0;
+    GLint stop7_uniform_location = 0;
+    GLint stop_colors_uniform_location = 0;
+    GLint stop_color0_uniform_location = 0;
+    GLint stop_color1_uniform_location = 0;
+    GLint stop_color2_uniform_location = 0;
+    GLint stop_color3_uniform_location = 0;
+    GLint stop_color4_uniform_location = 0;
+    GLint stop_color5_uniform_location = 0;
+    GLint stop_color6_uniform_location = 0;
+    GLint stop_color7_uniform_location = 0;
+    GLint pt_slope_uniform_location = 0;
+    GLint repeat_type_uniform_location = 0;
+    GLint hor_ver_uniform_location = 0;
+    GLint cos_val_uniform_location = 0;
+    GLint p1_distance_uniform_location = 0;
+    GLint pt_distance_uniform_location = 0;
+
+    glamor_priv = glamor_get_screen_private(screen);
+    glamor_make_current(glamor_priv);
+
+    /* Create a pixmap with VBO. */
+    pixmap = glamor_create_pixmap(screen,
+                                  width, height,
+                                  PIXMAN_FORMAT_DEPTH(format), 0);
+
+    if (!pixmap)
+        goto GRADIENT_FAIL;
+
+    dst_picture = CreatePicture(0, &pixmap->drawable,
+                                PictureMatchFormat(screen,
+                                                   PIXMAN_FORMAT_DEPTH(format),
+                                                   format), 0, 0, serverClient,
+                                &error);
+
+    /* Release the reference, picture will hold the last one. */
+    glamor_destroy_pixmap(pixmap);
+
+    if (!dst_picture)
+        goto GRADIENT_FAIL;
+
+    ValidatePicture(dst_picture);
+
+    stops_count = src_picture->pSourcePict->linear.nstops + 2;
+
+    /* Because the max value of nstops is unkown, so create a program
+       when nstops > LINEAR_LARGE_STOPS. */
+    if (stops_count <= LINEAR_SMALL_STOPS) {
+        gradient_prog = glamor_priv->gradient_prog[SHADER_GRADIENT_LINEAR][0];
+    }
+    else if (stops_count <= LINEAR_LARGE_STOPS) {
+        gradient_prog = glamor_priv->gradient_prog[SHADER_GRADIENT_LINEAR][1];
+    }
+    else {
+        _glamor_create_linear_gradient_program(screen,
+                                               src_picture->pSourcePict->linear.
+                                               nstops + 2, 1);
+        gradient_prog = glamor_priv->gradient_prog[SHADER_GRADIENT_LINEAR][2];
+    }
+
+    /* Bind all the uniform vars . */
+    n_stop_uniform_location =
+        glGetUniformLocation(gradient_prog, "n_stop");
+    pt_slope_uniform_location =
+        glGetUniformLocation(gradient_prog, "pt_slope");
+    repeat_type_uniform_location =
+        glGetUniformLocation(gradient_prog, "repeat_type");
+    hor_ver_uniform_location =
+        glGetUniformLocation(gradient_prog, "hor_ver");
+    transform_mat_uniform_location =
+        glGetUniformLocation(gradient_prog, "transform_mat");
+    cos_val_uniform_location =
+        glGetUniformLocation(gradient_prog, "cos_val");
+    p1_distance_uniform_location =
+        glGetUniformLocation(gradient_prog, "p1_distance");
+    pt_distance_uniform_location =
+        glGetUniformLocation(gradient_prog, "pt_distance");
+
+    if (src_picture->pSourcePict->linear.nstops + 2 <= LINEAR_SMALL_STOPS) {
+        stop0_uniform_location =
+            glGetUniformLocation(gradient_prog, "stop0");
+        stop1_uniform_location =
+            glGetUniformLocation(gradient_prog, "stop1");
+        stop2_uniform_location =
+            glGetUniformLocation(gradient_prog, "stop2");
+        stop3_uniform_location =
+            glGetUniformLocation(gradient_prog, "stop3");
+        stop4_uniform_location =
+            glGetUniformLocation(gradient_prog, "stop4");
+        stop5_uniform_location =
+            glGetUniformLocation(gradient_prog, "stop5");
+        stop6_uniform_location =
+            glGetUniformLocation(gradient_prog, "stop6");
+        stop7_uniform_location =
+            glGetUniformLocation(gradient_prog, "stop7");
+
+        stop_color0_uniform_location =
+            glGetUniformLocation(gradient_prog, "stop_color0");
+        stop_color1_uniform_location =
+            glGetUniformLocation(gradient_prog, "stop_color1");
+        stop_color2_uniform_location =
+            glGetUniformLocation(gradient_prog, "stop_color2");
+        stop_color3_uniform_location =
+            glGetUniformLocation(gradient_prog, "stop_color3");
+        stop_color4_uniform_location =
+            glGetUniformLocation(gradient_prog, "stop_color4");
+        stop_color5_uniform_location =
+            glGetUniformLocation(gradient_prog, "stop_color5");
+        stop_color6_uniform_location =
+            glGetUniformLocation(gradient_prog, "stop_color6");
+        stop_color7_uniform_location =
+            glGetUniformLocation(gradient_prog, "stop_color7");
+    }
+    else {
+        stops_uniform_location =
+            glGetUniformLocation(gradient_prog, "stops");
+        stop_colors_uniform_location =
+            glGetUniformLocation(gradient_prog, "stop_colors");
+    }
+
+    glUseProgram(gradient_prog);
+
+    glUniform1i(repeat_type_uniform_location, src_picture->repeatType);
+
+    /* set the transform matrix. */
+    if (src_picture->transform) {
+        _glamor_gradient_convert_trans_matrix(src_picture->transform,
+                                              transform_mat, width, height, 1);
+        glUniformMatrix3fv(transform_mat_uniform_location,
+                           1, 1, &transform_mat[0][0]);
+    }
+    else {
+        glUniformMatrix3fv(transform_mat_uniform_location,
+                           1, 1, &identity_mat[0][0]);
+    }
+
+    if (!_glamor_gradient_set_pixmap_destination
+        (screen, glamor_priv, dst_picture, &xscale, &yscale, x_source, y_source,
+         vertices, tex_vertices, 1))
+        goto GRADIENT_FAIL;
+
+    /* Normalize the PTs. */
+    glamor_set_normalize_pt(xscale, yscale,
+                            pixman_fixed_to_double(src_picture->pSourcePict->
+                                                   linear.p1.x),
+                            pixman_fixed_to_double(src_picture->pSourcePict->
+                                                   linear.p1.y),
+                            glamor_priv->yInverted, pt1);
+    DEBUGF("pt1:(%f, %f) ---> (%f %f)\n",
+           pixman_fixed_to_double(src_picture->pSourcePict->linear.p1.x),
+           pixman_fixed_to_double(src_picture->pSourcePict->linear.p1.y),
+           pt1[0], pt1[1]);
+
+    glamor_set_normalize_pt(xscale, yscale,
+                            pixman_fixed_to_double(src_picture->pSourcePict->
+                                                   linear.p2.x),
+                            pixman_fixed_to_double(src_picture->pSourcePict->
+                                                   linear.p2.y),
+                            glamor_priv->yInverted, pt2);
+    DEBUGF("pt2:(%f, %f) ---> (%f %f)\n",
+           pixman_fixed_to_double(src_picture->pSourcePict->linear.p2.x),
+           pixman_fixed_to_double(src_picture->pSourcePict->linear.p2.y),
+           pt2[0], pt2[1]);
+
+    /* Set all the stops and colors to shader. */
+    if (stops_count > LINEAR_SMALL_STOPS) {
+        stop_colors = malloc(4 * stops_count * sizeof(float));
+        if (stop_colors == NULL) {
+            ErrorF("Failed to allocate stop_colors memory.\n");
+            goto GRADIENT_FAIL;
+        }
+
+        n_stops = malloc(stops_count * sizeof(float));
+        if (n_stops == NULL) {
+            ErrorF("Failed to allocate n_stops memory.\n");
+            goto GRADIENT_FAIL;
+        }
+    }
+    else {
+        stop_colors = stop_colors_st;
+        n_stops = n_stops_st;
+    }
+
+    count =
+        _glamor_gradient_set_stops(src_picture,
+                                   &src_picture->pSourcePict->gradient,
+                                   stop_colors, n_stops);
+
+    if (src_picture->pSourcePict->linear.nstops + 2 <= LINEAR_SMALL_STOPS) {
+        int j = 0;
+
+        glUniform4f(stop_color0_uniform_location,
+                    stop_colors[4 * j + 0], stop_colors[4 * j + 1],
+                    stop_colors[4 * j + 2], stop_colors[4 * j + 3]);
+        j++;
+        glUniform4f(stop_color1_uniform_location,
+                    stop_colors[4 * j + 0], stop_colors[4 * j + 1],
+                    stop_colors[4 * j + 2], stop_colors[4 * j + 3]);
+        j++;
+        glUniform4f(stop_color2_uniform_location,
+                    stop_colors[4 * j + 0], stop_colors[4 * j + 1],
+                    stop_colors[4 * j + 2], stop_colors[4 * j + 3]);
+        j++;
+        glUniform4f(stop_color3_uniform_location,
+                    stop_colors[4 * j + 0], stop_colors[4 * j + 1],
+                    stop_colors[4 * j + 2], stop_colors[4 * j + 3]);
+        j++;
+        glUniform4f(stop_color4_uniform_location,
+                    stop_colors[4 * j + 0], stop_colors[4 * j + 1],
+                    stop_colors[4 * j + 2], stop_colors[4 * j + 3]);
+        j++;
+        glUniform4f(stop_color5_uniform_location,
+                    stop_colors[4 * j + 0], stop_colors[4 * j + 1],
+                    stop_colors[4 * j + 2], stop_colors[4 * j + 3]);
+        j++;
+        glUniform4f(stop_color6_uniform_location,
+                    stop_colors[4 * j + 0], stop_colors[4 * j + 1],
+                    stop_colors[4 * j + 2], stop_colors[4 * j + 3]);
+        j++;
+        glUniform4f(stop_color7_uniform_location,
+                    stop_colors[4 * j + 0], stop_colors[4 * j + 1],
+                    stop_colors[4 * j + 2], stop_colors[4 * j + 3]);
+
+        j = 0;
+        glUniform1f(stop0_uniform_location, n_stops[j++]);
+        glUniform1f(stop1_uniform_location, n_stops[j++]);
+        glUniform1f(stop2_uniform_location, n_stops[j++]);
+        glUniform1f(stop3_uniform_location, n_stops[j++]);
+        glUniform1f(stop4_uniform_location, n_stops[j++]);
+        glUniform1f(stop5_uniform_location, n_stops[j++]);
+        glUniform1f(stop6_uniform_location, n_stops[j++]);
+        glUniform1f(stop7_uniform_location, n_stops[j++]);
+
+        glUniform1i(n_stop_uniform_location, count);
+    }
+    else {
+        glUniform4fv(stop_colors_uniform_location, count, stop_colors);
+        glUniform1fv(stops_uniform_location, count, n_stops);
+        glUniform1i(n_stop_uniform_location, count);
+    }
+
+    if (src_picture->pSourcePict->linear.p2.y == src_picture->pSourcePict->linear.p1.y) {       // The horizontal case.
+        glUniform1i(hor_ver_uniform_location, 1);
+        DEBUGF("p1.y: %f, p2.y: %f, enter the horizontal case\n",
+               pt1[1], pt2[1]);
+
+        p1_distance = pt1[0];
+        pt_distance = (pt2[0] - p1_distance);
+        glUniform1f(p1_distance_uniform_location, p1_distance);
+        glUniform1f(pt_distance_uniform_location, pt_distance);
+    }
+    else {
+        /* The slope need to compute here. In shader, the viewport set will change
+           the orginal slope and the slope which is vertical to it will not be correct. */
+        slope = -(float) (src_picture->pSourcePict->linear.p2.x
+                          - src_picture->pSourcePict->linear.p1.x) /
+            (float) (src_picture->pSourcePict->linear.p2.y
+                     - src_picture->pSourcePict->linear.p1.y);
+        slope = slope * yscale / xscale;
+        glUniform1f(pt_slope_uniform_location, slope);
+        glUniform1i(hor_ver_uniform_location, 0);
+
+        cos_val = sqrt(1.0 / (slope * slope + 1.0));
+        glUniform1f(cos_val_uniform_location, cos_val);
+
+        p1_distance = (pt1[1] - pt1[0] * slope) * cos_val;
+        pt_distance = (pt2[1] - pt2[0] * slope) * cos_val - p1_distance;
+        glUniform1f(p1_distance_uniform_location, p1_distance);
+        glUniform1f(pt_distance_uniform_location, pt_distance);
+    }
+
+    /* Now rendering. */
+    glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
+
+    /* Do the clear logic. */
+    if (stops_count > LINEAR_SMALL_STOPS) {
+        free(n_stops);
+        free(stop_colors);
+    }
+
+    glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
+    glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
+
+    return dst_picture;
+
+ GRADIENT_FAIL:
+    if (dst_picture) {
+        FreePicture(dst_picture, 0);
+    }
+
+    if (stops_count > LINEAR_SMALL_STOPS) {
+        if (n_stops)
+            free(n_stops);
+        if (stop_colors)
+            free(stop_colors);
+    }
+
+    glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
+    glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
+    return NULL;
+}
+
+#endif                          /* End of GLAMOR_GRADIENT_SHADER */
+
+#endif                          /* End of RENDER */
diff --git a/glamor/glamor_image.c b/glamor/glamor_image.c
new file mode 100644 (file)
index 0000000..b38b412
--- /dev/null
@@ -0,0 +1,179 @@
+/*
+ * Copyright Â© 2014 Keith Packard
+ *
+ * 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 the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  The copyright holders make no representations
+ * about the suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS 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.
+ */
+
+#include "glamor_priv.h"
+#include "glamor_transfer.h"
+#include "glamor_transform.h"
+
+/*
+ * PutImage. Only does ZPixmap right now as other formats are quite a bit harder
+ */
+
+static Bool
+glamor_put_image_gl(DrawablePtr drawable, GCPtr gc, int depth, int x, int y,
+                    int w, int h, int leftPad, int format, char *bits)
+{
+    ScreenPtr screen = drawable->pScreen;
+    glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
+    PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable);
+    glamor_pixmap_private *pixmap_priv;
+    uint32_t    byte_stride = PixmapBytePad(w, drawable->depth);
+    RegionRec   region;
+    BoxRec      box;
+    int         off_x, off_y;
+
+    pixmap_priv = glamor_get_pixmap_private(pixmap);
+
+    if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv))
+        return FALSE;
+
+    if (gc->alu != GXcopy)
+        goto bail;
+
+    if (!glamor_pm_is_solid(&pixmap->drawable, gc->planemask))
+        goto bail;
+
+    if (format == XYPixmap && drawable->depth == 1 && leftPad == 0)
+        format = ZPixmap;
+
+    if (format != ZPixmap)
+        goto bail;
+
+    x += drawable->x;
+    y += drawable->y;
+    box.x1 = x;
+    box.y1 = y;
+    box.x2 = box.x1 + w;
+    box.y2 = box.y1 + h;
+    RegionInit(&region, &box, 1);
+    RegionIntersect(&region, &region, gc->pCompositeClip);
+
+    glamor_get_drawable_deltas(drawable, pixmap, &off_x, &off_y);
+    if (off_x || off_y) {
+        x += off_x;
+        y += off_y;
+        RegionTranslate(&region, off_x, off_y);
+    }
+
+    glamor_make_current(glamor_priv);
+
+    glamor_upload_region(pixmap, &region, x, y, (uint8_t *) bits, byte_stride);
+
+    RegionUninit(&region);
+    return TRUE;
+bail:
+    return FALSE;
+}
+
+static void
+glamor_put_image_bail(DrawablePtr drawable, GCPtr gc, int depth, int x, int y,
+                      int w, int h, int leftPad, int format, char *bits)
+{
+    if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RW))
+        fbPutImage(drawable, gc, depth, x, y, w, h, leftPad, format, bits);
+    glamor_finish_access(drawable);
+}
+
+void
+glamor_put_image(DrawablePtr drawable, GCPtr gc, int depth, int x, int y,
+                 int w, int h, int leftPad, int format, char *bits)
+{
+    if (glamor_put_image_gl(drawable, gc, depth, x, y, w, h, leftPad, format, bits))
+        return;
+    glamor_put_image_bail(drawable, gc, depth, x, y, w, h, leftPad, format, bits);
+}
+
+Bool
+glamor_put_image_nf(DrawablePtr drawable, GCPtr gc, int depth, int x, int y,
+                    int w, int h, int leftPad, int format, char *bits)
+{
+    if (glamor_put_image_gl(drawable, gc, depth, x, y, w, h, leftPad, format, bits))
+        return TRUE;
+    if (glamor_ddx_fallback_check_pixmap(drawable) &&
+        glamor_ddx_fallback_check_gc(gc))
+        return FALSE;
+    glamor_put_image_bail(drawable, gc, depth, x, y, w, h, leftPad, format, bits);
+    return TRUE;
+}
+
+static Bool
+glamor_get_image_gl(DrawablePtr drawable, int x, int y, int w, int h,
+                    unsigned int format, unsigned long plane_mask, char *d)
+{
+    PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable);
+    glamor_pixmap_private *pixmap_priv;
+    uint32_t    byte_stride = PixmapBytePad(w, drawable->depth);
+    BoxRec      box;
+    int         off_x, off_y;
+
+    pixmap_priv = glamor_get_pixmap_private(pixmap);
+    if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv))
+        goto bail;
+
+    if (format != ZPixmap || !glamor_pm_is_solid(drawable, plane_mask))
+        goto bail;
+
+    glamor_get_drawable_deltas(drawable, pixmap, &off_x, &off_y);
+    box.x1 = x;
+    box.x2 = x + w;
+    box.y1 = y;
+    box.y2 = y + h;
+    glamor_download_boxes(pixmap, &box, 1,
+                          drawable->x + off_x, drawable->y + off_y,
+                          -x, -y,
+                          (uint8_t *) d, byte_stride);
+    return TRUE;
+bail:
+    return FALSE;
+}
+
+static void
+glamor_get_image_bail(DrawablePtr drawable, int x, int y, int w, int h,
+                      unsigned int format, unsigned long plane_mask, char *d)
+{
+    if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RO))
+        fbGetImage(drawable, x, y, w, h, format, plane_mask, d);
+    glamor_finish_access(drawable);
+}
+
+void
+glamor_get_image(DrawablePtr drawable, int x, int y, int w, int h,
+                 unsigned int format, unsigned long plane_mask, char *d)
+{
+    if (glamor_get_image_gl(drawable, x, y, w, h, format, plane_mask, d))
+        return;
+    glamor_get_image_bail(drawable, x, y, w, h, format, plane_mask, d);
+}
+
+Bool
+glamor_get_image_nf(DrawablePtr drawable, int x, int y, int w, int h,
+                    unsigned int format, unsigned long plane_mask, char *d)
+{
+    if (glamor_get_image_gl(drawable, x, y, w, h, format, plane_mask, d))
+        return TRUE;
+
+    if (glamor_ddx_fallback_check_pixmap(drawable))
+        return FALSE;
+
+    glamor_get_image_bail(drawable, x, y, w, h, format, plane_mask, d);
+    return TRUE;
+}
diff --git a/glamor/glamor_largepixmap.c b/glamor/glamor_largepixmap.c
new file mode 100644 (file)
index 0000000..b3a8d5d
--- /dev/null
@@ -0,0 +1,1417 @@
+#include <stdlib.h>
+
+#include "glamor_priv.h"
+
+/**
+ * Clip the boxes regards to each pixmap's block array.
+ *
+ * Should translate the region to relative coords to the pixmap,
+ * start at (0,0).
+ */
+#if 0
+//#define DEBUGF(str, ...)  do {} while(0)
+#define DEBUGF(str, ...) ErrorF(str, ##__VA_ARGS__)
+//#define DEBUGRegionPrint(x) do {} while (0)
+#define DEBUGRegionPrint RegionPrint
+#endif
+
+static glamor_pixmap_clipped_regions *
+__glamor_compute_clipped_regions(int block_w,
+                                 int block_h,
+                                 int block_stride,
+                                 int x, int y,
+                                 int w, int h,
+                                 RegionPtr region,
+                                 int *n_region, int reverse, int upsidedown)
+{
+    glamor_pixmap_clipped_regions *clipped_regions;
+    BoxPtr extent;
+    int start_x, start_y, end_x, end_y;
+    int start_block_x, start_block_y;
+    int end_block_x, end_block_y;
+    int loop_start_block_x, loop_start_block_y;
+    int loop_end_block_x, loop_end_block_y;
+    int loop_block_stride;
+    int i, j, delta_i, delta_j;
+    RegionRec temp_region;
+    RegionPtr current_region;
+    int block_idx;
+    int k = 0;
+    int temp_block_idx;
+
+    extent = RegionExtents(region);
+    start_x = MAX(x, extent->x1);
+    start_y = MAX(y, extent->y1);
+    end_x = MIN(x + w, extent->x2);
+    end_y = MIN(y + h, extent->y2);
+
+    DEBUGF("start compute clipped regions:\n");
+    DEBUGF("block w %d h %d  x %d y %d w %d h %d, block_stride %d \n",
+           block_w, block_h, x, y, w, h, block_stride);
+    DEBUGRegionPrint(region);
+
+    DEBUGF("start_x %d start_y %d end_x %d end_y %d \n", start_x, start_y,
+           end_x, end_y);
+
+    if (start_x >= end_x || start_y >= end_y) {
+        *n_region = 0;
+        return NULL;
+    }
+
+    start_block_x = (start_x - x) / block_w;
+    start_block_y = (start_y - y) / block_h;
+    end_block_x = (end_x - x) / block_w;
+    end_block_y = (end_y - y) / block_h;
+
+    clipped_regions = calloc((end_block_x - start_block_x + 1)
+                             * (end_block_y - start_block_y + 1),
+                             sizeof(*clipped_regions));
+
+    DEBUGF("startx %d starty %d endx %d endy %d \n",
+           start_x, start_y, end_x, end_y);
+    DEBUGF("start_block_x %d end_block_x %d \n", start_block_x, end_block_x);
+    DEBUGF("start_block_y %d end_block_y %d \n", start_block_y, end_block_y);
+
+    if (!reverse) {
+        loop_start_block_x = start_block_x;
+        loop_end_block_x = end_block_x + 1;
+        delta_i = 1;
+    }
+    else {
+        loop_start_block_x = end_block_x;
+        loop_end_block_x = start_block_x - 1;
+        delta_i = -1;
+    }
+
+    if (!upsidedown) {
+        loop_start_block_y = start_block_y;
+        loop_end_block_y = end_block_y + 1;
+        delta_j = 1;
+    }
+    else {
+        loop_start_block_y = end_block_y;
+        loop_end_block_y = start_block_y - 1;
+        delta_j = -1;
+    }
+
+    loop_block_stride = delta_j * block_stride;
+    block_idx = (loop_start_block_y - delta_j) * block_stride;
+
+    for (j = loop_start_block_y; j != loop_end_block_y; j += delta_j) {
+        block_idx += loop_block_stride;
+        temp_block_idx = block_idx + loop_start_block_x;
+        for (i = loop_start_block_x;
+             i != loop_end_block_x; i += delta_i, temp_block_idx += delta_i) {
+            BoxRec temp_box;
+
+            temp_box.x1 = x + i * block_w;
+            temp_box.y1 = y + j * block_h;
+            temp_box.x2 = MIN(temp_box.x1 + block_w, end_x);
+            temp_box.y2 = MIN(temp_box.y1 + block_h, end_y);
+            RegionInitBoxes(&temp_region, &temp_box, 1);
+            DEBUGF("block idx %d \n", temp_block_idx);
+            DEBUGRegionPrint(&temp_region);
+            current_region = RegionCreate(NULL, 4);
+            RegionIntersect(current_region, &temp_region, region);
+            DEBUGF("i %d j %d  region: \n", i, j);
+            DEBUGRegionPrint(current_region);
+            if (RegionNumRects(current_region)) {
+                clipped_regions[k].region = current_region;
+                clipped_regions[k].block_idx = temp_block_idx;
+                k++;
+            }
+            else
+                RegionDestroy(current_region);
+            RegionUninit(&temp_region);
+        }
+    }
+
+    *n_region = k;
+    return clipped_regions;
+}
+
+/**
+ * Do a two round clipping,
+ * first is to clip the region regard to current pixmap's
+ * block array. Then for each clipped region, do a inner
+ * block clipping. This is to make sure the final result
+ * will be shapped by inner_block_w and inner_block_h, and
+ * the final region also will not cross the pixmap's block
+ * boundary.
+ *
+ * This is mainly used by transformation support when do
+ * compositing.
+ */
+
+glamor_pixmap_clipped_regions *
+glamor_compute_clipped_regions_ext(glamor_pixmap_private *pixmap_priv,
+                                   RegionPtr region,
+                                   int *n_region,
+                                   int inner_block_w, int inner_block_h,
+                                   int reverse, int upsidedown)
+{
+    glamor_pixmap_clipped_regions *clipped_regions, *inner_regions,
+        *result_regions;
+    int i, j, x, y, k, inner_n_regions;
+    int width, height;
+    glamor_pixmap_private_large_t *priv;
+
+    priv = &pixmap_priv->large;
+
+    DEBUGF("ext called \n");
+
+    if (pixmap_priv->type != GLAMOR_TEXTURE_LARGE) {
+        clipped_regions = calloc(1, sizeof(*clipped_regions));
+        if (clipped_regions == NULL) {
+            *n_region = 0;
+            return NULL;
+        }
+        clipped_regions[0].region = RegionCreate(NULL, 1);
+        clipped_regions[0].block_idx = 0;
+        RegionCopy(clipped_regions[0].region, region);
+        *n_region = 1;
+        priv->block_w = priv->base.pixmap->drawable.width;
+        priv->block_h = priv->base.pixmap->drawable.height;
+        priv->box_array = &priv->box;
+        priv->box.x1 = priv->box.y1 = 0;
+        priv->box.x2 = priv->block_w;
+        priv->box.y2 = priv->block_h;
+    }
+    else {
+        clipped_regions = __glamor_compute_clipped_regions(priv->block_w,
+                                                           priv->block_h,
+                                                           priv->block_wcnt,
+                                                           0, 0,
+                                                           priv->base.pixmap->
+                                                           drawable.width,
+                                                           priv->base.pixmap->
+                                                           drawable.height,
+                                                           region, n_region,
+                                                           reverse, upsidedown);
+
+        if (clipped_regions == NULL) {
+            *n_region = 0;
+            return NULL;
+        }
+    }
+    if (inner_block_w >= priv->block_w && inner_block_h >= priv->block_h)
+        return clipped_regions;
+    result_regions = calloc(*n_region
+                            * ((priv->block_w + inner_block_w - 1) /
+                               inner_block_w)
+                            * ((priv->block_h + inner_block_h - 1) /
+                               inner_block_h), sizeof(*result_regions));
+    k = 0;
+    for (i = 0; i < *n_region; i++) {
+        x = priv->box_array[clipped_regions[i].block_idx].x1;
+        y = priv->box_array[clipped_regions[i].block_idx].y1;
+        width = priv->box_array[clipped_regions[i].block_idx].x2 - x;
+        height = priv->box_array[clipped_regions[i].block_idx].y2 - y;
+        inner_regions = __glamor_compute_clipped_regions(inner_block_w,
+                                                         inner_block_h,
+                                                         0, x, y,
+                                                         width,
+                                                         height,
+                                                         clipped_regions[i].
+                                                         region,
+                                                         &inner_n_regions,
+                                                         reverse, upsidedown);
+        for (j = 0; j < inner_n_regions; j++) {
+            result_regions[k].region = inner_regions[j].region;
+            result_regions[k].block_idx = clipped_regions[i].block_idx;
+            k++;
+        }
+        free(inner_regions);
+    }
+    *n_region = k;
+    free(clipped_regions);
+    return result_regions;
+}
+
+/*
+ *
+ * For the repeat pad mode, we can simply convert the region and
+ * let the out-of-box region can cover the needed edge of the source/mask
+ * Then apply a normal clip we can get what we want.
+ */
+static RegionPtr
+_glamor_convert_pad_region(RegionPtr region, int w, int h)
+{
+    RegionPtr pad_region;
+    int nrect;
+    BoxPtr box;
+    int overlap;
+
+    nrect = RegionNumRects(region);
+    box = RegionRects(region);
+    pad_region = RegionCreate(NULL, 4);
+    if (pad_region == NULL)
+        return NULL;
+    while (nrect--) {
+        BoxRec pad_box;
+        RegionRec temp_region;
+
+        pad_box = *box;
+        if (pad_box.x1 < 0 && pad_box.x2 <= 0)
+            pad_box.x2 = 1;
+        else if (pad_box.x1 >= w && pad_box.x2 > w)
+            pad_box.x1 = w - 1;
+        if (pad_box.y1 < 0 && pad_box.y2 <= 0)
+            pad_box.y2 = 1;
+        else if (pad_box.y1 >= h && pad_box.y2 > h)
+            pad_box.y1 = h - 1;
+        RegionInitBoxes(&temp_region, &pad_box, 1);
+        RegionAppend(pad_region, &temp_region);
+        RegionUninit(&temp_region);
+        box++;
+    }
+    RegionValidate(pad_region, &overlap);
+    return pad_region;
+}
+
+/*
+ * For one type of large pixmap, its one direction is not exceed the
+ * size limitation, and in another word, on one direction it has only
+ * one block.
+ *
+ * This case of reflect repeating, we can optimize it and avoid repeat
+ * clip on that direction. We can just enlarge the repeat box and can
+ * cover all the dest region on that direction. But latter, we need to
+ * fixup the clipped result to get a correct coords for the subsequent
+ * processing. This function is to do the coords correction.
+ *
+ * */
+static void
+_glamor_largepixmap_reflect_fixup(short *xy1, short *xy2, int wh)
+{
+    int odd1, odd2;
+    int c1, c2;
+
+    if (*xy2 - *xy1 > wh) {
+        *xy1 = 0;
+        *xy2 = wh;
+        return;
+    }
+    modulus(*xy1, wh, c1);
+    odd1 = ((*xy1 - c1) / wh) & 0x1;
+    modulus(*xy2, wh, c2);
+    odd2 = ((*xy2 - c2) / wh) & 0x1;
+
+    if (odd1 && odd2) {
+        *xy1 = wh - c2;
+        *xy2 = wh - c1;
+    }
+    else if (odd1 && !odd2) {
+        *xy1 = 0;
+        *xy2 = MAX(c2, wh - c1);
+    }
+    else if (!odd1 && odd2) {
+        *xy2 = wh;
+        *xy1 = MIN(c1, wh - c2);
+    }
+    else {
+        *xy1 = c1;
+        *xy2 = c2;
+    }
+}
+
+/**
+ * Clip the boxes regards to each pixmap's block array.
+ *
+ * Should translate the region to relative coords to the pixmap,
+ * start at (0,0).
+ *
+ * @is_transform: if it is set, it has a transform matrix.
+ *
+ */
+static glamor_pixmap_clipped_regions *
+_glamor_compute_clipped_regions(glamor_pixmap_private *pixmap_priv,
+                                RegionPtr region, int *n_region,
+                                int repeat_type, int is_transform,
+                                int reverse, int upsidedown)
+{
+    glamor_pixmap_clipped_regions *clipped_regions;
+    BoxPtr extent;
+    int i, j;
+    RegionPtr current_region;
+    int pixmap_width, pixmap_height;
+    int m;
+    BoxRec repeat_box;
+    RegionRec repeat_region;
+    int right_shift = 0;
+    int down_shift = 0;
+    int x_center_shift = 0, y_center_shift = 0;
+    glamor_pixmap_private_large_t *priv;
+
+    priv = &pixmap_priv->large;
+
+    DEBUGRegionPrint(region);
+    if (pixmap_priv->type != GLAMOR_TEXTURE_LARGE) {
+        clipped_regions = calloc(1, sizeof(*clipped_regions));
+        clipped_regions[0].region = RegionCreate(NULL, 1);
+        clipped_regions[0].block_idx = 0;
+        RegionCopy(clipped_regions[0].region, region);
+        *n_region = 1;
+        return clipped_regions;
+    }
+
+    pixmap_width = priv->base.pixmap->drawable.width;
+    pixmap_height = priv->base.pixmap->drawable.height;
+    if (repeat_type == 0 || repeat_type == RepeatPad) {
+        RegionPtr saved_region = NULL;
+
+        if (repeat_type == RepeatPad) {
+            saved_region = region;
+            region =
+                _glamor_convert_pad_region(saved_region, pixmap_width,
+                                           pixmap_height);
+            if (region == NULL) {
+                *n_region = 0;
+                return NULL;
+            }
+        }
+        clipped_regions = __glamor_compute_clipped_regions(priv->block_w,
+                                                           priv->block_h,
+                                                           priv->block_wcnt,
+                                                           0, 0,
+                                                           priv->base.pixmap->
+                                                           drawable.width,
+                                                           priv->base.pixmap->
+                                                           drawable.height,
+                                                           region, n_region,
+                                                           reverse, upsidedown);
+        if (saved_region)
+            RegionDestroy(region);
+        return clipped_regions;
+    }
+    extent = RegionExtents(region);
+
+    x_center_shift = extent->x1 / pixmap_width;
+    if (x_center_shift < 0)
+        x_center_shift--;
+    if (abs(x_center_shift) & 1)
+        x_center_shift++;
+    y_center_shift = extent->y1 / pixmap_height;
+    if (y_center_shift < 0)
+        y_center_shift--;
+    if (abs(y_center_shift) & 1)
+        y_center_shift++;
+
+    if (extent->x1 < 0)
+        right_shift = ((-extent->x1 + pixmap_width - 1) / pixmap_width);
+    if (extent->y1 < 0)
+        down_shift = ((-extent->y1 + pixmap_height - 1) / pixmap_height);
+
+    if (right_shift != 0 || down_shift != 0) {
+        if (repeat_type == RepeatReflect) {
+            right_shift = (right_shift + 1) & ~1;
+            down_shift = (down_shift + 1) & ~1;
+        }
+        RegionTranslate(region, right_shift * pixmap_width,
+                        down_shift * pixmap_height);
+    }
+
+    extent = RegionExtents(region);
+    /* Tile a large pixmap to another large pixmap.
+     * We can't use the target large pixmap as the
+     * loop variable, instead we need to loop for all
+     * the blocks in the tile pixmap.
+     *
+     * simulate repeat each single block to cover the
+     * target's blocks. Two special case:
+     * a block_wcnt == 1 or block_hcnt ==1, then we
+     * only need to loop one direction as the other
+     * direction is fully included in the first block.
+     *
+     * For the other cases, just need to start
+     * from a proper shiftx/shifty, and then increase
+     * y by tile_height each time to walk trhough the
+     * target block and then walk trhough the target
+     * at x direction by increate tile_width each time.
+     *
+     * This way, we can consolidate all the sub blocks
+     * of the target boxes into one tile source's block.
+     *
+     * */
+    m = 0;
+    clipped_regions = calloc(priv->block_wcnt * priv->block_hcnt,
+                             sizeof(*clipped_regions));
+    if (clipped_regions == NULL) {
+        *n_region = 0;
+        return NULL;
+    }
+    if (right_shift != 0 || down_shift != 0) {
+        DEBUGF("region to be repeated shifted \n");
+        DEBUGRegionPrint(region);
+    }
+    DEBUGF("repeat pixmap width %d height %d \n", pixmap_width, pixmap_height);
+    DEBUGF("extent x1 %d y1 %d x2 %d y2 %d \n", extent->x1, extent->y1,
+           extent->x2, extent->y2);
+    for (j = 0; j < priv->block_hcnt; j++) {
+        for (i = 0; i < priv->block_wcnt; i++) {
+            int dx = pixmap_width;
+            int dy = pixmap_height;
+            int idx;
+            int shift_x;
+            int shift_y;
+            int saved_y1, saved_y2;
+            int x_idx = 0, y_idx = 0, saved_y_idx = 0;
+            RegionRec temp_region;
+            BoxRec reflect_repeat_box;
+            BoxPtr valid_repeat_box;
+
+            shift_x = (extent->x1 / pixmap_width) * pixmap_width;
+            shift_y = (extent->y1 / pixmap_height) * pixmap_height;
+            idx = j * priv->block_wcnt + i;
+            if (repeat_type == RepeatReflect) {
+                x_idx = (extent->x1 / pixmap_width);
+                y_idx = (extent->y1 / pixmap_height);
+            }
+
+            /* Construct a rect to clip the target region. */
+            repeat_box.x1 = shift_x + priv->box_array[idx].x1;
+            repeat_box.y1 = shift_y + priv->box_array[idx].y1;
+            if (priv->block_wcnt == 1) {
+                repeat_box.x2 = extent->x2;
+                dx = extent->x2 - repeat_box.x1;
+            }
+            else
+                repeat_box.x2 = shift_x + priv->box_array[idx].x2;
+            if (priv->block_hcnt == 1) {
+                repeat_box.y2 = extent->y2;
+                dy = extent->y2 - repeat_box.y1;
+            }
+            else
+                repeat_box.y2 = shift_y + priv->box_array[idx].y2;
+
+            current_region = RegionCreate(NULL, 4);
+            RegionInit(&temp_region, NULL, 4);
+            DEBUGF("init repeat box %d %d %d %d \n",
+                   repeat_box.x1, repeat_box.y1, repeat_box.x2, repeat_box.y2);
+
+            if (repeat_type == RepeatNormal) {
+                saved_y1 = repeat_box.y1;
+                saved_y2 = repeat_box.y2;
+                for (; repeat_box.x1 < extent->x2;
+                     repeat_box.x1 += dx, repeat_box.x2 += dx) {
+                    repeat_box.y1 = saved_y1;
+                    repeat_box.y2 = saved_y2;
+                    for (repeat_box.y1 = saved_y1, repeat_box.y2 = saved_y2;
+                         repeat_box.y1 < extent->y2;
+                         repeat_box.y1 += dy, repeat_box.y2 += dy) {
+
+                        RegionInitBoxes(&repeat_region, &repeat_box, 1);
+                        DEBUGF("Start to clip repeat region: \n");
+                        DEBUGRegionPrint(&repeat_region);
+                        RegionIntersect(&temp_region, &repeat_region, region);
+                        DEBUGF("clip result:\n");
+                        DEBUGRegionPrint(&temp_region);
+                        RegionAppend(current_region, &temp_region);
+                        RegionUninit(&repeat_region);
+                    }
+                }
+            }
+            else if (repeat_type == RepeatReflect) {
+                saved_y1 = repeat_box.y1;
+                saved_y2 = repeat_box.y2;
+                saved_y_idx = y_idx;
+                for (;; repeat_box.x1 += dx, repeat_box.x2 += dx) {
+                    repeat_box.y1 = saved_y1;
+                    repeat_box.y2 = saved_y2;
+                    y_idx = saved_y_idx;
+                    reflect_repeat_box.x1 = (x_idx & 1) ?
+                        ((2 * x_idx + 1) * dx - repeat_box.x2) : repeat_box.x1;
+                    reflect_repeat_box.x2 = (x_idx & 1) ?
+                        ((2 * x_idx + 1) * dx - repeat_box.x1) : repeat_box.x2;
+                    valid_repeat_box = &reflect_repeat_box;
+
+                    if (valid_repeat_box->x1 >= extent->x2)
+                        break;
+                    for (repeat_box.y1 = saved_y1, repeat_box.y2 = saved_y2;;
+                         repeat_box.y1 += dy, repeat_box.y2 += dy) {
+
+                        DEBUGF("x_idx %d y_idx %d dx %d dy %d\n", x_idx, y_idx,
+                               dx, dy);
+                        DEBUGF("repeat box %d %d %d %d \n", repeat_box.x1,
+                               repeat_box.y1, repeat_box.x2, repeat_box.y2);
+
+                        if (priv->block_hcnt > 1) {
+                            reflect_repeat_box.y1 = (y_idx & 1) ?
+                                ((2 * y_idx + 1) * dy -
+                                 repeat_box.y2) : repeat_box.y1;
+                            reflect_repeat_box.y2 =
+                                (y_idx & 1) ? ((2 * y_idx + 1) * dy -
+                                               repeat_box.y1) : repeat_box.y2;
+                        }
+                        else {
+                            reflect_repeat_box.y1 = repeat_box.y1;
+                            reflect_repeat_box.y2 = repeat_box.y2;
+                        }
+
+                        DEBUGF("valid_repeat_box x1 %d y1 %d \n",
+                               valid_repeat_box->x1, valid_repeat_box->y1);
+                        if (valid_repeat_box->y1 >= extent->y2)
+                            break;
+                        RegionInitBoxes(&repeat_region, valid_repeat_box, 1);
+                        DEBUGF("start to clip repeat[reflect] region: \n");
+                        DEBUGRegionPrint(&repeat_region);
+                        RegionIntersect(&temp_region, &repeat_region, region);
+                        DEBUGF("result:\n");
+                        DEBUGRegionPrint(&temp_region);
+                        if (is_transform && RegionNumRects(&temp_region)) {
+                            BoxRec temp_box;
+                            BoxPtr temp_extent;
+
+                            temp_extent = RegionExtents(&temp_region);
+                            if (priv->block_wcnt > 1) {
+                                if (x_idx & 1) {
+                                    temp_box.x1 =
+                                        ((2 * x_idx + 1) * dx -
+                                         temp_extent->x2);
+                                    temp_box.x2 =
+                                        ((2 * x_idx + 1) * dx -
+                                         temp_extent->x1);
+                                }
+                                else {
+                                    temp_box.x1 = temp_extent->x1;
+                                    temp_box.x2 = temp_extent->x2;
+                                }
+                                modulus(temp_box.x1, pixmap_width, temp_box.x1);
+                                modulus(temp_box.x2, pixmap_width, temp_box.x2);
+                                if (temp_box.x2 == 0)
+                                    temp_box.x2 = pixmap_width;
+                            }
+                            else {
+                                temp_box.x1 = temp_extent->x1;
+                                temp_box.x2 = temp_extent->x2;
+                                _glamor_largepixmap_reflect_fixup(&temp_box.x1,
+                                                                  &temp_box.x2,
+                                                                  pixmap_width);
+                            }
+
+                            if (priv->block_hcnt > 1) {
+                                if (y_idx & 1) {
+                                    temp_box.y1 =
+                                        ((2 * y_idx + 1) * dy -
+                                         temp_extent->y2);
+                                    temp_box.y2 =
+                                        ((2 * y_idx + 1) * dy -
+                                         temp_extent->y1);
+                                }
+                                else {
+                                    temp_box.y1 = temp_extent->y1;
+                                    temp_box.y2 = temp_extent->y2;
+                                }
+
+                                modulus(temp_box.y1, pixmap_height,
+                                        temp_box.y1);
+                                modulus(temp_box.y2, pixmap_height,
+                                        temp_box.y2);
+                                if (temp_box.y2 == 0)
+                                    temp_box.y2 = pixmap_height;
+                            }
+                            else {
+                                temp_box.y1 = temp_extent->y1;
+                                temp_box.y2 = temp_extent->y2;
+                                _glamor_largepixmap_reflect_fixup(&temp_box.y1,
+                                                                  &temp_box.y2,
+                                                                  pixmap_height);
+                            }
+
+                            RegionInitBoxes(&temp_region, &temp_box, 1);
+                            RegionTranslate(&temp_region,
+                                            x_center_shift * pixmap_width,
+                                            y_center_shift * pixmap_height);
+                            DEBUGF("for transform result:\n");
+                            DEBUGRegionPrint(&temp_region);
+                        }
+                        RegionAppend(current_region, &temp_region);
+                        RegionUninit(&repeat_region);
+                        y_idx++;
+                    }
+                    x_idx++;
+                }
+            }
+            DEBUGF("dx %d dy %d \n", dx, dy);
+
+            if (RegionNumRects(current_region)) {
+
+                if ((right_shift != 0 || down_shift != 0) &&
+                    !(is_transform && repeat_type == RepeatReflect))
+                    RegionTranslate(current_region, -right_shift * pixmap_width,
+                                    -down_shift * pixmap_height);
+                clipped_regions[m].region = current_region;
+                clipped_regions[m].block_idx = idx;
+                m++;
+            }
+            else
+                RegionDestroy(current_region);
+            RegionUninit(&temp_region);
+        }
+    }
+
+    if (right_shift != 0 || down_shift != 0)
+        RegionTranslate(region, -right_shift * pixmap_width,
+                        -down_shift * pixmap_height);
+    *n_region = m;
+
+    return clipped_regions;
+}
+
+glamor_pixmap_clipped_regions *
+glamor_compute_clipped_regions(glamor_pixmap_private *priv, RegionPtr region,
+                               int *n_region, int repeat_type,
+                               int reverse, int upsidedown)
+{
+    return _glamor_compute_clipped_regions(priv, region, n_region, repeat_type,
+                                           0, reverse, upsidedown);
+}
+
+/* XXX overflow still exist. maybe we need to change to use region32.
+ * by default. Or just use region32 for repeat cases?
+ **/
+glamor_pixmap_clipped_regions *
+glamor_compute_transform_clipped_regions(glamor_pixmap_private *priv,
+                                         struct pixman_transform *transform,
+                                         RegionPtr region, int *n_region,
+                                         int dx, int dy, int repeat_type,
+                                         int reverse, int upsidedown)
+{
+    BoxPtr temp_extent;
+    struct pixman_box32 temp_box;
+    struct pixman_box16 short_box;
+    RegionPtr temp_region;
+    glamor_pixmap_clipped_regions *ret;
+
+    temp_region = RegionCreate(NULL, 4);
+    temp_extent = RegionExtents(region);
+    DEBUGF("dest region \n");
+    DEBUGRegionPrint(region);
+    /* dx/dy may exceed MAX SHORT. we have to use
+     * a box32 to represent it.*/
+    temp_box.x1 = temp_extent->x1 + dx;
+    temp_box.x2 = temp_extent->x2 + dx;
+    temp_box.y1 = temp_extent->y1 + dy;
+    temp_box.y2 = temp_extent->y2 + dy;
+
+    DEBUGF("source box %d %d %d %d \n", temp_box.x1, temp_box.y1, temp_box.x2,
+           temp_box.y2);
+    if (transform)
+        glamor_get_transform_extent_from_box(&temp_box, transform);
+    if (repeat_type == RepeatNone) {
+        if (temp_box.x1 < 0)
+            temp_box.x1 = 0;
+        if (temp_box.y1 < 0)
+            temp_box.y1 = 0;
+        temp_box.x2 = MIN(temp_box.x2, priv->base.pixmap->drawable.width);
+        temp_box.y2 = MIN(temp_box.y2, priv->base.pixmap->drawable.height);
+    }
+    /* Now copy back the box32 to a box16 box. */
+    short_box.x1 = temp_box.x1;
+    short_box.y1 = temp_box.y1;
+    short_box.x2 = temp_box.x2;
+    short_box.y2 = temp_box.y2;
+    RegionInitBoxes(temp_region, &short_box, 1);
+    DEBUGF("copy to temp source region \n");
+    DEBUGRegionPrint(temp_region);
+    ret = _glamor_compute_clipped_regions(priv,
+                                          temp_region,
+                                          n_region,
+                                          repeat_type, 1, reverse, upsidedown);
+    DEBUGF("n_regions = %d \n", *n_region);
+    RegionDestroy(temp_region);
+
+    return ret;
+}
+
+/*
+ * As transform and repeatpad mode.
+ * We may get a clipped result which in multipe regions.
+ * It's not easy to do a 2nd round clipping just as we do
+ * without transform/repeatPad. As it's not easy to reverse
+ * the 2nd round clipping result with a transform/repeatPad mode,
+ * or even impossible for some transformation.
+ *
+ * So we have to merge the fragmental region into one region
+ * if the clipped result cross the region boundary.
+ */
+static void
+glamor_merge_clipped_regions(glamor_pixmap_private *pixmap_priv,
+                             int repeat_type,
+                             glamor_pixmap_clipped_regions *clipped_regions,
+                             int *n_regions, int *need_clean_fbo)
+{
+    BoxPtr temp_extent;
+    BoxRec temp_box, copy_box;
+    RegionPtr temp_region;
+    glamor_pixmap_private *temp_priv;
+    PixmapPtr temp_pixmap;
+    int overlap;
+    int i;
+    int pixmap_width, pixmap_height;
+    glamor_pixmap_private_large_t *priv;
+
+    priv = &pixmap_priv->large;
+    pixmap_width = priv->base.pixmap->drawable.width;
+    pixmap_height = priv->base.pixmap->drawable.height;
+
+    temp_region = RegionCreate(NULL, 4);
+    for (i = 0; i < *n_regions; i++) {
+        DEBUGF("Region %d:\n", i);
+        DEBUGRegionPrint(clipped_regions[i].region);
+        RegionAppend(temp_region, clipped_regions[i].region);
+    }
+
+    RegionValidate(temp_region, &overlap);
+    DEBUGF("temp region: \n");
+    DEBUGRegionPrint(temp_region);
+    temp_extent = RegionExtents(temp_region);
+
+    temp_box = *temp_extent;
+
+    DEBUGF("need copy region: \n");
+    DEBUGF("%d %d %d %d \n", temp_box.x1, temp_box.y1, temp_box.x2,
+           temp_box.y2);
+    temp_pixmap =
+        glamor_create_pixmap(priv->base.pixmap->drawable.pScreen,
+                             temp_box.x2 - temp_box.x1,
+                             temp_box.y2 - temp_box.y1,
+                             priv->base.pixmap->drawable.depth,
+                             GLAMOR_CREATE_PIXMAP_FIXUP);
+    if (temp_pixmap == NULL) {
+        assert(0);
+        return;
+    }
+
+    temp_priv = glamor_get_pixmap_private(temp_pixmap);
+    assert(temp_priv->type != GLAMOR_TEXTURE_LARGE);
+
+    priv->box = temp_box;
+    if (temp_extent->x1 >= 0 && temp_extent->x2 <= pixmap_width
+        && temp_extent->y1 >= 0 && temp_extent->y2 <= pixmap_height) {
+        int dx, dy;
+
+        copy_box.x1 = 0;
+        copy_box.y1 = 0;
+        copy_box.x2 = temp_extent->x2 - temp_extent->x1;
+        copy_box.y2 = temp_extent->y2 - temp_extent->y1;
+        dx = temp_extent->x1;
+        dy = temp_extent->y1;
+        glamor_copy_n_to_n(&priv->base.pixmap->drawable,
+                           &temp_pixmap->drawable,
+                           NULL, &copy_box, 1, dx, dy, 0, 0, 0, NULL);
+//              glamor_solid(temp_pixmap, 0, 0, temp_pixmap->drawable.width,
+//                             temp_pixmap->drawable.height, GXcopy, 0xffffffff, 0xff00);
+    }
+    else {
+        for (i = 0; i < *n_regions; i++) {
+            BoxPtr box;
+            int nbox;
+
+            box = REGION_RECTS(clipped_regions[i].region);
+            nbox = REGION_NUM_RECTS(clipped_regions[i].region);
+            while (nbox--) {
+                int dx, dy, c, d;
+
+                DEBUGF("box x1 %d y1 %d x2 %d y2 %d \n",
+                       box->x1, box->y1, box->x2, box->y2);
+                modulus(box->x1, pixmap_width, c);
+                dx = c - (box->x1 - temp_box.x1);
+                copy_box.x1 = box->x1 - temp_box.x1;
+                copy_box.x2 = box->x2 - temp_box.x1;
+
+                modulus(box->y1, pixmap_height, d);
+                dy = d - (box->y1 - temp_box.y1);
+                copy_box.y1 = box->y1 - temp_box.y1;
+                copy_box.y2 = box->y2 - temp_box.y1;
+
+                DEBUGF("copying box %d %d %d %d, dx %d dy %d\n",
+                       copy_box.x1, copy_box.y1, copy_box.x2,
+                       copy_box.y2, dx, dy);
+
+                glamor_copy_n_to_n(&priv->base.pixmap->drawable,
+                                   &temp_pixmap->drawable,
+                                   NULL, &copy_box, 1, dx, dy, 0, 0, 0, NULL);
+                box++;
+            }
+        }
+        //glamor_solid(temp_pixmap, 0, 0, temp_pixmap->drawable.width,
+        //             temp_pixmap->drawable.height, GXcopy, 0xffffffff, 0xff);
+    }
+    /* The first region will be released at caller side. */
+    for (i = 1; i < *n_regions; i++)
+        RegionDestroy(clipped_regions[i].region);
+    RegionDestroy(temp_region);
+    priv->box = temp_box;
+    priv->base.fbo = glamor_pixmap_detach_fbo(temp_priv);
+    DEBUGF("priv box x1 %d y1 %d x2 %d y2 %d \n",
+           priv->box.x1, priv->box.y1, priv->box.x2, priv->box.y2);
+    glamor_destroy_pixmap(temp_pixmap);
+    *need_clean_fbo = 1;
+    *n_regions = 1;
+}
+
+/**
+ * Given an expected transformed block width and block height,
+ *
+ * This function calculate a new block width and height which
+ * guarantee the transform result will not exceed the given
+ * block width and height.
+ *
+ * For large block width and height (> 2048), we choose a
+ * smaller new width and height and to reduce the cross region
+ * boundary and can avoid some overhead.
+ *
+ **/
+Bool
+glamor_get_transform_block_size(struct pixman_transform *transform,
+                                int block_w, int block_h,
+                                int *transformed_block_w,
+                                int *transformed_block_h)
+{
+    double a, b, c, d, e, f, g, h;
+    double scale;
+    int width, height;
+
+    a = pixman_fixed_to_double(transform->matrix[0][0]);
+    b = pixman_fixed_to_double(transform->matrix[0][1]);
+    c = pixman_fixed_to_double(transform->matrix[1][0]);
+    d = pixman_fixed_to_double(transform->matrix[1][1]);
+    scale = pixman_fixed_to_double(transform->matrix[2][2]);
+    if (block_w > 2048) {
+        /* For large block size, we shrink it to smaller box,
+         * thus latter we may get less cross boundary regions and
+         * thus can avoid some extra copy.
+         *
+         **/
+        width = block_w / 4;
+        height = block_h / 4;
+    }
+    else {
+        width = block_w - 2;
+        height = block_h - 2;
+    }
+    e = a + b;
+    f = c + d;
+
+    g = a - b;
+    h = c - d;
+
+    e = MIN(block_w, floor(width * scale) / MAX(fabs(e), fabs(g)));
+    f = MIN(block_h, floor(height * scale) / MAX(fabs(f), fabs(h)));
+    *transformed_block_w = MIN(e, f) - 1;
+    *transformed_block_h = *transformed_block_w;
+    if (*transformed_block_w <= 0 || *transformed_block_h <= 0)
+        return FALSE;
+    DEBUGF("original block_w/h %d %d, fixed %d %d \n", block_w, block_h,
+           *transformed_block_w, *transformed_block_h);
+    return TRUE;
+}
+
+#define VECTOR_FROM_POINT(p, x, y)     \
+       p.v[0] = x;  \
+       p.v[1] = y;  \
+       p.v[2] = 1.0;
+void
+glamor_get_transform_extent_from_box(struct pixman_box32 *box,
+                                     struct pixman_transform *transform)
+{
+    struct pixman_f_vector p0, p1, p2, p3;
+    float min_x, min_y, max_x, max_y;
+
+    struct pixman_f_transform ftransform;
+
+    VECTOR_FROM_POINT(p0, box->x1, box->y1)
+        VECTOR_FROM_POINT(p1, box->x2, box->y1)
+        VECTOR_FROM_POINT(p2, box->x2, box->y2)
+        VECTOR_FROM_POINT(p3, box->x1, box->y2)
+
+        pixman_f_transform_from_pixman_transform(&ftransform, transform);
+    pixman_f_transform_point(&ftransform, &p0);
+    pixman_f_transform_point(&ftransform, &p1);
+    pixman_f_transform_point(&ftransform, &p2);
+    pixman_f_transform_point(&ftransform, &p3);
+
+    min_x = MIN(p0.v[0], p1.v[0]);
+    min_x = MIN(min_x, p2.v[0]);
+    min_x = MIN(min_x, p3.v[0]);
+
+    min_y = MIN(p0.v[1], p1.v[1]);
+    min_y = MIN(min_y, p2.v[1]);
+    min_y = MIN(min_y, p3.v[1]);
+
+    max_x = MAX(p0.v[0], p1.v[0]);
+    max_x = MAX(max_x, p2.v[0]);
+    max_x = MAX(max_x, p3.v[0]);
+
+    max_y = MAX(p0.v[1], p1.v[1]);
+    max_y = MAX(max_y, p2.v[1]);
+    max_y = MAX(max_y, p3.v[1]);
+    box->x1 = floor(min_x) - 1;
+    box->y1 = floor(min_y) - 1;
+    box->x2 = ceil(max_x) + 1;
+    box->y2 = ceil(max_y) + 1;
+}
+
+static void
+_glamor_process_transformed_clipped_region(glamor_pixmap_private *priv,
+                                           int repeat_type,
+                                           glamor_pixmap_clipped_regions *
+                                           clipped_regions, int *n_regions,
+                                           int *need_clean_fbo)
+{
+    int shift_x, shift_y;
+
+    if (*n_regions != 1) {
+        /* Merge all source regions into one region. */
+        glamor_merge_clipped_regions(priv, repeat_type,
+                                     clipped_regions, n_regions,
+                                     need_clean_fbo);
+    }
+    else {
+        SET_PIXMAP_FBO_CURRENT(priv, clipped_regions[0].block_idx);
+        if (repeat_type == RepeatReflect || repeat_type == RepeatNormal) {
+            /* The required source areas are in one region,
+             * we need to shift the corresponding box's coords to proper position,
+             * thus we can calculate the relative coords correctly.*/
+            BoxPtr temp_box;
+            int rem;
+
+            temp_box = RegionExtents(clipped_regions[0].region);
+            modulus(temp_box->x1, priv->base.pixmap->drawable.width, rem);
+            shift_x = (temp_box->x1 - rem) / priv->base.pixmap->drawable.width;
+            modulus(temp_box->y1, priv->base.pixmap->drawable.height, rem);
+            shift_y = (temp_box->y1 - rem) / priv->base.pixmap->drawable.height;
+
+            if (shift_x != 0) {
+                priv->large.box.x1 +=
+                    shift_x * priv->base.pixmap->drawable.width;
+                priv->large.box.x2 +=
+                    shift_x * priv->base.pixmap->drawable.width;
+            }
+            if (shift_y != 0) {
+                priv->large.box.y1 +=
+                    shift_y * priv->base.pixmap->drawable.height;
+                priv->large.box.y2 +=
+                    shift_y * priv->base.pixmap->drawable.height;
+            }
+        }
+    }
+}
+
+Bool
+glamor_composite_largepixmap_region(CARD8 op,
+                                    PicturePtr source,
+                                    PicturePtr mask,
+                                    PicturePtr dest,
+                                    glamor_pixmap_private *source_pixmap_priv,
+                                    glamor_pixmap_private *mask_pixmap_priv,
+                                    glamor_pixmap_private *dest_pixmap_priv,
+                                    RegionPtr region, Bool force_clip,
+                                    INT16 x_source,
+                                    INT16 y_source,
+                                    INT16 x_mask,
+                                    INT16 y_mask,
+                                    INT16 x_dest, INT16 y_dest,
+                                    CARD16 width, CARD16 height)
+{
+    glamor_pixmap_clipped_regions *clipped_dest_regions;
+    glamor_pixmap_clipped_regions *clipped_source_regions;
+    glamor_pixmap_clipped_regions *clipped_mask_regions;
+    int n_dest_regions;
+    int n_mask_regions;
+    int n_source_regions;
+    int i, j, k;
+    int need_clean_source_fbo = 0;
+    int need_clean_mask_fbo = 0;
+    int is_normal_source_fbo = 0;
+    int is_normal_mask_fbo = 0;
+    int fixed_block_width, fixed_block_height;
+    int null_source, null_mask;
+    glamor_pixmap_private *need_free_source_pixmap_priv = NULL;
+    glamor_pixmap_private *need_free_mask_pixmap_priv = NULL;
+    int source_repeat_type = 0, mask_repeat_type = 0;
+    int ok = TRUE;
+
+    if (source->repeat)
+        source_repeat_type = source->repeatType;
+    else
+        source_repeat_type = RepeatNone;
+
+    if (mask && mask->repeat)
+        mask_repeat_type = mask->repeatType;
+    else
+        mask_repeat_type = RepeatNone;
+
+    fixed_block_width = dest_pixmap_priv->large.block_w;
+    fixed_block_height = dest_pixmap_priv->large.block_h;
+    /* If we got an totally out-of-box region for a source or mask
+     * region without repeat, we need to set it as null_source and
+     * give it a solid color (0,0,0,0). */
+    null_source = 0;
+    null_mask = 0;
+    RegionTranslate(region, -dest->pDrawable->x, -dest->pDrawable->y);
+
+    /* need to transform the dest region to the correct sourcei/mask region.
+     * it's a little complex, as one single edge of the
+     * target region may be transformed to cross a block boundary of the
+     * source or mask. Then it's impossible to handle it as usual way.
+     * We may have to split the original dest region to smaller region, and
+     * make sure each region's transformed region can fit into one texture,
+     * and then continue this loop again, and each time when a transformed region
+     * cross the bound, we need to copy it to a single pixmap and do the composition
+     * with the new pixmap. If the transformed region doesn't cross a source/mask's
+     * boundary then we don't need to copy.
+     *
+     */
+    if (source_pixmap_priv
+        && source->transform
+        && source_pixmap_priv->type == GLAMOR_TEXTURE_LARGE) {
+        int source_transformed_block_width, source_transformed_block_height;
+
+        if (!glamor_get_transform_block_size(source->transform,
+                                             source_pixmap_priv->large.block_w,
+                                             source_pixmap_priv->large.block_h,
+                                             &source_transformed_block_width,
+                                             &source_transformed_block_height))
+        {
+            DEBUGF("source block size less than 1, fallback.\n");
+            RegionTranslate(region, dest->pDrawable->x, dest->pDrawable->y);
+            return FALSE;
+        }
+        fixed_block_width =
+            min(fixed_block_width, source_transformed_block_width);
+        fixed_block_height =
+            min(fixed_block_height, source_transformed_block_height);
+        DEBUGF("new source block size %d x %d \n", fixed_block_width,
+               fixed_block_height);
+    }
+
+    if (mask_pixmap_priv
+        && mask->transform && mask_pixmap_priv->type == GLAMOR_TEXTURE_LARGE) {
+        int mask_transformed_block_width, mask_transformed_block_height;
+
+        if (!glamor_get_transform_block_size(mask->transform,
+                                             mask_pixmap_priv->large.block_w,
+                                             mask_pixmap_priv->large.block_h,
+                                             &mask_transformed_block_width,
+                                             &mask_transformed_block_height)) {
+            DEBUGF("mask block size less than 1, fallback.\n");
+            RegionTranslate(region, dest->pDrawable->x, dest->pDrawable->y);
+            return FALSE;
+        }
+        fixed_block_width =
+            min(fixed_block_width, mask_transformed_block_width);
+        fixed_block_height =
+            min(fixed_block_height, mask_transformed_block_height);
+        DEBUGF("new mask block size %d x %d \n", fixed_block_width,
+               fixed_block_height);
+    }
+
+    /*compute the correct block width and height whose transformed source/mask
+     *region can fit into one texture.*/
+    if (force_clip || fixed_block_width < dest_pixmap_priv->large.block_w
+        || fixed_block_height < dest_pixmap_priv->large.block_h)
+        clipped_dest_regions =
+            glamor_compute_clipped_regions_ext(dest_pixmap_priv, region,
+                                               &n_dest_regions,
+                                               fixed_block_width,
+                                               fixed_block_height, 0, 0);
+    else
+        clipped_dest_regions = glamor_compute_clipped_regions(dest_pixmap_priv,
+                                                              region,
+                                                              &n_dest_regions,
+                                                              0, 0, 0);
+    DEBUGF("dest clipped result %d region: \n", n_dest_regions);
+    if (source_pixmap_priv
+        && (source_pixmap_priv == dest_pixmap_priv ||
+            source_pixmap_priv == mask_pixmap_priv)
+        && source_pixmap_priv->type == GLAMOR_TEXTURE_LARGE) {
+        /* XXX self-copy... */
+        need_free_source_pixmap_priv = source_pixmap_priv;
+        source_pixmap_priv = malloc(sizeof(*source_pixmap_priv));
+        *source_pixmap_priv = *need_free_source_pixmap_priv;
+        need_free_source_pixmap_priv = source_pixmap_priv;
+    }
+    assert(mask_pixmap_priv != dest_pixmap_priv);
+
+    for (i = 0; i < n_dest_regions; i++) {
+        DEBUGF("dest region %d  idx %d\n", i,
+               clipped_dest_regions[i].block_idx);
+        DEBUGRegionPrint(clipped_dest_regions[i].region);
+        SET_PIXMAP_FBO_CURRENT(dest_pixmap_priv,
+                               clipped_dest_regions[i].block_idx);
+        if (source_pixmap_priv &&
+            source_pixmap_priv->type == GLAMOR_TEXTURE_LARGE) {
+            if (!source->transform && source_repeat_type != RepeatPad) {
+                RegionTranslate(clipped_dest_regions[i].region,
+                                x_source - x_dest, y_source - y_dest);
+                clipped_source_regions =
+                    glamor_compute_clipped_regions(source_pixmap_priv,
+                                                   clipped_dest_regions[i].
+                                                   region, &n_source_regions,
+                                                   source_repeat_type, 0, 0);
+                is_normal_source_fbo = 1;
+            }
+            else {
+                clipped_source_regions =
+                    glamor_compute_transform_clipped_regions(source_pixmap_priv,
+                                                             source->transform,
+                                                             clipped_dest_regions
+                                                             [i].region,
+                                                             &n_source_regions,
+                                                             x_source - x_dest,
+                                                             y_source - y_dest,
+                                                             source_repeat_type,
+                                                             0, 0);
+                is_normal_source_fbo = 0;
+                if (n_source_regions == 0) {
+                    /* Pad the out-of-box region to (0,0,0,0). */
+                    null_source = 1;
+                    n_source_regions = 1;
+                }
+                else
+                    _glamor_process_transformed_clipped_region
+                        (source_pixmap_priv, source_repeat_type,
+                         clipped_source_regions, &n_source_regions,
+                         &need_clean_source_fbo);
+            }
+            DEBUGF("source clipped result %d region: \n", n_source_regions);
+            for (j = 0; j < n_source_regions; j++) {
+                if (is_normal_source_fbo)
+                    SET_PIXMAP_FBO_CURRENT(source_pixmap_priv,
+                                           clipped_source_regions[j].block_idx);
+
+                if (mask_pixmap_priv &&
+                    mask_pixmap_priv->type == GLAMOR_TEXTURE_LARGE) {
+                    if (is_normal_mask_fbo && is_normal_source_fbo) {
+                        /* both mask and source are normal fbo box without transform or repeatpad.
+                         * The region is clipped against source and then we clip it against mask here.*/
+                        DEBUGF("source region %d  idx %d\n", j,
+                               clipped_source_regions[j].block_idx);
+                        DEBUGRegionPrint(clipped_source_regions[j].region);
+                        RegionTranslate(clipped_source_regions[j].region,
+                                        -x_source + x_mask, -y_source + y_mask);
+                        clipped_mask_regions =
+                            glamor_compute_clipped_regions(mask_pixmap_priv,
+                                                           clipped_source_regions
+                                                           [j].region,
+                                                           &n_mask_regions,
+                                                           mask_repeat_type, 0,
+                                                           0);
+                        is_normal_mask_fbo = 1;
+                    }
+                    else if (is_normal_mask_fbo && !is_normal_source_fbo) {
+                        assert(n_source_regions == 1);
+                        /* The source fbo is not a normal fbo box, it has transform or repeatpad.
+                         * the valid clip region should be the clip dest region rather than the
+                         * clip source region.*/
+                        RegionTranslate(clipped_dest_regions[i].region,
+                                        -x_dest + x_mask, -y_dest + y_mask);
+                        clipped_mask_regions =
+                            glamor_compute_clipped_regions(mask_pixmap_priv,
+                                                           clipped_dest_regions
+                                                           [i].region,
+                                                           &n_mask_regions,
+                                                           mask_repeat_type, 0,
+                                                           0);
+                        is_normal_mask_fbo = 1;
+                    }
+                    else {
+                        /* This mask region has transform or repeatpad, we need clip it agains the previous
+                         * valid region rather than the mask region. */
+                        if (!is_normal_source_fbo)
+                            clipped_mask_regions =
+                                glamor_compute_transform_clipped_regions
+                                (mask_pixmap_priv, mask->transform,
+                                 clipped_dest_regions[i].region,
+                                 &n_mask_regions, x_mask - x_dest,
+                                 y_mask - y_dest, mask_repeat_type, 0, 0);
+                        else
+                            clipped_mask_regions =
+                                glamor_compute_transform_clipped_regions
+                                (mask_pixmap_priv, mask->transform,
+                                 clipped_source_regions[j].region,
+                                 &n_mask_regions, x_mask - x_source,
+                                 y_mask - y_source, mask_repeat_type, 0, 0);
+                        is_normal_mask_fbo = 0;
+                        if (n_mask_regions == 0) {
+                            /* Pad the out-of-box region to (0,0,0,0). */
+                            null_mask = 1;
+                            n_mask_regions = 1;
+                        }
+                        else
+                            _glamor_process_transformed_clipped_region
+                                (mask_pixmap_priv, mask_repeat_type,
+                                 clipped_mask_regions, &n_mask_regions,
+                                 &need_clean_mask_fbo);
+                    }
+                    DEBUGF("mask clipped result %d region: \n", n_mask_regions);
+
+#define COMPOSITE_REGION(region) do {                          \
+       if (!glamor_composite_clipped_region(op,                \
+                        null_source ? NULL : source,           \
+                        null_mask ? NULL : mask, dest,         \
+                        null_source ? NULL : source_pixmap_priv, \
+                        null_mask ? NULL : mask_pixmap_priv,   \
+                        dest_pixmap_priv, region,              \
+                        x_source, y_source, x_mask, y_mask,    \
+                        x_dest, y_dest)) {                     \
+               assert(0);                                      \
+       }                                                       \
+   } while(0)
+
+                    for (k = 0; k < n_mask_regions; k++) {
+                        DEBUGF("mask region %d  idx %d\n", k,
+                               clipped_mask_regions[k].block_idx);
+                        DEBUGRegionPrint(clipped_mask_regions[k].region);
+                        if (is_normal_mask_fbo) {
+                            SET_PIXMAP_FBO_CURRENT(mask_pixmap_priv,
+                                                   clipped_mask_regions[k].
+                                                   block_idx);
+                            DEBUGF("mask fbo off %d %d \n",
+                                   mask_pixmap_priv->large.box.x1,
+                                   mask_pixmap_priv->large.box.y1);
+                            DEBUGF("start composite mask hasn't transform.\n");
+                            RegionTranslate(clipped_mask_regions[k].region,
+                                            x_dest - x_mask +
+                                            dest->pDrawable->x,
+                                            y_dest - y_mask +
+                                            dest->pDrawable->y);
+                            COMPOSITE_REGION(clipped_mask_regions[k].region);
+                        }
+                        else if (!is_normal_mask_fbo && !is_normal_source_fbo) {
+                            DEBUGF
+                                ("start composite both mask and source have transform.\n");
+                            RegionTranslate(clipped_dest_regions[i].region,
+                                            dest->pDrawable->x,
+                                            dest->pDrawable->y);
+                            COMPOSITE_REGION(clipped_dest_regions[i].region);
+                        }
+                        else {
+                            DEBUGF
+                                ("start composite only mask has transform.\n");
+                            RegionTranslate(clipped_source_regions[j].region,
+                                            x_dest - x_source +
+                                            dest->pDrawable->x,
+                                            y_dest - y_source +
+                                            dest->pDrawable->y);
+                            COMPOSITE_REGION(clipped_source_regions[j].region);
+                        }
+                        RegionDestroy(clipped_mask_regions[k].region);
+                    }
+                    free(clipped_mask_regions);
+                    if (null_mask)
+                        null_mask = 0;
+                    if (need_clean_mask_fbo) {
+                        assert(is_normal_mask_fbo == 0);
+                        glamor_destroy_fbo(mask_pixmap_priv->base.fbo);
+                        mask_pixmap_priv->base.fbo = NULL;
+                        need_clean_mask_fbo = 0;
+                    }
+                }
+                else {
+                    if (is_normal_source_fbo) {
+                        RegionTranslate(clipped_source_regions[j].region,
+                                        -x_source + x_dest + dest->pDrawable->x,
+                                        -y_source + y_dest +
+                                        dest->pDrawable->y);
+                        COMPOSITE_REGION(clipped_source_regions[j].region);
+                    }
+                    else {
+                        /* Source has transform or repeatPad. dest regions is the right
+                         * region to do the composite. */
+                        RegionTranslate(clipped_dest_regions[i].region,
+                                        dest->pDrawable->x, dest->pDrawable->y);
+                        COMPOSITE_REGION(clipped_dest_regions[i].region);
+                    }
+                }
+                if (clipped_source_regions && clipped_source_regions[j].region)
+                    RegionDestroy(clipped_source_regions[j].region);
+            }
+            free(clipped_source_regions);
+            if (null_source)
+                null_source = 0;
+            if (need_clean_source_fbo) {
+                assert(is_normal_source_fbo == 0);
+                glamor_destroy_fbo(source_pixmap_priv->base.fbo);
+                source_pixmap_priv->base.fbo = NULL;
+                need_clean_source_fbo = 0;
+            }
+        }
+        else {
+            if (mask_pixmap_priv &&
+                mask_pixmap_priv->type == GLAMOR_TEXTURE_LARGE) {
+                if (!mask->transform && mask_repeat_type != RepeatPad) {
+                    RegionTranslate(clipped_dest_regions[i].region,
+                                    x_mask - x_dest, y_mask - y_dest);
+                    clipped_mask_regions =
+                        glamor_compute_clipped_regions(mask_pixmap_priv,
+                                                       clipped_dest_regions[i].
+                                                       region, &n_mask_regions,
+                                                       mask_repeat_type, 0, 0);
+                    is_normal_mask_fbo = 1;
+                }
+                else {
+                    clipped_mask_regions =
+                        glamor_compute_transform_clipped_regions
+                        (mask_pixmap_priv, mask->transform,
+                         clipped_dest_regions[i].region, &n_mask_regions,
+                         x_mask - x_dest, y_mask - y_dest, mask_repeat_type, 0,
+                         0);
+                    is_normal_mask_fbo = 0;
+                    if (n_mask_regions == 0) {
+                        /* Pad the out-of-box region to (0,0,0,0). */
+                        null_mask = 1;
+                        n_mask_regions = 1;
+                    }
+                    else
+                        _glamor_process_transformed_clipped_region
+                            (mask_pixmap_priv, mask_repeat_type,
+                             clipped_mask_regions, &n_mask_regions,
+                             &need_clean_mask_fbo);
+                }
+
+                for (k = 0; k < n_mask_regions; k++) {
+                    DEBUGF("mask region %d  idx %d\n", k,
+                           clipped_mask_regions[k].block_idx);
+                    DEBUGRegionPrint(clipped_mask_regions[k].region);
+                    if (is_normal_mask_fbo) {
+                        SET_PIXMAP_FBO_CURRENT(mask_pixmap_priv,
+                                               clipped_mask_regions[k].
+                                               block_idx);
+                        RegionTranslate(clipped_mask_regions[k].region,
+                                        x_dest - x_mask + dest->pDrawable->x,
+                                        y_dest - y_mask + dest->pDrawable->y);
+                        COMPOSITE_REGION(clipped_mask_regions[k].region);
+                    }
+                    else {
+                        RegionTranslate(clipped_dest_regions[i].region,
+                                        dest->pDrawable->x, dest->pDrawable->y);
+                        COMPOSITE_REGION(clipped_dest_regions[i].region);
+                    }
+                    RegionDestroy(clipped_mask_regions[k].region);
+                }
+                free(clipped_mask_regions);
+                if (null_mask)
+                    null_mask = 0;
+                if (need_clean_mask_fbo) {
+                    glamor_destroy_fbo(mask_pixmap_priv->base.fbo);
+                    mask_pixmap_priv->base.fbo = NULL;
+                    need_clean_mask_fbo = 0;
+                }
+            }
+            else {
+                RegionTranslate(clipped_dest_regions[i].region,
+                                dest->pDrawable->x, dest->pDrawable->y);
+                COMPOSITE_REGION(clipped_dest_regions[i].region);
+            }
+        }
+        RegionDestroy(clipped_dest_regions[i].region);
+    }
+    free(clipped_dest_regions);
+    free(need_free_source_pixmap_priv);
+    free(need_free_mask_pixmap_priv);
+    ok = TRUE;
+    return ok;
+}
diff --git a/glamor/glamor_picture.c b/glamor/glamor_picture.c
new file mode 100644 (file)
index 0000000..5fdc5f9
--- /dev/null
@@ -0,0 +1,131 @@
+/*
+ * Copyright Â© 2009 Intel Corporation
+ * Copyright Â© 1998 Keith Packard
+ *
+ * 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.
+ *
+ * Authors:
+ *    Zhigang Gong <zhigang.gong@gmail.com>
+ *
+ */
+
+#include <stdlib.h>
+
+#include "glamor_priv.h"
+#include "mipict.h"
+
+/* Upload picture to texture.  We may need to flip the y axis or
+ * wire alpha to 1. So we may conditional create fbo for the picture.
+ * */
+enum glamor_pixmap_status
+glamor_upload_picture_to_texture(PicturePtr picture)
+{
+    PixmapPtr pixmap;
+
+    assert(picture->pDrawable);
+    pixmap = glamor_get_drawable_pixmap(picture->pDrawable);
+
+    return glamor_upload_pixmap_to_texture(pixmap);
+}
+
+Bool
+glamor_prepare_access_picture(PicturePtr picture, glamor_access_t access)
+{
+    if (!picture || !picture->pDrawable)
+        return TRUE;
+
+    return glamor_prepare_access(picture->pDrawable, access);
+}
+
+void
+glamor_finish_access_picture(PicturePtr picture)
+{
+    if (!picture || !picture->pDrawable)
+        return;
+
+    glamor_finish_access(picture->pDrawable);
+}
+
+/* 
+ * We should already have drawable attached to it, if it has one.
+ * Then set the attached pixmap to is_picture format, and set
+ * the pict format.
+ * */
+int
+glamor_create_picture(PicturePtr picture)
+{
+    PixmapPtr pixmap;
+    glamor_pixmap_private *pixmap_priv;
+
+    if (!picture || !picture->pDrawable)
+        return 0;
+
+    pixmap = glamor_get_drawable_pixmap(picture->pDrawable);
+    pixmap_priv = glamor_get_pixmap_private(pixmap);
+    if (!pixmap_priv) {
+        /* We must create a pixmap priv to track the picture format even
+         * if the pixmap is a pure in memory pixmap. The reason is that
+         * we may need to upload this pixmap to a texture on the fly. During
+         * the uploading, we need to know the picture format. */
+        glamor_set_pixmap_type(pixmap, GLAMOR_MEMORY);
+        pixmap_priv = glamor_get_pixmap_private(pixmap);
+    }
+    else {
+        if (GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv)) {
+            /* If the picture format is not compatible with glamor fbo format,
+             * we have to mark this pixmap as a separated texture, and don't
+             * fallback to DDX layer. */
+            if (pixmap_priv->type == GLAMOR_TEXTURE_DRM
+                && !glamor_pict_format_is_compatible(picture))
+                glamor_set_pixmap_type(pixmap, GLAMOR_SEPARATE_TEXTURE);
+        }
+    }
+
+    pixmap_priv->base.is_picture = 1;
+    pixmap_priv->base.picture = picture;
+
+    return miCreatePicture(picture);
+}
+
+void
+glamor_destroy_picture(PicturePtr picture)
+{
+    PixmapPtr pixmap;
+    glamor_pixmap_private *pixmap_priv;
+
+    if (!picture || !picture->pDrawable)
+        return;
+
+    pixmap = glamor_get_drawable_pixmap(picture->pDrawable);
+    pixmap_priv = glamor_get_pixmap_private(pixmap);
+
+    if (pixmap_priv) {
+        pixmap_priv->base.is_picture = 0;
+        pixmap_priv->base.picture = NULL;
+    }
+    miDestroyPicture(picture);
+}
+
+void
+glamor_picture_format_fixup(PicturePtr picture,
+                            glamor_pixmap_private *pixmap_priv)
+{
+    pixmap_priv->base.picture = picture;
+}
diff --git a/glamor/glamor_pixmap.c b/glamor/glamor_pixmap.c
new file mode 100644 (file)
index 0000000..789d377
--- /dev/null
@@ -0,0 +1,1689 @@
+/*
+ * Copyright Â© 2001 Keith Packard
+ * Copyright Â© 2008 Intel 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.
+ *
+ * Authors:
+ *    Eric Anholt <eric@anholt.net>
+ *    Zhigang Gong <zhigang.gong@linux.intel.com>
+ *
+ */
+
+#include <stdlib.h>
+
+#include "glamor_priv.h"
+/**
+ * Sets the offsets to add to coordinates to make them address the same bits in
+ * the backing drawable. These coordinates are nonzero only for redirected
+ * windows.
+ */
+void
+glamor_get_drawable_deltas(DrawablePtr drawable, PixmapPtr pixmap,
+                           int *x, int *y)
+{
+#ifdef COMPOSITE
+    if (drawable->type == DRAWABLE_WINDOW) {
+        *x = -pixmap->screen_x;
+        *y = -pixmap->screen_y;
+        return;
+    }
+#endif
+
+    *x = 0;
+    *y = 0;
+}
+
+void
+glamor_pixmap_init(ScreenPtr screen)
+{
+
+}
+
+void
+glamor_pixmap_fini(ScreenPtr screen)
+{
+}
+
+void
+glamor_set_destination_pixmap_fbo(glamor_pixmap_fbo *fbo, int x0, int y0,
+                                  int width, int height)
+{
+    glamor_make_current(fbo->glamor_priv);
+
+    glBindFramebuffer(GL_FRAMEBUFFER, fbo->fb);
+    glViewport(x0, y0, width, height);
+}
+
+void
+glamor_set_destination_pixmap_priv_nc(glamor_pixmap_private *pixmap_priv)
+{
+    int w, h;
+
+    PIXMAP_PRIV_GET_ACTUAL_SIZE(pixmap_priv, w, h);
+    glamor_set_destination_pixmap_fbo(pixmap_priv->base.fbo, 0, 0, w, h);
+}
+
+int
+glamor_set_destination_pixmap_priv(glamor_pixmap_private *pixmap_priv)
+{
+    if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv))
+        return -1;
+
+    glamor_set_destination_pixmap_priv_nc(pixmap_priv);
+    return 0;
+}
+
+int
+glamor_set_destination_pixmap(PixmapPtr pixmap)
+{
+    int err;
+    glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap);
+
+    err = glamor_set_destination_pixmap_priv(pixmap_priv);
+    return err;
+}
+
+Bool
+glamor_set_planemask(PixmapPtr pixmap, unsigned long planemask)
+{
+    if (glamor_pm_is_solid(&pixmap->drawable, planemask)) {
+        return GL_TRUE;
+    }
+
+    glamor_fallback("unsupported planemask %lx\n", planemask);
+    return GL_FALSE;
+}
+
+Bool
+glamor_set_alu(ScreenPtr screen, unsigned char alu)
+{
+    glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
+
+    if (glamor_priv->gl_flavor == GLAMOR_GL_ES2) {
+        if (alu != GXcopy)
+            return FALSE;
+        else
+            return TRUE;
+    }
+
+    if (alu == GXcopy) {
+        glDisable(GL_COLOR_LOGIC_OP);
+        return TRUE;
+    }
+    glEnable(GL_COLOR_LOGIC_OP);
+    switch (alu) {
+    case GXclear:
+        glLogicOp(GL_CLEAR);
+        break;
+    case GXand:
+        glLogicOp(GL_AND);
+        break;
+    case GXandReverse:
+        glLogicOp(GL_AND_REVERSE);
+        break;
+    case GXandInverted:
+        glLogicOp(GL_AND_INVERTED);
+        break;
+    case GXnoop:
+        glLogicOp(GL_NOOP);
+        break;
+    case GXxor:
+        glLogicOp(GL_XOR);
+        break;
+    case GXor:
+        glLogicOp(GL_OR);
+        break;
+    case GXnor:
+        glLogicOp(GL_NOR);
+        break;
+    case GXequiv:
+        glLogicOp(GL_EQUIV);
+        break;
+    case GXinvert:
+        glLogicOp(GL_INVERT);
+        break;
+    case GXorReverse:
+        glLogicOp(GL_OR_REVERSE);
+        break;
+    case GXcopyInverted:
+        glLogicOp(GL_COPY_INVERTED);
+        break;
+    case GXorInverted:
+        glLogicOp(GL_OR_INVERTED);
+        break;
+    case GXnand:
+        glLogicOp(GL_NAND);
+        break;
+    case GXset:
+        glLogicOp(GL_SET);
+        break;
+    default:
+        glamor_fallback("unsupported alu %x\n", alu);
+        return FALSE;
+    }
+
+    return TRUE;
+}
+
+/*
+ * Map picture's format to the correct gl texture format and type.
+ * no_alpha is used to indicate whehter we need to wire alpha to 1.
+ *
+ * Although opengl support A1/GL_BITMAP, we still don't use it
+ * here, it seems that mesa has bugs when uploading a A1 bitmap.
+ *
+ * Return 0 if find a matched texture type. Otherwise return -1.
+ **/
+static int
+glamor_get_tex_format_type_from_pictformat_gl(PictFormatShort format,
+                                              GLenum *tex_format,
+                                              GLenum *tex_type,
+                                              int *no_alpha,
+                                              int *revert,
+                                              int *swap_rb, int is_upload)
+{
+    *no_alpha = 0;
+    *revert = REVERT_NONE;
+    *swap_rb = is_upload ? SWAP_NONE_UPLOADING : SWAP_NONE_DOWNLOADING;
+    switch (format) {
+    case PICT_a1:
+        *tex_format = GL_ALPHA;
+        *tex_type = GL_UNSIGNED_BYTE;
+        *revert = is_upload ? REVERT_UPLOADING_A1 : REVERT_DOWNLOADING_A1;
+        break;
+    case PICT_b8g8r8x8:
+        *no_alpha = 1;
+    case PICT_b8g8r8a8:
+        *tex_format = GL_BGRA;
+        *tex_type = GL_UNSIGNED_INT_8_8_8_8;
+        break;
+
+    case PICT_x8r8g8b8:
+        *no_alpha = 1;
+    case PICT_a8r8g8b8:
+        *tex_format = GL_BGRA;
+        *tex_type = GL_UNSIGNED_INT_8_8_8_8_REV;
+        break;
+    case PICT_x8b8g8r8:
+        *no_alpha = 1;
+    case PICT_a8b8g8r8:
+        *tex_format = GL_RGBA;
+        *tex_type = GL_UNSIGNED_INT_8_8_8_8_REV;
+        break;
+    case PICT_x2r10g10b10:
+        *no_alpha = 1;
+    case PICT_a2r10g10b10:
+        *tex_format = GL_BGRA;
+        *tex_type = GL_UNSIGNED_INT_2_10_10_10_REV;
+        break;
+    case PICT_x2b10g10r10:
+        *no_alpha = 1;
+    case PICT_a2b10g10r10:
+        *tex_format = GL_RGBA;
+        *tex_type = GL_UNSIGNED_INT_2_10_10_10_REV;
+        break;
+
+    case PICT_r5g6b5:
+        *tex_format = GL_RGB;
+        *tex_type = GL_UNSIGNED_SHORT_5_6_5;
+        break;
+    case PICT_b5g6r5:
+        *tex_format = GL_RGB;
+        *tex_type = GL_UNSIGNED_SHORT_5_6_5_REV;
+        break;
+    case PICT_x1b5g5r5:
+        *no_alpha = 1;
+    case PICT_a1b5g5r5:
+        *tex_format = GL_RGBA;
+        *tex_type = GL_UNSIGNED_SHORT_1_5_5_5_REV;
+        break;
+
+    case PICT_x1r5g5b5:
+        *no_alpha = 1;
+    case PICT_a1r5g5b5:
+        *tex_format = GL_BGRA;
+        *tex_type = GL_UNSIGNED_SHORT_1_5_5_5_REV;
+        break;
+    case PICT_a8:
+        *tex_format = GL_ALPHA;
+        *tex_type = GL_UNSIGNED_BYTE;
+        break;
+    case PICT_x4r4g4b4:
+        *no_alpha = 1;
+    case PICT_a4r4g4b4:
+        *tex_format = GL_BGRA;
+        *tex_type = GL_UNSIGNED_SHORT_4_4_4_4_REV;
+        break;
+
+    case PICT_x4b4g4r4:
+        *no_alpha = 1;
+    case PICT_a4b4g4r4:
+        *tex_format = GL_RGBA;
+        *tex_type = GL_UNSIGNED_SHORT_4_4_4_4_REV;
+        break;
+
+    default:
+        return -1;
+    }
+    return 0;
+}
+
+#define IS_LITTLE_ENDIAN  (IMAGE_BYTE_ORDER == LSBFirst)
+
+static int
+glamor_get_tex_format_type_from_pictformat_gles2(PictFormatShort format,
+                                                 GLenum *tex_format,
+                                                 GLenum *tex_type,
+                                                 int *no_alpha,
+                                                 int *revert,
+                                                 int *swap_rb, int is_upload)
+{
+    int need_swap_rb = 0;
+
+    *no_alpha = 0;
+    *revert = IS_LITTLE_ENDIAN ? REVERT_NONE : REVERT_NORMAL;
+
+    switch (format) {
+    case PICT_b8g8r8x8:
+        *no_alpha = 1;
+    case PICT_b8g8r8a8:
+        *tex_format = GL_RGBA;
+        *tex_type = GL_UNSIGNED_BYTE;
+        need_swap_rb = 1;
+        *revert = IS_LITTLE_ENDIAN ? REVERT_NORMAL : REVERT_NONE;
+        break;
+
+    case PICT_x8r8g8b8:
+        *no_alpha = 1;
+    case PICT_a8r8g8b8:
+        *tex_format = GL_RGBA;
+        *tex_type = GL_UNSIGNED_BYTE;
+        need_swap_rb = 1;
+        break;
+
+    case PICT_x8b8g8r8:
+        *no_alpha = 1;
+    case PICT_a8b8g8r8:
+        *tex_format = GL_RGBA;
+        *tex_type = GL_UNSIGNED_BYTE;
+        break;
+
+    case PICT_x2r10g10b10:
+        *no_alpha = 1;
+    case PICT_a2r10g10b10:
+        *tex_format = GL_RGBA;
+        /* glReadPixmap doesn't support GL_UNSIGNED_INT_10_10_10_2.
+         * we have to use GL_UNSIGNED_BYTE and do the conversion in
+         * shader latter.*/
+        *tex_type = GL_UNSIGNED_BYTE;
+        if (is_upload == 1) {
+            if (!IS_LITTLE_ENDIAN)
+                *revert = REVERT_UPLOADING_10_10_10_2;
+            else
+                *revert = REVERT_UPLOADING_2_10_10_10;
+        }
+        else {
+            if (!IS_LITTLE_ENDIAN) {
+                *revert = REVERT_DOWNLOADING_10_10_10_2;
+            }
+            else {
+                *revert = REVERT_DOWNLOADING_2_10_10_10;
+            }
+        }
+        need_swap_rb = 1;
+
+        break;
+
+    case PICT_x2b10g10r10:
+        *no_alpha = 1;
+    case PICT_a2b10g10r10:
+        *tex_format = GL_RGBA;
+        *tex_type = GL_UNSIGNED_BYTE;
+        if (is_upload == 1) {
+            if (!IS_LITTLE_ENDIAN)
+                *revert = REVERT_UPLOADING_10_10_10_2;
+            else
+                *revert = REVERT_UPLOADING_2_10_10_10;
+        }
+        else {
+            if (!IS_LITTLE_ENDIAN) {
+                *revert = REVERT_DOWNLOADING_10_10_10_2;
+            }
+            else {
+                *revert = REVERT_DOWNLOADING_2_10_10_10;
+            }
+        }
+        break;
+
+    case PICT_r5g6b5:
+        *tex_format = GL_RGB;
+        *tex_type = GL_UNSIGNED_SHORT_5_6_5;
+        *revert = IS_LITTLE_ENDIAN ? REVERT_NONE : REVERT_NORMAL;
+
+        break;
+
+    case PICT_b5g6r5:
+        *tex_format = GL_RGB;
+        *tex_type = GL_UNSIGNED_SHORT_5_6_5;
+        need_swap_rb = IS_LITTLE_ENDIAN ? 1 : 0;;
+        break;
+
+    case PICT_x1b5g5r5:
+        *no_alpha = 1;
+    case PICT_a1b5g5r5:
+        *tex_format = GL_RGBA;
+        *tex_type = GL_UNSIGNED_SHORT_5_5_5_1;
+        if (IS_LITTLE_ENDIAN) {
+            *revert =
+                is_upload ? REVERT_UPLOADING_1_5_5_5 :
+                REVERT_DOWNLOADING_1_5_5_5;
+        }
+        else
+            *revert = REVERT_NONE;
+        break;
+
+    case PICT_x1r5g5b5:
+        *no_alpha = 1;
+    case PICT_a1r5g5b5:
+        *tex_format = GL_RGBA;
+        *tex_type = GL_UNSIGNED_SHORT_5_5_5_1;
+        if (IS_LITTLE_ENDIAN) {
+            *revert =
+                is_upload ? REVERT_UPLOADING_1_5_5_5 :
+                REVERT_DOWNLOADING_1_5_5_5;
+        }
+        else
+            *revert = REVERT_NONE;
+        need_swap_rb = 1;
+        break;
+
+    case PICT_a1:
+        *tex_format = GL_ALPHA;
+        *tex_type = GL_UNSIGNED_BYTE;
+        *revert = is_upload ? REVERT_UPLOADING_A1 : REVERT_DOWNLOADING_A1;
+        break;
+
+    case PICT_a8:
+        *tex_format = GL_ALPHA;
+        *tex_type = GL_UNSIGNED_BYTE;
+        *revert = REVERT_NONE;
+        break;
+
+    case PICT_x4r4g4b4:
+        *no_alpha = 1;
+    case PICT_a4r4g4b4:
+        *tex_format = GL_RGBA;
+        *tex_type = GL_UNSIGNED_SHORT_4_4_4_4;
+        *revert = IS_LITTLE_ENDIAN ? REVERT_NORMAL : REVERT_NONE;
+        need_swap_rb = 1;
+        break;
+
+    case PICT_x4b4g4r4:
+        *no_alpha = 1;
+    case PICT_a4b4g4r4:
+        *tex_format = GL_RGBA;
+        *tex_type = GL_UNSIGNED_SHORT_4_4_4_4;
+        *revert = IS_LITTLE_ENDIAN ? REVERT_NORMAL : REVERT_NONE;
+        break;
+
+    default:
+        LogMessageVerb(X_INFO, 0,
+                       "fail to get matched format for %x \n", format);
+        return -1;
+    }
+
+    if (need_swap_rb)
+        *swap_rb = is_upload ? SWAP_UPLOADING : SWAP_DOWNLOADING;
+    else
+        *swap_rb = is_upload ? SWAP_NONE_UPLOADING : SWAP_NONE_DOWNLOADING;
+    return 0;
+}
+
+static int
+glamor_get_tex_format_type_from_pixmap(PixmapPtr pixmap,
+                                       GLenum *format,
+                                       GLenum *type,
+                                       int *no_alpha,
+                                       int *revert, int *swap_rb, int is_upload)
+{
+    glamor_pixmap_private *pixmap_priv;
+    PictFormatShort pict_format;
+    glamor_screen_private *glamor_priv =
+        glamor_get_screen_private(pixmap->drawable.pScreen);
+
+    pixmap_priv = glamor_get_pixmap_private(pixmap);
+    if (GLAMOR_PIXMAP_PRIV_IS_PICTURE(pixmap_priv))
+        pict_format = pixmap_priv->base.picture->format;
+    else
+        pict_format = format_for_depth(pixmap->drawable.depth);
+
+    if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) {
+        return glamor_get_tex_format_type_from_pictformat_gl(pict_format,
+                                                             format, type,
+                                                             no_alpha,
+                                                             revert,
+                                                             swap_rb,
+                                                             is_upload);
+    } else {
+        return glamor_get_tex_format_type_from_pictformat_gles2(pict_format,
+                                                                format, type,
+                                                                no_alpha,
+                                                                revert,
+                                                                swap_rb,
+                                                                is_upload);
+    }
+}
+
+static void *
+_glamor_color_convert_a1_a8(void *src_bits, void *dst_bits, int w, int h,
+                            int stride, int revert)
+{
+    PictFormatShort dst_format, src_format;
+    pixman_image_t *dst_image;
+    pixman_image_t *src_image;
+    int src_stride;
+
+    if (revert == REVERT_UPLOADING_A1) {
+        src_format = PICT_a1;
+        dst_format = PICT_a8;
+        src_stride = PixmapBytePad(w, 1);
+    }
+    else {
+        dst_format = PICT_a1;
+        src_format = PICT_a8;
+        src_stride = (((w * 8 + 7) / 8) + 3) & ~3;
+    }
+
+    dst_image = pixman_image_create_bits(dst_format, w, h, dst_bits, stride);
+    if (dst_image == NULL) {
+        return NULL;
+    }
+
+    src_image = pixman_image_create_bits(src_format,
+                                         w, h, src_bits, src_stride);
+
+    if (src_image == NULL) {
+        pixman_image_unref(dst_image);
+        return NULL;
+    }
+
+    pixman_image_composite(PictOpSrc, src_image, NULL, dst_image,
+                           0, 0, 0, 0, 0, 0, w, h);
+
+    pixman_image_unref(src_image);
+    pixman_image_unref(dst_image);
+    return dst_bits;
+}
+
+#define ADJUST_BITS(d, src_bits, dst_bits)     (((dst_bits) == (src_bits)) ? (d) :                             \
+                                                       (((dst_bits) > (src_bits)) ?                            \
+                                                         (((d) << ((dst_bits) - (src_bits)))                   \
+                                                                  + (( 1 << ((dst_bits) - (src_bits))) >> 1))  \
+                                                               :  ((d) >> ((src_bits) - (dst_bits)))))
+
+#define GLAMOR_DO_CONVERT(src, dst, no_alpha, swap,            \
+                         a_shift_src, a_bits_src,              \
+                         b_shift_src, b_bits_src,              \
+                         g_shift_src, g_bits_src,              \
+                         r_shift_src, r_bits_src,              \
+                         a_shift, a_bits,                      \
+                         b_shift, b_bits,                      \
+                         g_shift, g_bits,                      \
+                         r_shift, r_bits)                      \
+       do {                                                            \
+               typeof(src) a,b,g,r;                                    \
+               typeof(src) a_mask_src, b_mask_src, g_mask_src, r_mask_src;\
+               a_mask_src = (((1 << (a_bits_src)) - 1) << a_shift_src);\
+               b_mask_src = (((1 << (b_bits_src)) - 1) << b_shift_src);\
+               g_mask_src = (((1 << (g_bits_src)) - 1) << g_shift_src);\
+               r_mask_src = (((1 << (r_bits_src)) - 1) << r_shift_src);\
+               if (no_alpha)                                           \
+                       a = (a_mask_src) >> (a_shift_src);                      \
+               else                                                    \
+                       a = ((src) & (a_mask_src)) >> (a_shift_src);    \
+               b = ((src) & (b_mask_src)) >> (b_shift_src);            \
+               g = ((src) & (g_mask_src)) >> (g_shift_src);            \
+               r = ((src) & (r_mask_src)) >> (r_shift_src);            \
+               a = ADJUST_BITS(a, a_bits_src, a_bits);                 \
+               b = ADJUST_BITS(b, b_bits_src, b_bits);                 \
+               g = ADJUST_BITS(g, g_bits_src, g_bits);                 \
+               r = ADJUST_BITS(r, r_bits_src, r_bits);                 \
+               if (swap == 0)                                          \
+                       (*dst) = ((a) << (a_shift)) | ((b) << (b_shift)) | ((g) << (g_shift)) | ((r) << (r_shift)); \
+               else                                                                                                \
+                       (*dst) = ((a) << (a_shift)) | ((r) << (b_shift)) | ((g) << (g_shift)) | ((b) << (r_shift)); \
+       } while (0)
+
+static void *
+_glamor_color_revert_x2b10g10r10(void *src_bits, void *dst_bits, int w, int h,
+                                 int stride, int no_alpha, int revert,
+                                 int swap_rb)
+{
+    int x, y;
+    unsigned int *words, *saved_words, *source_words;
+    int swap = !(swap_rb == SWAP_NONE_DOWNLOADING ||
+                 swap_rb == SWAP_NONE_UPLOADING);
+
+    source_words = src_bits;
+    words = dst_bits;
+    saved_words = words;
+
+    for (y = 0; y < h; y++) {
+        DEBUGF("Line %d :  ", y);
+        for (x = 0; x < w; x++) {
+            unsigned int pixel = source_words[x];
+
+            if (revert == REVERT_DOWNLOADING_2_10_10_10)
+                GLAMOR_DO_CONVERT(pixel, &words[x], no_alpha, swap,
+                                  24, 8, 16, 8, 8, 8, 0, 8,
+                                  30, 2, 20, 10, 10, 10, 0, 10);
+            else
+                GLAMOR_DO_CONVERT(pixel, &words[x], no_alpha, swap,
+                                  30, 2, 20, 10, 10, 10, 0, 10,
+                                  24, 8, 16, 8, 8, 8, 0, 8);
+            DEBUGF("%x:%x ", pixel, words[x]);
+        }
+        DEBUGF("\n");
+        words += stride / sizeof(*words);
+        source_words += stride / sizeof(*words);
+    }
+    DEBUGF("\n");
+    return saved_words;
+
+}
+
+static void *
+_glamor_color_revert_x1b5g5r5(void *src_bits, void *dst_bits, int w, int h,
+                              int stride, int no_alpha, int revert, int swap_rb)
+{
+    int x, y;
+    unsigned short *words, *saved_words, *source_words;
+    int swap = !(swap_rb == SWAP_NONE_DOWNLOADING ||
+                 swap_rb == SWAP_NONE_UPLOADING);
+
+    words = dst_bits;
+    source_words = src_bits;
+    saved_words = words;
+
+    for (y = 0; y < h; y++) {
+        DEBUGF("Line %d :  ", y);
+        for (x = 0; x < w; x++) {
+            unsigned short pixel = source_words[x];
+
+            if (revert == REVERT_DOWNLOADING_1_5_5_5)
+                GLAMOR_DO_CONVERT(pixel, &words[x], no_alpha, swap,
+                                  0, 1, 1, 5, 6, 5, 11, 5,
+                                  15, 1, 10, 5, 5, 5, 0, 5);
+            else
+                GLAMOR_DO_CONVERT(pixel, &words[x], no_alpha, swap,
+                                  15, 1, 10, 5, 5, 5, 0, 5,
+                                  0, 1, 1, 5, 6, 5, 11, 5);
+            DEBUGF("%04x:%04x ", pixel, words[x]);
+        }
+        DEBUGF("\n");
+        words += stride / sizeof(*words);
+        source_words += stride / sizeof(*words);
+    }
+    DEBUGF("\n");
+    return saved_words;
+}
+
+/*
+ * This function is to convert an unsupported color format to/from a
+ * supported GL format.
+ * Here are the current scenarios:
+ *
+ * @no_alpha:
+ *     If it is set, then we need to wire the alpha value to 1.
+ * @revert:
+       REVERT_DOWNLOADING_A1           : convert an Alpha8 buffer to a A1 buffer.
+       REVERT_UPLOADING_A1             : convert an A1 buffer to an Alpha8 buffer
+       REVERT_DOWNLOADING_2_10_10_10   : convert r10G10b10X2 to X2B10G10R10
+       REVERT_UPLOADING_2_10_10_10     : convert X2B10G10R10 to R10G10B10X2
+       REVERT_DOWNLOADING_1_5_5_5      : convert B5G5R5X1 to X1R5G5B5
+       REVERT_UPLOADING_1_5_5_5        : convert X1R5G5B5 to B5G5R5X1
+   @swap_rb: if we have the swap_rb set, then we need to swap the R and B's position.
+ *
+ */
+
+static void *
+glamor_color_convert_to_bits(void *src_bits, void *dst_bits, int w, int h,
+                             int stride, int no_alpha, int revert, int swap_rb)
+{
+    if (revert == REVERT_DOWNLOADING_A1 || revert == REVERT_UPLOADING_A1) {
+        return _glamor_color_convert_a1_a8(src_bits, dst_bits, w, h, stride,
+                                           revert);
+    }
+    else if (revert == REVERT_DOWNLOADING_2_10_10_10 ||
+             revert == REVERT_UPLOADING_2_10_10_10) {
+        return _glamor_color_revert_x2b10g10r10(src_bits, dst_bits, w, h,
+                                                stride, no_alpha, revert,
+                                                swap_rb);
+    }
+    else if (revert == REVERT_DOWNLOADING_1_5_5_5 ||
+             revert == REVERT_UPLOADING_1_5_5_5) {
+        return _glamor_color_revert_x1b5g5r5(src_bits, dst_bits, w, h, stride,
+                                             no_alpha, revert, swap_rb);
+    }
+    else
+        ErrorF("convert a non-supported mode %x.\n", revert);
+
+    return NULL;
+}
+
+/**
+ * Upload pixmap to a specified texture.
+ * This texture may not be the one attached to it.
+ **/
+static void
+__glamor_upload_pixmap_to_texture(PixmapPtr pixmap, unsigned int *tex,
+                                  GLenum format,
+                                  GLenum type,
+                                  int x, int y, int w, int h,
+                                  void *bits, int pbo)
+{
+    glamor_screen_private *glamor_priv =
+        glamor_get_screen_private(pixmap->drawable.pScreen);
+    int non_sub = 0;
+    unsigned int iformat = 0;
+
+    glamor_make_current(glamor_priv);
+    if (*tex == 0) {
+        glGenTextures(1, tex);
+        if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP)
+            iformat = gl_iformat_for_pixmap(pixmap);
+        else
+            iformat = format;
+        non_sub = 1;
+        assert(x == 0 && y == 0);
+    }
+
+    glBindTexture(GL_TEXTURE_2D, *tex);
+    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);
+    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+    glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
+
+    assert(pbo || bits != 0);
+    if (bits == NULL) {
+        glBindBuffer(GL_PIXEL_UNPACK_BUFFER, pbo);
+        glUnmapBuffer(GL_PIXEL_UNPACK_BUFFER);
+    }
+    if (non_sub)
+        glTexImage2D(GL_TEXTURE_2D, 0, iformat, w, h, 0, format, type, bits);
+    else
+        glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, w, h, format, type, bits);
+
+    if (bits == NULL)
+        glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
+}
+
+static Bool
+_glamor_upload_bits_to_pixmap_texture(PixmapPtr pixmap, GLenum format,
+                                      GLenum type, int no_alpha, int revert,
+                                      int swap_rb, int x, int y, int w, int h,
+                                      int stride, void *bits, int pbo)
+{
+    glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap);
+    glamor_screen_private *glamor_priv =
+        glamor_get_screen_private(pixmap->drawable.pScreen);
+    static float vertices[8];
+
+    static float texcoords[8] = { 0, 1,
+        1, 1,
+        1, 0,
+        0, 0
+    };
+    static float texcoords_inv[8] = { 0, 0,
+        1, 0,
+        1, 1,
+        0, 1
+    };
+    float *ptexcoords;
+    float dst_xscale, dst_yscale;
+    GLuint tex = 0;
+    int need_flip;
+    int need_free_bits = 0;
+
+    need_flip = !glamor_priv->yInverted;
+
+    if (bits == NULL)
+        goto ready_to_upload;
+
+    if (revert > REVERT_NORMAL) {
+        /* XXX if we are restoring the pixmap, then we may not need to allocate
+         * new buffer */
+        void *converted_bits;
+
+        if (pixmap->drawable.depth == 1)
+            stride = (((w * 8 + 7) / 8) + 3) & ~3;
+
+        converted_bits = malloc(h * stride);
+
+        if (converted_bits == NULL)
+            return FALSE;
+        bits = glamor_color_convert_to_bits(bits, converted_bits, w, h,
+                                            stride, no_alpha, revert, swap_rb);
+        if (bits == NULL) {
+            ErrorF("Failed to convert pixmap no_alpha %d,"
+                   "revert mode %d, swap mode %d\n", no_alpha, revert, swap_rb);
+            return FALSE;
+        }
+        no_alpha = 0;
+        revert = REVERT_NONE;
+        swap_rb = SWAP_NONE_UPLOADING;
+        need_free_bits = TRUE;
+    }
+
+ ready_to_upload:
+
+    /* Try fast path firstly, upload the pixmap to the texture attached
+     * to the fbo directly. */
+    if (no_alpha == 0
+        && revert == REVERT_NONE && swap_rb == SWAP_NONE_UPLOADING && !need_flip
+#ifdef WALKAROUND_LARGE_TEXTURE_MAP
+        && pixmap_priv->type != GLAMOR_TEXTURE_LARGE
+#endif
+        ) {
+        int fbo_x_off, fbo_y_off;
+
+        assert(pixmap_priv->base.fbo->tex);
+        pixmap_priv_get_fbo_off(pixmap_priv, &fbo_x_off, &fbo_y_off);
+
+        assert(x + fbo_x_off >= 0 && y + fbo_y_off >= 0);
+        assert(x + fbo_x_off + w <= pixmap_priv->base.fbo->width);
+        assert(y + fbo_y_off + h <= pixmap_priv->base.fbo->height);
+        __glamor_upload_pixmap_to_texture(pixmap, &pixmap_priv->base.fbo->tex,
+                                          format, type,
+                                          x + fbo_x_off, y + fbo_y_off, w, h,
+                                          bits, pbo);
+        return TRUE;
+    }
+
+    if (need_flip)
+        ptexcoords = texcoords;
+    else
+        ptexcoords = texcoords_inv;
+
+    pixmap_priv_get_dest_scale(pixmap_priv, &dst_xscale, &dst_yscale);
+    glamor_set_normalize_vcoords(pixmap_priv, dst_xscale,
+                                 dst_yscale,
+                                 x, y,
+                                 x + w, y + h,
+                                 glamor_priv->yInverted, vertices);
+    /* Slow path, we need to flip y or wire alpha to 1. */
+    glamor_make_current(glamor_priv);
+    glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT,
+                          GL_FALSE, 2 * sizeof(float), vertices);
+    glEnableVertexAttribArray(GLAMOR_VERTEX_POS);
+    glVertexAttribPointer(GLAMOR_VERTEX_SOURCE, 2, GL_FLOAT,
+                          GL_FALSE, 2 * sizeof(float), ptexcoords);
+    glEnableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
+
+    glamor_set_destination_pixmap_priv_nc(pixmap_priv);
+    __glamor_upload_pixmap_to_texture(pixmap, &tex,
+                                      format, type, 0, 0, w, h, bits, pbo);
+    glActiveTexture(GL_TEXTURE0);
+    glBindTexture(GL_TEXTURE_2D, tex);
+
+    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+    glUseProgram(glamor_priv->finish_access_prog[no_alpha]);
+    glUniform1i(glamor_priv->finish_access_revert[no_alpha], revert);
+    glUniform1i(glamor_priv->finish_access_swap_rb[no_alpha], swap_rb);
+
+    glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
+
+    glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
+    glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
+    glDeleteTextures(1, &tex);
+    glBindFramebuffer(GL_FRAMEBUFFER, 0);
+
+    if (need_free_bits)
+        free(bits);
+    return TRUE;
+}
+
+/*
+ * Prepare to upload a pixmap to texture memory.
+ * no_alpha equals 1 means the format needs to wire alpha to 1.
+ * Two condtion need to setup a fbo for a pixmap
+ * 1. !yInverted, we need to do flip if we are not yInverted.
+ * 2. no_alpha != 0, we need to wire the alpha.
+ * */
+static int
+glamor_pixmap_upload_prepare(PixmapPtr pixmap, GLenum format, int no_alpha,
+                             int revert, int swap_rb)
+{
+    int flag = 0;
+    glamor_pixmap_private *pixmap_priv;
+    glamor_screen_private *glamor_priv;
+    glamor_pixmap_fbo *fbo;
+    GLenum iformat;
+
+    pixmap_priv = glamor_get_pixmap_private(pixmap);
+    glamor_priv = glamor_get_screen_private(pixmap->drawable.pScreen);
+
+    if (pixmap_priv->base.gl_fbo != GLAMOR_FBO_UNATTACHED)
+        return 0;
+
+    if (pixmap_priv->base.fbo
+        && (pixmap_priv->base.fbo->width < pixmap->drawable.width
+            || pixmap_priv->base.fbo->height < pixmap->drawable.height)) {
+        fbo = glamor_pixmap_detach_fbo(pixmap_priv);
+        glamor_destroy_fbo(fbo);
+    }
+
+    if (pixmap_priv->base.fbo && pixmap_priv->base.fbo->fb)
+        return 0;
+
+    if (!(no_alpha || (revert == REVERT_NORMAL)
+          || (swap_rb != SWAP_NONE_UPLOADING)
+          || !glamor_priv->yInverted)) {
+        /* We don't need a fbo, a simple texture uploading should work. */
+
+        flag = GLAMOR_CREATE_FBO_NO_FBO;
+    }
+
+    if ((flag == GLAMOR_CREATE_FBO_NO_FBO
+         && pixmap_priv->base.fbo && pixmap_priv->base.fbo->tex)
+        || (flag == 0 && pixmap_priv->base.fbo && pixmap_priv->base.fbo->fb))
+        return 0;
+
+    if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP)
+        iformat = gl_iformat_for_pixmap(pixmap);
+    else
+        iformat = format;
+
+    if (!glamor_pixmap_ensure_fbo(pixmap, iformat, flag))
+        return -1;
+
+    return 0;
+}
+
+/*
+ * upload sub region to a large region.
+ * */
+static void
+glamor_put_bits(char *dst_bits, int dst_stride, char *src_bits,
+                int src_stride, int bpp, int x, int y, int w, int h)
+{
+    int j;
+    int byte_per_pixel;
+
+    byte_per_pixel = bpp / 8;
+    src_bits += y * src_stride + (x * byte_per_pixel);
+
+    for (j = y; j < y + h; j++) {
+        memcpy(dst_bits, src_bits, w * byte_per_pixel);
+        src_bits += src_stride;
+        dst_bits += dst_stride;
+    }
+}
+
+/*
+ * download sub region from a large region.
+ */
+static void
+glamor_get_bits(char *dst_bits, int dst_stride, char *src_bits,
+                int src_stride, int bpp, int x, int y, int w, int h)
+{
+    int j;
+    int byte_per_pixel;
+
+    byte_per_pixel = bpp / 8;
+    dst_bits += y * dst_stride + x * byte_per_pixel;
+
+    for (j = y; j < y + h; j++) {
+        memcpy(dst_bits, src_bits, w * byte_per_pixel);
+        src_bits += src_stride;
+        dst_bits += dst_stride;
+    }
+}
+
+Bool
+glamor_upload_sub_pixmap_to_texture(PixmapPtr pixmap, int x, int y, int w,
+                                    int h, int stride, void *bits, int pbo)
+{
+    GLenum format, type;
+    int no_alpha, revert, swap_rb;
+    glamor_pixmap_private *pixmap_priv;
+    Bool force_clip;
+
+    if (glamor_get_tex_format_type_from_pixmap(pixmap,
+                                               &format,
+                                               &type,
+                                               &no_alpha,
+                                               &revert, &swap_rb, 1)) {
+        glamor_fallback("Unknown pixmap depth %d.\n", pixmap->drawable.depth);
+        return FALSE;
+    }
+    if (glamor_pixmap_upload_prepare(pixmap, format, no_alpha, revert, swap_rb))
+        return FALSE;
+
+    pixmap_priv = glamor_get_pixmap_private(pixmap);
+    force_clip = pixmap_priv->base.glamor_priv->gl_flavor != GLAMOR_GL_DESKTOP
+        && !glamor_check_fbo_size(pixmap_priv->base.glamor_priv, w, h);
+
+    if (pixmap_priv->type == GLAMOR_TEXTURE_LARGE || force_clip) {
+        RegionRec region;
+        BoxRec box;
+        int n_region;
+        glamor_pixmap_clipped_regions *clipped_regions;
+        void *sub_bits;
+        int i, j;
+
+        sub_bits = malloc(h * stride);
+        if (sub_bits == NULL)
+            return FALSE;
+        box.x1 = x;
+        box.y1 = y;
+        box.x2 = x + w;
+        box.y2 = y + h;
+        RegionInitBoxes(&region, &box, 1);
+        if (!force_clip)
+            clipped_regions =
+                glamor_compute_clipped_regions(pixmap_priv, &region, &n_region,
+                                               0, 0, 0);
+        else
+            clipped_regions =
+                glamor_compute_clipped_regions_ext(pixmap_priv, &region,
+                                                   &n_region,
+                                                   pixmap_priv->large.block_w,
+                                                   pixmap_priv->large.block_h,
+                                                   0,
+                                                   0);
+        DEBUGF("prepare upload %dx%d to a large pixmap %p\n", w, h, pixmap);
+        for (i = 0; i < n_region; i++) {
+            BoxPtr boxes;
+            int nbox;
+            int temp_stride;
+            void *temp_bits;
+
+            assert(pbo == 0);
+
+            SET_PIXMAP_FBO_CURRENT(pixmap_priv, clipped_regions[i].block_idx);
+
+            boxes = RegionRects(clipped_regions[i].region);
+            nbox = RegionNumRects(clipped_regions[i].region);
+            DEBUGF("split to %d boxes\n", nbox);
+            for (j = 0; j < nbox; j++) {
+                temp_stride = PixmapBytePad(boxes[j].x2 - boxes[j].x1,
+                                            pixmap->drawable.depth);
+
+                if (boxes[j].x1 == x && temp_stride == stride) {
+                    temp_bits = (char *) bits + (boxes[j].y1 - y) * stride;
+                }
+                else {
+                    temp_bits = sub_bits;
+                    glamor_put_bits(temp_bits, temp_stride, bits, stride,
+                                    pixmap->drawable.bitsPerPixel,
+                                    boxes[j].x1 - x, boxes[j].y1 - y,
+                                    boxes[j].x2 - boxes[j].x1,
+                                    boxes[j].y2 - boxes[j].y1);
+                }
+                DEBUGF("upload x %d y %d w %d h %d temp stride %d \n",
+                       boxes[j].x1 - x, boxes[j].y1 - y,
+                       boxes[j].x2 - boxes[j].x1,
+                       boxes[j].y2 - boxes[j].y1, temp_stride);
+                if (_glamor_upload_bits_to_pixmap_texture
+                    (pixmap, format, type, no_alpha, revert, swap_rb,
+                     boxes[j].x1, boxes[j].y1, boxes[j].x2 - boxes[j].x1,
+                     boxes[j].y2 - boxes[j].y1, temp_stride, temp_bits,
+                     pbo) == FALSE) {
+                    RegionUninit(&region);
+                    free(sub_bits);
+                    assert(0);
+                    return FALSE;
+                }
+            }
+            RegionDestroy(clipped_regions[i].region);
+        }
+        free(sub_bits);
+        free(clipped_regions);
+        RegionUninit(&region);
+        return TRUE;
+    }
+    else
+        return _glamor_upload_bits_to_pixmap_texture(pixmap, format, type,
+                                                     no_alpha, revert, swap_rb,
+                                                     x, y, w, h, stride, bits,
+                                                     pbo);
+}
+
+enum glamor_pixmap_status
+glamor_upload_pixmap_to_texture(PixmapPtr pixmap)
+{
+    glamor_pixmap_private *pixmap_priv;
+    void *data;
+    int pbo;
+    int ret;
+
+    pixmap_priv = glamor_get_pixmap_private(pixmap);
+
+    if ((pixmap_priv->base.fbo)
+        && (pixmap_priv->base.fbo->pbo_valid)) {
+        data = NULL;
+        pbo = pixmap_priv->base.fbo->pbo;
+    }
+    else {
+        data = pixmap->devPrivate.ptr;
+        pbo = 0;
+    }
+
+    if (glamor_upload_sub_pixmap_to_texture(pixmap, 0, 0,
+                                            pixmap->drawable.width,
+                                            pixmap->drawable.height,
+                                            pixmap->devKind, data, pbo))
+        ret = GLAMOR_UPLOAD_DONE;
+    else
+        ret = GLAMOR_UPLOAD_FAILED;
+
+    return ret;
+}
+
+void
+glamor_restore_pixmap_to_texture(PixmapPtr pixmap)
+{
+    if (glamor_upload_pixmap_to_texture(pixmap) != GLAMOR_UPLOAD_DONE)
+        LogMessage(X_WARNING, "Failed to restore pixmap to texture.\n");
+}
+
+/*
+ * as gles2 only support a very small set of color format and
+ * type when do glReadPixel,
+ * Before we use glReadPixels to get back a textured pixmap,
+ * Use shader to convert it to a supported format and thus
+ * get a new temporary pixmap returned.
+ * */
+
+glamor_pixmap_fbo *
+glamor_es2_pixmap_read_prepare(PixmapPtr source, int x, int y, int w, int h,
+                               GLenum format, GLenum type, int no_alpha,
+                               int revert, int swap_rb)
+{
+    glamor_pixmap_private *source_priv;
+    glamor_screen_private *glamor_priv;
+    ScreenPtr screen;
+    glamor_pixmap_fbo *temp_fbo;
+    float temp_xscale, temp_yscale, source_xscale, source_yscale;
+    static float vertices[8];
+    static float texcoords[8];
+
+    screen = source->drawable.pScreen;
+
+    glamor_priv = glamor_get_screen_private(screen);
+    source_priv = glamor_get_pixmap_private(source);
+    temp_fbo = glamor_create_fbo(glamor_priv, w, h, format, 0);
+    if (temp_fbo == NULL)
+        return NULL;
+
+    glamor_make_current(glamor_priv);
+    temp_xscale = 1.0 / w;
+    temp_yscale = 1.0 / h;
+
+    glamor_set_normalize_vcoords((struct glamor_pixmap_private *) NULL,
+                                 temp_xscale, temp_yscale, 0, 0, w, h,
+                                 glamor_priv->yInverted, vertices);
+
+    glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT, GL_FALSE,
+                          2 * sizeof(float), vertices);
+    glEnableVertexAttribArray(GLAMOR_VERTEX_POS);
+
+    pixmap_priv_get_scale(source_priv, &source_xscale, &source_yscale);
+    glamor_set_normalize_tcoords(source_priv, source_xscale,
+                                 source_yscale,
+                                 x, y,
+                                 x + w, y + h,
+                                 glamor_priv->yInverted, texcoords);
+
+    glVertexAttribPointer(GLAMOR_VERTEX_SOURCE, 2, GL_FLOAT, GL_FALSE,
+                          2 * sizeof(float), texcoords);
+    glEnableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
+
+    glActiveTexture(GL_TEXTURE0);
+    glBindTexture(GL_TEXTURE_2D, source_priv->base.fbo->tex);
+    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+
+    glamor_set_destination_pixmap_fbo(temp_fbo, 0, 0, w, h);
+    glUseProgram(glamor_priv->finish_access_prog[no_alpha]);
+    glUniform1i(glamor_priv->finish_access_revert[no_alpha], revert);
+    glUniform1i(glamor_priv->finish_access_swap_rb[no_alpha], swap_rb);
+
+    glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
+
+    glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
+    glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
+    return temp_fbo;
+}
+
+/*
+ * Download a sub region of pixmap to a specified memory region.
+ * The pixmap must have a valid FBO, otherwise return a NULL.
+ * */
+
+static void *
+_glamor_download_sub_pixmap_to_cpu(PixmapPtr pixmap, GLenum format,
+                                   GLenum type, int no_alpha,
+                                   int revert, int swap_rb,
+                                   int x, int y, int w, int h,
+                                   int stride, void *bits, int pbo,
+                                   glamor_access_t access)
+{
+    glamor_pixmap_private *pixmap_priv;
+    GLenum gl_access = 0, gl_usage = 0;
+    void *data, *read;
+    glamor_screen_private *glamor_priv =
+        glamor_get_screen_private(pixmap->drawable.pScreen);
+    glamor_pixmap_fbo *temp_fbo = NULL;
+    int need_post_conversion = 0;
+    int need_free_data = 0;
+    int fbo_x_off, fbo_y_off;
+
+    data = bits;
+    pixmap_priv = glamor_get_pixmap_private(pixmap);
+    if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv))
+        return NULL;
+
+    switch (access) {
+    case GLAMOR_ACCESS_RO:
+        gl_access = GL_READ_ONLY;
+        gl_usage = GL_STREAM_READ;
+        break;
+    case GLAMOR_ACCESS_RW:
+        gl_access = GL_READ_WRITE;
+        gl_usage = GL_DYNAMIC_DRAW;
+        break;
+    default:
+        ErrorF("Glamor: Invalid access code. %d\n", access);
+        assert(0);
+    }
+
+    glamor_make_current(glamor_priv);
+    glamor_set_destination_pixmap_priv_nc(pixmap_priv);
+
+    need_post_conversion = (revert > REVERT_NORMAL);
+    if (need_post_conversion) {
+        if (pixmap->drawable.depth == 1) {
+            int temp_stride;
+
+            temp_stride = (((w * 8 + 7) / 8) + 3) & ~3;
+            data = malloc(temp_stride * h);
+            if (data == NULL)
+                return NULL;
+            need_free_data = 1;
+        }
+    }
+
+    pixmap_priv_get_fbo_off(pixmap_priv, &fbo_x_off, &fbo_y_off);
+
+    if (glamor_priv->gl_flavor == GLAMOR_GL_ES2
+        && !need_post_conversion
+        && (swap_rb != SWAP_NONE_DOWNLOADING || revert != REVERT_NONE)) {
+        if (!(temp_fbo = glamor_es2_pixmap_read_prepare(pixmap, x, y, w, h,
+                                                        format, type, no_alpha,
+                                                        revert, swap_rb))) {
+            free(data);
+            return NULL;
+        }
+        x = 0;
+        y = 0;
+        fbo_x_off = 0;
+        fbo_y_off = 0;
+    }
+
+    glPixelStorei(GL_PACK_ALIGNMENT, 4);
+
+    if (glamor_priv->has_pack_invert || glamor_priv->yInverted) {
+
+        if (!glamor_priv->yInverted) {
+            assert(glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP);
+            glPixelStorei(GL_PACK_INVERT_MESA, 1);
+        }
+
+        if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP && data == NULL) {
+            assert(pbo > 0);
+            glBindBuffer(GL_PIXEL_PACK_BUFFER, pbo);
+            glBufferData(GL_PIXEL_PACK_BUFFER, stride * h, NULL, gl_usage);
+        }
+
+        glReadPixels(x + fbo_x_off, y + fbo_y_off, w, h, format, type, data);
+
+        if (!glamor_priv->yInverted) {
+            assert(glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP);
+            glPixelStorei(GL_PACK_INVERT_MESA, 0);
+        }
+        if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP && bits == NULL) {
+            bits = glMapBuffer(GL_PIXEL_PACK_BUFFER, gl_access);
+            glBindBuffer(GL_PIXEL_PACK_BUFFER, 0);
+        }
+    }
+    else {
+        unsigned int temp_pbo;
+        int yy;
+
+        glamor_make_current(glamor_priv);
+        glGenBuffers(1, &temp_pbo);
+        glBindBuffer(GL_PIXEL_PACK_BUFFER, temp_pbo);
+        glBufferData(GL_PIXEL_PACK_BUFFER, stride * h, NULL, GL_STREAM_READ);
+        glReadPixels(x + fbo_x_off, y + fbo_y_off, w, h, format, type, 0);
+        read = glMapBuffer(GL_PIXEL_PACK_BUFFER, GL_READ_ONLY);
+        for (yy = 0; yy < pixmap->drawable.height; yy++)
+            memcpy((char *) data + yy * stride,
+                   (char *) read + (h - yy - 1) * stride, stride);
+        glUnmapBuffer(GL_PIXEL_PACK_BUFFER);
+        glBindBuffer(GL_PIXEL_PACK_BUFFER, 0);
+        glDeleteBuffers(1, &temp_pbo);
+    }
+
+    glBindFramebuffer(GL_FRAMEBUFFER, 0);
+
+    if (need_post_conversion) {
+        /* As OpenGL desktop version never enters here.
+         * Don't need to consider if the pbo is valid.*/
+        bits = glamor_color_convert_to_bits(data, bits,
+                                            w, h,
+                                            stride, no_alpha, revert, swap_rb);
+    }
+
+    if (temp_fbo != NULL)
+        glamor_destroy_fbo(temp_fbo);
+    if (need_free_data)
+        free(data);
+
+    return bits;
+}
+
+void *
+glamor_download_sub_pixmap_to_cpu(PixmapPtr pixmap, int x, int y, int w, int h,
+                                  int stride, void *bits, int pbo,
+                                  glamor_access_t access)
+{
+    GLenum format, type;
+    int no_alpha, revert, swap_rb;
+    glamor_pixmap_private *pixmap_priv;
+    Bool force_clip;
+
+    if (glamor_get_tex_format_type_from_pixmap(pixmap,
+                                               &format,
+                                               &type,
+                                               &no_alpha,
+                                               &revert, &swap_rb, 0)) {
+        glamor_fallback("Unknown pixmap depth %d.\n", pixmap->drawable.depth);
+        return NULL;
+    }
+
+    pixmap_priv = glamor_get_pixmap_private(pixmap);
+    if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv))
+        return NULL;
+
+    force_clip = pixmap_priv->base.glamor_priv->gl_flavor != GLAMOR_GL_DESKTOP
+        && !glamor_check_fbo_size(pixmap_priv->base.glamor_priv, w, h);
+
+    if (pixmap_priv->type == GLAMOR_TEXTURE_LARGE || force_clip) {
+
+        RegionRec region;
+        BoxRec box;
+        int n_region;
+        glamor_pixmap_clipped_regions *clipped_regions;
+        void *sub_bits;
+        int i, j;
+
+        sub_bits = malloc(h * stride);
+        if (sub_bits == NULL)
+            return FALSE;
+        box.x1 = x;
+        box.y1 = y;
+        box.x2 = x + w;
+        box.y2 = y + h;
+        RegionInitBoxes(&region, &box, 1);
+
+        if (!force_clip)
+            clipped_regions =
+                glamor_compute_clipped_regions(pixmap_priv, &region, &n_region,
+                                               0, 0, 0);
+        else
+            clipped_regions =
+                glamor_compute_clipped_regions_ext(pixmap_priv, &region,
+                                                   &n_region,
+                                                   pixmap_priv->large.block_w,
+                                                   pixmap_priv->large.block_h,
+                                                   0,
+                                                   0);
+
+        DEBUGF("start download large pixmap %p %dx%d \n", pixmap, w, h);
+        for (i = 0; i < n_region; i++) {
+            BoxPtr boxes;
+            int nbox;
+            int temp_stride;
+            void *temp_bits;
+
+            assert(pbo == 0);
+            SET_PIXMAP_FBO_CURRENT(pixmap_priv, clipped_regions[i].block_idx);
+
+            boxes = RegionRects(clipped_regions[i].region);
+            nbox = RegionNumRects(clipped_regions[i].region);
+            for (j = 0; j < nbox; j++) {
+                temp_stride = PixmapBytePad(boxes[j].x2 - boxes[j].x1,
+                                            pixmap->drawable.depth);
+
+                if (boxes[j].x1 == x && temp_stride == stride) {
+                    temp_bits = (char *) bits + (boxes[j].y1 - y) * stride;
+                }
+                else {
+                    temp_bits = sub_bits;
+                }
+                DEBUGF("download x %d y %d w %d h %d temp stride %d \n",
+                       boxes[j].x1, boxes[j].y1,
+                       boxes[j].x2 - boxes[j].x1,
+                       boxes[j].y2 - boxes[j].y1, temp_stride);
+
+                /* For large pixmap, we don't support pbo currently. */
+                assert(pbo == 0);
+                if (_glamor_download_sub_pixmap_to_cpu
+                    (pixmap, format, type, no_alpha, revert, swap_rb,
+                     boxes[j].x1, boxes[j].y1, boxes[j].x2 - boxes[j].x1,
+                     boxes[j].y2 - boxes[j].y1, temp_stride, temp_bits, pbo,
+                     access) == FALSE) {
+                    RegionUninit(&region);
+                    free(sub_bits);
+                    assert(0);
+                    return NULL;
+                }
+                if (boxes[j].x1 != x || temp_stride != stride)
+                    glamor_get_bits(bits, stride, temp_bits, temp_stride,
+                                    pixmap->drawable.bitsPerPixel,
+                                    boxes[j].x1 - x, boxes[j].y1 - y,
+                                    boxes[j].x2 - boxes[j].x1,
+                                    boxes[j].y2 - boxes[j].y1);
+            }
+
+            RegionDestroy(clipped_regions[i].region);
+        }
+        free(sub_bits);
+        free(clipped_regions);
+        RegionUninit(&region);
+        return bits;
+    }
+    else
+        return _glamor_download_sub_pixmap_to_cpu(pixmap, format, type,
+                                                  no_alpha, revert, swap_rb, x,
+                                                  y, w, h, stride, bits, pbo,
+                                                  access);
+}
+
+/**
+ * Move a pixmap to CPU memory.
+ * The input data is the pixmap's fbo.
+ * The output data is at pixmap->devPrivate.ptr. We always use pbo
+ * to read the fbo and then map it to va. If possible, we will use
+ * it directly as devPrivate.ptr.
+ * If successfully download a fbo to cpu then return TRUE.
+ * Otherwise return FALSE.
+ **/
+Bool
+glamor_download_pixmap_to_cpu(PixmapPtr pixmap, glamor_access_t access)
+{
+    glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap);
+    unsigned int stride;
+    void *data = NULL, *dst;
+    glamor_screen_private *glamor_priv =
+        glamor_get_screen_private(pixmap->drawable.pScreen);
+    int pbo = 0;
+
+    if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv))
+        return TRUE;
+
+    glamor_debug_output(GLAMOR_DEBUG_TEXTURE_DOWNLOAD,
+                        "Downloading pixmap %p  %dx%d depth%d\n",
+                        pixmap,
+                        pixmap->drawable.width,
+                        pixmap->drawable.height, pixmap->drawable.depth);
+
+    stride = pixmap->devKind;
+
+    if (glamor_priv->gl_flavor == GLAMOR_GL_ES2
+        || (!glamor_priv->has_pack_invert && !glamor_priv->yInverted)
+        || pixmap_priv->type == GLAMOR_TEXTURE_LARGE) {
+        data = malloc(stride * pixmap->drawable.height);
+    }
+    else {
+        glamor_make_current(glamor_priv);
+        if (pixmap_priv->base.fbo->pbo == 0)
+            glGenBuffers(1, &pixmap_priv->base.fbo->pbo);
+        pbo = pixmap_priv->base.fbo->pbo;
+    }
+
+    if (pixmap_priv->type == GLAMOR_TEXTURE_DRM) {
+        stride = PixmapBytePad(pixmap->drawable.width, pixmap->drawable.depth);
+        pixmap_priv->base.drm_stride = pixmap->devKind;
+        pixmap->devKind = stride;
+    }
+
+    dst = glamor_download_sub_pixmap_to_cpu(pixmap, 0, 0,
+                                            pixmap->drawable.width,
+                                            pixmap->drawable.height,
+                                            pixmap->devKind, data, pbo, access);
+
+    if (!dst) {
+        if (data)
+            free(data);
+        return FALSE;
+    }
+
+    if (pbo != 0)
+        pixmap_priv->base.fbo->pbo_valid = 1;
+
+    pixmap_priv->base.gl_fbo = GLAMOR_FBO_DOWNLOADED;
+
+    pixmap->devPrivate.ptr = dst;
+
+    return TRUE;
+}
+
+/* fixup a fbo to the exact size as the pixmap. */
+/* XXX LARGE pixmap? */
+Bool
+glamor_fixup_pixmap_priv(ScreenPtr screen, glamor_pixmap_private *pixmap_priv)
+{
+    glamor_pixmap_fbo *old_fbo;
+    glamor_pixmap_fbo *new_fbo = NULL;
+    PixmapPtr scratch = NULL;
+    glamor_pixmap_private *scratch_priv;
+    DrawablePtr drawable;
+    GCPtr gc = NULL;
+    int ret = FALSE;
+
+    drawable = &pixmap_priv->base.pixmap->drawable;
+
+    if (!GLAMOR_PIXMAP_FBO_NOT_EXACT_SIZE(pixmap_priv))
+        return TRUE;
+
+    old_fbo = pixmap_priv->base.fbo;
+
+    if (!old_fbo)
+        return FALSE;
+
+    gc = GetScratchGC(drawable->depth, screen);
+    if (!gc)
+        goto fail;
+
+    scratch = glamor_create_pixmap(screen, drawable->width, drawable->height,
+                                   drawable->depth, GLAMOR_CREATE_PIXMAP_FIXUP);
+
+    scratch_priv = glamor_get_pixmap_private(scratch);
+
+    if (!scratch_priv->base.fbo)
+        goto fail;
+
+    ValidateGC(&scratch->drawable, gc);
+    glamor_copy_area(drawable,
+                     &scratch->drawable,
+                     gc, 0, 0, drawable->width, drawable->height, 0, 0);
+    old_fbo = glamor_pixmap_detach_fbo(pixmap_priv);
+    new_fbo = glamor_pixmap_detach_fbo(scratch_priv);
+    glamor_pixmap_attach_fbo(pixmap_priv->base.pixmap, new_fbo);
+    glamor_pixmap_attach_fbo(scratch, old_fbo);
+
+    DEBUGF("old %dx%d type %d\n",
+           drawable->width, drawable->height, pixmap_priv->type);
+    DEBUGF("copy tex %d  %dx%d to tex %d %dx%d \n",
+           old_fbo->tex, old_fbo->width, old_fbo->height, new_fbo->tex,
+           new_fbo->width, new_fbo->height);
+    ret = TRUE;
+ fail:
+    if (gc)
+        FreeScratchGC(gc);
+    if (scratch)
+        glamor_destroy_pixmap(scratch);
+
+    return ret;
+}
+
+/*
+ * We may use this function to reduce a large pixmap to a small sub
+ * pixmap. Two scenarios currently:
+ * 1. When fallback a large textured pixmap to CPU but we do need to
+ * do rendering within a small sub region, then we can just get a
+ * sub region.
+ *
+ * 2. When uploading a large pixmap to texture but we only need to
+ * use part of the source/mask picture. As glTexImage2D will be more
+ * efficient to upload a contingent region rather than a sub block
+ * in a large buffer. We use this function to gather the sub region
+ * to a contingent sub pixmap.
+ *
+ * The sub-pixmap must have the same format as the source pixmap.
+ *
+ * */
+PixmapPtr
+glamor_get_sub_pixmap(PixmapPtr pixmap, int x, int y, int w, int h,
+                      glamor_access_t access)
+{
+    glamor_screen_private *glamor_priv;
+    PixmapPtr sub_pixmap;
+    glamor_pixmap_private *sub_pixmap_priv, *pixmap_priv;
+    void *data;
+    int pbo;
+    int flag;
+
+    if (x < 0 || y < 0)
+        return NULL;
+    w = (x + w) > pixmap->drawable.width ? (pixmap->drawable.width - x) : w;
+    h = (y + h) > pixmap->drawable.height ? (pixmap->drawable.height - y) : h;
+
+    glamor_priv = glamor_get_screen_private(pixmap->drawable.pScreen);
+    pixmap_priv = glamor_get_pixmap_private(pixmap);
+
+    if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv))
+        return NULL;
+    if (glamor_priv->gl_flavor == GLAMOR_GL_ES2 ||
+        pixmap_priv->type == GLAMOR_TEXTURE_LARGE)
+        flag = GLAMOR_CREATE_PIXMAP_CPU;
+    else
+        flag = GLAMOR_CREATE_PIXMAP_MAP;
+
+    sub_pixmap = glamor_create_pixmap(pixmap->drawable.pScreen, w, h,
+                                      pixmap->drawable.depth, flag);
+
+    if (sub_pixmap == NULL)
+        return NULL;
+
+    sub_pixmap_priv = glamor_get_pixmap_private(sub_pixmap);
+    pbo =
+        sub_pixmap_priv ? (sub_pixmap_priv->base.fbo ? sub_pixmap_priv->base.
+                           fbo->pbo : 0) : 0;
+
+    if (pixmap_priv->base.is_picture) {
+        sub_pixmap_priv->base.picture = pixmap_priv->base.picture;
+        sub_pixmap_priv->base.is_picture = pixmap_priv->base.is_picture;
+    }
+
+    if (pbo)
+        data = NULL;
+    else
+        data = sub_pixmap->devPrivate.ptr;
+
+    data =
+        glamor_download_sub_pixmap_to_cpu(pixmap, x, y, w, h,
+                                          sub_pixmap->devKind, data, pbo,
+                                          access);
+    if (data == NULL) {
+        fbDestroyPixmap(sub_pixmap);
+        return NULL;
+    }
+    if (pbo) {
+        assert(sub_pixmap->devPrivate.ptr == NULL);
+        sub_pixmap->devPrivate.ptr = data;
+        sub_pixmap_priv->base.fbo->pbo_valid = 1;
+    }
+#if 0
+    struct pixman_box16 box;
+    PixmapPtr new_sub_pixmap;
+    int dx, dy;
+
+    box.x1 = 0;
+    box.y1 = 0;
+    box.x2 = w;
+    box.y2 = h;
+
+    dx = x;
+    dy = y;
+
+    new_sub_pixmap = glamor_create_pixmap(pixmap->drawable.pScreen, w, h,
+                                          pixmap->drawable.depth,
+                                          GLAMOR_CREATE_PIXMAP_CPU);
+    glamor_copy_n_to_n(&pixmap->drawable, &new_sub_pixmap->drawable, NULL, &box,
+                       1, dx, dy, 0, 0, 0, NULL);
+    glamor_compare_pixmaps(new_sub_pixmap, sub_pixmap, 0, 0, w, h, 1, 1);
+#endif
+
+    return sub_pixmap;
+}
+
+void
+glamor_put_sub_pixmap(PixmapPtr sub_pixmap, PixmapPtr pixmap, int x, int y,
+                      int w, int h, glamor_access_t access)
+{
+    void *bits;
+    int pbo;
+    glamor_pixmap_private *sub_pixmap_priv;
+
+    if (access != GLAMOR_ACCESS_RO) {
+        sub_pixmap_priv = glamor_get_pixmap_private(sub_pixmap);
+        if (sub_pixmap_priv->base.fbo && sub_pixmap_priv->base.fbo->pbo_valid) {
+            bits = NULL;
+            pbo = sub_pixmap_priv->base.fbo->pbo;
+        }
+        else {
+            bits = sub_pixmap->devPrivate.ptr;
+            pbo = 0;
+        }
+
+        assert(x >= 0 && y >= 0);
+        w = (w > sub_pixmap->drawable.width) ? sub_pixmap->drawable.width : w;
+        h = (h > sub_pixmap->drawable.height) ? sub_pixmap->drawable.height : h;
+        glamor_upload_sub_pixmap_to_texture(pixmap, x, y, w, h,
+                                            sub_pixmap->devKind, bits, pbo);
+    }
+    glamor_destroy_pixmap(sub_pixmap);
+}
diff --git a/glamor/glamor_points.c b/glamor/glamor_points.c
new file mode 100644 (file)
index 0000000..d4525e2
--- /dev/null
@@ -0,0 +1,141 @@
+/*
+ * Copyright Â© 2009 Intel Corporation
+ * Copyright Â© 1998 Keith Packard
+ *
+ * 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.
+ *
+ * Authors:
+ *    Zhigang Gong <zhigang.gong@linux.intel.com>
+ *
+ */
+
+#include "glamor_priv.h"
+#include "glamor_transform.h"
+
+static const glamor_facet glamor_facet_point = {
+    .name = "poly_point",
+    .vs_vars = "attribute vec2 primitive;\n",
+    .vs_exec = GLAMOR_POS(gl_Position, primitive),
+};
+
+static Bool
+glamor_poly_point_gl(DrawablePtr drawable, GCPtr gc, int mode, int npt, DDXPointPtr ppt)
+{
+    ScreenPtr screen = drawable->pScreen;
+    glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
+    PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable);
+    glamor_program *prog = &glamor_priv->point_prog;
+    glamor_pixmap_private *pixmap_priv;
+    int off_x, off_y;
+    GLshort *vbo_ppt;
+    char *vbo_offset;
+    int box_x, box_y;
+
+    pixmap_priv = glamor_get_pixmap_private(pixmap);
+    if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv))
+        goto bail;
+
+    glamor_make_current(glamor_priv);
+
+    if (prog->failed)
+        goto bail_ctx;
+
+    if (!prog->prog) {
+        if (!glamor_build_program(screen, prog,
+                                  &glamor_facet_point,
+                                  &glamor_fill_solid))
+            goto bail_ctx;
+    }
+
+    if (!glamor_use_program(pixmap, gc, prog, NULL))
+        goto bail_ctx;
+
+    vbo_ppt = glamor_get_vbo_space(screen, npt * (2 * sizeof (INT16)), &vbo_offset);
+    glEnableVertexAttribArray(GLAMOR_VERTEX_POS);
+    glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_SHORT, GL_FALSE, 0, vbo_offset);
+    if (mode == CoordModePrevious) {
+        int n = npt;
+        INT16 x = 0, y = 0;
+        while (n--) {
+            vbo_ppt[0] = (x += ppt->x);
+            vbo_ppt[1] = (y += ppt->y);
+            vbo_ppt += 2;
+            ppt++;
+        }
+    } else
+        memcpy(vbo_ppt, ppt, npt * (2 * sizeof (INT16)));
+    glamor_put_vbo_space(screen);
+
+    glEnable(GL_SCISSOR_TEST);
+
+    glamor_pixmap_loop(pixmap_priv, box_x, box_y) {
+        int nbox = RegionNumRects(gc->pCompositeClip);
+        BoxPtr box = RegionRects(gc->pCompositeClip);
+
+        glamor_set_destination_drawable(drawable, box_x, box_y, TRUE, TRUE, prog->matrix_uniform, &off_x, &off_y);
+
+        while (nbox--) {
+            glScissor(box->x1 + off_x,
+                      box->y1 + off_y,
+                      box->x2 - box->x1,
+                      box->y2 - box->y1);
+            box++;
+            glDrawArrays(GL_POINTS, 0, npt);
+        }
+    }
+
+    glDisable(GL_SCISSOR_TEST);
+    glDisable(GL_COLOR_LOGIC_OP);
+    glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
+
+    glamor_priv->state = RENDER_STATE;
+    glamor_priv->render_idle_cnt = 0;
+
+    return TRUE;
+
+bail_ctx:
+    glDisable(GL_COLOR_LOGIC_OP);
+bail:
+    return FALSE;
+}
+
+void
+glamor_poly_point(DrawablePtr drawable, GCPtr gc, int mode, int npt,
+                  DDXPointPtr ppt)
+{
+    if (glamor_poly_point_gl(drawable, gc, mode, npt, ppt))
+        return;
+    miPolyPoint(drawable, gc, mode, npt, ppt);
+}
+
+Bool
+glamor_poly_point_nf(DrawablePtr drawable, GCPtr gc, int mode, int npt,
+                     DDXPointPtr ppt)
+{
+    if (glamor_poly_point_gl(drawable, gc, mode, npt, ppt))
+        return TRUE;
+
+    if (glamor_ddx_fallback_check_pixmap(drawable) && glamor_ddx_fallback_check_gc(gc))
+        return FALSE;
+
+    miPolyPoint(drawable, gc, mode, npt, ppt);
+    return TRUE;
+}
+
diff --git a/glamor/glamor_polylines.c b/glamor/glamor_polylines.c
new file mode 100644 (file)
index 0000000..1adf45d
--- /dev/null
@@ -0,0 +1,136 @@
+/*
+ * Copyright Â© 2009 Intel Corporation
+ * Copyright Â© 1998 Keith Packard
+ *
+ * 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.
+ *
+ * Authors:
+ *    Eric Anholt <eric@anholt.net>
+ *
+ */
+
+#include "glamor_priv.h"
+
+/** @file glamor_polylines.c
+ *
+ * GC PolyFillRect implementation, taken straight from fb_fill.c
+ */
+
+/**
+ * glamor_poly_lines() checks if it can accelerate the lines as a group of
+ * horizontal or vertical lines (rectangles), and uses existing rectangle fill
+ * acceleration if so.
+ */
+static Bool
+_glamor_poly_lines(DrawablePtr drawable, GCPtr gc, int mode, int n,
+                   DDXPointPtr points, Bool fallback)
+{
+    xRectangle *rects;
+    int x1, x2, y1, y2;
+    int i;
+
+    /* Don't try to do wide lines or non-solid fill style. */
+    if (gc->lineWidth != 0) {
+        /* This ends up in miSetSpans, which is accelerated as well as we
+         * can hope X wide lines will be.
+         */
+        goto fail;
+    }
+
+    if (gc->lineStyle != LineSolid) {
+        glamor_fallback("non-solid fill line style %d\n", gc->lineStyle);
+        goto fail;
+    }
+    rects = malloc(sizeof(xRectangle) * (n - 1));
+    x1 = points[0].x;
+    y1 = points[0].y;
+    /* If we have any non-horizontal/vertical, fall back. */
+    for (i = 0; i < n - 1; i++) {
+        if (mode == CoordModePrevious) {
+            x2 = x1 + points[i + 1].x;
+            y2 = y1 + points[i + 1].y;
+        }
+        else {
+            x2 = points[i + 1].x;
+            y2 = points[i + 1].y;
+        }
+        if (x1 != x2 && y1 != y2) {
+            free(rects);
+            glamor_fallback("stub diagonal poly_line\n");
+            goto fail;
+        }
+        if (x1 < x2) {
+            rects[i].x = x1;
+            rects[i].width = x2 - x1 + 1;
+        }
+        else {
+            rects[i].x = x2;
+            rects[i].width = x1 - x2 + 1;
+        }
+        if (y1 < y2) {
+            rects[i].y = y1;
+            rects[i].height = y2 - y1 + 1;
+        }
+        else {
+            rects[i].y = y2;
+            rects[i].height = y1 - y2 + 1;
+        }
+
+        x1 = x2;
+        y1 = y2;
+    }
+    gc->ops->PolyFillRect(drawable, gc, n - 1, rects);
+    free(rects);
+    return TRUE;
+
+ fail:
+    if (!fallback && glamor_ddx_fallback_check_pixmap(drawable)
+        && glamor_ddx_fallback_check_gc(gc))
+        return FALSE;
+
+    switch (gc->lineStyle) {
+    case LineSolid:
+        if (gc->lineWidth == 0)
+            miZeroLine(drawable, gc, mode, n, points);
+        else
+            miWideLine(drawable, gc, mode, n, points);
+        break;
+    case LineOnOffDash:
+    case LineDoubleDash:
+        miWideDash(drawable, gc, mode, n, points);
+        break;
+    }
+
+    return TRUE;
+}
+
+void
+glamor_poly_lines(DrawablePtr drawable, GCPtr gc, int mode, int n,
+                  DDXPointPtr points)
+{
+    _glamor_poly_lines(drawable, gc, mode, n, points, TRUE);
+}
+
+Bool
+glamor_poly_lines_nf(DrawablePtr drawable, GCPtr gc, int mode, int n,
+                     DDXPointPtr points)
+{
+    return _glamor_poly_lines(drawable, gc, mode, n, points, FALSE);
+}
diff --git a/glamor/glamor_priv.h b/glamor/glamor_priv.h
new file mode 100644 (file)
index 0000000..c56c559
--- /dev/null
@@ -0,0 +1,1056 @@
+/*
+ * Copyright Â© 2008 Intel 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.
+ *
+ * Authors:
+ *    Eric Anholt <eric@anholt.net>
+ *
+ */
+#ifndef GLAMOR_PRIV_H
+#define GLAMOR_PRIV_H
+
+#include "dix-config.h"
+
+#include <xorg-server.h>
+#include "glamor.h"
+
+#include <epoxy/gl.h>
+#if GLAMOR_HAS_GBM
+#define MESA_EGL_NO_X11_HEADERS
+#include <epoxy/egl.h>
+#endif
+
+#define GLAMOR_DEFAULT_PRECISION  \
+    "#ifdef GL_ES\n"              \
+    "precision mediump float;\n"  \
+    "#endif\n"
+
+#ifdef RENDER
+#include "glyphstr.h"
+#endif
+
+#include "glamor_debug.h"
+#include "glamor_context.h"
+#include "glamor_program.h"
+
+#include <list.h>
+
+struct glamor_pixmap_private;
+
+typedef struct glamor_composite_shader {
+    GLuint prog;
+    GLint dest_to_dest_uniform_location;
+    GLint dest_to_source_uniform_location;
+    GLint dest_to_mask_uniform_location;
+    GLint source_uniform_location;
+    GLint mask_uniform_location;
+    GLint source_wh;
+    GLint mask_wh;
+    GLint source_repeat_mode;
+    GLint mask_repeat_mode;
+    union {
+        float source_solid_color[4];
+        struct {
+            struct glamor_pixmap_private *source_priv;
+            PicturePtr source;
+        };
+    };
+
+    union {
+        float mask_solid_color[4];
+        struct {
+            struct glamor_pixmap_private *mask_priv;
+            PicturePtr mask;
+        };
+    };
+} glamor_composite_shader;
+
+enum shader_source {
+    SHADER_SOURCE_SOLID,
+    SHADER_SOURCE_TEXTURE,
+    SHADER_SOURCE_TEXTURE_ALPHA,
+    SHADER_SOURCE_COUNT,
+};
+
+enum shader_mask {
+    SHADER_MASK_NONE,
+    SHADER_MASK_SOLID,
+    SHADER_MASK_TEXTURE,
+    SHADER_MASK_TEXTURE_ALPHA,
+    SHADER_MASK_COUNT,
+};
+
+enum shader_in {
+    SHADER_IN_SOURCE_ONLY,
+    SHADER_IN_NORMAL,
+    SHADER_IN_CA_SOURCE,
+    SHADER_IN_CA_ALPHA,
+    SHADER_IN_COUNT,
+};
+
+struct shader_key {
+    enum shader_source source;
+    enum shader_mask mask;
+    enum shader_in in;
+};
+
+struct blendinfo {
+    Bool dest_alpha;
+    Bool source_alpha;
+    GLenum source_blend;
+    GLenum dest_blend;
+};
+
+typedef struct {
+    INT16 x_src;
+    INT16 y_src;
+    INT16 x_mask;
+    INT16 y_mask;
+    INT16 x_dst;
+    INT16 y_dst;
+    INT16 width;
+    INT16 height;
+} glamor_composite_rect_t;
+
+enum glamor_vertex_type {
+    GLAMOR_VERTEX_POS,
+    GLAMOR_VERTEX_SOURCE,
+    GLAMOR_VERTEX_MASK
+};
+
+enum gradient_shader {
+    SHADER_GRADIENT_LINEAR,
+    SHADER_GRADIENT_RADIAL,
+    SHADER_GRADIENT_CONICAL,
+    SHADER_GRADIENT_COUNT,
+};
+
+struct glamor_screen_private;
+struct glamor_pixmap_private;
+
+enum glamor_gl_flavor {
+    GLAMOR_GL_DESKTOP,          // OPENGL API
+    GLAMOR_GL_ES2               // OPENGL ES2.0 API
+};
+
+#define GLAMOR_NUM_GLYPH_CACHE_FORMATS 2
+
+#define GLAMOR_COMPOSITE_VBO_VERT_CNT (64*1024)
+
+typedef struct {
+    PicturePtr picture;         /* Where the glyphs of the cache are stored */
+    GlyphPtr *glyphs;
+    uint16_t count;
+    uint16_t evict;
+} glamor_glyph_cache_t;
+
+struct glamor_saved_procs {
+    CloseScreenProcPtr close_screen;
+    CreateScreenResourcesProcPtr create_screen_resources;
+    CreateGCProcPtr create_gc;
+    CreatePixmapProcPtr create_pixmap;
+    DestroyPixmapProcPtr destroy_pixmap;
+    GetSpansProcPtr get_spans;
+    GetImageProcPtr get_image;
+    CompositeProcPtr composite;
+    CompositeRectsProcPtr composite_rects;
+    TrapezoidsProcPtr trapezoids;
+    GlyphsProcPtr glyphs;
+    ChangeWindowAttributesProcPtr change_window_attributes;
+    CopyWindowProcPtr copy_window;
+    BitmapToRegionProcPtr bitmap_to_region;
+    TrianglesProcPtr triangles;
+    AddTrapsProcPtr addtraps;
+    CreatePictureProcPtr create_picture;
+    DestroyPictureProcPtr destroy_picture;
+    UnrealizeGlyphProcPtr unrealize_glyph;
+    SetWindowPixmapProcPtr set_window_pixmap;
+};
+
+#define CACHE_FORMAT_COUNT 3
+
+#define CACHE_BUCKET_WCOUNT 4
+#define CACHE_BUCKET_HCOUNT 4
+
+#define GLAMOR_TICK_AFTER(t0, t1)      \
+       (((int)(t1) - (int)(t0)) < 0)
+
+#define IDLE_STATE 0
+#define RENDER_STATE 1
+#define BLIT_STATE 2
+#define RENDER_IDEL_MAX 32
+
+typedef struct glamor_screen_private {
+    Bool yInverted;
+    unsigned int tick;
+    enum glamor_gl_flavor gl_flavor;
+    int glsl_version;
+    int has_pack_invert;
+    int has_fbo_blit;
+    int has_map_buffer_range;
+    int has_buffer_storage;
+    int has_khr_debug;
+    int max_fbo_size;
+
+    struct xorg_list
+        fbo_cache[CACHE_FORMAT_COUNT][CACHE_BUCKET_WCOUNT][CACHE_BUCKET_HCOUNT];
+    unsigned long fbo_cache_watermark;
+
+    /* glamor_solid */
+    GLint solid_prog;
+    GLint solid_color_uniform_location;
+
+    /* glamor point shader */
+    glamor_program point_prog;
+
+    /* glamor spans shaders */
+    glamor_program_fill fill_spans_program;
+
+    /* glamor rect shaders */
+    glamor_program_fill poly_fill_rect_program;
+
+    /* glamor glyphblt shaders */
+    glamor_program_fill poly_glyph_blt_progs;
+
+    /* glamor text shaders */
+    glamor_program_fill poly_text_progs;
+    glamor_program      te_text_prog;
+    glamor_program      image_text_prog;
+
+    /* vertext/elment_index buffer object for render */
+    GLuint vbo, ebo;
+    /** Next offset within the VBO that glamor_get_vbo_space() will use. */
+    int vbo_offset;
+    int vbo_size;
+    /**
+     * Pointer to glamor_get_vbo_space()'s current VBO mapping.
+     *
+     * Note that this is not necessarily equal to the pointer returned
+     * by glamor_get_vbo_space(), so it can't be used in place of that.
+     */
+    char *vb;
+    int vb_stride;
+    Bool has_source_coords, has_mask_coords;
+    int render_nr_verts;
+    glamor_composite_shader composite_shader[SHADER_SOURCE_COUNT]
+        [SHADER_MASK_COUNT]
+        [SHADER_IN_COUNT];
+    glamor_glyph_cache_t glyphCaches[GLAMOR_NUM_GLYPH_CACHE_FORMATS];
+    Bool glyph_cache_initialized;
+
+    /* shaders to restore a texture to another texture. */
+    GLint finish_access_prog[2];
+    GLint finish_access_revert[2];
+    GLint finish_access_swap_rb[2];
+
+    /* glamor_tile */
+    GLint tile_prog;
+    GLint tile_wh;
+
+    /* glamor gradient, 0 for small nstops, 1 for
+       large nstops and 2 for dynamic generate. */
+    GLint gradient_prog[SHADER_GRADIENT_COUNT][3];
+    int linear_max_nstops;
+    int radial_max_nstops;
+
+    /* glamor trapezoid shader. */
+    GLint trapezoid_prog;
+
+    PixmapPtr *back_pixmap;
+    int screen_fbo;
+    struct glamor_saved_procs saved_procs;
+    char delayed_fallback_string[GLAMOR_DELAYED_STRING_MAX + 1];
+    int delayed_fallback_pending;
+    int flags;
+    int state;
+    unsigned int render_idle_cnt;
+    ScreenPtr screen;
+    int dri3_enabled;
+
+    /* xv */
+    GLint xv_prog;
+
+    struct glamor_context ctx;
+} glamor_screen_private;
+
+typedef enum glamor_access {
+    GLAMOR_ACCESS_RO,
+    GLAMOR_ACCESS_RW,
+} glamor_access_t;
+
+enum glamor_fbo_state {
+    /** There is no storage attached to the pixmap. */
+    GLAMOR_FBO_UNATTACHED,
+    /**
+     * The pixmap has FBO storage attached, but devPrivate.ptr doesn't
+     * point at anything.
+     */
+    GLAMOR_FBO_NORMAL,
+    /**
+     * The FBO is present and can be accessed as a linear memory
+     * mapping through devPrivate.ptr.
+     */
+    GLAMOR_FBO_DOWNLOADED,
+};
+
+/* glamor_pixmap_fbo:
+ * @list:    to be used to link to the cache pool list.
+ * @expire:  when push to cache pool list, set a expire count.
+ *          will be freed when glamor_priv->tick is equal or
+ *          larger than this expire count in block handler.
+ * @pbo_valid: The pbo has a valid copy of the pixmap's data.
+ * @tex:     attached texture.
+ * @fb:      attached fbo.
+ * @pbo:     attached pbo.
+ * @width:   width of this fbo.
+ * @height:  height of this fbo.
+ * @format:  internal format of this fbo's texture.
+ * @type:    internal type of this fbo's texture.
+ * @glamor_priv: point to glamor private data.
+ */
+typedef struct glamor_pixmap_fbo {
+    struct xorg_list list;
+    unsigned int expire;
+    unsigned char pbo_valid;
+    GLuint tex;
+    GLuint fb;
+    GLuint pbo;
+    int width;
+    int height;
+    GLenum format;
+    GLenum type;
+    glamor_screen_private *glamor_priv;
+} glamor_pixmap_fbo;
+
+/*
+ * glamor_pixmap_private - glamor pixmap's private structure.
+ * @gl_tex:  The pixmap is in a gl texture originally.
+ * @is_picture: The drawable is attached to a picture.
+ * @pict_format: the corresponding picture's format.
+ * @pixmap: The corresponding pixmap's pointer.
+ *
+ * For GLAMOR_TEXTURE_LARGE, nbox should larger than 1.
+ * And the box and fbo will both have nbox elements.
+ * and box[i] store the relatively coords in this pixmap
+ * of the fbo[i]. The reason why use boxes not region to
+ * represent this structure is we may need to use overlapped
+ * boxes for one pixmap for some special reason.
+ *
+ * pixmap
+ * ******************
+ * *  fbo0 * fbo1   *
+ * *       *        *
+ * ******************
+ * *  fbo2 * fbo3   *
+ * *       *        *
+ * ******************
+ *
+ * Let's assume the texture has size of 1024x1024
+ * box[0] = {0,0,1024,1024}
+ * box[1] = {1024,0,2048,2048}
+ * ...
+ *
+ * For GLAMOR_TEXTURE_ATLAS nbox should be 1. And box
+ * and fbo both has one elements, and the box store
+ * the relatively coords in the fbo of this pixmap:
+ *
+ * fbo
+ * ******************
+ * *   pixmap       *
+ * *   *********    *
+ * *   *       *    *
+ * *   *********    *
+ * *                *
+ * ******************
+ *
+ * Assume the pixmap is at the (100,100) relatively to
+ * the fbo's origin.
+ * box[0]={100, 100, 1124, 1124};
+ *
+ * Considering large pixmap is not a normal case, to keep
+ * it simple, I designe it as the following way.
+ * When deal with a large pixmap, it split the working
+ * rectangle into serval boxes, and each box fit into a
+ * corresponding fbo. And then the rendering function will
+ * loop from the left-top box to the right-bottom box,
+ * each time, we will set current box and current fbo
+ * to the box and fbo elements. Thus the inner routines
+ * can handle it as normal, only the coords calculation need
+ * to aware of it's large pixmap.
+ *
+ * Currently, we haven't implemented the atlas pixmap.
+ *
+ **/
+
+typedef struct glamor_pixmap_clipped_regions {
+    int block_idx;
+    RegionPtr region;
+} glamor_pixmap_clipped_regions;
+
+#define SET_PIXMAP_FBO_CURRENT(priv, idx)                              \
+  do {                                                                 \
+       if (priv->type == GLAMOR_TEXTURE_LARGE) {                       \
+               (priv)->large.base.fbo = priv->large.fbo_array[idx];    \
+               (priv)->large.box = priv->large.box_array[idx];         \
+       }                                                               \
+  } while(0)
+
+typedef struct glamor_pixmap_private_base {
+    glamor_pixmap_type_t type;
+    enum glamor_fbo_state gl_fbo;
+    /**
+     * If devPrivate.ptr is non-NULL (meaning we're within
+     * glamor_prepare_access), determies whether we should re-upload
+     * that data on glamor_finish_access().
+     */
+    glamor_access_t map_access;
+    unsigned char is_picture:1;
+    unsigned char gl_tex:1;
+    glamor_pixmap_fbo *fbo;
+    PixmapPtr pixmap;
+    BoxRec box;
+    int drm_stride;
+    glamor_screen_private *glamor_priv;
+    PicturePtr picture;
+#if GLAMOR_HAS_GBM
+    EGLImageKHR image;
+#endif
+} glamor_pixmap_private_base_t;
+
+/*
+ * @base.fbo: current fbo.
+ * @box: current fbo's coords in the whole pixmap.
+ * @block_w: block width of this large pixmap.
+ * @block_h: block height of this large pixmap.
+ * @block_wcnt: block count in one block row.
+ * @block_hcnt: block count in one block column.
+ * @nbox: total block count.
+ * @box_array: contains each block's corresponding box.
+ * @fbo_array: contains each block's fbo pointer.
+ *
+ **/
+typedef struct glamor_pixmap_private_large {
+    union {
+        glamor_pixmap_type_t type;
+        glamor_pixmap_private_base_t base;
+    };
+    BoxRec box;
+    int block_w;
+    int block_h;
+    int block_wcnt;
+    int block_hcnt;
+    int nbox;
+    BoxPtr box_array;
+    glamor_pixmap_fbo **fbo_array;
+} glamor_pixmap_private_large_t;
+
+/*
+ * @box: the relative coords in the corresponding fbo.
+ */
+typedef struct glamor_pixmap_private_atlas {
+    union {
+        glamor_pixmap_type_t type;
+        glamor_pixmap_private_base_t base;
+    };
+    BoxRec box;
+} glamor_pixmap_private_atlas_t;
+
+typedef struct glamor_pixmap_private {
+    union {
+        glamor_pixmap_type_t type;
+        glamor_pixmap_private_base_t base;
+        glamor_pixmap_private_large_t large;
+        glamor_pixmap_private_atlas_t atlas;
+    };
+} glamor_pixmap_private;
+
+static inline glamor_pixmap_fbo *
+glamor_pixmap_fbo_at(glamor_pixmap_private *priv, int x, int y)
+{
+    if (priv->type == GLAMOR_TEXTURE_LARGE) {
+        assert(x < priv->large.block_wcnt);
+        assert(y < priv->large.block_hcnt);
+        return priv->large.fbo_array[y * priv->large.block_wcnt + x];
+    }
+    assert (x == 0);
+    assert (y == 0);
+    return priv->base.fbo;
+}
+
+static inline BoxPtr
+glamor_pixmap_box_at(glamor_pixmap_private *priv, int x, int y)
+{
+    if (priv->type == GLAMOR_TEXTURE_LARGE) {
+        assert(x < priv->large.block_wcnt);
+        assert(y < priv->large.block_hcnt);
+        return &priv->large.box_array[y * priv->large.block_wcnt + x];
+    }
+    assert (x == 0);
+    assert (y == 0);
+    return &priv->base.box;
+}
+
+static inline int
+glamor_pixmap_wcnt(glamor_pixmap_private *priv)
+{
+    if (priv->type == GLAMOR_TEXTURE_LARGE)
+        return priv->large.block_wcnt;
+    return 1;
+}
+
+static inline int
+glamor_pixmap_hcnt(glamor_pixmap_private *priv)
+{
+    if (priv->type == GLAMOR_TEXTURE_LARGE)
+        return priv->large.block_hcnt;
+    return 1;
+}
+
+#define glamor_pixmap_loop(priv, x, y)                  \
+    for (y = 0; y < glamor_pixmap_hcnt(priv); y++)      \
+        for (x = 0; x < glamor_pixmap_wcnt(priv); x++)
+
+/* 
+ * Pixmap dynamic status, used by dynamic upload feature.
+ *
+ * GLAMOR_NONE:  initial status, don't need to do anything.
+ * GLAMOR_UPLOAD_PENDING: marked as need to be uploaded to gl texture.
+ * GLAMOR_UPLOAD_DONE: the pixmap has been uploaded successfully.
+ * GLAMOR_UPLOAD_FAILED: fail to upload the pixmap.
+ *
+ * */
+typedef enum glamor_pixmap_status {
+    GLAMOR_NONE,
+    GLAMOR_UPLOAD_PENDING,
+    GLAMOR_UPLOAD_DONE,
+    GLAMOR_UPLOAD_FAILED
+} glamor_pixmap_status_t;
+
+extern DevPrivateKey glamor_screen_private_key;
+extern DevPrivateKey glamor_pixmap_private_key;
+static inline glamor_screen_private *
+glamor_get_screen_private(ScreenPtr screen)
+{
+    return (glamor_screen_private *)
+        dixLookupPrivate(&screen->devPrivates, glamor_screen_private_key);
+}
+
+static inline void
+glamor_set_screen_private(ScreenPtr screen, glamor_screen_private *priv)
+{
+    dixSetPrivate(&screen->devPrivates, glamor_screen_private_key, priv);
+}
+
+static inline glamor_pixmap_private *
+glamor_get_pixmap_private(PixmapPtr pixmap)
+{
+    glamor_pixmap_private *priv;
+
+    priv = dixLookupPrivate(&pixmap->devPrivates, glamor_pixmap_private_key);
+    if (!priv) {
+        glamor_set_pixmap_type(pixmap, GLAMOR_MEMORY);
+        priv = dixLookupPrivate(&pixmap->devPrivates,
+                                glamor_pixmap_private_key);
+    }
+    return priv;
+}
+
+void glamor_set_pixmap_private(PixmapPtr pixmap, glamor_pixmap_private *priv);
+
+/**
+ * Returns TRUE if the given planemask covers all the significant bits in the
+ * pixel values for pDrawable.
+ */
+static inline Bool
+glamor_pm_is_solid(DrawablePtr drawable, unsigned long planemask)
+{
+    return (planemask & FbFullMask(drawable->depth)) ==
+        FbFullMask(drawable->depth);
+}
+
+extern int glamor_debug_level;
+
+/* glamor.c */
+PixmapPtr glamor_get_drawable_pixmap(DrawablePtr drawable);
+
+glamor_pixmap_fbo *glamor_pixmap_detach_fbo(glamor_pixmap_private *
+                                            pixmap_priv);
+void glamor_pixmap_attach_fbo(PixmapPtr pixmap, glamor_pixmap_fbo *fbo);
+glamor_pixmap_fbo *glamor_create_fbo_from_tex(glamor_screen_private *
+                                              glamor_priv, int w, int h,
+                                              GLenum format, GLint tex,
+                                              int flag);
+glamor_pixmap_fbo *glamor_create_fbo(glamor_screen_private *glamor_priv, int w,
+                                     int h, GLenum format, int flag);
+void glamor_destroy_fbo(glamor_pixmap_fbo *fbo);
+void glamor_pixmap_destroy_fbo(glamor_pixmap_private *priv);
+void glamor_purge_fbo(glamor_pixmap_fbo *fbo);
+
+void glamor_init_pixmap_fbo(ScreenPtr screen);
+void glamor_fini_pixmap_fbo(ScreenPtr screen);
+Bool glamor_pixmap_fbo_fixup(ScreenPtr screen, PixmapPtr pixmap);
+void glamor_fbo_expire(glamor_screen_private *glamor_priv);
+
+glamor_pixmap_fbo *glamor_create_fbo_array(glamor_screen_private *glamor_priv,
+                                           int w, int h, GLenum format,
+                                           int flag, int block_w, int block_h,
+                                           glamor_pixmap_private *);
+
+/* glamor_copyarea.c */
+RegionPtr
+
+glamor_copy_area(DrawablePtr src, DrawablePtr dst, GCPtr gc,
+                 int srcx, int srcy, int width, int height, int dstx, int dsty);
+void glamor_copy_n_to_n(DrawablePtr src, DrawablePtr dst, GCPtr gc,
+                        BoxPtr box, int nbox, int dx, int dy, Bool reverse,
+                        Bool upsidedown, Pixel bitplane, void *closure);
+
+/* glamor_core.c */
+Bool glamor_prepare_access(DrawablePtr drawable, glamor_access_t access);
+void glamor_finish_access(DrawablePtr drawable);
+Bool glamor_prepare_access_window(WindowPtr window);
+void glamor_finish_access_window(WindowPtr window);
+Bool glamor_prepare_access_gc(GCPtr gc);
+void glamor_finish_access_gc(GCPtr gc);
+void glamor_init_finish_access_shaders(ScreenPtr screen);
+void glamor_fini_finish_access_shaders(ScreenPtr screen);
+const Bool glamor_get_drawable_location(const DrawablePtr drawable);
+void glamor_get_drawable_deltas(DrawablePtr drawable, PixmapPtr pixmap,
+                                int *x, int *y);
+Bool glamor_stipple(PixmapPtr pixmap, PixmapPtr stipple,
+                    int x, int y, int width, int height,
+                    unsigned char alu, unsigned long planemask,
+                    unsigned long fg_pixel, unsigned long bg_pixel,
+                    int stipple_x, int stipple_y);
+GLint glamor_compile_glsl_prog(GLenum type, const char *source);
+void glamor_link_glsl_prog(ScreenPtr screen, GLint prog,
+                           const char *format, ...) _X_ATTRIBUTE_PRINTF(3,4);
+void glamor_get_color_4f_from_pixel(PixmapPtr pixmap,
+                                    unsigned long fg_pixel, GLfloat *color);
+
+int glamor_set_destination_pixmap(PixmapPtr pixmap);
+int glamor_set_destination_pixmap_priv(glamor_pixmap_private *pixmap_priv);
+void glamor_set_destination_pixmap_fbo(glamor_pixmap_fbo *, int, int, int, int);
+
+/* nc means no check. caller must ensure this pixmap has valid fbo.
+ * usually use the GLAMOR_PIXMAP_PRIV_HAS_FBO firstly. 
+ * */
+void glamor_set_destination_pixmap_priv_nc(glamor_pixmap_private *pixmap_priv);
+
+glamor_pixmap_fbo *glamor_es2_pixmap_read_prepare(PixmapPtr source, int x,
+                                                  int y, int w, int h,
+                                                  GLenum format, GLenum type,
+                                                  int no_alpha, int revert,
+                                                  int swap_rb);
+
+Bool glamor_set_alu(ScreenPtr screen, unsigned char alu);
+Bool glamor_set_planemask(PixmapPtr pixmap, unsigned long planemask);
+RegionPtr glamor_bitmap_to_region(PixmapPtr pixmap);
+
+/* glamor_fill.c */
+Bool glamor_fill(DrawablePtr drawable,
+                 GCPtr gc, int x, int y, int width, int height, Bool fallback);
+Bool glamor_solid(PixmapPtr pixmap, int x, int y, int width, int height,
+                  unsigned char alu, unsigned long planemask,
+                  unsigned long fg_pixel);
+Bool glamor_solid_boxes(PixmapPtr pixmap,
+                        BoxPtr box, int nbox, unsigned long fg_pixel);
+
+void glamor_init_solid_shader(ScreenPtr screen);
+void glamor_fini_solid_shader(ScreenPtr screen);
+
+/* glamor_glyphs.c */
+Bool glamor_realize_glyph_caches(ScreenPtr screen);
+void glamor_glyphs_fini(ScreenPtr screen);
+void glamor_glyphs(CARD8 op,
+                   PicturePtr pSrc,
+                   PicturePtr pDst,
+                   PictFormatPtr maskFormat,
+                   INT16 xSrc,
+                   INT16 ySrc, int nlist, GlyphListPtr list, GlyphPtr *glyphs);
+
+/* glamor_polylines.c */
+void glamor_poly_lines(DrawablePtr drawable, GCPtr gc, int mode, int n,
+                       DDXPointPtr points);
+
+/* glamor_render.c */
+Bool glamor_composite_clipped_region(CARD8 op,
+                                     PicturePtr source,
+                                     PicturePtr mask,
+                                     PicturePtr dest,
+                                     glamor_pixmap_private *soruce_pixmap_priv,
+                                     glamor_pixmap_private *mask_pixmap_priv,
+                                     glamor_pixmap_private *dest_pixmap_priv,
+                                     RegionPtr region,
+                                     int x_source,
+                                     int y_source,
+                                     int x_mask, int y_mask,
+                                     int x_dest, int y_dest);
+
+void glamor_composite(CARD8 op,
+                      PicturePtr pSrc,
+                      PicturePtr pMask,
+                      PicturePtr pDst,
+                      INT16 xSrc,
+                      INT16 ySrc,
+                      INT16 xMask,
+                      INT16 yMask,
+                      INT16 xDst, INT16 yDst, CARD16 width, CARD16 height);
+
+void glamor_init_composite_shaders(ScreenPtr screen);
+void glamor_fini_composite_shaders(ScreenPtr screen);
+void glamor_composite_glyph_rects(CARD8 op,
+                                  PicturePtr src, PicturePtr mask,
+                                  PicturePtr dst, int nrect,
+                                  glamor_composite_rect_t *rects);
+void glamor_composite_rects(CARD8 op,
+                            PicturePtr pDst,
+                            xRenderColor *color, int nRect, xRectangle *rects);
+void glamor_init_trapezoid_shader(ScreenPtr screen);
+void glamor_fini_trapezoid_shader(ScreenPtr screen);
+PicturePtr glamor_convert_gradient_picture(ScreenPtr screen,
+                                           PicturePtr source,
+                                           int x_source,
+                                           int y_source, int width, int height);
+
+Bool glamor_composite_choose_shader(CARD8 op,
+                                    PicturePtr source,
+                                    PicturePtr mask,
+                                    PicturePtr dest,
+                                    glamor_pixmap_private *source_pixmap_priv,
+                                    glamor_pixmap_private *mask_pixmap_priv,
+                                    glamor_pixmap_private *dest_pixmap_priv,
+                                    struct shader_key *s_key,
+                                    glamor_composite_shader ** shader,
+                                    struct blendinfo *op_info,
+                                    PictFormatShort *psaved_source_format);
+
+void glamor_composite_set_shader_blend(glamor_pixmap_private *dest_priv,
+                                       struct shader_key *key,
+                                       glamor_composite_shader *shader,
+                                       struct blendinfo *op_info);
+
+void *glamor_setup_composite_vbo(ScreenPtr screen, int n_verts);
+
+/* glamor_trapezoid.c */
+void glamor_trapezoids(CARD8 op,
+                       PicturePtr src, PicturePtr dst,
+                       PictFormatPtr mask_format, INT16 x_src, INT16 y_src,
+                       int ntrap, xTrapezoid *traps);
+
+/* glamor_tile.c */
+Bool glamor_tile(PixmapPtr pixmap, PixmapPtr tile,
+                 int x, int y, int width, int height,
+                 unsigned char alu, unsigned long planemask,
+                 int tile_x, int tile_y);
+void glamor_init_tile_shader(ScreenPtr screen);
+void glamor_fini_tile_shader(ScreenPtr screen);
+
+/* glamor_gradient.c */
+void glamor_init_gradient_shader(ScreenPtr screen);
+void glamor_fini_gradient_shader(ScreenPtr screen);
+PicturePtr glamor_generate_linear_gradient_picture(ScreenPtr screen,
+                                                   PicturePtr src_picture,
+                                                   int x_source, int y_source,
+                                                   int width, int height,
+                                                   PictFormatShort format);
+PicturePtr glamor_generate_radial_gradient_picture(ScreenPtr screen,
+                                                   PicturePtr src_picture,
+                                                   int x_source, int y_source,
+                                                   int width, int height,
+                                                   PictFormatShort format);
+
+/* glamor_triangles.c */
+void glamor_triangles(CARD8 op,
+                      PicturePtr pSrc,
+                      PicturePtr pDst,
+                      PictFormatPtr maskFormat,
+                      INT16 xSrc, INT16 ySrc, int ntris, xTriangle * tris);
+
+/* glamor_pixmap.c */
+
+void glamor_pixmap_init(ScreenPtr screen);
+void glamor_pixmap_fini(ScreenPtr screen);
+
+/* glamor_vbo.c */
+
+void glamor_init_vbo(ScreenPtr screen);
+void glamor_fini_vbo(ScreenPtr screen);
+
+void *
+glamor_get_vbo_space(ScreenPtr screen, unsigned size, char **vbo_offset);
+
+void
+glamor_put_vbo_space(ScreenPtr screen);
+
+/** 
+ * Download a pixmap's texture to cpu memory. If success,
+ * One copy of current pixmap's texture will be put into
+ * the pixmap->devPrivate.ptr. Will use pbo to map to 
+ * the pointer if possible.
+ * The pixmap must be a gl texture pixmap. gl_fbo must be GLAMOR_FBO_NORMAL and
+ * gl_tex must be 1. Used by glamor_prepare_access.
+ *
+ */
+Bool glamor_download_pixmap_to_cpu(PixmapPtr pixmap, glamor_access_t access);
+
+void *glamor_download_sub_pixmap_to_cpu(PixmapPtr pixmap, int x, int y, int w,
+                                        int h, int stride, void *bits, int pbo,
+                                        glamor_access_t access);
+
+/**
+ * Restore a pixmap's data which is downloaded by 
+ * glamor_download_pixmap_to_cpu to its original 
+ * gl texture. Used by glamor_finish_access. 
+ *
+ * The pixmap must originally be a texture -- gl_fbo must be
+ * GLAMOR_FBO_NORMAL.
+ **/
+void glamor_restore_pixmap_to_texture(PixmapPtr pixmap);
+
+/**
+ * According to the flag,
+ * if the flag is GLAMOR_CREATE_FBO_NO_FBO then just ensure
+ * the fbo has a valid texture. Otherwise, it will ensure
+ * the fbo has valid texture and attach to a valid fb.
+ * If the fbo already has a valid glfbo then do nothing.
+ */
+Bool glamor_pixmap_ensure_fbo(PixmapPtr pixmap, GLenum format, int flag);
+
+/**
+ * Upload a pixmap to gl texture. Used by dynamic pixmap
+ * uploading feature. The pixmap must be a software pixmap.
+ * This function will change current FBO and current shaders.
+ */
+enum glamor_pixmap_status glamor_upload_pixmap_to_texture(PixmapPtr pixmap);
+
+Bool glamor_upload_sub_pixmap_to_texture(PixmapPtr pixmap, int x, int y, int w,
+                                         int h, int stride, void *bits,
+                                         int pbo);
+
+PixmapPtr glamor_get_sub_pixmap(PixmapPtr pixmap, int x, int y,
+                                int w, int h, glamor_access_t access);
+void glamor_put_sub_pixmap(PixmapPtr sub_pixmap, PixmapPtr pixmap, int x, int y,
+                           int w, int h, glamor_access_t access);
+
+glamor_pixmap_clipped_regions *
+glamor_compute_clipped_regions(glamor_pixmap_private *priv,
+                               RegionPtr region, int *clipped_nbox,
+                               int repeat_type, int reverse,
+                               int upsidedown);
+
+glamor_pixmap_clipped_regions *
+glamor_compute_clipped_regions_ext(glamor_pixmap_private *pixmap_priv,
+                                   RegionPtr region, int *n_region,
+                                   int inner_block_w, int inner_block_h,
+                                   int reverse, int upsidedown);
+
+glamor_pixmap_clipped_regions *
+glamor_compute_transform_clipped_regions(glamor_pixmap_private *priv,
+                                         struct pixman_transform *transform,
+                                         RegionPtr region,
+                                         int *n_region, int dx, int dy,
+                                         int repeat_type, int reverse,
+                                         int upsidedown);
+
+Bool glamor_composite_largepixmap_region(CARD8 op,
+                                         PicturePtr source,
+                                         PicturePtr mask,
+                                         PicturePtr dest,
+                                         glamor_pixmap_private *source_pixmap_priv,
+                                         glamor_pixmap_private *mask_pixmap_priv,
+                                         glamor_pixmap_private *dest_pixmap_priv,
+                                         RegionPtr region, Bool force_clip,
+                                         INT16 x_source,
+                                         INT16 y_source,
+                                         INT16 x_mask,
+                                         INT16 y_mask,
+                                         INT16 x_dest, INT16 y_dest,
+                                         CARD16 width, CARD16 height);
+
+Bool glamor_get_transform_block_size(struct pixman_transform *transform,
+                                     int block_w, int block_h,
+                                     int *transformed_block_w,
+                                     int *transformed_block_h);
+
+void glamor_get_transform_extent_from_box(struct pixman_box32 *temp_box,
+                                          struct pixman_transform *transform);
+
+/**
+ * Upload a picture to gl texture. Similar to the
+ * glamor_upload_pixmap_to_texture. Used in rendering.
+ **/
+enum glamor_pixmap_status glamor_upload_picture_to_texture(PicturePtr picture);
+
+/**
+ * Upload bits to a pixmap's texture. This function will
+ * convert the bits to the specified format/type format
+ * if the conversion is unavoidable.
+ **/
+Bool glamor_upload_bits_to_pixmap_texture(PixmapPtr pixmap, GLenum format,
+                                          GLenum type, int no_alpha, int revert,
+                                          int swap_rb, void *bits);
+
+/**
+ * Destroy all the resources allocated on the uploading
+ * phase, includs the tex and fbo.
+ **/
+void glamor_destroy_upload_pixmap(PixmapPtr pixmap);
+
+int glamor_create_picture(PicturePtr picture);
+
+void glamor_set_window_pixmap(WindowPtr pWindow, PixmapPtr pPixmap);
+
+Bool glamor_prepare_access_picture(PicturePtr picture, glamor_access_t access);
+
+void glamor_finish_access_picture(PicturePtr picture);
+
+void glamor_destroy_picture(PicturePtr picture);
+
+/* fixup a fbo to the exact size as the pixmap. */
+Bool glamor_fixup_pixmap_priv(ScreenPtr screen,
+                              glamor_pixmap_private *pixmap_priv);
+
+void glamor_picture_format_fixup(PicturePtr picture,
+                                 glamor_pixmap_private *pixmap_priv);
+
+void glamor_add_traps(PicturePtr pPicture,
+                      INT16 x_off, INT16 y_off, int ntrap, xTrap *traps);
+
+RegionPtr glamor_copy_plane(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
+                            int srcx, int srcy, int w, int h,
+                            int dstx, int dsty,
+                            unsigned long bitPlane);
+
+/* glamor_text.c */
+int glamor_poly_text8(DrawablePtr pDrawable, GCPtr pGC,
+                      int x, int y, int count, char *chars);
+
+int glamor_poly_text16(DrawablePtr pDrawable, GCPtr pGC,
+                       int x, int y, int count, unsigned short *chars);
+
+void glamor_image_text8(DrawablePtr pDrawable, GCPtr pGC,
+                        int x, int y, int count, char *chars);
+
+void glamor_image_text16(DrawablePtr pDrawable, GCPtr pGC,
+                         int x, int y, int count, unsigned short *chars);
+
+/* glamor_spans.c */
+void
+glamor_fill_spans(DrawablePtr drawable,
+                  GCPtr gc,
+                  int n, DDXPointPtr points, int *widths, int sorted);
+
+void
+glamor_get_spans(DrawablePtr drawable, int wmax,
+                 DDXPointPtr points, int *widths, int count, char *dst);
+
+void
+glamor_set_spans(DrawablePtr drawable, GCPtr gc, char *src,
+                 DDXPointPtr points, int *widths, int numPoints, int sorted);
+
+/* glamor_rects.c */
+void
+glamor_poly_fill_rect(DrawablePtr drawable,
+                      GCPtr gc, int nrect, xRectangle *prect);
+
+/* glamor_image.c */
+void
+glamor_put_image(DrawablePtr drawable, GCPtr gc, int depth, int x, int y,
+                 int w, int h, int leftPad, int format, char *bits);
+
+void
+glamor_get_image(DrawablePtr pDrawable, int x, int y, int w, int h,
+                 unsigned int format, unsigned long planeMask, char *d);
+
+/* glamor_glyphblt.c */
+void glamor_image_glyph_blt(DrawablePtr pDrawable, GCPtr pGC,
+                            int x, int y, unsigned int nglyph,
+                            CharInfoPtr *ppci, void *pglyphBase);
+
+void glamor_poly_glyph_blt(DrawablePtr pDrawable, GCPtr pGC,
+                           int x, int y, unsigned int nglyph,
+                           CharInfoPtr *ppci, void *pglyphBase);
+
+void glamor_push_pixels(GCPtr pGC, PixmapPtr pBitmap,
+                        DrawablePtr pDrawable, int w, int h, int x, int y);
+
+void glamor_poly_point(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt,
+                       DDXPointPtr ppt);
+
+void glamor_poly_segment(DrawablePtr pDrawable, GCPtr pGC, int nseg,
+                         xSegment *pSeg);
+
+void glamor_poly_line(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt,
+                      DDXPointPtr ppt);
+
+void glamor_composite_rectangles(CARD8 op,
+                                 PicturePtr dst,
+                                 xRenderColor *color,
+                                 int num_rects, xRectangle *rects);
+
+/* glamor_xv */
+typedef struct {
+    uint32_t transform_index;
+    uint32_t gamma;             /* gamma value x 1000 */
+    int brightness;
+    int saturation;
+    int hue;
+    int contrast;
+
+    DrawablePtr pDraw;
+    PixmapPtr pPixmap;
+    uint32_t src_pitch;
+    uint8_t *src_addr;
+    int src_w, src_h, dst_w, dst_h;
+    int src_x, src_y, drw_x, drw_y;
+    int w, h;
+    RegionRec clip;
+    PixmapPtr src_pix[3];       /* y, u, v for planar */
+    int src_pix_w, src_pix_h;
+} glamor_port_private;
+
+void glamor_init_xv_shader(ScreenPtr screen);
+void glamor_fini_xv_shader(ScreenPtr screen);
+
+#include"glamor_utils.h"
+
+/* Dynamic pixmap upload to texture if needed. 
+ * Sometimes, the target is a gl texture pixmap/picture,
+ * but the source or mask is in cpu memory. In that case,
+ * upload the source/mask to gl texture and then avoid 
+ * fallback the whole process to cpu. Most of the time,
+ * this will increase performance obviously. */
+
+#define GLAMOR_PIXMAP_DYNAMIC_UPLOAD
+#define GLAMOR_GRADIENT_SHADER
+#define GLAMOR_TRAPEZOID_SHADER
+#define GLAMOR_TEXTURED_LARGE_PIXMAP 1
+#define WALKAROUND_LARGE_TEXTURE_MAP
+#if 0
+#define MAX_FBO_SIZE 32         /* For test purpose only. */
+#endif
+//#define GLYPHS_NO_EDEGEMAP_OVERLAP_CHECK
+#define GLYPHS_EDEGE_OVERLAP_LOOSE_CHECK
+
+#include "glamor_font.h"
+
+#endif                          /* GLAMOR_PRIV_H */
diff --git a/glamor/glamor_program.c b/glamor/glamor_program.c
new file mode 100644 (file)
index 0000000..0f4d0f0
--- /dev/null
@@ -0,0 +1,386 @@
+/*
+ * Copyright Â© 2014 Keith Packard
+ *
+ * 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 the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  The copyright holders make no representations
+ * about the suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS 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.
+ */
+
+#include "glamor_priv.h"
+#include "glamor_transform.h"
+#include "glamor_program.h"
+
+static Bool
+use_solid(PixmapPtr pixmap, GCPtr gc, glamor_program *prog, void *arg)
+{
+    return glamor_set_solid(pixmap, gc, TRUE, prog->fg_uniform);
+}
+
+const glamor_facet glamor_fill_solid = {
+    .name = "solid",
+    .fs_exec = "       gl_FragColor = fg;\n",
+    .locations = glamor_program_location_fg,
+    .use = use_solid,
+};
+
+static Bool
+use_tile(PixmapPtr pixmap, GCPtr gc, glamor_program *prog, void *arg)
+{
+    return glamor_set_tiled(pixmap, gc, prog->fill_offset_uniform, prog->fill_size_uniform);
+}
+
+static const glamor_facet glamor_fill_tile = {
+    .name = "tile",
+    .vs_exec =  "       fill_pos = (fill_offset + primitive.xy + pos) / fill_size;\n",
+    .fs_exec =  "       gl_FragColor = texture2D(sampler, fill_pos);\n",
+    .locations = glamor_program_location_fill,
+    .use = use_tile,
+};
+
+#if 0
+static Bool
+use_stipple(PixmapPtr pixmap, GCPtr gc, glamor_program *prog)
+{
+    return glamor_set_stippled(pixmap, gc, prog->fg_uniform, prog->fill_offset_uniform, prog->fill_size_uniform);
+}
+
+static const glamor_facet glamor_fill_stipple = {
+    .name = "stipple",
+    .version = 130,
+    .vs_exec =  "       fill_pos = fill_offset + primitive.xy + pos;\n";
+    .fs_exec = ("       if (texelFetch(sampler, ivec2(mod(fill_pos,fill_size)), 0).x == 0)\n"
+                "               discard;\n"
+                "       gl_FragColor = fg;\n")
+    .locations = glamor_program_location_fg | glamor_program_location_fill
+    .use = use_stipple,
+};
+
+static const glamor_facet glamor_fill_opaque_stipple = {
+    .name = "opaque_stipple",
+    .version = 130,
+    .vs_exec =  "       fill_pos = fill_offset + primitive.xy + pos;\n";
+    .fs_exec = ("       if (texelFetch(sampler, ivec2(mod(fill_pos,fill_size)), 0).x == 0)\n"
+                "               gl_FragColor = bg;\n"
+                "       else\n"
+                "               gl_FragColor = fg;\n"),
+    .locations = glamor_program_location_fg | glamor_program_location_bg | glamor_program_location_fill
+    .use = use_opaque_stipple
+};
+#endif
+
+static const glamor_facet *glamor_facet_fill[4] = {
+    &glamor_fill_solid,
+    &glamor_fill_tile,
+    NULL,
+    NULL,
+};
+
+typedef struct {
+    glamor_program_location     location;
+    const char                  *vs_vars;
+    const char                  *fs_vars;
+} glamor_location_var;
+
+static glamor_location_var location_vars[] = {
+    {
+        .location = glamor_program_location_fg,
+        .fs_vars = "uniform vec4 fg;\n"
+    },
+    {
+        .location = glamor_program_location_bg,
+        .fs_vars = "uniform vec4 bg;\n"
+    },
+    {
+        .location = glamor_program_location_fill,
+        .vs_vars = ("uniform vec2 fill_offset;\n"
+                    "uniform vec2 fill_size;\n"
+                    "varying vec2 fill_pos;\n"),
+        .fs_vars = ("uniform sampler2D sampler;\n"
+                    "uniform vec2 fill_size;\n"
+                    "varying vec2 fill_pos;\n")
+    },
+    {
+        .location = glamor_program_location_font,
+        .fs_vars = "uniform usampler2D font;\n",
+    },
+};
+
+#define NUM_LOCATION_VARS       (sizeof location_vars / sizeof location_vars[0])
+
+static char *
+add_var(char *cur, const char *add)
+{
+    char *new;
+
+    if (!add)
+        return cur;
+
+    new = realloc(cur, strlen(cur) + strlen(add) + 1);
+    if (!new) {
+        free(cur);
+        return NULL;
+    }
+    strcat(new, add);
+    return new;
+}
+
+static char *
+vs_location_vars(glamor_program_location locations)
+{
+    int l;
+    char *vars = strdup("");
+
+    for (l = 0; vars && l < NUM_LOCATION_VARS; l++)
+        if (locations & location_vars[l].location)
+            vars = add_var(vars, location_vars[l].vs_vars);
+    return vars;
+}
+
+static char *
+fs_location_vars(glamor_program_location locations)
+{
+    int l;
+    char *vars = strdup("");
+
+    for (l = 0; vars && l < NUM_LOCATION_VARS; l++)
+        if (locations & location_vars[l].location)
+            vars = add_var(vars, location_vars[l].fs_vars);
+    return vars;
+}
+
+static const char vs_template[] =
+    "%s"                                /* version */
+    "%s"                                /* prim vs_vars */
+    "%s"                                /* fill vs_vars */
+    "%s"                                /* location vs_vars */
+    GLAMOR_DECLARE_MATRIX
+    "void main() {\n"
+    "%s"                                /* prim vs_exec, outputs 'pos' and gl_Position */
+    "%s"                                /* fill vs_exec */
+    "}\n";
+
+static const char fs_template[] =
+    "%s"                                /* version */
+    GLAMOR_DEFAULT_PRECISION
+    "%s"                                /* prim fs_vars */
+    "%s"                                /* fill fs_vars */
+    "%s"                                /* location fs_vars */
+    "void main() {\n"
+    "%s"                                /* prim fs_exec */
+    "%s"                                /* fill fs_exec */
+    "}\n";
+
+static const char *
+str(const char *s)
+{
+    if (!s)
+        return "";
+    return s;
+}
+
+static const glamor_facet facet_null_fill = {
+    .name = ""
+};
+
+static GLint
+glamor_get_uniform(glamor_program               *prog,
+                   glamor_program_location      location,
+                   const char                   *name)
+{
+    GLint uniform;
+    if (location && (prog->locations & location) == 0)
+        return -2;
+    uniform = glGetUniformLocation(prog->prog, name);
+#if DBG
+    ErrorF("%s uniform %d\n", name, uniform);
+#endif
+    return uniform;
+}
+
+Bool
+glamor_build_program(ScreenPtr          screen,
+                     glamor_program     *prog,
+                     const glamor_facet *prim,
+                     const glamor_facet *fill)
+{
+    glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
+
+    glamor_program_location     locations = prim->locations;
+    glamor_program_flag         flags = prim->flags;
+
+    int                         version = prim->version;
+    char                        *version_string = NULL;
+
+    char                        *fs_vars = NULL;
+    char                        *vs_vars = NULL;
+
+    char                        *vs_prog_string;
+    char                        *fs_prog_string;
+
+    GLint                       fs_prog, vs_prog;
+
+    if (!fill)
+        fill = &facet_null_fill;
+
+    locations |= fill->locations;
+    flags |= fill->flags;
+    version = MAX(version, fill->version);
+
+    if (version > glamor_priv->glsl_version)
+        goto fail;
+
+    vs_vars = vs_location_vars(locations);
+    fs_vars = fs_location_vars(locations);
+
+    if (!vs_vars)
+        goto fail;
+    if (!fs_vars)
+        goto fail;
+
+    if (version) {
+        if (asprintf(&version_string, "#version %d\n", version) < 0)
+            version_string = NULL;
+        if (!version_string)
+            goto fail;
+    }
+
+    if (asprintf(&vs_prog_string,
+                 vs_template,
+                 str(version_string),
+                 str(prim->vs_vars),
+                 str(fill->vs_vars),
+                 vs_vars,
+                 str(prim->vs_exec),
+                 str(fill->vs_exec)) < 0)
+        vs_prog_string = NULL;
+
+    if (asprintf(&fs_prog_string,
+                 fs_template,
+                 str(version_string),
+                 str(prim->fs_vars),
+                 str(fill->fs_vars),
+                 fs_vars,
+                 str(prim->fs_exec),
+                 str(fill->fs_exec)) < 0)
+        fs_prog_string = NULL;
+
+    if (!vs_prog_string || !fs_prog_string)
+        goto fail;
+
+#define DBG 0
+#if DBG
+    ErrorF("\nPrograms for %s %s\nVertex shader:\n\n%s\n\nFragment Shader:\n\n%s",
+           prim->name, fill->name, vs_prog_string, fs_prog_string);
+#endif
+
+    prog->prog = glCreateProgram();
+    prog->flags = flags;
+    prog->locations = locations;
+    prog->prim_use = prim->use;
+    prog->fill_use = fill->use;
+
+    vs_prog = glamor_compile_glsl_prog(GL_VERTEX_SHADER, vs_prog_string);
+    fs_prog = glamor_compile_glsl_prog(GL_FRAGMENT_SHADER, fs_prog_string);
+    free(vs_prog_string);
+    free(fs_prog_string);
+    glAttachShader(prog->prog, vs_prog);
+    glDeleteShader(vs_prog);
+    glAttachShader(prog->prog, fs_prog);
+    glDeleteShader(fs_prog);
+    glBindAttribLocation(prog->prog, GLAMOR_VERTEX_POS, "primitive");
+
+    if (prim->source_name) {
+#if DBG
+        ErrorF("Bind GLAMOR_VERTEX_SOURCE to %s\n", prim->source_name);
+#endif
+        glBindAttribLocation(prog->prog, GLAMOR_VERTEX_SOURCE, prim->source_name);
+    }
+
+    glamor_link_glsl_prog(screen, prog->prog, "%s_%s", prim->name, fill->name);
+
+    prog->matrix_uniform = glamor_get_uniform(prog, glamor_program_location_none, "v_matrix");
+    prog->fg_uniform = glamor_get_uniform(prog, glamor_program_location_fg, "fg");
+    prog->bg_uniform = glamor_get_uniform(prog, glamor_program_location_bg, "bg");
+    prog->fill_offset_uniform = glamor_get_uniform(prog, glamor_program_location_fill, "fill_offset");
+    prog->fill_size_uniform = glamor_get_uniform(prog, glamor_program_location_fill, "fill_size");
+    prog->font_uniform = glamor_get_uniform(prog, glamor_program_location_font, "font");
+
+    if (glGetError() != GL_NO_ERROR)
+        goto fail;
+
+    free(version_string);
+    free(fs_vars);
+    free(vs_vars);
+    return TRUE;
+fail:
+    prog->failed = 1;
+    if (prog->prog) {
+        glDeleteProgram(prog->prog);
+        prog->prog = 0;
+    }
+    free(version_string);
+    free(fs_vars);
+    free(vs_vars);
+    return FALSE;
+}
+
+Bool
+glamor_use_program(PixmapPtr            pixmap,
+                   GCPtr                gc,
+                   glamor_program       *prog,
+                   void                 *arg)
+{
+    glUseProgram(prog->prog);
+
+    if (prog->prim_use && !prog->prim_use(pixmap, gc, prog, arg))
+        return FALSE;
+
+    if (prog->fill_use && !prog->fill_use(pixmap, gc, prog, arg))
+        return FALSE;
+
+    return TRUE;
+}
+
+glamor_program *
+glamor_use_program_fill(PixmapPtr               pixmap,
+                        GCPtr                   gc,
+                        glamor_program_fill     *program_fill,
+                        const glamor_facet      *prim)
+{
+    ScreenPtr                   screen = pixmap->drawable.pScreen;
+    glamor_program              *prog = &program_fill->progs[gc->fillStyle];
+
+    int                         fill_style = gc->fillStyle;
+    const glamor_facet          *fill;
+
+    if (prog->failed)
+        return FALSE;
+
+    if (!prog->prog) {
+        fill = glamor_facet_fill[fill_style];
+        if (!fill)
+            return NULL;
+
+        if (!glamor_build_program(screen, prog, prim, fill))
+            return NULL;
+    }
+
+    if (!glamor_use_program(pixmap, gc, prog, NULL))
+        return NULL;
+
+    return prog;
+}
diff --git a/glamor/glamor_program.h b/glamor/glamor_program.h
new file mode 100644 (file)
index 0000000..88efc35
--- /dev/null
@@ -0,0 +1,94 @@
+/*
+ * Copyright Â© 2014 Keith Packard
+ *
+ * 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 the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  The copyright holders make no representations
+ * about the suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS 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.
+ */
+
+#ifndef _GLAMOR_PROGRAM_H_
+#define _GLAMOR_PROGRAM_H_
+
+typedef enum {
+    glamor_program_location_none = 0,
+    glamor_program_location_fg = 1,
+    glamor_program_location_bg = 2,
+    glamor_program_location_fill = 4,
+    glamor_program_location_font = 8,
+} glamor_program_location;
+
+typedef enum {
+    glamor_program_flag_none = 0,
+} glamor_program_flag;
+
+typedef struct _glamor_program glamor_program;
+
+typedef Bool (*glamor_use) (PixmapPtr pixmap, GCPtr gc, glamor_program *prog, void *arg);
+
+typedef struct {
+    const char                          *name;
+    const int                           version;
+    const char                          *vs_vars;
+    const char                          *vs_exec;
+    const char                          *fs_vars;
+    const char                          *fs_exec;
+    const glamor_program_location       locations;
+    const glamor_program_flag           flags;
+    const char                          *source_name;
+    glamor_use                          use;
+} glamor_facet;
+
+struct _glamor_program {
+    GLint                       prog;
+    GLint                       failed;
+    GLint                       matrix_uniform;
+    GLint                       fg_uniform;
+    GLint                       bg_uniform;
+    GLint                       fill_size_uniform;
+    GLint                       fill_offset_uniform;
+    GLint                       font_uniform;
+    glamor_program_location     locations;
+    glamor_program_flag         flags;
+    glamor_use                  prim_use;
+    glamor_use                  fill_use;
+};
+
+typedef struct {
+    glamor_program      progs[4];
+} glamor_program_fill;
+
+extern const glamor_facet glamor_fill_solid;
+
+Bool
+glamor_build_program(ScreenPtr          screen,
+                     glamor_program     *prog,
+                     const glamor_facet *prim,
+                     const glamor_facet *fill);
+
+Bool
+glamor_use_program(PixmapPtr            pixmap,
+                   GCPtr                gc,
+                   glamor_program       *prog,
+                   void                 *arg);
+
+glamor_program *
+glamor_use_program_fill(PixmapPtr               pixmap,
+                        GCPtr                   gc,
+                        glamor_program_fill     *program_fill,
+                        const glamor_facet      *prim);
+
+#endif /* _GLAMOR_PROGRAM_H_ */
diff --git a/glamor/glamor_rects.c b/glamor/glamor_rects.c
new file mode 100644 (file)
index 0000000..3a5c3f3
--- /dev/null
@@ -0,0 +1,187 @@
+/*
+ * Copyright Â© 2014 Keith Packard
+ *
+ * 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 the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  The copyright holders make no representations
+ * about the suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS 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.
+ */
+
+#include "glamor_priv.h"
+#include "glamor_program.h"
+#include "glamor_transform.h"
+
+static const glamor_facet glamor_facet_polyfillrect_130 = {
+    .name = "poly_fill_rect",
+    .version = 130,
+    .vs_vars = "attribute vec4 primitive;\n",
+    .vs_exec = ("       vec2 pos = primitive.zw * vec2(gl_VertexID&1, (gl_VertexID&2)>>1);\n"
+                GLAMOR_POS(gl_Position, (primitive.xy + pos))),
+};
+
+static const glamor_facet glamor_facet_polyfillrect_120 = {
+    .name = "poly_fill_rect",
+    .vs_vars = "attribute vec2 primitive;\n",
+    .vs_exec = ("        vec2 pos = vec2(0,0);\n"
+                GLAMOR_POS(gl_Position, primitive.xy)),
+};
+
+static Bool
+glamor_poly_fill_rect_gl(DrawablePtr drawable,
+                         GCPtr gc, int nrect, xRectangle *prect)
+{
+    ScreenPtr screen = drawable->pScreen;
+    glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
+    PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable);
+    glamor_pixmap_private *pixmap_priv;
+    glamor_program *prog;
+    int off_x, off_y;
+    GLshort *v;
+    char *vbo_offset;
+    int box_x, box_y;
+
+    pixmap_priv = glamor_get_pixmap_private(pixmap);
+    if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv))
+        goto bail;
+
+    glamor_make_current(glamor_priv);
+
+    if (glamor_priv->glsl_version >= 130) {
+        prog = glamor_use_program_fill(pixmap, gc,
+                                       &glamor_priv->poly_fill_rect_program,
+                                       &glamor_facet_polyfillrect_130);
+
+        if (!prog)
+            goto bail_ctx;
+
+        /* Set up the vertex buffers for the points */
+
+        v = glamor_get_vbo_space(drawable->pScreen, nrect * sizeof (xRectangle), &vbo_offset);
+
+        glEnableVertexAttribArray(GLAMOR_VERTEX_POS);
+        glVertexAttribDivisor(GLAMOR_VERTEX_POS, 1);
+        glVertexAttribPointer(GLAMOR_VERTEX_POS, 4, GL_SHORT, GL_FALSE,
+                              4 * sizeof (short), vbo_offset);
+
+        memcpy(v, prect, nrect * sizeof (xRectangle));
+
+        glamor_put_vbo_space(screen);
+    } else {
+        int n;
+
+        prog = glamor_use_program_fill(pixmap, gc,
+                                       &glamor_priv->poly_fill_rect_program,
+                                       &glamor_facet_polyfillrect_120);
+
+        if (!prog)
+            goto bail_ctx;
+
+        /* Set up the vertex buffers for the points */
+
+        v = glamor_get_vbo_space(drawable->pScreen, nrect * 8 * sizeof (short), &vbo_offset);
+
+        glEnableVertexAttribArray(GLAMOR_VERTEX_POS);
+        glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_SHORT, GL_FALSE,
+                              2 * sizeof (short), vbo_offset);
+
+        for (n = 0; n < nrect; n++) {
+            v[0] = prect->x;                v[1] = prect->y;
+            v[2] = prect->x;                v[3] = prect->y + prect->height;
+            v[4] = prect->x + prect->width; v[5] = prect->y + prect->height;
+            v[6] = prect->x + prect->width; v[7] = prect->y;
+            prect++;
+            v += 8;
+        }
+
+        glamor_put_vbo_space(screen);
+    }
+
+    glEnable(GL_SCISSOR_TEST);
+
+    glamor_pixmap_loop(pixmap_priv, box_x, box_y) {
+        int nbox = RegionNumRects(gc->pCompositeClip);
+        BoxPtr box = RegionRects(gc->pCompositeClip);
+
+        glamor_set_destination_drawable(drawable, box_x, box_y, TRUE, FALSE, prog->matrix_uniform, &off_x, &off_y);
+
+        while (nbox--) {
+            glScissor(box->x1 + off_x,
+                      box->y1 + off_y,
+                      box->x2 - box->x1,
+                      box->y2 - box->y1);
+            box++;
+            if (glamor_priv->glsl_version >= 130)
+                glDrawArraysInstanced(GL_TRIANGLE_STRIP, 0, 4, nrect);
+            else {
+                if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) {
+                    glDrawArrays(GL_QUADS, 0, nrect * 4);
+                } else {
+                    int i;
+                    for (i = 0; i < nrect; i++) {
+                        glDrawArrays(GL_TRIANGLE_FAN, i * 4, 4);
+                    }
+                }
+            }
+        }
+    }
+
+    glDisable(GL_SCISSOR_TEST);
+    glDisable(GL_COLOR_LOGIC_OP);
+    if (glamor_priv->glsl_version >= 130)
+        glVertexAttribDivisor(GLAMOR_VERTEX_POS, 0);
+    glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
+
+    return TRUE;
+bail_ctx:
+    glDisable(GL_COLOR_LOGIC_OP);
+bail:
+    return FALSE;
+}
+
+static void
+glamor_poly_fill_rect_bail(DrawablePtr drawable,
+                           GCPtr gc, int nrect, xRectangle *prect)
+{
+    glamor_fallback("to %p (%c)\n", drawable,
+                    glamor_get_drawable_location(drawable));
+    if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RW) &&
+        glamor_prepare_access_gc(gc)) {
+        fbPolyFillRect(drawable, gc, nrect, prect);
+    }
+    glamor_finish_access_gc(gc);
+    glamor_finish_access(drawable);
+}
+
+void
+glamor_poly_fill_rect(DrawablePtr drawable,
+                      GCPtr gc, int nrect, xRectangle *prect)
+{
+    if (glamor_poly_fill_rect_gl(drawable, gc, nrect, prect))
+        return;
+    glamor_poly_fill_rect_bail(drawable, gc, nrect, prect);
+}
+
+Bool
+glamor_poly_fill_rect_nf(DrawablePtr drawable,
+                         GCPtr gc, int nrect, xRectangle *prect)
+{
+    if (glamor_poly_fill_rect_gl(drawable, gc, nrect, prect))
+        return TRUE;
+    if (glamor_ddx_fallback_check_pixmap(drawable) && glamor_ddx_fallback_check_gc(gc))
+        return FALSE;
+    glamor_poly_fill_rect_bail(drawable, gc, nrect, prect);
+    return TRUE;
+}
diff --git a/glamor/glamor_render.c b/glamor/glamor_render.c
new file mode 100644 (file)
index 0000000..14ab738
--- /dev/null
@@ -0,0 +1,1983 @@
+/*
+ * Copyright Â© 2009 Intel 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.
+ *
+ * Authors:
+ *    Eric Anholt <eric@anholt.net>
+ *    Zhigang Gong <zhigang.gong@linux.intel.com>
+ *    Junyan He <junyan.he@linux.intel.com>
+ *
+ */
+
+/** @file glamor_render.c
+ *
+ * Render acceleration implementation
+ */
+
+#include "glamor_priv.h"
+
+#ifdef RENDER
+#include "mipict.h"
+#include "fbpict.h"
+#if 0
+//#define DEBUGF(str, ...)  do {} while(0)
+#define DEBUGF(str, ...) ErrorF(str, ##__VA_ARGS__)
+//#define DEBUGRegionPrint(x) do {} while (0)
+#define DEBUGRegionPrint RegionPrint
+#endif
+
+static struct blendinfo composite_op_info[] = {
+    [PictOpClear] = {0, 0, GL_ZERO, GL_ZERO},
+    [PictOpSrc] = {0, 0, GL_ONE, GL_ZERO},
+    [PictOpDst] = {0, 0, GL_ZERO, GL_ONE},
+    [PictOpOver] = {0, 1, GL_ONE, GL_ONE_MINUS_SRC_ALPHA},
+    [PictOpOverReverse] = {1, 0, GL_ONE_MINUS_DST_ALPHA, GL_ONE},
+    [PictOpIn] = {1, 0, GL_DST_ALPHA, GL_ZERO},
+    [PictOpInReverse] = {0, 1, GL_ZERO, GL_SRC_ALPHA},
+    [PictOpOut] = {1, 0, GL_ONE_MINUS_DST_ALPHA, GL_ZERO},
+    [PictOpOutReverse] = {0, 1, GL_ZERO, GL_ONE_MINUS_SRC_ALPHA},
+    [PictOpAtop] = {1, 1, GL_DST_ALPHA, GL_ONE_MINUS_SRC_ALPHA},
+    [PictOpAtopReverse] = {1, 1, GL_ONE_MINUS_DST_ALPHA, GL_SRC_ALPHA},
+    [PictOpXor] = {1, 1, GL_ONE_MINUS_DST_ALPHA, GL_ONE_MINUS_SRC_ALPHA},
+    [PictOpAdd] = {0, 0, GL_ONE, GL_ONE},
+};
+
+#define RepeatFix                      10
+static GLuint
+glamor_create_composite_fs(struct shader_key *key)
+{
+    const char *repeat_define =
+        "#define RepeatNone                          0\n"
+        "#define RepeatNormal                     1\n"
+        "#define RepeatPad                        2\n"
+        "#define RepeatReflect                    3\n"
+        "#define RepeatFix                           10\n"
+        "uniform int                   source_repeat_mode;\n"
+        "uniform int                   mask_repeat_mode;\n";
+    const char *relocate_texture =
+        GLAMOR_DEFAULT_PRECISION
+        "vec2 rel_tex_coord(vec2 texture, vec4 wh, int repeat) \n"
+        "{\n"
+        "   vec2 rel_tex; \n"
+        "   rel_tex = texture * wh.xy; \n"
+        "      if (repeat == RepeatNone)\n"
+        "              return rel_tex; \n"
+        "   else if (repeat == RepeatNormal) \n"
+        "      rel_tex = floor(rel_tex) + (fract(rel_tex) / wh.xy);    \n"
+        "   else if(repeat == RepeatPad) { \n"
+        "           if (rel_tex.x >= 1.0) rel_tex.x = 1.0 - wh.z * wh.x / 2.;          \n"
+        "              else if(rel_tex.x < 0.0) rel_tex.x = 0.0;               \n"
+        "           if (rel_tex.y >= 1.0) rel_tex.y = 1.0 - wh.w * wh.y / 2.;  \n"
+        "              else if(rel_tex.y < 0.0) rel_tex.y = 0.0;       \n"
+        "      rel_tex = rel_tex / wh.xy; \n"
+        "    } \n"
+        "   else if(repeat == RepeatReflect) {\n"
+        "              if ((1.0 - mod(abs(floor(rel_tex.x)), 2.0)) < 0.001)\n"
+        "                      rel_tex.x = 2.0 - (1.0 - fract(rel_tex.x))/wh.x;\n"
+        "              else \n"
+        "                      rel_tex.x = fract(rel_tex.x)/wh.x;\n"
+        "              if ((1.0 - mod(abs(floor(rel_tex.y)), 2.0)) < 0.001)\n"
+        "                      rel_tex.y = 2.0 - (1.0 - fract(rel_tex.y))/wh.y;\n"
+        "              else \n"
+        "                      rel_tex.y = fract(rel_tex.y)/wh.y;\n"
+        "    } \n"
+        "   return rel_tex; \n"
+        "}\n";
+    /* The texture and the pixmap size is not match eaxctly, so can't sample it directly.
+     * rel_sampler will recalculate the texture coords.*/
+    const char *rel_sampler =
+        " vec4 rel_sampler(sampler2D tex_image, vec2 tex, vec4 wh, int repeat, int set_alpha)\n"
+        "{\n"
+        "      tex = rel_tex_coord(tex, wh, repeat - RepeatFix);\n"
+        "   if (repeat == RepeatFix) {\n"
+        "              if (!(tex.x >= 0.0 && tex.x < 1.0 \n"
+        "                  && tex.y >= 0.0 && tex.y < 1.0))\n"
+        "                      return vec4(0.0, 0.0, 0.0, set_alpha);\n"
+        "              tex = (fract(tex) / wh.xy);\n"
+        "      }\n"
+        "      if (set_alpha != 1)\n"
+        "              return texture2D(tex_image, tex);\n"
+        "      else\n"
+        "              return vec4(texture2D(tex_image, tex).rgb, 1.0);\n"
+        "}\n";
+
+    const char *source_solid_fetch =
+        GLAMOR_DEFAULT_PRECISION
+        "uniform vec4 source;\n"
+        "vec4 get_source()\n"
+        "{\n"
+        "      return source;\n"
+        "}\n";
+    const char *source_alpha_pixmap_fetch =
+        GLAMOR_DEFAULT_PRECISION
+        "varying vec2 source_texture;\n"
+        "uniform sampler2D source_sampler;\n"
+        "uniform vec4 source_wh;"
+        "vec4 get_source()\n"
+        "{\n"
+        "   if (source_repeat_mode < RepeatFix)\n"
+        "              return texture2D(source_sampler, source_texture);\n"
+        "   else \n"
+        "              return rel_sampler(source_sampler, source_texture,\n"
+        "                                 source_wh, source_repeat_mode, 0);\n"
+        "}\n";
+    const char *source_pixmap_fetch =
+        GLAMOR_DEFAULT_PRECISION
+        "varying vec2 source_texture;\n"
+        "uniform sampler2D source_sampler;\n"
+        "uniform vec4 source_wh;\n"
+        "vec4 get_source()\n"
+        "{\n"
+        "   if (source_repeat_mode < RepeatFix) \n"
+        "              return vec4(texture2D(source_sampler, source_texture).rgb, 1);\n"
+        "      else \n"
+        "              return rel_sampler(source_sampler, source_texture,\n"
+        "                                 source_wh, source_repeat_mode, 1);\n"
+        "}\n";
+    const char *mask_solid_fetch =
+        GLAMOR_DEFAULT_PRECISION
+        "uniform vec4 mask;\n"
+        "vec4 get_mask()\n"
+        "{\n"
+        "      return mask;\n"
+        "}\n";
+    const char *mask_alpha_pixmap_fetch =
+        GLAMOR_DEFAULT_PRECISION
+        "varying vec2 mask_texture;\n"
+        "uniform sampler2D mask_sampler;\n"
+        "uniform vec4 mask_wh;\n"
+        "vec4 get_mask()\n"
+        "{\n"
+        "   if (mask_repeat_mode < RepeatFix) \n"
+        "              return texture2D(mask_sampler, mask_texture);\n"
+        "   else \n"
+        "              return rel_sampler(mask_sampler, mask_texture,\n"
+        "                                 mask_wh, mask_repeat_mode, 0);\n"
+        "}\n";
+    const char *mask_pixmap_fetch =
+        GLAMOR_DEFAULT_PRECISION
+        "varying vec2 mask_texture;\n"
+        "uniform sampler2D mask_sampler;\n"
+        "uniform vec4 mask_wh;\n"
+        "vec4 get_mask()\n"
+        "{\n"
+        "   if (mask_repeat_mode < RepeatFix) \n"
+        "      return vec4(texture2D(mask_sampler, mask_texture).rgb, 1);\n"
+        "   else \n"
+        "              return rel_sampler(mask_sampler, mask_texture,\n"
+        "                                 mask_wh, mask_repeat_mode, 1);\n"
+        "}\n";
+    const char *in_source_only =
+        GLAMOR_DEFAULT_PRECISION
+        "void main()\n"
+        "{\n"
+        "      gl_FragColor = get_source();\n"
+        "}\n";
+    const char *in_normal =
+        GLAMOR_DEFAULT_PRECISION
+        "void main()\n"
+        "{\n"
+        "      gl_FragColor = get_source() * get_mask().a;\n"
+        "}\n";
+    const char *in_ca_source =
+        GLAMOR_DEFAULT_PRECISION
+        "void main()\n"
+        "{\n"
+        "      gl_FragColor = get_source() * get_mask();\n"
+        "}\n";
+    const char *in_ca_alpha =
+        GLAMOR_DEFAULT_PRECISION
+        "void main()\n"
+        "{\n"
+        "      gl_FragColor = get_source().a * get_mask();\n"
+        "}\n";
+    char *source;
+    const char *source_fetch;
+    const char *mask_fetch = "";
+    const char *in;
+    GLuint prog;
+
+    switch (key->source) {
+    case SHADER_SOURCE_SOLID:
+        source_fetch = source_solid_fetch;
+        break;
+    case SHADER_SOURCE_TEXTURE_ALPHA:
+        source_fetch = source_alpha_pixmap_fetch;
+        break;
+    case SHADER_SOURCE_TEXTURE:
+        source_fetch = source_pixmap_fetch;
+        break;
+    default:
+        FatalError("Bad composite shader source");
+    }
+
+    switch (key->mask) {
+    case SHADER_MASK_NONE:
+        break;
+    case SHADER_MASK_SOLID:
+        mask_fetch = mask_solid_fetch;
+        break;
+    case SHADER_MASK_TEXTURE_ALPHA:
+        mask_fetch = mask_alpha_pixmap_fetch;
+        break;
+    case SHADER_MASK_TEXTURE:
+        mask_fetch = mask_pixmap_fetch;
+        break;
+    default:
+        FatalError("Bad composite shader mask");
+    }
+
+    switch (key->in) {
+    case SHADER_IN_SOURCE_ONLY:
+        in = in_source_only;
+        break;
+    case SHADER_IN_NORMAL:
+        in = in_normal;
+        break;
+    case SHADER_IN_CA_SOURCE:
+        in = in_ca_source;
+        break;
+    case SHADER_IN_CA_ALPHA:
+        in = in_ca_alpha;
+        break;
+    default:
+        FatalError("Bad composite IN type");
+    }
+
+    XNFasprintf(&source, "%s%s%s%s%s%s", repeat_define, relocate_texture,
+                rel_sampler, source_fetch, mask_fetch, in);
+
+    prog = glamor_compile_glsl_prog(GL_FRAGMENT_SHADER, source);
+    free(source);
+
+    return prog;
+}
+
+static GLuint
+glamor_create_composite_vs(struct shader_key *key)
+{
+    const char *main_opening =
+        "attribute vec4 v_position;\n"
+        "attribute vec4 v_texcoord0;\n"
+        "attribute vec4 v_texcoord1;\n"
+        "varying vec2 source_texture;\n"
+        "varying vec2 mask_texture;\n"
+        "void main()\n"
+        "{\n"
+        "      gl_Position = v_position;\n";
+    const char *source_coords = "      source_texture = v_texcoord0.xy;\n";
+    const char *mask_coords = "        mask_texture = v_texcoord1.xy;\n";
+    const char *main_closing = "}\n";
+    const char *source_coords_setup = "";
+    const char *mask_coords_setup = "";
+    char *source;
+    GLuint prog;
+
+    if (key->source != SHADER_SOURCE_SOLID)
+        source_coords_setup = source_coords;
+
+    if (key->mask != SHADER_MASK_NONE && key->mask != SHADER_MASK_SOLID)
+        mask_coords_setup = mask_coords;
+
+    XNFasprintf(&source,
+                "%s%s%s%s",
+                main_opening,
+                source_coords_setup, mask_coords_setup, main_closing);
+
+    prog = glamor_compile_glsl_prog(GL_VERTEX_SHADER, source);
+    free(source);
+
+    return prog;
+}
+
+static void
+glamor_create_composite_shader(ScreenPtr screen, struct shader_key *key,
+                               glamor_composite_shader *shader)
+{
+    GLuint vs, fs, prog;
+    GLint source_sampler_uniform_location, mask_sampler_uniform_location;
+    glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
+
+    glamor_make_current(glamor_priv);
+    vs = glamor_create_composite_vs(key);
+    if (vs == 0)
+        return;
+    fs = glamor_create_composite_fs(key);
+    if (fs == 0)
+        return;
+
+    prog = glCreateProgram();
+    glAttachShader(prog, vs);
+    glAttachShader(prog, fs);
+
+    glBindAttribLocation(prog, GLAMOR_VERTEX_POS, "v_position");
+    glBindAttribLocation(prog, GLAMOR_VERTEX_SOURCE, "v_texcoord0");
+    glBindAttribLocation(prog, GLAMOR_VERTEX_MASK, "v_texcoord1");
+
+    glamor_link_glsl_prog(screen, prog, "composite");
+
+    shader->prog = prog;
+
+    glUseProgram(prog);
+
+    if (key->source == SHADER_SOURCE_SOLID) {
+        shader->source_uniform_location = glGetUniformLocation(prog, "source");
+    }
+    else {
+        source_sampler_uniform_location =
+            glGetUniformLocation(prog, "source_sampler");
+        glUniform1i(source_sampler_uniform_location, 0);
+        shader->source_wh = glGetUniformLocation(prog, "source_wh");
+        shader->source_repeat_mode =
+            glGetUniformLocation(prog, "source_repeat_mode");
+    }
+
+    if (key->mask != SHADER_MASK_NONE) {
+        if (key->mask == SHADER_MASK_SOLID) {
+            shader->mask_uniform_location = glGetUniformLocation(prog, "mask");
+        }
+        else {
+            mask_sampler_uniform_location =
+                glGetUniformLocation(prog, "mask_sampler");
+            glUniform1i(mask_sampler_uniform_location, 1);
+            shader->mask_wh = glGetUniformLocation(prog, "mask_wh");
+            shader->mask_repeat_mode =
+                glGetUniformLocation(prog, "mask_repeat_mode");
+        }
+    }
+}
+
+static glamor_composite_shader *
+glamor_lookup_composite_shader(ScreenPtr screen, struct
+                               shader_key
+                               *key)
+{
+    glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
+    glamor_composite_shader *shader;
+
+    shader = &glamor_priv->composite_shader[key->source][key->mask][key->in];
+    if (shader->prog == 0)
+        glamor_create_composite_shader(screen, key, shader);
+
+    return shader;
+}
+
+static void
+glamor_init_eb(unsigned short *eb, int vert_cnt)
+{
+    int i, j;
+
+    for (i = 0, j = 0; j < vert_cnt; i += 6, j += 4) {
+        eb[i] = j;
+        eb[i + 1] = j + 1;
+        eb[i + 2] = j + 2;
+        eb[i + 3] = j;
+        eb[i + 4] = j + 2;
+        eb[i + 5] = j + 3;
+    }
+}
+
+void
+glamor_init_composite_shaders(ScreenPtr screen)
+{
+    glamor_screen_private *glamor_priv;
+    unsigned short *eb;
+    int eb_size;
+
+    glamor_priv = glamor_get_screen_private(screen);
+    glamor_make_current(glamor_priv);
+    glGenBuffers(1, &glamor_priv->ebo);
+    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, glamor_priv->ebo);
+
+    eb_size = GLAMOR_COMPOSITE_VBO_VERT_CNT * sizeof(short) * 2;
+
+    eb = XNFalloc(eb_size);
+    glamor_init_eb(eb, GLAMOR_COMPOSITE_VBO_VERT_CNT);
+    glBufferData(GL_ELEMENT_ARRAY_BUFFER, eb_size, eb, GL_STATIC_DRAW);
+    free(eb);
+}
+
+void
+glamor_fini_composite_shaders(ScreenPtr screen)
+{
+    glamor_screen_private *glamor_priv;
+    glamor_composite_shader *shader;
+    int i, j, k;
+
+    glamor_priv = glamor_get_screen_private(screen);
+    glamor_make_current(glamor_priv);
+    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
+    glDeleteBuffers(1, &glamor_priv->ebo);
+
+    for (i = 0; i < SHADER_SOURCE_COUNT; i++)
+        for (j = 0; j < SHADER_MASK_COUNT; j++)
+            for (k = 0; k < SHADER_IN_COUNT; k++) {
+                shader = &glamor_priv->composite_shader[i][j][k];
+                if (shader->prog)
+                    glDeleteProgram(shader->prog);
+            }
+}
+
+static Bool
+glamor_set_composite_op(ScreenPtr screen,
+                        CARD8 op, struct blendinfo *op_info_result,
+                        PicturePtr dest, PicturePtr mask)
+{
+    GLenum source_blend, dest_blend;
+    struct blendinfo *op_info;
+
+    if (op >= ARRAY_SIZE(composite_op_info)) {
+        glamor_fallback("unsupported render op %d \n", op);
+        return GL_FALSE;
+    }
+    op_info = &composite_op_info[op];
+
+    source_blend = op_info->source_blend;
+    dest_blend = op_info->dest_blend;
+
+    /* If there's no dst alpha channel, adjust the blend op so that we'll treat
+     * it as always 1.
+     */
+    if (PICT_FORMAT_A(dest->format) == 0 && op_info->dest_alpha) {
+        if (source_blend == GL_DST_ALPHA)
+            source_blend = GL_ONE;
+        else if (source_blend == GL_ONE_MINUS_DST_ALPHA)
+            source_blend = GL_ZERO;
+    }
+
+    /* Set up the source alpha value for blending in component alpha mode. */
+    if (mask && mask->componentAlpha
+        && PICT_FORMAT_RGB(mask->format) != 0 && op_info->source_alpha) {
+        if (dest_blend == GL_SRC_ALPHA)
+            dest_blend = GL_SRC_COLOR;
+        else if (dest_blend == GL_ONE_MINUS_SRC_ALPHA)
+            dest_blend = GL_ONE_MINUS_SRC_COLOR;
+    }
+
+    op_info_result->source_blend = source_blend;
+    op_info_result->dest_blend = dest_blend;
+    op_info_result->source_alpha = op_info->source_alpha;
+    op_info_result->dest_alpha = op_info->dest_alpha;
+
+    return TRUE;
+}
+
+static void
+glamor_set_composite_texture(glamor_screen_private *glamor_priv, int unit,
+                             PicturePtr picture,
+                             glamor_pixmap_private *pixmap_priv,
+                             GLuint wh_location, GLuint repeat_location)
+{
+    float wh[4];
+    int repeat_type;
+
+    glamor_make_current(glamor_priv);
+    glActiveTexture(GL_TEXTURE0 + unit);
+    glBindTexture(GL_TEXTURE_2D, pixmap_priv->base.fbo->tex);
+    repeat_type = picture->repeatType;
+    switch (picture->repeatType) {
+    case RepeatNone:
+        if (glamor_priv->gl_flavor != GLAMOR_GL_ES2) {
+            /* XXX  GLES2 doesn't support GL_CLAMP_TO_BORDER. */
+            glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S,
+                            GL_CLAMP_TO_BORDER);
+            glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T,
+                            GL_CLAMP_TO_BORDER);
+        } else {
+            glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+            glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+        }
+        break;
+    case RepeatNormal:
+        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
+        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
+        break;
+    case RepeatPad:
+        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+        break;
+    case RepeatReflect:
+        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_MIRRORED_REPEAT);
+        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_MIRRORED_REPEAT);
+        break;
+    }
+
+    switch (picture->filter) {
+    default:
+    case PictFilterFast:
+    case PictFilterNearest:
+        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+        break;
+    case PictFilterGood:
+    case PictFilterBest:
+    case PictFilterBilinear:
+        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+        break;
+    }
+
+    /*
+     *  GLES2 doesn't support RepeatNone. We need to fix it anyway.
+     *
+     **/
+    if (repeat_type != RepeatNone)
+        repeat_type += RepeatFix;
+    else if (glamor_priv->gl_flavor == GLAMOR_GL_ES2
+             || pixmap_priv->type == GLAMOR_TEXTURE_LARGE) {
+        if (picture->transform
+            || (GLAMOR_PIXMAP_FBO_NOT_EXACT_SIZE(pixmap_priv)))
+            repeat_type += RepeatFix;
+    }
+    if (repeat_type >= RepeatFix) {
+        glamor_pixmap_fbo_fix_wh_ratio(wh, pixmap_priv);
+        if ((wh[0] != 1.0 || wh[1] != 1.0)
+            || (glamor_priv->gl_flavor == GLAMOR_GL_ES2
+                && repeat_type == RepeatFix))
+            glUniform4fv(wh_location, 1, wh);
+        else
+            repeat_type -= RepeatFix;
+    }
+    glUniform1i(repeat_location, repeat_type);
+}
+
+static void
+glamor_set_composite_solid(float *color, GLint uniform_location)
+{
+    glUniform4fv(uniform_location, 1, color);
+}
+
+static int
+compatible_formats(CARD8 op, PicturePtr dst, PicturePtr src)
+{
+    if (op == PictOpSrc) {
+        if (src->format == dst->format)
+            return 1;
+
+        if (src->format == PICT_a8r8g8b8 && dst->format == PICT_x8r8g8b8)
+            return 1;
+
+        if (src->format == PICT_a8b8g8r8 && dst->format == PICT_x8b8g8r8)
+            return 1;
+    }
+    else if (op == PictOpOver) {
+        if (src->alphaMap || dst->alphaMap)
+            return 0;
+
+        if (src->format != dst->format)
+            return 0;
+
+        if (src->format == PICT_x8r8g8b8 || src->format == PICT_x8b8g8r8)
+            return 1;
+    }
+
+    return 0;
+}
+
+static char
+glamor_get_picture_location(PicturePtr picture)
+{
+    if (picture == NULL)
+        return ' ';
+
+    if (picture->pDrawable == NULL) {
+        switch (picture->pSourcePict->type) {
+        case SourcePictTypeSolidFill:
+            return 'c';
+        case SourcePictTypeLinear:
+            return 'l';
+        case SourcePictTypeRadial:
+            return 'r';
+        default:
+            return '?';
+        }
+    }
+    return glamor_get_drawable_location(picture->pDrawable);
+}
+
+static Bool
+glamor_composite_with_copy(CARD8 op,
+                           PicturePtr source,
+                           PicturePtr dest,
+                           INT16 x_source,
+                           INT16 y_source,
+                           INT16 x_dest, INT16 y_dest, RegionPtr region)
+{
+    int ret = FALSE;
+
+    if (!source->pDrawable)
+        return FALSE;
+
+    if (!compatible_formats(op, dest, source))
+        return FALSE;
+
+    if (source->repeat || source->transform) {
+        return FALSE;
+    }
+
+    x_dest += dest->pDrawable->x;
+    y_dest += dest->pDrawable->y;
+    x_source += source->pDrawable->x;
+    y_source += source->pDrawable->y;
+    if (PICT_FORMAT_A(source->format) == 0) {
+        /* Fallback if we sample outside the source so that we
+         * swizzle the correct clear color for out-of-bounds texels.
+         */
+        if (region->extents.x1 + x_source - x_dest < 0)
+            goto cleanup_region;
+        if (region->extents.x2 + x_source - x_dest > source->pDrawable->width)
+            goto cleanup_region;
+
+        if (region->extents.y1 + y_source - y_dest < 0)
+            goto cleanup_region;
+        if (region->extents.y2 + y_source - y_dest > source->pDrawable->height)
+            goto cleanup_region;
+    }
+    ret = glamor_copy_n_to_n_nf(source->pDrawable,
+                                dest->pDrawable, NULL,
+                                RegionRects(region), RegionNumRects(region),
+                                x_source - x_dest, y_source - y_dest,
+                                FALSE, FALSE, 0, NULL);
+ cleanup_region:
+    return ret;
+}
+
+void *
+glamor_setup_composite_vbo(ScreenPtr screen, int n_verts)
+{
+    glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
+    int vert_size;
+    char *vbo_offset;
+    float *vb;
+
+    glamor_priv->render_nr_verts = 0;
+    glamor_priv->vb_stride = 2 * sizeof(float);
+    if (glamor_priv->has_source_coords)
+        glamor_priv->vb_stride += 2 * sizeof(float);
+    if (glamor_priv->has_mask_coords)
+        glamor_priv->vb_stride += 2 * sizeof(float);
+
+    vert_size = n_verts * glamor_priv->vb_stride;
+
+    glamor_make_current(glamor_priv);
+    vb = glamor_get_vbo_space(screen, vert_size, &vbo_offset);
+
+    glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT, GL_FALSE,
+                          glamor_priv->vb_stride, vbo_offset);
+    glEnableVertexAttribArray(GLAMOR_VERTEX_POS);
+
+    if (glamor_priv->has_source_coords) {
+        glVertexAttribPointer(GLAMOR_VERTEX_SOURCE, 2,
+                              GL_FLOAT, GL_FALSE,
+                              glamor_priv->vb_stride,
+                              vbo_offset + 2 * sizeof(float));
+        glEnableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
+    }
+
+    if (glamor_priv->has_mask_coords) {
+        glVertexAttribPointer(GLAMOR_VERTEX_MASK, 2, GL_FLOAT, GL_FALSE,
+                              glamor_priv->vb_stride,
+                              vbo_offset + (glamor_priv->has_source_coords ?
+                                            4 : 2) * sizeof(float));
+        glEnableVertexAttribArray(GLAMOR_VERTEX_MASK);
+    }
+
+    return vb;
+}
+
+static void
+glamor_flush_composite_rects(ScreenPtr screen)
+{
+    glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
+
+    glamor_make_current(glamor_priv);
+
+    if (!glamor_priv->render_nr_verts)
+        return;
+
+    if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) {
+        glDrawRangeElements(GL_TRIANGLES, 0, glamor_priv->render_nr_verts,
+                            (glamor_priv->render_nr_verts * 3) / 2,
+                            GL_UNSIGNED_SHORT, NULL);
+    } else {
+        glDrawElements(GL_TRIANGLES, (glamor_priv->render_nr_verts * 3) / 2,
+                       GL_UNSIGNED_SHORT, NULL);
+    }
+}
+
+int pict_format_combine_tab[][3] = {
+    {PICT_TYPE_ARGB, PICT_TYPE_A, PICT_TYPE_ARGB},
+    {PICT_TYPE_ABGR, PICT_TYPE_A, PICT_TYPE_ABGR},
+};
+
+static Bool
+combine_pict_format(PictFormatShort * des, const PictFormatShort src,
+                    const PictFormatShort mask, enum shader_in in_ca)
+{
+    PictFormatShort new_vis;
+    int src_type, mask_type, src_bpp;
+    int i;
+
+    if (src == mask) {
+        *des = src;
+        return TRUE;
+    }
+    src_bpp = PICT_FORMAT_BPP(src);
+
+    assert(src_bpp == PICT_FORMAT_BPP(mask));
+
+    new_vis = PICT_FORMAT_VIS(src) | PICT_FORMAT_VIS(mask);
+
+    switch (in_ca) {
+    case SHADER_IN_SOURCE_ONLY:
+        return TRUE;
+    case SHADER_IN_NORMAL:
+        src_type = PICT_FORMAT_TYPE(src);
+        mask_type = PICT_TYPE_A;
+        break;
+    case SHADER_IN_CA_SOURCE:
+        src_type = PICT_FORMAT_TYPE(src);
+        mask_type = PICT_FORMAT_TYPE(mask);
+        break;
+    case SHADER_IN_CA_ALPHA:
+        src_type = PICT_TYPE_A;
+        mask_type = PICT_FORMAT_TYPE(mask);
+        break;
+    default:
+        return FALSE;
+    }
+
+    if (src_type == mask_type) {
+        *des = PICT_VISFORMAT(src_bpp, src_type, new_vis);
+        return TRUE;
+    }
+
+    for (i = 0;
+         i <
+         sizeof(pict_format_combine_tab) /
+         sizeof(pict_format_combine_tab[0]); i++) {
+        if ((src_type == pict_format_combine_tab[i][0]
+             && mask_type == pict_format_combine_tab[i][1])
+            || (src_type == pict_format_combine_tab[i][1]
+                && mask_type == pict_format_combine_tab[i][0])) {
+            *des = PICT_VISFORMAT(src_bpp, pict_format_combine_tab[i]
+                                  [2], new_vis);
+            return TRUE;
+        }
+    }
+    return FALSE;
+}
+
+static void
+glamor_set_normalize_tcoords_generic(glamor_pixmap_private *priv,
+                                     int repeat_type,
+                                     float *matrix,
+                                     float xscale, float yscale,
+                                     int x1, int y1, int x2, int y2,
+                                     int yInverted, float *texcoords,
+                                     int stride)
+{
+    if (!matrix && repeat_type == RepeatNone)
+        glamor_set_normalize_tcoords_ext(priv, xscale, yscale,
+                                         x1, y1,
+                                         x2, y2, yInverted, texcoords, stride);
+    else if (matrix && repeat_type == RepeatNone)
+        glamor_set_transformed_normalize_tcoords_ext(priv, matrix, xscale,
+                                                     yscale, x1, y1,
+                                                     x2, y2,
+                                                     yInverted,
+                                                     texcoords, stride);
+    else if (!matrix && repeat_type != RepeatNone)
+        glamor_set_repeat_normalize_tcoords_ext(priv, repeat_type,
+                                                xscale, yscale,
+                                                x1, y1,
+                                                x2, y2,
+                                                yInverted, texcoords, stride);
+    else if (matrix && repeat_type != RepeatNone)
+        glamor_set_repeat_transformed_normalize_tcoords_ext(priv, repeat_type,
+                                                            matrix, xscale,
+                                                            yscale, x1, y1, x2,
+                                                            y2, yInverted,
+                                                            texcoords, stride);
+}
+
+Bool
+glamor_composite_choose_shader(CARD8 op,
+                               PicturePtr source,
+                               PicturePtr mask,
+                               PicturePtr dest,
+                               glamor_pixmap_private *source_pixmap_priv,
+                               glamor_pixmap_private *mask_pixmap_priv,
+                               glamor_pixmap_private *dest_pixmap_priv,
+                               struct shader_key *s_key,
+                               glamor_composite_shader ** shader,
+                               struct blendinfo *op_info,
+                               PictFormatShort *psaved_source_format)
+{
+    ScreenPtr screen = dest->pDrawable->pScreen;
+    PixmapPtr dest_pixmap = dest_pixmap_priv->base.pixmap;
+    PixmapPtr source_pixmap = NULL;
+    PixmapPtr mask_pixmap = NULL;
+    enum glamor_pixmap_status source_status = GLAMOR_NONE;
+    enum glamor_pixmap_status mask_status = GLAMOR_NONE;
+    PictFormatShort saved_source_format = 0;
+    struct shader_key key;
+    GLfloat source_solid_color[4];
+    GLfloat mask_solid_color[4];
+    Bool ret = FALSE;
+
+    if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(dest_pixmap_priv)) {
+        glamor_fallback("dest has no fbo.\n");
+        goto fail;
+    }
+
+    memset(&key, 0, sizeof(key));
+    if (!source) {
+        key.source = SHADER_SOURCE_SOLID;
+        source_solid_color[0] = 0.0;
+        source_solid_color[1] = 0.0;
+        source_solid_color[2] = 0.0;
+        source_solid_color[3] = 0.0;
+    }
+    else if (!source->pDrawable) {
+        if (source->pSourcePict->type == SourcePictTypeSolidFill) {
+            key.source = SHADER_SOURCE_SOLID;
+            glamor_get_rgba_from_pixel(source->pSourcePict->solidFill.color,
+                                       &source_solid_color[0],
+                                       &source_solid_color[1],
+                                       &source_solid_color[2],
+                                       &source_solid_color[3], PICT_a8r8g8b8);
+        }
+        else
+            goto fail;
+    }
+    else {
+        if (PICT_FORMAT_A(source->format))
+            key.source = SHADER_SOURCE_TEXTURE_ALPHA;
+        else
+            key.source = SHADER_SOURCE_TEXTURE;
+    }
+
+    if (mask) {
+        if (!mask->pDrawable) {
+            if (mask->pSourcePict->type == SourcePictTypeSolidFill) {
+                key.mask = SHADER_MASK_SOLID;
+                glamor_get_rgba_from_pixel
+                    (mask->pSourcePict->solidFill.color,
+                     &mask_solid_color[0],
+                     &mask_solid_color[1],
+                     &mask_solid_color[2], &mask_solid_color[3], PICT_a8r8g8b8);
+            }
+            else
+                goto fail;
+        }
+        else {
+            key.mask = SHADER_MASK_TEXTURE_ALPHA;
+        }
+
+        if (!mask->componentAlpha) {
+            key.in = SHADER_IN_NORMAL;
+        }
+        else {
+            if (op == PictOpClear)
+                key.mask = SHADER_MASK_NONE;
+            else if (op == PictOpSrc || op == PictOpAdd
+                     || op == PictOpIn || op == PictOpOut
+                     || op == PictOpOverReverse)
+                key.in = SHADER_IN_CA_SOURCE;
+            else if (op == PictOpOutReverse || op == PictOpInReverse) {
+                key.in = SHADER_IN_CA_ALPHA;
+            }
+            else {
+                glamor_fallback("Unsupported component alpha op: %d\n", op);
+                goto fail;
+            }
+        }
+    }
+    else {
+        key.mask = SHADER_MASK_NONE;
+        key.in = SHADER_IN_SOURCE_ONLY;
+    }
+
+    if (source && source->alphaMap) {
+        glamor_fallback("source alphaMap\n");
+        goto fail;
+    }
+    if (mask && mask->alphaMap) {
+        glamor_fallback("mask alphaMap\n");
+        goto fail;
+    }
+
+    if (key.source == SHADER_SOURCE_TEXTURE ||
+        key.source == SHADER_SOURCE_TEXTURE_ALPHA) {
+        source_pixmap = source_pixmap_priv->base.pixmap;
+        if (source_pixmap == dest_pixmap) {
+            /* XXX source and the dest share the same texture.
+             * Does it need special handle? */
+            glamor_fallback("source == dest\n");
+        }
+        if (source_pixmap_priv->base.gl_fbo == GLAMOR_FBO_UNATTACHED) {
+#ifdef GLAMOR_PIXMAP_DYNAMIC_UPLOAD
+            source_status = GLAMOR_UPLOAD_PENDING;
+#else
+            glamor_fallback("no texture in source\n");
+            goto fail;
+#endif
+        }
+    }
+
+    if (key.mask == SHADER_MASK_TEXTURE ||
+        key.mask == SHADER_MASK_TEXTURE_ALPHA) {
+        mask_pixmap = mask_pixmap_priv->base.pixmap;
+        if (mask_pixmap == dest_pixmap) {
+            glamor_fallback("mask == dest\n");
+            goto fail;
+        }
+        if (mask_pixmap_priv->base.gl_fbo == GLAMOR_FBO_UNATTACHED) {
+#ifdef GLAMOR_PIXMAP_DYNAMIC_UPLOAD
+            mask_status = GLAMOR_UPLOAD_PENDING;
+#else
+            glamor_fallback("no texture in mask\n");
+            goto fail;
+#endif
+        }
+    }
+
+#ifdef GLAMOR_PIXMAP_DYNAMIC_UPLOAD
+    if (source_status == GLAMOR_UPLOAD_PENDING
+        && mask_status == GLAMOR_UPLOAD_PENDING
+        && source_pixmap == mask_pixmap) {
+
+        if (source->format != mask->format) {
+            saved_source_format = source->format;
+
+            if (!combine_pict_format(&source->format, source->format,
+                                     mask->format, key.in)) {
+                glamor_fallback("combine source %x mask %x failed.\n",
+                                source->format, mask->format);
+                goto fail;
+            }
+
+            if (source->format != saved_source_format) {
+                glamor_picture_format_fixup(source, source_pixmap_priv);
+            }
+            /* XXX
+             * By default, glamor_upload_picture_to_texture will wire alpha to 1
+             * if one picture doesn't have alpha. So we don't do that again in
+             * rendering function. But here is a special case, as source and
+             * mask share the same texture but may have different formats. For
+             * example, source doesn't have alpha, but mask has alpha. Then the
+             * texture will have the alpha value for the mask. And will not wire
+             * to 1 for the source. In this case, we have to use different shader
+             * to wire the source's alpha to 1.
+             *
+             * But this may cause a potential problem if the source's repeat mode
+             * is REPEAT_NONE, and if the source is smaller than the dest, then
+             * for the region not covered by the source may be painted incorrectly.
+             * because we wire the alpha to 1.
+             *
+             **/
+            if (!PICT_FORMAT_A(saved_source_format)
+                && PICT_FORMAT_A(mask->format))
+                key.source = SHADER_SOURCE_TEXTURE;
+
+            if (!PICT_FORMAT_A(mask->format)
+                && PICT_FORMAT_A(saved_source_format))
+                key.mask = SHADER_MASK_TEXTURE;
+
+            mask_status = GLAMOR_NONE;
+        }
+
+        source_status = glamor_upload_picture_to_texture(source);
+        if (source_status != GLAMOR_UPLOAD_DONE) {
+            glamor_fallback("Failed to upload source texture.\n");
+            goto fail;
+        }
+    }
+    else {
+        if (source_status == GLAMOR_UPLOAD_PENDING) {
+            source_status = glamor_upload_picture_to_texture(source);
+            if (source_status != GLAMOR_UPLOAD_DONE) {
+                glamor_fallback("Failed to upload source texture.\n");
+                goto fail;
+            }
+        }
+
+        if (mask_status == GLAMOR_UPLOAD_PENDING) {
+            mask_status = glamor_upload_picture_to_texture(mask);
+            if (mask_status != GLAMOR_UPLOAD_DONE) {
+                glamor_fallback("Failed to upload mask texture.\n");
+                goto fail;
+            }
+        }
+    }
+#endif
+
+    /* If the source and mask are two differently-formatted views of
+     * the same pixmap bits, and the pixmap was already uploaded (so
+     * the dynamic code above doesn't apply), then fall back to
+     * software.  We should use texture views to fix this properly.
+     */
+    if (source_pixmap && source_pixmap == mask_pixmap &&
+        source->format != mask->format) {
+        goto fail;
+    }
+
+    /*Before enter the rendering stage, we need to fixup
+     * transformed source and mask, if the transform is not int translate. */
+    if (key.source != SHADER_SOURCE_SOLID
+        && source->transform
+        && !pixman_transform_is_int_translate(source->transform)
+        && source_pixmap_priv->type != GLAMOR_TEXTURE_LARGE) {
+        if (!glamor_fixup_pixmap_priv(screen, source_pixmap_priv))
+            goto fail;
+    }
+    if (key.mask != SHADER_MASK_NONE && key.mask != SHADER_MASK_SOLID
+        && mask->transform
+        && !pixman_transform_is_int_translate(mask->transform)
+        && mask_pixmap_priv->type != GLAMOR_TEXTURE_LARGE) {
+        if (!glamor_fixup_pixmap_priv(screen, mask_pixmap_priv))
+            goto fail;
+    }
+
+    if (!glamor_set_composite_op(screen, op, op_info, dest, mask))
+        goto fail;
+
+    *shader = glamor_lookup_composite_shader(screen, &key);
+    if ((*shader)->prog == 0) {
+        glamor_fallback("no shader program for this render acccel mode\n");
+        goto fail;
+    }
+
+    if (key.source == SHADER_SOURCE_SOLID)
+        memcpy(&(*shader)->source_solid_color[0],
+               source_solid_color, 4 * sizeof(float));
+    else {
+        (*shader)->source_priv = source_pixmap_priv;
+        (*shader)->source = source;
+    }
+
+    if (key.mask == SHADER_MASK_SOLID)
+        memcpy(&(*shader)->mask_solid_color[0],
+               mask_solid_color, 4 * sizeof(float));
+    else {
+        (*shader)->mask_priv = mask_pixmap_priv;
+        (*shader)->mask = mask;
+    }
+
+    ret = TRUE;
+    memcpy(s_key, &key, sizeof(key));
+    *psaved_source_format = saved_source_format;
+    goto done;
+
+ fail:
+    if (saved_source_format)
+        source->format = saved_source_format;
+ done:
+    return ret;
+}
+
+void
+glamor_composite_set_shader_blend(glamor_pixmap_private *dest_priv,
+                                  struct shader_key *key,
+                                  glamor_composite_shader *shader,
+                                  struct blendinfo *op_info)
+{
+    glamor_screen_private *glamor_priv;
+
+    glamor_priv = dest_priv->base.glamor_priv;
+
+    glamor_make_current(glamor_priv);
+    glUseProgram(shader->prog);
+
+    if (key->source == SHADER_SOURCE_SOLID) {
+        glamor_set_composite_solid(shader->source_solid_color,
+                                   shader->source_uniform_location);
+    }
+    else {
+        glamor_set_composite_texture(glamor_priv, 0,
+                                     shader->source,
+                                     shader->source_priv, shader->source_wh,
+                                     shader->source_repeat_mode);
+    }
+
+    if (key->mask != SHADER_MASK_NONE) {
+        if (key->mask == SHADER_MASK_SOLID) {
+            glamor_set_composite_solid(shader->mask_solid_color,
+                                       shader->mask_uniform_location);
+        }
+        else {
+            glamor_set_composite_texture(glamor_priv, 1,
+                                         shader->mask,
+                                         shader->mask_priv, shader->mask_wh,
+                                         shader->mask_repeat_mode);
+        }
+    }
+
+    if (op_info->source_blend == GL_ONE && op_info->dest_blend == GL_ZERO) {
+        glDisable(GL_BLEND);
+    }
+    else {
+        glEnable(GL_BLEND);
+        glBlendFunc(op_info->source_blend, op_info->dest_blend);
+    }
+}
+
+static Bool
+glamor_composite_with_shader(CARD8 op,
+                             PicturePtr source,
+                             PicturePtr mask,
+                             PicturePtr dest,
+                             glamor_pixmap_private *source_pixmap_priv,
+                             glamor_pixmap_private *mask_pixmap_priv,
+                             glamor_pixmap_private *dest_pixmap_priv,
+                             int nrect, glamor_composite_rect_t *rects,
+                             Bool two_pass_ca)
+{
+    ScreenPtr screen = dest->pDrawable->pScreen;
+    glamor_screen_private *glamor_priv = dest_pixmap_priv->base.glamor_priv;
+    PixmapPtr dest_pixmap = dest_pixmap_priv->base.pixmap;
+    PixmapPtr source_pixmap = NULL;
+    PixmapPtr mask_pixmap = NULL;
+    GLfloat dst_xscale, dst_yscale;
+    GLfloat mask_xscale = 1, mask_yscale = 1, src_xscale = 1, src_yscale = 1;
+    struct shader_key key, key_ca;
+    int dest_x_off, dest_y_off;
+    int source_x_off, source_y_off;
+    int mask_x_off, mask_y_off;
+    PictFormatShort saved_source_format = 0;
+    float src_matrix[9], mask_matrix[9];
+    float *psrc_matrix = NULL, *pmask_matrix = NULL;
+    int nrect_max;
+    Bool ret = FALSE;
+    glamor_composite_shader *shader = NULL, *shader_ca = NULL;
+    struct blendinfo op_info, op_info_ca;
+
+    if (!glamor_composite_choose_shader(op, source, mask, dest,
+                                        source_pixmap_priv, mask_pixmap_priv,
+                                        dest_pixmap_priv,
+                                        &key, &shader, &op_info,
+                                        &saved_source_format)) {
+        glamor_fallback("glamor_composite_choose_shader failed\n");
+        return ret;
+    }
+    if (two_pass_ca) {
+        if (!glamor_composite_choose_shader(PictOpAdd, source, mask, dest,
+                                            source_pixmap_priv,
+                                            mask_pixmap_priv, dest_pixmap_priv,
+                                            &key_ca, &shader_ca, &op_info_ca,
+                                            &saved_source_format)) {
+            glamor_fallback("glamor_composite_choose_shader failed\n");
+            return ret;
+        }
+    }
+
+    glamor_set_destination_pixmap_priv_nc(dest_pixmap_priv);
+    glamor_composite_set_shader_blend(dest_pixmap_priv, &key, shader, &op_info);
+
+    glamor_make_current(glamor_priv);
+
+    glamor_priv->has_source_coords = key.source != SHADER_SOURCE_SOLID;
+    glamor_priv->has_mask_coords = (key.mask != SHADER_MASK_NONE &&
+                                    key.mask != SHADER_MASK_SOLID);
+
+    dest_pixmap = glamor_get_drawable_pixmap(dest->pDrawable);
+    dest_pixmap_priv = glamor_get_pixmap_private(dest_pixmap);
+    glamor_get_drawable_deltas(dest->pDrawable, dest_pixmap,
+                               &dest_x_off, &dest_y_off);
+    pixmap_priv_get_dest_scale(dest_pixmap_priv, &dst_xscale, &dst_yscale);
+
+    if (glamor_priv->has_source_coords) {
+        source_pixmap = source_pixmap_priv->base.pixmap;
+        glamor_get_drawable_deltas(source->pDrawable,
+                                   source_pixmap, &source_x_off, &source_y_off);
+        pixmap_priv_get_scale(source_pixmap_priv, &src_xscale, &src_yscale);
+        if (source->transform) {
+            psrc_matrix = src_matrix;
+            glamor_picture_get_matrixf(source, psrc_matrix);
+        }
+    }
+
+    if (glamor_priv->has_mask_coords) {
+        mask_pixmap = mask_pixmap_priv->base.pixmap;
+        glamor_get_drawable_deltas(mask->pDrawable, mask_pixmap,
+                                   &mask_x_off, &mask_y_off);
+        pixmap_priv_get_scale(mask_pixmap_priv, &mask_xscale, &mask_yscale);
+        if (mask->transform) {
+            pmask_matrix = mask_matrix;
+            glamor_picture_get_matrixf(mask, pmask_matrix);
+        }
+    }
+
+    nrect_max = MIN(nrect, GLAMOR_COMPOSITE_VBO_VERT_CNT / 4);
+
+    while (nrect) {
+        int mrect, rect_processed;
+        int vb_stride;
+        float *vertices;
+
+        mrect = nrect > nrect_max ? nrect_max : nrect;
+        vertices = glamor_setup_composite_vbo(screen, mrect * 4);
+        rect_processed = mrect;
+        vb_stride = glamor_priv->vb_stride / sizeof(float);
+        while (mrect--) {
+            INT16 x_source;
+            INT16 y_source;
+            INT16 x_mask;
+            INT16 y_mask;
+            INT16 x_dest;
+            INT16 y_dest;
+            CARD16 width;
+            CARD16 height;
+
+            x_dest = rects->x_dst + dest_x_off;
+            y_dest = rects->y_dst + dest_y_off;
+            x_source = rects->x_src + source_x_off;
+            y_source = rects->y_src + source_y_off;
+            x_mask = rects->x_mask + mask_x_off;
+            y_mask = rects->y_mask + mask_y_off;
+            width = rects->width;
+            height = rects->height;
+
+            DEBUGF
+                ("dest(%d,%d) source(%d %d) mask (%d %d), width %d height %d \n",
+                 x_dest, y_dest, x_source, y_source, x_mask, y_mask, width,
+                 height);
+
+            glamor_set_normalize_vcoords_ext(dest_pixmap_priv, dst_xscale,
+                                             dst_yscale, x_dest, y_dest,
+                                             x_dest + width, y_dest + height,
+                                             glamor_priv->yInverted, vertices,
+                                             vb_stride);
+            vertices += 2;
+            if (key.source != SHADER_SOURCE_SOLID) {
+                glamor_set_normalize_tcoords_generic(source_pixmap_priv,
+                                                     source->repeatType,
+                                                     psrc_matrix, src_xscale,
+                                                     src_yscale, x_source,
+                                                     y_source, x_source + width,
+                                                     y_source + height,
+                                                     glamor_priv->yInverted,
+                                                     vertices, vb_stride);
+                vertices += 2;
+            }
+
+            if (key.mask != SHADER_MASK_NONE && key.mask != SHADER_MASK_SOLID) {
+                glamor_set_normalize_tcoords_generic(mask_pixmap_priv,
+                                                     mask->repeatType,
+                                                     pmask_matrix, mask_xscale,
+                                                     mask_yscale, x_mask,
+                                                     y_mask, x_mask + width,
+                                                     y_mask + height,
+                                                     glamor_priv->yInverted,
+                                                     vertices, vb_stride);
+                vertices += 2;
+            }
+            glamor_priv->render_nr_verts += 4;
+            rects++;
+
+            /* We've incremented by one of our 4 verts, now do the other 3. */
+            vertices += 3 * vb_stride;
+        }
+        glamor_put_vbo_space(screen);
+        glamor_flush_composite_rects(screen);
+        nrect -= rect_processed;
+        if (two_pass_ca) {
+            glamor_composite_set_shader_blend(dest_pixmap_priv,
+                                              &key_ca, shader_ca, &op_info_ca);
+            glamor_flush_composite_rects(screen);
+            if (nrect)
+                glamor_composite_set_shader_blend(dest_pixmap_priv,
+                                                  &key, shader, &op_info);
+        }
+    }
+
+    glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
+    glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
+    glDisableVertexAttribArray(GLAMOR_VERTEX_MASK);
+    glDisable(GL_BLEND);
+    DEBUGF("finish rendering.\n");
+    glamor_priv->state = RENDER_STATE;
+    glamor_priv->render_idle_cnt = 0;
+    if (saved_source_format)
+        source->format = saved_source_format;
+
+    ret = TRUE;
+    return ret;
+}
+
+PicturePtr
+glamor_convert_gradient_picture(ScreenPtr screen,
+                                PicturePtr source,
+                                int x_source,
+                                int y_source, int width, int height)
+{
+    PixmapPtr pixmap;
+    PicturePtr dst = NULL;
+    int error;
+    PictFormatShort format;
+
+    if (!source->pDrawable)
+        format = PICT_a8r8g8b8;
+    else
+        format = source->format;
+#ifdef GLAMOR_GRADIENT_SHADER
+    if (!source->pDrawable) {
+        if (source->pSourcePict->type == SourcePictTypeLinear) {
+            dst = glamor_generate_linear_gradient_picture(screen,
+                                                          source, x_source,
+                                                          y_source, width,
+                                                          height, format);
+        }
+        else if (source->pSourcePict->type == SourcePictTypeRadial) {
+            dst = glamor_generate_radial_gradient_picture(screen,
+                                                          source, x_source,
+                                                          y_source, width,
+                                                          height, format);
+        }
+
+        if (dst) {
+#if 0                           /* Debug to compare it to pixman, Enable it if needed. */
+            glamor_compare_pictures(screen, source,
+                                    dst, x_source, y_source, width, height,
+                                    0, 3);
+#endif
+            return dst;
+        }
+    }
+#endif
+    pixmap = glamor_create_pixmap(screen,
+                                  width,
+                                  height,
+                                  PIXMAN_FORMAT_DEPTH(format),
+                                  GLAMOR_CREATE_PIXMAP_CPU);
+
+    if (!pixmap)
+        return NULL;
+
+    dst = CreatePicture(0,
+                        &pixmap->drawable,
+                        PictureMatchFormat(screen,
+                                           PIXMAN_FORMAT_DEPTH(format),
+                                           format), 0, 0, serverClient, &error);
+    glamor_destroy_pixmap(pixmap);
+    if (!dst)
+        return NULL;
+
+    ValidatePicture(dst);
+
+    fbComposite(PictOpSrc, source, NULL, dst, x_source, y_source,
+                0, 0, 0, 0, width, height);
+    return dst;
+}
+
+Bool
+glamor_composite_clipped_region(CARD8 op,
+                                PicturePtr source,
+                                PicturePtr mask,
+                                PicturePtr dest,
+                                glamor_pixmap_private *source_pixmap_priv,
+                                glamor_pixmap_private *mask_pixmap_priv,
+                                glamor_pixmap_private *dest_pixmap_priv,
+                                RegionPtr region,
+                                int x_source,
+                                int y_source,
+                                int x_mask, int y_mask, int x_dest, int y_dest)
+{
+    ScreenPtr screen = dest->pDrawable->pScreen;
+    PixmapPtr source_pixmap = NULL, mask_pixmap = NULL;
+    PicturePtr temp_src = source, temp_mask = mask;
+    glamor_pixmap_private *temp_src_priv = source_pixmap_priv;
+    glamor_pixmap_private *temp_mask_priv = mask_pixmap_priv;
+    int x_temp_src, y_temp_src, x_temp_mask, y_temp_mask;
+    BoxPtr extent;
+    glamor_composite_rect_t rect[10];
+    glamor_composite_rect_t *prect = rect;
+    int prect_size = ARRAY_SIZE(rect);
+    int ok = FALSE;
+    int i;
+    int width;
+    int height;
+    BoxPtr box;
+    int nbox;
+    Bool two_pass_ca = FALSE;
+
+    extent = RegionExtents(region);
+    box = RegionRects(region);
+    nbox = RegionNumRects(region);
+    width = extent->x2 - extent->x1;
+    height = extent->y2 - extent->y1;
+
+    x_temp_src = x_source;
+    y_temp_src = y_source;
+    x_temp_mask = x_mask;
+    y_temp_mask = y_mask;
+
+    DEBUGF("clipped (%d %d) (%d %d) (%d %d) width %d height %d \n",
+           x_source, y_source, x_mask, y_mask, x_dest, y_dest, width, height);
+
+    if (source_pixmap_priv)
+        source_pixmap = source_pixmap_priv->base.pixmap;
+
+    if (mask_pixmap_priv)
+        mask_pixmap = mask_pixmap_priv->base.pixmap;
+
+    /* XXX is it possible source mask have non-zero drawable.x/y? */
+    if (source
+        && ((!source->pDrawable
+             && (source->pSourcePict->type != SourcePictTypeSolidFill))
+            || (source->pDrawable
+                && !GLAMOR_PIXMAP_PRIV_HAS_FBO(source_pixmap_priv)
+                && (source_pixmap->drawable.width != width
+                    || source_pixmap->drawable.height != height)))) {
+        temp_src =
+            glamor_convert_gradient_picture(screen, source,
+                                            extent->x1 + x_source - x_dest,
+                                            extent->y1 + y_source - y_dest,
+                                            width, height);
+        if (!temp_src) {
+            temp_src = source;
+            goto out;
+        }
+        temp_src_priv =
+            glamor_get_pixmap_private((PixmapPtr) (temp_src->pDrawable));
+        x_temp_src = -extent->x1 + x_dest;
+        y_temp_src = -extent->y1 + y_dest;
+    }
+
+    if (mask
+        &&
+        ((!mask->pDrawable
+          && (mask->pSourcePict->type != SourcePictTypeSolidFill))
+         || (mask->pDrawable && !GLAMOR_PIXMAP_PRIV_HAS_FBO(mask_pixmap_priv)
+             && (mask_pixmap->drawable.width != width
+                 || mask_pixmap->drawable.height != height)))) {
+        /* XXX if mask->pDrawable is the same as source->pDrawable, we have an opportunity
+         * to do reduce one convertion. */
+        temp_mask =
+            glamor_convert_gradient_picture(screen, mask,
+                                            extent->x1 + x_mask - x_dest,
+                                            extent->y1 + y_mask - y_dest,
+                                            width, height);
+        if (!temp_mask) {
+            temp_mask = mask;
+            goto out;
+        }
+        temp_mask_priv =
+            glamor_get_pixmap_private((PixmapPtr) (temp_mask->pDrawable));
+        x_temp_mask = -extent->x1 + x_dest;
+        y_temp_mask = -extent->y1 + y_dest;
+    }
+    /* Do two-pass PictOpOver componentAlpha, until we enable
+     * dual source color blending.
+     */
+
+    if (mask && mask->componentAlpha) {
+        if (op == PictOpOver) {
+            two_pass_ca = TRUE;
+            op = PictOpOutReverse;
+        }
+    }
+
+    if (!mask && temp_src) {
+        if (glamor_composite_with_copy(op, temp_src, dest,
+                                       x_temp_src, y_temp_src,
+                                       x_dest, y_dest, region)) {
+            ok = TRUE;
+            goto out;
+        }
+    }
+
+    /*XXXXX, self copy? */
+
+    x_dest += dest->pDrawable->x;
+    y_dest += dest->pDrawable->y;
+    if (temp_src && temp_src->pDrawable) {
+        x_temp_src += temp_src->pDrawable->x;
+        y_temp_src += temp_src->pDrawable->y;
+    }
+    if (temp_mask && temp_mask->pDrawable) {
+        x_temp_mask += temp_mask->pDrawable->x;
+        y_temp_mask += temp_mask->pDrawable->y;
+    }
+
+    if (nbox > ARRAY_SIZE(rect)) {
+        prect = calloc(nbox, sizeof(*prect));
+        if (prect)
+            prect_size = nbox;
+        else {
+            prect = rect;
+            prect_size = ARRAY_SIZE(rect);
+        }
+    }
+    while (nbox) {
+        int box_cnt;
+
+        box_cnt = nbox > prect_size ? prect_size : nbox;
+        for (i = 0; i < box_cnt; i++) {
+            prect[i].x_src = box[i].x1 + x_temp_src - x_dest;
+            prect[i].y_src = box[i].y1 + y_temp_src - y_dest;
+            prect[i].x_mask = box[i].x1 + x_temp_mask - x_dest;
+            prect[i].y_mask = box[i].y1 + y_temp_mask - y_dest;
+            prect[i].x_dst = box[i].x1;
+            prect[i].y_dst = box[i].y1;
+            prect[i].width = box[i].x2 - box[i].x1;
+            prect[i].height = box[i].y2 - box[i].y1;
+            DEBUGF("dest %d %d \n", prect[i].x_dst, prect[i].y_dst);
+        }
+        ok = glamor_composite_with_shader(op, temp_src, temp_mask, dest,
+                                          temp_src_priv, temp_mask_priv,
+                                          dest_pixmap_priv,
+                                          box_cnt, prect, two_pass_ca);
+        if (!ok)
+            break;
+        nbox -= box_cnt;
+        box += box_cnt;
+    }
+
+    if (prect != rect)
+        free(prect);
+ out:
+    if (temp_src != source)
+        FreePicture(temp_src, 0);
+    if (temp_mask != mask)
+        FreePicture(temp_mask, 0);
+
+    return ok;
+}
+
+static Bool
+_glamor_composite(CARD8 op,
+                  PicturePtr source,
+                  PicturePtr mask,
+                  PicturePtr dest,
+                  INT16 x_source,
+                  INT16 y_source,
+                  INT16 x_mask,
+                  INT16 y_mask,
+                  INT16 x_dest, INT16 y_dest,
+                  CARD16 width, CARD16 height, Bool fallback)
+{
+    ScreenPtr screen = dest->pDrawable->pScreen;
+    glamor_pixmap_private *dest_pixmap_priv;
+    glamor_pixmap_private *source_pixmap_priv = NULL, *mask_pixmap_priv = NULL;
+    PixmapPtr dest_pixmap = glamor_get_drawable_pixmap(dest->pDrawable);
+    PixmapPtr source_pixmap = NULL, mask_pixmap = NULL;
+    glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
+    Bool ret = TRUE;
+    RegionRec region;
+    BoxPtr extent;
+    int nbox, ok = FALSE;
+    PixmapPtr sub_dest_pixmap = NULL;
+    PixmapPtr sub_source_pixmap = NULL;
+    PixmapPtr sub_mask_pixmap = NULL;
+    int dest_x_off, dest_y_off, saved_dest_x, saved_dest_y;
+    int source_x_off, source_y_off, saved_source_x, saved_source_y;
+    int mask_x_off, mask_y_off, saved_mask_x, saved_mask_y;
+    DrawablePtr saved_dest_drawable;
+    DrawablePtr saved_source_drawable;
+    DrawablePtr saved_mask_drawable;
+    int force_clip = 0;
+
+    dest_pixmap_priv = glamor_get_pixmap_private(dest_pixmap);
+
+    if (source->pDrawable) {
+        source_pixmap = glamor_get_drawable_pixmap(source->pDrawable);
+        source_pixmap_priv = glamor_get_pixmap_private(source_pixmap);
+        if (source_pixmap_priv && source_pixmap_priv->type == GLAMOR_DRM_ONLY)
+            goto fail;
+    }
+
+    if (mask && mask->pDrawable) {
+        mask_pixmap = glamor_get_drawable_pixmap(mask->pDrawable);
+        mask_pixmap_priv = glamor_get_pixmap_private(mask_pixmap);
+        if (mask_pixmap_priv && mask_pixmap_priv->type == GLAMOR_DRM_ONLY)
+            goto fail;
+    }
+
+    DEBUGF
+        ("source pixmap %p (%d %d) mask(%d %d) dest(%d %d) width %d height %d \n",
+         source_pixmap, x_source, y_source, x_mask, y_mask, x_dest, y_dest,
+         width, height);
+
+    if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(dest_pixmap_priv)) {
+        goto fail;
+    }
+
+    if (op >= ARRAY_SIZE(composite_op_info))
+        goto fail;
+
+    if (mask && mask->componentAlpha) {
+        if (op == PictOpAtop
+            || op == PictOpAtopReverse
+            || op == PictOpXor || op >= PictOpSaturate) {
+            glamor_fallback("glamor_composite(): component alpha op %x\n", op);
+            goto fail;
+        }
+    }
+
+    if ((source && source->filter >= PictFilterConvolution)
+        || (mask && mask->filter >= PictFilterConvolution)) {
+        glamor_fallback("glamor_composite(): unsupported filter\n");
+        goto fail;
+    }
+
+    if (!miComputeCompositeRegion(&region,
+                                  source, mask, dest,
+                                  x_source +
+                                  (source_pixmap ? source->pDrawable->x : 0),
+                                  y_source +
+                                  (source_pixmap ? source->pDrawable->y : 0),
+                                  x_mask +
+                                  (mask_pixmap ? mask->pDrawable->x : 0),
+                                  y_mask +
+                                  (mask_pixmap ? mask->pDrawable->y : 0),
+                                  x_dest + dest->pDrawable->x,
+                                  y_dest + dest->pDrawable->y, width, height)) {
+        ret = TRUE;
+        goto done;
+    }
+
+    nbox = REGION_NUM_RECTS(&region);
+    DEBUGF("first clipped when compositing.\n");
+    DEBUGRegionPrint(&region);
+    extent = RegionExtents(&region);
+    if (nbox == 0) {
+        ret = TRUE;
+        goto done;
+    }
+    /* If destination is not a large pixmap, but the region is larger
+     * than texture size limitation, and source or mask is memory pixmap,
+     * then there may be need to load a large memory pixmap to a
+     * texture, and this is not permitted. Then we force to clip the
+     * destination and make sure latter will not upload a large memory
+     * pixmap. */
+    if (!glamor_check_fbo_size(glamor_priv,
+                               extent->x2 - extent->x1, extent->y2 - extent->y1)
+        && (dest_pixmap_priv->type != GLAMOR_TEXTURE_LARGE)
+        && ((source_pixmap_priv
+             && (source_pixmap_priv->type == GLAMOR_MEMORY ||
+                 source->repeatType == RepeatPad))
+            || (mask_pixmap_priv &&
+                (mask_pixmap_priv->type == GLAMOR_MEMORY ||
+                 mask->repeatType == RepeatPad))
+            || (!source_pixmap_priv &&
+                (source->pSourcePict->type != SourcePictTypeSolidFill))
+            || (!mask_pixmap_priv && mask &&
+                mask->pSourcePict->type != SourcePictTypeSolidFill)))
+        force_clip = 1;
+
+    if (force_clip || dest_pixmap_priv->type == GLAMOR_TEXTURE_LARGE
+        || (source_pixmap_priv
+            && source_pixmap_priv->type == GLAMOR_TEXTURE_LARGE)
+        || (mask_pixmap_priv && mask_pixmap_priv->type == GLAMOR_TEXTURE_LARGE))
+        ok = glamor_composite_largepixmap_region(op,
+                                                 source, mask, dest,
+                                                 source_pixmap_priv,
+                                                 mask_pixmap_priv,
+                                                 dest_pixmap_priv,
+                                                 &region, force_clip,
+                                                 x_source, y_source,
+                                                 x_mask, y_mask,
+                                                 x_dest, y_dest, width, height);
+    else
+        ok = glamor_composite_clipped_region(op, source,
+                                             mask, dest,
+                                             source_pixmap_priv,
+                                             mask_pixmap_priv,
+                                             dest_pixmap_priv,
+                                             &region,
+                                             x_source, y_source,
+                                             x_mask, y_mask, x_dest, y_dest);
+
+    REGION_UNINIT(dest->pDrawable->pScreen, &region);
+
+    if (ok)
+        goto done;
+ fail:
+
+    if (!fallback && glamor_ddx_fallback_check_pixmap(&dest_pixmap->drawable)
+        && (!source_pixmap
+            || glamor_ddx_fallback_check_pixmap(&source_pixmap->drawable))
+        && (!mask_pixmap
+            || glamor_ddx_fallback_check_pixmap(&mask_pixmap->drawable))) {
+        ret = FALSE;
+        goto done;
+    }
+
+    glamor_fallback
+        ("from picts %p:%p %dx%d / %p:%p %d x %d (%c,%c)  to pict %p:%p %dx%d (%c)\n",
+         source, source->pDrawable,
+         source->pDrawable ? source->pDrawable->width : 0,
+         source->pDrawable ? source->pDrawable->height : 0, mask,
+         (!mask) ? NULL : mask->pDrawable, (!mask
+                                            || !mask->pDrawable) ? 0 :
+         mask->pDrawable->width, (!mask
+                                  || !mask->pDrawable) ? 0 : mask->
+         pDrawable->height, glamor_get_picture_location(source),
+         glamor_get_picture_location(mask), dest, dest->pDrawable,
+         dest->pDrawable->width, dest->pDrawable->height,
+         glamor_get_picture_location(dest));
+
+#define GET_SUB_PICTURE(p, access)             do {                                    \
+       glamor_get_drawable_deltas(p->pDrawable, p ##_pixmap,                           \
+                                  & p ##_x_off, & p ##_y_off);                         \
+       sub_ ##p ##_pixmap = glamor_get_sub_pixmap(p ##_pixmap,                         \
+                                             x_ ##p + p ##_x_off + p->pDrawable->x,    \
+                                             y_ ##p + p ##_y_off + p->pDrawable->y,    \
+                                             width, height, access);                   \
+       if (sub_ ##p ##_pixmap != NULL) {                                               \
+               saved_ ##p ##_drawable = p->pDrawable;                                  \
+               saved_ ##p ##_x = x_ ##p;                                               \
+               saved_ ##p ##_y = y_ ##p;                                               \
+               if (p->pCompositeClip)                                                  \
+                       pixman_region_translate (p->pCompositeClip,                     \
+                                                -p->pDrawable->x - x_ ##p,             \
+                                                -p->pDrawable->y - y_ ##p);            \
+               p->pDrawable = &sub_ ##p ##_pixmap->drawable;                           \
+               x_ ##p = 0;                                                             \
+               y_ ##p = 0;                                                             \
+       } } while(0)
+    GET_SUB_PICTURE(dest, GLAMOR_ACCESS_RW);
+    if (source->pDrawable && !source->transform)
+        GET_SUB_PICTURE(source, GLAMOR_ACCESS_RO);
+    if (mask && mask->pDrawable && !mask->transform)
+        GET_SUB_PICTURE(mask, GLAMOR_ACCESS_RO);
+
+    if (glamor_prepare_access_picture(dest, GLAMOR_ACCESS_RW) &&
+        glamor_prepare_access_picture(source, GLAMOR_ACCESS_RO) &&
+        glamor_prepare_access_picture(mask, GLAMOR_ACCESS_RO)) {
+        fbComposite(op,
+                    source, mask, dest,
+                    x_source, y_source,
+                    x_mask, y_mask, x_dest, y_dest, width, height);
+    }
+    glamor_finish_access_picture(mask);
+    glamor_finish_access_picture(source);
+    glamor_finish_access_picture(dest);
+
+#define PUT_SUB_PICTURE(p, access)             do {                            \
+       if (sub_ ##p ##_pixmap != NULL) {                                       \
+               x_ ##p = saved_ ##p ##_x;                                       \
+               y_ ##p = saved_ ##p ##_y;                                       \
+               p->pDrawable = saved_ ##p ##_drawable;                          \
+               if (p->pCompositeClip)                                          \
+                       pixman_region_translate (p->pCompositeClip,             \
+                                                p->pDrawable->x + x_ ##p,      \
+                                                p->pDrawable->y + y_ ##p);     \
+               glamor_put_sub_pixmap(sub_ ##p ##_pixmap, p ##_pixmap,          \
+                                     x_ ##p + p ##_x_off + p->pDrawable->x,    \
+                                     y_ ##p + p ##_y_off + p->pDrawable->y,    \
+                                     width, height, access);                   \
+       }} while(0)
+    if (mask && mask->pDrawable)
+        PUT_SUB_PICTURE(mask, GLAMOR_ACCESS_RO);
+    if (source->pDrawable)
+        PUT_SUB_PICTURE(source, GLAMOR_ACCESS_RO);
+    PUT_SUB_PICTURE(dest, GLAMOR_ACCESS_RW);
+ done:
+    return ret;
+}
+
+void
+glamor_composite(CARD8 op,
+                 PicturePtr source,
+                 PicturePtr mask,
+                 PicturePtr dest,
+                 INT16 x_source,
+                 INT16 y_source,
+                 INT16 x_mask,
+                 INT16 y_mask,
+                 INT16 x_dest, INT16 y_dest, CARD16 width, CARD16 height)
+{
+    _glamor_composite(op, source, mask, dest, x_source, y_source,
+                      x_mask, y_mask, x_dest, y_dest, width, height, TRUE);
+}
+
+Bool
+glamor_composite_nf(CARD8 op,
+                    PicturePtr source,
+                    PicturePtr mask,
+                    PicturePtr dest,
+                    INT16 x_source,
+                    INT16 y_source,
+                    INT16 x_mask,
+                    INT16 y_mask,
+                    INT16 x_dest, INT16 y_dest, CARD16 width, CARD16 height)
+{
+    return _glamor_composite(op, source, mask, dest, x_source, y_source,
+                             x_mask, y_mask, x_dest, y_dest, width, height,
+                             FALSE);
+}
+
+static void
+glamor_get_src_rect_extent(int nrect,
+                           glamor_composite_rect_t *rects, BoxPtr extent)
+{
+    extent->x1 = MAXSHORT;
+    extent->y1 = MAXSHORT;
+    extent->x2 = MINSHORT;
+    extent->y2 = MINSHORT;
+
+    while (nrect--) {
+        if (extent->x1 > rects->x_src)
+            extent->x1 = rects->x_src;
+        if (extent->y1 > rects->y_src)
+            extent->y1 = rects->y_src;
+        if (extent->x2 < rects->x_src + rects->width)
+            extent->x2 = rects->x_src + rects->width;
+        if (extent->y2 < rects->y_src + rects->height)
+            extent->y2 = rects->y_src + rects->height;
+        rects++;
+    }
+}
+
+static void
+glamor_composite_src_rect_translate(int nrect,
+                                    glamor_composite_rect_t *rects,
+                                    int x, int y)
+{
+    while (nrect--) {
+        rects->x_src += x;
+        rects->y_src += y;
+        rects++;
+    }
+}
+
+void
+glamor_composite_glyph_rects(CARD8 op,
+                             PicturePtr src, PicturePtr mask, PicturePtr dst,
+                             int nrect, glamor_composite_rect_t *rects)
+{
+    int n;
+    PicturePtr temp_src = NULL;
+    glamor_composite_rect_t *r;
+
+    ValidatePicture(src);
+    ValidatePicture(dst);
+    if (!(glamor_is_large_picture(src)
+          || (mask && glamor_is_large_picture(mask))
+          || glamor_is_large_picture(dst))) {
+        glamor_pixmap_private *src_pixmap_priv = NULL;
+        glamor_pixmap_private *mask_pixmap_priv = NULL;
+        glamor_pixmap_private *dst_pixmap_priv;
+        glamor_pixmap_private *temp_src_priv = NULL;
+        BoxRec src_extent;
+
+        dst_pixmap_priv = glamor_get_pixmap_private
+            (glamor_get_drawable_pixmap(dst->pDrawable));
+
+        if (mask && mask->pDrawable)
+            mask_pixmap_priv = glamor_get_pixmap_private
+                (glamor_get_drawable_pixmap(mask->pDrawable));
+        if (src->pDrawable)
+            src_pixmap_priv = glamor_get_pixmap_private
+                (glamor_get_drawable_pixmap(src->pDrawable));
+
+        if (!src->pDrawable
+            && (src->pSourcePict->type != SourcePictTypeSolidFill)) {
+            glamor_get_src_rect_extent(nrect, rects, &src_extent);
+            temp_src = glamor_convert_gradient_picture(dst->pDrawable->pScreen,
+                                                       src,
+                                                       src_extent.x1,
+                                                       src_extent.y1,
+                                                       src_extent.x2 -
+                                                       src_extent.x1,
+                                                       src_extent.y2 -
+                                                       src_extent.y1);
+            if (!temp_src)
+                goto fallback;
+
+            temp_src_priv = glamor_get_pixmap_private
+                ((PixmapPtr) (temp_src->pDrawable));
+            glamor_composite_src_rect_translate(nrect, rects,
+                                                -src_extent.x1, -src_extent.y1);
+        }
+        else {
+            temp_src = src;
+            temp_src_priv = src_pixmap_priv;
+        }
+
+        if (mask && mask->componentAlpha) {
+            if (op == PictOpOver) {
+                if (glamor_composite_with_shader(PictOpOutReverse,
+                                                 temp_src, mask, dst,
+                                                 temp_src_priv,
+                                                 mask_pixmap_priv,
+                                                 dst_pixmap_priv, nrect, rects,
+                                                 TRUE))
+                    goto done;
+            }
+        }
+        else {
+            if (glamor_composite_with_shader
+                (op, temp_src, mask, dst, temp_src_priv, mask_pixmap_priv,
+                 dst_pixmap_priv, nrect, rects, FALSE))
+                goto done;
+        }
+    }
+ fallback:
+    n = nrect;
+    r = rects;
+
+    while (n--) {
+        CompositePicture(op,
+                         temp_src ? temp_src : src,
+                         mask,
+                         dst,
+                         r->x_src, r->y_src,
+                         r->x_mask, r->y_mask,
+                         r->x_dst, r->y_dst, r->width, r->height);
+        r++;
+    }
+
+ done:
+    if (temp_src && temp_src != src)
+        FreePicture(temp_src, 0);
+}
+
+static Bool
+_glamor_composite_rects(CARD8 op,
+                        PicturePtr pDst,
+                        xRenderColor *color,
+                        int nRect, xRectangle *rects, Bool fallback)
+{
+    miCompositeRects(op, pDst, color, nRect, rects);
+    return TRUE;
+}
+
+void
+glamor_composite_rects(CARD8 op,
+                       PicturePtr pDst,
+                       xRenderColor *color, int nRect, xRectangle *rects)
+{
+    _glamor_composite_rects(op, pDst, color, nRect, rects, TRUE);
+}
+
+Bool
+glamor_composite_rects_nf(CARD8 op,
+                          PicturePtr pDst,
+                          xRenderColor *color, int nRect, xRectangle *rects)
+{
+    return _glamor_composite_rects(op, pDst, color, nRect, rects, FALSE);
+}
+
+#endif                          /* RENDER */
diff --git a/glamor/glamor_segment.c b/glamor/glamor_segment.c
new file mode 100644 (file)
index 0000000..53f7da0
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * Copyright Â© 2014 Keith Packard
+ *
+ * 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 the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  The copyright holders make no representations
+ * about the suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS 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.
+ */
+
+#include "glamor_priv.h"
+
+Bool
+glamor_poly_segment_nf(DrawablePtr drawable, GCPtr gc, int nseg,
+                       xSegment *seg)
+{
+    if (glamor_ddx_fallback_check_pixmap(drawable) &&
+        glamor_ddx_fallback_check_gc(gc)) {
+        return FALSE;
+    }
+
+    miPolySegment(drawable, gc, nseg, seg);
+
+    return TRUE;
+}
+
+void
+glamor_poly_segment(DrawablePtr drawable, GCPtr gc, int nseg,
+                    xSegment *seg)
+{
+    miPolySegment(drawable, gc, nseg, seg);
+}
diff --git a/glamor/glamor_spans.c b/glamor/glamor_spans.c
new file mode 100644 (file)
index 0000000..46ba6c3
--- /dev/null
@@ -0,0 +1,434 @@
+/*
+ * Copyright Â© 2014 Keith Packard
+ *
+ * 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 the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  The copyright holders make no representations
+ * about the suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS 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.
+ */
+
+#include "glamor_priv.h"
+#include "glamor_transform.h"
+#include "glamor_transfer.h"
+
+glamor_program  fill_spans_progs[4];
+
+static const glamor_facet glamor_facet_fillspans_130 = {
+    .name = "fill_spans",
+    .version = 130,
+    .vs_vars =  "attribute vec3 primitive;\n",
+    .vs_exec = ("       vec2 pos = vec2(primitive.z,1) * vec2(gl_VertexID&1, (gl_VertexID&2)>>1);\n"
+                GLAMOR_POS(gl_Position, (primitive.xy + pos))),
+};
+
+static const glamor_facet glamor_facet_fillspans_120 = {
+    .name = "fill_spans",
+    .vs_vars =  "attribute vec2 primitive;\n",
+    .vs_exec = ("       vec2 pos = vec2(0,0);\n"
+                GLAMOR_POS(gl_Position, primitive.xy)),
+};
+
+static Bool
+glamor_fill_spans_gl(DrawablePtr drawable,
+                     GCPtr gc,
+                     int n, DDXPointPtr points, int *widths, int sorted)
+{
+    ScreenPtr screen = drawable->pScreen;
+    glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
+    PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable);
+    glamor_pixmap_private *pixmap_priv;
+    glamor_program *prog;
+    int off_x, off_y;
+    GLshort *v;
+    char *vbo_offset;
+    int c;
+    int box_x, box_y;
+
+    pixmap_priv = glamor_get_pixmap_private(pixmap);
+    if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv))
+        goto bail;
+
+    glamor_make_current(glamor_priv);
+
+    if (glamor_priv->glsl_version >= 130) {
+        prog = glamor_use_program_fill(pixmap, gc, &glamor_priv->fill_spans_program,
+                                       &glamor_facet_fillspans_130);
+
+        if (!prog)
+            goto bail_ctx;
+
+        /* Set up the vertex buffers for the points */
+
+        v = glamor_get_vbo_space(drawable->pScreen, n * (4 * sizeof (GLshort)), &vbo_offset);
+
+        glEnableVertexAttribArray(GLAMOR_VERTEX_POS);
+        glVertexAttribDivisor(GLAMOR_VERTEX_POS, 1);
+        glVertexAttribPointer(GLAMOR_VERTEX_POS, 3, GL_SHORT, GL_FALSE,
+                              4 * sizeof (GLshort), vbo_offset);
+
+        for (c = 0; c < n; c++) {
+            v[0] = points->x;
+            v[1] = points->y;
+            v[2] = *widths++;
+            points++;
+            v += 4;
+        }
+
+        glamor_put_vbo_space(screen);
+    } else {
+        prog = glamor_use_program_fill(pixmap, gc, &glamor_priv->fill_spans_program,
+                                       &glamor_facet_fillspans_120);
+
+        if (!prog)
+            goto bail_ctx;
+
+        /* Set up the vertex buffers for the points */
+
+        v = glamor_get_vbo_space(drawable->pScreen, n * 8 * sizeof (short), &vbo_offset);
+
+        glEnableVertexAttribArray(GLAMOR_VERTEX_POS);
+        glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_SHORT, GL_FALSE,
+                              2 * sizeof (short), vbo_offset);
+
+        for (c = 0; c < n; c++) {
+            v[0] = points->x;           v[1] = points->y;
+            v[2] = points->x;           v[3] = points->y + 1;
+            v[4] = points->x + *widths; v[5] = points->y + 1;
+            v[6] = points->x + *widths; v[7] = points->y;
+
+            widths++;
+            points++;
+            v += 8;
+        }
+
+        glamor_put_vbo_space(screen);
+    }
+
+    glEnable(GL_SCISSOR_TEST);
+
+    glamor_pixmap_loop(pixmap_priv, box_x, box_y) {
+        int nbox = RegionNumRects(gc->pCompositeClip);
+        BoxPtr box = RegionRects(gc->pCompositeClip);
+
+        glamor_set_destination_drawable(drawable, box_x, box_y, FALSE, FALSE, prog->matrix_uniform, &off_x, &off_y);
+
+        while (nbox--) {
+            glScissor(box->x1 + off_x,
+                      box->y1 + off_y,
+                      box->x2 - box->x1,
+                      box->y2 - box->y1);
+            box++;
+            if (glamor_priv->glsl_version >= 130)
+                glDrawArraysInstanced(GL_TRIANGLE_STRIP, 0, 4, n);
+            else {
+                if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) {
+                    glDrawArrays(GL_QUADS, 0, 4 * n);
+                } else {
+                    int i;
+                    for (i = 0; i < n; i++) {
+                        glDrawArrays(GL_TRIANGLE_FAN, i * 4, 4);
+                    }
+                }
+            }
+        }
+    }
+
+    glDisable(GL_SCISSOR_TEST);
+    glDisable(GL_COLOR_LOGIC_OP);
+    if (glamor_priv->glsl_version >= 130)
+        glVertexAttribDivisor(GLAMOR_VERTEX_POS, 0);
+    glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
+
+    return TRUE;
+bail_ctx:
+    glDisable(GL_COLOR_LOGIC_OP);
+bail:
+    return FALSE;
+}
+
+static void
+glamor_fill_spans_bail(DrawablePtr drawable,
+                       GCPtr gc,
+                       int n, DDXPointPtr points, int *widths, int sorted)
+{
+    if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RW) &&
+        glamor_prepare_access_gc(gc)) {
+        fbFillSpans(drawable, gc, n, points, widths, sorted);
+    }
+    glamor_finish_access_gc(gc);
+    glamor_finish_access(drawable);
+}
+
+void
+glamor_fill_spans(DrawablePtr drawable,
+                  GCPtr gc,
+                  int n, DDXPointPtr points, int *widths, int sorted)
+{
+    if (glamor_fill_spans_gl(drawable, gc, n, points, widths, sorted))
+        return;
+    glamor_fill_spans_bail(drawable, gc, n, points, widths, sorted);
+}
+
+Bool
+glamor_fill_spans_nf(DrawablePtr drawable,
+                     GCPtr gc,
+                     int n, DDXPointPtr points, int *widths, int sorted)
+{
+    if (glamor_fill_spans_gl(drawable, gc, n, points, widths, sorted))
+        return TRUE;
+
+    if (glamor_ddx_fallback_check_pixmap(drawable) && glamor_ddx_fallback_check_gc(gc))
+        return FALSE;
+
+    glamor_fill_spans_bail(drawable, gc, n, points, widths, sorted);
+    return TRUE;
+}
+
+static Bool
+glamor_get_spans_gl(DrawablePtr drawable, int wmax,
+                    DDXPointPtr points, int *widths, int count, char *dst)
+{
+    ScreenPtr screen = drawable->pScreen;
+    glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
+    PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable);
+    glamor_pixmap_private *pixmap_priv;
+    int box_x, box_y;
+    int n;
+    char *d;
+    GLenum type;
+    GLenum format;
+    int off_x, off_y;
+
+    pixmap_priv = glamor_get_pixmap_private(pixmap);
+    if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv))
+        goto bail;
+
+    glamor_get_drawable_deltas(drawable, pixmap, &off_x, &off_y);
+
+    glamor_format_for_pixmap(pixmap, &format, &type);
+
+    glamor_make_current(glamor_priv);
+
+    glamor_pixmap_loop(pixmap_priv, box_x, box_y) {
+        BoxPtr                  box = glamor_pixmap_box_at(pixmap_priv, box_x, box_y);
+        glamor_pixmap_fbo       *fbo = glamor_pixmap_fbo_at(pixmap_priv, box_x, box_y);
+
+        glBindFramebuffer(GL_READ_FRAMEBUFFER, fbo->fb);
+        glPixelStorei(GL_PACK_ALIGNMENT, 4);
+
+        d = dst;
+        for (n = 0; n < count; n++) {
+            int x1 = points[n].x + off_x;
+            int y = points[n].y + off_y;
+            int w = widths[n];
+            int x2 = x1 + w;
+            char *l;
+
+            l = d;
+            d += PixmapBytePad(w, drawable->depth);
+
+            /* clip */
+            if (x1 < box->x1) {
+                l += (box->x1 - x1) * (drawable->bitsPerPixel >> 3);
+                x1 = box->x1;
+            }
+            if (x2 > box->x2)
+                x2 = box->x2;
+
+            if (x1 >= x2)
+                continue;
+            if (y < box->y1)
+                continue;
+            if (y >= box->y2)
+                continue;
+
+            glReadPixels(x1 - box->x1, y - box->y1, x2 - x1, 1, format, type, l);
+        }
+    }
+
+    return TRUE;
+bail:
+    return FALSE;
+}
+
+static void
+glamor_get_spans_bail(DrawablePtr drawable, int wmax,
+                 DDXPointPtr points, int *widths, int count, char *dst)
+{
+    if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RO))
+        fbGetSpans(drawable, wmax, points, widths, count, dst);
+    glamor_finish_access(drawable);
+}
+
+void
+glamor_get_spans(DrawablePtr drawable, int wmax,
+                 DDXPointPtr points, int *widths, int count, char *dst)
+{
+    if (glamor_get_spans_gl(drawable, wmax, points, widths, count, dst))
+        return;
+    glamor_get_spans_bail(drawable, wmax, points, widths, count, dst);
+}
+
+Bool
+glamor_get_spans_nf(DrawablePtr drawable, int wmax,
+                    DDXPointPtr points, int *widths, int count, char *dst)
+{
+    if (glamor_get_spans_gl(drawable, wmax, points, widths, count, dst))
+        return TRUE;
+
+    if (glamor_ddx_fallback_check_pixmap(drawable))
+        return FALSE;
+
+    glamor_get_spans_bail(drawable, wmax, points, widths, count, dst);
+    return TRUE;
+}
+
+static Bool
+glamor_set_spans_gl(DrawablePtr drawable, GCPtr gc, char *src,
+                    DDXPointPtr points, int *widths, int numPoints, int sorted)
+{
+    ScreenPtr screen = drawable->pScreen;
+    glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
+    PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable);
+    glamor_pixmap_private *pixmap_priv;
+    int box_x, box_y;
+    int n;
+    char *s;
+    GLenum type;
+    GLenum format;
+    int off_x, off_y;
+
+    pixmap_priv = glamor_get_pixmap_private(pixmap);
+    if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv))
+        goto bail;
+
+    if (gc->alu != GXcopy)
+        goto bail;
+
+    if (!glamor_pm_is_solid(&pixmap->drawable, gc->planemask))
+        goto bail;
+
+    glamor_get_drawable_deltas(drawable, pixmap, &off_x, &off_y);
+    glamor_format_for_pixmap(pixmap, &format, &type);
+
+    glamor_make_current(glamor_priv);
+
+    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+
+    glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
+
+    glamor_pixmap_loop(pixmap_priv, box_x, box_y) {
+        BoxPtr                  box = glamor_pixmap_box_at(pixmap_priv, box_x, box_y);
+        glamor_pixmap_fbo       *fbo = glamor_pixmap_fbo_at(pixmap_priv, box_x, box_y);
+
+        glActiveTexture(GL_TEXTURE0);
+        glBindTexture(GL_TEXTURE_2D, fbo->tex);
+
+        s = src;
+        for (n = 0; n < numPoints; n++) {
+
+            BoxPtr      clip_box = RegionRects(gc->pCompositeClip);
+            int         nclip_box = RegionNumRects(gc->pCompositeClip);
+            int         w = widths[n];
+            int         y = points[n].y;
+            int         x = points[n].x;
+
+            while (nclip_box--) {
+                int x1 = x;
+                int x2 = x + w;
+                int y1 = y;
+                char *l = s;
+
+                /* clip to composite clip */
+                if (x1 < clip_box->x1) {
+                    l += (clip_box->x1 - x1) * (drawable->bitsPerPixel >> 3);
+                    x1 = clip_box->x1;
+                }
+                if (x2 > clip_box->x2)
+                    x2 = clip_box->x2;
+
+                if (y < clip_box->y1)
+                    continue;
+                if (y >= clip_box->y2)
+                    continue;
+
+                /* adjust to pixmap coordinates */
+                x1 += off_x;
+                x2 += off_x;
+                y1 += off_y;
+
+                if (x1 < box->x1) {
+                    l += (box->x1 - x1) * (drawable->bitsPerPixel >> 3);
+                    x1 = box->x1;
+                }
+                if (x2 > box->x2)
+                    x2 = box->x2;
+
+                if (x1 >= x2)
+                    continue;
+                if (y1 < box->y1)
+                    continue;
+                if (y1 >= box->y2)
+                    continue;
+
+                glTexSubImage2D(GL_TEXTURE_2D, 0,
+                                x1 - box->x1, y1 - box->y1, x2 - x1, 1,
+                                format, type,
+                                l);
+            }
+            s += PixmapBytePad(w, drawable->depth);
+        }
+    }
+
+    return TRUE;
+
+bail:
+    return FALSE;
+}
+
+static void
+glamor_set_spans_bail(DrawablePtr drawable, GCPtr gc, char *src,
+                      DDXPointPtr points, int *widths, int numPoints, int sorted)
+{
+    if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RW) && glamor_prepare_access_gc(gc))
+        fbSetSpans(drawable, gc, src, points, widths, numPoints, sorted);
+    glamor_finish_access_gc(gc);
+    glamor_finish_access(drawable);
+}
+
+void
+glamor_set_spans(DrawablePtr drawable, GCPtr gc, char *src,
+                 DDXPointPtr points, int *widths, int numPoints, int sorted)
+{
+    if (glamor_set_spans_gl(drawable, gc, src, points, widths, numPoints, sorted))
+        return;
+    glamor_set_spans_bail(drawable, gc, src, points, widths, numPoints, sorted);
+}
+
+Bool
+glamor_set_spans_nf(DrawablePtr drawable, GCPtr gc, char *src,
+                    DDXPointPtr points, int *widths, int numPoints, int sorted)
+{
+    if (glamor_set_spans_gl(drawable, gc, src, points, widths, numPoints, sorted))
+        return TRUE;
+
+    if (glamor_ddx_fallback_check_pixmap(drawable) && glamor_ddx_fallback_check_gc(gc))
+        return FALSE;
+
+    glamor_set_spans_bail(drawable, gc, src, points, widths, numPoints, sorted);
+    return TRUE;
+}
diff --git a/glamor/glamor_text.c b/glamor/glamor_text.c
new file mode 100644 (file)
index 0000000..6e02b9a
--- /dev/null
@@ -0,0 +1,534 @@
+/*
+ * Copyright Â© 2014 Keith Packard
+ *
+ * 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 the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  The copyright holders make no representations
+ * about the suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS 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.
+ */
+
+#include "glamor_priv.h"
+#include <dixfontstr.h>
+#include "glamor_transform.h"
+
+/*
+ * Fill in the array of charinfo pointers for the provided characters. For
+ * missing characters, place a NULL in the array so that the charinfo array
+ * aligns exactly with chars
+ */
+
+static void
+glamor_get_glyphs(FontPtr font, glamor_font_t *glamor_font,
+                  int count, char *chars, Bool sixteen, CharInfoPtr *charinfo)
+{
+    unsigned long nglyphs;
+    FontEncoding encoding;
+    int char_step;
+    int c;
+
+    if (sixteen) {
+        char_step = 2;
+        if (FONTLASTROW(font) == 0)
+            encoding = Linear16Bit;
+        else
+            encoding = TwoD16Bit;
+    } else {
+        char_step = 1;
+        encoding = Linear8Bit;
+    }
+
+    /* If the font has a default character, then we shouldn't have to
+     * worry about missing glyphs, so just get the whole string all at
+     * once. Otherwise, we have to fetch chars one at a time to notice
+     * missing ones.
+     */
+    if (glamor_font->default_char) {
+        GetGlyphs(font, (unsigned long) count, (unsigned char *) chars,
+                  encoding, &nglyphs, charinfo);
+
+        /* Make sure it worked. There's a bug in libXfont through
+         * version 1.4.7 which would cause it to fail when the font is
+         * a 2D font without a first row, and the application sends a
+         * 1-d request. In this case, libXfont would return zero
+         * glyphs, even when the font had a default character.
+         *
+         * It's easy enough for us to work around that bug here by
+         * simply checking the returned nglyphs and falling through to
+         * the one-at-a-time code below. Not doing this check would
+         * result in uninitialized memory accesses in the rendering code.
+         */
+        if (nglyphs == count)
+            return;
+    }
+
+    for (c = 0; c < count; c++) {
+        GetGlyphs(font, 1, (unsigned char *) chars,
+                  encoding, &nglyphs, &charinfo[c]);
+        if (!nglyphs)
+            charinfo[c] = NULL;
+        chars += char_step;
+    }
+}
+
+/*
+ * Construct quads for the provided list of characters and draw them
+ */
+
+static int
+glamor_text(DrawablePtr drawable, GCPtr gc,
+            glamor_font_t *glamor_font,
+            glamor_program *prog,
+            int x, int y,
+            int count, char *s_chars, CharInfoPtr *charinfo,
+            Bool sixteen)
+{
+    unsigned char *chars = (unsigned char *) s_chars;
+    FontPtr font = gc->font;
+    int off_x, off_y;
+    int c;
+    int nglyph;
+    GLshort *v;
+    char *vbo_offset;
+    CharInfoPtr ci;
+    int firstRow = font->info.firstRow;
+    int firstCol = font->info.firstCol;
+    int glyph_spacing_x = glamor_font->glyph_width_bytes * 8;
+    int glyph_spacing_y = glamor_font->glyph_height;
+    int box_x, box_y;
+    PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable);
+    glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap);
+
+    /* Set the font as texture 1 */
+
+    glActiveTexture(GL_TEXTURE1);
+    glBindTexture(GL_TEXTURE_2D, glamor_font->texture_id);
+    glUniform1i(prog->font_uniform, 1);
+
+    /* Set up the vertex buffers for the font and destination */
+
+    v = glamor_get_vbo_space(drawable->pScreen, count * (6 * sizeof (GLshort)), &vbo_offset);
+
+    glEnableVertexAttribArray(GLAMOR_VERTEX_POS);
+    glVertexAttribDivisor(GLAMOR_VERTEX_POS, 1);
+    glVertexAttribPointer(GLAMOR_VERTEX_POS, 4, GL_SHORT, GL_FALSE,
+                          6 * sizeof (GLshort), vbo_offset);
+
+    glEnableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
+    glVertexAttribDivisor(GLAMOR_VERTEX_SOURCE, 1);
+    glVertexAttribPointer(GLAMOR_VERTEX_SOURCE, 2, GL_SHORT, GL_FALSE,
+                          6 * sizeof (GLshort), vbo_offset + 4 * sizeof (GLshort));
+
+    /* Set the vertex coordinates */
+    nglyph = 0;
+
+    for (c = 0; c < count; c++) {
+        if ((ci = *charinfo++)) {
+            int     x1 = x + ci->metrics.leftSideBearing;
+            int     y1 = y - ci->metrics.ascent;
+            int     width = GLYPHWIDTHPIXELS(ci);
+            int     height = GLYPHHEIGHTPIXELS(ci);
+            int     tx, ty = 0;
+            int     row = 0, col;
+
+            x += ci->metrics.characterWidth;
+
+            if (sixteen) {
+                if (ci == glamor_font->default_char) {
+                    row = glamor_font->default_row;
+                    col = glamor_font->default_col;
+                } else {
+                    row = chars[0];
+                    col = chars[1];
+                }
+                if (FONTLASTROW(font) != 0)
+                    ty = (row - firstRow) * glyph_spacing_y;
+                else
+                    col += row << 8;
+            } else {
+                if (ci == glamor_font->default_char)
+                    col = glamor_font->default_col;
+                else
+                    col = chars[0];
+            }
+
+            tx = (col - firstCol) * glyph_spacing_x;
+
+            v[ 0] = x1;
+            v[ 1] = y1;
+            v[ 2] = width;
+            v[ 3] = height;
+            v[ 4] = tx;
+            v[ 5] = ty;
+
+            v += 6;
+            nglyph++;
+        }
+        chars += 1 + sixteen;
+    }
+    glamor_put_vbo_space(drawable->pScreen);
+
+    if (nglyph != 0) {
+
+        glEnable(GL_SCISSOR_TEST);
+
+        glamor_pixmap_loop(pixmap_priv, box_x, box_y) {
+            BoxPtr box = RegionRects(gc->pCompositeClip);
+            int nbox = RegionNumRects(gc->pCompositeClip);
+
+            glamor_set_destination_drawable(drawable, box_x, box_y, TRUE, FALSE, prog->matrix_uniform, &off_x, &off_y);
+
+            /* Run over the clip list, drawing the glyphs
+             * in each box
+             */
+
+            while (nbox--) {
+                glScissor(box->x1 + off_x,
+                          box->y1 + off_y,
+                          box->x2 - box->x1,
+                          box->y2 - box->y1);
+                box++;
+                glDrawArraysInstanced(GL_TRIANGLE_STRIP, 0, 4, nglyph);
+            }
+        }
+        glDisable(GL_SCISSOR_TEST);
+    }
+
+    glVertexAttribDivisor(GLAMOR_VERTEX_SOURCE, 0);
+    glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
+    glVertexAttribDivisor(GLAMOR_VERTEX_POS, 0);
+    glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
+    glDisable(GL_COLOR_LOGIC_OP);
+
+    return x;
+}
+
+static const char vs_vars_text[] =
+    "attribute vec4 primitive;\n"
+    "attribute vec2 source;\n"
+    "varying vec2 glyph_pos;\n";
+
+static const char vs_exec_text[] =
+    "       vec2 pos = primitive.zw * vec2(gl_VertexID&1, (gl_VertexID&2)>>1);\n"
+    GLAMOR_POS(gl_Position, (primitive.xy + pos))
+    "       glyph_pos = source + pos;\n";
+
+static const char fs_vars_text[] =
+    "varying vec2 glyph_pos;\n";
+
+static const char fs_exec_text[] =
+    "       ivec2 itile_texture = ivec2(glyph_pos);\n"
+    "       uint x = uint(itile_texture.x & 7);\n"
+    "       itile_texture.x >>= 3;\n"
+    "       uint texel = texelFetch(font, itile_texture, 0).x;\n"
+    "       uint bit = (texel >> x) & uint(1);\n"
+    "       if (bit == uint(0))\n"
+    "               discard;\n";
+
+static const char fs_exec_te[] =
+    "       ivec2 itile_texture = ivec2(glyph_pos);\n"
+    "       uint x = uint(itile_texture.x & 7);\n"
+    "       itile_texture.x >>= 3;\n"
+    "       uint texel = texelFetch(font, itile_texture, 0).x;\n"
+    "       uint bit = (texel >> x) & uint(1);\n"
+    "       if (bit == uint(0))\n"
+    "               gl_FragColor = bg;\n"
+    "       else\n"
+    "               gl_FragColor = fg;\n";
+
+static const glamor_facet glamor_facet_poly_text = {
+    .name = "poly_text",
+    .version = 130,
+    .vs_vars = vs_vars_text,
+    .vs_exec = vs_exec_text,
+    .fs_vars = fs_vars_text,
+    .fs_exec = fs_exec_text,
+    .source_name = "source",
+    .locations = glamor_program_location_font,
+};
+
+static Bool
+glamor_poly_text(DrawablePtr drawable, GCPtr gc,
+                 int x, int y, int count, char *chars, Bool sixteen, int *final_pos)
+{
+    ScreenPtr screen = drawable->pScreen;
+    glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
+    PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable);
+    glamor_program *prog;
+    glamor_pixmap_private *pixmap_priv;
+    glamor_font_t *glamor_font;
+    CharInfoPtr charinfo[255];  /* encoding only has 1 byte for count */
+
+    glamor_font = glamor_font_get(drawable->pScreen, gc->font);
+    if (!glamor_font)
+        goto bail;
+
+    glamor_get_glyphs(gc->font, glamor_font, count, chars, sixteen, charinfo);
+
+    pixmap_priv = glamor_get_pixmap_private(pixmap);
+    if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv))
+        goto bail;
+
+    glamor_make_current(glamor_priv);
+
+    prog = glamor_use_program_fill(pixmap, gc, &glamor_priv->poly_text_progs, &glamor_facet_poly_text);
+
+    if (!prog)
+        goto bail_ctx;
+
+    x = glamor_text(drawable, gc, glamor_font, prog,
+                    x, y, count, chars, charinfo, sixteen);
+
+    glDisable(GL_COLOR_LOGIC_OP);
+
+    glamor_priv->state = RENDER_STATE;
+    glamor_priv->render_idle_cnt = 0;
+
+    *final_pos = x;
+    return TRUE;
+
+bail_ctx:
+    glDisable(GL_COLOR_LOGIC_OP);
+bail:
+    return FALSE;
+}
+
+Bool
+glamor_poly_text8_nf(DrawablePtr drawable, GCPtr gc,
+                     int x, int y, int count, char *chars, int *final_pos)
+{
+    if (glamor_poly_text(drawable, gc, x, y, count, chars, FALSE, final_pos))
+        return TRUE;
+    if (glamor_ddx_fallback_check_pixmap(drawable) && glamor_ddx_fallback_check_gc(gc))
+        return FALSE;
+    *final_pos = miPolyText8(drawable, gc, x, y, count, chars);
+    return TRUE;
+}
+
+int
+glamor_poly_text8(DrawablePtr drawable, GCPtr gc,
+                   int x, int y, int count, char *chars)
+{
+    int final_pos;
+
+    if (glamor_poly_text(drawable, gc, x, y, count, chars, FALSE, &final_pos))
+        return final_pos;
+    return miPolyText8(drawable, gc, x, y, count, chars);
+}
+
+Bool
+glamor_poly_text16_nf(DrawablePtr drawable, GCPtr gc,
+                      int x, int y, int count, unsigned short *chars, int *final_pos)
+{
+    if (glamor_poly_text(drawable, gc, x, y, count, (char *) chars, TRUE, final_pos))
+        return TRUE;
+
+    if (glamor_ddx_fallback_check_pixmap(drawable) && glamor_ddx_fallback_check_gc(gc))
+        return FALSE;
+    *final_pos = miPolyText16(drawable, gc, x, y, count, chars);
+    return TRUE;
+}
+
+int
+glamor_poly_text16(DrawablePtr drawable, GCPtr gc,
+                    int x, int y, int count, unsigned short *chars)
+{
+    int final_pos;
+
+    if (glamor_poly_text(drawable, gc, x, y, count, (char *) chars, TRUE, &final_pos))
+        return final_pos;
+    return miPolyText16(drawable, gc, x, y, count, chars);
+}
+
+/*
+ * Draw image text, which is always solid in copy mode and has the
+ * background cleared while painting the text. For fonts which have
+ * their bitmap metrics exactly equal to the area to clear, we can use
+ * the accelerated version which paints both fg and bg at the same
+ * time. Otherwise, clear the whole area and then paint the glyphs on
+ * top
+ */
+
+static const glamor_facet glamor_facet_image_text = {
+    .name = "image_text",
+    .version = 130,
+    .vs_vars = vs_vars_text,
+    .vs_exec = vs_exec_text,
+    .fs_vars = fs_vars_text,
+    .fs_exec = fs_exec_text,
+    .source_name = "source",
+    .locations = glamor_program_location_font,
+};
+
+static Bool
+use_image_solid(PixmapPtr pixmap, GCPtr gc, glamor_program *prog, void *arg)
+{
+    return glamor_set_solid(pixmap, gc, FALSE, prog->fg_uniform);
+}
+
+static const glamor_facet glamor_facet_image_fill = {
+    .name = "solid",
+    .fs_exec = "       gl_FragColor = fg;\n",
+    .locations = glamor_program_location_fg,
+    .use = use_image_solid,
+};
+
+static Bool
+glamor_te_text_use(PixmapPtr pixmap, GCPtr gc, glamor_program *prog, void *arg)
+{
+    if (!glamor_set_solid(pixmap, gc, FALSE, prog->fg_uniform))
+        return FALSE;
+    glamor_set_color(pixmap, gc->bgPixel, prog->bg_uniform);
+    return TRUE;
+}
+
+static const glamor_facet glamor_facet_te_text = {
+    .name = "te_text",
+    .version = 130,
+    .vs_vars = vs_vars_text,
+    .vs_exec = vs_exec_text,
+    .fs_vars = fs_vars_text,
+    .fs_exec = fs_exec_te,
+    .locations = glamor_program_location_fg | glamor_program_location_bg | glamor_program_location_font,
+    .source_name = "source",
+    .use = glamor_te_text_use,
+};
+
+static Bool
+glamor_image_text(DrawablePtr drawable, GCPtr gc,
+                  int x, int y, int count, char *chars,
+                  Bool sixteen)
+{
+    ScreenPtr screen = drawable->pScreen;
+    glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
+    PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable);
+    glamor_program *prog;
+    glamor_pixmap_private *pixmap_priv;
+    glamor_font_t *glamor_font;
+    const glamor_facet *prim_facet;
+    const glamor_facet *fill_facet;
+    CharInfoPtr charinfo[255];  /* encoding only has 1 byte for count */
+
+    pixmap_priv = glamor_get_pixmap_private(pixmap);
+    if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv))
+        return FALSE;
+
+    glamor_font = glamor_font_get(drawable->pScreen, gc->font);
+    if (!glamor_font)
+        return FALSE;
+
+    glamor_get_glyphs(gc->font, glamor_font, count, chars, sixteen, charinfo);
+
+    glamor_make_current(glamor_priv);
+
+    if (TERMINALFONT(gc->font))
+        prog = &glamor_priv->te_text_prog;
+    else
+        prog = &glamor_priv->image_text_prog;
+
+    if (prog->failed)
+        goto bail;
+
+    if (!prog->prog) {
+        if (TERMINALFONT(gc->font)) {
+            prim_facet = &glamor_facet_te_text;
+            fill_facet = NULL;
+        } else {
+            prim_facet = &glamor_facet_image_text;
+            fill_facet = &glamor_facet_image_fill;
+        }
+
+        if (!glamor_build_program(screen, prog, prim_facet, fill_facet))
+            goto bail;
+    }
+
+    if (!TERMINALFONT(gc->font)) {
+        int width = 0;
+        int c;
+        RegionRec region;
+        BoxRec box;
+        int off_x, off_y;
+
+        /* Check planemask before drawing background to
+         * bail early if it's not OK
+         */
+        if (!glamor_set_planemask(pixmap, gc->planemask))
+            goto bail;
+        for (c = 0; c < count; c++)
+            if (charinfo[c])
+                width += charinfo[c]->metrics.characterWidth;
+
+        glamor_get_drawable_deltas(drawable, pixmap, &off_x, &off_y);
+
+        if (width >= 0) {
+            box.x1 = off_x + drawable->x + x;
+            box.x2 = off_x + drawable->x + x + width;
+        } else {
+            box.x1 = off_x + drawable->x + x + width;
+            box.x2 = off_x + drawable->x + x;
+        }
+        box.y1 = off_y + drawable->y + y - gc->font->info.fontAscent;
+        box.y2 = off_y + drawable->y + y + gc->font->info.fontDescent;
+        RegionInit(&region, &box, 1);
+        RegionIntersect(&region, &region, gc->pCompositeClip);
+        glamor_solid_boxes(pixmap, RegionRects(&region), RegionNumRects(&region), gc->bgPixel);
+        RegionUninit(&region);
+    }
+
+    if (!glamor_use_program(pixmap, gc, prog, NULL))
+        goto bail;
+
+    (void) glamor_text(drawable, gc, glamor_font, prog,
+                       x, y, count, chars, charinfo, sixteen);
+
+    glamor_priv->state = RENDER_STATE;
+    glamor_priv->render_idle_cnt = 0;
+
+    return TRUE;
+
+bail:
+    glDisable(GL_COLOR_LOGIC_OP);
+    return FALSE;
+}
+
+Bool
+glamor_image_text8_nf(DrawablePtr drawable, GCPtr gc,
+                   int x, int y, int count, char *chars)
+{
+    return glamor_image_text(drawable, gc, x, y, count, chars, FALSE);
+}
+
+void
+glamor_image_text8(DrawablePtr drawable, GCPtr gc,
+                   int x, int y, int count, char *chars)
+{
+    if (!glamor_image_text(drawable, gc, x, y, count, chars, FALSE))
+        miImageText8(drawable, gc, x, y, count, chars);
+}
+
+Bool
+glamor_image_text16_nf(DrawablePtr drawable, GCPtr gc,
+                       int x, int y, int count, unsigned short *chars)
+{
+    return glamor_image_text(drawable, gc, x, y, count, (char *) chars, TRUE);
+}
+
+void
+glamor_image_text16(DrawablePtr drawable, GCPtr gc,
+                    int x, int y, int count, unsigned short *chars)
+{
+    if (!glamor_image_text(drawable, gc, x, y, count, (char *) chars, TRUE))
+        miImageText16(drawable, gc, x, y, count, chars);
+}
diff --git a/glamor/glamor_tile.c b/glamor/glamor_tile.c
new file mode 100644 (file)
index 0000000..4e47976
--- /dev/null
@@ -0,0 +1,293 @@
+/*
+ * Copyright Â© 2009 Intel 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.
+ *
+ * Authors:
+ *    Eric Anholt <eric@anholt.net>
+ *    Zhigang Gong <zhigang.gong@linux.intel.com>
+ *
+ */
+
+#include "glamor_priv.h"
+
+/** @file glamor_tile.c
+ *
+ * Implements the basic fill-with-a-tile support used by multiple GC ops.
+ */
+
+void
+glamor_init_tile_shader(ScreenPtr screen)
+{
+    glamor_screen_private *glamor_priv;
+    const char *tile_vs =
+        "attribute vec4 v_position;\n"
+        "attribute vec4 v_texcoord0;\n"
+        "varying vec2 tile_texture;\n"
+        "void main()\n"
+        "{\n"
+        "       gl_Position = v_position;\n"
+        "       tile_texture = v_texcoord0.xy;\n"
+        "}\n";
+    const char *tile_fs =
+        GLAMOR_DEFAULT_PRECISION
+        "varying vec2 tile_texture;\n"
+        "uniform sampler2D sampler;\n"
+        "uniform vec2  wh;"
+        "void main()\n"
+        "{\n"
+        "   vec2 rel_tex;"
+        "   rel_tex = tile_texture * wh; \n"
+        "   rel_tex = floor(rel_tex) + (fract(rel_tex) / wh); \n"
+        "      gl_FragColor = texture2D(sampler, rel_tex);\n"
+        "}\n";
+    GLint fs_prog, vs_prog;
+    GLint sampler_uniform_location;
+
+    glamor_priv = glamor_get_screen_private(screen);
+    glamor_make_current(glamor_priv);
+    glamor_priv->tile_prog = glCreateProgram();
+    vs_prog = glamor_compile_glsl_prog(GL_VERTEX_SHADER, tile_vs);
+    fs_prog = glamor_compile_glsl_prog(GL_FRAGMENT_SHADER, tile_fs);
+    glAttachShader(glamor_priv->tile_prog, vs_prog);
+    glAttachShader(glamor_priv->tile_prog, fs_prog);
+
+    glBindAttribLocation(glamor_priv->tile_prog,
+                         GLAMOR_VERTEX_POS, "v_position");
+    glBindAttribLocation(glamor_priv->tile_prog,
+                         GLAMOR_VERTEX_SOURCE, "v_texcoord0");
+    glamor_link_glsl_prog(screen, glamor_priv->tile_prog, "tile");
+
+    sampler_uniform_location =
+        glGetUniformLocation(glamor_priv->tile_prog, "sampler");
+    glUseProgram(glamor_priv->tile_prog);
+    glUniform1i(sampler_uniform_location, 0);
+
+    glamor_priv->tile_wh =
+        glGetUniformLocation(glamor_priv->tile_prog, "wh");
+}
+
+void
+glamor_fini_tile_shader(ScreenPtr screen)
+{
+    glamor_screen_private *glamor_priv;
+
+    glamor_priv = glamor_get_screen_private(screen);
+    glamor_make_current(glamor_priv);
+    glDeleteProgram(glamor_priv->tile_prog);
+}
+
+static void
+_glamor_tile(PixmapPtr pixmap, PixmapPtr tile,
+             int x, int y, int width, int height, int tile_x, int tile_y)
+{
+    ScreenPtr screen = pixmap->drawable.pScreen;
+    glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
+    int x1 = x;
+    int x2 = x + width;
+    int y1 = y;
+    int y2 = y + height;
+    int tile_x1 = tile_x;
+    int tile_x2 = tile_x + width;
+    int tile_y1 = tile_y;
+    int tile_y2 = tile_y + height;
+    float vertices[8];
+    float source_texcoords[8];
+    GLfloat dst_xscale, dst_yscale, src_xscale, src_yscale;
+    glamor_pixmap_private *src_pixmap_priv;
+    glamor_pixmap_private *dst_pixmap_priv;
+    float wh[4];
+
+    src_pixmap_priv = glamor_get_pixmap_private(tile);
+    dst_pixmap_priv = glamor_get_pixmap_private(pixmap);
+
+    glamor_set_destination_pixmap_priv_nc(dst_pixmap_priv);
+    pixmap_priv_get_dest_scale(dst_pixmap_priv, &dst_xscale, &dst_yscale);
+    pixmap_priv_get_scale(src_pixmap_priv, &src_xscale, &src_yscale);
+    glamor_make_current(glamor_priv);
+    glUseProgram(glamor_priv->tile_prog);
+
+    glamor_pixmap_fbo_fix_wh_ratio(wh, src_pixmap_priv);
+    glUniform2fv(glamor_priv->tile_wh, 1, wh);
+    glActiveTexture(GL_TEXTURE0);
+    glBindTexture(GL_TEXTURE_2D, src_pixmap_priv->base.fbo->tex);
+    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
+    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
+    glamor_set_repeat_normalize_tcoords
+        (src_pixmap_priv, RepeatNormal,
+         src_xscale, src_yscale,
+         tile_x1, tile_y1,
+         tile_x2, tile_y2, glamor_priv->yInverted, source_texcoords);
+
+    glVertexAttribPointer(GLAMOR_VERTEX_SOURCE, 2, GL_FLOAT, GL_FALSE,
+                          2 * sizeof(float), source_texcoords);
+    glEnableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
+
+    glamor_set_normalize_vcoords(dst_pixmap_priv, dst_xscale, dst_yscale,
+                                 x1, y1,
+                                 x2, y2, glamor_priv->yInverted, vertices);
+
+    glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT, GL_FALSE,
+                          2 * sizeof(float), vertices);
+    glEnableVertexAttribArray(GLAMOR_VERTEX_POS);
+    glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
+
+    glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
+    glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
+
+    glamor_priv->state = RENDER_STATE;
+    glamor_priv->render_idle_cnt = 0;
+}
+
+Bool
+glamor_tile(PixmapPtr pixmap, PixmapPtr tile,
+            int x, int y, int width, int height,
+            unsigned char alu, unsigned long planemask, int tile_x, int tile_y)
+{
+    ScreenPtr screen = pixmap->drawable.pScreen;
+    glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
+    glamor_pixmap_private *dst_pixmap_priv;
+    glamor_pixmap_private *src_pixmap_priv;
+
+    dst_pixmap_priv = glamor_get_pixmap_private(pixmap);
+    src_pixmap_priv = glamor_get_pixmap_private(tile);
+
+    if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(dst_pixmap_priv))
+        return FALSE;
+
+    if (glamor_priv->tile_prog == 0) {
+        glamor_fallback("Tiling unsupported\n");
+        goto fail;
+    }
+
+    if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(src_pixmap_priv)) {
+        /* XXX dynamic uploading candidate. */
+        glamor_fallback("Non-texture tile pixmap\n");
+        goto fail;
+    }
+
+    if (!glamor_set_planemask(pixmap, planemask)) {
+        glamor_fallback("unsupported planemask %lx\n", planemask);
+        goto fail;
+    }
+
+    glamor_make_current(glamor_priv);
+    if (!glamor_set_alu(screen, alu)) {
+        glamor_fallback("unsupported alu %x\n", alu);
+        goto fail;
+    }
+
+    if (dst_pixmap_priv->type == GLAMOR_TEXTURE_LARGE
+        || src_pixmap_priv->type == GLAMOR_TEXTURE_LARGE) {
+        glamor_pixmap_clipped_regions *clipped_dst_regions;
+        int n_dst_region, i, j, k;
+        BoxRec box;
+        RegionRec region;
+
+        box.x1 = x;
+        box.y1 = y;
+        box.x2 = x + width;
+        box.y2 = y + height;
+        RegionInitBoxes(&region, &box, 1);
+        clipped_dst_regions = glamor_compute_clipped_regions(dst_pixmap_priv,
+                                                             &region,
+                                                             &n_dst_region, 0,
+                                                             0, 0);
+        for (i = 0; i < n_dst_region; i++) {
+            int n_src_region;
+            glamor_pixmap_clipped_regions *clipped_src_regions;
+            BoxPtr current_boxes;
+            int n_current_boxes;
+
+            SET_PIXMAP_FBO_CURRENT(dst_pixmap_priv,
+                                   clipped_dst_regions[i].block_idx);
+
+            if (src_pixmap_priv->type == GLAMOR_TEXTURE_LARGE) {
+                RegionTranslate(clipped_dst_regions[i].region,
+                                tile_x - x, tile_y - y);
+                DEBUGF("tiled a large src pixmap. %dx%d \n",
+                       tile->drawable.width, tile->drawable.height);
+                clipped_src_regions =
+                    glamor_compute_clipped_regions(src_pixmap_priv,
+                                                   clipped_dst_regions[i].
+                                                   region, &n_src_region, 1, 0,
+                                                   0);
+                DEBUGF("got %d src regions %d \n", n_src_region);
+                for (j = 0; j < n_src_region; j++) {
+
+                    SET_PIXMAP_FBO_CURRENT(src_pixmap_priv,
+                                           clipped_src_regions[j].block_idx);
+
+                    RegionTranslate(clipped_src_regions[j].region,
+                                    x - tile_x, y - tile_y);
+                    current_boxes = RegionRects(clipped_src_regions[j].region);
+                    n_current_boxes =
+                        RegionNumRects(clipped_src_regions[j].region);
+                    for (k = 0; k < n_current_boxes; k++) {
+                        DEBUGF
+                            ("Tile on %d %d %d %d dst block id %d tile block id %d tilex %d tiley %d\n",
+                             current_boxes[k].x1, current_boxes[k].y1,
+                             current_boxes[k].x2 - current_boxes[k].x1,
+                             current_boxes[k].y2 - current_boxes[k].y1,
+                             clipped_dst_regions[i].block_idx,
+                             clipped_src_regions[j].block_idx,
+                             (tile_x + (current_boxes[k].x1 - x)),
+                             tile_y + (current_boxes[k].y1 - y));
+
+                        _glamor_tile(pixmap, tile,
+                                     current_boxes[k].x1, current_boxes[k].y1,
+                                     current_boxes[k].x2 - current_boxes[k].x1,
+                                     current_boxes[k].y2 - current_boxes[k].y1,
+                                     (tile_x + (current_boxes[k].x1 - x)),
+                                     (tile_y + (current_boxes[k].y1 - y)));
+                    }
+
+                    RegionDestroy(clipped_src_regions[j].region);
+                }
+                free(clipped_src_regions);
+            }
+            else {
+                current_boxes = RegionRects(clipped_dst_regions[i].region);
+                n_current_boxes = RegionNumRects(clipped_dst_regions[i].region);
+                for (k = 0; k < n_current_boxes; k++) {
+                    _glamor_tile(pixmap, tile,
+                                 current_boxes[k].x1, current_boxes[k].y1,
+                                 current_boxes[k].x2 - current_boxes[k].x1,
+                                 current_boxes[k].y2 - current_boxes[k].y1,
+                                 (tile_x + (current_boxes[k].x1 - x)),
+                                 (tile_y + (current_boxes[k].y1 - y)));
+                }
+            }
+            RegionDestroy(clipped_dst_regions[i].region);
+        }
+        free(clipped_dst_regions);
+        RegionUninit(&region);
+    }
+    else
+        _glamor_tile(pixmap, tile, x, y, width, height, tile_x, tile_y);
+
+    glamor_set_alu(screen, GXcopy);
+    return TRUE;
+ fail:
+    return FALSE;
+
+}
diff --git a/glamor/glamor_transfer.c b/glamor/glamor_transfer.c
new file mode 100644 (file)
index 0000000..ad875c9
--- /dev/null
@@ -0,0 +1,262 @@
+/*
+ * Copyright Â© 2014 Keith Packard
+ *
+ * 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 the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  The copyright holders make no representations
+ * about the suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS 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.
+ */
+
+#include "glamor_priv.h"
+#include "glamor_transfer.h"
+
+/* XXX a kludge for now */
+void
+glamor_format_for_pixmap(PixmapPtr pixmap, GLenum *format, GLenum *type)
+{
+    switch (pixmap->drawable.depth) {
+    case 24:
+    case 32:
+        *format = GL_BGRA;
+        *type = GL_UNSIGNED_INT_8_8_8_8_REV;
+        break;
+    case 16:
+        *format = GL_RGB;
+        *type = GL_UNSIGNED_SHORT_5_6_5;
+        break;
+    case 15:
+        *format = GL_BGRA;
+        *type = GL_UNSIGNED_SHORT_1_5_5_5_REV;
+        break;
+    case 8:
+        *format = GL_ALPHA;
+        *type = GL_UNSIGNED_BYTE;
+        break;
+    default:
+        FatalError("Invalid pixmap depth %d\n", pixmap->drawable.depth);
+        break;
+    }
+}
+
+/*
+ * Write a region of bits into a pixmap
+ */
+void
+glamor_upload_boxes(PixmapPtr pixmap, BoxPtr in_boxes, int in_nbox,
+                    int dx_src, int dy_src,
+                    int dx_dst, int dy_dst,
+                    uint8_t *bits, uint32_t byte_stride)
+{
+    ScreenPtr                   screen = pixmap->drawable.pScreen;
+    glamor_screen_private       *glamor_priv = glamor_get_screen_private(screen);
+    glamor_pixmap_private       *priv = glamor_get_pixmap_private(pixmap);
+    int                         box_x, box_y;
+    int                         bytes_per_pixel = pixmap->drawable.bitsPerPixel >> 3;
+    GLenum                      type;
+    GLenum                      format;
+
+    glamor_format_for_pixmap(pixmap, &format, &type);
+
+    glamor_make_current(glamor_priv);
+
+    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+
+    glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
+    glPixelStorei(GL_UNPACK_ROW_LENGTH, byte_stride / bytes_per_pixel);
+
+    glamor_pixmap_loop(priv, box_x, box_y) {
+        BoxPtr                  box = glamor_pixmap_box_at(priv, box_x, box_y);
+        glamor_pixmap_fbo       *fbo = glamor_pixmap_fbo_at(priv, box_x, box_y);
+        BoxPtr                  boxes = in_boxes;
+        int                     nbox = in_nbox;
+
+        glActiveTexture(GL_TEXTURE0);
+        glBindTexture(GL_TEXTURE_2D, fbo->tex);
+
+        while (nbox--) {
+
+            /* compute drawable coordinates */
+            int x1 = boxes->x1 + dx_dst;
+            int x2 = boxes->x2 + dx_dst;
+            int y1 = boxes->y1 + dy_dst;
+            int y2 = boxes->y2 + dy_dst;
+
+            boxes++;
+
+            if (x1 < box->x1)
+                x1 = box->x1;
+            if (box->x2 < x2)
+                x2 = box->x2;
+
+            if (x2 <= x1)
+                continue;
+
+            if (y1 < box->y1)
+                y1 = box->y1;
+            if (box->y2 < y2)
+                y2 = box->y2;
+
+            if (y2 <= y1)
+                continue;
+
+            glPixelStorei(GL_UNPACK_SKIP_ROWS, y1 - dy_dst + dy_src);
+            glPixelStorei(GL_UNPACK_SKIP_PIXELS, x1 - dx_dst + dx_src);
+
+            glTexSubImage2D(GL_TEXTURE_2D, 0,
+                            x1 - box->x1, y1 - box->y1,
+                            x2 - x1, y2 - y1,
+                            format, type,
+                            bits);
+        }
+    }
+
+    glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
+    glPixelStorei(GL_UNPACK_SKIP_ROWS, 0);
+    glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0);
+}
+
+/*
+ * Upload a region of data
+ */
+
+void
+glamor_upload_region(PixmapPtr pixmap, RegionPtr region,
+                     int region_x, int region_y,
+                     uint8_t *bits, uint32_t byte_stride)
+{
+    glamor_upload_boxes(pixmap, RegionRects(region), RegionNumRects(region),
+                        -region_x, -region_y,
+                        0, 0,
+                        bits, byte_stride);
+}
+
+/*
+ * Take the data in the pixmap and stuff it back into the FBO
+ */
+void
+glamor_upload_pixmap(PixmapPtr pixmap)
+{
+    BoxRec box;
+
+    box.x1 = 0;
+    box.x2 = pixmap->drawable.width;
+    box.y1 = 0;
+    box.y2 = pixmap->drawable.height;
+    glamor_upload_boxes(pixmap, &box, 1, 0, 0, 0, 0,
+                        pixmap->devPrivate.ptr, pixmap->devKind);
+}
+
+/*
+ * Read stuff from the pixmap FBOs and write to memory
+ */
+void
+glamor_download_boxes(PixmapPtr pixmap, BoxPtr in_boxes, int in_nbox,
+                      int dx_src, int dy_src,
+                      int dx_dst, int dy_dst,
+                      uint8_t *bits, uint32_t byte_stride)
+{
+    ScreenPtr screen = pixmap->drawable.pScreen;
+    glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
+    glamor_pixmap_private *priv = glamor_get_pixmap_private(pixmap);
+    int box_x, box_y;
+    int bytes_per_pixel = pixmap->drawable.bitsPerPixel >> 3;
+    GLenum type;
+    GLenum format;
+
+    glamor_format_for_pixmap(pixmap, &format, &type);
+
+    glamor_make_current(glamor_priv);
+
+    glPixelStorei(GL_PACK_ALIGNMENT, 4);
+    glPixelStorei(GL_PACK_ROW_LENGTH, byte_stride / bytes_per_pixel);
+
+    glamor_pixmap_loop(priv, box_x, box_y) {
+        BoxPtr                  box = glamor_pixmap_box_at(priv, box_x, box_y);
+        glamor_pixmap_fbo       *fbo = glamor_pixmap_fbo_at(priv, box_x, box_y);
+        BoxPtr                  boxes = in_boxes;
+        int                     nbox = in_nbox;
+
+        glBindFramebuffer(GL_READ_FRAMEBUFFER, fbo->fb);
+
+        while (nbox--) {
+
+            /* compute drawable coordinates */
+            int                     x1 = boxes->x1 + dx_src;
+            int                     x2 = boxes->x2 + dx_src;
+            int                     y1 = boxes->y1 + dy_src;
+            int                     y2 = boxes->y2 + dy_src;
+
+            boxes++;
+
+            if (x1 < box->x1)
+                x1 = box->x1;
+            if (box->x2 < x2)
+                x2 = box->x2;
+
+            if (y1 < box->y1)
+                y1 = box->y1;
+            if (box->y2 < y2)
+                y2 = box->y2;
+
+            if (x2 <= x1)
+                continue;
+            if (y2 <= y1)
+                continue;
+
+            glPixelStorei(GL_PACK_SKIP_PIXELS, x1 - dx_src + dx_dst);
+            glPixelStorei(GL_PACK_SKIP_ROWS, y1 - dy_src + dy_dst);
+            glReadPixels(x1 - box->x1, y1 - box->y1, x2 - x1, y2 - y1, format, type, bits);
+        }
+    }
+    glPixelStorei(GL_PACK_ROW_LENGTH, 0);
+    glPixelStorei(GL_PACK_SKIP_ROWS, 0);
+    glPixelStorei(GL_PACK_SKIP_PIXELS, 0);
+}
+
+/*
+ * Read data from the pixmap FBO
+ */
+void
+glamor_download_rect(PixmapPtr pixmap, int x, int y, int w, int h, uint8_t *bits)
+{
+    BoxRec      box;
+
+    box.x1 = x;
+    box.x2 = x + w;
+    box.y1 = y;
+    box.y2 = y + h;
+
+    glamor_download_boxes(pixmap, &box, 1, 0, 0, -x, -y,
+                          bits, PixmapBytePad(w, pixmap->drawable.depth));
+}
+
+/*
+ * Pull the data from the FBO down to the pixmap
+ */
+void
+glamor_download_pixmap(PixmapPtr pixmap)
+{
+    BoxRec      box;
+
+    box.x1 = 0;
+    box.x2 = pixmap->drawable.width;
+    box.y1 = 0;
+    box.y2 = pixmap->drawable.height;
+
+    glamor_download_boxes(pixmap, &box, 1, 0, 0, 0, 0,
+                          pixmap->devPrivate.ptr, pixmap->devKind);
+}
diff --git a/glamor/glamor_transfer.h b/glamor/glamor_transfer.h
new file mode 100644 (file)
index 0000000..de8186a
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * Copyright Â© 2014 Keith Packard
+ *
+ * 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 the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  The copyright holders make no representations
+ * about the suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS 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.
+ */
+
+#ifndef _GLAMOR_TRANSFER_H_
+#define _GLAMOR_TRANSFER_H_
+
+void
+glamor_format_for_pixmap(PixmapPtr pixmap, GLenum *format, GLenum *type);
+
+void
+glamor_upload_boxes(PixmapPtr pixmap, BoxPtr in_boxes, int in_nbox,
+                    int dx_src, int dy_src,
+                    int dx_dst, int dy_dst,
+                    uint8_t *bits, uint32_t byte_stride);
+
+void
+glamor_upload_region(PixmapPtr pixmap, RegionPtr region,
+                     int region_x, int region_y,
+                     uint8_t *bits, uint32_t byte_stride);
+
+void
+glamor_upload_pixmap(PixmapPtr pixmap);
+
+void
+glamor_download_boxes(PixmapPtr pixmap, BoxPtr in_boxes, int in_nbox,
+                      int dx_src, int dy_src,
+                      int dx_dst, int dy_dst,
+                      uint8_t *bits, uint32_t byte_stride);
+
+void
+glamor_download_rect(PixmapPtr pixmap, int x, int y, int w, int h, uint8_t *bits);
+
+void
+glamor_download_pixmap(PixmapPtr pixmap);
+
+#endif /* _GLAMOR_TRANSFER_H_ */
diff --git a/glamor/glamor_transform.c b/glamor/glamor_transform.c
new file mode 100644 (file)
index 0000000..d6ba564
--- /dev/null
@@ -0,0 +1,215 @@
+/*
+ * Copyright Â© 2014 Keith Packard
+ *
+ * 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 the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  The copyright holders make no representations
+ * about the suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS 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.
+ */
+
+#include "glamor_priv.h"
+#include "glamor_transform.h"
+
+
+/*
+ * Set up rendering to target the specified drawable, computing an
+ * appropriate transform for the vertex shader to convert
+ * drawable-relative coordinates into pixmap-relative coordinates. If
+ * requested, the offset from pixmap origin coordinates back to window
+ * system coordinates will be returned in *p_off_x, *p_off_y so that
+ * clipping computations can be adjusted as appropriate
+ */
+
+void
+glamor_set_destination_drawable(DrawablePtr     drawable,
+                                int             box_x,
+                                int             box_y,
+                                Bool            do_drawable_translate,
+                                Bool            center_offset,
+                                GLint           matrix_uniform_location,
+                                int             *p_off_x,
+                                int             *p_off_y)
+{
+    PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable);
+    glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap);
+    int off_x, off_y;
+    BoxPtr box = glamor_pixmap_box_at(pixmap_priv, box_x, box_y);
+    int w = box->x2 - box->x1;
+    int h = box->y2 - box->y1;
+    float scale_x = 2.0f / (float) w;
+    float scale_y = 2.0f / (float) h;
+    float center_adjust = 0.0f;
+
+    glamor_get_drawable_deltas(drawable, pixmap, &off_x, &off_y);
+
+    off_x -= box->x1;
+    off_y -= box->y1;
+
+    if (p_off_x) {
+        *p_off_x = off_x;
+        *p_off_y = off_y;
+    }
+
+    /* A tricky computation to find the right value for the two linear functions
+     * that transform rendering coordinates to pixmap coordinates
+     *
+     *  pixmap_x = render_x + drawable->x + off_x
+     *  pixmap_y = render_y + drawable->y + off_y
+     *
+     *  gl_x = pixmap_x * 2 / width - 1
+     *  gl_y = pixmap_y * 2 / height - 1
+     *
+     *  gl_x = (render_x + drawable->x + off_x) * 2 / width - 1
+     *
+     *  gl_x = (render_x) * 2 / width + (drawable->x + off_x) * 2 / width - 1
+     *
+     * I'll think about yInverted later, when I have some way to test
+     */
+
+    if (do_drawable_translate) {
+        off_x += drawable->x;
+        off_y += drawable->y;
+    }
+
+    /*
+     * To get GL_POINTS drawn in the right spot, we need to adjust the
+     * coordinates by 1/2 a pixel.
+     */
+    if (center_offset)
+        center_adjust = 0.5f;
+
+    glUniform4f(matrix_uniform_location,
+                scale_x, (off_x + center_adjust) * scale_x - 1.0f,
+                scale_y, (off_y + center_adjust) * scale_y - 1.0f);
+
+    glamor_set_destination_pixmap_fbo(glamor_pixmap_fbo_at(pixmap_priv, box_x, box_y),
+                                      0, 0, w, h);
+}
+
+/*
+ * Set up for solid rendering to the specified pixmap using alu, fg and planemask
+ * from the specified GC. Load the target color into the specified uniform
+ */
+
+void
+glamor_set_color(PixmapPtr      pixmap,
+                 CARD32         pixel,
+                 GLint          uniform)
+{
+    float       color[4];
+
+    glamor_get_rgba_from_pixel(pixel,
+                               &color[0], &color[1], &color[2], &color[3],
+                               format_for_pixmap(pixmap));
+
+    glUniform4fv(uniform, 1, color);
+}
+
+Bool
+glamor_set_solid(PixmapPtr      pixmap,
+                 GCPtr          gc,
+                 Bool           use_alu,
+                 GLint          uniform)
+{
+    CARD32      pixel;
+    int         alu = use_alu ? gc->alu : GXcopy;
+
+    if (!glamor_set_planemask(pixmap, gc->planemask))
+        return FALSE;
+
+    pixel = gc->fgPixel;
+
+    if (!glamor_set_alu(pixmap->drawable.pScreen, alu)) {
+        switch (gc->alu) {
+        case GXclear:
+            pixel = 0;
+            break;
+        case GXcopyInverted:
+            pixel = ~pixel;
+            break;
+        case GXset:
+            pixel = ~0 & gc->planemask;
+            break;
+        default:
+            return FALSE;
+        }
+    }
+    glamor_set_color(pixmap, gc->fgPixel, uniform);
+
+    return TRUE;
+}
+
+Bool
+glamor_set_texture(PixmapPtr    pixmap,
+                   PixmapPtr    texture,
+                   int          off_x,
+                   int          off_y,
+                   GLint        offset_uniform,
+                   GLint        size_uniform)
+{
+    glamor_pixmap_private *texture_priv;
+
+    texture_priv = glamor_get_pixmap_private(texture);
+
+    if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(texture_priv))
+        return FALSE;
+
+    if (texture_priv->type == GLAMOR_TEXTURE_LARGE)
+        return FALSE;
+
+    glActiveTexture(GL_TEXTURE0);
+    glBindTexture(GL_TEXTURE_2D, texture_priv->base.fbo->tex);
+
+    glUniform2f(offset_uniform, off_x, off_y);
+    glUniform2f(size_uniform, texture->drawable.width, texture->drawable.height);
+    return TRUE;
+}
+
+Bool
+glamor_set_tiled(PixmapPtr      pixmap,
+                 GCPtr          gc,
+                 GLint          offset_uniform,
+                 GLint          size_uniform)
+{
+    if (!glamor_set_alu(pixmap->drawable.pScreen, gc->alu))
+        return FALSE;
+
+    if (!glamor_set_planemask(pixmap, gc->planemask))
+        return FALSE;
+
+    return glamor_set_texture(pixmap,
+                              gc->tile.pixmap,
+                              -gc->patOrg.x,
+                              -gc->patOrg.y,
+                              offset_uniform,
+                              size_uniform);
+}
+
+Bool
+glamor_set_stippled(PixmapPtr      pixmap,
+                    GCPtr          gc,
+                    GLint          fg_uniform,
+                    GLint          offset_uniform,
+                    GLint          size_uniform)
+{
+    if (!glamor_set_solid(pixmap, gc, TRUE, fg_uniform))
+        return FALSE;
+
+    if (!glamor_set_texture(pixmap, gc->stipple, gc->patOrg.x, gc->patOrg.y, offset_uniform, size_uniform))
+        return FALSE;
+
+    return TRUE;
+}
diff --git a/glamor/glamor_transform.h b/glamor/glamor_transform.h
new file mode 100644 (file)
index 0000000..36b789a
--- /dev/null
@@ -0,0 +1,87 @@
+/*
+ * Copyright Â© 2014 Keith Packard
+ *
+ * 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 the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  The copyright holders make no representations
+ * about the suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS 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.
+ */
+
+#ifndef _GLAMOR_TRANSFORM_H_
+#define _GLAMOR_TRANSFORM_H_
+
+void
+glamor_set_destination_drawable(DrawablePtr     drawable,
+                                int             box_x,
+                                int             box_y,
+                                Bool            do_drawable_translate,
+                                Bool            center_offset,
+                                GLint           matrix_uniform_location,
+                                int             *p_off_x,
+                                int             *p_off_y);
+
+void
+glamor_set_color(PixmapPtr      pixmap,
+                 CARD32         pixel,
+                 GLint          uniform);
+
+Bool
+glamor_set_texture(PixmapPtr    pixmap,
+                   PixmapPtr    texture,
+                   int          off_x,
+                   int          off_y,
+                   GLint        offset_uniform,
+                   GLint        size_uniform);
+
+Bool
+glamor_set_solid(PixmapPtr      pixmap,
+                 GCPtr          gc,
+                 Bool           use_alu,
+                 GLint          uniform);
+
+Bool
+glamor_set_tiled(PixmapPtr      pixmap,
+                 GCPtr          gc,
+                 GLint          offset_uniform,
+                 GLint          size_uniform);
+
+Bool
+glamor_set_stippled(PixmapPtr      pixmap,
+                    GCPtr          gc,
+                    GLint          fg_uniform,
+                    GLint          offset_uniform,
+                    GLint          size_uniform);
+
+/*
+ * Vertex shader bits that transform X coordinates to pixmap
+ * coordinates using the matrix computed above
+ */
+
+#define GLAMOR_DECLARE_MATRIX   "uniform vec4 v_matrix;\n"
+#define GLAMOR_X_POS(x) #x " *v_matrix.x + v_matrix.y"
+#define GLAMOR_Y_POS(y) #y " *v_matrix.z + v_matrix.w"
+#if 0
+#define GLAMOR_POS(dst,src) \
+    "       " #dst ".x = " #src ".x * v_matrix.x + v_matrix.y;\n" \
+    "       " #dst ".y = " #src ".y * v_matrix.z + v_matrix.w;\n" \
+    "       " #dst ".z = 0.0;\n" \
+    "       " #dst ".w = 1.0;\n"
+#endif
+#define GLAMOR_POS(dst,src) \
+    "       " #dst ".xy = " #src ".xy * v_matrix.xz + v_matrix.yw;\n" \
+    "       " #dst ".zw = vec2(0.0,1.0);\n"
+
+#endif /* _GLAMOR_TRANSFORM_H_ */
diff --git a/glamor/glamor_trapezoid.c b/glamor/glamor_trapezoid.c
new file mode 100644 (file)
index 0000000..4aba469
--- /dev/null
@@ -0,0 +1,1818 @@
+/*
+ * Copyright Â© 2009 Intel 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.
+ *
+ * Authors:
+ *    Junyan He <junyan.he@linux.intel.com>
+ *
+ */
+
+/** @file glamor_trapezoid.c
+ *
+ * Trapezoid acceleration implementation
+ */
+
+#include "glamor_priv.h"
+
+#ifdef RENDER
+#include "mipict.h"
+#include "fbpict.h"
+
+static xFixed
+_glamor_linefixedX(xLineFixed *l, xFixed y, Bool ceil)
+{
+    xFixed dx = l->p2.x - l->p1.x;
+    xFixed_32_32 ex = (xFixed_32_32) (y - l->p1.y) * dx;
+    xFixed dy = l->p2.y - l->p1.y;
+
+    if (ceil)
+        ex += (dy - 1);
+    return l->p1.x + (xFixed) (ex / dy);
+}
+
+static xFixed
+_glamor_linefixedY(xLineFixed *l, xFixed x, Bool ceil)
+{
+    xFixed dy = l->p2.y - l->p1.y;
+    xFixed_32_32 ey = (xFixed_32_32) (x - l->p1.x) * dy;
+    xFixed dx = l->p2.x - l->p1.x;
+
+    if (ceil)
+        ey += (dx - 1);
+    return l->p1.y + (xFixed) (ey / dx);
+}
+
+#ifdef GLAMOR_TRAPEZOID_SHADER
+
+#define GLAMOR_VERTEX_TOP_BOTTOM  (GLAMOR_VERTEX_SOURCE + 1)
+#define GLAMOR_VERTEX_LEFT_PARAM  (GLAMOR_VERTEX_SOURCE + 2)
+#define GLAMOR_VERTEX_RIGHT_PARAM (GLAMOR_VERTEX_SOURCE + 3)
+
+#define DEBUG_CLIP_VTX 0
+
+#define POINT_INSIDE_CLIP_RECT(point, rect)    \
+    (point[0] >= IntToxFixed(rect->x1)         \
+     && point[0] <= IntToxFixed(rect->x2)      \
+     && point[1] >= IntToxFixed(rect->y1)      \
+     && point[1] <= IntToxFixed(rect->y2))
+
+static xFixed
+_glamor_lines_crossfixedY(xLineFixed *l, xLineFixed *r)
+{
+    xFixed dx1 = l->p2.x - l->p1.x;
+    xFixed dx2 = r->p2.x - r->p1.x;
+    xFixed dy1 = l->p2.y - l->p1.y;
+    xFixed dy2 = r->p2.y - r->p1.y;
+    xFixed_32_32 tmp = (xFixed_32_32) dy2 * dy1;
+    xFixed_32_32 dividend1 = (tmp >> 32) * (l->p1.x - r->p1.x);
+    xFixed_32_32 dividend2;
+    xFixed_32_32 dividend3;
+    xFixed_32_32 divisor;
+
+    tmp = (xFixed_32_32) dx1 *dy2;
+
+    dividend2 = (tmp >> 32) * l->p1.y;
+    tmp = (xFixed_32_32) dy1 *dx2;
+
+    dividend3 = (tmp >> 32) * r->p1.y;
+    divisor = ((xFixed_32_32) dx1 * (xFixed_32_32) dy2
+               - (xFixed_32_32) dy1 * (xFixed_32_32) dx2) >> 32;
+
+    if (divisor)
+        return (xFixed) ((dividend2 - dividend1 - dividend3) / divisor);
+
+    return 0xFFFFFFFF;
+}
+
+static Bool
+point_inside_trapezoid(int point[2], xTrapezoid *trap, xFixed cut_y)
+{
+    int ret = TRUE;
+    int tmp;
+
+    if (point[1] > trap->bottom) {
+        ret = FALSE;
+        if (DEBUG_CLIP_VTX) {
+            ErrorF("Out of Trap bottom, point[1] = %d(0x%x)), "
+                   "bottom = %d(0x%x)\n",
+                   (unsigned int) xFixedToInt(point[1]), point[1],
+                   (unsigned int) xFixedToInt(trap->bottom),
+                   (unsigned int) trap->bottom);
+        }
+
+        return ret;
+    }
+
+    if (point[1] < trap->top) {
+        ret = FALSE;
+        if (DEBUG_CLIP_VTX) {
+            ErrorF("Out of Trap top, point[1] = %d(0x%x)), "
+                   "top = %d(0x%x)\n",
+                   (unsigned int) xFixedToInt(point[1]), point[1],
+                   (unsigned int) xFixedToInt(trap->top),
+                   (unsigned int) trap->top);
+        }
+
+        return ret;
+    }
+
+    tmp = _glamor_linefixedX(&trap->left, point[1], FALSE);
+    if (point[0] < tmp) {
+        ret = FALSE;
+
+        if (abs(cut_y - trap->top) < pixman_fixed_1_minus_e &&
+            abs(point[1] - trap->top) < pixman_fixed_1_minus_e &&
+            tmp - point[0] < pixman_fixed_1_minus_e) {
+            ret = TRUE;
+        }
+        else if (abs(cut_y - trap->bottom) < pixman_fixed_1_minus_e &&
+                 point[1] - trap->bottom < pixman_fixed_1_minus_e &&
+                 tmp - point[0] < pixman_fixed_1_minus_e) {
+            ret = TRUE;
+        }
+
+        if (DEBUG_CLIP_VTX && !ret) {
+            ErrorF("Out of Trap left, point[0] = %d(0x%x)), "
+                   "left = %d(0x%x)\n",
+                   (unsigned int) xFixedToInt(point[0]), point[0],
+                   (unsigned int) xFixedToInt(tmp), (unsigned int) tmp);
+        }
+
+        if (!ret)
+            return ret;
+    }
+
+    tmp = _glamor_linefixedX(&trap->right, point[1], TRUE);
+    if (point[0] > tmp) {
+        ret = FALSE;
+
+        if (abs(cut_y - trap->top) < pixman_fixed_1_minus_e &&
+            abs(point[1] - trap->top) < pixman_fixed_1_minus_e &&
+            point[0] - tmp < pixman_fixed_1_minus_e) {
+            ret = TRUE;
+        }
+        else if (abs(cut_y - trap->bottom) < pixman_fixed_1_minus_e &&
+                 abs(point[1] - trap->bottom) < pixman_fixed_1_minus_e &&
+                 point[0] - tmp < pixman_fixed_1_minus_e) {
+            ret = TRUE;
+        }
+
+        if (DEBUG_CLIP_VTX && !ret) {
+            ErrorF("Out of Trap right, point[0] = %d(0x%x)), "
+                   "right = %d(0x%x)\n",
+                   (unsigned int) xFixedToInt(point[0]), point[0],
+                   (unsigned int) xFixedToInt(tmp), (unsigned int) tmp);
+        }
+
+        if (!ret)
+            return ret;
+    }
+
+    return ret;
+}
+
+static void
+glamor_emit_composite_vert(ScreenPtr screen,
+                           float *vb,
+                           const float *src_coords,
+                           const float *mask_coords,
+                           const float *dst_coords, int i)
+{
+    glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
+    int j = 0;
+
+    vb += i * glamor_priv->vb_stride / sizeof(float);
+
+    vb[j++] = dst_coords[i * 2 + 0];
+    vb[j++] = dst_coords[i * 2 + 1];
+    if (glamor_priv->has_source_coords) {
+        vb[j++] = src_coords[i * 2 + 0];
+        vb[j++] = src_coords[i * 2 + 1];
+    }
+    if (glamor_priv->has_mask_coords) {
+        vb[j++] = mask_coords[i * 2 + 0];
+        vb[j++] = mask_coords[i * 2 + 1];
+    }
+
+    glamor_priv->render_nr_verts++;
+}
+
+static void
+glamor_emit_composite_triangle(ScreenPtr screen,
+                               float *vb,
+                               const float *src_coords,
+                               const float *mask_coords,
+                               const float *dst_coords)
+{
+    glamor_emit_composite_vert(screen, vb,
+                               src_coords, mask_coords, dst_coords, 0);
+    glamor_emit_composite_vert(screen, vb,
+                               src_coords, mask_coords, dst_coords, 1);
+    glamor_emit_composite_vert(screen, vb,
+                               src_coords, mask_coords, dst_coords, 2);
+}
+
+static void
+glamor_flush_composite_triangles(ScreenPtr screen)
+{
+    glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
+
+    glamor_make_current(glamor_priv);
+    glamor_put_vbo_space(screen);
+
+    if (!glamor_priv->render_nr_verts)
+        return;
+
+    glDrawArrays(GL_TRIANGLES, 0, glamor_priv->render_nr_verts);
+}
+
+static Bool
+_glamor_clip_trapezoid_vertex(xTrapezoid *trap, BoxPtr pbox,
+                              int vertex[6], int *num)
+{
+    xFixed edge_cross_y = 0xFFFFFFFF;
+    int tl[2];
+    int bl[2];
+    int tr[2];
+    int br[2];
+    int left_cut_top[2];
+    int left_cut_left[2];
+    int left_cut_right[2];
+    int left_cut_bottom[2];
+    int right_cut_top[2];
+    int right_cut_left[2];
+    int right_cut_right[2];
+    int right_cut_bottom[2];
+    int tmp[2];
+    int tmp_vtx[20 * 2];
+    float tmp_vtx_slope[20];
+    BoxRec trap_bound;
+    int i = 0;
+    int vertex_num = 0;
+
+    if (DEBUG_CLIP_VTX) {
+        ErrorF
+            ("The parameter of xTrapezoid is:\ntop: %d  0x%x\tbottom: %d  0x%x\n"
+             "left:  p1 (%d   0x%x, %d   0x%x)\tp2 (%d   0x%x, %d   0x%x)\n"
+             "right: p1 (%d   0x%x, %d   0x%x)\tp2 (%d   0x%x, %d   0x%x)\n",
+             xFixedToInt(trap->top), (unsigned int) trap->top,
+             xFixedToInt(trap->bottom), (unsigned int) trap->bottom,
+             xFixedToInt(trap->left.p1.x), (unsigned int) trap->left.p1.x,
+             xFixedToInt(trap->left.p1.y), (unsigned int) trap->left.p1.y,
+             xFixedToInt(trap->left.p2.x), (unsigned int) trap->left.p2.x,
+             xFixedToInt(trap->left.p2.y), (unsigned int) trap->left.p2.y,
+             xFixedToInt(trap->right.p1.x), (unsigned int) trap->right.p1.x,
+             xFixedToInt(trap->right.p1.y), (unsigned int) trap->right.p1.y,
+             xFixedToInt(trap->right.p2.x), (unsigned int) trap->right.p2.x,
+             xFixedToInt(trap->right.p2.y), (unsigned int) trap->right.p2.y);
+    }
+
+    miTrapezoidBounds(1, trap, &trap_bound);
+    if (DEBUG_CLIP_VTX)
+        ErrorF("The bounds for this traps is: bounds.x1 = %d, bounds.x2 = %d, "
+               "bounds.y1 = %d, bounds.y2 = %d\n", trap_bound.x1, trap_bound.x2,
+               trap_bound.y1, trap_bound.y2);
+
+    if (trap_bound.x1 > pbox->x2 || trap_bound.x2 < pbox->x1)
+        return FALSE;
+    if (trap_bound.y1 > pbox->y2 || trap_bound.y2 < pbox->y1)
+        return FALSE;
+
+#define IS_TRAP_EDGE_VERTICAL(edge)            \
+       (edge->p1.x == edge->p2.x)
+
+#define CACULATE_CUT_VERTEX(vtx, cal_x, ceil, vh_edge, edge)           \
+       do {                                                            \
+           if(cal_x) {                                                 \
+               vtx[1] = (vh_edge);                                     \
+               vtx[0] = (_glamor_linefixedX(                           \
+                             edge, vh_edge, ceil));                    \
+               if(DEBUG_CLIP_VTX)                                      \
+                   ErrorF("The intersection point of line y=%d and "   \
+                          "line of p1:(%d,%d) -- p2 (%d,%d) "          \
+                          "is (%d, %d)\n",                             \
+                          xFixedToInt(vh_edge),                        \
+                          xFixedToInt(edge->p1.x),                     \
+                          xFixedToInt(edge->p1.y),                     \
+                          xFixedToInt(edge->p2.x),                     \
+                          xFixedToInt(edge->p2.y),                     \
+                          xFixedToInt(vtx[0]),                         \
+                          xFixedToInt(vtx[1]));                        \
+           } else {                                                    \
+               vtx[0] = (vh_edge);                                     \
+               vtx[1] = (_glamor_linefixedY(                           \
+                             edge, vh_edge, ceil));                    \
+               if(DEBUG_CLIP_VTX)                                      \
+                   ErrorF("The intersection point of line x=%d and "   \
+                          "line of p1:(%d,%d) -- p2 (%d,%d) "          \
+                          "is (%d, %d)\n",                             \
+                          xFixedToInt(vh_edge),                        \
+                          xFixedToInt(edge->p1.x),                     \
+                          xFixedToInt(edge->p1.y),                     \
+                          xFixedToInt(edge->p2.x),                     \
+                          xFixedToInt(edge->p2.y),                     \
+                          xFixedToInt(vtx[0]),                         \
+                          xFixedToInt(vtx[1]));                        \
+           }                                                           \
+       } while(0)
+
+#define ADD_VERTEX_IF_INSIDE(vtx)                              \
+       if(POINT_INSIDE_CLIP_RECT(vtx, pbox)                    \
+          && point_inside_trapezoid(vtx, trap, edge_cross_y)){ \
+           tmp_vtx[vertex_num] = xFixedToInt(vtx[0]);          \
+           tmp_vtx[vertex_num + 1] = xFixedToInt(vtx[1]);      \
+           vertex_num += 2;                                    \
+           if(DEBUG_CLIP_VTX)                                  \
+               ErrorF("@ Point: (%d, %d) is inside "           \
+                      "the Rect and Trapezoid\n",              \
+                      xFixedToInt(vtx[0]),                     \
+                      xFixedToInt(vtx[1]));                    \
+       } else if(DEBUG_CLIP_VTX){                              \
+           ErrorF("X Point: (%d, %d) is outside "              \
+                  "the Rect and Trapezoid\t",                  \
+                  xFixedToInt(vtx[0]),                         \
+                  xFixedToInt(vtx[1]));                        \
+           if(POINT_INSIDE_CLIP_RECT(vtx, pbox))               \
+               ErrorF("The Point is outside "                  \
+                      "the Trapezoid\n");                      \
+           else                                                \
+               ErrorF("The Point is outside "                  \
+                      "the Rect\n");                           \
+       }
+
+    /*Trap's right edge cut right edge. */
+    if ((!IS_TRAP_EDGE_VERTICAL((&trap->left))) ||
+        (!IS_TRAP_EDGE_VERTICAL((&trap->right)))) {
+        edge_cross_y = _glamor_lines_crossfixedY((&trap->left), (&trap->right));
+        if (DEBUG_CLIP_VTX) {
+            ErrorF("Trap's left edge cut right edge at %d(0x%x), "
+                   "trap_top = %x, trap_bottom = %x\n",
+                   xFixedToInt(edge_cross_y), edge_cross_y,
+                   (unsigned int) trap->top, (unsigned int) trap->bottom);
+        }
+    }
+
+    /*Trap's TopLeft, BottomLeft, TopRight and BottomRight. */
+    CACULATE_CUT_VERTEX(tl, 1, FALSE, trap->top, (&trap->left));
+    CACULATE_CUT_VERTEX(bl, 1, FALSE, trap->bottom, (&trap->left));
+    CACULATE_CUT_VERTEX(tr, 1, TRUE, trap->top, (&trap->right));
+    CACULATE_CUT_VERTEX(br, 1, TRUE, trap->bottom, (&trap->right));
+
+    if (DEBUG_CLIP_VTX)
+        ErrorF("Trap's TopLeft, BottomLeft, TopRight and BottomRight\n");
+    if (DEBUG_CLIP_VTX)
+        ErrorF("Caculate the vertex of trapezoid:\n"
+               "      (%3d, %3d)-------------------------(%3d, %3d)\n"
+               "              /                           \\       \n"
+               "             /                             \\      \n"
+               "            /                               \\     \n"
+               "  (%3d, %3d)---------------------------------(%3d, %3d)\n"
+               "Clip with rect:\n"
+               "  (%3d, %3d)------------------------(%3d, %3d)    \n"
+               "           |                        |             \n"
+               "           |                        |             \n"
+               "           |                        |             \n"
+               "  (%3d, %3d)------------------------(%3d, %3d)    \n",
+               xFixedToInt(tl[0]), xFixedToInt(tl[1]), xFixedToInt(tr[0]),
+               xFixedToInt(tr[1]), xFixedToInt(bl[0]), xFixedToInt(bl[1]),
+               xFixedToInt(br[0]), xFixedToInt(br[1]),
+               pbox->x1, pbox->y1, pbox->x2, pbox->y1, pbox->x1, pbox->y2,
+               pbox->x2, pbox->y2);
+
+    ADD_VERTEX_IF_INSIDE(tl);
+    ADD_VERTEX_IF_INSIDE(bl);
+    ADD_VERTEX_IF_INSIDE(tr);
+    ADD_VERTEX_IF_INSIDE(br);
+
+    /*Trap's left edge cut Rect. */
+    if (DEBUG_CLIP_VTX)
+        ErrorF("Trap's left edge cut Rect\n");
+    CACULATE_CUT_VERTEX(left_cut_top, 1, FALSE, IntToxFixed(pbox->y1),
+                        (&trap->left));
+    ADD_VERTEX_IF_INSIDE(left_cut_top);
+    if (!IS_TRAP_EDGE_VERTICAL((&trap->left))) {
+        CACULATE_CUT_VERTEX(left_cut_left, 0, FALSE, IntToxFixed(pbox->x1),
+                            (&trap->left));
+        ADD_VERTEX_IF_INSIDE(left_cut_left);
+    }
+    CACULATE_CUT_VERTEX(left_cut_bottom, 1, FALSE, IntToxFixed(pbox->y2),
+                        (&trap->left));
+    ADD_VERTEX_IF_INSIDE(left_cut_bottom);
+    if (!IS_TRAP_EDGE_VERTICAL((&trap->left))) {
+        CACULATE_CUT_VERTEX(left_cut_right, 0, FALSE, IntToxFixed(pbox->x2),
+                            (&trap->left));
+        ADD_VERTEX_IF_INSIDE(left_cut_right);
+    }
+
+    /*Trap's right edge cut Rect. */
+    if (DEBUG_CLIP_VTX)
+        ErrorF("Trap's right edge cut Rect\n");
+    CACULATE_CUT_VERTEX(right_cut_top, 1, TRUE, IntToxFixed(pbox->y1),
+                        (&trap->right));
+    ADD_VERTEX_IF_INSIDE(right_cut_top);
+    if (!IS_TRAP_EDGE_VERTICAL((&trap->right))) {
+        CACULATE_CUT_VERTEX(right_cut_left, 0, TRUE, IntToxFixed(pbox->x1),
+                            (&trap->right));
+        ADD_VERTEX_IF_INSIDE(right_cut_left);
+    }
+    CACULATE_CUT_VERTEX(right_cut_bottom, 1, TRUE, IntToxFixed(pbox->y2),
+                        (&trap->right));
+    ADD_VERTEX_IF_INSIDE(right_cut_bottom);
+    if (!IS_TRAP_EDGE_VERTICAL((&trap->right))) {
+        CACULATE_CUT_VERTEX(right_cut_right, 0, TRUE, IntToxFixed(pbox->x2),
+                            (&trap->right));
+        ADD_VERTEX_IF_INSIDE(right_cut_right);
+    }
+
+    /* Trap's top cut Left and Right of rect. */
+    if (DEBUG_CLIP_VTX)
+        ErrorF("Trap's top cut Left and Right of rect\n");
+    tmp[0] = IntToxFixed(pbox->x1);
+    tmp[1] = trap->top;
+    ADD_VERTEX_IF_INSIDE(tmp);
+    tmp[0] = IntToxFixed(pbox->x2);
+    tmp[1] = trap->top;
+    ADD_VERTEX_IF_INSIDE(tmp);
+
+    /* Trap's bottom cut Left and Right of rect. */
+    if (DEBUG_CLIP_VTX)
+        ErrorF("Trap's bottom cut Left and Right of rect\n");
+    tmp[0] = IntToxFixed(pbox->x1);
+    tmp[1] = trap->bottom;
+    ADD_VERTEX_IF_INSIDE(tmp);
+    tmp[0] = IntToxFixed(pbox->x2);
+    tmp[1] = trap->bottom;
+    ADD_VERTEX_IF_INSIDE(tmp);
+
+    /* The orginal 4 vertex of rect. */
+    if (DEBUG_CLIP_VTX)
+        ErrorF("The orginal 4 vertex of rect\n");
+    tmp[0] = IntToxFixed(pbox->x1);
+    tmp[1] = IntToxFixed(pbox->y1);
+    ADD_VERTEX_IF_INSIDE(tmp);
+    tmp[0] = IntToxFixed(pbox->x1);
+    tmp[1] = IntToxFixed(pbox->y2);
+    ADD_VERTEX_IF_INSIDE(tmp);
+    tmp[0] = IntToxFixed(pbox->x2);
+    tmp[1] = IntToxFixed(pbox->y2);
+    ADD_VERTEX_IF_INSIDE(tmp);
+    tmp[0] = IntToxFixed(pbox->x2);
+    tmp[1] = IntToxFixed(pbox->y1);
+    ADD_VERTEX_IF_INSIDE(tmp);
+
+    if (DEBUG_CLIP_VTX) {
+        ErrorF("\nThe candidate vertex number is %d\n", vertex_num / 2);
+        for (i = 0; i < vertex_num / 2; i++) {
+            ErrorF("(%d, %d) ", tmp_vtx[2 * i], tmp_vtx[2 * i + 1]);
+        }
+        ErrorF("\n");
+    }
+
+    /* Sort the vertex by X and then Y. */
+    for (i = 0; i < vertex_num / 2; i++) {
+        int j;
+
+        for (j = 0; j < vertex_num / 2 - i - 1; j++) {
+            if (tmp_vtx[2 * j] > tmp_vtx[2 * (j + 1)]
+                || (tmp_vtx[2 * j] == tmp_vtx[2 * (j + 1)]
+                    && tmp_vtx[2 * j + 1] > tmp_vtx[2 * (j + 1) + 1])) {
+                tmp[0] = tmp_vtx[2 * j];
+                tmp[1] = tmp_vtx[2 * j + 1];
+                tmp_vtx[2 * j] = tmp_vtx[2 * (j + 1)];
+                tmp_vtx[2 * j + 1] = tmp_vtx[2 * (j + 1) + 1];
+                tmp_vtx[2 * (j + 1)] = tmp[0];
+                tmp_vtx[2 * (j + 1) + 1] = tmp[1];
+            }
+        }
+
+    }
+
+    if (DEBUG_CLIP_VTX) {
+        ErrorF("\nAfter sort vertex number is:\n");
+        for (i = 0; i < vertex_num / 2; i++) {
+            ErrorF("(%d, %d) ", tmp_vtx[2 * i], tmp_vtx[2 * i + 1]);
+        }
+        ErrorF("\n");
+    }
+
+    memset(vertex, -1, 2 * 6);
+    *num = 0;
+
+    for (i = 0; i < vertex_num / 2; i++) {
+        if (*num > 0 && vertex[2 * (*num - 1)] == tmp_vtx[2 * i]
+            && vertex[2 * (*num - 1) + 1] == tmp_vtx[2 * i + 1]) {
+            /*same vertex. */
+            if (DEBUG_CLIP_VTX)
+                ErrorF("X Point:(%d, %d) discard\n",
+                       tmp_vtx[2 * i], tmp_vtx[2 * i + 1]);
+            continue;
+        }
+
+        (*num)++;
+        if (*num > 6) {
+            if (DEBUG_CLIP_VTX)
+                FatalError("Trapezoid clip with Rect can never have vtx"
+                           "number bigger than 6\n");
+            else {
+                ErrorF("Trapezoid clip with Rect can never have vtx"
+                       "number bigger than 6\n");
+                *num = 6;
+                break;
+            }
+        }
+
+        vertex[2 * (*num - 1)] = tmp_vtx[2 * i];
+        vertex[2 * (*num - 1) + 1] = tmp_vtx[2 * i + 1];
+        if (DEBUG_CLIP_VTX)
+            ErrorF("@ Point:(%d, %d) select, num now is %d\n",
+                   tmp_vtx[2 * i], tmp_vtx[2 * i + 1], *num);
+    }
+
+    /* Now we need to arrange the vtx in the polygon's counter-clockwise
+       order. We first select the left and top point as the start point and
+       sort every vtx by the slope from vtx to the start vtx. */
+    for (i = 1; i < *num; i++) {
+        tmp_vtx_slope[i] = (vertex[2 * i] != vertex[0] ?
+                            (float) (vertex[2 * i + 1] -
+                                     vertex[1]) / (float) (vertex[2 * i] -
+                                                           vertex[0])
+                            : (float) INT_MAX);
+    }
+
+    if (DEBUG_CLIP_VTX) {
+        ErrorF("\nvtx number: %d, VTX and slope:\n", *num);
+        for (i = 0; i < *num; i++) {
+            ErrorF("(%d, %d):%f ",
+                   vertex[2 * i], vertex[2 * i + 1], tmp_vtx_slope[i]);
+        }
+        ErrorF("\n");
+    }
+
+    /* Sort the vertex by slope. */
+    for (i = 0; i < *num - 1; i++) {
+        int j;
+        float tmp_slope;
+
+        for (j = 1; j < *num - i - 1; j++) {
+            if (tmp_vtx_slope[j] < tmp_vtx_slope[j + 1]) {
+                tmp_slope = tmp_vtx_slope[j];
+                tmp_vtx_slope[j] = tmp_vtx_slope[j + 1];
+                tmp_vtx_slope[j + 1] = tmp_slope;
+                tmp[0] = vertex[2 * j];
+                tmp[1] = vertex[2 * j + 1];
+                vertex[2 * j] = vertex[2 * (j + 1)];
+                vertex[2 * j + 1] = vertex[2 * (j + 1) + 1];
+                vertex[2 * (j + 1)] = tmp[0];
+                vertex[2 * (j + 1) + 1] = tmp[1];
+            }
+        }
+    }
+
+    if (DEBUG_CLIP_VTX) {
+        ErrorF("\nBefore return, vtx number: %d, VTX and slope:\n", *num);
+        for (i = 0; i < *num; i++) {
+            ErrorF("(%d, %d):%f ",
+                   vertex[2 * i], vertex[2 * i + 1], tmp_vtx_slope[i]);
+        }
+        ErrorF("\n");
+    }
+
+    return TRUE;
+}
+
+static void *
+glamor_setup_composite_vbo_for_trapezoid(ScreenPtr screen, int n_verts)
+{
+    glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
+    int stride;
+    int vert_size;
+    char *vbo_offset;
+    void *vb;
+
+    glamor_priv->render_nr_verts = 0;
+
+    /* For GLAMOR_VERTEX_POS */
+    glamor_priv->vb_stride = 2 * sizeof(float);
+
+    /* For GLAMOR_GLAMOR_VERTEX_SOURCE */
+    glamor_priv->vb_stride += 2 * sizeof(float);
+
+    /* For GLAMOR_VERTEX_TOP_BOTTOM */
+    glamor_priv->vb_stride += 2 * sizeof(float);
+
+    /* For GLAMOR_VERTEX_LEFT_PARAM */
+    glamor_priv->vb_stride += 4 * sizeof(float);
+
+    /* For GLAMOR_VERTEX_RIGHT_PARAM */
+    glamor_priv->vb_stride += 4 * sizeof(float);
+
+    vert_size = n_verts * glamor_priv->vb_stride;
+
+    glamor_make_current(glamor_priv);
+
+    glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
+    glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
+    glDisableVertexAttribArray(GLAMOR_VERTEX_TOP_BOTTOM);
+    glDisableVertexAttribArray(GLAMOR_VERTEX_LEFT_PARAM);
+    glDisableVertexAttribArray(GLAMOR_VERTEX_RIGHT_PARAM);
+
+    vb = glamor_get_vbo_space(screen, vert_size, &vbo_offset);
+
+    /* Set the vertex pointer. */
+    glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT,
+                          GL_FALSE, glamor_priv->vb_stride,
+                          vbo_offset);
+    glEnableVertexAttribArray(GLAMOR_VERTEX_POS);
+    stride = 2;
+
+    glVertexAttribPointer(GLAMOR_VERTEX_SOURCE, 2, GL_FLOAT,
+                          GL_FALSE, glamor_priv->vb_stride,
+                          vbo_offset + stride * sizeof(float));
+    glEnableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
+    stride += 2;
+
+    glVertexAttribPointer(GLAMOR_VERTEX_TOP_BOTTOM, 2, GL_FLOAT,
+                          GL_FALSE, glamor_priv->vb_stride,
+                          vbo_offset + stride * sizeof(float));
+    glEnableVertexAttribArray(GLAMOR_VERTEX_TOP_BOTTOM);
+    stride += 2;
+
+    glVertexAttribPointer(GLAMOR_VERTEX_LEFT_PARAM, 4, GL_FLOAT,
+                          GL_FALSE, glamor_priv->vb_stride,
+                          vbo_offset + stride * sizeof(float));
+    glEnableVertexAttribArray(GLAMOR_VERTEX_LEFT_PARAM);
+    stride += 4;
+
+    glVertexAttribPointer(GLAMOR_VERTEX_RIGHT_PARAM, 4, GL_FLOAT,
+                          GL_FALSE, glamor_priv->vb_stride,
+                          vbo_offset + stride * sizeof(float));
+    glEnableVertexAttribArray(GLAMOR_VERTEX_RIGHT_PARAM);
+
+    return vb;
+}
+
+static Bool
+_glamor_trapezoids_with_shader(CARD8 op,
+                               PicturePtr src, PicturePtr dst,
+                               PictFormatPtr mask_format, INT16 x_src,
+                               INT16 y_src, int ntrap, xTrapezoid * traps)
+{
+    ScreenPtr screen = dst->pDrawable->pScreen;
+    glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
+    struct shader_key key;
+    glamor_composite_shader *shader = NULL;
+    struct blendinfo op_info;
+    PictFormatShort saved_source_format = 0;
+    PixmapPtr source_pixmap = NULL;
+    PixmapPtr dest_pixmap = NULL;
+    glamor_pixmap_private *source_pixmap_priv = NULL;
+    glamor_pixmap_private *dest_pixmap_priv = NULL;
+    glamor_pixmap_private *temp_src_priv = NULL;
+    int x_temp_src, y_temp_src;
+    int src_width, src_height;
+    int source_x_off, source_y_off;
+    GLfloat src_xscale = 1, src_yscale = 1;
+    int x_dst, y_dst;
+    int dest_x_off, dest_y_off;
+    GLfloat dst_xscale, dst_yscale;
+    BoxRec bounds;
+    PicturePtr temp_src = src;
+    int vert_stride = 3;
+    int ntriangle_per_loop;
+    int nclip_rect;
+    int mclip_rect;
+    int clip_processed;
+    int clipped_vtx[6 * 2];
+    RegionRec region;
+    BoxPtr box = NULL;
+    BoxPtr pbox = NULL;
+    int traps_count = 0;
+    int traps_not_completed = 0;
+    xTrapezoid *ptrap = NULL;
+    int nbox;
+    float src_matrix[9];
+    Bool ret = FALSE;
+
+    /* If a mask format wasn't provided, we get to choose, but behavior should
+     * be as if there was no temporary mask the traps were accumulated into.
+     */
+    if (!mask_format) {
+        if (dst->polyEdge == PolyEdgeSharp)
+            mask_format = PictureMatchFormat(screen, 1, PICT_a1);
+        else
+            mask_format = PictureMatchFormat(screen, 8, PICT_a8);
+        for (; ntrap; ntrap--, traps++)
+            glamor_trapezoids(op, src, dst, mask_format, x_src,
+                              y_src, 1, traps);
+        return TRUE;
+    }
+
+    miTrapezoidBounds(ntrap, traps, &bounds);
+    DEBUGF("The bounds for all traps is: bounds.x1 = %d, bounds.x2 = %d, "
+           "bounds.y1 = %d, bounds.y2 = %d\n", bounds.x1, bounds.x2,
+           bounds.y1, bounds.y2);
+
+    /* No area need to render. */
+    if (bounds.y1 >= bounds.y2 || bounds.x1 >= bounds.x2)
+        return TRUE;
+
+    dest_pixmap = glamor_get_drawable_pixmap(dst->pDrawable);
+    dest_pixmap_priv = glamor_get_pixmap_private(dest_pixmap);
+
+    if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(dest_pixmap_priv)
+        || dest_pixmap_priv->type == GLAMOR_TEXTURE_LARGE) {
+        /* Currently. Always fallback to cpu if destination is in CPU memory. */
+        ret = FALSE;
+        DEBUGF("dst pixmap has no FBO.\n");
+        goto TRAPEZOID_OUT;
+    }
+
+    if (src->pDrawable) {
+        source_pixmap = glamor_get_drawable_pixmap(src->pDrawable);
+        source_pixmap_priv = glamor_get_pixmap_private(source_pixmap);
+        temp_src_priv = source_pixmap_priv;
+        if (source_pixmap_priv
+            && (source_pixmap_priv->type == GLAMOR_DRM_ONLY
+                || source_pixmap_priv->type == GLAMOR_TEXTURE_LARGE)) {
+            ret = FALSE;
+            goto TRAPEZOID_OUT;
+        }
+    }
+
+    x_dst = bounds.x1;
+    y_dst = bounds.y1;
+
+    src_width = bounds.x2 - bounds.x1;
+    src_height = bounds.y2 - bounds.y1;
+
+    x_temp_src = x_src + bounds.x1 - (traps[0].left.p1.x >> 16);
+    y_temp_src = y_src + bounds.y1 - (traps[0].left.p1.y >> 16);
+
+    if ((!src->pDrawable && (src->pSourcePict->type != SourcePictTypeSolidFill))        //1. The Gradient case.
+        /* 2. Has no fbo but can upload. */
+        || (src->pDrawable && !GLAMOR_PIXMAP_PRIV_HAS_FBO(source_pixmap_priv)
+            && ((src_width * src_height * 4 <
+                 source_pixmap->drawable.width * source_pixmap->drawable.height)
+                || !glamor_check_fbo_size(glamor_priv,
+                                          source_pixmap->drawable.width,
+                                          source_pixmap->drawable.height)))) {
+
+        if (!glamor_check_fbo_size(glamor_priv, src_width, src_height)) {
+            ret = FALSE;
+            goto TRAPEZOID_OUT;
+        }
+        temp_src = glamor_convert_gradient_picture(screen, src,
+                                                   x_src, y_src,
+                                                   src_width, src_height);
+        if (!temp_src) {
+            temp_src = src;
+            ret = FALSE;
+            DEBUGF("Convert gradient picture failed\n");
+            goto TRAPEZOID_OUT;
+        }
+        temp_src_priv =
+            glamor_get_pixmap_private((PixmapPtr) temp_src->pDrawable);
+        x_temp_src = y_temp_src = 0;
+    }
+
+    x_dst += dst->pDrawable->x;
+    y_dst += dst->pDrawable->y;
+    if (temp_src->pDrawable) {
+        x_temp_src += temp_src->pDrawable->x;
+        y_temp_src += temp_src->pDrawable->y;
+    }
+
+    if (!miComputeCompositeRegion(&region,
+                                  temp_src, NULL, dst,
+                                  x_temp_src, y_temp_src,
+                                  0, 0, x_dst, y_dst, src_width, src_height)) {
+        DEBUGF("All the regions are clipped out, do nothing\n");
+        goto TRAPEZOID_OUT;
+    }
+
+    glamor_make_current(glamor_priv);
+
+    box = REGION_RECTS(&region);
+    nbox = REGION_NUM_RECTS(&region);
+    pbox = box;
+
+    ret = glamor_composite_choose_shader(op, temp_src, NULL, dst,
+                                         temp_src_priv, NULL, dest_pixmap_priv,
+                                         &key, &shader, &op_info,
+                                         &saved_source_format);
+    if (ret == FALSE) {
+        DEBUGF("can not set the shader program for composite\n");
+        goto TRAPEZOID_RESET_GL;
+    }
+    glamor_set_destination_pixmap_priv_nc(dest_pixmap_priv);
+    glamor_composite_set_shader_blend(dest_pixmap_priv, &key, shader, &op_info);
+    glamor_priv->has_source_coords = key.source != SHADER_SOURCE_SOLID;
+    glamor_priv->has_mask_coords = (key.mask != SHADER_MASK_NONE &&
+                                    key.mask != SHADER_MASK_SOLID);
+
+    glamor_get_drawable_deltas(dst->pDrawable, dest_pixmap,
+                               &dest_x_off, &dest_y_off);
+
+    pixmap_priv_get_dest_scale(dest_pixmap_priv, &dst_xscale, &dst_yscale);
+
+    if (glamor_priv->has_source_coords) {
+        source_pixmap = glamor_get_drawable_pixmap(temp_src->pDrawable);
+        source_pixmap_priv = glamor_get_pixmap_private(source_pixmap);
+        glamor_get_drawable_deltas(temp_src->pDrawable,
+                                   source_pixmap, &source_x_off, &source_y_off);
+        pixmap_priv_get_scale(source_pixmap_priv, &src_xscale, &src_yscale);
+        glamor_picture_get_matrixf(temp_src, src_matrix);
+        vert_stride += 3;
+    }
+
+    if (glamor_priv->has_mask_coords) {
+        DEBUGF("Should never have mask coords here!\n");
+        ret = FALSE;
+        goto TRAPEZOID_RESET_GL;
+    }
+
+    /* A trapezoid clip with a rectangle will at most generate a hexagon,
+       which can be devided into 4 triangles to render. */
+    ntriangle_per_loop =
+        (vert_stride * nbox * ntrap * 4) >
+        GLAMOR_COMPOSITE_VBO_VERT_CNT ? (GLAMOR_COMPOSITE_VBO_VERT_CNT /
+                                         vert_stride) : nbox * ntrap * 4;
+    ntriangle_per_loop = (ntriangle_per_loop / 4) * 4;
+
+    nclip_rect = nbox;
+    while (nclip_rect) {
+        float *vb;
+
+        mclip_rect = (nclip_rect * ntrap * 4) > ntriangle_per_loop ?
+            (ntriangle_per_loop / (4 * ntrap)) : nclip_rect;
+
+        if (!mclip_rect) {      /* Maybe too many traps. */
+            mclip_rect = 1;
+            ptrap = traps;
+            traps_count = ntriangle_per_loop / 4;
+            traps_not_completed = ntrap - traps_count;
+        }
+        else {
+            traps_count = ntrap;
+            ptrap = traps;
+            traps_not_completed = 0;
+        }
+
+ NTRAPS_LOOP_AGAIN:
+
+        vb = glamor_setup_composite_vbo(screen,
+                                        (mclip_rect * traps_count *
+                                         4 * vert_stride));
+        clip_processed = mclip_rect;
+
+        while (mclip_rect--) {
+            while (traps_count--) {
+                int vtx_num;
+                int i;
+                float vertices[3 * 2], source_texcoords[3 * 2];
+
+                DEBUGF
+                    ("In loop of render trapezoid, nclip_rect = %d, mclip_rect = %d, "
+                     "clip_processed = %d, traps_count = %d, traps_not_completed = %d\n",
+                     nclip_rect, mclip_rect, clip_processed, traps_count,
+                     traps_not_completed);
+
+                if (_glamor_clip_trapezoid_vertex
+                    (ptrap, pbox, clipped_vtx, &vtx_num)) {
+                    for (i = 0; i < vtx_num - 2; i++) {
+                        int clipped_vtx_tmp[3 * 2];
+
+                        clipped_vtx_tmp[0] = clipped_vtx[0];
+                        clipped_vtx_tmp[1] = clipped_vtx[1];
+                        clipped_vtx_tmp[2] = clipped_vtx[(i + 1) * 2];
+                        clipped_vtx_tmp[3] = clipped_vtx[(i + 1) * 2 + 1];
+                        clipped_vtx_tmp[4] = clipped_vtx[(i + 2) * 2];
+                        clipped_vtx_tmp[5] = clipped_vtx[(i + 2) * 2 + 1];
+                        glamor_set_normalize_tri_vcoords(dst_xscale, dst_yscale,
+                                                         clipped_vtx_tmp,
+                                                         glamor_priv->yInverted,
+                                                         vertices);
+                        DEBUGF("vertices of triangle: (%f X %f), (%f X %f), "
+                               "(%f X %f)\n", vertices[0], vertices[1],
+                               vertices[2], vertices[3], vertices[4],
+                               vertices[5]);
+
+                        if (key.source != SHADER_SOURCE_SOLID) {
+                            if (src->transform) {
+                                glamor_set_transformed_normalize_tri_tcoords
+                                    (source_pixmap_priv, src_matrix, src_xscale,
+                                     src_yscale, clipped_vtx_tmp,
+                                     glamor_priv->yInverted, source_texcoords);
+                            }
+                            else {
+                                glamor_set_normalize_tri_tcoords(src_xscale,
+                                                                 src_yscale,
+                                                                 clipped_vtx_tmp,
+                                                                 glamor_priv->
+                                                                 yInverted,
+                                                                 source_texcoords);
+                            }
+
+                            DEBUGF("source_texcoords of triangle: (%f X %f), "
+                                   "(%f X %f), (%f X %f)\n",
+                                   source_texcoords[0], source_texcoords[1],
+                                   source_texcoords[2], source_texcoords[3],
+                                   source_texcoords[4], source_texcoords[5]);
+                        }
+
+                        glamor_emit_composite_triangle(screen, vb,
+                                                       source_texcoords,
+                                                       NULL, vertices);
+                        vb += 3 * glamor_priv->vb_stride / sizeof(float);
+                    }
+                }
+
+                ptrap++;
+            }
+
+            if (traps_not_completed) {  /* one loop of ntraps not completed */
+                mclip_rect = 1;
+                traps_count = traps_not_completed > (ntriangle_per_loop / 4) ?
+                    (ntriangle_per_loop / 4) : traps_not_completed;
+                traps_not_completed -= traps_count;
+                glamor_flush_composite_triangles(screen);
+                goto NTRAPS_LOOP_AGAIN;
+            }
+            else {
+                ptrap = traps;
+                traps_count = ntrap;
+            }
+
+            pbox++;
+        }
+
+        glamor_flush_composite_triangles(screen);
+
+        nclip_rect -= clip_processed;
+    }
+
+    ret = TRUE;
+
+ TRAPEZOID_RESET_GL:
+    glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
+    glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
+    glDisableVertexAttribArray(GLAMOR_VERTEX_MASK);
+    glDisable(GL_BLEND);
+
+ TRAPEZOID_OUT:
+    if (box) {
+        REGION_UNINIT(dst->pDrawable->pScreen, &region);
+    }
+
+    if (temp_src != src) {
+        FreePicture(temp_src, 0);
+    }
+    else {
+        if (saved_source_format) {
+            src->format = saved_source_format;
+        }
+    }
+
+    return ret;
+}
+
+void
+glamor_init_trapezoid_shader(ScreenPtr screen)
+{
+    glamor_screen_private *glamor_priv;
+    GLint fs_prog, vs_prog;
+
+    const char *trapezoid_vs =
+        GLAMOR_DEFAULT_PRECISION
+        "attribute vec4 v_position;\n"
+        "attribute vec2 v_texcoord;\n"
+        /* v_top_bottom, v_left_param and v_right_param contain the
+           constant value for all the vertex of one rect. Using uniform
+           is more suitable but we need to reset the uniform variables
+           for every rect rendering and can not use the vbo, which causes
+           performance loss. So we set these attributes to same value
+           for every vertex of one rect and so it is also a constant in FS */
+        "attribute vec2 v_top_bottom;\n"
+        "attribute vec4 v_left_param;\n"
+        "attribute vec4 v_right_param;\n"
+        "\n"
+        "varying vec2 source_texture;\n"
+        "varying float trap_top;\n"
+        "varying float trap_bottom;\n"
+        "varying float trap_left_x;\n"
+        "varying float trap_left_y;\n"
+        "varying float trap_left_slope;\n"
+        "varying float trap_left_vertical_f;\n"
+        "varying float trap_right_x;\n"
+        "varying float trap_right_y;\n"
+        "varying float trap_right_slope;\n"
+        "varying float trap_right_vertical_f;\n"
+        "\n"
+        "void main()\n"
+        "{\n"
+        "    gl_Position = v_position;\n"
+        "    source_texture = v_texcoord.xy;\n"
+        "    trap_top = v_top_bottom.x;\n"
+        "    trap_bottom = v_top_bottom.y;\n"
+        "    \n"
+        "    trap_left_x = v_left_param.x;\n"
+        "    trap_left_y = v_left_param.y;\n"
+        "    trap_left_slope = v_left_param.z;\n"
+        "    trap_left_vertical_f = v_left_param.w;\n"
+        "    \n"
+        "    trap_right_x = v_right_param.x;\n"
+        "    trap_right_y = v_right_param.y;\n"
+        "    trap_right_slope = v_right_param.z;\n"
+        "    trap_right_vertical_f = v_right_param.w;\n"
+        "}\n";
+
+    /*
+     * Because some GL fill function do not support the MultSample
+     * anti-alias, we need to do the MSAA here. This manner like
+     * pixman, will caculate the value of area in trapezoid dividing
+     * the totol area for each pixel, as follow:
+     |
+     ----+------------------------------------------------------>
+     |
+     |              -------------
+     |             /             \
+     |            /               \
+     |           /                 \
+     |          /              +----------------+
+     |         /               |.....\          |
+     |        /                |......\         |
+     |       /                 |.......\        |
+     |      /                  |........\       |
+     |     /-------------------+---------\      |
+     |                         |                |
+     |                         |                |
+     |                         +----------------+
+     |
+     \|/
+
+     */
+    const char *trapezoid_fs =
+        GLAMOR_DEFAULT_PRECISION
+        "varying vec2 source_texture;  \n"
+        "varying float trap_top;  \n"
+        "varying float trap_bottom;  \n"
+        "varying float trap_left_x;  \n"
+        "varying float trap_left_y;  \n"
+        "varying float trap_left_slope;  \n"
+        "varying float trap_left_vertical_f;  \n"
+        "varying float trap_right_x;  \n"
+        "varying float trap_right_y;  \n"
+        "varying float trap_right_slope;  \n"
+        "varying float trap_right_vertical_f;  \n"
+        "float x_per_pix = 1.0;"
+        "float y_per_pix = 1.0;"
+        "\n"
+        "float get_alpha_val() \n"
+        "{  \n"
+        "    float x_up_cut_left;  \n"
+        "    float x_bottom_cut_left;  \n"
+        "    float x_up_cut_right;  \n"
+        "    float x_bottom_cut_right;  \n"
+        "    bool trap_left_vertical;\n"
+        "    bool trap_right_vertical;\n"
+        "       if (abs(trap_left_vertical_f - 1.0) <= 0.0001)\n"
+        "              trap_left_vertical = true;\n"
+        "       else\n"
+        "              trap_left_vertical = false;\n"
+        "       if (abs(trap_right_vertical_f - 1.0) <= 0.0001)\n"
+        "              trap_right_vertical = true;\n"
+        "       else\n"
+        "              trap_right_vertical = false;\n"
+        "    \n"
+        "    if(trap_left_vertical == true) {  \n"
+        "        x_up_cut_left = trap_left_x;  \n"
+        "        x_bottom_cut_left = trap_left_x;  \n"
+        "    } else {  \n"
+        "        x_up_cut_left = trap_left_x  \n"
+        "            + (source_texture.y - y_per_pix/2.0 - trap_left_y)  \n"
+        "              / trap_left_slope;  \n"
+        "        x_bottom_cut_left = trap_left_x  \n"
+        "            + (source_texture.y + y_per_pix/2.0 - trap_left_y)  \n"
+        "              / trap_left_slope;  \n"
+        "    }  \n"
+        "    \n"
+        "    if(trap_right_vertical == true) {  \n"
+        "        x_up_cut_right = trap_right_x;  \n"
+        "        x_bottom_cut_right = trap_right_x;  \n"
+        "    } else {  \n"
+        "        x_up_cut_right = trap_right_x  \n"
+        "            + (source_texture.y - y_per_pix/2.0 - trap_right_y)  \n"
+        "              / trap_right_slope;  \n"
+        "        x_bottom_cut_right = trap_right_x  \n"
+        "            + (source_texture.y + y_per_pix/2.0 - trap_right_y)  \n"
+        "              / trap_right_slope;  \n"
+        "    }  \n"
+        "    \n"
+        "    if((x_up_cut_left <= source_texture.x - x_per_pix/2.0) &&  \n"
+        "          (x_bottom_cut_left <= source_texture.x - x_per_pix/2.0) &&  \n"
+        "          (x_up_cut_right >= source_texture.x + x_per_pix/2.0) &&  \n"
+        "          (x_bottom_cut_right >= source_texture.x + x_per_pix/2.0) &&  \n"
+        "          (trap_top <= source_texture.y - y_per_pix/2.0) &&  \n"
+        "          (trap_bottom >= source_texture.y + y_per_pix/2.0)) {  \n"
+        //       The complete inside case.
+        "        return 1.0;  \n"
+        "    } else if((trap_top > source_texture.y + y_per_pix/2.0) ||  \n"
+        "                (trap_bottom < source_texture.y - y_per_pix/2.0)) {  \n"
+        //       The complete outside. Above the top or Below the bottom.
+        "        return 0.0;  \n"
+        "    } else {  \n"
+        "        if((x_up_cut_right < source_texture.x - x_per_pix/2.0 &&  \n"
+        "                   x_bottom_cut_right < source_texture.x - x_per_pix/2.0)  \n"
+        "            || (x_up_cut_left > source_texture.x + x_per_pix/2.0  &&  \n"
+        "                   x_bottom_cut_left > source_texture.x + x_per_pix/2.0)) {  \n"
+        //            The complete outside. At Left or Right of the trapezoide.
+        "             return 0.0;  \n"
+        "        }  \n"
+        "    }  \n"
+        //   Get here, the pix is partly inside the trapezoid.
+        "    {  \n"
+        "        float percent = 0.0;  \n"
+        "        float up = (source_texture.y - y_per_pix/2.0) >= trap_top ?  \n"
+        "                       (source_texture.y - y_per_pix/2.0) : trap_top;  \n"
+        "        float bottom = (source_texture.y + y_per_pix/2.0) <= trap_bottom ?  \n"
+        "                       (source_texture.y + y_per_pix/2.0) : trap_bottom;  \n"
+        "        float left = source_texture.x - x_per_pix/2.0;  \n"
+        "        float right = source_texture.x + x_per_pix/2.0;  \n"
+        "        \n"
+        "        percent = (bottom - up) / y_per_pix;  \n"
+        "        \n"
+        "           if(trap_left_vertical == true) {  \n"
+        "            if(trap_left_x > source_texture.x - x_per_pix/2.0 &&  \n"
+        "                     trap_left_x < source_texture.x + x_per_pix/2.0)  \n"
+        "                left = trap_left_x;  \n"
+        "        }  \n"
+        "           if(trap_right_vertical == true) {  \n"
+        "            if(trap_right_x > source_texture.x - x_per_pix/2.0 &&  \n"
+        "                     trap_right_x < source_texture.x + x_per_pix/2.0)  \n"
+        "                right = trap_right_x;  \n"
+        "        }  \n"
+        "        if((up >= bottom) || (left >= right))  \n"
+        "            return 0.0;  \n"
+        "        \n"
+        "        percent = percent * ((right - left)/x_per_pix);  \n"
+        "        if(trap_left_vertical == true && trap_right_vertical == true)  \n"
+        "            return percent;  \n"
+        "        \n"
+        "        if(trap_left_vertical != true) {  \n"
+        "            float area;  \n"
+        //           the slope should never be 0.0 here
+        "            float up_x = trap_left_x + (up - trap_left_y)/trap_left_slope;  \n"
+        "            float bottom_x = trap_left_x + (bottom - trap_left_y)/trap_left_slope;  \n"
+        "            if(trap_left_slope < 0.0 && up_x > left) {  \n"
+        /*   case 1
+           |
+           ----+------------------------------------->
+           |                 /
+           |                /
+           |           +---/--------+
+           |           |  /.........|
+           |           | /..........|
+           |           |/...........|
+           |           /............|
+           |          /|............|
+           |           +------------+
+           |
+           \|/
+         */
+        "                float left_y = trap_left_y + trap_left_slope*(left - trap_left_x);  \n"
+        "                if((up_x > left) && (left_y > up)) {  \n"
+        "                    area = 0.5 * (up_x - left) * (left_y - up);  \n"
+        "                    if(up_x > right) {  \n"
+        "                        float right_y = trap_left_y  \n"
+        "                                  + trap_left_slope*(right - trap_left_x);  \n"
+        "                        area = area - 0.5 * (up_x - right) * (right_y - up);  \n"
+        "                    }  \n"
+        "                    if(left_y > bottom) {  \n"
+        "                        area = area - 0.5 * (bottom_x - left) * (left_y - bottom);  \n"
+        "                    }  \n"
+        "                } else {  \n"
+        "                    area = 0.0;  \n"
+        "                }  \n"
+        "                percent = percent * (1.0 - (area/((right-left)*(bottom-up))));  \n"
+        "            } else if(trap_left_slope > 0.0 && bottom_x > left) {  \n"
+        /*   case 2
+           |
+           ----+------------------------------------->
+           |          \
+           |           \
+           |           +\-----------+
+           |           | \..........|
+           |           |  \.........|
+           |           |   \........|
+           |           |    \.......|
+           |           |     \......|
+           |           +------\-----+
+           |                   \
+           |                    \
+           \|/
+         */
+        "                float right_y = trap_left_y + trap_left_slope*(right - trap_left_x);  \n"
+        "                if((up_x < right) && (right_y > up)) {  \n"
+        "                    area = 0.5 * (right - up_x) * (right_y - up);  \n"
+        "                    if(up_x < left) {  \n"
+        "                        float left_y = trap_left_y  \n"
+        "                                  + trap_left_slope*(left - trap_left_x);  \n"
+        "                        area = area - 0.5 * (left - up_x) * (left_y - up);  \n"
+        "                    }  \n"
+        "                    if(right_y > bottom) {  \n"
+        "                        area = area - 0.5 * (right - bottom_x) * (right_y - bottom);  \n"
+        "                    }  \n"
+        "                } else {  \n"
+        "                    area = 0.0;  \n"
+        "                }  \n"
+        "                percent = percent * (area/((right-left)*(bottom-up)));  \n"
+        "            }  \n"
+        "        }  \n"
+        "        \n"
+        "        if(trap_right_vertical != true) {  \n"
+        "            float area;  \n"
+        //           the slope should never be 0.0 here
+        "            float up_x = trap_right_x + (up - trap_right_y)/trap_right_slope;  \n"
+        "            float bottom_x = trap_right_x + (bottom - trap_right_y)/trap_right_slope;  \n"
+        "            if(trap_right_slope < 0.0 && bottom_x < right) {  \n"
+        /*   case 3
+           |
+           ----+------------------------------------->
+           |                     /
+           |           +--------/---+
+           |           |......./    |
+           |           |....../     |
+           |           |...../      |
+           |           |..../       |
+           |           |.../        |
+           |           +--/---------+
+           |             /
+           |
+           \|/
+         */
+        "                float left_y = trap_right_y + trap_right_slope*(left - trap_right_x);  \n"
+        "                if((up_x > left) && (left_y > up)) {  \n"
+        "                    area = 0.5 * (up_x - left) * (left_y - up);  \n"
+        "                    if(up_x > right) {  \n"
+        "                        float right_y = trap_right_y  \n"
+        "                                  + trap_right_slope*(right - trap_right_x);  \n"
+        "                        area = area - 0.5 * (up_x - right) * (right_y - up);  \n"
+        "                    }  \n"
+        "                    if(left_y > bottom) {  \n"
+        "                        area = area - 0.5 * (bottom_x - left) * (left_y - bottom);  \n"
+        "                    }  \n"
+        "                } else {  \n"
+        "                    area = 0.0;  \n"
+        "                }  \n"
+        "                percent = percent * (area/((right-left)*(bottom-up)));  \n"
+        "            } else if(trap_right_slope > 0.0 && up_x < right) {  \n"
+        /*   case 4
+           |
+           ----+------------------------------------->
+           |                   \
+           |           +--------\---+
+           |           |.........\  |
+           |           |..........\ |
+           |           |...........\|
+           |           |............\
+           |           |............|\
+           |           +------------+ \
+           |                           \
+           |
+           \|/
+         */
+        "                float right_y = trap_right_y + trap_right_slope*(right - trap_right_x);  \n"
+        "                if((up_x < right) && (right_y > up)) {  \n"
+        "                    area = 0.5 * (right - up_x) * (right_y - up);  \n"
+        "                    if(up_x < left) {  \n"
+        "                        float left_y = trap_right_y  \n"
+        "                                  + trap_right_slope*(left - trap_right_x);  \n"
+        "                        area = area - 0.5 * (left - up_x) * (left_y - up);  \n"
+        "                    }  \n"
+        "                    if(right_y > bottom) {  \n"
+        "                        area = area - 0.5 * (right - bottom_x) * (right_y - bottom);  \n"
+        "                    }  \n"
+        "                } else {  \n"
+        "                    area = 0.0;  \n"
+        "                }  \n"
+        "                percent = percent * (1.0 - (area/((right-left)*(bottom-up))));  \n"
+        "            }  \n"
+        "        }  \n"
+        "        \n"
+        "        return percent;  \n"
+        "    }  \n"
+        "}  \n"
+        "\n"
+        "void main()  \n"
+        "{  \n"
+        "    float alpha_val = get_alpha_val();  \n"
+        "    gl_FragColor = vec4(0.0, 0.0, 0.0, alpha_val);  \n"
+        "}\n";
+
+    glamor_priv = glamor_get_screen_private(screen);
+    glamor_make_current(glamor_priv);
+
+    glamor_priv->trapezoid_prog = glCreateProgram();
+
+    vs_prog = glamor_compile_glsl_prog(GL_VERTEX_SHADER, trapezoid_vs);
+    fs_prog = glamor_compile_glsl_prog(GL_FRAGMENT_SHADER, trapezoid_fs);
+
+    glAttachShader(glamor_priv->trapezoid_prog, vs_prog);
+    glAttachShader(glamor_priv->trapezoid_prog, fs_prog);
+
+    glBindAttribLocation(glamor_priv->trapezoid_prog,
+                         GLAMOR_VERTEX_POS, "v_positionsition");
+    glBindAttribLocation(glamor_priv->trapezoid_prog,
+                         GLAMOR_VERTEX_SOURCE, "v_texcoord");
+    glBindAttribLocation(glamor_priv->trapezoid_prog,
+                         GLAMOR_VERTEX_TOP_BOTTOM, "v_top_bottom");
+    glBindAttribLocation(glamor_priv->trapezoid_prog,
+                         GLAMOR_VERTEX_LEFT_PARAM, "v_left_param");
+    glBindAttribLocation(glamor_priv->trapezoid_prog,
+                         GLAMOR_VERTEX_RIGHT_PARAM, "v_right_param");
+
+    glamor_link_glsl_prog(screen, glamor_priv->trapezoid_prog, "trapezoid");
+}
+
+void
+glamor_fini_trapezoid_shader(ScreenPtr screen)
+{
+    glamor_screen_private *glamor_priv;
+
+    glamor_priv = glamor_get_screen_private(screen);
+    glamor_make_current(glamor_priv);
+    glDeleteProgram(glamor_priv->trapezoid_prog);
+}
+
+static Bool
+_glamor_generate_trapezoid_with_shader(ScreenPtr screen, PicturePtr picture,
+                                       xTrapezoid *traps, int ntrap,
+                                       BoxRec *bounds)
+{
+    glamor_screen_private *glamor_priv;
+    glamor_pixmap_private *pixmap_priv;
+    PixmapPtr pixmap = NULL;
+    GLint trapezoid_prog;
+    GLfloat xscale, yscale;
+    float left_slope, right_slope;
+    xTrapezoid *ptrap;
+    BoxRec one_trap_bound;
+    int nrect_max;
+    int i, j;
+    float params[4];
+
+    glamor_priv = glamor_get_screen_private(screen);
+    trapezoid_prog = glamor_priv->trapezoid_prog;
+
+    pixmap = glamor_get_drawable_pixmap(picture->pDrawable);
+    pixmap_priv = glamor_get_pixmap_private(pixmap);
+
+    if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv)
+        || pixmap_priv->type == GLAMOR_TEXTURE_LARGE) { /* should always have here. */
+        DEBUGF("GLAMOR_PIXMAP_PRIV_HAS_FBO check failed, fallback\n");
+        return FALSE;
+    }
+
+    /* First, clear all to zero */
+    if (!glamor_solid(pixmap, 0, 0, pixmap_priv->base.pixmap->drawable.width,
+                      pixmap_priv->base.pixmap->drawable.height,
+                      GXclear, 0xFFFFFFFF, 0)) {
+        DEBUGF("glamor_solid failed, fallback\n");
+        return FALSE;
+    }
+
+    glamor_make_current(glamor_priv);
+
+    glamor_set_destination_pixmap_priv_nc(pixmap_priv);
+
+    pixmap_priv_get_dest_scale(pixmap_priv, (&xscale), (&yscale));
+
+    /* Now draw the Trapezoid mask. */
+    glUseProgram(trapezoid_prog);
+
+    glEnable(GL_BLEND);
+    glBlendFunc(GL_ONE, GL_ONE);
+
+    nrect_max = GLAMOR_COMPOSITE_VBO_VERT_CNT / (4 * GLAMOR_VERTEX_RIGHT_PARAM);
+
+    for (i = 0; i < ntrap;) {
+        float *vertices;
+        int mrect;
+        int stride;
+
+        mrect = (ntrap - i) > nrect_max ? nrect_max : (ntrap - i);
+        vertices = glamor_setup_composite_vbo_for_trapezoid(screen, 4 * mrect);
+        stride = glamor_priv->vb_stride / sizeof(float);
+
+        for (j = 0; j < mrect; j++) {
+            ptrap = traps + i + j;
+
+            DEBUGF
+                ("--- The parameter of xTrapezoid is:\ntop: %d  0x%x\tbottom: %d  0x%x\n"
+                 "left:  p1 (%d   0x%x, %d   0x%x)\tp2 (%d   0x%x, %d   0x%x)\n"
+                 "right: p1 (%d   0x%x, %d   0x%x)\tp2 (%d   0x%x, %d   0x%x)\n",
+                 xFixedToInt(ptrap->top), ptrap->top,
+                 xFixedToInt(ptrap->bottom), ptrap->bottom,
+                 xFixedToInt(ptrap->left.p1.x), ptrap->left.p1.x,
+                 xFixedToInt(ptrap->left.p1.y), ptrap->left.p1.y,
+                 xFixedToInt(ptrap->left.p2.x), ptrap->left.p2.x,
+                 xFixedToInt(ptrap->left.p2.y), ptrap->left.p2.y,
+                 xFixedToInt(ptrap->right.p1.x), ptrap->right.p1.x,
+                 xFixedToInt(ptrap->right.p1.y), ptrap->right.p1.y,
+                 xFixedToInt(ptrap->right.p2.x), ptrap->right.p2.x,
+                 xFixedToInt(ptrap->right.p2.y), ptrap->right.p2.y);
+
+            miTrapezoidBounds(1, ptrap, &one_trap_bound);
+
+            vertices += 2;
+            glamor_set_tcoords_ext((pixmap_priv->base.pixmap->drawable.width),
+                                   (pixmap_priv->base.pixmap->drawable.height),
+                                   (one_trap_bound.x1), (one_trap_bound.y1),
+                                   (one_trap_bound.x2), (one_trap_bound.y2),
+                                   glamor_priv->yInverted, vertices, stride);
+            DEBUGF("tex_vertices --> leftup : %f X %f, rightup: %f X %f,"
+                   "rightbottom: %f X %f, leftbottom : %f X %f\n", vertices[0],
+                   vertices[1], vertices[1 * stride], vertices[1 * stride + 1],
+                   vertices[2 * stride], vertices[2 * stride + 1],
+                   vertices[3 * stride], vertices[3 * stride + 1]);
+
+            /* Need to rebase. */
+            one_trap_bound.x1 -= bounds->x1;
+            one_trap_bound.x2 -= bounds->x1;
+            one_trap_bound.y1 -= bounds->y1;
+            one_trap_bound.y2 -= bounds->y1;
+
+            vertices -= 2;
+
+            glamor_set_normalize_vcoords_ext(pixmap_priv, xscale, yscale,
+                                             one_trap_bound.x1,
+                                             one_trap_bound.y1,
+                                             one_trap_bound.x2,
+                                             one_trap_bound.y2,
+                                             glamor_priv->yInverted, vertices,
+                                             stride);
+            DEBUGF("vertices --> leftup : %f X %f, rightup: %f X %f,"
+                   "rightbottom: %f X %f, leftbottom : %f X %f\n", vertices[0],
+                   vertices[1], vertices[1 * stride], vertices[1 * stride + 1],
+                   vertices[2 * stride], vertices[2 * stride + 1],
+                   vertices[3 * stride], vertices[3 * stride + 1]);
+            vertices += 4;
+
+            /* Set the top and bottom. */
+            params[0] = ((float) ptrap->top) / 65536;
+            params[1] = ((float) ptrap->bottom) / 65536;
+            glamor_set_const_ext(params, 2, vertices, 4, stride);
+            vertices += 2;
+
+            /* Set the left params. */
+            params[0] = ((float) ptrap->left.p1.x) / 65536;
+            params[1] = ((float) ptrap->left.p1.y) / 65536;
+
+            if (ptrap->left.p1.x == ptrap->left.p2.x) {
+                left_slope = 0.0;
+                params[3] = 1.0;
+            }
+            else {
+                left_slope = ((float) (ptrap->left.p1.y - ptrap->left.p2.y))
+                    / ((float) (ptrap->left.p1.x - ptrap->left.p2.x));
+                params[3] = 0.0;
+            }
+            params[2] = left_slope;
+            glamor_set_const_ext(params, 4, vertices, 4, stride);
+            vertices += 4;
+
+            /* Set the left params. */
+            params[0] = ((float) ptrap->right.p1.x) / 65536;
+            params[1] = ((float) ptrap->right.p1.y) / 65536;
+
+            if (ptrap->right.p1.x == ptrap->right.p2.x) {
+                right_slope = 0.0;
+                params[3] = 1.0;
+            }
+            else {
+                right_slope = ((float) (ptrap->right.p1.y - ptrap->right.p2.y))
+                    / ((float) (ptrap->right.p1.x - ptrap->right.p2.x));
+                params[3] = 0.0;
+            }
+            params[2] = right_slope;
+            glamor_set_const_ext(params, 4, vertices, 4, stride);
+            vertices += 4;
+
+            DEBUGF("trap_top = %f, trap_bottom = %f, "
+                   "trap_left_x = %f, trap_left_y = %f, left_slope = %f, "
+                   "trap_right_x = %f, trap_right_y = %f, right_slope = %f\n",
+                   ((float) ptrap->top) / 65536,
+                   ((float) ptrap->bottom) / 65536,
+                   ((float) ptrap->left.p1.x) / 65536,
+                   ((float) ptrap->left.p1.y) / 65536, left_slope,
+                   ((float) ptrap->right.p1.x) / 65536,
+                   ((float) ptrap->right.p1.y) / 65536, right_slope);
+
+            glamor_priv->render_nr_verts += 4;
+            vertices += 3 * stride;
+        }
+
+        i += mrect;
+
+        glamor_put_vbo_space(screen);
+
+        /* Now rendering. */
+        if (!glamor_priv->render_nr_verts)
+            continue;
+
+        if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) {
+            glDrawRangeElements(GL_TRIANGLES, 0,
+                                glamor_priv->render_nr_verts,
+                                (glamor_priv->render_nr_verts * 3) / 2,
+                                GL_UNSIGNED_SHORT, NULL);
+        } else {
+            glDrawElements(GL_TRIANGLES,
+                           (glamor_priv->render_nr_verts * 3) / 2,
+                           GL_UNSIGNED_SHORT, NULL);
+        }
+    }
+
+    glBlendFunc(GL_ONE, GL_ZERO);
+    glDisable(GL_BLEND);
+    glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
+    glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
+    glDisableVertexAttribArray(GLAMOR_VERTEX_TOP_BOTTOM);
+    glDisableVertexAttribArray(GLAMOR_VERTEX_LEFT_PARAM);
+    glDisableVertexAttribArray(GLAMOR_VERTEX_RIGHT_PARAM);
+    return TRUE;
+}
+
+#endif                          /*GLAMOR_TRAPEZOID_SHADER */
+
+/**
+ * Creates an appropriate picture for temp mask use.
+ */
+static PicturePtr
+glamor_create_mask_picture(ScreenPtr screen,
+                           PicturePtr dst,
+                           PictFormatPtr pict_format,
+                           CARD16 width, CARD16 height, int gpu)
+{
+    PixmapPtr pixmap;
+    PicturePtr picture;
+    int error;
+
+    if (!pict_format) {
+        if (dst->polyEdge == PolyEdgeSharp)
+            pict_format = PictureMatchFormat(screen, 1, PICT_a1);
+        else
+            pict_format = PictureMatchFormat(screen, 8, PICT_a8);
+        if (!pict_format)
+            return 0;
+    }
+
+    if (gpu) {
+        pixmap = glamor_create_pixmap(screen, width, height,
+                                      pict_format->depth, 0);
+    }
+    else {
+        pixmap = glamor_create_pixmap(screen, 0, 0,
+                                      pict_format->depth,
+                                      GLAMOR_CREATE_PIXMAP_CPU);
+    }
+
+    if (!pixmap)
+        return 0;
+    picture = CreatePicture(0, &pixmap->drawable, pict_format,
+                            0, 0, serverClient, &error);
+    glamor_destroy_pixmap(pixmap);
+    return picture;
+}
+
+static int
+_glamor_trapezoid_bounds(int ntrap, xTrapezoid *traps, BoxPtr box)
+{
+    int has_large_trapezoid = 0;
+
+    box->y1 = MAXSHORT;
+    box->y2 = MINSHORT;
+    box->x1 = MAXSHORT;
+    box->x2 = MINSHORT;
+
+    for (; ntrap; ntrap--, traps++) {
+        INT16 x1, y1, x2, y2;
+
+        if (!xTrapezoidValid(traps))
+            continue;
+        y1 = xFixedToInt(traps->top);
+        if (y1 < box->y1)
+            box->y1 = y1;
+
+        y2 = xFixedToInt(xFixedCeil(traps->bottom));
+        if (y2 > box->y2)
+            box->y2 = y2;
+
+        x1 = xFixedToInt(min
+                         (_glamor_linefixedX(&traps->left, traps->top, FALSE),
+                          _glamor_linefixedX(&traps->left, traps->bottom,
+                                             FALSE)));
+        if (x1 < box->x1)
+            box->x1 = x1;
+
+        x2 = xFixedToInt(xFixedCeil
+                         (max
+                          (_glamor_linefixedX(&traps->right, traps->top, TRUE),
+                           _glamor_linefixedX(&traps->right, traps->bottom,
+                                              TRUE))));
+        if (x2 > box->x2)
+            box->x2 = x2;
+
+        if (!has_large_trapezoid && (x2 - x1) > 256 && (y2 - y1) > 32)
+            has_large_trapezoid = 1;
+    }
+
+    return has_large_trapezoid;
+}
+
+/**
+ * glamor_trapezoids will first try to create a trapezoid mask using shader,
+ * if failed, miTrapezoids will generate trapezoid mask accumulating in
+ * system memory.
+ */
+static Bool
+_glamor_trapezoids(CARD8 op,
+                   PicturePtr src, PicturePtr dst,
+                   PictFormatPtr mask_format, INT16 x_src, INT16 y_src,
+                   int ntrap, xTrapezoid *traps, Bool fallback)
+{
+    ScreenPtr screen = dst->pDrawable->pScreen;
+    BoxRec bounds;
+    PicturePtr picture;
+    INT16 x_dst, y_dst;
+    INT16 x_rel, y_rel;
+    int width, height, stride;
+    PixmapPtr pixmap;
+    pixman_image_t *image = NULL;
+    int ret = 0;
+    int has_large_trapezoid;
+
+    /* If a mask format wasn't provided, we get to choose, but behavior should
+     * be as if there was no temporary mask the traps were accumulated into.
+     */
+    if (!mask_format) {
+        if (dst->polyEdge == PolyEdgeSharp)
+            mask_format = PictureMatchFormat(screen, 1, PICT_a1);
+        else
+            mask_format = PictureMatchFormat(screen, 8, PICT_a8);
+        for (; ntrap; ntrap--, traps++)
+            glamor_trapezoids(op, src, dst, mask_format, x_src,
+                              y_src, 1, traps);
+        return TRUE;
+    }
+
+    has_large_trapezoid = _glamor_trapezoid_bounds(ntrap, traps, &bounds);
+    DEBUGF("The bounds for all traps is: bounds.x1 = %d, bounds.x2 = %d, "
+           "bounds.y1 = %d, bounds.y2 = %d, ---- ntrap = %d\n", bounds.x1,
+           bounds.x2, bounds.y1, bounds.y2, ntrap);
+
+    if (bounds.y1 >= bounds.y2 || bounds.x1 >= bounds.x2)
+        return TRUE;
+
+    x_dst = traps[0].left.p1.x >> 16;
+    y_dst = traps[0].left.p1.y >> 16;
+
+    width = bounds.x2 - bounds.x1;
+    height = bounds.y2 - bounds.y1;
+    stride = PixmapBytePad(width, mask_format->depth);
+
+#ifdef GLAMOR_TRAPEZOID_SHADER
+    /* We seperate the render to two paths.
+       Some GL implemetation do not implement the Anti-Alias for triangles
+       and polygen's filling. So when the edge is not vertical or horizontal,
+       sawtooth will be obvious. The trapezoid is widely used to render wide
+       lines and circles. In these case, the line or circle will be divided
+       into a large number of small trapezoids to approximate it, so the sawtooth
+       at the edge will cause the result not be acceptable.
+       When the depth of the mask is 1, there is no Anti-Alias needed, so we
+       use the clip logic to generate the result directly(fast path).
+       When the depth is not 1, AA is needed and we use a shader to generate
+       a temp mask pixmap.
+     */
+    if (mask_format->depth == 1) {
+        ret = _glamor_trapezoids_with_shader(op, src, dst, mask_format,
+                                             x_src, y_src, ntrap, traps);
+        if (ret)
+            return TRUE;
+    }
+    else {
+        if (has_large_trapezoid || ntrap > 256) {
+            /* The shader speed is relative slower than pixman when generating big chunk
+               trapezoid mask. We fallback to pixman to improve the performance. */
+            ;
+        }
+        else if (dst->polyMode == PolyModeImprecise) {
+            /*  The precise mode is that we sample the trapezoid on the centre points of
+               an (2*n+1)x(2*n-1) subpixel grid. It is computationally expensive in shader
+               and we use inside area ratio to replace it if the polymode == Imprecise. */
+            picture = glamor_create_mask_picture(screen, dst, mask_format,
+                                                 width, height, 1);
+            if (!picture)
+                return TRUE;
+
+            ret =
+                _glamor_generate_trapezoid_with_shader(screen, picture, traps,
+                                                       ntrap, &bounds);
+
+            if (!ret)
+                FreePicture(picture, 0);
+        }
+    }
+#endif
+
+    if (!ret) {
+        DEBUGF("Fallback to sw rasterize of trapezoid\n");
+
+        picture = glamor_create_mask_picture(screen, dst, mask_format,
+                                             width, height, 0);
+        if (!picture)
+            return TRUE;
+
+        image = pixman_image_create_bits(picture->format,
+                                         width, height, NULL, stride);
+        if (!image) {
+            FreePicture(picture, 0);
+            return TRUE;
+        }
+
+        for (; ntrap; ntrap--, traps++)
+            pixman_rasterize_trapezoid(image,
+                                       (pixman_trapezoid_t *) traps,
+                                       -bounds.x1, -bounds.y1);
+
+        pixmap = glamor_get_drawable_pixmap(picture->pDrawable);
+
+        screen->ModifyPixmapHeader(pixmap, width, height,
+                                   mask_format->depth,
+                                   BitsPerPixel(mask_format->depth),
+                                   PixmapBytePad(width,
+                                                 mask_format->depth),
+                                   pixman_image_get_data(image));
+    }
+
+    x_rel = bounds.x1 + x_src - x_dst;
+    y_rel = bounds.y1 + y_src - y_dst;
+    DEBUGF("x_src = %d, y_src = %d, x_dst = %d, y_dst = %d, "
+           "x_rel = %d, y_rel = %d\n", x_src, y_src, x_dst,
+           y_dst, x_rel, y_rel);
+
+    CompositePicture(op, src, picture, dst,
+                     x_rel, y_rel,
+                     0, 0,
+                     bounds.x1, bounds.y1,
+                     bounds.x2 - bounds.x1, bounds.y2 - bounds.y1);
+
+    if (image)
+        pixman_image_unref(image);
+
+    FreePicture(picture, 0);
+    return TRUE;
+}
+
+void
+glamor_trapezoids(CARD8 op,
+                  PicturePtr src, PicturePtr dst,
+                  PictFormatPtr mask_format, INT16 x_src, INT16 y_src,
+                  int ntrap, xTrapezoid *traps)
+{
+    DEBUGF("x_src = %d, y_src = %d, ntrap = %d\n", x_src, y_src, ntrap);
+
+    _glamor_trapezoids(op, src, dst, mask_format, x_src,
+                       y_src, ntrap, traps, TRUE);
+}
+
+Bool
+glamor_trapezoids_nf(CARD8 op,
+                     PicturePtr src, PicturePtr dst,
+                     PictFormatPtr mask_format, INT16 x_src, INT16 y_src,
+                     int ntrap, xTrapezoid *traps)
+{
+    DEBUGF("x_src = %d, y_src = %d, ntrap = %d\n", x_src, y_src, ntrap);
+
+    return _glamor_trapezoids(op, src, dst, mask_format, x_src,
+                              y_src, ntrap, traps, FALSE);
+}
+
+#endif                          /* RENDER */
diff --git a/glamor/glamor_triangles.c b/glamor/glamor_triangles.c
new file mode 100644 (file)
index 0000000..b89cb2d
--- /dev/null
@@ -0,0 +1,74 @@
+/*
+ * Copyright Â© 2009 Intel Corporation
+ * Copyright Â© 1998 Keith Packard
+ *
+ * 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.
+ *
+ * Authors:
+ *    Zhigang Gong <zhigang.gong@gmail.com>
+ *
+ */
+
+#include "glamor_priv.h"
+
+static Bool
+_glamor_triangles(CARD8 op,
+                  PicturePtr pSrc,
+                  PicturePtr pDst,
+                  PictFormatPtr maskFormat,
+                  INT16 xSrc, INT16 ySrc, int ntris, xTriangle * tris,
+                  Bool fallback)
+{
+    if (!fallback && glamor_ddx_fallback_check_pixmap(pDst->pDrawable)
+        && (!pSrc->pDrawable
+            || glamor_ddx_fallback_check_pixmap(pSrc->pDrawable)))
+        return FALSE;
+
+    if (glamor_prepare_access_picture(pDst, GLAMOR_ACCESS_RW) &&
+        glamor_prepare_access_picture(pSrc, GLAMOR_ACCESS_RO)) {
+        fbTriangles(op, pSrc, pDst, maskFormat, xSrc, ySrc, ntris, tris);
+    }
+    glamor_finish_access_picture(pSrc);
+    glamor_finish_access_picture(pDst);
+
+    return TRUE;
+}
+
+void
+glamor_triangles(CARD8 op,
+                 PicturePtr pSrc,
+                 PicturePtr pDst,
+                 PictFormatPtr maskFormat,
+                 INT16 xSrc, INT16 ySrc, int ntris, xTriangle * tris)
+{
+    _glamor_triangles(op, pSrc, pDst, maskFormat,
+                      xSrc, ySrc, ntris, tris, TRUE);
+}
+
+Bool
+glamor_triangles_nf(CARD8 op,
+                    PicturePtr pSrc,
+                    PicturePtr pDst,
+                    PictFormatPtr maskFormat,
+                    INT16 xSrc, INT16 ySrc, int ntris, xTriangle * tris)
+{
+    return _glamor_triangles(op, pSrc, pDst, maskFormat,
+                             xSrc, ySrc, ntris, tris, FALSE);
+}
diff --git a/glamor/glamor_utils.h b/glamor/glamor_utils.h
new file mode 100644 (file)
index 0000000..4c1581e
--- /dev/null
@@ -0,0 +1,1510 @@
+/*
+ * Copyright Â© 2009 Intel 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.
+ *
+ * Authors:
+ *    Zhigang Gong <zhigang.gong@linux.intel.com>
+ *
+ */
+
+#ifndef GLAMOR_PRIV_H
+#error This file can only be included by glamor_priv.h
+#endif
+
+#ifndef __GLAMOR_UTILS_H__
+#define __GLAMOR_UTILS_H__
+
+#define v_from_x_coord_x(_xscale_, _x_)          ( 2 * (_x_) * (_xscale_) - 1.0)
+#define v_from_x_coord_y(_yscale_, _y_)          (-2 * (_y_) * (_yscale_) + 1.0)
+#define v_from_x_coord_y_inverted(_yscale_, _y_) (2 * (_y_) * (_yscale_) - 1.0)
+#define t_from_x_coord_x(_xscale_, _x_)          ((_x_) * (_xscale_))
+#define t_from_x_coord_y(_yscale_, _y_)          (1.0 - (_y_) * (_yscale_))
+#define t_from_x_coord_y_inverted(_yscale_, _y_) ((_y_) * (_yscale_))
+
+#define pixmap_priv_get_dest_scale(_pixmap_priv_, _pxscale_, _pyscale_)  \
+  do {                                                                   \
+    int _w_,_h_;                                                         \
+    PIXMAP_PRIV_GET_ACTUAL_SIZE(_pixmap_priv_, _w_, _h_);                \
+    *(_pxscale_) = 1.0 / _w_;                                            \
+    *(_pyscale_) = 1.0 / _h_;                                            \
+   } while(0)
+
+#define pixmap_priv_get_scale(_pixmap_priv_, _pxscale_, _pyscale_)     \
+   do {                                                                        \
+    *(_pxscale_) = 1.0 / (_pixmap_priv_)->base.fbo->width;                     \
+    *(_pyscale_) = 1.0 / (_pixmap_priv_)->base.fbo->height;                    \
+  } while(0)
+
+#define GLAMOR_PIXMAP_FBO_NOT_EXACT_SIZE(priv)                 \
+   (priv->base.fbo->width != priv->base.pixmap->drawable.width         \
+      || priv->base.fbo->height != priv->base.pixmap->drawable.height) \
+
+#define PIXMAP_PRIV_GET_ACTUAL_SIZE(priv, w, h)                        \
+  do {                                                         \
+       if (_X_UNLIKELY(priv->type == GLAMOR_TEXTURE_LARGE)) {  \
+               w = priv->large.box.x2 - priv->large.box.x1;    \
+               h = priv->large.box.y2 - priv->large.box.y1;    \
+       } else {                                                \
+               w = priv->base.pixmap->drawable.width;          \
+               h = priv->base.pixmap->drawable.height;         \
+       }                                                       \
+  } while(0)
+
+#define glamor_pixmap_fbo_fix_wh_ratio(wh, priv)               \
+  do {                                                         \
+       int actual_w, actual_h;                                 \
+       PIXMAP_PRIV_GET_ACTUAL_SIZE(priv, actual_w, actual_h);  \
+       wh[0] = (float)priv->base.fbo->width / actual_w;        \
+       wh[1] = (float)priv->base.fbo->height / actual_h;       \
+       wh[2] = 1.0 / priv->base.fbo->width;                    \
+       wh[3] = 1.0 / priv->base.fbo->height;                   \
+  } while(0)
+
+#define pixmap_priv_get_fbo_off(_priv_, _xoff_, _yoff_)                \
+   do {                                                                \
+       if (_X_UNLIKELY(_priv_ && (_priv_)->type == GLAMOR_TEXTURE_LARGE)) {  \
+               *(_xoff_) = - (_priv_)->large.box.x1;   \
+               *(_yoff_) = - (_priv_)->large.box.y1;   \
+       } else {                                                \
+               *(_xoff_) = 0;                                  \
+               *(_yoff_) = 0;                                  \
+       }                                                       \
+   } while(0)
+
+#define xFixedToFloat(_val_) ((float)xFixedToInt(_val_)                        \
+                             + ((float)xFixedFrac(_val_) / 65536.0))
+
+#define glamor_picture_get_matrixf(_picture_, _matrix_)                        \
+  do {                                                                 \
+    int _i_;                                                           \
+    if ((_picture_)->transform)                                                \
+      {                                                                        \
+       for(_i_ = 0; _i_ < 3; _i_++)                                    \
+         {                                                             \
+           (_matrix_)[_i_ * 3 + 0] =                                   \
+             xFixedToFloat((_picture_)->transform->matrix[_i_][0]);    \
+           (_matrix_)[_i_ * 3 + 1] =                                   \
+             xFixedToFloat((_picture_)->transform->matrix[_i_][1]);    \
+           (_matrix_)[_i_ * 3 + 2] = \
+             xFixedToFloat((_picture_)->transform->matrix[_i_][2]);    \
+         }                                                             \
+      }                                                                        \
+  }  while(0)
+
+#define fmod(x, w)             (x - w * floor((float)x/w))
+
+#define fmodulus(x, w, c)      do {c = fmod(x, w);             \
+                                   c = c >= 0 ? c : c + w;}    \
+                               while(0)
+/* @x: is current coord
+ * @x2: is the right/bottom edge
+ * @w: is current width or height
+ * @odd: is output value, 0 means we are in an even region, 1 means we are in a
+ * odd region.
+ * @c: is output value, equal to x mod w. */
+#define fodd_repeat_mod(x, x2, w, odd, c)      \
+  do {                                         \
+       float shift;                            \
+       fmodulus((x), w, c);                    \
+       shift = fabs((x) - (c));                \
+       shift = floor(fabs(round(shift)) / w);  \
+       odd = (int)shift & 1;                   \
+       if (odd && (((x2 % w) == 0) &&          \
+           round(fabs(x)) == x2))              \
+               odd = 0;                        \
+  } while(0)
+
+/* @txy: output value, is the corrected coords.
+ * @xy: input coords to be fixed up.
+ * @cd: xy mod wh, is a input value.
+ * @wh: current width or height.
+ * @bxy1,bxy2: current box edge's x1/x2 or y1/y2
+ *
+ * case 1:
+ *  ----------
+ *  |  *     |
+ *  |        |
+ *  ----------
+ *  tx = (c - x1) mod w
+ *
+ *  case 2:
+ *     ---------
+ *  *  |       |
+ *     |       |
+ *     ---------
+ *   tx = - (c - (x1 mod w))
+ *
+ *   case 3:
+ *
+ *   ----------
+ *   |        |  *
+ *   |        |
+ *   ----------
+ *   tx = ((x2 mod x) - c) + (x2 - x1)
+ **/
+#define __glamor_repeat_reflect_fixup(txy, xy,         \
+                               cd, wh, bxy1, bxy2)     \
+  do {                                                 \
+       cd = wh - cd;                                   \
+       if ( xy >= bxy1 && xy < bxy2) {                 \
+               cd = cd - bxy1;                         \
+               fmodulus(cd, wh, txy);                  \
+       } else  if (xy < bxy1) {                        \
+               float bxy1_mod;                         \
+               fmodulus(bxy1, wh, bxy1_mod);           \
+               txy = -(cd - bxy1_mod);                 \
+       }                                               \
+       else if (xy >= bxy2)    {                       \
+               float bxy2_mod;                         \
+               fmodulus(bxy2, wh, bxy2_mod);           \
+               if (bxy2_mod == 0)                      \
+                       bxy2_mod = wh;                  \
+               txy = (bxy2_mod - cd) + bxy2 - bxy1;    \
+       } else {assert(0); txy = 0;}                    \
+  } while(0)
+
+#define _glamor_repeat_reflect_fixup(txy, xy, cd, odd, \
+                                    wh, bxy1, bxy2)    \
+  do {                                                 \
+       if (odd) {                                      \
+               __glamor_repeat_reflect_fixup(txy, xy,  \
+                       cd, wh, bxy1, bxy2);            \
+       } else                                          \
+               txy = xy - bxy1;                        \
+  } while(0)
+
+#define _glamor_get_reflect_transform_coords(priv, repeat_type,        \
+                                           tx1, ty1,           \
+                                           _x1_, _y1_)         \
+  do {                                                         \
+       int odd_x, odd_y;                                       \
+       float c, d;                                             \
+       fodd_repeat_mod(_x1_,priv->box.x2,                      \
+                   priv->base.pixmap->drawable.width,          \
+                   odd_x, c);                                  \
+       fodd_repeat_mod(_y1_,   priv->box.y2,                   \
+                   priv->base.pixmap->drawable.height,         \
+                   odd_y, d);                                  \
+       DEBUGF("c %f d %f oddx %d oddy %d \n",                  \
+               c, d, odd_x, odd_y);                            \
+       DEBUGF("x2 %d x1 %d fbo->width %d \n", priv->box.x2,    \
+               priv->box.x1, priv->base.fbo->width);           \
+       DEBUGF("y2 %d y1 %d fbo->height %d \n", priv->box.y2,   \
+               priv->box.y1, priv->base.fbo->height);          \
+       _glamor_repeat_reflect_fixup(tx1, _x1_, c, odd_x,       \
+               priv->base.pixmap->drawable.width,              \
+               priv->box.x1, priv->box.x2);                    \
+       _glamor_repeat_reflect_fixup(ty1, _y1_, d, odd_y,       \
+               priv->base.pixmap->drawable.height,             \
+               priv->box.y1, priv->box.y2);                    \
+   } while(0)
+
+#define _glamor_get_repeat_coords(priv, repeat_type, tx1,      \
+                                 ty1, tx2, ty2,                \
+                                 _x1_, _y1_, _x2_,             \
+                                 _y2_, c, d, odd_x, odd_y)     \
+  do {                                                         \
+       if (repeat_type == RepeatReflect) {                     \
+               DEBUGF("x1 y1 %d %d\n",                         \
+                       _x1_, _y1_ );                           \
+               DEBUGF("width %d box.x1 %d \n",                 \
+                      (priv)->base.pixmap->drawable.width,     \
+                      priv->box.x1);                           \
+               if (odd_x) {                                    \
+                       c = (priv)->base.pixmap->drawable.width \
+                               - c;                            \
+                       tx1 = c - priv->box.x1;                 \
+                       tx2 = tx1 - ((_x2_) - (_x1_));          \
+               } else {                                        \
+                       tx1 = c - priv->box.x1;                 \
+                       tx2 = tx1 + ((_x2_) - (_x1_));          \
+               }                                               \
+               if (odd_y){                                     \
+                       d = (priv)->base.pixmap->drawable.height\
+                           - d;                                \
+                       ty1 = d - priv->box.y1;                 \
+                       ty2 = ty1 - ((_y2_) - (_y1_));          \
+               } else {                                        \
+                       ty1 = d - priv->box.y1;                 \
+                       ty2 = ty1 + ((_y2_) - (_y1_));          \
+               }                                               \
+       } else { /* RepeatNormal*/                              \
+               tx1 = (c - priv->box.x1);                       \
+               ty1 = (d - priv->box.y1);                       \
+               tx2 = tx1 + ((_x2_) - (_x1_));                  \
+               ty2 = ty1 + ((_y2_) - (_y1_));                  \
+       }                                                       \
+   } while(0)
+
+/* _x1_ ... _y2_ may has fractional. */
+#define glamor_get_repeat_transform_coords(priv, repeat_type, tx1,     \
+                                          ty1, _x1_, _y1_)             \
+  do {                                                                 \
+       DEBUGF("width %d box.x1 %d x2 %d y1 %d y2 %d\n",                \
+               (priv)->base.pixmap->drawable.width,                    \
+               priv->box.x1, priv->box.x2, priv->box.y1,               \
+               priv->box.y2);                                          \
+       DEBUGF("x1 %f y1 %f \n", _x1_, _y1_);                           \
+       if (repeat_type != RepeatReflect) {                             \
+               tx1 = _x1_ - priv->box.x1;                              \
+               ty1 = _y1_ - priv->box.y1;                              \
+       } else                  \
+               _glamor_get_reflect_transform_coords(priv, repeat_type, \
+                                 tx1, ty1,                             \
+                                 _x1_, _y1_);                          \
+       DEBUGF("tx1 %f ty1 %f \n", tx1, ty1);                           \
+   } while(0)
+
+/* _x1_ ... _y2_ must be integer. */
+#define glamor_get_repeat_coords(priv, repeat_type, tx1,               \
+                                ty1, tx2, ty2, _x1_, _y1_, _x2_,       \
+                                _y2_)                                  \
+  do {                                                                 \
+       int c, d;                                                       \
+       int odd_x = 0, odd_y = 0;                                       \
+       DEBUGF("width %d box.x1 %d x2 %d y1 %d y2 %d\n",                \
+               (priv)->base.pixmap->drawable.width,                    \
+               priv->box.x1, priv->box.x2,                             \
+               priv->box.y1, priv->box.y2);                            \
+       modulus((_x1_), (priv)->base.pixmap->drawable.width, c);        \
+       modulus((_y1_), (priv)->base.pixmap->drawable.height, d);       \
+       DEBUGF("c %d d %d \n", c, d);                                   \
+       if (repeat_type == RepeatReflect) {                             \
+               odd_x = abs((_x1_ - c)                                  \
+                       / (priv->base.pixmap->drawable.width)) & 1;     \
+               odd_y = abs((_y1_ - d)                                  \
+                       / (priv->base.pixmap->drawable.height)) & 1;    \
+       }                                                               \
+       _glamor_get_repeat_coords(priv, repeat_type, tx1, ty1, tx2, ty2,\
+                                 _x1_, _y1_, _x2_, _y2_, c, d,         \
+                                 odd_x, odd_y);                        \
+   } while(0)
+
+#define glamor_transform_point(matrix, tx, ty, x, y)                   \
+  do {                                                                 \
+    int _i_;                                                           \
+    float _result_[4];                                                 \
+    for (_i_ = 0; _i_ < 3; _i_++) {                                    \
+      _result_[_i_] = (matrix)[_i_ * 3] * (x) + (matrix)[_i_ * 3 + 1] * (y)    \
+       + (matrix)[_i_ * 3 + 2];                                        \
+    }                                                                  \
+    tx = _result_[0] / _result_[2];                                    \
+    ty = _result_[1] / _result_[2];                                    \
+  } while(0)
+
+#define _glamor_set_normalize_tpoint(xscale, yscale, _tx_, _ty_,       \
+                                    texcoord, yInverted)               \
+  do {                                                                 \
+       (texcoord)[0] = t_from_x_coord_x(xscale, _tx_);                 \
+       if (_X_LIKELY(yInverted))                                       \
+               (texcoord)[1] = t_from_x_coord_y_inverted(yscale, _ty_);\
+       else                                                            \
+               (texcoord)[1] = t_from_x_coord_y(yscale, _ty_);         \
+        DEBUGF("normalized point tx %f ty %f \n", (texcoord)[0],       \
+               (texcoord)[1]);                                         \
+  } while(0)
+
+#define glamor_set_transformed_point(priv, matrix, xscale,             \
+                                    yscale, texcoord,                  \
+                                     x, y,                             \
+                                    yInverted)                         \
+  do {                                                                 \
+    float tx, ty;                                                      \
+    int fbo_x_off, fbo_y_off;                                          \
+    pixmap_priv_get_fbo_off(priv, &fbo_x_off, &fbo_y_off);             \
+    glamor_transform_point(matrix, tx, ty, x, y);                      \
+    DEBUGF("tx %f ty %f fbooff %d %d \n",                              \
+           tx, ty, fbo_x_off, fbo_y_off);                              \
+                                                                       \
+    tx += fbo_x_off;                                                   \
+    ty += fbo_y_off;                                                   \
+    (texcoord)[0] = t_from_x_coord_x(xscale, tx);                      \
+    if (_X_LIKELY(yInverted))                                          \
+      (texcoord)[1] = t_from_x_coord_y_inverted(yscale, ty);           \
+    else                                                               \
+      (texcoord)[1] = t_from_x_coord_y(yscale, ty);                    \
+    DEBUGF("normalized tx %f ty %f \n", (texcoord)[0], (texcoord)[1]); \
+  } while(0)
+
+#define glamor_set_transformed_normalize_tri_tcoords(priv,             \
+                                                    matrix,            \
+                                                    xscale,            \
+                                                    yscale,            \
+                                                    vtx,               \
+                                                    yInverted,         \
+                                                    texcoords)         \
+    do {                                                               \
+       glamor_set_transformed_point(priv, matrix, xscale, yscale,      \
+                                    texcoords, (vtx)[0], (vtx)[1],     \
+                                    yInverted);                        \
+       glamor_set_transformed_point(priv, matrix, xscale, yscale,      \
+                                    texcoords+2, (vtx)[2], (vtx)[3],   \
+                                    yInverted);                        \
+       glamor_set_transformed_point(priv, matrix, xscale, yscale,      \
+                                    texcoords+4, (vtx)[4], (vtx)[5],   \
+                                    yInverted);                        \
+    } while (0)
+
+#define glamor_set_transformed_normalize_tcoords_ext( priv,            \
+                                                 matrix,               \
+                                                 xscale,               \
+                                                 yscale,               \
+                                                  tx1, ty1, tx2, ty2,   \
+                                                  yInverted, texcoords,        \
+                                                 stride)               \
+  do {                                                                 \
+    glamor_set_transformed_point(priv, matrix, xscale, yscale,         \
+                                texcoords, tx1, ty1,                   \
+                                yInverted);                            \
+    glamor_set_transformed_point(priv, matrix, xscale, yscale,         \
+                                texcoords + 1 * stride, tx2, ty1,      \
+                                yInverted);                            \
+    glamor_set_transformed_point(priv, matrix, xscale, yscale,         \
+                                texcoords + 2 * stride, tx2, ty2,      \
+                                yInverted);                            \
+    glamor_set_transformed_point(priv, matrix, xscale, yscale,         \
+                                texcoords + 3 * stride, tx1, ty2,      \
+                                yInverted);                            \
+  } while (0)
+
+#define glamor_set_transformed_normalize_tcoords( priv,                        \
+                                                 matrix,               \
+                                                 xscale,               \
+                                                 yscale,               \
+                                                  tx1, ty1, tx2, ty2,   \
+                                                  yInverted, texcoords)        \
+  do {                                                                 \
+       glamor_set_transformed_normalize_tcoords_ext( priv,             \
+                                                 matrix,               \
+                                                 xscale,               \
+                                                 yscale,               \
+                                                  tx1, ty1, tx2, ty2,   \
+                                                  yInverted, texcoords,        \
+                                                 2);                   \
+  } while (0)
+
+#define glamor_set_normalize_tri_tcoords(xscale,               \
+                                        yscale,                \
+                                        vtx,                   \
+                                        yInverted,             \
+                                        texcoords)             \
+    do {                                                       \
+       _glamor_set_normalize_tpoint(xscale, yscale,            \
+                               (vtx)[0], (vtx)[1],             \
+                               texcoords,                      \
+                               yInverted);                     \
+       _glamor_set_normalize_tpoint(xscale, yscale,            \
+                               (vtx)[2], (vtx)[3],             \
+                               texcoords+2,                    \
+                               yInverted);                     \
+       _glamor_set_normalize_tpoint(xscale, yscale,            \
+                               (vtx)[4], (vtx)[5],             \
+                               texcoords+4,                    \
+                               yInverted);                     \
+    } while (0)
+
+#define glamor_set_repeat_transformed_normalize_tcoords_ext( priv,     \
+                                                        repeat_type,   \
+                                                        matrix,        \
+                                                        xscale,        \
+                                                        yscale,        \
+                                                        _x1_, _y1_,    \
+                                                        _x2_, _y2_,    \
+                                                        yInverted,     \
+                                                        texcoords,     \
+                                                        stride)        \
+  do {                                                                 \
+    if (_X_LIKELY(priv->type != GLAMOR_TEXTURE_LARGE)) {               \
+       glamor_set_transformed_normalize_tcoords_ext(priv, matrix, xscale,      \
+                                                yscale, _x1_, _y1_,    \
+                                                _x2_, _y2_, yInverted, \
+                                                texcoords, stride);    \
+    } else {                                                           \
+    float tx1, ty1, tx2, ty2, tx3, ty3, tx4, ty4;                      \
+    float ttx1, tty1, ttx2, tty2, ttx3, tty3, ttx4, tty4;              \
+    DEBUGF("original coords %d %d %d %d\n", _x1_, _y1_, _x2_, _y2_);   \
+    glamor_transform_point(matrix, tx1, ty1, _x1_, _y1_);              \
+    glamor_transform_point(matrix, tx2, ty2, _x2_, _y1_);              \
+    glamor_transform_point(matrix, tx3, ty3, _x2_, _y2_);              \
+    glamor_transform_point(matrix, tx4, ty4, _x1_, _y2_);              \
+    DEBUGF("transformed %f %f %f %f %f %f %f %f\n",                    \
+          tx1, ty1, tx2, ty2, tx3, ty3, tx4, ty4);                     \
+    glamor_get_repeat_transform_coords((&priv->large), repeat_type,    \
+                                      ttx1, tty1,                      \
+                                      tx1, ty1);                       \
+    glamor_get_repeat_transform_coords((&priv->large), repeat_type,    \
+                                      ttx2, tty2,                      \
+                                      tx2, ty2);                       \
+    glamor_get_repeat_transform_coords((&priv->large), repeat_type,    \
+                                      ttx3, tty3,                      \
+                                      tx3, ty3);                       \
+    glamor_get_repeat_transform_coords((&priv->large), repeat_type,    \
+                                      ttx4, tty4,                      \
+                                      tx4, ty4);                       \
+    DEBUGF("repeat transformed %f %f %f %f %f %f %f %f\n", ttx1, tty1,         \
+           ttx2, tty2, ttx3, tty3, ttx4, tty4);                        \
+    _glamor_set_normalize_tpoint(xscale, yscale, ttx1, tty1,           \
+                                texcoords, yInverted);                 \
+    _glamor_set_normalize_tpoint(xscale, yscale, ttx2, tty2,           \
+                                texcoords + 1 * stride, yInverted);    \
+    _glamor_set_normalize_tpoint(xscale, yscale, ttx3, tty3,           \
+                                texcoords + 2 * stride, yInverted);    \
+    _glamor_set_normalize_tpoint(xscale, yscale, ttx4, tty4,           \
+                                texcoords + 3 * stride, yInverted);    \
+   }                                                                   \
+  } while (0)
+
+#define glamor_set_repeat_transformed_normalize_tcoords( priv,         \
+                                                        repeat_type,   \
+                                                        matrix,        \
+                                                        xscale,        \
+                                                        yscale,        \
+                                                        _x1_, _y1_,    \
+                                                        _x2_, _y2_,    \
+                                                        yInverted,     \
+                                                        texcoords)     \
+  do {                                                                 \
+       glamor_set_repeat_transformed_normalize_tcoords_ext( priv,      \
+                                                        repeat_type,   \
+                                                        matrix,        \
+                                                        xscale,        \
+                                                        yscale,        \
+                                                        _x1_, _y1_,    \
+                                                        _x2_, _y2_,    \
+                                                        yInverted,     \
+                                                        texcoords,     \
+                                                        2);    \
+  } while (0)
+
+#define _glamor_set_normalize_tcoords(xscale, yscale, tx1,             \
+                                     ty1, tx2, ty2,                    \
+                                     yInverted, vertices, stride)      \
+  do {                                                                 \
+    /* vertices may be write-only, so we use following                 \
+     * temporary variable. */                                          \
+    float _t0_, _t1_, _t2_, _t5_;                                      \
+    (vertices)[0] = _t0_ = t_from_x_coord_x(xscale, tx1);              \
+    (vertices)[1 * stride] = _t2_ = t_from_x_coord_x(xscale, tx2);     \
+    (vertices)[2 * stride] = _t2_;                                     \
+    (vertices)[3 * stride] = _t0_;                                     \
+    if (_X_LIKELY(yInverted)) {                                                \
+      (vertices)[1] = _t1_ = t_from_x_coord_y_inverted(yscale, ty1);   \
+      (vertices)[2 * stride + 1] = _t5_ = t_from_x_coord_y_inverted(yscale, ty2);\
+    }                                                                  \
+    else {                                                             \
+      (vertices)[1] = _t1_ = t_from_x_coord_y(yscale, ty1);            \
+      (vertices)[2 * stride + 1] = _t5_ = t_from_x_coord_y(yscale, ty2);\
+    }                                                                  \
+    (vertices)[1 * stride + 1] = _t1_;                                 \
+    (vertices)[3 * stride + 1] = _t5_;                                 \
+  } while(0)
+
+#define glamor_set_normalize_tcoords_ext(priv, xscale, yscale,         \
+                                    x1, y1, x2, y2,                    \
+                                     yInverted, vertices, stride)      \
+  do {                                                                 \
+     if (_X_UNLIKELY(priv->type == GLAMOR_TEXTURE_LARGE)) {            \
+       float tx1, tx2, ty1, ty2;                                       \
+       int fbo_x_off, fbo_y_off;                                       \
+       pixmap_priv_get_fbo_off(priv, &fbo_x_off, &fbo_y_off);          \
+       tx1 = x1 + fbo_x_off;                                           \
+       tx2 = x2 + fbo_x_off;                                           \
+       ty1 = y1 + fbo_y_off;                                           \
+       ty2 = y2 + fbo_y_off;                                           \
+       _glamor_set_normalize_tcoords(xscale, yscale, tx1, ty1,         \
+                                  tx2, ty2, yInverted, vertices,       \
+                                  stride);                             \
+     } else                                                            \
+       _glamor_set_normalize_tcoords(xscale, yscale, x1, y1,           \
+                                  x2, y2, yInverted, vertices, stride);\
+ } while(0)
+
+#define glamor_set_normalize_tcoords(priv, xscale, yscale,             \
+                                    x1, y1, x2, y2,                    \
+                                     yInverted, vertices)              \
+  do {                                                                 \
+       glamor_set_normalize_tcoords_ext(priv, xscale, yscale,          \
+                                    x1, y1, x2, y2,                    \
+                                     yInverted, vertices, 2);          \
+ } while(0)
+
+#define glamor_set_repeat_normalize_tcoords_ext(priv, repeat_type,     \
+                                           xscale, yscale,             \
+                                           _x1_, _y1_, _x2_, _y2_,     \
+                                           yInverted, vertices, stride)\
+  do {                                                                 \
+     if (_X_UNLIKELY(priv->type == GLAMOR_TEXTURE_LARGE)) {            \
+       float tx1, tx2, ty1, ty2;                                       \
+       if (repeat_type == RepeatPad) {                                 \
+               tx1 = _x1_ - priv->large.box.x1;                        \
+               ty1 = _y1_ - priv->large.box.y1;                        \
+               tx2 = tx1 + ((_x2_) - (_x1_));                          \
+               ty2 = ty1 + ((_y2_) - (_y1_));                          \
+       } else {                                                        \
+       glamor_get_repeat_coords((&priv->large), repeat_type,           \
+                                tx1, ty1, tx2, ty2,                    \
+                                _x1_, _y1_, _x2_, _y2_);               \
+       }                                                               \
+       _glamor_set_normalize_tcoords(xscale, yscale, tx1, ty1,         \
+                                  tx2, ty2, yInverted, vertices,       \
+                                  stride);                             \
+     } else                                                            \
+       _glamor_set_normalize_tcoords(xscale, yscale, _x1_, _y1_,       \
+                                  _x2_, _y2_, yInverted, vertices,     \
+                                  stride);                             \
+ } while(0)
+
+#define glamor_set_repeat_normalize_tcoords(priv, repeat_type,         \
+                                           xscale, yscale,             \
+                                           _x1_, _y1_, _x2_, _y2_,     \
+                                           yInverted, vertices)        \
+  do {                                                                 \
+       glamor_set_repeat_normalize_tcoords_ext(priv, repeat_type,      \
+                                           xscale, yscale,             \
+                                           _x1_, _y1_, _x2_, _y2_,     \
+                                           yInverted, vertices, 2);    \
+ } while(0)
+
+#define glamor_set_normalize_tcoords_tri_stripe(xscale, yscale,                \
+                                               x1, y1, x2, y2,         \
+                                               yInverted, vertices)    \
+    do {                                                               \
+       (vertices)[0] = t_from_x_coord_x(xscale, x1);                   \
+       (vertices)[2] = t_from_x_coord_x(xscale, x2);                   \
+       (vertices)[6] = (vertices)[2];                                  \
+       (vertices)[4] = (vertices)[0];                                  \
+       if (_X_LIKELY(yInverted)) {                                     \
+           (vertices)[1] = t_from_x_coord_y_inverted(yscale, y1);      \
+           (vertices)[7] = t_from_x_coord_y_inverted(yscale, y2);      \
+       }                                                               \
+       else {                                                          \
+           (vertices)[1] = t_from_x_coord_y(yscale, y1);               \
+           (vertices)[7] = t_from_x_coord_y(yscale, y2);               \
+       }                                                               \
+       (vertices)[3] = (vertices)[1];                                  \
+       (vertices)[5] = (vertices)[7];                                  \
+    } while(0)
+
+#define glamor_set_tcoords(width, height, x1, y1, x2, y2,      \
+                          yInverted, vertices)                 \
+    do {                                                       \
+       (vertices)[0] = (x1);                                   \
+       (vertices)[2] = (x2);                                   \
+       (vertices)[4] = (vertices)[2];                          \
+       (vertices)[6] = (vertices)[0];                          \
+       if (_X_LIKELY(yInverted)) {                             \
+           (vertices)[1] = (y1);                               \
+           (vertices)[5] = (y2);                               \
+       }                                                       \
+       else {                                                  \
+           (vertices)[1] = height - (y2);                      \
+           (vertices)[5] = height - (y1);                      \
+       }                                                       \
+       (vertices)[3] = (vertices)[1];                          \
+       (vertices)[7] = (vertices)[5];                          \
+    } while(0)
+
+#define glamor_set_tcoords_ext(width, height, x1, y1, x2, y2,  \
+                              yInverted, vertices, stride)     \
+    do {                                                       \
+       (vertices)[0] = (x1);                                   \
+       (vertices)[1*stride] = (x2);                            \
+       (vertices)[2*stride] = (vertices)[1*stride];            \
+       (vertices)[3*stride] = (vertices)[0];                   \
+       if (_X_LIKELY(yInverted)) {                             \
+           (vertices)[1] = (y1);                               \
+           (vertices)[2*stride + 1] = (y2);                    \
+       }                                                       \
+       else {                                                  \
+           (vertices)[1] = height - (y2);                      \
+           (vertices)[2*stride + 1] = height - (y1);           \
+       }                                                       \
+       (vertices)[1*stride + 1] = (vertices)[1];               \
+       (vertices)[3*stride + 1] = (vertices)[2*stride + 1];    \
+    } while(0)
+
+#define glamor_set_normalize_one_vcoord(xscale, yscale, x, y,          \
+                                       yInverted, vertices)            \
+    do {                                                               \
+       (vertices)[0] = v_from_x_coord_x(xscale, x);                    \
+       if (_X_LIKELY(yInverted)) {                                     \
+           (vertices)[1] = v_from_x_coord_y_inverted(yscale, y);       \
+       } else {                                                        \
+           (vertices)[1] = v_from_x_coord_y(yscale, y);                \
+       }                                                               \
+    } while(0)
+
+#define glamor_set_normalize_tri_vcoords(xscale, yscale, vtx,          \
+                                        yInverted, vertices)           \
+    do {                                                               \
+       glamor_set_normalize_one_vcoord(xscale, yscale,                 \
+                                       (vtx)[0], (vtx)[1],             \
+                                       yInverted, vertices);           \
+       glamor_set_normalize_one_vcoord(xscale, yscale,                 \
+                                       (vtx)[2], (vtx)[3],             \
+                                       yInverted, vertices+2);         \
+       glamor_set_normalize_one_vcoord(xscale, yscale,                 \
+                                       (vtx)[4], (vtx)[5],             \
+                                       yInverted, vertices+4);         \
+    } while(0)
+
+#define glamor_set_tcoords_tri_strip(width, height, x1, y1, x2, y2,    \
+                                    yInverted, vertices)               \
+    do {                                                               \
+       (vertices)[0] = (x1);                                           \
+       (vertices)[2] = (x2);                                           \
+       (vertices)[6] = (vertices)[2];                                  \
+       (vertices)[4] = (vertices)[0];                                  \
+       if (_X_LIKELY(yInverted)) {                                     \
+           (vertices)[1] = (y1);                                       \
+           (vertices)[7] = (y2);                                       \
+       }                                                               \
+       else {                                                          \
+           (vertices)[1] = height - (y2);                              \
+           (vertices)[7] = height - (y1);                              \
+       }                                                               \
+       (vertices)[3] = (vertices)[1];                                  \
+       (vertices)[5] = (vertices)[7];                                  \
+    } while(0)
+
+#define glamor_set_normalize_vcoords_ext(priv, xscale, yscale,         \
+                                    x1, y1, x2, y2,                    \
+                                     yInverted, vertices, stride)      \
+  do {                                                                 \
+    int fbo_x_off, fbo_y_off;                                          \
+    /* vertices may be write-only, so we use following                 \
+     * temporary variable. */                                          \
+    float _t0_, _t1_, _t2_, _t5_;                                      \
+    pixmap_priv_get_fbo_off(priv, &fbo_x_off, &fbo_y_off);             \
+    (vertices)[0] = _t0_ = v_from_x_coord_x(xscale, x1 + fbo_x_off);   \
+    (vertices)[1 * stride] = _t2_ = v_from_x_coord_x(xscale,           \
+                                       x2 + fbo_x_off);                \
+    (vertices)[2 * stride] = _t2_;                                     \
+    (vertices)[3 * stride] = _t0_;                                     \
+    if (_X_LIKELY(yInverted)) {                                                \
+      (vertices)[1] = _t1_ = v_from_x_coord_y_inverted(yscale,         \
+                               y1 + fbo_y_off);                        \
+      (vertices)[2 * stride + 1] = _t5_ =                              \
+                       v_from_x_coord_y_inverted(yscale,               \
+                                       y2 + fbo_y_off);                \
+    }                                                                  \
+    else {                                                             \
+      (vertices)[1] = _t1_ = v_from_x_coord_y(yscale, y1 + fbo_y_off); \
+      (vertices)[2 * stride + 1] = _t5_ = v_from_x_coord_y(yscale,     \
+                                       y2 + fbo_y_off);                \
+    }                                                                  \
+    (vertices)[1 * stride + 1] = _t1_;                                 \
+    (vertices)[3 * stride + 1] = _t5_;                                 \
+  } while(0)
+
+#define glamor_set_normalize_vcoords(priv, xscale, yscale,             \
+                                    x1, y1, x2, y2,                    \
+                                     yInverted, vertices)              \
+  do {                                                                 \
+       glamor_set_normalize_vcoords_ext(priv, xscale, yscale,          \
+                                    x1, y1, x2, y2,                    \
+                                     yInverted, vertices, 2);          \
+  } while(0)
+
+#define glamor_set_const_ext(params, nparam, vertices, nverts, stride) \
+    do {                                                               \
+       int _i_ = 0, _j_ = 0;                                           \
+       for(; _i_ < nverts; _i_++) {                                    \
+           for(_j_ = 0; _j_ < nparam; _j_++) {                         \
+               vertices[stride*_i_ + _j_] = params[_j_];               \
+           }                                                           \
+       }                                                               \
+    } while(0)
+
+#define glamor_set_normalize_vcoords_tri_strip(xscale, yscale,         \
+                                              x1, y1, x2, y2,          \
+                                              yInverted, vertices)     \
+    do {                                                               \
+       (vertices)[0] = v_from_x_coord_x(xscale, x1);                   \
+       (vertices)[2] = v_from_x_coord_x(xscale, x2);                   \
+       (vertices)[6] = (vertices)[2];                                  \
+       (vertices)[4] = (vertices)[0];                                  \
+       if (_X_LIKELY(yInverted)) {                                     \
+           (vertices)[1] = v_from_x_coord_y_inverted(yscale, y1);      \
+           (vertices)[7] = v_from_x_coord_y_inverted(yscale, y2);      \
+       }                                                               \
+       else {                                                          \
+           (vertices)[1] = v_from_x_coord_y(yscale, y1);               \
+           (vertices)[7] = v_from_x_coord_y(yscale, y2);               \
+       }                                                               \
+       (vertices)[3] = (vertices)[1];                                  \
+       (vertices)[5] = (vertices)[7];                                  \
+    } while(0)
+
+#define glamor_set_normalize_pt(xscale, yscale, x, y,          \
+                                yInverted, pt)                 \
+    do {                                                       \
+        (pt)[0] = t_from_x_coord_x(xscale, x);                 \
+        if (_X_LIKELY(yInverted)) {                            \
+            (pt)[1] = t_from_x_coord_y_inverted(yscale, y);    \
+        } else {                                               \
+            (pt)[1] = t_from_x_coord_y(yscale, y);             \
+        }                                                      \
+    } while(0)
+
+#define glamor_set_circle_centre(width, height, x, y,  \
+                                yInverted, c)          \
+    do {                                               \
+        (c)[0] = (float)x;                             \
+        if (_X_LIKELY(yInverted)) {                    \
+            (c)[1] = (float)y;                         \
+        } else {                                       \
+            (c)[1] = (float)height - (float)y;         \
+        }                                              \
+    } while(0)
+
+inline static void
+glamor_calculate_boxes_bound(BoxPtr bound, BoxPtr boxes, int nbox)
+{
+    int x_min, y_min;
+    int x_max, y_max;
+    int i;
+
+    x_min = y_min = MAXSHORT;
+    x_max = y_max = MINSHORT;
+    for (i = 0; i < nbox; i++) {
+        if (x_min > boxes[i].x1)
+            x_min = boxes[i].x1;
+        if (y_min > boxes[i].y1)
+            y_min = boxes[i].y1;
+
+        if (x_max < boxes[i].x2)
+            x_max = boxes[i].x2;
+        if (y_max < boxes[i].y2)
+            y_max = boxes[i].y2;
+    }
+    bound->x1 = x_min;
+    bound->y1 = y_min;
+    bound->x2 = x_max;
+    bound->y2 = y_max;
+}
+
+inline static void
+glamor_translate_boxes(BoxPtr boxes, int nbox, int dx, int dy)
+{
+    int i;
+
+    for (i = 0; i < nbox; i++) {
+        boxes[i].x1 += dx;
+        boxes[i].y1 += dy;
+        boxes[i].x2 += dx;
+        boxes[i].y2 += dy;
+    }
+}
+
+#ifndef ARRAY_SIZE
+#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
+#endif
+
+#define ALIGN(i,m)     (((i) + (m) - 1) & ~((m) - 1))
+#define MIN(a,b)       ((a) < (b) ? (a) : (b))
+#define MAX(a,b)       ((a) > (b) ? (a) : (b))
+
+#define glamor_check_fbo_size(_glamor_,_w_, _h_)    ((_w_) > 0 && (_h_) > 0 \
+                                                    && (_w_) <= _glamor_->max_fbo_size  \
+                                                    && (_h_) <= _glamor_->max_fbo_size)
+
+/* For 1bpp pixmap, we don't store it as texture. */
+#define glamor_check_pixmap_fbo_depth(_depth_) (                       \
+                                               _depth_ == 8            \
+                                               || _depth_ == 15        \
+                                               || _depth_ == 16        \
+                                               || _depth_ == 24        \
+                                               || _depth_ == 30        \
+                                               || _depth_ == 32)
+
+#define GLAMOR_PIXMAP_PRIV_IS_PICTURE(pixmap_priv) (pixmap_priv && pixmap_priv->base.is_picture == 1)
+#define GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv)    (pixmap_priv && pixmap_priv->base.gl_fbo == GLAMOR_FBO_NORMAL)
+#define GLAMOR_PIXMAP_PRIV_HAS_FBO_DOWNLOADED(pixmap_priv)    (pixmap_priv && (pixmap_priv->base.gl_fbo == GLAMOR_FBO_DOWNLOADED))
+
+/**
+ * Borrow from uxa.
+ */
+static inline CARD32
+format_for_depth(int depth)
+{
+    switch (depth) {
+    case 1:
+        return PICT_a1;
+    case 4:
+        return PICT_a4;
+    case 8:
+        return PICT_a8;
+    case 15:
+        return PICT_x1r5g5b5;
+    case 16:
+        return PICT_r5g6b5;
+    default:
+    case 24:
+        return PICT_x8r8g8b8;
+#if XORG_VERSION_CURRENT >= 10699900
+    case 30:
+        return PICT_x2r10g10b10;
+#endif
+    case 32:
+        return PICT_a8r8g8b8;
+    }
+}
+
+static inline GLenum
+gl_iformat_for_pixmap(PixmapPtr pixmap)
+{
+    glamor_screen_private *glamor_priv =
+        glamor_get_screen_private(pixmap->drawable.pScreen);
+
+    if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP &&
+        (pixmap->drawable.depth == 1 || pixmap->drawable.depth == 8)) {
+        return GL_ALPHA;
+    } else {
+        return GL_RGBA;
+    }
+}
+
+static inline CARD32
+format_for_pixmap(PixmapPtr pixmap)
+{
+    glamor_pixmap_private *pixmap_priv;
+    PictFormatShort pict_format;
+
+    pixmap_priv = glamor_get_pixmap_private(pixmap);
+    if (GLAMOR_PIXMAP_PRIV_IS_PICTURE(pixmap_priv))
+        pict_format = pixmap_priv->base.picture->format;
+    else
+        pict_format = format_for_depth(pixmap->drawable.depth);
+
+    return pict_format;
+}
+
+#define REVERT_NONE                    0
+#define REVERT_NORMAL                  1
+#define REVERT_DOWNLOADING_A1          2
+#define REVERT_UPLOADING_A1            3
+#define REVERT_DOWNLOADING_2_10_10_10  4
+#define REVERT_UPLOADING_2_10_10_10    5
+#define REVERT_DOWNLOADING_1_5_5_5     7
+#define REVERT_UPLOADING_1_5_5_5       8
+#define REVERT_DOWNLOADING_10_10_10_2  9
+#define REVERT_UPLOADING_10_10_10_2    10
+
+#define SWAP_NONE_DOWNLOADING          0
+#define SWAP_DOWNLOADING       1
+#define SWAP_UPLOADING         2
+#define SWAP_NONE_UPLOADING    3
+
+inline static int
+cache_format(GLenum format)
+{
+    switch (format) {
+    case GL_ALPHA:
+        return 2;
+    case GL_RGB:
+        return 1;
+    case GL_RGBA:
+        return 0;
+    default:
+        return -1;
+    }
+}
+
+/* borrowed from uxa */
+static inline Bool
+glamor_get_rgba_from_pixel(CARD32 pixel,
+                           float *red,
+                           float *green,
+                           float *blue, float *alpha, CARD32 format)
+{
+    int rbits, bbits, gbits, abits;
+    int rshift, bshift, gshift, ashift;
+
+    rbits = PICT_FORMAT_R(format);
+    gbits = PICT_FORMAT_G(format);
+    bbits = PICT_FORMAT_B(format);
+    abits = PICT_FORMAT_A(format);
+
+    if (PICT_FORMAT_TYPE(format) == PICT_TYPE_A) {
+        rshift = gshift = bshift = ashift = 0;
+    }
+    else if (PICT_FORMAT_TYPE(format) == PICT_TYPE_ARGB) {
+        bshift = 0;
+        gshift = bbits;
+        rshift = gshift + gbits;
+        ashift = rshift + rbits;
+    }
+    else if (PICT_FORMAT_TYPE(format) == PICT_TYPE_ABGR) {
+        rshift = 0;
+        gshift = rbits;
+        bshift = gshift + gbits;
+        ashift = bshift + bbits;
+#if XORG_VERSION_CURRENT >= 10699900
+    }
+    else if (PICT_FORMAT_TYPE(format) == PICT_TYPE_BGRA) {
+        ashift = 0;
+        rshift = abits;
+        if (abits == 0)
+            rshift = PICT_FORMAT_BPP(format) - (rbits + gbits + bbits);
+        gshift = rshift + rbits;
+        bshift = gshift + gbits;
+#endif
+    }
+    else {
+        return FALSE;
+    }
+#define COLOR_INT_TO_FLOAT(_fc_, _p_, _s_, _bits_)     \
+  *_fc_ = (((_p_) >> (_s_)) & (( 1 << (_bits_)) - 1))  \
+    / (float)((1<<(_bits_)) - 1)
+
+    if (rbits)
+        COLOR_INT_TO_FLOAT(red, pixel, rshift, rbits);
+    else
+        *red = 0;
+
+    if (gbits)
+        COLOR_INT_TO_FLOAT(green, pixel, gshift, gbits);
+    else
+        *green = 0;
+
+    if (bbits)
+        COLOR_INT_TO_FLOAT(blue, pixel, bshift, bbits);
+    else
+        *blue = 0;
+
+    if (abits)
+        COLOR_INT_TO_FLOAT(alpha, pixel, ashift, abits);
+    else
+        *alpha = 1;
+
+    return TRUE;
+}
+
+inline static Bool
+glamor_pict_format_is_compatible(PicturePtr picture)
+{
+    GLenum iformat;
+    PixmapPtr pixmap = glamor_get_drawable_pixmap(picture->pDrawable);
+
+    iformat = gl_iformat_for_pixmap(pixmap);
+    switch (iformat) {
+    case GL_RGBA:
+        return (picture->format == PICT_a8r8g8b8 ||
+                picture->format == PICT_x8r8g8b8);
+    case GL_ALPHA:
+        return (picture->format == PICT_a8);
+    default:
+        return FALSE;
+    }
+}
+
+/* return TRUE if we can access this pixmap at DDX driver. */
+inline static Bool
+glamor_ddx_fallback_check_pixmap(DrawablePtr drawable)
+{
+    PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable);
+    glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap);
+
+    return (!pixmap_priv
+            || (pixmap_priv->type == GLAMOR_TEXTURE_DRM
+                || pixmap_priv->type == GLAMOR_MEMORY
+                || pixmap_priv->type == GLAMOR_DRM_ONLY));
+}
+
+inline static Bool
+glamor_ddx_fallback_check_gc(GCPtr gc)
+{
+    PixmapPtr pixmap;
+
+    if (!gc)
+        return TRUE;
+    switch (gc->fillStyle) {
+    case FillStippled:
+    case FillOpaqueStippled:
+        pixmap = gc->stipple;
+        break;
+    case FillTiled:
+        pixmap = gc->tile.pixmap;
+        break;
+    default:
+        pixmap = NULL;
+    }
+    return (!pixmap || glamor_ddx_fallback_check_pixmap(&pixmap->drawable));
+}
+
+inline static Bool
+glamor_is_large_pixmap(PixmapPtr pixmap)
+{
+    glamor_pixmap_private *priv;
+
+    priv = glamor_get_pixmap_private(pixmap);
+    return (priv->type == GLAMOR_TEXTURE_LARGE);
+}
+
+inline static Bool
+glamor_is_large_picture(PicturePtr picture)
+{
+    PixmapPtr pixmap;
+
+    if (picture->pDrawable) {
+        pixmap = glamor_get_drawable_pixmap(picture->pDrawable);
+        return glamor_is_large_pixmap(pixmap);
+    }
+    return FALSE;
+}
+
+inline static Bool
+glamor_tex_format_is_readable(GLenum format)
+{
+    return ((format == GL_RGBA || format == GL_RGB || format == GL_ALPHA));
+
+}
+
+static inline void
+_glamor_dump_pixmap_bits(PixmapPtr pixmap, int x, int y, int w, int h)
+{
+    int i, j;
+    unsigned char *p = pixmap->devPrivate.ptr;
+    int stride = pixmap->devKind;
+
+    p = p + y * stride + x;
+
+    for (i = 0; i < h; i++) {
+        ErrorF("line %3d: ", i);
+        for (j = 0; j < w; j++)
+            ErrorF("%2d ", (p[j / 8] & (1 << (j % 8))) >> (j % 8));
+        p += stride;
+        ErrorF("\n");
+    }
+}
+
+static inline void
+_glamor_dump_pixmap_byte(PixmapPtr pixmap, int x, int y, int w, int h)
+{
+    int i, j;
+    unsigned char *p = pixmap->devPrivate.ptr;
+    int stride = pixmap->devKind;
+
+    p = p + y * stride + x;
+
+    for (i = 0; i < h; i++) {
+        ErrorF("line %3d: ", i);
+        for (j = 0; j < w; j++)
+            ErrorF("%2x ", p[j]);
+        p += stride;
+        ErrorF("\n");
+    }
+}
+
+static inline void
+_glamor_dump_pixmap_sword(PixmapPtr pixmap, int x, int y, int w, int h)
+{
+    int i, j;
+    unsigned short *p = pixmap->devPrivate.ptr;
+    int stride = pixmap->devKind / 2;
+
+    p = p + y * stride + x;
+
+    for (i = 0; i < h; i++) {
+        ErrorF("line %3d: ", i);
+        for (j = 0; j < w; j++)
+            ErrorF("%2x ", p[j]);
+        p += stride;
+        ErrorF("\n");
+    }
+}
+
+static inline void
+_glamor_dump_pixmap_word(PixmapPtr pixmap, int x, int y, int w, int h)
+{
+    int i, j;
+    unsigned int *p = pixmap->devPrivate.ptr;
+    int stride = pixmap->devKind / 4;
+
+    p = p + y * stride + x;
+
+    for (i = 0; i < h; i++) {
+        ErrorF("line %3d: ", i);
+        for (j = 0; j < w; j++)
+            ErrorF("%2x ", p[j]);
+        p += stride;
+        ErrorF("\n");
+    }
+}
+
+static inline void
+glamor_dump_pixmap(PixmapPtr pixmap, int x, int y, int w, int h)
+{
+    w = ((x + w) > pixmap->drawable.width) ? (pixmap->drawable.width - x) : w;
+    h = ((y + h) > pixmap->drawable.height) ? (pixmap->drawable.height - y) : h;
+
+    glamor_prepare_access(&pixmap->drawable, GLAMOR_ACCESS_RO);
+    switch (pixmap->drawable.depth) {
+    case 8:
+        _glamor_dump_pixmap_byte(pixmap, x, y, w, h);
+        break;
+    case 15:
+    case 16:
+        _glamor_dump_pixmap_sword(pixmap, x, y, w, h);
+        break;
+
+    case 24:
+    case 32:
+        _glamor_dump_pixmap_word(pixmap, x, y, w, h);
+        break;
+    case 1:
+        _glamor_dump_pixmap_bits(pixmap, x, y, w, h);
+        break;
+    default:
+        ErrorF("dump depth %d, not implemented.\n", pixmap->drawable.depth);
+    }
+    glamor_finish_access(&pixmap->drawable);
+}
+
+static inline void
+_glamor_compare_pixmaps(PixmapPtr pixmap1, PixmapPtr pixmap2,
+                        int x, int y, int w, int h,
+                        PictFormatShort short_format, int all, int diffs)
+{
+    int i, j;
+    unsigned char *p1 = pixmap1->devPrivate.ptr;
+    unsigned char *p2 = pixmap2->devPrivate.ptr;
+    int line_need_printed = 0;
+    int test_code = 0xAABBCCDD;
+    int little_endian = 0;
+    unsigned char *p_test;
+    int bpp = pixmap1->drawable.depth == 8 ? 1 : 4;
+    int stride = pixmap1->devKind;
+
+    assert(pixmap1->devKind == pixmap2->devKind);
+
+    ErrorF("stride:%d, width:%d, height:%d\n", stride, w, h);
+
+    p1 = p1 + y * stride + x;
+    p2 = p2 + y * stride + x;
+
+    if (all) {
+        for (i = 0; i < h; i++) {
+            ErrorF("line %3d: ", i);
+
+            for (j = 0; j < stride; j++) {
+                if (j % bpp == 0)
+                    ErrorF("[%d]%2x:%2x ", j / bpp, p1[j], p2[j]);
+                else
+                    ErrorF("%2x:%2x ", p1[j], p2[j]);
+            }
+
+            p1 += stride;
+            p2 += stride;
+            ErrorF("\n");
+        }
+    }
+    else {
+        if (short_format == PICT_a8r8g8b8) {
+            p_test = (unsigned char *) &test_code;
+            little_endian = (*p_test == 0xDD);
+            bpp = 4;
+
+            for (i = 0; i < h; i++) {
+                line_need_printed = 0;
+
+                for (j = 0; j < stride; j++) {
+                    if (p1[j] != p2[j] &&
+                        (p1[j] - p2[j] > diffs || p2[j] - p1[j] > diffs)) {
+                        if (line_need_printed) {
+                            if (little_endian) {
+                                switch (j % 4) {
+                                case 2:
+                                    ErrorF("[%d]RED:%2x:%2x ", j / bpp, p1[j],
+                                           p2[j]);
+                                    break;
+                                case 1:
+                                    ErrorF("[%d]GREEN:%2x:%2x ", j / bpp, p1[j],
+                                           p2[j]);
+                                    break;
+                                case 0:
+                                    ErrorF("[%d]BLUE:%2x:%2x ", j / bpp, p1[j],
+                                           p2[j]);
+                                    break;
+                                case 3:
+                                    ErrorF("[%d]Alpha:%2x:%2x ", j / bpp, p1[j],
+                                           p2[j]);
+                                    break;
+                                }
+                            }
+                            else {
+                                switch (j % 4) {
+                                case 1:
+                                    ErrorF("[%d]RED:%2x:%2x ", j / bpp, p1[j],
+                                           p2[j]);
+                                    break;
+                                case 2:
+                                    ErrorF("[%d]GREEN:%2x:%2x ", j / bpp, p1[j],
+                                           p2[j]);
+                                    break;
+                                case 3:
+                                    ErrorF("[%d]BLUE:%2x:%2x ", j / bpp, p1[j],
+                                           p2[j]);
+                                    break;
+                                case 0:
+                                    ErrorF("[%d]Alpha:%2x:%2x ", j / bpp, p1[j],
+                                           p2[j]);
+                                    break;
+                                }
+                            }
+                        }
+                        else {
+                            line_need_printed = 1;
+                            j = -1;
+                            ErrorF("line %3d: ", i);
+                            continue;
+                        }
+                    }
+                }
+
+                p1 += stride;
+                p2 += stride;
+                ErrorF("\n");
+            }
+        }                       //more format can be added here.
+        else {                  // the default format, just print.
+            for (i = 0; i < h; i++) {
+                line_need_printed = 0;
+
+                for (j = 0; j < stride; j++) {
+                    if (p1[j] != p2[j]) {
+                        if (line_need_printed) {
+                            ErrorF("[%d]%2x:%2x ", j / bpp, p1[j], p2[j]);
+                        }
+                        else {
+                            line_need_printed = 1;
+                            j = -1;
+                            ErrorF("line %3d: ", i);
+                            continue;
+                        }
+                    }
+                }
+
+                p1 += stride;
+                p2 += stride;
+                ErrorF("\n");
+            }
+        }
+    }
+}
+
+static inline void
+glamor_compare_pixmaps(PixmapPtr pixmap1, PixmapPtr pixmap2,
+                       int x, int y, int w, int h, int all, int diffs)
+{
+    assert(pixmap1->drawable.depth == pixmap2->drawable.depth);
+
+    if (glamor_prepare_access(&pixmap1->drawable, GLAMOR_ACCESS_RO) &&
+        glamor_prepare_access(&pixmap2->drawable, GLAMOR_ACCESS_RO)) {
+        _glamor_compare_pixmaps(pixmap1, pixmap2, x, y, w, h, -1, all, diffs);
+    }
+    glamor_finish_access(&pixmap1->drawable);
+    glamor_finish_access(&pixmap2->drawable);
+}
+
+/* This function is used to compare two pictures.
+   If the picture has no drawable, we use fb functions to generate it. */
+static inline void
+glamor_compare_pictures(ScreenPtr screen,
+                        PicturePtr fst_picture,
+                        PicturePtr snd_picture,
+                        int x_source, int y_source,
+                        int width, int height, int all, int diffs)
+{
+    PixmapPtr fst_pixmap;
+    PixmapPtr snd_pixmap;
+    int fst_generated, snd_generated;
+    int error;
+    int fst_type = -1;
+    int snd_type = -1;          // -1 represent has drawable.
+
+    if (fst_picture->format != snd_picture->format) {
+        ErrorF("Different picture format can not compare!\n");
+        return;
+    }
+
+    if (!fst_picture->pDrawable) {
+        fst_type = fst_picture->pSourcePict->type;
+    }
+
+    if (!snd_picture->pDrawable) {
+        snd_type = snd_picture->pSourcePict->type;
+    }
+
+    if ((fst_type != -1) && (snd_type != -1) && (fst_type != snd_type)) {
+        ErrorF("Different picture type will never be same!\n");
+        return;
+    }
+
+    fst_generated = snd_generated = 0;
+
+    if (!fst_picture->pDrawable) {
+        PicturePtr pixman_pic;
+        PixmapPtr pixmap = NULL;
+        PictFormatShort format;
+
+        format = fst_picture->format;
+
+        pixmap = glamor_create_pixmap(screen,
+                                      width, height,
+                                      PIXMAN_FORMAT_DEPTH(format),
+                                      GLAMOR_CREATE_PIXMAP_CPU);
+
+        pixman_pic = CreatePicture(0,
+                                   &pixmap->drawable,
+                                   PictureMatchFormat(screen,
+                                                      PIXMAN_FORMAT_DEPTH
+                                                      (format), format), 0, 0,
+                                   serverClient, &error);
+
+        fbComposite(PictOpSrc, fst_picture, NULL, pixman_pic,
+                    x_source, y_source, 0, 0, 0, 0, width, height);
+
+        glamor_destroy_pixmap(pixmap);
+
+        fst_picture = pixman_pic;
+        fst_generated = 1;
+    }
+
+    if (!snd_picture->pDrawable) {
+        PicturePtr pixman_pic;
+        PixmapPtr pixmap = NULL;
+        PictFormatShort format;
+
+        format = snd_picture->format;
+
+        pixmap = glamor_create_pixmap(screen,
+                                      width, height,
+                                      PIXMAN_FORMAT_DEPTH(format),
+                                      GLAMOR_CREATE_PIXMAP_CPU);
+
+        pixman_pic = CreatePicture(0,
+                                   &pixmap->drawable,
+                                   PictureMatchFormat(screen,
+                                                      PIXMAN_FORMAT_DEPTH
+                                                      (format), format), 0, 0,
+                                   serverClient, &error);
+
+        fbComposite(PictOpSrc, snd_picture, NULL, pixman_pic,
+                    x_source, y_source, 0, 0, 0, 0, width, height);
+
+        glamor_destroy_pixmap(pixmap);
+
+        snd_picture = pixman_pic;
+        snd_generated = 1;
+    }
+
+    fst_pixmap = glamor_get_drawable_pixmap(fst_picture->pDrawable);
+    snd_pixmap = glamor_get_drawable_pixmap(snd_picture->pDrawable);
+
+    if (fst_pixmap->drawable.depth != snd_pixmap->drawable.depth) {
+        if (fst_generated)
+            glamor_destroy_picture(fst_picture);
+        if (snd_generated)
+            glamor_destroy_picture(snd_picture);
+
+        ErrorF("Different pixmap depth can not compare!\n");
+        return;
+    }
+
+    if ((fst_type == SourcePictTypeLinear) ||
+        (fst_type == SourcePictTypeRadial) ||
+        (fst_type == SourcePictTypeConical) ||
+        (snd_type == SourcePictTypeLinear) ||
+        (snd_type == SourcePictTypeRadial) ||
+        (snd_type == SourcePictTypeConical)) {
+        x_source = y_source = 0;
+    }
+
+    if (glamor_prepare_access(&fst_pixmap->drawable, GLAMOR_ACCESS_RO) &&
+        glamor_prepare_access(&snd_pixmap->drawable, GLAMOR_ACCESS_RO)) {
+        _glamor_compare_pixmaps(fst_pixmap, snd_pixmap,
+                                x_source, y_source,
+                                width, height, fst_picture->format,
+                                all, diffs);
+    }
+    glamor_finish_access(&fst_pixmap->drawable);
+    glamor_finish_access(&snd_pixmap->drawable);
+
+    if (fst_generated)
+        glamor_destroy_picture(fst_picture);
+    if (snd_generated)
+        glamor_destroy_picture(snd_picture);
+
+    return;
+}
+
+#ifdef __i386__
+static inline unsigned long
+__fls(unsigned long x)
+{
+ asm("bsr %1,%0":"=r"(x)
+ :     "rm"(x));
+    return x;
+}
+#else
+static inline unsigned long
+__fls(unsigned long x)
+{
+    int n;
+
+    if (x == 0)
+        return (0);
+    n = 0;
+    if (x <= 0x0000FFFF) {
+        n = n + 16;
+        x = x << 16;
+    }
+    if (x <= 0x00FFFFFF) {
+        n = n + 8;
+        x = x << 8;
+    }
+    if (x <= 0x0FFFFFFF) {
+        n = n + 4;
+        x = x << 4;
+    }
+    if (x <= 0x3FFFFFFF) {
+        n = n + 2;
+        x = x << 2;
+    }
+    if (x <= 0x7FFFFFFF) {
+        n = n + 1;
+    }
+    return 31 - n;
+}
+#endif
+
+static inline void
+glamor_make_current(glamor_screen_private *glamor_priv)
+{
+    if (lastGLContext != &glamor_priv->ctx) {
+        lastGLContext = &glamor_priv->ctx;
+        glamor_priv->ctx.make_current(&glamor_priv->ctx);
+    }
+}
+
+#endif
diff --git a/glamor/glamor_vbo.c b/glamor/glamor_vbo.c
new file mode 100644 (file)
index 0000000..e906101
--- /dev/null
@@ -0,0 +1,177 @@
+/*
+ * Copyright Â© 2014 Intel 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.
+ */
+
+/**
+ * @file glamor_vbo.c
+ *
+ * Helpers for managing streamed vertex bufffers used in glamor.
+ */
+
+#include "glamor_priv.h"
+
+/** Default size of the VBO, in bytes.
+ *
+ * If a single request is larger than this size, we'll resize the VBO
+ * and return an appropriate mapping, but we'll resize back down after
+ * that to avoid hogging that memory forever.  We don't anticipate
+ * normal usage actually requiring larger VBO sizes.
+ */
+#define GLAMOR_VBO_SIZE (512 * 1024)
+
+/**
+ * Returns a pointer to @size bytes of VBO storage, which should be
+ * accessed by the GL using vbo_offset within the VBO.
+ */
+void *
+glamor_get_vbo_space(ScreenPtr screen, unsigned size, char **vbo_offset)
+{
+    glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
+    void *data;
+
+    glamor_make_current(glamor_priv);
+
+    glBindBuffer(GL_ARRAY_BUFFER, glamor_priv->vbo);
+
+    if (glamor_priv->has_buffer_storage) {
+        if (glamor_priv->vbo_size < glamor_priv->vbo_offset + size) {
+            if (glamor_priv->vbo_size)
+                glUnmapBuffer(GL_ARRAY_BUFFER);
+
+            if (size > glamor_priv->vbo_size) {
+                glamor_priv->vbo_size = MAX(GLAMOR_VBO_SIZE, size);
+
+                /* We aren't allowed to resize glBufferStorage()
+                 * buffers, so we need to gen a new one.
+                 */
+                glDeleteBuffers(1, &glamor_priv->vbo);
+                glGenBuffers(1, &glamor_priv->vbo);
+                glBindBuffer(GL_ARRAY_BUFFER, glamor_priv->vbo);
+
+                assert(glGetError() == GL_NO_ERROR);
+                glBufferStorage(GL_ARRAY_BUFFER, glamor_priv->vbo_size, NULL,
+                                GL_MAP_WRITE_BIT |
+                                GL_MAP_PERSISTENT_BIT |
+                                GL_MAP_COHERENT_BIT);
+
+                if (glGetError() != GL_NO_ERROR) {
+                    /* If the driver failed our coherent mapping, fall
+                     * back to the ARB_mbr path.
+                     */
+                    glamor_priv->has_buffer_storage = false;
+                    glamor_priv->vbo_size = 0;
+
+                    return glamor_get_vbo_space(screen, size, vbo_offset);
+                }
+            }
+
+            glamor_priv->vbo_offset = 0;
+            glamor_priv->vb = glMapBufferRange(GL_ARRAY_BUFFER,
+                                               0, glamor_priv->vbo_size,
+                                               GL_MAP_WRITE_BIT |
+                                               GL_MAP_INVALIDATE_BUFFER_BIT |
+                                               GL_MAP_PERSISTENT_BIT |
+                                               GL_MAP_COHERENT_BIT);
+        }
+        *vbo_offset = (void *)(uintptr_t)glamor_priv->vbo_offset;
+        data = glamor_priv->vb + glamor_priv->vbo_offset;
+        glamor_priv->vbo_offset += size;
+    } else if (glamor_priv->has_map_buffer_range) {
+        if (glamor_priv->vbo_size < glamor_priv->vbo_offset + size) {
+            glamor_priv->vbo_size = MAX(GLAMOR_VBO_SIZE, size);
+            glamor_priv->vbo_offset = 0;
+            glBufferData(GL_ARRAY_BUFFER,
+                         glamor_priv->vbo_size, NULL, GL_STREAM_DRAW);
+        }
+
+        data = glMapBufferRange(GL_ARRAY_BUFFER,
+                                glamor_priv->vbo_offset,
+                                size,
+                                GL_MAP_WRITE_BIT |
+                                GL_MAP_UNSYNCHRONIZED_BIT |
+                                GL_MAP_INVALIDATE_RANGE_BIT);
+        assert(data != NULL);
+        *vbo_offset = (char *)(uintptr_t)glamor_priv->vbo_offset;
+        glamor_priv->vbo_offset += size;
+    } else {
+        /* Return a pointer to the statically allocated non-VBO
+         * memory. We'll upload it through glBufferData() later.
+         */
+        if (glamor_priv->vbo_size < size) {
+            glamor_priv->vbo_size = MAX(GLAMOR_VBO_SIZE, size);
+            free(glamor_priv->vb);
+            glamor_priv->vb = XNFalloc(glamor_priv->vbo_size);
+        }
+        *vbo_offset = NULL;
+        /* We point to the start of glamor_priv->vb every time, and
+         * the vbo_offset determines the size of the glBufferData().
+         */
+        glamor_priv->vbo_offset = size;
+        data = glamor_priv->vb;
+    }
+
+    return data;
+}
+
+void
+glamor_put_vbo_space(ScreenPtr screen)
+{
+    glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
+
+    glamor_make_current(glamor_priv);
+
+    if (glamor_priv->has_buffer_storage) {
+        /* If we're in the ARB_buffer_storage path, we have a
+         * persistent mapping, so we can leave it around until we
+         * reach the end of the buffer.
+         */
+    } else if (glamor_priv->has_map_buffer_range) {
+        glUnmapBuffer(GL_ARRAY_BUFFER);
+    } else {
+        glBufferData(GL_ARRAY_BUFFER, glamor_priv->vbo_offset,
+                     glamor_priv->vb, GL_DYNAMIC_DRAW);
+    }
+
+    glBindBuffer(GL_ARRAY_BUFFER, 0);
+}
+
+void
+glamor_init_vbo(ScreenPtr screen)
+{
+    glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
+
+    glamor_make_current(glamor_priv);
+
+    glGenBuffers(1, &glamor_priv->vbo);
+}
+
+void
+glamor_fini_vbo(ScreenPtr screen)
+{
+    glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
+
+    glamor_make_current(glamor_priv);
+
+    glDeleteBuffers(1, &glamor_priv->vbo);
+    if (!glamor_priv->has_map_buffer_range)
+        free(glamor_priv->vb);
+}
diff --git a/glamor/glamor_window.c b/glamor/glamor_window.c
new file mode 100644 (file)
index 0000000..60647bf
--- /dev/null
@@ -0,0 +1,99 @@
+/*
+ * Copyright Â© 2008 Intel Corporation
+ * Copyright Â© 1998 Keith Packard
+ *
+ * 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 Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission.  Keith Packard makes no
+ * representations about the suitability of this software for any purpose.  It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD 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.
+ */
+
+#include "glamor_priv.h"
+
+/** @file glamor_window.c
+ *
+ * Screen Change Window Attribute implementation.
+ */
+
+static void
+glamor_fixup_window_pixmap(DrawablePtr pDrawable, PixmapPtr *ppPixmap)
+{
+    PixmapPtr pPixmap = *ppPixmap;
+    glamor_pixmap_private *pixmap_priv;
+
+    if (pPixmap->drawable.bitsPerPixel != pDrawable->bitsPerPixel) {
+        pixmap_priv = glamor_get_pixmap_private(pPixmap);
+        if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv)) {
+            glamor_fallback("pixmap %p has no fbo\n", pPixmap);
+            goto fail;
+        }
+        glamor_debug_output(GLAMOR_DEBUG_UNIMPL, "To be implemented.\n");
+    }
+    return;
+
+ fail:
+    GLAMOR_PANIC
+        (" We can't fall back to fbFixupWindowPixmap, as the fb24_32ReformatTile"
+         " is broken for glamor. \n");
+}
+
+Bool
+glamor_change_window_attributes(WindowPtr pWin, unsigned long mask)
+{
+    if (mask & CWBackPixmap) {
+        if (pWin->backgroundState == BackgroundPixmap)
+            glamor_fixup_window_pixmap(&pWin->drawable,
+                                       &pWin->background.pixmap);
+    }
+
+    if (mask & CWBorderPixmap) {
+        if (pWin->borderIsPixel == FALSE)
+            glamor_fixup_window_pixmap(&pWin->drawable, &pWin->border.pixmap);
+    }
+    return TRUE;
+}
+
+void
+glamor_set_window_pixmap(WindowPtr win, PixmapPtr pPixmap)
+{
+    ScreenPtr screen = win->drawable.pScreen;
+    glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
+    PixmapPtr old = screen->GetWindowPixmap(win);
+
+    if (pPixmap != old) {
+        glamor_pixmap_private *pixmap_priv;
+        PicturePtr pic = NULL;
+
+        pixmap_priv = glamor_get_pixmap_private(old);
+        if (GLAMOR_PIXMAP_PRIV_IS_PICTURE(pixmap_priv) &&
+            pixmap_priv->base.picture->pDrawable == (DrawablePtr) win) {
+            pic = pixmap_priv->base.picture;
+            pixmap_priv->base.is_picture = 0;
+            pixmap_priv->base.picture = NULL;
+        }
+
+        pixmap_priv = glamor_get_pixmap_private(pPixmap);
+        if (pixmap_priv) {
+            pixmap_priv->base.is_picture = ! !pic;
+            pixmap_priv->base.picture = pic;
+        }
+    }
+
+    screen->SetWindowPixmap = glamor_priv->saved_procs.set_window_pixmap;
+    (screen->SetWindowPixmap) (win, pPixmap);
+    glamor_priv->saved_procs.set_window_pixmap = screen->SetWindowPixmap;
+    screen->SetWindowPixmap = glamor_set_window_pixmap;
+}
diff --git a/glamor/glamor_xv.c b/glamor/glamor_xv.c
new file mode 100644 (file)
index 0000000..369b02b
--- /dev/null
@@ -0,0 +1,606 @@
+/*
+ * Copyright Â© 2013 Red Hat
+ *
+ * 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.
+ *
+ * Authors:
+ *      Dave Airlie <airlied@redhat.com>
+ *
+ * some code is derived from the xf86-video-ati radeon driver, mainly
+ * the calculations.
+ */
+
+/** @file glamor_xv.c
+ *
+ * Xv acceleration implementation
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "xf86xv.h"
+#define GLAMOR_FOR_XORG
+#include "glamor_priv.h"
+
+#include <X11/extensions/Xv.h>
+#include "fourcc.h"
+/* Reference color space transform data */
+typedef struct tagREF_TRANSFORM {
+    float RefLuma;
+    float RefRCb;
+    float RefRCr;
+    float RefGCb;
+    float RefGCr;
+    float RefBCb;
+    float RefBCr;
+} REF_TRANSFORM;
+
+#define RTFSaturation(a)   (1.0 + ((a)*1.0)/1000.0)
+#define RTFBrightness(a)   (((a)*1.0)/2000.0)
+#define RTFIntensity(a)   (((a)*1.0)/2000.0)
+#define RTFContrast(a)   (1.0 + ((a)*1.0)/1000.0)
+#define RTFHue(a)   (((a)*3.1416)/1000.0)
+
+static const char *xv_vs = "attribute vec4 v_position;\n"
+    "attribute vec4 v_texcoord0;\n"
+    "varying vec2 tcs;\n"
+    "void main()\n"
+    "{\n"
+    "     gl_Position = v_position;\n"
+    "tcs = v_texcoord0.xy;\n"
+    "}\n";
+
+static const char *xv_ps = GLAMOR_DEFAULT_PRECISION
+    "uniform sampler2D y_sampler;\n"
+    "uniform sampler2D u_sampler;\n"
+    "uniform sampler2D v_sampler;\n"
+    "uniform vec4 offsetyco;\n"
+    "uniform vec4 ucogamma;\n"
+    "uniform vec4 vco;\n"
+    "varying vec2 tcs;\n"
+    "float sample;\n"
+    "vec4 temp1;\n"
+    "void main()\n"
+    "{\n"
+    "sample = texture2D(y_sampler, tcs).w;\n"
+    "temp1.xyz = offsetyco.www * vec3(sample) + offsetyco.xyz;\n"
+    "sample = texture2D(u_sampler, tcs).w;\n"
+    "temp1.xyz = ucogamma.xyz * vec3(sample) + temp1.xyz;\n"
+    "sample = texture2D(v_sampler, tcs).w;\n"
+    "temp1.xyz = clamp(vco.xyz * vec3(sample) + temp1.xyz, 0.0, 1.0);\n"
+    "temp1.w = 1.0;\n"
+    "gl_FragColor = temp1;\n"
+    "}\n";
+
+void
+glamor_init_xv_shader(ScreenPtr screen)
+{
+    glamor_screen_private *glamor_priv;
+    GLint fs_prog, vs_prog;
+
+    glamor_priv = glamor_get_screen_private(screen);
+    glamor_make_current(glamor_priv);
+    glamor_priv->xv_prog = glCreateProgram();
+
+    vs_prog = glamor_compile_glsl_prog(GL_VERTEX_SHADER, xv_vs);
+    fs_prog = glamor_compile_glsl_prog(GL_FRAGMENT_SHADER, xv_ps);
+    glAttachShader(glamor_priv->xv_prog, vs_prog);
+    glAttachShader(glamor_priv->xv_prog, fs_prog);
+
+    glBindAttribLocation(glamor_priv->xv_prog,
+                         GLAMOR_VERTEX_POS, "v_position");
+    glBindAttribLocation(glamor_priv->xv_prog,
+                         GLAMOR_VERTEX_SOURCE, "v_texcoord0");
+    glamor_link_glsl_prog(screen, glamor_priv->xv_prog, "xv");
+}
+
+#define ClipValue(v,min,max) ((v) < (min) ? (min) : (v) > (max) ? (max) : (v))
+#define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE)
+
+static Atom xvBrightness, xvContrast, xvSaturation, xvHue, xvColorspace,
+    xvGamma;
+
+#define NUM_ATTRIBUTES 5
+static XF86AttributeRec Attributes_glamor[NUM_ATTRIBUTES + 1] = {
+    {XvSettable | XvGettable, -1000, 1000, "XV_BRIGHTNESS"},
+    {XvSettable | XvGettable, -1000, 1000, "XV_CONTRAST"},
+    {XvSettable | XvGettable, -1000, 1000, "XV_SATURATION"},
+    {XvSettable | XvGettable, -1000, 1000, "XV_HUE"},
+    {XvSettable | XvGettable, 0, 1, "XV_COLORSPACE"},
+    {0, 0, 0, NULL}
+};
+
+#define NUM_FORMATS 3
+
+static XF86VideoFormatRec Formats[NUM_FORMATS] = {
+    {15, TrueColor}, {16, TrueColor}, {24, TrueColor}
+};
+
+#define NUM_IMAGES 2
+
+static XF86ImageRec Images[NUM_IMAGES] = {
+    XVIMAGE_YV12,
+    XVIMAGE_I420,
+};
+
+static void
+glamor_xv_stop_video(ScrnInfoPtr pScrn, void *data, Bool cleanup)
+{
+    glamor_port_private *port_priv = (glamor_port_private *) data;
+    int i;
+
+    if (!cleanup)
+        return;
+
+    for (i = 0; i < 3; i++) {
+        if (port_priv->src_pix[i]) {
+            glamor_destroy_pixmap(port_priv->src_pix[i]);
+            port_priv->src_pix[i] = NULL;
+        }
+    }
+}
+
+static int
+glamor_xv_set_port_attribute(ScrnInfoPtr pScrn,
+                             Atom attribute, INT32 value, void *data)
+{
+    glamor_port_private *port_priv = (glamor_port_private *) data;
+
+    if (attribute == xvBrightness)
+        port_priv->brightness = ClipValue(value, -1000, 1000);
+    else if (attribute == xvHue)
+        port_priv->hue = ClipValue(value, -1000, 1000);
+    else if (attribute == xvContrast)
+        port_priv->contrast = ClipValue(value, -1000, 1000);
+    else if (attribute == xvSaturation)
+        port_priv->saturation = ClipValue(value, -1000, 1000);
+    else if (attribute == xvGamma)
+        port_priv->gamma = ClipValue(value, 100, 10000);
+    else if (attribute == xvColorspace)
+        port_priv->transform_index = ClipValue(value, 0, 1);
+    else
+        return BadMatch;
+    return Success;
+}
+
+static int
+glamor_xv_get_port_attribute(ScrnInfoPtr pScrn,
+                             Atom attribute, INT32 *value, void *data)
+{
+    glamor_port_private *port_priv = (glamor_port_private *) data;
+
+    if (attribute == xvBrightness)
+        *value = port_priv->brightness;
+    else if (attribute == xvHue)
+        *value = port_priv->hue;
+    else if (attribute == xvContrast)
+        *value = port_priv->contrast;
+    else if (attribute == xvSaturation)
+        *value = port_priv->saturation;
+    else if (attribute == xvGamma)
+        *value = port_priv->gamma;
+    else if (attribute == xvColorspace)
+        *value = port_priv->transform_index;
+    else
+        return BadMatch;
+
+    return Success;
+}
+
+static void
+glamor_xv_query_best_size(ScrnInfoPtr pScrn,
+                          Bool motion,
+                          short vid_w, short vid_h,
+                          short drw_w, short drw_h,
+                          unsigned int *p_w, unsigned int *p_h, void *data)
+{
+    *p_w = drw_w;
+    *p_h = drw_h;
+}
+
+static int
+glamor_xv_query_image_attributes(ScrnInfoPtr pScrn,
+                                 int id,
+                                 unsigned short *w, unsigned short *h,
+                                 int *pitches, int *offsets)
+{
+    int size = 0, tmp;
+
+    if (offsets)
+        offsets[0] = 0;
+    switch (id) {
+    case FOURCC_YV12:
+    case FOURCC_I420:
+        *h = *h;
+        *w = *w;
+        size = *w;
+        if (pitches)
+            pitches[0] = size;
+        size *= *h;
+        if (offsets)
+            offsets[1] = size;
+        tmp = *w >> 1;
+        if (pitches)
+            pitches[1] = pitches[2] = tmp;
+        tmp *= (*h >> 1);
+        size += tmp;
+        if (offsets)
+            offsets[2] = size;
+        size += tmp;
+        break;
+    }
+    return size;
+}
+
+/* Parameters for ITU-R BT.601 and ITU-R BT.709 colour spaces
+   note the difference to the parameters used in overlay are due
+   to 10bit vs. float calcs */
+static REF_TRANSFORM trans[2] = {
+    {1.1643, 0.0, 1.5960, -0.3918, -0.8129, 2.0172, 0.0},       /* BT.601 */
+    {1.1643, 0.0, 1.7927, -0.2132, -0.5329, 2.1124, 0.0}        /* BT.709 */
+};
+
+static void
+glamor_display_textured_video(glamor_port_private *port_priv)
+{
+    ScreenPtr screen = port_priv->pPixmap->drawable.pScreen;
+    glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
+    glamor_pixmap_private *pixmap_priv =
+        glamor_get_pixmap_private(port_priv->pPixmap);
+    glamor_pixmap_private *src_pixmap_priv[3];
+    float vertices[32], texcoords[8];
+    BoxPtr box = REGION_RECTS(&port_priv->clip);
+    int nBox = REGION_NUM_RECTS(&port_priv->clip);
+    int dst_x_off, dst_y_off;
+    GLfloat dst_xscale, dst_yscale;
+    GLfloat src_xscale[3], src_yscale[3];
+    int i;
+    const float Loff = -0.0627;
+    const float Coff = -0.502;
+    float uvcosf, uvsinf;
+    float yco;
+    float uco[3], vco[3], off[3];
+    float bright, cont, gamma;
+    int ref = port_priv->transform_index;
+    GLint uloc, sampler_loc;
+
+    cont = RTFContrast(port_priv->contrast);
+    bright = RTFBrightness(port_priv->brightness);
+    gamma = (float) port_priv->gamma / 1000.0;
+    uvcosf = RTFSaturation(port_priv->saturation) * cos(RTFHue(port_priv->hue));
+    uvsinf = RTFSaturation(port_priv->saturation) * sin(RTFHue(port_priv->hue));
+/* overlay video also does pre-gamma contrast/sat adjust, should we? */
+
+    yco = trans[ref].RefLuma * cont;
+    uco[0] = -trans[ref].RefRCr * uvsinf;
+    uco[1] = trans[ref].RefGCb * uvcosf - trans[ref].RefGCr * uvsinf;
+    uco[2] = trans[ref].RefBCb * uvcosf;
+    vco[0] = trans[ref].RefRCr * uvcosf;
+    vco[1] = trans[ref].RefGCb * uvsinf + trans[ref].RefGCr * uvcosf;
+    vco[2] = trans[ref].RefBCb * uvsinf;
+    off[0] = Loff * yco + Coff * (uco[0] + vco[0]) + bright;
+    off[1] = Loff * yco + Coff * (uco[1] + vco[1]) + bright;
+    off[2] = Loff * yco + Coff * (uco[2] + vco[2]) + bright;
+    gamma = 1.0;
+
+    pixmap_priv_get_dest_scale(pixmap_priv, &dst_xscale, &dst_yscale);
+    glamor_get_drawable_deltas(port_priv->pDraw, port_priv->pPixmap, &dst_x_off,
+                               &dst_y_off);
+    glamor_set_destination_pixmap_priv_nc(pixmap_priv);
+
+    for (i = 0; i < 3; i++) {
+        if (port_priv->src_pix[i]) {
+            src_pixmap_priv[i] =
+                glamor_get_pixmap_private(port_priv->src_pix[i]);
+            pixmap_priv_get_scale(src_pixmap_priv[i], &src_xscale[i],
+                                  &src_yscale[i]);
+        }
+    }
+    glamor_make_current(glamor_priv);
+    glUseProgram(glamor_priv->xv_prog);
+
+    uloc = glGetUniformLocation(glamor_priv->xv_prog, "offsetyco");
+    glUniform4f(uloc, off[0], off[1], off[2], yco);
+    uloc = glGetUniformLocation(glamor_priv->xv_prog, "ucogamma");
+    glUniform4f(uloc, uco[0], uco[1], uco[2], gamma);
+    uloc = glGetUniformLocation(glamor_priv->xv_prog, "vco");
+    glUniform4f(uloc, vco[0], vco[1], vco[2], 0);
+
+    glActiveTexture(GL_TEXTURE0);
+    glBindTexture(GL_TEXTURE_2D, src_pixmap_priv[0]->base.fbo->tex);
+    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+
+    glActiveTexture(GL_TEXTURE1);
+    glBindTexture(GL_TEXTURE_2D, src_pixmap_priv[1]->base.fbo->tex);
+    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+
+    glActiveTexture(GL_TEXTURE2);
+    glBindTexture(GL_TEXTURE_2D, src_pixmap_priv[2]->base.fbo->tex);
+    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+
+    sampler_loc = glGetUniformLocation(glamor_priv->xv_prog, "y_sampler");
+    glUniform1i(sampler_loc, 0);
+    sampler_loc = glGetUniformLocation(glamor_priv->xv_prog, "u_sampler");
+    glUniform1i(sampler_loc, 1);
+    sampler_loc = glGetUniformLocation(glamor_priv->xv_prog, "v_sampler");
+    glUniform1i(sampler_loc, 2);
+
+    glVertexAttribPointer(GLAMOR_VERTEX_SOURCE, 2,
+                          GL_FLOAT, GL_FALSE,
+                          2 * sizeof(float), texcoords);
+    glEnableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
+
+    glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT,
+                          GL_FALSE, 2 * sizeof(float), vertices);
+
+    glEnableVertexAttribArray(GLAMOR_VERTEX_POS);
+    for (i = 0; i < nBox; i++) {
+        float off_x = box[i].x1 - port_priv->drw_x;
+        float off_y = box[i].y1 - port_priv->drw_y;
+        float diff_x = (float) port_priv->src_w / (float) port_priv->dst_w;
+        float diff_y = (float) port_priv->src_h / (float) port_priv->dst_h;
+        float srcx, srcy, srcw, srch;
+        int dstx, dsty, dstw, dsth;
+
+        dstx = box[i].x1 + dst_x_off;
+        dsty = box[i].y1 + dst_y_off;
+        dstw = box[i].x2 - box[i].x1;
+        dsth = box[i].y2 - box[i].y1;
+
+        srcx = port_priv->src_x + off_x * diff_x;
+        srcy = port_priv->src_y + off_y * diff_y;
+        srcw = (port_priv->src_w * dstw) / (float) port_priv->dst_w;
+        srch = (port_priv->src_h * dsth) / (float) port_priv->dst_h;
+
+        glamor_set_normalize_vcoords(pixmap_priv,
+                                     dst_xscale, dst_yscale,
+                                     dstx,
+                                     dsty,
+                                     dstx + dstw,
+                                     dsty + dsth,
+                                     glamor_priv->yInverted, vertices);
+
+        glamor_set_normalize_tcoords(src_pixmap_priv[0],
+                                     src_xscale[0],
+                                     src_yscale[0],
+                                     srcx,
+                                     srcy,
+                                     srcx + srcw,
+                                     srcy + srch,
+                                     glamor_priv->yInverted, texcoords);
+
+        glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
+    }
+
+    glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
+    glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
+
+    DamageDamageRegion(port_priv->pDraw, &port_priv->clip);
+}
+
+static int
+glamor_xv_put_image(ScrnInfoPtr pScrn,
+                    short src_x, short src_y,
+                    short drw_x, short drw_y,
+                    short src_w, short src_h,
+                    short drw_w, short drw_h,
+                    int id,
+                    unsigned char *buf,
+                    short width,
+                    short height,
+                    Bool sync,
+                    RegionPtr clipBoxes, void *data, DrawablePtr pDrawable)
+{
+    ScreenPtr screen = pDrawable->pScreen;
+    glamor_port_private *port_priv = (glamor_port_private *) data;
+    INT32 x1, x2, y1, y2;
+    int srcPitch, srcPitch2;
+    BoxRec dstBox;
+    int top, nlines;
+    int s2offset, s3offset, tmp;
+
+    s2offset = s3offset = srcPitch2 = 0;
+
+    /* Clip */
+    x1 = src_x;
+    x2 = src_x + src_w;
+    y1 = src_y;
+    y2 = src_y + src_h;
+
+    dstBox.x1 = drw_x;
+    dstBox.x2 = drw_x + drw_w;
+    dstBox.y1 = drw_y;
+    dstBox.y2 = drw_y + drw_h;
+    if (!xf86XVClipVideoHelper
+        (&dstBox, &x1, &x2, &y1, &y2, clipBoxes, width, height))
+        return Success;
+
+    if ((x1 >= x2) || (y1 >= y2))
+        return Success;
+
+    srcPitch = width;
+    srcPitch2 = width >> 1;
+
+    if (!port_priv->src_pix[0] ||
+        (width != port_priv->src_pix_w || height != port_priv->src_pix_h)) {
+        int i;
+
+        for (i = 0; i < 3; i++)
+            if (port_priv->src_pix[i])
+                glamor_destroy_pixmap(port_priv->src_pix[i]);
+
+        port_priv->src_pix[0] =
+            glamor_create_pixmap(screen, width, height, 8, 0);
+        port_priv->src_pix[1] =
+            glamor_create_pixmap(screen, width >> 1, height >> 1, 8, 0);
+        port_priv->src_pix[2] =
+            glamor_create_pixmap(screen, width >> 1, height >> 1, 8, 0);
+        port_priv->src_pix_w = width;
+        port_priv->src_pix_h = height;
+
+        if (!port_priv->src_pix[0] || !port_priv->src_pix[1] ||
+            !port_priv->src_pix[2])
+            return BadAlloc;
+    }
+
+    top = (y1 >> 16) & ~1;
+    nlines = ((y2 + 0xffff) >> 16) - top;
+
+    switch (id) {
+    case FOURCC_YV12:
+    case FOURCC_I420:
+        s2offset = srcPitch * height;
+        s3offset = s2offset + (srcPitch2 * ((height + 1) >> 1));
+        s2offset += ((top >> 1) * srcPitch2);
+        s3offset += ((top >> 1) * srcPitch2);
+        if (id == FOURCC_YV12) {
+            tmp = s2offset;
+            s2offset = s3offset;
+            s3offset = tmp;
+        }
+        glamor_upload_sub_pixmap_to_texture(port_priv->src_pix[0],
+                                            0, 0, srcPitch, nlines,
+                                            port_priv->src_pix[0]->devKind,
+                                            buf + (top * srcPitch), 0);
+
+        glamor_upload_sub_pixmap_to_texture(port_priv->src_pix[1],
+                                            0, 0, srcPitch2, (nlines + 1) >> 1,
+                                            port_priv->src_pix[1]->devKind,
+                                            buf + s2offset, 0);
+
+        glamor_upload_sub_pixmap_to_texture(port_priv->src_pix[2],
+                                            0, 0, srcPitch2, (nlines + 1) >> 1,
+                                            port_priv->src_pix[2]->devKind,
+                                            buf + s3offset, 0);
+        break;
+    default:
+        return BadMatch;
+    }
+
+    if (pDrawable->type == DRAWABLE_WINDOW)
+        port_priv->pPixmap = (*screen->GetWindowPixmap) ((WindowPtr) pDrawable);
+    else
+        port_priv->pPixmap = (PixmapPtr) pDrawable;
+
+    if (!RegionEqual(&port_priv->clip, clipBoxes)) {
+        RegionCopy(&port_priv->clip, clipBoxes);
+    }
+
+    port_priv->src_x = src_x;
+    port_priv->src_y = src_y;
+    port_priv->src_w = src_w;
+    port_priv->src_h = src_h;
+    port_priv->dst_w = drw_w;
+    port_priv->dst_h = drw_h;
+    port_priv->drw_x = drw_x;
+    port_priv->drw_y = drw_y;
+    port_priv->w = width;
+    port_priv->h = height;
+    port_priv->pDraw = pDrawable;
+    glamor_display_textured_video(port_priv);
+    return Success;
+}
+
+static XF86VideoEncodingRec DummyEncodingGLAMOR[1] = {
+    {
+     0,
+     "XV_IMAGE",
+     8192, 8192,
+     {1, 1}
+     }
+};
+
+XF86VideoAdaptorPtr
+glamor_xv_init(ScreenPtr screen, int num_texture_ports)
+{
+    glamor_port_private *port_priv;
+    XF86VideoAdaptorPtr adapt;
+    int i;
+
+    glamor_init_xv_shader(screen);
+
+    adapt = calloc(1, sizeof(XF86VideoAdaptorRec) + num_texture_ports *
+                   (sizeof(glamor_port_private) + sizeof(DevUnion)));
+    if (adapt == NULL)
+        return NULL;
+
+    xvBrightness = MAKE_ATOM("XV_BRIGHTNESS");
+    xvContrast = MAKE_ATOM("XV_CONTRAST");
+    xvSaturation = MAKE_ATOM("XV_SATURATION");
+    xvHue = MAKE_ATOM("XV_HUE");
+    xvGamma = MAKE_ATOM("XV_GAMMA");
+    xvColorspace = MAKE_ATOM("XV_COLORSPACE");
+
+    adapt->type = XvWindowMask | XvInputMask | XvImageMask;
+    adapt->flags = 0;
+    adapt->name = "GLAMOR Textured Video";
+    adapt->nEncodings = 1;
+    adapt->pEncodings = DummyEncodingGLAMOR;
+
+    adapt->nFormats = NUM_FORMATS;
+    adapt->pFormats = Formats;
+    adapt->nPorts = num_texture_ports;
+    adapt->pPortPrivates = (DevUnion *) (&adapt[1]);
+
+    adapt->pAttributes = Attributes_glamor;
+    adapt->nAttributes = NUM_ATTRIBUTES;
+
+    port_priv =
+        (glamor_port_private *) (&adapt->pPortPrivates[num_texture_ports]);
+    adapt->pImages = Images;
+    adapt->nImages = NUM_IMAGES;
+    adapt->PutVideo = NULL;
+    adapt->PutStill = NULL;
+    adapt->GetVideo = NULL;
+    adapt->GetStill = NULL;
+    adapt->StopVideo = glamor_xv_stop_video;
+    adapt->SetPortAttribute = glamor_xv_set_port_attribute;
+    adapt->GetPortAttribute = glamor_xv_get_port_attribute;
+    adapt->QueryBestSize = glamor_xv_query_best_size;
+    adapt->PutImage = glamor_xv_put_image;
+    adapt->ReputImage = NULL;
+    adapt->QueryImageAttributes = glamor_xv_query_image_attributes;
+
+    for (i = 0; i < num_texture_ports; i++) {
+        glamor_port_private *pPriv = &port_priv[i];
+
+        pPriv->brightness = 0;
+        pPriv->contrast = 0;
+        pPriv->saturation = 0;
+        pPriv->hue = 0;
+        pPriv->gamma = 1000;
+        pPriv->transform_index = 0;
+
+        REGION_NULL(pScreen, &pPriv->clip);
+
+        adapt->pPortPrivates[i].ptr = (void *) (pPriv);
+    }
+    return adapt;
+}
index 591c4ac..54e8140 100644 (file)
@@ -15,18 +15,19 @@ AM_CFLAGS = \
 # none yet
 #sdk_HEADERS =
 
-INCLUDES = \
+AM_CPPFLAGS = \
        -I$(top_srcdir)/hw/xfree86/os-support \
        -I$(top_srcdir)/hw/xfree86/os-support/bus \
        -I$(top_srcdir)/hw/xfree86/common \
        -I$(top_srcdir)/hw/xfree86/dri \
-       -I$(top_srcdir)/mi
+       -I$(top_srcdir)/mi \
+       -I$(top_srcdir)/present
 
 if DRI2_AIGLX
-INCLUDES += -I$(top_srcdir)/hw/xfree86/dri2
+AM_CPPFLAGS += -I$(top_srcdir)/hw/xfree86/dri2
 endif
 
-glapi_sources =                                        \
+indirect_sources =                             \
        indirect_dispatch.c                     \
        indirect_dispatch.h                     \
        indirect_dispatch_swap.c                \
@@ -35,22 +36,10 @@ glapi_sources =                                     \
        indirect_size.h                         \
        indirect_size_get.c                     \
        indirect_size_get.h                     \
-       indirect_table.c                        \
-       dispatch.h                              \
-       glapitable.h                            \
-       glapi.c                                 \
-       glapi.h                                 \
-       glapi_gentable.c                        \
-       glprocs.h                               \
-       glthread.c                              \
-       glthread.h
+       indirect_table.c
 
 libglxdri_la_SOURCES =
 
-if DRI
-libglxdri_la_SOURCES += glxdri.c
-endif
-
 if DRI2_AIGLX
 libglxdri_la_SOURCES += glxdri2.c
 endif
@@ -59,7 +48,6 @@ libglxdri_la_LIBADD = $(DLOPEN_LIBS)
 
 libglx_la_SOURCES = \
        $(indirect_sources) \
-       $(glapi_sources) \
        clientinfo.c \
        createcontext.c \
        extension_string.c \
index 13d21cc..cbeddec 100644 (file)
@@ -68,6 +68,8 @@ validate_render_type(uint32_t render_type)
     switch (render_type) {
     case GLX_RGBA_TYPE:
     case GLX_COLOR_INDEX_TYPE:
+    case GLX_RGBA_FLOAT_TYPE_ARB:
+    case GLX_RGBA_UNSIGNED_FLOAT_TYPE_EXT:
         return True;
     default:
         return False;
@@ -320,7 +322,7 @@ __glXDisp_CreateContextAttribsARB(__GLXclientState * cl, GLbyte * pc)
     ctx->id = req->context;
     ctx->share_id = req->shareList;
     ctx->idExists = True;
-    ctx->isCurrent = False;
+    ctx->currentClient = False;
     ctx->isDirect = req->isDirect;
     ctx->hasUnflushedCommands = False;
     ctx->renderMode = GL_RENDER;
diff --git a/glx/dispatch.h b/glx/dispatch.h
deleted file mode 100644 (file)
index 7208653..0000000
+++ /dev/null
@@ -1,19816 +0,0 @@
-/* DO NOT EDIT - This file generated automatically by gl_table.py (from Mesa) script */
-
-/*
- * (C) Copyright IBM Corporation 2005
- * All Rights Reserved.
- * 
- * 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, sub license,
- * 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 NON-INFRINGEMENT.  IN NO EVENT SHALL
- * IBM,
- * AND/OR THEIR SUPPLIERS 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.
- */
-
-#if !defined( _DISPATCH_H_ )
-#define _DISPATCH_H_
-
-/**
- * \file main/dispatch.h
- * Macros for handling GL dispatch tables.
- *
- * For each known GL function, there are 3 macros in this file.  The first
- * macro is named CALL_FuncName and is used to call that GL function using
- * the specified dispatch table.  The other 2 macros, called GET_FuncName
- * can SET_FuncName, are used to get and set the dispatch pointer for the
- * named function in the specified dispatch table.
- */
-
-/* GLXEXT is defined when building the GLX extension in the xserver.
- */
-#if !defined(GLXEXT)
-#include "main/mfeatures.h"
-#endif
-
-#define CALL_by_offset(disp, cast, offset, parameters) \
-    (*(cast (GET_by_offset(disp, offset)))) parameters
-#define GET_by_offset(disp, offset) \
-    (offset >= 0) ? (((_glapi_proc *)(disp))[offset]) : NULL
-#define SET_by_offset(disp, offset, fn) \
-    do { \
-        if ( (offset) < 0 ) { \
-            /* fprintf( stderr, "[%s:%u] SET_by_offset(%p, %d, %s)!\n", */ \
-            /*         __func__, __LINE__, disp, offset, # fn); */ \
-            /* abort(); */ \
-        } \
-        else { \
-            ( (_glapi_proc *) (disp) )[offset] = (_glapi_proc) fn; \
-        } \
-    } while(0)
-
-/* total number of offsets below */
-#define _gloffset_COUNT 973
-
-#define _gloffset_NewList 0
-#define _gloffset_EndList 1
-#define _gloffset_CallList 2
-#define _gloffset_CallLists 3
-#define _gloffset_DeleteLists 4
-#define _gloffset_GenLists 5
-#define _gloffset_ListBase 6
-#define _gloffset_Begin 7
-#define _gloffset_Bitmap 8
-#define _gloffset_Color3b 9
-#define _gloffset_Color3bv 10
-#define _gloffset_Color3d 11
-#define _gloffset_Color3dv 12
-#define _gloffset_Color3f 13
-#define _gloffset_Color3fv 14
-#define _gloffset_Color3i 15
-#define _gloffset_Color3iv 16
-#define _gloffset_Color3s 17
-#define _gloffset_Color3sv 18
-#define _gloffset_Color3ub 19
-#define _gloffset_Color3ubv 20
-#define _gloffset_Color3ui 21
-#define _gloffset_Color3uiv 22
-#define _gloffset_Color3us 23
-#define _gloffset_Color3usv 24
-#define _gloffset_Color4b 25
-#define _gloffset_Color4bv 26
-#define _gloffset_Color4d 27
-#define _gloffset_Color4dv 28
-#define _gloffset_Color4f 29
-#define _gloffset_Color4fv 30
-#define _gloffset_Color4i 31
-#define _gloffset_Color4iv 32
-#define _gloffset_Color4s 33
-#define _gloffset_Color4sv 34
-#define _gloffset_Color4ub 35
-#define _gloffset_Color4ubv 36
-#define _gloffset_Color4ui 37
-#define _gloffset_Color4uiv 38
-#define _gloffset_Color4us 39
-#define _gloffset_Color4usv 40
-#define _gloffset_EdgeFlag 41
-#define _gloffset_EdgeFlagv 42
-#define _gloffset_End 43
-#define _gloffset_Indexd 44
-#define _gloffset_Indexdv 45
-#define _gloffset_Indexf 46
-#define _gloffset_Indexfv 47
-#define _gloffset_Indexi 48
-#define _gloffset_Indexiv 49
-#define _gloffset_Indexs 50
-#define _gloffset_Indexsv 51
-#define _gloffset_Normal3b 52
-#define _gloffset_Normal3bv 53
-#define _gloffset_Normal3d 54
-#define _gloffset_Normal3dv 55
-#define _gloffset_Normal3f 56
-#define _gloffset_Normal3fv 57
-#define _gloffset_Normal3i 58
-#define _gloffset_Normal3iv 59
-#define _gloffset_Normal3s 60
-#define _gloffset_Normal3sv 61
-#define _gloffset_RasterPos2d 62
-#define _gloffset_RasterPos2dv 63
-#define _gloffset_RasterPos2f 64
-#define _gloffset_RasterPos2fv 65
-#define _gloffset_RasterPos2i 66
-#define _gloffset_RasterPos2iv 67
-#define _gloffset_RasterPos2s 68
-#define _gloffset_RasterPos2sv 69
-#define _gloffset_RasterPos3d 70
-#define _gloffset_RasterPos3dv 71
-#define _gloffset_RasterPos3f 72
-#define _gloffset_RasterPos3fv 73
-#define _gloffset_RasterPos3i 74
-#define _gloffset_RasterPos3iv 75
-#define _gloffset_RasterPos3s 76
-#define _gloffset_RasterPos3sv 77
-#define _gloffset_RasterPos4d 78
-#define _gloffset_RasterPos4dv 79
-#define _gloffset_RasterPos4f 80
-#define _gloffset_RasterPos4fv 81
-#define _gloffset_RasterPos4i 82
-#define _gloffset_RasterPos4iv 83
-#define _gloffset_RasterPos4s 84
-#define _gloffset_RasterPos4sv 85
-#define _gloffset_Rectd 86
-#define _gloffset_Rectdv 87
-#define _gloffset_Rectf 88
-#define _gloffset_Rectfv 89
-#define _gloffset_Recti 90
-#define _gloffset_Rectiv 91
-#define _gloffset_Rects 92
-#define _gloffset_Rectsv 93
-#define _gloffset_TexCoord1d 94
-#define _gloffset_TexCoord1dv 95
-#define _gloffset_TexCoord1f 96
-#define _gloffset_TexCoord1fv 97
-#define _gloffset_TexCoord1i 98
-#define _gloffset_TexCoord1iv 99
-#define _gloffset_TexCoord1s 100
-#define _gloffset_TexCoord1sv 101
-#define _gloffset_TexCoord2d 102
-#define _gloffset_TexCoord2dv 103
-#define _gloffset_TexCoord2f 104
-#define _gloffset_TexCoord2fv 105
-#define _gloffset_TexCoord2i 106
-#define _gloffset_TexCoord2iv 107
-#define _gloffset_TexCoord2s 108
-#define _gloffset_TexCoord2sv 109
-#define _gloffset_TexCoord3d 110
-#define _gloffset_TexCoord3dv 111
-#define _gloffset_TexCoord3f 112
-#define _gloffset_TexCoord3fv 113
-#define _gloffset_TexCoord3i 114
-#define _gloffset_TexCoord3iv 115
-#define _gloffset_TexCoord3s 116
-#define _gloffset_TexCoord3sv 117
-#define _gloffset_TexCoord4d 118
-#define _gloffset_TexCoord4dv 119
-#define _gloffset_TexCoord4f 120
-#define _gloffset_TexCoord4fv 121
-#define _gloffset_TexCoord4i 122
-#define _gloffset_TexCoord4iv 123
-#define _gloffset_TexCoord4s 124
-#define _gloffset_TexCoord4sv 125
-#define _gloffset_Vertex2d 126
-#define _gloffset_Vertex2dv 127
-#define _gloffset_Vertex2f 128
-#define _gloffset_Vertex2fv 129
-#define _gloffset_Vertex2i 130
-#define _gloffset_Vertex2iv 131
-#define _gloffset_Vertex2s 132
-#define _gloffset_Vertex2sv 133
-#define _gloffset_Vertex3d 134
-#define _gloffset_Vertex3dv 135
-#define _gloffset_Vertex3f 136
-#define _gloffset_Vertex3fv 137
-#define _gloffset_Vertex3i 138
-#define _gloffset_Vertex3iv 139
-#define _gloffset_Vertex3s 140
-#define _gloffset_Vertex3sv 141
-#define _gloffset_Vertex4d 142
-#define _gloffset_Vertex4dv 143
-#define _gloffset_Vertex4f 144
-#define _gloffset_Vertex4fv 145
-#define _gloffset_Vertex4i 146
-#define _gloffset_Vertex4iv 147
-#define _gloffset_Vertex4s 148
-#define _gloffset_Vertex4sv 149
-#define _gloffset_ClipPlane 150
-#define _gloffset_ColorMaterial 151
-#define _gloffset_CullFace 152
-#define _gloffset_Fogf 153
-#define _gloffset_Fogfv 154
-#define _gloffset_Fogi 155
-#define _gloffset_Fogiv 156
-#define _gloffset_FrontFace 157
-#define _gloffset_Hint 158
-#define _gloffset_Lightf 159
-#define _gloffset_Lightfv 160
-#define _gloffset_Lighti 161
-#define _gloffset_Lightiv 162
-#define _gloffset_LightModelf 163
-#define _gloffset_LightModelfv 164
-#define _gloffset_LightModeli 165
-#define _gloffset_LightModeliv 166
-#define _gloffset_LineStipple 167
-#define _gloffset_LineWidth 168
-#define _gloffset_Materialf 169
-#define _gloffset_Materialfv 170
-#define _gloffset_Materiali 171
-#define _gloffset_Materialiv 172
-#define _gloffset_PointSize 173
-#define _gloffset_PolygonMode 174
-#define _gloffset_PolygonStipple 175
-#define _gloffset_Scissor 176
-#define _gloffset_ShadeModel 177
-#define _gloffset_TexParameterf 178
-#define _gloffset_TexParameterfv 179
-#define _gloffset_TexParameteri 180
-#define _gloffset_TexParameteriv 181
-#define _gloffset_TexImage1D 182
-#define _gloffset_TexImage2D 183
-#define _gloffset_TexEnvf 184
-#define _gloffset_TexEnvfv 185
-#define _gloffset_TexEnvi 186
-#define _gloffset_TexEnviv 187
-#define _gloffset_TexGend 188
-#define _gloffset_TexGendv 189
-#define _gloffset_TexGenf 190
-#define _gloffset_TexGenfv 191
-#define _gloffset_TexGeni 192
-#define _gloffset_TexGeniv 193
-#define _gloffset_FeedbackBuffer 194
-#define _gloffset_SelectBuffer 195
-#define _gloffset_RenderMode 196
-#define _gloffset_InitNames 197
-#define _gloffset_LoadName 198
-#define _gloffset_PassThrough 199
-#define _gloffset_PopName 200
-#define _gloffset_PushName 201
-#define _gloffset_DrawBuffer 202
-#define _gloffset_Clear 203
-#define _gloffset_ClearAccum 204
-#define _gloffset_ClearIndex 205
-#define _gloffset_ClearColor 206
-#define _gloffset_ClearStencil 207
-#define _gloffset_ClearDepth 208
-#define _gloffset_StencilMask 209
-#define _gloffset_ColorMask 210
-#define _gloffset_DepthMask 211
-#define _gloffset_IndexMask 212
-#define _gloffset_Accum 213
-#define _gloffset_Disable 214
-#define _gloffset_Enable 215
-#define _gloffset_Finish 216
-#define _gloffset_Flush 217
-#define _gloffset_PopAttrib 218
-#define _gloffset_PushAttrib 219
-#define _gloffset_Map1d 220
-#define _gloffset_Map1f 221
-#define _gloffset_Map2d 222
-#define _gloffset_Map2f 223
-#define _gloffset_MapGrid1d 224
-#define _gloffset_MapGrid1f 225
-#define _gloffset_MapGrid2d 226
-#define _gloffset_MapGrid2f 227
-#define _gloffset_EvalCoord1d 228
-#define _gloffset_EvalCoord1dv 229
-#define _gloffset_EvalCoord1f 230
-#define _gloffset_EvalCoord1fv 231
-#define _gloffset_EvalCoord2d 232
-#define _gloffset_EvalCoord2dv 233
-#define _gloffset_EvalCoord2f 234
-#define _gloffset_EvalCoord2fv 235
-#define _gloffset_EvalMesh1 236
-#define _gloffset_EvalPoint1 237
-#define _gloffset_EvalMesh2 238
-#define _gloffset_EvalPoint2 239
-#define _gloffset_AlphaFunc 240
-#define _gloffset_BlendFunc 241
-#define _gloffset_LogicOp 242
-#define _gloffset_StencilFunc 243
-#define _gloffset_StencilOp 244
-#define _gloffset_DepthFunc 245
-#define _gloffset_PixelZoom 246
-#define _gloffset_PixelTransferf 247
-#define _gloffset_PixelTransferi 248
-#define _gloffset_PixelStoref 249
-#define _gloffset_PixelStorei 250
-#define _gloffset_PixelMapfv 251
-#define _gloffset_PixelMapuiv 252
-#define _gloffset_PixelMapusv 253
-#define _gloffset_ReadBuffer 254
-#define _gloffset_CopyPixels 255
-#define _gloffset_ReadPixels 256
-#define _gloffset_DrawPixels 257
-#define _gloffset_GetBooleanv 258
-#define _gloffset_GetClipPlane 259
-#define _gloffset_GetDoublev 260
-#define _gloffset_GetError 261
-#define _gloffset_GetFloatv 262
-#define _gloffset_GetIntegerv 263
-#define _gloffset_GetLightfv 264
-#define _gloffset_GetLightiv 265
-#define _gloffset_GetMapdv 266
-#define _gloffset_GetMapfv 267
-#define _gloffset_GetMapiv 268
-#define _gloffset_GetMaterialfv 269
-#define _gloffset_GetMaterialiv 270
-#define _gloffset_GetPixelMapfv 271
-#define _gloffset_GetPixelMapuiv 272
-#define _gloffset_GetPixelMapusv 273
-#define _gloffset_GetPolygonStipple 274
-#define _gloffset_GetString 275
-#define _gloffset_GetTexEnvfv 276
-#define _gloffset_GetTexEnviv 277
-#define _gloffset_GetTexGendv 278
-#define _gloffset_GetTexGenfv 279
-#define _gloffset_GetTexGeniv 280
-#define _gloffset_GetTexImage 281
-#define _gloffset_GetTexParameterfv 282
-#define _gloffset_GetTexParameteriv 283
-#define _gloffset_GetTexLevelParameterfv 284
-#define _gloffset_GetTexLevelParameteriv 285
-#define _gloffset_IsEnabled 286
-#define _gloffset_IsList 287
-#define _gloffset_DepthRange 288
-#define _gloffset_Frustum 289
-#define _gloffset_LoadIdentity 290
-#define _gloffset_LoadMatrixf 291
-#define _gloffset_LoadMatrixd 292
-#define _gloffset_MatrixMode 293
-#define _gloffset_MultMatrixf 294
-#define _gloffset_MultMatrixd 295
-#define _gloffset_Ortho 296
-#define _gloffset_PopMatrix 297
-#define _gloffset_PushMatrix 298
-#define _gloffset_Rotated 299
-#define _gloffset_Rotatef 300
-#define _gloffset_Scaled 301
-#define _gloffset_Scalef 302
-#define _gloffset_Translated 303
-#define _gloffset_Translatef 304
-#define _gloffset_Viewport 305
-#define _gloffset_ArrayElement 306
-#define _gloffset_BindTexture 307
-#define _gloffset_ColorPointer 308
-#define _gloffset_DisableClientState 309
-#define _gloffset_DrawArrays 310
-#define _gloffset_DrawElements 311
-#define _gloffset_EdgeFlagPointer 312
-#define _gloffset_EnableClientState 313
-#define _gloffset_IndexPointer 314
-#define _gloffset_Indexub 315
-#define _gloffset_Indexubv 316
-#define _gloffset_InterleavedArrays 317
-#define _gloffset_NormalPointer 318
-#define _gloffset_PolygonOffset 319
-#define _gloffset_TexCoordPointer 320
-#define _gloffset_VertexPointer 321
-#define _gloffset_AreTexturesResident 322
-#define _gloffset_CopyTexImage1D 323
-#define _gloffset_CopyTexImage2D 324
-#define _gloffset_CopyTexSubImage1D 325
-#define _gloffset_CopyTexSubImage2D 326
-#define _gloffset_DeleteTextures 327
-#define _gloffset_GenTextures 328
-#define _gloffset_GetPointerv 329
-#define _gloffset_IsTexture 330
-#define _gloffset_PrioritizeTextures 331
-#define _gloffset_TexSubImage1D 332
-#define _gloffset_TexSubImage2D 333
-#define _gloffset_PopClientAttrib 334
-#define _gloffset_PushClientAttrib 335
-#define _gloffset_BlendColor 336
-#define _gloffset_BlendEquation 337
-#define _gloffset_DrawRangeElements 338
-#define _gloffset_ColorTable 339
-#define _gloffset_ColorTableParameterfv 340
-#define _gloffset_ColorTableParameteriv 341
-#define _gloffset_CopyColorTable 342
-#define _gloffset_GetColorTable 343
-#define _gloffset_GetColorTableParameterfv 344
-#define _gloffset_GetColorTableParameteriv 345
-#define _gloffset_ColorSubTable 346
-#define _gloffset_CopyColorSubTable 347
-#define _gloffset_ConvolutionFilter1D 348
-#define _gloffset_ConvolutionFilter2D 349
-#define _gloffset_ConvolutionParameterf 350
-#define _gloffset_ConvolutionParameterfv 351
-#define _gloffset_ConvolutionParameteri 352
-#define _gloffset_ConvolutionParameteriv 353
-#define _gloffset_CopyConvolutionFilter1D 354
-#define _gloffset_CopyConvolutionFilter2D 355
-#define _gloffset_GetConvolutionFilter 356
-#define _gloffset_GetConvolutionParameterfv 357
-#define _gloffset_GetConvolutionParameteriv 358
-#define _gloffset_GetSeparableFilter 359
-#define _gloffset_SeparableFilter2D 360
-#define _gloffset_GetHistogram 361
-#define _gloffset_GetHistogramParameterfv 362
-#define _gloffset_GetHistogramParameteriv 363
-#define _gloffset_GetMinmax 364
-#define _gloffset_GetMinmaxParameterfv 365
-#define _gloffset_GetMinmaxParameteriv 366
-#define _gloffset_Histogram 367
-#define _gloffset_Minmax 368
-#define _gloffset_ResetHistogram 369
-#define _gloffset_ResetMinmax 370
-#define _gloffset_TexImage3D 371
-#define _gloffset_TexSubImage3D 372
-#define _gloffset_CopyTexSubImage3D 373
-#define _gloffset_ActiveTextureARB 374
-#define _gloffset_ClientActiveTextureARB 375
-#define _gloffset_MultiTexCoord1dARB 376
-#define _gloffset_MultiTexCoord1dvARB 377
-#define _gloffset_MultiTexCoord1fARB 378
-#define _gloffset_MultiTexCoord1fvARB 379
-#define _gloffset_MultiTexCoord1iARB 380
-#define _gloffset_MultiTexCoord1ivARB 381
-#define _gloffset_MultiTexCoord1sARB 382
-#define _gloffset_MultiTexCoord1svARB 383
-#define _gloffset_MultiTexCoord2dARB 384
-#define _gloffset_MultiTexCoord2dvARB 385
-#define _gloffset_MultiTexCoord2fARB 386
-#define _gloffset_MultiTexCoord2fvARB 387
-#define _gloffset_MultiTexCoord2iARB 388
-#define _gloffset_MultiTexCoord2ivARB 389
-#define _gloffset_MultiTexCoord2sARB 390
-#define _gloffset_MultiTexCoord2svARB 391
-#define _gloffset_MultiTexCoord3dARB 392
-#define _gloffset_MultiTexCoord3dvARB 393
-#define _gloffset_MultiTexCoord3fARB 394
-#define _gloffset_MultiTexCoord3fvARB 395
-#define _gloffset_MultiTexCoord3iARB 396
-#define _gloffset_MultiTexCoord3ivARB 397
-#define _gloffset_MultiTexCoord3sARB 398
-#define _gloffset_MultiTexCoord3svARB 399
-#define _gloffset_MultiTexCoord4dARB 400
-#define _gloffset_MultiTexCoord4dvARB 401
-#define _gloffset_MultiTexCoord4fARB 402
-#define _gloffset_MultiTexCoord4fvARB 403
-#define _gloffset_MultiTexCoord4iARB 404
-#define _gloffset_MultiTexCoord4ivARB 405
-#define _gloffset_MultiTexCoord4sARB 406
-#define _gloffset_MultiTexCoord4svARB 407
-
-#if !FEATURE_remap_table
-
-#define _gloffset_AttachShader 408
-#define _gloffset_CreateProgram 409
-#define _gloffset_CreateShader 410
-#define _gloffset_DeleteProgram 411
-#define _gloffset_DeleteShader 412
-#define _gloffset_DetachShader 413
-#define _gloffset_GetAttachedShaders 414
-#define _gloffset_GetProgramInfoLog 415
-#define _gloffset_GetProgramiv 416
-#define _gloffset_GetShaderInfoLog 417
-#define _gloffset_GetShaderiv 418
-#define _gloffset_IsProgram 419
-#define _gloffset_IsShader 420
-#define _gloffset_StencilFuncSeparate 421
-#define _gloffset_StencilMaskSeparate 422
-#define _gloffset_StencilOpSeparate 423
-#define _gloffset_UniformMatrix2x3fv 424
-#define _gloffset_UniformMatrix2x4fv 425
-#define _gloffset_UniformMatrix3x2fv 426
-#define _gloffset_UniformMatrix3x4fv 427
-#define _gloffset_UniformMatrix4x2fv 428
-#define _gloffset_UniformMatrix4x3fv 429
-#define _gloffset_ClampColor 430
-#define _gloffset_ClearBufferfi 431
-#define _gloffset_ClearBufferfv 432
-#define _gloffset_ClearBufferiv 433
-#define _gloffset_ClearBufferuiv 434
-#define _gloffset_GetStringi 435
-#define _gloffset_TexBuffer 436
-#define _gloffset_FramebufferTexture 437
-#define _gloffset_GetBufferParameteri64v 438
-#define _gloffset_GetInteger64i_v 439
-#define _gloffset_VertexAttribDivisor 440
-#define _gloffset_LoadTransposeMatrixdARB 441
-#define _gloffset_LoadTransposeMatrixfARB 442
-#define _gloffset_MultTransposeMatrixdARB 443
-#define _gloffset_MultTransposeMatrixfARB 444
-#define _gloffset_SampleCoverageARB 445
-#define _gloffset_CompressedTexImage1DARB 446
-#define _gloffset_CompressedTexImage2DARB 447
-#define _gloffset_CompressedTexImage3DARB 448
-#define _gloffset_CompressedTexSubImage1DARB 449
-#define _gloffset_CompressedTexSubImage2DARB 450
-#define _gloffset_CompressedTexSubImage3DARB 451
-#define _gloffset_GetCompressedTexImageARB 452
-#define _gloffset_DisableVertexAttribArrayARB 453
-#define _gloffset_EnableVertexAttribArrayARB 454
-#define _gloffset_GetProgramEnvParameterdvARB 455
-#define _gloffset_GetProgramEnvParameterfvARB 456
-#define _gloffset_GetProgramLocalParameterdvARB 457
-#define _gloffset_GetProgramLocalParameterfvARB 458
-#define _gloffset_GetProgramStringARB 459
-#define _gloffset_GetProgramivARB 460
-#define _gloffset_GetVertexAttribdvARB 461
-#define _gloffset_GetVertexAttribfvARB 462
-#define _gloffset_GetVertexAttribivARB 463
-#define _gloffset_ProgramEnvParameter4dARB 464
-#define _gloffset_ProgramEnvParameter4dvARB 465
-#define _gloffset_ProgramEnvParameter4fARB 466
-#define _gloffset_ProgramEnvParameter4fvARB 467
-#define _gloffset_ProgramLocalParameter4dARB 468
-#define _gloffset_ProgramLocalParameter4dvARB 469
-#define _gloffset_ProgramLocalParameter4fARB 470
-#define _gloffset_ProgramLocalParameter4fvARB 471
-#define _gloffset_ProgramStringARB 472
-#define _gloffset_VertexAttrib1dARB 473
-#define _gloffset_VertexAttrib1dvARB 474
-#define _gloffset_VertexAttrib1fARB 475
-#define _gloffset_VertexAttrib1fvARB 476
-#define _gloffset_VertexAttrib1sARB 477
-#define _gloffset_VertexAttrib1svARB 478
-#define _gloffset_VertexAttrib2dARB 479
-#define _gloffset_VertexAttrib2dvARB 480
-#define _gloffset_VertexAttrib2fARB 481
-#define _gloffset_VertexAttrib2fvARB 482
-#define _gloffset_VertexAttrib2sARB 483
-#define _gloffset_VertexAttrib2svARB 484
-#define _gloffset_VertexAttrib3dARB 485
-#define _gloffset_VertexAttrib3dvARB 486
-#define _gloffset_VertexAttrib3fARB 487
-#define _gloffset_VertexAttrib3fvARB 488
-#define _gloffset_VertexAttrib3sARB 489
-#define _gloffset_VertexAttrib3svARB 490
-#define _gloffset_VertexAttrib4NbvARB 491
-#define _gloffset_VertexAttrib4NivARB 492
-#define _gloffset_VertexAttrib4NsvARB 493
-#define _gloffset_VertexAttrib4NubARB 494
-#define _gloffset_VertexAttrib4NubvARB 495
-#define _gloffset_VertexAttrib4NuivARB 496
-#define _gloffset_VertexAttrib4NusvARB 497
-#define _gloffset_VertexAttrib4bvARB 498
-#define _gloffset_VertexAttrib4dARB 499
-#define _gloffset_VertexAttrib4dvARB 500
-#define _gloffset_VertexAttrib4fARB 501
-#define _gloffset_VertexAttrib4fvARB 502
-#define _gloffset_VertexAttrib4ivARB 503
-#define _gloffset_VertexAttrib4sARB 504
-#define _gloffset_VertexAttrib4svARB 505
-#define _gloffset_VertexAttrib4ubvARB 506
-#define _gloffset_VertexAttrib4uivARB 507
-#define _gloffset_VertexAttrib4usvARB 508
-#define _gloffset_VertexAttribPointerARB 509
-#define _gloffset_BindBufferARB 510
-#define _gloffset_BufferDataARB 511
-#define _gloffset_BufferSubDataARB 512
-#define _gloffset_DeleteBuffersARB 513
-#define _gloffset_GenBuffersARB 514
-#define _gloffset_GetBufferParameterivARB 515
-#define _gloffset_GetBufferPointervARB 516
-#define _gloffset_GetBufferSubDataARB 517
-#define _gloffset_IsBufferARB 518
-#define _gloffset_MapBufferARB 519
-#define _gloffset_UnmapBufferARB 520
-#define _gloffset_BeginQueryARB 521
-#define _gloffset_DeleteQueriesARB 522
-#define _gloffset_EndQueryARB 523
-#define _gloffset_GenQueriesARB 524
-#define _gloffset_GetQueryObjectivARB 525
-#define _gloffset_GetQueryObjectuivARB 526
-#define _gloffset_GetQueryivARB 527
-#define _gloffset_IsQueryARB 528
-#define _gloffset_AttachObjectARB 529
-#define _gloffset_CompileShaderARB 530
-#define _gloffset_CreateProgramObjectARB 531
-#define _gloffset_CreateShaderObjectARB 532
-#define _gloffset_DeleteObjectARB 533
-#define _gloffset_DetachObjectARB 534
-#define _gloffset_GetActiveUniformARB 535
-#define _gloffset_GetAttachedObjectsARB 536
-#define _gloffset_GetHandleARB 537
-#define _gloffset_GetInfoLogARB 538
-#define _gloffset_GetObjectParameterfvARB 539
-#define _gloffset_GetObjectParameterivARB 540
-#define _gloffset_GetShaderSourceARB 541
-#define _gloffset_GetUniformLocationARB 542
-#define _gloffset_GetUniformfvARB 543
-#define _gloffset_GetUniformivARB 544
-#define _gloffset_LinkProgramARB 545
-#define _gloffset_ShaderSourceARB 546
-#define _gloffset_Uniform1fARB 547
-#define _gloffset_Uniform1fvARB 548
-#define _gloffset_Uniform1iARB 549
-#define _gloffset_Uniform1ivARB 550
-#define _gloffset_Uniform2fARB 551
-#define _gloffset_Uniform2fvARB 552
-#define _gloffset_Uniform2iARB 553
-#define _gloffset_Uniform2ivARB 554
-#define _gloffset_Uniform3fARB 555
-#define _gloffset_Uniform3fvARB 556
-#define _gloffset_Uniform3iARB 557
-#define _gloffset_Uniform3ivARB 558
-#define _gloffset_Uniform4fARB 559
-#define _gloffset_Uniform4fvARB 560
-#define _gloffset_Uniform4iARB 561
-#define _gloffset_Uniform4ivARB 562
-#define _gloffset_UniformMatrix2fvARB 563
-#define _gloffset_UniformMatrix3fvARB 564
-#define _gloffset_UniformMatrix4fvARB 565
-#define _gloffset_UseProgramObjectARB 566
-#define _gloffset_ValidateProgramARB 567
-#define _gloffset_BindAttribLocationARB 568
-#define _gloffset_GetActiveAttribARB 569
-#define _gloffset_GetAttribLocationARB 570
-#define _gloffset_DrawBuffersARB 571
-#define _gloffset_ClampColorARB 572
-#define _gloffset_DrawArraysInstancedARB 573
-#define _gloffset_DrawElementsInstancedARB 574
-#define _gloffset_RenderbufferStorageMultisample 575
-#define _gloffset_FramebufferTextureARB 576
-#define _gloffset_FramebufferTextureFaceARB 577
-#define _gloffset_ProgramParameteriARB 578
-#define _gloffset_VertexAttribDivisorARB 579
-#define _gloffset_FlushMappedBufferRange 580
-#define _gloffset_MapBufferRange 581
-#define _gloffset_TexBufferARB 582
-#define _gloffset_BindVertexArray 583
-#define _gloffset_GenVertexArrays 584
-#define _gloffset_CopyBufferSubData 585
-#define _gloffset_ClientWaitSync 586
-#define _gloffset_DeleteSync 587
-#define _gloffset_FenceSync 588
-#define _gloffset_GetInteger64v 589
-#define _gloffset_GetSynciv 590
-#define _gloffset_IsSync 591
-#define _gloffset_WaitSync 592
-#define _gloffset_DrawElementsBaseVertex 593
-#define _gloffset_DrawElementsInstancedBaseVertex 594
-#define _gloffset_DrawRangeElementsBaseVertex 595
-#define _gloffset_MultiDrawElementsBaseVertex 596
-#define _gloffset_BlendEquationSeparateiARB 597
-#define _gloffset_BlendEquationiARB 598
-#define _gloffset_BlendFuncSeparateiARB 599
-#define _gloffset_BlendFunciARB 600
-#define _gloffset_BindSampler 601
-#define _gloffset_DeleteSamplers 602
-#define _gloffset_GenSamplers 603
-#define _gloffset_GetSamplerParameterIiv 604
-#define _gloffset_GetSamplerParameterIuiv 605
-#define _gloffset_GetSamplerParameterfv 606
-#define _gloffset_GetSamplerParameteriv 607
-#define _gloffset_IsSampler 608
-#define _gloffset_SamplerParameterIiv 609
-#define _gloffset_SamplerParameterIuiv 610
-#define _gloffset_SamplerParameterf 611
-#define _gloffset_SamplerParameterfv 612
-#define _gloffset_SamplerParameteri 613
-#define _gloffset_SamplerParameteriv 614
-#define _gloffset_ColorP3ui 615
-#define _gloffset_ColorP3uiv 616
-#define _gloffset_ColorP4ui 617
-#define _gloffset_ColorP4uiv 618
-#define _gloffset_MultiTexCoordP1ui 619
-#define _gloffset_MultiTexCoordP1uiv 620
-#define _gloffset_MultiTexCoordP2ui 621
-#define _gloffset_MultiTexCoordP2uiv 622
-#define _gloffset_MultiTexCoordP3ui 623
-#define _gloffset_MultiTexCoordP3uiv 624
-#define _gloffset_MultiTexCoordP4ui 625
-#define _gloffset_MultiTexCoordP4uiv 626
-#define _gloffset_NormalP3ui 627
-#define _gloffset_NormalP3uiv 628
-#define _gloffset_SecondaryColorP3ui 629
-#define _gloffset_SecondaryColorP3uiv 630
-#define _gloffset_TexCoordP1ui 631
-#define _gloffset_TexCoordP1uiv 632
-#define _gloffset_TexCoordP2ui 633
-#define _gloffset_TexCoordP2uiv 634
-#define _gloffset_TexCoordP3ui 635
-#define _gloffset_TexCoordP3uiv 636
-#define _gloffset_TexCoordP4ui 637
-#define _gloffset_TexCoordP4uiv 638
-#define _gloffset_VertexAttribP1ui 639
-#define _gloffset_VertexAttribP1uiv 640
-#define _gloffset_VertexAttribP2ui 641
-#define _gloffset_VertexAttribP2uiv 642
-#define _gloffset_VertexAttribP3ui 643
-#define _gloffset_VertexAttribP3uiv 644
-#define _gloffset_VertexAttribP4ui 645
-#define _gloffset_VertexAttribP4uiv 646
-#define _gloffset_VertexP2ui 647
-#define _gloffset_VertexP2uiv 648
-#define _gloffset_VertexP3ui 649
-#define _gloffset_VertexP3uiv 650
-#define _gloffset_VertexP4ui 651
-#define _gloffset_VertexP4uiv 652
-#define _gloffset_BindTransformFeedback 653
-#define _gloffset_DeleteTransformFeedbacks 654
-#define _gloffset_DrawTransformFeedback 655
-#define _gloffset_GenTransformFeedbacks 656
-#define _gloffset_IsTransformFeedback 657
-#define _gloffset_PauseTransformFeedback 658
-#define _gloffset_ResumeTransformFeedback 659
-#define _gloffset_ClearDepthf 660
-#define _gloffset_DepthRangef 661
-#define _gloffset_GetShaderPrecisionFormat 662
-#define _gloffset_ReleaseShaderCompiler 663
-#define _gloffset_ShaderBinary 664
-#define _gloffset_GetGraphicsResetStatusARB 665
-#define _gloffset_GetnColorTableARB 666
-#define _gloffset_GetnCompressedTexImageARB 667
-#define _gloffset_GetnConvolutionFilterARB 668
-#define _gloffset_GetnHistogramARB 669
-#define _gloffset_GetnMapdvARB 670
-#define _gloffset_GetnMapfvARB 671
-#define _gloffset_GetnMapivARB 672
-#define _gloffset_GetnMinmaxARB 673
-#define _gloffset_GetnPixelMapfvARB 674
-#define _gloffset_GetnPixelMapuivARB 675
-#define _gloffset_GetnPixelMapusvARB 676
-#define _gloffset_GetnPolygonStippleARB 677
-#define _gloffset_GetnSeparableFilterARB 678
-#define _gloffset_GetnTexImageARB 679
-#define _gloffset_GetnUniformdvARB 680
-#define _gloffset_GetnUniformfvARB 681
-#define _gloffset_GetnUniformivARB 682
-#define _gloffset_GetnUniformuivARB 683
-#define _gloffset_ReadnPixelsARB 684
-#define _gloffset_TexStorage1D 685
-#define _gloffset_TexStorage2D 686
-#define _gloffset_TexStorage3D 687
-#define _gloffset_TextureStorage1DEXT 688
-#define _gloffset_TextureStorage2DEXT 689
-#define _gloffset_TextureStorage3DEXT 690
-#define _gloffset_PolygonOffsetEXT 691
-#define _gloffset_GetPixelTexGenParameterfvSGIS 692
-#define _gloffset_GetPixelTexGenParameterivSGIS 693
-#define _gloffset_PixelTexGenParameterfSGIS 694
-#define _gloffset_PixelTexGenParameterfvSGIS 695
-#define _gloffset_PixelTexGenParameteriSGIS 696
-#define _gloffset_PixelTexGenParameterivSGIS 697
-#define _gloffset_SampleMaskSGIS 698
-#define _gloffset_SamplePatternSGIS 699
-#define _gloffset_ColorPointerEXT 700
-#define _gloffset_EdgeFlagPointerEXT 701
-#define _gloffset_IndexPointerEXT 702
-#define _gloffset_NormalPointerEXT 703
-#define _gloffset_TexCoordPointerEXT 704
-#define _gloffset_VertexPointerEXT 705
-#define _gloffset_PointParameterfEXT 706
-#define _gloffset_PointParameterfvEXT 707
-#define _gloffset_LockArraysEXT 708
-#define _gloffset_UnlockArraysEXT 709
-#define _gloffset_SecondaryColor3bEXT 710
-#define _gloffset_SecondaryColor3bvEXT 711
-#define _gloffset_SecondaryColor3dEXT 712
-#define _gloffset_SecondaryColor3dvEXT 713
-#define _gloffset_SecondaryColor3fEXT 714
-#define _gloffset_SecondaryColor3fvEXT 715
-#define _gloffset_SecondaryColor3iEXT 716
-#define _gloffset_SecondaryColor3ivEXT 717
-#define _gloffset_SecondaryColor3sEXT 718
-#define _gloffset_SecondaryColor3svEXT 719
-#define _gloffset_SecondaryColor3ubEXT 720
-#define _gloffset_SecondaryColor3ubvEXT 721
-#define _gloffset_SecondaryColor3uiEXT 722
-#define _gloffset_SecondaryColor3uivEXT 723
-#define _gloffset_SecondaryColor3usEXT 724
-#define _gloffset_SecondaryColor3usvEXT 725
-#define _gloffset_SecondaryColorPointerEXT 726
-#define _gloffset_MultiDrawArraysEXT 727
-#define _gloffset_MultiDrawElementsEXT 728
-#define _gloffset_FogCoordPointerEXT 729
-#define _gloffset_FogCoorddEXT 730
-#define _gloffset_FogCoorddvEXT 731
-#define _gloffset_FogCoordfEXT 732
-#define _gloffset_FogCoordfvEXT 733
-#define _gloffset_PixelTexGenSGIX 734
-#define _gloffset_BlendFuncSeparateEXT 735
-#define _gloffset_FlushVertexArrayRangeNV 736
-#define _gloffset_VertexArrayRangeNV 737
-#define _gloffset_CombinerInputNV 738
-#define _gloffset_CombinerOutputNV 739
-#define _gloffset_CombinerParameterfNV 740
-#define _gloffset_CombinerParameterfvNV 741
-#define _gloffset_CombinerParameteriNV 742
-#define _gloffset_CombinerParameterivNV 743
-#define _gloffset_FinalCombinerInputNV 744
-#define _gloffset_GetCombinerInputParameterfvNV 745
-#define _gloffset_GetCombinerInputParameterivNV 746
-#define _gloffset_GetCombinerOutputParameterfvNV 747
-#define _gloffset_GetCombinerOutputParameterivNV 748
-#define _gloffset_GetFinalCombinerInputParameterfvNV 749
-#define _gloffset_GetFinalCombinerInputParameterivNV 750
-#define _gloffset_ResizeBuffersMESA 751
-#define _gloffset_WindowPos2dMESA 752
-#define _gloffset_WindowPos2dvMESA 753
-#define _gloffset_WindowPos2fMESA 754
-#define _gloffset_WindowPos2fvMESA 755
-#define _gloffset_WindowPos2iMESA 756
-#define _gloffset_WindowPos2ivMESA 757
-#define _gloffset_WindowPos2sMESA 758
-#define _gloffset_WindowPos2svMESA 759
-#define _gloffset_WindowPos3dMESA 760
-#define _gloffset_WindowPos3dvMESA 761
-#define _gloffset_WindowPos3fMESA 762
-#define _gloffset_WindowPos3fvMESA 763
-#define _gloffset_WindowPos3iMESA 764
-#define _gloffset_WindowPos3ivMESA 765
-#define _gloffset_WindowPos3sMESA 766
-#define _gloffset_WindowPos3svMESA 767
-#define _gloffset_WindowPos4dMESA 768
-#define _gloffset_WindowPos4dvMESA 769
-#define _gloffset_WindowPos4fMESA 770
-#define _gloffset_WindowPos4fvMESA 771
-#define _gloffset_WindowPos4iMESA 772
-#define _gloffset_WindowPos4ivMESA 773
-#define _gloffset_WindowPos4sMESA 774
-#define _gloffset_WindowPos4svMESA 775
-#define _gloffset_MultiModeDrawArraysIBM 776
-#define _gloffset_MultiModeDrawElementsIBM 777
-#define _gloffset_DeleteFencesNV 778
-#define _gloffset_FinishFenceNV 779
-#define _gloffset_GenFencesNV 780
-#define _gloffset_GetFenceivNV 781
-#define _gloffset_IsFenceNV 782
-#define _gloffset_SetFenceNV 783
-#define _gloffset_TestFenceNV 784
-#define _gloffset_AreProgramsResidentNV 785
-#define _gloffset_BindProgramNV 786
-#define _gloffset_DeleteProgramsNV 787
-#define _gloffset_ExecuteProgramNV 788
-#define _gloffset_GenProgramsNV 789
-#define _gloffset_GetProgramParameterdvNV 790
-#define _gloffset_GetProgramParameterfvNV 791
-#define _gloffset_GetProgramStringNV 792
-#define _gloffset_GetProgramivNV 793
-#define _gloffset_GetTrackMatrixivNV 794
-#define _gloffset_GetVertexAttribPointervNV 795
-#define _gloffset_GetVertexAttribdvNV 796
-#define _gloffset_GetVertexAttribfvNV 797
-#define _gloffset_GetVertexAttribivNV 798
-#define _gloffset_IsProgramNV 799
-#define _gloffset_LoadProgramNV 800
-#define _gloffset_ProgramParameters4dvNV 801
-#define _gloffset_ProgramParameters4fvNV 802
-#define _gloffset_RequestResidentProgramsNV 803
-#define _gloffset_TrackMatrixNV 804
-#define _gloffset_VertexAttrib1dNV 805
-#define _gloffset_VertexAttrib1dvNV 806
-#define _gloffset_VertexAttrib1fNV 807
-#define _gloffset_VertexAttrib1fvNV 808
-#define _gloffset_VertexAttrib1sNV 809
-#define _gloffset_VertexAttrib1svNV 810
-#define _gloffset_VertexAttrib2dNV 811
-#define _gloffset_VertexAttrib2dvNV 812
-#define _gloffset_VertexAttrib2fNV 813
-#define _gloffset_VertexAttrib2fvNV 814
-#define _gloffset_VertexAttrib2sNV 815
-#define _gloffset_VertexAttrib2svNV 816
-#define _gloffset_VertexAttrib3dNV 817
-#define _gloffset_VertexAttrib3dvNV 818
-#define _gloffset_VertexAttrib3fNV 819
-#define _gloffset_VertexAttrib3fvNV 820
-#define _gloffset_VertexAttrib3sNV 821
-#define _gloffset_VertexAttrib3svNV 822
-#define _gloffset_VertexAttrib4dNV 823
-#define _gloffset_VertexAttrib4dvNV 824
-#define _gloffset_VertexAttrib4fNV 825
-#define _gloffset_VertexAttrib4fvNV 826
-#define _gloffset_VertexAttrib4sNV 827
-#define _gloffset_VertexAttrib4svNV 828
-#define _gloffset_VertexAttrib4ubNV 829
-#define _gloffset_VertexAttrib4ubvNV 830
-#define _gloffset_VertexAttribPointerNV 831
-#define _gloffset_VertexAttribs1dvNV 832
-#define _gloffset_VertexAttribs1fvNV 833
-#define _gloffset_VertexAttribs1svNV 834
-#define _gloffset_VertexAttribs2dvNV 835
-#define _gloffset_VertexAttribs2fvNV 836
-#define _gloffset_VertexAttribs2svNV 837
-#define _gloffset_VertexAttribs3dvNV 838
-#define _gloffset_VertexAttribs3fvNV 839
-#define _gloffset_VertexAttribs3svNV 840
-#define _gloffset_VertexAttribs4dvNV 841
-#define _gloffset_VertexAttribs4fvNV 842
-#define _gloffset_VertexAttribs4svNV 843
-#define _gloffset_VertexAttribs4ubvNV 844
-#define _gloffset_GetTexBumpParameterfvATI 845
-#define _gloffset_GetTexBumpParameterivATI 846
-#define _gloffset_TexBumpParameterfvATI 847
-#define _gloffset_TexBumpParameterivATI 848
-#define _gloffset_AlphaFragmentOp1ATI 849
-#define _gloffset_AlphaFragmentOp2ATI 850
-#define _gloffset_AlphaFragmentOp3ATI 851
-#define _gloffset_BeginFragmentShaderATI 852
-#define _gloffset_BindFragmentShaderATI 853
-#define _gloffset_ColorFragmentOp1ATI 854
-#define _gloffset_ColorFragmentOp2ATI 855
-#define _gloffset_ColorFragmentOp3ATI 856
-#define _gloffset_DeleteFragmentShaderATI 857
-#define _gloffset_EndFragmentShaderATI 858
-#define _gloffset_GenFragmentShadersATI 859
-#define _gloffset_PassTexCoordATI 860
-#define _gloffset_SampleMapATI 861
-#define _gloffset_SetFragmentShaderConstantATI 862
-#define _gloffset_PointParameteriNV 863
-#define _gloffset_PointParameterivNV 864
-#define _gloffset_ActiveStencilFaceEXT 865
-#define _gloffset_BindVertexArrayAPPLE 866
-#define _gloffset_DeleteVertexArraysAPPLE 867
-#define _gloffset_GenVertexArraysAPPLE 868
-#define _gloffset_IsVertexArrayAPPLE 869
-#define _gloffset_GetProgramNamedParameterdvNV 870
-#define _gloffset_GetProgramNamedParameterfvNV 871
-#define _gloffset_ProgramNamedParameter4dNV 872
-#define _gloffset_ProgramNamedParameter4dvNV 873
-#define _gloffset_ProgramNamedParameter4fNV 874
-#define _gloffset_ProgramNamedParameter4fvNV 875
-#define _gloffset_PrimitiveRestartIndexNV 876
-#define _gloffset_PrimitiveRestartNV 877
-#define _gloffset_DepthBoundsEXT 878
-#define _gloffset_BlendEquationSeparateEXT 879
-#define _gloffset_BindFramebufferEXT 880
-#define _gloffset_BindRenderbufferEXT 881
-#define _gloffset_CheckFramebufferStatusEXT 882
-#define _gloffset_DeleteFramebuffersEXT 883
-#define _gloffset_DeleteRenderbuffersEXT 884
-#define _gloffset_FramebufferRenderbufferEXT 885
-#define _gloffset_FramebufferTexture1DEXT 886
-#define _gloffset_FramebufferTexture2DEXT 887
-#define _gloffset_FramebufferTexture3DEXT 888
-#define _gloffset_GenFramebuffersEXT 889
-#define _gloffset_GenRenderbuffersEXT 890
-#define _gloffset_GenerateMipmapEXT 891
-#define _gloffset_GetFramebufferAttachmentParameterivEXT 892
-#define _gloffset_GetRenderbufferParameterivEXT 893
-#define _gloffset_IsFramebufferEXT 894
-#define _gloffset_IsRenderbufferEXT 895
-#define _gloffset_RenderbufferStorageEXT 896
-#define _gloffset_BlitFramebufferEXT 897
-#define _gloffset_BufferParameteriAPPLE 898
-#define _gloffset_FlushMappedBufferRangeAPPLE 899
-#define _gloffset_BindFragDataLocationEXT 900
-#define _gloffset_GetFragDataLocationEXT 901
-#define _gloffset_GetUniformuivEXT 902
-#define _gloffset_GetVertexAttribIivEXT 903
-#define _gloffset_GetVertexAttribIuivEXT 904
-#define _gloffset_Uniform1uiEXT 905
-#define _gloffset_Uniform1uivEXT 906
-#define _gloffset_Uniform2uiEXT 907
-#define _gloffset_Uniform2uivEXT 908
-#define _gloffset_Uniform3uiEXT 909
-#define _gloffset_Uniform3uivEXT 910
-#define _gloffset_Uniform4uiEXT 911
-#define _gloffset_Uniform4uivEXT 912
-#define _gloffset_VertexAttribI1iEXT 913
-#define _gloffset_VertexAttribI1ivEXT 914
-#define _gloffset_VertexAttribI1uiEXT 915
-#define _gloffset_VertexAttribI1uivEXT 916
-#define _gloffset_VertexAttribI2iEXT 917
-#define _gloffset_VertexAttribI2ivEXT 918
-#define _gloffset_VertexAttribI2uiEXT 919
-#define _gloffset_VertexAttribI2uivEXT 920
-#define _gloffset_VertexAttribI3iEXT 921
-#define _gloffset_VertexAttribI3ivEXT 922
-#define _gloffset_VertexAttribI3uiEXT 923
-#define _gloffset_VertexAttribI3uivEXT 924
-#define _gloffset_VertexAttribI4bvEXT 925
-#define _gloffset_VertexAttribI4iEXT 926
-#define _gloffset_VertexAttribI4ivEXT 927
-#define _gloffset_VertexAttribI4svEXT 928
-#define _gloffset_VertexAttribI4ubvEXT 929
-#define _gloffset_VertexAttribI4uiEXT 930
-#define _gloffset_VertexAttribI4uivEXT 931
-#define _gloffset_VertexAttribI4usvEXT 932
-#define _gloffset_VertexAttribIPointerEXT 933
-#define _gloffset_FramebufferTextureLayerEXT 934
-#define _gloffset_ColorMaskIndexedEXT 935
-#define _gloffset_DisableIndexedEXT 936
-#define _gloffset_EnableIndexedEXT 937
-#define _gloffset_GetBooleanIndexedvEXT 938
-#define _gloffset_GetIntegerIndexedvEXT 939
-#define _gloffset_IsEnabledIndexedEXT 940
-#define _gloffset_ClearColorIiEXT 941
-#define _gloffset_ClearColorIuiEXT 942
-#define _gloffset_GetTexParameterIivEXT 943
-#define _gloffset_GetTexParameterIuivEXT 944
-#define _gloffset_TexParameterIivEXT 945
-#define _gloffset_TexParameterIuivEXT 946
-#define _gloffset_BeginConditionalRenderNV 947
-#define _gloffset_EndConditionalRenderNV 948
-#define _gloffset_BeginTransformFeedbackEXT 949
-#define _gloffset_BindBufferBaseEXT 950
-#define _gloffset_BindBufferOffsetEXT 951
-#define _gloffset_BindBufferRangeEXT 952
-#define _gloffset_EndTransformFeedbackEXT 953
-#define _gloffset_GetTransformFeedbackVaryingEXT 954
-#define _gloffset_TransformFeedbackVaryingsEXT 955
-#define _gloffset_ProvokingVertexEXT 956
-#define _gloffset_GetTexParameterPointervAPPLE 957
-#define _gloffset_TextureRangeAPPLE 958
-#define _gloffset_GetObjectParameterivAPPLE 959
-#define _gloffset_ObjectPurgeableAPPLE 960
-#define _gloffset_ObjectUnpurgeableAPPLE 961
-#define _gloffset_ActiveProgramEXT 962
-#define _gloffset_CreateShaderProgramEXT 963
-#define _gloffset_UseShaderProgramEXT 964
-#define _gloffset_TextureBarrierNV 965
-#define _gloffset_StencilFuncSeparateATI 966
-#define _gloffset_ProgramEnvParameters4fvEXT 967
-#define _gloffset_ProgramLocalParameters4fvEXT 968
-#define _gloffset_GetQueryObjecti64vEXT 969
-#define _gloffset_GetQueryObjectui64vEXT 970
-#define _gloffset_EGLImageTargetRenderbufferStorageOES 971
-#define _gloffset_EGLImageTargetTexture2DOES 972
-
-#else                           /* !FEATURE_remap_table */
-
-#define driDispatchRemapTable_size 565
-extern int driDispatchRemapTable[driDispatchRemapTable_size];
-
-#define AttachShader_remap_index 0
-#define CreateProgram_remap_index 1
-#define CreateShader_remap_index 2
-#define DeleteProgram_remap_index 3
-#define DeleteShader_remap_index 4
-#define DetachShader_remap_index 5
-#define GetAttachedShaders_remap_index 6
-#define GetProgramInfoLog_remap_index 7
-#define GetProgramiv_remap_index 8
-#define GetShaderInfoLog_remap_index 9
-#define GetShaderiv_remap_index 10
-#define IsProgram_remap_index 11
-#define IsShader_remap_index 12
-#define StencilFuncSeparate_remap_index 13
-#define StencilMaskSeparate_remap_index 14
-#define StencilOpSeparate_remap_index 15
-#define UniformMatrix2x3fv_remap_index 16
-#define UniformMatrix2x4fv_remap_index 17
-#define UniformMatrix3x2fv_remap_index 18
-#define UniformMatrix3x4fv_remap_index 19
-#define UniformMatrix4x2fv_remap_index 20
-#define UniformMatrix4x3fv_remap_index 21
-#define ClampColor_remap_index 22
-#define ClearBufferfi_remap_index 23
-#define ClearBufferfv_remap_index 24
-#define ClearBufferiv_remap_index 25
-#define ClearBufferuiv_remap_index 26
-#define GetStringi_remap_index 27
-#define TexBuffer_remap_index 28
-#define FramebufferTexture_remap_index 29
-#define GetBufferParameteri64v_remap_index 30
-#define GetInteger64i_v_remap_index 31
-#define VertexAttribDivisor_remap_index 32
-#define LoadTransposeMatrixdARB_remap_index 33
-#define LoadTransposeMatrixfARB_remap_index 34
-#define MultTransposeMatrixdARB_remap_index 35
-#define MultTransposeMatrixfARB_remap_index 36
-#define SampleCoverageARB_remap_index 37
-#define CompressedTexImage1DARB_remap_index 38
-#define CompressedTexImage2DARB_remap_index 39
-#define CompressedTexImage3DARB_remap_index 40
-#define CompressedTexSubImage1DARB_remap_index 41
-#define CompressedTexSubImage2DARB_remap_index 42
-#define CompressedTexSubImage3DARB_remap_index 43
-#define GetCompressedTexImageARB_remap_index 44
-#define DisableVertexAttribArrayARB_remap_index 45
-#define EnableVertexAttribArrayARB_remap_index 46
-#define GetProgramEnvParameterdvARB_remap_index 47
-#define GetProgramEnvParameterfvARB_remap_index 48
-#define GetProgramLocalParameterdvARB_remap_index 49
-#define GetProgramLocalParameterfvARB_remap_index 50
-#define GetProgramStringARB_remap_index 51
-#define GetProgramivARB_remap_index 52
-#define GetVertexAttribdvARB_remap_index 53
-#define GetVertexAttribfvARB_remap_index 54
-#define GetVertexAttribivARB_remap_index 55
-#define ProgramEnvParameter4dARB_remap_index 56
-#define ProgramEnvParameter4dvARB_remap_index 57
-#define ProgramEnvParameter4fARB_remap_index 58
-#define ProgramEnvParameter4fvARB_remap_index 59
-#define ProgramLocalParameter4dARB_remap_index 60
-#define ProgramLocalParameter4dvARB_remap_index 61
-#define ProgramLocalParameter4fARB_remap_index 62
-#define ProgramLocalParameter4fvARB_remap_index 63
-#define ProgramStringARB_remap_index 64
-#define VertexAttrib1dARB_remap_index 65
-#define VertexAttrib1dvARB_remap_index 66
-#define VertexAttrib1fARB_remap_index 67
-#define VertexAttrib1fvARB_remap_index 68
-#define VertexAttrib1sARB_remap_index 69
-#define VertexAttrib1svARB_remap_index 70
-#define VertexAttrib2dARB_remap_index 71
-#define VertexAttrib2dvARB_remap_index 72
-#define VertexAttrib2fARB_remap_index 73
-#define VertexAttrib2fvARB_remap_index 74
-#define VertexAttrib2sARB_remap_index 75
-#define VertexAttrib2svARB_remap_index 76
-#define VertexAttrib3dARB_remap_index 77
-#define VertexAttrib3dvARB_remap_index 78
-#define VertexAttrib3fARB_remap_index 79
-#define VertexAttrib3fvARB_remap_index 80
-#define VertexAttrib3sARB_remap_index 81
-#define VertexAttrib3svARB_remap_index 82
-#define VertexAttrib4NbvARB_remap_index 83
-#define VertexAttrib4NivARB_remap_index 84
-#define VertexAttrib4NsvARB_remap_index 85
-#define VertexAttrib4NubARB_remap_index 86
-#define VertexAttrib4NubvARB_remap_index 87
-#define VertexAttrib4NuivARB_remap_index 88
-#define VertexAttrib4NusvARB_remap_index 89
-#define VertexAttrib4bvARB_remap_index 90
-#define VertexAttrib4dARB_remap_index 91
-#define VertexAttrib4dvARB_remap_index 92
-#define VertexAttrib4fARB_remap_index 93
-#define VertexAttrib4fvARB_remap_index 94
-#define VertexAttrib4ivARB_remap_index 95
-#define VertexAttrib4sARB_remap_index 96
-#define VertexAttrib4svARB_remap_index 97
-#define VertexAttrib4ubvARB_remap_index 98
-#define VertexAttrib4uivARB_remap_index 99
-#define VertexAttrib4usvARB_remap_index 100
-#define VertexAttribPointerARB_remap_index 101
-#define BindBufferARB_remap_index 102
-#define BufferDataARB_remap_index 103
-#define BufferSubDataARB_remap_index 104
-#define DeleteBuffersARB_remap_index 105
-#define GenBuffersARB_remap_index 106
-#define GetBufferParameterivARB_remap_index 107
-#define GetBufferPointervARB_remap_index 108
-#define GetBufferSubDataARB_remap_index 109
-#define IsBufferARB_remap_index 110
-#define MapBufferARB_remap_index 111
-#define UnmapBufferARB_remap_index 112
-#define BeginQueryARB_remap_index 113
-#define DeleteQueriesARB_remap_index 114
-#define EndQueryARB_remap_index 115
-#define GenQueriesARB_remap_index 116
-#define GetQueryObjectivARB_remap_index 117
-#define GetQueryObjectuivARB_remap_index 118
-#define GetQueryivARB_remap_index 119
-#define IsQueryARB_remap_index 120
-#define AttachObjectARB_remap_index 121
-#define CompileShaderARB_remap_index 122
-#define CreateProgramObjectARB_remap_index 123
-#define CreateShaderObjectARB_remap_index 124
-#define DeleteObjectARB_remap_index 125
-#define DetachObjectARB_remap_index 126
-#define GetActiveUniformARB_remap_index 127
-#define GetAttachedObjectsARB_remap_index 128
-#define GetHandleARB_remap_index 129
-#define GetInfoLogARB_remap_index 130
-#define GetObjectParameterfvARB_remap_index 131
-#define GetObjectParameterivARB_remap_index 132
-#define GetShaderSourceARB_remap_index 133
-#define GetUniformLocationARB_remap_index 134
-#define GetUniformfvARB_remap_index 135
-#define GetUniformivARB_remap_index 136
-#define LinkProgramARB_remap_index 137
-#define ShaderSourceARB_remap_index 138
-#define Uniform1fARB_remap_index 139
-#define Uniform1fvARB_remap_index 140
-#define Uniform1iARB_remap_index 141
-#define Uniform1ivARB_remap_index 142
-#define Uniform2fARB_remap_index 143
-#define Uniform2fvARB_remap_index 144
-#define Uniform2iARB_remap_index 145
-#define Uniform2ivARB_remap_index 146
-#define Uniform3fARB_remap_index 147
-#define Uniform3fvARB_remap_index 148
-#define Uniform3iARB_remap_index 149
-#define Uniform3ivARB_remap_index 150
-#define Uniform4fARB_remap_index 151
-#define Uniform4fvARB_remap_index 152
-#define Uniform4iARB_remap_index 153
-#define Uniform4ivARB_remap_index 154
-#define UniformMatrix2fvARB_remap_index 155
-#define UniformMatrix3fvARB_remap_index 156
-#define UniformMatrix4fvARB_remap_index 157
-#define UseProgramObjectARB_remap_index 158
-#define ValidateProgramARB_remap_index 159
-#define BindAttribLocationARB_remap_index 160
-#define GetActiveAttribARB_remap_index 161
-#define GetAttribLocationARB_remap_index 162
-#define DrawBuffersARB_remap_index 163
-#define ClampColorARB_remap_index 164
-#define DrawArraysInstancedARB_remap_index 165
-#define DrawElementsInstancedARB_remap_index 166
-#define RenderbufferStorageMultisample_remap_index 167
-#define FramebufferTextureARB_remap_index 168
-#define FramebufferTextureFaceARB_remap_index 169
-#define ProgramParameteriARB_remap_index 170
-#define VertexAttribDivisorARB_remap_index 171
-#define FlushMappedBufferRange_remap_index 172
-#define MapBufferRange_remap_index 173
-#define TexBufferARB_remap_index 174
-#define BindVertexArray_remap_index 175
-#define GenVertexArrays_remap_index 176
-#define CopyBufferSubData_remap_index 177
-#define ClientWaitSync_remap_index 178
-#define DeleteSync_remap_index 179
-#define FenceSync_remap_index 180
-#define GetInteger64v_remap_index 181
-#define GetSynciv_remap_index 182
-#define IsSync_remap_index 183
-#define WaitSync_remap_index 184
-#define DrawElementsBaseVertex_remap_index 185
-#define DrawElementsInstancedBaseVertex_remap_index 186
-#define DrawRangeElementsBaseVertex_remap_index 187
-#define MultiDrawElementsBaseVertex_remap_index 188
-#define BlendEquationSeparateiARB_remap_index 189
-#define BlendEquationiARB_remap_index 190
-#define BlendFuncSeparateiARB_remap_index 191
-#define BlendFunciARB_remap_index 192
-#define BindSampler_remap_index 193
-#define DeleteSamplers_remap_index 194
-#define GenSamplers_remap_index 195
-#define GetSamplerParameterIiv_remap_index 196
-#define GetSamplerParameterIuiv_remap_index 197
-#define GetSamplerParameterfv_remap_index 198
-#define GetSamplerParameteriv_remap_index 199
-#define IsSampler_remap_index 200
-#define SamplerParameterIiv_remap_index 201
-#define SamplerParameterIuiv_remap_index 202
-#define SamplerParameterf_remap_index 203
-#define SamplerParameterfv_remap_index 204
-#define SamplerParameteri_remap_index 205
-#define SamplerParameteriv_remap_index 206
-#define ColorP3ui_remap_index 207
-#define ColorP3uiv_remap_index 208
-#define ColorP4ui_remap_index 209
-#define ColorP4uiv_remap_index 210
-#define MultiTexCoordP1ui_remap_index 211
-#define MultiTexCoordP1uiv_remap_index 212
-#define MultiTexCoordP2ui_remap_index 213
-#define MultiTexCoordP2uiv_remap_index 214
-#define MultiTexCoordP3ui_remap_index 215
-#define MultiTexCoordP3uiv_remap_index 216
-#define MultiTexCoordP4ui_remap_index 217
-#define MultiTexCoordP4uiv_remap_index 218
-#define NormalP3ui_remap_index 219
-#define NormalP3uiv_remap_index 220
-#define SecondaryColorP3ui_remap_index 221
-#define SecondaryColorP3uiv_remap_index 222
-#define TexCoordP1ui_remap_index 223
-#define TexCoordP1uiv_remap_index 224
-#define TexCoordP2ui_remap_index 225
-#define TexCoordP2uiv_remap_index 226
-#define TexCoordP3ui_remap_index 227
-#define TexCoordP3uiv_remap_index 228
-#define TexCoordP4ui_remap_index 229
-#define TexCoordP4uiv_remap_index 230
-#define VertexAttribP1ui_remap_index 231
-#define VertexAttribP1uiv_remap_index 232
-#define VertexAttribP2ui_remap_index 233
-#define VertexAttribP2uiv_remap_index 234
-#define VertexAttribP3ui_remap_index 235
-#define VertexAttribP3uiv_remap_index 236
-#define VertexAttribP4ui_remap_index 237
-#define VertexAttribP4uiv_remap_index 238
-#define VertexP2ui_remap_index 239
-#define VertexP2uiv_remap_index 240
-#define VertexP3ui_remap_index 241
-#define VertexP3uiv_remap_index 242
-#define VertexP4ui_remap_index 243
-#define VertexP4uiv_remap_index 244
-#define BindTransformFeedback_remap_index 245
-#define DeleteTransformFeedbacks_remap_index 246
-#define DrawTransformFeedback_remap_index 247
-#define GenTransformFeedbacks_remap_index 248
-#define IsTransformFeedback_remap_index 249
-#define PauseTransformFeedback_remap_index 250
-#define ResumeTransformFeedback_remap_index 251
-#define ClearDepthf_remap_index 252
-#define DepthRangef_remap_index 253
-#define GetShaderPrecisionFormat_remap_index 254
-#define ReleaseShaderCompiler_remap_index 255
-#define ShaderBinary_remap_index 256
-#define GetGraphicsResetStatusARB_remap_index 257
-#define GetnColorTableARB_remap_index 258
-#define GetnCompressedTexImageARB_remap_index 259
-#define GetnConvolutionFilterARB_remap_index 260
-#define GetnHistogramARB_remap_index 261
-#define GetnMapdvARB_remap_index 262
-#define GetnMapfvARB_remap_index 263
-#define GetnMapivARB_remap_index 264
-#define GetnMinmaxARB_remap_index 265
-#define GetnPixelMapfvARB_remap_index 266
-#define GetnPixelMapuivARB_remap_index 267
-#define GetnPixelMapusvARB_remap_index 268
-#define GetnPolygonStippleARB_remap_index 269
-#define GetnSeparableFilterARB_remap_index 270
-#define GetnTexImageARB_remap_index 271
-#define GetnUniformdvARB_remap_index 272
-#define GetnUniformfvARB_remap_index 273
-#define GetnUniformivARB_remap_index 274
-#define GetnUniformuivARB_remap_index 275
-#define ReadnPixelsARB_remap_index 276
-#define TexStorage1D_remap_index 277
-#define TexStorage2D_remap_index 278
-#define TexStorage3D_remap_index 279
-#define TextureStorage1DEXT_remap_index 280
-#define TextureStorage2DEXT_remap_index 281
-#define TextureStorage3DEXT_remap_index 282
-#define PolygonOffsetEXT_remap_index 283
-#define GetPixelTexGenParameterfvSGIS_remap_index 284
-#define GetPixelTexGenParameterivSGIS_remap_index 285
-#define PixelTexGenParameterfSGIS_remap_index 286
-#define PixelTexGenParameterfvSGIS_remap_index 287
-#define PixelTexGenParameteriSGIS_remap_index 288
-#define PixelTexGenParameterivSGIS_remap_index 289
-#define SampleMaskSGIS_remap_index 290
-#define SamplePatternSGIS_remap_index 291
-#define ColorPointerEXT_remap_index 292
-#define EdgeFlagPointerEXT_remap_index 293
-#define IndexPointerEXT_remap_index 294
-#define NormalPointerEXT_remap_index 295
-#define TexCoordPointerEXT_remap_index 296
-#define VertexPointerEXT_remap_index 297
-#define PointParameterfEXT_remap_index 298
-#define PointParameterfvEXT_remap_index 299
-#define LockArraysEXT_remap_index 300
-#define UnlockArraysEXT_remap_index 301
-#define SecondaryColor3bEXT_remap_index 302
-#define SecondaryColor3bvEXT_remap_index 303
-#define SecondaryColor3dEXT_remap_index 304
-#define SecondaryColor3dvEXT_remap_index 305
-#define SecondaryColor3fEXT_remap_index 306
-#define SecondaryColor3fvEXT_remap_index 307
-#define SecondaryColor3iEXT_remap_index 308
-#define SecondaryColor3ivEXT_remap_index 309
-#define SecondaryColor3sEXT_remap_index 310
-#define SecondaryColor3svEXT_remap_index 311
-#define SecondaryColor3ubEXT_remap_index 312
-#define SecondaryColor3ubvEXT_remap_index 313
-#define SecondaryColor3uiEXT_remap_index 314
-#define SecondaryColor3uivEXT_remap_index 315
-#define SecondaryColor3usEXT_remap_index 316
-#define SecondaryColor3usvEXT_remap_index 317
-#define SecondaryColorPointerEXT_remap_index 318
-#define MultiDrawArraysEXT_remap_index 319
-#define MultiDrawElementsEXT_remap_index 320
-#define FogCoordPointerEXT_remap_index 321
-#define FogCoorddEXT_remap_index 322
-#define FogCoorddvEXT_remap_index 323
-#define FogCoordfEXT_remap_index 324
-#define FogCoordfvEXT_remap_index 325
-#define PixelTexGenSGIX_remap_index 326
-#define BlendFuncSeparateEXT_remap_index 327
-#define FlushVertexArrayRangeNV_remap_index 328
-#define VertexArrayRangeNV_remap_index 329
-#define CombinerInputNV_remap_index 330
-#define CombinerOutputNV_remap_index 331
-#define CombinerParameterfNV_remap_index 332
-#define CombinerParameterfvNV_remap_index 333
-#define CombinerParameteriNV_remap_index 334
-#define CombinerParameterivNV_remap_index 335
-#define FinalCombinerInputNV_remap_index 336
-#define GetCombinerInputParameterfvNV_remap_index 337
-#define GetCombinerInputParameterivNV_remap_index 338
-#define GetCombinerOutputParameterfvNV_remap_index 339
-#define GetCombinerOutputParameterivNV_remap_index 340
-#define GetFinalCombinerInputParameterfvNV_remap_index 341
-#define GetFinalCombinerInputParameterivNV_remap_index 342
-#define ResizeBuffersMESA_remap_index 343
-#define WindowPos2dMESA_remap_index 344
-#define WindowPos2dvMESA_remap_index 345
-#define WindowPos2fMESA_remap_index 346
-#define WindowPos2fvMESA_remap_index 347
-#define WindowPos2iMESA_remap_index 348
-#define WindowPos2ivMESA_remap_index 349
-#define WindowPos2sMESA_remap_index 350
-#define WindowPos2svMESA_remap_index 351
-#define WindowPos3dMESA_remap_index 352
-#define WindowPos3dvMESA_remap_index 353
-#define WindowPos3fMESA_remap_index 354
-#define WindowPos3fvMESA_remap_index 355
-#define WindowPos3iMESA_remap_index 356
-#define WindowPos3ivMESA_remap_index 357
-#define WindowPos3sMESA_remap_index 358
-#define WindowPos3svMESA_remap_index 359
-#define WindowPos4dMESA_remap_index 360
-#define WindowPos4dvMESA_remap_index 361
-#define WindowPos4fMESA_remap_index 362
-#define WindowPos4fvMESA_remap_index 363
-#define WindowPos4iMESA_remap_index 364
-#define WindowPos4ivMESA_remap_index 365
-#define WindowPos4sMESA_remap_index 366
-#define WindowPos4svMESA_remap_index 367
-#define MultiModeDrawArraysIBM_remap_index 368
-#define MultiModeDrawElementsIBM_remap_index 369
-#define DeleteFencesNV_remap_index 370
-#define FinishFenceNV_remap_index 371
-#define GenFencesNV_remap_index 372
-#define GetFenceivNV_remap_index 373
-#define IsFenceNV_remap_index 374
-#define SetFenceNV_remap_index 375
-#define TestFenceNV_remap_index 376
-#define AreProgramsResidentNV_remap_index 377
-#define BindProgramNV_remap_index 378
-#define DeleteProgramsNV_remap_index 379
-#define ExecuteProgramNV_remap_index 380
-#define GenProgramsNV_remap_index 381
-#define GetProgramParameterdvNV_remap_index 382
-#define GetProgramParameterfvNV_remap_index 383
-#define GetProgramStringNV_remap_index 384
-#define GetProgramivNV_remap_index 385
-#define GetTrackMatrixivNV_remap_index 386
-#define GetVertexAttribPointervNV_remap_index 387
-#define GetVertexAttribdvNV_remap_index 388
-#define GetVertexAttribfvNV_remap_index 389
-#define GetVertexAttribivNV_remap_index 390
-#define IsProgramNV_remap_index 391
-#define LoadProgramNV_remap_index 392
-#define ProgramParameters4dvNV_remap_index 393
-#define ProgramParameters4fvNV_remap_index 394
-#define RequestResidentProgramsNV_remap_index 395
-#define TrackMatrixNV_remap_index 396
-#define VertexAttrib1dNV_remap_index 397
-#define VertexAttrib1dvNV_remap_index 398
-#define VertexAttrib1fNV_remap_index 399
-#define VertexAttrib1fvNV_remap_index 400
-#define VertexAttrib1sNV_remap_index 401
-#define VertexAttrib1svNV_remap_index 402
-#define VertexAttrib2dNV_remap_index 403
-#define VertexAttrib2dvNV_remap_index 404
-#define VertexAttrib2fNV_remap_index 405
-#define VertexAttrib2fvNV_remap_index 406
-#define VertexAttrib2sNV_remap_index 407
-#define VertexAttrib2svNV_remap_index 408
-#define VertexAttrib3dNV_remap_index 409
-#define VertexAttrib3dvNV_remap_index 410
-#define VertexAttrib3fNV_remap_index 411
-#define VertexAttrib3fvNV_remap_index 412
-#define VertexAttrib3sNV_remap_index 413
-#define VertexAttrib3svNV_remap_index 414
-#define VertexAttrib4dNV_remap_index 415
-#define VertexAttrib4dvNV_remap_index 416
-#define VertexAttrib4fNV_remap_index 417
-#define VertexAttrib4fvNV_remap_index 418
-#define VertexAttrib4sNV_remap_index 419
-#define VertexAttrib4svNV_remap_index 420
-#define VertexAttrib4ubNV_remap_index 421
-#define VertexAttrib4ubvNV_remap_index 422
-#define VertexAttribPointerNV_remap_index 423
-#define VertexAttribs1dvNV_remap_index 424
-#define VertexAttribs1fvNV_remap_index 425
-#define VertexAttribs1svNV_remap_index 426
-#define VertexAttribs2dvNV_remap_index 427
-#define VertexAttribs2fvNV_remap_index 428
-#define VertexAttribs2svNV_remap_index 429
-#define VertexAttribs3dvNV_remap_index 430
-#define VertexAttribs3fvNV_remap_index 431
-#define VertexAttribs3svNV_remap_index 432
-#define VertexAttribs4dvNV_remap_index 433
-#define VertexAttribs4fvNV_remap_index 434
-#define VertexAttribs4svNV_remap_index 435
-#define VertexAttribs4ubvNV_remap_index 436
-#define GetTexBumpParameterfvATI_remap_index 437
-#define GetTexBumpParameterivATI_remap_index 438
-#define TexBumpParameterfvATI_remap_index 439
-#define TexBumpParameterivATI_remap_index 440
-#define AlphaFragmentOp1ATI_remap_index 441
-#define AlphaFragmentOp2ATI_remap_index 442
-#define AlphaFragmentOp3ATI_remap_index 443
-#define BeginFragmentShaderATI_remap_index 444
-#define BindFragmentShaderATI_remap_index 445
-#define ColorFragmentOp1ATI_remap_index 446
-#define ColorFragmentOp2ATI_remap_index 447
-#define ColorFragmentOp3ATI_remap_index 448
-#define DeleteFragmentShaderATI_remap_index 449
-#define EndFragmentShaderATI_remap_index 450
-#define GenFragmentShadersATI_remap_index 451
-#define PassTexCoordATI_remap_index 452
-#define SampleMapATI_remap_index 453
-#define SetFragmentShaderConstantATI_remap_index 454
-#define PointParameteriNV_remap_index 455
-#define PointParameterivNV_remap_index 456
-#define ActiveStencilFaceEXT_remap_index 457
-#define BindVertexArrayAPPLE_remap_index 458
-#define DeleteVertexArraysAPPLE_remap_index 459
-#define GenVertexArraysAPPLE_remap_index 460
-#define IsVertexArrayAPPLE_remap_index 461
-#define GetProgramNamedParameterdvNV_remap_index 462
-#define GetProgramNamedParameterfvNV_remap_index 463
-#define ProgramNamedParameter4dNV_remap_index 464
-#define ProgramNamedParameter4dvNV_remap_index 465
-#define ProgramNamedParameter4fNV_remap_index 466
-#define ProgramNamedParameter4fvNV_remap_index 467
-#define PrimitiveRestartIndexNV_remap_index 468
-#define PrimitiveRestartNV_remap_index 469
-#define DepthBoundsEXT_remap_index 470
-#define BlendEquationSeparateEXT_remap_index 471
-#define BindFramebufferEXT_remap_index 472
-#define BindRenderbufferEXT_remap_index 473
-#define CheckFramebufferStatusEXT_remap_index 474
-#define DeleteFramebuffersEXT_remap_index 475
-#define DeleteRenderbuffersEXT_remap_index 476
-#define FramebufferRenderbufferEXT_remap_index 477
-#define FramebufferTexture1DEXT_remap_index 478
-#define FramebufferTexture2DEXT_remap_index 479
-#define FramebufferTexture3DEXT_remap_index 480
-#define GenFramebuffersEXT_remap_index 481
-#define GenRenderbuffersEXT_remap_index 482
-#define GenerateMipmapEXT_remap_index 483
-#define GetFramebufferAttachmentParameterivEXT_remap_index 484
-#define GetRenderbufferParameterivEXT_remap_index 485
-#define IsFramebufferEXT_remap_index 486
-#define IsRenderbufferEXT_remap_index 487
-#define RenderbufferStorageEXT_remap_index 488
-#define BlitFramebufferEXT_remap_index 489
-#define BufferParameteriAPPLE_remap_index 490
-#define FlushMappedBufferRangeAPPLE_remap_index 491
-#define BindFragDataLocationEXT_remap_index 492
-#define GetFragDataLocationEXT_remap_index 493
-#define GetUniformuivEXT_remap_index 494
-#define GetVertexAttribIivEXT_remap_index 495
-#define GetVertexAttribIuivEXT_remap_index 496
-#define Uniform1uiEXT_remap_index 497
-#define Uniform1uivEXT_remap_index 498
-#define Uniform2uiEXT_remap_index 499
-#define Uniform2uivEXT_remap_index 500
-#define Uniform3uiEXT_remap_index 501
-#define Uniform3uivEXT_remap_index 502
-#define Uniform4uiEXT_remap_index 503
-#define Uniform4uivEXT_remap_index 504
-#define VertexAttribI1iEXT_remap_index 505
-#define VertexAttribI1ivEXT_remap_index 506
-#define VertexAttribI1uiEXT_remap_index 507
-#define VertexAttribI1uivEXT_remap_index 508
-#define VertexAttribI2iEXT_remap_index 509
-#define VertexAttribI2ivEXT_remap_index 510
-#define VertexAttribI2uiEXT_remap_index 511
-#define VertexAttribI2uivEXT_remap_index 512
-#define VertexAttribI3iEXT_remap_index 513
-#define VertexAttribI3ivEXT_remap_index 514
-#define VertexAttribI3uiEXT_remap_index 515
-#define VertexAttribI3uivEXT_remap_index 516
-#define VertexAttribI4bvEXT_remap_index 517
-#define VertexAttribI4iEXT_remap_index 518
-#define VertexAttribI4ivEXT_remap_index 519
-#define VertexAttribI4svEXT_remap_index 520
-#define VertexAttribI4ubvEXT_remap_index 521
-#define VertexAttribI4uiEXT_remap_index 522
-#define VertexAttribI4uivEXT_remap_index 523
-#define VertexAttribI4usvEXT_remap_index 524
-#define VertexAttribIPointerEXT_remap_index 525
-#define FramebufferTextureLayerEXT_remap_index 526
-#define ColorMaskIndexedEXT_remap_index 527
-#define DisableIndexedEXT_remap_index 528
-#define EnableIndexedEXT_remap_index 529
-#define GetBooleanIndexedvEXT_remap_index 530
-#define GetIntegerIndexedvEXT_remap_index 531
-#define IsEnabledIndexedEXT_remap_index 532
-#define ClearColorIiEXT_remap_index 533
-#define ClearColorIuiEXT_remap_index 534
-#define GetTexParameterIivEXT_remap_index 535
-#define GetTexParameterIuivEXT_remap_index 536
-#define TexParameterIivEXT_remap_index 537
-#define TexParameterIuivEXT_remap_index 538
-#define BeginConditionalRenderNV_remap_index 539
-#define EndConditionalRenderNV_remap_index 540
-#define BeginTransformFeedbackEXT_remap_index 541
-#define BindBufferBaseEXT_remap_index 542
-#define BindBufferOffsetEXT_remap_index 543
-#define BindBufferRangeEXT_remap_index 544
-#define EndTransformFeedbackEXT_remap_index 545
-#define GetTransformFeedbackVaryingEXT_remap_index 546
-#define TransformFeedbackVaryingsEXT_remap_index 547
-#define ProvokingVertexEXT_remap_index 548
-#define GetTexParameterPointervAPPLE_remap_index 549
-#define TextureRangeAPPLE_remap_index 550
-#define GetObjectParameterivAPPLE_remap_index 551
-#define ObjectPurgeableAPPLE_remap_index 552
-#define ObjectUnpurgeableAPPLE_remap_index 553
-#define ActiveProgramEXT_remap_index 554
-#define CreateShaderProgramEXT_remap_index 555
-#define UseShaderProgramEXT_remap_index 556
-#define TextureBarrierNV_remap_index 557
-#define StencilFuncSeparateATI_remap_index 558
-#define ProgramEnvParameters4fvEXT_remap_index 559
-#define ProgramLocalParameters4fvEXT_remap_index 560
-#define GetQueryObjecti64vEXT_remap_index 561
-#define GetQueryObjectui64vEXT_remap_index 562
-#define EGLImageTargetRenderbufferStorageOES_remap_index 563
-#define EGLImageTargetTexture2DOES_remap_index 564
-
-#define _gloffset_AttachShader driDispatchRemapTable[AttachShader_remap_index]
-#define _gloffset_CreateProgram driDispatchRemapTable[CreateProgram_remap_index]
-#define _gloffset_CreateShader driDispatchRemapTable[CreateShader_remap_index]
-#define _gloffset_DeleteProgram driDispatchRemapTable[DeleteProgram_remap_index]
-#define _gloffset_DeleteShader driDispatchRemapTable[DeleteShader_remap_index]
-#define _gloffset_DetachShader driDispatchRemapTable[DetachShader_remap_index]
-#define _gloffset_GetAttachedShaders driDispatchRemapTable[GetAttachedShaders_remap_index]
-#define _gloffset_GetProgramInfoLog driDispatchRemapTable[GetProgramInfoLog_remap_index]
-#define _gloffset_GetProgramiv driDispatchRemapTable[GetProgramiv_remap_index]
-#define _gloffset_GetShaderInfoLog driDispatchRemapTable[GetShaderInfoLog_remap_index]
-#define _gloffset_GetShaderiv driDispatchRemapTable[GetShaderiv_remap_index]
-#define _gloffset_IsProgram driDispatchRemapTable[IsProgram_remap_index]
-#define _gloffset_IsShader driDispatchRemapTable[IsShader_remap_index]
-#define _gloffset_StencilFuncSeparate driDispatchRemapTable[StencilFuncSeparate_remap_index]
-#define _gloffset_StencilMaskSeparate driDispatchRemapTable[StencilMaskSeparate_remap_index]
-#define _gloffset_StencilOpSeparate driDispatchRemapTable[StencilOpSeparate_remap_index]
-#define _gloffset_UniformMatrix2x3fv driDispatchRemapTable[UniformMatrix2x3fv_remap_index]
-#define _gloffset_UniformMatrix2x4fv driDispatchRemapTable[UniformMatrix2x4fv_remap_index]
-#define _gloffset_UniformMatrix3x2fv driDispatchRemapTable[UniformMatrix3x2fv_remap_index]
-#define _gloffset_UniformMatrix3x4fv driDispatchRemapTable[UniformMatrix3x4fv_remap_index]
-#define _gloffset_UniformMatrix4x2fv driDispatchRemapTable[UniformMatrix4x2fv_remap_index]
-#define _gloffset_UniformMatrix4x3fv driDispatchRemapTable[UniformMatrix4x3fv_remap_index]
-#define _gloffset_ClampColor driDispatchRemapTable[ClampColor_remap_index]
-#define _gloffset_ClearBufferfi driDispatchRemapTable[ClearBufferfi_remap_index]
-#define _gloffset_ClearBufferfv driDispatchRemapTable[ClearBufferfv_remap_index]
-#define _gloffset_ClearBufferiv driDispatchRemapTable[ClearBufferiv_remap_index]
-#define _gloffset_ClearBufferuiv driDispatchRemapTable[ClearBufferuiv_remap_index]
-#define _gloffset_GetStringi driDispatchRemapTable[GetStringi_remap_index]
-#define _gloffset_TexBuffer driDispatchRemapTable[TexBuffer_remap_index]
-#define _gloffset_FramebufferTexture driDispatchRemapTable[FramebufferTexture_remap_index]
-#define _gloffset_GetBufferParameteri64v driDispatchRemapTable[GetBufferParameteri64v_remap_index]
-#define _gloffset_GetInteger64i_v driDispatchRemapTable[GetInteger64i_v_remap_index]
-#define _gloffset_VertexAttribDivisor driDispatchRemapTable[VertexAttribDivisor_remap_index]
-#define _gloffset_LoadTransposeMatrixdARB driDispatchRemapTable[LoadTransposeMatrixdARB_remap_index]
-#define _gloffset_LoadTransposeMatrixfARB driDispatchRemapTable[LoadTransposeMatrixfARB_remap_index]
-#define _gloffset_MultTransposeMatrixdARB driDispatchRemapTable[MultTransposeMatrixdARB_remap_index]
-#define _gloffset_MultTransposeMatrixfARB driDispatchRemapTable[MultTransposeMatrixfARB_remap_index]
-#define _gloffset_SampleCoverageARB driDispatchRemapTable[SampleCoverageARB_remap_index]
-#define _gloffset_CompressedTexImage1DARB driDispatchRemapTable[CompressedTexImage1DARB_remap_index]
-#define _gloffset_CompressedTexImage2DARB driDispatchRemapTable[CompressedTexImage2DARB_remap_index]
-#define _gloffset_CompressedTexImage3DARB driDispatchRemapTable[CompressedTexImage3DARB_remap_index]
-#define _gloffset_CompressedTexSubImage1DARB driDispatchRemapTable[CompressedTexSubImage1DARB_remap_index]
-#define _gloffset_CompressedTexSubImage2DARB driDispatchRemapTable[CompressedTexSubImage2DARB_remap_index]
-#define _gloffset_CompressedTexSubImage3DARB driDispatchRemapTable[CompressedTexSubImage3DARB_remap_index]
-#define _gloffset_GetCompressedTexImageARB driDispatchRemapTable[GetCompressedTexImageARB_remap_index]
-#define _gloffset_DisableVertexAttribArrayARB driDispatchRemapTable[DisableVertexAttribArrayARB_remap_index]
-#define _gloffset_EnableVertexAttribArrayARB driDispatchRemapTable[EnableVertexAttribArrayARB_remap_index]
-#define _gloffset_GetProgramEnvParameterdvARB driDispatchRemapTable[GetProgramEnvParameterdvARB_remap_index]
-#define _gloffset_GetProgramEnvParameterfvARB driDispatchRemapTable[GetProgramEnvParameterfvARB_remap_index]
-#define _gloffset_GetProgramLocalParameterdvARB driDispatchRemapTable[GetProgramLocalParameterdvARB_remap_index]
-#define _gloffset_GetProgramLocalParameterfvARB driDispatchRemapTable[GetProgramLocalParameterfvARB_remap_index]
-#define _gloffset_GetProgramStringARB driDispatchRemapTable[GetProgramStringARB_remap_index]
-#define _gloffset_GetProgramivARB driDispatchRemapTable[GetProgramivARB_remap_index]
-#define _gloffset_GetVertexAttribdvARB driDispatchRemapTable[GetVertexAttribdvARB_remap_index]
-#define _gloffset_GetVertexAttribfvARB driDispatchRemapTable[GetVertexAttribfvARB_remap_index]
-#define _gloffset_GetVertexAttribivARB driDispatchRemapTable[GetVertexAttribivARB_remap_index]
-#define _gloffset_ProgramEnvParameter4dARB driDispatchRemapTable[ProgramEnvParameter4dARB_remap_index]
-#define _gloffset_ProgramEnvParameter4dvARB driDispatchRemapTable[ProgramEnvParameter4dvARB_remap_index]
-#define _gloffset_ProgramEnvParameter4fARB driDispatchRemapTable[ProgramEnvParameter4fARB_remap_index]
-#define _gloffset_ProgramEnvParameter4fvARB driDispatchRemapTable[ProgramEnvParameter4fvARB_remap_index]
-#define _gloffset_ProgramLocalParameter4dARB driDispatchRemapTable[ProgramLocalParameter4dARB_remap_index]
-#define _gloffset_ProgramLocalParameter4dvARB driDispatchRemapTable[ProgramLocalParameter4dvARB_remap_index]
-#define _gloffset_ProgramLocalParameter4fARB driDispatchRemapTable[ProgramLocalParameter4fARB_remap_index]
-#define _gloffset_ProgramLocalParameter4fvARB driDispatchRemapTable[ProgramLocalParameter4fvARB_remap_index]
-#define _gloffset_ProgramStringARB driDispatchRemapTable[ProgramStringARB_remap_index]
-#define _gloffset_VertexAttrib1dARB driDispatchRemapTable[VertexAttrib1dARB_remap_index]
-#define _gloffset_VertexAttrib1dvARB driDispatchRemapTable[VertexAttrib1dvARB_remap_index]
-#define _gloffset_VertexAttrib1fARB driDispatchRemapTable[VertexAttrib1fARB_remap_index]
-#define _gloffset_VertexAttrib1fvARB driDispatchRemapTable[VertexAttrib1fvARB_remap_index]
-#define _gloffset_VertexAttrib1sARB driDispatchRemapTable[VertexAttrib1sARB_remap_index]
-#define _gloffset_VertexAttrib1svARB driDispatchRemapTable[VertexAttrib1svARB_remap_index]
-#define _gloffset_VertexAttrib2dARB driDispatchRemapTable[VertexAttrib2dARB_remap_index]
-#define _gloffset_VertexAttrib2dvARB driDispatchRemapTable[VertexAttrib2dvARB_remap_index]
-#define _gloffset_VertexAttrib2fARB driDispatchRemapTable[VertexAttrib2fARB_remap_index]
-#define _gloffset_VertexAttrib2fvARB driDispatchRemapTable[VertexAttrib2fvARB_remap_index]
-#define _gloffset_VertexAttrib2sARB driDispatchRemapTable[VertexAttrib2sARB_remap_index]
-#define _gloffset_VertexAttrib2svARB driDispatchRemapTable[VertexAttrib2svARB_remap_index]
-#define _gloffset_VertexAttrib3dARB driDispatchRemapTable[VertexAttrib3dARB_remap_index]
-#define _gloffset_VertexAttrib3dvARB driDispatchRemapTable[VertexAttrib3dvARB_remap_index]
-#define _gloffset_VertexAttrib3fARB driDispatchRemapTable[VertexAttrib3fARB_remap_index]
-#define _gloffset_VertexAttrib3fvARB driDispatchRemapTable[VertexAttrib3fvARB_remap_index]
-#define _gloffset_VertexAttrib3sARB driDispatchRemapTable[VertexAttrib3sARB_remap_index]
-#define _gloffset_VertexAttrib3svARB driDispatchRemapTable[VertexAttrib3svARB_remap_index]
-#define _gloffset_VertexAttrib4NbvARB driDispatchRemapTable[VertexAttrib4NbvARB_remap_index]
-#define _gloffset_VertexAttrib4NivARB driDispatchRemapTable[VertexAttrib4NivARB_remap_index]
-#define _gloffset_VertexAttrib4NsvARB driDispatchRemapTable[VertexAttrib4NsvARB_remap_index]
-#define _gloffset_VertexAttrib4NubARB driDispatchRemapTable[VertexAttrib4NubARB_remap_index]
-#define _gloffset_VertexAttrib4NubvARB driDispatchRemapTable[VertexAttrib4NubvARB_remap_index]
-#define _gloffset_VertexAttrib4NuivARB driDispatchRemapTable[VertexAttrib4NuivARB_remap_index]
-#define _gloffset_VertexAttrib4NusvARB driDispatchRemapTable[VertexAttrib4NusvARB_remap_index]
-#define _gloffset_VertexAttrib4bvARB driDispatchRemapTable[VertexAttrib4bvARB_remap_index]
-#define _gloffset_VertexAttrib4dARB driDispatchRemapTable[VertexAttrib4dARB_remap_index]
-#define _gloffset_VertexAttrib4dvARB driDispatchRemapTable[VertexAttrib4dvARB_remap_index]
-#define _gloffset_VertexAttrib4fARB driDispatchRemapTable[VertexAttrib4fARB_remap_index]
-#define _gloffset_VertexAttrib4fvARB driDispatchRemapTable[VertexAttrib4fvARB_remap_index]
-#define _gloffset_VertexAttrib4ivARB driDispatchRemapTable[VertexAttrib4ivARB_remap_index]
-#define _gloffset_VertexAttrib4sARB driDispatchRemapTable[VertexAttrib4sARB_remap_index]
-#define _gloffset_VertexAttrib4svARB driDispatchRemapTable[VertexAttrib4svARB_remap_index]
-#define _gloffset_VertexAttrib4ubvARB driDispatchRemapTable[VertexAttrib4ubvARB_remap_index]
-#define _gloffset_VertexAttrib4uivARB driDispatchRemapTable[VertexAttrib4uivARB_remap_index]
-#define _gloffset_VertexAttrib4usvARB driDispatchRemapTable[VertexAttrib4usvARB_remap_index]
-#define _gloffset_VertexAttribPointerARB driDispatchRemapTable[VertexAttribPointerARB_remap_index]
-#define _gloffset_BindBufferARB driDispatchRemapTable[BindBufferARB_remap_index]
-#define _gloffset_BufferDataARB driDispatchRemapTable[BufferDataARB_remap_index]
-#define _gloffset_BufferSubDataARB driDispatchRemapTable[BufferSubDataARB_remap_index]
-#define _gloffset_DeleteBuffersARB driDispatchRemapTable[DeleteBuffersARB_remap_index]
-#define _gloffset_GenBuffersARB driDispatchRemapTable[GenBuffersARB_remap_index]
-#define _gloffset_GetBufferParameterivARB driDispatchRemapTable[GetBufferParameterivARB_remap_index]
-#define _gloffset_GetBufferPointervARB driDispatchRemapTable[GetBufferPointervARB_remap_index]
-#define _gloffset_GetBufferSubDataARB driDispatchRemapTable[GetBufferSubDataARB_remap_index]
-#define _gloffset_IsBufferARB driDispatchRemapTable[IsBufferARB_remap_index]
-#define _gloffset_MapBufferARB driDispatchRemapTable[MapBufferARB_remap_index]
-#define _gloffset_UnmapBufferARB driDispatchRemapTable[UnmapBufferARB_remap_index]
-#define _gloffset_BeginQueryARB driDispatchRemapTable[BeginQueryARB_remap_index]
-#define _gloffset_DeleteQueriesARB driDispatchRemapTable[DeleteQueriesARB_remap_index]
-#define _gloffset_EndQueryARB driDispatchRemapTable[EndQueryARB_remap_index]
-#define _gloffset_GenQueriesARB driDispatchRemapTable[GenQueriesARB_remap_index]
-#define _gloffset_GetQueryObjectivARB driDispatchRemapTable[GetQueryObjectivARB_remap_index]
-#define _gloffset_GetQueryObjectuivARB driDispatchRemapTable[GetQueryObjectuivARB_remap_index]
-#define _gloffset_GetQueryivARB driDispatchRemapTable[GetQueryivARB_remap_index]
-#define _gloffset_IsQueryARB driDispatchRemapTable[IsQueryARB_remap_index]
-#define _gloffset_AttachObjectARB driDispatchRemapTable[AttachObjectARB_remap_index]
-#define _gloffset_CompileShaderARB driDispatchRemapTable[CompileShaderARB_remap_index]
-#define _gloffset_CreateProgramObjectARB driDispatchRemapTable[CreateProgramObjectARB_remap_index]
-#define _gloffset_CreateShaderObjectARB driDispatchRemapTable[CreateShaderObjectARB_remap_index]
-#define _gloffset_DeleteObjectARB driDispatchRemapTable[DeleteObjectARB_remap_index]
-#define _gloffset_DetachObjectARB driDispatchRemapTable[DetachObjectARB_remap_index]
-#define _gloffset_GetActiveUniformARB driDispatchRemapTable[GetActiveUniformARB_remap_index]
-#define _gloffset_GetAttachedObjectsARB driDispatchRemapTable[GetAttachedObjectsARB_remap_index]
-#define _gloffset_GetHandleARB driDispatchRemapTable[GetHandleARB_remap_index]
-#define _gloffset_GetInfoLogARB driDispatchRemapTable[GetInfoLogARB_remap_index]
-#define _gloffset_GetObjectParameterfvARB driDispatchRemapTable[GetObjectParameterfvARB_remap_index]
-#define _gloffset_GetObjectParameterivARB driDispatchRemapTable[GetObjectParameterivARB_remap_index]
-#define _gloffset_GetShaderSourceARB driDispatchRemapTable[GetShaderSourceARB_remap_index]
-#define _gloffset_GetUniformLocationARB driDispatchRemapTable[GetUniformLocationARB_remap_index]
-#define _gloffset_GetUniformfvARB driDispatchRemapTable[GetUniformfvARB_remap_index]
-#define _gloffset_GetUniformivARB driDispatchRemapTable[GetUniformivARB_remap_index]
-#define _gloffset_LinkProgramARB driDispatchRemapTable[LinkProgramARB_remap_index]
-#define _gloffset_ShaderSourceARB driDispatchRemapTable[ShaderSourceARB_remap_index]
-#define _gloffset_Uniform1fARB driDispatchRemapTable[Uniform1fARB_remap_index]
-#define _gloffset_Uniform1fvARB driDispatchRemapTable[Uniform1fvARB_remap_index]
-#define _gloffset_Uniform1iARB driDispatchRemapTable[Uniform1iARB_remap_index]
-#define _gloffset_Uniform1ivARB driDispatchRemapTable[Uniform1ivARB_remap_index]
-#define _gloffset_Uniform2fARB driDispatchRemapTable[Uniform2fARB_remap_index]
-#define _gloffset_Uniform2fvARB driDispatchRemapTable[Uniform2fvARB_remap_index]
-#define _gloffset_Uniform2iARB driDispatchRemapTable[Uniform2iARB_remap_index]
-#define _gloffset_Uniform2ivARB driDispatchRemapTable[Uniform2ivARB_remap_index]
-#define _gloffset_Uniform3fARB driDispatchRemapTable[Uniform3fARB_remap_index]
-#define _gloffset_Uniform3fvARB driDispatchRemapTable[Uniform3fvARB_remap_index]
-#define _gloffset_Uniform3iARB driDispatchRemapTable[Uniform3iARB_remap_index]
-#define _gloffset_Uniform3ivARB driDispatchRemapTable[Uniform3ivARB_remap_index]
-#define _gloffset_Uniform4fARB driDispatchRemapTable[Uniform4fARB_remap_index]
-#define _gloffset_Uniform4fvARB driDispatchRemapTable[Uniform4fvARB_remap_index]
-#define _gloffset_Uniform4iARB driDispatchRemapTable[Uniform4iARB_remap_index]
-#define _gloffset_Uniform4ivARB driDispatchRemapTable[Uniform4ivARB_remap_index]
-#define _gloffset_UniformMatrix2fvARB driDispatchRemapTable[UniformMatrix2fvARB_remap_index]
-#define _gloffset_UniformMatrix3fvARB driDispatchRemapTable[UniformMatrix3fvARB_remap_index]
-#define _gloffset_UniformMatrix4fvARB driDispatchRemapTable[UniformMatrix4fvARB_remap_index]
-#define _gloffset_UseProgramObjectARB driDispatchRemapTable[UseProgramObjectARB_remap_index]
-#define _gloffset_ValidateProgramARB driDispatchRemapTable[ValidateProgramARB_remap_index]
-#define _gloffset_BindAttribLocationARB driDispatchRemapTable[BindAttribLocationARB_remap_index]
-#define _gloffset_GetActiveAttribARB driDispatchRemapTable[GetActiveAttribARB_remap_index]
-#define _gloffset_GetAttribLocationARB driDispatchRemapTable[GetAttribLocationARB_remap_index]
-#define _gloffset_DrawBuffersARB driDispatchRemapTable[DrawBuffersARB_remap_index]
-#define _gloffset_ClampColorARB driDispatchRemapTable[ClampColorARB_remap_index]
-#define _gloffset_DrawArraysInstancedARB driDispatchRemapTable[DrawArraysInstancedARB_remap_index]
-#define _gloffset_DrawElementsInstancedARB driDispatchRemapTable[DrawElementsInstancedARB_remap_index]
-#define _gloffset_RenderbufferStorageMultisample driDispatchRemapTable[RenderbufferStorageMultisample_remap_index]
-#define _gloffset_FramebufferTextureARB driDispatchRemapTable[FramebufferTextureARB_remap_index]
-#define _gloffset_FramebufferTextureFaceARB driDispatchRemapTable[FramebufferTextureFaceARB_remap_index]
-#define _gloffset_ProgramParameteriARB driDispatchRemapTable[ProgramParameteriARB_remap_index]
-#define _gloffset_VertexAttribDivisorARB driDispatchRemapTable[VertexAttribDivisorARB_remap_index]
-#define _gloffset_FlushMappedBufferRange driDispatchRemapTable[FlushMappedBufferRange_remap_index]
-#define _gloffset_MapBufferRange driDispatchRemapTable[MapBufferRange_remap_index]
-#define _gloffset_TexBufferARB driDispatchRemapTable[TexBufferARB_remap_index]
-#define _gloffset_BindVertexArray driDispatchRemapTable[BindVertexArray_remap_index]
-#define _gloffset_GenVertexArrays driDispatchRemapTable[GenVertexArrays_remap_index]
-#define _gloffset_CopyBufferSubData driDispatchRemapTable[CopyBufferSubData_remap_index]
-#define _gloffset_ClientWaitSync driDispatchRemapTable[ClientWaitSync_remap_index]
-#define _gloffset_DeleteSync driDispatchRemapTable[DeleteSync_remap_index]
-#define _gloffset_FenceSync driDispatchRemapTable[FenceSync_remap_index]
-#define _gloffset_GetInteger64v driDispatchRemapTable[GetInteger64v_remap_index]
-#define _gloffset_GetSynciv driDispatchRemapTable[GetSynciv_remap_index]
-#define _gloffset_IsSync driDispatchRemapTable[IsSync_remap_index]
-#define _gloffset_WaitSync driDispatchRemapTable[WaitSync_remap_index]
-#define _gloffset_DrawElementsBaseVertex driDispatchRemapTable[DrawElementsBaseVertex_remap_index]
-#define _gloffset_DrawElementsInstancedBaseVertex driDispatchRemapTable[DrawElementsInstancedBaseVertex_remap_index]
-#define _gloffset_DrawRangeElementsBaseVertex driDispatchRemapTable[DrawRangeElementsBaseVertex_remap_index]
-#define _gloffset_MultiDrawElementsBaseVertex driDispatchRemapTable[MultiDrawElementsBaseVertex_remap_index]
-#define _gloffset_BlendEquationSeparateiARB driDispatchRemapTable[BlendEquationSeparateiARB_remap_index]
-#define _gloffset_BlendEquationiARB driDispatchRemapTable[BlendEquationiARB_remap_index]
-#define _gloffset_BlendFuncSeparateiARB driDispatchRemapTable[BlendFuncSeparateiARB_remap_index]
-#define _gloffset_BlendFunciARB driDispatchRemapTable[BlendFunciARB_remap_index]
-#define _gloffset_BindSampler driDispatchRemapTable[BindSampler_remap_index]
-#define _gloffset_DeleteSamplers driDispatchRemapTable[DeleteSamplers_remap_index]
-#define _gloffset_GenSamplers driDispatchRemapTable[GenSamplers_remap_index]
-#define _gloffset_GetSamplerParameterIiv driDispatchRemapTable[GetSamplerParameterIiv_remap_index]
-#define _gloffset_GetSamplerParameterIuiv driDispatchRemapTable[GetSamplerParameterIuiv_remap_index]
-#define _gloffset_GetSamplerParameterfv driDispatchRemapTable[GetSamplerParameterfv_remap_index]
-#define _gloffset_GetSamplerParameteriv driDispatchRemapTable[GetSamplerParameteriv_remap_index]
-#define _gloffset_IsSampler driDispatchRemapTable[IsSampler_remap_index]
-#define _gloffset_SamplerParameterIiv driDispatchRemapTable[SamplerParameterIiv_remap_index]
-#define _gloffset_SamplerParameterIuiv driDispatchRemapTable[SamplerParameterIuiv_remap_index]
-#define _gloffset_SamplerParameterf driDispatchRemapTable[SamplerParameterf_remap_index]
-#define _gloffset_SamplerParameterfv driDispatchRemapTable[SamplerParameterfv_remap_index]
-#define _gloffset_SamplerParameteri driDispatchRemapTable[SamplerParameteri_remap_index]
-#define _gloffset_SamplerParameteriv driDispatchRemapTable[SamplerParameteriv_remap_index]
-#define _gloffset_ColorP3ui driDispatchRemapTable[ColorP3ui_remap_index]
-#define _gloffset_ColorP3uiv driDispatchRemapTable[ColorP3uiv_remap_index]
-#define _gloffset_ColorP4ui driDispatchRemapTable[ColorP4ui_remap_index]
-#define _gloffset_ColorP4uiv driDispatchRemapTable[ColorP4uiv_remap_index]
-#define _gloffset_MultiTexCoordP1ui driDispatchRemapTable[MultiTexCoordP1ui_remap_index]
-#define _gloffset_MultiTexCoordP1uiv driDispatchRemapTable[MultiTexCoordP1uiv_remap_index]
-#define _gloffset_MultiTexCoordP2ui driDispatchRemapTable[MultiTexCoordP2ui_remap_index]
-#define _gloffset_MultiTexCoordP2uiv driDispatchRemapTable[MultiTexCoordP2uiv_remap_index]
-#define _gloffset_MultiTexCoordP3ui driDispatchRemapTable[MultiTexCoordP3ui_remap_index]
-#define _gloffset_MultiTexCoordP3uiv driDispatchRemapTable[MultiTexCoordP3uiv_remap_index]
-#define _gloffset_MultiTexCoordP4ui driDispatchRemapTable[MultiTexCoordP4ui_remap_index]
-#define _gloffset_MultiTexCoordP4uiv driDispatchRemapTable[MultiTexCoordP4uiv_remap_index]
-#define _gloffset_NormalP3ui driDispatchRemapTable[NormalP3ui_remap_index]
-#define _gloffset_NormalP3uiv driDispatchRemapTable[NormalP3uiv_remap_index]
-#define _gloffset_SecondaryColorP3ui driDispatchRemapTable[SecondaryColorP3ui_remap_index]
-#define _gloffset_SecondaryColorP3uiv driDispatchRemapTable[SecondaryColorP3uiv_remap_index]
-#define _gloffset_TexCoordP1ui driDispatchRemapTable[TexCoordP1ui_remap_index]
-#define _gloffset_TexCoordP1uiv driDispatchRemapTable[TexCoordP1uiv_remap_index]
-#define _gloffset_TexCoordP2ui driDispatchRemapTable[TexCoordP2ui_remap_index]
-#define _gloffset_TexCoordP2uiv driDispatchRemapTable[TexCoordP2uiv_remap_index]
-#define _gloffset_TexCoordP3ui driDispatchRemapTable[TexCoordP3ui_remap_index]
-#define _gloffset_TexCoordP3uiv driDispatchRemapTable[TexCoordP3uiv_remap_index]
-#define _gloffset_TexCoordP4ui driDispatchRemapTable[TexCoordP4ui_remap_index]
-#define _gloffset_TexCoordP4uiv driDispatchRemapTable[TexCoordP4uiv_remap_index]
-#define _gloffset_VertexAttribP1ui driDispatchRemapTable[VertexAttribP1ui_remap_index]
-#define _gloffset_VertexAttribP1uiv driDispatchRemapTable[VertexAttribP1uiv_remap_index]
-#define _gloffset_VertexAttribP2ui driDispatchRemapTable[VertexAttribP2ui_remap_index]
-#define _gloffset_VertexAttribP2uiv driDispatchRemapTable[VertexAttribP2uiv_remap_index]
-#define _gloffset_VertexAttribP3ui driDispatchRemapTable[VertexAttribP3ui_remap_index]
-#define _gloffset_VertexAttribP3uiv driDispatchRemapTable[VertexAttribP3uiv_remap_index]
-#define _gloffset_VertexAttribP4ui driDispatchRemapTable[VertexAttribP4ui_remap_index]
-#define _gloffset_VertexAttribP4uiv driDispatchRemapTable[VertexAttribP4uiv_remap_index]
-#define _gloffset_VertexP2ui driDispatchRemapTable[VertexP2ui_remap_index]
-#define _gloffset_VertexP2uiv driDispatchRemapTable[VertexP2uiv_remap_index]
-#define _gloffset_VertexP3ui driDispatchRemapTable[VertexP3ui_remap_index]
-#define _gloffset_VertexP3uiv driDispatchRemapTable[VertexP3uiv_remap_index]
-#define _gloffset_VertexP4ui driDispatchRemapTable[VertexP4ui_remap_index]
-#define _gloffset_VertexP4uiv driDispatchRemapTable[VertexP4uiv_remap_index]
-#define _gloffset_BindTransformFeedback driDispatchRemapTable[BindTransformFeedback_remap_index]
-#define _gloffset_DeleteTransformFeedbacks driDispatchRemapTable[DeleteTransformFeedbacks_remap_index]
-#define _gloffset_DrawTransformFeedback driDispatchRemapTable[DrawTransformFeedback_remap_index]
-#define _gloffset_GenTransformFeedbacks driDispatchRemapTable[GenTransformFeedbacks_remap_index]
-#define _gloffset_IsTransformFeedback driDispatchRemapTable[IsTransformFeedback_remap_index]
-#define _gloffset_PauseTransformFeedback driDispatchRemapTable[PauseTransformFeedback_remap_index]
-#define _gloffset_ResumeTransformFeedback driDispatchRemapTable[ResumeTransformFeedback_remap_index]
-#define _gloffset_ClearDepthf driDispatchRemapTable[ClearDepthf_remap_index]
-#define _gloffset_DepthRangef driDispatchRemapTable[DepthRangef_remap_index]
-#define _gloffset_GetShaderPrecisionFormat driDispatchRemapTable[GetShaderPrecisionFormat_remap_index]
-#define _gloffset_ReleaseShaderCompiler driDispatchRemapTable[ReleaseShaderCompiler_remap_index]
-#define _gloffset_ShaderBinary driDispatchRemapTable[ShaderBinary_remap_index]
-#define _gloffset_GetGraphicsResetStatusARB driDispatchRemapTable[GetGraphicsResetStatusARB_remap_index]
-#define _gloffset_GetnColorTableARB driDispatchRemapTable[GetnColorTableARB_remap_index]
-#define _gloffset_GetnCompressedTexImageARB driDispatchRemapTable[GetnCompressedTexImageARB_remap_index]
-#define _gloffset_GetnConvolutionFilterARB driDispatchRemapTable[GetnConvolutionFilterARB_remap_index]
-#define _gloffset_GetnHistogramARB driDispatchRemapTable[GetnHistogramARB_remap_index]
-#define _gloffset_GetnMapdvARB driDispatchRemapTable[GetnMapdvARB_remap_index]
-#define _gloffset_GetnMapfvARB driDispatchRemapTable[GetnMapfvARB_remap_index]
-#define _gloffset_GetnMapivARB driDispatchRemapTable[GetnMapivARB_remap_index]
-#define _gloffset_GetnMinmaxARB driDispatchRemapTable[GetnMinmaxARB_remap_index]
-#define _gloffset_GetnPixelMapfvARB driDispatchRemapTable[GetnPixelMapfvARB_remap_index]
-#define _gloffset_GetnPixelMapuivARB driDispatchRemapTable[GetnPixelMapuivARB_remap_index]
-#define _gloffset_GetnPixelMapusvARB driDispatchRemapTable[GetnPixelMapusvARB_remap_index]
-#define _gloffset_GetnPolygonStippleARB driDispatchRemapTable[GetnPolygonStippleARB_remap_index]
-#define _gloffset_GetnSeparableFilterARB driDispatchRemapTable[GetnSeparableFilterARB_remap_index]
-#define _gloffset_GetnTexImageARB driDispatchRemapTable[GetnTexImageARB_remap_index]
-#define _gloffset_GetnUniformdvARB driDispatchRemapTable[GetnUniformdvARB_remap_index]
-#define _gloffset_GetnUniformfvARB driDispatchRemapTable[GetnUniformfvARB_remap_index]
-#define _gloffset_GetnUniformivARB driDispatchRemapTable[GetnUniformivARB_remap_index]
-#define _gloffset_GetnUniformuivARB driDispatchRemapTable[GetnUniformuivARB_remap_index]
-#define _gloffset_ReadnPixelsARB driDispatchRemapTable[ReadnPixelsARB_remap_index]
-#define _gloffset_TexStorage1D driDispatchRemapTable[TexStorage1D_remap_index]
-#define _gloffset_TexStorage2D driDispatchRemapTable[TexStorage2D_remap_index]
-#define _gloffset_TexStorage3D driDispatchRemapTable[TexStorage3D_remap_index]
-#define _gloffset_TextureStorage1DEXT driDispatchRemapTable[TextureStorage1DEXT_remap_index]
-#define _gloffset_TextureStorage2DEXT driDispatchRemapTable[TextureStorage2DEXT_remap_index]
-#define _gloffset_TextureStorage3DEXT driDispatchRemapTable[TextureStorage3DEXT_remap_index]
-#define _gloffset_PolygonOffsetEXT driDispatchRemapTable[PolygonOffsetEXT_remap_index]
-#define _gloffset_GetPixelTexGenParameterfvSGIS driDispatchRemapTable[GetPixelTexGenParameterfvSGIS_remap_index]
-#define _gloffset_GetPixelTexGenParameterivSGIS driDispatchRemapTable[GetPixelTexGenParameterivSGIS_remap_index]
-#define _gloffset_PixelTexGenParameterfSGIS driDispatchRemapTable[PixelTexGenParameterfSGIS_remap_index]
-#define _gloffset_PixelTexGenParameterfvSGIS driDispatchRemapTable[PixelTexGenParameterfvSGIS_remap_index]
-#define _gloffset_PixelTexGenParameteriSGIS driDispatchRemapTable[PixelTexGenParameteriSGIS_remap_index]
-#define _gloffset_PixelTexGenParameterivSGIS driDispatchRemapTable[PixelTexGenParameterivSGIS_remap_index]
-#define _gloffset_SampleMaskSGIS driDispatchRemapTable[SampleMaskSGIS_remap_index]
-#define _gloffset_SamplePatternSGIS driDispatchRemapTable[SamplePatternSGIS_remap_index]
-#define _gloffset_ColorPointerEXT driDispatchRemapTable[ColorPointerEXT_remap_index]
-#define _gloffset_EdgeFlagPointerEXT driDispatchRemapTable[EdgeFlagPointerEXT_remap_index]
-#define _gloffset_IndexPointerEXT driDispatchRemapTable[IndexPointerEXT_remap_index]
-#define _gloffset_NormalPointerEXT driDispatchRemapTable[NormalPointerEXT_remap_index]
-#define _gloffset_TexCoordPointerEXT driDispatchRemapTable[TexCoordPointerEXT_remap_index]
-#define _gloffset_VertexPointerEXT driDispatchRemapTable[VertexPointerEXT_remap_index]
-#define _gloffset_PointParameterfEXT driDispatchRemapTable[PointParameterfEXT_remap_index]
-#define _gloffset_PointParameterfvEXT driDispatchRemapTable[PointParameterfvEXT_remap_index]
-#define _gloffset_LockArraysEXT driDispatchRemapTable[LockArraysEXT_remap_index]
-#define _gloffset_UnlockArraysEXT driDispatchRemapTable[UnlockArraysEXT_remap_index]
-#define _gloffset_SecondaryColor3bEXT driDispatchRemapTable[SecondaryColor3bEXT_remap_index]
-#define _gloffset_SecondaryColor3bvEXT driDispatchRemapTable[SecondaryColor3bvEXT_remap_index]
-#define _gloffset_SecondaryColor3dEXT driDispatchRemapTable[SecondaryColor3dEXT_remap_index]
-#define _gloffset_SecondaryColor3dvEXT driDispatchRemapTable[SecondaryColor3dvEXT_remap_index]
-#define _gloffset_SecondaryColor3fEXT driDispatchRemapTable[SecondaryColor3fEXT_remap_index]
-#define _gloffset_SecondaryColor3fvEXT driDispatchRemapTable[SecondaryColor3fvEXT_remap_index]
-#define _gloffset_SecondaryColor3iEXT driDispatchRemapTable[SecondaryColor3iEXT_remap_index]
-#define _gloffset_SecondaryColor3ivEXT driDispatchRemapTable[SecondaryColor3ivEXT_remap_index]
-#define _gloffset_SecondaryColor3sEXT driDispatchRemapTable[SecondaryColor3sEXT_remap_index]
-#define _gloffset_SecondaryColor3svEXT driDispatchRemapTable[SecondaryColor3svEXT_remap_index]
-#define _gloffset_SecondaryColor3ubEXT driDispatchRemapTable[SecondaryColor3ubEXT_remap_index]
-#define _gloffset_SecondaryColor3ubvEXT driDispatchRemapTable[SecondaryColor3ubvEXT_remap_index]
-#define _gloffset_SecondaryColor3uiEXT driDispatchRemapTable[SecondaryColor3uiEXT_remap_index]
-#define _gloffset_SecondaryColor3uivEXT driDispatchRemapTable[SecondaryColor3uivEXT_remap_index]
-#define _gloffset_SecondaryColor3usEXT driDispatchRemapTable[SecondaryColor3usEXT_remap_index]
-#define _gloffset_SecondaryColor3usvEXT driDispatchRemapTable[SecondaryColor3usvEXT_remap_index]
-#define _gloffset_SecondaryColorPointerEXT driDispatchRemapTable[SecondaryColorPointerEXT_remap_index]
-#define _gloffset_MultiDrawArraysEXT driDispatchRemapTable[MultiDrawArraysEXT_remap_index]
-#define _gloffset_MultiDrawElementsEXT driDispatchRemapTable[MultiDrawElementsEXT_remap_index]
-#define _gloffset_FogCoordPointerEXT driDispatchRemapTable[FogCoordPointerEXT_remap_index]
-#define _gloffset_FogCoorddEXT driDispatchRemapTable[FogCoorddEXT_remap_index]
-#define _gloffset_FogCoorddvEXT driDispatchRemapTable[FogCoorddvEXT_remap_index]
-#define _gloffset_FogCoordfEXT driDispatchRemapTable[FogCoordfEXT_remap_index]
-#define _gloffset_FogCoordfvEXT driDispatchRemapTable[FogCoordfvEXT_remap_index]
-#define _gloffset_PixelTexGenSGIX driDispatchRemapTable[PixelTexGenSGIX_remap_index]
-#define _gloffset_BlendFuncSeparateEXT driDispatchRemapTable[BlendFuncSeparateEXT_remap_index]
-#define _gloffset_FlushVertexArrayRangeNV driDispatchRemapTable[FlushVertexArrayRangeNV_remap_index]
-#define _gloffset_VertexArrayRangeNV driDispatchRemapTable[VertexArrayRangeNV_remap_index]
-#define _gloffset_CombinerInputNV driDispatchRemapTable[CombinerInputNV_remap_index]
-#define _gloffset_CombinerOutputNV driDispatchRemapTable[CombinerOutputNV_remap_index]
-#define _gloffset_CombinerParameterfNV driDispatchRemapTable[CombinerParameterfNV_remap_index]
-#define _gloffset_CombinerParameterfvNV driDispatchRemapTable[CombinerParameterfvNV_remap_index]
-#define _gloffset_CombinerParameteriNV driDispatchRemapTable[CombinerParameteriNV_remap_index]
-#define _gloffset_CombinerParameterivNV driDispatchRemapTable[CombinerParameterivNV_remap_index]
-#define _gloffset_FinalCombinerInputNV driDispatchRemapTable[FinalCombinerInputNV_remap_index]
-#define _gloffset_GetCombinerInputParameterfvNV driDispatchRemapTable[GetCombinerInputParameterfvNV_remap_index]
-#define _gloffset_GetCombinerInputParameterivNV driDispatchRemapTable[GetCombinerInputParameterivNV_remap_index]
-#define _gloffset_GetCombinerOutputParameterfvNV driDispatchRemapTable[GetCombinerOutputParameterfvNV_remap_index]
-#define _gloffset_GetCombinerOutputParameterivNV driDispatchRemapTable[GetCombinerOutputParameterivNV_remap_index]
-#define _gloffset_GetFinalCombinerInputParameterfvNV driDispatchRemapTable[GetFinalCombinerInputParameterfvNV_remap_index]
-#define _gloffset_GetFinalCombinerInputParameterivNV driDispatchRemapTable[GetFinalCombinerInputParameterivNV_remap_index]
-#define _gloffset_ResizeBuffersMESA driDispatchRemapTable[ResizeBuffersMESA_remap_index]
-#define _gloffset_WindowPos2dMESA driDispatchRemapTable[WindowPos2dMESA_remap_index]
-#define _gloffset_WindowPos2dvMESA driDispatchRemapTable[WindowPos2dvMESA_remap_index]
-#define _gloffset_WindowPos2fMESA driDispatchRemapTable[WindowPos2fMESA_remap_index]
-#define _gloffset_WindowPos2fvMESA driDispatchRemapTable[WindowPos2fvMESA_remap_index]
-#define _gloffset_WindowPos2iMESA driDispatchRemapTable[WindowPos2iMESA_remap_index]
-#define _gloffset_WindowPos2ivMESA driDispatchRemapTable[WindowPos2ivMESA_remap_index]
-#define _gloffset_WindowPos2sMESA driDispatchRemapTable[WindowPos2sMESA_remap_index]
-#define _gloffset_WindowPos2svMESA driDispatchRemapTable[WindowPos2svMESA_remap_index]
-#define _gloffset_WindowPos3dMESA driDispatchRemapTable[WindowPos3dMESA_remap_index]
-#define _gloffset_WindowPos3dvMESA driDispatchRemapTable[WindowPos3dvMESA_remap_index]
-#define _gloffset_WindowPos3fMESA driDispatchRemapTable[WindowPos3fMESA_remap_index]
-#define _gloffset_WindowPos3fvMESA driDispatchRemapTable[WindowPos3fvMESA_remap_index]
-#define _gloffset_WindowPos3iMESA driDispatchRemapTable[WindowPos3iMESA_remap_index]
-#define _gloffset_WindowPos3ivMESA driDispatchRemapTable[WindowPos3ivMESA_remap_index]
-#define _gloffset_WindowPos3sMESA driDispatchRemapTable[WindowPos3sMESA_remap_index]
-#define _gloffset_WindowPos3svMESA driDispatchRemapTable[WindowPos3svMESA_remap_index]
-#define _gloffset_WindowPos4dMESA driDispatchRemapTable[WindowPos4dMESA_remap_index]
-#define _gloffset_WindowPos4dvMESA driDispatchRemapTable[WindowPos4dvMESA_remap_index]
-#define _gloffset_WindowPos4fMESA driDispatchRemapTable[WindowPos4fMESA_remap_index]
-#define _gloffset_WindowPos4fvMESA driDispatchRemapTable[WindowPos4fvMESA_remap_index]
-#define _gloffset_WindowPos4iMESA driDispatchRemapTable[WindowPos4iMESA_remap_index]
-#define _gloffset_WindowPos4ivMESA driDispatchRemapTable[WindowPos4ivMESA_remap_index]
-#define _gloffset_WindowPos4sMESA driDispatchRemapTable[WindowPos4sMESA_remap_index]
-#define _gloffset_WindowPos4svMESA driDispatchRemapTable[WindowPos4svMESA_remap_index]
-#define _gloffset_MultiModeDrawArraysIBM driDispatchRemapTable[MultiModeDrawArraysIBM_remap_index]
-#define _gloffset_MultiModeDrawElementsIBM driDispatchRemapTable[MultiModeDrawElementsIBM_remap_index]
-#define _gloffset_DeleteFencesNV driDispatchRemapTable[DeleteFencesNV_remap_index]
-#define _gloffset_FinishFenceNV driDispatchRemapTable[FinishFenceNV_remap_index]
-#define _gloffset_GenFencesNV driDispatchRemapTable[GenFencesNV_remap_index]
-#define _gloffset_GetFenceivNV driDispatchRemapTable[GetFenceivNV_remap_index]
-#define _gloffset_IsFenceNV driDispatchRemapTable[IsFenceNV_remap_index]
-#define _gloffset_SetFenceNV driDispatchRemapTable[SetFenceNV_remap_index]
-#define _gloffset_TestFenceNV driDispatchRemapTable[TestFenceNV_remap_index]
-#define _gloffset_AreProgramsResidentNV driDispatchRemapTable[AreProgramsResidentNV_remap_index]
-#define _gloffset_BindProgramNV driDispatchRemapTable[BindProgramNV_remap_index]
-#define _gloffset_DeleteProgramsNV driDispatchRemapTable[DeleteProgramsNV_remap_index]
-#define _gloffset_ExecuteProgramNV driDispatchRemapTable[ExecuteProgramNV_remap_index]
-#define _gloffset_GenProgramsNV driDispatchRemapTable[GenProgramsNV_remap_index]
-#define _gloffset_GetProgramParameterdvNV driDispatchRemapTable[GetProgramParameterdvNV_remap_index]
-#define _gloffset_GetProgramParameterfvNV driDispatchRemapTable[GetProgramParameterfvNV_remap_index]
-#define _gloffset_GetProgramStringNV driDispatchRemapTable[GetProgramStringNV_remap_index]
-#define _gloffset_GetProgramivNV driDispatchRemapTable[GetProgramivNV_remap_index]
-#define _gloffset_GetTrackMatrixivNV driDispatchRemapTable[GetTrackMatrixivNV_remap_index]
-#define _gloffset_GetVertexAttribPointervNV driDispatchRemapTable[GetVertexAttribPointervNV_remap_index]
-#define _gloffset_GetVertexAttribdvNV driDispatchRemapTable[GetVertexAttribdvNV_remap_index]
-#define _gloffset_GetVertexAttribfvNV driDispatchRemapTable[GetVertexAttribfvNV_remap_index]
-#define _gloffset_GetVertexAttribivNV driDispatchRemapTable[GetVertexAttribivNV_remap_index]
-#define _gloffset_IsProgramNV driDispatchRemapTable[IsProgramNV_remap_index]
-#define _gloffset_LoadProgramNV driDispatchRemapTable[LoadProgramNV_remap_index]
-#define _gloffset_ProgramParameters4dvNV driDispatchRemapTable[ProgramParameters4dvNV_remap_index]
-#define _gloffset_ProgramParameters4fvNV driDispatchRemapTable[ProgramParameters4fvNV_remap_index]
-#define _gloffset_RequestResidentProgramsNV driDispatchRemapTable[RequestResidentProgramsNV_remap_index]
-#define _gloffset_TrackMatrixNV driDispatchRemapTable[TrackMatrixNV_remap_index]
-#define _gloffset_VertexAttrib1dNV driDispatchRemapTable[VertexAttrib1dNV_remap_index]
-#define _gloffset_VertexAttrib1dvNV driDispatchRemapTable[VertexAttrib1dvNV_remap_index]
-#define _gloffset_VertexAttrib1fNV driDispatchRemapTable[VertexAttrib1fNV_remap_index]
-#define _gloffset_VertexAttrib1fvNV driDispatchRemapTable[VertexAttrib1fvNV_remap_index]
-#define _gloffset_VertexAttrib1sNV driDispatchRemapTable[VertexAttrib1sNV_remap_index]
-#define _gloffset_VertexAttrib1svNV driDispatchRemapTable[VertexAttrib1svNV_remap_index]
-#define _gloffset_VertexAttrib2dNV driDispatchRemapTable[VertexAttrib2dNV_remap_index]
-#define _gloffset_VertexAttrib2dvNV driDispatchRemapTable[VertexAttrib2dvNV_remap_index]
-#define _gloffset_VertexAttrib2fNV driDispatchRemapTable[VertexAttrib2fNV_remap_index]
-#define _gloffset_VertexAttrib2fvNV driDispatchRemapTable[VertexAttrib2fvNV_remap_index]
-#define _gloffset_VertexAttrib2sNV driDispatchRemapTable[VertexAttrib2sNV_remap_index]
-#define _gloffset_VertexAttrib2svNV driDispatchRemapTable[VertexAttrib2svNV_remap_index]
-#define _gloffset_VertexAttrib3dNV driDispatchRemapTable[VertexAttrib3dNV_remap_index]
-#define _gloffset_VertexAttrib3dvNV driDispatchRemapTable[VertexAttrib3dvNV_remap_index]
-#define _gloffset_VertexAttrib3fNV driDispatchRemapTable[VertexAttrib3fNV_remap_index]
-#define _gloffset_VertexAttrib3fvNV driDispatchRemapTable[VertexAttrib3fvNV_remap_index]
-#define _gloffset_VertexAttrib3sNV driDispatchRemapTable[VertexAttrib3sNV_remap_index]
-#define _gloffset_VertexAttrib3svNV driDispatchRemapTable[VertexAttrib3svNV_remap_index]
-#define _gloffset_VertexAttrib4dNV driDispatchRemapTable[VertexAttrib4dNV_remap_index]
-#define _gloffset_VertexAttrib4dvNV driDispatchRemapTable[VertexAttrib4dvNV_remap_index]
-#define _gloffset_VertexAttrib4fNV driDispatchRemapTable[VertexAttrib4fNV_remap_index]
-#define _gloffset_VertexAttrib4fvNV driDispatchRemapTable[VertexAttrib4fvNV_remap_index]
-#define _gloffset_VertexAttrib4sNV driDispatchRemapTable[VertexAttrib4sNV_remap_index]
-#define _gloffset_VertexAttrib4svNV driDispatchRemapTable[VertexAttrib4svNV_remap_index]
-#define _gloffset_VertexAttrib4ubNV driDispatchRemapTable[VertexAttrib4ubNV_remap_index]
-#define _gloffset_VertexAttrib4ubvNV driDispatchRemapTable[VertexAttrib4ubvNV_remap_index]
-#define _gloffset_VertexAttribPointerNV driDispatchRemapTable[VertexAttribPointerNV_remap_index]
-#define _gloffset_VertexAttribs1dvNV driDispatchRemapTable[VertexAttribs1dvNV_remap_index]
-#define _gloffset_VertexAttribs1fvNV driDispatchRemapTable[VertexAttribs1fvNV_remap_index]
-#define _gloffset_VertexAttribs1svNV driDispatchRemapTable[VertexAttribs1svNV_remap_index]
-#define _gloffset_VertexAttribs2dvNV driDispatchRemapTable[VertexAttribs2dvNV_remap_index]
-#define _gloffset_VertexAttribs2fvNV driDispatchRemapTable[VertexAttribs2fvNV_remap_index]
-#define _gloffset_VertexAttribs2svNV driDispatchRemapTable[VertexAttribs2svNV_remap_index]
-#define _gloffset_VertexAttribs3dvNV driDispatchRemapTable[VertexAttribs3dvNV_remap_index]
-#define _gloffset_VertexAttribs3fvNV driDispatchRemapTable[VertexAttribs3fvNV_remap_index]
-#define _gloffset_VertexAttribs3svNV driDispatchRemapTable[VertexAttribs3svNV_remap_index]
-#define _gloffset_VertexAttribs4dvNV driDispatchRemapTable[VertexAttribs4dvNV_remap_index]
-#define _gloffset_VertexAttribs4fvNV driDispatchRemapTable[VertexAttribs4fvNV_remap_index]
-#define _gloffset_VertexAttribs4svNV driDispatchRemapTable[VertexAttribs4svNV_remap_index]
-#define _gloffset_VertexAttribs4ubvNV driDispatchRemapTable[VertexAttribs4ubvNV_remap_index]
-#define _gloffset_GetTexBumpParameterfvATI driDispatchRemapTable[GetTexBumpParameterfvATI_remap_index]
-#define _gloffset_GetTexBumpParameterivATI driDispatchRemapTable[GetTexBumpParameterivATI_remap_index]
-#define _gloffset_TexBumpParameterfvATI driDispatchRemapTable[TexBumpParameterfvATI_remap_index]
-#define _gloffset_TexBumpParameterivATI driDispatchRemapTable[TexBumpParameterivATI_remap_index]
-#define _gloffset_AlphaFragmentOp1ATI driDispatchRemapTable[AlphaFragmentOp1ATI_remap_index]
-#define _gloffset_AlphaFragmentOp2ATI driDispatchRemapTable[AlphaFragmentOp2ATI_remap_index]
-#define _gloffset_AlphaFragmentOp3ATI driDispatchRemapTable[AlphaFragmentOp3ATI_remap_index]
-#define _gloffset_BeginFragmentShaderATI driDispatchRemapTable[BeginFragmentShaderATI_remap_index]
-#define _gloffset_BindFragmentShaderATI driDispatchRemapTable[BindFragmentShaderATI_remap_index]
-#define _gloffset_ColorFragmentOp1ATI driDispatchRemapTable[ColorFragmentOp1ATI_remap_index]
-#define _gloffset_ColorFragmentOp2ATI driDispatchRemapTable[ColorFragmentOp2ATI_remap_index]
-#define _gloffset_ColorFragmentOp3ATI driDispatchRemapTable[ColorFragmentOp3ATI_remap_index]
-#define _gloffset_DeleteFragmentShaderATI driDispatchRemapTable[DeleteFragmentShaderATI_remap_index]
-#define _gloffset_EndFragmentShaderATI driDispatchRemapTable[EndFragmentShaderATI_remap_index]
-#define _gloffset_GenFragmentShadersATI driDispatchRemapTable[GenFragmentShadersATI_remap_index]
-#define _gloffset_PassTexCoordATI driDispatchRemapTable[PassTexCoordATI_remap_index]
-#define _gloffset_SampleMapATI driDispatchRemapTable[SampleMapATI_remap_index]
-#define _gloffset_SetFragmentShaderConstantATI driDispatchRemapTable[SetFragmentShaderConstantATI_remap_index]
-#define _gloffset_PointParameteriNV driDispatchRemapTable[PointParameteriNV_remap_index]
-#define _gloffset_PointParameterivNV driDispatchRemapTable[PointParameterivNV_remap_index]
-#define _gloffset_ActiveStencilFaceEXT driDispatchRemapTable[ActiveStencilFaceEXT_remap_index]
-#define _gloffset_BindVertexArrayAPPLE driDispatchRemapTable[BindVertexArrayAPPLE_remap_index]
-#define _gloffset_DeleteVertexArraysAPPLE driDispatchRemapTable[DeleteVertexArraysAPPLE_remap_index]
-#define _gloffset_GenVertexArraysAPPLE driDispatchRemapTable[GenVertexArraysAPPLE_remap_index]
-#define _gloffset_IsVertexArrayAPPLE driDispatchRemapTable[IsVertexArrayAPPLE_remap_index]
-#define _gloffset_GetProgramNamedParameterdvNV driDispatchRemapTable[GetProgramNamedParameterdvNV_remap_index]
-#define _gloffset_GetProgramNamedParameterfvNV driDispatchRemapTable[GetProgramNamedParameterfvNV_remap_index]
-#define _gloffset_ProgramNamedParameter4dNV driDispatchRemapTable[ProgramNamedParameter4dNV_remap_index]
-#define _gloffset_ProgramNamedParameter4dvNV driDispatchRemapTable[ProgramNamedParameter4dvNV_remap_index]
-#define _gloffset_ProgramNamedParameter4fNV driDispatchRemapTable[ProgramNamedParameter4fNV_remap_index]
-#define _gloffset_ProgramNamedParameter4fvNV driDispatchRemapTable[ProgramNamedParameter4fvNV_remap_index]
-#define _gloffset_PrimitiveRestartIndexNV driDispatchRemapTable[PrimitiveRestartIndexNV_remap_index]
-#define _gloffset_PrimitiveRestartNV driDispatchRemapTable[PrimitiveRestartNV_remap_index]
-#define _gloffset_DepthBoundsEXT driDispatchRemapTable[DepthBoundsEXT_remap_index]
-#define _gloffset_BlendEquationSeparateEXT driDispatchRemapTable[BlendEquationSeparateEXT_remap_index]
-#define _gloffset_BindFramebufferEXT driDispatchRemapTable[BindFramebufferEXT_remap_index]
-#define _gloffset_BindRenderbufferEXT driDispatchRemapTable[BindRenderbufferEXT_remap_index]
-#define _gloffset_CheckFramebufferStatusEXT driDispatchRemapTable[CheckFramebufferStatusEXT_remap_index]
-#define _gloffset_DeleteFramebuffersEXT driDispatchRemapTable[DeleteFramebuffersEXT_remap_index]
-#define _gloffset_DeleteRenderbuffersEXT driDispatchRemapTable[DeleteRenderbuffersEXT_remap_index]
-#define _gloffset_FramebufferRenderbufferEXT driDispatchRemapTable[FramebufferRenderbufferEXT_remap_index]
-#define _gloffset_FramebufferTexture1DEXT driDispatchRemapTable[FramebufferTexture1DEXT_remap_index]
-#define _gloffset_FramebufferTexture2DEXT driDispatchRemapTable[FramebufferTexture2DEXT_remap_index]
-#define _gloffset_FramebufferTexture3DEXT driDispatchRemapTable[FramebufferTexture3DEXT_remap_index]
-#define _gloffset_GenFramebuffersEXT driDispatchRemapTable[GenFramebuffersEXT_remap_index]
-#define _gloffset_GenRenderbuffersEXT driDispatchRemapTable[GenRenderbuffersEXT_remap_index]
-#define _gloffset_GenerateMipmapEXT driDispatchRemapTable[GenerateMipmapEXT_remap_index]
-#define _gloffset_GetFramebufferAttachmentParameterivEXT driDispatchRemapTable[GetFramebufferAttachmentParameterivEXT_remap_index]
-#define _gloffset_GetRenderbufferParameterivEXT driDispatchRemapTable[GetRenderbufferParameterivEXT_remap_index]
-#define _gloffset_IsFramebufferEXT driDispatchRemapTable[IsFramebufferEXT_remap_index]
-#define _gloffset_IsRenderbufferEXT driDispatchRemapTable[IsRenderbufferEXT_remap_index]
-#define _gloffset_RenderbufferStorageEXT driDispatchRemapTable[RenderbufferStorageEXT_remap_index]
-#define _gloffset_BlitFramebufferEXT driDispatchRemapTable[BlitFramebufferEXT_remap_index]
-#define _gloffset_BufferParameteriAPPLE driDispatchRemapTable[BufferParameteriAPPLE_remap_index]
-#define _gloffset_FlushMappedBufferRangeAPPLE driDispatchRemapTable[FlushMappedBufferRangeAPPLE_remap_index]
-#define _gloffset_BindFragDataLocationEXT driDispatchRemapTable[BindFragDataLocationEXT_remap_index]
-#define _gloffset_GetFragDataLocationEXT driDispatchRemapTable[GetFragDataLocationEXT_remap_index]
-#define _gloffset_GetUniformuivEXT driDispatchRemapTable[GetUniformuivEXT_remap_index]
-#define _gloffset_GetVertexAttribIivEXT driDispatchRemapTable[GetVertexAttribIivEXT_remap_index]
-#define _gloffset_GetVertexAttribIuivEXT driDispatchRemapTable[GetVertexAttribIuivEXT_remap_index]
-#define _gloffset_Uniform1uiEXT driDispatchRemapTable[Uniform1uiEXT_remap_index]
-#define _gloffset_Uniform1uivEXT driDispatchRemapTable[Uniform1uivEXT_remap_index]
-#define _gloffset_Uniform2uiEXT driDispatchRemapTable[Uniform2uiEXT_remap_index]
-#define _gloffset_Uniform2uivEXT driDispatchRemapTable[Uniform2uivEXT_remap_index]
-#define _gloffset_Uniform3uiEXT driDispatchRemapTable[Uniform3uiEXT_remap_index]
-#define _gloffset_Uniform3uivEXT driDispatchRemapTable[Uniform3uivEXT_remap_index]
-#define _gloffset_Uniform4uiEXT driDispatchRemapTable[Uniform4uiEXT_remap_index]
-#define _gloffset_Uniform4uivEXT driDispatchRemapTable[Uniform4uivEXT_remap_index]
-#define _gloffset_VertexAttribI1iEXT driDispatchRemapTable[VertexAttribI1iEXT_remap_index]
-#define _gloffset_VertexAttribI1ivEXT driDispatchRemapTable[VertexAttribI1ivEXT_remap_index]
-#define _gloffset_VertexAttribI1uiEXT driDispatchRemapTable[VertexAttribI1uiEXT_remap_index]
-#define _gloffset_VertexAttribI1uivEXT driDispatchRemapTable[VertexAttribI1uivEXT_remap_index]
-#define _gloffset_VertexAttribI2iEXT driDispatchRemapTable[VertexAttribI2iEXT_remap_index]
-#define _gloffset_VertexAttribI2ivEXT driDispatchRemapTable[VertexAttribI2ivEXT_remap_index]
-#define _gloffset_VertexAttribI2uiEXT driDispatchRemapTable[VertexAttribI2uiEXT_remap_index]
-#define _gloffset_VertexAttribI2uivEXT driDispatchRemapTable[VertexAttribI2uivEXT_remap_index]
-#define _gloffset_VertexAttribI3iEXT driDispatchRemapTable[VertexAttribI3iEXT_remap_index]
-#define _gloffset_VertexAttribI3ivEXT driDispatchRemapTable[VertexAttribI3ivEXT_remap_index]
-#define _gloffset_VertexAttribI3uiEXT driDispatchRemapTable[VertexAttribI3uiEXT_remap_index]
-#define _gloffset_VertexAttribI3uivEXT driDispatchRemapTable[VertexAttribI3uivEXT_remap_index]
-#define _gloffset_VertexAttribI4bvEXT driDispatchRemapTable[VertexAttribI4bvEXT_remap_index]
-#define _gloffset_VertexAttribI4iEXT driDispatchRemapTable[VertexAttribI4iEXT_remap_index]
-#define _gloffset_VertexAttribI4ivEXT driDispatchRemapTable[VertexAttribI4ivEXT_remap_index]
-#define _gloffset_VertexAttribI4svEXT driDispatchRemapTable[VertexAttribI4svEXT_remap_index]
-#define _gloffset_VertexAttribI4ubvEXT driDispatchRemapTable[VertexAttribI4ubvEXT_remap_index]
-#define _gloffset_VertexAttribI4uiEXT driDispatchRemapTable[VertexAttribI4uiEXT_remap_index]
-#define _gloffset_VertexAttribI4uivEXT driDispatchRemapTable[VertexAttribI4uivEXT_remap_index]
-#define _gloffset_VertexAttribI4usvEXT driDispatchRemapTable[VertexAttribI4usvEXT_remap_index]
-#define _gloffset_VertexAttribIPointerEXT driDispatchRemapTable[VertexAttribIPointerEXT_remap_index]
-#define _gloffset_FramebufferTextureLayerEXT driDispatchRemapTable[FramebufferTextureLayerEXT_remap_index]
-#define _gloffset_ColorMaskIndexedEXT driDispatchRemapTable[ColorMaskIndexedEXT_remap_index]
-#define _gloffset_DisableIndexedEXT driDispatchRemapTable[DisableIndexedEXT_remap_index]
-#define _gloffset_EnableIndexedEXT driDispatchRemapTable[EnableIndexedEXT_remap_index]
-#define _gloffset_GetBooleanIndexedvEXT driDispatchRemapTable[GetBooleanIndexedvEXT_remap_index]
-#define _gloffset_GetIntegerIndexedvEXT driDispatchRemapTable[GetIntegerIndexedvEXT_remap_index]
-#define _gloffset_IsEnabledIndexedEXT driDispatchRemapTable[IsEnabledIndexedEXT_remap_index]
-#define _gloffset_ClearColorIiEXT driDispatchRemapTable[ClearColorIiEXT_remap_index]
-#define _gloffset_ClearColorIuiEXT driDispatchRemapTable[ClearColorIuiEXT_remap_index]
-#define _gloffset_GetTexParameterIivEXT driDispatchRemapTable[GetTexParameterIivEXT_remap_index]
-#define _gloffset_GetTexParameterIuivEXT driDispatchRemapTable[GetTexParameterIuivEXT_remap_index]
-#define _gloffset_TexParameterIivEXT driDispatchRemapTable[TexParameterIivEXT_remap_index]
-#define _gloffset_TexParameterIuivEXT driDispatchRemapTable[TexParameterIuivEXT_remap_index]
-#define _gloffset_BeginConditionalRenderNV driDispatchRemapTable[BeginConditionalRenderNV_remap_index]
-#define _gloffset_EndConditionalRenderNV driDispatchRemapTable[EndConditionalRenderNV_remap_index]
-#define _gloffset_BeginTransformFeedbackEXT driDispatchRemapTable[BeginTransformFeedbackEXT_remap_index]
-#define _gloffset_BindBufferBaseEXT driDispatchRemapTable[BindBufferBaseEXT_remap_index]
-#define _gloffset_BindBufferOffsetEXT driDispatchRemapTable[BindBufferOffsetEXT_remap_index]
-#define _gloffset_BindBufferRangeEXT driDispatchRemapTable[BindBufferRangeEXT_remap_index]
-#define _gloffset_EndTransformFeedbackEXT driDispatchRemapTable[EndTransformFeedbackEXT_remap_index]
-#define _gloffset_GetTransformFeedbackVaryingEXT driDispatchRemapTable[GetTransformFeedbackVaryingEXT_remap_index]
-#define _gloffset_TransformFeedbackVaryingsEXT driDispatchRemapTable[TransformFeedbackVaryingsEXT_remap_index]
-#define _gloffset_ProvokingVertexEXT driDispatchRemapTable[ProvokingVertexEXT_remap_index]
-#define _gloffset_GetTexParameterPointervAPPLE driDispatchRemapTable[GetTexParameterPointervAPPLE_remap_index]
-#define _gloffset_TextureRangeAPPLE driDispatchRemapTable[TextureRangeAPPLE_remap_index]
-#define _gloffset_GetObjectParameterivAPPLE driDispatchRemapTable[GetObjectParameterivAPPLE_remap_index]
-#define _gloffset_ObjectPurgeableAPPLE driDispatchRemapTable[ObjectPurgeableAPPLE_remap_index]
-#define _gloffset_ObjectUnpurgeableAPPLE driDispatchRemapTable[ObjectUnpurgeableAPPLE_remap_index]
-#define _gloffset_ActiveProgramEXT driDispatchRemapTable[ActiveProgramEXT_remap_index]
-#define _gloffset_CreateShaderProgramEXT driDispatchRemapTable[CreateShaderProgramEXT_remap_index]
-#define _gloffset_UseShaderProgramEXT driDispatchRemapTable[UseShaderProgramEXT_remap_index]
-#define _gloffset_TextureBarrierNV driDispatchRemapTable[TextureBarrierNV_remap_index]
-#define _gloffset_StencilFuncSeparateATI driDispatchRemapTable[StencilFuncSeparateATI_remap_index]
-#define _gloffset_ProgramEnvParameters4fvEXT driDispatchRemapTable[ProgramEnvParameters4fvEXT_remap_index]
-#define _gloffset_ProgramLocalParameters4fvEXT driDispatchRemapTable[ProgramLocalParameters4fvEXT_remap_index]
-#define _gloffset_GetQueryObjecti64vEXT driDispatchRemapTable[GetQueryObjecti64vEXT_remap_index]
-#define _gloffset_GetQueryObjectui64vEXT driDispatchRemapTable[GetQueryObjectui64vEXT_remap_index]
-#define _gloffset_EGLImageTargetRenderbufferStorageOES driDispatchRemapTable[EGLImageTargetRenderbufferStorageOES_remap_index]
-#define _gloffset_EGLImageTargetTexture2DOES driDispatchRemapTable[EGLImageTargetTexture2DOES_remap_index]
-
-#endif                          /* !FEATURE_remap_table */
-
-typedef void (GLAPIENTRYP _glptr_NewList) (GLuint, GLenum);
-
-#define CALL_NewList(disp, parameters) \
-    (* GET_NewList(disp)) parameters
-static inline _glptr_NewList
-GET_NewList(struct _glapi_table *disp)
-{
-    return (_glptr_NewList) (GET_by_offset(disp, _gloffset_NewList));
-}
-
-static inline void
-SET_NewList(struct _glapi_table *disp, void (GLAPIENTRYP fn) (GLuint, GLenum))
-{
-    SET_by_offset(disp, _gloffset_NewList, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_EndList) (void);
-
-#define CALL_EndList(disp, parameters) \
-    (* GET_EndList(disp)) parameters
-static inline _glptr_EndList
-GET_EndList(struct _glapi_table *disp)
-{
-    return (_glptr_EndList) (GET_by_offset(disp, _gloffset_EndList));
-}
-
-static inline void
-SET_EndList(struct _glapi_table *disp, void (GLAPIENTRYP fn) (void))
-{
-    SET_by_offset(disp, _gloffset_EndList, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_CallList) (GLuint);
-
-#define CALL_CallList(disp, parameters) \
-    (* GET_CallList(disp)) parameters
-static inline _glptr_CallList
-GET_CallList(struct _glapi_table *disp)
-{
-    return (_glptr_CallList) (GET_by_offset(disp, _gloffset_CallList));
-}
-
-static inline void
-SET_CallList(struct _glapi_table *disp, void (GLAPIENTRYP fn) (GLuint))
-{
-    SET_by_offset(disp, _gloffset_CallList, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_CallLists) (GLsizei, GLenum, const GLvoid *);
-
-#define CALL_CallLists(disp, parameters) \
-    (* GET_CallLists(disp)) parameters
-static inline _glptr_CallLists
-GET_CallLists(struct _glapi_table *disp)
-{
-    return (_glptr_CallLists) (GET_by_offset(disp, _gloffset_CallLists));
-}
-
-static inline void
-SET_CallLists(struct _glapi_table *disp,
-              void (GLAPIENTRYP fn) (GLsizei, GLenum, const GLvoid *))
-{
-    SET_by_offset(disp, _gloffset_CallLists, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_DeleteLists) (GLuint, GLsizei);
-
-#define CALL_DeleteLists(disp, parameters) \
-    (* GET_DeleteLists(disp)) parameters
-static inline _glptr_DeleteLists
-GET_DeleteLists(struct _glapi_table *disp)
-{
-    return (_glptr_DeleteLists) (GET_by_offset(disp, _gloffset_DeleteLists));
-}
-
-static inline void
-SET_DeleteLists(struct _glapi_table *disp,
-                void (GLAPIENTRYP fn) (GLuint, GLsizei))
-{
-    SET_by_offset(disp, _gloffset_DeleteLists, fn);
-}
-
-typedef GLuint(GLAPIENTRYP _glptr_GenLists) (GLsizei);
-
-#define CALL_GenLists(disp, parameters) \
-    (* GET_GenLists(disp)) parameters
-static inline _glptr_GenLists
-GET_GenLists(struct _glapi_table *disp)
-{
-    return (_glptr_GenLists) (GET_by_offset(disp, _gloffset_GenLists));
-}
-
-static inline void
-SET_GenLists(struct _glapi_table *disp, GLuint(GLAPIENTRYP fn) (GLsizei))
-{
-    SET_by_offset(disp, _gloffset_GenLists, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ListBase) (GLuint);
-
-#define CALL_ListBase(disp, parameters) \
-    (* GET_ListBase(disp)) parameters
-static inline _glptr_ListBase
-GET_ListBase(struct _glapi_table *disp)
-{
-    return (_glptr_ListBase) (GET_by_offset(disp, _gloffset_ListBase));
-}
-
-static inline void
-SET_ListBase(struct _glapi_table *disp, void (GLAPIENTRYP fn) (GLuint))
-{
-    SET_by_offset(disp, _gloffset_ListBase, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Begin) (GLenum);
-
-#define CALL_Begin(disp, parameters) \
-    (* GET_Begin(disp)) parameters
-static inline _glptr_Begin
-GET_Begin(struct _glapi_table *disp)
-{
-    return (_glptr_Begin) (GET_by_offset(disp, _gloffset_Begin));
-}
-
-static inline void
-SET_Begin(struct _glapi_table *disp, void (GLAPIENTRYP fn) (GLenum))
-{
-    SET_by_offset(disp, _gloffset_Begin, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Bitmap) (GLsizei, GLsizei, GLfloat, GLfloat,
-                                          GLfloat, GLfloat, const GLubyte *);
-#define CALL_Bitmap(disp, parameters) \
-    (* GET_Bitmap(disp)) parameters
-static inline _glptr_Bitmap
-GET_Bitmap(struct _glapi_table *disp)
-{
-    return (_glptr_Bitmap) (GET_by_offset(disp, _gloffset_Bitmap));
-}
-
-static inline void
-SET_Bitmap(struct _glapi_table *disp,
-           void (GLAPIENTRYP fn) (GLsizei, GLsizei, GLfloat, GLfloat, GLfloat,
-                                  GLfloat, const GLubyte *))
-{
-    SET_by_offset(disp, _gloffset_Bitmap, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Color3b) (GLbyte, GLbyte, GLbyte);
-
-#define CALL_Color3b(disp, parameters) \
-    (* GET_Color3b(disp)) parameters
-static inline _glptr_Color3b
-GET_Color3b(struct _glapi_table *disp)
-{
-    return (_glptr_Color3b) (GET_by_offset(disp, _gloffset_Color3b));
-}
-
-static inline void
-SET_Color3b(struct _glapi_table *disp,
-            void (GLAPIENTRYP fn) (GLbyte, GLbyte, GLbyte))
-{
-    SET_by_offset(disp, _gloffset_Color3b, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Color3bv) (const GLbyte *);
-
-#define CALL_Color3bv(disp, parameters) \
-    (* GET_Color3bv(disp)) parameters
-static inline _glptr_Color3bv
-GET_Color3bv(struct _glapi_table *disp)
-{
-    return (_glptr_Color3bv) (GET_by_offset(disp, _gloffset_Color3bv));
-}
-
-static inline void
-SET_Color3bv(struct _glapi_table *disp, void (GLAPIENTRYP fn) (const GLbyte *))
-{
-    SET_by_offset(disp, _gloffset_Color3bv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Color3d) (GLdouble, GLdouble, GLdouble);
-
-#define CALL_Color3d(disp, parameters) \
-    (* GET_Color3d(disp)) parameters
-static inline _glptr_Color3d
-GET_Color3d(struct _glapi_table *disp)
-{
-    return (_glptr_Color3d) (GET_by_offset(disp, _gloffset_Color3d));
-}
-
-static inline void
-SET_Color3d(struct _glapi_table *disp,
-            void (GLAPIENTRYP fn) (GLdouble, GLdouble, GLdouble))
-{
-    SET_by_offset(disp, _gloffset_Color3d, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Color3dv) (const GLdouble *);
-
-#define CALL_Color3dv(disp, parameters) \
-    (* GET_Color3dv(disp)) parameters
-static inline _glptr_Color3dv
-GET_Color3dv(struct _glapi_table *disp)
-{
-    return (_glptr_Color3dv) (GET_by_offset(disp, _gloffset_Color3dv));
-}
-
-static inline void
-SET_Color3dv(struct _glapi_table *disp,
-             void (GLAPIENTRYP fn) (const GLdouble *))
-{
-    SET_by_offset(disp, _gloffset_Color3dv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Color3f) (GLfloat, GLfloat, GLfloat);
-
-#define CALL_Color3f(disp, parameters) \
-    (* GET_Color3f(disp)) parameters
-static inline _glptr_Color3f
-GET_Color3f(struct _glapi_table *disp)
-{
-    return (_glptr_Color3f) (GET_by_offset(disp, _gloffset_Color3f));
-}
-
-static inline void
-SET_Color3f(struct _glapi_table *disp,
-            void (GLAPIENTRYP fn) (GLfloat, GLfloat, GLfloat))
-{
-    SET_by_offset(disp, _gloffset_Color3f, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Color3fv) (const GLfloat *);
-
-#define CALL_Color3fv(disp, parameters) \
-    (* GET_Color3fv(disp)) parameters
-static inline _glptr_Color3fv
-GET_Color3fv(struct _glapi_table *disp)
-{
-    return (_glptr_Color3fv) (GET_by_offset(disp, _gloffset_Color3fv));
-}
-
-static inline void
-SET_Color3fv(struct _glapi_table *disp, void (GLAPIENTRYP fn) (const GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_Color3fv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Color3i) (GLint, GLint, GLint);
-
-#define CALL_Color3i(disp, parameters) \
-    (* GET_Color3i(disp)) parameters
-static inline _glptr_Color3i
-GET_Color3i(struct _glapi_table *disp)
-{
-    return (_glptr_Color3i) (GET_by_offset(disp, _gloffset_Color3i));
-}
-
-static inline void
-SET_Color3i(struct _glapi_table *disp,
-            void (GLAPIENTRYP fn) (GLint, GLint, GLint))
-{
-    SET_by_offset(disp, _gloffset_Color3i, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Color3iv) (const GLint *);
-
-#define CALL_Color3iv(disp, parameters) \
-    (* GET_Color3iv(disp)) parameters
-static inline _glptr_Color3iv
-GET_Color3iv(struct _glapi_table *disp)
-{
-    return (_glptr_Color3iv) (GET_by_offset(disp, _gloffset_Color3iv));
-}
-
-static inline void
-SET_Color3iv(struct _glapi_table *disp, void (GLAPIENTRYP fn) (const GLint *))
-{
-    SET_by_offset(disp, _gloffset_Color3iv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Color3s) (GLshort, GLshort, GLshort);
-
-#define CALL_Color3s(disp, parameters) \
-    (* GET_Color3s(disp)) parameters
-static inline _glptr_Color3s
-GET_Color3s(struct _glapi_table *disp)
-{
-    return (_glptr_Color3s) (GET_by_offset(disp, _gloffset_Color3s));
-}
-
-static inline void
-SET_Color3s(struct _glapi_table *disp,
-            void (GLAPIENTRYP fn) (GLshort, GLshort, GLshort))
-{
-    SET_by_offset(disp, _gloffset_Color3s, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Color3sv) (const GLshort *);
-
-#define CALL_Color3sv(disp, parameters) \
-    (* GET_Color3sv(disp)) parameters
-static inline _glptr_Color3sv
-GET_Color3sv(struct _glapi_table *disp)
-{
-    return (_glptr_Color3sv) (GET_by_offset(disp, _gloffset_Color3sv));
-}
-
-static inline void
-SET_Color3sv(struct _glapi_table *disp, void (GLAPIENTRYP fn) (const GLshort *))
-{
-    SET_by_offset(disp, _gloffset_Color3sv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Color3ub) (GLubyte, GLubyte, GLubyte);
-
-#define CALL_Color3ub(disp, parameters) \
-    (* GET_Color3ub(disp)) parameters
-static inline _glptr_Color3ub
-GET_Color3ub(struct _glapi_table *disp)
-{
-    return (_glptr_Color3ub) (GET_by_offset(disp, _gloffset_Color3ub));
-}
-
-static inline void
-SET_Color3ub(struct _glapi_table *disp,
-             void (GLAPIENTRYP fn) (GLubyte, GLubyte, GLubyte))
-{
-    SET_by_offset(disp, _gloffset_Color3ub, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Color3ubv) (const GLubyte *);
-
-#define CALL_Color3ubv(disp, parameters) \
-    (* GET_Color3ubv(disp)) parameters
-static inline _glptr_Color3ubv
-GET_Color3ubv(struct _glapi_table *disp)
-{
-    return (_glptr_Color3ubv) (GET_by_offset(disp, _gloffset_Color3ubv));
-}
-
-static inline void
-SET_Color3ubv(struct _glapi_table *disp,
-              void (GLAPIENTRYP fn) (const GLubyte *))
-{
-    SET_by_offset(disp, _gloffset_Color3ubv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Color3ui) (GLuint, GLuint, GLuint);
-
-#define CALL_Color3ui(disp, parameters) \
-    (* GET_Color3ui(disp)) parameters
-static inline _glptr_Color3ui
-GET_Color3ui(struct _glapi_table *disp)
-{
-    return (_glptr_Color3ui) (GET_by_offset(disp, _gloffset_Color3ui));
-}
-
-static inline void
-SET_Color3ui(struct _glapi_table *disp,
-             void (GLAPIENTRYP fn) (GLuint, GLuint, GLuint))
-{
-    SET_by_offset(disp, _gloffset_Color3ui, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Color3uiv) (const GLuint *);
-
-#define CALL_Color3uiv(disp, parameters) \
-    (* GET_Color3uiv(disp)) parameters
-static inline _glptr_Color3uiv
-GET_Color3uiv(struct _glapi_table *disp)
-{
-    return (_glptr_Color3uiv) (GET_by_offset(disp, _gloffset_Color3uiv));
-}
-
-static inline void
-SET_Color3uiv(struct _glapi_table *disp, void (GLAPIENTRYP fn) (const GLuint *))
-{
-    SET_by_offset(disp, _gloffset_Color3uiv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Color3us) (GLushort, GLushort, GLushort);
-
-#define CALL_Color3us(disp, parameters) \
-    (* GET_Color3us(disp)) parameters
-static inline _glptr_Color3us
-GET_Color3us(struct _glapi_table *disp)
-{
-    return (_glptr_Color3us) (GET_by_offset(disp, _gloffset_Color3us));
-}
-
-static inline void
-SET_Color3us(struct _glapi_table *disp,
-             void (GLAPIENTRYP fn) (GLushort, GLushort, GLushort))
-{
-    SET_by_offset(disp, _gloffset_Color3us, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Color3usv) (const GLushort *);
-
-#define CALL_Color3usv(disp, parameters) \
-    (* GET_Color3usv(disp)) parameters
-static inline _glptr_Color3usv
-GET_Color3usv(struct _glapi_table *disp)
-{
-    return (_glptr_Color3usv) (GET_by_offset(disp, _gloffset_Color3usv));
-}
-
-static inline void
-SET_Color3usv(struct _glapi_table *disp,
-              void (GLAPIENTRYP fn) (const GLushort *))
-{
-    SET_by_offset(disp, _gloffset_Color3usv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Color4b) (GLbyte, GLbyte, GLbyte, GLbyte);
-
-#define CALL_Color4b(disp, parameters) \
-    (* GET_Color4b(disp)) parameters
-static inline _glptr_Color4b
-GET_Color4b(struct _glapi_table *disp)
-{
-    return (_glptr_Color4b) (GET_by_offset(disp, _gloffset_Color4b));
-}
-
-static inline void
-SET_Color4b(struct _glapi_table *disp,
-            void (GLAPIENTRYP fn) (GLbyte, GLbyte, GLbyte, GLbyte))
-{
-    SET_by_offset(disp, _gloffset_Color4b, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Color4bv) (const GLbyte *);
-
-#define CALL_Color4bv(disp, parameters) \
-    (* GET_Color4bv(disp)) parameters
-static inline _glptr_Color4bv
-GET_Color4bv(struct _glapi_table *disp)
-{
-    return (_glptr_Color4bv) (GET_by_offset(disp, _gloffset_Color4bv));
-}
-
-static inline void
-SET_Color4bv(struct _glapi_table *disp, void (GLAPIENTRYP fn) (const GLbyte *))
-{
-    SET_by_offset(disp, _gloffset_Color4bv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Color4d) (GLdouble, GLdouble, GLdouble,
-                                           GLdouble);
-#define CALL_Color4d(disp, parameters) \
-    (* GET_Color4d(disp)) parameters
-static inline _glptr_Color4d
-GET_Color4d(struct _glapi_table *disp)
-{
-    return (_glptr_Color4d) (GET_by_offset(disp, _gloffset_Color4d));
-}
-
-static inline void
-SET_Color4d(struct _glapi_table *disp,
-            void (GLAPIENTRYP fn) (GLdouble, GLdouble, GLdouble, GLdouble))
-{
-    SET_by_offset(disp, _gloffset_Color4d, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Color4dv) (const GLdouble *);
-
-#define CALL_Color4dv(disp, parameters) \
-    (* GET_Color4dv(disp)) parameters
-static inline _glptr_Color4dv
-GET_Color4dv(struct _glapi_table *disp)
-{
-    return (_glptr_Color4dv) (GET_by_offset(disp, _gloffset_Color4dv));
-}
-
-static inline void
-SET_Color4dv(struct _glapi_table *disp,
-             void (GLAPIENTRYP fn) (const GLdouble *))
-{
-    SET_by_offset(disp, _gloffset_Color4dv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Color4f) (GLfloat, GLfloat, GLfloat, GLfloat);
-
-#define CALL_Color4f(disp, parameters) \
-    (* GET_Color4f(disp)) parameters
-static inline _glptr_Color4f
-GET_Color4f(struct _glapi_table *disp)
-{
-    return (_glptr_Color4f) (GET_by_offset(disp, _gloffset_Color4f));
-}
-
-static inline void
-SET_Color4f(struct _glapi_table *disp,
-            void (GLAPIENTRYP fn) (GLfloat, GLfloat, GLfloat, GLfloat))
-{
-    SET_by_offset(disp, _gloffset_Color4f, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Color4fv) (const GLfloat *);
-
-#define CALL_Color4fv(disp, parameters) \
-    (* GET_Color4fv(disp)) parameters
-static inline _glptr_Color4fv
-GET_Color4fv(struct _glapi_table *disp)
-{
-    return (_glptr_Color4fv) (GET_by_offset(disp, _gloffset_Color4fv));
-}
-
-static inline void
-SET_Color4fv(struct _glapi_table *disp, void (GLAPIENTRYP fn) (const GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_Color4fv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Color4i) (GLint, GLint, GLint, GLint);
-
-#define CALL_Color4i(disp, parameters) \
-    (* GET_Color4i(disp)) parameters
-static inline _glptr_Color4i
-GET_Color4i(struct _glapi_table *disp)
-{
-    return (_glptr_Color4i) (GET_by_offset(disp, _gloffset_Color4i));
-}
-
-static inline void
-SET_Color4i(struct _glapi_table *disp,
-            void (GLAPIENTRYP fn) (GLint, GLint, GLint, GLint))
-{
-    SET_by_offset(disp, _gloffset_Color4i, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Color4iv) (const GLint *);
-
-#define CALL_Color4iv(disp, parameters) \
-    (* GET_Color4iv(disp)) parameters
-static inline _glptr_Color4iv
-GET_Color4iv(struct _glapi_table *disp)
-{
-    return (_glptr_Color4iv) (GET_by_offset(disp, _gloffset_Color4iv));
-}
-
-static inline void
-SET_Color4iv(struct _glapi_table *disp, void (GLAPIENTRYP fn) (const GLint *))
-{
-    SET_by_offset(disp, _gloffset_Color4iv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Color4s) (GLshort, GLshort, GLshort, GLshort);
-
-#define CALL_Color4s(disp, parameters) \
-    (* GET_Color4s(disp)) parameters
-static inline _glptr_Color4s
-GET_Color4s(struct _glapi_table *disp)
-{
-    return (_glptr_Color4s) (GET_by_offset(disp, _gloffset_Color4s));
-}
-
-static inline void
-SET_Color4s(struct _glapi_table *disp,
-            void (GLAPIENTRYP fn) (GLshort, GLshort, GLshort, GLshort))
-{
-    SET_by_offset(disp, _gloffset_Color4s, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Color4sv) (const GLshort *);
-
-#define CALL_Color4sv(disp, parameters) \
-    (* GET_Color4sv(disp)) parameters
-static inline _glptr_Color4sv
-GET_Color4sv(struct _glapi_table *disp)
-{
-    return (_glptr_Color4sv) (GET_by_offset(disp, _gloffset_Color4sv));
-}
-
-static inline void
-SET_Color4sv(struct _glapi_table *disp, void (GLAPIENTRYP fn) (const GLshort *))
-{
-    SET_by_offset(disp, _gloffset_Color4sv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Color4ub) (GLubyte, GLubyte, GLubyte, GLubyte);
-
-#define CALL_Color4ub(disp, parameters) \
-    (* GET_Color4ub(disp)) parameters
-static inline _glptr_Color4ub
-GET_Color4ub(struct _glapi_table *disp)
-{
-    return (_glptr_Color4ub) (GET_by_offset(disp, _gloffset_Color4ub));
-}
-
-static inline void
-SET_Color4ub(struct _glapi_table *disp,
-             void (GLAPIENTRYP fn) (GLubyte, GLubyte, GLubyte, GLubyte))
-{
-    SET_by_offset(disp, _gloffset_Color4ub, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Color4ubv) (const GLubyte *);
-
-#define CALL_Color4ubv(disp, parameters) \
-    (* GET_Color4ubv(disp)) parameters
-static inline _glptr_Color4ubv
-GET_Color4ubv(struct _glapi_table *disp)
-{
-    return (_glptr_Color4ubv) (GET_by_offset(disp, _gloffset_Color4ubv));
-}
-
-static inline void
-SET_Color4ubv(struct _glapi_table *disp,
-              void (GLAPIENTRYP fn) (const GLubyte *))
-{
-    SET_by_offset(disp, _gloffset_Color4ubv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Color4ui) (GLuint, GLuint, GLuint, GLuint);
-
-#define CALL_Color4ui(disp, parameters) \
-    (* GET_Color4ui(disp)) parameters
-static inline _glptr_Color4ui
-GET_Color4ui(struct _glapi_table *disp)
-{
-    return (_glptr_Color4ui) (GET_by_offset(disp, _gloffset_Color4ui));
-}
-
-static inline void
-SET_Color4ui(struct _glapi_table *disp,
-             void (GLAPIENTRYP fn) (GLuint, GLuint, GLuint, GLuint))
-{
-    SET_by_offset(disp, _gloffset_Color4ui, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Color4uiv) (const GLuint *);
-
-#define CALL_Color4uiv(disp, parameters) \
-    (* GET_Color4uiv(disp)) parameters
-static inline _glptr_Color4uiv
-GET_Color4uiv(struct _glapi_table *disp)
-{
-    return (_glptr_Color4uiv) (GET_by_offset(disp, _gloffset_Color4uiv));
-}
-
-static inline void
-SET_Color4uiv(struct _glapi_table *disp, void (GLAPIENTRYP fn) (const GLuint *))
-{
-    SET_by_offset(disp, _gloffset_Color4uiv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Color4us) (GLushort, GLushort, GLushort,
-                                            GLushort);
-#define CALL_Color4us(disp, parameters) \
-    (* GET_Color4us(disp)) parameters
-static inline _glptr_Color4us
-GET_Color4us(struct _glapi_table *disp)
-{
-    return (_glptr_Color4us) (GET_by_offset(disp, _gloffset_Color4us));
-}
-
-static inline void
-SET_Color4us(struct _glapi_table *disp,
-             void (GLAPIENTRYP fn) (GLushort, GLushort, GLushort, GLushort))
-{
-    SET_by_offset(disp, _gloffset_Color4us, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Color4usv) (const GLushort *);
-
-#define CALL_Color4usv(disp, parameters) \
-    (* GET_Color4usv(disp)) parameters
-static inline _glptr_Color4usv
-GET_Color4usv(struct _glapi_table *disp)
-{
-    return (_glptr_Color4usv) (GET_by_offset(disp, _gloffset_Color4usv));
-}
-
-static inline void
-SET_Color4usv(struct _glapi_table *disp,
-              void (GLAPIENTRYP fn) (const GLushort *))
-{
-    SET_by_offset(disp, _gloffset_Color4usv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_EdgeFlag) (GLboolean);
-
-#define CALL_EdgeFlag(disp, parameters) \
-    (* GET_EdgeFlag(disp)) parameters
-static inline _glptr_EdgeFlag
-GET_EdgeFlag(struct _glapi_table *disp)
-{
-    return (_glptr_EdgeFlag) (GET_by_offset(disp, _gloffset_EdgeFlag));
-}
-
-static inline void
-SET_EdgeFlag(struct _glapi_table *disp, void (GLAPIENTRYP fn) (GLboolean))
-{
-    SET_by_offset(disp, _gloffset_EdgeFlag, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_EdgeFlagv) (const GLboolean *);
-
-#define CALL_EdgeFlagv(disp, parameters) \
-    (* GET_EdgeFlagv(disp)) parameters
-static inline _glptr_EdgeFlagv
-GET_EdgeFlagv(struct _glapi_table *disp)
-{
-    return (_glptr_EdgeFlagv) (GET_by_offset(disp, _gloffset_EdgeFlagv));
-}
-
-static inline void
-SET_EdgeFlagv(struct _glapi_table *disp,
-              void (GLAPIENTRYP fn) (const GLboolean *))
-{
-    SET_by_offset(disp, _gloffset_EdgeFlagv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_End) (void);
-
-#define CALL_End(disp, parameters) \
-    (* GET_End(disp)) parameters
-static inline _glptr_End
-GET_End(struct _glapi_table *disp)
-{
-    return (_glptr_End) (GET_by_offset(disp, _gloffset_End));
-}
-
-static inline void
-SET_End(struct _glapi_table *disp, void (GLAPIENTRYP fn) (void))
-{
-    SET_by_offset(disp, _gloffset_End, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Indexd) (GLdouble);
-
-#define CALL_Indexd(disp, parameters) \
-    (* GET_Indexd(disp)) parameters
-static inline _glptr_Indexd
-GET_Indexd(struct _glapi_table *disp)
-{
-    return (_glptr_Indexd) (GET_by_offset(disp, _gloffset_Indexd));
-}
-
-static inline void
-SET_Indexd(struct _glapi_table *disp, void (GLAPIENTRYP fn) (GLdouble))
-{
-    SET_by_offset(disp, _gloffset_Indexd, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Indexdv) (const GLdouble *);
-
-#define CALL_Indexdv(disp, parameters) \
-    (* GET_Indexdv(disp)) parameters
-static inline _glptr_Indexdv
-GET_Indexdv(struct _glapi_table *disp)
-{
-    return (_glptr_Indexdv) (GET_by_offset(disp, _gloffset_Indexdv));
-}
-
-static inline void
-SET_Indexdv(struct _glapi_table *disp, void (GLAPIENTRYP fn) (const GLdouble *))
-{
-    SET_by_offset(disp, _gloffset_Indexdv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Indexf) (GLfloat);
-
-#define CALL_Indexf(disp, parameters) \
-    (* GET_Indexf(disp)) parameters
-static inline _glptr_Indexf
-GET_Indexf(struct _glapi_table *disp)
-{
-    return (_glptr_Indexf) (GET_by_offset(disp, _gloffset_Indexf));
-}
-
-static inline void
-SET_Indexf(struct _glapi_table *disp, void (GLAPIENTRYP fn) (GLfloat))
-{
-    SET_by_offset(disp, _gloffset_Indexf, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Indexfv) (const GLfloat *);
-
-#define CALL_Indexfv(disp, parameters) \
-    (* GET_Indexfv(disp)) parameters
-static inline _glptr_Indexfv
-GET_Indexfv(struct _glapi_table *disp)
-{
-    return (_glptr_Indexfv) (GET_by_offset(disp, _gloffset_Indexfv));
-}
-
-static inline void
-SET_Indexfv(struct _glapi_table *disp, void (GLAPIENTRYP fn) (const GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_Indexfv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Indexi) (GLint);
-
-#define CALL_Indexi(disp, parameters) \
-    (* GET_Indexi(disp)) parameters
-static inline _glptr_Indexi
-GET_Indexi(struct _glapi_table *disp)
-{
-    return (_glptr_Indexi) (GET_by_offset(disp, _gloffset_Indexi));
-}
-
-static inline void
-SET_Indexi(struct _glapi_table *disp, void (GLAPIENTRYP fn) (GLint))
-{
-    SET_by_offset(disp, _gloffset_Indexi, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Indexiv) (const GLint *);
-
-#define CALL_Indexiv(disp, parameters) \
-    (* GET_Indexiv(disp)) parameters
-static inline _glptr_Indexiv
-GET_Indexiv(struct _glapi_table *disp)
-{
-    return (_glptr_Indexiv) (GET_by_offset(disp, _gloffset_Indexiv));
-}
-
-static inline void
-SET_Indexiv(struct _glapi_table *disp, void (GLAPIENTRYP fn) (const GLint *))
-{
-    SET_by_offset(disp, _gloffset_Indexiv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Indexs) (GLshort);
-
-#define CALL_Indexs(disp, parameters) \
-    (* GET_Indexs(disp)) parameters
-static inline _glptr_Indexs
-GET_Indexs(struct _glapi_table *disp)
-{
-    return (_glptr_Indexs) (GET_by_offset(disp, _gloffset_Indexs));
-}
-
-static inline void
-SET_Indexs(struct _glapi_table *disp, void (GLAPIENTRYP fn) (GLshort))
-{
-    SET_by_offset(disp, _gloffset_Indexs, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Indexsv) (const GLshort *);
-
-#define CALL_Indexsv(disp, parameters) \
-    (* GET_Indexsv(disp)) parameters
-static inline _glptr_Indexsv
-GET_Indexsv(struct _glapi_table *disp)
-{
-    return (_glptr_Indexsv) (GET_by_offset(disp, _gloffset_Indexsv));
-}
-
-static inline void
-SET_Indexsv(struct _glapi_table *disp, void (GLAPIENTRYP fn) (const GLshort *))
-{
-    SET_by_offset(disp, _gloffset_Indexsv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Normal3b) (GLbyte, GLbyte, GLbyte);
-
-#define CALL_Normal3b(disp, parameters) \
-    (* GET_Normal3b(disp)) parameters
-static inline _glptr_Normal3b
-GET_Normal3b(struct _glapi_table *disp)
-{
-    return (_glptr_Normal3b) (GET_by_offset(disp, _gloffset_Normal3b));
-}
-
-static inline void
-SET_Normal3b(struct _glapi_table *disp,
-             void (GLAPIENTRYP fn) (GLbyte, GLbyte, GLbyte))
-{
-    SET_by_offset(disp, _gloffset_Normal3b, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Normal3bv) (const GLbyte *);
-
-#define CALL_Normal3bv(disp, parameters) \
-    (* GET_Normal3bv(disp)) parameters
-static inline _glptr_Normal3bv
-GET_Normal3bv(struct _glapi_table *disp)
-{
-    return (_glptr_Normal3bv) (GET_by_offset(disp, _gloffset_Normal3bv));
-}
-
-static inline void
-SET_Normal3bv(struct _glapi_table *disp, void (GLAPIENTRYP fn) (const GLbyte *))
-{
-    SET_by_offset(disp, _gloffset_Normal3bv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Normal3d) (GLdouble, GLdouble, GLdouble);
-
-#define CALL_Normal3d(disp, parameters) \
-    (* GET_Normal3d(disp)) parameters
-static inline _glptr_Normal3d
-GET_Normal3d(struct _glapi_table *disp)
-{
-    return (_glptr_Normal3d) (GET_by_offset(disp, _gloffset_Normal3d));
-}
-
-static inline void
-SET_Normal3d(struct _glapi_table *disp,
-             void (GLAPIENTRYP fn) (GLdouble, GLdouble, GLdouble))
-{
-    SET_by_offset(disp, _gloffset_Normal3d, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Normal3dv) (const GLdouble *);
-
-#define CALL_Normal3dv(disp, parameters) \
-    (* GET_Normal3dv(disp)) parameters
-static inline _glptr_Normal3dv
-GET_Normal3dv(struct _glapi_table *disp)
-{
-    return (_glptr_Normal3dv) (GET_by_offset(disp, _gloffset_Normal3dv));
-}
-
-static inline void
-SET_Normal3dv(struct _glapi_table *disp,
-              void (GLAPIENTRYP fn) (const GLdouble *))
-{
-    SET_by_offset(disp, _gloffset_Normal3dv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Normal3f) (GLfloat, GLfloat, GLfloat);
-
-#define CALL_Normal3f(disp, parameters) \
-    (* GET_Normal3f(disp)) parameters
-static inline _glptr_Normal3f
-GET_Normal3f(struct _glapi_table *disp)
-{
-    return (_glptr_Normal3f) (GET_by_offset(disp, _gloffset_Normal3f));
-}
-
-static inline void
-SET_Normal3f(struct _glapi_table *disp,
-             void (GLAPIENTRYP fn) (GLfloat, GLfloat, GLfloat))
-{
-    SET_by_offset(disp, _gloffset_Normal3f, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Normal3fv) (const GLfloat *);
-
-#define CALL_Normal3fv(disp, parameters) \
-    (* GET_Normal3fv(disp)) parameters
-static inline _glptr_Normal3fv
-GET_Normal3fv(struct _glapi_table *disp)
-{
-    return (_glptr_Normal3fv) (GET_by_offset(disp, _gloffset_Normal3fv));
-}
-
-static inline void
-SET_Normal3fv(struct _glapi_table *disp,
-              void (GLAPIENTRYP fn) (const GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_Normal3fv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Normal3i) (GLint, GLint, GLint);
-
-#define CALL_Normal3i(disp, parameters) \
-    (* GET_Normal3i(disp)) parameters
-static inline _glptr_Normal3i
-GET_Normal3i(struct _glapi_table *disp)
-{
-    return (_glptr_Normal3i) (GET_by_offset(disp, _gloffset_Normal3i));
-}
-
-static inline void
-SET_Normal3i(struct _glapi_table *disp,
-             void (GLAPIENTRYP fn) (GLint, GLint, GLint))
-{
-    SET_by_offset(disp, _gloffset_Normal3i, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Normal3iv) (const GLint *);
-
-#define CALL_Normal3iv(disp, parameters) \
-    (* GET_Normal3iv(disp)) parameters
-static inline _glptr_Normal3iv
-GET_Normal3iv(struct _glapi_table *disp)
-{
-    return (_glptr_Normal3iv) (GET_by_offset(disp, _gloffset_Normal3iv));
-}
-
-static inline void
-SET_Normal3iv(struct _glapi_table *disp, void (GLAPIENTRYP fn) (const GLint *))
-{
-    SET_by_offset(disp, _gloffset_Normal3iv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Normal3s) (GLshort, GLshort, GLshort);
-
-#define CALL_Normal3s(disp, parameters) \
-    (* GET_Normal3s(disp)) parameters
-static inline _glptr_Normal3s
-GET_Normal3s(struct _glapi_table *disp)
-{
-    return (_glptr_Normal3s) (GET_by_offset(disp, _gloffset_Normal3s));
-}
-
-static inline void
-SET_Normal3s(struct _glapi_table *disp,
-             void (GLAPIENTRYP fn) (GLshort, GLshort, GLshort))
-{
-    SET_by_offset(disp, _gloffset_Normal3s, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Normal3sv) (const GLshort *);
-
-#define CALL_Normal3sv(disp, parameters) \
-    (* GET_Normal3sv(disp)) parameters
-static inline _glptr_Normal3sv
-GET_Normal3sv(struct _glapi_table *disp)
-{
-    return (_glptr_Normal3sv) (GET_by_offset(disp, _gloffset_Normal3sv));
-}
-
-static inline void
-SET_Normal3sv(struct _glapi_table *disp,
-              void (GLAPIENTRYP fn) (const GLshort *))
-{
-    SET_by_offset(disp, _gloffset_Normal3sv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_RasterPos2d) (GLdouble, GLdouble);
-
-#define CALL_RasterPos2d(disp, parameters) \
-    (* GET_RasterPos2d(disp)) parameters
-static inline _glptr_RasterPos2d
-GET_RasterPos2d(struct _glapi_table *disp)
-{
-    return (_glptr_RasterPos2d) (GET_by_offset(disp, _gloffset_RasterPos2d));
-}
-
-static inline void
-SET_RasterPos2d(struct _glapi_table *disp,
-                void (GLAPIENTRYP fn) (GLdouble, GLdouble))
-{
-    SET_by_offset(disp, _gloffset_RasterPos2d, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_RasterPos2dv) (const GLdouble *);
-
-#define CALL_RasterPos2dv(disp, parameters) \
-    (* GET_RasterPos2dv(disp)) parameters
-static inline _glptr_RasterPos2dv
-GET_RasterPos2dv(struct _glapi_table *disp)
-{
-    return (_glptr_RasterPos2dv) (GET_by_offset(disp, _gloffset_RasterPos2dv));
-}
-
-static inline void
-SET_RasterPos2dv(struct _glapi_table *disp,
-                 void (GLAPIENTRYP fn) (const GLdouble *))
-{
-    SET_by_offset(disp, _gloffset_RasterPos2dv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_RasterPos2f) (GLfloat, GLfloat);
-
-#define CALL_RasterPos2f(disp, parameters) \
-    (* GET_RasterPos2f(disp)) parameters
-static inline _glptr_RasterPos2f
-GET_RasterPos2f(struct _glapi_table *disp)
-{
-    return (_glptr_RasterPos2f) (GET_by_offset(disp, _gloffset_RasterPos2f));
-}
-
-static inline void
-SET_RasterPos2f(struct _glapi_table *disp,
-                void (GLAPIENTRYP fn) (GLfloat, GLfloat))
-{
-    SET_by_offset(disp, _gloffset_RasterPos2f, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_RasterPos2fv) (const GLfloat *);
-
-#define CALL_RasterPos2fv(disp, parameters) \
-    (* GET_RasterPos2fv(disp)) parameters
-static inline _glptr_RasterPos2fv
-GET_RasterPos2fv(struct _glapi_table *disp)
-{
-    return (_glptr_RasterPos2fv) (GET_by_offset(disp, _gloffset_RasterPos2fv));
-}
-
-static inline void
-SET_RasterPos2fv(struct _glapi_table *disp,
-                 void (GLAPIENTRYP fn) (const GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_RasterPos2fv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_RasterPos2i) (GLint, GLint);
-
-#define CALL_RasterPos2i(disp, parameters) \
-    (* GET_RasterPos2i(disp)) parameters
-static inline _glptr_RasterPos2i
-GET_RasterPos2i(struct _glapi_table *disp)
-{
-    return (_glptr_RasterPos2i) (GET_by_offset(disp, _gloffset_RasterPos2i));
-}
-
-static inline void
-SET_RasterPos2i(struct _glapi_table *disp, void (GLAPIENTRYP fn) (GLint, GLint))
-{
-    SET_by_offset(disp, _gloffset_RasterPos2i, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_RasterPos2iv) (const GLint *);
-
-#define CALL_RasterPos2iv(disp, parameters) \
-    (* GET_RasterPos2iv(disp)) parameters
-static inline _glptr_RasterPos2iv
-GET_RasterPos2iv(struct _glapi_table *disp)
-{
-    return (_glptr_RasterPos2iv) (GET_by_offset(disp, _gloffset_RasterPos2iv));
-}
-
-static inline void
-SET_RasterPos2iv(struct _glapi_table *disp,
-                 void (GLAPIENTRYP fn) (const GLint *))
-{
-    SET_by_offset(disp, _gloffset_RasterPos2iv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_RasterPos2s) (GLshort, GLshort);
-
-#define CALL_RasterPos2s(disp, parameters) \
-    (* GET_RasterPos2s(disp)) parameters
-static inline _glptr_RasterPos2s
-GET_RasterPos2s(struct _glapi_table *disp)
-{
-    return (_glptr_RasterPos2s) (GET_by_offset(disp, _gloffset_RasterPos2s));
-}
-
-static inline void
-SET_RasterPos2s(struct _glapi_table *disp,
-                void (GLAPIENTRYP fn) (GLshort, GLshort))
-{
-    SET_by_offset(disp, _gloffset_RasterPos2s, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_RasterPos2sv) (const GLshort *);
-
-#define CALL_RasterPos2sv(disp, parameters) \
-    (* GET_RasterPos2sv(disp)) parameters
-static inline _glptr_RasterPos2sv
-GET_RasterPos2sv(struct _glapi_table *disp)
-{
-    return (_glptr_RasterPos2sv) (GET_by_offset(disp, _gloffset_RasterPos2sv));
-}
-
-static inline void
-SET_RasterPos2sv(struct _glapi_table *disp,
-                 void (GLAPIENTRYP fn) (const GLshort *))
-{
-    SET_by_offset(disp, _gloffset_RasterPos2sv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_RasterPos3d) (GLdouble, GLdouble, GLdouble);
-
-#define CALL_RasterPos3d(disp, parameters) \
-    (* GET_RasterPos3d(disp)) parameters
-static inline _glptr_RasterPos3d
-GET_RasterPos3d(struct _glapi_table *disp)
-{
-    return (_glptr_RasterPos3d) (GET_by_offset(disp, _gloffset_RasterPos3d));
-}
-
-static inline void
-SET_RasterPos3d(struct _glapi_table *disp,
-                void (GLAPIENTRYP fn) (GLdouble, GLdouble, GLdouble))
-{
-    SET_by_offset(disp, _gloffset_RasterPos3d, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_RasterPos3dv) (const GLdouble *);
-
-#define CALL_RasterPos3dv(disp, parameters) \
-    (* GET_RasterPos3dv(disp)) parameters
-static inline _glptr_RasterPos3dv
-GET_RasterPos3dv(struct _glapi_table *disp)
-{
-    return (_glptr_RasterPos3dv) (GET_by_offset(disp, _gloffset_RasterPos3dv));
-}
-
-static inline void
-SET_RasterPos3dv(struct _glapi_table *disp,
-                 void (GLAPIENTRYP fn) (const GLdouble *))
-{
-    SET_by_offset(disp, _gloffset_RasterPos3dv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_RasterPos3f) (GLfloat, GLfloat, GLfloat);
-
-#define CALL_RasterPos3f(disp, parameters) \
-    (* GET_RasterPos3f(disp)) parameters
-static inline _glptr_RasterPos3f
-GET_RasterPos3f(struct _glapi_table *disp)
-{
-    return (_glptr_RasterPos3f) (GET_by_offset(disp, _gloffset_RasterPos3f));
-}
-
-static inline void
-SET_RasterPos3f(struct _glapi_table *disp,
-                void (GLAPIENTRYP fn) (GLfloat, GLfloat, GLfloat))
-{
-    SET_by_offset(disp, _gloffset_RasterPos3f, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_RasterPos3fv) (const GLfloat *);
-
-#define CALL_RasterPos3fv(disp, parameters) \
-    (* GET_RasterPos3fv(disp)) parameters
-static inline _glptr_RasterPos3fv
-GET_RasterPos3fv(struct _glapi_table *disp)
-{
-    return (_glptr_RasterPos3fv) (GET_by_offset(disp, _gloffset_RasterPos3fv));
-}
-
-static inline void
-SET_RasterPos3fv(struct _glapi_table *disp,
-                 void (GLAPIENTRYP fn) (const GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_RasterPos3fv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_RasterPos3i) (GLint, GLint, GLint);
-
-#define CALL_RasterPos3i(disp, parameters) \
-    (* GET_RasterPos3i(disp)) parameters
-static inline _glptr_RasterPos3i
-GET_RasterPos3i(struct _glapi_table *disp)
-{
-    return (_glptr_RasterPos3i) (GET_by_offset(disp, _gloffset_RasterPos3i));
-}
-
-static inline void
-SET_RasterPos3i(struct _glapi_table *disp,
-                void (GLAPIENTRYP fn) (GLint, GLint, GLint))
-{
-    SET_by_offset(disp, _gloffset_RasterPos3i, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_RasterPos3iv) (const GLint *);
-
-#define CALL_RasterPos3iv(disp, parameters) \
-    (* GET_RasterPos3iv(disp)) parameters
-static inline _glptr_RasterPos3iv
-GET_RasterPos3iv(struct _glapi_table *disp)
-{
-    return (_glptr_RasterPos3iv) (GET_by_offset(disp, _gloffset_RasterPos3iv));
-}
-
-static inline void
-SET_RasterPos3iv(struct _glapi_table *disp,
-                 void (GLAPIENTRYP fn) (const GLint *))
-{
-    SET_by_offset(disp, _gloffset_RasterPos3iv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_RasterPos3s) (GLshort, GLshort, GLshort);
-
-#define CALL_RasterPos3s(disp, parameters) \
-    (* GET_RasterPos3s(disp)) parameters
-static inline _glptr_RasterPos3s
-GET_RasterPos3s(struct _glapi_table *disp)
-{
-    return (_glptr_RasterPos3s) (GET_by_offset(disp, _gloffset_RasterPos3s));
-}
-
-static inline void
-SET_RasterPos3s(struct _glapi_table *disp,
-                void (GLAPIENTRYP fn) (GLshort, GLshort, GLshort))
-{
-    SET_by_offset(disp, _gloffset_RasterPos3s, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_RasterPos3sv) (const GLshort *);
-
-#define CALL_RasterPos3sv(disp, parameters) \
-    (* GET_RasterPos3sv(disp)) parameters
-static inline _glptr_RasterPos3sv
-GET_RasterPos3sv(struct _glapi_table *disp)
-{
-    return (_glptr_RasterPos3sv) (GET_by_offset(disp, _gloffset_RasterPos3sv));
-}
-
-static inline void
-SET_RasterPos3sv(struct _glapi_table *disp,
-                 void (GLAPIENTRYP fn) (const GLshort *))
-{
-    SET_by_offset(disp, _gloffset_RasterPos3sv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_RasterPos4d) (GLdouble, GLdouble, GLdouble,
-                                               GLdouble);
-#define CALL_RasterPos4d(disp, parameters) \
-    (* GET_RasterPos4d(disp)) parameters
-static inline _glptr_RasterPos4d
-GET_RasterPos4d(struct _glapi_table *disp)
-{
-    return (_glptr_RasterPos4d) (GET_by_offset(disp, _gloffset_RasterPos4d));
-}
-
-static inline void
-SET_RasterPos4d(struct _glapi_table *disp,
-                void (GLAPIENTRYP fn) (GLdouble, GLdouble, GLdouble, GLdouble))
-{
-    SET_by_offset(disp, _gloffset_RasterPos4d, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_RasterPos4dv) (const GLdouble *);
-
-#define CALL_RasterPos4dv(disp, parameters) \
-    (* GET_RasterPos4dv(disp)) parameters
-static inline _glptr_RasterPos4dv
-GET_RasterPos4dv(struct _glapi_table *disp)
-{
-    return (_glptr_RasterPos4dv) (GET_by_offset(disp, _gloffset_RasterPos4dv));
-}
-
-static inline void
-SET_RasterPos4dv(struct _glapi_table *disp,
-                 void (GLAPIENTRYP fn) (const GLdouble *))
-{
-    SET_by_offset(disp, _gloffset_RasterPos4dv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_RasterPos4f) (GLfloat, GLfloat, GLfloat,
-                                               GLfloat);
-#define CALL_RasterPos4f(disp, parameters) \
-    (* GET_RasterPos4f(disp)) parameters
-static inline _glptr_RasterPos4f
-GET_RasterPos4f(struct _glapi_table *disp)
-{
-    return (_glptr_RasterPos4f) (GET_by_offset(disp, _gloffset_RasterPos4f));
-}
-
-static inline void
-SET_RasterPos4f(struct _glapi_table *disp,
-                void (GLAPIENTRYP fn) (GLfloat, GLfloat, GLfloat, GLfloat))
-{
-    SET_by_offset(disp, _gloffset_RasterPos4f, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_RasterPos4fv) (const GLfloat *);
-
-#define CALL_RasterPos4fv(disp, parameters) \
-    (* GET_RasterPos4fv(disp)) parameters
-static inline _glptr_RasterPos4fv
-GET_RasterPos4fv(struct _glapi_table *disp)
-{
-    return (_glptr_RasterPos4fv) (GET_by_offset(disp, _gloffset_RasterPos4fv));
-}
-
-static inline void
-SET_RasterPos4fv(struct _glapi_table *disp,
-                 void (GLAPIENTRYP fn) (const GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_RasterPos4fv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_RasterPos4i) (GLint, GLint, GLint, GLint);
-
-#define CALL_RasterPos4i(disp, parameters) \
-    (* GET_RasterPos4i(disp)) parameters
-static inline _glptr_RasterPos4i
-GET_RasterPos4i(struct _glapi_table *disp)
-{
-    return (_glptr_RasterPos4i) (GET_by_offset(disp, _gloffset_RasterPos4i));
-}
-
-static inline void
-SET_RasterPos4i(struct _glapi_table *disp,
-                void (GLAPIENTRYP fn) (GLint, GLint, GLint, GLint))
-{
-    SET_by_offset(disp, _gloffset_RasterPos4i, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_RasterPos4iv) (const GLint *);
-
-#define CALL_RasterPos4iv(disp, parameters) \
-    (* GET_RasterPos4iv(disp)) parameters
-static inline _glptr_RasterPos4iv
-GET_RasterPos4iv(struct _glapi_table *disp)
-{
-    return (_glptr_RasterPos4iv) (GET_by_offset(disp, _gloffset_RasterPos4iv));
-}
-
-static inline void
-SET_RasterPos4iv(struct _glapi_table *disp,
-                 void (GLAPIENTRYP fn) (const GLint *))
-{
-    SET_by_offset(disp, _gloffset_RasterPos4iv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_RasterPos4s) (GLshort, GLshort, GLshort,
-                                               GLshort);
-#define CALL_RasterPos4s(disp, parameters) \
-    (* GET_RasterPos4s(disp)) parameters
-static inline _glptr_RasterPos4s
-GET_RasterPos4s(struct _glapi_table *disp)
-{
-    return (_glptr_RasterPos4s) (GET_by_offset(disp, _gloffset_RasterPos4s));
-}
-
-static inline void
-SET_RasterPos4s(struct _glapi_table *disp,
-                void (GLAPIENTRYP fn) (GLshort, GLshort, GLshort, GLshort))
-{
-    SET_by_offset(disp, _gloffset_RasterPos4s, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_RasterPos4sv) (const GLshort *);
-
-#define CALL_RasterPos4sv(disp, parameters) \
-    (* GET_RasterPos4sv(disp)) parameters
-static inline _glptr_RasterPos4sv
-GET_RasterPos4sv(struct _glapi_table *disp)
-{
-    return (_glptr_RasterPos4sv) (GET_by_offset(disp, _gloffset_RasterPos4sv));
-}
-
-static inline void
-SET_RasterPos4sv(struct _glapi_table *disp,
-                 void (GLAPIENTRYP fn) (const GLshort *))
-{
-    SET_by_offset(disp, _gloffset_RasterPos4sv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Rectd) (GLdouble, GLdouble, GLdouble,
-                                         GLdouble);
-#define CALL_Rectd(disp, parameters) \
-    (* GET_Rectd(disp)) parameters
-static inline _glptr_Rectd
-GET_Rectd(struct _glapi_table *disp)
-{
-    return (_glptr_Rectd) (GET_by_offset(disp, _gloffset_Rectd));
-}
-
-static inline void
-SET_Rectd(struct _glapi_table *disp,
-          void (GLAPIENTRYP fn) (GLdouble, GLdouble, GLdouble, GLdouble))
-{
-    SET_by_offset(disp, _gloffset_Rectd, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Rectdv) (const GLdouble *, const GLdouble *);
-
-#define CALL_Rectdv(disp, parameters) \
-    (* GET_Rectdv(disp)) parameters
-static inline _glptr_Rectdv
-GET_Rectdv(struct _glapi_table *disp)
-{
-    return (_glptr_Rectdv) (GET_by_offset(disp, _gloffset_Rectdv));
-}
-
-static inline void
-SET_Rectdv(struct _glapi_table *disp,
-           void (GLAPIENTRYP fn) (const GLdouble *, const GLdouble *))
-{
-    SET_by_offset(disp, _gloffset_Rectdv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Rectf) (GLfloat, GLfloat, GLfloat, GLfloat);
-
-#define CALL_Rectf(disp, parameters) \
-    (* GET_Rectf(disp)) parameters
-static inline _glptr_Rectf
-GET_Rectf(struct _glapi_table *disp)
-{
-    return (_glptr_Rectf) (GET_by_offset(disp, _gloffset_Rectf));
-}
-
-static inline void
-SET_Rectf(struct _glapi_table *disp,
-          void (GLAPIENTRYP fn) (GLfloat, GLfloat, GLfloat, GLfloat))
-{
-    SET_by_offset(disp, _gloffset_Rectf, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Rectfv) (const GLfloat *, const GLfloat *);
-
-#define CALL_Rectfv(disp, parameters) \
-    (* GET_Rectfv(disp)) parameters
-static inline _glptr_Rectfv
-GET_Rectfv(struct _glapi_table *disp)
-{
-    return (_glptr_Rectfv) (GET_by_offset(disp, _gloffset_Rectfv));
-}
-
-static inline void
-SET_Rectfv(struct _glapi_table *disp,
-           void (GLAPIENTRYP fn) (const GLfloat *, const GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_Rectfv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Recti) (GLint, GLint, GLint, GLint);
-
-#define CALL_Recti(disp, parameters) \
-    (* GET_Recti(disp)) parameters
-static inline _glptr_Recti
-GET_Recti(struct _glapi_table *disp)
-{
-    return (_glptr_Recti) (GET_by_offset(disp, _gloffset_Recti));
-}
-
-static inline void
-SET_Recti(struct _glapi_table *disp,
-          void (GLAPIENTRYP fn) (GLint, GLint, GLint, GLint))
-{
-    SET_by_offset(disp, _gloffset_Recti, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Rectiv) (const GLint *, const GLint *);
-
-#define CALL_Rectiv(disp, parameters) \
-    (* GET_Rectiv(disp)) parameters
-static inline _glptr_Rectiv
-GET_Rectiv(struct _glapi_table *disp)
-{
-    return (_glptr_Rectiv) (GET_by_offset(disp, _gloffset_Rectiv));
-}
-
-static inline void
-SET_Rectiv(struct _glapi_table *disp,
-           void (GLAPIENTRYP fn) (const GLint *, const GLint *))
-{
-    SET_by_offset(disp, _gloffset_Rectiv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Rects) (GLshort, GLshort, GLshort, GLshort);
-
-#define CALL_Rects(disp, parameters) \
-    (* GET_Rects(disp)) parameters
-static inline _glptr_Rects
-GET_Rects(struct _glapi_table *disp)
-{
-    return (_glptr_Rects) (GET_by_offset(disp, _gloffset_Rects));
-}
-
-static inline void
-SET_Rects(struct _glapi_table *disp,
-          void (GLAPIENTRYP fn) (GLshort, GLshort, GLshort, GLshort))
-{
-    SET_by_offset(disp, _gloffset_Rects, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Rectsv) (const GLshort *, const GLshort *);
-
-#define CALL_Rectsv(disp, parameters) \
-    (* GET_Rectsv(disp)) parameters
-static inline _glptr_Rectsv
-GET_Rectsv(struct _glapi_table *disp)
-{
-    return (_glptr_Rectsv) (GET_by_offset(disp, _gloffset_Rectsv));
-}
-
-static inline void
-SET_Rectsv(struct _glapi_table *disp,
-           void (GLAPIENTRYP fn) (const GLshort *, const GLshort *))
-{
-    SET_by_offset(disp, _gloffset_Rectsv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoord1d) (GLdouble);
-
-#define CALL_TexCoord1d(disp, parameters) \
-    (* GET_TexCoord1d(disp)) parameters
-static inline _glptr_TexCoord1d
-GET_TexCoord1d(struct _glapi_table *disp)
-{
-    return (_glptr_TexCoord1d) (GET_by_offset(disp, _gloffset_TexCoord1d));
-}
-
-static inline void
-SET_TexCoord1d(struct _glapi_table *disp, void (GLAPIENTRYP fn) (GLdouble))
-{
-    SET_by_offset(disp, _gloffset_TexCoord1d, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoord1dv) (const GLdouble *);
-
-#define CALL_TexCoord1dv(disp, parameters) \
-    (* GET_TexCoord1dv(disp)) parameters
-static inline _glptr_TexCoord1dv
-GET_TexCoord1dv(struct _glapi_table *disp)
-{
-    return (_glptr_TexCoord1dv) (GET_by_offset(disp, _gloffset_TexCoord1dv));
-}
-
-static inline void
-SET_TexCoord1dv(struct _glapi_table *disp,
-                void (GLAPIENTRYP fn) (const GLdouble *))
-{
-    SET_by_offset(disp, _gloffset_TexCoord1dv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoord1f) (GLfloat);
-
-#define CALL_TexCoord1f(disp, parameters) \
-    (* GET_TexCoord1f(disp)) parameters
-static inline _glptr_TexCoord1f
-GET_TexCoord1f(struct _glapi_table *disp)
-{
-    return (_glptr_TexCoord1f) (GET_by_offset(disp, _gloffset_TexCoord1f));
-}
-
-static inline void
-SET_TexCoord1f(struct _glapi_table *disp, void (GLAPIENTRYP fn) (GLfloat))
-{
-    SET_by_offset(disp, _gloffset_TexCoord1f, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoord1fv) (const GLfloat *);
-
-#define CALL_TexCoord1fv(disp, parameters) \
-    (* GET_TexCoord1fv(disp)) parameters
-static inline _glptr_TexCoord1fv
-GET_TexCoord1fv(struct _glapi_table *disp)
-{
-    return (_glptr_TexCoord1fv) (GET_by_offset(disp, _gloffset_TexCoord1fv));
-}
-
-static inline void
-SET_TexCoord1fv(struct _glapi_table *disp,
-                void (GLAPIENTRYP fn) (const GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_TexCoord1fv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoord1i) (GLint);
-
-#define CALL_TexCoord1i(disp, parameters) \
-    (* GET_TexCoord1i(disp)) parameters
-static inline _glptr_TexCoord1i
-GET_TexCoord1i(struct _glapi_table *disp)
-{
-    return (_glptr_TexCoord1i) (GET_by_offset(disp, _gloffset_TexCoord1i));
-}
-
-static inline void
-SET_TexCoord1i(struct _glapi_table *disp, void (GLAPIENTRYP fn) (GLint))
-{
-    SET_by_offset(disp, _gloffset_TexCoord1i, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoord1iv) (const GLint *);
-
-#define CALL_TexCoord1iv(disp, parameters) \
-    (* GET_TexCoord1iv(disp)) parameters
-static inline _glptr_TexCoord1iv
-GET_TexCoord1iv(struct _glapi_table *disp)
-{
-    return (_glptr_TexCoord1iv) (GET_by_offset(disp, _gloffset_TexCoord1iv));
-}
-
-static inline void
-SET_TexCoord1iv(struct _glapi_table *disp,
-                void (GLAPIENTRYP fn) (const GLint *))
-{
-    SET_by_offset(disp, _gloffset_TexCoord1iv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoord1s) (GLshort);
-
-#define CALL_TexCoord1s(disp, parameters) \
-    (* GET_TexCoord1s(disp)) parameters
-static inline _glptr_TexCoord1s
-GET_TexCoord1s(struct _glapi_table *disp)
-{
-    return (_glptr_TexCoord1s) (GET_by_offset(disp, _gloffset_TexCoord1s));
-}
-
-static inline void
-SET_TexCoord1s(struct _glapi_table *disp, void (GLAPIENTRYP fn) (GLshort))
-{
-    SET_by_offset(disp, _gloffset_TexCoord1s, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoord1sv) (const GLshort *);
-
-#define CALL_TexCoord1sv(disp, parameters) \
-    (* GET_TexCoord1sv(disp)) parameters
-static inline _glptr_TexCoord1sv
-GET_TexCoord1sv(struct _glapi_table *disp)
-{
-    return (_glptr_TexCoord1sv) (GET_by_offset(disp, _gloffset_TexCoord1sv));
-}
-
-static inline void
-SET_TexCoord1sv(struct _glapi_table *disp,
-                void (GLAPIENTRYP fn) (const GLshort *))
-{
-    SET_by_offset(disp, _gloffset_TexCoord1sv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoord2d) (GLdouble, GLdouble);
-
-#define CALL_TexCoord2d(disp, parameters) \
-    (* GET_TexCoord2d(disp)) parameters
-static inline _glptr_TexCoord2d
-GET_TexCoord2d(struct _glapi_table *disp)
-{
-    return (_glptr_TexCoord2d) (GET_by_offset(disp, _gloffset_TexCoord2d));
-}
-
-static inline void
-SET_TexCoord2d(struct _glapi_table *disp,
-               void (GLAPIENTRYP fn) (GLdouble, GLdouble))
-{
-    SET_by_offset(disp, _gloffset_TexCoord2d, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoord2dv) (const GLdouble *);
-
-#define CALL_TexCoord2dv(disp, parameters) \
-    (* GET_TexCoord2dv(disp)) parameters
-static inline _glptr_TexCoord2dv
-GET_TexCoord2dv(struct _glapi_table *disp)
-{
-    return (_glptr_TexCoord2dv) (GET_by_offset(disp, _gloffset_TexCoord2dv));
-}
-
-static inline void
-SET_TexCoord2dv(struct _glapi_table *disp,
-                void (GLAPIENTRYP fn) (const GLdouble *))
-{
-    SET_by_offset(disp, _gloffset_TexCoord2dv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoord2f) (GLfloat, GLfloat);
-
-#define CALL_TexCoord2f(disp, parameters) \
-    (* GET_TexCoord2f(disp)) parameters
-static inline _glptr_TexCoord2f
-GET_TexCoord2f(struct _glapi_table *disp)
-{
-    return (_glptr_TexCoord2f) (GET_by_offset(disp, _gloffset_TexCoord2f));
-}
-
-static inline void
-SET_TexCoord2f(struct _glapi_table *disp,
-               void (GLAPIENTRYP fn) (GLfloat, GLfloat))
-{
-    SET_by_offset(disp, _gloffset_TexCoord2f, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoord2fv) (const GLfloat *);
-
-#define CALL_TexCoord2fv(disp, parameters) \
-    (* GET_TexCoord2fv(disp)) parameters
-static inline _glptr_TexCoord2fv
-GET_TexCoord2fv(struct _glapi_table *disp)
-{
-    return (_glptr_TexCoord2fv) (GET_by_offset(disp, _gloffset_TexCoord2fv));
-}
-
-static inline void
-SET_TexCoord2fv(struct _glapi_table *disp,
-                void (GLAPIENTRYP fn) (const GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_TexCoord2fv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoord2i) (GLint, GLint);
-
-#define CALL_TexCoord2i(disp, parameters) \
-    (* GET_TexCoord2i(disp)) parameters
-static inline _glptr_TexCoord2i
-GET_TexCoord2i(struct _glapi_table *disp)
-{
-    return (_glptr_TexCoord2i) (GET_by_offset(disp, _gloffset_TexCoord2i));
-}
-
-static inline void
-SET_TexCoord2i(struct _glapi_table *disp, void (GLAPIENTRYP fn) (GLint, GLint))
-{
-    SET_by_offset(disp, _gloffset_TexCoord2i, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoord2iv) (const GLint *);
-
-#define CALL_TexCoord2iv(disp, parameters) \
-    (* GET_TexCoord2iv(disp)) parameters
-static inline _glptr_TexCoord2iv
-GET_TexCoord2iv(struct _glapi_table *disp)
-{
-    return (_glptr_TexCoord2iv) (GET_by_offset(disp, _gloffset_TexCoord2iv));
-}
-
-static inline void
-SET_TexCoord2iv(struct _glapi_table *disp,
-                void (GLAPIENTRYP fn) (const GLint *))
-{
-    SET_by_offset(disp, _gloffset_TexCoord2iv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoord2s) (GLshort, GLshort);
-
-#define CALL_TexCoord2s(disp, parameters) \
-    (* GET_TexCoord2s(disp)) parameters
-static inline _glptr_TexCoord2s
-GET_TexCoord2s(struct _glapi_table *disp)
-{
-    return (_glptr_TexCoord2s) (GET_by_offset(disp, _gloffset_TexCoord2s));
-}
-
-static inline void
-SET_TexCoord2s(struct _glapi_table *disp,
-               void (GLAPIENTRYP fn) (GLshort, GLshort))
-{
-    SET_by_offset(disp, _gloffset_TexCoord2s, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoord2sv) (const GLshort *);
-
-#define CALL_TexCoord2sv(disp, parameters) \
-    (* GET_TexCoord2sv(disp)) parameters
-static inline _glptr_TexCoord2sv
-GET_TexCoord2sv(struct _glapi_table *disp)
-{
-    return (_glptr_TexCoord2sv) (GET_by_offset(disp, _gloffset_TexCoord2sv));
-}
-
-static inline void
-SET_TexCoord2sv(struct _glapi_table *disp,
-                void (GLAPIENTRYP fn) (const GLshort *))
-{
-    SET_by_offset(disp, _gloffset_TexCoord2sv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoord3d) (GLdouble, GLdouble, GLdouble);
-
-#define CALL_TexCoord3d(disp, parameters) \
-    (* GET_TexCoord3d(disp)) parameters
-static inline _glptr_TexCoord3d
-GET_TexCoord3d(struct _glapi_table *disp)
-{
-    return (_glptr_TexCoord3d) (GET_by_offset(disp, _gloffset_TexCoord3d));
-}
-
-static inline void
-SET_TexCoord3d(struct _glapi_table *disp,
-               void (GLAPIENTRYP fn) (GLdouble, GLdouble, GLdouble))
-{
-    SET_by_offset(disp, _gloffset_TexCoord3d, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoord3dv) (const GLdouble *);
-
-#define CALL_TexCoord3dv(disp, parameters) \
-    (* GET_TexCoord3dv(disp)) parameters
-static inline _glptr_TexCoord3dv
-GET_TexCoord3dv(struct _glapi_table *disp)
-{
-    return (_glptr_TexCoord3dv) (GET_by_offset(disp, _gloffset_TexCoord3dv));
-}
-
-static inline void
-SET_TexCoord3dv(struct _glapi_table *disp,
-                void (GLAPIENTRYP fn) (const GLdouble *))
-{
-    SET_by_offset(disp, _gloffset_TexCoord3dv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoord3f) (GLfloat, GLfloat, GLfloat);
-
-#define CALL_TexCoord3f(disp, parameters) \
-    (* GET_TexCoord3f(disp)) parameters
-static inline _glptr_TexCoord3f
-GET_TexCoord3f(struct _glapi_table *disp)
-{
-    return (_glptr_TexCoord3f) (GET_by_offset(disp, _gloffset_TexCoord3f));
-}
-
-static inline void
-SET_TexCoord3f(struct _glapi_table *disp,
-               void (GLAPIENTRYP fn) (GLfloat, GLfloat, GLfloat))
-{
-    SET_by_offset(disp, _gloffset_TexCoord3f, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoord3fv) (const GLfloat *);
-
-#define CALL_TexCoord3fv(disp, parameters) \
-    (* GET_TexCoord3fv(disp)) parameters
-static inline _glptr_TexCoord3fv
-GET_TexCoord3fv(struct _glapi_table *disp)
-{
-    return (_glptr_TexCoord3fv) (GET_by_offset(disp, _gloffset_TexCoord3fv));
-}
-
-static inline void
-SET_TexCoord3fv(struct _glapi_table *disp,
-                void (GLAPIENTRYP fn) (const GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_TexCoord3fv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoord3i) (GLint, GLint, GLint);
-
-#define CALL_TexCoord3i(disp, parameters) \
-    (* GET_TexCoord3i(disp)) parameters
-static inline _glptr_TexCoord3i
-GET_TexCoord3i(struct _glapi_table *disp)
-{
-    return (_glptr_TexCoord3i) (GET_by_offset(disp, _gloffset_TexCoord3i));
-}
-
-static inline void
-SET_TexCoord3i(struct _glapi_table *disp,
-               void (GLAPIENTRYP fn) (GLint, GLint, GLint))
-{
-    SET_by_offset(disp, _gloffset_TexCoord3i, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoord3iv) (const GLint *);
-
-#define CALL_TexCoord3iv(disp, parameters) \
-    (* GET_TexCoord3iv(disp)) parameters
-static inline _glptr_TexCoord3iv
-GET_TexCoord3iv(struct _glapi_table *disp)
-{
-    return (_glptr_TexCoord3iv) (GET_by_offset(disp, _gloffset_TexCoord3iv));
-}
-
-static inline void
-SET_TexCoord3iv(struct _glapi_table *disp,
-                void (GLAPIENTRYP fn) (const GLint *))
-{
-    SET_by_offset(disp, _gloffset_TexCoord3iv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoord3s) (GLshort, GLshort, GLshort);
-
-#define CALL_TexCoord3s(disp, parameters) \
-    (* GET_TexCoord3s(disp)) parameters
-static inline _glptr_TexCoord3s
-GET_TexCoord3s(struct _glapi_table *disp)
-{
-    return (_glptr_TexCoord3s) (GET_by_offset(disp, _gloffset_TexCoord3s));
-}
-
-static inline void
-SET_TexCoord3s(struct _glapi_table *disp,
-               void (GLAPIENTRYP fn) (GLshort, GLshort, GLshort))
-{
-    SET_by_offset(disp, _gloffset_TexCoord3s, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoord3sv) (const GLshort *);
-
-#define CALL_TexCoord3sv(disp, parameters) \
-    (* GET_TexCoord3sv(disp)) parameters
-static inline _glptr_TexCoord3sv
-GET_TexCoord3sv(struct _glapi_table *disp)
-{
-    return (_glptr_TexCoord3sv) (GET_by_offset(disp, _gloffset_TexCoord3sv));
-}
-
-static inline void
-SET_TexCoord3sv(struct _glapi_table *disp,
-                void (GLAPIENTRYP fn) (const GLshort *))
-{
-    SET_by_offset(disp, _gloffset_TexCoord3sv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoord4d) (GLdouble, GLdouble, GLdouble,
-                                              GLdouble);
-#define CALL_TexCoord4d(disp, parameters) \
-    (* GET_TexCoord4d(disp)) parameters
-static inline _glptr_TexCoord4d
-GET_TexCoord4d(struct _glapi_table *disp)
-{
-    return (_glptr_TexCoord4d) (GET_by_offset(disp, _gloffset_TexCoord4d));
-}
-
-static inline void
-SET_TexCoord4d(struct _glapi_table *disp,
-               void (GLAPIENTRYP fn) (GLdouble, GLdouble, GLdouble, GLdouble))
-{
-    SET_by_offset(disp, _gloffset_TexCoord4d, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoord4dv) (const GLdouble *);
-
-#define CALL_TexCoord4dv(disp, parameters) \
-    (* GET_TexCoord4dv(disp)) parameters
-static inline _glptr_TexCoord4dv
-GET_TexCoord4dv(struct _glapi_table *disp)
-{
-    return (_glptr_TexCoord4dv) (GET_by_offset(disp, _gloffset_TexCoord4dv));
-}
-
-static inline void
-SET_TexCoord4dv(struct _glapi_table *disp,
-                void (GLAPIENTRYP fn) (const GLdouble *))
-{
-    SET_by_offset(disp, _gloffset_TexCoord4dv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoord4f) (GLfloat, GLfloat, GLfloat,
-                                              GLfloat);
-#define CALL_TexCoord4f(disp, parameters) \
-    (* GET_TexCoord4f(disp)) parameters
-static inline _glptr_TexCoord4f
-GET_TexCoord4f(struct _glapi_table *disp)
-{
-    return (_glptr_TexCoord4f) (GET_by_offset(disp, _gloffset_TexCoord4f));
-}
-
-static inline void
-SET_TexCoord4f(struct _glapi_table *disp,
-               void (GLAPIENTRYP fn) (GLfloat, GLfloat, GLfloat, GLfloat))
-{
-    SET_by_offset(disp, _gloffset_TexCoord4f, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoord4fv) (const GLfloat *);
-
-#define CALL_TexCoord4fv(disp, parameters) \
-    (* GET_TexCoord4fv(disp)) parameters
-static inline _glptr_TexCoord4fv
-GET_TexCoord4fv(struct _glapi_table *disp)
-{
-    return (_glptr_TexCoord4fv) (GET_by_offset(disp, _gloffset_TexCoord4fv));
-}
-
-static inline void
-SET_TexCoord4fv(struct _glapi_table *disp,
-                void (GLAPIENTRYP fn) (const GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_TexCoord4fv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoord4i) (GLint, GLint, GLint, GLint);
-
-#define CALL_TexCoord4i(disp, parameters) \
-    (* GET_TexCoord4i(disp)) parameters
-static inline _glptr_TexCoord4i
-GET_TexCoord4i(struct _glapi_table *disp)
-{
-    return (_glptr_TexCoord4i) (GET_by_offset(disp, _gloffset_TexCoord4i));
-}
-
-static inline void
-SET_TexCoord4i(struct _glapi_table *disp,
-               void (GLAPIENTRYP fn) (GLint, GLint, GLint, GLint))
-{
-    SET_by_offset(disp, _gloffset_TexCoord4i, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoord4iv) (const GLint *);
-
-#define CALL_TexCoord4iv(disp, parameters) \
-    (* GET_TexCoord4iv(disp)) parameters
-static inline _glptr_TexCoord4iv
-GET_TexCoord4iv(struct _glapi_table *disp)
-{
-    return (_glptr_TexCoord4iv) (GET_by_offset(disp, _gloffset_TexCoord4iv));
-}
-
-static inline void
-SET_TexCoord4iv(struct _glapi_table *disp,
-                void (GLAPIENTRYP fn) (const GLint *))
-{
-    SET_by_offset(disp, _gloffset_TexCoord4iv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoord4s) (GLshort, GLshort, GLshort,
-                                              GLshort);
-#define CALL_TexCoord4s(disp, parameters) \
-    (* GET_TexCoord4s(disp)) parameters
-static inline _glptr_TexCoord4s
-GET_TexCoord4s(struct _glapi_table *disp)
-{
-    return (_glptr_TexCoord4s) (GET_by_offset(disp, _gloffset_TexCoord4s));
-}
-
-static inline void
-SET_TexCoord4s(struct _glapi_table *disp,
-               void (GLAPIENTRYP fn) (GLshort, GLshort, GLshort, GLshort))
-{
-    SET_by_offset(disp, _gloffset_TexCoord4s, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoord4sv) (const GLshort *);
-
-#define CALL_TexCoord4sv(disp, parameters) \
-    (* GET_TexCoord4sv(disp)) parameters
-static inline _glptr_TexCoord4sv
-GET_TexCoord4sv(struct _glapi_table *disp)
-{
-    return (_glptr_TexCoord4sv) (GET_by_offset(disp, _gloffset_TexCoord4sv));
-}
-
-static inline void
-SET_TexCoord4sv(struct _glapi_table *disp,
-                void (GLAPIENTRYP fn) (const GLshort *))
-{
-    SET_by_offset(disp, _gloffset_TexCoord4sv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Vertex2d) (GLdouble, GLdouble);
-
-#define CALL_Vertex2d(disp, parameters) \
-    (* GET_Vertex2d(disp)) parameters
-static inline _glptr_Vertex2d
-GET_Vertex2d(struct _glapi_table *disp)
-{
-    return (_glptr_Vertex2d) (GET_by_offset(disp, _gloffset_Vertex2d));
-}
-
-static inline void
-SET_Vertex2d(struct _glapi_table *disp,
-             void (GLAPIENTRYP fn) (GLdouble, GLdouble))
-{
-    SET_by_offset(disp, _gloffset_Vertex2d, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Vertex2dv) (const GLdouble *);
-
-#define CALL_Vertex2dv(disp, parameters) \
-    (* GET_Vertex2dv(disp)) parameters
-static inline _glptr_Vertex2dv
-GET_Vertex2dv(struct _glapi_table *disp)
-{
-    return (_glptr_Vertex2dv) (GET_by_offset(disp, _gloffset_Vertex2dv));
-}
-
-static inline void
-SET_Vertex2dv(struct _glapi_table *disp,
-              void (GLAPIENTRYP fn) (const GLdouble *))
-{
-    SET_by_offset(disp, _gloffset_Vertex2dv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Vertex2f) (GLfloat, GLfloat);
-
-#define CALL_Vertex2f(disp, parameters) \
-    (* GET_Vertex2f(disp)) parameters
-static inline _glptr_Vertex2f
-GET_Vertex2f(struct _glapi_table *disp)
-{
-    return (_glptr_Vertex2f) (GET_by_offset(disp, _gloffset_Vertex2f));
-}
-
-static inline void
-SET_Vertex2f(struct _glapi_table *disp,
-             void (GLAPIENTRYP fn) (GLfloat, GLfloat))
-{
-    SET_by_offset(disp, _gloffset_Vertex2f, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Vertex2fv) (const GLfloat *);
-
-#define CALL_Vertex2fv(disp, parameters) \
-    (* GET_Vertex2fv(disp)) parameters
-static inline _glptr_Vertex2fv
-GET_Vertex2fv(struct _glapi_table *disp)
-{
-    return (_glptr_Vertex2fv) (GET_by_offset(disp, _gloffset_Vertex2fv));
-}
-
-static inline void
-SET_Vertex2fv(struct _glapi_table *disp,
-              void (GLAPIENTRYP fn) (const GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_Vertex2fv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Vertex2i) (GLint, GLint);
-
-#define CALL_Vertex2i(disp, parameters) \
-    (* GET_Vertex2i(disp)) parameters
-static inline _glptr_Vertex2i
-GET_Vertex2i(struct _glapi_table *disp)
-{
-    return (_glptr_Vertex2i) (GET_by_offset(disp, _gloffset_Vertex2i));
-}
-
-static inline void
-SET_Vertex2i(struct _glapi_table *disp, void (GLAPIENTRYP fn) (GLint, GLint))
-{
-    SET_by_offset(disp, _gloffset_Vertex2i, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Vertex2iv) (const GLint *);
-
-#define CALL_Vertex2iv(disp, parameters) \
-    (* GET_Vertex2iv(disp)) parameters
-static inline _glptr_Vertex2iv
-GET_Vertex2iv(struct _glapi_table *disp)
-{
-    return (_glptr_Vertex2iv) (GET_by_offset(disp, _gloffset_Vertex2iv));
-}
-
-static inline void
-SET_Vertex2iv(struct _glapi_table *disp, void (GLAPIENTRYP fn) (const GLint *))
-{
-    SET_by_offset(disp, _gloffset_Vertex2iv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Vertex2s) (GLshort, GLshort);
-
-#define CALL_Vertex2s(disp, parameters) \
-    (* GET_Vertex2s(disp)) parameters
-static inline _glptr_Vertex2s
-GET_Vertex2s(struct _glapi_table *disp)
-{
-    return (_glptr_Vertex2s) (GET_by_offset(disp, _gloffset_Vertex2s));
-}
-
-static inline void
-SET_Vertex2s(struct _glapi_table *disp,
-             void (GLAPIENTRYP fn) (GLshort, GLshort))
-{
-    SET_by_offset(disp, _gloffset_Vertex2s, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Vertex2sv) (const GLshort *);
-
-#define CALL_Vertex2sv(disp, parameters) \
-    (* GET_Vertex2sv(disp)) parameters
-static inline _glptr_Vertex2sv
-GET_Vertex2sv(struct _glapi_table *disp)
-{
-    return (_glptr_Vertex2sv) (GET_by_offset(disp, _gloffset_Vertex2sv));
-}
-
-static inline void
-SET_Vertex2sv(struct _glapi_table *disp,
-              void (GLAPIENTRYP fn) (const GLshort *))
-{
-    SET_by_offset(disp, _gloffset_Vertex2sv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Vertex3d) (GLdouble, GLdouble, GLdouble);
-
-#define CALL_Vertex3d(disp, parameters) \
-    (* GET_Vertex3d(disp)) parameters
-static inline _glptr_Vertex3d
-GET_Vertex3d(struct _glapi_table *disp)
-{
-    return (_glptr_Vertex3d) (GET_by_offset(disp, _gloffset_Vertex3d));
-}
-
-static inline void
-SET_Vertex3d(struct _glapi_table *disp,
-             void (GLAPIENTRYP fn) (GLdouble, GLdouble, GLdouble))
-{
-    SET_by_offset(disp, _gloffset_Vertex3d, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Vertex3dv) (const GLdouble *);
-
-#define CALL_Vertex3dv(disp, parameters) \
-    (* GET_Vertex3dv(disp)) parameters
-static inline _glptr_Vertex3dv
-GET_Vertex3dv(struct _glapi_table *disp)
-{
-    return (_glptr_Vertex3dv) (GET_by_offset(disp, _gloffset_Vertex3dv));
-}
-
-static inline void
-SET_Vertex3dv(struct _glapi_table *disp,
-              void (GLAPIENTRYP fn) (const GLdouble *))
-{
-    SET_by_offset(disp, _gloffset_Vertex3dv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Vertex3f) (GLfloat, GLfloat, GLfloat);
-
-#define CALL_Vertex3f(disp, parameters) \
-    (* GET_Vertex3f(disp)) parameters
-static inline _glptr_Vertex3f
-GET_Vertex3f(struct _glapi_table *disp)
-{
-    return (_glptr_Vertex3f) (GET_by_offset(disp, _gloffset_Vertex3f));
-}
-
-static inline void
-SET_Vertex3f(struct _glapi_table *disp,
-             void (GLAPIENTRYP fn) (GLfloat, GLfloat, GLfloat))
-{
-    SET_by_offset(disp, _gloffset_Vertex3f, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Vertex3fv) (const GLfloat *);
-
-#define CALL_Vertex3fv(disp, parameters) \
-    (* GET_Vertex3fv(disp)) parameters
-static inline _glptr_Vertex3fv
-GET_Vertex3fv(struct _glapi_table *disp)
-{
-    return (_glptr_Vertex3fv) (GET_by_offset(disp, _gloffset_Vertex3fv));
-}
-
-static inline void
-SET_Vertex3fv(struct _glapi_table *disp,
-              void (GLAPIENTRYP fn) (const GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_Vertex3fv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Vertex3i) (GLint, GLint, GLint);
-
-#define CALL_Vertex3i(disp, parameters) \
-    (* GET_Vertex3i(disp)) parameters
-static inline _glptr_Vertex3i
-GET_Vertex3i(struct _glapi_table *disp)
-{
-    return (_glptr_Vertex3i) (GET_by_offset(disp, _gloffset_Vertex3i));
-}
-
-static inline void
-SET_Vertex3i(struct _glapi_table *disp,
-             void (GLAPIENTRYP fn) (GLint, GLint, GLint))
-{
-    SET_by_offset(disp, _gloffset_Vertex3i, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Vertex3iv) (const GLint *);
-
-#define CALL_Vertex3iv(disp, parameters) \
-    (* GET_Vertex3iv(disp)) parameters
-static inline _glptr_Vertex3iv
-GET_Vertex3iv(struct _glapi_table *disp)
-{
-    return (_glptr_Vertex3iv) (GET_by_offset(disp, _gloffset_Vertex3iv));
-}
-
-static inline void
-SET_Vertex3iv(struct _glapi_table *disp, void (GLAPIENTRYP fn) (const GLint *))
-{
-    SET_by_offset(disp, _gloffset_Vertex3iv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Vertex3s) (GLshort, GLshort, GLshort);
-
-#define CALL_Vertex3s(disp, parameters) \
-    (* GET_Vertex3s(disp)) parameters
-static inline _glptr_Vertex3s
-GET_Vertex3s(struct _glapi_table *disp)
-{
-    return (_glptr_Vertex3s) (GET_by_offset(disp, _gloffset_Vertex3s));
-}
-
-static inline void
-SET_Vertex3s(struct _glapi_table *disp,
-             void (GLAPIENTRYP fn) (GLshort, GLshort, GLshort))
-{
-    SET_by_offset(disp, _gloffset_Vertex3s, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Vertex3sv) (const GLshort *);
-
-#define CALL_Vertex3sv(disp, parameters) \
-    (* GET_Vertex3sv(disp)) parameters
-static inline _glptr_Vertex3sv
-GET_Vertex3sv(struct _glapi_table *disp)
-{
-    return (_glptr_Vertex3sv) (GET_by_offset(disp, _gloffset_Vertex3sv));
-}
-
-static inline void
-SET_Vertex3sv(struct _glapi_table *disp,
-              void (GLAPIENTRYP fn) (const GLshort *))
-{
-    SET_by_offset(disp, _gloffset_Vertex3sv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Vertex4d) (GLdouble, GLdouble, GLdouble,
-                                            GLdouble);
-#define CALL_Vertex4d(disp, parameters) \
-    (* GET_Vertex4d(disp)) parameters
-static inline _glptr_Vertex4d
-GET_Vertex4d(struct _glapi_table *disp)
-{
-    return (_glptr_Vertex4d) (GET_by_offset(disp, _gloffset_Vertex4d));
-}
-
-static inline void
-SET_Vertex4d(struct _glapi_table *disp,
-             void (GLAPIENTRYP fn) (GLdouble, GLdouble, GLdouble, GLdouble))
-{
-    SET_by_offset(disp, _gloffset_Vertex4d, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Vertex4dv) (const GLdouble *);
-
-#define CALL_Vertex4dv(disp, parameters) \
-    (* GET_Vertex4dv(disp)) parameters
-static inline _glptr_Vertex4dv
-GET_Vertex4dv(struct _glapi_table *disp)
-{
-    return (_glptr_Vertex4dv) (GET_by_offset(disp, _gloffset_Vertex4dv));
-}
-
-static inline void
-SET_Vertex4dv(struct _glapi_table *disp,
-              void (GLAPIENTRYP fn) (const GLdouble *))
-{
-    SET_by_offset(disp, _gloffset_Vertex4dv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Vertex4f) (GLfloat, GLfloat, GLfloat, GLfloat);
-
-#define CALL_Vertex4f(disp, parameters) \
-    (* GET_Vertex4f(disp)) parameters
-static inline _glptr_Vertex4f
-GET_Vertex4f(struct _glapi_table *disp)
-{
-    return (_glptr_Vertex4f) (GET_by_offset(disp, _gloffset_Vertex4f));
-}
-
-static inline void
-SET_Vertex4f(struct _glapi_table *disp,
-             void (GLAPIENTRYP fn) (GLfloat, GLfloat, GLfloat, GLfloat))
-{
-    SET_by_offset(disp, _gloffset_Vertex4f, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Vertex4fv) (const GLfloat *);
-
-#define CALL_Vertex4fv(disp, parameters) \
-    (* GET_Vertex4fv(disp)) parameters
-static inline _glptr_Vertex4fv
-GET_Vertex4fv(struct _glapi_table *disp)
-{
-    return (_glptr_Vertex4fv) (GET_by_offset(disp, _gloffset_Vertex4fv));
-}
-
-static inline void
-SET_Vertex4fv(struct _glapi_table *disp,
-              void (GLAPIENTRYP fn) (const GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_Vertex4fv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Vertex4i) (GLint, GLint, GLint, GLint);
-
-#define CALL_Vertex4i(disp, parameters) \
-    (* GET_Vertex4i(disp)) parameters
-static inline _glptr_Vertex4i
-GET_Vertex4i(struct _glapi_table *disp)
-{
-    return (_glptr_Vertex4i) (GET_by_offset(disp, _gloffset_Vertex4i));
-}
-
-static inline void
-SET_Vertex4i(struct _glapi_table *disp,
-             void (GLAPIENTRYP fn) (GLint, GLint, GLint, GLint))
-{
-    SET_by_offset(disp, _gloffset_Vertex4i, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Vertex4iv) (const GLint *);
-
-#define CALL_Vertex4iv(disp, parameters) \
-    (* GET_Vertex4iv(disp)) parameters
-static inline _glptr_Vertex4iv
-GET_Vertex4iv(struct _glapi_table *disp)
-{
-    return (_glptr_Vertex4iv) (GET_by_offset(disp, _gloffset_Vertex4iv));
-}
-
-static inline void
-SET_Vertex4iv(struct _glapi_table *disp, void (GLAPIENTRYP fn) (const GLint *))
-{
-    SET_by_offset(disp, _gloffset_Vertex4iv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Vertex4s) (GLshort, GLshort, GLshort, GLshort);
-
-#define CALL_Vertex4s(disp, parameters) \
-    (* GET_Vertex4s(disp)) parameters
-static inline _glptr_Vertex4s
-GET_Vertex4s(struct _glapi_table *disp)
-{
-    return (_glptr_Vertex4s) (GET_by_offset(disp, _gloffset_Vertex4s));
-}
-
-static inline void
-SET_Vertex4s(struct _glapi_table *disp,
-             void (GLAPIENTRYP fn) (GLshort, GLshort, GLshort, GLshort))
-{
-    SET_by_offset(disp, _gloffset_Vertex4s, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Vertex4sv) (const GLshort *);
-
-#define CALL_Vertex4sv(disp, parameters) \
-    (* GET_Vertex4sv(disp)) parameters
-static inline _glptr_Vertex4sv
-GET_Vertex4sv(struct _glapi_table *disp)
-{
-    return (_glptr_Vertex4sv) (GET_by_offset(disp, _gloffset_Vertex4sv));
-}
-
-static inline void
-SET_Vertex4sv(struct _glapi_table *disp,
-              void (GLAPIENTRYP fn) (const GLshort *))
-{
-    SET_by_offset(disp, _gloffset_Vertex4sv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ClipPlane) (GLenum, const GLdouble *);
-
-#define CALL_ClipPlane(disp, parameters) \
-    (* GET_ClipPlane(disp)) parameters
-static inline _glptr_ClipPlane
-GET_ClipPlane(struct _glapi_table *disp)
-{
-    return (_glptr_ClipPlane) (GET_by_offset(disp, _gloffset_ClipPlane));
-}
-
-static inline void
-SET_ClipPlane(struct _glapi_table *disp,
-              void (GLAPIENTRYP fn) (GLenum, const GLdouble *))
-{
-    SET_by_offset(disp, _gloffset_ClipPlane, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ColorMaterial) (GLenum, GLenum);
-
-#define CALL_ColorMaterial(disp, parameters) \
-    (* GET_ColorMaterial(disp)) parameters
-static inline _glptr_ColorMaterial
-GET_ColorMaterial(struct _glapi_table *disp)
-{
-    return (_glptr_ColorMaterial) (GET_by_offset
-                                   (disp, _gloffset_ColorMaterial));
-}
-
-static inline void
-SET_ColorMaterial(struct _glapi_table *disp,
-                  void (GLAPIENTRYP fn) (GLenum, GLenum))
-{
-    SET_by_offset(disp, _gloffset_ColorMaterial, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_CullFace) (GLenum);
-
-#define CALL_CullFace(disp, parameters) \
-    (* GET_CullFace(disp)) parameters
-static inline _glptr_CullFace
-GET_CullFace(struct _glapi_table *disp)
-{
-    return (_glptr_CullFace) (GET_by_offset(disp, _gloffset_CullFace));
-}
-
-static inline void
-SET_CullFace(struct _glapi_table *disp, void (GLAPIENTRYP fn) (GLenum))
-{
-    SET_by_offset(disp, _gloffset_CullFace, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Fogf) (GLenum, GLfloat);
-
-#define CALL_Fogf(disp, parameters) \
-    (* GET_Fogf(disp)) parameters
-static inline _glptr_Fogf
-GET_Fogf(struct _glapi_table *disp)
-{
-    return (_glptr_Fogf) (GET_by_offset(disp, _gloffset_Fogf));
-}
-
-static inline void
-SET_Fogf(struct _glapi_table *disp, void (GLAPIENTRYP fn) (GLenum, GLfloat))
-{
-    SET_by_offset(disp, _gloffset_Fogf, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Fogfv) (GLenum, const GLfloat *);
-
-#define CALL_Fogfv(disp, parameters) \
-    (* GET_Fogfv(disp)) parameters
-static inline _glptr_Fogfv
-GET_Fogfv(struct _glapi_table *disp)
-{
-    return (_glptr_Fogfv) (GET_by_offset(disp, _gloffset_Fogfv));
-}
-
-static inline void
-SET_Fogfv(struct _glapi_table *disp,
-          void (GLAPIENTRYP fn) (GLenum, const GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_Fogfv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Fogi) (GLenum, GLint);
-
-#define CALL_Fogi(disp, parameters) \
-    (* GET_Fogi(disp)) parameters
-static inline _glptr_Fogi
-GET_Fogi(struct _glapi_table *disp)
-{
-    return (_glptr_Fogi) (GET_by_offset(disp, _gloffset_Fogi));
-}
-
-static inline void
-SET_Fogi(struct _glapi_table *disp, void (GLAPIENTRYP fn) (GLenum, GLint))
-{
-    SET_by_offset(disp, _gloffset_Fogi, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Fogiv) (GLenum, const GLint *);
-
-#define CALL_Fogiv(disp, parameters) \
-    (* GET_Fogiv(disp)) parameters
-static inline _glptr_Fogiv
-GET_Fogiv(struct _glapi_table *disp)
-{
-    return (_glptr_Fogiv) (GET_by_offset(disp, _gloffset_Fogiv));
-}
-
-static inline void
-SET_Fogiv(struct _glapi_table *disp,
-          void (GLAPIENTRYP fn) (GLenum, const GLint *))
-{
-    SET_by_offset(disp, _gloffset_Fogiv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_FrontFace) (GLenum);
-
-#define CALL_FrontFace(disp, parameters) \
-    (* GET_FrontFace(disp)) parameters
-static inline _glptr_FrontFace
-GET_FrontFace(struct _glapi_table *disp)
-{
-    return (_glptr_FrontFace) (GET_by_offset(disp, _gloffset_FrontFace));
-}
-
-static inline void
-SET_FrontFace(struct _glapi_table *disp, void (GLAPIENTRYP fn) (GLenum))
-{
-    SET_by_offset(disp, _gloffset_FrontFace, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Hint) (GLenum, GLenum);
-
-#define CALL_Hint(disp, parameters) \
-    (* GET_Hint(disp)) parameters
-static inline _glptr_Hint
-GET_Hint(struct _glapi_table *disp)
-{
-    return (_glptr_Hint) (GET_by_offset(disp, _gloffset_Hint));
-}
-
-static inline void
-SET_Hint(struct _glapi_table *disp, void (GLAPIENTRYP fn) (GLenum, GLenum))
-{
-    SET_by_offset(disp, _gloffset_Hint, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Lightf) (GLenum, GLenum, GLfloat);
-
-#define CALL_Lightf(disp, parameters) \
-    (* GET_Lightf(disp)) parameters
-static inline _glptr_Lightf
-GET_Lightf(struct _glapi_table *disp)
-{
-    return (_glptr_Lightf) (GET_by_offset(disp, _gloffset_Lightf));
-}
-
-static inline void
-SET_Lightf(struct _glapi_table *disp,
-           void (GLAPIENTRYP fn) (GLenum, GLenum, GLfloat))
-{
-    SET_by_offset(disp, _gloffset_Lightf, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Lightfv) (GLenum, GLenum, const GLfloat *);
-
-#define CALL_Lightfv(disp, parameters) \
-    (* GET_Lightfv(disp)) parameters
-static inline _glptr_Lightfv
-GET_Lightfv(struct _glapi_table *disp)
-{
-    return (_glptr_Lightfv) (GET_by_offset(disp, _gloffset_Lightfv));
-}
-
-static inline void
-SET_Lightfv(struct _glapi_table *disp,
-            void (GLAPIENTRYP fn) (GLenum, GLenum, const GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_Lightfv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Lighti) (GLenum, GLenum, GLint);
-
-#define CALL_Lighti(disp, parameters) \
-    (* GET_Lighti(disp)) parameters
-static inline _glptr_Lighti
-GET_Lighti(struct _glapi_table *disp)
-{
-    return (_glptr_Lighti) (GET_by_offset(disp, _gloffset_Lighti));
-}
-
-static inline void
-SET_Lighti(struct _glapi_table *disp,
-           void (GLAPIENTRYP fn) (GLenum, GLenum, GLint))
-{
-    SET_by_offset(disp, _gloffset_Lighti, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Lightiv) (GLenum, GLenum, const GLint *);
-
-#define CALL_Lightiv(disp, parameters) \
-    (* GET_Lightiv(disp)) parameters
-static inline _glptr_Lightiv
-GET_Lightiv(struct _glapi_table *disp)
-{
-    return (_glptr_Lightiv) (GET_by_offset(disp, _gloffset_Lightiv));
-}
-
-static inline void
-SET_Lightiv(struct _glapi_table *disp,
-            void (GLAPIENTRYP fn) (GLenum, GLenum, const GLint *))
-{
-    SET_by_offset(disp, _gloffset_Lightiv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_LightModelf) (GLenum, GLfloat);
-
-#define CALL_LightModelf(disp, parameters) \
-    (* GET_LightModelf(disp)) parameters
-static inline _glptr_LightModelf
-GET_LightModelf(struct _glapi_table *disp)
-{
-    return (_glptr_LightModelf) (GET_by_offset(disp, _gloffset_LightModelf));
-}
-
-static inline void
-SET_LightModelf(struct _glapi_table *disp,
-                void (GLAPIENTRYP fn) (GLenum, GLfloat))
-{
-    SET_by_offset(disp, _gloffset_LightModelf, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_LightModelfv) (GLenum, const GLfloat *);
-
-#define CALL_LightModelfv(disp, parameters) \
-    (* GET_LightModelfv(disp)) parameters
-static inline _glptr_LightModelfv
-GET_LightModelfv(struct _glapi_table *disp)
-{
-    return (_glptr_LightModelfv) (GET_by_offset(disp, _gloffset_LightModelfv));
-}
-
-static inline void
-SET_LightModelfv(struct _glapi_table *disp,
-                 void (GLAPIENTRYP fn) (GLenum, const GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_LightModelfv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_LightModeli) (GLenum, GLint);
-
-#define CALL_LightModeli(disp, parameters) \
-    (* GET_LightModeli(disp)) parameters
-static inline _glptr_LightModeli
-GET_LightModeli(struct _glapi_table *disp)
-{
-    return (_glptr_LightModeli) (GET_by_offset(disp, _gloffset_LightModeli));
-}
-
-static inline void
-SET_LightModeli(struct _glapi_table *disp,
-                void (GLAPIENTRYP fn) (GLenum, GLint))
-{
-    SET_by_offset(disp, _gloffset_LightModeli, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_LightModeliv) (GLenum, const GLint *);
-
-#define CALL_LightModeliv(disp, parameters) \
-    (* GET_LightModeliv(disp)) parameters
-static inline _glptr_LightModeliv
-GET_LightModeliv(struct _glapi_table *disp)
-{
-    return (_glptr_LightModeliv) (GET_by_offset(disp, _gloffset_LightModeliv));
-}
-
-static inline void
-SET_LightModeliv(struct _glapi_table *disp,
-                 void (GLAPIENTRYP fn) (GLenum, const GLint *))
-{
-    SET_by_offset(disp, _gloffset_LightModeliv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_LineStipple) (GLint, GLushort);
-
-#define CALL_LineStipple(disp, parameters) \
-    (* GET_LineStipple(disp)) parameters
-static inline _glptr_LineStipple
-GET_LineStipple(struct _glapi_table *disp)
-{
-    return (_glptr_LineStipple) (GET_by_offset(disp, _gloffset_LineStipple));
-}
-
-static inline void
-SET_LineStipple(struct _glapi_table *disp,
-                void (GLAPIENTRYP fn) (GLint, GLushort))
-{
-    SET_by_offset(disp, _gloffset_LineStipple, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_LineWidth) (GLfloat);
-
-#define CALL_LineWidth(disp, parameters) \
-    (* GET_LineWidth(disp)) parameters
-static inline _glptr_LineWidth
-GET_LineWidth(struct _glapi_table *disp)
-{
-    return (_glptr_LineWidth) (GET_by_offset(disp, _gloffset_LineWidth));
-}
-
-static inline void
-SET_LineWidth(struct _glapi_table *disp, void (GLAPIENTRYP fn) (GLfloat))
-{
-    SET_by_offset(disp, _gloffset_LineWidth, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Materialf) (GLenum, GLenum, GLfloat);
-
-#define CALL_Materialf(disp, parameters) \
-    (* GET_Materialf(disp)) parameters
-static inline _glptr_Materialf
-GET_Materialf(struct _glapi_table *disp)
-{
-    return (_glptr_Materialf) (GET_by_offset(disp, _gloffset_Materialf));
-}
-
-static inline void
-SET_Materialf(struct _glapi_table *disp,
-              void (GLAPIENTRYP fn) (GLenum, GLenum, GLfloat))
-{
-    SET_by_offset(disp, _gloffset_Materialf, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Materialfv) (GLenum, GLenum, const GLfloat *);
-
-#define CALL_Materialfv(disp, parameters) \
-    (* GET_Materialfv(disp)) parameters
-static inline _glptr_Materialfv
-GET_Materialfv(struct _glapi_table *disp)
-{
-    return (_glptr_Materialfv) (GET_by_offset(disp, _gloffset_Materialfv));
-}
-
-static inline void
-SET_Materialfv(struct _glapi_table *disp,
-               void (GLAPIENTRYP fn) (GLenum, GLenum, const GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_Materialfv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Materiali) (GLenum, GLenum, GLint);
-
-#define CALL_Materiali(disp, parameters) \
-    (* GET_Materiali(disp)) parameters
-static inline _glptr_Materiali
-GET_Materiali(struct _glapi_table *disp)
-{
-    return (_glptr_Materiali) (GET_by_offset(disp, _gloffset_Materiali));
-}
-
-static inline void
-SET_Materiali(struct _glapi_table *disp,
-              void (GLAPIENTRYP fn) (GLenum, GLenum, GLint))
-{
-    SET_by_offset(disp, _gloffset_Materiali, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Materialiv) (GLenum, GLenum, const GLint *);
-
-#define CALL_Materialiv(disp, parameters) \
-    (* GET_Materialiv(disp)) parameters
-static inline _glptr_Materialiv
-GET_Materialiv(struct _glapi_table *disp)
-{
-    return (_glptr_Materialiv) (GET_by_offset(disp, _gloffset_Materialiv));
-}
-
-static inline void
-SET_Materialiv(struct _glapi_table *disp,
-               void (GLAPIENTRYP fn) (GLenum, GLenum, const GLint *))
-{
-    SET_by_offset(disp, _gloffset_Materialiv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_PointSize) (GLfloat);
-
-#define CALL_PointSize(disp, parameters) \
-    (* GET_PointSize(disp)) parameters
-static inline _glptr_PointSize
-GET_PointSize(struct _glapi_table *disp)
-{
-    return (_glptr_PointSize) (GET_by_offset(disp, _gloffset_PointSize));
-}
-
-static inline void
-SET_PointSize(struct _glapi_table *disp, void (GLAPIENTRYP fn) (GLfloat))
-{
-    SET_by_offset(disp, _gloffset_PointSize, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_PolygonMode) (GLenum, GLenum);
-
-#define CALL_PolygonMode(disp, parameters) \
-    (* GET_PolygonMode(disp)) parameters
-static inline _glptr_PolygonMode
-GET_PolygonMode(struct _glapi_table *disp)
-{
-    return (_glptr_PolygonMode) (GET_by_offset(disp, _gloffset_PolygonMode));
-}
-
-static inline void
-SET_PolygonMode(struct _glapi_table *disp,
-                void (GLAPIENTRYP fn) (GLenum, GLenum))
-{
-    SET_by_offset(disp, _gloffset_PolygonMode, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_PolygonStipple) (const GLubyte *);
-
-#define CALL_PolygonStipple(disp, parameters) \
-    (* GET_PolygonStipple(disp)) parameters
-static inline _glptr_PolygonStipple
-GET_PolygonStipple(struct _glapi_table *disp)
-{
-    return (_glptr_PolygonStipple) (GET_by_offset
-                                    (disp, _gloffset_PolygonStipple));
-}
-
-static inline void
-SET_PolygonStipple(struct _glapi_table *disp,
-                   void (GLAPIENTRYP fn) (const GLubyte *))
-{
-    SET_by_offset(disp, _gloffset_PolygonStipple, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Scissor) (GLint, GLint, GLsizei, GLsizei);
-
-#define CALL_Scissor(disp, parameters) \
-    (* GET_Scissor(disp)) parameters
-static inline _glptr_Scissor
-GET_Scissor(struct _glapi_table *disp)
-{
-    return (_glptr_Scissor) (GET_by_offset(disp, _gloffset_Scissor));
-}
-
-static inline void
-SET_Scissor(struct _glapi_table *disp,
-            void (GLAPIENTRYP fn) (GLint, GLint, GLsizei, GLsizei))
-{
-    SET_by_offset(disp, _gloffset_Scissor, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ShadeModel) (GLenum);
-
-#define CALL_ShadeModel(disp, parameters) \
-    (* GET_ShadeModel(disp)) parameters
-static inline _glptr_ShadeModel
-GET_ShadeModel(struct _glapi_table *disp)
-{
-    return (_glptr_ShadeModel) (GET_by_offset(disp, _gloffset_ShadeModel));
-}
-
-static inline void
-SET_ShadeModel(struct _glapi_table *disp, void (GLAPIENTRYP fn) (GLenum))
-{
-    SET_by_offset(disp, _gloffset_ShadeModel, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexParameterf) (GLenum, GLenum, GLfloat);
-
-#define CALL_TexParameterf(disp, parameters) \
-    (* GET_TexParameterf(disp)) parameters
-static inline _glptr_TexParameterf
-GET_TexParameterf(struct _glapi_table *disp)
-{
-    return (_glptr_TexParameterf) (GET_by_offset
-                                   (disp, _gloffset_TexParameterf));
-}
-
-static inline void
-SET_TexParameterf(struct _glapi_table *disp,
-                  void (GLAPIENTRYP fn) (GLenum, GLenum, GLfloat))
-{
-    SET_by_offset(disp, _gloffset_TexParameterf, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexParameterfv) (GLenum, GLenum,
-                                                  const GLfloat *);
-#define CALL_TexParameterfv(disp, parameters) \
-    (* GET_TexParameterfv(disp)) parameters
-static inline _glptr_TexParameterfv
-GET_TexParameterfv(struct _glapi_table *disp)
-{
-    return (_glptr_TexParameterfv) (GET_by_offset
-                                    (disp, _gloffset_TexParameterfv));
-}
-
-static inline void
-SET_TexParameterfv(struct _glapi_table *disp,
-                   void (GLAPIENTRYP fn) (GLenum, GLenum, const GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_TexParameterfv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexParameteri) (GLenum, GLenum, GLint);
-
-#define CALL_TexParameteri(disp, parameters) \
-    (* GET_TexParameteri(disp)) parameters
-static inline _glptr_TexParameteri
-GET_TexParameteri(struct _glapi_table *disp)
-{
-    return (_glptr_TexParameteri) (GET_by_offset
-                                   (disp, _gloffset_TexParameteri));
-}
-
-static inline void
-SET_TexParameteri(struct _glapi_table *disp,
-                  void (GLAPIENTRYP fn) (GLenum, GLenum, GLint))
-{
-    SET_by_offset(disp, _gloffset_TexParameteri, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexParameteriv) (GLenum, GLenum,
-                                                  const GLint *);
-#define CALL_TexParameteriv(disp, parameters) \
-    (* GET_TexParameteriv(disp)) parameters
-static inline _glptr_TexParameteriv
-GET_TexParameteriv(struct _glapi_table *disp)
-{
-    return (_glptr_TexParameteriv) (GET_by_offset
-                                    (disp, _gloffset_TexParameteriv));
-}
-
-static inline void
-SET_TexParameteriv(struct _glapi_table *disp,
-                   void (GLAPIENTRYP fn) (GLenum, GLenum, const GLint *))
-{
-    SET_by_offset(disp, _gloffset_TexParameteriv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexImage1D) (GLenum, GLint, GLint, GLsizei,
-                                              GLint, GLenum, GLenum,
-                                              const GLvoid *);
-#define CALL_TexImage1D(disp, parameters) \
-    (* GET_TexImage1D(disp)) parameters
-static inline _glptr_TexImage1D
-GET_TexImage1D(struct _glapi_table *disp)
-{
-    return (_glptr_TexImage1D) (GET_by_offset(disp, _gloffset_TexImage1D));
-}
-
-static inline void
-SET_TexImage1D(struct _glapi_table *disp,
-               void (GLAPIENTRYP fn) (GLenum, GLint, GLint, GLsizei, GLint,
-                                      GLenum, GLenum, const GLvoid *))
-{
-    SET_by_offset(disp, _gloffset_TexImage1D, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexImage2D) (GLenum, GLint, GLint, GLsizei,
-                                              GLsizei, GLint, GLenum, GLenum,
-                                              const GLvoid *);
-#define CALL_TexImage2D(disp, parameters) \
-    (* GET_TexImage2D(disp)) parameters
-static inline _glptr_TexImage2D
-GET_TexImage2D(struct _glapi_table *disp)
-{
-    return (_glptr_TexImage2D) (GET_by_offset(disp, _gloffset_TexImage2D));
-}
-
-static inline void
-SET_TexImage2D(struct _glapi_table *disp,
-               void (GLAPIENTRYP fn) (GLenum, GLint, GLint, GLsizei, GLsizei,
-                                      GLint, GLenum, GLenum, const GLvoid *))
-{
-    SET_by_offset(disp, _gloffset_TexImage2D, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexEnvf) (GLenum, GLenum, GLfloat);
-
-#define CALL_TexEnvf(disp, parameters) \
-    (* GET_TexEnvf(disp)) parameters
-static inline _glptr_TexEnvf
-GET_TexEnvf(struct _glapi_table *disp)
-{
-    return (_glptr_TexEnvf) (GET_by_offset(disp, _gloffset_TexEnvf));
-}
-
-static inline void
-SET_TexEnvf(struct _glapi_table *disp,
-            void (GLAPIENTRYP fn) (GLenum, GLenum, GLfloat))
-{
-    SET_by_offset(disp, _gloffset_TexEnvf, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexEnvfv) (GLenum, GLenum, const GLfloat *);
-
-#define CALL_TexEnvfv(disp, parameters) \
-    (* GET_TexEnvfv(disp)) parameters
-static inline _glptr_TexEnvfv
-GET_TexEnvfv(struct _glapi_table *disp)
-{
-    return (_glptr_TexEnvfv) (GET_by_offset(disp, _gloffset_TexEnvfv));
-}
-
-static inline void
-SET_TexEnvfv(struct _glapi_table *disp,
-             void (GLAPIENTRYP fn) (GLenum, GLenum, const GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_TexEnvfv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexEnvi) (GLenum, GLenum, GLint);
-
-#define CALL_TexEnvi(disp, parameters) \
-    (* GET_TexEnvi(disp)) parameters
-static inline _glptr_TexEnvi
-GET_TexEnvi(struct _glapi_table *disp)
-{
-    return (_glptr_TexEnvi) (GET_by_offset(disp, _gloffset_TexEnvi));
-}
-
-static inline void
-SET_TexEnvi(struct _glapi_table *disp,
-            void (GLAPIENTRYP fn) (GLenum, GLenum, GLint))
-{
-    SET_by_offset(disp, _gloffset_TexEnvi, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexEnviv) (GLenum, GLenum, const GLint *);
-
-#define CALL_TexEnviv(disp, parameters) \
-    (* GET_TexEnviv(disp)) parameters
-static inline _glptr_TexEnviv
-GET_TexEnviv(struct _glapi_table *disp)
-{
-    return (_glptr_TexEnviv) (GET_by_offset(disp, _gloffset_TexEnviv));
-}
-
-static inline void
-SET_TexEnviv(struct _glapi_table *disp,
-             void (GLAPIENTRYP fn) (GLenum, GLenum, const GLint *))
-{
-    SET_by_offset(disp, _gloffset_TexEnviv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexGend) (GLenum, GLenum, GLdouble);
-
-#define CALL_TexGend(disp, parameters) \
-    (* GET_TexGend(disp)) parameters
-static inline _glptr_TexGend
-GET_TexGend(struct _glapi_table *disp)
-{
-    return (_glptr_TexGend) (GET_by_offset(disp, _gloffset_TexGend));
-}
-
-static inline void
-SET_TexGend(struct _glapi_table *disp,
-            void (GLAPIENTRYP fn) (GLenum, GLenum, GLdouble))
-{
-    SET_by_offset(disp, _gloffset_TexGend, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexGendv) (GLenum, GLenum, const GLdouble *);
-
-#define CALL_TexGendv(disp, parameters) \
-    (* GET_TexGendv(disp)) parameters
-static inline _glptr_TexGendv
-GET_TexGendv(struct _glapi_table *disp)
-{
-    return (_glptr_TexGendv) (GET_by_offset(disp, _gloffset_TexGendv));
-}
-
-static inline void
-SET_TexGendv(struct _glapi_table *disp,
-             void (GLAPIENTRYP fn) (GLenum, GLenum, const GLdouble *))
-{
-    SET_by_offset(disp, _gloffset_TexGendv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexGenf) (GLenum, GLenum, GLfloat);
-
-#define CALL_TexGenf(disp, parameters) \
-    (* GET_TexGenf(disp)) parameters
-static inline _glptr_TexGenf
-GET_TexGenf(struct _glapi_table *disp)
-{
-    return (_glptr_TexGenf) (GET_by_offset(disp, _gloffset_TexGenf));
-}
-
-static inline void
-SET_TexGenf(struct _glapi_table *disp,
-            void (GLAPIENTRYP fn) (GLenum, GLenum, GLfloat))
-{
-    SET_by_offset(disp, _gloffset_TexGenf, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexGenfv) (GLenum, GLenum, const GLfloat *);
-
-#define CALL_TexGenfv(disp, parameters) \
-    (* GET_TexGenfv(disp)) parameters
-static inline _glptr_TexGenfv
-GET_TexGenfv(struct _glapi_table *disp)
-{
-    return (_glptr_TexGenfv) (GET_by_offset(disp, _gloffset_TexGenfv));
-}
-
-static inline void
-SET_TexGenfv(struct _glapi_table *disp,
-             void (GLAPIENTRYP fn) (GLenum, GLenum, const GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_TexGenfv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexGeni) (GLenum, GLenum, GLint);
-
-#define CALL_TexGeni(disp, parameters) \
-    (* GET_TexGeni(disp)) parameters
-static inline _glptr_TexGeni
-GET_TexGeni(struct _glapi_table *disp)
-{
-    return (_glptr_TexGeni) (GET_by_offset(disp, _gloffset_TexGeni));
-}
-
-static inline void
-SET_TexGeni(struct _glapi_table *disp,
-            void (GLAPIENTRYP fn) (GLenum, GLenum, GLint))
-{
-    SET_by_offset(disp, _gloffset_TexGeni, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexGeniv) (GLenum, GLenum, const GLint *);
-
-#define CALL_TexGeniv(disp, parameters) \
-    (* GET_TexGeniv(disp)) parameters
-static inline _glptr_TexGeniv
-GET_TexGeniv(struct _glapi_table *disp)
-{
-    return (_glptr_TexGeniv) (GET_by_offset(disp, _gloffset_TexGeniv));
-}
-
-static inline void
-SET_TexGeniv(struct _glapi_table *disp,
-             void (GLAPIENTRYP fn) (GLenum, GLenum, const GLint *))
-{
-    SET_by_offset(disp, _gloffset_TexGeniv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_FeedbackBuffer) (GLsizei, GLenum, GLfloat *);
-
-#define CALL_FeedbackBuffer(disp, parameters) \
-    (* GET_FeedbackBuffer(disp)) parameters
-static inline _glptr_FeedbackBuffer
-GET_FeedbackBuffer(struct _glapi_table *disp)
-{
-    return (_glptr_FeedbackBuffer) (GET_by_offset
-                                    (disp, _gloffset_FeedbackBuffer));
-}
-
-static inline void
-SET_FeedbackBuffer(struct _glapi_table *disp,
-                   void (GLAPIENTRYP fn) (GLsizei, GLenum, GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_FeedbackBuffer, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_SelectBuffer) (GLsizei, GLuint *);
-
-#define CALL_SelectBuffer(disp, parameters) \
-    (* GET_SelectBuffer(disp)) parameters
-static inline _glptr_SelectBuffer
-GET_SelectBuffer(struct _glapi_table *disp)
-{
-    return (_glptr_SelectBuffer) (GET_by_offset(disp, _gloffset_SelectBuffer));
-}
-
-static inline void
-SET_SelectBuffer(struct _glapi_table *disp,
-                 void (GLAPIENTRYP fn) (GLsizei, GLuint *))
-{
-    SET_by_offset(disp, _gloffset_SelectBuffer, fn);
-}
-
-typedef GLint(GLAPIENTRYP _glptr_RenderMode) (GLenum);
-
-#define CALL_RenderMode(disp, parameters) \
-    (* GET_RenderMode(disp)) parameters
-static inline _glptr_RenderMode
-GET_RenderMode(struct _glapi_table *disp)
-{
-    return (_glptr_RenderMode) (GET_by_offset(disp, _gloffset_RenderMode));
-}
-
-static inline void
-SET_RenderMode(struct _glapi_table *disp, GLint(GLAPIENTRYP fn) (GLenum))
-{
-    SET_by_offset(disp, _gloffset_RenderMode, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_InitNames) (void);
-
-#define CALL_InitNames(disp, parameters) \
-    (* GET_InitNames(disp)) parameters
-static inline _glptr_InitNames
-GET_InitNames(struct _glapi_table *disp)
-{
-    return (_glptr_InitNames) (GET_by_offset(disp, _gloffset_InitNames));
-}
-
-static inline void
-SET_InitNames(struct _glapi_table *disp, void (GLAPIENTRYP fn) (void))
-{
-    SET_by_offset(disp, _gloffset_InitNames, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_LoadName) (GLuint);
-
-#define CALL_LoadName(disp, parameters) \
-    (* GET_LoadName(disp)) parameters
-static inline _glptr_LoadName
-GET_LoadName(struct _glapi_table *disp)
-{
-    return (_glptr_LoadName) (GET_by_offset(disp, _gloffset_LoadName));
-}
-
-static inline void
-SET_LoadName(struct _glapi_table *disp, void (GLAPIENTRYP fn) (GLuint))
-{
-    SET_by_offset(disp, _gloffset_LoadName, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_PassThrough) (GLfloat);
-
-#define CALL_PassThrough(disp, parameters) \
-    (* GET_PassThrough(disp)) parameters
-static inline _glptr_PassThrough
-GET_PassThrough(struct _glapi_table *disp)
-{
-    return (_glptr_PassThrough) (GET_by_offset(disp, _gloffset_PassThrough));
-}
-
-static inline void
-SET_PassThrough(struct _glapi_table *disp, void (GLAPIENTRYP fn) (GLfloat))
-{
-    SET_by_offset(disp, _gloffset_PassThrough, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_PopName) (void);
-
-#define CALL_PopName(disp, parameters) \
-    (* GET_PopName(disp)) parameters
-static inline _glptr_PopName
-GET_PopName(struct _glapi_table *disp)
-{
-    return (_glptr_PopName) (GET_by_offset(disp, _gloffset_PopName));
-}
-
-static inline void
-SET_PopName(struct _glapi_table *disp, void (GLAPIENTRYP fn) (void))
-{
-    SET_by_offset(disp, _gloffset_PopName, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_PushName) (GLuint);
-
-#define CALL_PushName(disp, parameters) \
-    (* GET_PushName(disp)) parameters
-static inline _glptr_PushName
-GET_PushName(struct _glapi_table *disp)
-{
-    return (_glptr_PushName) (GET_by_offset(disp, _gloffset_PushName));
-}
-
-static inline void
-SET_PushName(struct _glapi_table *disp, void (GLAPIENTRYP fn) (GLuint))
-{
-    SET_by_offset(disp, _gloffset_PushName, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_DrawBuffer) (GLenum);
-
-#define CALL_DrawBuffer(disp, parameters) \
-    (* GET_DrawBuffer(disp)) parameters
-static inline _glptr_DrawBuffer
-GET_DrawBuffer(struct _glapi_table *disp)
-{
-    return (_glptr_DrawBuffer) (GET_by_offset(disp, _gloffset_DrawBuffer));
-}
-
-static inline void
-SET_DrawBuffer(struct _glapi_table *disp, void (GLAPIENTRYP fn) (GLenum))
-{
-    SET_by_offset(disp, _gloffset_DrawBuffer, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Clear) (GLbitfield);
-
-#define CALL_Clear(disp, parameters) \
-    (* GET_Clear(disp)) parameters
-static inline _glptr_Clear
-GET_Clear(struct _glapi_table *disp)
-{
-    return (_glptr_Clear) (GET_by_offset(disp, _gloffset_Clear));
-}
-
-static inline void
-SET_Clear(struct _glapi_table *disp, void (GLAPIENTRYP fn) (GLbitfield))
-{
-    SET_by_offset(disp, _gloffset_Clear, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ClearAccum) (GLfloat, GLfloat, GLfloat,
-                                              GLfloat);
-#define CALL_ClearAccum(disp, parameters) \
-    (* GET_ClearAccum(disp)) parameters
-static inline _glptr_ClearAccum
-GET_ClearAccum(struct _glapi_table *disp)
-{
-    return (_glptr_ClearAccum) (GET_by_offset(disp, _gloffset_ClearAccum));
-}
-
-static inline void
-SET_ClearAccum(struct _glapi_table *disp,
-               void (GLAPIENTRYP fn) (GLfloat, GLfloat, GLfloat, GLfloat))
-{
-    SET_by_offset(disp, _gloffset_ClearAccum, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ClearIndex) (GLfloat);
-
-#define CALL_ClearIndex(disp, parameters) \
-    (* GET_ClearIndex(disp)) parameters
-static inline _glptr_ClearIndex
-GET_ClearIndex(struct _glapi_table *disp)
-{
-    return (_glptr_ClearIndex) (GET_by_offset(disp, _gloffset_ClearIndex));
-}
-
-static inline void
-SET_ClearIndex(struct _glapi_table *disp, void (GLAPIENTRYP fn) (GLfloat))
-{
-    SET_by_offset(disp, _gloffset_ClearIndex, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ClearColor) (GLclampf, GLclampf, GLclampf,
-                                              GLclampf);
-#define CALL_ClearColor(disp, parameters) \
-    (* GET_ClearColor(disp)) parameters
-static inline _glptr_ClearColor
-GET_ClearColor(struct _glapi_table *disp)
-{
-    return (_glptr_ClearColor) (GET_by_offset(disp, _gloffset_ClearColor));
-}
-
-static inline void
-SET_ClearColor(struct _glapi_table *disp,
-               void (GLAPIENTRYP fn) (GLclampf, GLclampf, GLclampf, GLclampf))
-{
-    SET_by_offset(disp, _gloffset_ClearColor, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ClearStencil) (GLint);
-
-#define CALL_ClearStencil(disp, parameters) \
-    (* GET_ClearStencil(disp)) parameters
-static inline _glptr_ClearStencil
-GET_ClearStencil(struct _glapi_table *disp)
-{
-    return (_glptr_ClearStencil) (GET_by_offset(disp, _gloffset_ClearStencil));
-}
-
-static inline void
-SET_ClearStencil(struct _glapi_table *disp, void (GLAPIENTRYP fn) (GLint))
-{
-    SET_by_offset(disp, _gloffset_ClearStencil, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ClearDepth) (GLclampd);
-
-#define CALL_ClearDepth(disp, parameters) \
-    (* GET_ClearDepth(disp)) parameters
-static inline _glptr_ClearDepth
-GET_ClearDepth(struct _glapi_table *disp)
-{
-    return (_glptr_ClearDepth) (GET_by_offset(disp, _gloffset_ClearDepth));
-}
-
-static inline void
-SET_ClearDepth(struct _glapi_table *disp, void (GLAPIENTRYP fn) (GLclampd))
-{
-    SET_by_offset(disp, _gloffset_ClearDepth, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_StencilMask) (GLuint);
-
-#define CALL_StencilMask(disp, parameters) \
-    (* GET_StencilMask(disp)) parameters
-static inline _glptr_StencilMask
-GET_StencilMask(struct _glapi_table *disp)
-{
-    return (_glptr_StencilMask) (GET_by_offset(disp, _gloffset_StencilMask));
-}
-
-static inline void
-SET_StencilMask(struct _glapi_table *disp, void (GLAPIENTRYP fn) (GLuint))
-{
-    SET_by_offset(disp, _gloffset_StencilMask, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ColorMask) (GLboolean, GLboolean, GLboolean,
-                                             GLboolean);
-#define CALL_ColorMask(disp, parameters) \
-    (* GET_ColorMask(disp)) parameters
-static inline _glptr_ColorMask
-GET_ColorMask(struct _glapi_table *disp)
-{
-    return (_glptr_ColorMask) (GET_by_offset(disp, _gloffset_ColorMask));
-}
-
-static inline void
-SET_ColorMask(struct _glapi_table *disp,
-              void (GLAPIENTRYP fn) (GLboolean, GLboolean, GLboolean,
-                                     GLboolean))
-{
-    SET_by_offset(disp, _gloffset_ColorMask, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_DepthMask) (GLboolean);
-
-#define CALL_DepthMask(disp, parameters) \
-    (* GET_DepthMask(disp)) parameters
-static inline _glptr_DepthMask
-GET_DepthMask(struct _glapi_table *disp)
-{
-    return (_glptr_DepthMask) (GET_by_offset(disp, _gloffset_DepthMask));
-}
-
-static inline void
-SET_DepthMask(struct _glapi_table *disp, void (GLAPIENTRYP fn) (GLboolean))
-{
-    SET_by_offset(disp, _gloffset_DepthMask, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_IndexMask) (GLuint);
-
-#define CALL_IndexMask(disp, parameters) \
-    (* GET_IndexMask(disp)) parameters
-static inline _glptr_IndexMask
-GET_IndexMask(struct _glapi_table *disp)
-{
-    return (_glptr_IndexMask) (GET_by_offset(disp, _gloffset_IndexMask));
-}
-
-static inline void
-SET_IndexMask(struct _glapi_table *disp, void (GLAPIENTRYP fn) (GLuint))
-{
-    SET_by_offset(disp, _gloffset_IndexMask, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Accum) (GLenum, GLfloat);
-
-#define CALL_Accum(disp, parameters) \
-    (* GET_Accum(disp)) parameters
-static inline _glptr_Accum
-GET_Accum(struct _glapi_table *disp)
-{
-    return (_glptr_Accum) (GET_by_offset(disp, _gloffset_Accum));
-}
-
-static inline void
-SET_Accum(struct _glapi_table *disp, void (GLAPIENTRYP fn) (GLenum, GLfloat))
-{
-    SET_by_offset(disp, _gloffset_Accum, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Disable) (GLenum);
-
-#define CALL_Disable(disp, parameters) \
-    (* GET_Disable(disp)) parameters
-static inline _glptr_Disable
-GET_Disable(struct _glapi_table *disp)
-{
-    return (_glptr_Disable) (GET_by_offset(disp, _gloffset_Disable));
-}
-
-static inline void
-SET_Disable(struct _glapi_table *disp, void (GLAPIENTRYP fn) (GLenum))
-{
-    SET_by_offset(disp, _gloffset_Disable, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Enable) (GLenum);
-
-#define CALL_Enable(disp, parameters) \
-    (* GET_Enable(disp)) parameters
-static inline _glptr_Enable
-GET_Enable(struct _glapi_table *disp)
-{
-    return (_glptr_Enable) (GET_by_offset(disp, _gloffset_Enable));
-}
-
-static inline void
-SET_Enable(struct _glapi_table *disp, void (GLAPIENTRYP fn) (GLenum))
-{
-    SET_by_offset(disp, _gloffset_Enable, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Finish) (void);
-
-#define CALL_Finish(disp, parameters) \
-    (* GET_Finish(disp)) parameters
-static inline _glptr_Finish
-GET_Finish(struct _glapi_table *disp)
-{
-    return (_glptr_Finish) (GET_by_offset(disp, _gloffset_Finish));
-}
-
-static inline void
-SET_Finish(struct _glapi_table *disp, void (GLAPIENTRYP fn) (void))
-{
-    SET_by_offset(disp, _gloffset_Finish, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Flush) (void);
-
-#define CALL_Flush(disp, parameters) \
-    (* GET_Flush(disp)) parameters
-static inline _glptr_Flush
-GET_Flush(struct _glapi_table *disp)
-{
-    return (_glptr_Flush) (GET_by_offset(disp, _gloffset_Flush));
-}
-
-static inline void
-SET_Flush(struct _glapi_table *disp, void (GLAPIENTRYP fn) (void))
-{
-    SET_by_offset(disp, _gloffset_Flush, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_PopAttrib) (void);
-
-#define CALL_PopAttrib(disp, parameters) \
-    (* GET_PopAttrib(disp)) parameters
-static inline _glptr_PopAttrib
-GET_PopAttrib(struct _glapi_table *disp)
-{
-    return (_glptr_PopAttrib) (GET_by_offset(disp, _gloffset_PopAttrib));
-}
-
-static inline void
-SET_PopAttrib(struct _glapi_table *disp, void (GLAPIENTRYP fn) (void))
-{
-    SET_by_offset(disp, _gloffset_PopAttrib, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_PushAttrib) (GLbitfield);
-
-#define CALL_PushAttrib(disp, parameters) \
-    (* GET_PushAttrib(disp)) parameters
-static inline _glptr_PushAttrib
-GET_PushAttrib(struct _glapi_table *disp)
-{
-    return (_glptr_PushAttrib) (GET_by_offset(disp, _gloffset_PushAttrib));
-}
-
-static inline void
-SET_PushAttrib(struct _glapi_table *disp, void (GLAPIENTRYP fn) (GLbitfield))
-{
-    SET_by_offset(disp, _gloffset_PushAttrib, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Map1d) (GLenum, GLdouble, GLdouble, GLint,
-                                         GLint, const GLdouble *);
-#define CALL_Map1d(disp, parameters) \
-    (* GET_Map1d(disp)) parameters
-static inline _glptr_Map1d
-GET_Map1d(struct _glapi_table *disp)
-{
-    return (_glptr_Map1d) (GET_by_offset(disp, _gloffset_Map1d));
-}
-
-static inline void
-SET_Map1d(struct _glapi_table *disp,
-          void (GLAPIENTRYP fn) (GLenum, GLdouble, GLdouble, GLint, GLint,
-                                 const GLdouble *))
-{
-    SET_by_offset(disp, _gloffset_Map1d, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Map1f) (GLenum, GLfloat, GLfloat, GLint, GLint,
-                                         const GLfloat *);
-#define CALL_Map1f(disp, parameters) \
-    (* GET_Map1f(disp)) parameters
-static inline _glptr_Map1f
-GET_Map1f(struct _glapi_table *disp)
-{
-    return (_glptr_Map1f) (GET_by_offset(disp, _gloffset_Map1f));
-}
-
-static inline void
-SET_Map1f(struct _glapi_table *disp,
-          void (GLAPIENTRYP fn) (GLenum, GLfloat, GLfloat, GLint, GLint,
-                                 const GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_Map1f, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Map2d) (GLenum, GLdouble, GLdouble, GLint,
-                                         GLint, GLdouble, GLdouble, GLint,
-                                         GLint, const GLdouble *);
-#define CALL_Map2d(disp, parameters) \
-    (* GET_Map2d(disp)) parameters
-static inline _glptr_Map2d
-GET_Map2d(struct _glapi_table *disp)
-{
-    return (_glptr_Map2d) (GET_by_offset(disp, _gloffset_Map2d));
-}
-
-static inline void
-SET_Map2d(struct _glapi_table *disp,
-          void (GLAPIENTRYP fn) (GLenum, GLdouble, GLdouble, GLint, GLint,
-                                 GLdouble, GLdouble, GLint, GLint,
-                                 const GLdouble *))
-{
-    SET_by_offset(disp, _gloffset_Map2d, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Map2f) (GLenum, GLfloat, GLfloat, GLint, GLint,
-                                         GLfloat, GLfloat, GLint, GLint,
-                                         const GLfloat *);
-#define CALL_Map2f(disp, parameters) \
-    (* GET_Map2f(disp)) parameters
-static inline _glptr_Map2f
-GET_Map2f(struct _glapi_table *disp)
-{
-    return (_glptr_Map2f) (GET_by_offset(disp, _gloffset_Map2f));
-}
-
-static inline void
-SET_Map2f(struct _glapi_table *disp,
-          void (GLAPIENTRYP fn) (GLenum, GLfloat, GLfloat, GLint, GLint,
-                                 GLfloat, GLfloat, GLint, GLint,
-                                 const GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_Map2f, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MapGrid1d) (GLint, GLdouble, GLdouble);
-
-#define CALL_MapGrid1d(disp, parameters) \
-    (* GET_MapGrid1d(disp)) parameters
-static inline _glptr_MapGrid1d
-GET_MapGrid1d(struct _glapi_table *disp)
-{
-    return (_glptr_MapGrid1d) (GET_by_offset(disp, _gloffset_MapGrid1d));
-}
-
-static inline void
-SET_MapGrid1d(struct _glapi_table *disp,
-              void (GLAPIENTRYP fn) (GLint, GLdouble, GLdouble))
-{
-    SET_by_offset(disp, _gloffset_MapGrid1d, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MapGrid1f) (GLint, GLfloat, GLfloat);
-
-#define CALL_MapGrid1f(disp, parameters) \
-    (* GET_MapGrid1f(disp)) parameters
-static inline _glptr_MapGrid1f
-GET_MapGrid1f(struct _glapi_table *disp)
-{
-    return (_glptr_MapGrid1f) (GET_by_offset(disp, _gloffset_MapGrid1f));
-}
-
-static inline void
-SET_MapGrid1f(struct _glapi_table *disp,
-              void (GLAPIENTRYP fn) (GLint, GLfloat, GLfloat))
-{
-    SET_by_offset(disp, _gloffset_MapGrid1f, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MapGrid2d) (GLint, GLdouble, GLdouble, GLint,
-                                             GLdouble, GLdouble);
-#define CALL_MapGrid2d(disp, parameters) \
-    (* GET_MapGrid2d(disp)) parameters
-static inline _glptr_MapGrid2d
-GET_MapGrid2d(struct _glapi_table *disp)
-{
-    return (_glptr_MapGrid2d) (GET_by_offset(disp, _gloffset_MapGrid2d));
-}
-
-static inline void
-SET_MapGrid2d(struct _glapi_table *disp,
-              void (GLAPIENTRYP fn) (GLint, GLdouble, GLdouble, GLint, GLdouble,
-                                     GLdouble))
-{
-    SET_by_offset(disp, _gloffset_MapGrid2d, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MapGrid2f) (GLint, GLfloat, GLfloat, GLint,
-                                             GLfloat, GLfloat);
-#define CALL_MapGrid2f(disp, parameters) \
-    (* GET_MapGrid2f(disp)) parameters
-static inline _glptr_MapGrid2f
-GET_MapGrid2f(struct _glapi_table *disp)
-{
-    return (_glptr_MapGrid2f) (GET_by_offset(disp, _gloffset_MapGrid2f));
-}
-
-static inline void
-SET_MapGrid2f(struct _glapi_table *disp,
-              void (GLAPIENTRYP fn) (GLint, GLfloat, GLfloat, GLint, GLfloat,
-                                     GLfloat))
-{
-    SET_by_offset(disp, _gloffset_MapGrid2f, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_EvalCoord1d) (GLdouble);
-
-#define CALL_EvalCoord1d(disp, parameters) \
-    (* GET_EvalCoord1d(disp)) parameters
-static inline _glptr_EvalCoord1d
-GET_EvalCoord1d(struct _glapi_table *disp)
-{
-    return (_glptr_EvalCoord1d) (GET_by_offset(disp, _gloffset_EvalCoord1d));
-}
-
-static inline void
-SET_EvalCoord1d(struct _glapi_table *disp, void (GLAPIENTRYP fn) (GLdouble))
-{
-    SET_by_offset(disp, _gloffset_EvalCoord1d, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_EvalCoord1dv) (const GLdouble *);
-
-#define CALL_EvalCoord1dv(disp, parameters) \
-    (* GET_EvalCoord1dv(disp)) parameters
-static inline _glptr_EvalCoord1dv
-GET_EvalCoord1dv(struct _glapi_table *disp)
-{
-    return (_glptr_EvalCoord1dv) (GET_by_offset(disp, _gloffset_EvalCoord1dv));
-}
-
-static inline void
-SET_EvalCoord1dv(struct _glapi_table *disp,
-                 void (GLAPIENTRYP fn) (const GLdouble *))
-{
-    SET_by_offset(disp, _gloffset_EvalCoord1dv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_EvalCoord1f) (GLfloat);
-
-#define CALL_EvalCoord1f(disp, parameters) \
-    (* GET_EvalCoord1f(disp)) parameters
-static inline _glptr_EvalCoord1f
-GET_EvalCoord1f(struct _glapi_table *disp)
-{
-    return (_glptr_EvalCoord1f) (GET_by_offset(disp, _gloffset_EvalCoord1f));
-}
-
-static inline void
-SET_EvalCoord1f(struct _glapi_table *disp, void (GLAPIENTRYP fn) (GLfloat))
-{
-    SET_by_offset(disp, _gloffset_EvalCoord1f, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_EvalCoord1fv) (const GLfloat *);
-
-#define CALL_EvalCoord1fv(disp, parameters) \
-    (* GET_EvalCoord1fv(disp)) parameters
-static inline _glptr_EvalCoord1fv
-GET_EvalCoord1fv(struct _glapi_table *disp)
-{
-    return (_glptr_EvalCoord1fv) (GET_by_offset(disp, _gloffset_EvalCoord1fv));
-}
-
-static inline void
-SET_EvalCoord1fv(struct _glapi_table *disp,
-                 void (GLAPIENTRYP fn) (const GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_EvalCoord1fv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_EvalCoord2d) (GLdouble, GLdouble);
-
-#define CALL_EvalCoord2d(disp, parameters) \
-    (* GET_EvalCoord2d(disp)) parameters
-static inline _glptr_EvalCoord2d
-GET_EvalCoord2d(struct _glapi_table *disp)
-{
-    return (_glptr_EvalCoord2d) (GET_by_offset(disp, _gloffset_EvalCoord2d));
-}
-
-static inline void
-SET_EvalCoord2d(struct _glapi_table *disp,
-                void (GLAPIENTRYP fn) (GLdouble, GLdouble))
-{
-    SET_by_offset(disp, _gloffset_EvalCoord2d, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_EvalCoord2dv) (const GLdouble *);
-
-#define CALL_EvalCoord2dv(disp, parameters) \
-    (* GET_EvalCoord2dv(disp)) parameters
-static inline _glptr_EvalCoord2dv
-GET_EvalCoord2dv(struct _glapi_table *disp)
-{
-    return (_glptr_EvalCoord2dv) (GET_by_offset(disp, _gloffset_EvalCoord2dv));
-}
-
-static inline void
-SET_EvalCoord2dv(struct _glapi_table *disp,
-                 void (GLAPIENTRYP fn) (const GLdouble *))
-{
-    SET_by_offset(disp, _gloffset_EvalCoord2dv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_EvalCoord2f) (GLfloat, GLfloat);
-
-#define CALL_EvalCoord2f(disp, parameters) \
-    (* GET_EvalCoord2f(disp)) parameters
-static inline _glptr_EvalCoord2f
-GET_EvalCoord2f(struct _glapi_table *disp)
-{
-    return (_glptr_EvalCoord2f) (GET_by_offset(disp, _gloffset_EvalCoord2f));
-}
-
-static inline void
-SET_EvalCoord2f(struct _glapi_table *disp,
-                void (GLAPIENTRYP fn) (GLfloat, GLfloat))
-{
-    SET_by_offset(disp, _gloffset_EvalCoord2f, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_EvalCoord2fv) (const GLfloat *);
-
-#define CALL_EvalCoord2fv(disp, parameters) \
-    (* GET_EvalCoord2fv(disp)) parameters
-static inline _glptr_EvalCoord2fv
-GET_EvalCoord2fv(struct _glapi_table *disp)
-{
-    return (_glptr_EvalCoord2fv) (GET_by_offset(disp, _gloffset_EvalCoord2fv));
-}
-
-static inline void
-SET_EvalCoord2fv(struct _glapi_table *disp,
-                 void (GLAPIENTRYP fn) (const GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_EvalCoord2fv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_EvalMesh1) (GLenum, GLint, GLint);
-
-#define CALL_EvalMesh1(disp, parameters) \
-    (* GET_EvalMesh1(disp)) parameters
-static inline _glptr_EvalMesh1
-GET_EvalMesh1(struct _glapi_table *disp)
-{
-    return (_glptr_EvalMesh1) (GET_by_offset(disp, _gloffset_EvalMesh1));
-}
-
-static inline void
-SET_EvalMesh1(struct _glapi_table *disp,
-              void (GLAPIENTRYP fn) (GLenum, GLint, GLint))
-{
-    SET_by_offset(disp, _gloffset_EvalMesh1, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_EvalPoint1) (GLint);
-
-#define CALL_EvalPoint1(disp, parameters) \
-    (* GET_EvalPoint1(disp)) parameters
-static inline _glptr_EvalPoint1
-GET_EvalPoint1(struct _glapi_table *disp)
-{
-    return (_glptr_EvalPoint1) (GET_by_offset(disp, _gloffset_EvalPoint1));
-}
-
-static inline void
-SET_EvalPoint1(struct _glapi_table *disp, void (GLAPIENTRYP fn) (GLint))
-{
-    SET_by_offset(disp, _gloffset_EvalPoint1, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_EvalMesh2) (GLenum, GLint, GLint, GLint,
-                                             GLint);
-#define CALL_EvalMesh2(disp, parameters) \
-    (* GET_EvalMesh2(disp)) parameters
-static inline _glptr_EvalMesh2
-GET_EvalMesh2(struct _glapi_table *disp)
-{
-    return (_glptr_EvalMesh2) (GET_by_offset(disp, _gloffset_EvalMesh2));
-}
-
-static inline void
-SET_EvalMesh2(struct _glapi_table *disp,
-              void (GLAPIENTRYP fn) (GLenum, GLint, GLint, GLint, GLint))
-{
-    SET_by_offset(disp, _gloffset_EvalMesh2, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_EvalPoint2) (GLint, GLint);
-
-#define CALL_EvalPoint2(disp, parameters) \
-    (* GET_EvalPoint2(disp)) parameters
-static inline _glptr_EvalPoint2
-GET_EvalPoint2(struct _glapi_table *disp)
-{
-    return (_glptr_EvalPoint2) (GET_by_offset(disp, _gloffset_EvalPoint2));
-}
-
-static inline void
-SET_EvalPoint2(struct _glapi_table *disp, void (GLAPIENTRYP fn) (GLint, GLint))
-{
-    SET_by_offset(disp, _gloffset_EvalPoint2, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_AlphaFunc) (GLenum, GLclampf);
-
-#define CALL_AlphaFunc(disp, parameters) \
-    (* GET_AlphaFunc(disp)) parameters
-static inline _glptr_AlphaFunc
-GET_AlphaFunc(struct _glapi_table *disp)
-{
-    return (_glptr_AlphaFunc) (GET_by_offset(disp, _gloffset_AlphaFunc));
-}
-
-static inline void
-SET_AlphaFunc(struct _glapi_table *disp,
-              void (GLAPIENTRYP fn) (GLenum, GLclampf))
-{
-    SET_by_offset(disp, _gloffset_AlphaFunc, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_BlendFunc) (GLenum, GLenum);
-
-#define CALL_BlendFunc(disp, parameters) \
-    (* GET_BlendFunc(disp)) parameters
-static inline _glptr_BlendFunc
-GET_BlendFunc(struct _glapi_table *disp)
-{
-    return (_glptr_BlendFunc) (GET_by_offset(disp, _gloffset_BlendFunc));
-}
-
-static inline void
-SET_BlendFunc(struct _glapi_table *disp, void (GLAPIENTRYP fn) (GLenum, GLenum))
-{
-    SET_by_offset(disp, _gloffset_BlendFunc, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_LogicOp) (GLenum);
-
-#define CALL_LogicOp(disp, parameters) \
-    (* GET_LogicOp(disp)) parameters
-static inline _glptr_LogicOp
-GET_LogicOp(struct _glapi_table *disp)
-{
-    return (_glptr_LogicOp) (GET_by_offset(disp, _gloffset_LogicOp));
-}
-
-static inline void
-SET_LogicOp(struct _glapi_table *disp, void (GLAPIENTRYP fn) (GLenum))
-{
-    SET_by_offset(disp, _gloffset_LogicOp, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_StencilFunc) (GLenum, GLint, GLuint);
-
-#define CALL_StencilFunc(disp, parameters) \
-    (* GET_StencilFunc(disp)) parameters
-static inline _glptr_StencilFunc
-GET_StencilFunc(struct _glapi_table *disp)
-{
-    return (_glptr_StencilFunc) (GET_by_offset(disp, _gloffset_StencilFunc));
-}
-
-static inline void
-SET_StencilFunc(struct _glapi_table *disp,
-                void (GLAPIENTRYP fn) (GLenum, GLint, GLuint))
-{
-    SET_by_offset(disp, _gloffset_StencilFunc, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_StencilOp) (GLenum, GLenum, GLenum);
-
-#define CALL_StencilOp(disp, parameters) \
-    (* GET_StencilOp(disp)) parameters
-static inline _glptr_StencilOp
-GET_StencilOp(struct _glapi_table *disp)
-{
-    return (_glptr_StencilOp) (GET_by_offset(disp, _gloffset_StencilOp));
-}
-
-static inline void
-SET_StencilOp(struct _glapi_table *disp,
-              void (GLAPIENTRYP fn) (GLenum, GLenum, GLenum))
-{
-    SET_by_offset(disp, _gloffset_StencilOp, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_DepthFunc) (GLenum);
-
-#define CALL_DepthFunc(disp, parameters) \
-    (* GET_DepthFunc(disp)) parameters
-static inline _glptr_DepthFunc
-GET_DepthFunc(struct _glapi_table *disp)
-{
-    return (_glptr_DepthFunc) (GET_by_offset(disp, _gloffset_DepthFunc));
-}
-
-static inline void
-SET_DepthFunc(struct _glapi_table *disp, void (GLAPIENTRYP fn) (GLenum))
-{
-    SET_by_offset(disp, _gloffset_DepthFunc, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_PixelZoom) (GLfloat, GLfloat);
-
-#define CALL_PixelZoom(disp, parameters) \
-    (* GET_PixelZoom(disp)) parameters
-static inline _glptr_PixelZoom
-GET_PixelZoom(struct _glapi_table *disp)
-{
-    return (_glptr_PixelZoom) (GET_by_offset(disp, _gloffset_PixelZoom));
-}
-
-static inline void
-SET_PixelZoom(struct _glapi_table *disp,
-              void (GLAPIENTRYP fn) (GLfloat, GLfloat))
-{
-    SET_by_offset(disp, _gloffset_PixelZoom, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_PixelTransferf) (GLenum, GLfloat);
-
-#define CALL_PixelTransferf(disp, parameters) \
-    (* GET_PixelTransferf(disp)) parameters
-static inline _glptr_PixelTransferf
-GET_PixelTransferf(struct _glapi_table *disp)
-{
-    return (_glptr_PixelTransferf) (GET_by_offset
-                                    (disp, _gloffset_PixelTransferf));
-}
-
-static inline void
-SET_PixelTransferf(struct _glapi_table *disp,
-                   void (GLAPIENTRYP fn) (GLenum, GLfloat))
-{
-    SET_by_offset(disp, _gloffset_PixelTransferf, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_PixelTransferi) (GLenum, GLint);
-
-#define CALL_PixelTransferi(disp, parameters) \
-    (* GET_PixelTransferi(disp)) parameters
-static inline _glptr_PixelTransferi
-GET_PixelTransferi(struct _glapi_table *disp)
-{
-    return (_glptr_PixelTransferi) (GET_by_offset
-                                    (disp, _gloffset_PixelTransferi));
-}
-
-static inline void
-SET_PixelTransferi(struct _glapi_table *disp,
-                   void (GLAPIENTRYP fn) (GLenum, GLint))
-{
-    SET_by_offset(disp, _gloffset_PixelTransferi, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_PixelStoref) (GLenum, GLfloat);
-
-#define CALL_PixelStoref(disp, parameters) \
-    (* GET_PixelStoref(disp)) parameters
-static inline _glptr_PixelStoref
-GET_PixelStoref(struct _glapi_table *disp)
-{
-    return (_glptr_PixelStoref) (GET_by_offset(disp, _gloffset_PixelStoref));
-}
-
-static inline void
-SET_PixelStoref(struct _glapi_table *disp,
-                void (GLAPIENTRYP fn) (GLenum, GLfloat))
-{
-    SET_by_offset(disp, _gloffset_PixelStoref, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_PixelStorei) (GLenum, GLint);
-
-#define CALL_PixelStorei(disp, parameters) \
-    (* GET_PixelStorei(disp)) parameters
-static inline _glptr_PixelStorei
-GET_PixelStorei(struct _glapi_table *disp)
-{
-    return (_glptr_PixelStorei) (GET_by_offset(disp, _gloffset_PixelStorei));
-}
-
-static inline void
-SET_PixelStorei(struct _glapi_table *disp,
-                void (GLAPIENTRYP fn) (GLenum, GLint))
-{
-    SET_by_offset(disp, _gloffset_PixelStorei, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_PixelMapfv) (GLenum, GLsizei, const GLfloat *);
-
-#define CALL_PixelMapfv(disp, parameters) \
-    (* GET_PixelMapfv(disp)) parameters
-static inline _glptr_PixelMapfv
-GET_PixelMapfv(struct _glapi_table *disp)
-{
-    return (_glptr_PixelMapfv) (GET_by_offset(disp, _gloffset_PixelMapfv));
-}
-
-static inline void
-SET_PixelMapfv(struct _glapi_table *disp,
-               void (GLAPIENTRYP fn) (GLenum, GLsizei, const GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_PixelMapfv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_PixelMapuiv) (GLenum, GLsizei, const GLuint *);
-
-#define CALL_PixelMapuiv(disp, parameters) \
-    (* GET_PixelMapuiv(disp)) parameters
-static inline _glptr_PixelMapuiv
-GET_PixelMapuiv(struct _glapi_table *disp)
-{
-    return (_glptr_PixelMapuiv) (GET_by_offset(disp, _gloffset_PixelMapuiv));
-}
-
-static inline void
-SET_PixelMapuiv(struct _glapi_table *disp,
-                void (GLAPIENTRYP fn) (GLenum, GLsizei, const GLuint *))
-{
-    SET_by_offset(disp, _gloffset_PixelMapuiv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_PixelMapusv) (GLenum, GLsizei,
-                                               const GLushort *);
-#define CALL_PixelMapusv(disp, parameters) \
-    (* GET_PixelMapusv(disp)) parameters
-static inline _glptr_PixelMapusv
-GET_PixelMapusv(struct _glapi_table *disp)
-{
-    return (_glptr_PixelMapusv) (GET_by_offset(disp, _gloffset_PixelMapusv));
-}
-
-static inline void
-SET_PixelMapusv(struct _glapi_table *disp,
-                void (GLAPIENTRYP fn) (GLenum, GLsizei, const GLushort *))
-{
-    SET_by_offset(disp, _gloffset_PixelMapusv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ReadBuffer) (GLenum);
-
-#define CALL_ReadBuffer(disp, parameters) \
-    (* GET_ReadBuffer(disp)) parameters
-static inline _glptr_ReadBuffer
-GET_ReadBuffer(struct _glapi_table *disp)
-{
-    return (_glptr_ReadBuffer) (GET_by_offset(disp, _gloffset_ReadBuffer));
-}
-
-static inline void
-SET_ReadBuffer(struct _glapi_table *disp, void (GLAPIENTRYP fn) (GLenum))
-{
-    SET_by_offset(disp, _gloffset_ReadBuffer, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_CopyPixels) (GLint, GLint, GLsizei, GLsizei,
-                                              GLenum);
-#define CALL_CopyPixels(disp, parameters) \
-    (* GET_CopyPixels(disp)) parameters
-static inline _glptr_CopyPixels
-GET_CopyPixels(struct _glapi_table *disp)
-{
-    return (_glptr_CopyPixels) (GET_by_offset(disp, _gloffset_CopyPixels));
-}
-
-static inline void
-SET_CopyPixels(struct _glapi_table *disp,
-               void (GLAPIENTRYP fn) (GLint, GLint, GLsizei, GLsizei, GLenum))
-{
-    SET_by_offset(disp, _gloffset_CopyPixels, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ReadPixels) (GLint, GLint, GLsizei, GLsizei,
-                                              GLenum, GLenum, GLvoid *);
-#define CALL_ReadPixels(disp, parameters) \
-    (* GET_ReadPixels(disp)) parameters
-static inline _glptr_ReadPixels
-GET_ReadPixels(struct _glapi_table *disp)
-{
-    return (_glptr_ReadPixels) (GET_by_offset(disp, _gloffset_ReadPixels));
-}
-
-static inline void
-SET_ReadPixels(struct _glapi_table *disp,
-               void (GLAPIENTRYP fn) (GLint, GLint, GLsizei, GLsizei, GLenum,
-                                      GLenum, GLvoid *))
-{
-    SET_by_offset(disp, _gloffset_ReadPixels, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_DrawPixels) (GLsizei, GLsizei, GLenum, GLenum,
-                                              const GLvoid *);
-#define CALL_DrawPixels(disp, parameters) \
-    (* GET_DrawPixels(disp)) parameters
-static inline _glptr_DrawPixels
-GET_DrawPixels(struct _glapi_table *disp)
-{
-    return (_glptr_DrawPixels) (GET_by_offset(disp, _gloffset_DrawPixels));
-}
-
-static inline void
-SET_DrawPixels(struct _glapi_table *disp,
-               void (GLAPIENTRYP fn) (GLsizei, GLsizei, GLenum, GLenum,
-                                      const GLvoid *))
-{
-    SET_by_offset(disp, _gloffset_DrawPixels, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetBooleanv) (GLenum, GLboolean *);
-
-#define CALL_GetBooleanv(disp, parameters) \
-    (* GET_GetBooleanv(disp)) parameters
-static inline _glptr_GetBooleanv
-GET_GetBooleanv(struct _glapi_table *disp)
-{
-    return (_glptr_GetBooleanv) (GET_by_offset(disp, _gloffset_GetBooleanv));
-}
-
-static inline void
-SET_GetBooleanv(struct _glapi_table *disp,
-                void (GLAPIENTRYP fn) (GLenum, GLboolean *))
-{
-    SET_by_offset(disp, _gloffset_GetBooleanv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetClipPlane) (GLenum, GLdouble *);
-
-#define CALL_GetClipPlane(disp, parameters) \
-    (* GET_GetClipPlane(disp)) parameters
-static inline _glptr_GetClipPlane
-GET_GetClipPlane(struct _glapi_table *disp)
-{
-    return (_glptr_GetClipPlane) (GET_by_offset(disp, _gloffset_GetClipPlane));
-}
-
-static inline void
-SET_GetClipPlane(struct _glapi_table *disp,
-                 void (GLAPIENTRYP fn) (GLenum, GLdouble *))
-{
-    SET_by_offset(disp, _gloffset_GetClipPlane, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetDoublev) (GLenum, GLdouble *);
-
-#define CALL_GetDoublev(disp, parameters) \
-    (* GET_GetDoublev(disp)) parameters
-static inline _glptr_GetDoublev
-GET_GetDoublev(struct _glapi_table *disp)
-{
-    return (_glptr_GetDoublev) (GET_by_offset(disp, _gloffset_GetDoublev));
-}
-
-static inline void
-SET_GetDoublev(struct _glapi_table *disp,
-               void (GLAPIENTRYP fn) (GLenum, GLdouble *))
-{
-    SET_by_offset(disp, _gloffset_GetDoublev, fn);
-}
-
-typedef GLenum(GLAPIENTRYP _glptr_GetError) (void);
-
-#define CALL_GetError(disp, parameters) \
-    (* GET_GetError(disp)) parameters
-static inline _glptr_GetError
-GET_GetError(struct _glapi_table *disp)
-{
-    return (_glptr_GetError) (GET_by_offset(disp, _gloffset_GetError));
-}
-
-static inline void
-SET_GetError(struct _glapi_table *disp, GLenum(GLAPIENTRYP fn) (void))
-{
-    SET_by_offset(disp, _gloffset_GetError, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetFloatv) (GLenum, GLfloat *);
-
-#define CALL_GetFloatv(disp, parameters) \
-    (* GET_GetFloatv(disp)) parameters
-static inline _glptr_GetFloatv
-GET_GetFloatv(struct _glapi_table *disp)
-{
-    return (_glptr_GetFloatv) (GET_by_offset(disp, _gloffset_GetFloatv));
-}
-
-static inline void
-SET_GetFloatv(struct _glapi_table *disp,
-              void (GLAPIENTRYP fn) (GLenum, GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_GetFloatv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetIntegerv) (GLenum, GLint *);
-
-#define CALL_GetIntegerv(disp, parameters) \
-    (* GET_GetIntegerv(disp)) parameters
-static inline _glptr_GetIntegerv
-GET_GetIntegerv(struct _glapi_table *disp)
-{
-    return (_glptr_GetIntegerv) (GET_by_offset(disp, _gloffset_GetIntegerv));
-}
-
-static inline void
-SET_GetIntegerv(struct _glapi_table *disp,
-                void (GLAPIENTRYP fn) (GLenum, GLint *))
-{
-    SET_by_offset(disp, _gloffset_GetIntegerv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetLightfv) (GLenum, GLenum, GLfloat *);
-
-#define CALL_GetLightfv(disp, parameters) \
-    (* GET_GetLightfv(disp)) parameters
-static inline _glptr_GetLightfv
-GET_GetLightfv(struct _glapi_table *disp)
-{
-    return (_glptr_GetLightfv) (GET_by_offset(disp, _gloffset_GetLightfv));
-}
-
-static inline void
-SET_GetLightfv(struct _glapi_table *disp,
-               void (GLAPIENTRYP fn) (GLenum, GLenum, GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_GetLightfv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetLightiv) (GLenum, GLenum, GLint *);
-
-#define CALL_GetLightiv(disp, parameters) \
-    (* GET_GetLightiv(disp)) parameters
-static inline _glptr_GetLightiv
-GET_GetLightiv(struct _glapi_table *disp)
-{
-    return (_glptr_GetLightiv) (GET_by_offset(disp, _gloffset_GetLightiv));
-}
-
-static inline void
-SET_GetLightiv(struct _glapi_table *disp,
-               void (GLAPIENTRYP fn) (GLenum, GLenum, GLint *))
-{
-    SET_by_offset(disp, _gloffset_GetLightiv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetMapdv) (GLenum, GLenum, GLdouble *);
-
-#define CALL_GetMapdv(disp, parameters) \
-    (* GET_GetMapdv(disp)) parameters
-static inline _glptr_GetMapdv
-GET_GetMapdv(struct _glapi_table *disp)
-{
-    return (_glptr_GetMapdv) (GET_by_offset(disp, _gloffset_GetMapdv));
-}
-
-static inline void
-SET_GetMapdv(struct _glapi_table *disp,
-             void (GLAPIENTRYP fn) (GLenum, GLenum, GLdouble *))
-{
-    SET_by_offset(disp, _gloffset_GetMapdv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetMapfv) (GLenum, GLenum, GLfloat *);
-
-#define CALL_GetMapfv(disp, parameters) \
-    (* GET_GetMapfv(disp)) parameters
-static inline _glptr_GetMapfv
-GET_GetMapfv(struct _glapi_table *disp)
-{
-    return (_glptr_GetMapfv) (GET_by_offset(disp, _gloffset_GetMapfv));
-}
-
-static inline void
-SET_GetMapfv(struct _glapi_table *disp,
-             void (GLAPIENTRYP fn) (GLenum, GLenum, GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_GetMapfv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetMapiv) (GLenum, GLenum, GLint *);
-
-#define CALL_GetMapiv(disp, parameters) \
-    (* GET_GetMapiv(disp)) parameters
-static inline _glptr_GetMapiv
-GET_GetMapiv(struct _glapi_table *disp)
-{
-    return (_glptr_GetMapiv) (GET_by_offset(disp, _gloffset_GetMapiv));
-}
-
-static inline void
-SET_GetMapiv(struct _glapi_table *disp,
-             void (GLAPIENTRYP fn) (GLenum, GLenum, GLint *))
-{
-    SET_by_offset(disp, _gloffset_GetMapiv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetMaterialfv) (GLenum, GLenum, GLfloat *);
-
-#define CALL_GetMaterialfv(disp, parameters) \
-    (* GET_GetMaterialfv(disp)) parameters
-static inline _glptr_GetMaterialfv
-GET_GetMaterialfv(struct _glapi_table *disp)
-{
-    return (_glptr_GetMaterialfv) (GET_by_offset
-                                   (disp, _gloffset_GetMaterialfv));
-}
-
-static inline void
-SET_GetMaterialfv(struct _glapi_table *disp,
-                  void (GLAPIENTRYP fn) (GLenum, GLenum, GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_GetMaterialfv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetMaterialiv) (GLenum, GLenum, GLint *);
-
-#define CALL_GetMaterialiv(disp, parameters) \
-    (* GET_GetMaterialiv(disp)) parameters
-static inline _glptr_GetMaterialiv
-GET_GetMaterialiv(struct _glapi_table *disp)
-{
-    return (_glptr_GetMaterialiv) (GET_by_offset
-                                   (disp, _gloffset_GetMaterialiv));
-}
-
-static inline void
-SET_GetMaterialiv(struct _glapi_table *disp,
-                  void (GLAPIENTRYP fn) (GLenum, GLenum, GLint *))
-{
-    SET_by_offset(disp, _gloffset_GetMaterialiv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetPixelMapfv) (GLenum, GLfloat *);
-
-#define CALL_GetPixelMapfv(disp, parameters) \
-    (* GET_GetPixelMapfv(disp)) parameters
-static inline _glptr_GetPixelMapfv
-GET_GetPixelMapfv(struct _glapi_table *disp)
-{
-    return (_glptr_GetPixelMapfv) (GET_by_offset
-                                   (disp, _gloffset_GetPixelMapfv));
-}
-
-static inline void
-SET_GetPixelMapfv(struct _glapi_table *disp,
-                  void (GLAPIENTRYP fn) (GLenum, GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_GetPixelMapfv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetPixelMapuiv) (GLenum, GLuint *);
-
-#define CALL_GetPixelMapuiv(disp, parameters) \
-    (* GET_GetPixelMapuiv(disp)) parameters
-static inline _glptr_GetPixelMapuiv
-GET_GetPixelMapuiv(struct _glapi_table *disp)
-{
-    return (_glptr_GetPixelMapuiv) (GET_by_offset
-                                    (disp, _gloffset_GetPixelMapuiv));
-}
-
-static inline void
-SET_GetPixelMapuiv(struct _glapi_table *disp,
-                   void (GLAPIENTRYP fn) (GLenum, GLuint *))
-{
-    SET_by_offset(disp, _gloffset_GetPixelMapuiv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetPixelMapusv) (GLenum, GLushort *);
-
-#define CALL_GetPixelMapusv(disp, parameters) \
-    (* GET_GetPixelMapusv(disp)) parameters
-static inline _glptr_GetPixelMapusv
-GET_GetPixelMapusv(struct _glapi_table *disp)
-{
-    return (_glptr_GetPixelMapusv) (GET_by_offset
-                                    (disp, _gloffset_GetPixelMapusv));
-}
-
-static inline void
-SET_GetPixelMapusv(struct _glapi_table *disp,
-                   void (GLAPIENTRYP fn) (GLenum, GLushort *))
-{
-    SET_by_offset(disp, _gloffset_GetPixelMapusv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetPolygonStipple) (GLubyte *);
-
-#define CALL_GetPolygonStipple(disp, parameters) \
-    (* GET_GetPolygonStipple(disp)) parameters
-static inline _glptr_GetPolygonStipple
-GET_GetPolygonStipple(struct _glapi_table *disp)
-{
-    return (_glptr_GetPolygonStipple) (GET_by_offset
-                                       (disp, _gloffset_GetPolygonStipple));
-}
-
-static inline void
-SET_GetPolygonStipple(struct _glapi_table *disp,
-                      void (GLAPIENTRYP fn) (GLubyte *))
-{
-    SET_by_offset(disp, _gloffset_GetPolygonStipple, fn);
-}
-
-typedef const GLubyte *(GLAPIENTRYP _glptr_GetString) (GLenum);
-
-#define CALL_GetString(disp, parameters) \
-    (* GET_GetString(disp)) parameters
-static inline _glptr_GetString
-GET_GetString(struct _glapi_table *disp)
-{
-    return (_glptr_GetString) (GET_by_offset(disp, _gloffset_GetString));
-}
-
-static inline void
-SET_GetString(struct _glapi_table *disp,
-              const GLubyte * (GLAPIENTRYP fn) (GLenum))
-{
-    SET_by_offset(disp, _gloffset_GetString, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetTexEnvfv) (GLenum, GLenum, GLfloat *);
-
-#define CALL_GetTexEnvfv(disp, parameters) \
-    (* GET_GetTexEnvfv(disp)) parameters
-static inline _glptr_GetTexEnvfv
-GET_GetTexEnvfv(struct _glapi_table *disp)
-{
-    return (_glptr_GetTexEnvfv) (GET_by_offset(disp, _gloffset_GetTexEnvfv));
-}
-
-static inline void
-SET_GetTexEnvfv(struct _glapi_table *disp,
-                void (GLAPIENTRYP fn) (GLenum, GLenum, GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_GetTexEnvfv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetTexEnviv) (GLenum, GLenum, GLint *);
-
-#define CALL_GetTexEnviv(disp, parameters) \
-    (* GET_GetTexEnviv(disp)) parameters
-static inline _glptr_GetTexEnviv
-GET_GetTexEnviv(struct _glapi_table *disp)
-{
-    return (_glptr_GetTexEnviv) (GET_by_offset(disp, _gloffset_GetTexEnviv));
-}
-
-static inline void
-SET_GetTexEnviv(struct _glapi_table *disp,
-                void (GLAPIENTRYP fn) (GLenum, GLenum, GLint *))
-{
-    SET_by_offset(disp, _gloffset_GetTexEnviv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetTexGendv) (GLenum, GLenum, GLdouble *);
-
-#define CALL_GetTexGendv(disp, parameters) \
-    (* GET_GetTexGendv(disp)) parameters
-static inline _glptr_GetTexGendv
-GET_GetTexGendv(struct _glapi_table *disp)
-{
-    return (_glptr_GetTexGendv) (GET_by_offset(disp, _gloffset_GetTexGendv));
-}
-
-static inline void
-SET_GetTexGendv(struct _glapi_table *disp,
-                void (GLAPIENTRYP fn) (GLenum, GLenum, GLdouble *))
-{
-    SET_by_offset(disp, _gloffset_GetTexGendv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetTexGenfv) (GLenum, GLenum, GLfloat *);
-
-#define CALL_GetTexGenfv(disp, parameters) \
-    (* GET_GetTexGenfv(disp)) parameters
-static inline _glptr_GetTexGenfv
-GET_GetTexGenfv(struct _glapi_table *disp)
-{
-    return (_glptr_GetTexGenfv) (GET_by_offset(disp, _gloffset_GetTexGenfv));
-}
-
-static inline void
-SET_GetTexGenfv(struct _glapi_table *disp,
-                void (GLAPIENTRYP fn) (GLenum, GLenum, GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_GetTexGenfv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetTexGeniv) (GLenum, GLenum, GLint *);
-
-#define CALL_GetTexGeniv(disp, parameters) \
-    (* GET_GetTexGeniv(disp)) parameters
-static inline _glptr_GetTexGeniv
-GET_GetTexGeniv(struct _glapi_table *disp)
-{
-    return (_glptr_GetTexGeniv) (GET_by_offset(disp, _gloffset_GetTexGeniv));
-}
-
-static inline void
-SET_GetTexGeniv(struct _glapi_table *disp,
-                void (GLAPIENTRYP fn) (GLenum, GLenum, GLint *))
-{
-    SET_by_offset(disp, _gloffset_GetTexGeniv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetTexImage) (GLenum, GLint, GLenum, GLenum,
-                                               GLvoid *);
-#define CALL_GetTexImage(disp, parameters) \
-    (* GET_GetTexImage(disp)) parameters
-static inline _glptr_GetTexImage
-GET_GetTexImage(struct _glapi_table *disp)
-{
-    return (_glptr_GetTexImage) (GET_by_offset(disp, _gloffset_GetTexImage));
-}
-
-static inline void
-SET_GetTexImage(struct _glapi_table *disp,
-                void (GLAPIENTRYP fn) (GLenum, GLint, GLenum, GLenum, GLvoid *))
-{
-    SET_by_offset(disp, _gloffset_GetTexImage, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetTexParameterfv) (GLenum, GLenum, GLfloat *);
-
-#define CALL_GetTexParameterfv(disp, parameters) \
-    (* GET_GetTexParameterfv(disp)) parameters
-static inline _glptr_GetTexParameterfv
-GET_GetTexParameterfv(struct _glapi_table *disp)
-{
-    return (_glptr_GetTexParameterfv) (GET_by_offset
-                                       (disp, _gloffset_GetTexParameterfv));
-}
-
-static inline void
-SET_GetTexParameterfv(struct _glapi_table *disp,
-                      void (GLAPIENTRYP fn) (GLenum, GLenum, GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_GetTexParameterfv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetTexParameteriv) (GLenum, GLenum, GLint *);
-
-#define CALL_GetTexParameteriv(disp, parameters) \
-    (* GET_GetTexParameteriv(disp)) parameters
-static inline _glptr_GetTexParameteriv
-GET_GetTexParameteriv(struct _glapi_table *disp)
-{
-    return (_glptr_GetTexParameteriv) (GET_by_offset
-                                       (disp, _gloffset_GetTexParameteriv));
-}
-
-static inline void
-SET_GetTexParameteriv(struct _glapi_table *disp,
-                      void (GLAPIENTRYP fn) (GLenum, GLenum, GLint *))
-{
-    SET_by_offset(disp, _gloffset_GetTexParameteriv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetTexLevelParameterfv) (GLenum, GLint, GLenum,
-                                                          GLfloat *);
-#define CALL_GetTexLevelParameterfv(disp, parameters) \
-    (* GET_GetTexLevelParameterfv(disp)) parameters
-static inline _glptr_GetTexLevelParameterfv
-GET_GetTexLevelParameterfv(struct _glapi_table *disp)
-{
-    return (_glptr_GetTexLevelParameterfv) (GET_by_offset
-                                            (disp,
-                                             _gloffset_GetTexLevelParameterfv));
-}
-
-static inline void
-SET_GetTexLevelParameterfv(struct _glapi_table *disp,
-                           void (GLAPIENTRYP fn) (GLenum, GLint, GLenum,
-                                                  GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_GetTexLevelParameterfv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetTexLevelParameteriv) (GLenum, GLint, GLenum,
-                                                          GLint *);
-#define CALL_GetTexLevelParameteriv(disp, parameters) \
-    (* GET_GetTexLevelParameteriv(disp)) parameters
-static inline _glptr_GetTexLevelParameteriv
-GET_GetTexLevelParameteriv(struct _glapi_table *disp)
-{
-    return (_glptr_GetTexLevelParameteriv) (GET_by_offset
-                                            (disp,
-                                             _gloffset_GetTexLevelParameteriv));
-}
-
-static inline void
-SET_GetTexLevelParameteriv(struct _glapi_table *disp,
-                           void (GLAPIENTRYP fn) (GLenum, GLint, GLenum,
-                                                  GLint *))
-{
-    SET_by_offset(disp, _gloffset_GetTexLevelParameteriv, fn);
-}
-
-typedef GLboolean(GLAPIENTRYP _glptr_IsEnabled) (GLenum);
-
-#define CALL_IsEnabled(disp, parameters) \
-    (* GET_IsEnabled(disp)) parameters
-static inline _glptr_IsEnabled
-GET_IsEnabled(struct _glapi_table *disp)
-{
-    return (_glptr_IsEnabled) (GET_by_offset(disp, _gloffset_IsEnabled));
-}
-
-static inline void
-SET_IsEnabled(struct _glapi_table *disp, GLboolean(GLAPIENTRYP fn) (GLenum))
-{
-    SET_by_offset(disp, _gloffset_IsEnabled, fn);
-}
-
-typedef GLboolean(GLAPIENTRYP _glptr_IsList) (GLuint);
-
-#define CALL_IsList(disp, parameters) \
-    (* GET_IsList(disp)) parameters
-static inline _glptr_IsList
-GET_IsList(struct _glapi_table *disp)
-{
-    return (_glptr_IsList) (GET_by_offset(disp, _gloffset_IsList));
-}
-
-static inline void
-SET_IsList(struct _glapi_table *disp, GLboolean(GLAPIENTRYP fn) (GLuint))
-{
-    SET_by_offset(disp, _gloffset_IsList, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_DepthRange) (GLclampd, GLclampd);
-
-#define CALL_DepthRange(disp, parameters) \
-    (* GET_DepthRange(disp)) parameters
-static inline _glptr_DepthRange
-GET_DepthRange(struct _glapi_table *disp)
-{
-    return (_glptr_DepthRange) (GET_by_offset(disp, _gloffset_DepthRange));
-}
-
-static inline void
-SET_DepthRange(struct _glapi_table *disp,
-               void (GLAPIENTRYP fn) (GLclampd, GLclampd))
-{
-    SET_by_offset(disp, _gloffset_DepthRange, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Frustum) (GLdouble, GLdouble, GLdouble,
-                                           GLdouble, GLdouble, GLdouble);
-#define CALL_Frustum(disp, parameters) \
-    (* GET_Frustum(disp)) parameters
-static inline _glptr_Frustum
-GET_Frustum(struct _glapi_table *disp)
-{
-    return (_glptr_Frustum) (GET_by_offset(disp, _gloffset_Frustum));
-}
-
-static inline void
-SET_Frustum(struct _glapi_table *disp,
-            void (GLAPIENTRYP fn) (GLdouble, GLdouble, GLdouble, GLdouble,
-                                   GLdouble, GLdouble))
-{
-    SET_by_offset(disp, _gloffset_Frustum, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_LoadIdentity) (void);
-
-#define CALL_LoadIdentity(disp, parameters) \
-    (* GET_LoadIdentity(disp)) parameters
-static inline _glptr_LoadIdentity
-GET_LoadIdentity(struct _glapi_table *disp)
-{
-    return (_glptr_LoadIdentity) (GET_by_offset(disp, _gloffset_LoadIdentity));
-}
-
-static inline void
-SET_LoadIdentity(struct _glapi_table *disp, void (GLAPIENTRYP fn) (void))
-{
-    SET_by_offset(disp, _gloffset_LoadIdentity, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_LoadMatrixf) (const GLfloat *);
-
-#define CALL_LoadMatrixf(disp, parameters) \
-    (* GET_LoadMatrixf(disp)) parameters
-static inline _glptr_LoadMatrixf
-GET_LoadMatrixf(struct _glapi_table *disp)
-{
-    return (_glptr_LoadMatrixf) (GET_by_offset(disp, _gloffset_LoadMatrixf));
-}
-
-static inline void
-SET_LoadMatrixf(struct _glapi_table *disp,
-                void (GLAPIENTRYP fn) (const GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_LoadMatrixf, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_LoadMatrixd) (const GLdouble *);
-
-#define CALL_LoadMatrixd(disp, parameters) \
-    (* GET_LoadMatrixd(disp)) parameters
-static inline _glptr_LoadMatrixd
-GET_LoadMatrixd(struct _glapi_table *disp)
-{
-    return (_glptr_LoadMatrixd) (GET_by_offset(disp, _gloffset_LoadMatrixd));
-}
-
-static inline void
-SET_LoadMatrixd(struct _glapi_table *disp,
-                void (GLAPIENTRYP fn) (const GLdouble *))
-{
-    SET_by_offset(disp, _gloffset_LoadMatrixd, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MatrixMode) (GLenum);
-
-#define CALL_MatrixMode(disp, parameters) \
-    (* GET_MatrixMode(disp)) parameters
-static inline _glptr_MatrixMode
-GET_MatrixMode(struct _glapi_table *disp)
-{
-    return (_glptr_MatrixMode) (GET_by_offset(disp, _gloffset_MatrixMode));
-}
-
-static inline void
-SET_MatrixMode(struct _glapi_table *disp, void (GLAPIENTRYP fn) (GLenum))
-{
-    SET_by_offset(disp, _gloffset_MatrixMode, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultMatrixf) (const GLfloat *);
-
-#define CALL_MultMatrixf(disp, parameters) \
-    (* GET_MultMatrixf(disp)) parameters
-static inline _glptr_MultMatrixf
-GET_MultMatrixf(struct _glapi_table *disp)
-{
-    return (_glptr_MultMatrixf) (GET_by_offset(disp, _gloffset_MultMatrixf));
-}
-
-static inline void
-SET_MultMatrixf(struct _glapi_table *disp,
-                void (GLAPIENTRYP fn) (const GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_MultMatrixf, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultMatrixd) (const GLdouble *);
-
-#define CALL_MultMatrixd(disp, parameters) \
-    (* GET_MultMatrixd(disp)) parameters
-static inline _glptr_MultMatrixd
-GET_MultMatrixd(struct _glapi_table *disp)
-{
-    return (_glptr_MultMatrixd) (GET_by_offset(disp, _gloffset_MultMatrixd));
-}
-
-static inline void
-SET_MultMatrixd(struct _glapi_table *disp,
-                void (GLAPIENTRYP fn) (const GLdouble *))
-{
-    SET_by_offset(disp, _gloffset_MultMatrixd, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Ortho) (GLdouble, GLdouble, GLdouble, GLdouble,
-                                         GLdouble, GLdouble);
-#define CALL_Ortho(disp, parameters) \
-    (* GET_Ortho(disp)) parameters
-static inline _glptr_Ortho
-GET_Ortho(struct _glapi_table *disp)
-{
-    return (_glptr_Ortho) (GET_by_offset(disp, _gloffset_Ortho));
-}
-
-static inline void
-SET_Ortho(struct _glapi_table *disp,
-          void (GLAPIENTRYP fn) (GLdouble, GLdouble, GLdouble, GLdouble,
-                                 GLdouble, GLdouble))
-{
-    SET_by_offset(disp, _gloffset_Ortho, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_PopMatrix) (void);
-
-#define CALL_PopMatrix(disp, parameters) \
-    (* GET_PopMatrix(disp)) parameters
-static inline _glptr_PopMatrix
-GET_PopMatrix(struct _glapi_table *disp)
-{
-    return (_glptr_PopMatrix) (GET_by_offset(disp, _gloffset_PopMatrix));
-}
-
-static inline void
-SET_PopMatrix(struct _glapi_table *disp, void (GLAPIENTRYP fn) (void))
-{
-    SET_by_offset(disp, _gloffset_PopMatrix, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_PushMatrix) (void);
-
-#define CALL_PushMatrix(disp, parameters) \
-    (* GET_PushMatrix(disp)) parameters
-static inline _glptr_PushMatrix
-GET_PushMatrix(struct _glapi_table *disp)
-{
-    return (_glptr_PushMatrix) (GET_by_offset(disp, _gloffset_PushMatrix));
-}
-
-static inline void
-SET_PushMatrix(struct _glapi_table *disp, void (GLAPIENTRYP fn) (void))
-{
-    SET_by_offset(disp, _gloffset_PushMatrix, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Rotated) (GLdouble, GLdouble, GLdouble,
-                                           GLdouble);
-#define CALL_Rotated(disp, parameters) \
-    (* GET_Rotated(disp)) parameters
-static inline _glptr_Rotated
-GET_Rotated(struct _glapi_table *disp)
-{
-    return (_glptr_Rotated) (GET_by_offset(disp, _gloffset_Rotated));
-}
-
-static inline void
-SET_Rotated(struct _glapi_table *disp,
-            void (GLAPIENTRYP fn) (GLdouble, GLdouble, GLdouble, GLdouble))
-{
-    SET_by_offset(disp, _gloffset_Rotated, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Rotatef) (GLfloat, GLfloat, GLfloat, GLfloat);
-
-#define CALL_Rotatef(disp, parameters) \
-    (* GET_Rotatef(disp)) parameters
-static inline _glptr_Rotatef
-GET_Rotatef(struct _glapi_table *disp)
-{
-    return (_glptr_Rotatef) (GET_by_offset(disp, _gloffset_Rotatef));
-}
-
-static inline void
-SET_Rotatef(struct _glapi_table *disp,
-            void (GLAPIENTRYP fn) (GLfloat, GLfloat, GLfloat, GLfloat))
-{
-    SET_by_offset(disp, _gloffset_Rotatef, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Scaled) (GLdouble, GLdouble, GLdouble);
-
-#define CALL_Scaled(disp, parameters) \
-    (* GET_Scaled(disp)) parameters
-static inline _glptr_Scaled
-GET_Scaled(struct _glapi_table *disp)
-{
-    return (_glptr_Scaled) (GET_by_offset(disp, _gloffset_Scaled));
-}
-
-static inline void
-SET_Scaled(struct _glapi_table *disp,
-           void (GLAPIENTRYP fn) (GLdouble, GLdouble, GLdouble))
-{
-    SET_by_offset(disp, _gloffset_Scaled, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Scalef) (GLfloat, GLfloat, GLfloat);
-
-#define CALL_Scalef(disp, parameters) \
-    (* GET_Scalef(disp)) parameters
-static inline _glptr_Scalef
-GET_Scalef(struct _glapi_table *disp)
-{
-    return (_glptr_Scalef) (GET_by_offset(disp, _gloffset_Scalef));
-}
-
-static inline void
-SET_Scalef(struct _glapi_table *disp,
-           void (GLAPIENTRYP fn) (GLfloat, GLfloat, GLfloat))
-{
-    SET_by_offset(disp, _gloffset_Scalef, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Translated) (GLdouble, GLdouble, GLdouble);
-
-#define CALL_Translated(disp, parameters) \
-    (* GET_Translated(disp)) parameters
-static inline _glptr_Translated
-GET_Translated(struct _glapi_table *disp)
-{
-    return (_glptr_Translated) (GET_by_offset(disp, _gloffset_Translated));
-}
-
-static inline void
-SET_Translated(struct _glapi_table *disp,
-               void (GLAPIENTRYP fn) (GLdouble, GLdouble, GLdouble))
-{
-    SET_by_offset(disp, _gloffset_Translated, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Translatef) (GLfloat, GLfloat, GLfloat);
-
-#define CALL_Translatef(disp, parameters) \
-    (* GET_Translatef(disp)) parameters
-static inline _glptr_Translatef
-GET_Translatef(struct _glapi_table *disp)
-{
-    return (_glptr_Translatef) (GET_by_offset(disp, _gloffset_Translatef));
-}
-
-static inline void
-SET_Translatef(struct _glapi_table *disp,
-               void (GLAPIENTRYP fn) (GLfloat, GLfloat, GLfloat))
-{
-    SET_by_offset(disp, _gloffset_Translatef, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Viewport) (GLint, GLint, GLsizei, GLsizei);
-
-#define CALL_Viewport(disp, parameters) \
-    (* GET_Viewport(disp)) parameters
-static inline _glptr_Viewport
-GET_Viewport(struct _glapi_table *disp)
-{
-    return (_glptr_Viewport) (GET_by_offset(disp, _gloffset_Viewport));
-}
-
-static inline void
-SET_Viewport(struct _glapi_table *disp,
-             void (GLAPIENTRYP fn) (GLint, GLint, GLsizei, GLsizei))
-{
-    SET_by_offset(disp, _gloffset_Viewport, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ArrayElement) (GLint);
-
-#define CALL_ArrayElement(disp, parameters) \
-    (* GET_ArrayElement(disp)) parameters
-static inline _glptr_ArrayElement
-GET_ArrayElement(struct _glapi_table *disp)
-{
-    return (_glptr_ArrayElement) (GET_by_offset(disp, _gloffset_ArrayElement));
-}
-
-static inline void
-SET_ArrayElement(struct _glapi_table *disp, void (GLAPIENTRYP fn) (GLint))
-{
-    SET_by_offset(disp, _gloffset_ArrayElement, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_BindTexture) (GLenum, GLuint);
-
-#define CALL_BindTexture(disp, parameters) \
-    (* GET_BindTexture(disp)) parameters
-static inline _glptr_BindTexture
-GET_BindTexture(struct _glapi_table *disp)
-{
-    return (_glptr_BindTexture) (GET_by_offset(disp, _gloffset_BindTexture));
-}
-
-static inline void
-SET_BindTexture(struct _glapi_table *disp,
-                void (GLAPIENTRYP fn) (GLenum, GLuint))
-{
-    SET_by_offset(disp, _gloffset_BindTexture, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ColorPointer) (GLint, GLenum, GLsizei,
-                                                const GLvoid *);
-#define CALL_ColorPointer(disp, parameters) \
-    (* GET_ColorPointer(disp)) parameters
-static inline _glptr_ColorPointer
-GET_ColorPointer(struct _glapi_table *disp)
-{
-    return (_glptr_ColorPointer) (GET_by_offset(disp, _gloffset_ColorPointer));
-}
-
-static inline void
-SET_ColorPointer(struct _glapi_table *disp,
-                 void (GLAPIENTRYP fn) (GLint, GLenum, GLsizei, const GLvoid *))
-{
-    SET_by_offset(disp, _gloffset_ColorPointer, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_DisableClientState) (GLenum);
-
-#define CALL_DisableClientState(disp, parameters) \
-    (* GET_DisableClientState(disp)) parameters
-static inline _glptr_DisableClientState
-GET_DisableClientState(struct _glapi_table *disp)
-{
-    return (_glptr_DisableClientState) (GET_by_offset
-                                        (disp, _gloffset_DisableClientState));
-}
-
-static inline void
-SET_DisableClientState(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLenum))
-{
-    SET_by_offset(disp, _gloffset_DisableClientState, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_DrawArrays) (GLenum, GLint, GLsizei);
-
-#define CALL_DrawArrays(disp, parameters) \
-    (* GET_DrawArrays(disp)) parameters
-static inline _glptr_DrawArrays
-GET_DrawArrays(struct _glapi_table *disp)
-{
-    return (_glptr_DrawArrays) (GET_by_offset(disp, _gloffset_DrawArrays));
-}
-
-static inline void
-SET_DrawArrays(struct _glapi_table *disp,
-               void (GLAPIENTRYP fn) (GLenum, GLint, GLsizei))
-{
-    SET_by_offset(disp, _gloffset_DrawArrays, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_DrawElements) (GLenum, GLsizei, GLenum,
-                                                const GLvoid *);
-#define CALL_DrawElements(disp, parameters) \
-    (* GET_DrawElements(disp)) parameters
-static inline _glptr_DrawElements
-GET_DrawElements(struct _glapi_table *disp)
-{
-    return (_glptr_DrawElements) (GET_by_offset(disp, _gloffset_DrawElements));
-}
-
-static inline void
-SET_DrawElements(struct _glapi_table *disp,
-                 void (GLAPIENTRYP fn) (GLenum, GLsizei, GLenum,
-                                        const GLvoid *))
-{
-    SET_by_offset(disp, _gloffset_DrawElements, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_EdgeFlagPointer) (GLsizei, const GLvoid *);
-
-#define CALL_EdgeFlagPointer(disp, parameters) \
-    (* GET_EdgeFlagPointer(disp)) parameters
-static inline _glptr_EdgeFlagPointer
-GET_EdgeFlagPointer(struct _glapi_table *disp)
-{
-    return (_glptr_EdgeFlagPointer) (GET_by_offset
-                                     (disp, _gloffset_EdgeFlagPointer));
-}
-
-static inline void
-SET_EdgeFlagPointer(struct _glapi_table *disp,
-                    void (GLAPIENTRYP fn) (GLsizei, const GLvoid *))
-{
-    SET_by_offset(disp, _gloffset_EdgeFlagPointer, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_EnableClientState) (GLenum);
-
-#define CALL_EnableClientState(disp, parameters) \
-    (* GET_EnableClientState(disp)) parameters
-static inline _glptr_EnableClientState
-GET_EnableClientState(struct _glapi_table *disp)
-{
-    return (_glptr_EnableClientState) (GET_by_offset
-                                       (disp, _gloffset_EnableClientState));
-}
-
-static inline void
-SET_EnableClientState(struct _glapi_table *disp, void (GLAPIENTRYP fn) (GLenum))
-{
-    SET_by_offset(disp, _gloffset_EnableClientState, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_IndexPointer) (GLenum, GLsizei,
-                                                const GLvoid *);
-#define CALL_IndexPointer(disp, parameters) \
-    (* GET_IndexPointer(disp)) parameters
-static inline _glptr_IndexPointer
-GET_IndexPointer(struct _glapi_table *disp)
-{
-    return (_glptr_IndexPointer) (GET_by_offset(disp, _gloffset_IndexPointer));
-}
-
-static inline void
-SET_IndexPointer(struct _glapi_table *disp,
-                 void (GLAPIENTRYP fn) (GLenum, GLsizei, const GLvoid *))
-{
-    SET_by_offset(disp, _gloffset_IndexPointer, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Indexub) (GLubyte);
-
-#define CALL_Indexub(disp, parameters) \
-    (* GET_Indexub(disp)) parameters
-static inline _glptr_Indexub
-GET_Indexub(struct _glapi_table *disp)
-{
-    return (_glptr_Indexub) (GET_by_offset(disp, _gloffset_Indexub));
-}
-
-static inline void
-SET_Indexub(struct _glapi_table *disp, void (GLAPIENTRYP fn) (GLubyte))
-{
-    SET_by_offset(disp, _gloffset_Indexub, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Indexubv) (const GLubyte *);
-
-#define CALL_Indexubv(disp, parameters) \
-    (* GET_Indexubv(disp)) parameters
-static inline _glptr_Indexubv
-GET_Indexubv(struct _glapi_table *disp)
-{
-    return (_glptr_Indexubv) (GET_by_offset(disp, _gloffset_Indexubv));
-}
-
-static inline void
-SET_Indexubv(struct _glapi_table *disp, void (GLAPIENTRYP fn) (const GLubyte *))
-{
-    SET_by_offset(disp, _gloffset_Indexubv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_InterleavedArrays) (GLenum, GLsizei,
-                                                     const GLvoid *);
-#define CALL_InterleavedArrays(disp, parameters) \
-    (* GET_InterleavedArrays(disp)) parameters
-static inline _glptr_InterleavedArrays
-GET_InterleavedArrays(struct _glapi_table *disp)
-{
-    return (_glptr_InterleavedArrays) (GET_by_offset
-                                       (disp, _gloffset_InterleavedArrays));
-}
-
-static inline void
-SET_InterleavedArrays(struct _glapi_table *disp,
-                      void (GLAPIENTRYP fn) (GLenum, GLsizei, const GLvoid *))
-{
-    SET_by_offset(disp, _gloffset_InterleavedArrays, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_NormalPointer) (GLenum, GLsizei,
-                                                 const GLvoid *);
-#define CALL_NormalPointer(disp, parameters) \
-    (* GET_NormalPointer(disp)) parameters
-static inline _glptr_NormalPointer
-GET_NormalPointer(struct _glapi_table *disp)
-{
-    return (_glptr_NormalPointer) (GET_by_offset
-                                   (disp, _gloffset_NormalPointer));
-}
-
-static inline void
-SET_NormalPointer(struct _glapi_table *disp,
-                  void (GLAPIENTRYP fn) (GLenum, GLsizei, const GLvoid *))
-{
-    SET_by_offset(disp, _gloffset_NormalPointer, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_PolygonOffset) (GLfloat, GLfloat);
-
-#define CALL_PolygonOffset(disp, parameters) \
-    (* GET_PolygonOffset(disp)) parameters
-static inline _glptr_PolygonOffset
-GET_PolygonOffset(struct _glapi_table *disp)
-{
-    return (_glptr_PolygonOffset) (GET_by_offset
-                                   (disp, _gloffset_PolygonOffset));
-}
-
-static inline void
-SET_PolygonOffset(struct _glapi_table *disp,
-                  void (GLAPIENTRYP fn) (GLfloat, GLfloat))
-{
-    SET_by_offset(disp, _gloffset_PolygonOffset, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoordPointer) (GLint, GLenum, GLsizei,
-                                                   const GLvoid *);
-#define CALL_TexCoordPointer(disp, parameters) \
-    (* GET_TexCoordPointer(disp)) parameters
-static inline _glptr_TexCoordPointer
-GET_TexCoordPointer(struct _glapi_table *disp)
-{
-    return (_glptr_TexCoordPointer) (GET_by_offset
-                                     (disp, _gloffset_TexCoordPointer));
-}
-
-static inline void
-SET_TexCoordPointer(struct _glapi_table *disp,
-                    void (GLAPIENTRYP fn) (GLint, GLenum, GLsizei,
-                                           const GLvoid *))
-{
-    SET_by_offset(disp, _gloffset_TexCoordPointer, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexPointer) (GLint, GLenum, GLsizei,
-                                                 const GLvoid *);
-#define CALL_VertexPointer(disp, parameters) \
-    (* GET_VertexPointer(disp)) parameters
-static inline _glptr_VertexPointer
-GET_VertexPointer(struct _glapi_table *disp)
-{
-    return (_glptr_VertexPointer) (GET_by_offset
-                                   (disp, _gloffset_VertexPointer));
-}
-
-static inline void
-SET_VertexPointer(struct _glapi_table *disp,
-                  void (GLAPIENTRYP fn) (GLint, GLenum, GLsizei,
-                                         const GLvoid *))
-{
-    SET_by_offset(disp, _gloffset_VertexPointer, fn);
-}
-
-typedef GLboolean(GLAPIENTRYP _glptr_AreTexturesResident) (GLsizei,
-                                                           const GLuint *,
-                                                           GLboolean *);
-#define CALL_AreTexturesResident(disp, parameters) \
-    (* GET_AreTexturesResident(disp)) parameters
-static inline _glptr_AreTexturesResident
-GET_AreTexturesResident(struct _glapi_table *disp)
-{
-    return (_glptr_AreTexturesResident) (GET_by_offset
-                                         (disp, _gloffset_AreTexturesResident));
-}
-
-static inline void
-SET_AreTexturesResident(struct _glapi_table *disp,
-                        GLboolean(GLAPIENTRYP fn) (GLsizei, const GLuint *,
-                                                   GLboolean *))
-{
-    SET_by_offset(disp, _gloffset_AreTexturesResident, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_CopyTexImage1D) (GLenum, GLint, GLenum, GLint,
-                                                  GLint, GLsizei, GLint);
-#define CALL_CopyTexImage1D(disp, parameters) \
-    (* GET_CopyTexImage1D(disp)) parameters
-static inline _glptr_CopyTexImage1D
-GET_CopyTexImage1D(struct _glapi_table *disp)
-{
-    return (_glptr_CopyTexImage1D) (GET_by_offset
-                                    (disp, _gloffset_CopyTexImage1D));
-}
-
-static inline void
-SET_CopyTexImage1D(struct _glapi_table *disp,
-                   void (GLAPIENTRYP fn) (GLenum, GLint, GLenum, GLint, GLint,
-                                          GLsizei, GLint))
-{
-    SET_by_offset(disp, _gloffset_CopyTexImage1D, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_CopyTexImage2D) (GLenum, GLint, GLenum, GLint,
-                                                  GLint, GLsizei, GLsizei,
-                                                  GLint);
-#define CALL_CopyTexImage2D(disp, parameters) \
-    (* GET_CopyTexImage2D(disp)) parameters
-static inline _glptr_CopyTexImage2D
-GET_CopyTexImage2D(struct _glapi_table *disp)
-{
-    return (_glptr_CopyTexImage2D) (GET_by_offset
-                                    (disp, _gloffset_CopyTexImage2D));
-}
-
-static inline void
-SET_CopyTexImage2D(struct _glapi_table *disp,
-                   void (GLAPIENTRYP fn) (GLenum, GLint, GLenum, GLint, GLint,
-                                          GLsizei, GLsizei, GLint))
-{
-    SET_by_offset(disp, _gloffset_CopyTexImage2D, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_CopyTexSubImage1D) (GLenum, GLint, GLint,
-                                                     GLint, GLint, GLsizei);
-#define CALL_CopyTexSubImage1D(disp, parameters) \
-    (* GET_CopyTexSubImage1D(disp)) parameters
-static inline _glptr_CopyTexSubImage1D
-GET_CopyTexSubImage1D(struct _glapi_table *disp)
-{
-    return (_glptr_CopyTexSubImage1D) (GET_by_offset
-                                       (disp, _gloffset_CopyTexSubImage1D));
-}
-
-static inline void
-SET_CopyTexSubImage1D(struct _glapi_table *disp,
-                      void (GLAPIENTRYP fn) (GLenum, GLint, GLint, GLint, GLint,
-                                             GLsizei))
-{
-    SET_by_offset(disp, _gloffset_CopyTexSubImage1D, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_CopyTexSubImage2D) (GLenum, GLint, GLint,
-                                                     GLint, GLint, GLint,
-                                                     GLsizei, GLsizei);
-#define CALL_CopyTexSubImage2D(disp, parameters) \
-    (* GET_CopyTexSubImage2D(disp)) parameters
-static inline _glptr_CopyTexSubImage2D
-GET_CopyTexSubImage2D(struct _glapi_table *disp)
-{
-    return (_glptr_CopyTexSubImage2D) (GET_by_offset
-                                       (disp, _gloffset_CopyTexSubImage2D));
-}
-
-static inline void
-SET_CopyTexSubImage2D(struct _glapi_table *disp,
-                      void (GLAPIENTRYP fn) (GLenum, GLint, GLint, GLint, GLint,
-                                             GLint, GLsizei, GLsizei))
-{
-    SET_by_offset(disp, _gloffset_CopyTexSubImage2D, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_DeleteTextures) (GLsizei, const GLuint *);
-
-#define CALL_DeleteTextures(disp, parameters) \
-    (* GET_DeleteTextures(disp)) parameters
-static inline _glptr_DeleteTextures
-GET_DeleteTextures(struct _glapi_table *disp)
-{
-    return (_glptr_DeleteTextures) (GET_by_offset
-                                    (disp, _gloffset_DeleteTextures));
-}
-
-static inline void
-SET_DeleteTextures(struct _glapi_table *disp,
-                   void (GLAPIENTRYP fn) (GLsizei, const GLuint *))
-{
-    SET_by_offset(disp, _gloffset_DeleteTextures, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GenTextures) (GLsizei, GLuint *);
-
-#define CALL_GenTextures(disp, parameters) \
-    (* GET_GenTextures(disp)) parameters
-static inline _glptr_GenTextures
-GET_GenTextures(struct _glapi_table *disp)
-{
-    return (_glptr_GenTextures) (GET_by_offset(disp, _gloffset_GenTextures));
-}
-
-static inline void
-SET_GenTextures(struct _glapi_table *disp,
-                void (GLAPIENTRYP fn) (GLsizei, GLuint *))
-{
-    SET_by_offset(disp, _gloffset_GenTextures, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetPointerv) (GLenum, GLvoid **);
-
-#define CALL_GetPointerv(disp, parameters) \
-    (* GET_GetPointerv(disp)) parameters
-static inline _glptr_GetPointerv
-GET_GetPointerv(struct _glapi_table *disp)
-{
-    return (_glptr_GetPointerv) (GET_by_offset(disp, _gloffset_GetPointerv));
-}
-
-static inline void
-SET_GetPointerv(struct _glapi_table *disp,
-                void (GLAPIENTRYP fn) (GLenum, GLvoid **))
-{
-    SET_by_offset(disp, _gloffset_GetPointerv, fn);
-}
-
-typedef GLboolean(GLAPIENTRYP _glptr_IsTexture) (GLuint);
-
-#define CALL_IsTexture(disp, parameters) \
-    (* GET_IsTexture(disp)) parameters
-static inline _glptr_IsTexture
-GET_IsTexture(struct _glapi_table *disp)
-{
-    return (_glptr_IsTexture) (GET_by_offset(disp, _gloffset_IsTexture));
-}
-
-static inline void
-SET_IsTexture(struct _glapi_table *disp, GLboolean(GLAPIENTRYP fn) (GLuint))
-{
-    SET_by_offset(disp, _gloffset_IsTexture, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_PrioritizeTextures) (GLsizei, const GLuint *,
-                                                      const GLclampf *);
-#define CALL_PrioritizeTextures(disp, parameters) \
-    (* GET_PrioritizeTextures(disp)) parameters
-static inline _glptr_PrioritizeTextures
-GET_PrioritizeTextures(struct _glapi_table *disp)
-{
-    return (_glptr_PrioritizeTextures) (GET_by_offset
-                                        (disp, _gloffset_PrioritizeTextures));
-}
-
-static inline void
-SET_PrioritizeTextures(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLsizei, const GLuint *,
-                                              const GLclampf *))
-{
-    SET_by_offset(disp, _gloffset_PrioritizeTextures, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexSubImage1D) (GLenum, GLint, GLint, GLsizei,
-                                                 GLenum, GLenum,
-                                                 const GLvoid *);
-#define CALL_TexSubImage1D(disp, parameters) \
-    (* GET_TexSubImage1D(disp)) parameters
-static inline _glptr_TexSubImage1D
-GET_TexSubImage1D(struct _glapi_table *disp)
-{
-    return (_glptr_TexSubImage1D) (GET_by_offset
-                                   (disp, _gloffset_TexSubImage1D));
-}
-
-static inline void
-SET_TexSubImage1D(struct _glapi_table *disp,
-                  void (GLAPIENTRYP fn) (GLenum, GLint, GLint, GLsizei, GLenum,
-                                         GLenum, const GLvoid *))
-{
-    SET_by_offset(disp, _gloffset_TexSubImage1D, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexSubImage2D) (GLenum, GLint, GLint, GLint,
-                                                 GLsizei, GLsizei, GLenum,
-                                                 GLenum, const GLvoid *);
-#define CALL_TexSubImage2D(disp, parameters) \
-    (* GET_TexSubImage2D(disp)) parameters
-static inline _glptr_TexSubImage2D
-GET_TexSubImage2D(struct _glapi_table *disp)
-{
-    return (_glptr_TexSubImage2D) (GET_by_offset
-                                   (disp, _gloffset_TexSubImage2D));
-}
-
-static inline void
-SET_TexSubImage2D(struct _glapi_table *disp,
-                  void (GLAPIENTRYP fn) (GLenum, GLint, GLint, GLint, GLsizei,
-                                         GLsizei, GLenum, GLenum,
-                                         const GLvoid *))
-{
-    SET_by_offset(disp, _gloffset_TexSubImage2D, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_PopClientAttrib) (void);
-
-#define CALL_PopClientAttrib(disp, parameters) \
-    (* GET_PopClientAttrib(disp)) parameters
-static inline _glptr_PopClientAttrib
-GET_PopClientAttrib(struct _glapi_table *disp)
-{
-    return (_glptr_PopClientAttrib) (GET_by_offset
-                                     (disp, _gloffset_PopClientAttrib));
-}
-
-static inline void
-SET_PopClientAttrib(struct _glapi_table *disp, void (GLAPIENTRYP fn) (void))
-{
-    SET_by_offset(disp, _gloffset_PopClientAttrib, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_PushClientAttrib) (GLbitfield);
-
-#define CALL_PushClientAttrib(disp, parameters) \
-    (* GET_PushClientAttrib(disp)) parameters
-static inline _glptr_PushClientAttrib
-GET_PushClientAttrib(struct _glapi_table *disp)
-{
-    return (_glptr_PushClientAttrib) (GET_by_offset
-                                      (disp, _gloffset_PushClientAttrib));
-}
-
-static inline void
-SET_PushClientAttrib(struct _glapi_table *disp,
-                     void (GLAPIENTRYP fn) (GLbitfield))
-{
-    SET_by_offset(disp, _gloffset_PushClientAttrib, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_BlendColor) (GLclampf, GLclampf, GLclampf,
-                                              GLclampf);
-#define CALL_BlendColor(disp, parameters) \
-    (* GET_BlendColor(disp)) parameters
-static inline _glptr_BlendColor
-GET_BlendColor(struct _glapi_table *disp)
-{
-    return (_glptr_BlendColor) (GET_by_offset(disp, _gloffset_BlendColor));
-}
-
-static inline void
-SET_BlendColor(struct _glapi_table *disp,
-               void (GLAPIENTRYP fn) (GLclampf, GLclampf, GLclampf, GLclampf))
-{
-    SET_by_offset(disp, _gloffset_BlendColor, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_BlendEquation) (GLenum);
-
-#define CALL_BlendEquation(disp, parameters) \
-    (* GET_BlendEquation(disp)) parameters
-static inline _glptr_BlendEquation
-GET_BlendEquation(struct _glapi_table *disp)
-{
-    return (_glptr_BlendEquation) (GET_by_offset
-                                   (disp, _gloffset_BlendEquation));
-}
-
-static inline void
-SET_BlendEquation(struct _glapi_table *disp, void (GLAPIENTRYP fn) (GLenum))
-{
-    SET_by_offset(disp, _gloffset_BlendEquation, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_DrawRangeElements) (GLenum, GLuint, GLuint,
-                                                     GLsizei, GLenum,
-                                                     const GLvoid *);
-#define CALL_DrawRangeElements(disp, parameters) \
-    (* GET_DrawRangeElements(disp)) parameters
-static inline _glptr_DrawRangeElements
-GET_DrawRangeElements(struct _glapi_table *disp)
-{
-    return (_glptr_DrawRangeElements) (GET_by_offset
-                                       (disp, _gloffset_DrawRangeElements));
-}
-
-static inline void
-SET_DrawRangeElements(struct _glapi_table *disp,
-                      void (GLAPIENTRYP fn) (GLenum, GLuint, GLuint, GLsizei,
-                                             GLenum, const GLvoid *))
-{
-    SET_by_offset(disp, _gloffset_DrawRangeElements, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ColorTable) (GLenum, GLenum, GLsizei, GLenum,
-                                              GLenum, const GLvoid *);
-#define CALL_ColorTable(disp, parameters) \
-    (* GET_ColorTable(disp)) parameters
-static inline _glptr_ColorTable
-GET_ColorTable(struct _glapi_table *disp)
-{
-    return (_glptr_ColorTable) (GET_by_offset(disp, _gloffset_ColorTable));
-}
-
-static inline void
-SET_ColorTable(struct _glapi_table *disp,
-               void (GLAPIENTRYP fn) (GLenum, GLenum, GLsizei, GLenum, GLenum,
-                                      const GLvoid *))
-{
-    SET_by_offset(disp, _gloffset_ColorTable, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ColorTableParameterfv) (GLenum, GLenum,
-                                                         const GLfloat *);
-#define CALL_ColorTableParameterfv(disp, parameters) \
-    (* GET_ColorTableParameterfv(disp)) parameters
-static inline _glptr_ColorTableParameterfv
-GET_ColorTableParameterfv(struct _glapi_table *disp)
-{
-    return (_glptr_ColorTableParameterfv) (GET_by_offset
-                                           (disp,
-                                            _gloffset_ColorTableParameterfv));
-}
-
-static inline void
-SET_ColorTableParameterfv(struct _glapi_table *disp,
-                          void (GLAPIENTRYP fn) (GLenum, GLenum,
-                                                 const GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_ColorTableParameterfv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ColorTableParameteriv) (GLenum, GLenum,
-                                                         const GLint *);
-#define CALL_ColorTableParameteriv(disp, parameters) \
-    (* GET_ColorTableParameteriv(disp)) parameters
-static inline _glptr_ColorTableParameteriv
-GET_ColorTableParameteriv(struct _glapi_table *disp)
-{
-    return (_glptr_ColorTableParameteriv) (GET_by_offset
-                                           (disp,
-                                            _gloffset_ColorTableParameteriv));
-}
-
-static inline void
-SET_ColorTableParameteriv(struct _glapi_table *disp,
-                          void (GLAPIENTRYP fn) (GLenum, GLenum, const GLint *))
-{
-    SET_by_offset(disp, _gloffset_ColorTableParameteriv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_CopyColorTable) (GLenum, GLenum, GLint, GLint,
-                                                  GLsizei);
-#define CALL_CopyColorTable(disp, parameters) \
-    (* GET_CopyColorTable(disp)) parameters
-static inline _glptr_CopyColorTable
-GET_CopyColorTable(struct _glapi_table *disp)
-{
-    return (_glptr_CopyColorTable) (GET_by_offset
-                                    (disp, _gloffset_CopyColorTable));
-}
-
-static inline void
-SET_CopyColorTable(struct _glapi_table *disp,
-                   void (GLAPIENTRYP fn) (GLenum, GLenum, GLint, GLint,
-                                          GLsizei))
-{
-    SET_by_offset(disp, _gloffset_CopyColorTable, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetColorTable) (GLenum, GLenum, GLenum,
-                                                 GLvoid *);
-#define CALL_GetColorTable(disp, parameters) \
-    (* GET_GetColorTable(disp)) parameters
-static inline _glptr_GetColorTable
-GET_GetColorTable(struct _glapi_table *disp)
-{
-    return (_glptr_GetColorTable) (GET_by_offset
-                                   (disp, _gloffset_GetColorTable));
-}
-
-static inline void
-SET_GetColorTable(struct _glapi_table *disp,
-                  void (GLAPIENTRYP fn) (GLenum, GLenum, GLenum, GLvoid *))
-{
-    SET_by_offset(disp, _gloffset_GetColorTable, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetColorTableParameterfv) (GLenum, GLenum,
-                                                            GLfloat *);
-#define CALL_GetColorTableParameterfv(disp, parameters) \
-    (* GET_GetColorTableParameterfv(disp)) parameters
-static inline _glptr_GetColorTableParameterfv
-GET_GetColorTableParameterfv(struct _glapi_table *disp)
-{
-    return (_glptr_GetColorTableParameterfv) (GET_by_offset
-                                              (disp,
-                                               _gloffset_GetColorTableParameterfv));
-}
-
-static inline void
-SET_GetColorTableParameterfv(struct _glapi_table *disp,
-                             void (GLAPIENTRYP fn) (GLenum, GLenum, GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_GetColorTableParameterfv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetColorTableParameteriv) (GLenum, GLenum,
-                                                            GLint *);
-#define CALL_GetColorTableParameteriv(disp, parameters) \
-    (* GET_GetColorTableParameteriv(disp)) parameters
-static inline _glptr_GetColorTableParameteriv
-GET_GetColorTableParameteriv(struct _glapi_table *disp)
-{
-    return (_glptr_GetColorTableParameteriv) (GET_by_offset
-                                              (disp,
-                                               _gloffset_GetColorTableParameteriv));
-}
-
-static inline void
-SET_GetColorTableParameteriv(struct _glapi_table *disp,
-                             void (GLAPIENTRYP fn) (GLenum, GLenum, GLint *))
-{
-    SET_by_offset(disp, _gloffset_GetColorTableParameteriv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ColorSubTable) (GLenum, GLsizei, GLsizei,
-                                                 GLenum, GLenum,
-                                                 const GLvoid *);
-#define CALL_ColorSubTable(disp, parameters) \
-    (* GET_ColorSubTable(disp)) parameters
-static inline _glptr_ColorSubTable
-GET_ColorSubTable(struct _glapi_table *disp)
-{
-    return (_glptr_ColorSubTable) (GET_by_offset
-                                   (disp, _gloffset_ColorSubTable));
-}
-
-static inline void
-SET_ColorSubTable(struct _glapi_table *disp,
-                  void (GLAPIENTRYP fn) (GLenum, GLsizei, GLsizei, GLenum,
-                                         GLenum, const GLvoid *))
-{
-    SET_by_offset(disp, _gloffset_ColorSubTable, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_CopyColorSubTable) (GLenum, GLsizei, GLint,
-                                                     GLint, GLsizei);
-#define CALL_CopyColorSubTable(disp, parameters) \
-    (* GET_CopyColorSubTable(disp)) parameters
-static inline _glptr_CopyColorSubTable
-GET_CopyColorSubTable(struct _glapi_table *disp)
-{
-    return (_glptr_CopyColorSubTable) (GET_by_offset
-                                       (disp, _gloffset_CopyColorSubTable));
-}
-
-static inline void
-SET_CopyColorSubTable(struct _glapi_table *disp,
-                      void (GLAPIENTRYP fn) (GLenum, GLsizei, GLint, GLint,
-                                             GLsizei))
-{
-    SET_by_offset(disp, _gloffset_CopyColorSubTable, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ConvolutionFilter1D) (GLenum, GLenum, GLsizei,
-                                                       GLenum, GLenum,
-                                                       const GLvoid *);
-#define CALL_ConvolutionFilter1D(disp, parameters) \
-    (* GET_ConvolutionFilter1D(disp)) parameters
-static inline _glptr_ConvolutionFilter1D
-GET_ConvolutionFilter1D(struct _glapi_table *disp)
-{
-    return (_glptr_ConvolutionFilter1D) (GET_by_offset
-                                         (disp, _gloffset_ConvolutionFilter1D));
-}
-
-static inline void
-SET_ConvolutionFilter1D(struct _glapi_table *disp,
-                        void (GLAPIENTRYP fn) (GLenum, GLenum, GLsizei, GLenum,
-                                               GLenum, const GLvoid *))
-{
-    SET_by_offset(disp, _gloffset_ConvolutionFilter1D, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ConvolutionFilter2D) (GLenum, GLenum, GLsizei,
-                                                       GLsizei, GLenum, GLenum,
-                                                       const GLvoid *);
-#define CALL_ConvolutionFilter2D(disp, parameters) \
-    (* GET_ConvolutionFilter2D(disp)) parameters
-static inline _glptr_ConvolutionFilter2D
-GET_ConvolutionFilter2D(struct _glapi_table *disp)
-{
-    return (_glptr_ConvolutionFilter2D) (GET_by_offset
-                                         (disp, _gloffset_ConvolutionFilter2D));
-}
-
-static inline void
-SET_ConvolutionFilter2D(struct _glapi_table *disp,
-                        void (GLAPIENTRYP fn) (GLenum, GLenum, GLsizei, GLsizei,
-                                               GLenum, GLenum, const GLvoid *))
-{
-    SET_by_offset(disp, _gloffset_ConvolutionFilter2D, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ConvolutionParameterf) (GLenum, GLenum,
-                                                         GLfloat);
-#define CALL_ConvolutionParameterf(disp, parameters) \
-    (* GET_ConvolutionParameterf(disp)) parameters
-static inline _glptr_ConvolutionParameterf
-GET_ConvolutionParameterf(struct _glapi_table *disp)
-{
-    return (_glptr_ConvolutionParameterf) (GET_by_offset
-                                           (disp,
-                                            _gloffset_ConvolutionParameterf));
-}
-
-static inline void
-SET_ConvolutionParameterf(struct _glapi_table *disp,
-                          void (GLAPIENTRYP fn) (GLenum, GLenum, GLfloat))
-{
-    SET_by_offset(disp, _gloffset_ConvolutionParameterf, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ConvolutionParameterfv) (GLenum, GLenum,
-                                                          const GLfloat *);
-#define CALL_ConvolutionParameterfv(disp, parameters) \
-    (* GET_ConvolutionParameterfv(disp)) parameters
-static inline _glptr_ConvolutionParameterfv
-GET_ConvolutionParameterfv(struct _glapi_table *disp)
-{
-    return (_glptr_ConvolutionParameterfv) (GET_by_offset
-                                            (disp,
-                                             _gloffset_ConvolutionParameterfv));
-}
-
-static inline void
-SET_ConvolutionParameterfv(struct _glapi_table *disp,
-                           void (GLAPIENTRYP fn) (GLenum, GLenum,
-                                                  const GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_ConvolutionParameterfv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ConvolutionParameteri) (GLenum, GLenum, GLint);
-
-#define CALL_ConvolutionParameteri(disp, parameters) \
-    (* GET_ConvolutionParameteri(disp)) parameters
-static inline _glptr_ConvolutionParameteri
-GET_ConvolutionParameteri(struct _glapi_table *disp)
-{
-    return (_glptr_ConvolutionParameteri) (GET_by_offset
-                                           (disp,
-                                            _gloffset_ConvolutionParameteri));
-}
-
-static inline void
-SET_ConvolutionParameteri(struct _glapi_table *disp,
-                          void (GLAPIENTRYP fn) (GLenum, GLenum, GLint))
-{
-    SET_by_offset(disp, _gloffset_ConvolutionParameteri, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ConvolutionParameteriv) (GLenum, GLenum,
-                                                          const GLint *);
-#define CALL_ConvolutionParameteriv(disp, parameters) \
-    (* GET_ConvolutionParameteriv(disp)) parameters
-static inline _glptr_ConvolutionParameteriv
-GET_ConvolutionParameteriv(struct _glapi_table *disp)
-{
-    return (_glptr_ConvolutionParameteriv) (GET_by_offset
-                                            (disp,
-                                             _gloffset_ConvolutionParameteriv));
-}
-
-static inline void
-SET_ConvolutionParameteriv(struct _glapi_table *disp,
-                           void (GLAPIENTRYP fn) (GLenum, GLenum,
-                                                  const GLint *))
-{
-    SET_by_offset(disp, _gloffset_ConvolutionParameteriv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_CopyConvolutionFilter1D) (GLenum, GLenum,
-                                                           GLint, GLint,
-                                                           GLsizei);
-#define CALL_CopyConvolutionFilter1D(disp, parameters) \
-    (* GET_CopyConvolutionFilter1D(disp)) parameters
-static inline _glptr_CopyConvolutionFilter1D
-GET_CopyConvolutionFilter1D(struct _glapi_table *disp)
-{
-    return (_glptr_CopyConvolutionFilter1D) (GET_by_offset
-                                             (disp,
-                                              _gloffset_CopyConvolutionFilter1D));
-}
-
-static inline void
-SET_CopyConvolutionFilter1D(struct _glapi_table *disp,
-                            void (GLAPIENTRYP fn) (GLenum, GLenum, GLint, GLint,
-                                                   GLsizei))
-{
-    SET_by_offset(disp, _gloffset_CopyConvolutionFilter1D, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_CopyConvolutionFilter2D) (GLenum, GLenum,
-                                                           GLint, GLint,
-                                                           GLsizei, GLsizei);
-#define CALL_CopyConvolutionFilter2D(disp, parameters) \
-    (* GET_CopyConvolutionFilter2D(disp)) parameters
-static inline _glptr_CopyConvolutionFilter2D
-GET_CopyConvolutionFilter2D(struct _glapi_table *disp)
-{
-    return (_glptr_CopyConvolutionFilter2D) (GET_by_offset
-                                             (disp,
-                                              _gloffset_CopyConvolutionFilter2D));
-}
-
-static inline void
-SET_CopyConvolutionFilter2D(struct _glapi_table *disp,
-                            void (GLAPIENTRYP fn) (GLenum, GLenum, GLint, GLint,
-                                                   GLsizei, GLsizei))
-{
-    SET_by_offset(disp, _gloffset_CopyConvolutionFilter2D, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetConvolutionFilter) (GLenum, GLenum, GLenum,
-                                                        GLvoid *);
-#define CALL_GetConvolutionFilter(disp, parameters) \
-    (* GET_GetConvolutionFilter(disp)) parameters
-static inline _glptr_GetConvolutionFilter
-GET_GetConvolutionFilter(struct _glapi_table *disp)
-{
-    return (_glptr_GetConvolutionFilter) (GET_by_offset
-                                          (disp,
-                                           _gloffset_GetConvolutionFilter));
-}
-
-static inline void
-SET_GetConvolutionFilter(struct _glapi_table *disp,
-                         void (GLAPIENTRYP fn) (GLenum, GLenum, GLenum,
-                                                GLvoid *))
-{
-    SET_by_offset(disp, _gloffset_GetConvolutionFilter, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetConvolutionParameterfv) (GLenum, GLenum,
-                                                             GLfloat *);
-#define CALL_GetConvolutionParameterfv(disp, parameters) \
-    (* GET_GetConvolutionParameterfv(disp)) parameters
-static inline _glptr_GetConvolutionParameterfv
-GET_GetConvolutionParameterfv(struct _glapi_table *disp)
-{
-    return (_glptr_GetConvolutionParameterfv) (GET_by_offset
-                                               (disp,
-                                                _gloffset_GetConvolutionParameterfv));
-}
-
-static inline void
-SET_GetConvolutionParameterfv(struct _glapi_table *disp,
-                              void (GLAPIENTRYP fn) (GLenum, GLenum, GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_GetConvolutionParameterfv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetConvolutionParameteriv) (GLenum, GLenum,
-                                                             GLint *);
-#define CALL_GetConvolutionParameteriv(disp, parameters) \
-    (* GET_GetConvolutionParameteriv(disp)) parameters
-static inline _glptr_GetConvolutionParameteriv
-GET_GetConvolutionParameteriv(struct _glapi_table *disp)
-{
-    return (_glptr_GetConvolutionParameteriv) (GET_by_offset
-                                               (disp,
-                                                _gloffset_GetConvolutionParameteriv));
-}
-
-static inline void
-SET_GetConvolutionParameteriv(struct _glapi_table *disp,
-                              void (GLAPIENTRYP fn) (GLenum, GLenum, GLint *))
-{
-    SET_by_offset(disp, _gloffset_GetConvolutionParameteriv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetSeparableFilter) (GLenum, GLenum, GLenum,
-                                                      GLvoid *, GLvoid *,
-                                                      GLvoid *);
-#define CALL_GetSeparableFilter(disp, parameters) \
-    (* GET_GetSeparableFilter(disp)) parameters
-static inline _glptr_GetSeparableFilter
-GET_GetSeparableFilter(struct _glapi_table *disp)
-{
-    return (_glptr_GetSeparableFilter) (GET_by_offset
-                                        (disp, _gloffset_GetSeparableFilter));
-}
-
-static inline void
-SET_GetSeparableFilter(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLenum, GLenum, GLenum, GLvoid *,
-                                              GLvoid *, GLvoid *))
-{
-    SET_by_offset(disp, _gloffset_GetSeparableFilter, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_SeparableFilter2D) (GLenum, GLenum, GLsizei,
-                                                     GLsizei, GLenum, GLenum,
-                                                     const GLvoid *,
-                                                     const GLvoid *);
-#define CALL_SeparableFilter2D(disp, parameters) \
-    (* GET_SeparableFilter2D(disp)) parameters
-static inline _glptr_SeparableFilter2D
-GET_SeparableFilter2D(struct _glapi_table *disp)
-{
-    return (_glptr_SeparableFilter2D) (GET_by_offset
-                                       (disp, _gloffset_SeparableFilter2D));
-}
-
-static inline void
-SET_SeparableFilter2D(struct _glapi_table *disp,
-                      void (GLAPIENTRYP fn) (GLenum, GLenum, GLsizei, GLsizei,
-                                             GLenum, GLenum, const GLvoid *,
-                                             const GLvoid *))
-{
-    SET_by_offset(disp, _gloffset_SeparableFilter2D, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetHistogram) (GLenum, GLboolean, GLenum,
-                                                GLenum, GLvoid *);
-#define CALL_GetHistogram(disp, parameters) \
-    (* GET_GetHistogram(disp)) parameters
-static inline _glptr_GetHistogram
-GET_GetHistogram(struct _glapi_table *disp)
-{
-    return (_glptr_GetHistogram) (GET_by_offset(disp, _gloffset_GetHistogram));
-}
-
-static inline void
-SET_GetHistogram(struct _glapi_table *disp,
-                 void (GLAPIENTRYP fn) (GLenum, GLboolean, GLenum, GLenum,
-                                        GLvoid *))
-{
-    SET_by_offset(disp, _gloffset_GetHistogram, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetHistogramParameterfv) (GLenum, GLenum,
-                                                           GLfloat *);
-#define CALL_GetHistogramParameterfv(disp, parameters) \
-    (* GET_GetHistogramParameterfv(disp)) parameters
-static inline _glptr_GetHistogramParameterfv
-GET_GetHistogramParameterfv(struct _glapi_table *disp)
-{
-    return (_glptr_GetHistogramParameterfv) (GET_by_offset
-                                             (disp,
-                                              _gloffset_GetHistogramParameterfv));
-}
-
-static inline void
-SET_GetHistogramParameterfv(struct _glapi_table *disp,
-                            void (GLAPIENTRYP fn) (GLenum, GLenum, GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_GetHistogramParameterfv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetHistogramParameteriv) (GLenum, GLenum,
-                                                           GLint *);
-#define CALL_GetHistogramParameteriv(disp, parameters) \
-    (* GET_GetHistogramParameteriv(disp)) parameters
-static inline _glptr_GetHistogramParameteriv
-GET_GetHistogramParameteriv(struct _glapi_table *disp)
-{
-    return (_glptr_GetHistogramParameteriv) (GET_by_offset
-                                             (disp,
-                                              _gloffset_GetHistogramParameteriv));
-}
-
-static inline void
-SET_GetHistogramParameteriv(struct _glapi_table *disp,
-                            void (GLAPIENTRYP fn) (GLenum, GLenum, GLint *))
-{
-    SET_by_offset(disp, _gloffset_GetHistogramParameteriv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetMinmax) (GLenum, GLboolean, GLenum, GLenum,
-                                             GLvoid *);
-#define CALL_GetMinmax(disp, parameters) \
-    (* GET_GetMinmax(disp)) parameters
-static inline _glptr_GetMinmax
-GET_GetMinmax(struct _glapi_table *disp)
-{
-    return (_glptr_GetMinmax) (GET_by_offset(disp, _gloffset_GetMinmax));
-}
-
-static inline void
-SET_GetMinmax(struct _glapi_table *disp,
-              void (GLAPIENTRYP fn) (GLenum, GLboolean, GLenum, GLenum,
-                                     GLvoid *))
-{
-    SET_by_offset(disp, _gloffset_GetMinmax, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetMinmaxParameterfv) (GLenum, GLenum,
-                                                        GLfloat *);
-#define CALL_GetMinmaxParameterfv(disp, parameters) \
-    (* GET_GetMinmaxParameterfv(disp)) parameters
-static inline _glptr_GetMinmaxParameterfv
-GET_GetMinmaxParameterfv(struct _glapi_table *disp)
-{
-    return (_glptr_GetMinmaxParameterfv) (GET_by_offset
-                                          (disp,
-                                           _gloffset_GetMinmaxParameterfv));
-}
-
-static inline void
-SET_GetMinmaxParameterfv(struct _glapi_table *disp,
-                         void (GLAPIENTRYP fn) (GLenum, GLenum, GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_GetMinmaxParameterfv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetMinmaxParameteriv) (GLenum, GLenum,
-                                                        GLint *);
-#define CALL_GetMinmaxParameteriv(disp, parameters) \
-    (* GET_GetMinmaxParameteriv(disp)) parameters
-static inline _glptr_GetMinmaxParameteriv
-GET_GetMinmaxParameteriv(struct _glapi_table *disp)
-{
-    return (_glptr_GetMinmaxParameteriv) (GET_by_offset
-                                          (disp,
-                                           _gloffset_GetMinmaxParameteriv));
-}
-
-static inline void
-SET_GetMinmaxParameteriv(struct _glapi_table *disp,
-                         void (GLAPIENTRYP fn) (GLenum, GLenum, GLint *))
-{
-    SET_by_offset(disp, _gloffset_GetMinmaxParameteriv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Histogram) (GLenum, GLsizei, GLenum,
-                                             GLboolean);
-#define CALL_Histogram(disp, parameters) \
-    (* GET_Histogram(disp)) parameters
-static inline _glptr_Histogram
-GET_Histogram(struct _glapi_table *disp)
-{
-    return (_glptr_Histogram) (GET_by_offset(disp, _gloffset_Histogram));
-}
-
-static inline void
-SET_Histogram(struct _glapi_table *disp,
-              void (GLAPIENTRYP fn) (GLenum, GLsizei, GLenum, GLboolean))
-{
-    SET_by_offset(disp, _gloffset_Histogram, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Minmax) (GLenum, GLenum, GLboolean);
-
-#define CALL_Minmax(disp, parameters) \
-    (* GET_Minmax(disp)) parameters
-static inline _glptr_Minmax
-GET_Minmax(struct _glapi_table *disp)
-{
-    return (_glptr_Minmax) (GET_by_offset(disp, _gloffset_Minmax));
-}
-
-static inline void
-SET_Minmax(struct _glapi_table *disp,
-           void (GLAPIENTRYP fn) (GLenum, GLenum, GLboolean))
-{
-    SET_by_offset(disp, _gloffset_Minmax, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ResetHistogram) (GLenum);
-
-#define CALL_ResetHistogram(disp, parameters) \
-    (* GET_ResetHistogram(disp)) parameters
-static inline _glptr_ResetHistogram
-GET_ResetHistogram(struct _glapi_table *disp)
-{
-    return (_glptr_ResetHistogram) (GET_by_offset
-                                    (disp, _gloffset_ResetHistogram));
-}
-
-static inline void
-SET_ResetHistogram(struct _glapi_table *disp, void (GLAPIENTRYP fn) (GLenum))
-{
-    SET_by_offset(disp, _gloffset_ResetHistogram, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ResetMinmax) (GLenum);
-
-#define CALL_ResetMinmax(disp, parameters) \
-    (* GET_ResetMinmax(disp)) parameters
-static inline _glptr_ResetMinmax
-GET_ResetMinmax(struct _glapi_table *disp)
-{
-    return (_glptr_ResetMinmax) (GET_by_offset(disp, _gloffset_ResetMinmax));
-}
-
-static inline void
-SET_ResetMinmax(struct _glapi_table *disp, void (GLAPIENTRYP fn) (GLenum))
-{
-    SET_by_offset(disp, _gloffset_ResetMinmax, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexImage3D) (GLenum, GLint, GLint, GLsizei,
-                                              GLsizei, GLsizei, GLint, GLenum,
-                                              GLenum, const GLvoid *);
-#define CALL_TexImage3D(disp, parameters) \
-    (* GET_TexImage3D(disp)) parameters
-static inline _glptr_TexImage3D
-GET_TexImage3D(struct _glapi_table *disp)
-{
-    return (_glptr_TexImage3D) (GET_by_offset(disp, _gloffset_TexImage3D));
-}
-
-static inline void
-SET_TexImage3D(struct _glapi_table *disp,
-               void (GLAPIENTRYP fn) (GLenum, GLint, GLint, GLsizei, GLsizei,
-                                      GLsizei, GLint, GLenum, GLenum,
-                                      const GLvoid *))
-{
-    SET_by_offset(disp, _gloffset_TexImage3D, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexSubImage3D) (GLenum, GLint, GLint, GLint,
-                                                 GLint, GLsizei, GLsizei,
-                                                 GLsizei, GLenum, GLenum,
-                                                 const GLvoid *);
-#define CALL_TexSubImage3D(disp, parameters) \
-    (* GET_TexSubImage3D(disp)) parameters
-static inline _glptr_TexSubImage3D
-GET_TexSubImage3D(struct _glapi_table *disp)
-{
-    return (_glptr_TexSubImage3D) (GET_by_offset
-                                   (disp, _gloffset_TexSubImage3D));
-}
-
-static inline void
-SET_TexSubImage3D(struct _glapi_table *disp,
-                  void (GLAPIENTRYP fn) (GLenum, GLint, GLint, GLint, GLint,
-                                         GLsizei, GLsizei, GLsizei, GLenum,
-                                         GLenum, const GLvoid *))
-{
-    SET_by_offset(disp, _gloffset_TexSubImage3D, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_CopyTexSubImage3D) (GLenum, GLint, GLint,
-                                                     GLint, GLint, GLint, GLint,
-                                                     GLsizei, GLsizei);
-#define CALL_CopyTexSubImage3D(disp, parameters) \
-    (* GET_CopyTexSubImage3D(disp)) parameters
-static inline _glptr_CopyTexSubImage3D
-GET_CopyTexSubImage3D(struct _glapi_table *disp)
-{
-    return (_glptr_CopyTexSubImage3D) (GET_by_offset
-                                       (disp, _gloffset_CopyTexSubImage3D));
-}
-
-static inline void
-SET_CopyTexSubImage3D(struct _glapi_table *disp,
-                      void (GLAPIENTRYP fn) (GLenum, GLint, GLint, GLint, GLint,
-                                             GLint, GLint, GLsizei, GLsizei))
-{
-    SET_by_offset(disp, _gloffset_CopyTexSubImage3D, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ActiveTextureARB) (GLenum);
-
-#define CALL_ActiveTextureARB(disp, parameters) \
-    (* GET_ActiveTextureARB(disp)) parameters
-static inline _glptr_ActiveTextureARB
-GET_ActiveTextureARB(struct _glapi_table *disp)
-{
-    return (_glptr_ActiveTextureARB) (GET_by_offset
-                                      (disp, _gloffset_ActiveTextureARB));
-}
-
-static inline void
-SET_ActiveTextureARB(struct _glapi_table *disp, void (GLAPIENTRYP fn) (GLenum))
-{
-    SET_by_offset(disp, _gloffset_ActiveTextureARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ClientActiveTextureARB) (GLenum);
-
-#define CALL_ClientActiveTextureARB(disp, parameters) \
-    (* GET_ClientActiveTextureARB(disp)) parameters
-static inline _glptr_ClientActiveTextureARB
-GET_ClientActiveTextureARB(struct _glapi_table *disp)
-{
-    return (_glptr_ClientActiveTextureARB) (GET_by_offset
-                                            (disp,
-                                             _gloffset_ClientActiveTextureARB));
-}
-
-static inline void
-SET_ClientActiveTextureARB(struct _glapi_table *disp,
-                           void (GLAPIENTRYP fn) (GLenum))
-{
-    SET_by_offset(disp, _gloffset_ClientActiveTextureARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiTexCoord1dARB) (GLenum, GLdouble);
-
-#define CALL_MultiTexCoord1dARB(disp, parameters) \
-    (* GET_MultiTexCoord1dARB(disp)) parameters
-static inline _glptr_MultiTexCoord1dARB
-GET_MultiTexCoord1dARB(struct _glapi_table *disp)
-{
-    return (_glptr_MultiTexCoord1dARB) (GET_by_offset
-                                        (disp, _gloffset_MultiTexCoord1dARB));
-}
-
-static inline void
-SET_MultiTexCoord1dARB(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLenum, GLdouble))
-{
-    SET_by_offset(disp, _gloffset_MultiTexCoord1dARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiTexCoord1dvARB) (GLenum,
-                                                       const GLdouble *);
-#define CALL_MultiTexCoord1dvARB(disp, parameters) \
-    (* GET_MultiTexCoord1dvARB(disp)) parameters
-static inline _glptr_MultiTexCoord1dvARB
-GET_MultiTexCoord1dvARB(struct _glapi_table *disp)
-{
-    return (_glptr_MultiTexCoord1dvARB) (GET_by_offset
-                                         (disp, _gloffset_MultiTexCoord1dvARB));
-}
-
-static inline void
-SET_MultiTexCoord1dvARB(struct _glapi_table *disp,
-                        void (GLAPIENTRYP fn) (GLenum, const GLdouble *))
-{
-    SET_by_offset(disp, _gloffset_MultiTexCoord1dvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiTexCoord1fARB) (GLenum, GLfloat);
-
-#define CALL_MultiTexCoord1fARB(disp, parameters) \
-    (* GET_MultiTexCoord1fARB(disp)) parameters
-static inline _glptr_MultiTexCoord1fARB
-GET_MultiTexCoord1fARB(struct _glapi_table *disp)
-{
-    return (_glptr_MultiTexCoord1fARB) (GET_by_offset
-                                        (disp, _gloffset_MultiTexCoord1fARB));
-}
-
-static inline void
-SET_MultiTexCoord1fARB(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLenum, GLfloat))
-{
-    SET_by_offset(disp, _gloffset_MultiTexCoord1fARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiTexCoord1fvARB) (GLenum, const GLfloat *);
-
-#define CALL_MultiTexCoord1fvARB(disp, parameters) \
-    (* GET_MultiTexCoord1fvARB(disp)) parameters
-static inline _glptr_MultiTexCoord1fvARB
-GET_MultiTexCoord1fvARB(struct _glapi_table *disp)
-{
-    return (_glptr_MultiTexCoord1fvARB) (GET_by_offset
-                                         (disp, _gloffset_MultiTexCoord1fvARB));
-}
-
-static inline void
-SET_MultiTexCoord1fvARB(struct _glapi_table *disp,
-                        void (GLAPIENTRYP fn) (GLenum, const GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_MultiTexCoord1fvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiTexCoord1iARB) (GLenum, GLint);
-
-#define CALL_MultiTexCoord1iARB(disp, parameters) \
-    (* GET_MultiTexCoord1iARB(disp)) parameters
-static inline _glptr_MultiTexCoord1iARB
-GET_MultiTexCoord1iARB(struct _glapi_table *disp)
-{
-    return (_glptr_MultiTexCoord1iARB) (GET_by_offset
-                                        (disp, _gloffset_MultiTexCoord1iARB));
-}
-
-static inline void
-SET_MultiTexCoord1iARB(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLenum, GLint))
-{
-    SET_by_offset(disp, _gloffset_MultiTexCoord1iARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiTexCoord1ivARB) (GLenum, const GLint *);
-
-#define CALL_MultiTexCoord1ivARB(disp, parameters) \
-    (* GET_MultiTexCoord1ivARB(disp)) parameters
-static inline _glptr_MultiTexCoord1ivARB
-GET_MultiTexCoord1ivARB(struct _glapi_table *disp)
-{
-    return (_glptr_MultiTexCoord1ivARB) (GET_by_offset
-                                         (disp, _gloffset_MultiTexCoord1ivARB));
-}
-
-static inline void
-SET_MultiTexCoord1ivARB(struct _glapi_table *disp,
-                        void (GLAPIENTRYP fn) (GLenum, const GLint *))
-{
-    SET_by_offset(disp, _gloffset_MultiTexCoord1ivARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiTexCoord1sARB) (GLenum, GLshort);
-
-#define CALL_MultiTexCoord1sARB(disp, parameters) \
-    (* GET_MultiTexCoord1sARB(disp)) parameters
-static inline _glptr_MultiTexCoord1sARB
-GET_MultiTexCoord1sARB(struct _glapi_table *disp)
-{
-    return (_glptr_MultiTexCoord1sARB) (GET_by_offset
-                                        (disp, _gloffset_MultiTexCoord1sARB));
-}
-
-static inline void
-SET_MultiTexCoord1sARB(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLenum, GLshort))
-{
-    SET_by_offset(disp, _gloffset_MultiTexCoord1sARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiTexCoord1svARB) (GLenum, const GLshort *);
-
-#define CALL_MultiTexCoord1svARB(disp, parameters) \
-    (* GET_MultiTexCoord1svARB(disp)) parameters
-static inline _glptr_MultiTexCoord1svARB
-GET_MultiTexCoord1svARB(struct _glapi_table *disp)
-{
-    return (_glptr_MultiTexCoord1svARB) (GET_by_offset
-                                         (disp, _gloffset_MultiTexCoord1svARB));
-}
-
-static inline void
-SET_MultiTexCoord1svARB(struct _glapi_table *disp,
-                        void (GLAPIENTRYP fn) (GLenum, const GLshort *))
-{
-    SET_by_offset(disp, _gloffset_MultiTexCoord1svARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiTexCoord2dARB) (GLenum, GLdouble,
-                                                      GLdouble);
-#define CALL_MultiTexCoord2dARB(disp, parameters) \
-    (* GET_MultiTexCoord2dARB(disp)) parameters
-static inline _glptr_MultiTexCoord2dARB
-GET_MultiTexCoord2dARB(struct _glapi_table *disp)
-{
-    return (_glptr_MultiTexCoord2dARB) (GET_by_offset
-                                        (disp, _gloffset_MultiTexCoord2dARB));
-}
-
-static inline void
-SET_MultiTexCoord2dARB(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLenum, GLdouble, GLdouble))
-{
-    SET_by_offset(disp, _gloffset_MultiTexCoord2dARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiTexCoord2dvARB) (GLenum,
-                                                       const GLdouble *);
-#define CALL_MultiTexCoord2dvARB(disp, parameters) \
-    (* GET_MultiTexCoord2dvARB(disp)) parameters
-static inline _glptr_MultiTexCoord2dvARB
-GET_MultiTexCoord2dvARB(struct _glapi_table *disp)
-{
-    return (_glptr_MultiTexCoord2dvARB) (GET_by_offset
-                                         (disp, _gloffset_MultiTexCoord2dvARB));
-}
-
-static inline void
-SET_MultiTexCoord2dvARB(struct _glapi_table *disp,
-                        void (GLAPIENTRYP fn) (GLenum, const GLdouble *))
-{
-    SET_by_offset(disp, _gloffset_MultiTexCoord2dvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiTexCoord2fARB) (GLenum, GLfloat, GLfloat);
-
-#define CALL_MultiTexCoord2fARB(disp, parameters) \
-    (* GET_MultiTexCoord2fARB(disp)) parameters
-static inline _glptr_MultiTexCoord2fARB
-GET_MultiTexCoord2fARB(struct _glapi_table *disp)
-{
-    return (_glptr_MultiTexCoord2fARB) (GET_by_offset
-                                        (disp, _gloffset_MultiTexCoord2fARB));
-}
-
-static inline void
-SET_MultiTexCoord2fARB(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLenum, GLfloat, GLfloat))
-{
-    SET_by_offset(disp, _gloffset_MultiTexCoord2fARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiTexCoord2fvARB) (GLenum, const GLfloat *);
-
-#define CALL_MultiTexCoord2fvARB(disp, parameters) \
-    (* GET_MultiTexCoord2fvARB(disp)) parameters
-static inline _glptr_MultiTexCoord2fvARB
-GET_MultiTexCoord2fvARB(struct _glapi_table *disp)
-{
-    return (_glptr_MultiTexCoord2fvARB) (GET_by_offset
-                                         (disp, _gloffset_MultiTexCoord2fvARB));
-}
-
-static inline void
-SET_MultiTexCoord2fvARB(struct _glapi_table *disp,
-                        void (GLAPIENTRYP fn) (GLenum, const GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_MultiTexCoord2fvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiTexCoord2iARB) (GLenum, GLint, GLint);
-
-#define CALL_MultiTexCoord2iARB(disp, parameters) \
-    (* GET_MultiTexCoord2iARB(disp)) parameters
-static inline _glptr_MultiTexCoord2iARB
-GET_MultiTexCoord2iARB(struct _glapi_table *disp)
-{
-    return (_glptr_MultiTexCoord2iARB) (GET_by_offset
-                                        (disp, _gloffset_MultiTexCoord2iARB));
-}
-
-static inline void
-SET_MultiTexCoord2iARB(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLenum, GLint, GLint))
-{
-    SET_by_offset(disp, _gloffset_MultiTexCoord2iARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiTexCoord2ivARB) (GLenum, const GLint *);
-
-#define CALL_MultiTexCoord2ivARB(disp, parameters) \
-    (* GET_MultiTexCoord2ivARB(disp)) parameters
-static inline _glptr_MultiTexCoord2ivARB
-GET_MultiTexCoord2ivARB(struct _glapi_table *disp)
-{
-    return (_glptr_MultiTexCoord2ivARB) (GET_by_offset
-                                         (disp, _gloffset_MultiTexCoord2ivARB));
-}
-
-static inline void
-SET_MultiTexCoord2ivARB(struct _glapi_table *disp,
-                        void (GLAPIENTRYP fn) (GLenum, const GLint *))
-{
-    SET_by_offset(disp, _gloffset_MultiTexCoord2ivARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiTexCoord2sARB) (GLenum, GLshort, GLshort);
-
-#define CALL_MultiTexCoord2sARB(disp, parameters) \
-    (* GET_MultiTexCoord2sARB(disp)) parameters
-static inline _glptr_MultiTexCoord2sARB
-GET_MultiTexCoord2sARB(struct _glapi_table *disp)
-{
-    return (_glptr_MultiTexCoord2sARB) (GET_by_offset
-                                        (disp, _gloffset_MultiTexCoord2sARB));
-}
-
-static inline void
-SET_MultiTexCoord2sARB(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLenum, GLshort, GLshort))
-{
-    SET_by_offset(disp, _gloffset_MultiTexCoord2sARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiTexCoord2svARB) (GLenum, const GLshort *);
-
-#define CALL_MultiTexCoord2svARB(disp, parameters) \
-    (* GET_MultiTexCoord2svARB(disp)) parameters
-static inline _glptr_MultiTexCoord2svARB
-GET_MultiTexCoord2svARB(struct _glapi_table *disp)
-{
-    return (_glptr_MultiTexCoord2svARB) (GET_by_offset
-                                         (disp, _gloffset_MultiTexCoord2svARB));
-}
-
-static inline void
-SET_MultiTexCoord2svARB(struct _glapi_table *disp,
-                        void (GLAPIENTRYP fn) (GLenum, const GLshort *))
-{
-    SET_by_offset(disp, _gloffset_MultiTexCoord2svARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiTexCoord3dARB) (GLenum, GLdouble,
-                                                      GLdouble, GLdouble);
-#define CALL_MultiTexCoord3dARB(disp, parameters) \
-    (* GET_MultiTexCoord3dARB(disp)) parameters
-static inline _glptr_MultiTexCoord3dARB
-GET_MultiTexCoord3dARB(struct _glapi_table *disp)
-{
-    return (_glptr_MultiTexCoord3dARB) (GET_by_offset
-                                        (disp, _gloffset_MultiTexCoord3dARB));
-}
-
-static inline void
-SET_MultiTexCoord3dARB(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLenum, GLdouble, GLdouble,
-                                              GLdouble))
-{
-    SET_by_offset(disp, _gloffset_MultiTexCoord3dARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiTexCoord3dvARB) (GLenum,
-                                                       const GLdouble *);
-#define CALL_MultiTexCoord3dvARB(disp, parameters) \
-    (* GET_MultiTexCoord3dvARB(disp)) parameters
-static inline _glptr_MultiTexCoord3dvARB
-GET_MultiTexCoord3dvARB(struct _glapi_table *disp)
-{
-    return (_glptr_MultiTexCoord3dvARB) (GET_by_offset
-                                         (disp, _gloffset_MultiTexCoord3dvARB));
-}
-
-static inline void
-SET_MultiTexCoord3dvARB(struct _glapi_table *disp,
-                        void (GLAPIENTRYP fn) (GLenum, const GLdouble *))
-{
-    SET_by_offset(disp, _gloffset_MultiTexCoord3dvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiTexCoord3fARB) (GLenum, GLfloat, GLfloat,
-                                                      GLfloat);
-#define CALL_MultiTexCoord3fARB(disp, parameters) \
-    (* GET_MultiTexCoord3fARB(disp)) parameters
-static inline _glptr_MultiTexCoord3fARB
-GET_MultiTexCoord3fARB(struct _glapi_table *disp)
-{
-    return (_glptr_MultiTexCoord3fARB) (GET_by_offset
-                                        (disp, _gloffset_MultiTexCoord3fARB));
-}
-
-static inline void
-SET_MultiTexCoord3fARB(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLenum, GLfloat, GLfloat,
-                                              GLfloat))
-{
-    SET_by_offset(disp, _gloffset_MultiTexCoord3fARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiTexCoord3fvARB) (GLenum, const GLfloat *);
-
-#define CALL_MultiTexCoord3fvARB(disp, parameters) \
-    (* GET_MultiTexCoord3fvARB(disp)) parameters
-static inline _glptr_MultiTexCoord3fvARB
-GET_MultiTexCoord3fvARB(struct _glapi_table *disp)
-{
-    return (_glptr_MultiTexCoord3fvARB) (GET_by_offset
-                                         (disp, _gloffset_MultiTexCoord3fvARB));
-}
-
-static inline void
-SET_MultiTexCoord3fvARB(struct _glapi_table *disp,
-                        void (GLAPIENTRYP fn) (GLenum, const GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_MultiTexCoord3fvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiTexCoord3iARB) (GLenum, GLint, GLint,
-                                                      GLint);
-#define CALL_MultiTexCoord3iARB(disp, parameters) \
-    (* GET_MultiTexCoord3iARB(disp)) parameters
-static inline _glptr_MultiTexCoord3iARB
-GET_MultiTexCoord3iARB(struct _glapi_table *disp)
-{
-    return (_glptr_MultiTexCoord3iARB) (GET_by_offset
-                                        (disp, _gloffset_MultiTexCoord3iARB));
-}
-
-static inline void
-SET_MultiTexCoord3iARB(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLenum, GLint, GLint, GLint))
-{
-    SET_by_offset(disp, _gloffset_MultiTexCoord3iARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiTexCoord3ivARB) (GLenum, const GLint *);
-
-#define CALL_MultiTexCoord3ivARB(disp, parameters) \
-    (* GET_MultiTexCoord3ivARB(disp)) parameters
-static inline _glptr_MultiTexCoord3ivARB
-GET_MultiTexCoord3ivARB(struct _glapi_table *disp)
-{
-    return (_glptr_MultiTexCoord3ivARB) (GET_by_offset
-                                         (disp, _gloffset_MultiTexCoord3ivARB));
-}
-
-static inline void
-SET_MultiTexCoord3ivARB(struct _glapi_table *disp,
-                        void (GLAPIENTRYP fn) (GLenum, const GLint *))
-{
-    SET_by_offset(disp, _gloffset_MultiTexCoord3ivARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiTexCoord3sARB) (GLenum, GLshort, GLshort,
-                                                      GLshort);
-#define CALL_MultiTexCoord3sARB(disp, parameters) \
-    (* GET_MultiTexCoord3sARB(disp)) parameters
-static inline _glptr_MultiTexCoord3sARB
-GET_MultiTexCoord3sARB(struct _glapi_table *disp)
-{
-    return (_glptr_MultiTexCoord3sARB) (GET_by_offset
-                                        (disp, _gloffset_MultiTexCoord3sARB));
-}
-
-static inline void
-SET_MultiTexCoord3sARB(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLenum, GLshort, GLshort,
-                                              GLshort))
-{
-    SET_by_offset(disp, _gloffset_MultiTexCoord3sARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiTexCoord3svARB) (GLenum, const GLshort *);
-
-#define CALL_MultiTexCoord3svARB(disp, parameters) \
-    (* GET_MultiTexCoord3svARB(disp)) parameters
-static inline _glptr_MultiTexCoord3svARB
-GET_MultiTexCoord3svARB(struct _glapi_table *disp)
-{
-    return (_glptr_MultiTexCoord3svARB) (GET_by_offset
-                                         (disp, _gloffset_MultiTexCoord3svARB));
-}
-
-static inline void
-SET_MultiTexCoord3svARB(struct _glapi_table *disp,
-                        void (GLAPIENTRYP fn) (GLenum, const GLshort *))
-{
-    SET_by_offset(disp, _gloffset_MultiTexCoord3svARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiTexCoord4dARB) (GLenum, GLdouble,
-                                                      GLdouble, GLdouble,
-                                                      GLdouble);
-#define CALL_MultiTexCoord4dARB(disp, parameters) \
-    (* GET_MultiTexCoord4dARB(disp)) parameters
-static inline _glptr_MultiTexCoord4dARB
-GET_MultiTexCoord4dARB(struct _glapi_table *disp)
-{
-    return (_glptr_MultiTexCoord4dARB) (GET_by_offset
-                                        (disp, _gloffset_MultiTexCoord4dARB));
-}
-
-static inline void
-SET_MultiTexCoord4dARB(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLenum, GLdouble, GLdouble,
-                                              GLdouble, GLdouble))
-{
-    SET_by_offset(disp, _gloffset_MultiTexCoord4dARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiTexCoord4dvARB) (GLenum,
-                                                       const GLdouble *);
-#define CALL_MultiTexCoord4dvARB(disp, parameters) \
-    (* GET_MultiTexCoord4dvARB(disp)) parameters
-static inline _glptr_MultiTexCoord4dvARB
-GET_MultiTexCoord4dvARB(struct _glapi_table *disp)
-{
-    return (_glptr_MultiTexCoord4dvARB) (GET_by_offset
-                                         (disp, _gloffset_MultiTexCoord4dvARB));
-}
-
-static inline void
-SET_MultiTexCoord4dvARB(struct _glapi_table *disp,
-                        void (GLAPIENTRYP fn) (GLenum, const GLdouble *))
-{
-    SET_by_offset(disp, _gloffset_MultiTexCoord4dvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiTexCoord4fARB) (GLenum, GLfloat, GLfloat,
-                                                      GLfloat, GLfloat);
-#define CALL_MultiTexCoord4fARB(disp, parameters) \
-    (* GET_MultiTexCoord4fARB(disp)) parameters
-static inline _glptr_MultiTexCoord4fARB
-GET_MultiTexCoord4fARB(struct _glapi_table *disp)
-{
-    return (_glptr_MultiTexCoord4fARB) (GET_by_offset
-                                        (disp, _gloffset_MultiTexCoord4fARB));
-}
-
-static inline void
-SET_MultiTexCoord4fARB(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLenum, GLfloat, GLfloat, GLfloat,
-                                              GLfloat))
-{
-    SET_by_offset(disp, _gloffset_MultiTexCoord4fARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiTexCoord4fvARB) (GLenum, const GLfloat *);
-
-#define CALL_MultiTexCoord4fvARB(disp, parameters) \
-    (* GET_MultiTexCoord4fvARB(disp)) parameters
-static inline _glptr_MultiTexCoord4fvARB
-GET_MultiTexCoord4fvARB(struct _glapi_table *disp)
-{
-    return (_glptr_MultiTexCoord4fvARB) (GET_by_offset
-                                         (disp, _gloffset_MultiTexCoord4fvARB));
-}
-
-static inline void
-SET_MultiTexCoord4fvARB(struct _glapi_table *disp,
-                        void (GLAPIENTRYP fn) (GLenum, const GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_MultiTexCoord4fvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiTexCoord4iARB) (GLenum, GLint, GLint,
-                                                      GLint, GLint);
-#define CALL_MultiTexCoord4iARB(disp, parameters) \
-    (* GET_MultiTexCoord4iARB(disp)) parameters
-static inline _glptr_MultiTexCoord4iARB
-GET_MultiTexCoord4iARB(struct _glapi_table *disp)
-{
-    return (_glptr_MultiTexCoord4iARB) (GET_by_offset
-                                        (disp, _gloffset_MultiTexCoord4iARB));
-}
-
-static inline void
-SET_MultiTexCoord4iARB(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLenum, GLint, GLint, GLint,
-                                              GLint))
-{
-    SET_by_offset(disp, _gloffset_MultiTexCoord4iARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiTexCoord4ivARB) (GLenum, const GLint *);
-
-#define CALL_MultiTexCoord4ivARB(disp, parameters) \
-    (* GET_MultiTexCoord4ivARB(disp)) parameters
-static inline _glptr_MultiTexCoord4ivARB
-GET_MultiTexCoord4ivARB(struct _glapi_table *disp)
-{
-    return (_glptr_MultiTexCoord4ivARB) (GET_by_offset
-                                         (disp, _gloffset_MultiTexCoord4ivARB));
-}
-
-static inline void
-SET_MultiTexCoord4ivARB(struct _glapi_table *disp,
-                        void (GLAPIENTRYP fn) (GLenum, const GLint *))
-{
-    SET_by_offset(disp, _gloffset_MultiTexCoord4ivARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiTexCoord4sARB) (GLenum, GLshort, GLshort,
-                                                      GLshort, GLshort);
-#define CALL_MultiTexCoord4sARB(disp, parameters) \
-    (* GET_MultiTexCoord4sARB(disp)) parameters
-static inline _glptr_MultiTexCoord4sARB
-GET_MultiTexCoord4sARB(struct _glapi_table *disp)
-{
-    return (_glptr_MultiTexCoord4sARB) (GET_by_offset
-                                        (disp, _gloffset_MultiTexCoord4sARB));
-}
-
-static inline void
-SET_MultiTexCoord4sARB(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLenum, GLshort, GLshort, GLshort,
-                                              GLshort))
-{
-    SET_by_offset(disp, _gloffset_MultiTexCoord4sARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiTexCoord4svARB) (GLenum, const GLshort *);
-
-#define CALL_MultiTexCoord4svARB(disp, parameters) \
-    (* GET_MultiTexCoord4svARB(disp)) parameters
-static inline _glptr_MultiTexCoord4svARB
-GET_MultiTexCoord4svARB(struct _glapi_table *disp)
-{
-    return (_glptr_MultiTexCoord4svARB) (GET_by_offset
-                                         (disp, _gloffset_MultiTexCoord4svARB));
-}
-
-static inline void
-SET_MultiTexCoord4svARB(struct _glapi_table *disp,
-                        void (GLAPIENTRYP fn) (GLenum, const GLshort *))
-{
-    SET_by_offset(disp, _gloffset_MultiTexCoord4svARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_AttachShader) (GLuint, GLuint);
-
-#define CALL_AttachShader(disp, parameters) \
-    (* GET_AttachShader(disp)) parameters
-static inline _glptr_AttachShader
-GET_AttachShader(struct _glapi_table *disp)
-{
-    return (_glptr_AttachShader) (GET_by_offset(disp, _gloffset_AttachShader));
-}
-
-static inline void
-SET_AttachShader(struct _glapi_table *disp,
-                 void (GLAPIENTRYP fn) (GLuint, GLuint))
-{
-    SET_by_offset(disp, _gloffset_AttachShader, fn);
-}
-
-typedef GLuint(GLAPIENTRYP _glptr_CreateProgram) (void);
-
-#define CALL_CreateProgram(disp, parameters) \
-    (* GET_CreateProgram(disp)) parameters
-static inline _glptr_CreateProgram
-GET_CreateProgram(struct _glapi_table *disp)
-{
-    return (_glptr_CreateProgram) (GET_by_offset
-                                   (disp, _gloffset_CreateProgram));
-}
-
-static inline void
-SET_CreateProgram(struct _glapi_table *disp, GLuint(GLAPIENTRYP fn) (void))
-{
-    SET_by_offset(disp, _gloffset_CreateProgram, fn);
-}
-
-typedef GLuint(GLAPIENTRYP _glptr_CreateShader) (GLenum);
-
-#define CALL_CreateShader(disp, parameters) \
-    (* GET_CreateShader(disp)) parameters
-static inline _glptr_CreateShader
-GET_CreateShader(struct _glapi_table *disp)
-{
-    return (_glptr_CreateShader) (GET_by_offset(disp, _gloffset_CreateShader));
-}
-
-static inline void
-SET_CreateShader(struct _glapi_table *disp, GLuint(GLAPIENTRYP fn) (GLenum))
-{
-    SET_by_offset(disp, _gloffset_CreateShader, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_DeleteProgram) (GLuint);
-
-#define CALL_DeleteProgram(disp, parameters) \
-    (* GET_DeleteProgram(disp)) parameters
-static inline _glptr_DeleteProgram
-GET_DeleteProgram(struct _glapi_table *disp)
-{
-    return (_glptr_DeleteProgram) (GET_by_offset
-                                   (disp, _gloffset_DeleteProgram));
-}
-
-static inline void
-SET_DeleteProgram(struct _glapi_table *disp, void (GLAPIENTRYP fn) (GLuint))
-{
-    SET_by_offset(disp, _gloffset_DeleteProgram, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_DeleteShader) (GLuint);
-
-#define CALL_DeleteShader(disp, parameters) \
-    (* GET_DeleteShader(disp)) parameters
-static inline _glptr_DeleteShader
-GET_DeleteShader(struct _glapi_table *disp)
-{
-    return (_glptr_DeleteShader) (GET_by_offset(disp, _gloffset_DeleteShader));
-}
-
-static inline void
-SET_DeleteShader(struct _glapi_table *disp, void (GLAPIENTRYP fn) (GLuint))
-{
-    SET_by_offset(disp, _gloffset_DeleteShader, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_DetachShader) (GLuint, GLuint);
-
-#define CALL_DetachShader(disp, parameters) \
-    (* GET_DetachShader(disp)) parameters
-static inline _glptr_DetachShader
-GET_DetachShader(struct _glapi_table *disp)
-{
-    return (_glptr_DetachShader) (GET_by_offset(disp, _gloffset_DetachShader));
-}
-
-static inline void
-SET_DetachShader(struct _glapi_table *disp,
-                 void (GLAPIENTRYP fn) (GLuint, GLuint))
-{
-    SET_by_offset(disp, _gloffset_DetachShader, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetAttachedShaders) (GLuint, GLsizei,
-                                                      GLsizei *, GLuint *);
-#define CALL_GetAttachedShaders(disp, parameters) \
-    (* GET_GetAttachedShaders(disp)) parameters
-static inline _glptr_GetAttachedShaders
-GET_GetAttachedShaders(struct _glapi_table *disp)
-{
-    return (_glptr_GetAttachedShaders) (GET_by_offset
-                                        (disp, _gloffset_GetAttachedShaders));
-}
-
-static inline void
-SET_GetAttachedShaders(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLuint, GLsizei, GLsizei *,
-                                              GLuint *))
-{
-    SET_by_offset(disp, _gloffset_GetAttachedShaders, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetProgramInfoLog) (GLuint, GLsizei, GLsizei *,
-                                                     GLchar *);
-#define CALL_GetProgramInfoLog(disp, parameters) \
-    (* GET_GetProgramInfoLog(disp)) parameters
-static inline _glptr_GetProgramInfoLog
-GET_GetProgramInfoLog(struct _glapi_table *disp)
-{
-    return (_glptr_GetProgramInfoLog) (GET_by_offset
-                                       (disp, _gloffset_GetProgramInfoLog));
-}
-
-static inline void
-SET_GetProgramInfoLog(struct _glapi_table *disp,
-                      void (GLAPIENTRYP fn) (GLuint, GLsizei, GLsizei *,
-                                             GLchar *))
-{
-    SET_by_offset(disp, _gloffset_GetProgramInfoLog, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetProgramiv) (GLuint, GLenum, GLint *);
-
-#define CALL_GetProgramiv(disp, parameters) \
-    (* GET_GetProgramiv(disp)) parameters
-static inline _glptr_GetProgramiv
-GET_GetProgramiv(struct _glapi_table *disp)
-{
-    return (_glptr_GetProgramiv) (GET_by_offset(disp, _gloffset_GetProgramiv));
-}
-
-static inline void
-SET_GetProgramiv(struct _glapi_table *disp,
-                 void (GLAPIENTRYP fn) (GLuint, GLenum, GLint *))
-{
-    SET_by_offset(disp, _gloffset_GetProgramiv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetShaderInfoLog) (GLuint, GLsizei, GLsizei *,
-                                                    GLchar *);
-#define CALL_GetShaderInfoLog(disp, parameters) \
-    (* GET_GetShaderInfoLog(disp)) parameters
-static inline _glptr_GetShaderInfoLog
-GET_GetShaderInfoLog(struct _glapi_table *disp)
-{
-    return (_glptr_GetShaderInfoLog) (GET_by_offset
-                                      (disp, _gloffset_GetShaderInfoLog));
-}
-
-static inline void
-SET_GetShaderInfoLog(struct _glapi_table *disp,
-                     void (GLAPIENTRYP fn) (GLuint, GLsizei, GLsizei *,
-                                            GLchar *))
-{
-    SET_by_offset(disp, _gloffset_GetShaderInfoLog, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetShaderiv) (GLuint, GLenum, GLint *);
-
-#define CALL_GetShaderiv(disp, parameters) \
-    (* GET_GetShaderiv(disp)) parameters
-static inline _glptr_GetShaderiv
-GET_GetShaderiv(struct _glapi_table *disp)
-{
-    return (_glptr_GetShaderiv) (GET_by_offset(disp, _gloffset_GetShaderiv));
-}
-
-static inline void
-SET_GetShaderiv(struct _glapi_table *disp,
-                void (GLAPIENTRYP fn) (GLuint, GLenum, GLint *))
-{
-    SET_by_offset(disp, _gloffset_GetShaderiv, fn);
-}
-
-typedef GLboolean(GLAPIENTRYP _glptr_IsProgram) (GLuint);
-
-#define CALL_IsProgram(disp, parameters) \
-    (* GET_IsProgram(disp)) parameters
-static inline _glptr_IsProgram
-GET_IsProgram(struct _glapi_table *disp)
-{
-    return (_glptr_IsProgram) (GET_by_offset(disp, _gloffset_IsProgram));
-}
-
-static inline void
-SET_IsProgram(struct _glapi_table *disp, GLboolean(GLAPIENTRYP fn) (GLuint))
-{
-    SET_by_offset(disp, _gloffset_IsProgram, fn);
-}
-
-typedef GLboolean(GLAPIENTRYP _glptr_IsShader) (GLuint);
-
-#define CALL_IsShader(disp, parameters) \
-    (* GET_IsShader(disp)) parameters
-static inline _glptr_IsShader
-GET_IsShader(struct _glapi_table *disp)
-{
-    return (_glptr_IsShader) (GET_by_offset(disp, _gloffset_IsShader));
-}
-
-static inline void
-SET_IsShader(struct _glapi_table *disp, GLboolean(GLAPIENTRYP fn) (GLuint))
-{
-    SET_by_offset(disp, _gloffset_IsShader, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_StencilFuncSeparate) (GLenum, GLenum, GLint,
-                                                       GLuint);
-#define CALL_StencilFuncSeparate(disp, parameters) \
-    (* GET_StencilFuncSeparate(disp)) parameters
-static inline _glptr_StencilFuncSeparate
-GET_StencilFuncSeparate(struct _glapi_table *disp)
-{
-    return (_glptr_StencilFuncSeparate) (GET_by_offset
-                                         (disp, _gloffset_StencilFuncSeparate));
-}
-
-static inline void
-SET_StencilFuncSeparate(struct _glapi_table *disp,
-                        void (GLAPIENTRYP fn) (GLenum, GLenum, GLint, GLuint))
-{
-    SET_by_offset(disp, _gloffset_StencilFuncSeparate, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_StencilMaskSeparate) (GLenum, GLuint);
-
-#define CALL_StencilMaskSeparate(disp, parameters) \
-    (* GET_StencilMaskSeparate(disp)) parameters
-static inline _glptr_StencilMaskSeparate
-GET_StencilMaskSeparate(struct _glapi_table *disp)
-{
-    return (_glptr_StencilMaskSeparate) (GET_by_offset
-                                         (disp, _gloffset_StencilMaskSeparate));
-}
-
-static inline void
-SET_StencilMaskSeparate(struct _glapi_table *disp,
-                        void (GLAPIENTRYP fn) (GLenum, GLuint))
-{
-    SET_by_offset(disp, _gloffset_StencilMaskSeparate, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_StencilOpSeparate) (GLenum, GLenum, GLenum,
-                                                     GLenum);
-#define CALL_StencilOpSeparate(disp, parameters) \
-    (* GET_StencilOpSeparate(disp)) parameters
-static inline _glptr_StencilOpSeparate
-GET_StencilOpSeparate(struct _glapi_table *disp)
-{
-    return (_glptr_StencilOpSeparate) (GET_by_offset
-                                       (disp, _gloffset_StencilOpSeparate));
-}
-
-static inline void
-SET_StencilOpSeparate(struct _glapi_table *disp,
-                      void (GLAPIENTRYP fn) (GLenum, GLenum, GLenum, GLenum))
-{
-    SET_by_offset(disp, _gloffset_StencilOpSeparate, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_UniformMatrix2x3fv) (GLint, GLsizei, GLboolean,
-                                                      const GLfloat *);
-#define CALL_UniformMatrix2x3fv(disp, parameters) \
-    (* GET_UniformMatrix2x3fv(disp)) parameters
-static inline _glptr_UniformMatrix2x3fv
-GET_UniformMatrix2x3fv(struct _glapi_table *disp)
-{
-    return (_glptr_UniformMatrix2x3fv) (GET_by_offset
-                                        (disp, _gloffset_UniformMatrix2x3fv));
-}
-
-static inline void
-SET_UniformMatrix2x3fv(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLint, GLsizei, GLboolean,
-                                              const GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_UniformMatrix2x3fv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_UniformMatrix2x4fv) (GLint, GLsizei, GLboolean,
-                                                      const GLfloat *);
-#define CALL_UniformMatrix2x4fv(disp, parameters) \
-    (* GET_UniformMatrix2x4fv(disp)) parameters
-static inline _glptr_UniformMatrix2x4fv
-GET_UniformMatrix2x4fv(struct _glapi_table *disp)
-{
-    return (_glptr_UniformMatrix2x4fv) (GET_by_offset
-                                        (disp, _gloffset_UniformMatrix2x4fv));
-}
-
-static inline void
-SET_UniformMatrix2x4fv(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLint, GLsizei, GLboolean,
-                                              const GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_UniformMatrix2x4fv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_UniformMatrix3x2fv) (GLint, GLsizei, GLboolean,
-                                                      const GLfloat *);
-#define CALL_UniformMatrix3x2fv(disp, parameters) \
-    (* GET_UniformMatrix3x2fv(disp)) parameters
-static inline _glptr_UniformMatrix3x2fv
-GET_UniformMatrix3x2fv(struct _glapi_table *disp)
-{
-    return (_glptr_UniformMatrix3x2fv) (GET_by_offset
-                                        (disp, _gloffset_UniformMatrix3x2fv));
-}
-
-static inline void
-SET_UniformMatrix3x2fv(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLint, GLsizei, GLboolean,
-                                              const GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_UniformMatrix3x2fv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_UniformMatrix3x4fv) (GLint, GLsizei, GLboolean,
-                                                      const GLfloat *);
-#define CALL_UniformMatrix3x4fv(disp, parameters) \
-    (* GET_UniformMatrix3x4fv(disp)) parameters
-static inline _glptr_UniformMatrix3x4fv
-GET_UniformMatrix3x4fv(struct _glapi_table *disp)
-{
-    return (_glptr_UniformMatrix3x4fv) (GET_by_offset
-                                        (disp, _gloffset_UniformMatrix3x4fv));
-}
-
-static inline void
-SET_UniformMatrix3x4fv(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLint, GLsizei, GLboolean,
-                                              const GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_UniformMatrix3x4fv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_UniformMatrix4x2fv) (GLint, GLsizei, GLboolean,
-                                                      const GLfloat *);
-#define CALL_UniformMatrix4x2fv(disp, parameters) \
-    (* GET_UniformMatrix4x2fv(disp)) parameters
-static inline _glptr_UniformMatrix4x2fv
-GET_UniformMatrix4x2fv(struct _glapi_table *disp)
-{
-    return (_glptr_UniformMatrix4x2fv) (GET_by_offset
-                                        (disp, _gloffset_UniformMatrix4x2fv));
-}
-
-static inline void
-SET_UniformMatrix4x2fv(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLint, GLsizei, GLboolean,
-                                              const GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_UniformMatrix4x2fv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_UniformMatrix4x3fv) (GLint, GLsizei, GLboolean,
-                                                      const GLfloat *);
-#define CALL_UniformMatrix4x3fv(disp, parameters) \
-    (* GET_UniformMatrix4x3fv(disp)) parameters
-static inline _glptr_UniformMatrix4x3fv
-GET_UniformMatrix4x3fv(struct _glapi_table *disp)
-{
-    return (_glptr_UniformMatrix4x3fv) (GET_by_offset
-                                        (disp, _gloffset_UniformMatrix4x3fv));
-}
-
-static inline void
-SET_UniformMatrix4x3fv(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLint, GLsizei, GLboolean,
-                                              const GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_UniformMatrix4x3fv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ClampColor) (GLenum, GLenum);
-
-#define CALL_ClampColor(disp, parameters) \
-    (* GET_ClampColor(disp)) parameters
-static inline _glptr_ClampColor
-GET_ClampColor(struct _glapi_table *disp)
-{
-    return (_glptr_ClampColor) (GET_by_offset(disp, _gloffset_ClampColor));
-}
-
-static inline void
-SET_ClampColor(struct _glapi_table *disp,
-               void (GLAPIENTRYP fn) (GLenum, GLenum))
-{
-    SET_by_offset(disp, _gloffset_ClampColor, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ClearBufferfi) (GLenum, GLint, GLfloat, GLint);
-
-#define CALL_ClearBufferfi(disp, parameters) \
-    (* GET_ClearBufferfi(disp)) parameters
-static inline _glptr_ClearBufferfi
-GET_ClearBufferfi(struct _glapi_table *disp)
-{
-    return (_glptr_ClearBufferfi) (GET_by_offset
-                                   (disp, _gloffset_ClearBufferfi));
-}
-
-static inline void
-SET_ClearBufferfi(struct _glapi_table *disp,
-                  void (GLAPIENTRYP fn) (GLenum, GLint, GLfloat, GLint))
-{
-    SET_by_offset(disp, _gloffset_ClearBufferfi, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ClearBufferfv) (GLenum, GLint,
-                                                 const GLfloat *);
-#define CALL_ClearBufferfv(disp, parameters) \
-    (* GET_ClearBufferfv(disp)) parameters
-static inline _glptr_ClearBufferfv
-GET_ClearBufferfv(struct _glapi_table *disp)
-{
-    return (_glptr_ClearBufferfv) (GET_by_offset
-                                   (disp, _gloffset_ClearBufferfv));
-}
-
-static inline void
-SET_ClearBufferfv(struct _glapi_table *disp,
-                  void (GLAPIENTRYP fn) (GLenum, GLint, const GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_ClearBufferfv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ClearBufferiv) (GLenum, GLint, const GLint *);
-
-#define CALL_ClearBufferiv(disp, parameters) \
-    (* GET_ClearBufferiv(disp)) parameters
-static inline _glptr_ClearBufferiv
-GET_ClearBufferiv(struct _glapi_table *disp)
-{
-    return (_glptr_ClearBufferiv) (GET_by_offset
-                                   (disp, _gloffset_ClearBufferiv));
-}
-
-static inline void
-SET_ClearBufferiv(struct _glapi_table *disp,
-                  void (GLAPIENTRYP fn) (GLenum, GLint, const GLint *))
-{
-    SET_by_offset(disp, _gloffset_ClearBufferiv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ClearBufferuiv) (GLenum, GLint,
-                                                  const GLuint *);
-#define CALL_ClearBufferuiv(disp, parameters) \
-    (* GET_ClearBufferuiv(disp)) parameters
-static inline _glptr_ClearBufferuiv
-GET_ClearBufferuiv(struct _glapi_table *disp)
-{
-    return (_glptr_ClearBufferuiv) (GET_by_offset
-                                    (disp, _gloffset_ClearBufferuiv));
-}
-
-static inline void
-SET_ClearBufferuiv(struct _glapi_table *disp,
-                   void (GLAPIENTRYP fn) (GLenum, GLint, const GLuint *))
-{
-    SET_by_offset(disp, _gloffset_ClearBufferuiv, fn);
-}
-
-typedef const GLubyte *(GLAPIENTRYP _glptr_GetStringi) (GLenum, GLuint);
-
-#define CALL_GetStringi(disp, parameters) \
-    (* GET_GetStringi(disp)) parameters
-static inline _glptr_GetStringi
-GET_GetStringi(struct _glapi_table *disp)
-{
-    return (_glptr_GetStringi) (GET_by_offset(disp, _gloffset_GetStringi));
-}
-
-static inline void
-SET_GetStringi(struct _glapi_table *disp,
-               const GLubyte * (GLAPIENTRYP fn) (GLenum, GLuint))
-{
-    SET_by_offset(disp, _gloffset_GetStringi, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexBuffer) (GLenum, GLenum, GLuint);
-
-#define CALL_TexBuffer(disp, parameters) \
-    (* GET_TexBuffer(disp)) parameters
-static inline _glptr_TexBuffer
-GET_TexBuffer(struct _glapi_table *disp)
-{
-    return (_glptr_TexBuffer) (GET_by_offset(disp, _gloffset_TexBuffer));
-}
-
-static inline void
-SET_TexBuffer(struct _glapi_table *disp,
-              void (GLAPIENTRYP fn) (GLenum, GLenum, GLuint))
-{
-    SET_by_offset(disp, _gloffset_TexBuffer, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_FramebufferTexture) (GLenum, GLenum, GLuint,
-                                                      GLint);
-#define CALL_FramebufferTexture(disp, parameters) \
-    (* GET_FramebufferTexture(disp)) parameters
-static inline _glptr_FramebufferTexture
-GET_FramebufferTexture(struct _glapi_table *disp)
-{
-    return (_glptr_FramebufferTexture) (GET_by_offset
-                                        (disp, _gloffset_FramebufferTexture));
-}
-
-static inline void
-SET_FramebufferTexture(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLenum, GLenum, GLuint, GLint))
-{
-    SET_by_offset(disp, _gloffset_FramebufferTexture, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetBufferParameteri64v) (GLenum, GLenum,
-                                                          GLint64 *);
-#define CALL_GetBufferParameteri64v(disp, parameters) \
-    (* GET_GetBufferParameteri64v(disp)) parameters
-static inline _glptr_GetBufferParameteri64v
-GET_GetBufferParameteri64v(struct _glapi_table *disp)
-{
-    return (_glptr_GetBufferParameteri64v) (GET_by_offset
-                                            (disp,
-                                             _gloffset_GetBufferParameteri64v));
-}
-
-static inline void
-SET_GetBufferParameteri64v(struct _glapi_table *disp,
-                           void (GLAPIENTRYP fn) (GLenum, GLenum, GLint64 *))
-{
-    SET_by_offset(disp, _gloffset_GetBufferParameteri64v, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetInteger64i_v) (GLenum, GLuint, GLint64 *);
-
-#define CALL_GetInteger64i_v(disp, parameters) \
-    (* GET_GetInteger64i_v(disp)) parameters
-static inline _glptr_GetInteger64i_v
-GET_GetInteger64i_v(struct _glapi_table *disp)
-{
-    return (_glptr_GetInteger64i_v) (GET_by_offset
-                                     (disp, _gloffset_GetInteger64i_v));
-}
-
-static inline void
-SET_GetInteger64i_v(struct _glapi_table *disp,
-                    void (GLAPIENTRYP fn) (GLenum, GLuint, GLint64 *))
-{
-    SET_by_offset(disp, _gloffset_GetInteger64i_v, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribDivisor) (GLuint, GLuint);
-
-#define CALL_VertexAttribDivisor(disp, parameters) \
-    (* GET_VertexAttribDivisor(disp)) parameters
-static inline _glptr_VertexAttribDivisor
-GET_VertexAttribDivisor(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttribDivisor) (GET_by_offset
-                                         (disp, _gloffset_VertexAttribDivisor));
-}
-
-static inline void
-SET_VertexAttribDivisor(struct _glapi_table *disp,
-                        void (GLAPIENTRYP fn) (GLuint, GLuint))
-{
-    SET_by_offset(disp, _gloffset_VertexAttribDivisor, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_LoadTransposeMatrixdARB) (const GLdouble *);
-
-#define CALL_LoadTransposeMatrixdARB(disp, parameters) \
-    (* GET_LoadTransposeMatrixdARB(disp)) parameters
-static inline _glptr_LoadTransposeMatrixdARB
-GET_LoadTransposeMatrixdARB(struct _glapi_table *disp)
-{
-    return (_glptr_LoadTransposeMatrixdARB) (GET_by_offset
-                                             (disp,
-                                              _gloffset_LoadTransposeMatrixdARB));
-}
-
-static inline void
-SET_LoadTransposeMatrixdARB(struct _glapi_table *disp,
-                            void (GLAPIENTRYP fn) (const GLdouble *))
-{
-    SET_by_offset(disp, _gloffset_LoadTransposeMatrixdARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_LoadTransposeMatrixfARB) (const GLfloat *);
-
-#define CALL_LoadTransposeMatrixfARB(disp, parameters) \
-    (* GET_LoadTransposeMatrixfARB(disp)) parameters
-static inline _glptr_LoadTransposeMatrixfARB
-GET_LoadTransposeMatrixfARB(struct _glapi_table *disp)
-{
-    return (_glptr_LoadTransposeMatrixfARB) (GET_by_offset
-                                             (disp,
-                                              _gloffset_LoadTransposeMatrixfARB));
-}
-
-static inline void
-SET_LoadTransposeMatrixfARB(struct _glapi_table *disp,
-                            void (GLAPIENTRYP fn) (const GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_LoadTransposeMatrixfARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultTransposeMatrixdARB) (const GLdouble *);
-
-#define CALL_MultTransposeMatrixdARB(disp, parameters) \
-    (* GET_MultTransposeMatrixdARB(disp)) parameters
-static inline _glptr_MultTransposeMatrixdARB
-GET_MultTransposeMatrixdARB(struct _glapi_table *disp)
-{
-    return (_glptr_MultTransposeMatrixdARB) (GET_by_offset
-                                             (disp,
-                                              _gloffset_MultTransposeMatrixdARB));
-}
-
-static inline void
-SET_MultTransposeMatrixdARB(struct _glapi_table *disp,
-                            void (GLAPIENTRYP fn) (const GLdouble *))
-{
-    SET_by_offset(disp, _gloffset_MultTransposeMatrixdARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultTransposeMatrixfARB) (const GLfloat *);
-
-#define CALL_MultTransposeMatrixfARB(disp, parameters) \
-    (* GET_MultTransposeMatrixfARB(disp)) parameters
-static inline _glptr_MultTransposeMatrixfARB
-GET_MultTransposeMatrixfARB(struct _glapi_table *disp)
-{
-    return (_glptr_MultTransposeMatrixfARB) (GET_by_offset
-                                             (disp,
-                                              _gloffset_MultTransposeMatrixfARB));
-}
-
-static inline void
-SET_MultTransposeMatrixfARB(struct _glapi_table *disp,
-                            void (GLAPIENTRYP fn) (const GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_MultTransposeMatrixfARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_SampleCoverageARB) (GLclampf, GLboolean);
-
-#define CALL_SampleCoverageARB(disp, parameters) \
-    (* GET_SampleCoverageARB(disp)) parameters
-static inline _glptr_SampleCoverageARB
-GET_SampleCoverageARB(struct _glapi_table *disp)
-{
-    return (_glptr_SampleCoverageARB) (GET_by_offset
-                                       (disp, _gloffset_SampleCoverageARB));
-}
-
-static inline void
-SET_SampleCoverageARB(struct _glapi_table *disp,
-                      void (GLAPIENTRYP fn) (GLclampf, GLboolean))
-{
-    SET_by_offset(disp, _gloffset_SampleCoverageARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_CompressedTexImage1DARB) (GLenum, GLint,
-                                                           GLenum, GLsizei,
-                                                           GLint, GLsizei,
-                                                           const GLvoid *);
-#define CALL_CompressedTexImage1DARB(disp, parameters) \
-    (* GET_CompressedTexImage1DARB(disp)) parameters
-static inline _glptr_CompressedTexImage1DARB
-GET_CompressedTexImage1DARB(struct _glapi_table *disp)
-{
-    return (_glptr_CompressedTexImage1DARB) (GET_by_offset
-                                             (disp,
-                                              _gloffset_CompressedTexImage1DARB));
-}
-
-static inline void
-SET_CompressedTexImage1DARB(struct _glapi_table *disp,
-                            void (GLAPIENTRYP fn) (GLenum, GLint, GLenum,
-                                                   GLsizei, GLint, GLsizei,
-                                                   const GLvoid *))
-{
-    SET_by_offset(disp, _gloffset_CompressedTexImage1DARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_CompressedTexImage2DARB) (GLenum, GLint,
-                                                           GLenum, GLsizei,
-                                                           GLsizei, GLint,
-                                                           GLsizei,
-                                                           const GLvoid *);
-#define CALL_CompressedTexImage2DARB(disp, parameters) \
-    (* GET_CompressedTexImage2DARB(disp)) parameters
-static inline _glptr_CompressedTexImage2DARB
-GET_CompressedTexImage2DARB(struct _glapi_table *disp)
-{
-    return (_glptr_CompressedTexImage2DARB) (GET_by_offset
-                                             (disp,
-                                              _gloffset_CompressedTexImage2DARB));
-}
-
-static inline void
-SET_CompressedTexImage2DARB(struct _glapi_table *disp,
-                            void (GLAPIENTRYP fn) (GLenum, GLint, GLenum,
-                                                   GLsizei, GLsizei, GLint,
-                                                   GLsizei, const GLvoid *))
-{
-    SET_by_offset(disp, _gloffset_CompressedTexImage2DARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_CompressedTexImage3DARB) (GLenum, GLint,
-                                                           GLenum, GLsizei,
-                                                           GLsizei, GLsizei,
-                                                           GLint, GLsizei,
-                                                           const GLvoid *);
-#define CALL_CompressedTexImage3DARB(disp, parameters) \
-    (* GET_CompressedTexImage3DARB(disp)) parameters
-static inline _glptr_CompressedTexImage3DARB
-GET_CompressedTexImage3DARB(struct _glapi_table *disp)
-{
-    return (_glptr_CompressedTexImage3DARB) (GET_by_offset
-                                             (disp,
-                                              _gloffset_CompressedTexImage3DARB));
-}
-
-static inline void
-SET_CompressedTexImage3DARB(struct _glapi_table *disp,
-                            void (GLAPIENTRYP fn) (GLenum, GLint, GLenum,
-                                                   GLsizei, GLsizei, GLsizei,
-                                                   GLint, GLsizei,
-                                                   const GLvoid *))
-{
-    SET_by_offset(disp, _gloffset_CompressedTexImage3DARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_CompressedTexSubImage1DARB) (GLenum, GLint,
-                                                              GLint, GLsizei,
-                                                              GLenum, GLsizei,
-                                                              const GLvoid *);
-#define CALL_CompressedTexSubImage1DARB(disp, parameters) \
-    (* GET_CompressedTexSubImage1DARB(disp)) parameters
-static inline _glptr_CompressedTexSubImage1DARB
-GET_CompressedTexSubImage1DARB(struct _glapi_table *disp)
-{
-    return (_glptr_CompressedTexSubImage1DARB) (GET_by_offset
-                                                (disp,
-                                                 _gloffset_CompressedTexSubImage1DARB));
-}
-
-static inline void
-SET_CompressedTexSubImage1DARB(struct _glapi_table *disp,
-                               void (GLAPIENTRYP fn) (GLenum, GLint, GLint,
-                                                      GLsizei, GLenum, GLsizei,
-                                                      const GLvoid *))
-{
-    SET_by_offset(disp, _gloffset_CompressedTexSubImage1DARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_CompressedTexSubImage2DARB) (GLenum, GLint,
-                                                              GLint, GLint,
-                                                              GLsizei, GLsizei,
-                                                              GLenum, GLsizei,
-                                                              const GLvoid *);
-#define CALL_CompressedTexSubImage2DARB(disp, parameters) \
-    (* GET_CompressedTexSubImage2DARB(disp)) parameters
-static inline _glptr_CompressedTexSubImage2DARB
-GET_CompressedTexSubImage2DARB(struct _glapi_table *disp)
-{
-    return (_glptr_CompressedTexSubImage2DARB) (GET_by_offset
-                                                (disp,
-                                                 _gloffset_CompressedTexSubImage2DARB));
-}
-
-static inline void
-SET_CompressedTexSubImage2DARB(struct _glapi_table *disp,
-                               void (GLAPIENTRYP fn) (GLenum, GLint, GLint,
-                                                      GLint, GLsizei, GLsizei,
-                                                      GLenum, GLsizei,
-                                                      const GLvoid *))
-{
-    SET_by_offset(disp, _gloffset_CompressedTexSubImage2DARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_CompressedTexSubImage3DARB) (GLenum, GLint,
-                                                              GLint, GLint,
-                                                              GLint, GLsizei,
-                                                              GLsizei, GLsizei,
-                                                              GLenum, GLsizei,
-                                                              const GLvoid *);
-#define CALL_CompressedTexSubImage3DARB(disp, parameters) \
-    (* GET_CompressedTexSubImage3DARB(disp)) parameters
-static inline _glptr_CompressedTexSubImage3DARB
-GET_CompressedTexSubImage3DARB(struct _glapi_table *disp)
-{
-    return (_glptr_CompressedTexSubImage3DARB) (GET_by_offset
-                                                (disp,
-                                                 _gloffset_CompressedTexSubImage3DARB));
-}
-
-static inline void
-SET_CompressedTexSubImage3DARB(struct _glapi_table *disp,
-                               void (GLAPIENTRYP fn) (GLenum, GLint, GLint,
-                                                      GLint, GLint, GLsizei,
-                                                      GLsizei, GLsizei, GLenum,
-                                                      GLsizei, const GLvoid *))
-{
-    SET_by_offset(disp, _gloffset_CompressedTexSubImage3DARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetCompressedTexImageARB) (GLenum, GLint,
-                                                            GLvoid *);
-#define CALL_GetCompressedTexImageARB(disp, parameters) \
-    (* GET_GetCompressedTexImageARB(disp)) parameters
-static inline _glptr_GetCompressedTexImageARB
-GET_GetCompressedTexImageARB(struct _glapi_table *disp)
-{
-    return (_glptr_GetCompressedTexImageARB) (GET_by_offset
-                                              (disp,
-                                               _gloffset_GetCompressedTexImageARB));
-}
-
-static inline void
-SET_GetCompressedTexImageARB(struct _glapi_table *disp,
-                             void (GLAPIENTRYP fn) (GLenum, GLint, GLvoid *))
-{
-    SET_by_offset(disp, _gloffset_GetCompressedTexImageARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_DisableVertexAttribArrayARB) (GLuint);
-
-#define CALL_DisableVertexAttribArrayARB(disp, parameters) \
-    (* GET_DisableVertexAttribArrayARB(disp)) parameters
-static inline _glptr_DisableVertexAttribArrayARB
-GET_DisableVertexAttribArrayARB(struct _glapi_table *disp)
-{
-    return (_glptr_DisableVertexAttribArrayARB) (GET_by_offset
-                                                 (disp,
-                                                  _gloffset_DisableVertexAttribArrayARB));
-}
-
-static inline void
-SET_DisableVertexAttribArrayARB(struct _glapi_table *disp,
-                                void (GLAPIENTRYP fn) (GLuint))
-{
-    SET_by_offset(disp, _gloffset_DisableVertexAttribArrayARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_EnableVertexAttribArrayARB) (GLuint);
-
-#define CALL_EnableVertexAttribArrayARB(disp, parameters) \
-    (* GET_EnableVertexAttribArrayARB(disp)) parameters
-static inline _glptr_EnableVertexAttribArrayARB
-GET_EnableVertexAttribArrayARB(struct _glapi_table *disp)
-{
-    return (_glptr_EnableVertexAttribArrayARB) (GET_by_offset
-                                                (disp,
-                                                 _gloffset_EnableVertexAttribArrayARB));
-}
-
-static inline void
-SET_EnableVertexAttribArrayARB(struct _glapi_table *disp,
-                               void (GLAPIENTRYP fn) (GLuint))
-{
-    SET_by_offset(disp, _gloffset_EnableVertexAttribArrayARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetProgramEnvParameterdvARB) (GLenum, GLuint,
-                                                               GLdouble *);
-#define CALL_GetProgramEnvParameterdvARB(disp, parameters) \
-    (* GET_GetProgramEnvParameterdvARB(disp)) parameters
-static inline _glptr_GetProgramEnvParameterdvARB
-GET_GetProgramEnvParameterdvARB(struct _glapi_table *disp)
-{
-    return (_glptr_GetProgramEnvParameterdvARB) (GET_by_offset
-                                                 (disp,
-                                                  _gloffset_GetProgramEnvParameterdvARB));
-}
-
-static inline void
-SET_GetProgramEnvParameterdvARB(struct _glapi_table *disp,
-                                void (GLAPIENTRYP fn) (GLenum, GLuint,
-                                                       GLdouble *))
-{
-    SET_by_offset(disp, _gloffset_GetProgramEnvParameterdvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetProgramEnvParameterfvARB) (GLenum, GLuint,
-                                                               GLfloat *);
-#define CALL_GetProgramEnvParameterfvARB(disp, parameters) \
-    (* GET_GetProgramEnvParameterfvARB(disp)) parameters
-static inline _glptr_GetProgramEnvParameterfvARB
-GET_GetProgramEnvParameterfvARB(struct _glapi_table *disp)
-{
-    return (_glptr_GetProgramEnvParameterfvARB) (GET_by_offset
-                                                 (disp,
-                                                  _gloffset_GetProgramEnvParameterfvARB));
-}
-
-static inline void
-SET_GetProgramEnvParameterfvARB(struct _glapi_table *disp,
-                                void (GLAPIENTRYP fn) (GLenum, GLuint,
-                                                       GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_GetProgramEnvParameterfvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetProgramLocalParameterdvARB) (GLenum, GLuint,
-                                                                 GLdouble *);
-#define CALL_GetProgramLocalParameterdvARB(disp, parameters) \
-    (* GET_GetProgramLocalParameterdvARB(disp)) parameters
-static inline _glptr_GetProgramLocalParameterdvARB
-GET_GetProgramLocalParameterdvARB(struct _glapi_table *disp)
-{
-    return (_glptr_GetProgramLocalParameterdvARB) (GET_by_offset
-                                                   (disp,
-                                                    _gloffset_GetProgramLocalParameterdvARB));
-}
-
-static inline void
-SET_GetProgramLocalParameterdvARB(struct _glapi_table *disp,
-                                  void (GLAPIENTRYP fn) (GLenum, GLuint,
-                                                         GLdouble *))
-{
-    SET_by_offset(disp, _gloffset_GetProgramLocalParameterdvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetProgramLocalParameterfvARB) (GLenum, GLuint,
-                                                                 GLfloat *);
-#define CALL_GetProgramLocalParameterfvARB(disp, parameters) \
-    (* GET_GetProgramLocalParameterfvARB(disp)) parameters
-static inline _glptr_GetProgramLocalParameterfvARB
-GET_GetProgramLocalParameterfvARB(struct _glapi_table *disp)
-{
-    return (_glptr_GetProgramLocalParameterfvARB) (GET_by_offset
-                                                   (disp,
-                                                    _gloffset_GetProgramLocalParameterfvARB));
-}
-
-static inline void
-SET_GetProgramLocalParameterfvARB(struct _glapi_table *disp,
-                                  void (GLAPIENTRYP fn) (GLenum, GLuint,
-                                                         GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_GetProgramLocalParameterfvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetProgramStringARB) (GLenum, GLenum,
-                                                       GLvoid *);
-#define CALL_GetProgramStringARB(disp, parameters) \
-    (* GET_GetProgramStringARB(disp)) parameters
-static inline _glptr_GetProgramStringARB
-GET_GetProgramStringARB(struct _glapi_table *disp)
-{
-    return (_glptr_GetProgramStringARB) (GET_by_offset
-                                         (disp, _gloffset_GetProgramStringARB));
-}
-
-static inline void
-SET_GetProgramStringARB(struct _glapi_table *disp,
-                        void (GLAPIENTRYP fn) (GLenum, GLenum, GLvoid *))
-{
-    SET_by_offset(disp, _gloffset_GetProgramStringARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetProgramivARB) (GLenum, GLenum, GLint *);
-
-#define CALL_GetProgramivARB(disp, parameters) \
-    (* GET_GetProgramivARB(disp)) parameters
-static inline _glptr_GetProgramivARB
-GET_GetProgramivARB(struct _glapi_table *disp)
-{
-    return (_glptr_GetProgramivARB) (GET_by_offset
-                                     (disp, _gloffset_GetProgramivARB));
-}
-
-static inline void
-SET_GetProgramivARB(struct _glapi_table *disp,
-                    void (GLAPIENTRYP fn) (GLenum, GLenum, GLint *))
-{
-    SET_by_offset(disp, _gloffset_GetProgramivARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetVertexAttribdvARB) (GLuint, GLenum,
-                                                        GLdouble *);
-#define CALL_GetVertexAttribdvARB(disp, parameters) \
-    (* GET_GetVertexAttribdvARB(disp)) parameters
-static inline _glptr_GetVertexAttribdvARB
-GET_GetVertexAttribdvARB(struct _glapi_table *disp)
-{
-    return (_glptr_GetVertexAttribdvARB) (GET_by_offset
-                                          (disp,
-                                           _gloffset_GetVertexAttribdvARB));
-}
-
-static inline void
-SET_GetVertexAttribdvARB(struct _glapi_table *disp,
-                         void (GLAPIENTRYP fn) (GLuint, GLenum, GLdouble *))
-{
-    SET_by_offset(disp, _gloffset_GetVertexAttribdvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetVertexAttribfvARB) (GLuint, GLenum,
-                                                        GLfloat *);
-#define CALL_GetVertexAttribfvARB(disp, parameters) \
-    (* GET_GetVertexAttribfvARB(disp)) parameters
-static inline _glptr_GetVertexAttribfvARB
-GET_GetVertexAttribfvARB(struct _glapi_table *disp)
-{
-    return (_glptr_GetVertexAttribfvARB) (GET_by_offset
-                                          (disp,
-                                           _gloffset_GetVertexAttribfvARB));
-}
-
-static inline void
-SET_GetVertexAttribfvARB(struct _glapi_table *disp,
-                         void (GLAPIENTRYP fn) (GLuint, GLenum, GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_GetVertexAttribfvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetVertexAttribivARB) (GLuint, GLenum,
-                                                        GLint *);
-#define CALL_GetVertexAttribivARB(disp, parameters) \
-    (* GET_GetVertexAttribivARB(disp)) parameters
-static inline _glptr_GetVertexAttribivARB
-GET_GetVertexAttribivARB(struct _glapi_table *disp)
-{
-    return (_glptr_GetVertexAttribivARB) (GET_by_offset
-                                          (disp,
-                                           _gloffset_GetVertexAttribivARB));
-}
-
-static inline void
-SET_GetVertexAttribivARB(struct _glapi_table *disp,
-                         void (GLAPIENTRYP fn) (GLuint, GLenum, GLint *))
-{
-    SET_by_offset(disp, _gloffset_GetVertexAttribivARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ProgramEnvParameter4dARB) (GLenum, GLuint,
-                                                            GLdouble, GLdouble,
-                                                            GLdouble, GLdouble);
-#define CALL_ProgramEnvParameter4dARB(disp, parameters) \
-    (* GET_ProgramEnvParameter4dARB(disp)) parameters
-static inline _glptr_ProgramEnvParameter4dARB
-GET_ProgramEnvParameter4dARB(struct _glapi_table *disp)
-{
-    return (_glptr_ProgramEnvParameter4dARB) (GET_by_offset
-                                              (disp,
-                                               _gloffset_ProgramEnvParameter4dARB));
-}
-
-static inline void
-SET_ProgramEnvParameter4dARB(struct _glapi_table *disp,
-                             void (GLAPIENTRYP fn) (GLenum, GLuint, GLdouble,
-                                                    GLdouble, GLdouble,
-                                                    GLdouble))
-{
-    SET_by_offset(disp, _gloffset_ProgramEnvParameter4dARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ProgramEnvParameter4dvARB) (GLenum, GLuint,
-                                                             const GLdouble *);
-#define CALL_ProgramEnvParameter4dvARB(disp, parameters) \
-    (* GET_ProgramEnvParameter4dvARB(disp)) parameters
-static inline _glptr_ProgramEnvParameter4dvARB
-GET_ProgramEnvParameter4dvARB(struct _glapi_table *disp)
-{
-    return (_glptr_ProgramEnvParameter4dvARB) (GET_by_offset
-                                               (disp,
-                                                _gloffset_ProgramEnvParameter4dvARB));
-}
-
-static inline void
-SET_ProgramEnvParameter4dvARB(struct _glapi_table *disp,
-                              void (GLAPIENTRYP fn) (GLenum, GLuint,
-                                                     const GLdouble *))
-{
-    SET_by_offset(disp, _gloffset_ProgramEnvParameter4dvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ProgramEnvParameter4fARB) (GLenum, GLuint,
-                                                            GLfloat, GLfloat,
-                                                            GLfloat, GLfloat);
-#define CALL_ProgramEnvParameter4fARB(disp, parameters) \
-    (* GET_ProgramEnvParameter4fARB(disp)) parameters
-static inline _glptr_ProgramEnvParameter4fARB
-GET_ProgramEnvParameter4fARB(struct _glapi_table *disp)
-{
-    return (_glptr_ProgramEnvParameter4fARB) (GET_by_offset
-                                              (disp,
-                                               _gloffset_ProgramEnvParameter4fARB));
-}
-
-static inline void
-SET_ProgramEnvParameter4fARB(struct _glapi_table *disp,
-                             void (GLAPIENTRYP fn) (GLenum, GLuint, GLfloat,
-                                                    GLfloat, GLfloat, GLfloat))
-{
-    SET_by_offset(disp, _gloffset_ProgramEnvParameter4fARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ProgramEnvParameter4fvARB) (GLenum, GLuint,
-                                                             const GLfloat *);
-#define CALL_ProgramEnvParameter4fvARB(disp, parameters) \
-    (* GET_ProgramEnvParameter4fvARB(disp)) parameters
-static inline _glptr_ProgramEnvParameter4fvARB
-GET_ProgramEnvParameter4fvARB(struct _glapi_table *disp)
-{
-    return (_glptr_ProgramEnvParameter4fvARB) (GET_by_offset
-                                               (disp,
-                                                _gloffset_ProgramEnvParameter4fvARB));
-}
-
-static inline void
-SET_ProgramEnvParameter4fvARB(struct _glapi_table *disp,
-                              void (GLAPIENTRYP fn) (GLenum, GLuint,
-                                                     const GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_ProgramEnvParameter4fvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ProgramLocalParameter4dARB) (GLenum, GLuint,
-                                                              GLdouble,
-                                                              GLdouble,
-                                                              GLdouble,
-                                                              GLdouble);
-#define CALL_ProgramLocalParameter4dARB(disp, parameters) \
-    (* GET_ProgramLocalParameter4dARB(disp)) parameters
-static inline _glptr_ProgramLocalParameter4dARB
-GET_ProgramLocalParameter4dARB(struct _glapi_table *disp)
-{
-    return (_glptr_ProgramLocalParameter4dARB) (GET_by_offset
-                                                (disp,
-                                                 _gloffset_ProgramLocalParameter4dARB));
-}
-
-static inline void
-SET_ProgramLocalParameter4dARB(struct _glapi_table *disp,
-                               void (GLAPIENTRYP fn) (GLenum, GLuint, GLdouble,
-                                                      GLdouble, GLdouble,
-                                                      GLdouble))
-{
-    SET_by_offset(disp, _gloffset_ProgramLocalParameter4dARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ProgramLocalParameter4dvARB) (GLenum, GLuint,
-                                                               const GLdouble
-                                                               *);
-#define CALL_ProgramLocalParameter4dvARB(disp, parameters) \
-    (* GET_ProgramLocalParameter4dvARB(disp)) parameters
-static inline _glptr_ProgramLocalParameter4dvARB
-GET_ProgramLocalParameter4dvARB(struct _glapi_table *disp)
-{
-    return (_glptr_ProgramLocalParameter4dvARB) (GET_by_offset
-                                                 (disp,
-                                                  _gloffset_ProgramLocalParameter4dvARB));
-}
-
-static inline void
-SET_ProgramLocalParameter4dvARB(struct _glapi_table *disp,
-                                void (GLAPIENTRYP fn) (GLenum, GLuint,
-                                                       const GLdouble *))
-{
-    SET_by_offset(disp, _gloffset_ProgramLocalParameter4dvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ProgramLocalParameter4fARB) (GLenum, GLuint,
-                                                              GLfloat, GLfloat,
-                                                              GLfloat, GLfloat);
-#define CALL_ProgramLocalParameter4fARB(disp, parameters) \
-    (* GET_ProgramLocalParameter4fARB(disp)) parameters
-static inline _glptr_ProgramLocalParameter4fARB
-GET_ProgramLocalParameter4fARB(struct _glapi_table *disp)
-{
-    return (_glptr_ProgramLocalParameter4fARB) (GET_by_offset
-                                                (disp,
-                                                 _gloffset_ProgramLocalParameter4fARB));
-}
-
-static inline void
-SET_ProgramLocalParameter4fARB(struct _glapi_table *disp,
-                               void (GLAPIENTRYP fn) (GLenum, GLuint, GLfloat,
-                                                      GLfloat, GLfloat,
-                                                      GLfloat))
-{
-    SET_by_offset(disp, _gloffset_ProgramLocalParameter4fARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ProgramLocalParameter4fvARB) (GLenum, GLuint,
-                                                               const GLfloat *);
-#define CALL_ProgramLocalParameter4fvARB(disp, parameters) \
-    (* GET_ProgramLocalParameter4fvARB(disp)) parameters
-static inline _glptr_ProgramLocalParameter4fvARB
-GET_ProgramLocalParameter4fvARB(struct _glapi_table *disp)
-{
-    return (_glptr_ProgramLocalParameter4fvARB) (GET_by_offset
-                                                 (disp,
-                                                  _gloffset_ProgramLocalParameter4fvARB));
-}
-
-static inline void
-SET_ProgramLocalParameter4fvARB(struct _glapi_table *disp,
-                                void (GLAPIENTRYP fn) (GLenum, GLuint,
-                                                       const GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_ProgramLocalParameter4fvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ProgramStringARB) (GLenum, GLenum, GLsizei,
-                                                    const GLvoid *);
-#define CALL_ProgramStringARB(disp, parameters) \
-    (* GET_ProgramStringARB(disp)) parameters
-static inline _glptr_ProgramStringARB
-GET_ProgramStringARB(struct _glapi_table *disp)
-{
-    return (_glptr_ProgramStringARB) (GET_by_offset
-                                      (disp, _gloffset_ProgramStringARB));
-}
-
-static inline void
-SET_ProgramStringARB(struct _glapi_table *disp,
-                     void (GLAPIENTRYP fn) (GLenum, GLenum, GLsizei,
-                                            const GLvoid *))
-{
-    SET_by_offset(disp, _gloffset_ProgramStringARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib1dARB) (GLuint, GLdouble);
-
-#define CALL_VertexAttrib1dARB(disp, parameters) \
-    (* GET_VertexAttrib1dARB(disp)) parameters
-static inline _glptr_VertexAttrib1dARB
-GET_VertexAttrib1dARB(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttrib1dARB) (GET_by_offset
-                                       (disp, _gloffset_VertexAttrib1dARB));
-}
-
-static inline void
-SET_VertexAttrib1dARB(struct _glapi_table *disp,
-                      void (GLAPIENTRYP fn) (GLuint, GLdouble))
-{
-    SET_by_offset(disp, _gloffset_VertexAttrib1dARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib1dvARB) (GLuint, const GLdouble *);
-
-#define CALL_VertexAttrib1dvARB(disp, parameters) \
-    (* GET_VertexAttrib1dvARB(disp)) parameters
-static inline _glptr_VertexAttrib1dvARB
-GET_VertexAttrib1dvARB(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttrib1dvARB) (GET_by_offset
-                                        (disp, _gloffset_VertexAttrib1dvARB));
-}
-
-static inline void
-SET_VertexAttrib1dvARB(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLuint, const GLdouble *))
-{
-    SET_by_offset(disp, _gloffset_VertexAttrib1dvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib1fARB) (GLuint, GLfloat);
-
-#define CALL_VertexAttrib1fARB(disp, parameters) \
-    (* GET_VertexAttrib1fARB(disp)) parameters
-static inline _glptr_VertexAttrib1fARB
-GET_VertexAttrib1fARB(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttrib1fARB) (GET_by_offset
-                                       (disp, _gloffset_VertexAttrib1fARB));
-}
-
-static inline void
-SET_VertexAttrib1fARB(struct _glapi_table *disp,
-                      void (GLAPIENTRYP fn) (GLuint, GLfloat))
-{
-    SET_by_offset(disp, _gloffset_VertexAttrib1fARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib1fvARB) (GLuint, const GLfloat *);
-
-#define CALL_VertexAttrib1fvARB(disp, parameters) \
-    (* GET_VertexAttrib1fvARB(disp)) parameters
-static inline _glptr_VertexAttrib1fvARB
-GET_VertexAttrib1fvARB(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttrib1fvARB) (GET_by_offset
-                                        (disp, _gloffset_VertexAttrib1fvARB));
-}
-
-static inline void
-SET_VertexAttrib1fvARB(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLuint, const GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_VertexAttrib1fvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib1sARB) (GLuint, GLshort);
-
-#define CALL_VertexAttrib1sARB(disp, parameters) \
-    (* GET_VertexAttrib1sARB(disp)) parameters
-static inline _glptr_VertexAttrib1sARB
-GET_VertexAttrib1sARB(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttrib1sARB) (GET_by_offset
-                                       (disp, _gloffset_VertexAttrib1sARB));
-}
-
-static inline void
-SET_VertexAttrib1sARB(struct _glapi_table *disp,
-                      void (GLAPIENTRYP fn) (GLuint, GLshort))
-{
-    SET_by_offset(disp, _gloffset_VertexAttrib1sARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib1svARB) (GLuint, const GLshort *);
-
-#define CALL_VertexAttrib1svARB(disp, parameters) \
-    (* GET_VertexAttrib1svARB(disp)) parameters
-static inline _glptr_VertexAttrib1svARB
-GET_VertexAttrib1svARB(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttrib1svARB) (GET_by_offset
-                                        (disp, _gloffset_VertexAttrib1svARB));
-}
-
-static inline void
-SET_VertexAttrib1svARB(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLuint, const GLshort *))
-{
-    SET_by_offset(disp, _gloffset_VertexAttrib1svARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib2dARB) (GLuint, GLdouble,
-                                                     GLdouble);
-#define CALL_VertexAttrib2dARB(disp, parameters) \
-    (* GET_VertexAttrib2dARB(disp)) parameters
-static inline _glptr_VertexAttrib2dARB
-GET_VertexAttrib2dARB(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttrib2dARB) (GET_by_offset
-                                       (disp, _gloffset_VertexAttrib2dARB));
-}
-
-static inline void
-SET_VertexAttrib2dARB(struct _glapi_table *disp,
-                      void (GLAPIENTRYP fn) (GLuint, GLdouble, GLdouble))
-{
-    SET_by_offset(disp, _gloffset_VertexAttrib2dARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib2dvARB) (GLuint, const GLdouble *);
-
-#define CALL_VertexAttrib2dvARB(disp, parameters) \
-    (* GET_VertexAttrib2dvARB(disp)) parameters
-static inline _glptr_VertexAttrib2dvARB
-GET_VertexAttrib2dvARB(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttrib2dvARB) (GET_by_offset
-                                        (disp, _gloffset_VertexAttrib2dvARB));
-}
-
-static inline void
-SET_VertexAttrib2dvARB(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLuint, const GLdouble *))
-{
-    SET_by_offset(disp, _gloffset_VertexAttrib2dvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib2fARB) (GLuint, GLfloat, GLfloat);
-
-#define CALL_VertexAttrib2fARB(disp, parameters) \
-    (* GET_VertexAttrib2fARB(disp)) parameters
-static inline _glptr_VertexAttrib2fARB
-GET_VertexAttrib2fARB(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttrib2fARB) (GET_by_offset
-                                       (disp, _gloffset_VertexAttrib2fARB));
-}
-
-static inline void
-SET_VertexAttrib2fARB(struct _glapi_table *disp,
-                      void (GLAPIENTRYP fn) (GLuint, GLfloat, GLfloat))
-{
-    SET_by_offset(disp, _gloffset_VertexAttrib2fARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib2fvARB) (GLuint, const GLfloat *);
-
-#define CALL_VertexAttrib2fvARB(disp, parameters) \
-    (* GET_VertexAttrib2fvARB(disp)) parameters
-static inline _glptr_VertexAttrib2fvARB
-GET_VertexAttrib2fvARB(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttrib2fvARB) (GET_by_offset
-                                        (disp, _gloffset_VertexAttrib2fvARB));
-}
-
-static inline void
-SET_VertexAttrib2fvARB(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLuint, const GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_VertexAttrib2fvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib2sARB) (GLuint, GLshort, GLshort);
-
-#define CALL_VertexAttrib2sARB(disp, parameters) \
-    (* GET_VertexAttrib2sARB(disp)) parameters
-static inline _glptr_VertexAttrib2sARB
-GET_VertexAttrib2sARB(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttrib2sARB) (GET_by_offset
-                                       (disp, _gloffset_VertexAttrib2sARB));
-}
-
-static inline void
-SET_VertexAttrib2sARB(struct _glapi_table *disp,
-                      void (GLAPIENTRYP fn) (GLuint, GLshort, GLshort))
-{
-    SET_by_offset(disp, _gloffset_VertexAttrib2sARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib2svARB) (GLuint, const GLshort *);
-
-#define CALL_VertexAttrib2svARB(disp, parameters) \
-    (* GET_VertexAttrib2svARB(disp)) parameters
-static inline _glptr_VertexAttrib2svARB
-GET_VertexAttrib2svARB(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttrib2svARB) (GET_by_offset
-                                        (disp, _gloffset_VertexAttrib2svARB));
-}
-
-static inline void
-SET_VertexAttrib2svARB(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLuint, const GLshort *))
-{
-    SET_by_offset(disp, _gloffset_VertexAttrib2svARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib3dARB) (GLuint, GLdouble, GLdouble,
-                                                     GLdouble);
-#define CALL_VertexAttrib3dARB(disp, parameters) \
-    (* GET_VertexAttrib3dARB(disp)) parameters
-static inline _glptr_VertexAttrib3dARB
-GET_VertexAttrib3dARB(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttrib3dARB) (GET_by_offset
-                                       (disp, _gloffset_VertexAttrib3dARB));
-}
-
-static inline void
-SET_VertexAttrib3dARB(struct _glapi_table *disp,
-                      void (GLAPIENTRYP fn) (GLuint, GLdouble, GLdouble,
-                                             GLdouble))
-{
-    SET_by_offset(disp, _gloffset_VertexAttrib3dARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib3dvARB) (GLuint, const GLdouble *);
-
-#define CALL_VertexAttrib3dvARB(disp, parameters) \
-    (* GET_VertexAttrib3dvARB(disp)) parameters
-static inline _glptr_VertexAttrib3dvARB
-GET_VertexAttrib3dvARB(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttrib3dvARB) (GET_by_offset
-                                        (disp, _gloffset_VertexAttrib3dvARB));
-}
-
-static inline void
-SET_VertexAttrib3dvARB(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLuint, const GLdouble *))
-{
-    SET_by_offset(disp, _gloffset_VertexAttrib3dvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib3fARB) (GLuint, GLfloat, GLfloat,
-                                                     GLfloat);
-#define CALL_VertexAttrib3fARB(disp, parameters) \
-    (* GET_VertexAttrib3fARB(disp)) parameters
-static inline _glptr_VertexAttrib3fARB
-GET_VertexAttrib3fARB(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttrib3fARB) (GET_by_offset
-                                       (disp, _gloffset_VertexAttrib3fARB));
-}
-
-static inline void
-SET_VertexAttrib3fARB(struct _glapi_table *disp,
-                      void (GLAPIENTRYP fn) (GLuint, GLfloat, GLfloat, GLfloat))
-{
-    SET_by_offset(disp, _gloffset_VertexAttrib3fARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib3fvARB) (GLuint, const GLfloat *);
-
-#define CALL_VertexAttrib3fvARB(disp, parameters) \
-    (* GET_VertexAttrib3fvARB(disp)) parameters
-static inline _glptr_VertexAttrib3fvARB
-GET_VertexAttrib3fvARB(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttrib3fvARB) (GET_by_offset
-                                        (disp, _gloffset_VertexAttrib3fvARB));
-}
-
-static inline void
-SET_VertexAttrib3fvARB(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLuint, const GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_VertexAttrib3fvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib3sARB) (GLuint, GLshort, GLshort,
-                                                     GLshort);
-#define CALL_VertexAttrib3sARB(disp, parameters) \
-    (* GET_VertexAttrib3sARB(disp)) parameters
-static inline _glptr_VertexAttrib3sARB
-GET_VertexAttrib3sARB(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttrib3sARB) (GET_by_offset
-                                       (disp, _gloffset_VertexAttrib3sARB));
-}
-
-static inline void
-SET_VertexAttrib3sARB(struct _glapi_table *disp,
-                      void (GLAPIENTRYP fn) (GLuint, GLshort, GLshort, GLshort))
-{
-    SET_by_offset(disp, _gloffset_VertexAttrib3sARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib3svARB) (GLuint, const GLshort *);
-
-#define CALL_VertexAttrib3svARB(disp, parameters) \
-    (* GET_VertexAttrib3svARB(disp)) parameters
-static inline _glptr_VertexAttrib3svARB
-GET_VertexAttrib3svARB(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttrib3svARB) (GET_by_offset
-                                        (disp, _gloffset_VertexAttrib3svARB));
-}
-
-static inline void
-SET_VertexAttrib3svARB(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLuint, const GLshort *))
-{
-    SET_by_offset(disp, _gloffset_VertexAttrib3svARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib4NbvARB) (GLuint, const GLbyte *);
-
-#define CALL_VertexAttrib4NbvARB(disp, parameters) \
-    (* GET_VertexAttrib4NbvARB(disp)) parameters
-static inline _glptr_VertexAttrib4NbvARB
-GET_VertexAttrib4NbvARB(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttrib4NbvARB) (GET_by_offset
-                                         (disp, _gloffset_VertexAttrib4NbvARB));
-}
-
-static inline void
-SET_VertexAttrib4NbvARB(struct _glapi_table *disp,
-                        void (GLAPIENTRYP fn) (GLuint, const GLbyte *))
-{
-    SET_by_offset(disp, _gloffset_VertexAttrib4NbvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib4NivARB) (GLuint, const GLint *);
-
-#define CALL_VertexAttrib4NivARB(disp, parameters) \
-    (* GET_VertexAttrib4NivARB(disp)) parameters
-static inline _glptr_VertexAttrib4NivARB
-GET_VertexAttrib4NivARB(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttrib4NivARB) (GET_by_offset
-                                         (disp, _gloffset_VertexAttrib4NivARB));
-}
-
-static inline void
-SET_VertexAttrib4NivARB(struct _glapi_table *disp,
-                        void (GLAPIENTRYP fn) (GLuint, const GLint *))
-{
-    SET_by_offset(disp, _gloffset_VertexAttrib4NivARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib4NsvARB) (GLuint, const GLshort *);
-
-#define CALL_VertexAttrib4NsvARB(disp, parameters) \
-    (* GET_VertexAttrib4NsvARB(disp)) parameters
-static inline _glptr_VertexAttrib4NsvARB
-GET_VertexAttrib4NsvARB(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttrib4NsvARB) (GET_by_offset
-                                         (disp, _gloffset_VertexAttrib4NsvARB));
-}
-
-static inline void
-SET_VertexAttrib4NsvARB(struct _glapi_table *disp,
-                        void (GLAPIENTRYP fn) (GLuint, const GLshort *))
-{
-    SET_by_offset(disp, _gloffset_VertexAttrib4NsvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib4NubARB) (GLuint, GLubyte, GLubyte,
-                                                       GLubyte, GLubyte);
-#define CALL_VertexAttrib4NubARB(disp, parameters) \
-    (* GET_VertexAttrib4NubARB(disp)) parameters
-static inline _glptr_VertexAttrib4NubARB
-GET_VertexAttrib4NubARB(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttrib4NubARB) (GET_by_offset
-                                         (disp, _gloffset_VertexAttrib4NubARB));
-}
-
-static inline void
-SET_VertexAttrib4NubARB(struct _glapi_table *disp,
-                        void (GLAPIENTRYP fn) (GLuint, GLubyte, GLubyte,
-                                               GLubyte, GLubyte))
-{
-    SET_by_offset(disp, _gloffset_VertexAttrib4NubARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib4NubvARB) (GLuint,
-                                                        const GLubyte *);
-#define CALL_VertexAttrib4NubvARB(disp, parameters) \
-    (* GET_VertexAttrib4NubvARB(disp)) parameters
-static inline _glptr_VertexAttrib4NubvARB
-GET_VertexAttrib4NubvARB(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttrib4NubvARB) (GET_by_offset
-                                          (disp,
-                                           _gloffset_VertexAttrib4NubvARB));
-}
-
-static inline void
-SET_VertexAttrib4NubvARB(struct _glapi_table *disp,
-                         void (GLAPIENTRYP fn) (GLuint, const GLubyte *))
-{
-    SET_by_offset(disp, _gloffset_VertexAttrib4NubvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib4NuivARB) (GLuint, const GLuint *);
-
-#define CALL_VertexAttrib4NuivARB(disp, parameters) \
-    (* GET_VertexAttrib4NuivARB(disp)) parameters
-static inline _glptr_VertexAttrib4NuivARB
-GET_VertexAttrib4NuivARB(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttrib4NuivARB) (GET_by_offset
-                                          (disp,
-                                           _gloffset_VertexAttrib4NuivARB));
-}
-
-static inline void
-SET_VertexAttrib4NuivARB(struct _glapi_table *disp,
-                         void (GLAPIENTRYP fn) (GLuint, const GLuint *))
-{
-    SET_by_offset(disp, _gloffset_VertexAttrib4NuivARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib4NusvARB) (GLuint,
-                                                        const GLushort *);
-#define CALL_VertexAttrib4NusvARB(disp, parameters) \
-    (* GET_VertexAttrib4NusvARB(disp)) parameters
-static inline _glptr_VertexAttrib4NusvARB
-GET_VertexAttrib4NusvARB(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttrib4NusvARB) (GET_by_offset
-                                          (disp,
-                                           _gloffset_VertexAttrib4NusvARB));
-}
-
-static inline void
-SET_VertexAttrib4NusvARB(struct _glapi_table *disp,
-                         void (GLAPIENTRYP fn) (GLuint, const GLushort *))
-{
-    SET_by_offset(disp, _gloffset_VertexAttrib4NusvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib4bvARB) (GLuint, const GLbyte *);
-
-#define CALL_VertexAttrib4bvARB(disp, parameters) \
-    (* GET_VertexAttrib4bvARB(disp)) parameters
-static inline _glptr_VertexAttrib4bvARB
-GET_VertexAttrib4bvARB(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttrib4bvARB) (GET_by_offset
-                                        (disp, _gloffset_VertexAttrib4bvARB));
-}
-
-static inline void
-SET_VertexAttrib4bvARB(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLuint, const GLbyte *))
-{
-    SET_by_offset(disp, _gloffset_VertexAttrib4bvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib4dARB) (GLuint, GLdouble, GLdouble,
-                                                     GLdouble, GLdouble);
-#define CALL_VertexAttrib4dARB(disp, parameters) \
-    (* GET_VertexAttrib4dARB(disp)) parameters
-static inline _glptr_VertexAttrib4dARB
-GET_VertexAttrib4dARB(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttrib4dARB) (GET_by_offset
-                                       (disp, _gloffset_VertexAttrib4dARB));
-}
-
-static inline void
-SET_VertexAttrib4dARB(struct _glapi_table *disp,
-                      void (GLAPIENTRYP fn) (GLuint, GLdouble, GLdouble,
-                                             GLdouble, GLdouble))
-{
-    SET_by_offset(disp, _gloffset_VertexAttrib4dARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib4dvARB) (GLuint, const GLdouble *);
-
-#define CALL_VertexAttrib4dvARB(disp, parameters) \
-    (* GET_VertexAttrib4dvARB(disp)) parameters
-static inline _glptr_VertexAttrib4dvARB
-GET_VertexAttrib4dvARB(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttrib4dvARB) (GET_by_offset
-                                        (disp, _gloffset_VertexAttrib4dvARB));
-}
-
-static inline void
-SET_VertexAttrib4dvARB(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLuint, const GLdouble *))
-{
-    SET_by_offset(disp, _gloffset_VertexAttrib4dvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib4fARB) (GLuint, GLfloat, GLfloat,
-                                                     GLfloat, GLfloat);
-#define CALL_VertexAttrib4fARB(disp, parameters) \
-    (* GET_VertexAttrib4fARB(disp)) parameters
-static inline _glptr_VertexAttrib4fARB
-GET_VertexAttrib4fARB(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttrib4fARB) (GET_by_offset
-                                       (disp, _gloffset_VertexAttrib4fARB));
-}
-
-static inline void
-SET_VertexAttrib4fARB(struct _glapi_table *disp,
-                      void (GLAPIENTRYP fn) (GLuint, GLfloat, GLfloat, GLfloat,
-                                             GLfloat))
-{
-    SET_by_offset(disp, _gloffset_VertexAttrib4fARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib4fvARB) (GLuint, const GLfloat *);
-
-#define CALL_VertexAttrib4fvARB(disp, parameters) \
-    (* GET_VertexAttrib4fvARB(disp)) parameters
-static inline _glptr_VertexAttrib4fvARB
-GET_VertexAttrib4fvARB(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttrib4fvARB) (GET_by_offset
-                                        (disp, _gloffset_VertexAttrib4fvARB));
-}
-
-static inline void
-SET_VertexAttrib4fvARB(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLuint, const GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_VertexAttrib4fvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib4ivARB) (GLuint, const GLint *);
-
-#define CALL_VertexAttrib4ivARB(disp, parameters) \
-    (* GET_VertexAttrib4ivARB(disp)) parameters
-static inline _glptr_VertexAttrib4ivARB
-GET_VertexAttrib4ivARB(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttrib4ivARB) (GET_by_offset
-                                        (disp, _gloffset_VertexAttrib4ivARB));
-}
-
-static inline void
-SET_VertexAttrib4ivARB(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLuint, const GLint *))
-{
-    SET_by_offset(disp, _gloffset_VertexAttrib4ivARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib4sARB) (GLuint, GLshort, GLshort,
-                                                     GLshort, GLshort);
-#define CALL_VertexAttrib4sARB(disp, parameters) \
-    (* GET_VertexAttrib4sARB(disp)) parameters
-static inline _glptr_VertexAttrib4sARB
-GET_VertexAttrib4sARB(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttrib4sARB) (GET_by_offset
-                                       (disp, _gloffset_VertexAttrib4sARB));
-}
-
-static inline void
-SET_VertexAttrib4sARB(struct _glapi_table *disp,
-                      void (GLAPIENTRYP fn) (GLuint, GLshort, GLshort, GLshort,
-                                             GLshort))
-{
-    SET_by_offset(disp, _gloffset_VertexAttrib4sARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib4svARB) (GLuint, const GLshort *);
-
-#define CALL_VertexAttrib4svARB(disp, parameters) \
-    (* GET_VertexAttrib4svARB(disp)) parameters
-static inline _glptr_VertexAttrib4svARB
-GET_VertexAttrib4svARB(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttrib4svARB) (GET_by_offset
-                                        (disp, _gloffset_VertexAttrib4svARB));
-}
-
-static inline void
-SET_VertexAttrib4svARB(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLuint, const GLshort *))
-{
-    SET_by_offset(disp, _gloffset_VertexAttrib4svARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib4ubvARB) (GLuint, const GLubyte *);
-
-#define CALL_VertexAttrib4ubvARB(disp, parameters) \
-    (* GET_VertexAttrib4ubvARB(disp)) parameters
-static inline _glptr_VertexAttrib4ubvARB
-GET_VertexAttrib4ubvARB(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttrib4ubvARB) (GET_by_offset
-                                         (disp, _gloffset_VertexAttrib4ubvARB));
-}
-
-static inline void
-SET_VertexAttrib4ubvARB(struct _glapi_table *disp,
-                        void (GLAPIENTRYP fn) (GLuint, const GLubyte *))
-{
-    SET_by_offset(disp, _gloffset_VertexAttrib4ubvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib4uivARB) (GLuint, const GLuint *);
-
-#define CALL_VertexAttrib4uivARB(disp, parameters) \
-    (* GET_VertexAttrib4uivARB(disp)) parameters
-static inline _glptr_VertexAttrib4uivARB
-GET_VertexAttrib4uivARB(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttrib4uivARB) (GET_by_offset
-                                         (disp, _gloffset_VertexAttrib4uivARB));
-}
-
-static inline void
-SET_VertexAttrib4uivARB(struct _glapi_table *disp,
-                        void (GLAPIENTRYP fn) (GLuint, const GLuint *))
-{
-    SET_by_offset(disp, _gloffset_VertexAttrib4uivARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib4usvARB) (GLuint,
-                                                       const GLushort *);
-#define CALL_VertexAttrib4usvARB(disp, parameters) \
-    (* GET_VertexAttrib4usvARB(disp)) parameters
-static inline _glptr_VertexAttrib4usvARB
-GET_VertexAttrib4usvARB(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttrib4usvARB) (GET_by_offset
-                                         (disp, _gloffset_VertexAttrib4usvARB));
-}
-
-static inline void
-SET_VertexAttrib4usvARB(struct _glapi_table *disp,
-                        void (GLAPIENTRYP fn) (GLuint, const GLushort *))
-{
-    SET_by_offset(disp, _gloffset_VertexAttrib4usvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribPointerARB) (GLuint, GLint, GLenum,
-                                                          GLboolean, GLsizei,
-                                                          const GLvoid *);
-#define CALL_VertexAttribPointerARB(disp, parameters) \
-    (* GET_VertexAttribPointerARB(disp)) parameters
-static inline _glptr_VertexAttribPointerARB
-GET_VertexAttribPointerARB(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttribPointerARB) (GET_by_offset
-                                            (disp,
-                                             _gloffset_VertexAttribPointerARB));
-}
-
-static inline void
-SET_VertexAttribPointerARB(struct _glapi_table *disp,
-                           void (GLAPIENTRYP fn) (GLuint, GLint, GLenum,
-                                                  GLboolean, GLsizei,
-                                                  const GLvoid *))
-{
-    SET_by_offset(disp, _gloffset_VertexAttribPointerARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_BindBufferARB) (GLenum, GLuint);
-
-#define CALL_BindBufferARB(disp, parameters) \
-    (* GET_BindBufferARB(disp)) parameters
-static inline _glptr_BindBufferARB
-GET_BindBufferARB(struct _glapi_table *disp)
-{
-    return (_glptr_BindBufferARB) (GET_by_offset
-                                   (disp, _gloffset_BindBufferARB));
-}
-
-static inline void
-SET_BindBufferARB(struct _glapi_table *disp,
-                  void (GLAPIENTRYP fn) (GLenum, GLuint))
-{
-    SET_by_offset(disp, _gloffset_BindBufferARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_BufferDataARB) (GLenum, GLsizeiptrARB,
-                                                 const GLvoid *, GLenum);
-#define CALL_BufferDataARB(disp, parameters) \
-    (* GET_BufferDataARB(disp)) parameters
-static inline _glptr_BufferDataARB
-GET_BufferDataARB(struct _glapi_table *disp)
-{
-    return (_glptr_BufferDataARB) (GET_by_offset
-                                   (disp, _gloffset_BufferDataARB));
-}
-
-static inline void
-SET_BufferDataARB(struct _glapi_table *disp,
-                  void (GLAPIENTRYP fn) (GLenum, GLsizeiptrARB, const GLvoid *,
-                                         GLenum))
-{
-    SET_by_offset(disp, _gloffset_BufferDataARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_BufferSubDataARB) (GLenum, GLintptrARB,
-                                                    GLsizeiptrARB,
-                                                    const GLvoid *);
-#define CALL_BufferSubDataARB(disp, parameters) \
-    (* GET_BufferSubDataARB(disp)) parameters
-static inline _glptr_BufferSubDataARB
-GET_BufferSubDataARB(struct _glapi_table *disp)
-{
-    return (_glptr_BufferSubDataARB) (GET_by_offset
-                                      (disp, _gloffset_BufferSubDataARB));
-}
-
-static inline void
-SET_BufferSubDataARB(struct _glapi_table *disp,
-                     void (GLAPIENTRYP fn) (GLenum, GLintptrARB, GLsizeiptrARB,
-                                            const GLvoid *))
-{
-    SET_by_offset(disp, _gloffset_BufferSubDataARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_DeleteBuffersARB) (GLsizei, const GLuint *);
-
-#define CALL_DeleteBuffersARB(disp, parameters) \
-    (* GET_DeleteBuffersARB(disp)) parameters
-static inline _glptr_DeleteBuffersARB
-GET_DeleteBuffersARB(struct _glapi_table *disp)
-{
-    return (_glptr_DeleteBuffersARB) (GET_by_offset
-                                      (disp, _gloffset_DeleteBuffersARB));
-}
-
-static inline void
-SET_DeleteBuffersARB(struct _glapi_table *disp,
-                     void (GLAPIENTRYP fn) (GLsizei, const GLuint *))
-{
-    SET_by_offset(disp, _gloffset_DeleteBuffersARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GenBuffersARB) (GLsizei, GLuint *);
-
-#define CALL_GenBuffersARB(disp, parameters) \
-    (* GET_GenBuffersARB(disp)) parameters
-static inline _glptr_GenBuffersARB
-GET_GenBuffersARB(struct _glapi_table *disp)
-{
-    return (_glptr_GenBuffersARB) (GET_by_offset
-                                   (disp, _gloffset_GenBuffersARB));
-}
-
-static inline void
-SET_GenBuffersARB(struct _glapi_table *disp,
-                  void (GLAPIENTRYP fn) (GLsizei, GLuint *))
-{
-    SET_by_offset(disp, _gloffset_GenBuffersARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetBufferParameterivARB) (GLenum, GLenum,
-                                                           GLint *);
-#define CALL_GetBufferParameterivARB(disp, parameters) \
-    (* GET_GetBufferParameterivARB(disp)) parameters
-static inline _glptr_GetBufferParameterivARB
-GET_GetBufferParameterivARB(struct _glapi_table *disp)
-{
-    return (_glptr_GetBufferParameterivARB) (GET_by_offset
-                                             (disp,
-                                              _gloffset_GetBufferParameterivARB));
-}
-
-static inline void
-SET_GetBufferParameterivARB(struct _glapi_table *disp,
-                            void (GLAPIENTRYP fn) (GLenum, GLenum, GLint *))
-{
-    SET_by_offset(disp, _gloffset_GetBufferParameterivARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetBufferPointervARB) (GLenum, GLenum,
-                                                        GLvoid **);
-#define CALL_GetBufferPointervARB(disp, parameters) \
-    (* GET_GetBufferPointervARB(disp)) parameters
-static inline _glptr_GetBufferPointervARB
-GET_GetBufferPointervARB(struct _glapi_table *disp)
-{
-    return (_glptr_GetBufferPointervARB) (GET_by_offset
-                                          (disp,
-                                           _gloffset_GetBufferPointervARB));
-}
-
-static inline void
-SET_GetBufferPointervARB(struct _glapi_table *disp,
-                         void (GLAPIENTRYP fn) (GLenum, GLenum, GLvoid **))
-{
-    SET_by_offset(disp, _gloffset_GetBufferPointervARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetBufferSubDataARB) (GLenum, GLintptrARB,
-                                                       GLsizeiptrARB, GLvoid *);
-#define CALL_GetBufferSubDataARB(disp, parameters) \
-    (* GET_GetBufferSubDataARB(disp)) parameters
-static inline _glptr_GetBufferSubDataARB
-GET_GetBufferSubDataARB(struct _glapi_table *disp)
-{
-    return (_glptr_GetBufferSubDataARB) (GET_by_offset
-                                         (disp, _gloffset_GetBufferSubDataARB));
-}
-
-static inline void
-SET_GetBufferSubDataARB(struct _glapi_table *disp,
-                        void (GLAPIENTRYP fn) (GLenum, GLintptrARB,
-                                               GLsizeiptrARB, GLvoid *))
-{
-    SET_by_offset(disp, _gloffset_GetBufferSubDataARB, fn);
-}
-
-typedef GLboolean(GLAPIENTRYP _glptr_IsBufferARB) (GLuint);
-
-#define CALL_IsBufferARB(disp, parameters) \
-    (* GET_IsBufferARB(disp)) parameters
-static inline _glptr_IsBufferARB
-GET_IsBufferARB(struct _glapi_table *disp)
-{
-    return (_glptr_IsBufferARB) (GET_by_offset(disp, _gloffset_IsBufferARB));
-}
-
-static inline void
-SET_IsBufferARB(struct _glapi_table *disp, GLboolean(GLAPIENTRYP fn) (GLuint))
-{
-    SET_by_offset(disp, _gloffset_IsBufferARB, fn);
-}
-
-typedef GLvoid *(GLAPIENTRYP _glptr_MapBufferARB) (GLenum, GLenum);
-
-#define CALL_MapBufferARB(disp, parameters) \
-    (* GET_MapBufferARB(disp)) parameters
-static inline _glptr_MapBufferARB
-GET_MapBufferARB(struct _glapi_table *disp)
-{
-    return (_glptr_MapBufferARB) (GET_by_offset(disp, _gloffset_MapBufferARB));
-}
-
-static inline void
-SET_MapBufferARB(struct _glapi_table *disp,
-                 GLvoid * (GLAPIENTRYP fn) (GLenum, GLenum))
-{
-    SET_by_offset(disp, _gloffset_MapBufferARB, fn);
-}
-
-typedef GLboolean(GLAPIENTRYP _glptr_UnmapBufferARB) (GLenum);
-
-#define CALL_UnmapBufferARB(disp, parameters) \
-    (* GET_UnmapBufferARB(disp)) parameters
-static inline _glptr_UnmapBufferARB
-GET_UnmapBufferARB(struct _glapi_table *disp)
-{
-    return (_glptr_UnmapBufferARB) (GET_by_offset
-                                    (disp, _gloffset_UnmapBufferARB));
-}
-
-static inline void
-SET_UnmapBufferARB(struct _glapi_table *disp,
-                   GLboolean(GLAPIENTRYP fn) (GLenum))
-{
-    SET_by_offset(disp, _gloffset_UnmapBufferARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_BeginQueryARB) (GLenum, GLuint);
-
-#define CALL_BeginQueryARB(disp, parameters) \
-    (* GET_BeginQueryARB(disp)) parameters
-static inline _glptr_BeginQueryARB
-GET_BeginQueryARB(struct _glapi_table *disp)
-{
-    return (_glptr_BeginQueryARB) (GET_by_offset
-                                   (disp, _gloffset_BeginQueryARB));
-}
-
-static inline void
-SET_BeginQueryARB(struct _glapi_table *disp,
-                  void (GLAPIENTRYP fn) (GLenum, GLuint))
-{
-    SET_by_offset(disp, _gloffset_BeginQueryARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_DeleteQueriesARB) (GLsizei, const GLuint *);
-
-#define CALL_DeleteQueriesARB(disp, parameters) \
-    (* GET_DeleteQueriesARB(disp)) parameters
-static inline _glptr_DeleteQueriesARB
-GET_DeleteQueriesARB(struct _glapi_table *disp)
-{
-    return (_glptr_DeleteQueriesARB) (GET_by_offset
-                                      (disp, _gloffset_DeleteQueriesARB));
-}
-
-static inline void
-SET_DeleteQueriesARB(struct _glapi_table *disp,
-                     void (GLAPIENTRYP fn) (GLsizei, const GLuint *))
-{
-    SET_by_offset(disp, _gloffset_DeleteQueriesARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_EndQueryARB) (GLenum);
-
-#define CALL_EndQueryARB(disp, parameters) \
-    (* GET_EndQueryARB(disp)) parameters
-static inline _glptr_EndQueryARB
-GET_EndQueryARB(struct _glapi_table *disp)
-{
-    return (_glptr_EndQueryARB) (GET_by_offset(disp, _gloffset_EndQueryARB));
-}
-
-static inline void
-SET_EndQueryARB(struct _glapi_table *disp, void (GLAPIENTRYP fn) (GLenum))
-{
-    SET_by_offset(disp, _gloffset_EndQueryARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GenQueriesARB) (GLsizei, GLuint *);
-
-#define CALL_GenQueriesARB(disp, parameters) \
-    (* GET_GenQueriesARB(disp)) parameters
-static inline _glptr_GenQueriesARB
-GET_GenQueriesARB(struct _glapi_table *disp)
-{
-    return (_glptr_GenQueriesARB) (GET_by_offset
-                                   (disp, _gloffset_GenQueriesARB));
-}
-
-static inline void
-SET_GenQueriesARB(struct _glapi_table *disp,
-                  void (GLAPIENTRYP fn) (GLsizei, GLuint *))
-{
-    SET_by_offset(disp, _gloffset_GenQueriesARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetQueryObjectivARB) (GLuint, GLenum, GLint *);
-
-#define CALL_GetQueryObjectivARB(disp, parameters) \
-    (* GET_GetQueryObjectivARB(disp)) parameters
-static inline _glptr_GetQueryObjectivARB
-GET_GetQueryObjectivARB(struct _glapi_table *disp)
-{
-    return (_glptr_GetQueryObjectivARB) (GET_by_offset
-                                         (disp, _gloffset_GetQueryObjectivARB));
-}
-
-static inline void
-SET_GetQueryObjectivARB(struct _glapi_table *disp,
-                        void (GLAPIENTRYP fn) (GLuint, GLenum, GLint *))
-{
-    SET_by_offset(disp, _gloffset_GetQueryObjectivARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetQueryObjectuivARB) (GLuint, GLenum,
-                                                        GLuint *);
-#define CALL_GetQueryObjectuivARB(disp, parameters) \
-    (* GET_GetQueryObjectuivARB(disp)) parameters
-static inline _glptr_GetQueryObjectuivARB
-GET_GetQueryObjectuivARB(struct _glapi_table *disp)
-{
-    return (_glptr_GetQueryObjectuivARB) (GET_by_offset
-                                          (disp,
-                                           _gloffset_GetQueryObjectuivARB));
-}
-
-static inline void
-SET_GetQueryObjectuivARB(struct _glapi_table *disp,
-                         void (GLAPIENTRYP fn) (GLuint, GLenum, GLuint *))
-{
-    SET_by_offset(disp, _gloffset_GetQueryObjectuivARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetQueryivARB) (GLenum, GLenum, GLint *);
-
-#define CALL_GetQueryivARB(disp, parameters) \
-    (* GET_GetQueryivARB(disp)) parameters
-static inline _glptr_GetQueryivARB
-GET_GetQueryivARB(struct _glapi_table *disp)
-{
-    return (_glptr_GetQueryivARB) (GET_by_offset
-                                   (disp, _gloffset_GetQueryivARB));
-}
-
-static inline void
-SET_GetQueryivARB(struct _glapi_table *disp,
-                  void (GLAPIENTRYP fn) (GLenum, GLenum, GLint *))
-{
-    SET_by_offset(disp, _gloffset_GetQueryivARB, fn);
-}
-
-typedef GLboolean(GLAPIENTRYP _glptr_IsQueryARB) (GLuint);
-
-#define CALL_IsQueryARB(disp, parameters) \
-    (* GET_IsQueryARB(disp)) parameters
-static inline _glptr_IsQueryARB
-GET_IsQueryARB(struct _glapi_table *disp)
-{
-    return (_glptr_IsQueryARB) (GET_by_offset(disp, _gloffset_IsQueryARB));
-}
-
-static inline void
-SET_IsQueryARB(struct _glapi_table *disp, GLboolean(GLAPIENTRYP fn) (GLuint))
-{
-    SET_by_offset(disp, _gloffset_IsQueryARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_AttachObjectARB) (GLhandleARB, GLhandleARB);
-
-#define CALL_AttachObjectARB(disp, parameters) \
-    (* GET_AttachObjectARB(disp)) parameters
-static inline _glptr_AttachObjectARB
-GET_AttachObjectARB(struct _glapi_table *disp)
-{
-    return (_glptr_AttachObjectARB) (GET_by_offset
-                                     (disp, _gloffset_AttachObjectARB));
-}
-
-static inline void
-SET_AttachObjectARB(struct _glapi_table *disp,
-                    void (GLAPIENTRYP fn) (GLhandleARB, GLhandleARB))
-{
-    SET_by_offset(disp, _gloffset_AttachObjectARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_CompileShaderARB) (GLhandleARB);
-
-#define CALL_CompileShaderARB(disp, parameters) \
-    (* GET_CompileShaderARB(disp)) parameters
-static inline _glptr_CompileShaderARB
-GET_CompileShaderARB(struct _glapi_table *disp)
-{
-    return (_glptr_CompileShaderARB) (GET_by_offset
-                                      (disp, _gloffset_CompileShaderARB));
-}
-
-static inline void
-SET_CompileShaderARB(struct _glapi_table *disp,
-                     void (GLAPIENTRYP fn) (GLhandleARB))
-{
-    SET_by_offset(disp, _gloffset_CompileShaderARB, fn);
-}
-
-typedef GLhandleARB(GLAPIENTRYP _glptr_CreateProgramObjectARB) (void);
-
-#define CALL_CreateProgramObjectARB(disp, parameters) \
-    (* GET_CreateProgramObjectARB(disp)) parameters
-static inline _glptr_CreateProgramObjectARB
-GET_CreateProgramObjectARB(struct _glapi_table *disp)
-{
-    return (_glptr_CreateProgramObjectARB) (GET_by_offset
-                                            (disp,
-                                             _gloffset_CreateProgramObjectARB));
-}
-
-static inline void
-SET_CreateProgramObjectARB(struct _glapi_table *disp,
-                           GLhandleARB(GLAPIENTRYP fn) (void))
-{
-    SET_by_offset(disp, _gloffset_CreateProgramObjectARB, fn);
-}
-
-typedef GLhandleARB(GLAPIENTRYP _glptr_CreateShaderObjectARB) (GLenum);
-
-#define CALL_CreateShaderObjectARB(disp, parameters) \
-    (* GET_CreateShaderObjectARB(disp)) parameters
-static inline _glptr_CreateShaderObjectARB
-GET_CreateShaderObjectARB(struct _glapi_table *disp)
-{
-    return (_glptr_CreateShaderObjectARB) (GET_by_offset
-                                           (disp,
-                                            _gloffset_CreateShaderObjectARB));
-}
-
-static inline void
-SET_CreateShaderObjectARB(struct _glapi_table *disp,
-                          GLhandleARB(GLAPIENTRYP fn) (GLenum))
-{
-    SET_by_offset(disp, _gloffset_CreateShaderObjectARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_DeleteObjectARB) (GLhandleARB);
-
-#define CALL_DeleteObjectARB(disp, parameters) \
-    (* GET_DeleteObjectARB(disp)) parameters
-static inline _glptr_DeleteObjectARB
-GET_DeleteObjectARB(struct _glapi_table *disp)
-{
-    return (_glptr_DeleteObjectARB) (GET_by_offset
-                                     (disp, _gloffset_DeleteObjectARB));
-}
-
-static inline void
-SET_DeleteObjectARB(struct _glapi_table *disp,
-                    void (GLAPIENTRYP fn) (GLhandleARB))
-{
-    SET_by_offset(disp, _gloffset_DeleteObjectARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_DetachObjectARB) (GLhandleARB, GLhandleARB);
-
-#define CALL_DetachObjectARB(disp, parameters) \
-    (* GET_DetachObjectARB(disp)) parameters
-static inline _glptr_DetachObjectARB
-GET_DetachObjectARB(struct _glapi_table *disp)
-{
-    return (_glptr_DetachObjectARB) (GET_by_offset
-                                     (disp, _gloffset_DetachObjectARB));
-}
-
-static inline void
-SET_DetachObjectARB(struct _glapi_table *disp,
-                    void (GLAPIENTRYP fn) (GLhandleARB, GLhandleARB))
-{
-    SET_by_offset(disp, _gloffset_DetachObjectARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetActiveUniformARB) (GLhandleARB, GLuint,
-                                                       GLsizei, GLsizei *,
-                                                       GLint *, GLenum *,
-                                                       GLcharARB *);
-#define CALL_GetActiveUniformARB(disp, parameters) \
-    (* GET_GetActiveUniformARB(disp)) parameters
-static inline _glptr_GetActiveUniformARB
-GET_GetActiveUniformARB(struct _glapi_table *disp)
-{
-    return (_glptr_GetActiveUniformARB) (GET_by_offset
-                                         (disp, _gloffset_GetActiveUniformARB));
-}
-
-static inline void
-SET_GetActiveUniformARB(struct _glapi_table *disp,
-                        void (GLAPIENTRYP fn) (GLhandleARB, GLuint, GLsizei,
-                                               GLsizei *, GLint *, GLenum *,
-                                               GLcharARB *))
-{
-    SET_by_offset(disp, _gloffset_GetActiveUniformARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetAttachedObjectsARB) (GLhandleARB, GLsizei,
-                                                         GLsizei *,
-                                                         GLhandleARB *);
-#define CALL_GetAttachedObjectsARB(disp, parameters) \
-    (* GET_GetAttachedObjectsARB(disp)) parameters
-static inline _glptr_GetAttachedObjectsARB
-GET_GetAttachedObjectsARB(struct _glapi_table *disp)
-{
-    return (_glptr_GetAttachedObjectsARB) (GET_by_offset
-                                           (disp,
-                                            _gloffset_GetAttachedObjectsARB));
-}
-
-static inline void
-SET_GetAttachedObjectsARB(struct _glapi_table *disp,
-                          void (GLAPIENTRYP fn) (GLhandleARB, GLsizei,
-                                                 GLsizei *, GLhandleARB *))
-{
-    SET_by_offset(disp, _gloffset_GetAttachedObjectsARB, fn);
-}
-
-typedef GLhandleARB(GLAPIENTRYP _glptr_GetHandleARB) (GLenum);
-
-#define CALL_GetHandleARB(disp, parameters) \
-    (* GET_GetHandleARB(disp)) parameters
-static inline _glptr_GetHandleARB
-GET_GetHandleARB(struct _glapi_table *disp)
-{
-    return (_glptr_GetHandleARB) (GET_by_offset(disp, _gloffset_GetHandleARB));
-}
-
-static inline void
-SET_GetHandleARB(struct _glapi_table *disp,
-                 GLhandleARB(GLAPIENTRYP fn) (GLenum))
-{
-    SET_by_offset(disp, _gloffset_GetHandleARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetInfoLogARB) (GLhandleARB, GLsizei,
-                                                 GLsizei *, GLcharARB *);
-#define CALL_GetInfoLogARB(disp, parameters) \
-    (* GET_GetInfoLogARB(disp)) parameters
-static inline _glptr_GetInfoLogARB
-GET_GetInfoLogARB(struct _glapi_table *disp)
-{
-    return (_glptr_GetInfoLogARB) (GET_by_offset
-                                   (disp, _gloffset_GetInfoLogARB));
-}
-
-static inline void
-SET_GetInfoLogARB(struct _glapi_table *disp,
-                  void (GLAPIENTRYP fn) (GLhandleARB, GLsizei, GLsizei *,
-                                         GLcharARB *))
-{
-    SET_by_offset(disp, _gloffset_GetInfoLogARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetObjectParameterfvARB) (GLhandleARB, GLenum,
-                                                           GLfloat *);
-#define CALL_GetObjectParameterfvARB(disp, parameters) \
-    (* GET_GetObjectParameterfvARB(disp)) parameters
-static inline _glptr_GetObjectParameterfvARB
-GET_GetObjectParameterfvARB(struct _glapi_table *disp)
-{
-    return (_glptr_GetObjectParameterfvARB) (GET_by_offset
-                                             (disp,
-                                              _gloffset_GetObjectParameterfvARB));
-}
-
-static inline void
-SET_GetObjectParameterfvARB(struct _glapi_table *disp,
-                            void (GLAPIENTRYP fn) (GLhandleARB, GLenum,
-                                                   GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_GetObjectParameterfvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetObjectParameterivARB) (GLhandleARB, GLenum,
-                                                           GLint *);
-#define CALL_GetObjectParameterivARB(disp, parameters) \
-    (* GET_GetObjectParameterivARB(disp)) parameters
-static inline _glptr_GetObjectParameterivARB
-GET_GetObjectParameterivARB(struct _glapi_table *disp)
-{
-    return (_glptr_GetObjectParameterivARB) (GET_by_offset
-                                             (disp,
-                                              _gloffset_GetObjectParameterivARB));
-}
-
-static inline void
-SET_GetObjectParameterivARB(struct _glapi_table *disp,
-                            void (GLAPIENTRYP fn) (GLhandleARB, GLenum,
-                                                   GLint *))
-{
-    SET_by_offset(disp, _gloffset_GetObjectParameterivARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetShaderSourceARB) (GLhandleARB, GLsizei,
-                                                      GLsizei *, GLcharARB *);
-#define CALL_GetShaderSourceARB(disp, parameters) \
-    (* GET_GetShaderSourceARB(disp)) parameters
-static inline _glptr_GetShaderSourceARB
-GET_GetShaderSourceARB(struct _glapi_table *disp)
-{
-    return (_glptr_GetShaderSourceARB) (GET_by_offset
-                                        (disp, _gloffset_GetShaderSourceARB));
-}
-
-static inline void
-SET_GetShaderSourceARB(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLhandleARB, GLsizei, GLsizei *,
-                                              GLcharARB *))
-{
-    SET_by_offset(disp, _gloffset_GetShaderSourceARB, fn);
-}
-
-typedef GLint(GLAPIENTRYP _glptr_GetUniformLocationARB) (GLhandleARB,
-                                                         const GLcharARB *);
-#define CALL_GetUniformLocationARB(disp, parameters) \
-    (* GET_GetUniformLocationARB(disp)) parameters
-static inline _glptr_GetUniformLocationARB
-GET_GetUniformLocationARB(struct _glapi_table *disp)
-{
-    return (_glptr_GetUniformLocationARB) (GET_by_offset
-                                           (disp,
-                                            _gloffset_GetUniformLocationARB));
-}
-
-static inline void
-SET_GetUniformLocationARB(struct _glapi_table *disp,
-                          GLint(GLAPIENTRYP fn) (GLhandleARB,
-                                                 const GLcharARB *))
-{
-    SET_by_offset(disp, _gloffset_GetUniformLocationARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetUniformfvARB) (GLhandleARB, GLint,
-                                                   GLfloat *);
-#define CALL_GetUniformfvARB(disp, parameters) \
-    (* GET_GetUniformfvARB(disp)) parameters
-static inline _glptr_GetUniformfvARB
-GET_GetUniformfvARB(struct _glapi_table *disp)
-{
-    return (_glptr_GetUniformfvARB) (GET_by_offset
-                                     (disp, _gloffset_GetUniformfvARB));
-}
-
-static inline void
-SET_GetUniformfvARB(struct _glapi_table *disp,
-                    void (GLAPIENTRYP fn) (GLhandleARB, GLint, GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_GetUniformfvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetUniformivARB) (GLhandleARB, GLint, GLint *);
-
-#define CALL_GetUniformivARB(disp, parameters) \
-    (* GET_GetUniformivARB(disp)) parameters
-static inline _glptr_GetUniformivARB
-GET_GetUniformivARB(struct _glapi_table *disp)
-{
-    return (_glptr_GetUniformivARB) (GET_by_offset
-                                     (disp, _gloffset_GetUniformivARB));
-}
-
-static inline void
-SET_GetUniformivARB(struct _glapi_table *disp,
-                    void (GLAPIENTRYP fn) (GLhandleARB, GLint, GLint *))
-{
-    SET_by_offset(disp, _gloffset_GetUniformivARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_LinkProgramARB) (GLhandleARB);
-
-#define CALL_LinkProgramARB(disp, parameters) \
-    (* GET_LinkProgramARB(disp)) parameters
-static inline _glptr_LinkProgramARB
-GET_LinkProgramARB(struct _glapi_table *disp)
-{
-    return (_glptr_LinkProgramARB) (GET_by_offset
-                                    (disp, _gloffset_LinkProgramARB));
-}
-
-static inline void
-SET_LinkProgramARB(struct _glapi_table *disp,
-                   void (GLAPIENTRYP fn) (GLhandleARB))
-{
-    SET_by_offset(disp, _gloffset_LinkProgramARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ShaderSourceARB) (GLhandleARB, GLsizei,
-                                                   const GLcharARB **,
-                                                   const GLint *);
-#define CALL_ShaderSourceARB(disp, parameters) \
-    (* GET_ShaderSourceARB(disp)) parameters
-static inline _glptr_ShaderSourceARB
-GET_ShaderSourceARB(struct _glapi_table *disp)
-{
-    return (_glptr_ShaderSourceARB) (GET_by_offset
-                                     (disp, _gloffset_ShaderSourceARB));
-}
-
-static inline void
-SET_ShaderSourceARB(struct _glapi_table *disp,
-                    void (GLAPIENTRYP fn) (GLhandleARB, GLsizei,
-                                           const GLcharARB **, const GLint *))
-{
-    SET_by_offset(disp, _gloffset_ShaderSourceARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Uniform1fARB) (GLint, GLfloat);
-
-#define CALL_Uniform1fARB(disp, parameters) \
-    (* GET_Uniform1fARB(disp)) parameters
-static inline _glptr_Uniform1fARB
-GET_Uniform1fARB(struct _glapi_table *disp)
-{
-    return (_glptr_Uniform1fARB) (GET_by_offset(disp, _gloffset_Uniform1fARB));
-}
-
-static inline void
-SET_Uniform1fARB(struct _glapi_table *disp,
-                 void (GLAPIENTRYP fn) (GLint, GLfloat))
-{
-    SET_by_offset(disp, _gloffset_Uniform1fARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Uniform1fvARB) (GLint, GLsizei,
-                                                 const GLfloat *);
-#define CALL_Uniform1fvARB(disp, parameters) \
-    (* GET_Uniform1fvARB(disp)) parameters
-static inline _glptr_Uniform1fvARB
-GET_Uniform1fvARB(struct _glapi_table *disp)
-{
-    return (_glptr_Uniform1fvARB) (GET_by_offset
-                                   (disp, _gloffset_Uniform1fvARB));
-}
-
-static inline void
-SET_Uniform1fvARB(struct _glapi_table *disp,
-                  void (GLAPIENTRYP fn) (GLint, GLsizei, const GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_Uniform1fvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Uniform1iARB) (GLint, GLint);
-
-#define CALL_Uniform1iARB(disp, parameters) \
-    (* GET_Uniform1iARB(disp)) parameters
-static inline _glptr_Uniform1iARB
-GET_Uniform1iARB(struct _glapi_table *disp)
-{
-    return (_glptr_Uniform1iARB) (GET_by_offset(disp, _gloffset_Uniform1iARB));
-}
-
-static inline void
-SET_Uniform1iARB(struct _glapi_table *disp,
-                 void (GLAPIENTRYP fn) (GLint, GLint))
-{
-    SET_by_offset(disp, _gloffset_Uniform1iARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Uniform1ivARB) (GLint, GLsizei, const GLint *);
-
-#define CALL_Uniform1ivARB(disp, parameters) \
-    (* GET_Uniform1ivARB(disp)) parameters
-static inline _glptr_Uniform1ivARB
-GET_Uniform1ivARB(struct _glapi_table *disp)
-{
-    return (_glptr_Uniform1ivARB) (GET_by_offset
-                                   (disp, _gloffset_Uniform1ivARB));
-}
-
-static inline void
-SET_Uniform1ivARB(struct _glapi_table *disp,
-                  void (GLAPIENTRYP fn) (GLint, GLsizei, const GLint *))
-{
-    SET_by_offset(disp, _gloffset_Uniform1ivARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Uniform2fARB) (GLint, GLfloat, GLfloat);
-
-#define CALL_Uniform2fARB(disp, parameters) \
-    (* GET_Uniform2fARB(disp)) parameters
-static inline _glptr_Uniform2fARB
-GET_Uniform2fARB(struct _glapi_table *disp)
-{
-    return (_glptr_Uniform2fARB) (GET_by_offset(disp, _gloffset_Uniform2fARB));
-}
-
-static inline void
-SET_Uniform2fARB(struct _glapi_table *disp,
-                 void (GLAPIENTRYP fn) (GLint, GLfloat, GLfloat))
-{
-    SET_by_offset(disp, _gloffset_Uniform2fARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Uniform2fvARB) (GLint, GLsizei,
-                                                 const GLfloat *);
-#define CALL_Uniform2fvARB(disp, parameters) \
-    (* GET_Uniform2fvARB(disp)) parameters
-static inline _glptr_Uniform2fvARB
-GET_Uniform2fvARB(struct _glapi_table *disp)
-{
-    return (_glptr_Uniform2fvARB) (GET_by_offset
-                                   (disp, _gloffset_Uniform2fvARB));
-}
-
-static inline void
-SET_Uniform2fvARB(struct _glapi_table *disp,
-                  void (GLAPIENTRYP fn) (GLint, GLsizei, const GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_Uniform2fvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Uniform2iARB) (GLint, GLint, GLint);
-
-#define CALL_Uniform2iARB(disp, parameters) \
-    (* GET_Uniform2iARB(disp)) parameters
-static inline _glptr_Uniform2iARB
-GET_Uniform2iARB(struct _glapi_table *disp)
-{
-    return (_glptr_Uniform2iARB) (GET_by_offset(disp, _gloffset_Uniform2iARB));
-}
-
-static inline void
-SET_Uniform2iARB(struct _glapi_table *disp,
-                 void (GLAPIENTRYP fn) (GLint, GLint, GLint))
-{
-    SET_by_offset(disp, _gloffset_Uniform2iARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Uniform2ivARB) (GLint, GLsizei, const GLint *);
-
-#define CALL_Uniform2ivARB(disp, parameters) \
-    (* GET_Uniform2ivARB(disp)) parameters
-static inline _glptr_Uniform2ivARB
-GET_Uniform2ivARB(struct _glapi_table *disp)
-{
-    return (_glptr_Uniform2ivARB) (GET_by_offset
-                                   (disp, _gloffset_Uniform2ivARB));
-}
-
-static inline void
-SET_Uniform2ivARB(struct _glapi_table *disp,
-                  void (GLAPIENTRYP fn) (GLint, GLsizei, const GLint *))
-{
-    SET_by_offset(disp, _gloffset_Uniform2ivARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Uniform3fARB) (GLint, GLfloat, GLfloat,
-                                                GLfloat);
-#define CALL_Uniform3fARB(disp, parameters) \
-    (* GET_Uniform3fARB(disp)) parameters
-static inline _glptr_Uniform3fARB
-GET_Uniform3fARB(struct _glapi_table *disp)
-{
-    return (_glptr_Uniform3fARB) (GET_by_offset(disp, _gloffset_Uniform3fARB));
-}
-
-static inline void
-SET_Uniform3fARB(struct _glapi_table *disp,
-                 void (GLAPIENTRYP fn) (GLint, GLfloat, GLfloat, GLfloat))
-{
-    SET_by_offset(disp, _gloffset_Uniform3fARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Uniform3fvARB) (GLint, GLsizei,
-                                                 const GLfloat *);
-#define CALL_Uniform3fvARB(disp, parameters) \
-    (* GET_Uniform3fvARB(disp)) parameters
-static inline _glptr_Uniform3fvARB
-GET_Uniform3fvARB(struct _glapi_table *disp)
-{
-    return (_glptr_Uniform3fvARB) (GET_by_offset
-                                   (disp, _gloffset_Uniform3fvARB));
-}
-
-static inline void
-SET_Uniform3fvARB(struct _glapi_table *disp,
-                  void (GLAPIENTRYP fn) (GLint, GLsizei, const GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_Uniform3fvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Uniform3iARB) (GLint, GLint, GLint, GLint);
-
-#define CALL_Uniform3iARB(disp, parameters) \
-    (* GET_Uniform3iARB(disp)) parameters
-static inline _glptr_Uniform3iARB
-GET_Uniform3iARB(struct _glapi_table *disp)
-{
-    return (_glptr_Uniform3iARB) (GET_by_offset(disp, _gloffset_Uniform3iARB));
-}
-
-static inline void
-SET_Uniform3iARB(struct _glapi_table *disp,
-                 void (GLAPIENTRYP fn) (GLint, GLint, GLint, GLint))
-{
-    SET_by_offset(disp, _gloffset_Uniform3iARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Uniform3ivARB) (GLint, GLsizei, const GLint *);
-
-#define CALL_Uniform3ivARB(disp, parameters) \
-    (* GET_Uniform3ivARB(disp)) parameters
-static inline _glptr_Uniform3ivARB
-GET_Uniform3ivARB(struct _glapi_table *disp)
-{
-    return (_glptr_Uniform3ivARB) (GET_by_offset
-                                   (disp, _gloffset_Uniform3ivARB));
-}
-
-static inline void
-SET_Uniform3ivARB(struct _glapi_table *disp,
-                  void (GLAPIENTRYP fn) (GLint, GLsizei, const GLint *))
-{
-    SET_by_offset(disp, _gloffset_Uniform3ivARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Uniform4fARB) (GLint, GLfloat, GLfloat,
-                                                GLfloat, GLfloat);
-#define CALL_Uniform4fARB(disp, parameters) \
-    (* GET_Uniform4fARB(disp)) parameters
-static inline _glptr_Uniform4fARB
-GET_Uniform4fARB(struct _glapi_table *disp)
-{
-    return (_glptr_Uniform4fARB) (GET_by_offset(disp, _gloffset_Uniform4fARB));
-}
-
-static inline void
-SET_Uniform4fARB(struct _glapi_table *disp,
-                 void (GLAPIENTRYP fn) (GLint, GLfloat, GLfloat, GLfloat,
-                                        GLfloat))
-{
-    SET_by_offset(disp, _gloffset_Uniform4fARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Uniform4fvARB) (GLint, GLsizei,
-                                                 const GLfloat *);
-#define CALL_Uniform4fvARB(disp, parameters) \
-    (* GET_Uniform4fvARB(disp)) parameters
-static inline _glptr_Uniform4fvARB
-GET_Uniform4fvARB(struct _glapi_table *disp)
-{
-    return (_glptr_Uniform4fvARB) (GET_by_offset
-                                   (disp, _gloffset_Uniform4fvARB));
-}
-
-static inline void
-SET_Uniform4fvARB(struct _glapi_table *disp,
-                  void (GLAPIENTRYP fn) (GLint, GLsizei, const GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_Uniform4fvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Uniform4iARB) (GLint, GLint, GLint, GLint,
-                                                GLint);
-#define CALL_Uniform4iARB(disp, parameters) \
-    (* GET_Uniform4iARB(disp)) parameters
-static inline _glptr_Uniform4iARB
-GET_Uniform4iARB(struct _glapi_table *disp)
-{
-    return (_glptr_Uniform4iARB) (GET_by_offset(disp, _gloffset_Uniform4iARB));
-}
-
-static inline void
-SET_Uniform4iARB(struct _glapi_table *disp,
-                 void (GLAPIENTRYP fn) (GLint, GLint, GLint, GLint, GLint))
-{
-    SET_by_offset(disp, _gloffset_Uniform4iARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Uniform4ivARB) (GLint, GLsizei, const GLint *);
-
-#define CALL_Uniform4ivARB(disp, parameters) \
-    (* GET_Uniform4ivARB(disp)) parameters
-static inline _glptr_Uniform4ivARB
-GET_Uniform4ivARB(struct _glapi_table *disp)
-{
-    return (_glptr_Uniform4ivARB) (GET_by_offset
-                                   (disp, _gloffset_Uniform4ivARB));
-}
-
-static inline void
-SET_Uniform4ivARB(struct _glapi_table *disp,
-                  void (GLAPIENTRYP fn) (GLint, GLsizei, const GLint *))
-{
-    SET_by_offset(disp, _gloffset_Uniform4ivARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_UniformMatrix2fvARB) (GLint, GLsizei,
-                                                       GLboolean,
-                                                       const GLfloat *);
-#define CALL_UniformMatrix2fvARB(disp, parameters) \
-    (* GET_UniformMatrix2fvARB(disp)) parameters
-static inline _glptr_UniformMatrix2fvARB
-GET_UniformMatrix2fvARB(struct _glapi_table *disp)
-{
-    return (_glptr_UniformMatrix2fvARB) (GET_by_offset
-                                         (disp, _gloffset_UniformMatrix2fvARB));
-}
-
-static inline void
-SET_UniformMatrix2fvARB(struct _glapi_table *disp,
-                        void (GLAPIENTRYP fn) (GLint, GLsizei, GLboolean,
-                                               const GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_UniformMatrix2fvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_UniformMatrix3fvARB) (GLint, GLsizei,
-                                                       GLboolean,
-                                                       const GLfloat *);
-#define CALL_UniformMatrix3fvARB(disp, parameters) \
-    (* GET_UniformMatrix3fvARB(disp)) parameters
-static inline _glptr_UniformMatrix3fvARB
-GET_UniformMatrix3fvARB(struct _glapi_table *disp)
-{
-    return (_glptr_UniformMatrix3fvARB) (GET_by_offset
-                                         (disp, _gloffset_UniformMatrix3fvARB));
-}
-
-static inline void
-SET_UniformMatrix3fvARB(struct _glapi_table *disp,
-                        void (GLAPIENTRYP fn) (GLint, GLsizei, GLboolean,
-                                               const GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_UniformMatrix3fvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_UniformMatrix4fvARB) (GLint, GLsizei,
-                                                       GLboolean,
-                                                       const GLfloat *);
-#define CALL_UniformMatrix4fvARB(disp, parameters) \
-    (* GET_UniformMatrix4fvARB(disp)) parameters
-static inline _glptr_UniformMatrix4fvARB
-GET_UniformMatrix4fvARB(struct _glapi_table *disp)
-{
-    return (_glptr_UniformMatrix4fvARB) (GET_by_offset
-                                         (disp, _gloffset_UniformMatrix4fvARB));
-}
-
-static inline void
-SET_UniformMatrix4fvARB(struct _glapi_table *disp,
-                        void (GLAPIENTRYP fn) (GLint, GLsizei, GLboolean,
-                                               const GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_UniformMatrix4fvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_UseProgramObjectARB) (GLhandleARB);
-
-#define CALL_UseProgramObjectARB(disp, parameters) \
-    (* GET_UseProgramObjectARB(disp)) parameters
-static inline _glptr_UseProgramObjectARB
-GET_UseProgramObjectARB(struct _glapi_table *disp)
-{
-    return (_glptr_UseProgramObjectARB) (GET_by_offset
-                                         (disp, _gloffset_UseProgramObjectARB));
-}
-
-static inline void
-SET_UseProgramObjectARB(struct _glapi_table *disp,
-                        void (GLAPIENTRYP fn) (GLhandleARB))
-{
-    SET_by_offset(disp, _gloffset_UseProgramObjectARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ValidateProgramARB) (GLhandleARB);
-
-#define CALL_ValidateProgramARB(disp, parameters) \
-    (* GET_ValidateProgramARB(disp)) parameters
-static inline _glptr_ValidateProgramARB
-GET_ValidateProgramARB(struct _glapi_table *disp)
-{
-    return (_glptr_ValidateProgramARB) (GET_by_offset
-                                        (disp, _gloffset_ValidateProgramARB));
-}
-
-static inline void
-SET_ValidateProgramARB(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLhandleARB))
-{
-    SET_by_offset(disp, _gloffset_ValidateProgramARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_BindAttribLocationARB) (GLhandleARB, GLuint,
-                                                         const GLcharARB *);
-#define CALL_BindAttribLocationARB(disp, parameters) \
-    (* GET_BindAttribLocationARB(disp)) parameters
-static inline _glptr_BindAttribLocationARB
-GET_BindAttribLocationARB(struct _glapi_table *disp)
-{
-    return (_glptr_BindAttribLocationARB) (GET_by_offset
-                                           (disp,
-                                            _gloffset_BindAttribLocationARB));
-}
-
-static inline void
-SET_BindAttribLocationARB(struct _glapi_table *disp,
-                          void (GLAPIENTRYP fn) (GLhandleARB, GLuint,
-                                                 const GLcharARB *))
-{
-    SET_by_offset(disp, _gloffset_BindAttribLocationARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetActiveAttribARB) (GLhandleARB, GLuint,
-                                                      GLsizei, GLsizei *,
-                                                      GLint *, GLenum *,
-                                                      GLcharARB *);
-#define CALL_GetActiveAttribARB(disp, parameters) \
-    (* GET_GetActiveAttribARB(disp)) parameters
-static inline _glptr_GetActiveAttribARB
-GET_GetActiveAttribARB(struct _glapi_table *disp)
-{
-    return (_glptr_GetActiveAttribARB) (GET_by_offset
-                                        (disp, _gloffset_GetActiveAttribARB));
-}
-
-static inline void
-SET_GetActiveAttribARB(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLhandleARB, GLuint, GLsizei,
-                                              GLsizei *, GLint *, GLenum *,
-                                              GLcharARB *))
-{
-    SET_by_offset(disp, _gloffset_GetActiveAttribARB, fn);
-}
-
-typedef GLint(GLAPIENTRYP _glptr_GetAttribLocationARB) (GLhandleARB,
-                                                        const GLcharARB *);
-#define CALL_GetAttribLocationARB(disp, parameters) \
-    (* GET_GetAttribLocationARB(disp)) parameters
-static inline _glptr_GetAttribLocationARB
-GET_GetAttribLocationARB(struct _glapi_table *disp)
-{
-    return (_glptr_GetAttribLocationARB) (GET_by_offset
-                                          (disp,
-                                           _gloffset_GetAttribLocationARB));
-}
-
-static inline void
-SET_GetAttribLocationARB(struct _glapi_table *disp,
-                         GLint(GLAPIENTRYP fn) (GLhandleARB, const GLcharARB *))
-{
-    SET_by_offset(disp, _gloffset_GetAttribLocationARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_DrawBuffersARB) (GLsizei, const GLenum *);
-
-#define CALL_DrawBuffersARB(disp, parameters) \
-    (* GET_DrawBuffersARB(disp)) parameters
-static inline _glptr_DrawBuffersARB
-GET_DrawBuffersARB(struct _glapi_table *disp)
-{
-    return (_glptr_DrawBuffersARB) (GET_by_offset
-                                    (disp, _gloffset_DrawBuffersARB));
-}
-
-static inline void
-SET_DrawBuffersARB(struct _glapi_table *disp,
-                   void (GLAPIENTRYP fn) (GLsizei, const GLenum *))
-{
-    SET_by_offset(disp, _gloffset_DrawBuffersARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ClampColorARB) (GLenum, GLenum);
-
-#define CALL_ClampColorARB(disp, parameters) \
-    (* GET_ClampColorARB(disp)) parameters
-static inline _glptr_ClampColorARB
-GET_ClampColorARB(struct _glapi_table *disp)
-{
-    return (_glptr_ClampColorARB) (GET_by_offset
-                                   (disp, _gloffset_ClampColorARB));
-}
-
-static inline void
-SET_ClampColorARB(struct _glapi_table *disp,
-                  void (GLAPIENTRYP fn) (GLenum, GLenum))
-{
-    SET_by_offset(disp, _gloffset_ClampColorARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_DrawArraysInstancedARB) (GLenum, GLint,
-                                                          GLsizei, GLsizei);
-#define CALL_DrawArraysInstancedARB(disp, parameters) \
-    (* GET_DrawArraysInstancedARB(disp)) parameters
-static inline _glptr_DrawArraysInstancedARB
-GET_DrawArraysInstancedARB(struct _glapi_table *disp)
-{
-    return (_glptr_DrawArraysInstancedARB) (GET_by_offset
-                                            (disp,
-                                             _gloffset_DrawArraysInstancedARB));
-}
-
-static inline void
-SET_DrawArraysInstancedARB(struct _glapi_table *disp,
-                           void (GLAPIENTRYP fn) (GLenum, GLint, GLsizei,
-                                                  GLsizei))
-{
-    SET_by_offset(disp, _gloffset_DrawArraysInstancedARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_DrawElementsInstancedARB) (GLenum, GLsizei,
-                                                            GLenum,
-                                                            const GLvoid *,
-                                                            GLsizei);
-#define CALL_DrawElementsInstancedARB(disp, parameters) \
-    (* GET_DrawElementsInstancedARB(disp)) parameters
-static inline _glptr_DrawElementsInstancedARB
-GET_DrawElementsInstancedARB(struct _glapi_table *disp)
-{
-    return (_glptr_DrawElementsInstancedARB) (GET_by_offset
-                                              (disp,
-                                               _gloffset_DrawElementsInstancedARB));
-}
-
-static inline void
-SET_DrawElementsInstancedARB(struct _glapi_table *disp,
-                             void (GLAPIENTRYP fn) (GLenum, GLsizei, GLenum,
-                                                    const GLvoid *, GLsizei))
-{
-    SET_by_offset(disp, _gloffset_DrawElementsInstancedARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_RenderbufferStorageMultisample) (GLenum,
-                                                                  GLsizei,
-                                                                  GLenum,
-                                                                  GLsizei,
-                                                                  GLsizei);
-#define CALL_RenderbufferStorageMultisample(disp, parameters) \
-    (* GET_RenderbufferStorageMultisample(disp)) parameters
-static inline _glptr_RenderbufferStorageMultisample
-GET_RenderbufferStorageMultisample(struct _glapi_table *disp)
-{
-    return (_glptr_RenderbufferStorageMultisample) (GET_by_offset
-                                                    (disp,
-                                                     _gloffset_RenderbufferStorageMultisample));
-}
-
-static inline void
-SET_RenderbufferStorageMultisample(struct _glapi_table *disp,
-                                   void (GLAPIENTRYP fn) (GLenum, GLsizei,
-                                                          GLenum, GLsizei,
-                                                          GLsizei))
-{
-    SET_by_offset(disp, _gloffset_RenderbufferStorageMultisample, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_FramebufferTextureARB) (GLenum, GLenum, GLuint,
-                                                         GLint);
-#define CALL_FramebufferTextureARB(disp, parameters) \
-    (* GET_FramebufferTextureARB(disp)) parameters
-static inline _glptr_FramebufferTextureARB
-GET_FramebufferTextureARB(struct _glapi_table *disp)
-{
-    return (_glptr_FramebufferTextureARB) (GET_by_offset
-                                           (disp,
-                                            _gloffset_FramebufferTextureARB));
-}
-
-static inline void
-SET_FramebufferTextureARB(struct _glapi_table *disp,
-                          void (GLAPIENTRYP fn) (GLenum, GLenum, GLuint, GLint))
-{
-    SET_by_offset(disp, _gloffset_FramebufferTextureARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_FramebufferTextureFaceARB) (GLenum, GLenum,
-                                                             GLuint, GLint,
-                                                             GLenum);
-#define CALL_FramebufferTextureFaceARB(disp, parameters) \
-    (* GET_FramebufferTextureFaceARB(disp)) parameters
-static inline _glptr_FramebufferTextureFaceARB
-GET_FramebufferTextureFaceARB(struct _glapi_table *disp)
-{
-    return (_glptr_FramebufferTextureFaceARB) (GET_by_offset
-                                               (disp,
-                                                _gloffset_FramebufferTextureFaceARB));
-}
-
-static inline void
-SET_FramebufferTextureFaceARB(struct _glapi_table *disp,
-                              void (GLAPIENTRYP fn) (GLenum, GLenum, GLuint,
-                                                     GLint, GLenum))
-{
-    SET_by_offset(disp, _gloffset_FramebufferTextureFaceARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ProgramParameteriARB) (GLuint, GLenum, GLint);
-
-#define CALL_ProgramParameteriARB(disp, parameters) \
-    (* GET_ProgramParameteriARB(disp)) parameters
-static inline _glptr_ProgramParameteriARB
-GET_ProgramParameteriARB(struct _glapi_table *disp)
-{
-    return (_glptr_ProgramParameteriARB) (GET_by_offset
-                                          (disp,
-                                           _gloffset_ProgramParameteriARB));
-}
-
-static inline void
-SET_ProgramParameteriARB(struct _glapi_table *disp,
-                         void (GLAPIENTRYP fn) (GLuint, GLenum, GLint))
-{
-    SET_by_offset(disp, _gloffset_ProgramParameteriARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribDivisorARB) (GLuint, GLuint);
-
-#define CALL_VertexAttribDivisorARB(disp, parameters) \
-    (* GET_VertexAttribDivisorARB(disp)) parameters
-static inline _glptr_VertexAttribDivisorARB
-GET_VertexAttribDivisorARB(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttribDivisorARB) (GET_by_offset
-                                            (disp,
-                                             _gloffset_VertexAttribDivisorARB));
-}
-
-static inline void
-SET_VertexAttribDivisorARB(struct _glapi_table *disp,
-                           void (GLAPIENTRYP fn) (GLuint, GLuint))
-{
-    SET_by_offset(disp, _gloffset_VertexAttribDivisorARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_FlushMappedBufferRange) (GLenum, GLintptr,
-                                                          GLsizeiptr);
-#define CALL_FlushMappedBufferRange(disp, parameters) \
-    (* GET_FlushMappedBufferRange(disp)) parameters
-static inline _glptr_FlushMappedBufferRange
-GET_FlushMappedBufferRange(struct _glapi_table *disp)
-{
-    return (_glptr_FlushMappedBufferRange) (GET_by_offset
-                                            (disp,
-                                             _gloffset_FlushMappedBufferRange));
-}
-
-static inline void
-SET_FlushMappedBufferRange(struct _glapi_table *disp,
-                           void (GLAPIENTRYP fn) (GLenum, GLintptr, GLsizeiptr))
-{
-    SET_by_offset(disp, _gloffset_FlushMappedBufferRange, fn);
-}
-
-typedef GLvoid *(GLAPIENTRYP _glptr_MapBufferRange) (GLenum, GLintptr,
-                                                     GLsizeiptr, GLbitfield);
-#define CALL_MapBufferRange(disp, parameters) \
-    (* GET_MapBufferRange(disp)) parameters
-static inline _glptr_MapBufferRange
-GET_MapBufferRange(struct _glapi_table *disp)
-{
-    return (_glptr_MapBufferRange) (GET_by_offset
-                                    (disp, _gloffset_MapBufferRange));
-}
-
-static inline void
-SET_MapBufferRange(struct _glapi_table *disp,
-                   GLvoid * (GLAPIENTRYP fn) (GLenum, GLintptr, GLsizeiptr,
-                                              GLbitfield))
-{
-    SET_by_offset(disp, _gloffset_MapBufferRange, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexBufferARB) (GLenum, GLenum, GLuint);
-
-#define CALL_TexBufferARB(disp, parameters) \
-    (* GET_TexBufferARB(disp)) parameters
-static inline _glptr_TexBufferARB
-GET_TexBufferARB(struct _glapi_table *disp)
-{
-    return (_glptr_TexBufferARB) (GET_by_offset(disp, _gloffset_TexBufferARB));
-}
-
-static inline void
-SET_TexBufferARB(struct _glapi_table *disp,
-                 void (GLAPIENTRYP fn) (GLenum, GLenum, GLuint))
-{
-    SET_by_offset(disp, _gloffset_TexBufferARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_BindVertexArray) (GLuint);
-
-#define CALL_BindVertexArray(disp, parameters) \
-    (* GET_BindVertexArray(disp)) parameters
-static inline _glptr_BindVertexArray
-GET_BindVertexArray(struct _glapi_table *disp)
-{
-    return (_glptr_BindVertexArray) (GET_by_offset
-                                     (disp, _gloffset_BindVertexArray));
-}
-
-static inline void
-SET_BindVertexArray(struct _glapi_table *disp, void (GLAPIENTRYP fn) (GLuint))
-{
-    SET_by_offset(disp, _gloffset_BindVertexArray, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GenVertexArrays) (GLsizei, GLuint *);
-
-#define CALL_GenVertexArrays(disp, parameters) \
-    (* GET_GenVertexArrays(disp)) parameters
-static inline _glptr_GenVertexArrays
-GET_GenVertexArrays(struct _glapi_table *disp)
-{
-    return (_glptr_GenVertexArrays) (GET_by_offset
-                                     (disp, _gloffset_GenVertexArrays));
-}
-
-static inline void
-SET_GenVertexArrays(struct _glapi_table *disp,
-                    void (GLAPIENTRYP fn) (GLsizei, GLuint *))
-{
-    SET_by_offset(disp, _gloffset_GenVertexArrays, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_CopyBufferSubData) (GLenum, GLenum, GLintptr,
-                                                     GLintptr, GLsizeiptr);
-#define CALL_CopyBufferSubData(disp, parameters) \
-    (* GET_CopyBufferSubData(disp)) parameters
-static inline _glptr_CopyBufferSubData
-GET_CopyBufferSubData(struct _glapi_table *disp)
-{
-    return (_glptr_CopyBufferSubData) (GET_by_offset
-                                       (disp, _gloffset_CopyBufferSubData));
-}
-
-static inline void
-SET_CopyBufferSubData(struct _glapi_table *disp,
-                      void (GLAPIENTRYP fn) (GLenum, GLenum, GLintptr, GLintptr,
-                                             GLsizeiptr))
-{
-    SET_by_offset(disp, _gloffset_CopyBufferSubData, fn);
-}
-
-typedef GLenum(GLAPIENTRYP _glptr_ClientWaitSync) (GLsync, GLbitfield,
-                                                   GLuint64);
-#define CALL_ClientWaitSync(disp, parameters) \
-    (* GET_ClientWaitSync(disp)) parameters
-static inline _glptr_ClientWaitSync
-GET_ClientWaitSync(struct _glapi_table *disp)
-{
-    return (_glptr_ClientWaitSync) (GET_by_offset
-                                    (disp, _gloffset_ClientWaitSync));
-}
-
-static inline void
-SET_ClientWaitSync(struct _glapi_table *disp,
-                   GLenum(GLAPIENTRYP fn) (GLsync, GLbitfield, GLuint64))
-{
-    SET_by_offset(disp, _gloffset_ClientWaitSync, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_DeleteSync) (GLsync);
-
-#define CALL_DeleteSync(disp, parameters) \
-    (* GET_DeleteSync(disp)) parameters
-static inline _glptr_DeleteSync
-GET_DeleteSync(struct _glapi_table *disp)
-{
-    return (_glptr_DeleteSync) (GET_by_offset(disp, _gloffset_DeleteSync));
-}
-
-static inline void
-SET_DeleteSync(struct _glapi_table *disp, void (GLAPIENTRYP fn) (GLsync))
-{
-    SET_by_offset(disp, _gloffset_DeleteSync, fn);
-}
-
-typedef GLsync(GLAPIENTRYP _glptr_FenceSync) (GLenum, GLbitfield);
-
-#define CALL_FenceSync(disp, parameters) \
-    (* GET_FenceSync(disp)) parameters
-static inline _glptr_FenceSync
-GET_FenceSync(struct _glapi_table *disp)
-{
-    return (_glptr_FenceSync) (GET_by_offset(disp, _gloffset_FenceSync));
-}
-
-static inline void
-SET_FenceSync(struct _glapi_table *disp,
-              GLsync(GLAPIENTRYP fn) (GLenum, GLbitfield))
-{
-    SET_by_offset(disp, _gloffset_FenceSync, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetInteger64v) (GLenum, GLint64 *);
-
-#define CALL_GetInteger64v(disp, parameters) \
-    (* GET_GetInteger64v(disp)) parameters
-static inline _glptr_GetInteger64v
-GET_GetInteger64v(struct _glapi_table *disp)
-{
-    return (_glptr_GetInteger64v) (GET_by_offset
-                                   (disp, _gloffset_GetInteger64v));
-}
-
-static inline void
-SET_GetInteger64v(struct _glapi_table *disp,
-                  void (GLAPIENTRYP fn) (GLenum, GLint64 *))
-{
-    SET_by_offset(disp, _gloffset_GetInteger64v, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetSynciv) (GLsync, GLenum, GLsizei, GLsizei *,
-                                             GLint *);
-#define CALL_GetSynciv(disp, parameters) \
-    (* GET_GetSynciv(disp)) parameters
-static inline _glptr_GetSynciv
-GET_GetSynciv(struct _glapi_table *disp)
-{
-    return (_glptr_GetSynciv) (GET_by_offset(disp, _gloffset_GetSynciv));
-}
-
-static inline void
-SET_GetSynciv(struct _glapi_table *disp,
-              void (GLAPIENTRYP fn) (GLsync, GLenum, GLsizei, GLsizei *,
-                                     GLint *))
-{
-    SET_by_offset(disp, _gloffset_GetSynciv, fn);
-}
-
-typedef GLboolean(GLAPIENTRYP _glptr_IsSync) (GLsync);
-
-#define CALL_IsSync(disp, parameters) \
-    (* GET_IsSync(disp)) parameters
-static inline _glptr_IsSync
-GET_IsSync(struct _glapi_table *disp)
-{
-    return (_glptr_IsSync) (GET_by_offset(disp, _gloffset_IsSync));
-}
-
-static inline void
-SET_IsSync(struct _glapi_table *disp, GLboolean(GLAPIENTRYP fn) (GLsync))
-{
-    SET_by_offset(disp, _gloffset_IsSync, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_WaitSync) (GLsync, GLbitfield, GLuint64);
-
-#define CALL_WaitSync(disp, parameters) \
-    (* GET_WaitSync(disp)) parameters
-static inline _glptr_WaitSync
-GET_WaitSync(struct _glapi_table *disp)
-{
-    return (_glptr_WaitSync) (GET_by_offset(disp, _gloffset_WaitSync));
-}
-
-static inline void
-SET_WaitSync(struct _glapi_table *disp,
-             void (GLAPIENTRYP fn) (GLsync, GLbitfield, GLuint64))
-{
-    SET_by_offset(disp, _gloffset_WaitSync, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_DrawElementsBaseVertex) (GLenum, GLsizei,
-                                                          GLenum,
-                                                          const GLvoid *,
-                                                          GLint);
-#define CALL_DrawElementsBaseVertex(disp, parameters) \
-    (* GET_DrawElementsBaseVertex(disp)) parameters
-static inline _glptr_DrawElementsBaseVertex
-GET_DrawElementsBaseVertex(struct _glapi_table *disp)
-{
-    return (_glptr_DrawElementsBaseVertex) (GET_by_offset
-                                            (disp,
-                                             _gloffset_DrawElementsBaseVertex));
-}
-
-static inline void
-SET_DrawElementsBaseVertex(struct _glapi_table *disp,
-                           void (GLAPIENTRYP fn) (GLenum, GLsizei, GLenum,
-                                                  const GLvoid *, GLint))
-{
-    SET_by_offset(disp, _gloffset_DrawElementsBaseVertex, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_DrawElementsInstancedBaseVertex) (GLenum,
-                                                                   GLsizei,
-                                                                   GLenum,
-                                                                   const GLvoid
-                                                                   *, GLsizei,
-                                                                   GLint);
-#define CALL_DrawElementsInstancedBaseVertex(disp, parameters) \
-    (* GET_DrawElementsInstancedBaseVertex(disp)) parameters
-static inline _glptr_DrawElementsInstancedBaseVertex
-GET_DrawElementsInstancedBaseVertex(struct _glapi_table *disp)
-{
-    return (_glptr_DrawElementsInstancedBaseVertex) (GET_by_offset
-                                                     (disp,
-                                                      _gloffset_DrawElementsInstancedBaseVertex));
-}
-
-static inline void
-SET_DrawElementsInstancedBaseVertex(struct _glapi_table *disp,
-                                    void (GLAPIENTRYP fn) (GLenum, GLsizei,
-                                                           GLenum,
-                                                           const GLvoid *,
-                                                           GLsizei, GLint))
-{
-    SET_by_offset(disp, _gloffset_DrawElementsInstancedBaseVertex, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_DrawRangeElementsBaseVertex) (GLenum, GLuint,
-                                                               GLuint, GLsizei,
-                                                               GLenum,
-                                                               const GLvoid *,
-                                                               GLint);
-#define CALL_DrawRangeElementsBaseVertex(disp, parameters) \
-    (* GET_DrawRangeElementsBaseVertex(disp)) parameters
-static inline _glptr_DrawRangeElementsBaseVertex
-GET_DrawRangeElementsBaseVertex(struct _glapi_table *disp)
-{
-    return (_glptr_DrawRangeElementsBaseVertex) (GET_by_offset
-                                                 (disp,
-                                                  _gloffset_DrawRangeElementsBaseVertex));
-}
-
-static inline void
-SET_DrawRangeElementsBaseVertex(struct _glapi_table *disp,
-                                void (GLAPIENTRYP fn) (GLenum, GLuint, GLuint,
-                                                       GLsizei, GLenum,
-                                                       const GLvoid *, GLint))
-{
-    SET_by_offset(disp, _gloffset_DrawRangeElementsBaseVertex, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiDrawElementsBaseVertex) (GLenum,
-                                                               const GLsizei *,
-                                                               GLenum,
-                                                               const GLvoid **,
-                                                               GLsizei,
-                                                               const GLint *);
-#define CALL_MultiDrawElementsBaseVertex(disp, parameters) \
-    (* GET_MultiDrawElementsBaseVertex(disp)) parameters
-static inline _glptr_MultiDrawElementsBaseVertex
-GET_MultiDrawElementsBaseVertex(struct _glapi_table *disp)
-{
-    return (_glptr_MultiDrawElementsBaseVertex) (GET_by_offset
-                                                 (disp,
-                                                  _gloffset_MultiDrawElementsBaseVertex));
-}
-
-static inline void
-SET_MultiDrawElementsBaseVertex(struct _glapi_table *disp,
-                                void (GLAPIENTRYP fn) (GLenum, const GLsizei *,
-                                                       GLenum, const GLvoid **,
-                                                       GLsizei, const GLint *))
-{
-    SET_by_offset(disp, _gloffset_MultiDrawElementsBaseVertex, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_BlendEquationSeparateiARB) (GLuint, GLenum,
-                                                             GLenum);
-#define CALL_BlendEquationSeparateiARB(disp, parameters) \
-    (* GET_BlendEquationSeparateiARB(disp)) parameters
-static inline _glptr_BlendEquationSeparateiARB
-GET_BlendEquationSeparateiARB(struct _glapi_table *disp)
-{
-    return (_glptr_BlendEquationSeparateiARB) (GET_by_offset
-                                               (disp,
-                                                _gloffset_BlendEquationSeparateiARB));
-}
-
-static inline void
-SET_BlendEquationSeparateiARB(struct _glapi_table *disp,
-                              void (GLAPIENTRYP fn) (GLuint, GLenum, GLenum))
-{
-    SET_by_offset(disp, _gloffset_BlendEquationSeparateiARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_BlendEquationiARB) (GLuint, GLenum);
-
-#define CALL_BlendEquationiARB(disp, parameters) \
-    (* GET_BlendEquationiARB(disp)) parameters
-static inline _glptr_BlendEquationiARB
-GET_BlendEquationiARB(struct _glapi_table *disp)
-{
-    return (_glptr_BlendEquationiARB) (GET_by_offset
-                                       (disp, _gloffset_BlendEquationiARB));
-}
-
-static inline void
-SET_BlendEquationiARB(struct _glapi_table *disp,
-                      void (GLAPIENTRYP fn) (GLuint, GLenum))
-{
-    SET_by_offset(disp, _gloffset_BlendEquationiARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_BlendFuncSeparateiARB) (GLuint, GLenum, GLenum,
-                                                         GLenum, GLenum);
-#define CALL_BlendFuncSeparateiARB(disp, parameters) \
-    (* GET_BlendFuncSeparateiARB(disp)) parameters
-static inline _glptr_BlendFuncSeparateiARB
-GET_BlendFuncSeparateiARB(struct _glapi_table *disp)
-{
-    return (_glptr_BlendFuncSeparateiARB) (GET_by_offset
-                                           (disp,
-                                            _gloffset_BlendFuncSeparateiARB));
-}
-
-static inline void
-SET_BlendFuncSeparateiARB(struct _glapi_table *disp,
-                          void (GLAPIENTRYP fn) (GLuint, GLenum, GLenum, GLenum,
-                                                 GLenum))
-{
-    SET_by_offset(disp, _gloffset_BlendFuncSeparateiARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_BlendFunciARB) (GLuint, GLenum, GLenum);
-
-#define CALL_BlendFunciARB(disp, parameters) \
-    (* GET_BlendFunciARB(disp)) parameters
-static inline _glptr_BlendFunciARB
-GET_BlendFunciARB(struct _glapi_table *disp)
-{
-    return (_glptr_BlendFunciARB) (GET_by_offset
-                                   (disp, _gloffset_BlendFunciARB));
-}
-
-static inline void
-SET_BlendFunciARB(struct _glapi_table *disp,
-                  void (GLAPIENTRYP fn) (GLuint, GLenum, GLenum))
-{
-    SET_by_offset(disp, _gloffset_BlendFunciARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_BindSampler) (GLuint, GLuint);
-
-#define CALL_BindSampler(disp, parameters) \
-    (* GET_BindSampler(disp)) parameters
-static inline _glptr_BindSampler
-GET_BindSampler(struct _glapi_table *disp)
-{
-    return (_glptr_BindSampler) (GET_by_offset(disp, _gloffset_BindSampler));
-}
-
-static inline void
-SET_BindSampler(struct _glapi_table *disp,
-                void (GLAPIENTRYP fn) (GLuint, GLuint))
-{
-    SET_by_offset(disp, _gloffset_BindSampler, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_DeleteSamplers) (GLsizei, const GLuint *);
-
-#define CALL_DeleteSamplers(disp, parameters) \
-    (* GET_DeleteSamplers(disp)) parameters
-static inline _glptr_DeleteSamplers
-GET_DeleteSamplers(struct _glapi_table *disp)
-{
-    return (_glptr_DeleteSamplers) (GET_by_offset
-                                    (disp, _gloffset_DeleteSamplers));
-}
-
-static inline void
-SET_DeleteSamplers(struct _glapi_table *disp,
-                   void (GLAPIENTRYP fn) (GLsizei, const GLuint *))
-{
-    SET_by_offset(disp, _gloffset_DeleteSamplers, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GenSamplers) (GLsizei, GLuint *);
-
-#define CALL_GenSamplers(disp, parameters) \
-    (* GET_GenSamplers(disp)) parameters
-static inline _glptr_GenSamplers
-GET_GenSamplers(struct _glapi_table *disp)
-{
-    return (_glptr_GenSamplers) (GET_by_offset(disp, _gloffset_GenSamplers));
-}
-
-static inline void
-SET_GenSamplers(struct _glapi_table *disp,
-                void (GLAPIENTRYP fn) (GLsizei, GLuint *))
-{
-    SET_by_offset(disp, _gloffset_GenSamplers, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetSamplerParameterIiv) (GLuint, GLenum,
-                                                          GLint *);
-#define CALL_GetSamplerParameterIiv(disp, parameters) \
-    (* GET_GetSamplerParameterIiv(disp)) parameters
-static inline _glptr_GetSamplerParameterIiv
-GET_GetSamplerParameterIiv(struct _glapi_table *disp)
-{
-    return (_glptr_GetSamplerParameterIiv) (GET_by_offset
-                                            (disp,
-                                             _gloffset_GetSamplerParameterIiv));
-}
-
-static inline void
-SET_GetSamplerParameterIiv(struct _glapi_table *disp,
-                           void (GLAPIENTRYP fn) (GLuint, GLenum, GLint *))
-{
-    SET_by_offset(disp, _gloffset_GetSamplerParameterIiv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetSamplerParameterIuiv) (GLuint, GLenum,
-                                                           GLuint *);
-#define CALL_GetSamplerParameterIuiv(disp, parameters) \
-    (* GET_GetSamplerParameterIuiv(disp)) parameters
-static inline _glptr_GetSamplerParameterIuiv
-GET_GetSamplerParameterIuiv(struct _glapi_table *disp)
-{
-    return (_glptr_GetSamplerParameterIuiv) (GET_by_offset
-                                             (disp,
-                                              _gloffset_GetSamplerParameterIuiv));
-}
-
-static inline void
-SET_GetSamplerParameterIuiv(struct _glapi_table *disp,
-                            void (GLAPIENTRYP fn) (GLuint, GLenum, GLuint *))
-{
-    SET_by_offset(disp, _gloffset_GetSamplerParameterIuiv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetSamplerParameterfv) (GLuint, GLenum,
-                                                         GLfloat *);
-#define CALL_GetSamplerParameterfv(disp, parameters) \
-    (* GET_GetSamplerParameterfv(disp)) parameters
-static inline _glptr_GetSamplerParameterfv
-GET_GetSamplerParameterfv(struct _glapi_table *disp)
-{
-    return (_glptr_GetSamplerParameterfv) (GET_by_offset
-                                           (disp,
-                                            _gloffset_GetSamplerParameterfv));
-}
-
-static inline void
-SET_GetSamplerParameterfv(struct _glapi_table *disp,
-                          void (GLAPIENTRYP fn) (GLuint, GLenum, GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_GetSamplerParameterfv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetSamplerParameteriv) (GLuint, GLenum,
-                                                         GLint *);
-#define CALL_GetSamplerParameteriv(disp, parameters) \
-    (* GET_GetSamplerParameteriv(disp)) parameters
-static inline _glptr_GetSamplerParameteriv
-GET_GetSamplerParameteriv(struct _glapi_table *disp)
-{
-    return (_glptr_GetSamplerParameteriv) (GET_by_offset
-                                           (disp,
-                                            _gloffset_GetSamplerParameteriv));
-}
-
-static inline void
-SET_GetSamplerParameteriv(struct _glapi_table *disp,
-                          void (GLAPIENTRYP fn) (GLuint, GLenum, GLint *))
-{
-    SET_by_offset(disp, _gloffset_GetSamplerParameteriv, fn);
-}
-
-typedef GLboolean(GLAPIENTRYP _glptr_IsSampler) (GLuint);
-
-#define CALL_IsSampler(disp, parameters) \
-    (* GET_IsSampler(disp)) parameters
-static inline _glptr_IsSampler
-GET_IsSampler(struct _glapi_table *disp)
-{
-    return (_glptr_IsSampler) (GET_by_offset(disp, _gloffset_IsSampler));
-}
-
-static inline void
-SET_IsSampler(struct _glapi_table *disp, GLboolean(GLAPIENTRYP fn) (GLuint))
-{
-    SET_by_offset(disp, _gloffset_IsSampler, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_SamplerParameterIiv) (GLuint, GLenum,
-                                                       const GLint *);
-#define CALL_SamplerParameterIiv(disp, parameters) \
-    (* GET_SamplerParameterIiv(disp)) parameters
-static inline _glptr_SamplerParameterIiv
-GET_SamplerParameterIiv(struct _glapi_table *disp)
-{
-    return (_glptr_SamplerParameterIiv) (GET_by_offset
-                                         (disp, _gloffset_SamplerParameterIiv));
-}
-
-static inline void
-SET_SamplerParameterIiv(struct _glapi_table *disp,
-                        void (GLAPIENTRYP fn) (GLuint, GLenum, const GLint *))
-{
-    SET_by_offset(disp, _gloffset_SamplerParameterIiv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_SamplerParameterIuiv) (GLuint, GLenum,
-                                                        const GLuint *);
-#define CALL_SamplerParameterIuiv(disp, parameters) \
-    (* GET_SamplerParameterIuiv(disp)) parameters
-static inline _glptr_SamplerParameterIuiv
-GET_SamplerParameterIuiv(struct _glapi_table *disp)
-{
-    return (_glptr_SamplerParameterIuiv) (GET_by_offset
-                                          (disp,
-                                           _gloffset_SamplerParameterIuiv));
-}
-
-static inline void
-SET_SamplerParameterIuiv(struct _glapi_table *disp,
-                         void (GLAPIENTRYP fn) (GLuint, GLenum, const GLuint *))
-{
-    SET_by_offset(disp, _gloffset_SamplerParameterIuiv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_SamplerParameterf) (GLuint, GLenum, GLfloat);
-
-#define CALL_SamplerParameterf(disp, parameters) \
-    (* GET_SamplerParameterf(disp)) parameters
-static inline _glptr_SamplerParameterf
-GET_SamplerParameterf(struct _glapi_table *disp)
-{
-    return (_glptr_SamplerParameterf) (GET_by_offset
-                                       (disp, _gloffset_SamplerParameterf));
-}
-
-static inline void
-SET_SamplerParameterf(struct _glapi_table *disp,
-                      void (GLAPIENTRYP fn) (GLuint, GLenum, GLfloat))
-{
-    SET_by_offset(disp, _gloffset_SamplerParameterf, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_SamplerParameterfv) (GLuint, GLenum,
-                                                      const GLfloat *);
-#define CALL_SamplerParameterfv(disp, parameters) \
-    (* GET_SamplerParameterfv(disp)) parameters
-static inline _glptr_SamplerParameterfv
-GET_SamplerParameterfv(struct _glapi_table *disp)
-{
-    return (_glptr_SamplerParameterfv) (GET_by_offset
-                                        (disp, _gloffset_SamplerParameterfv));
-}
-
-static inline void
-SET_SamplerParameterfv(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLuint, GLenum, const GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_SamplerParameterfv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_SamplerParameteri) (GLuint, GLenum, GLint);
-
-#define CALL_SamplerParameteri(disp, parameters) \
-    (* GET_SamplerParameteri(disp)) parameters
-static inline _glptr_SamplerParameteri
-GET_SamplerParameteri(struct _glapi_table *disp)
-{
-    return (_glptr_SamplerParameteri) (GET_by_offset
-                                       (disp, _gloffset_SamplerParameteri));
-}
-
-static inline void
-SET_SamplerParameteri(struct _glapi_table *disp,
-                      void (GLAPIENTRYP fn) (GLuint, GLenum, GLint))
-{
-    SET_by_offset(disp, _gloffset_SamplerParameteri, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_SamplerParameteriv) (GLuint, GLenum,
-                                                      const GLint *);
-#define CALL_SamplerParameteriv(disp, parameters) \
-    (* GET_SamplerParameteriv(disp)) parameters
-static inline _glptr_SamplerParameteriv
-GET_SamplerParameteriv(struct _glapi_table *disp)
-{
-    return (_glptr_SamplerParameteriv) (GET_by_offset
-                                        (disp, _gloffset_SamplerParameteriv));
-}
-
-static inline void
-SET_SamplerParameteriv(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLuint, GLenum, const GLint *))
-{
-    SET_by_offset(disp, _gloffset_SamplerParameteriv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ColorP3ui) (GLenum, GLuint);
-
-#define CALL_ColorP3ui(disp, parameters) \
-    (* GET_ColorP3ui(disp)) parameters
-static inline _glptr_ColorP3ui
-GET_ColorP3ui(struct _glapi_table *disp)
-{
-    return (_glptr_ColorP3ui) (GET_by_offset(disp, _gloffset_ColorP3ui));
-}
-
-static inline void
-SET_ColorP3ui(struct _glapi_table *disp, void (GLAPIENTRYP fn) (GLenum, GLuint))
-{
-    SET_by_offset(disp, _gloffset_ColorP3ui, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ColorP3uiv) (GLenum, const GLuint *);
-
-#define CALL_ColorP3uiv(disp, parameters) \
-    (* GET_ColorP3uiv(disp)) parameters
-static inline _glptr_ColorP3uiv
-GET_ColorP3uiv(struct _glapi_table *disp)
-{
-    return (_glptr_ColorP3uiv) (GET_by_offset(disp, _gloffset_ColorP3uiv));
-}
-
-static inline void
-SET_ColorP3uiv(struct _glapi_table *disp,
-               void (GLAPIENTRYP fn) (GLenum, const GLuint *))
-{
-    SET_by_offset(disp, _gloffset_ColorP3uiv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ColorP4ui) (GLenum, GLuint);
-
-#define CALL_ColorP4ui(disp, parameters) \
-    (* GET_ColorP4ui(disp)) parameters
-static inline _glptr_ColorP4ui
-GET_ColorP4ui(struct _glapi_table *disp)
-{
-    return (_glptr_ColorP4ui) (GET_by_offset(disp, _gloffset_ColorP4ui));
-}
-
-static inline void
-SET_ColorP4ui(struct _glapi_table *disp, void (GLAPIENTRYP fn) (GLenum, GLuint))
-{
-    SET_by_offset(disp, _gloffset_ColorP4ui, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ColorP4uiv) (GLenum, const GLuint *);
-
-#define CALL_ColorP4uiv(disp, parameters) \
-    (* GET_ColorP4uiv(disp)) parameters
-static inline _glptr_ColorP4uiv
-GET_ColorP4uiv(struct _glapi_table *disp)
-{
-    return (_glptr_ColorP4uiv) (GET_by_offset(disp, _gloffset_ColorP4uiv));
-}
-
-static inline void
-SET_ColorP4uiv(struct _glapi_table *disp,
-               void (GLAPIENTRYP fn) (GLenum, const GLuint *))
-{
-    SET_by_offset(disp, _gloffset_ColorP4uiv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiTexCoordP1ui) (GLenum, GLenum, GLuint);
-
-#define CALL_MultiTexCoordP1ui(disp, parameters) \
-    (* GET_MultiTexCoordP1ui(disp)) parameters
-static inline _glptr_MultiTexCoordP1ui
-GET_MultiTexCoordP1ui(struct _glapi_table *disp)
-{
-    return (_glptr_MultiTexCoordP1ui) (GET_by_offset
-                                       (disp, _gloffset_MultiTexCoordP1ui));
-}
-
-static inline void
-SET_MultiTexCoordP1ui(struct _glapi_table *disp,
-                      void (GLAPIENTRYP fn) (GLenum, GLenum, GLuint))
-{
-    SET_by_offset(disp, _gloffset_MultiTexCoordP1ui, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiTexCoordP1uiv) (GLenum, GLenum,
-                                                      const GLuint *);
-#define CALL_MultiTexCoordP1uiv(disp, parameters) \
-    (* GET_MultiTexCoordP1uiv(disp)) parameters
-static inline _glptr_MultiTexCoordP1uiv
-GET_MultiTexCoordP1uiv(struct _glapi_table *disp)
-{
-    return (_glptr_MultiTexCoordP1uiv) (GET_by_offset
-                                        (disp, _gloffset_MultiTexCoordP1uiv));
-}
-
-static inline void
-SET_MultiTexCoordP1uiv(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLenum, GLenum, const GLuint *))
-{
-    SET_by_offset(disp, _gloffset_MultiTexCoordP1uiv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiTexCoordP2ui) (GLenum, GLenum, GLuint);
-
-#define CALL_MultiTexCoordP2ui(disp, parameters) \
-    (* GET_MultiTexCoordP2ui(disp)) parameters
-static inline _glptr_MultiTexCoordP2ui
-GET_MultiTexCoordP2ui(struct _glapi_table *disp)
-{
-    return (_glptr_MultiTexCoordP2ui) (GET_by_offset
-                                       (disp, _gloffset_MultiTexCoordP2ui));
-}
-
-static inline void
-SET_MultiTexCoordP2ui(struct _glapi_table *disp,
-                      void (GLAPIENTRYP fn) (GLenum, GLenum, GLuint))
-{
-    SET_by_offset(disp, _gloffset_MultiTexCoordP2ui, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiTexCoordP2uiv) (GLenum, GLenum,
-                                                      const GLuint *);
-#define CALL_MultiTexCoordP2uiv(disp, parameters) \
-    (* GET_MultiTexCoordP2uiv(disp)) parameters
-static inline _glptr_MultiTexCoordP2uiv
-GET_MultiTexCoordP2uiv(struct _glapi_table *disp)
-{
-    return (_glptr_MultiTexCoordP2uiv) (GET_by_offset
-                                        (disp, _gloffset_MultiTexCoordP2uiv));
-}
-
-static inline void
-SET_MultiTexCoordP2uiv(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLenum, GLenum, const GLuint *))
-{
-    SET_by_offset(disp, _gloffset_MultiTexCoordP2uiv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiTexCoordP3ui) (GLenum, GLenum, GLuint);
-
-#define CALL_MultiTexCoordP3ui(disp, parameters) \
-    (* GET_MultiTexCoordP3ui(disp)) parameters
-static inline _glptr_MultiTexCoordP3ui
-GET_MultiTexCoordP3ui(struct _glapi_table *disp)
-{
-    return (_glptr_MultiTexCoordP3ui) (GET_by_offset
-                                       (disp, _gloffset_MultiTexCoordP3ui));
-}
-
-static inline void
-SET_MultiTexCoordP3ui(struct _glapi_table *disp,
-                      void (GLAPIENTRYP fn) (GLenum, GLenum, GLuint))
-{
-    SET_by_offset(disp, _gloffset_MultiTexCoordP3ui, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiTexCoordP3uiv) (GLenum, GLenum,
-                                                      const GLuint *);
-#define CALL_MultiTexCoordP3uiv(disp, parameters) \
-    (* GET_MultiTexCoordP3uiv(disp)) parameters
-static inline _glptr_MultiTexCoordP3uiv
-GET_MultiTexCoordP3uiv(struct _glapi_table *disp)
-{
-    return (_glptr_MultiTexCoordP3uiv) (GET_by_offset
-                                        (disp, _gloffset_MultiTexCoordP3uiv));
-}
-
-static inline void
-SET_MultiTexCoordP3uiv(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLenum, GLenum, const GLuint *))
-{
-    SET_by_offset(disp, _gloffset_MultiTexCoordP3uiv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiTexCoordP4ui) (GLenum, GLenum, GLuint);
-
-#define CALL_MultiTexCoordP4ui(disp, parameters) \
-    (* GET_MultiTexCoordP4ui(disp)) parameters
-static inline _glptr_MultiTexCoordP4ui
-GET_MultiTexCoordP4ui(struct _glapi_table *disp)
-{
-    return (_glptr_MultiTexCoordP4ui) (GET_by_offset
-                                       (disp, _gloffset_MultiTexCoordP4ui));
-}
-
-static inline void
-SET_MultiTexCoordP4ui(struct _glapi_table *disp,
-                      void (GLAPIENTRYP fn) (GLenum, GLenum, GLuint))
-{
-    SET_by_offset(disp, _gloffset_MultiTexCoordP4ui, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiTexCoordP4uiv) (GLenum, GLenum,
-                                                      const GLuint *);
-#define CALL_MultiTexCoordP4uiv(disp, parameters) \
-    (* GET_MultiTexCoordP4uiv(disp)) parameters
-static inline _glptr_MultiTexCoordP4uiv
-GET_MultiTexCoordP4uiv(struct _glapi_table *disp)
-{
-    return (_glptr_MultiTexCoordP4uiv) (GET_by_offset
-                                        (disp, _gloffset_MultiTexCoordP4uiv));
-}
-
-static inline void
-SET_MultiTexCoordP4uiv(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLenum, GLenum, const GLuint *))
-{
-    SET_by_offset(disp, _gloffset_MultiTexCoordP4uiv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_NormalP3ui) (GLenum, GLuint);
-
-#define CALL_NormalP3ui(disp, parameters) \
-    (* GET_NormalP3ui(disp)) parameters
-static inline _glptr_NormalP3ui
-GET_NormalP3ui(struct _glapi_table *disp)
-{
-    return (_glptr_NormalP3ui) (GET_by_offset(disp, _gloffset_NormalP3ui));
-}
-
-static inline void
-SET_NormalP3ui(struct _glapi_table *disp,
-               void (GLAPIENTRYP fn) (GLenum, GLuint))
-{
-    SET_by_offset(disp, _gloffset_NormalP3ui, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_NormalP3uiv) (GLenum, const GLuint *);
-
-#define CALL_NormalP3uiv(disp, parameters) \
-    (* GET_NormalP3uiv(disp)) parameters
-static inline _glptr_NormalP3uiv
-GET_NormalP3uiv(struct _glapi_table *disp)
-{
-    return (_glptr_NormalP3uiv) (GET_by_offset(disp, _gloffset_NormalP3uiv));
-}
-
-static inline void
-SET_NormalP3uiv(struct _glapi_table *disp,
-                void (GLAPIENTRYP fn) (GLenum, const GLuint *))
-{
-    SET_by_offset(disp, _gloffset_NormalP3uiv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_SecondaryColorP3ui) (GLenum, GLuint);
-
-#define CALL_SecondaryColorP3ui(disp, parameters) \
-    (* GET_SecondaryColorP3ui(disp)) parameters
-static inline _glptr_SecondaryColorP3ui
-GET_SecondaryColorP3ui(struct _glapi_table *disp)
-{
-    return (_glptr_SecondaryColorP3ui) (GET_by_offset
-                                        (disp, _gloffset_SecondaryColorP3ui));
-}
-
-static inline void
-SET_SecondaryColorP3ui(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLenum, GLuint))
-{
-    SET_by_offset(disp, _gloffset_SecondaryColorP3ui, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_SecondaryColorP3uiv) (GLenum, const GLuint *);
-
-#define CALL_SecondaryColorP3uiv(disp, parameters) \
-    (* GET_SecondaryColorP3uiv(disp)) parameters
-static inline _glptr_SecondaryColorP3uiv
-GET_SecondaryColorP3uiv(struct _glapi_table *disp)
-{
-    return (_glptr_SecondaryColorP3uiv) (GET_by_offset
-                                         (disp, _gloffset_SecondaryColorP3uiv));
-}
-
-static inline void
-SET_SecondaryColorP3uiv(struct _glapi_table *disp,
-                        void (GLAPIENTRYP fn) (GLenum, const GLuint *))
-{
-    SET_by_offset(disp, _gloffset_SecondaryColorP3uiv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoordP1ui) (GLenum, GLuint);
-
-#define CALL_TexCoordP1ui(disp, parameters) \
-    (* GET_TexCoordP1ui(disp)) parameters
-static inline _glptr_TexCoordP1ui
-GET_TexCoordP1ui(struct _glapi_table *disp)
-{
-    return (_glptr_TexCoordP1ui) (GET_by_offset(disp, _gloffset_TexCoordP1ui));
-}
-
-static inline void
-SET_TexCoordP1ui(struct _glapi_table *disp,
-                 void (GLAPIENTRYP fn) (GLenum, GLuint))
-{
-    SET_by_offset(disp, _gloffset_TexCoordP1ui, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoordP1uiv) (GLenum, const GLuint *);
-
-#define CALL_TexCoordP1uiv(disp, parameters) \
-    (* GET_TexCoordP1uiv(disp)) parameters
-static inline _glptr_TexCoordP1uiv
-GET_TexCoordP1uiv(struct _glapi_table *disp)
-{
-    return (_glptr_TexCoordP1uiv) (GET_by_offset
-                                   (disp, _gloffset_TexCoordP1uiv));
-}
-
-static inline void
-SET_TexCoordP1uiv(struct _glapi_table *disp,
-                  void (GLAPIENTRYP fn) (GLenum, const GLuint *))
-{
-    SET_by_offset(disp, _gloffset_TexCoordP1uiv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoordP2ui) (GLenum, GLuint);
-
-#define CALL_TexCoordP2ui(disp, parameters) \
-    (* GET_TexCoordP2ui(disp)) parameters
-static inline _glptr_TexCoordP2ui
-GET_TexCoordP2ui(struct _glapi_table *disp)
-{
-    return (_glptr_TexCoordP2ui) (GET_by_offset(disp, _gloffset_TexCoordP2ui));
-}
-
-static inline void
-SET_TexCoordP2ui(struct _glapi_table *disp,
-                 void (GLAPIENTRYP fn) (GLenum, GLuint))
-{
-    SET_by_offset(disp, _gloffset_TexCoordP2ui, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoordP2uiv) (GLenum, const GLuint *);
-
-#define CALL_TexCoordP2uiv(disp, parameters) \
-    (* GET_TexCoordP2uiv(disp)) parameters
-static inline _glptr_TexCoordP2uiv
-GET_TexCoordP2uiv(struct _glapi_table *disp)
-{
-    return (_glptr_TexCoordP2uiv) (GET_by_offset
-                                   (disp, _gloffset_TexCoordP2uiv));
-}
-
-static inline void
-SET_TexCoordP2uiv(struct _glapi_table *disp,
-                  void (GLAPIENTRYP fn) (GLenum, const GLuint *))
-{
-    SET_by_offset(disp, _gloffset_TexCoordP2uiv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoordP3ui) (GLenum, GLuint);
-
-#define CALL_TexCoordP3ui(disp, parameters) \
-    (* GET_TexCoordP3ui(disp)) parameters
-static inline _glptr_TexCoordP3ui
-GET_TexCoordP3ui(struct _glapi_table *disp)
-{
-    return (_glptr_TexCoordP3ui) (GET_by_offset(disp, _gloffset_TexCoordP3ui));
-}
-
-static inline void
-SET_TexCoordP3ui(struct _glapi_table *disp,
-                 void (GLAPIENTRYP fn) (GLenum, GLuint))
-{
-    SET_by_offset(disp, _gloffset_TexCoordP3ui, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoordP3uiv) (GLenum, const GLuint *);
-
-#define CALL_TexCoordP3uiv(disp, parameters) \
-    (* GET_TexCoordP3uiv(disp)) parameters
-static inline _glptr_TexCoordP3uiv
-GET_TexCoordP3uiv(struct _glapi_table *disp)
-{
-    return (_glptr_TexCoordP3uiv) (GET_by_offset
-                                   (disp, _gloffset_TexCoordP3uiv));
-}
-
-static inline void
-SET_TexCoordP3uiv(struct _glapi_table *disp,
-                  void (GLAPIENTRYP fn) (GLenum, const GLuint *))
-{
-    SET_by_offset(disp, _gloffset_TexCoordP3uiv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoordP4ui) (GLenum, GLuint);
-
-#define CALL_TexCoordP4ui(disp, parameters) \
-    (* GET_TexCoordP4ui(disp)) parameters
-static inline _glptr_TexCoordP4ui
-GET_TexCoordP4ui(struct _glapi_table *disp)
-{
-    return (_glptr_TexCoordP4ui) (GET_by_offset(disp, _gloffset_TexCoordP4ui));
-}
-
-static inline void
-SET_TexCoordP4ui(struct _glapi_table *disp,
-                 void (GLAPIENTRYP fn) (GLenum, GLuint))
-{
-    SET_by_offset(disp, _gloffset_TexCoordP4ui, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoordP4uiv) (GLenum, const GLuint *);
-
-#define CALL_TexCoordP4uiv(disp, parameters) \
-    (* GET_TexCoordP4uiv(disp)) parameters
-static inline _glptr_TexCoordP4uiv
-GET_TexCoordP4uiv(struct _glapi_table *disp)
-{
-    return (_glptr_TexCoordP4uiv) (GET_by_offset
-                                   (disp, _gloffset_TexCoordP4uiv));
-}
-
-static inline void
-SET_TexCoordP4uiv(struct _glapi_table *disp,
-                  void (GLAPIENTRYP fn) (GLenum, const GLuint *))
-{
-    SET_by_offset(disp, _gloffset_TexCoordP4uiv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribP1ui) (GLuint, GLenum, GLboolean,
-                                                    GLuint);
-#define CALL_VertexAttribP1ui(disp, parameters) \
-    (* GET_VertexAttribP1ui(disp)) parameters
-static inline _glptr_VertexAttribP1ui
-GET_VertexAttribP1ui(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttribP1ui) (GET_by_offset
-                                      (disp, _gloffset_VertexAttribP1ui));
-}
-
-static inline void
-SET_VertexAttribP1ui(struct _glapi_table *disp,
-                     void (GLAPIENTRYP fn) (GLuint, GLenum, GLboolean, GLuint))
-{
-    SET_by_offset(disp, _gloffset_VertexAttribP1ui, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribP1uiv) (GLuint, GLenum, GLboolean,
-                                                     const GLuint *);
-#define CALL_VertexAttribP1uiv(disp, parameters) \
-    (* GET_VertexAttribP1uiv(disp)) parameters
-static inline _glptr_VertexAttribP1uiv
-GET_VertexAttribP1uiv(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttribP1uiv) (GET_by_offset
-                                       (disp, _gloffset_VertexAttribP1uiv));
-}
-
-static inline void
-SET_VertexAttribP1uiv(struct _glapi_table *disp,
-                      void (GLAPIENTRYP fn) (GLuint, GLenum, GLboolean,
-                                             const GLuint *))
-{
-    SET_by_offset(disp, _gloffset_VertexAttribP1uiv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribP2ui) (GLuint, GLenum, GLboolean,
-                                                    GLuint);
-#define CALL_VertexAttribP2ui(disp, parameters) \
-    (* GET_VertexAttribP2ui(disp)) parameters
-static inline _glptr_VertexAttribP2ui
-GET_VertexAttribP2ui(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttribP2ui) (GET_by_offset
-                                      (disp, _gloffset_VertexAttribP2ui));
-}
-
-static inline void
-SET_VertexAttribP2ui(struct _glapi_table *disp,
-                     void (GLAPIENTRYP fn) (GLuint, GLenum, GLboolean, GLuint))
-{
-    SET_by_offset(disp, _gloffset_VertexAttribP2ui, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribP2uiv) (GLuint, GLenum, GLboolean,
-                                                     const GLuint *);
-#define CALL_VertexAttribP2uiv(disp, parameters) \
-    (* GET_VertexAttribP2uiv(disp)) parameters
-static inline _glptr_VertexAttribP2uiv
-GET_VertexAttribP2uiv(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttribP2uiv) (GET_by_offset
-                                       (disp, _gloffset_VertexAttribP2uiv));
-}
-
-static inline void
-SET_VertexAttribP2uiv(struct _glapi_table *disp,
-                      void (GLAPIENTRYP fn) (GLuint, GLenum, GLboolean,
-                                             const GLuint *))
-{
-    SET_by_offset(disp, _gloffset_VertexAttribP2uiv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribP3ui) (GLuint, GLenum, GLboolean,
-                                                    GLuint);
-#define CALL_VertexAttribP3ui(disp, parameters) \
-    (* GET_VertexAttribP3ui(disp)) parameters
-static inline _glptr_VertexAttribP3ui
-GET_VertexAttribP3ui(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttribP3ui) (GET_by_offset
-                                      (disp, _gloffset_VertexAttribP3ui));
-}
-
-static inline void
-SET_VertexAttribP3ui(struct _glapi_table *disp,
-                     void (GLAPIENTRYP fn) (GLuint, GLenum, GLboolean, GLuint))
-{
-    SET_by_offset(disp, _gloffset_VertexAttribP3ui, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribP3uiv) (GLuint, GLenum, GLboolean,
-                                                     const GLuint *);
-#define CALL_VertexAttribP3uiv(disp, parameters) \
-    (* GET_VertexAttribP3uiv(disp)) parameters
-static inline _glptr_VertexAttribP3uiv
-GET_VertexAttribP3uiv(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttribP3uiv) (GET_by_offset
-                                       (disp, _gloffset_VertexAttribP3uiv));
-}
-
-static inline void
-SET_VertexAttribP3uiv(struct _glapi_table *disp,
-                      void (GLAPIENTRYP fn) (GLuint, GLenum, GLboolean,
-                                             const GLuint *))
-{
-    SET_by_offset(disp, _gloffset_VertexAttribP3uiv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribP4ui) (GLuint, GLenum, GLboolean,
-                                                    GLuint);
-#define CALL_VertexAttribP4ui(disp, parameters) \
-    (* GET_VertexAttribP4ui(disp)) parameters
-static inline _glptr_VertexAttribP4ui
-GET_VertexAttribP4ui(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttribP4ui) (GET_by_offset
-                                      (disp, _gloffset_VertexAttribP4ui));
-}
-
-static inline void
-SET_VertexAttribP4ui(struct _glapi_table *disp,
-                     void (GLAPIENTRYP fn) (GLuint, GLenum, GLboolean, GLuint))
-{
-    SET_by_offset(disp, _gloffset_VertexAttribP4ui, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribP4uiv) (GLuint, GLenum, GLboolean,
-                                                     const GLuint *);
-#define CALL_VertexAttribP4uiv(disp, parameters) \
-    (* GET_VertexAttribP4uiv(disp)) parameters
-static inline _glptr_VertexAttribP4uiv
-GET_VertexAttribP4uiv(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttribP4uiv) (GET_by_offset
-                                       (disp, _gloffset_VertexAttribP4uiv));
-}
-
-static inline void
-SET_VertexAttribP4uiv(struct _glapi_table *disp,
-                      void (GLAPIENTRYP fn) (GLuint, GLenum, GLboolean,
-                                             const GLuint *))
-{
-    SET_by_offset(disp, _gloffset_VertexAttribP4uiv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexP2ui) (GLenum, GLuint);
-
-#define CALL_VertexP2ui(disp, parameters) \
-    (* GET_VertexP2ui(disp)) parameters
-static inline _glptr_VertexP2ui
-GET_VertexP2ui(struct _glapi_table *disp)
-{
-    return (_glptr_VertexP2ui) (GET_by_offset(disp, _gloffset_VertexP2ui));
-}
-
-static inline void
-SET_VertexP2ui(struct _glapi_table *disp,
-               void (GLAPIENTRYP fn) (GLenum, GLuint))
-{
-    SET_by_offset(disp, _gloffset_VertexP2ui, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexP2uiv) (GLenum, const GLuint *);
-
-#define CALL_VertexP2uiv(disp, parameters) \
-    (* GET_VertexP2uiv(disp)) parameters
-static inline _glptr_VertexP2uiv
-GET_VertexP2uiv(struct _glapi_table *disp)
-{
-    return (_glptr_VertexP2uiv) (GET_by_offset(disp, _gloffset_VertexP2uiv));
-}
-
-static inline void
-SET_VertexP2uiv(struct _glapi_table *disp,
-                void (GLAPIENTRYP fn) (GLenum, const GLuint *))
-{
-    SET_by_offset(disp, _gloffset_VertexP2uiv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexP3ui) (GLenum, GLuint);
-
-#define CALL_VertexP3ui(disp, parameters) \
-    (* GET_VertexP3ui(disp)) parameters
-static inline _glptr_VertexP3ui
-GET_VertexP3ui(struct _glapi_table *disp)
-{
-    return (_glptr_VertexP3ui) (GET_by_offset(disp, _gloffset_VertexP3ui));
-}
-
-static inline void
-SET_VertexP3ui(struct _glapi_table *disp,
-               void (GLAPIENTRYP fn) (GLenum, GLuint))
-{
-    SET_by_offset(disp, _gloffset_VertexP3ui, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexP3uiv) (GLenum, const GLuint *);
-
-#define CALL_VertexP3uiv(disp, parameters) \
-    (* GET_VertexP3uiv(disp)) parameters
-static inline _glptr_VertexP3uiv
-GET_VertexP3uiv(struct _glapi_table *disp)
-{
-    return (_glptr_VertexP3uiv) (GET_by_offset(disp, _gloffset_VertexP3uiv));
-}
-
-static inline void
-SET_VertexP3uiv(struct _glapi_table *disp,
-                void (GLAPIENTRYP fn) (GLenum, const GLuint *))
-{
-    SET_by_offset(disp, _gloffset_VertexP3uiv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexP4ui) (GLenum, GLuint);
-
-#define CALL_VertexP4ui(disp, parameters) \
-    (* GET_VertexP4ui(disp)) parameters
-static inline _glptr_VertexP4ui
-GET_VertexP4ui(struct _glapi_table *disp)
-{
-    return (_glptr_VertexP4ui) (GET_by_offset(disp, _gloffset_VertexP4ui));
-}
-
-static inline void
-SET_VertexP4ui(struct _glapi_table *disp,
-               void (GLAPIENTRYP fn) (GLenum, GLuint))
-{
-    SET_by_offset(disp, _gloffset_VertexP4ui, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexP4uiv) (GLenum, const GLuint *);
-
-#define CALL_VertexP4uiv(disp, parameters) \
-    (* GET_VertexP4uiv(disp)) parameters
-static inline _glptr_VertexP4uiv
-GET_VertexP4uiv(struct _glapi_table *disp)
-{
-    return (_glptr_VertexP4uiv) (GET_by_offset(disp, _gloffset_VertexP4uiv));
-}
-
-static inline void
-SET_VertexP4uiv(struct _glapi_table *disp,
-                void (GLAPIENTRYP fn) (GLenum, const GLuint *))
-{
-    SET_by_offset(disp, _gloffset_VertexP4uiv, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_BindTransformFeedback) (GLenum, GLuint);
-
-#define CALL_BindTransformFeedback(disp, parameters) \
-    (* GET_BindTransformFeedback(disp)) parameters
-static inline _glptr_BindTransformFeedback
-GET_BindTransformFeedback(struct _glapi_table *disp)
-{
-    return (_glptr_BindTransformFeedback) (GET_by_offset
-                                           (disp,
-                                            _gloffset_BindTransformFeedback));
-}
-
-static inline void
-SET_BindTransformFeedback(struct _glapi_table *disp,
-                          void (GLAPIENTRYP fn) (GLenum, GLuint))
-{
-    SET_by_offset(disp, _gloffset_BindTransformFeedback, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_DeleteTransformFeedbacks) (GLsizei,
-                                                            const GLuint *);
-#define CALL_DeleteTransformFeedbacks(disp, parameters) \
-    (* GET_DeleteTransformFeedbacks(disp)) parameters
-static inline _glptr_DeleteTransformFeedbacks
-GET_DeleteTransformFeedbacks(struct _glapi_table *disp)
-{
-    return (_glptr_DeleteTransformFeedbacks) (GET_by_offset
-                                              (disp,
-                                               _gloffset_DeleteTransformFeedbacks));
-}
-
-static inline void
-SET_DeleteTransformFeedbacks(struct _glapi_table *disp,
-                             void (GLAPIENTRYP fn) (GLsizei, const GLuint *))
-{
-    SET_by_offset(disp, _gloffset_DeleteTransformFeedbacks, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_DrawTransformFeedback) (GLenum, GLuint);
-
-#define CALL_DrawTransformFeedback(disp, parameters) \
-    (* GET_DrawTransformFeedback(disp)) parameters
-static inline _glptr_DrawTransformFeedback
-GET_DrawTransformFeedback(struct _glapi_table *disp)
-{
-    return (_glptr_DrawTransformFeedback) (GET_by_offset
-                                           (disp,
-                                            _gloffset_DrawTransformFeedback));
-}
-
-static inline void
-SET_DrawTransformFeedback(struct _glapi_table *disp,
-                          void (GLAPIENTRYP fn) (GLenum, GLuint))
-{
-    SET_by_offset(disp, _gloffset_DrawTransformFeedback, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GenTransformFeedbacks) (GLsizei, GLuint *);
-
-#define CALL_GenTransformFeedbacks(disp, parameters) \
-    (* GET_GenTransformFeedbacks(disp)) parameters
-static inline _glptr_GenTransformFeedbacks
-GET_GenTransformFeedbacks(struct _glapi_table *disp)
-{
-    return (_glptr_GenTransformFeedbacks) (GET_by_offset
-                                           (disp,
-                                            _gloffset_GenTransformFeedbacks));
-}
-
-static inline void
-SET_GenTransformFeedbacks(struct _glapi_table *disp,
-                          void (GLAPIENTRYP fn) (GLsizei, GLuint *))
-{
-    SET_by_offset(disp, _gloffset_GenTransformFeedbacks, fn);
-}
-
-typedef GLboolean(GLAPIENTRYP _glptr_IsTransformFeedback) (GLuint);
-
-#define CALL_IsTransformFeedback(disp, parameters) \
-    (* GET_IsTransformFeedback(disp)) parameters
-static inline _glptr_IsTransformFeedback
-GET_IsTransformFeedback(struct _glapi_table *disp)
-{
-    return (_glptr_IsTransformFeedback) (GET_by_offset
-                                         (disp, _gloffset_IsTransformFeedback));
-}
-
-static inline void
-SET_IsTransformFeedback(struct _glapi_table *disp,
-                        GLboolean(GLAPIENTRYP fn) (GLuint))
-{
-    SET_by_offset(disp, _gloffset_IsTransformFeedback, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_PauseTransformFeedback) (void);
-
-#define CALL_PauseTransformFeedback(disp, parameters) \
-    (* GET_PauseTransformFeedback(disp)) parameters
-static inline _glptr_PauseTransformFeedback
-GET_PauseTransformFeedback(struct _glapi_table *disp)
-{
-    return (_glptr_PauseTransformFeedback) (GET_by_offset
-                                            (disp,
-                                             _gloffset_PauseTransformFeedback));
-}
-
-static inline void
-SET_PauseTransformFeedback(struct _glapi_table *disp,
-                           void (GLAPIENTRYP fn) (void))
-{
-    SET_by_offset(disp, _gloffset_PauseTransformFeedback, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ResumeTransformFeedback) (void);
-
-#define CALL_ResumeTransformFeedback(disp, parameters) \
-    (* GET_ResumeTransformFeedback(disp)) parameters
-static inline _glptr_ResumeTransformFeedback
-GET_ResumeTransformFeedback(struct _glapi_table *disp)
-{
-    return (_glptr_ResumeTransformFeedback) (GET_by_offset
-                                             (disp,
-                                              _gloffset_ResumeTransformFeedback));
-}
-
-static inline void
-SET_ResumeTransformFeedback(struct _glapi_table *disp,
-                            void (GLAPIENTRYP fn) (void))
-{
-    SET_by_offset(disp, _gloffset_ResumeTransformFeedback, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ClearDepthf) (GLclampf);
-
-#define CALL_ClearDepthf(disp, parameters) \
-    (* GET_ClearDepthf(disp)) parameters
-static inline _glptr_ClearDepthf
-GET_ClearDepthf(struct _glapi_table *disp)
-{
-    return (_glptr_ClearDepthf) (GET_by_offset(disp, _gloffset_ClearDepthf));
-}
-
-static inline void
-SET_ClearDepthf(struct _glapi_table *disp, void (GLAPIENTRYP fn) (GLclampf))
-{
-    SET_by_offset(disp, _gloffset_ClearDepthf, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_DepthRangef) (GLclampf, GLclampf);
-
-#define CALL_DepthRangef(disp, parameters) \
-    (* GET_DepthRangef(disp)) parameters
-static inline _glptr_DepthRangef
-GET_DepthRangef(struct _glapi_table *disp)
-{
-    return (_glptr_DepthRangef) (GET_by_offset(disp, _gloffset_DepthRangef));
-}
-
-static inline void
-SET_DepthRangef(struct _glapi_table *disp,
-                void (GLAPIENTRYP fn) (GLclampf, GLclampf))
-{
-    SET_by_offset(disp, _gloffset_DepthRangef, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetShaderPrecisionFormat) (GLenum, GLenum,
-                                                            GLint *, GLint *);
-#define CALL_GetShaderPrecisionFormat(disp, parameters) \
-    (* GET_GetShaderPrecisionFormat(disp)) parameters
-static inline _glptr_GetShaderPrecisionFormat
-GET_GetShaderPrecisionFormat(struct _glapi_table *disp)
-{
-    return (_glptr_GetShaderPrecisionFormat) (GET_by_offset
-                                              (disp,
-                                               _gloffset_GetShaderPrecisionFormat));
-}
-
-static inline void
-SET_GetShaderPrecisionFormat(struct _glapi_table *disp,
-                             void (GLAPIENTRYP fn) (GLenum, GLenum, GLint *,
-                                                    GLint *))
-{
-    SET_by_offset(disp, _gloffset_GetShaderPrecisionFormat, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ReleaseShaderCompiler) (void);
-
-#define CALL_ReleaseShaderCompiler(disp, parameters) \
-    (* GET_ReleaseShaderCompiler(disp)) parameters
-static inline _glptr_ReleaseShaderCompiler
-GET_ReleaseShaderCompiler(struct _glapi_table *disp)
-{
-    return (_glptr_ReleaseShaderCompiler) (GET_by_offset
-                                           (disp,
-                                            _gloffset_ReleaseShaderCompiler));
-}
-
-static inline void
-SET_ReleaseShaderCompiler(struct _glapi_table *disp,
-                          void (GLAPIENTRYP fn) (void))
-{
-    SET_by_offset(disp, _gloffset_ReleaseShaderCompiler, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ShaderBinary) (GLsizei, const GLuint *, GLenum,
-                                                const GLvoid *, GLsizei);
-#define CALL_ShaderBinary(disp, parameters) \
-    (* GET_ShaderBinary(disp)) parameters
-static inline _glptr_ShaderBinary
-GET_ShaderBinary(struct _glapi_table *disp)
-{
-    return (_glptr_ShaderBinary) (GET_by_offset(disp, _gloffset_ShaderBinary));
-}
-
-static inline void
-SET_ShaderBinary(struct _glapi_table *disp,
-                 void (GLAPIENTRYP fn) (GLsizei, const GLuint *, GLenum,
-                                        const GLvoid *, GLsizei))
-{
-    SET_by_offset(disp, _gloffset_ShaderBinary, fn);
-}
-
-typedef GLenum(GLAPIENTRYP _glptr_GetGraphicsResetStatusARB) (void);
-
-#define CALL_GetGraphicsResetStatusARB(disp, parameters) \
-    (* GET_GetGraphicsResetStatusARB(disp)) parameters
-static inline _glptr_GetGraphicsResetStatusARB
-GET_GetGraphicsResetStatusARB(struct _glapi_table *disp)
-{
-    return (_glptr_GetGraphicsResetStatusARB) (GET_by_offset
-                                               (disp,
-                                                _gloffset_GetGraphicsResetStatusARB));
-}
-
-static inline void
-SET_GetGraphicsResetStatusARB(struct _glapi_table *disp,
-                              GLenum(GLAPIENTRYP fn) (void))
-{
-    SET_by_offset(disp, _gloffset_GetGraphicsResetStatusARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetnColorTableARB) (GLenum, GLenum, GLenum,
-                                                     GLsizei, GLvoid *);
-#define CALL_GetnColorTableARB(disp, parameters) \
-    (* GET_GetnColorTableARB(disp)) parameters
-static inline _glptr_GetnColorTableARB
-GET_GetnColorTableARB(struct _glapi_table *disp)
-{
-    return (_glptr_GetnColorTableARB) (GET_by_offset
-                                       (disp, _gloffset_GetnColorTableARB));
-}
-
-static inline void
-SET_GetnColorTableARB(struct _glapi_table *disp,
-                      void (GLAPIENTRYP fn) (GLenum, GLenum, GLenum, GLsizei,
-                                             GLvoid *))
-{
-    SET_by_offset(disp, _gloffset_GetnColorTableARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetnCompressedTexImageARB) (GLenum, GLint,
-                                                             GLsizei, GLvoid *);
-#define CALL_GetnCompressedTexImageARB(disp, parameters) \
-    (* GET_GetnCompressedTexImageARB(disp)) parameters
-static inline _glptr_GetnCompressedTexImageARB
-GET_GetnCompressedTexImageARB(struct _glapi_table *disp)
-{
-    return (_glptr_GetnCompressedTexImageARB) (GET_by_offset
-                                               (disp,
-                                                _gloffset_GetnCompressedTexImageARB));
-}
-
-static inline void
-SET_GetnCompressedTexImageARB(struct _glapi_table *disp,
-                              void (GLAPIENTRYP fn) (GLenum, GLint, GLsizei,
-                                                     GLvoid *))
-{
-    SET_by_offset(disp, _gloffset_GetnCompressedTexImageARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetnConvolutionFilterARB) (GLenum, GLenum,
-                                                            GLenum, GLsizei,
-                                                            GLvoid *);
-#define CALL_GetnConvolutionFilterARB(disp, parameters) \
-    (* GET_GetnConvolutionFilterARB(disp)) parameters
-static inline _glptr_GetnConvolutionFilterARB
-GET_GetnConvolutionFilterARB(struct _glapi_table *disp)
-{
-    return (_glptr_GetnConvolutionFilterARB) (GET_by_offset
-                                              (disp,
-                                               _gloffset_GetnConvolutionFilterARB));
-}
-
-static inline void
-SET_GetnConvolutionFilterARB(struct _glapi_table *disp,
-                             void (GLAPIENTRYP fn) (GLenum, GLenum, GLenum,
-                                                    GLsizei, GLvoid *))
-{
-    SET_by_offset(disp, _gloffset_GetnConvolutionFilterARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetnHistogramARB) (GLenum, GLboolean, GLenum,
-                                                    GLenum, GLsizei, GLvoid *);
-#define CALL_GetnHistogramARB(disp, parameters) \
-    (* GET_GetnHistogramARB(disp)) parameters
-static inline _glptr_GetnHistogramARB
-GET_GetnHistogramARB(struct _glapi_table *disp)
-{
-    return (_glptr_GetnHistogramARB) (GET_by_offset
-                                      (disp, _gloffset_GetnHistogramARB));
-}
-
-static inline void
-SET_GetnHistogramARB(struct _glapi_table *disp,
-                     void (GLAPIENTRYP fn) (GLenum, GLboolean, GLenum, GLenum,
-                                            GLsizei, GLvoid *))
-{
-    SET_by_offset(disp, _gloffset_GetnHistogramARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetnMapdvARB) (GLenum, GLenum, GLsizei,
-                                                GLdouble *);
-#define CALL_GetnMapdvARB(disp, parameters) \
-    (* GET_GetnMapdvARB(disp)) parameters
-static inline _glptr_GetnMapdvARB
-GET_GetnMapdvARB(struct _glapi_table *disp)
-{
-    return (_glptr_GetnMapdvARB) (GET_by_offset(disp, _gloffset_GetnMapdvARB));
-}
-
-static inline void
-SET_GetnMapdvARB(struct _glapi_table *disp,
-                 void (GLAPIENTRYP fn) (GLenum, GLenum, GLsizei, GLdouble *))
-{
-    SET_by_offset(disp, _gloffset_GetnMapdvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetnMapfvARB) (GLenum, GLenum, GLsizei,
-                                                GLfloat *);
-#define CALL_GetnMapfvARB(disp, parameters) \
-    (* GET_GetnMapfvARB(disp)) parameters
-static inline _glptr_GetnMapfvARB
-GET_GetnMapfvARB(struct _glapi_table *disp)
-{
-    return (_glptr_GetnMapfvARB) (GET_by_offset(disp, _gloffset_GetnMapfvARB));
-}
-
-static inline void
-SET_GetnMapfvARB(struct _glapi_table *disp,
-                 void (GLAPIENTRYP fn) (GLenum, GLenum, GLsizei, GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_GetnMapfvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetnMapivARB) (GLenum, GLenum, GLsizei,
-                                                GLint *);
-#define CALL_GetnMapivARB(disp, parameters) \
-    (* GET_GetnMapivARB(disp)) parameters
-static inline _glptr_GetnMapivARB
-GET_GetnMapivARB(struct _glapi_table *disp)
-{
-    return (_glptr_GetnMapivARB) (GET_by_offset(disp, _gloffset_GetnMapivARB));
-}
-
-static inline void
-SET_GetnMapivARB(struct _glapi_table *disp,
-                 void (GLAPIENTRYP fn) (GLenum, GLenum, GLsizei, GLint *))
-{
-    SET_by_offset(disp, _gloffset_GetnMapivARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetnMinmaxARB) (GLenum, GLboolean, GLenum,
-                                                 GLenum, GLsizei, GLvoid *);
-#define CALL_GetnMinmaxARB(disp, parameters) \
-    (* GET_GetnMinmaxARB(disp)) parameters
-static inline _glptr_GetnMinmaxARB
-GET_GetnMinmaxARB(struct _glapi_table *disp)
-{
-    return (_glptr_GetnMinmaxARB) (GET_by_offset
-                                   (disp, _gloffset_GetnMinmaxARB));
-}
-
-static inline void
-SET_GetnMinmaxARB(struct _glapi_table *disp,
-                  void (GLAPIENTRYP fn) (GLenum, GLboolean, GLenum, GLenum,
-                                         GLsizei, GLvoid *))
-{
-    SET_by_offset(disp, _gloffset_GetnMinmaxARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetnPixelMapfvARB) (GLenum, GLsizei,
-                                                     GLfloat *);
-#define CALL_GetnPixelMapfvARB(disp, parameters) \
-    (* GET_GetnPixelMapfvARB(disp)) parameters
-static inline _glptr_GetnPixelMapfvARB
-GET_GetnPixelMapfvARB(struct _glapi_table *disp)
-{
-    return (_glptr_GetnPixelMapfvARB) (GET_by_offset
-                                       (disp, _gloffset_GetnPixelMapfvARB));
-}
-
-static inline void
-SET_GetnPixelMapfvARB(struct _glapi_table *disp,
-                      void (GLAPIENTRYP fn) (GLenum, GLsizei, GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_GetnPixelMapfvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetnPixelMapuivARB) (GLenum, GLsizei,
-                                                      GLuint *);
-#define CALL_GetnPixelMapuivARB(disp, parameters) \
-    (* GET_GetnPixelMapuivARB(disp)) parameters
-static inline _glptr_GetnPixelMapuivARB
-GET_GetnPixelMapuivARB(struct _glapi_table *disp)
-{
-    return (_glptr_GetnPixelMapuivARB) (GET_by_offset
-                                        (disp, _gloffset_GetnPixelMapuivARB));
-}
-
-static inline void
-SET_GetnPixelMapuivARB(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLenum, GLsizei, GLuint *))
-{
-    SET_by_offset(disp, _gloffset_GetnPixelMapuivARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetnPixelMapusvARB) (GLenum, GLsizei,
-                                                      GLushort *);
-#define CALL_GetnPixelMapusvARB(disp, parameters) \
-    (* GET_GetnPixelMapusvARB(disp)) parameters
-static inline _glptr_GetnPixelMapusvARB
-GET_GetnPixelMapusvARB(struct _glapi_table *disp)
-{
-    return (_glptr_GetnPixelMapusvARB) (GET_by_offset
-                                        (disp, _gloffset_GetnPixelMapusvARB));
-}
-
-static inline void
-SET_GetnPixelMapusvARB(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLenum, GLsizei, GLushort *))
-{
-    SET_by_offset(disp, _gloffset_GetnPixelMapusvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetnPolygonStippleARB) (GLsizei, GLubyte *);
-
-#define CALL_GetnPolygonStippleARB(disp, parameters) \
-    (* GET_GetnPolygonStippleARB(disp)) parameters
-static inline _glptr_GetnPolygonStippleARB
-GET_GetnPolygonStippleARB(struct _glapi_table *disp)
-{
-    return (_glptr_GetnPolygonStippleARB) (GET_by_offset
-                                           (disp,
-                                            _gloffset_GetnPolygonStippleARB));
-}
-
-static inline void
-SET_GetnPolygonStippleARB(struct _glapi_table *disp,
-                          void (GLAPIENTRYP fn) (GLsizei, GLubyte *))
-{
-    SET_by_offset(disp, _gloffset_GetnPolygonStippleARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetnSeparableFilterARB) (GLenum, GLenum,
-                                                          GLenum, GLsizei,
-                                                          GLvoid *, GLsizei,
-                                                          GLvoid *, GLvoid *);
-#define CALL_GetnSeparableFilterARB(disp, parameters) \
-    (* GET_GetnSeparableFilterARB(disp)) parameters
-static inline _glptr_GetnSeparableFilterARB
-GET_GetnSeparableFilterARB(struct _glapi_table *disp)
-{
-    return (_glptr_GetnSeparableFilterARB) (GET_by_offset
-                                            (disp,
-                                             _gloffset_GetnSeparableFilterARB));
-}
-
-static inline void
-SET_GetnSeparableFilterARB(struct _glapi_table *disp,
-                           void (GLAPIENTRYP fn) (GLenum, GLenum, GLenum,
-                                                  GLsizei, GLvoid *, GLsizei,
-                                                  GLvoid *, GLvoid *))
-{
-    SET_by_offset(disp, _gloffset_GetnSeparableFilterARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetnTexImageARB) (GLenum, GLint, GLenum,
-                                                   GLenum, GLsizei, GLvoid *);
-#define CALL_GetnTexImageARB(disp, parameters) \
-    (* GET_GetnTexImageARB(disp)) parameters
-static inline _glptr_GetnTexImageARB
-GET_GetnTexImageARB(struct _glapi_table *disp)
-{
-    return (_glptr_GetnTexImageARB) (GET_by_offset
-                                     (disp, _gloffset_GetnTexImageARB));
-}
-
-static inline void
-SET_GetnTexImageARB(struct _glapi_table *disp,
-                    void (GLAPIENTRYP fn) (GLenum, GLint, GLenum, GLenum,
-                                           GLsizei, GLvoid *))
-{
-    SET_by_offset(disp, _gloffset_GetnTexImageARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetnUniformdvARB) (GLhandleARB, GLint, GLsizei,
-                                                    GLdouble *);
-#define CALL_GetnUniformdvARB(disp, parameters) \
-    (* GET_GetnUniformdvARB(disp)) parameters
-static inline _glptr_GetnUniformdvARB
-GET_GetnUniformdvARB(struct _glapi_table *disp)
-{
-    return (_glptr_GetnUniformdvARB) (GET_by_offset
-                                      (disp, _gloffset_GetnUniformdvARB));
-}
-
-static inline void
-SET_GetnUniformdvARB(struct _glapi_table *disp,
-                     void (GLAPIENTRYP fn) (GLhandleARB, GLint, GLsizei,
-                                            GLdouble *))
-{
-    SET_by_offset(disp, _gloffset_GetnUniformdvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetnUniformfvARB) (GLhandleARB, GLint, GLsizei,
-                                                    GLfloat *);
-#define CALL_GetnUniformfvARB(disp, parameters) \
-    (* GET_GetnUniformfvARB(disp)) parameters
-static inline _glptr_GetnUniformfvARB
-GET_GetnUniformfvARB(struct _glapi_table *disp)
-{
-    return (_glptr_GetnUniformfvARB) (GET_by_offset
-                                      (disp, _gloffset_GetnUniformfvARB));
-}
-
-static inline void
-SET_GetnUniformfvARB(struct _glapi_table *disp,
-                     void (GLAPIENTRYP fn) (GLhandleARB, GLint, GLsizei,
-                                            GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_GetnUniformfvARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetnUniformivARB) (GLhandleARB, GLint, GLsizei,
-                                                    GLint *);
-#define CALL_GetnUniformivARB(disp, parameters) \
-    (* GET_GetnUniformivARB(disp)) parameters
-static inline _glptr_GetnUniformivARB
-GET_GetnUniformivARB(struct _glapi_table *disp)
-{
-    return (_glptr_GetnUniformivARB) (GET_by_offset
-                                      (disp, _gloffset_GetnUniformivARB));
-}
-
-static inline void
-SET_GetnUniformivARB(struct _glapi_table *disp,
-                     void (GLAPIENTRYP fn) (GLhandleARB, GLint, GLsizei,
-                                            GLint *))
-{
-    SET_by_offset(disp, _gloffset_GetnUniformivARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetnUniformuivARB) (GLhandleARB, GLint,
-                                                     GLsizei, GLuint *);
-#define CALL_GetnUniformuivARB(disp, parameters) \
-    (* GET_GetnUniformuivARB(disp)) parameters
-static inline _glptr_GetnUniformuivARB
-GET_GetnUniformuivARB(struct _glapi_table *disp)
-{
-    return (_glptr_GetnUniformuivARB) (GET_by_offset
-                                       (disp, _gloffset_GetnUniformuivARB));
-}
-
-static inline void
-SET_GetnUniformuivARB(struct _glapi_table *disp,
-                      void (GLAPIENTRYP fn) (GLhandleARB, GLint, GLsizei,
-                                             GLuint *))
-{
-    SET_by_offset(disp, _gloffset_GetnUniformuivARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ReadnPixelsARB) (GLint, GLint, GLsizei,
-                                                  GLsizei, GLenum, GLenum,
-                                                  GLsizei, GLvoid *);
-#define CALL_ReadnPixelsARB(disp, parameters) \
-    (* GET_ReadnPixelsARB(disp)) parameters
-static inline _glptr_ReadnPixelsARB
-GET_ReadnPixelsARB(struct _glapi_table *disp)
-{
-    return (_glptr_ReadnPixelsARB) (GET_by_offset
-                                    (disp, _gloffset_ReadnPixelsARB));
-}
-
-static inline void
-SET_ReadnPixelsARB(struct _glapi_table *disp,
-                   void (GLAPIENTRYP fn) (GLint, GLint, GLsizei, GLsizei,
-                                          GLenum, GLenum, GLsizei, GLvoid *))
-{
-    SET_by_offset(disp, _gloffset_ReadnPixelsARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexStorage1D) (GLenum, GLsizei, GLenum,
-                                                GLsizei);
-#define CALL_TexStorage1D(disp, parameters) \
-    (* GET_TexStorage1D(disp)) parameters
-static inline _glptr_TexStorage1D
-GET_TexStorage1D(struct _glapi_table *disp)
-{
-    return (_glptr_TexStorage1D) (GET_by_offset(disp, _gloffset_TexStorage1D));
-}
-
-static inline void
-SET_TexStorage1D(struct _glapi_table *disp,
-                 void (GLAPIENTRYP fn) (GLenum, GLsizei, GLenum, GLsizei))
-{
-    SET_by_offset(disp, _gloffset_TexStorage1D, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexStorage2D) (GLenum, GLsizei, GLenum,
-                                                GLsizei, GLsizei);
-#define CALL_TexStorage2D(disp, parameters) \
-    (* GET_TexStorage2D(disp)) parameters
-static inline _glptr_TexStorage2D
-GET_TexStorage2D(struct _glapi_table *disp)
-{
-    return (_glptr_TexStorage2D) (GET_by_offset(disp, _gloffset_TexStorage2D));
-}
-
-static inline void
-SET_TexStorage2D(struct _glapi_table *disp,
-                 void (GLAPIENTRYP fn) (GLenum, GLsizei, GLenum, GLsizei,
-                                        GLsizei))
-{
-    SET_by_offset(disp, _gloffset_TexStorage2D, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexStorage3D) (GLenum, GLsizei, GLenum,
-                                                GLsizei, GLsizei, GLsizei);
-#define CALL_TexStorage3D(disp, parameters) \
-    (* GET_TexStorage3D(disp)) parameters
-static inline _glptr_TexStorage3D
-GET_TexStorage3D(struct _glapi_table *disp)
-{
-    return (_glptr_TexStorage3D) (GET_by_offset(disp, _gloffset_TexStorage3D));
-}
-
-static inline void
-SET_TexStorage3D(struct _glapi_table *disp,
-                 void (GLAPIENTRYP fn) (GLenum, GLsizei, GLenum, GLsizei,
-                                        GLsizei, GLsizei))
-{
-    SET_by_offset(disp, _gloffset_TexStorage3D, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TextureStorage1DEXT) (GLuint, GLenum, GLsizei,
-                                                       GLenum, GLsizei);
-#define CALL_TextureStorage1DEXT(disp, parameters) \
-    (* GET_TextureStorage1DEXT(disp)) parameters
-static inline _glptr_TextureStorage1DEXT
-GET_TextureStorage1DEXT(struct _glapi_table *disp)
-{
-    return (_glptr_TextureStorage1DEXT) (GET_by_offset
-                                         (disp, _gloffset_TextureStorage1DEXT));
-}
-
-static inline void
-SET_TextureStorage1DEXT(struct _glapi_table *disp,
-                        void (GLAPIENTRYP fn) (GLuint, GLenum, GLsizei, GLenum,
-                                               GLsizei))
-{
-    SET_by_offset(disp, _gloffset_TextureStorage1DEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TextureStorage2DEXT) (GLuint, GLenum, GLsizei,
-                                                       GLenum, GLsizei,
-                                                       GLsizei);
-#define CALL_TextureStorage2DEXT(disp, parameters) \
-    (* GET_TextureStorage2DEXT(disp)) parameters
-static inline _glptr_TextureStorage2DEXT
-GET_TextureStorage2DEXT(struct _glapi_table *disp)
-{
-    return (_glptr_TextureStorage2DEXT) (GET_by_offset
-                                         (disp, _gloffset_TextureStorage2DEXT));
-}
-
-static inline void
-SET_TextureStorage2DEXT(struct _glapi_table *disp,
-                        void (GLAPIENTRYP fn) (GLuint, GLenum, GLsizei, GLenum,
-                                               GLsizei, GLsizei))
-{
-    SET_by_offset(disp, _gloffset_TextureStorage2DEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TextureStorage3DEXT) (GLuint, GLenum, GLsizei,
-                                                       GLenum, GLsizei, GLsizei,
-                                                       GLsizei);
-#define CALL_TextureStorage3DEXT(disp, parameters) \
-    (* GET_TextureStorage3DEXT(disp)) parameters
-static inline _glptr_TextureStorage3DEXT
-GET_TextureStorage3DEXT(struct _glapi_table *disp)
-{
-    return (_glptr_TextureStorage3DEXT) (GET_by_offset
-                                         (disp, _gloffset_TextureStorage3DEXT));
-}
-
-static inline void
-SET_TextureStorage3DEXT(struct _glapi_table *disp,
-                        void (GLAPIENTRYP fn) (GLuint, GLenum, GLsizei, GLenum,
-                                               GLsizei, GLsizei, GLsizei))
-{
-    SET_by_offset(disp, _gloffset_TextureStorage3DEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_PolygonOffsetEXT) (GLfloat, GLfloat);
-
-#define CALL_PolygonOffsetEXT(disp, parameters) \
-    (* GET_PolygonOffsetEXT(disp)) parameters
-static inline _glptr_PolygonOffsetEXT
-GET_PolygonOffsetEXT(struct _glapi_table *disp)
-{
-    return (_glptr_PolygonOffsetEXT) (GET_by_offset
-                                      (disp, _gloffset_PolygonOffsetEXT));
-}
-
-static inline void
-SET_PolygonOffsetEXT(struct _glapi_table *disp,
-                     void (GLAPIENTRYP fn) (GLfloat, GLfloat))
-{
-    SET_by_offset(disp, _gloffset_PolygonOffsetEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetPixelTexGenParameterfvSGIS) (GLenum,
-                                                                 GLfloat *);
-#define CALL_GetPixelTexGenParameterfvSGIS(disp, parameters) \
-    (* GET_GetPixelTexGenParameterfvSGIS(disp)) parameters
-static inline _glptr_GetPixelTexGenParameterfvSGIS
-GET_GetPixelTexGenParameterfvSGIS(struct _glapi_table *disp)
-{
-    return (_glptr_GetPixelTexGenParameterfvSGIS) (GET_by_offset
-                                                   (disp,
-                                                    _gloffset_GetPixelTexGenParameterfvSGIS));
-}
-
-static inline void
-SET_GetPixelTexGenParameterfvSGIS(struct _glapi_table *disp,
-                                  void (GLAPIENTRYP fn) (GLenum, GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_GetPixelTexGenParameterfvSGIS, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetPixelTexGenParameterivSGIS) (GLenum,
-                                                                 GLint *);
-#define CALL_GetPixelTexGenParameterivSGIS(disp, parameters) \
-    (* GET_GetPixelTexGenParameterivSGIS(disp)) parameters
-static inline _glptr_GetPixelTexGenParameterivSGIS
-GET_GetPixelTexGenParameterivSGIS(struct _glapi_table *disp)
-{
-    return (_glptr_GetPixelTexGenParameterivSGIS) (GET_by_offset
-                                                   (disp,
-                                                    _gloffset_GetPixelTexGenParameterivSGIS));
-}
-
-static inline void
-SET_GetPixelTexGenParameterivSGIS(struct _glapi_table *disp,
-                                  void (GLAPIENTRYP fn) (GLenum, GLint *))
-{
-    SET_by_offset(disp, _gloffset_GetPixelTexGenParameterivSGIS, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_PixelTexGenParameterfSGIS) (GLenum, GLfloat);
-
-#define CALL_PixelTexGenParameterfSGIS(disp, parameters) \
-    (* GET_PixelTexGenParameterfSGIS(disp)) parameters
-static inline _glptr_PixelTexGenParameterfSGIS
-GET_PixelTexGenParameterfSGIS(struct _glapi_table *disp)
-{
-    return (_glptr_PixelTexGenParameterfSGIS) (GET_by_offset
-                                               (disp,
-                                                _gloffset_PixelTexGenParameterfSGIS));
-}
-
-static inline void
-SET_PixelTexGenParameterfSGIS(struct _glapi_table *disp,
-                              void (GLAPIENTRYP fn) (GLenum, GLfloat))
-{
-    SET_by_offset(disp, _gloffset_PixelTexGenParameterfSGIS, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_PixelTexGenParameterfvSGIS) (GLenum,
-                                                              const GLfloat *);
-#define CALL_PixelTexGenParameterfvSGIS(disp, parameters) \
-    (* GET_PixelTexGenParameterfvSGIS(disp)) parameters
-static inline _glptr_PixelTexGenParameterfvSGIS
-GET_PixelTexGenParameterfvSGIS(struct _glapi_table *disp)
-{
-    return (_glptr_PixelTexGenParameterfvSGIS) (GET_by_offset
-                                                (disp,
-                                                 _gloffset_PixelTexGenParameterfvSGIS));
-}
-
-static inline void
-SET_PixelTexGenParameterfvSGIS(struct _glapi_table *disp,
-                               void (GLAPIENTRYP fn) (GLenum, const GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_PixelTexGenParameterfvSGIS, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_PixelTexGenParameteriSGIS) (GLenum, GLint);
-
-#define CALL_PixelTexGenParameteriSGIS(disp, parameters) \
-    (* GET_PixelTexGenParameteriSGIS(disp)) parameters
-static inline _glptr_PixelTexGenParameteriSGIS
-GET_PixelTexGenParameteriSGIS(struct _glapi_table *disp)
-{
-    return (_glptr_PixelTexGenParameteriSGIS) (GET_by_offset
-                                               (disp,
-                                                _gloffset_PixelTexGenParameteriSGIS));
-}
-
-static inline void
-SET_PixelTexGenParameteriSGIS(struct _glapi_table *disp,
-                              void (GLAPIENTRYP fn) (GLenum, GLint))
-{
-    SET_by_offset(disp, _gloffset_PixelTexGenParameteriSGIS, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_PixelTexGenParameterivSGIS) (GLenum,
-                                                              const GLint *);
-#define CALL_PixelTexGenParameterivSGIS(disp, parameters) \
-    (* GET_PixelTexGenParameterivSGIS(disp)) parameters
-static inline _glptr_PixelTexGenParameterivSGIS
-GET_PixelTexGenParameterivSGIS(struct _glapi_table *disp)
-{
-    return (_glptr_PixelTexGenParameterivSGIS) (GET_by_offset
-                                                (disp,
-                                                 _gloffset_PixelTexGenParameterivSGIS));
-}
-
-static inline void
-SET_PixelTexGenParameterivSGIS(struct _glapi_table *disp,
-                               void (GLAPIENTRYP fn) (GLenum, const GLint *))
-{
-    SET_by_offset(disp, _gloffset_PixelTexGenParameterivSGIS, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_SampleMaskSGIS) (GLclampf, GLboolean);
-
-#define CALL_SampleMaskSGIS(disp, parameters) \
-    (* GET_SampleMaskSGIS(disp)) parameters
-static inline _glptr_SampleMaskSGIS
-GET_SampleMaskSGIS(struct _glapi_table *disp)
-{
-    return (_glptr_SampleMaskSGIS) (GET_by_offset
-                                    (disp, _gloffset_SampleMaskSGIS));
-}
-
-static inline void
-SET_SampleMaskSGIS(struct _glapi_table *disp,
-                   void (GLAPIENTRYP fn) (GLclampf, GLboolean))
-{
-    SET_by_offset(disp, _gloffset_SampleMaskSGIS, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_SamplePatternSGIS) (GLenum);
-
-#define CALL_SamplePatternSGIS(disp, parameters) \
-    (* GET_SamplePatternSGIS(disp)) parameters
-static inline _glptr_SamplePatternSGIS
-GET_SamplePatternSGIS(struct _glapi_table *disp)
-{
-    return (_glptr_SamplePatternSGIS) (GET_by_offset
-                                       (disp, _gloffset_SamplePatternSGIS));
-}
-
-static inline void
-SET_SamplePatternSGIS(struct _glapi_table *disp, void (GLAPIENTRYP fn) (GLenum))
-{
-    SET_by_offset(disp, _gloffset_SamplePatternSGIS, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ColorPointerEXT) (GLint, GLenum, GLsizei,
-                                                   GLsizei, const GLvoid *);
-#define CALL_ColorPointerEXT(disp, parameters) \
-    (* GET_ColorPointerEXT(disp)) parameters
-static inline _glptr_ColorPointerEXT
-GET_ColorPointerEXT(struct _glapi_table *disp)
-{
-    return (_glptr_ColorPointerEXT) (GET_by_offset
-                                     (disp, _gloffset_ColorPointerEXT));
-}
-
-static inline void
-SET_ColorPointerEXT(struct _glapi_table *disp,
-                    void (GLAPIENTRYP fn) (GLint, GLenum, GLsizei, GLsizei,
-                                           const GLvoid *))
-{
-    SET_by_offset(disp, _gloffset_ColorPointerEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_EdgeFlagPointerEXT) (GLsizei, GLsizei,
-                                                      const GLboolean *);
-#define CALL_EdgeFlagPointerEXT(disp, parameters) \
-    (* GET_EdgeFlagPointerEXT(disp)) parameters
-static inline _glptr_EdgeFlagPointerEXT
-GET_EdgeFlagPointerEXT(struct _glapi_table *disp)
-{
-    return (_glptr_EdgeFlagPointerEXT) (GET_by_offset
-                                        (disp, _gloffset_EdgeFlagPointerEXT));
-}
-
-static inline void
-SET_EdgeFlagPointerEXT(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLsizei, GLsizei,
-                                              const GLboolean *))
-{
-    SET_by_offset(disp, _gloffset_EdgeFlagPointerEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_IndexPointerEXT) (GLenum, GLsizei, GLsizei,
-                                                   const GLvoid *);
-#define CALL_IndexPointerEXT(disp, parameters) \
-    (* GET_IndexPointerEXT(disp)) parameters
-static inline _glptr_IndexPointerEXT
-GET_IndexPointerEXT(struct _glapi_table *disp)
-{
-    return (_glptr_IndexPointerEXT) (GET_by_offset
-                                     (disp, _gloffset_IndexPointerEXT));
-}
-
-static inline void
-SET_IndexPointerEXT(struct _glapi_table *disp,
-                    void (GLAPIENTRYP fn) (GLenum, GLsizei, GLsizei,
-                                           const GLvoid *))
-{
-    SET_by_offset(disp, _gloffset_IndexPointerEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_NormalPointerEXT) (GLenum, GLsizei, GLsizei,
-                                                    const GLvoid *);
-#define CALL_NormalPointerEXT(disp, parameters) \
-    (* GET_NormalPointerEXT(disp)) parameters
-static inline _glptr_NormalPointerEXT
-GET_NormalPointerEXT(struct _glapi_table *disp)
-{
-    return (_glptr_NormalPointerEXT) (GET_by_offset
-                                      (disp, _gloffset_NormalPointerEXT));
-}
-
-static inline void
-SET_NormalPointerEXT(struct _glapi_table *disp,
-                     void (GLAPIENTRYP fn) (GLenum, GLsizei, GLsizei,
-                                            const GLvoid *))
-{
-    SET_by_offset(disp, _gloffset_NormalPointerEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexCoordPointerEXT) (GLint, GLenum, GLsizei,
-                                                      GLsizei, const GLvoid *);
-#define CALL_TexCoordPointerEXT(disp, parameters) \
-    (* GET_TexCoordPointerEXT(disp)) parameters
-static inline _glptr_TexCoordPointerEXT
-GET_TexCoordPointerEXT(struct _glapi_table *disp)
-{
-    return (_glptr_TexCoordPointerEXT) (GET_by_offset
-                                        (disp, _gloffset_TexCoordPointerEXT));
-}
-
-static inline void
-SET_TexCoordPointerEXT(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLint, GLenum, GLsizei, GLsizei,
-                                              const GLvoid *))
-{
-    SET_by_offset(disp, _gloffset_TexCoordPointerEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexPointerEXT) (GLint, GLenum, GLsizei,
-                                                    GLsizei, const GLvoid *);
-#define CALL_VertexPointerEXT(disp, parameters) \
-    (* GET_VertexPointerEXT(disp)) parameters
-static inline _glptr_VertexPointerEXT
-GET_VertexPointerEXT(struct _glapi_table *disp)
-{
-    return (_glptr_VertexPointerEXT) (GET_by_offset
-                                      (disp, _gloffset_VertexPointerEXT));
-}
-
-static inline void
-SET_VertexPointerEXT(struct _glapi_table *disp,
-                     void (GLAPIENTRYP fn) (GLint, GLenum, GLsizei, GLsizei,
-                                            const GLvoid *))
-{
-    SET_by_offset(disp, _gloffset_VertexPointerEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_PointParameterfEXT) (GLenum, GLfloat);
-
-#define CALL_PointParameterfEXT(disp, parameters) \
-    (* GET_PointParameterfEXT(disp)) parameters
-static inline _glptr_PointParameterfEXT
-GET_PointParameterfEXT(struct _glapi_table *disp)
-{
-    return (_glptr_PointParameterfEXT) (GET_by_offset
-                                        (disp, _gloffset_PointParameterfEXT));
-}
-
-static inline void
-SET_PointParameterfEXT(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLenum, GLfloat))
-{
-    SET_by_offset(disp, _gloffset_PointParameterfEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_PointParameterfvEXT) (GLenum, const GLfloat *);
-
-#define CALL_PointParameterfvEXT(disp, parameters) \
-    (* GET_PointParameterfvEXT(disp)) parameters
-static inline _glptr_PointParameterfvEXT
-GET_PointParameterfvEXT(struct _glapi_table *disp)
-{
-    return (_glptr_PointParameterfvEXT) (GET_by_offset
-                                         (disp, _gloffset_PointParameterfvEXT));
-}
-
-static inline void
-SET_PointParameterfvEXT(struct _glapi_table *disp,
-                        void (GLAPIENTRYP fn) (GLenum, const GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_PointParameterfvEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_LockArraysEXT) (GLint, GLsizei);
-
-#define CALL_LockArraysEXT(disp, parameters) \
-    (* GET_LockArraysEXT(disp)) parameters
-static inline _glptr_LockArraysEXT
-GET_LockArraysEXT(struct _glapi_table *disp)
-{
-    return (_glptr_LockArraysEXT) (GET_by_offset
-                                   (disp, _gloffset_LockArraysEXT));
-}
-
-static inline void
-SET_LockArraysEXT(struct _glapi_table *disp,
-                  void (GLAPIENTRYP fn) (GLint, GLsizei))
-{
-    SET_by_offset(disp, _gloffset_LockArraysEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_UnlockArraysEXT) (void);
-
-#define CALL_UnlockArraysEXT(disp, parameters) \
-    (* GET_UnlockArraysEXT(disp)) parameters
-static inline _glptr_UnlockArraysEXT
-GET_UnlockArraysEXT(struct _glapi_table *disp)
-{
-    return (_glptr_UnlockArraysEXT) (GET_by_offset
-                                     (disp, _gloffset_UnlockArraysEXT));
-}
-
-static inline void
-SET_UnlockArraysEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn) (void))
-{
-    SET_by_offset(disp, _gloffset_UnlockArraysEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_SecondaryColor3bEXT) (GLbyte, GLbyte, GLbyte);
-
-#define CALL_SecondaryColor3bEXT(disp, parameters) \
-    (* GET_SecondaryColor3bEXT(disp)) parameters
-static inline _glptr_SecondaryColor3bEXT
-GET_SecondaryColor3bEXT(struct _glapi_table *disp)
-{
-    return (_glptr_SecondaryColor3bEXT) (GET_by_offset
-                                         (disp, _gloffset_SecondaryColor3bEXT));
-}
-
-static inline void
-SET_SecondaryColor3bEXT(struct _glapi_table *disp,
-                        void (GLAPIENTRYP fn) (GLbyte, GLbyte, GLbyte))
-{
-    SET_by_offset(disp, _gloffset_SecondaryColor3bEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_SecondaryColor3bvEXT) (const GLbyte *);
-
-#define CALL_SecondaryColor3bvEXT(disp, parameters) \
-    (* GET_SecondaryColor3bvEXT(disp)) parameters
-static inline _glptr_SecondaryColor3bvEXT
-GET_SecondaryColor3bvEXT(struct _glapi_table *disp)
-{
-    return (_glptr_SecondaryColor3bvEXT) (GET_by_offset
-                                          (disp,
-                                           _gloffset_SecondaryColor3bvEXT));
-}
-
-static inline void
-SET_SecondaryColor3bvEXT(struct _glapi_table *disp,
-                         void (GLAPIENTRYP fn) (const GLbyte *))
-{
-    SET_by_offset(disp, _gloffset_SecondaryColor3bvEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_SecondaryColor3dEXT) (GLdouble, GLdouble,
-                                                       GLdouble);
-#define CALL_SecondaryColor3dEXT(disp, parameters) \
-    (* GET_SecondaryColor3dEXT(disp)) parameters
-static inline _glptr_SecondaryColor3dEXT
-GET_SecondaryColor3dEXT(struct _glapi_table *disp)
-{
-    return (_glptr_SecondaryColor3dEXT) (GET_by_offset
-                                         (disp, _gloffset_SecondaryColor3dEXT));
-}
-
-static inline void
-SET_SecondaryColor3dEXT(struct _glapi_table *disp,
-                        void (GLAPIENTRYP fn) (GLdouble, GLdouble, GLdouble))
-{
-    SET_by_offset(disp, _gloffset_SecondaryColor3dEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_SecondaryColor3dvEXT) (const GLdouble *);
-
-#define CALL_SecondaryColor3dvEXT(disp, parameters) \
-    (* GET_SecondaryColor3dvEXT(disp)) parameters
-static inline _glptr_SecondaryColor3dvEXT
-GET_SecondaryColor3dvEXT(struct _glapi_table *disp)
-{
-    return (_glptr_SecondaryColor3dvEXT) (GET_by_offset
-                                          (disp,
-                                           _gloffset_SecondaryColor3dvEXT));
-}
-
-static inline void
-SET_SecondaryColor3dvEXT(struct _glapi_table *disp,
-                         void (GLAPIENTRYP fn) (const GLdouble *))
-{
-    SET_by_offset(disp, _gloffset_SecondaryColor3dvEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_SecondaryColor3fEXT) (GLfloat, GLfloat,
-                                                       GLfloat);
-#define CALL_SecondaryColor3fEXT(disp, parameters) \
-    (* GET_SecondaryColor3fEXT(disp)) parameters
-static inline _glptr_SecondaryColor3fEXT
-GET_SecondaryColor3fEXT(struct _glapi_table *disp)
-{
-    return (_glptr_SecondaryColor3fEXT) (GET_by_offset
-                                         (disp, _gloffset_SecondaryColor3fEXT));
-}
-
-static inline void
-SET_SecondaryColor3fEXT(struct _glapi_table *disp,
-                        void (GLAPIENTRYP fn) (GLfloat, GLfloat, GLfloat))
-{
-    SET_by_offset(disp, _gloffset_SecondaryColor3fEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_SecondaryColor3fvEXT) (const GLfloat *);
-
-#define CALL_SecondaryColor3fvEXT(disp, parameters) \
-    (* GET_SecondaryColor3fvEXT(disp)) parameters
-static inline _glptr_SecondaryColor3fvEXT
-GET_SecondaryColor3fvEXT(struct _glapi_table *disp)
-{
-    return (_glptr_SecondaryColor3fvEXT) (GET_by_offset
-                                          (disp,
-                                           _gloffset_SecondaryColor3fvEXT));
-}
-
-static inline void
-SET_SecondaryColor3fvEXT(struct _glapi_table *disp,
-                         void (GLAPIENTRYP fn) (const GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_SecondaryColor3fvEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_SecondaryColor3iEXT) (GLint, GLint, GLint);
-
-#define CALL_SecondaryColor3iEXT(disp, parameters) \
-    (* GET_SecondaryColor3iEXT(disp)) parameters
-static inline _glptr_SecondaryColor3iEXT
-GET_SecondaryColor3iEXT(struct _glapi_table *disp)
-{
-    return (_glptr_SecondaryColor3iEXT) (GET_by_offset
-                                         (disp, _gloffset_SecondaryColor3iEXT));
-}
-
-static inline void
-SET_SecondaryColor3iEXT(struct _glapi_table *disp,
-                        void (GLAPIENTRYP fn) (GLint, GLint, GLint))
-{
-    SET_by_offset(disp, _gloffset_SecondaryColor3iEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_SecondaryColor3ivEXT) (const GLint *);
-
-#define CALL_SecondaryColor3ivEXT(disp, parameters) \
-    (* GET_SecondaryColor3ivEXT(disp)) parameters
-static inline _glptr_SecondaryColor3ivEXT
-GET_SecondaryColor3ivEXT(struct _glapi_table *disp)
-{
-    return (_glptr_SecondaryColor3ivEXT) (GET_by_offset
-                                          (disp,
-                                           _gloffset_SecondaryColor3ivEXT));
-}
-
-static inline void
-SET_SecondaryColor3ivEXT(struct _glapi_table *disp,
-                         void (GLAPIENTRYP fn) (const GLint *))
-{
-    SET_by_offset(disp, _gloffset_SecondaryColor3ivEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_SecondaryColor3sEXT) (GLshort, GLshort,
-                                                       GLshort);
-#define CALL_SecondaryColor3sEXT(disp, parameters) \
-    (* GET_SecondaryColor3sEXT(disp)) parameters
-static inline _glptr_SecondaryColor3sEXT
-GET_SecondaryColor3sEXT(struct _glapi_table *disp)
-{
-    return (_glptr_SecondaryColor3sEXT) (GET_by_offset
-                                         (disp, _gloffset_SecondaryColor3sEXT));
-}
-
-static inline void
-SET_SecondaryColor3sEXT(struct _glapi_table *disp,
-                        void (GLAPIENTRYP fn) (GLshort, GLshort, GLshort))
-{
-    SET_by_offset(disp, _gloffset_SecondaryColor3sEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_SecondaryColor3svEXT) (const GLshort *);
-
-#define CALL_SecondaryColor3svEXT(disp, parameters) \
-    (* GET_SecondaryColor3svEXT(disp)) parameters
-static inline _glptr_SecondaryColor3svEXT
-GET_SecondaryColor3svEXT(struct _glapi_table *disp)
-{
-    return (_glptr_SecondaryColor3svEXT) (GET_by_offset
-                                          (disp,
-                                           _gloffset_SecondaryColor3svEXT));
-}
-
-static inline void
-SET_SecondaryColor3svEXT(struct _glapi_table *disp,
-                         void (GLAPIENTRYP fn) (const GLshort *))
-{
-    SET_by_offset(disp, _gloffset_SecondaryColor3svEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_SecondaryColor3ubEXT) (GLubyte, GLubyte,
-                                                        GLubyte);
-#define CALL_SecondaryColor3ubEXT(disp, parameters) \
-    (* GET_SecondaryColor3ubEXT(disp)) parameters
-static inline _glptr_SecondaryColor3ubEXT
-GET_SecondaryColor3ubEXT(struct _glapi_table *disp)
-{
-    return (_glptr_SecondaryColor3ubEXT) (GET_by_offset
-                                          (disp,
-                                           _gloffset_SecondaryColor3ubEXT));
-}
-
-static inline void
-SET_SecondaryColor3ubEXT(struct _glapi_table *disp,
-                         void (GLAPIENTRYP fn) (GLubyte, GLubyte, GLubyte))
-{
-    SET_by_offset(disp, _gloffset_SecondaryColor3ubEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_SecondaryColor3ubvEXT) (const GLubyte *);
-
-#define CALL_SecondaryColor3ubvEXT(disp, parameters) \
-    (* GET_SecondaryColor3ubvEXT(disp)) parameters
-static inline _glptr_SecondaryColor3ubvEXT
-GET_SecondaryColor3ubvEXT(struct _glapi_table *disp)
-{
-    return (_glptr_SecondaryColor3ubvEXT) (GET_by_offset
-                                           (disp,
-                                            _gloffset_SecondaryColor3ubvEXT));
-}
-
-static inline void
-SET_SecondaryColor3ubvEXT(struct _glapi_table *disp,
-                          void (GLAPIENTRYP fn) (const GLubyte *))
-{
-    SET_by_offset(disp, _gloffset_SecondaryColor3ubvEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_SecondaryColor3uiEXT) (GLuint, GLuint, GLuint);
-
-#define CALL_SecondaryColor3uiEXT(disp, parameters) \
-    (* GET_SecondaryColor3uiEXT(disp)) parameters
-static inline _glptr_SecondaryColor3uiEXT
-GET_SecondaryColor3uiEXT(struct _glapi_table *disp)
-{
-    return (_glptr_SecondaryColor3uiEXT) (GET_by_offset
-                                          (disp,
-                                           _gloffset_SecondaryColor3uiEXT));
-}
-
-static inline void
-SET_SecondaryColor3uiEXT(struct _glapi_table *disp,
-                         void (GLAPIENTRYP fn) (GLuint, GLuint, GLuint))
-{
-    SET_by_offset(disp, _gloffset_SecondaryColor3uiEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_SecondaryColor3uivEXT) (const GLuint *);
-
-#define CALL_SecondaryColor3uivEXT(disp, parameters) \
-    (* GET_SecondaryColor3uivEXT(disp)) parameters
-static inline _glptr_SecondaryColor3uivEXT
-GET_SecondaryColor3uivEXT(struct _glapi_table *disp)
-{
-    return (_glptr_SecondaryColor3uivEXT) (GET_by_offset
-                                           (disp,
-                                            _gloffset_SecondaryColor3uivEXT));
-}
-
-static inline void
-SET_SecondaryColor3uivEXT(struct _glapi_table *disp,
-                          void (GLAPIENTRYP fn) (const GLuint *))
-{
-    SET_by_offset(disp, _gloffset_SecondaryColor3uivEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_SecondaryColor3usEXT) (GLushort, GLushort,
-                                                        GLushort);
-#define CALL_SecondaryColor3usEXT(disp, parameters) \
-    (* GET_SecondaryColor3usEXT(disp)) parameters
-static inline _glptr_SecondaryColor3usEXT
-GET_SecondaryColor3usEXT(struct _glapi_table *disp)
-{
-    return (_glptr_SecondaryColor3usEXT) (GET_by_offset
-                                          (disp,
-                                           _gloffset_SecondaryColor3usEXT));
-}
-
-static inline void
-SET_SecondaryColor3usEXT(struct _glapi_table *disp,
-                         void (GLAPIENTRYP fn) (GLushort, GLushort, GLushort))
-{
-    SET_by_offset(disp, _gloffset_SecondaryColor3usEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_SecondaryColor3usvEXT) (const GLushort *);
-
-#define CALL_SecondaryColor3usvEXT(disp, parameters) \
-    (* GET_SecondaryColor3usvEXT(disp)) parameters
-static inline _glptr_SecondaryColor3usvEXT
-GET_SecondaryColor3usvEXT(struct _glapi_table *disp)
-{
-    return (_glptr_SecondaryColor3usvEXT) (GET_by_offset
-                                           (disp,
-                                            _gloffset_SecondaryColor3usvEXT));
-}
-
-static inline void
-SET_SecondaryColor3usvEXT(struct _glapi_table *disp,
-                          void (GLAPIENTRYP fn) (const GLushort *))
-{
-    SET_by_offset(disp, _gloffset_SecondaryColor3usvEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_SecondaryColorPointerEXT) (GLint, GLenum,
-                                                            GLsizei,
-                                                            const GLvoid *);
-#define CALL_SecondaryColorPointerEXT(disp, parameters) \
-    (* GET_SecondaryColorPointerEXT(disp)) parameters
-static inline _glptr_SecondaryColorPointerEXT
-GET_SecondaryColorPointerEXT(struct _glapi_table *disp)
-{
-    return (_glptr_SecondaryColorPointerEXT) (GET_by_offset
-                                              (disp,
-                                               _gloffset_SecondaryColorPointerEXT));
-}
-
-static inline void
-SET_SecondaryColorPointerEXT(struct _glapi_table *disp,
-                             void (GLAPIENTRYP fn) (GLint, GLenum, GLsizei,
-                                                    const GLvoid *))
-{
-    SET_by_offset(disp, _gloffset_SecondaryColorPointerEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiDrawArraysEXT) (GLenum, const GLint *,
-                                                      const GLsizei *, GLsizei);
-#define CALL_MultiDrawArraysEXT(disp, parameters) \
-    (* GET_MultiDrawArraysEXT(disp)) parameters
-static inline _glptr_MultiDrawArraysEXT
-GET_MultiDrawArraysEXT(struct _glapi_table *disp)
-{
-    return (_glptr_MultiDrawArraysEXT) (GET_by_offset
-                                        (disp, _gloffset_MultiDrawArraysEXT));
-}
-
-static inline void
-SET_MultiDrawArraysEXT(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLenum, const GLint *,
-                                              const GLsizei *, GLsizei))
-{
-    SET_by_offset(disp, _gloffset_MultiDrawArraysEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiDrawElementsEXT) (GLenum, const GLsizei *,
-                                                        GLenum, const GLvoid **,
-                                                        GLsizei);
-#define CALL_MultiDrawElementsEXT(disp, parameters) \
-    (* GET_MultiDrawElementsEXT(disp)) parameters
-static inline _glptr_MultiDrawElementsEXT
-GET_MultiDrawElementsEXT(struct _glapi_table *disp)
-{
-    return (_glptr_MultiDrawElementsEXT) (GET_by_offset
-                                          (disp,
-                                           _gloffset_MultiDrawElementsEXT));
-}
-
-static inline void
-SET_MultiDrawElementsEXT(struct _glapi_table *disp,
-                         void (GLAPIENTRYP fn) (GLenum, const GLsizei *, GLenum,
-                                                const GLvoid **, GLsizei))
-{
-    SET_by_offset(disp, _gloffset_MultiDrawElementsEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_FogCoordPointerEXT) (GLenum, GLsizei,
-                                                      const GLvoid *);
-#define CALL_FogCoordPointerEXT(disp, parameters) \
-    (* GET_FogCoordPointerEXT(disp)) parameters
-static inline _glptr_FogCoordPointerEXT
-GET_FogCoordPointerEXT(struct _glapi_table *disp)
-{
-    return (_glptr_FogCoordPointerEXT) (GET_by_offset
-                                        (disp, _gloffset_FogCoordPointerEXT));
-}
-
-static inline void
-SET_FogCoordPointerEXT(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLenum, GLsizei, const GLvoid *))
-{
-    SET_by_offset(disp, _gloffset_FogCoordPointerEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_FogCoorddEXT) (GLdouble);
-
-#define CALL_FogCoorddEXT(disp, parameters) \
-    (* GET_FogCoorddEXT(disp)) parameters
-static inline _glptr_FogCoorddEXT
-GET_FogCoorddEXT(struct _glapi_table *disp)
-{
-    return (_glptr_FogCoorddEXT) (GET_by_offset(disp, _gloffset_FogCoorddEXT));
-}
-
-static inline void
-SET_FogCoorddEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn) (GLdouble))
-{
-    SET_by_offset(disp, _gloffset_FogCoorddEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_FogCoorddvEXT) (const GLdouble *);
-
-#define CALL_FogCoorddvEXT(disp, parameters) \
-    (* GET_FogCoorddvEXT(disp)) parameters
-static inline _glptr_FogCoorddvEXT
-GET_FogCoorddvEXT(struct _glapi_table *disp)
-{
-    return (_glptr_FogCoorddvEXT) (GET_by_offset
-                                   (disp, _gloffset_FogCoorddvEXT));
-}
-
-static inline void
-SET_FogCoorddvEXT(struct _glapi_table *disp,
-                  void (GLAPIENTRYP fn) (const GLdouble *))
-{
-    SET_by_offset(disp, _gloffset_FogCoorddvEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_FogCoordfEXT) (GLfloat);
-
-#define CALL_FogCoordfEXT(disp, parameters) \
-    (* GET_FogCoordfEXT(disp)) parameters
-static inline _glptr_FogCoordfEXT
-GET_FogCoordfEXT(struct _glapi_table *disp)
-{
-    return (_glptr_FogCoordfEXT) (GET_by_offset(disp, _gloffset_FogCoordfEXT));
-}
-
-static inline void
-SET_FogCoordfEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn) (GLfloat))
-{
-    SET_by_offset(disp, _gloffset_FogCoordfEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_FogCoordfvEXT) (const GLfloat *);
-
-#define CALL_FogCoordfvEXT(disp, parameters) \
-    (* GET_FogCoordfvEXT(disp)) parameters
-static inline _glptr_FogCoordfvEXT
-GET_FogCoordfvEXT(struct _glapi_table *disp)
-{
-    return (_glptr_FogCoordfvEXT) (GET_by_offset
-                                   (disp, _gloffset_FogCoordfvEXT));
-}
-
-static inline void
-SET_FogCoordfvEXT(struct _glapi_table *disp,
-                  void (GLAPIENTRYP fn) (const GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_FogCoordfvEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_PixelTexGenSGIX) (GLenum);
-
-#define CALL_PixelTexGenSGIX(disp, parameters) \
-    (* GET_PixelTexGenSGIX(disp)) parameters
-static inline _glptr_PixelTexGenSGIX
-GET_PixelTexGenSGIX(struct _glapi_table *disp)
-{
-    return (_glptr_PixelTexGenSGIX) (GET_by_offset
-                                     (disp, _gloffset_PixelTexGenSGIX));
-}
-
-static inline void
-SET_PixelTexGenSGIX(struct _glapi_table *disp, void (GLAPIENTRYP fn) (GLenum))
-{
-    SET_by_offset(disp, _gloffset_PixelTexGenSGIX, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_BlendFuncSeparateEXT) (GLenum, GLenum, GLenum,
-                                                        GLenum);
-#define CALL_BlendFuncSeparateEXT(disp, parameters) \
-    (* GET_BlendFuncSeparateEXT(disp)) parameters
-static inline _glptr_BlendFuncSeparateEXT
-GET_BlendFuncSeparateEXT(struct _glapi_table *disp)
-{
-    return (_glptr_BlendFuncSeparateEXT) (GET_by_offset
-                                          (disp,
-                                           _gloffset_BlendFuncSeparateEXT));
-}
-
-static inline void
-SET_BlendFuncSeparateEXT(struct _glapi_table *disp,
-                         void (GLAPIENTRYP fn) (GLenum, GLenum, GLenum, GLenum))
-{
-    SET_by_offset(disp, _gloffset_BlendFuncSeparateEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_FlushVertexArrayRangeNV) (void);
-
-#define CALL_FlushVertexArrayRangeNV(disp, parameters) \
-    (* GET_FlushVertexArrayRangeNV(disp)) parameters
-static inline _glptr_FlushVertexArrayRangeNV
-GET_FlushVertexArrayRangeNV(struct _glapi_table *disp)
-{
-    return (_glptr_FlushVertexArrayRangeNV) (GET_by_offset
-                                             (disp,
-                                              _gloffset_FlushVertexArrayRangeNV));
-}
-
-static inline void
-SET_FlushVertexArrayRangeNV(struct _glapi_table *disp,
-                            void (GLAPIENTRYP fn) (void))
-{
-    SET_by_offset(disp, _gloffset_FlushVertexArrayRangeNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexArrayRangeNV) (GLsizei, const GLvoid *);
-
-#define CALL_VertexArrayRangeNV(disp, parameters) \
-    (* GET_VertexArrayRangeNV(disp)) parameters
-static inline _glptr_VertexArrayRangeNV
-GET_VertexArrayRangeNV(struct _glapi_table *disp)
-{
-    return (_glptr_VertexArrayRangeNV) (GET_by_offset
-                                        (disp, _gloffset_VertexArrayRangeNV));
-}
-
-static inline void
-SET_VertexArrayRangeNV(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLsizei, const GLvoid *))
-{
-    SET_by_offset(disp, _gloffset_VertexArrayRangeNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_CombinerInputNV) (GLenum, GLenum, GLenum,
-                                                   GLenum, GLenum, GLenum);
-#define CALL_CombinerInputNV(disp, parameters) \
-    (* GET_CombinerInputNV(disp)) parameters
-static inline _glptr_CombinerInputNV
-GET_CombinerInputNV(struct _glapi_table *disp)
-{
-    return (_glptr_CombinerInputNV) (GET_by_offset
-                                     (disp, _gloffset_CombinerInputNV));
-}
-
-static inline void
-SET_CombinerInputNV(struct _glapi_table *disp,
-                    void (GLAPIENTRYP fn) (GLenum, GLenum, GLenum, GLenum,
-                                           GLenum, GLenum))
-{
-    SET_by_offset(disp, _gloffset_CombinerInputNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_CombinerOutputNV) (GLenum, GLenum, GLenum,
-                                                    GLenum, GLenum, GLenum,
-                                                    GLenum, GLboolean,
-                                                    GLboolean, GLboolean);
-#define CALL_CombinerOutputNV(disp, parameters) \
-    (* GET_CombinerOutputNV(disp)) parameters
-static inline _glptr_CombinerOutputNV
-GET_CombinerOutputNV(struct _glapi_table *disp)
-{
-    return (_glptr_CombinerOutputNV) (GET_by_offset
-                                      (disp, _gloffset_CombinerOutputNV));
-}
-
-static inline void
-SET_CombinerOutputNV(struct _glapi_table *disp,
-                     void (GLAPIENTRYP fn) (GLenum, GLenum, GLenum, GLenum,
-                                            GLenum, GLenum, GLenum, GLboolean,
-                                            GLboolean, GLboolean))
-{
-    SET_by_offset(disp, _gloffset_CombinerOutputNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_CombinerParameterfNV) (GLenum, GLfloat);
-
-#define CALL_CombinerParameterfNV(disp, parameters) \
-    (* GET_CombinerParameterfNV(disp)) parameters
-static inline _glptr_CombinerParameterfNV
-GET_CombinerParameterfNV(struct _glapi_table *disp)
-{
-    return (_glptr_CombinerParameterfNV) (GET_by_offset
-                                          (disp,
-                                           _gloffset_CombinerParameterfNV));
-}
-
-static inline void
-SET_CombinerParameterfNV(struct _glapi_table *disp,
-                         void (GLAPIENTRYP fn) (GLenum, GLfloat))
-{
-    SET_by_offset(disp, _gloffset_CombinerParameterfNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_CombinerParameterfvNV) (GLenum,
-                                                         const GLfloat *);
-#define CALL_CombinerParameterfvNV(disp, parameters) \
-    (* GET_CombinerParameterfvNV(disp)) parameters
-static inline _glptr_CombinerParameterfvNV
-GET_CombinerParameterfvNV(struct _glapi_table *disp)
-{
-    return (_glptr_CombinerParameterfvNV) (GET_by_offset
-                                           (disp,
-                                            _gloffset_CombinerParameterfvNV));
-}
-
-static inline void
-SET_CombinerParameterfvNV(struct _glapi_table *disp,
-                          void (GLAPIENTRYP fn) (GLenum, const GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_CombinerParameterfvNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_CombinerParameteriNV) (GLenum, GLint);
-
-#define CALL_CombinerParameteriNV(disp, parameters) \
-    (* GET_CombinerParameteriNV(disp)) parameters
-static inline _glptr_CombinerParameteriNV
-GET_CombinerParameteriNV(struct _glapi_table *disp)
-{
-    return (_glptr_CombinerParameteriNV) (GET_by_offset
-                                          (disp,
-                                           _gloffset_CombinerParameteriNV));
-}
-
-static inline void
-SET_CombinerParameteriNV(struct _glapi_table *disp,
-                         void (GLAPIENTRYP fn) (GLenum, GLint))
-{
-    SET_by_offset(disp, _gloffset_CombinerParameteriNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_CombinerParameterivNV) (GLenum, const GLint *);
-
-#define CALL_CombinerParameterivNV(disp, parameters) \
-    (* GET_CombinerParameterivNV(disp)) parameters
-static inline _glptr_CombinerParameterivNV
-GET_CombinerParameterivNV(struct _glapi_table *disp)
-{
-    return (_glptr_CombinerParameterivNV) (GET_by_offset
-                                           (disp,
-                                            _gloffset_CombinerParameterivNV));
-}
-
-static inline void
-SET_CombinerParameterivNV(struct _glapi_table *disp,
-                          void (GLAPIENTRYP fn) (GLenum, const GLint *))
-{
-    SET_by_offset(disp, _gloffset_CombinerParameterivNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_FinalCombinerInputNV) (GLenum, GLenum, GLenum,
-                                                        GLenum);
-#define CALL_FinalCombinerInputNV(disp, parameters) \
-    (* GET_FinalCombinerInputNV(disp)) parameters
-static inline _glptr_FinalCombinerInputNV
-GET_FinalCombinerInputNV(struct _glapi_table *disp)
-{
-    return (_glptr_FinalCombinerInputNV) (GET_by_offset
-                                          (disp,
-                                           _gloffset_FinalCombinerInputNV));
-}
-
-static inline void
-SET_FinalCombinerInputNV(struct _glapi_table *disp,
-                         void (GLAPIENTRYP fn) (GLenum, GLenum, GLenum, GLenum))
-{
-    SET_by_offset(disp, _gloffset_FinalCombinerInputNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetCombinerInputParameterfvNV) (GLenum, GLenum,
-                                                                 GLenum, GLenum,
-                                                                 GLfloat *);
-#define CALL_GetCombinerInputParameterfvNV(disp, parameters) \
-    (* GET_GetCombinerInputParameterfvNV(disp)) parameters
-static inline _glptr_GetCombinerInputParameterfvNV
-GET_GetCombinerInputParameterfvNV(struct _glapi_table *disp)
-{
-    return (_glptr_GetCombinerInputParameterfvNV) (GET_by_offset
-                                                   (disp,
-                                                    _gloffset_GetCombinerInputParameterfvNV));
-}
-
-static inline void
-SET_GetCombinerInputParameterfvNV(struct _glapi_table *disp,
-                                  void (GLAPIENTRYP fn) (GLenum, GLenum, GLenum,
-                                                         GLenum, GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_GetCombinerInputParameterfvNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetCombinerInputParameterivNV) (GLenum, GLenum,
-                                                                 GLenum, GLenum,
-                                                                 GLint *);
-#define CALL_GetCombinerInputParameterivNV(disp, parameters) \
-    (* GET_GetCombinerInputParameterivNV(disp)) parameters
-static inline _glptr_GetCombinerInputParameterivNV
-GET_GetCombinerInputParameterivNV(struct _glapi_table *disp)
-{
-    return (_glptr_GetCombinerInputParameterivNV) (GET_by_offset
-                                                   (disp,
-                                                    _gloffset_GetCombinerInputParameterivNV));
-}
-
-static inline void
-SET_GetCombinerInputParameterivNV(struct _glapi_table *disp,
-                                  void (GLAPIENTRYP fn) (GLenum, GLenum, GLenum,
-                                                         GLenum, GLint *))
-{
-    SET_by_offset(disp, _gloffset_GetCombinerInputParameterivNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetCombinerOutputParameterfvNV) (GLenum,
-                                                                  GLenum,
-                                                                  GLenum,
-                                                                  GLfloat *);
-#define CALL_GetCombinerOutputParameterfvNV(disp, parameters) \
-    (* GET_GetCombinerOutputParameterfvNV(disp)) parameters
-static inline _glptr_GetCombinerOutputParameterfvNV
-GET_GetCombinerOutputParameterfvNV(struct _glapi_table *disp)
-{
-    return (_glptr_GetCombinerOutputParameterfvNV) (GET_by_offset
-                                                    (disp,
-                                                     _gloffset_GetCombinerOutputParameterfvNV));
-}
-
-static inline void
-SET_GetCombinerOutputParameterfvNV(struct _glapi_table *disp,
-                                   void (GLAPIENTRYP fn) (GLenum, GLenum,
-                                                          GLenum, GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_GetCombinerOutputParameterfvNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetCombinerOutputParameterivNV) (GLenum,
-                                                                  GLenum,
-                                                                  GLenum,
-                                                                  GLint *);
-#define CALL_GetCombinerOutputParameterivNV(disp, parameters) \
-    (* GET_GetCombinerOutputParameterivNV(disp)) parameters
-static inline _glptr_GetCombinerOutputParameterivNV
-GET_GetCombinerOutputParameterivNV(struct _glapi_table *disp)
-{
-    return (_glptr_GetCombinerOutputParameterivNV) (GET_by_offset
-                                                    (disp,
-                                                     _gloffset_GetCombinerOutputParameterivNV));
-}
-
-static inline void
-SET_GetCombinerOutputParameterivNV(struct _glapi_table *disp,
-                                   void (GLAPIENTRYP fn) (GLenum, GLenum,
-                                                          GLenum, GLint *))
-{
-    SET_by_offset(disp, _gloffset_GetCombinerOutputParameterivNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetFinalCombinerInputParameterfvNV) (GLenum,
-                                                                      GLenum,
-                                                                      GLfloat
-                                                                      *);
-#define CALL_GetFinalCombinerInputParameterfvNV(disp, parameters) \
-    (* GET_GetFinalCombinerInputParameterfvNV(disp)) parameters
-static inline _glptr_GetFinalCombinerInputParameterfvNV
-GET_GetFinalCombinerInputParameterfvNV(struct _glapi_table *disp)
-{
-    return (_glptr_GetFinalCombinerInputParameterfvNV) (GET_by_offset
-                                                        (disp,
-                                                         _gloffset_GetFinalCombinerInputParameterfvNV));
-}
-
-static inline void
-SET_GetFinalCombinerInputParameterfvNV(struct _glapi_table *disp,
-                                       void (GLAPIENTRYP fn) (GLenum, GLenum,
-                                                              GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_GetFinalCombinerInputParameterfvNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetFinalCombinerInputParameterivNV) (GLenum,
-                                                                      GLenum,
-                                                                      GLint *);
-#define CALL_GetFinalCombinerInputParameterivNV(disp, parameters) \
-    (* GET_GetFinalCombinerInputParameterivNV(disp)) parameters
-static inline _glptr_GetFinalCombinerInputParameterivNV
-GET_GetFinalCombinerInputParameterivNV(struct _glapi_table *disp)
-{
-    return (_glptr_GetFinalCombinerInputParameterivNV) (GET_by_offset
-                                                        (disp,
-                                                         _gloffset_GetFinalCombinerInputParameterivNV));
-}
-
-static inline void
-SET_GetFinalCombinerInputParameterivNV(struct _glapi_table *disp,
-                                       void (GLAPIENTRYP fn) (GLenum, GLenum,
-                                                              GLint *))
-{
-    SET_by_offset(disp, _gloffset_GetFinalCombinerInputParameterivNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ResizeBuffersMESA) (void);
-
-#define CALL_ResizeBuffersMESA(disp, parameters) \
-    (* GET_ResizeBuffersMESA(disp)) parameters
-static inline _glptr_ResizeBuffersMESA
-GET_ResizeBuffersMESA(struct _glapi_table *disp)
-{
-    return (_glptr_ResizeBuffersMESA) (GET_by_offset
-                                       (disp, _gloffset_ResizeBuffersMESA));
-}
-
-static inline void
-SET_ResizeBuffersMESA(struct _glapi_table *disp, void (GLAPIENTRYP fn) (void))
-{
-    SET_by_offset(disp, _gloffset_ResizeBuffersMESA, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_WindowPos2dMESA) (GLdouble, GLdouble);
-
-#define CALL_WindowPos2dMESA(disp, parameters) \
-    (* GET_WindowPos2dMESA(disp)) parameters
-static inline _glptr_WindowPos2dMESA
-GET_WindowPos2dMESA(struct _glapi_table *disp)
-{
-    return (_glptr_WindowPos2dMESA) (GET_by_offset
-                                     (disp, _gloffset_WindowPos2dMESA));
-}
-
-static inline void
-SET_WindowPos2dMESA(struct _glapi_table *disp,
-                    void (GLAPIENTRYP fn) (GLdouble, GLdouble))
-{
-    SET_by_offset(disp, _gloffset_WindowPos2dMESA, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_WindowPos2dvMESA) (const GLdouble *);
-
-#define CALL_WindowPos2dvMESA(disp, parameters) \
-    (* GET_WindowPos2dvMESA(disp)) parameters
-static inline _glptr_WindowPos2dvMESA
-GET_WindowPos2dvMESA(struct _glapi_table *disp)
-{
-    return (_glptr_WindowPos2dvMESA) (GET_by_offset
-                                      (disp, _gloffset_WindowPos2dvMESA));
-}
-
-static inline void
-SET_WindowPos2dvMESA(struct _glapi_table *disp,
-                     void (GLAPIENTRYP fn) (const GLdouble *))
-{
-    SET_by_offset(disp, _gloffset_WindowPos2dvMESA, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_WindowPos2fMESA) (GLfloat, GLfloat);
-
-#define CALL_WindowPos2fMESA(disp, parameters) \
-    (* GET_WindowPos2fMESA(disp)) parameters
-static inline _glptr_WindowPos2fMESA
-GET_WindowPos2fMESA(struct _glapi_table *disp)
-{
-    return (_glptr_WindowPos2fMESA) (GET_by_offset
-                                     (disp, _gloffset_WindowPos2fMESA));
-}
-
-static inline void
-SET_WindowPos2fMESA(struct _glapi_table *disp,
-                    void (GLAPIENTRYP fn) (GLfloat, GLfloat))
-{
-    SET_by_offset(disp, _gloffset_WindowPos2fMESA, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_WindowPos2fvMESA) (const GLfloat *);
-
-#define CALL_WindowPos2fvMESA(disp, parameters) \
-    (* GET_WindowPos2fvMESA(disp)) parameters
-static inline _glptr_WindowPos2fvMESA
-GET_WindowPos2fvMESA(struct _glapi_table *disp)
-{
-    return (_glptr_WindowPos2fvMESA) (GET_by_offset
-                                      (disp, _gloffset_WindowPos2fvMESA));
-}
-
-static inline void
-SET_WindowPos2fvMESA(struct _glapi_table *disp,
-                     void (GLAPIENTRYP fn) (const GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_WindowPos2fvMESA, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_WindowPos2iMESA) (GLint, GLint);
-
-#define CALL_WindowPos2iMESA(disp, parameters) \
-    (* GET_WindowPos2iMESA(disp)) parameters
-static inline _glptr_WindowPos2iMESA
-GET_WindowPos2iMESA(struct _glapi_table *disp)
-{
-    return (_glptr_WindowPos2iMESA) (GET_by_offset
-                                     (disp, _gloffset_WindowPos2iMESA));
-}
-
-static inline void
-SET_WindowPos2iMESA(struct _glapi_table *disp,
-                    void (GLAPIENTRYP fn) (GLint, GLint))
-{
-    SET_by_offset(disp, _gloffset_WindowPos2iMESA, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_WindowPos2ivMESA) (const GLint *);
-
-#define CALL_WindowPos2ivMESA(disp, parameters) \
-    (* GET_WindowPos2ivMESA(disp)) parameters
-static inline _glptr_WindowPos2ivMESA
-GET_WindowPos2ivMESA(struct _glapi_table *disp)
-{
-    return (_glptr_WindowPos2ivMESA) (GET_by_offset
-                                      (disp, _gloffset_WindowPos2ivMESA));
-}
-
-static inline void
-SET_WindowPos2ivMESA(struct _glapi_table *disp,
-                     void (GLAPIENTRYP fn) (const GLint *))
-{
-    SET_by_offset(disp, _gloffset_WindowPos2ivMESA, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_WindowPos2sMESA) (GLshort, GLshort);
-
-#define CALL_WindowPos2sMESA(disp, parameters) \
-    (* GET_WindowPos2sMESA(disp)) parameters
-static inline _glptr_WindowPos2sMESA
-GET_WindowPos2sMESA(struct _glapi_table *disp)
-{
-    return (_glptr_WindowPos2sMESA) (GET_by_offset
-                                     (disp, _gloffset_WindowPos2sMESA));
-}
-
-static inline void
-SET_WindowPos2sMESA(struct _glapi_table *disp,
-                    void (GLAPIENTRYP fn) (GLshort, GLshort))
-{
-    SET_by_offset(disp, _gloffset_WindowPos2sMESA, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_WindowPos2svMESA) (const GLshort *);
-
-#define CALL_WindowPos2svMESA(disp, parameters) \
-    (* GET_WindowPos2svMESA(disp)) parameters
-static inline _glptr_WindowPos2svMESA
-GET_WindowPos2svMESA(struct _glapi_table *disp)
-{
-    return (_glptr_WindowPos2svMESA) (GET_by_offset
-                                      (disp, _gloffset_WindowPos2svMESA));
-}
-
-static inline void
-SET_WindowPos2svMESA(struct _glapi_table *disp,
-                     void (GLAPIENTRYP fn) (const GLshort *))
-{
-    SET_by_offset(disp, _gloffset_WindowPos2svMESA, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_WindowPos3dMESA) (GLdouble, GLdouble,
-                                                   GLdouble);
-#define CALL_WindowPos3dMESA(disp, parameters) \
-    (* GET_WindowPos3dMESA(disp)) parameters
-static inline _glptr_WindowPos3dMESA
-GET_WindowPos3dMESA(struct _glapi_table *disp)
-{
-    return (_glptr_WindowPos3dMESA) (GET_by_offset
-                                     (disp, _gloffset_WindowPos3dMESA));
-}
-
-static inline void
-SET_WindowPos3dMESA(struct _glapi_table *disp,
-                    void (GLAPIENTRYP fn) (GLdouble, GLdouble, GLdouble))
-{
-    SET_by_offset(disp, _gloffset_WindowPos3dMESA, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_WindowPos3dvMESA) (const GLdouble *);
-
-#define CALL_WindowPos3dvMESA(disp, parameters) \
-    (* GET_WindowPos3dvMESA(disp)) parameters
-static inline _glptr_WindowPos3dvMESA
-GET_WindowPos3dvMESA(struct _glapi_table *disp)
-{
-    return (_glptr_WindowPos3dvMESA) (GET_by_offset
-                                      (disp, _gloffset_WindowPos3dvMESA));
-}
-
-static inline void
-SET_WindowPos3dvMESA(struct _glapi_table *disp,
-                     void (GLAPIENTRYP fn) (const GLdouble *))
-{
-    SET_by_offset(disp, _gloffset_WindowPos3dvMESA, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_WindowPos3fMESA) (GLfloat, GLfloat, GLfloat);
-
-#define CALL_WindowPos3fMESA(disp, parameters) \
-    (* GET_WindowPos3fMESA(disp)) parameters
-static inline _glptr_WindowPos3fMESA
-GET_WindowPos3fMESA(struct _glapi_table *disp)
-{
-    return (_glptr_WindowPos3fMESA) (GET_by_offset
-                                     (disp, _gloffset_WindowPos3fMESA));
-}
-
-static inline void
-SET_WindowPos3fMESA(struct _glapi_table *disp,
-                    void (GLAPIENTRYP fn) (GLfloat, GLfloat, GLfloat))
-{
-    SET_by_offset(disp, _gloffset_WindowPos3fMESA, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_WindowPos3fvMESA) (const GLfloat *);
-
-#define CALL_WindowPos3fvMESA(disp, parameters) \
-    (* GET_WindowPos3fvMESA(disp)) parameters
-static inline _glptr_WindowPos3fvMESA
-GET_WindowPos3fvMESA(struct _glapi_table *disp)
-{
-    return (_glptr_WindowPos3fvMESA) (GET_by_offset
-                                      (disp, _gloffset_WindowPos3fvMESA));
-}
-
-static inline void
-SET_WindowPos3fvMESA(struct _glapi_table *disp,
-                     void (GLAPIENTRYP fn) (const GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_WindowPos3fvMESA, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_WindowPos3iMESA) (GLint, GLint, GLint);
-
-#define CALL_WindowPos3iMESA(disp, parameters) \
-    (* GET_WindowPos3iMESA(disp)) parameters
-static inline _glptr_WindowPos3iMESA
-GET_WindowPos3iMESA(struct _glapi_table *disp)
-{
-    return (_glptr_WindowPos3iMESA) (GET_by_offset
-                                     (disp, _gloffset_WindowPos3iMESA));
-}
-
-static inline void
-SET_WindowPos3iMESA(struct _glapi_table *disp,
-                    void (GLAPIENTRYP fn) (GLint, GLint, GLint))
-{
-    SET_by_offset(disp, _gloffset_WindowPos3iMESA, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_WindowPos3ivMESA) (const GLint *);
-
-#define CALL_WindowPos3ivMESA(disp, parameters) \
-    (* GET_WindowPos3ivMESA(disp)) parameters
-static inline _glptr_WindowPos3ivMESA
-GET_WindowPos3ivMESA(struct _glapi_table *disp)
-{
-    return (_glptr_WindowPos3ivMESA) (GET_by_offset
-                                      (disp, _gloffset_WindowPos3ivMESA));
-}
-
-static inline void
-SET_WindowPos3ivMESA(struct _glapi_table *disp,
-                     void (GLAPIENTRYP fn) (const GLint *))
-{
-    SET_by_offset(disp, _gloffset_WindowPos3ivMESA, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_WindowPos3sMESA) (GLshort, GLshort, GLshort);
-
-#define CALL_WindowPos3sMESA(disp, parameters) \
-    (* GET_WindowPos3sMESA(disp)) parameters
-static inline _glptr_WindowPos3sMESA
-GET_WindowPos3sMESA(struct _glapi_table *disp)
-{
-    return (_glptr_WindowPos3sMESA) (GET_by_offset
-                                     (disp, _gloffset_WindowPos3sMESA));
-}
-
-static inline void
-SET_WindowPos3sMESA(struct _glapi_table *disp,
-                    void (GLAPIENTRYP fn) (GLshort, GLshort, GLshort))
-{
-    SET_by_offset(disp, _gloffset_WindowPos3sMESA, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_WindowPos3svMESA) (const GLshort *);
-
-#define CALL_WindowPos3svMESA(disp, parameters) \
-    (* GET_WindowPos3svMESA(disp)) parameters
-static inline _glptr_WindowPos3svMESA
-GET_WindowPos3svMESA(struct _glapi_table *disp)
-{
-    return (_glptr_WindowPos3svMESA) (GET_by_offset
-                                      (disp, _gloffset_WindowPos3svMESA));
-}
-
-static inline void
-SET_WindowPos3svMESA(struct _glapi_table *disp,
-                     void (GLAPIENTRYP fn) (const GLshort *))
-{
-    SET_by_offset(disp, _gloffset_WindowPos3svMESA, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_WindowPos4dMESA) (GLdouble, GLdouble, GLdouble,
-                                                   GLdouble);
-#define CALL_WindowPos4dMESA(disp, parameters) \
-    (* GET_WindowPos4dMESA(disp)) parameters
-static inline _glptr_WindowPos4dMESA
-GET_WindowPos4dMESA(struct _glapi_table *disp)
-{
-    return (_glptr_WindowPos4dMESA) (GET_by_offset
-                                     (disp, _gloffset_WindowPos4dMESA));
-}
-
-static inline void
-SET_WindowPos4dMESA(struct _glapi_table *disp,
-                    void (GLAPIENTRYP fn) (GLdouble, GLdouble, GLdouble,
-                                           GLdouble))
-{
-    SET_by_offset(disp, _gloffset_WindowPos4dMESA, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_WindowPos4dvMESA) (const GLdouble *);
-
-#define CALL_WindowPos4dvMESA(disp, parameters) \
-    (* GET_WindowPos4dvMESA(disp)) parameters
-static inline _glptr_WindowPos4dvMESA
-GET_WindowPos4dvMESA(struct _glapi_table *disp)
-{
-    return (_glptr_WindowPos4dvMESA) (GET_by_offset
-                                      (disp, _gloffset_WindowPos4dvMESA));
-}
-
-static inline void
-SET_WindowPos4dvMESA(struct _glapi_table *disp,
-                     void (GLAPIENTRYP fn) (const GLdouble *))
-{
-    SET_by_offset(disp, _gloffset_WindowPos4dvMESA, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_WindowPos4fMESA) (GLfloat, GLfloat, GLfloat,
-                                                   GLfloat);
-#define CALL_WindowPos4fMESA(disp, parameters) \
-    (* GET_WindowPos4fMESA(disp)) parameters
-static inline _glptr_WindowPos4fMESA
-GET_WindowPos4fMESA(struct _glapi_table *disp)
-{
-    return (_glptr_WindowPos4fMESA) (GET_by_offset
-                                     (disp, _gloffset_WindowPos4fMESA));
-}
-
-static inline void
-SET_WindowPos4fMESA(struct _glapi_table *disp,
-                    void (GLAPIENTRYP fn) (GLfloat, GLfloat, GLfloat, GLfloat))
-{
-    SET_by_offset(disp, _gloffset_WindowPos4fMESA, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_WindowPos4fvMESA) (const GLfloat *);
-
-#define CALL_WindowPos4fvMESA(disp, parameters) \
-    (* GET_WindowPos4fvMESA(disp)) parameters
-static inline _glptr_WindowPos4fvMESA
-GET_WindowPos4fvMESA(struct _glapi_table *disp)
-{
-    return (_glptr_WindowPos4fvMESA) (GET_by_offset
-                                      (disp, _gloffset_WindowPos4fvMESA));
-}
-
-static inline void
-SET_WindowPos4fvMESA(struct _glapi_table *disp,
-                     void (GLAPIENTRYP fn) (const GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_WindowPos4fvMESA, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_WindowPos4iMESA) (GLint, GLint, GLint, GLint);
-
-#define CALL_WindowPos4iMESA(disp, parameters) \
-    (* GET_WindowPos4iMESA(disp)) parameters
-static inline _glptr_WindowPos4iMESA
-GET_WindowPos4iMESA(struct _glapi_table *disp)
-{
-    return (_glptr_WindowPos4iMESA) (GET_by_offset
-                                     (disp, _gloffset_WindowPos4iMESA));
-}
-
-static inline void
-SET_WindowPos4iMESA(struct _glapi_table *disp,
-                    void (GLAPIENTRYP fn) (GLint, GLint, GLint, GLint))
-{
-    SET_by_offset(disp, _gloffset_WindowPos4iMESA, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_WindowPos4ivMESA) (const GLint *);
-
-#define CALL_WindowPos4ivMESA(disp, parameters) \
-    (* GET_WindowPos4ivMESA(disp)) parameters
-static inline _glptr_WindowPos4ivMESA
-GET_WindowPos4ivMESA(struct _glapi_table *disp)
-{
-    return (_glptr_WindowPos4ivMESA) (GET_by_offset
-                                      (disp, _gloffset_WindowPos4ivMESA));
-}
-
-static inline void
-SET_WindowPos4ivMESA(struct _glapi_table *disp,
-                     void (GLAPIENTRYP fn) (const GLint *))
-{
-    SET_by_offset(disp, _gloffset_WindowPos4ivMESA, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_WindowPos4sMESA) (GLshort, GLshort, GLshort,
-                                                   GLshort);
-#define CALL_WindowPos4sMESA(disp, parameters) \
-    (* GET_WindowPos4sMESA(disp)) parameters
-static inline _glptr_WindowPos4sMESA
-GET_WindowPos4sMESA(struct _glapi_table *disp)
-{
-    return (_glptr_WindowPos4sMESA) (GET_by_offset
-                                     (disp, _gloffset_WindowPos4sMESA));
-}
-
-static inline void
-SET_WindowPos4sMESA(struct _glapi_table *disp,
-                    void (GLAPIENTRYP fn) (GLshort, GLshort, GLshort, GLshort))
-{
-    SET_by_offset(disp, _gloffset_WindowPos4sMESA, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_WindowPos4svMESA) (const GLshort *);
-
-#define CALL_WindowPos4svMESA(disp, parameters) \
-    (* GET_WindowPos4svMESA(disp)) parameters
-static inline _glptr_WindowPos4svMESA
-GET_WindowPos4svMESA(struct _glapi_table *disp)
-{
-    return (_glptr_WindowPos4svMESA) (GET_by_offset
-                                      (disp, _gloffset_WindowPos4svMESA));
-}
-
-static inline void
-SET_WindowPos4svMESA(struct _glapi_table *disp,
-                     void (GLAPIENTRYP fn) (const GLshort *))
-{
-    SET_by_offset(disp, _gloffset_WindowPos4svMESA, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiModeDrawArraysIBM) (const GLenum *,
-                                                          const GLint *,
-                                                          const GLsizei *,
-                                                          GLsizei, GLint);
-#define CALL_MultiModeDrawArraysIBM(disp, parameters) \
-    (* GET_MultiModeDrawArraysIBM(disp)) parameters
-static inline _glptr_MultiModeDrawArraysIBM
-GET_MultiModeDrawArraysIBM(struct _glapi_table *disp)
-{
-    return (_glptr_MultiModeDrawArraysIBM) (GET_by_offset
-                                            (disp,
-                                             _gloffset_MultiModeDrawArraysIBM));
-}
-
-static inline void
-SET_MultiModeDrawArraysIBM(struct _glapi_table *disp,
-                           void (GLAPIENTRYP fn) (const GLenum *, const GLint *,
-                                                  const GLsizei *, GLsizei,
-                                                  GLint))
-{
-    SET_by_offset(disp, _gloffset_MultiModeDrawArraysIBM, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_MultiModeDrawElementsIBM) (const GLenum *,
-                                                            const GLsizei *,
-                                                            GLenum,
-                                                            const GLvoid *
-                                                            const *, GLsizei,
-                                                            GLint);
-#define CALL_MultiModeDrawElementsIBM(disp, parameters) \
-    (* GET_MultiModeDrawElementsIBM(disp)) parameters
-static inline _glptr_MultiModeDrawElementsIBM
-GET_MultiModeDrawElementsIBM(struct _glapi_table *disp)
-{
-    return (_glptr_MultiModeDrawElementsIBM) (GET_by_offset
-                                              (disp,
-                                               _gloffset_MultiModeDrawElementsIBM));
-}
-
-static inline void
-SET_MultiModeDrawElementsIBM(struct _glapi_table *disp,
-                             void (GLAPIENTRYP fn) (const GLenum *,
-                                                    const GLsizei *, GLenum,
-                                                    const GLvoid * const *,
-                                                    GLsizei, GLint))
-{
-    SET_by_offset(disp, _gloffset_MultiModeDrawElementsIBM, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_DeleteFencesNV) (GLsizei, const GLuint *);
-
-#define CALL_DeleteFencesNV(disp, parameters) \
-    (* GET_DeleteFencesNV(disp)) parameters
-static inline _glptr_DeleteFencesNV
-GET_DeleteFencesNV(struct _glapi_table *disp)
-{
-    return (_glptr_DeleteFencesNV) (GET_by_offset
-                                    (disp, _gloffset_DeleteFencesNV));
-}
-
-static inline void
-SET_DeleteFencesNV(struct _glapi_table *disp,
-                   void (GLAPIENTRYP fn) (GLsizei, const GLuint *))
-{
-    SET_by_offset(disp, _gloffset_DeleteFencesNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_FinishFenceNV) (GLuint);
-
-#define CALL_FinishFenceNV(disp, parameters) \
-    (* GET_FinishFenceNV(disp)) parameters
-static inline _glptr_FinishFenceNV
-GET_FinishFenceNV(struct _glapi_table *disp)
-{
-    return (_glptr_FinishFenceNV) (GET_by_offset
-                                   (disp, _gloffset_FinishFenceNV));
-}
-
-static inline void
-SET_FinishFenceNV(struct _glapi_table *disp, void (GLAPIENTRYP fn) (GLuint))
-{
-    SET_by_offset(disp, _gloffset_FinishFenceNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GenFencesNV) (GLsizei, GLuint *);
-
-#define CALL_GenFencesNV(disp, parameters) \
-    (* GET_GenFencesNV(disp)) parameters
-static inline _glptr_GenFencesNV
-GET_GenFencesNV(struct _glapi_table *disp)
-{
-    return (_glptr_GenFencesNV) (GET_by_offset(disp, _gloffset_GenFencesNV));
-}
-
-static inline void
-SET_GenFencesNV(struct _glapi_table *disp,
-                void (GLAPIENTRYP fn) (GLsizei, GLuint *))
-{
-    SET_by_offset(disp, _gloffset_GenFencesNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetFenceivNV) (GLuint, GLenum, GLint *);
-
-#define CALL_GetFenceivNV(disp, parameters) \
-    (* GET_GetFenceivNV(disp)) parameters
-static inline _glptr_GetFenceivNV
-GET_GetFenceivNV(struct _glapi_table *disp)
-{
-    return (_glptr_GetFenceivNV) (GET_by_offset(disp, _gloffset_GetFenceivNV));
-}
-
-static inline void
-SET_GetFenceivNV(struct _glapi_table *disp,
-                 void (GLAPIENTRYP fn) (GLuint, GLenum, GLint *))
-{
-    SET_by_offset(disp, _gloffset_GetFenceivNV, fn);
-}
-
-typedef GLboolean(GLAPIENTRYP _glptr_IsFenceNV) (GLuint);
-
-#define CALL_IsFenceNV(disp, parameters) \
-    (* GET_IsFenceNV(disp)) parameters
-static inline _glptr_IsFenceNV
-GET_IsFenceNV(struct _glapi_table *disp)
-{
-    return (_glptr_IsFenceNV) (GET_by_offset(disp, _gloffset_IsFenceNV));
-}
-
-static inline void
-SET_IsFenceNV(struct _glapi_table *disp, GLboolean(GLAPIENTRYP fn) (GLuint))
-{
-    SET_by_offset(disp, _gloffset_IsFenceNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_SetFenceNV) (GLuint, GLenum);
-
-#define CALL_SetFenceNV(disp, parameters) \
-    (* GET_SetFenceNV(disp)) parameters
-static inline _glptr_SetFenceNV
-GET_SetFenceNV(struct _glapi_table *disp)
-{
-    return (_glptr_SetFenceNV) (GET_by_offset(disp, _gloffset_SetFenceNV));
-}
-
-static inline void
-SET_SetFenceNV(struct _glapi_table *disp,
-               void (GLAPIENTRYP fn) (GLuint, GLenum))
-{
-    SET_by_offset(disp, _gloffset_SetFenceNV, fn);
-}
-
-typedef GLboolean(GLAPIENTRYP _glptr_TestFenceNV) (GLuint);
-
-#define CALL_TestFenceNV(disp, parameters) \
-    (* GET_TestFenceNV(disp)) parameters
-static inline _glptr_TestFenceNV
-GET_TestFenceNV(struct _glapi_table *disp)
-{
-    return (_glptr_TestFenceNV) (GET_by_offset(disp, _gloffset_TestFenceNV));
-}
-
-static inline void
-SET_TestFenceNV(struct _glapi_table *disp, GLboolean(GLAPIENTRYP fn) (GLuint))
-{
-    SET_by_offset(disp, _gloffset_TestFenceNV, fn);
-}
-
-typedef GLboolean(GLAPIENTRYP _glptr_AreProgramsResidentNV) (GLsizei,
-                                                             const GLuint *,
-                                                             GLboolean *);
-#define CALL_AreProgramsResidentNV(disp, parameters) \
-    (* GET_AreProgramsResidentNV(disp)) parameters
-static inline _glptr_AreProgramsResidentNV
-GET_AreProgramsResidentNV(struct _glapi_table *disp)
-{
-    return (_glptr_AreProgramsResidentNV) (GET_by_offset
-                                           (disp,
-                                            _gloffset_AreProgramsResidentNV));
-}
-
-static inline void
-SET_AreProgramsResidentNV(struct _glapi_table *disp,
-                          GLboolean(GLAPIENTRYP fn) (GLsizei, const GLuint *,
-                                                     GLboolean *))
-{
-    SET_by_offset(disp, _gloffset_AreProgramsResidentNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_BindProgramNV) (GLenum, GLuint);
-
-#define CALL_BindProgramNV(disp, parameters) \
-    (* GET_BindProgramNV(disp)) parameters
-static inline _glptr_BindProgramNV
-GET_BindProgramNV(struct _glapi_table *disp)
-{
-    return (_glptr_BindProgramNV) (GET_by_offset
-                                   (disp, _gloffset_BindProgramNV));
-}
-
-static inline void
-SET_BindProgramNV(struct _glapi_table *disp,
-                  void (GLAPIENTRYP fn) (GLenum, GLuint))
-{
-    SET_by_offset(disp, _gloffset_BindProgramNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_DeleteProgramsNV) (GLsizei, const GLuint *);
-
-#define CALL_DeleteProgramsNV(disp, parameters) \
-    (* GET_DeleteProgramsNV(disp)) parameters
-static inline _glptr_DeleteProgramsNV
-GET_DeleteProgramsNV(struct _glapi_table *disp)
-{
-    return (_glptr_DeleteProgramsNV) (GET_by_offset
-                                      (disp, _gloffset_DeleteProgramsNV));
-}
-
-static inline void
-SET_DeleteProgramsNV(struct _glapi_table *disp,
-                     void (GLAPIENTRYP fn) (GLsizei, const GLuint *))
-{
-    SET_by_offset(disp, _gloffset_DeleteProgramsNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ExecuteProgramNV) (GLenum, GLuint,
-                                                    const GLfloat *);
-#define CALL_ExecuteProgramNV(disp, parameters) \
-    (* GET_ExecuteProgramNV(disp)) parameters
-static inline _glptr_ExecuteProgramNV
-GET_ExecuteProgramNV(struct _glapi_table *disp)
-{
-    return (_glptr_ExecuteProgramNV) (GET_by_offset
-                                      (disp, _gloffset_ExecuteProgramNV));
-}
-
-static inline void
-SET_ExecuteProgramNV(struct _glapi_table *disp,
-                     void (GLAPIENTRYP fn) (GLenum, GLuint, const GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_ExecuteProgramNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GenProgramsNV) (GLsizei, GLuint *);
-
-#define CALL_GenProgramsNV(disp, parameters) \
-    (* GET_GenProgramsNV(disp)) parameters
-static inline _glptr_GenProgramsNV
-GET_GenProgramsNV(struct _glapi_table *disp)
-{
-    return (_glptr_GenProgramsNV) (GET_by_offset
-                                   (disp, _gloffset_GenProgramsNV));
-}
-
-static inline void
-SET_GenProgramsNV(struct _glapi_table *disp,
-                  void (GLAPIENTRYP fn) (GLsizei, GLuint *))
-{
-    SET_by_offset(disp, _gloffset_GenProgramsNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetProgramParameterdvNV) (GLenum, GLuint,
-                                                           GLenum, GLdouble *);
-#define CALL_GetProgramParameterdvNV(disp, parameters) \
-    (* GET_GetProgramParameterdvNV(disp)) parameters
-static inline _glptr_GetProgramParameterdvNV
-GET_GetProgramParameterdvNV(struct _glapi_table *disp)
-{
-    return (_glptr_GetProgramParameterdvNV) (GET_by_offset
-                                             (disp,
-                                              _gloffset_GetProgramParameterdvNV));
-}
-
-static inline void
-SET_GetProgramParameterdvNV(struct _glapi_table *disp,
-                            void (GLAPIENTRYP fn) (GLenum, GLuint, GLenum,
-                                                   GLdouble *))
-{
-    SET_by_offset(disp, _gloffset_GetProgramParameterdvNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetProgramParameterfvNV) (GLenum, GLuint,
-                                                           GLenum, GLfloat *);
-#define CALL_GetProgramParameterfvNV(disp, parameters) \
-    (* GET_GetProgramParameterfvNV(disp)) parameters
-static inline _glptr_GetProgramParameterfvNV
-GET_GetProgramParameterfvNV(struct _glapi_table *disp)
-{
-    return (_glptr_GetProgramParameterfvNV) (GET_by_offset
-                                             (disp,
-                                              _gloffset_GetProgramParameterfvNV));
-}
-
-static inline void
-SET_GetProgramParameterfvNV(struct _glapi_table *disp,
-                            void (GLAPIENTRYP fn) (GLenum, GLuint, GLenum,
-                                                   GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_GetProgramParameterfvNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetProgramStringNV) (GLuint, GLenum,
-                                                      GLubyte *);
-#define CALL_GetProgramStringNV(disp, parameters) \
-    (* GET_GetProgramStringNV(disp)) parameters
-static inline _glptr_GetProgramStringNV
-GET_GetProgramStringNV(struct _glapi_table *disp)
-{
-    return (_glptr_GetProgramStringNV) (GET_by_offset
-                                        (disp, _gloffset_GetProgramStringNV));
-}
-
-static inline void
-SET_GetProgramStringNV(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLuint, GLenum, GLubyte *))
-{
-    SET_by_offset(disp, _gloffset_GetProgramStringNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetProgramivNV) (GLuint, GLenum, GLint *);
-
-#define CALL_GetProgramivNV(disp, parameters) \
-    (* GET_GetProgramivNV(disp)) parameters
-static inline _glptr_GetProgramivNV
-GET_GetProgramivNV(struct _glapi_table *disp)
-{
-    return (_glptr_GetProgramivNV) (GET_by_offset
-                                    (disp, _gloffset_GetProgramivNV));
-}
-
-static inline void
-SET_GetProgramivNV(struct _glapi_table *disp,
-                   void (GLAPIENTRYP fn) (GLuint, GLenum, GLint *))
-{
-    SET_by_offset(disp, _gloffset_GetProgramivNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetTrackMatrixivNV) (GLenum, GLuint, GLenum,
-                                                      GLint *);
-#define CALL_GetTrackMatrixivNV(disp, parameters) \
-    (* GET_GetTrackMatrixivNV(disp)) parameters
-static inline _glptr_GetTrackMatrixivNV
-GET_GetTrackMatrixivNV(struct _glapi_table *disp)
-{
-    return (_glptr_GetTrackMatrixivNV) (GET_by_offset
-                                        (disp, _gloffset_GetTrackMatrixivNV));
-}
-
-static inline void
-SET_GetTrackMatrixivNV(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLenum, GLuint, GLenum, GLint *))
-{
-    SET_by_offset(disp, _gloffset_GetTrackMatrixivNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetVertexAttribPointervNV) (GLuint, GLenum,
-                                                             GLvoid **);
-#define CALL_GetVertexAttribPointervNV(disp, parameters) \
-    (* GET_GetVertexAttribPointervNV(disp)) parameters
-static inline _glptr_GetVertexAttribPointervNV
-GET_GetVertexAttribPointervNV(struct _glapi_table *disp)
-{
-    return (_glptr_GetVertexAttribPointervNV) (GET_by_offset
-                                               (disp,
-                                                _gloffset_GetVertexAttribPointervNV));
-}
-
-static inline void
-SET_GetVertexAttribPointervNV(struct _glapi_table *disp,
-                              void (GLAPIENTRYP fn) (GLuint, GLenum, GLvoid **))
-{
-    SET_by_offset(disp, _gloffset_GetVertexAttribPointervNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetVertexAttribdvNV) (GLuint, GLenum,
-                                                       GLdouble *);
-#define CALL_GetVertexAttribdvNV(disp, parameters) \
-    (* GET_GetVertexAttribdvNV(disp)) parameters
-static inline _glptr_GetVertexAttribdvNV
-GET_GetVertexAttribdvNV(struct _glapi_table *disp)
-{
-    return (_glptr_GetVertexAttribdvNV) (GET_by_offset
-                                         (disp, _gloffset_GetVertexAttribdvNV));
-}
-
-static inline void
-SET_GetVertexAttribdvNV(struct _glapi_table *disp,
-                        void (GLAPIENTRYP fn) (GLuint, GLenum, GLdouble *))
-{
-    SET_by_offset(disp, _gloffset_GetVertexAttribdvNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetVertexAttribfvNV) (GLuint, GLenum,
-                                                       GLfloat *);
-#define CALL_GetVertexAttribfvNV(disp, parameters) \
-    (* GET_GetVertexAttribfvNV(disp)) parameters
-static inline _glptr_GetVertexAttribfvNV
-GET_GetVertexAttribfvNV(struct _glapi_table *disp)
-{
-    return (_glptr_GetVertexAttribfvNV) (GET_by_offset
-                                         (disp, _gloffset_GetVertexAttribfvNV));
-}
-
-static inline void
-SET_GetVertexAttribfvNV(struct _glapi_table *disp,
-                        void (GLAPIENTRYP fn) (GLuint, GLenum, GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_GetVertexAttribfvNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetVertexAttribivNV) (GLuint, GLenum, GLint *);
-
-#define CALL_GetVertexAttribivNV(disp, parameters) \
-    (* GET_GetVertexAttribivNV(disp)) parameters
-static inline _glptr_GetVertexAttribivNV
-GET_GetVertexAttribivNV(struct _glapi_table *disp)
-{
-    return (_glptr_GetVertexAttribivNV) (GET_by_offset
-                                         (disp, _gloffset_GetVertexAttribivNV));
-}
-
-static inline void
-SET_GetVertexAttribivNV(struct _glapi_table *disp,
-                        void (GLAPIENTRYP fn) (GLuint, GLenum, GLint *))
-{
-    SET_by_offset(disp, _gloffset_GetVertexAttribivNV, fn);
-}
-
-typedef GLboolean(GLAPIENTRYP _glptr_IsProgramNV) (GLuint);
-
-#define CALL_IsProgramNV(disp, parameters) \
-    (* GET_IsProgramNV(disp)) parameters
-static inline _glptr_IsProgramNV
-GET_IsProgramNV(struct _glapi_table *disp)
-{
-    return (_glptr_IsProgramNV) (GET_by_offset(disp, _gloffset_IsProgramNV));
-}
-
-static inline void
-SET_IsProgramNV(struct _glapi_table *disp, GLboolean(GLAPIENTRYP fn) (GLuint))
-{
-    SET_by_offset(disp, _gloffset_IsProgramNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_LoadProgramNV) (GLenum, GLuint, GLsizei,
-                                                 const GLubyte *);
-#define CALL_LoadProgramNV(disp, parameters) \
-    (* GET_LoadProgramNV(disp)) parameters
-static inline _glptr_LoadProgramNV
-GET_LoadProgramNV(struct _glapi_table *disp)
-{
-    return (_glptr_LoadProgramNV) (GET_by_offset
-                                   (disp, _gloffset_LoadProgramNV));
-}
-
-static inline void
-SET_LoadProgramNV(struct _glapi_table *disp,
-                  void (GLAPIENTRYP fn) (GLenum, GLuint, GLsizei,
-                                         const GLubyte *))
-{
-    SET_by_offset(disp, _gloffset_LoadProgramNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ProgramParameters4dvNV) (GLenum, GLuint,
-                                                          GLsizei,
-                                                          const GLdouble *);
-#define CALL_ProgramParameters4dvNV(disp, parameters) \
-    (* GET_ProgramParameters4dvNV(disp)) parameters
-static inline _glptr_ProgramParameters4dvNV
-GET_ProgramParameters4dvNV(struct _glapi_table *disp)
-{
-    return (_glptr_ProgramParameters4dvNV) (GET_by_offset
-                                            (disp,
-                                             _gloffset_ProgramParameters4dvNV));
-}
-
-static inline void
-SET_ProgramParameters4dvNV(struct _glapi_table *disp,
-                           void (GLAPIENTRYP fn) (GLenum, GLuint, GLsizei,
-                                                  const GLdouble *))
-{
-    SET_by_offset(disp, _gloffset_ProgramParameters4dvNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ProgramParameters4fvNV) (GLenum, GLuint,
-                                                          GLsizei,
-                                                          const GLfloat *);
-#define CALL_ProgramParameters4fvNV(disp, parameters) \
-    (* GET_ProgramParameters4fvNV(disp)) parameters
-static inline _glptr_ProgramParameters4fvNV
-GET_ProgramParameters4fvNV(struct _glapi_table *disp)
-{
-    return (_glptr_ProgramParameters4fvNV) (GET_by_offset
-                                            (disp,
-                                             _gloffset_ProgramParameters4fvNV));
-}
-
-static inline void
-SET_ProgramParameters4fvNV(struct _glapi_table *disp,
-                           void (GLAPIENTRYP fn) (GLenum, GLuint, GLsizei,
-                                                  const GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_ProgramParameters4fvNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_RequestResidentProgramsNV) (GLsizei,
-                                                             const GLuint *);
-#define CALL_RequestResidentProgramsNV(disp, parameters) \
-    (* GET_RequestResidentProgramsNV(disp)) parameters
-static inline _glptr_RequestResidentProgramsNV
-GET_RequestResidentProgramsNV(struct _glapi_table *disp)
-{
-    return (_glptr_RequestResidentProgramsNV) (GET_by_offset
-                                               (disp,
-                                                _gloffset_RequestResidentProgramsNV));
-}
-
-static inline void
-SET_RequestResidentProgramsNV(struct _glapi_table *disp,
-                              void (GLAPIENTRYP fn) (GLsizei, const GLuint *))
-{
-    SET_by_offset(disp, _gloffset_RequestResidentProgramsNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TrackMatrixNV) (GLenum, GLuint, GLenum,
-                                                 GLenum);
-#define CALL_TrackMatrixNV(disp, parameters) \
-    (* GET_TrackMatrixNV(disp)) parameters
-static inline _glptr_TrackMatrixNV
-GET_TrackMatrixNV(struct _glapi_table *disp)
-{
-    return (_glptr_TrackMatrixNV) (GET_by_offset
-                                   (disp, _gloffset_TrackMatrixNV));
-}
-
-static inline void
-SET_TrackMatrixNV(struct _glapi_table *disp,
-                  void (GLAPIENTRYP fn) (GLenum, GLuint, GLenum, GLenum))
-{
-    SET_by_offset(disp, _gloffset_TrackMatrixNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib1dNV) (GLuint, GLdouble);
-
-#define CALL_VertexAttrib1dNV(disp, parameters) \
-    (* GET_VertexAttrib1dNV(disp)) parameters
-static inline _glptr_VertexAttrib1dNV
-GET_VertexAttrib1dNV(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttrib1dNV) (GET_by_offset
-                                      (disp, _gloffset_VertexAttrib1dNV));
-}
-
-static inline void
-SET_VertexAttrib1dNV(struct _glapi_table *disp,
-                     void (GLAPIENTRYP fn) (GLuint, GLdouble))
-{
-    SET_by_offset(disp, _gloffset_VertexAttrib1dNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib1dvNV) (GLuint, const GLdouble *);
-
-#define CALL_VertexAttrib1dvNV(disp, parameters) \
-    (* GET_VertexAttrib1dvNV(disp)) parameters
-static inline _glptr_VertexAttrib1dvNV
-GET_VertexAttrib1dvNV(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttrib1dvNV) (GET_by_offset
-                                       (disp, _gloffset_VertexAttrib1dvNV));
-}
-
-static inline void
-SET_VertexAttrib1dvNV(struct _glapi_table *disp,
-                      void (GLAPIENTRYP fn) (GLuint, const GLdouble *))
-{
-    SET_by_offset(disp, _gloffset_VertexAttrib1dvNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib1fNV) (GLuint, GLfloat);
-
-#define CALL_VertexAttrib1fNV(disp, parameters) \
-    (* GET_VertexAttrib1fNV(disp)) parameters
-static inline _glptr_VertexAttrib1fNV
-GET_VertexAttrib1fNV(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttrib1fNV) (GET_by_offset
-                                      (disp, _gloffset_VertexAttrib1fNV));
-}
-
-static inline void
-SET_VertexAttrib1fNV(struct _glapi_table *disp,
-                     void (GLAPIENTRYP fn) (GLuint, GLfloat))
-{
-    SET_by_offset(disp, _gloffset_VertexAttrib1fNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib1fvNV) (GLuint, const GLfloat *);
-
-#define CALL_VertexAttrib1fvNV(disp, parameters) \
-    (* GET_VertexAttrib1fvNV(disp)) parameters
-static inline _glptr_VertexAttrib1fvNV
-GET_VertexAttrib1fvNV(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttrib1fvNV) (GET_by_offset
-                                       (disp, _gloffset_VertexAttrib1fvNV));
-}
-
-static inline void
-SET_VertexAttrib1fvNV(struct _glapi_table *disp,
-                      void (GLAPIENTRYP fn) (GLuint, const GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_VertexAttrib1fvNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib1sNV) (GLuint, GLshort);
-
-#define CALL_VertexAttrib1sNV(disp, parameters) \
-    (* GET_VertexAttrib1sNV(disp)) parameters
-static inline _glptr_VertexAttrib1sNV
-GET_VertexAttrib1sNV(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttrib1sNV) (GET_by_offset
-                                      (disp, _gloffset_VertexAttrib1sNV));
-}
-
-static inline void
-SET_VertexAttrib1sNV(struct _glapi_table *disp,
-                     void (GLAPIENTRYP fn) (GLuint, GLshort))
-{
-    SET_by_offset(disp, _gloffset_VertexAttrib1sNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib1svNV) (GLuint, const GLshort *);
-
-#define CALL_VertexAttrib1svNV(disp, parameters) \
-    (* GET_VertexAttrib1svNV(disp)) parameters
-static inline _glptr_VertexAttrib1svNV
-GET_VertexAttrib1svNV(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttrib1svNV) (GET_by_offset
-                                       (disp, _gloffset_VertexAttrib1svNV));
-}
-
-static inline void
-SET_VertexAttrib1svNV(struct _glapi_table *disp,
-                      void (GLAPIENTRYP fn) (GLuint, const GLshort *))
-{
-    SET_by_offset(disp, _gloffset_VertexAttrib1svNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib2dNV) (GLuint, GLdouble, GLdouble);
-
-#define CALL_VertexAttrib2dNV(disp, parameters) \
-    (* GET_VertexAttrib2dNV(disp)) parameters
-static inline _glptr_VertexAttrib2dNV
-GET_VertexAttrib2dNV(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttrib2dNV) (GET_by_offset
-                                      (disp, _gloffset_VertexAttrib2dNV));
-}
-
-static inline void
-SET_VertexAttrib2dNV(struct _glapi_table *disp,
-                     void (GLAPIENTRYP fn) (GLuint, GLdouble, GLdouble))
-{
-    SET_by_offset(disp, _gloffset_VertexAttrib2dNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib2dvNV) (GLuint, const GLdouble *);
-
-#define CALL_VertexAttrib2dvNV(disp, parameters) \
-    (* GET_VertexAttrib2dvNV(disp)) parameters
-static inline _glptr_VertexAttrib2dvNV
-GET_VertexAttrib2dvNV(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttrib2dvNV) (GET_by_offset
-                                       (disp, _gloffset_VertexAttrib2dvNV));
-}
-
-static inline void
-SET_VertexAttrib2dvNV(struct _glapi_table *disp,
-                      void (GLAPIENTRYP fn) (GLuint, const GLdouble *))
-{
-    SET_by_offset(disp, _gloffset_VertexAttrib2dvNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib2fNV) (GLuint, GLfloat, GLfloat);
-
-#define CALL_VertexAttrib2fNV(disp, parameters) \
-    (* GET_VertexAttrib2fNV(disp)) parameters
-static inline _glptr_VertexAttrib2fNV
-GET_VertexAttrib2fNV(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttrib2fNV) (GET_by_offset
-                                      (disp, _gloffset_VertexAttrib2fNV));
-}
-
-static inline void
-SET_VertexAttrib2fNV(struct _glapi_table *disp,
-                     void (GLAPIENTRYP fn) (GLuint, GLfloat, GLfloat))
-{
-    SET_by_offset(disp, _gloffset_VertexAttrib2fNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib2fvNV) (GLuint, const GLfloat *);
-
-#define CALL_VertexAttrib2fvNV(disp, parameters) \
-    (* GET_VertexAttrib2fvNV(disp)) parameters
-static inline _glptr_VertexAttrib2fvNV
-GET_VertexAttrib2fvNV(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttrib2fvNV) (GET_by_offset
-                                       (disp, _gloffset_VertexAttrib2fvNV));
-}
-
-static inline void
-SET_VertexAttrib2fvNV(struct _glapi_table *disp,
-                      void (GLAPIENTRYP fn) (GLuint, const GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_VertexAttrib2fvNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib2sNV) (GLuint, GLshort, GLshort);
-
-#define CALL_VertexAttrib2sNV(disp, parameters) \
-    (* GET_VertexAttrib2sNV(disp)) parameters
-static inline _glptr_VertexAttrib2sNV
-GET_VertexAttrib2sNV(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttrib2sNV) (GET_by_offset
-                                      (disp, _gloffset_VertexAttrib2sNV));
-}
-
-static inline void
-SET_VertexAttrib2sNV(struct _glapi_table *disp,
-                     void (GLAPIENTRYP fn) (GLuint, GLshort, GLshort))
-{
-    SET_by_offset(disp, _gloffset_VertexAttrib2sNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib2svNV) (GLuint, const GLshort *);
-
-#define CALL_VertexAttrib2svNV(disp, parameters) \
-    (* GET_VertexAttrib2svNV(disp)) parameters
-static inline _glptr_VertexAttrib2svNV
-GET_VertexAttrib2svNV(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttrib2svNV) (GET_by_offset
-                                       (disp, _gloffset_VertexAttrib2svNV));
-}
-
-static inline void
-SET_VertexAttrib2svNV(struct _glapi_table *disp,
-                      void (GLAPIENTRYP fn) (GLuint, const GLshort *))
-{
-    SET_by_offset(disp, _gloffset_VertexAttrib2svNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib3dNV) (GLuint, GLdouble, GLdouble,
-                                                    GLdouble);
-#define CALL_VertexAttrib3dNV(disp, parameters) \
-    (* GET_VertexAttrib3dNV(disp)) parameters
-static inline _glptr_VertexAttrib3dNV
-GET_VertexAttrib3dNV(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttrib3dNV) (GET_by_offset
-                                      (disp, _gloffset_VertexAttrib3dNV));
-}
-
-static inline void
-SET_VertexAttrib3dNV(struct _glapi_table *disp,
-                     void (GLAPIENTRYP fn) (GLuint, GLdouble, GLdouble,
-                                            GLdouble))
-{
-    SET_by_offset(disp, _gloffset_VertexAttrib3dNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib3dvNV) (GLuint, const GLdouble *);
-
-#define CALL_VertexAttrib3dvNV(disp, parameters) \
-    (* GET_VertexAttrib3dvNV(disp)) parameters
-static inline _glptr_VertexAttrib3dvNV
-GET_VertexAttrib3dvNV(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttrib3dvNV) (GET_by_offset
-                                       (disp, _gloffset_VertexAttrib3dvNV));
-}
-
-static inline void
-SET_VertexAttrib3dvNV(struct _glapi_table *disp,
-                      void (GLAPIENTRYP fn) (GLuint, const GLdouble *))
-{
-    SET_by_offset(disp, _gloffset_VertexAttrib3dvNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib3fNV) (GLuint, GLfloat, GLfloat,
-                                                    GLfloat);
-#define CALL_VertexAttrib3fNV(disp, parameters) \
-    (* GET_VertexAttrib3fNV(disp)) parameters
-static inline _glptr_VertexAttrib3fNV
-GET_VertexAttrib3fNV(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttrib3fNV) (GET_by_offset
-                                      (disp, _gloffset_VertexAttrib3fNV));
-}
-
-static inline void
-SET_VertexAttrib3fNV(struct _glapi_table *disp,
-                     void (GLAPIENTRYP fn) (GLuint, GLfloat, GLfloat, GLfloat))
-{
-    SET_by_offset(disp, _gloffset_VertexAttrib3fNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib3fvNV) (GLuint, const GLfloat *);
-
-#define CALL_VertexAttrib3fvNV(disp, parameters) \
-    (* GET_VertexAttrib3fvNV(disp)) parameters
-static inline _glptr_VertexAttrib3fvNV
-GET_VertexAttrib3fvNV(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttrib3fvNV) (GET_by_offset
-                                       (disp, _gloffset_VertexAttrib3fvNV));
-}
-
-static inline void
-SET_VertexAttrib3fvNV(struct _glapi_table *disp,
-                      void (GLAPIENTRYP fn) (GLuint, const GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_VertexAttrib3fvNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib3sNV) (GLuint, GLshort, GLshort,
-                                                    GLshort);
-#define CALL_VertexAttrib3sNV(disp, parameters) \
-    (* GET_VertexAttrib3sNV(disp)) parameters
-static inline _glptr_VertexAttrib3sNV
-GET_VertexAttrib3sNV(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttrib3sNV) (GET_by_offset
-                                      (disp, _gloffset_VertexAttrib3sNV));
-}
-
-static inline void
-SET_VertexAttrib3sNV(struct _glapi_table *disp,
-                     void (GLAPIENTRYP fn) (GLuint, GLshort, GLshort, GLshort))
-{
-    SET_by_offset(disp, _gloffset_VertexAttrib3sNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib3svNV) (GLuint, const GLshort *);
-
-#define CALL_VertexAttrib3svNV(disp, parameters) \
-    (* GET_VertexAttrib3svNV(disp)) parameters
-static inline _glptr_VertexAttrib3svNV
-GET_VertexAttrib3svNV(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttrib3svNV) (GET_by_offset
-                                       (disp, _gloffset_VertexAttrib3svNV));
-}
-
-static inline void
-SET_VertexAttrib3svNV(struct _glapi_table *disp,
-                      void (GLAPIENTRYP fn) (GLuint, const GLshort *))
-{
-    SET_by_offset(disp, _gloffset_VertexAttrib3svNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib4dNV) (GLuint, GLdouble, GLdouble,
-                                                    GLdouble, GLdouble);
-#define CALL_VertexAttrib4dNV(disp, parameters) \
-    (* GET_VertexAttrib4dNV(disp)) parameters
-static inline _glptr_VertexAttrib4dNV
-GET_VertexAttrib4dNV(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttrib4dNV) (GET_by_offset
-                                      (disp, _gloffset_VertexAttrib4dNV));
-}
-
-static inline void
-SET_VertexAttrib4dNV(struct _glapi_table *disp,
-                     void (GLAPIENTRYP fn) (GLuint, GLdouble, GLdouble,
-                                            GLdouble, GLdouble))
-{
-    SET_by_offset(disp, _gloffset_VertexAttrib4dNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib4dvNV) (GLuint, const GLdouble *);
-
-#define CALL_VertexAttrib4dvNV(disp, parameters) \
-    (* GET_VertexAttrib4dvNV(disp)) parameters
-static inline _glptr_VertexAttrib4dvNV
-GET_VertexAttrib4dvNV(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttrib4dvNV) (GET_by_offset
-                                       (disp, _gloffset_VertexAttrib4dvNV));
-}
-
-static inline void
-SET_VertexAttrib4dvNV(struct _glapi_table *disp,
-                      void (GLAPIENTRYP fn) (GLuint, const GLdouble *))
-{
-    SET_by_offset(disp, _gloffset_VertexAttrib4dvNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib4fNV) (GLuint, GLfloat, GLfloat,
-                                                    GLfloat, GLfloat);
-#define CALL_VertexAttrib4fNV(disp, parameters) \
-    (* GET_VertexAttrib4fNV(disp)) parameters
-static inline _glptr_VertexAttrib4fNV
-GET_VertexAttrib4fNV(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttrib4fNV) (GET_by_offset
-                                      (disp, _gloffset_VertexAttrib4fNV));
-}
-
-static inline void
-SET_VertexAttrib4fNV(struct _glapi_table *disp,
-                     void (GLAPIENTRYP fn) (GLuint, GLfloat, GLfloat, GLfloat,
-                                            GLfloat))
-{
-    SET_by_offset(disp, _gloffset_VertexAttrib4fNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib4fvNV) (GLuint, const GLfloat *);
-
-#define CALL_VertexAttrib4fvNV(disp, parameters) \
-    (* GET_VertexAttrib4fvNV(disp)) parameters
-static inline _glptr_VertexAttrib4fvNV
-GET_VertexAttrib4fvNV(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttrib4fvNV) (GET_by_offset
-                                       (disp, _gloffset_VertexAttrib4fvNV));
-}
-
-static inline void
-SET_VertexAttrib4fvNV(struct _glapi_table *disp,
-                      void (GLAPIENTRYP fn) (GLuint, const GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_VertexAttrib4fvNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib4sNV) (GLuint, GLshort, GLshort,
-                                                    GLshort, GLshort);
-#define CALL_VertexAttrib4sNV(disp, parameters) \
-    (* GET_VertexAttrib4sNV(disp)) parameters
-static inline _glptr_VertexAttrib4sNV
-GET_VertexAttrib4sNV(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttrib4sNV) (GET_by_offset
-                                      (disp, _gloffset_VertexAttrib4sNV));
-}
-
-static inline void
-SET_VertexAttrib4sNV(struct _glapi_table *disp,
-                     void (GLAPIENTRYP fn) (GLuint, GLshort, GLshort, GLshort,
-                                            GLshort))
-{
-    SET_by_offset(disp, _gloffset_VertexAttrib4sNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib4svNV) (GLuint, const GLshort *);
-
-#define CALL_VertexAttrib4svNV(disp, parameters) \
-    (* GET_VertexAttrib4svNV(disp)) parameters
-static inline _glptr_VertexAttrib4svNV
-GET_VertexAttrib4svNV(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttrib4svNV) (GET_by_offset
-                                       (disp, _gloffset_VertexAttrib4svNV));
-}
-
-static inline void
-SET_VertexAttrib4svNV(struct _glapi_table *disp,
-                      void (GLAPIENTRYP fn) (GLuint, const GLshort *))
-{
-    SET_by_offset(disp, _gloffset_VertexAttrib4svNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib4ubNV) (GLuint, GLubyte, GLubyte,
-                                                     GLubyte, GLubyte);
-#define CALL_VertexAttrib4ubNV(disp, parameters) \
-    (* GET_VertexAttrib4ubNV(disp)) parameters
-static inline _glptr_VertexAttrib4ubNV
-GET_VertexAttrib4ubNV(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttrib4ubNV) (GET_by_offset
-                                       (disp, _gloffset_VertexAttrib4ubNV));
-}
-
-static inline void
-SET_VertexAttrib4ubNV(struct _glapi_table *disp,
-                      void (GLAPIENTRYP fn) (GLuint, GLubyte, GLubyte, GLubyte,
-                                             GLubyte))
-{
-    SET_by_offset(disp, _gloffset_VertexAttrib4ubNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttrib4ubvNV) (GLuint, const GLubyte *);
-
-#define CALL_VertexAttrib4ubvNV(disp, parameters) \
-    (* GET_VertexAttrib4ubvNV(disp)) parameters
-static inline _glptr_VertexAttrib4ubvNV
-GET_VertexAttrib4ubvNV(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttrib4ubvNV) (GET_by_offset
-                                        (disp, _gloffset_VertexAttrib4ubvNV));
-}
-
-static inline void
-SET_VertexAttrib4ubvNV(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLuint, const GLubyte *))
-{
-    SET_by_offset(disp, _gloffset_VertexAttrib4ubvNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribPointerNV) (GLuint, GLint, GLenum,
-                                                         GLsizei,
-                                                         const GLvoid *);
-#define CALL_VertexAttribPointerNV(disp, parameters) \
-    (* GET_VertexAttribPointerNV(disp)) parameters
-static inline _glptr_VertexAttribPointerNV
-GET_VertexAttribPointerNV(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttribPointerNV) (GET_by_offset
-                                           (disp,
-                                            _gloffset_VertexAttribPointerNV));
-}
-
-static inline void
-SET_VertexAttribPointerNV(struct _glapi_table *disp,
-                          void (GLAPIENTRYP fn) (GLuint, GLint, GLenum, GLsizei,
-                                                 const GLvoid *))
-{
-    SET_by_offset(disp, _gloffset_VertexAttribPointerNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribs1dvNV) (GLuint, GLsizei,
-                                                      const GLdouble *);
-#define CALL_VertexAttribs1dvNV(disp, parameters) \
-    (* GET_VertexAttribs1dvNV(disp)) parameters
-static inline _glptr_VertexAttribs1dvNV
-GET_VertexAttribs1dvNV(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttribs1dvNV) (GET_by_offset
-                                        (disp, _gloffset_VertexAttribs1dvNV));
-}
-
-static inline void
-SET_VertexAttribs1dvNV(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLuint, GLsizei,
-                                              const GLdouble *))
-{
-    SET_by_offset(disp, _gloffset_VertexAttribs1dvNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribs1fvNV) (GLuint, GLsizei,
-                                                      const GLfloat *);
-#define CALL_VertexAttribs1fvNV(disp, parameters) \
-    (* GET_VertexAttribs1fvNV(disp)) parameters
-static inline _glptr_VertexAttribs1fvNV
-GET_VertexAttribs1fvNV(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttribs1fvNV) (GET_by_offset
-                                        (disp, _gloffset_VertexAttribs1fvNV));
-}
-
-static inline void
-SET_VertexAttribs1fvNV(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLuint, GLsizei, const GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_VertexAttribs1fvNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribs1svNV) (GLuint, GLsizei,
-                                                      const GLshort *);
-#define CALL_VertexAttribs1svNV(disp, parameters) \
-    (* GET_VertexAttribs1svNV(disp)) parameters
-static inline _glptr_VertexAttribs1svNV
-GET_VertexAttribs1svNV(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttribs1svNV) (GET_by_offset
-                                        (disp, _gloffset_VertexAttribs1svNV));
-}
-
-static inline void
-SET_VertexAttribs1svNV(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLuint, GLsizei, const GLshort *))
-{
-    SET_by_offset(disp, _gloffset_VertexAttribs1svNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribs2dvNV) (GLuint, GLsizei,
-                                                      const GLdouble *);
-#define CALL_VertexAttribs2dvNV(disp, parameters) \
-    (* GET_VertexAttribs2dvNV(disp)) parameters
-static inline _glptr_VertexAttribs2dvNV
-GET_VertexAttribs2dvNV(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttribs2dvNV) (GET_by_offset
-                                        (disp, _gloffset_VertexAttribs2dvNV));
-}
-
-static inline void
-SET_VertexAttribs2dvNV(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLuint, GLsizei,
-                                              const GLdouble *))
-{
-    SET_by_offset(disp, _gloffset_VertexAttribs2dvNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribs2fvNV) (GLuint, GLsizei,
-                                                      const GLfloat *);
-#define CALL_VertexAttribs2fvNV(disp, parameters) \
-    (* GET_VertexAttribs2fvNV(disp)) parameters
-static inline _glptr_VertexAttribs2fvNV
-GET_VertexAttribs2fvNV(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttribs2fvNV) (GET_by_offset
-                                        (disp, _gloffset_VertexAttribs2fvNV));
-}
-
-static inline void
-SET_VertexAttribs2fvNV(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLuint, GLsizei, const GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_VertexAttribs2fvNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribs2svNV) (GLuint, GLsizei,
-                                                      const GLshort *);
-#define CALL_VertexAttribs2svNV(disp, parameters) \
-    (* GET_VertexAttribs2svNV(disp)) parameters
-static inline _glptr_VertexAttribs2svNV
-GET_VertexAttribs2svNV(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttribs2svNV) (GET_by_offset
-                                        (disp, _gloffset_VertexAttribs2svNV));
-}
-
-static inline void
-SET_VertexAttribs2svNV(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLuint, GLsizei, const GLshort *))
-{
-    SET_by_offset(disp, _gloffset_VertexAttribs2svNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribs3dvNV) (GLuint, GLsizei,
-                                                      const GLdouble *);
-#define CALL_VertexAttribs3dvNV(disp, parameters) \
-    (* GET_VertexAttribs3dvNV(disp)) parameters
-static inline _glptr_VertexAttribs3dvNV
-GET_VertexAttribs3dvNV(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttribs3dvNV) (GET_by_offset
-                                        (disp, _gloffset_VertexAttribs3dvNV));
-}
-
-static inline void
-SET_VertexAttribs3dvNV(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLuint, GLsizei,
-                                              const GLdouble *))
-{
-    SET_by_offset(disp, _gloffset_VertexAttribs3dvNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribs3fvNV) (GLuint, GLsizei,
-                                                      const GLfloat *);
-#define CALL_VertexAttribs3fvNV(disp, parameters) \
-    (* GET_VertexAttribs3fvNV(disp)) parameters
-static inline _glptr_VertexAttribs3fvNV
-GET_VertexAttribs3fvNV(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttribs3fvNV) (GET_by_offset
-                                        (disp, _gloffset_VertexAttribs3fvNV));
-}
-
-static inline void
-SET_VertexAttribs3fvNV(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLuint, GLsizei, const GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_VertexAttribs3fvNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribs3svNV) (GLuint, GLsizei,
-                                                      const GLshort *);
-#define CALL_VertexAttribs3svNV(disp, parameters) \
-    (* GET_VertexAttribs3svNV(disp)) parameters
-static inline _glptr_VertexAttribs3svNV
-GET_VertexAttribs3svNV(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttribs3svNV) (GET_by_offset
-                                        (disp, _gloffset_VertexAttribs3svNV));
-}
-
-static inline void
-SET_VertexAttribs3svNV(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLuint, GLsizei, const GLshort *))
-{
-    SET_by_offset(disp, _gloffset_VertexAttribs3svNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribs4dvNV) (GLuint, GLsizei,
-                                                      const GLdouble *);
-#define CALL_VertexAttribs4dvNV(disp, parameters) \
-    (* GET_VertexAttribs4dvNV(disp)) parameters
-static inline _glptr_VertexAttribs4dvNV
-GET_VertexAttribs4dvNV(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttribs4dvNV) (GET_by_offset
-                                        (disp, _gloffset_VertexAttribs4dvNV));
-}
-
-static inline void
-SET_VertexAttribs4dvNV(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLuint, GLsizei,
-                                              const GLdouble *))
-{
-    SET_by_offset(disp, _gloffset_VertexAttribs4dvNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribs4fvNV) (GLuint, GLsizei,
-                                                      const GLfloat *);
-#define CALL_VertexAttribs4fvNV(disp, parameters) \
-    (* GET_VertexAttribs4fvNV(disp)) parameters
-static inline _glptr_VertexAttribs4fvNV
-GET_VertexAttribs4fvNV(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttribs4fvNV) (GET_by_offset
-                                        (disp, _gloffset_VertexAttribs4fvNV));
-}
-
-static inline void
-SET_VertexAttribs4fvNV(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLuint, GLsizei, const GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_VertexAttribs4fvNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribs4svNV) (GLuint, GLsizei,
-                                                      const GLshort *);
-#define CALL_VertexAttribs4svNV(disp, parameters) \
-    (* GET_VertexAttribs4svNV(disp)) parameters
-static inline _glptr_VertexAttribs4svNV
-GET_VertexAttribs4svNV(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttribs4svNV) (GET_by_offset
-                                        (disp, _gloffset_VertexAttribs4svNV));
-}
-
-static inline void
-SET_VertexAttribs4svNV(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLuint, GLsizei, const GLshort *))
-{
-    SET_by_offset(disp, _gloffset_VertexAttribs4svNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribs4ubvNV) (GLuint, GLsizei,
-                                                       const GLubyte *);
-#define CALL_VertexAttribs4ubvNV(disp, parameters) \
-    (* GET_VertexAttribs4ubvNV(disp)) parameters
-static inline _glptr_VertexAttribs4ubvNV
-GET_VertexAttribs4ubvNV(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttribs4ubvNV) (GET_by_offset
-                                         (disp, _gloffset_VertexAttribs4ubvNV));
-}
-
-static inline void
-SET_VertexAttribs4ubvNV(struct _glapi_table *disp,
-                        void (GLAPIENTRYP fn) (GLuint, GLsizei,
-                                               const GLubyte *))
-{
-    SET_by_offset(disp, _gloffset_VertexAttribs4ubvNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetTexBumpParameterfvATI) (GLenum, GLfloat *);
-
-#define CALL_GetTexBumpParameterfvATI(disp, parameters) \
-    (* GET_GetTexBumpParameterfvATI(disp)) parameters
-static inline _glptr_GetTexBumpParameterfvATI
-GET_GetTexBumpParameterfvATI(struct _glapi_table *disp)
-{
-    return (_glptr_GetTexBumpParameterfvATI) (GET_by_offset
-                                              (disp,
-                                               _gloffset_GetTexBumpParameterfvATI));
-}
-
-static inline void
-SET_GetTexBumpParameterfvATI(struct _glapi_table *disp,
-                             void (GLAPIENTRYP fn) (GLenum, GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_GetTexBumpParameterfvATI, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetTexBumpParameterivATI) (GLenum, GLint *);
-
-#define CALL_GetTexBumpParameterivATI(disp, parameters) \
-    (* GET_GetTexBumpParameterivATI(disp)) parameters
-static inline _glptr_GetTexBumpParameterivATI
-GET_GetTexBumpParameterivATI(struct _glapi_table *disp)
-{
-    return (_glptr_GetTexBumpParameterivATI) (GET_by_offset
-                                              (disp,
-                                               _gloffset_GetTexBumpParameterivATI));
-}
-
-static inline void
-SET_GetTexBumpParameterivATI(struct _glapi_table *disp,
-                             void (GLAPIENTRYP fn) (GLenum, GLint *))
-{
-    SET_by_offset(disp, _gloffset_GetTexBumpParameterivATI, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexBumpParameterfvATI) (GLenum,
-                                                         const GLfloat *);
-#define CALL_TexBumpParameterfvATI(disp, parameters) \
-    (* GET_TexBumpParameterfvATI(disp)) parameters
-static inline _glptr_TexBumpParameterfvATI
-GET_TexBumpParameterfvATI(struct _glapi_table *disp)
-{
-    return (_glptr_TexBumpParameterfvATI) (GET_by_offset
-                                           (disp,
-                                            _gloffset_TexBumpParameterfvATI));
-}
-
-static inline void
-SET_TexBumpParameterfvATI(struct _glapi_table *disp,
-                          void (GLAPIENTRYP fn) (GLenum, const GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_TexBumpParameterfvATI, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexBumpParameterivATI) (GLenum, const GLint *);
-
-#define CALL_TexBumpParameterivATI(disp, parameters) \
-    (* GET_TexBumpParameterivATI(disp)) parameters
-static inline _glptr_TexBumpParameterivATI
-GET_TexBumpParameterivATI(struct _glapi_table *disp)
-{
-    return (_glptr_TexBumpParameterivATI) (GET_by_offset
-                                           (disp,
-                                            _gloffset_TexBumpParameterivATI));
-}
-
-static inline void
-SET_TexBumpParameterivATI(struct _glapi_table *disp,
-                          void (GLAPIENTRYP fn) (GLenum, const GLint *))
-{
-    SET_by_offset(disp, _gloffset_TexBumpParameterivATI, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_AlphaFragmentOp1ATI) (GLenum, GLuint, GLuint,
-                                                       GLuint, GLuint, GLuint);
-#define CALL_AlphaFragmentOp1ATI(disp, parameters) \
-    (* GET_AlphaFragmentOp1ATI(disp)) parameters
-static inline _glptr_AlphaFragmentOp1ATI
-GET_AlphaFragmentOp1ATI(struct _glapi_table *disp)
-{
-    return (_glptr_AlphaFragmentOp1ATI) (GET_by_offset
-                                         (disp, _gloffset_AlphaFragmentOp1ATI));
-}
-
-static inline void
-SET_AlphaFragmentOp1ATI(struct _glapi_table *disp,
-                        void (GLAPIENTRYP fn) (GLenum, GLuint, GLuint, GLuint,
-                                               GLuint, GLuint))
-{
-    SET_by_offset(disp, _gloffset_AlphaFragmentOp1ATI, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_AlphaFragmentOp2ATI) (GLenum, GLuint, GLuint,
-                                                       GLuint, GLuint, GLuint,
-                                                       GLuint, GLuint, GLuint);
-#define CALL_AlphaFragmentOp2ATI(disp, parameters) \
-    (* GET_AlphaFragmentOp2ATI(disp)) parameters
-static inline _glptr_AlphaFragmentOp2ATI
-GET_AlphaFragmentOp2ATI(struct _glapi_table *disp)
-{
-    return (_glptr_AlphaFragmentOp2ATI) (GET_by_offset
-                                         (disp, _gloffset_AlphaFragmentOp2ATI));
-}
-
-static inline void
-SET_AlphaFragmentOp2ATI(struct _glapi_table *disp,
-                        void (GLAPIENTRYP fn) (GLenum, GLuint, GLuint, GLuint,
-                                               GLuint, GLuint, GLuint, GLuint,
-                                               GLuint))
-{
-    SET_by_offset(disp, _gloffset_AlphaFragmentOp2ATI, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_AlphaFragmentOp3ATI) (GLenum, GLuint, GLuint,
-                                                       GLuint, GLuint, GLuint,
-                                                       GLuint, GLuint, GLuint,
-                                                       GLuint, GLuint, GLuint);
-#define CALL_AlphaFragmentOp3ATI(disp, parameters) \
-    (* GET_AlphaFragmentOp3ATI(disp)) parameters
-static inline _glptr_AlphaFragmentOp3ATI
-GET_AlphaFragmentOp3ATI(struct _glapi_table *disp)
-{
-    return (_glptr_AlphaFragmentOp3ATI) (GET_by_offset
-                                         (disp, _gloffset_AlphaFragmentOp3ATI));
-}
-
-static inline void
-SET_AlphaFragmentOp3ATI(struct _glapi_table *disp,
-                        void (GLAPIENTRYP fn) (GLenum, GLuint, GLuint, GLuint,
-                                               GLuint, GLuint, GLuint, GLuint,
-                                               GLuint, GLuint, GLuint, GLuint))
-{
-    SET_by_offset(disp, _gloffset_AlphaFragmentOp3ATI, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_BeginFragmentShaderATI) (void);
-
-#define CALL_BeginFragmentShaderATI(disp, parameters) \
-    (* GET_BeginFragmentShaderATI(disp)) parameters
-static inline _glptr_BeginFragmentShaderATI
-GET_BeginFragmentShaderATI(struct _glapi_table *disp)
-{
-    return (_glptr_BeginFragmentShaderATI) (GET_by_offset
-                                            (disp,
-                                             _gloffset_BeginFragmentShaderATI));
-}
-
-static inline void
-SET_BeginFragmentShaderATI(struct _glapi_table *disp,
-                           void (GLAPIENTRYP fn) (void))
-{
-    SET_by_offset(disp, _gloffset_BeginFragmentShaderATI, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_BindFragmentShaderATI) (GLuint);
-
-#define CALL_BindFragmentShaderATI(disp, parameters) \
-    (* GET_BindFragmentShaderATI(disp)) parameters
-static inline _glptr_BindFragmentShaderATI
-GET_BindFragmentShaderATI(struct _glapi_table *disp)
-{
-    return (_glptr_BindFragmentShaderATI) (GET_by_offset
-                                           (disp,
-                                            _gloffset_BindFragmentShaderATI));
-}
-
-static inline void
-SET_BindFragmentShaderATI(struct _glapi_table *disp,
-                          void (GLAPIENTRYP fn) (GLuint))
-{
-    SET_by_offset(disp, _gloffset_BindFragmentShaderATI, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ColorFragmentOp1ATI) (GLenum, GLuint, GLuint,
-                                                       GLuint, GLuint, GLuint,
-                                                       GLuint);
-#define CALL_ColorFragmentOp1ATI(disp, parameters) \
-    (* GET_ColorFragmentOp1ATI(disp)) parameters
-static inline _glptr_ColorFragmentOp1ATI
-GET_ColorFragmentOp1ATI(struct _glapi_table *disp)
-{
-    return (_glptr_ColorFragmentOp1ATI) (GET_by_offset
-                                         (disp, _gloffset_ColorFragmentOp1ATI));
-}
-
-static inline void
-SET_ColorFragmentOp1ATI(struct _glapi_table *disp,
-                        void (GLAPIENTRYP fn) (GLenum, GLuint, GLuint, GLuint,
-                                               GLuint, GLuint, GLuint))
-{
-    SET_by_offset(disp, _gloffset_ColorFragmentOp1ATI, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ColorFragmentOp2ATI) (GLenum, GLuint, GLuint,
-                                                       GLuint, GLuint, GLuint,
-                                                       GLuint, GLuint, GLuint,
-                                                       GLuint);
-#define CALL_ColorFragmentOp2ATI(disp, parameters) \
-    (* GET_ColorFragmentOp2ATI(disp)) parameters
-static inline _glptr_ColorFragmentOp2ATI
-GET_ColorFragmentOp2ATI(struct _glapi_table *disp)
-{
-    return (_glptr_ColorFragmentOp2ATI) (GET_by_offset
-                                         (disp, _gloffset_ColorFragmentOp2ATI));
-}
-
-static inline void
-SET_ColorFragmentOp2ATI(struct _glapi_table *disp,
-                        void (GLAPIENTRYP fn) (GLenum, GLuint, GLuint, GLuint,
-                                               GLuint, GLuint, GLuint, GLuint,
-                                               GLuint, GLuint))
-{
-    SET_by_offset(disp, _gloffset_ColorFragmentOp2ATI, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ColorFragmentOp3ATI) (GLenum, GLuint, GLuint,
-                                                       GLuint, GLuint, GLuint,
-                                                       GLuint, GLuint, GLuint,
-                                                       GLuint, GLuint, GLuint,
-                                                       GLuint);
-#define CALL_ColorFragmentOp3ATI(disp, parameters) \
-    (* GET_ColorFragmentOp3ATI(disp)) parameters
-static inline _glptr_ColorFragmentOp3ATI
-GET_ColorFragmentOp3ATI(struct _glapi_table *disp)
-{
-    return (_glptr_ColorFragmentOp3ATI) (GET_by_offset
-                                         (disp, _gloffset_ColorFragmentOp3ATI));
-}
-
-static inline void
-SET_ColorFragmentOp3ATI(struct _glapi_table *disp,
-                        void (GLAPIENTRYP fn) (GLenum, GLuint, GLuint, GLuint,
-                                               GLuint, GLuint, GLuint, GLuint,
-                                               GLuint, GLuint, GLuint, GLuint,
-                                               GLuint))
-{
-    SET_by_offset(disp, _gloffset_ColorFragmentOp3ATI, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_DeleteFragmentShaderATI) (GLuint);
-
-#define CALL_DeleteFragmentShaderATI(disp, parameters) \
-    (* GET_DeleteFragmentShaderATI(disp)) parameters
-static inline _glptr_DeleteFragmentShaderATI
-GET_DeleteFragmentShaderATI(struct _glapi_table *disp)
-{
-    return (_glptr_DeleteFragmentShaderATI) (GET_by_offset
-                                             (disp,
-                                              _gloffset_DeleteFragmentShaderATI));
-}
-
-static inline void
-SET_DeleteFragmentShaderATI(struct _glapi_table *disp,
-                            void (GLAPIENTRYP fn) (GLuint))
-{
-    SET_by_offset(disp, _gloffset_DeleteFragmentShaderATI, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_EndFragmentShaderATI) (void);
-
-#define CALL_EndFragmentShaderATI(disp, parameters) \
-    (* GET_EndFragmentShaderATI(disp)) parameters
-static inline _glptr_EndFragmentShaderATI
-GET_EndFragmentShaderATI(struct _glapi_table *disp)
-{
-    return (_glptr_EndFragmentShaderATI) (GET_by_offset
-                                          (disp,
-                                           _gloffset_EndFragmentShaderATI));
-}
-
-static inline void
-SET_EndFragmentShaderATI(struct _glapi_table *disp,
-                         void (GLAPIENTRYP fn) (void))
-{
-    SET_by_offset(disp, _gloffset_EndFragmentShaderATI, fn);
-}
-
-typedef GLuint(GLAPIENTRYP _glptr_GenFragmentShadersATI) (GLuint);
-
-#define CALL_GenFragmentShadersATI(disp, parameters) \
-    (* GET_GenFragmentShadersATI(disp)) parameters
-static inline _glptr_GenFragmentShadersATI
-GET_GenFragmentShadersATI(struct _glapi_table *disp)
-{
-    return (_glptr_GenFragmentShadersATI) (GET_by_offset
-                                           (disp,
-                                            _gloffset_GenFragmentShadersATI));
-}
-
-static inline void
-SET_GenFragmentShadersATI(struct _glapi_table *disp,
-                          GLuint(GLAPIENTRYP fn) (GLuint))
-{
-    SET_by_offset(disp, _gloffset_GenFragmentShadersATI, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_PassTexCoordATI) (GLuint, GLuint, GLenum);
-
-#define CALL_PassTexCoordATI(disp, parameters) \
-    (* GET_PassTexCoordATI(disp)) parameters
-static inline _glptr_PassTexCoordATI
-GET_PassTexCoordATI(struct _glapi_table *disp)
-{
-    return (_glptr_PassTexCoordATI) (GET_by_offset
-                                     (disp, _gloffset_PassTexCoordATI));
-}
-
-static inline void
-SET_PassTexCoordATI(struct _glapi_table *disp,
-                    void (GLAPIENTRYP fn) (GLuint, GLuint, GLenum))
-{
-    SET_by_offset(disp, _gloffset_PassTexCoordATI, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_SampleMapATI) (GLuint, GLuint, GLenum);
-
-#define CALL_SampleMapATI(disp, parameters) \
-    (* GET_SampleMapATI(disp)) parameters
-static inline _glptr_SampleMapATI
-GET_SampleMapATI(struct _glapi_table *disp)
-{
-    return (_glptr_SampleMapATI) (GET_by_offset(disp, _gloffset_SampleMapATI));
-}
-
-static inline void
-SET_SampleMapATI(struct _glapi_table *disp,
-                 void (GLAPIENTRYP fn) (GLuint, GLuint, GLenum))
-{
-    SET_by_offset(disp, _gloffset_SampleMapATI, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_SetFragmentShaderConstantATI) (GLuint,
-                                                                const GLfloat
-                                                                *);
-#define CALL_SetFragmentShaderConstantATI(disp, parameters) \
-    (* GET_SetFragmentShaderConstantATI(disp)) parameters
-static inline _glptr_SetFragmentShaderConstantATI
-GET_SetFragmentShaderConstantATI(struct _glapi_table *disp)
-{
-    return (_glptr_SetFragmentShaderConstantATI) (GET_by_offset
-                                                  (disp,
-                                                   _gloffset_SetFragmentShaderConstantATI));
-}
-
-static inline void
-SET_SetFragmentShaderConstantATI(struct _glapi_table *disp,
-                                 void (GLAPIENTRYP fn) (GLuint,
-                                                        const GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_SetFragmentShaderConstantATI, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_PointParameteriNV) (GLenum, GLint);
-
-#define CALL_PointParameteriNV(disp, parameters) \
-    (* GET_PointParameteriNV(disp)) parameters
-static inline _glptr_PointParameteriNV
-GET_PointParameteriNV(struct _glapi_table *disp)
-{
-    return (_glptr_PointParameteriNV) (GET_by_offset
-                                       (disp, _gloffset_PointParameteriNV));
-}
-
-static inline void
-SET_PointParameteriNV(struct _glapi_table *disp,
-                      void (GLAPIENTRYP fn) (GLenum, GLint))
-{
-    SET_by_offset(disp, _gloffset_PointParameteriNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_PointParameterivNV) (GLenum, const GLint *);
-
-#define CALL_PointParameterivNV(disp, parameters) \
-    (* GET_PointParameterivNV(disp)) parameters
-static inline _glptr_PointParameterivNV
-GET_PointParameterivNV(struct _glapi_table *disp)
-{
-    return (_glptr_PointParameterivNV) (GET_by_offset
-                                        (disp, _gloffset_PointParameterivNV));
-}
-
-static inline void
-SET_PointParameterivNV(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLenum, const GLint *))
-{
-    SET_by_offset(disp, _gloffset_PointParameterivNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ActiveStencilFaceEXT) (GLenum);
-
-#define CALL_ActiveStencilFaceEXT(disp, parameters) \
-    (* GET_ActiveStencilFaceEXT(disp)) parameters
-static inline _glptr_ActiveStencilFaceEXT
-GET_ActiveStencilFaceEXT(struct _glapi_table *disp)
-{
-    return (_glptr_ActiveStencilFaceEXT) (GET_by_offset
-                                          (disp,
-                                           _gloffset_ActiveStencilFaceEXT));
-}
-
-static inline void
-SET_ActiveStencilFaceEXT(struct _glapi_table *disp,
-                         void (GLAPIENTRYP fn) (GLenum))
-{
-    SET_by_offset(disp, _gloffset_ActiveStencilFaceEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_BindVertexArrayAPPLE) (GLuint);
-
-#define CALL_BindVertexArrayAPPLE(disp, parameters) \
-    (* GET_BindVertexArrayAPPLE(disp)) parameters
-static inline _glptr_BindVertexArrayAPPLE
-GET_BindVertexArrayAPPLE(struct _glapi_table *disp)
-{
-    return (_glptr_BindVertexArrayAPPLE) (GET_by_offset
-                                          (disp,
-                                           _gloffset_BindVertexArrayAPPLE));
-}
-
-static inline void
-SET_BindVertexArrayAPPLE(struct _glapi_table *disp,
-                         void (GLAPIENTRYP fn) (GLuint))
-{
-    SET_by_offset(disp, _gloffset_BindVertexArrayAPPLE, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_DeleteVertexArraysAPPLE) (GLsizei,
-                                                           const GLuint *);
-#define CALL_DeleteVertexArraysAPPLE(disp, parameters) \
-    (* GET_DeleteVertexArraysAPPLE(disp)) parameters
-static inline _glptr_DeleteVertexArraysAPPLE
-GET_DeleteVertexArraysAPPLE(struct _glapi_table *disp)
-{
-    return (_glptr_DeleteVertexArraysAPPLE) (GET_by_offset
-                                             (disp,
-                                              _gloffset_DeleteVertexArraysAPPLE));
-}
-
-static inline void
-SET_DeleteVertexArraysAPPLE(struct _glapi_table *disp,
-                            void (GLAPIENTRYP fn) (GLsizei, const GLuint *))
-{
-    SET_by_offset(disp, _gloffset_DeleteVertexArraysAPPLE, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GenVertexArraysAPPLE) (GLsizei, GLuint *);
-
-#define CALL_GenVertexArraysAPPLE(disp, parameters) \
-    (* GET_GenVertexArraysAPPLE(disp)) parameters
-static inline _glptr_GenVertexArraysAPPLE
-GET_GenVertexArraysAPPLE(struct _glapi_table *disp)
-{
-    return (_glptr_GenVertexArraysAPPLE) (GET_by_offset
-                                          (disp,
-                                           _gloffset_GenVertexArraysAPPLE));
-}
-
-static inline void
-SET_GenVertexArraysAPPLE(struct _glapi_table *disp,
-                         void (GLAPIENTRYP fn) (GLsizei, GLuint *))
-{
-    SET_by_offset(disp, _gloffset_GenVertexArraysAPPLE, fn);
-}
-
-typedef GLboolean(GLAPIENTRYP _glptr_IsVertexArrayAPPLE) (GLuint);
-
-#define CALL_IsVertexArrayAPPLE(disp, parameters) \
-    (* GET_IsVertexArrayAPPLE(disp)) parameters
-static inline _glptr_IsVertexArrayAPPLE
-GET_IsVertexArrayAPPLE(struct _glapi_table *disp)
-{
-    return (_glptr_IsVertexArrayAPPLE) (GET_by_offset
-                                        (disp, _gloffset_IsVertexArrayAPPLE));
-}
-
-static inline void
-SET_IsVertexArrayAPPLE(struct _glapi_table *disp,
-                       GLboolean(GLAPIENTRYP fn) (GLuint))
-{
-    SET_by_offset(disp, _gloffset_IsVertexArrayAPPLE, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetProgramNamedParameterdvNV) (GLuint, GLsizei,
-                                                                const GLubyte *,
-                                                                GLdouble *);
-#define CALL_GetProgramNamedParameterdvNV(disp, parameters) \
-    (* GET_GetProgramNamedParameterdvNV(disp)) parameters
-static inline _glptr_GetProgramNamedParameterdvNV
-GET_GetProgramNamedParameterdvNV(struct _glapi_table *disp)
-{
-    return (_glptr_GetProgramNamedParameterdvNV) (GET_by_offset
-                                                  (disp,
-                                                   _gloffset_GetProgramNamedParameterdvNV));
-}
-
-static inline void
-SET_GetProgramNamedParameterdvNV(struct _glapi_table *disp,
-                                 void (GLAPIENTRYP fn) (GLuint, GLsizei,
-                                                        const GLubyte *,
-                                                        GLdouble *))
-{
-    SET_by_offset(disp, _gloffset_GetProgramNamedParameterdvNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetProgramNamedParameterfvNV) (GLuint, GLsizei,
-                                                                const GLubyte *,
-                                                                GLfloat *);
-#define CALL_GetProgramNamedParameterfvNV(disp, parameters) \
-    (* GET_GetProgramNamedParameterfvNV(disp)) parameters
-static inline _glptr_GetProgramNamedParameterfvNV
-GET_GetProgramNamedParameterfvNV(struct _glapi_table *disp)
-{
-    return (_glptr_GetProgramNamedParameterfvNV) (GET_by_offset
-                                                  (disp,
-                                                   _gloffset_GetProgramNamedParameterfvNV));
-}
-
-static inline void
-SET_GetProgramNamedParameterfvNV(struct _glapi_table *disp,
-                                 void (GLAPIENTRYP fn) (GLuint, GLsizei,
-                                                        const GLubyte *,
-                                                        GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_GetProgramNamedParameterfvNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ProgramNamedParameter4dNV) (GLuint, GLsizei,
-                                                             const GLubyte *,
-                                                             GLdouble, GLdouble,
-                                                             GLdouble,
-                                                             GLdouble);
-#define CALL_ProgramNamedParameter4dNV(disp, parameters) \
-    (* GET_ProgramNamedParameter4dNV(disp)) parameters
-static inline _glptr_ProgramNamedParameter4dNV
-GET_ProgramNamedParameter4dNV(struct _glapi_table *disp)
-{
-    return (_glptr_ProgramNamedParameter4dNV) (GET_by_offset
-                                               (disp,
-                                                _gloffset_ProgramNamedParameter4dNV));
-}
-
-static inline void
-SET_ProgramNamedParameter4dNV(struct _glapi_table *disp,
-                              void (GLAPIENTRYP fn) (GLuint, GLsizei,
-                                                     const GLubyte *, GLdouble,
-                                                     GLdouble, GLdouble,
-                                                     GLdouble))
-{
-    SET_by_offset(disp, _gloffset_ProgramNamedParameter4dNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ProgramNamedParameter4dvNV) (GLuint, GLsizei,
-                                                              const GLubyte *,
-                                                              const GLdouble *);
-#define CALL_ProgramNamedParameter4dvNV(disp, parameters) \
-    (* GET_ProgramNamedParameter4dvNV(disp)) parameters
-static inline _glptr_ProgramNamedParameter4dvNV
-GET_ProgramNamedParameter4dvNV(struct _glapi_table *disp)
-{
-    return (_glptr_ProgramNamedParameter4dvNV) (GET_by_offset
-                                                (disp,
-                                                 _gloffset_ProgramNamedParameter4dvNV));
-}
-
-static inline void
-SET_ProgramNamedParameter4dvNV(struct _glapi_table *disp,
-                               void (GLAPIENTRYP fn) (GLuint, GLsizei,
-                                                      const GLubyte *,
-                                                      const GLdouble *))
-{
-    SET_by_offset(disp, _gloffset_ProgramNamedParameter4dvNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ProgramNamedParameter4fNV) (GLuint, GLsizei,
-                                                             const GLubyte *,
-                                                             GLfloat, GLfloat,
-                                                             GLfloat, GLfloat);
-#define CALL_ProgramNamedParameter4fNV(disp, parameters) \
-    (* GET_ProgramNamedParameter4fNV(disp)) parameters
-static inline _glptr_ProgramNamedParameter4fNV
-GET_ProgramNamedParameter4fNV(struct _glapi_table *disp)
-{
-    return (_glptr_ProgramNamedParameter4fNV) (GET_by_offset
-                                               (disp,
-                                                _gloffset_ProgramNamedParameter4fNV));
-}
-
-static inline void
-SET_ProgramNamedParameter4fNV(struct _glapi_table *disp,
-                              void (GLAPIENTRYP fn) (GLuint, GLsizei,
-                                                     const GLubyte *, GLfloat,
-                                                     GLfloat, GLfloat, GLfloat))
-{
-    SET_by_offset(disp, _gloffset_ProgramNamedParameter4fNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ProgramNamedParameter4fvNV) (GLuint, GLsizei,
-                                                              const GLubyte *,
-                                                              const GLfloat *);
-#define CALL_ProgramNamedParameter4fvNV(disp, parameters) \
-    (* GET_ProgramNamedParameter4fvNV(disp)) parameters
-static inline _glptr_ProgramNamedParameter4fvNV
-GET_ProgramNamedParameter4fvNV(struct _glapi_table *disp)
-{
-    return (_glptr_ProgramNamedParameter4fvNV) (GET_by_offset
-                                                (disp,
-                                                 _gloffset_ProgramNamedParameter4fvNV));
-}
-
-static inline void
-SET_ProgramNamedParameter4fvNV(struct _glapi_table *disp,
-                               void (GLAPIENTRYP fn) (GLuint, GLsizei,
-                                                      const GLubyte *,
-                                                      const GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_ProgramNamedParameter4fvNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_PrimitiveRestartIndexNV) (GLuint);
-
-#define CALL_PrimitiveRestartIndexNV(disp, parameters) \
-    (* GET_PrimitiveRestartIndexNV(disp)) parameters
-static inline _glptr_PrimitiveRestartIndexNV
-GET_PrimitiveRestartIndexNV(struct _glapi_table *disp)
-{
-    return (_glptr_PrimitiveRestartIndexNV) (GET_by_offset
-                                             (disp,
-                                              _gloffset_PrimitiveRestartIndexNV));
-}
-
-static inline void
-SET_PrimitiveRestartIndexNV(struct _glapi_table *disp,
-                            void (GLAPIENTRYP fn) (GLuint))
-{
-    SET_by_offset(disp, _gloffset_PrimitiveRestartIndexNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_PrimitiveRestartNV) (void);
-
-#define CALL_PrimitiveRestartNV(disp, parameters) \
-    (* GET_PrimitiveRestartNV(disp)) parameters
-static inline _glptr_PrimitiveRestartNV
-GET_PrimitiveRestartNV(struct _glapi_table *disp)
-{
-    return (_glptr_PrimitiveRestartNV) (GET_by_offset
-                                        (disp, _gloffset_PrimitiveRestartNV));
-}
-
-static inline void
-SET_PrimitiveRestartNV(struct _glapi_table *disp, void (GLAPIENTRYP fn) (void))
-{
-    SET_by_offset(disp, _gloffset_PrimitiveRestartNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_DepthBoundsEXT) (GLclampd, GLclampd);
-
-#define CALL_DepthBoundsEXT(disp, parameters) \
-    (* GET_DepthBoundsEXT(disp)) parameters
-static inline _glptr_DepthBoundsEXT
-GET_DepthBoundsEXT(struct _glapi_table *disp)
-{
-    return (_glptr_DepthBoundsEXT) (GET_by_offset
-                                    (disp, _gloffset_DepthBoundsEXT));
-}
-
-static inline void
-SET_DepthBoundsEXT(struct _glapi_table *disp,
-                   void (GLAPIENTRYP fn) (GLclampd, GLclampd))
-{
-    SET_by_offset(disp, _gloffset_DepthBoundsEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_BlendEquationSeparateEXT) (GLenum, GLenum);
-
-#define CALL_BlendEquationSeparateEXT(disp, parameters) \
-    (* GET_BlendEquationSeparateEXT(disp)) parameters
-static inline _glptr_BlendEquationSeparateEXT
-GET_BlendEquationSeparateEXT(struct _glapi_table *disp)
-{
-    return (_glptr_BlendEquationSeparateEXT) (GET_by_offset
-                                              (disp,
-                                               _gloffset_BlendEquationSeparateEXT));
-}
-
-static inline void
-SET_BlendEquationSeparateEXT(struct _glapi_table *disp,
-                             void (GLAPIENTRYP fn) (GLenum, GLenum))
-{
-    SET_by_offset(disp, _gloffset_BlendEquationSeparateEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_BindFramebufferEXT) (GLenum, GLuint);
-
-#define CALL_BindFramebufferEXT(disp, parameters) \
-    (* GET_BindFramebufferEXT(disp)) parameters
-static inline _glptr_BindFramebufferEXT
-GET_BindFramebufferEXT(struct _glapi_table *disp)
-{
-    return (_glptr_BindFramebufferEXT) (GET_by_offset
-                                        (disp, _gloffset_BindFramebufferEXT));
-}
-
-static inline void
-SET_BindFramebufferEXT(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLenum, GLuint))
-{
-    SET_by_offset(disp, _gloffset_BindFramebufferEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_BindRenderbufferEXT) (GLenum, GLuint);
-
-#define CALL_BindRenderbufferEXT(disp, parameters) \
-    (* GET_BindRenderbufferEXT(disp)) parameters
-static inline _glptr_BindRenderbufferEXT
-GET_BindRenderbufferEXT(struct _glapi_table *disp)
-{
-    return (_glptr_BindRenderbufferEXT) (GET_by_offset
-                                         (disp, _gloffset_BindRenderbufferEXT));
-}
-
-static inline void
-SET_BindRenderbufferEXT(struct _glapi_table *disp,
-                        void (GLAPIENTRYP fn) (GLenum, GLuint))
-{
-    SET_by_offset(disp, _gloffset_BindRenderbufferEXT, fn);
-}
-
-typedef GLenum(GLAPIENTRYP _glptr_CheckFramebufferStatusEXT) (GLenum);
-
-#define CALL_CheckFramebufferStatusEXT(disp, parameters) \
-    (* GET_CheckFramebufferStatusEXT(disp)) parameters
-static inline _glptr_CheckFramebufferStatusEXT
-GET_CheckFramebufferStatusEXT(struct _glapi_table *disp)
-{
-    return (_glptr_CheckFramebufferStatusEXT) (GET_by_offset
-                                               (disp,
-                                                _gloffset_CheckFramebufferStatusEXT));
-}
-
-static inline void
-SET_CheckFramebufferStatusEXT(struct _glapi_table *disp,
-                              GLenum(GLAPIENTRYP fn) (GLenum))
-{
-    SET_by_offset(disp, _gloffset_CheckFramebufferStatusEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_DeleteFramebuffersEXT) (GLsizei,
-                                                         const GLuint *);
-#define CALL_DeleteFramebuffersEXT(disp, parameters) \
-    (* GET_DeleteFramebuffersEXT(disp)) parameters
-static inline _glptr_DeleteFramebuffersEXT
-GET_DeleteFramebuffersEXT(struct _glapi_table *disp)
-{
-    return (_glptr_DeleteFramebuffersEXT) (GET_by_offset
-                                           (disp,
-                                            _gloffset_DeleteFramebuffersEXT));
-}
-
-static inline void
-SET_DeleteFramebuffersEXT(struct _glapi_table *disp,
-                          void (GLAPIENTRYP fn) (GLsizei, const GLuint *))
-{
-    SET_by_offset(disp, _gloffset_DeleteFramebuffersEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_DeleteRenderbuffersEXT) (GLsizei,
-                                                          const GLuint *);
-#define CALL_DeleteRenderbuffersEXT(disp, parameters) \
-    (* GET_DeleteRenderbuffersEXT(disp)) parameters
-static inline _glptr_DeleteRenderbuffersEXT
-GET_DeleteRenderbuffersEXT(struct _glapi_table *disp)
-{
-    return (_glptr_DeleteRenderbuffersEXT) (GET_by_offset
-                                            (disp,
-                                             _gloffset_DeleteRenderbuffersEXT));
-}
-
-static inline void
-SET_DeleteRenderbuffersEXT(struct _glapi_table *disp,
-                           void (GLAPIENTRYP fn) (GLsizei, const GLuint *))
-{
-    SET_by_offset(disp, _gloffset_DeleteRenderbuffersEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_FramebufferRenderbufferEXT) (GLenum, GLenum,
-                                                              GLenum, GLuint);
-#define CALL_FramebufferRenderbufferEXT(disp, parameters) \
-    (* GET_FramebufferRenderbufferEXT(disp)) parameters
-static inline _glptr_FramebufferRenderbufferEXT
-GET_FramebufferRenderbufferEXT(struct _glapi_table *disp)
-{
-    return (_glptr_FramebufferRenderbufferEXT) (GET_by_offset
-                                                (disp,
-                                                 _gloffset_FramebufferRenderbufferEXT));
-}
-
-static inline void
-SET_FramebufferRenderbufferEXT(struct _glapi_table *disp,
-                               void (GLAPIENTRYP fn) (GLenum, GLenum, GLenum,
-                                                      GLuint))
-{
-    SET_by_offset(disp, _gloffset_FramebufferRenderbufferEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_FramebufferTexture1DEXT) (GLenum, GLenum,
-                                                           GLenum, GLuint,
-                                                           GLint);
-#define CALL_FramebufferTexture1DEXT(disp, parameters) \
-    (* GET_FramebufferTexture1DEXT(disp)) parameters
-static inline _glptr_FramebufferTexture1DEXT
-GET_FramebufferTexture1DEXT(struct _glapi_table *disp)
-{
-    return (_glptr_FramebufferTexture1DEXT) (GET_by_offset
-                                             (disp,
-                                              _gloffset_FramebufferTexture1DEXT));
-}
-
-static inline void
-SET_FramebufferTexture1DEXT(struct _glapi_table *disp,
-                            void (GLAPIENTRYP fn) (GLenum, GLenum, GLenum,
-                                                   GLuint, GLint))
-{
-    SET_by_offset(disp, _gloffset_FramebufferTexture1DEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_FramebufferTexture2DEXT) (GLenum, GLenum,
-                                                           GLenum, GLuint,
-                                                           GLint);
-#define CALL_FramebufferTexture2DEXT(disp, parameters) \
-    (* GET_FramebufferTexture2DEXT(disp)) parameters
-static inline _glptr_FramebufferTexture2DEXT
-GET_FramebufferTexture2DEXT(struct _glapi_table *disp)
-{
-    return (_glptr_FramebufferTexture2DEXT) (GET_by_offset
-                                             (disp,
-                                              _gloffset_FramebufferTexture2DEXT));
-}
-
-static inline void
-SET_FramebufferTexture2DEXT(struct _glapi_table *disp,
-                            void (GLAPIENTRYP fn) (GLenum, GLenum, GLenum,
-                                                   GLuint, GLint))
-{
-    SET_by_offset(disp, _gloffset_FramebufferTexture2DEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_FramebufferTexture3DEXT) (GLenum, GLenum,
-                                                           GLenum, GLuint,
-                                                           GLint, GLint);
-#define CALL_FramebufferTexture3DEXT(disp, parameters) \
-    (* GET_FramebufferTexture3DEXT(disp)) parameters
-static inline _glptr_FramebufferTexture3DEXT
-GET_FramebufferTexture3DEXT(struct _glapi_table *disp)
-{
-    return (_glptr_FramebufferTexture3DEXT) (GET_by_offset
-                                             (disp,
-                                              _gloffset_FramebufferTexture3DEXT));
-}
-
-static inline void
-SET_FramebufferTexture3DEXT(struct _glapi_table *disp,
-                            void (GLAPIENTRYP fn) (GLenum, GLenum, GLenum,
-                                                   GLuint, GLint, GLint))
-{
-    SET_by_offset(disp, _gloffset_FramebufferTexture3DEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GenFramebuffersEXT) (GLsizei, GLuint *);
-
-#define CALL_GenFramebuffersEXT(disp, parameters) \
-    (* GET_GenFramebuffersEXT(disp)) parameters
-static inline _glptr_GenFramebuffersEXT
-GET_GenFramebuffersEXT(struct _glapi_table *disp)
-{
-    return (_glptr_GenFramebuffersEXT) (GET_by_offset
-                                        (disp, _gloffset_GenFramebuffersEXT));
-}
-
-static inline void
-SET_GenFramebuffersEXT(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLsizei, GLuint *))
-{
-    SET_by_offset(disp, _gloffset_GenFramebuffersEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GenRenderbuffersEXT) (GLsizei, GLuint *);
-
-#define CALL_GenRenderbuffersEXT(disp, parameters) \
-    (* GET_GenRenderbuffersEXT(disp)) parameters
-static inline _glptr_GenRenderbuffersEXT
-GET_GenRenderbuffersEXT(struct _glapi_table *disp)
-{
-    return (_glptr_GenRenderbuffersEXT) (GET_by_offset
-                                         (disp, _gloffset_GenRenderbuffersEXT));
-}
-
-static inline void
-SET_GenRenderbuffersEXT(struct _glapi_table *disp,
-                        void (GLAPIENTRYP fn) (GLsizei, GLuint *))
-{
-    SET_by_offset(disp, _gloffset_GenRenderbuffersEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GenerateMipmapEXT) (GLenum);
-
-#define CALL_GenerateMipmapEXT(disp, parameters) \
-    (* GET_GenerateMipmapEXT(disp)) parameters
-static inline _glptr_GenerateMipmapEXT
-GET_GenerateMipmapEXT(struct _glapi_table *disp)
-{
-    return (_glptr_GenerateMipmapEXT) (GET_by_offset
-                                       (disp, _gloffset_GenerateMipmapEXT));
-}
-
-static inline void
-SET_GenerateMipmapEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn) (GLenum))
-{
-    SET_by_offset(disp, _gloffset_GenerateMipmapEXT, fn);
-}
-
-typedef void (GLAPIENTRYP
-              _glptr_GetFramebufferAttachmentParameterivEXT) (GLenum, GLenum,
-                                                              GLenum, GLint *);
-#define CALL_GetFramebufferAttachmentParameterivEXT(disp, parameters) \
-    (* GET_GetFramebufferAttachmentParameterivEXT(disp)) parameters
-static inline _glptr_GetFramebufferAttachmentParameterivEXT
-GET_GetFramebufferAttachmentParameterivEXT(struct _glapi_table *disp)
-{
-    return (_glptr_GetFramebufferAttachmentParameterivEXT) (GET_by_offset
-                                                            (disp,
-                                                             _gloffset_GetFramebufferAttachmentParameterivEXT));
-}
-
-static inline void
-SET_GetFramebufferAttachmentParameterivEXT(struct _glapi_table *disp,
-                                           void (GLAPIENTRYP fn) (GLenum,
-                                                                  GLenum,
-                                                                  GLenum,
-                                                                  GLint *))
-{
-    SET_by_offset(disp, _gloffset_GetFramebufferAttachmentParameterivEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetRenderbufferParameterivEXT) (GLenum, GLenum,
-                                                                 GLint *);
-#define CALL_GetRenderbufferParameterivEXT(disp, parameters) \
-    (* GET_GetRenderbufferParameterivEXT(disp)) parameters
-static inline _glptr_GetRenderbufferParameterivEXT
-GET_GetRenderbufferParameterivEXT(struct _glapi_table *disp)
-{
-    return (_glptr_GetRenderbufferParameterivEXT) (GET_by_offset
-                                                   (disp,
-                                                    _gloffset_GetRenderbufferParameterivEXT));
-}
-
-static inline void
-SET_GetRenderbufferParameterivEXT(struct _glapi_table *disp,
-                                  void (GLAPIENTRYP fn) (GLenum, GLenum,
-                                                         GLint *))
-{
-    SET_by_offset(disp, _gloffset_GetRenderbufferParameterivEXT, fn);
-}
-
-typedef GLboolean(GLAPIENTRYP _glptr_IsFramebufferEXT) (GLuint);
-
-#define CALL_IsFramebufferEXT(disp, parameters) \
-    (* GET_IsFramebufferEXT(disp)) parameters
-static inline _glptr_IsFramebufferEXT
-GET_IsFramebufferEXT(struct _glapi_table *disp)
-{
-    return (_glptr_IsFramebufferEXT) (GET_by_offset
-                                      (disp, _gloffset_IsFramebufferEXT));
-}
-
-static inline void
-SET_IsFramebufferEXT(struct _glapi_table *disp,
-                     GLboolean(GLAPIENTRYP fn) (GLuint))
-{
-    SET_by_offset(disp, _gloffset_IsFramebufferEXT, fn);
-}
-
-typedef GLboolean(GLAPIENTRYP _glptr_IsRenderbufferEXT) (GLuint);
-
-#define CALL_IsRenderbufferEXT(disp, parameters) \
-    (* GET_IsRenderbufferEXT(disp)) parameters
-static inline _glptr_IsRenderbufferEXT
-GET_IsRenderbufferEXT(struct _glapi_table *disp)
-{
-    return (_glptr_IsRenderbufferEXT) (GET_by_offset
-                                       (disp, _gloffset_IsRenderbufferEXT));
-}
-
-static inline void
-SET_IsRenderbufferEXT(struct _glapi_table *disp,
-                      GLboolean(GLAPIENTRYP fn) (GLuint))
-{
-    SET_by_offset(disp, _gloffset_IsRenderbufferEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_RenderbufferStorageEXT) (GLenum, GLenum,
-                                                          GLsizei, GLsizei);
-#define CALL_RenderbufferStorageEXT(disp, parameters) \
-    (* GET_RenderbufferStorageEXT(disp)) parameters
-static inline _glptr_RenderbufferStorageEXT
-GET_RenderbufferStorageEXT(struct _glapi_table *disp)
-{
-    return (_glptr_RenderbufferStorageEXT) (GET_by_offset
-                                            (disp,
-                                             _gloffset_RenderbufferStorageEXT));
-}
-
-static inline void
-SET_RenderbufferStorageEXT(struct _glapi_table *disp,
-                           void (GLAPIENTRYP fn) (GLenum, GLenum, GLsizei,
-                                                  GLsizei))
-{
-    SET_by_offset(disp, _gloffset_RenderbufferStorageEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_BlitFramebufferEXT) (GLint, GLint, GLint,
-                                                      GLint, GLint, GLint,
-                                                      GLint, GLint, GLbitfield,
-                                                      GLenum);
-#define CALL_BlitFramebufferEXT(disp, parameters) \
-    (* GET_BlitFramebufferEXT(disp)) parameters
-static inline _glptr_BlitFramebufferEXT
-GET_BlitFramebufferEXT(struct _glapi_table *disp)
-{
-    return (_glptr_BlitFramebufferEXT) (GET_by_offset
-                                        (disp, _gloffset_BlitFramebufferEXT));
-}
-
-static inline void
-SET_BlitFramebufferEXT(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLint, GLint, GLint, GLint, GLint,
-                                              GLint, GLint, GLint, GLbitfield,
-                                              GLenum))
-{
-    SET_by_offset(disp, _gloffset_BlitFramebufferEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_BufferParameteriAPPLE) (GLenum, GLenum, GLint);
-
-#define CALL_BufferParameteriAPPLE(disp, parameters) \
-    (* GET_BufferParameteriAPPLE(disp)) parameters
-static inline _glptr_BufferParameteriAPPLE
-GET_BufferParameteriAPPLE(struct _glapi_table *disp)
-{
-    return (_glptr_BufferParameteriAPPLE) (GET_by_offset
-                                           (disp,
-                                            _gloffset_BufferParameteriAPPLE));
-}
-
-static inline void
-SET_BufferParameteriAPPLE(struct _glapi_table *disp,
-                          void (GLAPIENTRYP fn) (GLenum, GLenum, GLint))
-{
-    SET_by_offset(disp, _gloffset_BufferParameteriAPPLE, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_FlushMappedBufferRangeAPPLE) (GLenum, GLintptr,
-                                                               GLsizeiptr);
-#define CALL_FlushMappedBufferRangeAPPLE(disp, parameters) \
-    (* GET_FlushMappedBufferRangeAPPLE(disp)) parameters
-static inline _glptr_FlushMappedBufferRangeAPPLE
-GET_FlushMappedBufferRangeAPPLE(struct _glapi_table *disp)
-{
-    return (_glptr_FlushMappedBufferRangeAPPLE) (GET_by_offset
-                                                 (disp,
-                                                  _gloffset_FlushMappedBufferRangeAPPLE));
-}
-
-static inline void
-SET_FlushMappedBufferRangeAPPLE(struct _glapi_table *disp,
-                                void (GLAPIENTRYP fn) (GLenum, GLintptr,
-                                                       GLsizeiptr))
-{
-    SET_by_offset(disp, _gloffset_FlushMappedBufferRangeAPPLE, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_BindFragDataLocationEXT) (GLuint, GLuint,
-                                                           const GLchar *);
-#define CALL_BindFragDataLocationEXT(disp, parameters) \
-    (* GET_BindFragDataLocationEXT(disp)) parameters
-static inline _glptr_BindFragDataLocationEXT
-GET_BindFragDataLocationEXT(struct _glapi_table *disp)
-{
-    return (_glptr_BindFragDataLocationEXT) (GET_by_offset
-                                             (disp,
-                                              _gloffset_BindFragDataLocationEXT));
-}
-
-static inline void
-SET_BindFragDataLocationEXT(struct _glapi_table *disp,
-                            void (GLAPIENTRYP fn) (GLuint, GLuint,
-                                                   const GLchar *))
-{
-    SET_by_offset(disp, _gloffset_BindFragDataLocationEXT, fn);
-}
-
-typedef GLint(GLAPIENTRYP _glptr_GetFragDataLocationEXT) (GLuint,
-                                                          const GLchar *);
-#define CALL_GetFragDataLocationEXT(disp, parameters) \
-    (* GET_GetFragDataLocationEXT(disp)) parameters
-static inline _glptr_GetFragDataLocationEXT
-GET_GetFragDataLocationEXT(struct _glapi_table *disp)
-{
-    return (_glptr_GetFragDataLocationEXT) (GET_by_offset
-                                            (disp,
-                                             _gloffset_GetFragDataLocationEXT));
-}
-
-static inline void
-SET_GetFragDataLocationEXT(struct _glapi_table *disp,
-                           GLint(GLAPIENTRYP fn) (GLuint, const GLchar *))
-{
-    SET_by_offset(disp, _gloffset_GetFragDataLocationEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetUniformuivEXT) (GLuint, GLint, GLuint *);
-
-#define CALL_GetUniformuivEXT(disp, parameters) \
-    (* GET_GetUniformuivEXT(disp)) parameters
-static inline _glptr_GetUniformuivEXT
-GET_GetUniformuivEXT(struct _glapi_table *disp)
-{
-    return (_glptr_GetUniformuivEXT) (GET_by_offset
-                                      (disp, _gloffset_GetUniformuivEXT));
-}
-
-static inline void
-SET_GetUniformuivEXT(struct _glapi_table *disp,
-                     void (GLAPIENTRYP fn) (GLuint, GLint, GLuint *))
-{
-    SET_by_offset(disp, _gloffset_GetUniformuivEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetVertexAttribIivEXT) (GLuint, GLenum,
-                                                         GLint *);
-#define CALL_GetVertexAttribIivEXT(disp, parameters) \
-    (* GET_GetVertexAttribIivEXT(disp)) parameters
-static inline _glptr_GetVertexAttribIivEXT
-GET_GetVertexAttribIivEXT(struct _glapi_table *disp)
-{
-    return (_glptr_GetVertexAttribIivEXT) (GET_by_offset
-                                           (disp,
-                                            _gloffset_GetVertexAttribIivEXT));
-}
-
-static inline void
-SET_GetVertexAttribIivEXT(struct _glapi_table *disp,
-                          void (GLAPIENTRYP fn) (GLuint, GLenum, GLint *))
-{
-    SET_by_offset(disp, _gloffset_GetVertexAttribIivEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetVertexAttribIuivEXT) (GLuint, GLenum,
-                                                          GLuint *);
-#define CALL_GetVertexAttribIuivEXT(disp, parameters) \
-    (* GET_GetVertexAttribIuivEXT(disp)) parameters
-static inline _glptr_GetVertexAttribIuivEXT
-GET_GetVertexAttribIuivEXT(struct _glapi_table *disp)
-{
-    return (_glptr_GetVertexAttribIuivEXT) (GET_by_offset
-                                            (disp,
-                                             _gloffset_GetVertexAttribIuivEXT));
-}
-
-static inline void
-SET_GetVertexAttribIuivEXT(struct _glapi_table *disp,
-                           void (GLAPIENTRYP fn) (GLuint, GLenum, GLuint *))
-{
-    SET_by_offset(disp, _gloffset_GetVertexAttribIuivEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Uniform1uiEXT) (GLint, GLuint);
-
-#define CALL_Uniform1uiEXT(disp, parameters) \
-    (* GET_Uniform1uiEXT(disp)) parameters
-static inline _glptr_Uniform1uiEXT
-GET_Uniform1uiEXT(struct _glapi_table *disp)
-{
-    return (_glptr_Uniform1uiEXT) (GET_by_offset
-                                   (disp, _gloffset_Uniform1uiEXT));
-}
-
-static inline void
-SET_Uniform1uiEXT(struct _glapi_table *disp,
-                  void (GLAPIENTRYP fn) (GLint, GLuint))
-{
-    SET_by_offset(disp, _gloffset_Uniform1uiEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Uniform1uivEXT) (GLint, GLsizei,
-                                                  const GLuint *);
-#define CALL_Uniform1uivEXT(disp, parameters) \
-    (* GET_Uniform1uivEXT(disp)) parameters
-static inline _glptr_Uniform1uivEXT
-GET_Uniform1uivEXT(struct _glapi_table *disp)
-{
-    return (_glptr_Uniform1uivEXT) (GET_by_offset
-                                    (disp, _gloffset_Uniform1uivEXT));
-}
-
-static inline void
-SET_Uniform1uivEXT(struct _glapi_table *disp,
-                   void (GLAPIENTRYP fn) (GLint, GLsizei, const GLuint *))
-{
-    SET_by_offset(disp, _gloffset_Uniform1uivEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Uniform2uiEXT) (GLint, GLuint, GLuint);
-
-#define CALL_Uniform2uiEXT(disp, parameters) \
-    (* GET_Uniform2uiEXT(disp)) parameters
-static inline _glptr_Uniform2uiEXT
-GET_Uniform2uiEXT(struct _glapi_table *disp)
-{
-    return (_glptr_Uniform2uiEXT) (GET_by_offset
-                                   (disp, _gloffset_Uniform2uiEXT));
-}
-
-static inline void
-SET_Uniform2uiEXT(struct _glapi_table *disp,
-                  void (GLAPIENTRYP fn) (GLint, GLuint, GLuint))
-{
-    SET_by_offset(disp, _gloffset_Uniform2uiEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Uniform2uivEXT) (GLint, GLsizei,
-                                                  const GLuint *);
-#define CALL_Uniform2uivEXT(disp, parameters) \
-    (* GET_Uniform2uivEXT(disp)) parameters
-static inline _glptr_Uniform2uivEXT
-GET_Uniform2uivEXT(struct _glapi_table *disp)
-{
-    return (_glptr_Uniform2uivEXT) (GET_by_offset
-                                    (disp, _gloffset_Uniform2uivEXT));
-}
-
-static inline void
-SET_Uniform2uivEXT(struct _glapi_table *disp,
-                   void (GLAPIENTRYP fn) (GLint, GLsizei, const GLuint *))
-{
-    SET_by_offset(disp, _gloffset_Uniform2uivEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Uniform3uiEXT) (GLint, GLuint, GLuint, GLuint);
-
-#define CALL_Uniform3uiEXT(disp, parameters) \
-    (* GET_Uniform3uiEXT(disp)) parameters
-static inline _glptr_Uniform3uiEXT
-GET_Uniform3uiEXT(struct _glapi_table *disp)
-{
-    return (_glptr_Uniform3uiEXT) (GET_by_offset
-                                   (disp, _gloffset_Uniform3uiEXT));
-}
-
-static inline void
-SET_Uniform3uiEXT(struct _glapi_table *disp,
-                  void (GLAPIENTRYP fn) (GLint, GLuint, GLuint, GLuint))
-{
-    SET_by_offset(disp, _gloffset_Uniform3uiEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Uniform3uivEXT) (GLint, GLsizei,
-                                                  const GLuint *);
-#define CALL_Uniform3uivEXT(disp, parameters) \
-    (* GET_Uniform3uivEXT(disp)) parameters
-static inline _glptr_Uniform3uivEXT
-GET_Uniform3uivEXT(struct _glapi_table *disp)
-{
-    return (_glptr_Uniform3uivEXT) (GET_by_offset
-                                    (disp, _gloffset_Uniform3uivEXT));
-}
-
-static inline void
-SET_Uniform3uivEXT(struct _glapi_table *disp,
-                   void (GLAPIENTRYP fn) (GLint, GLsizei, const GLuint *))
-{
-    SET_by_offset(disp, _gloffset_Uniform3uivEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Uniform4uiEXT) (GLint, GLuint, GLuint, GLuint,
-                                                 GLuint);
-#define CALL_Uniform4uiEXT(disp, parameters) \
-    (* GET_Uniform4uiEXT(disp)) parameters
-static inline _glptr_Uniform4uiEXT
-GET_Uniform4uiEXT(struct _glapi_table *disp)
-{
-    return (_glptr_Uniform4uiEXT) (GET_by_offset
-                                   (disp, _gloffset_Uniform4uiEXT));
-}
-
-static inline void
-SET_Uniform4uiEXT(struct _glapi_table *disp,
-                  void (GLAPIENTRYP fn) (GLint, GLuint, GLuint, GLuint, GLuint))
-{
-    SET_by_offset(disp, _gloffset_Uniform4uiEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_Uniform4uivEXT) (GLint, GLsizei,
-                                                  const GLuint *);
-#define CALL_Uniform4uivEXT(disp, parameters) \
-    (* GET_Uniform4uivEXT(disp)) parameters
-static inline _glptr_Uniform4uivEXT
-GET_Uniform4uivEXT(struct _glapi_table *disp)
-{
-    return (_glptr_Uniform4uivEXT) (GET_by_offset
-                                    (disp, _gloffset_Uniform4uivEXT));
-}
-
-static inline void
-SET_Uniform4uivEXT(struct _glapi_table *disp,
-                   void (GLAPIENTRYP fn) (GLint, GLsizei, const GLuint *))
-{
-    SET_by_offset(disp, _gloffset_Uniform4uivEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribI1iEXT) (GLuint, GLint);
-
-#define CALL_VertexAttribI1iEXT(disp, parameters) \
-    (* GET_VertexAttribI1iEXT(disp)) parameters
-static inline _glptr_VertexAttribI1iEXT
-GET_VertexAttribI1iEXT(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttribI1iEXT) (GET_by_offset
-                                        (disp, _gloffset_VertexAttribI1iEXT));
-}
-
-static inline void
-SET_VertexAttribI1iEXT(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLuint, GLint))
-{
-    SET_by_offset(disp, _gloffset_VertexAttribI1iEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribI1ivEXT) (GLuint, const GLint *);
-
-#define CALL_VertexAttribI1ivEXT(disp, parameters) \
-    (* GET_VertexAttribI1ivEXT(disp)) parameters
-static inline _glptr_VertexAttribI1ivEXT
-GET_VertexAttribI1ivEXT(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttribI1ivEXT) (GET_by_offset
-                                         (disp, _gloffset_VertexAttribI1ivEXT));
-}
-
-static inline void
-SET_VertexAttribI1ivEXT(struct _glapi_table *disp,
-                        void (GLAPIENTRYP fn) (GLuint, const GLint *))
-{
-    SET_by_offset(disp, _gloffset_VertexAttribI1ivEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribI1uiEXT) (GLuint, GLuint);
-
-#define CALL_VertexAttribI1uiEXT(disp, parameters) \
-    (* GET_VertexAttribI1uiEXT(disp)) parameters
-static inline _glptr_VertexAttribI1uiEXT
-GET_VertexAttribI1uiEXT(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttribI1uiEXT) (GET_by_offset
-                                         (disp, _gloffset_VertexAttribI1uiEXT));
-}
-
-static inline void
-SET_VertexAttribI1uiEXT(struct _glapi_table *disp,
-                        void (GLAPIENTRYP fn) (GLuint, GLuint))
-{
-    SET_by_offset(disp, _gloffset_VertexAttribI1uiEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribI1uivEXT) (GLuint, const GLuint *);
-
-#define CALL_VertexAttribI1uivEXT(disp, parameters) \
-    (* GET_VertexAttribI1uivEXT(disp)) parameters
-static inline _glptr_VertexAttribI1uivEXT
-GET_VertexAttribI1uivEXT(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttribI1uivEXT) (GET_by_offset
-                                          (disp,
-                                           _gloffset_VertexAttribI1uivEXT));
-}
-
-static inline void
-SET_VertexAttribI1uivEXT(struct _glapi_table *disp,
-                         void (GLAPIENTRYP fn) (GLuint, const GLuint *))
-{
-    SET_by_offset(disp, _gloffset_VertexAttribI1uivEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribI2iEXT) (GLuint, GLint, GLint);
-
-#define CALL_VertexAttribI2iEXT(disp, parameters) \
-    (* GET_VertexAttribI2iEXT(disp)) parameters
-static inline _glptr_VertexAttribI2iEXT
-GET_VertexAttribI2iEXT(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttribI2iEXT) (GET_by_offset
-                                        (disp, _gloffset_VertexAttribI2iEXT));
-}
-
-static inline void
-SET_VertexAttribI2iEXT(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLuint, GLint, GLint))
-{
-    SET_by_offset(disp, _gloffset_VertexAttribI2iEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribI2ivEXT) (GLuint, const GLint *);
-
-#define CALL_VertexAttribI2ivEXT(disp, parameters) \
-    (* GET_VertexAttribI2ivEXT(disp)) parameters
-static inline _glptr_VertexAttribI2ivEXT
-GET_VertexAttribI2ivEXT(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttribI2ivEXT) (GET_by_offset
-                                         (disp, _gloffset_VertexAttribI2ivEXT));
-}
-
-static inline void
-SET_VertexAttribI2ivEXT(struct _glapi_table *disp,
-                        void (GLAPIENTRYP fn) (GLuint, const GLint *))
-{
-    SET_by_offset(disp, _gloffset_VertexAttribI2ivEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribI2uiEXT) (GLuint, GLuint, GLuint);
-
-#define CALL_VertexAttribI2uiEXT(disp, parameters) \
-    (* GET_VertexAttribI2uiEXT(disp)) parameters
-static inline _glptr_VertexAttribI2uiEXT
-GET_VertexAttribI2uiEXT(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttribI2uiEXT) (GET_by_offset
-                                         (disp, _gloffset_VertexAttribI2uiEXT));
-}
-
-static inline void
-SET_VertexAttribI2uiEXT(struct _glapi_table *disp,
-                        void (GLAPIENTRYP fn) (GLuint, GLuint, GLuint))
-{
-    SET_by_offset(disp, _gloffset_VertexAttribI2uiEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribI2uivEXT) (GLuint, const GLuint *);
-
-#define CALL_VertexAttribI2uivEXT(disp, parameters) \
-    (* GET_VertexAttribI2uivEXT(disp)) parameters
-static inline _glptr_VertexAttribI2uivEXT
-GET_VertexAttribI2uivEXT(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttribI2uivEXT) (GET_by_offset
-                                          (disp,
-                                           _gloffset_VertexAttribI2uivEXT));
-}
-
-static inline void
-SET_VertexAttribI2uivEXT(struct _glapi_table *disp,
-                         void (GLAPIENTRYP fn) (GLuint, const GLuint *))
-{
-    SET_by_offset(disp, _gloffset_VertexAttribI2uivEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribI3iEXT) (GLuint, GLint, GLint,
-                                                      GLint);
-#define CALL_VertexAttribI3iEXT(disp, parameters) \
-    (* GET_VertexAttribI3iEXT(disp)) parameters
-static inline _glptr_VertexAttribI3iEXT
-GET_VertexAttribI3iEXT(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttribI3iEXT) (GET_by_offset
-                                        (disp, _gloffset_VertexAttribI3iEXT));
-}
-
-static inline void
-SET_VertexAttribI3iEXT(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLuint, GLint, GLint, GLint))
-{
-    SET_by_offset(disp, _gloffset_VertexAttribI3iEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribI3ivEXT) (GLuint, const GLint *);
-
-#define CALL_VertexAttribI3ivEXT(disp, parameters) \
-    (* GET_VertexAttribI3ivEXT(disp)) parameters
-static inline _glptr_VertexAttribI3ivEXT
-GET_VertexAttribI3ivEXT(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttribI3ivEXT) (GET_by_offset
-                                         (disp, _gloffset_VertexAttribI3ivEXT));
-}
-
-static inline void
-SET_VertexAttribI3ivEXT(struct _glapi_table *disp,
-                        void (GLAPIENTRYP fn) (GLuint, const GLint *))
-{
-    SET_by_offset(disp, _gloffset_VertexAttribI3ivEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribI3uiEXT) (GLuint, GLuint, GLuint,
-                                                       GLuint);
-#define CALL_VertexAttribI3uiEXT(disp, parameters) \
-    (* GET_VertexAttribI3uiEXT(disp)) parameters
-static inline _glptr_VertexAttribI3uiEXT
-GET_VertexAttribI3uiEXT(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttribI3uiEXT) (GET_by_offset
-                                         (disp, _gloffset_VertexAttribI3uiEXT));
-}
-
-static inline void
-SET_VertexAttribI3uiEXT(struct _glapi_table *disp,
-                        void (GLAPIENTRYP fn) (GLuint, GLuint, GLuint, GLuint))
-{
-    SET_by_offset(disp, _gloffset_VertexAttribI3uiEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribI3uivEXT) (GLuint, const GLuint *);
-
-#define CALL_VertexAttribI3uivEXT(disp, parameters) \
-    (* GET_VertexAttribI3uivEXT(disp)) parameters
-static inline _glptr_VertexAttribI3uivEXT
-GET_VertexAttribI3uivEXT(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttribI3uivEXT) (GET_by_offset
-                                          (disp,
-                                           _gloffset_VertexAttribI3uivEXT));
-}
-
-static inline void
-SET_VertexAttribI3uivEXT(struct _glapi_table *disp,
-                         void (GLAPIENTRYP fn) (GLuint, const GLuint *))
-{
-    SET_by_offset(disp, _gloffset_VertexAttribI3uivEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribI4bvEXT) (GLuint, const GLbyte *);
-
-#define CALL_VertexAttribI4bvEXT(disp, parameters) \
-    (* GET_VertexAttribI4bvEXT(disp)) parameters
-static inline _glptr_VertexAttribI4bvEXT
-GET_VertexAttribI4bvEXT(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttribI4bvEXT) (GET_by_offset
-                                         (disp, _gloffset_VertexAttribI4bvEXT));
-}
-
-static inline void
-SET_VertexAttribI4bvEXT(struct _glapi_table *disp,
-                        void (GLAPIENTRYP fn) (GLuint, const GLbyte *))
-{
-    SET_by_offset(disp, _gloffset_VertexAttribI4bvEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribI4iEXT) (GLuint, GLint, GLint,
-                                                      GLint, GLint);
-#define CALL_VertexAttribI4iEXT(disp, parameters) \
-    (* GET_VertexAttribI4iEXT(disp)) parameters
-static inline _glptr_VertexAttribI4iEXT
-GET_VertexAttribI4iEXT(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttribI4iEXT) (GET_by_offset
-                                        (disp, _gloffset_VertexAttribI4iEXT));
-}
-
-static inline void
-SET_VertexAttribI4iEXT(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLuint, GLint, GLint, GLint,
-                                              GLint))
-{
-    SET_by_offset(disp, _gloffset_VertexAttribI4iEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribI4ivEXT) (GLuint, const GLint *);
-
-#define CALL_VertexAttribI4ivEXT(disp, parameters) \
-    (* GET_VertexAttribI4ivEXT(disp)) parameters
-static inline _glptr_VertexAttribI4ivEXT
-GET_VertexAttribI4ivEXT(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttribI4ivEXT) (GET_by_offset
-                                         (disp, _gloffset_VertexAttribI4ivEXT));
-}
-
-static inline void
-SET_VertexAttribI4ivEXT(struct _glapi_table *disp,
-                        void (GLAPIENTRYP fn) (GLuint, const GLint *))
-{
-    SET_by_offset(disp, _gloffset_VertexAttribI4ivEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribI4svEXT) (GLuint, const GLshort *);
-
-#define CALL_VertexAttribI4svEXT(disp, parameters) \
-    (* GET_VertexAttribI4svEXT(disp)) parameters
-static inline _glptr_VertexAttribI4svEXT
-GET_VertexAttribI4svEXT(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttribI4svEXT) (GET_by_offset
-                                         (disp, _gloffset_VertexAttribI4svEXT));
-}
-
-static inline void
-SET_VertexAttribI4svEXT(struct _glapi_table *disp,
-                        void (GLAPIENTRYP fn) (GLuint, const GLshort *))
-{
-    SET_by_offset(disp, _gloffset_VertexAttribI4svEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribI4ubvEXT) (GLuint,
-                                                        const GLubyte *);
-#define CALL_VertexAttribI4ubvEXT(disp, parameters) \
-    (* GET_VertexAttribI4ubvEXT(disp)) parameters
-static inline _glptr_VertexAttribI4ubvEXT
-GET_VertexAttribI4ubvEXT(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttribI4ubvEXT) (GET_by_offset
-                                          (disp,
-                                           _gloffset_VertexAttribI4ubvEXT));
-}
-
-static inline void
-SET_VertexAttribI4ubvEXT(struct _glapi_table *disp,
-                         void (GLAPIENTRYP fn) (GLuint, const GLubyte *))
-{
-    SET_by_offset(disp, _gloffset_VertexAttribI4ubvEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribI4uiEXT) (GLuint, GLuint, GLuint,
-                                                       GLuint, GLuint);
-#define CALL_VertexAttribI4uiEXT(disp, parameters) \
-    (* GET_VertexAttribI4uiEXT(disp)) parameters
-static inline _glptr_VertexAttribI4uiEXT
-GET_VertexAttribI4uiEXT(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttribI4uiEXT) (GET_by_offset
-                                         (disp, _gloffset_VertexAttribI4uiEXT));
-}
-
-static inline void
-SET_VertexAttribI4uiEXT(struct _glapi_table *disp,
-                        void (GLAPIENTRYP fn) (GLuint, GLuint, GLuint, GLuint,
-                                               GLuint))
-{
-    SET_by_offset(disp, _gloffset_VertexAttribI4uiEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribI4uivEXT) (GLuint, const GLuint *);
-
-#define CALL_VertexAttribI4uivEXT(disp, parameters) \
-    (* GET_VertexAttribI4uivEXT(disp)) parameters
-static inline _glptr_VertexAttribI4uivEXT
-GET_VertexAttribI4uivEXT(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttribI4uivEXT) (GET_by_offset
-                                          (disp,
-                                           _gloffset_VertexAttribI4uivEXT));
-}
-
-static inline void
-SET_VertexAttribI4uivEXT(struct _glapi_table *disp,
-                         void (GLAPIENTRYP fn) (GLuint, const GLuint *))
-{
-    SET_by_offset(disp, _gloffset_VertexAttribI4uivEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribI4usvEXT) (GLuint,
-                                                        const GLushort *);
-#define CALL_VertexAttribI4usvEXT(disp, parameters) \
-    (* GET_VertexAttribI4usvEXT(disp)) parameters
-static inline _glptr_VertexAttribI4usvEXT
-GET_VertexAttribI4usvEXT(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttribI4usvEXT) (GET_by_offset
-                                          (disp,
-                                           _gloffset_VertexAttribI4usvEXT));
-}
-
-static inline void
-SET_VertexAttribI4usvEXT(struct _glapi_table *disp,
-                         void (GLAPIENTRYP fn) (GLuint, const GLushort *))
-{
-    SET_by_offset(disp, _gloffset_VertexAttribI4usvEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_VertexAttribIPointerEXT) (GLuint, GLint,
-                                                           GLenum, GLsizei,
-                                                           const GLvoid *);
-#define CALL_VertexAttribIPointerEXT(disp, parameters) \
-    (* GET_VertexAttribIPointerEXT(disp)) parameters
-static inline _glptr_VertexAttribIPointerEXT
-GET_VertexAttribIPointerEXT(struct _glapi_table *disp)
-{
-    return (_glptr_VertexAttribIPointerEXT) (GET_by_offset
-                                             (disp,
-                                              _gloffset_VertexAttribIPointerEXT));
-}
-
-static inline void
-SET_VertexAttribIPointerEXT(struct _glapi_table *disp,
-                            void (GLAPIENTRYP fn) (GLuint, GLint, GLenum,
-                                                   GLsizei, const GLvoid *))
-{
-    SET_by_offset(disp, _gloffset_VertexAttribIPointerEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_FramebufferTextureLayerEXT) (GLenum, GLenum,
-                                                              GLuint, GLint,
-                                                              GLint);
-#define CALL_FramebufferTextureLayerEXT(disp, parameters) \
-    (* GET_FramebufferTextureLayerEXT(disp)) parameters
-static inline _glptr_FramebufferTextureLayerEXT
-GET_FramebufferTextureLayerEXT(struct _glapi_table *disp)
-{
-    return (_glptr_FramebufferTextureLayerEXT) (GET_by_offset
-                                                (disp,
-                                                 _gloffset_FramebufferTextureLayerEXT));
-}
-
-static inline void
-SET_FramebufferTextureLayerEXT(struct _glapi_table *disp,
-                               void (GLAPIENTRYP fn) (GLenum, GLenum, GLuint,
-                                                      GLint, GLint))
-{
-    SET_by_offset(disp, _gloffset_FramebufferTextureLayerEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ColorMaskIndexedEXT) (GLuint, GLboolean,
-                                                       GLboolean, GLboolean,
-                                                       GLboolean);
-#define CALL_ColorMaskIndexedEXT(disp, parameters) \
-    (* GET_ColorMaskIndexedEXT(disp)) parameters
-static inline _glptr_ColorMaskIndexedEXT
-GET_ColorMaskIndexedEXT(struct _glapi_table *disp)
-{
-    return (_glptr_ColorMaskIndexedEXT) (GET_by_offset
-                                         (disp, _gloffset_ColorMaskIndexedEXT));
-}
-
-static inline void
-SET_ColorMaskIndexedEXT(struct _glapi_table *disp,
-                        void (GLAPIENTRYP fn) (GLuint, GLboolean, GLboolean,
-                                               GLboolean, GLboolean))
-{
-    SET_by_offset(disp, _gloffset_ColorMaskIndexedEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_DisableIndexedEXT) (GLenum, GLuint);
-
-#define CALL_DisableIndexedEXT(disp, parameters) \
-    (* GET_DisableIndexedEXT(disp)) parameters
-static inline _glptr_DisableIndexedEXT
-GET_DisableIndexedEXT(struct _glapi_table *disp)
-{
-    return (_glptr_DisableIndexedEXT) (GET_by_offset
-                                       (disp, _gloffset_DisableIndexedEXT));
-}
-
-static inline void
-SET_DisableIndexedEXT(struct _glapi_table *disp,
-                      void (GLAPIENTRYP fn) (GLenum, GLuint))
-{
-    SET_by_offset(disp, _gloffset_DisableIndexedEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_EnableIndexedEXT) (GLenum, GLuint);
-
-#define CALL_EnableIndexedEXT(disp, parameters) \
-    (* GET_EnableIndexedEXT(disp)) parameters
-static inline _glptr_EnableIndexedEXT
-GET_EnableIndexedEXT(struct _glapi_table *disp)
-{
-    return (_glptr_EnableIndexedEXT) (GET_by_offset
-                                      (disp, _gloffset_EnableIndexedEXT));
-}
-
-static inline void
-SET_EnableIndexedEXT(struct _glapi_table *disp,
-                     void (GLAPIENTRYP fn) (GLenum, GLuint))
-{
-    SET_by_offset(disp, _gloffset_EnableIndexedEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetBooleanIndexedvEXT) (GLenum, GLuint,
-                                                         GLboolean *);
-#define CALL_GetBooleanIndexedvEXT(disp, parameters) \
-    (* GET_GetBooleanIndexedvEXT(disp)) parameters
-static inline _glptr_GetBooleanIndexedvEXT
-GET_GetBooleanIndexedvEXT(struct _glapi_table *disp)
-{
-    return (_glptr_GetBooleanIndexedvEXT) (GET_by_offset
-                                           (disp,
-                                            _gloffset_GetBooleanIndexedvEXT));
-}
-
-static inline void
-SET_GetBooleanIndexedvEXT(struct _glapi_table *disp,
-                          void (GLAPIENTRYP fn) (GLenum, GLuint, GLboolean *))
-{
-    SET_by_offset(disp, _gloffset_GetBooleanIndexedvEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetIntegerIndexedvEXT) (GLenum, GLuint,
-                                                         GLint *);
-#define CALL_GetIntegerIndexedvEXT(disp, parameters) \
-    (* GET_GetIntegerIndexedvEXT(disp)) parameters
-static inline _glptr_GetIntegerIndexedvEXT
-GET_GetIntegerIndexedvEXT(struct _glapi_table *disp)
-{
-    return (_glptr_GetIntegerIndexedvEXT) (GET_by_offset
-                                           (disp,
-                                            _gloffset_GetIntegerIndexedvEXT));
-}
-
-static inline void
-SET_GetIntegerIndexedvEXT(struct _glapi_table *disp,
-                          void (GLAPIENTRYP fn) (GLenum, GLuint, GLint *))
-{
-    SET_by_offset(disp, _gloffset_GetIntegerIndexedvEXT, fn);
-}
-
-typedef GLboolean(GLAPIENTRYP _glptr_IsEnabledIndexedEXT) (GLenum, GLuint);
-
-#define CALL_IsEnabledIndexedEXT(disp, parameters) \
-    (* GET_IsEnabledIndexedEXT(disp)) parameters
-static inline _glptr_IsEnabledIndexedEXT
-GET_IsEnabledIndexedEXT(struct _glapi_table *disp)
-{
-    return (_glptr_IsEnabledIndexedEXT) (GET_by_offset
-                                         (disp, _gloffset_IsEnabledIndexedEXT));
-}
-
-static inline void
-SET_IsEnabledIndexedEXT(struct _glapi_table *disp,
-                        GLboolean(GLAPIENTRYP fn) (GLenum, GLuint))
-{
-    SET_by_offset(disp, _gloffset_IsEnabledIndexedEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ClearColorIiEXT) (GLint, GLint, GLint, GLint);
-
-#define CALL_ClearColorIiEXT(disp, parameters) \
-    (* GET_ClearColorIiEXT(disp)) parameters
-static inline _glptr_ClearColorIiEXT
-GET_ClearColorIiEXT(struct _glapi_table *disp)
-{
-    return (_glptr_ClearColorIiEXT) (GET_by_offset
-                                     (disp, _gloffset_ClearColorIiEXT));
-}
-
-static inline void
-SET_ClearColorIiEXT(struct _glapi_table *disp,
-                    void (GLAPIENTRYP fn) (GLint, GLint, GLint, GLint))
-{
-    SET_by_offset(disp, _gloffset_ClearColorIiEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ClearColorIuiEXT) (GLuint, GLuint, GLuint,
-                                                    GLuint);
-#define CALL_ClearColorIuiEXT(disp, parameters) \
-    (* GET_ClearColorIuiEXT(disp)) parameters
-static inline _glptr_ClearColorIuiEXT
-GET_ClearColorIuiEXT(struct _glapi_table *disp)
-{
-    return (_glptr_ClearColorIuiEXT) (GET_by_offset
-                                      (disp, _gloffset_ClearColorIuiEXT));
-}
-
-static inline void
-SET_ClearColorIuiEXT(struct _glapi_table *disp,
-                     void (GLAPIENTRYP fn) (GLuint, GLuint, GLuint, GLuint))
-{
-    SET_by_offset(disp, _gloffset_ClearColorIuiEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetTexParameterIivEXT) (GLenum, GLenum,
-                                                         GLint *);
-#define CALL_GetTexParameterIivEXT(disp, parameters) \
-    (* GET_GetTexParameterIivEXT(disp)) parameters
-static inline _glptr_GetTexParameterIivEXT
-GET_GetTexParameterIivEXT(struct _glapi_table *disp)
-{
-    return (_glptr_GetTexParameterIivEXT) (GET_by_offset
-                                           (disp,
-                                            _gloffset_GetTexParameterIivEXT));
-}
-
-static inline void
-SET_GetTexParameterIivEXT(struct _glapi_table *disp,
-                          void (GLAPIENTRYP fn) (GLenum, GLenum, GLint *))
-{
-    SET_by_offset(disp, _gloffset_GetTexParameterIivEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetTexParameterIuivEXT) (GLenum, GLenum,
-                                                          GLuint *);
-#define CALL_GetTexParameterIuivEXT(disp, parameters) \
-    (* GET_GetTexParameterIuivEXT(disp)) parameters
-static inline _glptr_GetTexParameterIuivEXT
-GET_GetTexParameterIuivEXT(struct _glapi_table *disp)
-{
-    return (_glptr_GetTexParameterIuivEXT) (GET_by_offset
-                                            (disp,
-                                             _gloffset_GetTexParameterIuivEXT));
-}
-
-static inline void
-SET_GetTexParameterIuivEXT(struct _glapi_table *disp,
-                           void (GLAPIENTRYP fn) (GLenum, GLenum, GLuint *))
-{
-    SET_by_offset(disp, _gloffset_GetTexParameterIuivEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexParameterIivEXT) (GLenum, GLenum,
-                                                      const GLint *);
-#define CALL_TexParameterIivEXT(disp, parameters) \
-    (* GET_TexParameterIivEXT(disp)) parameters
-static inline _glptr_TexParameterIivEXT
-GET_TexParameterIivEXT(struct _glapi_table *disp)
-{
-    return (_glptr_TexParameterIivEXT) (GET_by_offset
-                                        (disp, _gloffset_TexParameterIivEXT));
-}
-
-static inline void
-SET_TexParameterIivEXT(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLenum, GLenum, const GLint *))
-{
-    SET_by_offset(disp, _gloffset_TexParameterIivEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TexParameterIuivEXT) (GLenum, GLenum,
-                                                       const GLuint *);
-#define CALL_TexParameterIuivEXT(disp, parameters) \
-    (* GET_TexParameterIuivEXT(disp)) parameters
-static inline _glptr_TexParameterIuivEXT
-GET_TexParameterIuivEXT(struct _glapi_table *disp)
-{
-    return (_glptr_TexParameterIuivEXT) (GET_by_offset
-                                         (disp, _gloffset_TexParameterIuivEXT));
-}
-
-static inline void
-SET_TexParameterIuivEXT(struct _glapi_table *disp,
-                        void (GLAPIENTRYP fn) (GLenum, GLenum, const GLuint *))
-{
-    SET_by_offset(disp, _gloffset_TexParameterIuivEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_BeginConditionalRenderNV) (GLuint, GLenum);
-
-#define CALL_BeginConditionalRenderNV(disp, parameters) \
-    (* GET_BeginConditionalRenderNV(disp)) parameters
-static inline _glptr_BeginConditionalRenderNV
-GET_BeginConditionalRenderNV(struct _glapi_table *disp)
-{
-    return (_glptr_BeginConditionalRenderNV) (GET_by_offset
-                                              (disp,
-                                               _gloffset_BeginConditionalRenderNV));
-}
-
-static inline void
-SET_BeginConditionalRenderNV(struct _glapi_table *disp,
-                             void (GLAPIENTRYP fn) (GLuint, GLenum))
-{
-    SET_by_offset(disp, _gloffset_BeginConditionalRenderNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_EndConditionalRenderNV) (void);
-
-#define CALL_EndConditionalRenderNV(disp, parameters) \
-    (* GET_EndConditionalRenderNV(disp)) parameters
-static inline _glptr_EndConditionalRenderNV
-GET_EndConditionalRenderNV(struct _glapi_table *disp)
-{
-    return (_glptr_EndConditionalRenderNV) (GET_by_offset
-                                            (disp,
-                                             _gloffset_EndConditionalRenderNV));
-}
-
-static inline void
-SET_EndConditionalRenderNV(struct _glapi_table *disp,
-                           void (GLAPIENTRYP fn) (void))
-{
-    SET_by_offset(disp, _gloffset_EndConditionalRenderNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_BeginTransformFeedbackEXT) (GLenum);
-
-#define CALL_BeginTransformFeedbackEXT(disp, parameters) \
-    (* GET_BeginTransformFeedbackEXT(disp)) parameters
-static inline _glptr_BeginTransformFeedbackEXT
-GET_BeginTransformFeedbackEXT(struct _glapi_table *disp)
-{
-    return (_glptr_BeginTransformFeedbackEXT) (GET_by_offset
-                                               (disp,
-                                                _gloffset_BeginTransformFeedbackEXT));
-}
-
-static inline void
-SET_BeginTransformFeedbackEXT(struct _glapi_table *disp,
-                              void (GLAPIENTRYP fn) (GLenum))
-{
-    SET_by_offset(disp, _gloffset_BeginTransformFeedbackEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_BindBufferBaseEXT) (GLenum, GLuint, GLuint);
-
-#define CALL_BindBufferBaseEXT(disp, parameters) \
-    (* GET_BindBufferBaseEXT(disp)) parameters
-static inline _glptr_BindBufferBaseEXT
-GET_BindBufferBaseEXT(struct _glapi_table *disp)
-{
-    return (_glptr_BindBufferBaseEXT) (GET_by_offset
-                                       (disp, _gloffset_BindBufferBaseEXT));
-}
-
-static inline void
-SET_BindBufferBaseEXT(struct _glapi_table *disp,
-                      void (GLAPIENTRYP fn) (GLenum, GLuint, GLuint))
-{
-    SET_by_offset(disp, _gloffset_BindBufferBaseEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_BindBufferOffsetEXT) (GLenum, GLuint, GLuint,
-                                                       GLintptr);
-#define CALL_BindBufferOffsetEXT(disp, parameters) \
-    (* GET_BindBufferOffsetEXT(disp)) parameters
-static inline _glptr_BindBufferOffsetEXT
-GET_BindBufferOffsetEXT(struct _glapi_table *disp)
-{
-    return (_glptr_BindBufferOffsetEXT) (GET_by_offset
-                                         (disp, _gloffset_BindBufferOffsetEXT));
-}
-
-static inline void
-SET_BindBufferOffsetEXT(struct _glapi_table *disp,
-                        void (GLAPIENTRYP fn) (GLenum, GLuint, GLuint,
-                                               GLintptr))
-{
-    SET_by_offset(disp, _gloffset_BindBufferOffsetEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_BindBufferRangeEXT) (GLenum, GLuint, GLuint,
-                                                      GLintptr, GLsizeiptr);
-#define CALL_BindBufferRangeEXT(disp, parameters) \
-    (* GET_BindBufferRangeEXT(disp)) parameters
-static inline _glptr_BindBufferRangeEXT
-GET_BindBufferRangeEXT(struct _glapi_table *disp)
-{
-    return (_glptr_BindBufferRangeEXT) (GET_by_offset
-                                        (disp, _gloffset_BindBufferRangeEXT));
-}
-
-static inline void
-SET_BindBufferRangeEXT(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLenum, GLuint, GLuint, GLintptr,
-                                              GLsizeiptr))
-{
-    SET_by_offset(disp, _gloffset_BindBufferRangeEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_EndTransformFeedbackEXT) (void);
-
-#define CALL_EndTransformFeedbackEXT(disp, parameters) \
-    (* GET_EndTransformFeedbackEXT(disp)) parameters
-static inline _glptr_EndTransformFeedbackEXT
-GET_EndTransformFeedbackEXT(struct _glapi_table *disp)
-{
-    return (_glptr_EndTransformFeedbackEXT) (GET_by_offset
-                                             (disp,
-                                              _gloffset_EndTransformFeedbackEXT));
-}
-
-static inline void
-SET_EndTransformFeedbackEXT(struct _glapi_table *disp,
-                            void (GLAPIENTRYP fn) (void))
-{
-    SET_by_offset(disp, _gloffset_EndTransformFeedbackEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetTransformFeedbackVaryingEXT) (GLuint,
-                                                                  GLuint,
-                                                                  GLsizei,
-                                                                  GLsizei *,
-                                                                  GLsizei *,
-                                                                  GLenum *,
-                                                                  GLchar *);
-#define CALL_GetTransformFeedbackVaryingEXT(disp, parameters) \
-    (* GET_GetTransformFeedbackVaryingEXT(disp)) parameters
-static inline _glptr_GetTransformFeedbackVaryingEXT
-GET_GetTransformFeedbackVaryingEXT(struct _glapi_table *disp)
-{
-    return (_glptr_GetTransformFeedbackVaryingEXT) (GET_by_offset
-                                                    (disp,
-                                                     _gloffset_GetTransformFeedbackVaryingEXT));
-}
-
-static inline void
-SET_GetTransformFeedbackVaryingEXT(struct _glapi_table *disp,
-                                   void (GLAPIENTRYP fn) (GLuint, GLuint,
-                                                          GLsizei, GLsizei *,
-                                                          GLsizei *, GLenum *,
-                                                          GLchar *))
-{
-    SET_by_offset(disp, _gloffset_GetTransformFeedbackVaryingEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TransformFeedbackVaryingsEXT) (GLuint, GLsizei,
-                                                                const char **,
-                                                                GLenum);
-#define CALL_TransformFeedbackVaryingsEXT(disp, parameters) \
-    (* GET_TransformFeedbackVaryingsEXT(disp)) parameters
-static inline _glptr_TransformFeedbackVaryingsEXT
-GET_TransformFeedbackVaryingsEXT(struct _glapi_table *disp)
-{
-    return (_glptr_TransformFeedbackVaryingsEXT) (GET_by_offset
-                                                  (disp,
-                                                   _gloffset_TransformFeedbackVaryingsEXT));
-}
-
-static inline void
-SET_TransformFeedbackVaryingsEXT(struct _glapi_table *disp,
-                                 void (GLAPIENTRYP fn) (GLuint, GLsizei,
-                                                        const char **, GLenum))
-{
-    SET_by_offset(disp, _gloffset_TransformFeedbackVaryingsEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ProvokingVertexEXT) (GLenum);
-
-#define CALL_ProvokingVertexEXT(disp, parameters) \
-    (* GET_ProvokingVertexEXT(disp)) parameters
-static inline _glptr_ProvokingVertexEXT
-GET_ProvokingVertexEXT(struct _glapi_table *disp)
-{
-    return (_glptr_ProvokingVertexEXT) (GET_by_offset
-                                        (disp, _gloffset_ProvokingVertexEXT));
-}
-
-static inline void
-SET_ProvokingVertexEXT(struct _glapi_table *disp,
-                       void (GLAPIENTRYP fn) (GLenum))
-{
-    SET_by_offset(disp, _gloffset_ProvokingVertexEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetTexParameterPointervAPPLE) (GLenum, GLenum,
-                                                                GLvoid **);
-#define CALL_GetTexParameterPointervAPPLE(disp, parameters) \
-    (* GET_GetTexParameterPointervAPPLE(disp)) parameters
-static inline _glptr_GetTexParameterPointervAPPLE
-GET_GetTexParameterPointervAPPLE(struct _glapi_table *disp)
-{
-    return (_glptr_GetTexParameterPointervAPPLE) (GET_by_offset
-                                                  (disp,
-                                                   _gloffset_GetTexParameterPointervAPPLE));
-}
-
-static inline void
-SET_GetTexParameterPointervAPPLE(struct _glapi_table *disp,
-                                 void (GLAPIENTRYP fn) (GLenum, GLenum,
-                                                        GLvoid **))
-{
-    SET_by_offset(disp, _gloffset_GetTexParameterPointervAPPLE, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TextureRangeAPPLE) (GLenum, GLsizei, GLvoid *);
-
-#define CALL_TextureRangeAPPLE(disp, parameters) \
-    (* GET_TextureRangeAPPLE(disp)) parameters
-static inline _glptr_TextureRangeAPPLE
-GET_TextureRangeAPPLE(struct _glapi_table *disp)
-{
-    return (_glptr_TextureRangeAPPLE) (GET_by_offset
-                                       (disp, _gloffset_TextureRangeAPPLE));
-}
-
-static inline void
-SET_TextureRangeAPPLE(struct _glapi_table *disp,
-                      void (GLAPIENTRYP fn) (GLenum, GLsizei, GLvoid *))
-{
-    SET_by_offset(disp, _gloffset_TextureRangeAPPLE, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetObjectParameterivAPPLE) (GLenum, GLuint,
-                                                             GLenum, GLint *);
-#define CALL_GetObjectParameterivAPPLE(disp, parameters) \
-    (* GET_GetObjectParameterivAPPLE(disp)) parameters
-static inline _glptr_GetObjectParameterivAPPLE
-GET_GetObjectParameterivAPPLE(struct _glapi_table *disp)
-{
-    return (_glptr_GetObjectParameterivAPPLE) (GET_by_offset
-                                               (disp,
-                                                _gloffset_GetObjectParameterivAPPLE));
-}
-
-static inline void
-SET_GetObjectParameterivAPPLE(struct _glapi_table *disp,
-                              void (GLAPIENTRYP fn) (GLenum, GLuint, GLenum,
-                                                     GLint *))
-{
-    SET_by_offset(disp, _gloffset_GetObjectParameterivAPPLE, fn);
-}
-
-typedef GLenum(GLAPIENTRYP _glptr_ObjectPurgeableAPPLE) (GLenum, GLuint,
-                                                         GLenum);
-#define CALL_ObjectPurgeableAPPLE(disp, parameters) \
-    (* GET_ObjectPurgeableAPPLE(disp)) parameters
-static inline _glptr_ObjectPurgeableAPPLE
-GET_ObjectPurgeableAPPLE(struct _glapi_table *disp)
-{
-    return (_glptr_ObjectPurgeableAPPLE) (GET_by_offset
-                                          (disp,
-                                           _gloffset_ObjectPurgeableAPPLE));
-}
-
-static inline void
-SET_ObjectPurgeableAPPLE(struct _glapi_table *disp,
-                         GLenum(GLAPIENTRYP fn) (GLenum, GLuint, GLenum))
-{
-    SET_by_offset(disp, _gloffset_ObjectPurgeableAPPLE, fn);
-}
-
-typedef GLenum(GLAPIENTRYP _glptr_ObjectUnpurgeableAPPLE) (GLenum, GLuint,
-                                                           GLenum);
-#define CALL_ObjectUnpurgeableAPPLE(disp, parameters) \
-    (* GET_ObjectUnpurgeableAPPLE(disp)) parameters
-static inline _glptr_ObjectUnpurgeableAPPLE
-GET_ObjectUnpurgeableAPPLE(struct _glapi_table *disp)
-{
-    return (_glptr_ObjectUnpurgeableAPPLE) (GET_by_offset
-                                            (disp,
-                                             _gloffset_ObjectUnpurgeableAPPLE));
-}
-
-static inline void
-SET_ObjectUnpurgeableAPPLE(struct _glapi_table *disp,
-                           GLenum(GLAPIENTRYP fn) (GLenum, GLuint, GLenum))
-{
-    SET_by_offset(disp, _gloffset_ObjectUnpurgeableAPPLE, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ActiveProgramEXT) (GLuint);
-
-#define CALL_ActiveProgramEXT(disp, parameters) \
-    (* GET_ActiveProgramEXT(disp)) parameters
-static inline _glptr_ActiveProgramEXT
-GET_ActiveProgramEXT(struct _glapi_table *disp)
-{
-    return (_glptr_ActiveProgramEXT) (GET_by_offset
-                                      (disp, _gloffset_ActiveProgramEXT));
-}
-
-static inline void
-SET_ActiveProgramEXT(struct _glapi_table *disp, void (GLAPIENTRYP fn) (GLuint))
-{
-    SET_by_offset(disp, _gloffset_ActiveProgramEXT, fn);
-}
-
-typedef GLuint(GLAPIENTRYP _glptr_CreateShaderProgramEXT) (GLenum,
-                                                           const GLchar *);
-#define CALL_CreateShaderProgramEXT(disp, parameters) \
-    (* GET_CreateShaderProgramEXT(disp)) parameters
-static inline _glptr_CreateShaderProgramEXT
-GET_CreateShaderProgramEXT(struct _glapi_table *disp)
-{
-    return (_glptr_CreateShaderProgramEXT) (GET_by_offset
-                                            (disp,
-                                             _gloffset_CreateShaderProgramEXT));
-}
-
-static inline void
-SET_CreateShaderProgramEXT(struct _glapi_table *disp,
-                           GLuint(GLAPIENTRYP fn) (GLenum, const GLchar *))
-{
-    SET_by_offset(disp, _gloffset_CreateShaderProgramEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_UseShaderProgramEXT) (GLenum, GLuint);
-
-#define CALL_UseShaderProgramEXT(disp, parameters) \
-    (* GET_UseShaderProgramEXT(disp)) parameters
-static inline _glptr_UseShaderProgramEXT
-GET_UseShaderProgramEXT(struct _glapi_table *disp)
-{
-    return (_glptr_UseShaderProgramEXT) (GET_by_offset
-                                         (disp, _gloffset_UseShaderProgramEXT));
-}
-
-static inline void
-SET_UseShaderProgramEXT(struct _glapi_table *disp,
-                        void (GLAPIENTRYP fn) (GLenum, GLuint))
-{
-    SET_by_offset(disp, _gloffset_UseShaderProgramEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_TextureBarrierNV) (void);
-
-#define CALL_TextureBarrierNV(disp, parameters) \
-    (* GET_TextureBarrierNV(disp)) parameters
-static inline _glptr_TextureBarrierNV
-GET_TextureBarrierNV(struct _glapi_table *disp)
-{
-    return (_glptr_TextureBarrierNV) (GET_by_offset
-                                      (disp, _gloffset_TextureBarrierNV));
-}
-
-static inline void
-SET_TextureBarrierNV(struct _glapi_table *disp, void (GLAPIENTRYP fn) (void))
-{
-    SET_by_offset(disp, _gloffset_TextureBarrierNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_StencilFuncSeparateATI) (GLenum, GLenum, GLint,
-                                                          GLuint);
-#define CALL_StencilFuncSeparateATI(disp, parameters) \
-    (* GET_StencilFuncSeparateATI(disp)) parameters
-static inline _glptr_StencilFuncSeparateATI
-GET_StencilFuncSeparateATI(struct _glapi_table *disp)
-{
-    return (_glptr_StencilFuncSeparateATI) (GET_by_offset
-                                            (disp,
-                                             _gloffset_StencilFuncSeparateATI));
-}
-
-static inline void
-SET_StencilFuncSeparateATI(struct _glapi_table *disp,
-                           void (GLAPIENTRYP fn) (GLenum, GLenum, GLint,
-                                                  GLuint))
-{
-    SET_by_offset(disp, _gloffset_StencilFuncSeparateATI, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ProgramEnvParameters4fvEXT) (GLenum, GLuint,
-                                                              GLsizei,
-                                                              const GLfloat *);
-#define CALL_ProgramEnvParameters4fvEXT(disp, parameters) \
-    (* GET_ProgramEnvParameters4fvEXT(disp)) parameters
-static inline _glptr_ProgramEnvParameters4fvEXT
-GET_ProgramEnvParameters4fvEXT(struct _glapi_table *disp)
-{
-    return (_glptr_ProgramEnvParameters4fvEXT) (GET_by_offset
-                                                (disp,
-                                                 _gloffset_ProgramEnvParameters4fvEXT));
-}
-
-static inline void
-SET_ProgramEnvParameters4fvEXT(struct _glapi_table *disp,
-                               void (GLAPIENTRYP fn) (GLenum, GLuint, GLsizei,
-                                                      const GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_ProgramEnvParameters4fvEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ProgramLocalParameters4fvEXT) (GLenum, GLuint,
-                                                                GLsizei,
-                                                                const GLfloat
-                                                                *);
-#define CALL_ProgramLocalParameters4fvEXT(disp, parameters) \
-    (* GET_ProgramLocalParameters4fvEXT(disp)) parameters
-static inline _glptr_ProgramLocalParameters4fvEXT
-GET_ProgramLocalParameters4fvEXT(struct _glapi_table *disp)
-{
-    return (_glptr_ProgramLocalParameters4fvEXT) (GET_by_offset
-                                                  (disp,
-                                                   _gloffset_ProgramLocalParameters4fvEXT));
-}
-
-static inline void
-SET_ProgramLocalParameters4fvEXT(struct _glapi_table *disp,
-                                 void (GLAPIENTRYP fn) (GLenum, GLuint, GLsizei,
-                                                        const GLfloat *))
-{
-    SET_by_offset(disp, _gloffset_ProgramLocalParameters4fvEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetQueryObjecti64vEXT) (GLuint, GLenum,
-                                                         GLint64EXT *);
-#define CALL_GetQueryObjecti64vEXT(disp, parameters) \
-    (* GET_GetQueryObjecti64vEXT(disp)) parameters
-static inline _glptr_GetQueryObjecti64vEXT
-GET_GetQueryObjecti64vEXT(struct _glapi_table *disp)
-{
-    return (_glptr_GetQueryObjecti64vEXT) (GET_by_offset
-                                           (disp,
-                                            _gloffset_GetQueryObjecti64vEXT));
-}
-
-static inline void
-SET_GetQueryObjecti64vEXT(struct _glapi_table *disp,
-                          void (GLAPIENTRYP fn) (GLuint, GLenum, GLint64EXT *))
-{
-    SET_by_offset(disp, _gloffset_GetQueryObjecti64vEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetQueryObjectui64vEXT) (GLuint, GLenum,
-                                                          GLuint64EXT *);
-#define CALL_GetQueryObjectui64vEXT(disp, parameters) \
-    (* GET_GetQueryObjectui64vEXT(disp)) parameters
-static inline _glptr_GetQueryObjectui64vEXT
-GET_GetQueryObjectui64vEXT(struct _glapi_table *disp)
-{
-    return (_glptr_GetQueryObjectui64vEXT) (GET_by_offset
-                                            (disp,
-                                             _gloffset_GetQueryObjectui64vEXT));
-}
-
-static inline void
-SET_GetQueryObjectui64vEXT(struct _glapi_table *disp,
-                           void (GLAPIENTRYP fn) (GLuint, GLenum,
-                                                  GLuint64EXT *))
-{
-    SET_by_offset(disp, _gloffset_GetQueryObjectui64vEXT, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_EGLImageTargetRenderbufferStorageOES) (GLenum,
-                                                                        GLvoid
-                                                                        *);
-#define CALL_EGLImageTargetRenderbufferStorageOES(disp, parameters) \
-    (* GET_EGLImageTargetRenderbufferStorageOES(disp)) parameters
-static inline _glptr_EGLImageTargetRenderbufferStorageOES
-GET_EGLImageTargetRenderbufferStorageOES(struct _glapi_table *disp)
-{
-    return (_glptr_EGLImageTargetRenderbufferStorageOES) (GET_by_offset
-                                                          (disp,
-                                                           _gloffset_EGLImageTargetRenderbufferStorageOES));
-}
-
-static inline void
-SET_EGLImageTargetRenderbufferStorageOES(struct _glapi_table *disp,
-                                         void (GLAPIENTRYP fn) (GLenum,
-                                                                GLvoid *))
-{
-    SET_by_offset(disp, _gloffset_EGLImageTargetRenderbufferStorageOES, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_EGLImageTargetTexture2DOES) (GLenum, GLvoid *);
-
-#define CALL_EGLImageTargetTexture2DOES(disp, parameters) \
-    (* GET_EGLImageTargetTexture2DOES(disp)) parameters
-static inline _glptr_EGLImageTargetTexture2DOES
-GET_EGLImageTargetTexture2DOES(struct _glapi_table *disp)
-{
-    return (_glptr_EGLImageTargetTexture2DOES) (GET_by_offset
-                                                (disp,
-                                                 _gloffset_EGLImageTargetTexture2DOES));
-}
-
-static inline void
-SET_EGLImageTargetTexture2DOES(struct _glapi_table *disp,
-                               void (GLAPIENTRYP fn) (GLenum, GLvoid *))
-{
-    SET_by_offset(disp, _gloffset_EGLImageTargetTexture2DOES, fn);
-}
-
-#endif                          /* !defined( _DISPATCH_H_ ) */
index 544ca1f..4bef96f 100644 (file)
@@ -65,15 +65,22 @@ struct extension_info {
     unsigned char driver_support;
 };
 
+/**
+ * List of known GLX Extensions.
+ * The last Y/N switch informs whether the support of this extension is always enabled.
+ */
 static const struct extension_info known_glx_extensions[] = {
 /*   GLX_ARB_get_proc_address is implemented on the client. */
     /* *INDENT-OFF* */
     { GLX(ARB_create_context),          VER(0,0), N, },
     { GLX(ARB_create_context_profile),  VER(0,0), N, },
     { GLX(ARB_create_context_robustness), VER(0,0), N, },
+    { GLX(ARB_fbconfig_float),          VER(0,0), N, },
+    { GLX(ARB_framebuffer_sRGB),        VER(0,0), N, },
     { GLX(ARB_multisample),             VER(1,4), Y, },
 
     { GLX(EXT_create_context_es2_profile), VER(0,0), N, },
+    { GLX(EXT_framebuffer_sRGB),        VER(0,0), N, },
     { GLX(EXT_import_context),          VER(0,0), Y, },
     { GLX(EXT_texture_from_pixmap),     VER(0,0), Y, },
     { GLX(EXT_visual_info),             VER(0,0), Y, },
index 7a4a8b1..e7d3932 100644 (file)
@@ -39,6 +39,8 @@ enum {
     ARB_create_context_bit = 0,
     ARB_create_context_profile_bit,
     ARB_create_context_robustness_bit,
+    ARB_fbconfig_float_bit,
+    ARB_framebuffer_sRGB_bit,
     ARB_multisample_bit,
     EXT_create_context_es2_profile_bit,
     EXT_import_context_bit,
@@ -58,6 +60,10 @@ enum {
     __NUM_GLX_EXTS,
 };
 
+/* For extensions which have identical ARB and EXT implementation
+ * in GLX area, use one enabling bit for both. */
+#define EXT_framebuffer_sRGB_bit ARB_framebuffer_sRGB_bit
+
 #define __GLX_EXT_BYTES ((__NUM_GLX_EXTS + 7) / 8)
 
 extern int __glXGetExtensionString(const unsigned char *enable_bits,
diff --git a/glx/glapi.c b/glx/glapi.c
deleted file mode 100644 (file)
index 02e06ac..0000000
+++ /dev/null
@@ -1,504 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version:  6.5
- *
- * Copyright (C) 1999-2006  Brian Paul   All Rights Reserved.
- *
- * 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 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
- * BRIAN PAUL 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.
- */
-
-/*
- * This file manages the OpenGL API dispatch layer.  There are functions
- * to set/get the current dispatch table for the current thread and to
- * manage registration/dispatch of dynamically added extension functions.
- *
- * This code was originally general enough to be shared with Mesa, but
- * they diverged long ago, so this is now just enough support to make
- * indirect GLX work.
- */
-
-#include <dix-config.h>
-#include <X11/Xfuncproto.h>
-#include <os.h>
-#define PUBLIC _X_EXPORT
-
-#include <stdlib.h>
-#include <string.h>
-#ifdef DEBUG
-#include <assert.h>
-#endif
-
-#include "glapi.h"
-#include "dispatch.h"
-#include "glapitable.h"
-
-#define FIRST_DYNAMIC_OFFSET (sizeof(struct _glapi_table) / sizeof(void *))
-
-#if defined(PTHREADS) || defined(GLX_USE_TLS)
-static void init_glapi_relocs(void);
-#endif
-
-/**
- * \name Current dispatch and current context control variables
- *
- * Depending on whether or not multithreading is support, and the type of
- * support available, several variables are used to store the current context
- * pointer and the current dispatch table pointer.  In the non-threaded case,
- * the variables \c _glapi_Dispatch and \c _glapi_Context are used for this
- * purpose.
- *
- * In the "normal" threaded case, the variables \c _glapi_Dispatch and
- * \c _glapi_Context will be \c NULL if an application is detected as being
- * multithreaded.  Single-threaded applications will use \c _glapi_Dispatch
- * and \c _glapi_Context just like the case without any threading support.
- * When \c _glapi_Dispatch and \c _glapi_Context are \c NULL, the thread state
- * data \c _gl_DispatchTSD and \c ContextTSD are used.  Drivers and the
- * static dispatch functions access these variables via \c _glapi_get_dispatch
- * and \c _glapi_get_context.
- *
- * In the TLS case, the variables \c _glapi_Dispatch and \c _glapi_Context are
- * hardcoded to \c NULL.  Instead the TLS variables \c _glapi_tls_Dispatch and
- * \c _glapi_tls_Context are used.  Having \c _glapi_Dispatch and
- * \c _glapi_Context be hardcoded to \c NULL maintains binary compatability
- * between TLS enabled loaders and non-TLS DRI drivers.
- */
-/*@{*/
-#if defined(GLX_USE_TLS)
-
-PUBLIC TLS struct _glapi_table *_glapi_tls_Dispatch = NULL;
-
-PUBLIC TLS void *_glapi_tls_Context;
-
-PUBLIC const struct _glapi_table *_glapi_Dispatch = NULL;
-PUBLIC const void *_glapi_Context = NULL;
-
-#else
-
-#if defined(THREADS)
-
-_glthread_TSD _gl_DispatchTSD;           /**< Per-thread dispatch pointer */
-static _glthread_TSD ContextTSD;         /**< Per-thread context pointer */
-
-#if defined(WIN32_THREADS)
-void FreeTSD(_glthread_TSD * p);
-void
-FreeAllTSD(void)
-{
-    FreeTSD(&_gl_DispatchTSD);
-    FreeTSD(&ContextTSD);
-}
-#endif                          /* defined(WIN32_THREADS) */
-
-#endif                          /* defined(THREADS) */
-
-PUBLIC struct _glapi_table *_glapi_Dispatch = NULL;
-PUBLIC void *_glapi_Context = NULL;
-
-#endif                          /* defined(GLX_USE_TLS) */
-/*@}*/
-
-/*
- * xserver's gl is not multithreaded, we promise.
- */
-PUBLIC void
-_glapi_check_multithread(void)
-{
-}
-
-/**
- * Set the current context pointer for this thread.
- * The context pointer is an opaque type which should be cast to
- * void from the real context pointer type.
- */
-PUBLIC void
-_glapi_set_context(void *context)
-{
-#if defined(GLX_USE_TLS)
-    _glapi_tls_Context = context;
-#elif defined(THREADS)
-    _glthread_SetTSD(&ContextTSD, context);
-    _glapi_Context = context;
-#else
-    _glapi_Context = context;
-#endif
-}
-
-/**
- * Get the current context pointer for this thread.
- * The context pointer is an opaque type which should be cast from
- * void to the real context pointer type.
- */
-PUBLIC void *
-_glapi_get_context(void)
-{
-#if defined(GLX_USE_TLS)
-    return _glapi_tls_Context;
-#else
-    return _glapi_Context;
-#endif
-}
-
-/**
- * Set the global or per-thread dispatch table pointer.
- */
-PUBLIC void
-_glapi_set_dispatch(struct _glapi_table *dispatch)
-{
-#if defined(PTHREADS) || defined(GLX_USE_TLS)
-    static pthread_once_t once_control = PTHREAD_ONCE_INIT;
-
-    pthread_once(&once_control, init_glapi_relocs);
-#endif
-
-#if defined(GLX_USE_TLS)
-    _glapi_tls_Dispatch = dispatch;
-#elif defined(THREADS)
-    _glthread_SetTSD(&_gl_DispatchTSD, (void *) dispatch);
-    _glapi_Dispatch = dispatch;
-#else /*THREADS*/
-        _glapi_Dispatch = dispatch;
-#endif /*THREADS*/
-}
-
-/**
- * Return pointer to current dispatch table for calling thread.
- */
-PUBLIC struct _glapi_table *
-_glapi_get_dispatch(void)
-{
-    struct _glapi_table *api;
-
-#if defined(GLX_USE_TLS)
-    api = _glapi_tls_Dispatch;
-#else
-    api = _glapi_Dispatch;
-#endif
-    return api;
-}
-
-/***
- *** The rest of this file is pretty much concerned with GetProcAddress
- *** functionality.
- ***/
-
-#if defined(USE_X64_64_ASM) && defined(GLX_USE_TLS)
-#define DISPATCH_FUNCTION_SIZE  16
-#elif defined(USE_X86_ASM)
-#if defined(THREADS) && !defined(GLX_USE_TLS)
-#define DISPATCH_FUNCTION_SIZE  32
-#else
-#define DISPATCH_FUNCTION_SIZE  16
-#endif
-#endif
-
-/* The code in this file is auto-generated with Python */
-#include "glprocs.h"
-
-/**
- * Search the table of static entrypoint functions for the named function
- * and return the corresponding glprocs_table_t entry.
- */
-static const glprocs_table_t *
-find_entry(const char *n)
-{
-    GLuint i;
-
-    for (i = 0; static_functions[i].Name_offset >= 0; i++) {
-        const char *testName =
-            gl_string_table + static_functions[i].Name_offset;
-        if (strcmp(testName, n) == 0) {
-            return &static_functions[i];
-        }
-    }
-    return NULL;
-}
-
-/**
- * Return dispatch table offset of the named static (built-in) function.
- * Return -1 if function not found.
- */
-static GLint
-get_static_proc_offset(const char *funcName)
-{
-    const glprocs_table_t *const f = find_entry(funcName);
-
-    if (f) {
-        return f->Offset;
-    }
-    return -1;
-}
-
-/**********************************************************************
- * Extension function management.
- */
-
-/*
- * Number of extension functions which we can dynamically add at runtime.
- */
-#define MAX_EXTENSION_FUNCS 300
-
-/*
- * The dispatch table size (number of entries) is the size of the
- * _glapi_table struct plus the number of dynamic entries we can add.
- * The extra slots can be filled in by DRI drivers that register new extension
- * functions.
- */
-#define DISPATCH_TABLE_SIZE (sizeof(struct _glapi_table) / sizeof(void *) + MAX_EXTENSION_FUNCS)
-
-/**
- * Track information about a function added to the GL API.
- */
-struct _glapi_function {
-   /**
-    * Name of the function.
-    */
-    const char *name;
-
-   /**
-    * Text string that describes the types of the parameters passed to the
-    * named function.   Parameter types are converted to characters using the
-    * following rules:
-    *   - 'i' for \c GLint, \c GLuint, and \c GLenum
-    *   - 'p' for any pointer type
-    *   - 'f' for \c GLfloat and \c GLclampf
-    *   - 'd' for \c GLdouble and \c GLclampd
-    */
-    const char *parameter_signature;
-
-   /**
-    * Offset in the dispatch table where the pointer to the real function is
-    * located.  If the driver has not requested that the named function be
-    * added to the dispatch table, this will have the value ~0.
-    */
-    unsigned dispatch_offset;
-};
-
-static struct _glapi_function ExtEntryTable[MAX_EXTENSION_FUNCS];
-static GLuint NumExtEntryPoints = 0;
-
-/**
- * Generate new entrypoint
- *
- * Use a temporary dispatch offset of ~0 (i.e. -1).  Later, when the driver
- * calls \c _glapi_add_dispatch we'll put in the proper offset.  If that
- * never happens, and the user calls this function, he'll segfault.  That's
- * what you get when you try calling a GL function that doesn't really exist.
- * 
- * \param funcName  Name of the function to create an entry-point for.
- * 
- * \sa _glapi_add_entrypoint
- */
-
-static struct _glapi_function *
-add_function_name(const char *funcName)
-{
-    struct _glapi_function *entry = NULL;
-
-    if (NumExtEntryPoints < MAX_EXTENSION_FUNCS) {
-        entry = &ExtEntryTable[NumExtEntryPoints];
-
-        ExtEntryTable[NumExtEntryPoints].name = strdup(funcName);
-        ExtEntryTable[NumExtEntryPoints].parameter_signature = NULL;
-        ExtEntryTable[NumExtEntryPoints].dispatch_offset = ~0;
-        NumExtEntryPoints++;
-    }
-
-    return entry;
-}
-
-/**
- * Fill-in the dispatch stub for the named function.
- * 
- * This function is intended to be called by a hardware driver.  When called,
- * a dispatch stub may be created created for the function.  A pointer to this
- * dispatch function will be returned by glXGetProcAddress.
- *
- * \param function_names       Array of pointers to function names that should
- *                             share a common dispatch offset.
- * \param parameter_signature  String representing the types of the parameters
- *                             passed to the named function.  Parameter types
- *                             are converted to characters using the following
- *                             rules:
- *                               - 'i' for \c GLint, \c GLuint, and \c GLenum
- *                               - 'p' for any pointer type
- *                               - 'f' for \c GLfloat and \c GLclampf
- *                               - 'd' for \c GLdouble and \c GLclampd
- *
- * \returns
- * The offset in the dispatch table of the named function.  A pointer to the
- * driver's implementation of the named function should be stored at
- * \c dispatch_table[\c offset].
- *
- * \sa glXGetProcAddress
- *
- * \warning
- * This function can only handle up to 8 names at a time.  As far as I know,
- * the maximum number of names ever associated with an existing GL function is
- * 4 (\c glPointParameterfSGIS, \c glPointParameterfEXT,
- * \c glPointParameterfARB, and \c glPointParameterf), so this should not be
- * too painful of a limitation.
- *
- * \todo
- * Determine whether or not \c parameter_signature should be allowed to be
- * \c NULL.  It doesn't seem like much of a hardship for drivers to have to
- * pass in an empty string.
- *
- * \todo
- * Determine if code should be added to reject function names that start with
- * 'glX'.
- * 
- * \bug
- * Add code to compare \c parameter_signature with the parameter signature of
- * a static function.  In order to do that, we need to find a way to \b get
- * the parameter signature of a static function.
- */
-
-PUBLIC int
-_glapi_add_dispatch(const char *const *function_names,
-                    const char *parameter_signature)
-{
-    static int next_dynamic_offset = FIRST_DYNAMIC_OFFSET;
-    const char *const real_sig = (parameter_signature != NULL)
-        ? parameter_signature : "";
-    struct _glapi_function *entry[8];
-    GLboolean is_static[8];
-    unsigned i;
-    unsigned j;
-    int offset = ~0;
-    int new_offset;
-
-    (void) memset(is_static, 0, sizeof(is_static));
-    (void) memset(entry, 0, sizeof(entry));
-
-    for (i = 0; function_names[i] != NULL; i++) {
-        /* Do some trivial validation on the name of the function. */
-
-        if (function_names[i][0] != 'g' || function_names[i][1] != 'l')
-            return GL_FALSE;
-
-        /* Determine if the named function already exists.  If the function does
-         * exist, it must have the same parameter signature as the function
-         * being added.
-         */
-
-        new_offset = get_static_proc_offset(function_names[i]);
-        if (new_offset >= 0) {
-            /* FIXME: Make sure the parameter signatures match!  How do we get
-             * FIXME: the parameter signature for static functions?
-             */
-
-            if ((offset != ~0) && (new_offset != offset)) {
-                return -1;
-            }
-
-            is_static[i] = GL_TRUE;
-            offset = new_offset;
-        }
-
-        for (j = 0; j < NumExtEntryPoints; j++) {
-            if (strcmp(ExtEntryTable[j].name, function_names[i]) == 0) {
-                /* The offset may be ~0 if the function name was added by
-                 * glXGetProcAddress but never filled in by the driver.
-                 */
-
-                if (ExtEntryTable[j].dispatch_offset != ~0) {
-                    if (strcmp(real_sig, ExtEntryTable[j].parameter_signature)
-                        != 0)
-                        return -1;
-
-                    if ((offset != ~0) &&
-                        (ExtEntryTable[j].dispatch_offset != offset)) {
-                        return -1;
-                    }
-
-                    offset = ExtEntryTable[j].dispatch_offset;
-                }
-
-                entry[i] = &ExtEntryTable[j];
-                break;
-            }
-        }
-    }
-
-    if (offset == ~0) {
-        offset = next_dynamic_offset;
-        next_dynamic_offset++;
-    }
-
-    for (i = 0; function_names[i] != NULL; i++) {
-        if (!is_static[i]) {
-            if (entry[i] == NULL) {
-                entry[i] = add_function_name(function_names[i]);
-                if (entry[i] == NULL)
-                    return -1;
-            }
-
-            entry[i]->parameter_signature = strdup(real_sig);
-            entry[i]->dispatch_offset = offset;
-        }
-    }
-
-    return offset;
-}
-
-/*
- * glXGetProcAddress doesn't exist in the protocol, the drivers never call
- * this themselves, and neither does the server.  warn if it happens though.
- */
-PUBLIC _glapi_proc
-_glapi_get_proc_address(const char *funcName)
-{
-    ErrorF("_glapi_get_proc_address called!\n");
-    return NULL;
-}
-
-/**
- * Return size of dispatch table struct as number of functions (or
- * slots).
- */
-PUBLIC GLuint
-_glapi_get_dispatch_table_size(void)
-{
-    return DISPATCH_TABLE_SIZE;
-}
-
-#if defined(PTHREADS) || defined(GLX_USE_TLS)
-/**
- * Perform platform-specific GL API entry-point fixups.
- */
-static void
-init_glapi_relocs(void)
-{
-#if defined(USE_X86_ASM) && defined(GLX_USE_TLS) && !defined(GLX_X86_READONLY_TEXT)
-    extern unsigned long _x86_get_dispatch(void);
-
-    char run_time_patch[] = {
-        0x65, 0xa1, 0, 0, 0, 0  /* movl %gs:0,%eax */
-    };
-    GLuint *offset = (GLuint *) & run_time_patch[2];    /* 32-bits for x86/32 */
-    const GLubyte *const get_disp = (const GLubyte *) run_time_patch;
-    GLubyte *curr_func = (GLubyte *) gl_dispatch_functions_start;
-
-    *offset = _x86_get_dispatch();
-    while (curr_func != (GLubyte *) gl_dispatch_functions_end) {
-        (void) memcpy(curr_func, get_disp, sizeof(run_time_patch));
-        curr_func += DISPATCH_FUNCTION_SIZE;
-    }
-#endif
-}
-#endif                          /* defined(PTHREADS) || defined(GLX_USE_TLS) */
diff --git a/glx/glapi.h b/glx/glapi.h
deleted file mode 100644 (file)
index bad791e..0000000
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version:  7.1
- *
- * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved.
- *
- * 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 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
- * BRIAN PAUL 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.
- */
-
-/**
- * \mainpage Mesa GL API Module
- *
- * \section GLAPIIntroduction Introduction
- *
- * The Mesa GL API module is responsible for dispatching all the
- * gl*() functions.  All GL functions are dispatched by jumping through
- * the current dispatch table (basically a struct full of function
- * pointers.)
- *
- * A per-thread current dispatch table and per-thread current context
- * pointer are managed by this module too.
- *
- * This module is intended to be non-Mesa-specific so it can be used
- * with the X/DRI libGL also.
- */
-
-#ifndef _GLAPI_H
-#define _GLAPI_H
-
-#define GL_GLEXT_PROTOTYPES
-
-#include "GL/gl.h"
-#include "GL/glext.h"
-#include "glthread.h"
-
-struct _glapi_table;
-
-typedef void (*_glapi_proc) (void);     /* generic function pointer */
-
-typedef void (*_glapi_warning_func) (void *ctx, const char *str, ...);
-
-#if defined(USE_MGL_NAMESPACE)
-#define _glapi_set_dispatch _mglapi_set_dispatch
-#define _glapi_get_dispatch _mglapi_get_dispatch
-#define _glapi_set_context _mglapi_set_context
-#define _glapi_get_context _mglapi_get_context
-#define _glapi_Context _mglapi_Context
-#define _glapi_Dispatch _mglapi_Dispatch
-#endif
-
-/*
- * Number of extension functions which we can dynamically add at runtime.
- */
-#define MAX_EXTENSION_FUNCS 300
-
-/**
- ** Define the GET_CURRENT_CONTEXT() macro.
- ** \param C local variable which will hold the current context.
- **/
-#if defined (GLX_USE_TLS)
-
-const extern void *_glapi_Context;
-const extern struct _glapi_table *_glapi_Dispatch;
-
-extern TLS void *_glapi_tls_Context;
-
-#define GET_CURRENT_CONTEXT(C)  GLcontext *C = (GLcontext *) _glapi_tls_Context
-
-#else
-
-extern void *_glapi_Context;
-extern struct _glapi_table *_glapi_Dispatch;
-
-#ifdef THREADS
-#define GET_CURRENT_CONTEXT(C)  GLcontext *C = (GLcontext *) (_glapi_Context ? _glapi_Context : _glapi_get_context())
-#else
-#define GET_CURRENT_CONTEXT(C)  GLcontext *C = (GLcontext *) _glapi_Context
-#endif
-
-#endif                          /* defined (GLX_USE_TLS) */
-
-/**
- ** GL API public functions
- **/
-
-extern void
- _glapi_check_multithread(void);
-
-extern void
- _glapi_set_context(void *context);
-
-extern void *_glapi_get_context(void);
-
-extern void
- _glapi_set_dispatch(struct _glapi_table *dispatch);
-
-extern struct _glapi_table *_glapi_get_dispatch(void);
-
-extern int
- _glapi_begin_dispatch_override(struct _glapi_table *override);
-
-extern void
- _glapi_end_dispatch_override(int layer);
-
-struct _glapi_table *_glapi_get_override_dispatch(int layer);
-
-extern GLuint _glapi_get_dispatch_table_size(void);
-
-extern int
-
-_glapi_add_dispatch(const char *const *function_names,
-                    const char *parameter_signature);
-
-extern _glapi_proc _glapi_get_proc_address(const char *funcName);
-
-extern struct _glapi_table *_glapi_create_table_from_handle(void *handle,
-                                                            const char
-                                                            *symbol_prefix);
-
-#endif
diff --git a/glx/glapi_gentable.c b/glx/glapi_gentable.c
deleted file mode 100644 (file)
index 4b28015..0000000
+++ /dev/null
@@ -1,10058 +0,0 @@
-/* DO NOT EDIT - This file generated automatically by gl_gen_table.py (from Mesa) script */
-
-/*
- * Copyright (C) 1999-2001  Brian Paul   All Rights Reserved.
- * (C) Copyright IBM Corporation 2004, 2005
- * (C) Copyright Apple Inc 2011
- * All Rights Reserved.
- * 
- * 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, sub license,
- * 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 NON-INFRINGEMENT.  IN NO EVENT SHALL
- * BRIAN PAUL, IBM,
- * AND/OR THEIR SUPPLIERS 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.
- */
-
-/* GLXEXT is the define used in the xserver when the GLX extension is being
- * built.  Hijack this to determine whether this file is being built for the
- * server or the client.
- */
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#if (defined(GLXEXT) && defined(HAVE_BACKTRACE)) \
-       || (!defined(GLXEXT) && defined(DEBUG) && !defined(_WIN32_WCE))
-#define USE_BACKTRACE
-#endif
-
-#ifdef USE_BACKTRACE
-#include <execinfo.h>
-#endif
-
-#include <dlfcn.h>
-#include <stdlib.h>
-#include <stdio.h>
-
-#include <GL/gl.h>
-
-#include "glapi.h"
-#include "glapitable.h"
-
-#ifdef GLXEXT
-#include "os.h"
-#endif
-
-static void
-__glapi_gentable_NoOp(void)
-{
-    const char *fstr = "Unknown";
-
-    /* Silence potential GCC warning for some #ifdef paths.
-     */
-    (void) fstr;
-#if defined(USE_BACKTRACE)
-#if !defined(GLXEXT)
-    if (getenv("MESA_DEBUG") || getenv("LIBGL_DEBUG"))
-#endif
-    {
-        void *frames[2];
-
-        if (backtrace(frames, 2) == 2) {
-            Dl_info info;
-
-            dladdr(frames[1], &info);
-            if (info.dli_sname)
-                fstr = info.dli_sname;
-        }
-
-#if !defined(GLXEXT)
-        fprintf(stderr, "Call to unimplemented API: %s\n", fstr);
-#endif
-    }
-#endif
-#if defined(GLXEXT)
-    LogMessage(X_ERROR, "GLX: Call to unimplemented API: %s\n", fstr);
-#endif
-}
-
-static void
-__glapi_gentable_set_remaining_noop(struct _glapi_table *disp)
-{
-    GLuint entries = _glapi_get_dispatch_table_size();
-    void **dispatch = (void **) disp;
-    int i;
-
-    /* ISO C is annoying sometimes */
-    union {
-        _glapi_proc p;
-        void *v;
-    } p;
-
-    p.p = __glapi_gentable_NoOp;
-
-    for (i = 0; i < entries; i++)
-        if (dispatch[i] == NULL)
-            dispatch[i] = p.v;
-}
-
-struct _glapi_table *
-_glapi_create_table_from_handle(void *handle, const char *symbol_prefix)
-{
-    struct _glapi_table *disp = calloc(_glapi_get_dispatch_table_size(), sizeof(void*));
-    char symboln[512];
-
-    if (!disp)
-        return NULL;
-
-    if (symbol_prefix == NULL)
-        symbol_prefix = "";
-
-    if (!disp->NewList) {
-        void **procp = (void **) &disp->NewList;
-
-        snprintf(symboln, sizeof(symboln), "%sNewList", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->EndList) {
-        void **procp = (void **) &disp->EndList;
-
-        snprintf(symboln, sizeof(symboln), "%sEndList", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->CallList) {
-        void **procp = (void **) &disp->CallList;
-
-        snprintf(symboln, sizeof(symboln), "%sCallList", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->CallLists) {
-        void **procp = (void **) &disp->CallLists;
-
-        snprintf(symboln, sizeof(symboln), "%sCallLists", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->DeleteLists) {
-        void **procp = (void **) &disp->DeleteLists;
-
-        snprintf(symboln, sizeof(symboln), "%sDeleteLists", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GenLists) {
-        void **procp = (void **) &disp->GenLists;
-
-        snprintf(symboln, sizeof(symboln), "%sGenLists", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ListBase) {
-        void **procp = (void **) &disp->ListBase;
-
-        snprintf(symboln, sizeof(symboln), "%sListBase", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Begin) {
-        void **procp = (void **) &disp->Begin;
-
-        snprintf(symboln, sizeof(symboln), "%sBegin", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Bitmap) {
-        void **procp = (void **) &disp->Bitmap;
-
-        snprintf(symboln, sizeof(symboln), "%sBitmap", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Color3b) {
-        void **procp = (void **) &disp->Color3b;
-
-        snprintf(symboln, sizeof(symboln), "%sColor3b", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Color3bv) {
-        void **procp = (void **) &disp->Color3bv;
-
-        snprintf(symboln, sizeof(symboln), "%sColor3bv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Color3d) {
-        void **procp = (void **) &disp->Color3d;
-
-        snprintf(symboln, sizeof(symboln), "%sColor3d", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Color3dv) {
-        void **procp = (void **) &disp->Color3dv;
-
-        snprintf(symboln, sizeof(symboln), "%sColor3dv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Color3f) {
-        void **procp = (void **) &disp->Color3f;
-
-        snprintf(symboln, sizeof(symboln), "%sColor3f", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Color3fv) {
-        void **procp = (void **) &disp->Color3fv;
-
-        snprintf(symboln, sizeof(symboln), "%sColor3fv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Color3i) {
-        void **procp = (void **) &disp->Color3i;
-
-        snprintf(symboln, sizeof(symboln), "%sColor3i", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Color3iv) {
-        void **procp = (void **) &disp->Color3iv;
-
-        snprintf(symboln, sizeof(symboln), "%sColor3iv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Color3s) {
-        void **procp = (void **) &disp->Color3s;
-
-        snprintf(symboln, sizeof(symboln), "%sColor3s", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Color3sv) {
-        void **procp = (void **) &disp->Color3sv;
-
-        snprintf(symboln, sizeof(symboln), "%sColor3sv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Color3ub) {
-        void **procp = (void **) &disp->Color3ub;
-
-        snprintf(symboln, sizeof(symboln), "%sColor3ub", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Color3ubv) {
-        void **procp = (void **) &disp->Color3ubv;
-
-        snprintf(symboln, sizeof(symboln), "%sColor3ubv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Color3ui) {
-        void **procp = (void **) &disp->Color3ui;
-
-        snprintf(symboln, sizeof(symboln), "%sColor3ui", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Color3uiv) {
-        void **procp = (void **) &disp->Color3uiv;
-
-        snprintf(symboln, sizeof(symboln), "%sColor3uiv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Color3us) {
-        void **procp = (void **) &disp->Color3us;
-
-        snprintf(symboln, sizeof(symboln), "%sColor3us", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Color3usv) {
-        void **procp = (void **) &disp->Color3usv;
-
-        snprintf(symboln, sizeof(symboln), "%sColor3usv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Color4b) {
-        void **procp = (void **) &disp->Color4b;
-
-        snprintf(symboln, sizeof(symboln), "%sColor4b", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Color4bv) {
-        void **procp = (void **) &disp->Color4bv;
-
-        snprintf(symboln, sizeof(symboln), "%sColor4bv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Color4d) {
-        void **procp = (void **) &disp->Color4d;
-
-        snprintf(symboln, sizeof(symboln), "%sColor4d", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Color4dv) {
-        void **procp = (void **) &disp->Color4dv;
-
-        snprintf(symboln, sizeof(symboln), "%sColor4dv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Color4f) {
-        void **procp = (void **) &disp->Color4f;
-
-        snprintf(symboln, sizeof(symboln), "%sColor4f", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Color4fv) {
-        void **procp = (void **) &disp->Color4fv;
-
-        snprintf(symboln, sizeof(symboln), "%sColor4fv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Color4i) {
-        void **procp = (void **) &disp->Color4i;
-
-        snprintf(symboln, sizeof(symboln), "%sColor4i", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Color4iv) {
-        void **procp = (void **) &disp->Color4iv;
-
-        snprintf(symboln, sizeof(symboln), "%sColor4iv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Color4s) {
-        void **procp = (void **) &disp->Color4s;
-
-        snprintf(symboln, sizeof(symboln), "%sColor4s", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Color4sv) {
-        void **procp = (void **) &disp->Color4sv;
-
-        snprintf(symboln, sizeof(symboln), "%sColor4sv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Color4ub) {
-        void **procp = (void **) &disp->Color4ub;
-
-        snprintf(symboln, sizeof(symboln), "%sColor4ub", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Color4ubv) {
-        void **procp = (void **) &disp->Color4ubv;
-
-        snprintf(symboln, sizeof(symboln), "%sColor4ubv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Color4ui) {
-        void **procp = (void **) &disp->Color4ui;
-
-        snprintf(symboln, sizeof(symboln), "%sColor4ui", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Color4uiv) {
-        void **procp = (void **) &disp->Color4uiv;
-
-        snprintf(symboln, sizeof(symboln), "%sColor4uiv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Color4us) {
-        void **procp = (void **) &disp->Color4us;
-
-        snprintf(symboln, sizeof(symboln), "%sColor4us", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Color4usv) {
-        void **procp = (void **) &disp->Color4usv;
-
-        snprintf(symboln, sizeof(symboln), "%sColor4usv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->EdgeFlag) {
-        void **procp = (void **) &disp->EdgeFlag;
-
-        snprintf(symboln, sizeof(symboln), "%sEdgeFlag", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->EdgeFlagv) {
-        void **procp = (void **) &disp->EdgeFlagv;
-
-        snprintf(symboln, sizeof(symboln), "%sEdgeFlagv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->End) {
-        void **procp = (void **) &disp->End;
-
-        snprintf(symboln, sizeof(symboln), "%sEnd", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Indexd) {
-        void **procp = (void **) &disp->Indexd;
-
-        snprintf(symboln, sizeof(symboln), "%sIndexd", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Indexdv) {
-        void **procp = (void **) &disp->Indexdv;
-
-        snprintf(symboln, sizeof(symboln), "%sIndexdv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Indexf) {
-        void **procp = (void **) &disp->Indexf;
-
-        snprintf(symboln, sizeof(symboln), "%sIndexf", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Indexfv) {
-        void **procp = (void **) &disp->Indexfv;
-
-        snprintf(symboln, sizeof(symboln), "%sIndexfv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Indexi) {
-        void **procp = (void **) &disp->Indexi;
-
-        snprintf(symboln, sizeof(symboln), "%sIndexi", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Indexiv) {
-        void **procp = (void **) &disp->Indexiv;
-
-        snprintf(symboln, sizeof(symboln), "%sIndexiv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Indexs) {
-        void **procp = (void **) &disp->Indexs;
-
-        snprintf(symboln, sizeof(symboln), "%sIndexs", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Indexsv) {
-        void **procp = (void **) &disp->Indexsv;
-
-        snprintf(symboln, sizeof(symboln), "%sIndexsv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Normal3b) {
-        void **procp = (void **) &disp->Normal3b;
-
-        snprintf(symboln, sizeof(symboln), "%sNormal3b", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Normal3bv) {
-        void **procp = (void **) &disp->Normal3bv;
-
-        snprintf(symboln, sizeof(symboln), "%sNormal3bv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Normal3d) {
-        void **procp = (void **) &disp->Normal3d;
-
-        snprintf(symboln, sizeof(symboln), "%sNormal3d", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Normal3dv) {
-        void **procp = (void **) &disp->Normal3dv;
-
-        snprintf(symboln, sizeof(symboln), "%sNormal3dv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Normal3f) {
-        void **procp = (void **) &disp->Normal3f;
-
-        snprintf(symboln, sizeof(symboln), "%sNormal3f", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Normal3fv) {
-        void **procp = (void **) &disp->Normal3fv;
-
-        snprintf(symboln, sizeof(symboln), "%sNormal3fv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Normal3i) {
-        void **procp = (void **) &disp->Normal3i;
-
-        snprintf(symboln, sizeof(symboln), "%sNormal3i", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Normal3iv) {
-        void **procp = (void **) &disp->Normal3iv;
-
-        snprintf(symboln, sizeof(symboln), "%sNormal3iv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Normal3s) {
-        void **procp = (void **) &disp->Normal3s;
-
-        snprintf(symboln, sizeof(symboln), "%sNormal3s", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Normal3sv) {
-        void **procp = (void **) &disp->Normal3sv;
-
-        snprintf(symboln, sizeof(symboln), "%sNormal3sv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->RasterPos2d) {
-        void **procp = (void **) &disp->RasterPos2d;
-
-        snprintf(symboln, sizeof(symboln), "%sRasterPos2d", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->RasterPos2dv) {
-        void **procp = (void **) &disp->RasterPos2dv;
-
-        snprintf(symboln, sizeof(symboln), "%sRasterPos2dv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->RasterPos2f) {
-        void **procp = (void **) &disp->RasterPos2f;
-
-        snprintf(symboln, sizeof(symboln), "%sRasterPos2f", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->RasterPos2fv) {
-        void **procp = (void **) &disp->RasterPos2fv;
-
-        snprintf(symboln, sizeof(symboln), "%sRasterPos2fv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->RasterPos2i) {
-        void **procp = (void **) &disp->RasterPos2i;
-
-        snprintf(symboln, sizeof(symboln), "%sRasterPos2i", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->RasterPos2iv) {
-        void **procp = (void **) &disp->RasterPos2iv;
-
-        snprintf(symboln, sizeof(symboln), "%sRasterPos2iv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->RasterPos2s) {
-        void **procp = (void **) &disp->RasterPos2s;
-
-        snprintf(symboln, sizeof(symboln), "%sRasterPos2s", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->RasterPos2sv) {
-        void **procp = (void **) &disp->RasterPos2sv;
-
-        snprintf(symboln, sizeof(symboln), "%sRasterPos2sv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->RasterPos3d) {
-        void **procp = (void **) &disp->RasterPos3d;
-
-        snprintf(symboln, sizeof(symboln), "%sRasterPos3d", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->RasterPos3dv) {
-        void **procp = (void **) &disp->RasterPos3dv;
-
-        snprintf(symboln, sizeof(symboln), "%sRasterPos3dv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->RasterPos3f) {
-        void **procp = (void **) &disp->RasterPos3f;
-
-        snprintf(symboln, sizeof(symboln), "%sRasterPos3f", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->RasterPos3fv) {
-        void **procp = (void **) &disp->RasterPos3fv;
-
-        snprintf(symboln, sizeof(symboln), "%sRasterPos3fv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->RasterPos3i) {
-        void **procp = (void **) &disp->RasterPos3i;
-
-        snprintf(symboln, sizeof(symboln), "%sRasterPos3i", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->RasterPos3iv) {
-        void **procp = (void **) &disp->RasterPos3iv;
-
-        snprintf(symboln, sizeof(symboln), "%sRasterPos3iv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->RasterPos3s) {
-        void **procp = (void **) &disp->RasterPos3s;
-
-        snprintf(symboln, sizeof(symboln), "%sRasterPos3s", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->RasterPos3sv) {
-        void **procp = (void **) &disp->RasterPos3sv;
-
-        snprintf(symboln, sizeof(symboln), "%sRasterPos3sv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->RasterPos4d) {
-        void **procp = (void **) &disp->RasterPos4d;
-
-        snprintf(symboln, sizeof(symboln), "%sRasterPos4d", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->RasterPos4dv) {
-        void **procp = (void **) &disp->RasterPos4dv;
-
-        snprintf(symboln, sizeof(symboln), "%sRasterPos4dv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->RasterPos4f) {
-        void **procp = (void **) &disp->RasterPos4f;
-
-        snprintf(symboln, sizeof(symboln), "%sRasterPos4f", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->RasterPos4fv) {
-        void **procp = (void **) &disp->RasterPos4fv;
-
-        snprintf(symboln, sizeof(symboln), "%sRasterPos4fv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->RasterPos4i) {
-        void **procp = (void **) &disp->RasterPos4i;
-
-        snprintf(symboln, sizeof(symboln), "%sRasterPos4i", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->RasterPos4iv) {
-        void **procp = (void **) &disp->RasterPos4iv;
-
-        snprintf(symboln, sizeof(symboln), "%sRasterPos4iv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->RasterPos4s) {
-        void **procp = (void **) &disp->RasterPos4s;
-
-        snprintf(symboln, sizeof(symboln), "%sRasterPos4s", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->RasterPos4sv) {
-        void **procp = (void **) &disp->RasterPos4sv;
-
-        snprintf(symboln, sizeof(symboln), "%sRasterPos4sv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Rectd) {
-        void **procp = (void **) &disp->Rectd;
-
-        snprintf(symboln, sizeof(symboln), "%sRectd", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Rectdv) {
-        void **procp = (void **) &disp->Rectdv;
-
-        snprintf(symboln, sizeof(symboln), "%sRectdv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Rectf) {
-        void **procp = (void **) &disp->Rectf;
-
-        snprintf(symboln, sizeof(symboln), "%sRectf", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Rectfv) {
-        void **procp = (void **) &disp->Rectfv;
-
-        snprintf(symboln, sizeof(symboln), "%sRectfv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Recti) {
-        void **procp = (void **) &disp->Recti;
-
-        snprintf(symboln, sizeof(symboln), "%sRecti", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Rectiv) {
-        void **procp = (void **) &disp->Rectiv;
-
-        snprintf(symboln, sizeof(symboln), "%sRectiv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Rects) {
-        void **procp = (void **) &disp->Rects;
-
-        snprintf(symboln, sizeof(symboln), "%sRects", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Rectsv) {
-        void **procp = (void **) &disp->Rectsv;
-
-        snprintf(symboln, sizeof(symboln), "%sRectsv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TexCoord1d) {
-        void **procp = (void **) &disp->TexCoord1d;
-
-        snprintf(symboln, sizeof(symboln), "%sTexCoord1d", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TexCoord1dv) {
-        void **procp = (void **) &disp->TexCoord1dv;
-
-        snprintf(symboln, sizeof(symboln), "%sTexCoord1dv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TexCoord1f) {
-        void **procp = (void **) &disp->TexCoord1f;
-
-        snprintf(symboln, sizeof(symboln), "%sTexCoord1f", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TexCoord1fv) {
-        void **procp = (void **) &disp->TexCoord1fv;
-
-        snprintf(symboln, sizeof(symboln), "%sTexCoord1fv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TexCoord1i) {
-        void **procp = (void **) &disp->TexCoord1i;
-
-        snprintf(symboln, sizeof(symboln), "%sTexCoord1i", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TexCoord1iv) {
-        void **procp = (void **) &disp->TexCoord1iv;
-
-        snprintf(symboln, sizeof(symboln), "%sTexCoord1iv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TexCoord1s) {
-        void **procp = (void **) &disp->TexCoord1s;
-
-        snprintf(symboln, sizeof(symboln), "%sTexCoord1s", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TexCoord1sv) {
-        void **procp = (void **) &disp->TexCoord1sv;
-
-        snprintf(symboln, sizeof(symboln), "%sTexCoord1sv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TexCoord2d) {
-        void **procp = (void **) &disp->TexCoord2d;
-
-        snprintf(symboln, sizeof(symboln), "%sTexCoord2d", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TexCoord2dv) {
-        void **procp = (void **) &disp->TexCoord2dv;
-
-        snprintf(symboln, sizeof(symboln), "%sTexCoord2dv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TexCoord2f) {
-        void **procp = (void **) &disp->TexCoord2f;
-
-        snprintf(symboln, sizeof(symboln), "%sTexCoord2f", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TexCoord2fv) {
-        void **procp = (void **) &disp->TexCoord2fv;
-
-        snprintf(symboln, sizeof(symboln), "%sTexCoord2fv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TexCoord2i) {
-        void **procp = (void **) &disp->TexCoord2i;
-
-        snprintf(symboln, sizeof(symboln), "%sTexCoord2i", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TexCoord2iv) {
-        void **procp = (void **) &disp->TexCoord2iv;
-
-        snprintf(symboln, sizeof(symboln), "%sTexCoord2iv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TexCoord2s) {
-        void **procp = (void **) &disp->TexCoord2s;
-
-        snprintf(symboln, sizeof(symboln), "%sTexCoord2s", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TexCoord2sv) {
-        void **procp = (void **) &disp->TexCoord2sv;
-
-        snprintf(symboln, sizeof(symboln), "%sTexCoord2sv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TexCoord3d) {
-        void **procp = (void **) &disp->TexCoord3d;
-
-        snprintf(symboln, sizeof(symboln), "%sTexCoord3d", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TexCoord3dv) {
-        void **procp = (void **) &disp->TexCoord3dv;
-
-        snprintf(symboln, sizeof(symboln), "%sTexCoord3dv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TexCoord3f) {
-        void **procp = (void **) &disp->TexCoord3f;
-
-        snprintf(symboln, sizeof(symboln), "%sTexCoord3f", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TexCoord3fv) {
-        void **procp = (void **) &disp->TexCoord3fv;
-
-        snprintf(symboln, sizeof(symboln), "%sTexCoord3fv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TexCoord3i) {
-        void **procp = (void **) &disp->TexCoord3i;
-
-        snprintf(symboln, sizeof(symboln), "%sTexCoord3i", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TexCoord3iv) {
-        void **procp = (void **) &disp->TexCoord3iv;
-
-        snprintf(symboln, sizeof(symboln), "%sTexCoord3iv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TexCoord3s) {
-        void **procp = (void **) &disp->TexCoord3s;
-
-        snprintf(symboln, sizeof(symboln), "%sTexCoord3s", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TexCoord3sv) {
-        void **procp = (void **) &disp->TexCoord3sv;
-
-        snprintf(symboln, sizeof(symboln), "%sTexCoord3sv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TexCoord4d) {
-        void **procp = (void **) &disp->TexCoord4d;
-
-        snprintf(symboln, sizeof(symboln), "%sTexCoord4d", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TexCoord4dv) {
-        void **procp = (void **) &disp->TexCoord4dv;
-
-        snprintf(symboln, sizeof(symboln), "%sTexCoord4dv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TexCoord4f) {
-        void **procp = (void **) &disp->TexCoord4f;
-
-        snprintf(symboln, sizeof(symboln), "%sTexCoord4f", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TexCoord4fv) {
-        void **procp = (void **) &disp->TexCoord4fv;
-
-        snprintf(symboln, sizeof(symboln), "%sTexCoord4fv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TexCoord4i) {
-        void **procp = (void **) &disp->TexCoord4i;
-
-        snprintf(symboln, sizeof(symboln), "%sTexCoord4i", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TexCoord4iv) {
-        void **procp = (void **) &disp->TexCoord4iv;
-
-        snprintf(symboln, sizeof(symboln), "%sTexCoord4iv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TexCoord4s) {
-        void **procp = (void **) &disp->TexCoord4s;
-
-        snprintf(symboln, sizeof(symboln), "%sTexCoord4s", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TexCoord4sv) {
-        void **procp = (void **) &disp->TexCoord4sv;
-
-        snprintf(symboln, sizeof(symboln), "%sTexCoord4sv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Vertex2d) {
-        void **procp = (void **) &disp->Vertex2d;
-
-        snprintf(symboln, sizeof(symboln), "%sVertex2d", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Vertex2dv) {
-        void **procp = (void **) &disp->Vertex2dv;
-
-        snprintf(symboln, sizeof(symboln), "%sVertex2dv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Vertex2f) {
-        void **procp = (void **) &disp->Vertex2f;
-
-        snprintf(symboln, sizeof(symboln), "%sVertex2f", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Vertex2fv) {
-        void **procp = (void **) &disp->Vertex2fv;
-
-        snprintf(symboln, sizeof(symboln), "%sVertex2fv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Vertex2i) {
-        void **procp = (void **) &disp->Vertex2i;
-
-        snprintf(symboln, sizeof(symboln), "%sVertex2i", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Vertex2iv) {
-        void **procp = (void **) &disp->Vertex2iv;
-
-        snprintf(symboln, sizeof(symboln), "%sVertex2iv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Vertex2s) {
-        void **procp = (void **) &disp->Vertex2s;
-
-        snprintf(symboln, sizeof(symboln), "%sVertex2s", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Vertex2sv) {
-        void **procp = (void **) &disp->Vertex2sv;
-
-        snprintf(symboln, sizeof(symboln), "%sVertex2sv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Vertex3d) {
-        void **procp = (void **) &disp->Vertex3d;
-
-        snprintf(symboln, sizeof(symboln), "%sVertex3d", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Vertex3dv) {
-        void **procp = (void **) &disp->Vertex3dv;
-
-        snprintf(symboln, sizeof(symboln), "%sVertex3dv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Vertex3f) {
-        void **procp = (void **) &disp->Vertex3f;
-
-        snprintf(symboln, sizeof(symboln), "%sVertex3f", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Vertex3fv) {
-        void **procp = (void **) &disp->Vertex3fv;
-
-        snprintf(symboln, sizeof(symboln), "%sVertex3fv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Vertex3i) {
-        void **procp = (void **) &disp->Vertex3i;
-
-        snprintf(symboln, sizeof(symboln), "%sVertex3i", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Vertex3iv) {
-        void **procp = (void **) &disp->Vertex3iv;
-
-        snprintf(symboln, sizeof(symboln), "%sVertex3iv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Vertex3s) {
-        void **procp = (void **) &disp->Vertex3s;
-
-        snprintf(symboln, sizeof(symboln), "%sVertex3s", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Vertex3sv) {
-        void **procp = (void **) &disp->Vertex3sv;
-
-        snprintf(symboln, sizeof(symboln), "%sVertex3sv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Vertex4d) {
-        void **procp = (void **) &disp->Vertex4d;
-
-        snprintf(symboln, sizeof(symboln), "%sVertex4d", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Vertex4dv) {
-        void **procp = (void **) &disp->Vertex4dv;
-
-        snprintf(symboln, sizeof(symboln), "%sVertex4dv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Vertex4f) {
-        void **procp = (void **) &disp->Vertex4f;
-
-        snprintf(symboln, sizeof(symboln), "%sVertex4f", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Vertex4fv) {
-        void **procp = (void **) &disp->Vertex4fv;
-
-        snprintf(symboln, sizeof(symboln), "%sVertex4fv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Vertex4i) {
-        void **procp = (void **) &disp->Vertex4i;
-
-        snprintf(symboln, sizeof(symboln), "%sVertex4i", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Vertex4iv) {
-        void **procp = (void **) &disp->Vertex4iv;
-
-        snprintf(symboln, sizeof(symboln), "%sVertex4iv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Vertex4s) {
-        void **procp = (void **) &disp->Vertex4s;
-
-        snprintf(symboln, sizeof(symboln), "%sVertex4s", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Vertex4sv) {
-        void **procp = (void **) &disp->Vertex4sv;
-
-        snprintf(symboln, sizeof(symboln), "%sVertex4sv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ClipPlane) {
-        void **procp = (void **) &disp->ClipPlane;
-
-        snprintf(symboln, sizeof(symboln), "%sClipPlane", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ColorMaterial) {
-        void **procp = (void **) &disp->ColorMaterial;
-
-        snprintf(symboln, sizeof(symboln), "%sColorMaterial", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->CullFace) {
-        void **procp = (void **) &disp->CullFace;
-
-        snprintf(symboln, sizeof(symboln), "%sCullFace", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Fogf) {
-        void **procp = (void **) &disp->Fogf;
-
-        snprintf(symboln, sizeof(symboln), "%sFogf", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Fogfv) {
-        void **procp = (void **) &disp->Fogfv;
-
-        snprintf(symboln, sizeof(symboln), "%sFogfv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Fogi) {
-        void **procp = (void **) &disp->Fogi;
-
-        snprintf(symboln, sizeof(symboln), "%sFogi", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Fogiv) {
-        void **procp = (void **) &disp->Fogiv;
-
-        snprintf(symboln, sizeof(symboln), "%sFogiv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->FrontFace) {
-        void **procp = (void **) &disp->FrontFace;
-
-        snprintf(symboln, sizeof(symboln), "%sFrontFace", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Hint) {
-        void **procp = (void **) &disp->Hint;
-
-        snprintf(symboln, sizeof(symboln), "%sHint", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Lightf) {
-        void **procp = (void **) &disp->Lightf;
-
-        snprintf(symboln, sizeof(symboln), "%sLightf", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Lightfv) {
-        void **procp = (void **) &disp->Lightfv;
-
-        snprintf(symboln, sizeof(symboln), "%sLightfv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Lighti) {
-        void **procp = (void **) &disp->Lighti;
-
-        snprintf(symboln, sizeof(symboln), "%sLighti", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Lightiv) {
-        void **procp = (void **) &disp->Lightiv;
-
-        snprintf(symboln, sizeof(symboln), "%sLightiv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->LightModelf) {
-        void **procp = (void **) &disp->LightModelf;
-
-        snprintf(symboln, sizeof(symboln), "%sLightModelf", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->LightModelfv) {
-        void **procp = (void **) &disp->LightModelfv;
-
-        snprintf(symboln, sizeof(symboln), "%sLightModelfv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->LightModeli) {
-        void **procp = (void **) &disp->LightModeli;
-
-        snprintf(symboln, sizeof(symboln), "%sLightModeli", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->LightModeliv) {
-        void **procp = (void **) &disp->LightModeliv;
-
-        snprintf(symboln, sizeof(symboln), "%sLightModeliv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->LineStipple) {
-        void **procp = (void **) &disp->LineStipple;
-
-        snprintf(symboln, sizeof(symboln), "%sLineStipple", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->LineWidth) {
-        void **procp = (void **) &disp->LineWidth;
-
-        snprintf(symboln, sizeof(symboln), "%sLineWidth", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Materialf) {
-        void **procp = (void **) &disp->Materialf;
-
-        snprintf(symboln, sizeof(symboln), "%sMaterialf", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Materialfv) {
-        void **procp = (void **) &disp->Materialfv;
-
-        snprintf(symboln, sizeof(symboln), "%sMaterialfv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Materiali) {
-        void **procp = (void **) &disp->Materiali;
-
-        snprintf(symboln, sizeof(symboln), "%sMateriali", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Materialiv) {
-        void **procp = (void **) &disp->Materialiv;
-
-        snprintf(symboln, sizeof(symboln), "%sMaterialiv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->PointSize) {
-        void **procp = (void **) &disp->PointSize;
-
-        snprintf(symboln, sizeof(symboln), "%sPointSize", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->PolygonMode) {
-        void **procp = (void **) &disp->PolygonMode;
-
-        snprintf(symboln, sizeof(symboln), "%sPolygonMode", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->PolygonStipple) {
-        void **procp = (void **) &disp->PolygonStipple;
-
-        snprintf(symboln, sizeof(symboln), "%sPolygonStipple", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Scissor) {
-        void **procp = (void **) &disp->Scissor;
-
-        snprintf(symboln, sizeof(symboln), "%sScissor", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ShadeModel) {
-        void **procp = (void **) &disp->ShadeModel;
-
-        snprintf(symboln, sizeof(symboln), "%sShadeModel", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TexParameterf) {
-        void **procp = (void **) &disp->TexParameterf;
-
-        snprintf(symboln, sizeof(symboln), "%sTexParameterf", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TexParameterfv) {
-        void **procp = (void **) &disp->TexParameterfv;
-
-        snprintf(symboln, sizeof(symboln), "%sTexParameterfv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TexParameteri) {
-        void **procp = (void **) &disp->TexParameteri;
-
-        snprintf(symboln, sizeof(symboln), "%sTexParameteri", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TexParameteriv) {
-        void **procp = (void **) &disp->TexParameteriv;
-
-        snprintf(symboln, sizeof(symboln), "%sTexParameteriv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TexImage1D) {
-        void **procp = (void **) &disp->TexImage1D;
-
-        snprintf(symboln, sizeof(symboln), "%sTexImage1D", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TexImage2D) {
-        void **procp = (void **) &disp->TexImage2D;
-
-        snprintf(symboln, sizeof(symboln), "%sTexImage2D", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TexEnvf) {
-        void **procp = (void **) &disp->TexEnvf;
-
-        snprintf(symboln, sizeof(symboln), "%sTexEnvf", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TexEnvfv) {
-        void **procp = (void **) &disp->TexEnvfv;
-
-        snprintf(symboln, sizeof(symboln), "%sTexEnvfv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TexEnvi) {
-        void **procp = (void **) &disp->TexEnvi;
-
-        snprintf(symboln, sizeof(symboln), "%sTexEnvi", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TexEnviv) {
-        void **procp = (void **) &disp->TexEnviv;
-
-        snprintf(symboln, sizeof(symboln), "%sTexEnviv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TexGend) {
-        void **procp = (void **) &disp->TexGend;
-
-        snprintf(symboln, sizeof(symboln), "%sTexGend", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TexGendv) {
-        void **procp = (void **) &disp->TexGendv;
-
-        snprintf(symboln, sizeof(symboln), "%sTexGendv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TexGenf) {
-        void **procp = (void **) &disp->TexGenf;
-
-        snprintf(symboln, sizeof(symboln), "%sTexGenf", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TexGenfv) {
-        void **procp = (void **) &disp->TexGenfv;
-
-        snprintf(symboln, sizeof(symboln), "%sTexGenfv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TexGeni) {
-        void **procp = (void **) &disp->TexGeni;
-
-        snprintf(symboln, sizeof(symboln), "%sTexGeni", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TexGeniv) {
-        void **procp = (void **) &disp->TexGeniv;
-
-        snprintf(symboln, sizeof(symboln), "%sTexGeniv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->FeedbackBuffer) {
-        void **procp = (void **) &disp->FeedbackBuffer;
-
-        snprintf(symboln, sizeof(symboln), "%sFeedbackBuffer", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->SelectBuffer) {
-        void **procp = (void **) &disp->SelectBuffer;
-
-        snprintf(symboln, sizeof(symboln), "%sSelectBuffer", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->RenderMode) {
-        void **procp = (void **) &disp->RenderMode;
-
-        snprintf(symboln, sizeof(symboln), "%sRenderMode", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->InitNames) {
-        void **procp = (void **) &disp->InitNames;
-
-        snprintf(symboln, sizeof(symboln), "%sInitNames", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->LoadName) {
-        void **procp = (void **) &disp->LoadName;
-
-        snprintf(symboln, sizeof(symboln), "%sLoadName", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->PassThrough) {
-        void **procp = (void **) &disp->PassThrough;
-
-        snprintf(symboln, sizeof(symboln), "%sPassThrough", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->PopName) {
-        void **procp = (void **) &disp->PopName;
-
-        snprintf(symboln, sizeof(symboln), "%sPopName", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->PushName) {
-        void **procp = (void **) &disp->PushName;
-
-        snprintf(symboln, sizeof(symboln), "%sPushName", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->DrawBuffer) {
-        void **procp = (void **) &disp->DrawBuffer;
-
-        snprintf(symboln, sizeof(symboln), "%sDrawBuffer", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Clear) {
-        void **procp = (void **) &disp->Clear;
-
-        snprintf(symboln, sizeof(symboln), "%sClear", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ClearAccum) {
-        void **procp = (void **) &disp->ClearAccum;
-
-        snprintf(symboln, sizeof(symboln), "%sClearAccum", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ClearIndex) {
-        void **procp = (void **) &disp->ClearIndex;
-
-        snprintf(symboln, sizeof(symboln), "%sClearIndex", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ClearColor) {
-        void **procp = (void **) &disp->ClearColor;
-
-        snprintf(symboln, sizeof(symboln), "%sClearColor", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ClearStencil) {
-        void **procp = (void **) &disp->ClearStencil;
-
-        snprintf(symboln, sizeof(symboln), "%sClearStencil", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ClearDepth) {
-        void **procp = (void **) &disp->ClearDepth;
-
-        snprintf(symboln, sizeof(symboln), "%sClearDepth", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->StencilMask) {
-        void **procp = (void **) &disp->StencilMask;
-
-        snprintf(symboln, sizeof(symboln), "%sStencilMask", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ColorMask) {
-        void **procp = (void **) &disp->ColorMask;
-
-        snprintf(symboln, sizeof(symboln), "%sColorMask", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->DepthMask) {
-        void **procp = (void **) &disp->DepthMask;
-
-        snprintf(symboln, sizeof(symboln), "%sDepthMask", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->IndexMask) {
-        void **procp = (void **) &disp->IndexMask;
-
-        snprintf(symboln, sizeof(symboln), "%sIndexMask", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Accum) {
-        void **procp = (void **) &disp->Accum;
-
-        snprintf(symboln, sizeof(symboln), "%sAccum", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Disable) {
-        void **procp = (void **) &disp->Disable;
-
-        snprintf(symboln, sizeof(symboln), "%sDisable", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Enable) {
-        void **procp = (void **) &disp->Enable;
-
-        snprintf(symboln, sizeof(symboln), "%sEnable", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Finish) {
-        void **procp = (void **) &disp->Finish;
-
-        snprintf(symboln, sizeof(symboln), "%sFinish", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Flush) {
-        void **procp = (void **) &disp->Flush;
-
-        snprintf(symboln, sizeof(symboln), "%sFlush", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->PopAttrib) {
-        void **procp = (void **) &disp->PopAttrib;
-
-        snprintf(symboln, sizeof(symboln), "%sPopAttrib", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->PushAttrib) {
-        void **procp = (void **) &disp->PushAttrib;
-
-        snprintf(symboln, sizeof(symboln), "%sPushAttrib", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Map1d) {
-        void **procp = (void **) &disp->Map1d;
-
-        snprintf(symboln, sizeof(symboln), "%sMap1d", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Map1f) {
-        void **procp = (void **) &disp->Map1f;
-
-        snprintf(symboln, sizeof(symboln), "%sMap1f", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Map2d) {
-        void **procp = (void **) &disp->Map2d;
-
-        snprintf(symboln, sizeof(symboln), "%sMap2d", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Map2f) {
-        void **procp = (void **) &disp->Map2f;
-
-        snprintf(symboln, sizeof(symboln), "%sMap2f", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MapGrid1d) {
-        void **procp = (void **) &disp->MapGrid1d;
-
-        snprintf(symboln, sizeof(symboln), "%sMapGrid1d", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MapGrid1f) {
-        void **procp = (void **) &disp->MapGrid1f;
-
-        snprintf(symboln, sizeof(symboln), "%sMapGrid1f", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MapGrid2d) {
-        void **procp = (void **) &disp->MapGrid2d;
-
-        snprintf(symboln, sizeof(symboln), "%sMapGrid2d", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MapGrid2f) {
-        void **procp = (void **) &disp->MapGrid2f;
-
-        snprintf(symboln, sizeof(symboln), "%sMapGrid2f", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->EvalCoord1d) {
-        void **procp = (void **) &disp->EvalCoord1d;
-
-        snprintf(symboln, sizeof(symboln), "%sEvalCoord1d", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->EvalCoord1dv) {
-        void **procp = (void **) &disp->EvalCoord1dv;
-
-        snprintf(symboln, sizeof(symboln), "%sEvalCoord1dv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->EvalCoord1f) {
-        void **procp = (void **) &disp->EvalCoord1f;
-
-        snprintf(symboln, sizeof(symboln), "%sEvalCoord1f", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->EvalCoord1fv) {
-        void **procp = (void **) &disp->EvalCoord1fv;
-
-        snprintf(symboln, sizeof(symboln), "%sEvalCoord1fv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->EvalCoord2d) {
-        void **procp = (void **) &disp->EvalCoord2d;
-
-        snprintf(symboln, sizeof(symboln), "%sEvalCoord2d", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->EvalCoord2dv) {
-        void **procp = (void **) &disp->EvalCoord2dv;
-
-        snprintf(symboln, sizeof(symboln), "%sEvalCoord2dv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->EvalCoord2f) {
-        void **procp = (void **) &disp->EvalCoord2f;
-
-        snprintf(symboln, sizeof(symboln), "%sEvalCoord2f", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->EvalCoord2fv) {
-        void **procp = (void **) &disp->EvalCoord2fv;
-
-        snprintf(symboln, sizeof(symboln), "%sEvalCoord2fv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->EvalMesh1) {
-        void **procp = (void **) &disp->EvalMesh1;
-
-        snprintf(symboln, sizeof(symboln), "%sEvalMesh1", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->EvalPoint1) {
-        void **procp = (void **) &disp->EvalPoint1;
-
-        snprintf(symboln, sizeof(symboln), "%sEvalPoint1", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->EvalMesh2) {
-        void **procp = (void **) &disp->EvalMesh2;
-
-        snprintf(symboln, sizeof(symboln), "%sEvalMesh2", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->EvalPoint2) {
-        void **procp = (void **) &disp->EvalPoint2;
-
-        snprintf(symboln, sizeof(symboln), "%sEvalPoint2", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->AlphaFunc) {
-        void **procp = (void **) &disp->AlphaFunc;
-
-        snprintf(symboln, sizeof(symboln), "%sAlphaFunc", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->BlendFunc) {
-        void **procp = (void **) &disp->BlendFunc;
-
-        snprintf(symboln, sizeof(symboln), "%sBlendFunc", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->LogicOp) {
-        void **procp = (void **) &disp->LogicOp;
-
-        snprintf(symboln, sizeof(symboln), "%sLogicOp", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->StencilFunc) {
-        void **procp = (void **) &disp->StencilFunc;
-
-        snprintf(symboln, sizeof(symboln), "%sStencilFunc", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->StencilOp) {
-        void **procp = (void **) &disp->StencilOp;
-
-        snprintf(symboln, sizeof(symboln), "%sStencilOp", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->DepthFunc) {
-        void **procp = (void **) &disp->DepthFunc;
-
-        snprintf(symboln, sizeof(symboln), "%sDepthFunc", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->PixelZoom) {
-        void **procp = (void **) &disp->PixelZoom;
-
-        snprintf(symboln, sizeof(symboln), "%sPixelZoom", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->PixelTransferf) {
-        void **procp = (void **) &disp->PixelTransferf;
-
-        snprintf(symboln, sizeof(symboln), "%sPixelTransferf", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->PixelTransferi) {
-        void **procp = (void **) &disp->PixelTransferi;
-
-        snprintf(symboln, sizeof(symboln), "%sPixelTransferi", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->PixelStoref) {
-        void **procp = (void **) &disp->PixelStoref;
-
-        snprintf(symboln, sizeof(symboln), "%sPixelStoref", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->PixelStorei) {
-        void **procp = (void **) &disp->PixelStorei;
-
-        snprintf(symboln, sizeof(symboln), "%sPixelStorei", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->PixelMapfv) {
-        void **procp = (void **) &disp->PixelMapfv;
-
-        snprintf(symboln, sizeof(symboln), "%sPixelMapfv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->PixelMapuiv) {
-        void **procp = (void **) &disp->PixelMapuiv;
-
-        snprintf(symboln, sizeof(symboln), "%sPixelMapuiv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->PixelMapusv) {
-        void **procp = (void **) &disp->PixelMapusv;
-
-        snprintf(symboln, sizeof(symboln), "%sPixelMapusv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ReadBuffer) {
-        void **procp = (void **) &disp->ReadBuffer;
-
-        snprintf(symboln, sizeof(symboln), "%sReadBuffer", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->CopyPixels) {
-        void **procp = (void **) &disp->CopyPixels;
-
-        snprintf(symboln, sizeof(symboln), "%sCopyPixels", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ReadPixels) {
-        void **procp = (void **) &disp->ReadPixels;
-
-        snprintf(symboln, sizeof(symboln), "%sReadPixels", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->DrawPixels) {
-        void **procp = (void **) &disp->DrawPixels;
-
-        snprintf(symboln, sizeof(symboln), "%sDrawPixels", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetBooleanv) {
-        void **procp = (void **) &disp->GetBooleanv;
-
-        snprintf(symboln, sizeof(symboln), "%sGetBooleanv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetClipPlane) {
-        void **procp = (void **) &disp->GetClipPlane;
-
-        snprintf(symboln, sizeof(symboln), "%sGetClipPlane", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetDoublev) {
-        void **procp = (void **) &disp->GetDoublev;
-
-        snprintf(symboln, sizeof(symboln), "%sGetDoublev", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetError) {
-        void **procp = (void **) &disp->GetError;
-
-        snprintf(symboln, sizeof(symboln), "%sGetError", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetFloatv) {
-        void **procp = (void **) &disp->GetFloatv;
-
-        snprintf(symboln, sizeof(symboln), "%sGetFloatv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetIntegerv) {
-        void **procp = (void **) &disp->GetIntegerv;
-
-        snprintf(symboln, sizeof(symboln), "%sGetIntegerv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetLightfv) {
-        void **procp = (void **) &disp->GetLightfv;
-
-        snprintf(symboln, sizeof(symboln), "%sGetLightfv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetLightiv) {
-        void **procp = (void **) &disp->GetLightiv;
-
-        snprintf(symboln, sizeof(symboln), "%sGetLightiv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetMapdv) {
-        void **procp = (void **) &disp->GetMapdv;
-
-        snprintf(symboln, sizeof(symboln), "%sGetMapdv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetMapfv) {
-        void **procp = (void **) &disp->GetMapfv;
-
-        snprintf(symboln, sizeof(symboln), "%sGetMapfv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetMapiv) {
-        void **procp = (void **) &disp->GetMapiv;
-
-        snprintf(symboln, sizeof(symboln), "%sGetMapiv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetMaterialfv) {
-        void **procp = (void **) &disp->GetMaterialfv;
-
-        snprintf(symboln, sizeof(symboln), "%sGetMaterialfv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetMaterialiv) {
-        void **procp = (void **) &disp->GetMaterialiv;
-
-        snprintf(symboln, sizeof(symboln), "%sGetMaterialiv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetPixelMapfv) {
-        void **procp = (void **) &disp->GetPixelMapfv;
-
-        snprintf(symboln, sizeof(symboln), "%sGetPixelMapfv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetPixelMapuiv) {
-        void **procp = (void **) &disp->GetPixelMapuiv;
-
-        snprintf(symboln, sizeof(symboln), "%sGetPixelMapuiv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetPixelMapusv) {
-        void **procp = (void **) &disp->GetPixelMapusv;
-
-        snprintf(symboln, sizeof(symboln), "%sGetPixelMapusv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetPolygonStipple) {
-        void **procp = (void **) &disp->GetPolygonStipple;
-
-        snprintf(symboln, sizeof(symboln), "%sGetPolygonStipple",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetString) {
-        void **procp = (void **) &disp->GetString;
-
-        snprintf(symboln, sizeof(symboln), "%sGetString", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetTexEnvfv) {
-        void **procp = (void **) &disp->GetTexEnvfv;
-
-        snprintf(symboln, sizeof(symboln), "%sGetTexEnvfv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetTexEnviv) {
-        void **procp = (void **) &disp->GetTexEnviv;
-
-        snprintf(symboln, sizeof(symboln), "%sGetTexEnviv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetTexGendv) {
-        void **procp = (void **) &disp->GetTexGendv;
-
-        snprintf(symboln, sizeof(symboln), "%sGetTexGendv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetTexGenfv) {
-        void **procp = (void **) &disp->GetTexGenfv;
-
-        snprintf(symboln, sizeof(symboln), "%sGetTexGenfv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetTexGeniv) {
-        void **procp = (void **) &disp->GetTexGeniv;
-
-        snprintf(symboln, sizeof(symboln), "%sGetTexGeniv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetTexImage) {
-        void **procp = (void **) &disp->GetTexImage;
-
-        snprintf(symboln, sizeof(symboln), "%sGetTexImage", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetTexParameterfv) {
-        void **procp = (void **) &disp->GetTexParameterfv;
-
-        snprintf(symboln, sizeof(symboln), "%sGetTexParameterfv",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetTexParameteriv) {
-        void **procp = (void **) &disp->GetTexParameteriv;
-
-        snprintf(symboln, sizeof(symboln), "%sGetTexParameteriv",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetTexLevelParameterfv) {
-        void **procp = (void **) &disp->GetTexLevelParameterfv;
-
-        snprintf(symboln, sizeof(symboln), "%sGetTexLevelParameterfv",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetTexLevelParameteriv) {
-        void **procp = (void **) &disp->GetTexLevelParameteriv;
-
-        snprintf(symboln, sizeof(symboln), "%sGetTexLevelParameteriv",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->IsEnabled) {
-        void **procp = (void **) &disp->IsEnabled;
-
-        snprintf(symboln, sizeof(symboln), "%sIsEnabled", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->IsList) {
-        void **procp = (void **) &disp->IsList;
-
-        snprintf(symboln, sizeof(symboln), "%sIsList", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->DepthRange) {
-        void **procp = (void **) &disp->DepthRange;
-
-        snprintf(symboln, sizeof(symboln), "%sDepthRange", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Frustum) {
-        void **procp = (void **) &disp->Frustum;
-
-        snprintf(symboln, sizeof(symboln), "%sFrustum", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->LoadIdentity) {
-        void **procp = (void **) &disp->LoadIdentity;
-
-        snprintf(symboln, sizeof(symboln), "%sLoadIdentity", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->LoadMatrixf) {
-        void **procp = (void **) &disp->LoadMatrixf;
-
-        snprintf(symboln, sizeof(symboln), "%sLoadMatrixf", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->LoadMatrixd) {
-        void **procp = (void **) &disp->LoadMatrixd;
-
-        snprintf(symboln, sizeof(symboln), "%sLoadMatrixd", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MatrixMode) {
-        void **procp = (void **) &disp->MatrixMode;
-
-        snprintf(symboln, sizeof(symboln), "%sMatrixMode", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultMatrixf) {
-        void **procp = (void **) &disp->MultMatrixf;
-
-        snprintf(symboln, sizeof(symboln), "%sMultMatrixf", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultMatrixd) {
-        void **procp = (void **) &disp->MultMatrixd;
-
-        snprintf(symboln, sizeof(symboln), "%sMultMatrixd", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Ortho) {
-        void **procp = (void **) &disp->Ortho;
-
-        snprintf(symboln, sizeof(symboln), "%sOrtho", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->PopMatrix) {
-        void **procp = (void **) &disp->PopMatrix;
-
-        snprintf(symboln, sizeof(symboln), "%sPopMatrix", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->PushMatrix) {
-        void **procp = (void **) &disp->PushMatrix;
-
-        snprintf(symboln, sizeof(symboln), "%sPushMatrix", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Rotated) {
-        void **procp = (void **) &disp->Rotated;
-
-        snprintf(symboln, sizeof(symboln), "%sRotated", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Rotatef) {
-        void **procp = (void **) &disp->Rotatef;
-
-        snprintf(symboln, sizeof(symboln), "%sRotatef", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Scaled) {
-        void **procp = (void **) &disp->Scaled;
-
-        snprintf(symboln, sizeof(symboln), "%sScaled", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Scalef) {
-        void **procp = (void **) &disp->Scalef;
-
-        snprintf(symboln, sizeof(symboln), "%sScalef", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Translated) {
-        void **procp = (void **) &disp->Translated;
-
-        snprintf(symboln, sizeof(symboln), "%sTranslated", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Translatef) {
-        void **procp = (void **) &disp->Translatef;
-
-        snprintf(symboln, sizeof(symboln), "%sTranslatef", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Viewport) {
-        void **procp = (void **) &disp->Viewport;
-
-        snprintf(symboln, sizeof(symboln), "%sViewport", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ArrayElement) {
-        void **procp = (void **) &disp->ArrayElement;
-
-        snprintf(symboln, sizeof(symboln), "%sArrayElement", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ArrayElement) {
-        void **procp = (void **) &disp->ArrayElement;
-
-        snprintf(symboln, sizeof(symboln), "%sArrayElementEXT", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->BindTexture) {
-        void **procp = (void **) &disp->BindTexture;
-
-        snprintf(symboln, sizeof(symboln), "%sBindTexture", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->BindTexture) {
-        void **procp = (void **) &disp->BindTexture;
-
-        snprintf(symboln, sizeof(symboln), "%sBindTextureEXT", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ColorPointer) {
-        void **procp = (void **) &disp->ColorPointer;
-
-        snprintf(symboln, sizeof(symboln), "%sColorPointer", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->DisableClientState) {
-        void **procp = (void **) &disp->DisableClientState;
-
-        snprintf(symboln, sizeof(symboln), "%sDisableClientState",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->DrawArrays) {
-        void **procp = (void **) &disp->DrawArrays;
-
-        snprintf(symboln, sizeof(symboln), "%sDrawArrays", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->DrawArrays) {
-        void **procp = (void **) &disp->DrawArrays;
-
-        snprintf(symboln, sizeof(symboln), "%sDrawArraysEXT", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->DrawElements) {
-        void **procp = (void **) &disp->DrawElements;
-
-        snprintf(symboln, sizeof(symboln), "%sDrawElements", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->EdgeFlagPointer) {
-        void **procp = (void **) &disp->EdgeFlagPointer;
-
-        snprintf(symboln, sizeof(symboln), "%sEdgeFlagPointer", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->EnableClientState) {
-        void **procp = (void **) &disp->EnableClientState;
-
-        snprintf(symboln, sizeof(symboln), "%sEnableClientState",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->IndexPointer) {
-        void **procp = (void **) &disp->IndexPointer;
-
-        snprintf(symboln, sizeof(symboln), "%sIndexPointer", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Indexub) {
-        void **procp = (void **) &disp->Indexub;
-
-        snprintf(symboln, sizeof(symboln), "%sIndexub", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Indexubv) {
-        void **procp = (void **) &disp->Indexubv;
-
-        snprintf(symboln, sizeof(symboln), "%sIndexubv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->InterleavedArrays) {
-        void **procp = (void **) &disp->InterleavedArrays;
-
-        snprintf(symboln, sizeof(symboln), "%sInterleavedArrays",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->NormalPointer) {
-        void **procp = (void **) &disp->NormalPointer;
-
-        snprintf(symboln, sizeof(symboln), "%sNormalPointer", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->PolygonOffset) {
-        void **procp = (void **) &disp->PolygonOffset;
-
-        snprintf(symboln, sizeof(symboln), "%sPolygonOffset", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TexCoordPointer) {
-        void **procp = (void **) &disp->TexCoordPointer;
-
-        snprintf(symboln, sizeof(symboln), "%sTexCoordPointer", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexPointer) {
-        void **procp = (void **) &disp->VertexPointer;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexPointer", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->AreTexturesResident) {
-        void **procp = (void **) &disp->AreTexturesResident;
-
-        snprintf(symboln, sizeof(symboln), "%sAreTexturesResident",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->AreTexturesResident) {
-        void **procp = (void **) &disp->AreTexturesResident;
-
-        snprintf(symboln, sizeof(symboln), "%sAreTexturesResidentEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->CopyTexImage1D) {
-        void **procp = (void **) &disp->CopyTexImage1D;
-
-        snprintf(symboln, sizeof(symboln), "%sCopyTexImage1D", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->CopyTexImage1D) {
-        void **procp = (void **) &disp->CopyTexImage1D;
-
-        snprintf(symboln, sizeof(symboln), "%sCopyTexImage1DEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->CopyTexImage2D) {
-        void **procp = (void **) &disp->CopyTexImage2D;
-
-        snprintf(symboln, sizeof(symboln), "%sCopyTexImage2D", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->CopyTexImage2D) {
-        void **procp = (void **) &disp->CopyTexImage2D;
-
-        snprintf(symboln, sizeof(symboln), "%sCopyTexImage2DEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->CopyTexSubImage1D) {
-        void **procp = (void **) &disp->CopyTexSubImage1D;
-
-        snprintf(symboln, sizeof(symboln), "%sCopyTexSubImage1D",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->CopyTexSubImage1D) {
-        void **procp = (void **) &disp->CopyTexSubImage1D;
-
-        snprintf(symboln, sizeof(symboln), "%sCopyTexSubImage1DEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->CopyTexSubImage2D) {
-        void **procp = (void **) &disp->CopyTexSubImage2D;
-
-        snprintf(symboln, sizeof(symboln), "%sCopyTexSubImage2D",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->CopyTexSubImage2D) {
-        void **procp = (void **) &disp->CopyTexSubImage2D;
-
-        snprintf(symboln, sizeof(symboln), "%sCopyTexSubImage2DEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->DeleteTextures) {
-        void **procp = (void **) &disp->DeleteTextures;
-
-        snprintf(symboln, sizeof(symboln), "%sDeleteTextures", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->DeleteTextures) {
-        void **procp = (void **) &disp->DeleteTextures;
-
-        snprintf(symboln, sizeof(symboln), "%sDeleteTexturesEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GenTextures) {
-        void **procp = (void **) &disp->GenTextures;
-
-        snprintf(symboln, sizeof(symboln), "%sGenTextures", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GenTextures) {
-        void **procp = (void **) &disp->GenTextures;
-
-        snprintf(symboln, sizeof(symboln), "%sGenTexturesEXT", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetPointerv) {
-        void **procp = (void **) &disp->GetPointerv;
-
-        snprintf(symboln, sizeof(symboln), "%sGetPointerv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetPointerv) {
-        void **procp = (void **) &disp->GetPointerv;
-
-        snprintf(symboln, sizeof(symboln), "%sGetPointervEXT", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->IsTexture) {
-        void **procp = (void **) &disp->IsTexture;
-
-        snprintf(symboln, sizeof(symboln), "%sIsTexture", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->IsTexture) {
-        void **procp = (void **) &disp->IsTexture;
-
-        snprintf(symboln, sizeof(symboln), "%sIsTextureEXT", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->PrioritizeTextures) {
-        void **procp = (void **) &disp->PrioritizeTextures;
-
-        snprintf(symboln, sizeof(symboln), "%sPrioritizeTextures",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->PrioritizeTextures) {
-        void **procp = (void **) &disp->PrioritizeTextures;
-
-        snprintf(symboln, sizeof(symboln), "%sPrioritizeTexturesEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TexSubImage1D) {
-        void **procp = (void **) &disp->TexSubImage1D;
-
-        snprintf(symboln, sizeof(symboln), "%sTexSubImage1D", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TexSubImage1D) {
-        void **procp = (void **) &disp->TexSubImage1D;
-
-        snprintf(symboln, sizeof(symboln), "%sTexSubImage1DEXT", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TexSubImage2D) {
-        void **procp = (void **) &disp->TexSubImage2D;
-
-        snprintf(symboln, sizeof(symboln), "%sTexSubImage2D", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TexSubImage2D) {
-        void **procp = (void **) &disp->TexSubImage2D;
-
-        snprintf(symboln, sizeof(symboln), "%sTexSubImage2DEXT", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->PopClientAttrib) {
-        void **procp = (void **) &disp->PopClientAttrib;
-
-        snprintf(symboln, sizeof(symboln), "%sPopClientAttrib", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->PushClientAttrib) {
-        void **procp = (void **) &disp->PushClientAttrib;
-
-        snprintf(symboln, sizeof(symboln), "%sPushClientAttrib", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->BlendColor) {
-        void **procp = (void **) &disp->BlendColor;
-
-        snprintf(symboln, sizeof(symboln), "%sBlendColor", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->BlendColor) {
-        void **procp = (void **) &disp->BlendColor;
-
-        snprintf(symboln, sizeof(symboln), "%sBlendColorEXT", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->BlendEquation) {
-        void **procp = (void **) &disp->BlendEquation;
-
-        snprintf(symboln, sizeof(symboln), "%sBlendEquation", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->BlendEquation) {
-        void **procp = (void **) &disp->BlendEquation;
-
-        snprintf(symboln, sizeof(symboln), "%sBlendEquationEXT", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->DrawRangeElements) {
-        void **procp = (void **) &disp->DrawRangeElements;
-
-        snprintf(symboln, sizeof(symboln), "%sDrawRangeElements",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->DrawRangeElements) {
-        void **procp = (void **) &disp->DrawRangeElements;
-
-        snprintf(symboln, sizeof(symboln), "%sDrawRangeElementsEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ColorTable) {
-        void **procp = (void **) &disp->ColorTable;
-
-        snprintf(symboln, sizeof(symboln), "%sColorTable", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ColorTable) {
-        void **procp = (void **) &disp->ColorTable;
-
-        snprintf(symboln, sizeof(symboln), "%sColorTableSGI", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ColorTable) {
-        void **procp = (void **) &disp->ColorTable;
-
-        snprintf(symboln, sizeof(symboln), "%sColorTableEXT", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ColorTableParameterfv) {
-        void **procp = (void **) &disp->ColorTableParameterfv;
-
-        snprintf(symboln, sizeof(symboln), "%sColorTableParameterfv",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ColorTableParameterfv) {
-        void **procp = (void **) &disp->ColorTableParameterfv;
-
-        snprintf(symboln, sizeof(symboln), "%sColorTableParameterfvSGI",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ColorTableParameteriv) {
-        void **procp = (void **) &disp->ColorTableParameteriv;
-
-        snprintf(symboln, sizeof(symboln), "%sColorTableParameteriv",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ColorTableParameteriv) {
-        void **procp = (void **) &disp->ColorTableParameteriv;
-
-        snprintf(symboln, sizeof(symboln), "%sColorTableParameterivSGI",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->CopyColorTable) {
-        void **procp = (void **) &disp->CopyColorTable;
-
-        snprintf(symboln, sizeof(symboln), "%sCopyColorTable", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->CopyColorTable) {
-        void **procp = (void **) &disp->CopyColorTable;
-
-        snprintf(symboln, sizeof(symboln), "%sCopyColorTableSGI",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetColorTable) {
-        void **procp = (void **) &disp->GetColorTable;
-
-        snprintf(symboln, sizeof(symboln), "%sGetColorTable", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetColorTable) {
-        void **procp = (void **) &disp->GetColorTable;
-
-        snprintf(symboln, sizeof(symboln), "%sGetColorTableSGI", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetColorTable) {
-        void **procp = (void **) &disp->GetColorTable;
-
-        snprintf(symboln, sizeof(symboln), "%sGetColorTableEXT", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetColorTableParameterfv) {
-        void **procp = (void **) &disp->GetColorTableParameterfv;
-
-        snprintf(symboln, sizeof(symboln), "%sGetColorTableParameterfv",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetColorTableParameterfv) {
-        void **procp = (void **) &disp->GetColorTableParameterfv;
-
-        snprintf(symboln, sizeof(symboln), "%sGetColorTableParameterfvSGI",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetColorTableParameterfv) {
-        void **procp = (void **) &disp->GetColorTableParameterfv;
-
-        snprintf(symboln, sizeof(symboln), "%sGetColorTableParameterfvEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetColorTableParameteriv) {
-        void **procp = (void **) &disp->GetColorTableParameteriv;
-
-        snprintf(symboln, sizeof(symboln), "%sGetColorTableParameteriv",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetColorTableParameteriv) {
-        void **procp = (void **) &disp->GetColorTableParameteriv;
-
-        snprintf(symboln, sizeof(symboln), "%sGetColorTableParameterivSGI",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetColorTableParameteriv) {
-        void **procp = (void **) &disp->GetColorTableParameteriv;
-
-        snprintf(symboln, sizeof(symboln), "%sGetColorTableParameterivEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ColorSubTable) {
-        void **procp = (void **) &disp->ColorSubTable;
-
-        snprintf(symboln, sizeof(symboln), "%sColorSubTable", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ColorSubTable) {
-        void **procp = (void **) &disp->ColorSubTable;
-
-        snprintf(symboln, sizeof(symboln), "%sColorSubTableEXT", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->CopyColorSubTable) {
-        void **procp = (void **) &disp->CopyColorSubTable;
-
-        snprintf(symboln, sizeof(symboln), "%sCopyColorSubTable",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->CopyColorSubTable) {
-        void **procp = (void **) &disp->CopyColorSubTable;
-
-        snprintf(symboln, sizeof(symboln), "%sCopyColorSubTableEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ConvolutionFilter1D) {
-        void **procp = (void **) &disp->ConvolutionFilter1D;
-
-        snprintf(symboln, sizeof(symboln), "%sConvolutionFilter1D",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ConvolutionFilter1D) {
-        void **procp = (void **) &disp->ConvolutionFilter1D;
-
-        snprintf(symboln, sizeof(symboln), "%sConvolutionFilter1DEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ConvolutionFilter2D) {
-        void **procp = (void **) &disp->ConvolutionFilter2D;
-
-        snprintf(symboln, sizeof(symboln), "%sConvolutionFilter2D",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ConvolutionFilter2D) {
-        void **procp = (void **) &disp->ConvolutionFilter2D;
-
-        snprintf(symboln, sizeof(symboln), "%sConvolutionFilter2DEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ConvolutionParameterf) {
-        void **procp = (void **) &disp->ConvolutionParameterf;
-
-        snprintf(symboln, sizeof(symboln), "%sConvolutionParameterf",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ConvolutionParameterf) {
-        void **procp = (void **) &disp->ConvolutionParameterf;
-
-        snprintf(symboln, sizeof(symboln), "%sConvolutionParameterfEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ConvolutionParameterfv) {
-        void **procp = (void **) &disp->ConvolutionParameterfv;
-
-        snprintf(symboln, sizeof(symboln), "%sConvolutionParameterfv",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ConvolutionParameterfv) {
-        void **procp = (void **) &disp->ConvolutionParameterfv;
-
-        snprintf(symboln, sizeof(symboln), "%sConvolutionParameterfvEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ConvolutionParameteri) {
-        void **procp = (void **) &disp->ConvolutionParameteri;
-
-        snprintf(symboln, sizeof(symboln), "%sConvolutionParameteri",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ConvolutionParameteri) {
-        void **procp = (void **) &disp->ConvolutionParameteri;
-
-        snprintf(symboln, sizeof(symboln), "%sConvolutionParameteriEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ConvolutionParameteriv) {
-        void **procp = (void **) &disp->ConvolutionParameteriv;
-
-        snprintf(symboln, sizeof(symboln), "%sConvolutionParameteriv",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ConvolutionParameteriv) {
-        void **procp = (void **) &disp->ConvolutionParameteriv;
-
-        snprintf(symboln, sizeof(symboln), "%sConvolutionParameterivEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->CopyConvolutionFilter1D) {
-        void **procp = (void **) &disp->CopyConvolutionFilter1D;
-
-        snprintf(symboln, sizeof(symboln), "%sCopyConvolutionFilter1D",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->CopyConvolutionFilter1D) {
-        void **procp = (void **) &disp->CopyConvolutionFilter1D;
-
-        snprintf(symboln, sizeof(symboln), "%sCopyConvolutionFilter1DEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->CopyConvolutionFilter2D) {
-        void **procp = (void **) &disp->CopyConvolutionFilter2D;
-
-        snprintf(symboln, sizeof(symboln), "%sCopyConvolutionFilter2D",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->CopyConvolutionFilter2D) {
-        void **procp = (void **) &disp->CopyConvolutionFilter2D;
-
-        snprintf(symboln, sizeof(symboln), "%sCopyConvolutionFilter2DEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetConvolutionFilter) {
-        void **procp = (void **) &disp->GetConvolutionFilter;
-
-        snprintf(symboln, sizeof(symboln), "%sGetConvolutionFilter",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetConvolutionFilter) {
-        void **procp = (void **) &disp->GetConvolutionFilter;
-
-        snprintf(symboln, sizeof(symboln), "%sGetConvolutionFilterEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetConvolutionParameterfv) {
-        void **procp = (void **) &disp->GetConvolutionParameterfv;
-
-        snprintf(symboln, sizeof(symboln), "%sGetConvolutionParameterfv",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetConvolutionParameterfv) {
-        void **procp = (void **) &disp->GetConvolutionParameterfv;
-
-        snprintf(symboln, sizeof(symboln), "%sGetConvolutionParameterfvEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetConvolutionParameteriv) {
-        void **procp = (void **) &disp->GetConvolutionParameteriv;
-
-        snprintf(symboln, sizeof(symboln), "%sGetConvolutionParameteriv",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetConvolutionParameteriv) {
-        void **procp = (void **) &disp->GetConvolutionParameteriv;
-
-        snprintf(symboln, sizeof(symboln), "%sGetConvolutionParameterivEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetSeparableFilter) {
-        void **procp = (void **) &disp->GetSeparableFilter;
-
-        snprintf(symboln, sizeof(symboln), "%sGetSeparableFilter",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetSeparableFilter) {
-        void **procp = (void **) &disp->GetSeparableFilter;
-
-        snprintf(symboln, sizeof(symboln), "%sGetSeparableFilterEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->SeparableFilter2D) {
-        void **procp = (void **) &disp->SeparableFilter2D;
-
-        snprintf(symboln, sizeof(symboln), "%sSeparableFilter2D",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->SeparableFilter2D) {
-        void **procp = (void **) &disp->SeparableFilter2D;
-
-        snprintf(symboln, sizeof(symboln), "%sSeparableFilter2DEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetHistogram) {
-        void **procp = (void **) &disp->GetHistogram;
-
-        snprintf(symboln, sizeof(symboln), "%sGetHistogram", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetHistogram) {
-        void **procp = (void **) &disp->GetHistogram;
-
-        snprintf(symboln, sizeof(symboln), "%sGetHistogramEXT", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetHistogramParameterfv) {
-        void **procp = (void **) &disp->GetHistogramParameterfv;
-
-        snprintf(symboln, sizeof(symboln), "%sGetHistogramParameterfv",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetHistogramParameterfv) {
-        void **procp = (void **) &disp->GetHistogramParameterfv;
-
-        snprintf(symboln, sizeof(symboln), "%sGetHistogramParameterfvEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetHistogramParameteriv) {
-        void **procp = (void **) &disp->GetHistogramParameteriv;
-
-        snprintf(symboln, sizeof(symboln), "%sGetHistogramParameteriv",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetHistogramParameteriv) {
-        void **procp = (void **) &disp->GetHistogramParameteriv;
-
-        snprintf(symboln, sizeof(symboln), "%sGetHistogramParameterivEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetMinmax) {
-        void **procp = (void **) &disp->GetMinmax;
-
-        snprintf(symboln, sizeof(symboln), "%sGetMinmax", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetMinmax) {
-        void **procp = (void **) &disp->GetMinmax;
-
-        snprintf(symboln, sizeof(symboln), "%sGetMinmaxEXT", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetMinmaxParameterfv) {
-        void **procp = (void **) &disp->GetMinmaxParameterfv;
-
-        snprintf(symboln, sizeof(symboln), "%sGetMinmaxParameterfv",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetMinmaxParameterfv) {
-        void **procp = (void **) &disp->GetMinmaxParameterfv;
-
-        snprintf(symboln, sizeof(symboln), "%sGetMinmaxParameterfvEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetMinmaxParameteriv) {
-        void **procp = (void **) &disp->GetMinmaxParameteriv;
-
-        snprintf(symboln, sizeof(symboln), "%sGetMinmaxParameteriv",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetMinmaxParameteriv) {
-        void **procp = (void **) &disp->GetMinmaxParameteriv;
-
-        snprintf(symboln, sizeof(symboln), "%sGetMinmaxParameterivEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Histogram) {
-        void **procp = (void **) &disp->Histogram;
-
-        snprintf(symboln, sizeof(symboln), "%sHistogram", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Histogram) {
-        void **procp = (void **) &disp->Histogram;
-
-        snprintf(symboln, sizeof(symboln), "%sHistogramEXT", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Minmax) {
-        void **procp = (void **) &disp->Minmax;
-
-        snprintf(symboln, sizeof(symboln), "%sMinmax", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Minmax) {
-        void **procp = (void **) &disp->Minmax;
-
-        snprintf(symboln, sizeof(symboln), "%sMinmaxEXT", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ResetHistogram) {
-        void **procp = (void **) &disp->ResetHistogram;
-
-        snprintf(symboln, sizeof(symboln), "%sResetHistogram", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ResetHistogram) {
-        void **procp = (void **) &disp->ResetHistogram;
-
-        snprintf(symboln, sizeof(symboln), "%sResetHistogramEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ResetMinmax) {
-        void **procp = (void **) &disp->ResetMinmax;
-
-        snprintf(symboln, sizeof(symboln), "%sResetMinmax", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ResetMinmax) {
-        void **procp = (void **) &disp->ResetMinmax;
-
-        snprintf(symboln, sizeof(symboln), "%sResetMinmaxEXT", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TexImage3D) {
-        void **procp = (void **) &disp->TexImage3D;
-
-        snprintf(symboln, sizeof(symboln), "%sTexImage3D", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TexImage3D) {
-        void **procp = (void **) &disp->TexImage3D;
-
-        snprintf(symboln, sizeof(symboln), "%sTexImage3DEXT", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TexSubImage3D) {
-        void **procp = (void **) &disp->TexSubImage3D;
-
-        snprintf(symboln, sizeof(symboln), "%sTexSubImage3D", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TexSubImage3D) {
-        void **procp = (void **) &disp->TexSubImage3D;
-
-        snprintf(symboln, sizeof(symboln), "%sTexSubImage3DEXT", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->CopyTexSubImage3D) {
-        void **procp = (void **) &disp->CopyTexSubImage3D;
-
-        snprintf(symboln, sizeof(symboln), "%sCopyTexSubImage3D",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->CopyTexSubImage3D) {
-        void **procp = (void **) &disp->CopyTexSubImage3D;
-
-        snprintf(symboln, sizeof(symboln), "%sCopyTexSubImage3DEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ActiveTextureARB) {
-        void **procp = (void **) &disp->ActiveTextureARB;
-
-        snprintf(symboln, sizeof(symboln), "%sActiveTexture", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ActiveTextureARB) {
-        void **procp = (void **) &disp->ActiveTextureARB;
-
-        snprintf(symboln, sizeof(symboln), "%sActiveTextureARB", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ClientActiveTextureARB) {
-        void **procp = (void **) &disp->ClientActiveTextureARB;
-
-        snprintf(symboln, sizeof(symboln), "%sClientActiveTexture",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ClientActiveTextureARB) {
-        void **procp = (void **) &disp->ClientActiveTextureARB;
-
-        snprintf(symboln, sizeof(symboln), "%sClientActiveTextureARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultiTexCoord1dARB) {
-        void **procp = (void **) &disp->MultiTexCoord1dARB;
-
-        snprintf(symboln, sizeof(symboln), "%sMultiTexCoord1d", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultiTexCoord1dARB) {
-        void **procp = (void **) &disp->MultiTexCoord1dARB;
-
-        snprintf(symboln, sizeof(symboln), "%sMultiTexCoord1dARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultiTexCoord1dvARB) {
-        void **procp = (void **) &disp->MultiTexCoord1dvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sMultiTexCoord1dv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultiTexCoord1dvARB) {
-        void **procp = (void **) &disp->MultiTexCoord1dvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sMultiTexCoord1dvARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultiTexCoord1fARB) {
-        void **procp = (void **) &disp->MultiTexCoord1fARB;
-
-        snprintf(symboln, sizeof(symboln), "%sMultiTexCoord1f", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultiTexCoord1fARB) {
-        void **procp = (void **) &disp->MultiTexCoord1fARB;
-
-        snprintf(symboln, sizeof(symboln), "%sMultiTexCoord1fARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultiTexCoord1fvARB) {
-        void **procp = (void **) &disp->MultiTexCoord1fvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sMultiTexCoord1fv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultiTexCoord1fvARB) {
-        void **procp = (void **) &disp->MultiTexCoord1fvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sMultiTexCoord1fvARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultiTexCoord1iARB) {
-        void **procp = (void **) &disp->MultiTexCoord1iARB;
-
-        snprintf(symboln, sizeof(symboln), "%sMultiTexCoord1i", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultiTexCoord1iARB) {
-        void **procp = (void **) &disp->MultiTexCoord1iARB;
-
-        snprintf(symboln, sizeof(symboln), "%sMultiTexCoord1iARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultiTexCoord1ivARB) {
-        void **procp = (void **) &disp->MultiTexCoord1ivARB;
-
-        snprintf(symboln, sizeof(symboln), "%sMultiTexCoord1iv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultiTexCoord1ivARB) {
-        void **procp = (void **) &disp->MultiTexCoord1ivARB;
-
-        snprintf(symboln, sizeof(symboln), "%sMultiTexCoord1ivARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultiTexCoord1sARB) {
-        void **procp = (void **) &disp->MultiTexCoord1sARB;
-
-        snprintf(symboln, sizeof(symboln), "%sMultiTexCoord1s", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultiTexCoord1sARB) {
-        void **procp = (void **) &disp->MultiTexCoord1sARB;
-
-        snprintf(symboln, sizeof(symboln), "%sMultiTexCoord1sARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultiTexCoord1svARB) {
-        void **procp = (void **) &disp->MultiTexCoord1svARB;
-
-        snprintf(symboln, sizeof(symboln), "%sMultiTexCoord1sv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultiTexCoord1svARB) {
-        void **procp = (void **) &disp->MultiTexCoord1svARB;
-
-        snprintf(symboln, sizeof(symboln), "%sMultiTexCoord1svARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultiTexCoord2dARB) {
-        void **procp = (void **) &disp->MultiTexCoord2dARB;
-
-        snprintf(symboln, sizeof(symboln), "%sMultiTexCoord2d", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultiTexCoord2dARB) {
-        void **procp = (void **) &disp->MultiTexCoord2dARB;
-
-        snprintf(symboln, sizeof(symboln), "%sMultiTexCoord2dARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultiTexCoord2dvARB) {
-        void **procp = (void **) &disp->MultiTexCoord2dvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sMultiTexCoord2dv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultiTexCoord2dvARB) {
-        void **procp = (void **) &disp->MultiTexCoord2dvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sMultiTexCoord2dvARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultiTexCoord2fARB) {
-        void **procp = (void **) &disp->MultiTexCoord2fARB;
-
-        snprintf(symboln, sizeof(symboln), "%sMultiTexCoord2f", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultiTexCoord2fARB) {
-        void **procp = (void **) &disp->MultiTexCoord2fARB;
-
-        snprintf(symboln, sizeof(symboln), "%sMultiTexCoord2fARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultiTexCoord2fvARB) {
-        void **procp = (void **) &disp->MultiTexCoord2fvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sMultiTexCoord2fv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultiTexCoord2fvARB) {
-        void **procp = (void **) &disp->MultiTexCoord2fvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sMultiTexCoord2fvARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultiTexCoord2iARB) {
-        void **procp = (void **) &disp->MultiTexCoord2iARB;
-
-        snprintf(symboln, sizeof(symboln), "%sMultiTexCoord2i", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultiTexCoord2iARB) {
-        void **procp = (void **) &disp->MultiTexCoord2iARB;
-
-        snprintf(symboln, sizeof(symboln), "%sMultiTexCoord2iARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultiTexCoord2ivARB) {
-        void **procp = (void **) &disp->MultiTexCoord2ivARB;
-
-        snprintf(symboln, sizeof(symboln), "%sMultiTexCoord2iv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultiTexCoord2ivARB) {
-        void **procp = (void **) &disp->MultiTexCoord2ivARB;
-
-        snprintf(symboln, sizeof(symboln), "%sMultiTexCoord2ivARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultiTexCoord2sARB) {
-        void **procp = (void **) &disp->MultiTexCoord2sARB;
-
-        snprintf(symboln, sizeof(symboln), "%sMultiTexCoord2s", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultiTexCoord2sARB) {
-        void **procp = (void **) &disp->MultiTexCoord2sARB;
-
-        snprintf(symboln, sizeof(symboln), "%sMultiTexCoord2sARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultiTexCoord2svARB) {
-        void **procp = (void **) &disp->MultiTexCoord2svARB;
-
-        snprintf(symboln, sizeof(symboln), "%sMultiTexCoord2sv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultiTexCoord2svARB) {
-        void **procp = (void **) &disp->MultiTexCoord2svARB;
-
-        snprintf(symboln, sizeof(symboln), "%sMultiTexCoord2svARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultiTexCoord3dARB) {
-        void **procp = (void **) &disp->MultiTexCoord3dARB;
-
-        snprintf(symboln, sizeof(symboln), "%sMultiTexCoord3d", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultiTexCoord3dARB) {
-        void **procp = (void **) &disp->MultiTexCoord3dARB;
-
-        snprintf(symboln, sizeof(symboln), "%sMultiTexCoord3dARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultiTexCoord3dvARB) {
-        void **procp = (void **) &disp->MultiTexCoord3dvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sMultiTexCoord3dv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultiTexCoord3dvARB) {
-        void **procp = (void **) &disp->MultiTexCoord3dvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sMultiTexCoord3dvARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultiTexCoord3fARB) {
-        void **procp = (void **) &disp->MultiTexCoord3fARB;
-
-        snprintf(symboln, sizeof(symboln), "%sMultiTexCoord3f", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultiTexCoord3fARB) {
-        void **procp = (void **) &disp->MultiTexCoord3fARB;
-
-        snprintf(symboln, sizeof(symboln), "%sMultiTexCoord3fARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultiTexCoord3fvARB) {
-        void **procp = (void **) &disp->MultiTexCoord3fvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sMultiTexCoord3fv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultiTexCoord3fvARB) {
-        void **procp = (void **) &disp->MultiTexCoord3fvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sMultiTexCoord3fvARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultiTexCoord3iARB) {
-        void **procp = (void **) &disp->MultiTexCoord3iARB;
-
-        snprintf(symboln, sizeof(symboln), "%sMultiTexCoord3i", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultiTexCoord3iARB) {
-        void **procp = (void **) &disp->MultiTexCoord3iARB;
-
-        snprintf(symboln, sizeof(symboln), "%sMultiTexCoord3iARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultiTexCoord3ivARB) {
-        void **procp = (void **) &disp->MultiTexCoord3ivARB;
-
-        snprintf(symboln, sizeof(symboln), "%sMultiTexCoord3iv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultiTexCoord3ivARB) {
-        void **procp = (void **) &disp->MultiTexCoord3ivARB;
-
-        snprintf(symboln, sizeof(symboln), "%sMultiTexCoord3ivARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultiTexCoord3sARB) {
-        void **procp = (void **) &disp->MultiTexCoord3sARB;
-
-        snprintf(symboln, sizeof(symboln), "%sMultiTexCoord3s", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultiTexCoord3sARB) {
-        void **procp = (void **) &disp->MultiTexCoord3sARB;
-
-        snprintf(symboln, sizeof(symboln), "%sMultiTexCoord3sARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultiTexCoord3svARB) {
-        void **procp = (void **) &disp->MultiTexCoord3svARB;
-
-        snprintf(symboln, sizeof(symboln), "%sMultiTexCoord3sv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultiTexCoord3svARB) {
-        void **procp = (void **) &disp->MultiTexCoord3svARB;
-
-        snprintf(symboln, sizeof(symboln), "%sMultiTexCoord3svARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultiTexCoord4dARB) {
-        void **procp = (void **) &disp->MultiTexCoord4dARB;
-
-        snprintf(symboln, sizeof(symboln), "%sMultiTexCoord4d", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultiTexCoord4dARB) {
-        void **procp = (void **) &disp->MultiTexCoord4dARB;
-
-        snprintf(symboln, sizeof(symboln), "%sMultiTexCoord4dARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultiTexCoord4dvARB) {
-        void **procp = (void **) &disp->MultiTexCoord4dvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sMultiTexCoord4dv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultiTexCoord4dvARB) {
-        void **procp = (void **) &disp->MultiTexCoord4dvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sMultiTexCoord4dvARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultiTexCoord4fARB) {
-        void **procp = (void **) &disp->MultiTexCoord4fARB;
-
-        snprintf(symboln, sizeof(symboln), "%sMultiTexCoord4f", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultiTexCoord4fARB) {
-        void **procp = (void **) &disp->MultiTexCoord4fARB;
-
-        snprintf(symboln, sizeof(symboln), "%sMultiTexCoord4fARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultiTexCoord4fvARB) {
-        void **procp = (void **) &disp->MultiTexCoord4fvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sMultiTexCoord4fv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultiTexCoord4fvARB) {
-        void **procp = (void **) &disp->MultiTexCoord4fvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sMultiTexCoord4fvARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultiTexCoord4iARB) {
-        void **procp = (void **) &disp->MultiTexCoord4iARB;
-
-        snprintf(symboln, sizeof(symboln), "%sMultiTexCoord4i", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultiTexCoord4iARB) {
-        void **procp = (void **) &disp->MultiTexCoord4iARB;
-
-        snprintf(symboln, sizeof(symboln), "%sMultiTexCoord4iARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultiTexCoord4ivARB) {
-        void **procp = (void **) &disp->MultiTexCoord4ivARB;
-
-        snprintf(symboln, sizeof(symboln), "%sMultiTexCoord4iv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultiTexCoord4ivARB) {
-        void **procp = (void **) &disp->MultiTexCoord4ivARB;
-
-        snprintf(symboln, sizeof(symboln), "%sMultiTexCoord4ivARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultiTexCoord4sARB) {
-        void **procp = (void **) &disp->MultiTexCoord4sARB;
-
-        snprintf(symboln, sizeof(symboln), "%sMultiTexCoord4s", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultiTexCoord4sARB) {
-        void **procp = (void **) &disp->MultiTexCoord4sARB;
-
-        snprintf(symboln, sizeof(symboln), "%sMultiTexCoord4sARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultiTexCoord4svARB) {
-        void **procp = (void **) &disp->MultiTexCoord4svARB;
-
-        snprintf(symboln, sizeof(symboln), "%sMultiTexCoord4sv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultiTexCoord4svARB) {
-        void **procp = (void **) &disp->MultiTexCoord4svARB;
-
-        snprintf(symboln, sizeof(symboln), "%sMultiTexCoord4svARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->AttachShader) {
-        void **procp = (void **) &disp->AttachShader;
-
-        snprintf(symboln, sizeof(symboln), "%sAttachShader", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->CreateProgram) {
-        void **procp = (void **) &disp->CreateProgram;
-
-        snprintf(symboln, sizeof(symboln), "%sCreateProgram", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->CreateShader) {
-        void **procp = (void **) &disp->CreateShader;
-
-        snprintf(symboln, sizeof(symboln), "%sCreateShader", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->DeleteProgram) {
-        void **procp = (void **) &disp->DeleteProgram;
-
-        snprintf(symboln, sizeof(symboln), "%sDeleteProgram", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->DeleteShader) {
-        void **procp = (void **) &disp->DeleteShader;
-
-        snprintf(symboln, sizeof(symboln), "%sDeleteShader", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->DetachShader) {
-        void **procp = (void **) &disp->DetachShader;
-
-        snprintf(symboln, sizeof(symboln), "%sDetachShader", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetAttachedShaders) {
-        void **procp = (void **) &disp->GetAttachedShaders;
-
-        snprintf(symboln, sizeof(symboln), "%sGetAttachedShaders",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetProgramInfoLog) {
-        void **procp = (void **) &disp->GetProgramInfoLog;
-
-        snprintf(symboln, sizeof(symboln), "%sGetProgramInfoLog",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetProgramiv) {
-        void **procp = (void **) &disp->GetProgramiv;
-
-        snprintf(symboln, sizeof(symboln), "%sGetProgramiv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetShaderInfoLog) {
-        void **procp = (void **) &disp->GetShaderInfoLog;
-
-        snprintf(symboln, sizeof(symboln), "%sGetShaderInfoLog", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetShaderiv) {
-        void **procp = (void **) &disp->GetShaderiv;
-
-        snprintf(symboln, sizeof(symboln), "%sGetShaderiv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->IsProgram) {
-        void **procp = (void **) &disp->IsProgram;
-
-        snprintf(symboln, sizeof(symboln), "%sIsProgram", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->IsShader) {
-        void **procp = (void **) &disp->IsShader;
-
-        snprintf(symboln, sizeof(symboln), "%sIsShader", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->StencilFuncSeparate) {
-        void **procp = (void **) &disp->StencilFuncSeparate;
-
-        snprintf(symboln, sizeof(symboln), "%sStencilFuncSeparate",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->StencilMaskSeparate) {
-        void **procp = (void **) &disp->StencilMaskSeparate;
-
-        snprintf(symboln, sizeof(symboln), "%sStencilMaskSeparate",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->StencilOpSeparate) {
-        void **procp = (void **) &disp->StencilOpSeparate;
-
-        snprintf(symboln, sizeof(symboln), "%sStencilOpSeparate",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->StencilOpSeparate) {
-        void **procp = (void **) &disp->StencilOpSeparate;
-
-        snprintf(symboln, sizeof(symboln), "%sStencilOpSeparateATI",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->UniformMatrix2x3fv) {
-        void **procp = (void **) &disp->UniformMatrix2x3fv;
-
-        snprintf(symboln, sizeof(symboln), "%sUniformMatrix2x3fv",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->UniformMatrix2x4fv) {
-        void **procp = (void **) &disp->UniformMatrix2x4fv;
-
-        snprintf(symboln, sizeof(symboln), "%sUniformMatrix2x4fv",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->UniformMatrix3x2fv) {
-        void **procp = (void **) &disp->UniformMatrix3x2fv;
-
-        snprintf(symboln, sizeof(symboln), "%sUniformMatrix3x2fv",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->UniformMatrix3x4fv) {
-        void **procp = (void **) &disp->UniformMatrix3x4fv;
-
-        snprintf(symboln, sizeof(symboln), "%sUniformMatrix3x4fv",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->UniformMatrix4x2fv) {
-        void **procp = (void **) &disp->UniformMatrix4x2fv;
-
-        snprintf(symboln, sizeof(symboln), "%sUniformMatrix4x2fv",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->UniformMatrix4x3fv) {
-        void **procp = (void **) &disp->UniformMatrix4x3fv;
-
-        snprintf(symboln, sizeof(symboln), "%sUniformMatrix4x3fv",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ClampColor) {
-        void **procp = (void **) &disp->ClampColor;
-
-        snprintf(symboln, sizeof(symboln), "%sClampColor", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ClearBufferfi) {
-        void **procp = (void **) &disp->ClearBufferfi;
-
-        snprintf(symboln, sizeof(symboln), "%sClearBufferfi", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ClearBufferfv) {
-        void **procp = (void **) &disp->ClearBufferfv;
-
-        snprintf(symboln, sizeof(symboln), "%sClearBufferfv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ClearBufferiv) {
-        void **procp = (void **) &disp->ClearBufferiv;
-
-        snprintf(symboln, sizeof(symboln), "%sClearBufferiv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ClearBufferuiv) {
-        void **procp = (void **) &disp->ClearBufferuiv;
-
-        snprintf(symboln, sizeof(symboln), "%sClearBufferuiv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetStringi) {
-        void **procp = (void **) &disp->GetStringi;
-
-        snprintf(symboln, sizeof(symboln), "%sGetStringi", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TexBuffer) {
-        void **procp = (void **) &disp->TexBuffer;
-
-        snprintf(symboln, sizeof(symboln), "%sTexBuffer", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->FramebufferTexture) {
-        void **procp = (void **) &disp->FramebufferTexture;
-
-        snprintf(symboln, sizeof(symboln), "%sFramebufferTexture",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetBufferParameteri64v) {
-        void **procp = (void **) &disp->GetBufferParameteri64v;
-
-        snprintf(symboln, sizeof(symboln), "%sGetBufferParameteri64v",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetInteger64i_v) {
-        void **procp = (void **) &disp->GetInteger64i_v;
-
-        snprintf(symboln, sizeof(symboln), "%sGetInteger64i_v", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttribDivisor) {
-        void **procp = (void **) &disp->VertexAttribDivisor;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttribDivisor",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->LoadTransposeMatrixdARB) {
-        void **procp = (void **) &disp->LoadTransposeMatrixdARB;
-
-        snprintf(symboln, sizeof(symboln), "%sLoadTransposeMatrixd",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->LoadTransposeMatrixdARB) {
-        void **procp = (void **) &disp->LoadTransposeMatrixdARB;
-
-        snprintf(symboln, sizeof(symboln), "%sLoadTransposeMatrixdARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->LoadTransposeMatrixfARB) {
-        void **procp = (void **) &disp->LoadTransposeMatrixfARB;
-
-        snprintf(symboln, sizeof(symboln), "%sLoadTransposeMatrixf",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->LoadTransposeMatrixfARB) {
-        void **procp = (void **) &disp->LoadTransposeMatrixfARB;
-
-        snprintf(symboln, sizeof(symboln), "%sLoadTransposeMatrixfARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultTransposeMatrixdARB) {
-        void **procp = (void **) &disp->MultTransposeMatrixdARB;
-
-        snprintf(symboln, sizeof(symboln), "%sMultTransposeMatrixd",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultTransposeMatrixdARB) {
-        void **procp = (void **) &disp->MultTransposeMatrixdARB;
-
-        snprintf(symboln, sizeof(symboln), "%sMultTransposeMatrixdARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultTransposeMatrixfARB) {
-        void **procp = (void **) &disp->MultTransposeMatrixfARB;
-
-        snprintf(symboln, sizeof(symboln), "%sMultTransposeMatrixf",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultTransposeMatrixfARB) {
-        void **procp = (void **) &disp->MultTransposeMatrixfARB;
-
-        snprintf(symboln, sizeof(symboln), "%sMultTransposeMatrixfARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->SampleCoverageARB) {
-        void **procp = (void **) &disp->SampleCoverageARB;
-
-        snprintf(symboln, sizeof(symboln), "%sSampleCoverage", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->SampleCoverageARB) {
-        void **procp = (void **) &disp->SampleCoverageARB;
-
-        snprintf(symboln, sizeof(symboln), "%sSampleCoverageARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->CompressedTexImage1DARB) {
-        void **procp = (void **) &disp->CompressedTexImage1DARB;
-
-        snprintf(symboln, sizeof(symboln), "%sCompressedTexImage1D",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->CompressedTexImage1DARB) {
-        void **procp = (void **) &disp->CompressedTexImage1DARB;
-
-        snprintf(symboln, sizeof(symboln), "%sCompressedTexImage1DARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->CompressedTexImage2DARB) {
-        void **procp = (void **) &disp->CompressedTexImage2DARB;
-
-        snprintf(symboln, sizeof(symboln), "%sCompressedTexImage2D",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->CompressedTexImage2DARB) {
-        void **procp = (void **) &disp->CompressedTexImage2DARB;
-
-        snprintf(symboln, sizeof(symboln), "%sCompressedTexImage2DARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->CompressedTexImage3DARB) {
-        void **procp = (void **) &disp->CompressedTexImage3DARB;
-
-        snprintf(symboln, sizeof(symboln), "%sCompressedTexImage3D",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->CompressedTexImage3DARB) {
-        void **procp = (void **) &disp->CompressedTexImage3DARB;
-
-        snprintf(symboln, sizeof(symboln), "%sCompressedTexImage3DARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->CompressedTexSubImage1DARB) {
-        void **procp = (void **) &disp->CompressedTexSubImage1DARB;
-
-        snprintf(symboln, sizeof(symboln), "%sCompressedTexSubImage1D",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->CompressedTexSubImage1DARB) {
-        void **procp = (void **) &disp->CompressedTexSubImage1DARB;
-
-        snprintf(symboln, sizeof(symboln), "%sCompressedTexSubImage1DARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->CompressedTexSubImage2DARB) {
-        void **procp = (void **) &disp->CompressedTexSubImage2DARB;
-
-        snprintf(symboln, sizeof(symboln), "%sCompressedTexSubImage2D",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->CompressedTexSubImage2DARB) {
-        void **procp = (void **) &disp->CompressedTexSubImage2DARB;
-
-        snprintf(symboln, sizeof(symboln), "%sCompressedTexSubImage2DARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->CompressedTexSubImage3DARB) {
-        void **procp = (void **) &disp->CompressedTexSubImage3DARB;
-
-        snprintf(symboln, sizeof(symboln), "%sCompressedTexSubImage3D",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->CompressedTexSubImage3DARB) {
-        void **procp = (void **) &disp->CompressedTexSubImage3DARB;
-
-        snprintf(symboln, sizeof(symboln), "%sCompressedTexSubImage3DARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetCompressedTexImageARB) {
-        void **procp = (void **) &disp->GetCompressedTexImageARB;
-
-        snprintf(symboln, sizeof(symboln), "%sGetCompressedTexImage",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetCompressedTexImageARB) {
-        void **procp = (void **) &disp->GetCompressedTexImageARB;
-
-        snprintf(symboln, sizeof(symboln), "%sGetCompressedTexImageARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->DisableVertexAttribArrayARB) {
-        void **procp = (void **) &disp->DisableVertexAttribArrayARB;
-
-        snprintf(symboln, sizeof(symboln), "%sDisableVertexAttribArray",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->DisableVertexAttribArrayARB) {
-        void **procp = (void **) &disp->DisableVertexAttribArrayARB;
-
-        snprintf(symboln, sizeof(symboln), "%sDisableVertexAttribArrayARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->EnableVertexAttribArrayARB) {
-        void **procp = (void **) &disp->EnableVertexAttribArrayARB;
-
-        snprintf(symboln, sizeof(symboln), "%sEnableVertexAttribArray",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->EnableVertexAttribArrayARB) {
-        void **procp = (void **) &disp->EnableVertexAttribArrayARB;
-
-        snprintf(symboln, sizeof(symboln), "%sEnableVertexAttribArrayARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetProgramEnvParameterdvARB) {
-        void **procp = (void **) &disp->GetProgramEnvParameterdvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sGetProgramEnvParameterdvARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetProgramEnvParameterfvARB) {
-        void **procp = (void **) &disp->GetProgramEnvParameterfvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sGetProgramEnvParameterfvARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetProgramLocalParameterdvARB) {
-        void **procp = (void **) &disp->GetProgramLocalParameterdvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sGetProgramLocalParameterdvARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetProgramLocalParameterfvARB) {
-        void **procp = (void **) &disp->GetProgramLocalParameterfvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sGetProgramLocalParameterfvARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetProgramStringARB) {
-        void **procp = (void **) &disp->GetProgramStringARB;
-
-        snprintf(symboln, sizeof(symboln), "%sGetProgramStringARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetProgramivARB) {
-        void **procp = (void **) &disp->GetProgramivARB;
-
-        snprintf(symboln, sizeof(symboln), "%sGetProgramivARB", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetVertexAttribdvARB) {
-        void **procp = (void **) &disp->GetVertexAttribdvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sGetVertexAttribdv",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetVertexAttribdvARB) {
-        void **procp = (void **) &disp->GetVertexAttribdvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sGetVertexAttribdvARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetVertexAttribfvARB) {
-        void **procp = (void **) &disp->GetVertexAttribfvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sGetVertexAttribfv",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetVertexAttribfvARB) {
-        void **procp = (void **) &disp->GetVertexAttribfvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sGetVertexAttribfvARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetVertexAttribivARB) {
-        void **procp = (void **) &disp->GetVertexAttribivARB;
-
-        snprintf(symboln, sizeof(symboln), "%sGetVertexAttribiv",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetVertexAttribivARB) {
-        void **procp = (void **) &disp->GetVertexAttribivARB;
-
-        snprintf(symboln, sizeof(symboln), "%sGetVertexAttribivARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ProgramEnvParameter4dARB) {
-        void **procp = (void **) &disp->ProgramEnvParameter4dARB;
-
-        snprintf(symboln, sizeof(symboln), "%sProgramEnvParameter4dARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ProgramEnvParameter4dARB) {
-        void **procp = (void **) &disp->ProgramEnvParameter4dARB;
-
-        snprintf(symboln, sizeof(symboln), "%sProgramParameter4dNV",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ProgramEnvParameter4dvARB) {
-        void **procp = (void **) &disp->ProgramEnvParameter4dvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sProgramEnvParameter4dvARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ProgramEnvParameter4dvARB) {
-        void **procp = (void **) &disp->ProgramEnvParameter4dvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sProgramParameter4dvNV",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ProgramEnvParameter4fARB) {
-        void **procp = (void **) &disp->ProgramEnvParameter4fARB;
-
-        snprintf(symboln, sizeof(symboln), "%sProgramEnvParameter4fARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ProgramEnvParameter4fARB) {
-        void **procp = (void **) &disp->ProgramEnvParameter4fARB;
-
-        snprintf(symboln, sizeof(symboln), "%sProgramParameter4fNV",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ProgramEnvParameter4fvARB) {
-        void **procp = (void **) &disp->ProgramEnvParameter4fvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sProgramEnvParameter4fvARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ProgramEnvParameter4fvARB) {
-        void **procp = (void **) &disp->ProgramEnvParameter4fvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sProgramParameter4fvNV",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ProgramLocalParameter4dARB) {
-        void **procp = (void **) &disp->ProgramLocalParameter4dARB;
-
-        snprintf(symboln, sizeof(symboln), "%sProgramLocalParameter4dARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ProgramLocalParameter4dvARB) {
-        void **procp = (void **) &disp->ProgramLocalParameter4dvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sProgramLocalParameter4dvARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ProgramLocalParameter4fARB) {
-        void **procp = (void **) &disp->ProgramLocalParameter4fARB;
-
-        snprintf(symboln, sizeof(symboln), "%sProgramLocalParameter4fARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ProgramLocalParameter4fvARB) {
-        void **procp = (void **) &disp->ProgramLocalParameter4fvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sProgramLocalParameter4fvARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ProgramStringARB) {
-        void **procp = (void **) &disp->ProgramStringARB;
-
-        snprintf(symboln, sizeof(symboln), "%sProgramStringARB", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib1dARB) {
-        void **procp = (void **) &disp->VertexAttrib1dARB;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib1d", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib1dARB) {
-        void **procp = (void **) &disp->VertexAttrib1dARB;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib1dARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib1dvARB) {
-        void **procp = (void **) &disp->VertexAttrib1dvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib1dv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib1dvARB) {
-        void **procp = (void **) &disp->VertexAttrib1dvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib1dvARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib1fARB) {
-        void **procp = (void **) &disp->VertexAttrib1fARB;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib1f", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib1fARB) {
-        void **procp = (void **) &disp->VertexAttrib1fARB;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib1fARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib1fvARB) {
-        void **procp = (void **) &disp->VertexAttrib1fvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib1fv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib1fvARB) {
-        void **procp = (void **) &disp->VertexAttrib1fvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib1fvARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib1sARB) {
-        void **procp = (void **) &disp->VertexAttrib1sARB;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib1s", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib1sARB) {
-        void **procp = (void **) &disp->VertexAttrib1sARB;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib1sARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib1svARB) {
-        void **procp = (void **) &disp->VertexAttrib1svARB;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib1sv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib1svARB) {
-        void **procp = (void **) &disp->VertexAttrib1svARB;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib1svARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib2dARB) {
-        void **procp = (void **) &disp->VertexAttrib2dARB;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib2d", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib2dARB) {
-        void **procp = (void **) &disp->VertexAttrib2dARB;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib2dARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib2dvARB) {
-        void **procp = (void **) &disp->VertexAttrib2dvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib2dv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib2dvARB) {
-        void **procp = (void **) &disp->VertexAttrib2dvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib2dvARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib2fARB) {
-        void **procp = (void **) &disp->VertexAttrib2fARB;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib2f", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib2fARB) {
-        void **procp = (void **) &disp->VertexAttrib2fARB;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib2fARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib2fvARB) {
-        void **procp = (void **) &disp->VertexAttrib2fvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib2fv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib2fvARB) {
-        void **procp = (void **) &disp->VertexAttrib2fvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib2fvARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib2sARB) {
-        void **procp = (void **) &disp->VertexAttrib2sARB;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib2s", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib2sARB) {
-        void **procp = (void **) &disp->VertexAttrib2sARB;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib2sARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib2svARB) {
-        void **procp = (void **) &disp->VertexAttrib2svARB;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib2sv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib2svARB) {
-        void **procp = (void **) &disp->VertexAttrib2svARB;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib2svARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib3dARB) {
-        void **procp = (void **) &disp->VertexAttrib3dARB;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib3d", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib3dARB) {
-        void **procp = (void **) &disp->VertexAttrib3dARB;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib3dARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib3dvARB) {
-        void **procp = (void **) &disp->VertexAttrib3dvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib3dv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib3dvARB) {
-        void **procp = (void **) &disp->VertexAttrib3dvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib3dvARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib3fARB) {
-        void **procp = (void **) &disp->VertexAttrib3fARB;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib3f", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib3fARB) {
-        void **procp = (void **) &disp->VertexAttrib3fARB;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib3fARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib3fvARB) {
-        void **procp = (void **) &disp->VertexAttrib3fvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib3fv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib3fvARB) {
-        void **procp = (void **) &disp->VertexAttrib3fvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib3fvARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib3sARB) {
-        void **procp = (void **) &disp->VertexAttrib3sARB;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib3s", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib3sARB) {
-        void **procp = (void **) &disp->VertexAttrib3sARB;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib3sARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib3svARB) {
-        void **procp = (void **) &disp->VertexAttrib3svARB;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib3sv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib3svARB) {
-        void **procp = (void **) &disp->VertexAttrib3svARB;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib3svARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib4NbvARB) {
-        void **procp = (void **) &disp->VertexAttrib4NbvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib4Nbv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib4NbvARB) {
-        void **procp = (void **) &disp->VertexAttrib4NbvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib4NbvARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib4NivARB) {
-        void **procp = (void **) &disp->VertexAttrib4NivARB;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib4Niv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib4NivARB) {
-        void **procp = (void **) &disp->VertexAttrib4NivARB;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib4NivARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib4NsvARB) {
-        void **procp = (void **) &disp->VertexAttrib4NsvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib4Nsv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib4NsvARB) {
-        void **procp = (void **) &disp->VertexAttrib4NsvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib4NsvARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib4NubARB) {
-        void **procp = (void **) &disp->VertexAttrib4NubARB;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib4Nub", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib4NubARB) {
-        void **procp = (void **) &disp->VertexAttrib4NubARB;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib4NubARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib4NubvARB) {
-        void **procp = (void **) &disp->VertexAttrib4NubvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib4Nubv",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib4NubvARB) {
-        void **procp = (void **) &disp->VertexAttrib4NubvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib4NubvARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib4NuivARB) {
-        void **procp = (void **) &disp->VertexAttrib4NuivARB;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib4Nuiv",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib4NuivARB) {
-        void **procp = (void **) &disp->VertexAttrib4NuivARB;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib4NuivARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib4NusvARB) {
-        void **procp = (void **) &disp->VertexAttrib4NusvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib4Nusv",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib4NusvARB) {
-        void **procp = (void **) &disp->VertexAttrib4NusvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib4NusvARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib4bvARB) {
-        void **procp = (void **) &disp->VertexAttrib4bvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib4bv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib4bvARB) {
-        void **procp = (void **) &disp->VertexAttrib4bvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib4bvARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib4dARB) {
-        void **procp = (void **) &disp->VertexAttrib4dARB;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib4d", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib4dARB) {
-        void **procp = (void **) &disp->VertexAttrib4dARB;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib4dARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib4dvARB) {
-        void **procp = (void **) &disp->VertexAttrib4dvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib4dv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib4dvARB) {
-        void **procp = (void **) &disp->VertexAttrib4dvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib4dvARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib4fARB) {
-        void **procp = (void **) &disp->VertexAttrib4fARB;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib4f", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib4fARB) {
-        void **procp = (void **) &disp->VertexAttrib4fARB;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib4fARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib4fvARB) {
-        void **procp = (void **) &disp->VertexAttrib4fvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib4fv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib4fvARB) {
-        void **procp = (void **) &disp->VertexAttrib4fvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib4fvARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib4ivARB) {
-        void **procp = (void **) &disp->VertexAttrib4ivARB;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib4iv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib4ivARB) {
-        void **procp = (void **) &disp->VertexAttrib4ivARB;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib4ivARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib4sARB) {
-        void **procp = (void **) &disp->VertexAttrib4sARB;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib4s", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib4sARB) {
-        void **procp = (void **) &disp->VertexAttrib4sARB;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib4sARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib4svARB) {
-        void **procp = (void **) &disp->VertexAttrib4svARB;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib4sv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib4svARB) {
-        void **procp = (void **) &disp->VertexAttrib4svARB;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib4svARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib4ubvARB) {
-        void **procp = (void **) &disp->VertexAttrib4ubvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib4ubv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib4ubvARB) {
-        void **procp = (void **) &disp->VertexAttrib4ubvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib4ubvARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib4uivARB) {
-        void **procp = (void **) &disp->VertexAttrib4uivARB;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib4uiv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib4uivARB) {
-        void **procp = (void **) &disp->VertexAttrib4uivARB;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib4uivARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib4usvARB) {
-        void **procp = (void **) &disp->VertexAttrib4usvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib4usv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib4usvARB) {
-        void **procp = (void **) &disp->VertexAttrib4usvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib4usvARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttribPointerARB) {
-        void **procp = (void **) &disp->VertexAttribPointerARB;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttribPointer",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttribPointerARB) {
-        void **procp = (void **) &disp->VertexAttribPointerARB;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttribPointerARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->BindBufferARB) {
-        void **procp = (void **) &disp->BindBufferARB;
-
-        snprintf(symboln, sizeof(symboln), "%sBindBuffer", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->BindBufferARB) {
-        void **procp = (void **) &disp->BindBufferARB;
-
-        snprintf(symboln, sizeof(symboln), "%sBindBufferARB", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->BufferDataARB) {
-        void **procp = (void **) &disp->BufferDataARB;
-
-        snprintf(symboln, sizeof(symboln), "%sBufferData", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->BufferDataARB) {
-        void **procp = (void **) &disp->BufferDataARB;
-
-        snprintf(symboln, sizeof(symboln), "%sBufferDataARB", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->BufferSubDataARB) {
-        void **procp = (void **) &disp->BufferSubDataARB;
-
-        snprintf(symboln, sizeof(symboln), "%sBufferSubData", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->BufferSubDataARB) {
-        void **procp = (void **) &disp->BufferSubDataARB;
-
-        snprintf(symboln, sizeof(symboln), "%sBufferSubDataARB", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->DeleteBuffersARB) {
-        void **procp = (void **) &disp->DeleteBuffersARB;
-
-        snprintf(symboln, sizeof(symboln), "%sDeleteBuffers", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->DeleteBuffersARB) {
-        void **procp = (void **) &disp->DeleteBuffersARB;
-
-        snprintf(symboln, sizeof(symboln), "%sDeleteBuffersARB", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GenBuffersARB) {
-        void **procp = (void **) &disp->GenBuffersARB;
-
-        snprintf(symboln, sizeof(symboln), "%sGenBuffers", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GenBuffersARB) {
-        void **procp = (void **) &disp->GenBuffersARB;
-
-        snprintf(symboln, sizeof(symboln), "%sGenBuffersARB", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetBufferParameterivARB) {
-        void **procp = (void **) &disp->GetBufferParameterivARB;
-
-        snprintf(symboln, sizeof(symboln), "%sGetBufferParameteriv",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetBufferParameterivARB) {
-        void **procp = (void **) &disp->GetBufferParameterivARB;
-
-        snprintf(symboln, sizeof(symboln), "%sGetBufferParameterivARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetBufferPointervARB) {
-        void **procp = (void **) &disp->GetBufferPointervARB;
-
-        snprintf(symboln, sizeof(symboln), "%sGetBufferPointerv",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetBufferPointervARB) {
-        void **procp = (void **) &disp->GetBufferPointervARB;
-
-        snprintf(symboln, sizeof(symboln), "%sGetBufferPointervARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetBufferSubDataARB) {
-        void **procp = (void **) &disp->GetBufferSubDataARB;
-
-        snprintf(symboln, sizeof(symboln), "%sGetBufferSubData", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetBufferSubDataARB) {
-        void **procp = (void **) &disp->GetBufferSubDataARB;
-
-        snprintf(symboln, sizeof(symboln), "%sGetBufferSubDataARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->IsBufferARB) {
-        void **procp = (void **) &disp->IsBufferARB;
-
-        snprintf(symboln, sizeof(symboln), "%sIsBuffer", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->IsBufferARB) {
-        void **procp = (void **) &disp->IsBufferARB;
-
-        snprintf(symboln, sizeof(symboln), "%sIsBufferARB", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MapBufferARB) {
-        void **procp = (void **) &disp->MapBufferARB;
-
-        snprintf(symboln, sizeof(symboln), "%sMapBuffer", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MapBufferARB) {
-        void **procp = (void **) &disp->MapBufferARB;
-
-        snprintf(symboln, sizeof(symboln), "%sMapBufferARB", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->UnmapBufferARB) {
-        void **procp = (void **) &disp->UnmapBufferARB;
-
-        snprintf(symboln, sizeof(symboln), "%sUnmapBuffer", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->UnmapBufferARB) {
-        void **procp = (void **) &disp->UnmapBufferARB;
-
-        snprintf(symboln, sizeof(symboln), "%sUnmapBufferARB", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->BeginQueryARB) {
-        void **procp = (void **) &disp->BeginQueryARB;
-
-        snprintf(symboln, sizeof(symboln), "%sBeginQuery", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->BeginQueryARB) {
-        void **procp = (void **) &disp->BeginQueryARB;
-
-        snprintf(symboln, sizeof(symboln), "%sBeginQueryARB", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->DeleteQueriesARB) {
-        void **procp = (void **) &disp->DeleteQueriesARB;
-
-        snprintf(symboln, sizeof(symboln), "%sDeleteQueries", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->DeleteQueriesARB) {
-        void **procp = (void **) &disp->DeleteQueriesARB;
-
-        snprintf(symboln, sizeof(symboln), "%sDeleteQueriesARB", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->EndQueryARB) {
-        void **procp = (void **) &disp->EndQueryARB;
-
-        snprintf(symboln, sizeof(symboln), "%sEndQuery", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->EndQueryARB) {
-        void **procp = (void **) &disp->EndQueryARB;
-
-        snprintf(symboln, sizeof(symboln), "%sEndQueryARB", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GenQueriesARB) {
-        void **procp = (void **) &disp->GenQueriesARB;
-
-        snprintf(symboln, sizeof(symboln), "%sGenQueries", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GenQueriesARB) {
-        void **procp = (void **) &disp->GenQueriesARB;
-
-        snprintf(symboln, sizeof(symboln), "%sGenQueriesARB", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetQueryObjectivARB) {
-        void **procp = (void **) &disp->GetQueryObjectivARB;
-
-        snprintf(symboln, sizeof(symboln), "%sGetQueryObjectiv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetQueryObjectivARB) {
-        void **procp = (void **) &disp->GetQueryObjectivARB;
-
-        snprintf(symboln, sizeof(symboln), "%sGetQueryObjectivARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetQueryObjectuivARB) {
-        void **procp = (void **) &disp->GetQueryObjectuivARB;
-
-        snprintf(symboln, sizeof(symboln), "%sGetQueryObjectuiv",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetQueryObjectuivARB) {
-        void **procp = (void **) &disp->GetQueryObjectuivARB;
-
-        snprintf(symboln, sizeof(symboln), "%sGetQueryObjectuivARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetQueryivARB) {
-        void **procp = (void **) &disp->GetQueryivARB;
-
-        snprintf(symboln, sizeof(symboln), "%sGetQueryiv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetQueryivARB) {
-        void **procp = (void **) &disp->GetQueryivARB;
-
-        snprintf(symboln, sizeof(symboln), "%sGetQueryivARB", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->IsQueryARB) {
-        void **procp = (void **) &disp->IsQueryARB;
-
-        snprintf(symboln, sizeof(symboln), "%sIsQuery", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->IsQueryARB) {
-        void **procp = (void **) &disp->IsQueryARB;
-
-        snprintf(symboln, sizeof(symboln), "%sIsQueryARB", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->AttachObjectARB) {
-        void **procp = (void **) &disp->AttachObjectARB;
-
-        snprintf(symboln, sizeof(symboln), "%sAttachObjectARB", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->CompileShaderARB) {
-        void **procp = (void **) &disp->CompileShaderARB;
-
-        snprintf(symboln, sizeof(symboln), "%sCompileShader", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->CompileShaderARB) {
-        void **procp = (void **) &disp->CompileShaderARB;
-
-        snprintf(symboln, sizeof(symboln), "%sCompileShaderARB", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->CreateProgramObjectARB) {
-        void **procp = (void **) &disp->CreateProgramObjectARB;
-
-        snprintf(symboln, sizeof(symboln), "%sCreateProgramObjectARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->CreateShaderObjectARB) {
-        void **procp = (void **) &disp->CreateShaderObjectARB;
-
-        snprintf(symboln, sizeof(symboln), "%sCreateShaderObjectARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->DeleteObjectARB) {
-        void **procp = (void **) &disp->DeleteObjectARB;
-
-        snprintf(symboln, sizeof(symboln), "%sDeleteObjectARB", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->DetachObjectARB) {
-        void **procp = (void **) &disp->DetachObjectARB;
-
-        snprintf(symboln, sizeof(symboln), "%sDetachObjectARB", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetActiveUniformARB) {
-        void **procp = (void **) &disp->GetActiveUniformARB;
-
-        snprintf(symboln, sizeof(symboln), "%sGetActiveUniform", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetActiveUniformARB) {
-        void **procp = (void **) &disp->GetActiveUniformARB;
-
-        snprintf(symboln, sizeof(symboln), "%sGetActiveUniformARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetAttachedObjectsARB) {
-        void **procp = (void **) &disp->GetAttachedObjectsARB;
-
-        snprintf(symboln, sizeof(symboln), "%sGetAttachedObjectsARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetHandleARB) {
-        void **procp = (void **) &disp->GetHandleARB;
-
-        snprintf(symboln, sizeof(symboln), "%sGetHandleARB", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetInfoLogARB) {
-        void **procp = (void **) &disp->GetInfoLogARB;
-
-        snprintf(symboln, sizeof(symboln), "%sGetInfoLogARB", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetObjectParameterfvARB) {
-        void **procp = (void **) &disp->GetObjectParameterfvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sGetObjectParameterfvARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetObjectParameterivARB) {
-        void **procp = (void **) &disp->GetObjectParameterivARB;
-
-        snprintf(symboln, sizeof(symboln), "%sGetObjectParameterivARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetShaderSourceARB) {
-        void **procp = (void **) &disp->GetShaderSourceARB;
-
-        snprintf(symboln, sizeof(symboln), "%sGetShaderSource", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetShaderSourceARB) {
-        void **procp = (void **) &disp->GetShaderSourceARB;
-
-        snprintf(symboln, sizeof(symboln), "%sGetShaderSourceARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetUniformLocationARB) {
-        void **procp = (void **) &disp->GetUniformLocationARB;
-
-        snprintf(symboln, sizeof(symboln), "%sGetUniformLocation",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetUniformLocationARB) {
-        void **procp = (void **) &disp->GetUniformLocationARB;
-
-        snprintf(symboln, sizeof(symboln), "%sGetUniformLocationARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetUniformfvARB) {
-        void **procp = (void **) &disp->GetUniformfvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sGetUniformfv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetUniformfvARB) {
-        void **procp = (void **) &disp->GetUniformfvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sGetUniformfvARB", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetUniformivARB) {
-        void **procp = (void **) &disp->GetUniformivARB;
-
-        snprintf(symboln, sizeof(symboln), "%sGetUniformiv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetUniformivARB) {
-        void **procp = (void **) &disp->GetUniformivARB;
-
-        snprintf(symboln, sizeof(symboln), "%sGetUniformivARB", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->LinkProgramARB) {
-        void **procp = (void **) &disp->LinkProgramARB;
-
-        snprintf(symboln, sizeof(symboln), "%sLinkProgram", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->LinkProgramARB) {
-        void **procp = (void **) &disp->LinkProgramARB;
-
-        snprintf(symboln, sizeof(symboln), "%sLinkProgramARB", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ShaderSourceARB) {
-        void **procp = (void **) &disp->ShaderSourceARB;
-
-        snprintf(symboln, sizeof(symboln), "%sShaderSource", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ShaderSourceARB) {
-        void **procp = (void **) &disp->ShaderSourceARB;
-
-        snprintf(symboln, sizeof(symboln), "%sShaderSourceARB", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Uniform1fARB) {
-        void **procp = (void **) &disp->Uniform1fARB;
-
-        snprintf(symboln, sizeof(symboln), "%sUniform1f", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Uniform1fARB) {
-        void **procp = (void **) &disp->Uniform1fARB;
-
-        snprintf(symboln, sizeof(symboln), "%sUniform1fARB", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Uniform1fvARB) {
-        void **procp = (void **) &disp->Uniform1fvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sUniform1fv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Uniform1fvARB) {
-        void **procp = (void **) &disp->Uniform1fvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sUniform1fvARB", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Uniform1iARB) {
-        void **procp = (void **) &disp->Uniform1iARB;
-
-        snprintf(symboln, sizeof(symboln), "%sUniform1i", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Uniform1iARB) {
-        void **procp = (void **) &disp->Uniform1iARB;
-
-        snprintf(symboln, sizeof(symboln), "%sUniform1iARB", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Uniform1ivARB) {
-        void **procp = (void **) &disp->Uniform1ivARB;
-
-        snprintf(symboln, sizeof(symboln), "%sUniform1iv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Uniform1ivARB) {
-        void **procp = (void **) &disp->Uniform1ivARB;
-
-        snprintf(symboln, sizeof(symboln), "%sUniform1ivARB", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Uniform2fARB) {
-        void **procp = (void **) &disp->Uniform2fARB;
-
-        snprintf(symboln, sizeof(symboln), "%sUniform2f", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Uniform2fARB) {
-        void **procp = (void **) &disp->Uniform2fARB;
-
-        snprintf(symboln, sizeof(symboln), "%sUniform2fARB", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Uniform2fvARB) {
-        void **procp = (void **) &disp->Uniform2fvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sUniform2fv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Uniform2fvARB) {
-        void **procp = (void **) &disp->Uniform2fvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sUniform2fvARB", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Uniform2iARB) {
-        void **procp = (void **) &disp->Uniform2iARB;
-
-        snprintf(symboln, sizeof(symboln), "%sUniform2i", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Uniform2iARB) {
-        void **procp = (void **) &disp->Uniform2iARB;
-
-        snprintf(symboln, sizeof(symboln), "%sUniform2iARB", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Uniform2ivARB) {
-        void **procp = (void **) &disp->Uniform2ivARB;
-
-        snprintf(symboln, sizeof(symboln), "%sUniform2iv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Uniform2ivARB) {
-        void **procp = (void **) &disp->Uniform2ivARB;
-
-        snprintf(symboln, sizeof(symboln), "%sUniform2ivARB", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Uniform3fARB) {
-        void **procp = (void **) &disp->Uniform3fARB;
-
-        snprintf(symboln, sizeof(symboln), "%sUniform3f", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Uniform3fARB) {
-        void **procp = (void **) &disp->Uniform3fARB;
-
-        snprintf(symboln, sizeof(symboln), "%sUniform3fARB", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Uniform3fvARB) {
-        void **procp = (void **) &disp->Uniform3fvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sUniform3fv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Uniform3fvARB) {
-        void **procp = (void **) &disp->Uniform3fvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sUniform3fvARB", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Uniform3iARB) {
-        void **procp = (void **) &disp->Uniform3iARB;
-
-        snprintf(symboln, sizeof(symboln), "%sUniform3i", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Uniform3iARB) {
-        void **procp = (void **) &disp->Uniform3iARB;
-
-        snprintf(symboln, sizeof(symboln), "%sUniform3iARB", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Uniform3ivARB) {
-        void **procp = (void **) &disp->Uniform3ivARB;
-
-        snprintf(symboln, sizeof(symboln), "%sUniform3iv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Uniform3ivARB) {
-        void **procp = (void **) &disp->Uniform3ivARB;
-
-        snprintf(symboln, sizeof(symboln), "%sUniform3ivARB", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Uniform4fARB) {
-        void **procp = (void **) &disp->Uniform4fARB;
-
-        snprintf(symboln, sizeof(symboln), "%sUniform4f", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Uniform4fARB) {
-        void **procp = (void **) &disp->Uniform4fARB;
-
-        snprintf(symboln, sizeof(symboln), "%sUniform4fARB", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Uniform4fvARB) {
-        void **procp = (void **) &disp->Uniform4fvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sUniform4fv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Uniform4fvARB) {
-        void **procp = (void **) &disp->Uniform4fvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sUniform4fvARB", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Uniform4iARB) {
-        void **procp = (void **) &disp->Uniform4iARB;
-
-        snprintf(symboln, sizeof(symboln), "%sUniform4i", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Uniform4iARB) {
-        void **procp = (void **) &disp->Uniform4iARB;
-
-        snprintf(symboln, sizeof(symboln), "%sUniform4iARB", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Uniform4ivARB) {
-        void **procp = (void **) &disp->Uniform4ivARB;
-
-        snprintf(symboln, sizeof(symboln), "%sUniform4iv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Uniform4ivARB) {
-        void **procp = (void **) &disp->Uniform4ivARB;
-
-        snprintf(symboln, sizeof(symboln), "%sUniform4ivARB", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->UniformMatrix2fvARB) {
-        void **procp = (void **) &disp->UniformMatrix2fvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sUniformMatrix2fv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->UniformMatrix2fvARB) {
-        void **procp = (void **) &disp->UniformMatrix2fvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sUniformMatrix2fvARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->UniformMatrix3fvARB) {
-        void **procp = (void **) &disp->UniformMatrix3fvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sUniformMatrix3fv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->UniformMatrix3fvARB) {
-        void **procp = (void **) &disp->UniformMatrix3fvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sUniformMatrix3fvARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->UniformMatrix4fvARB) {
-        void **procp = (void **) &disp->UniformMatrix4fvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sUniformMatrix4fv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->UniformMatrix4fvARB) {
-        void **procp = (void **) &disp->UniformMatrix4fvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sUniformMatrix4fvARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->UseProgramObjectARB) {
-        void **procp = (void **) &disp->UseProgramObjectARB;
-
-        snprintf(symboln, sizeof(symboln), "%sUseProgram", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->UseProgramObjectARB) {
-        void **procp = (void **) &disp->UseProgramObjectARB;
-
-        snprintf(symboln, sizeof(symboln), "%sUseProgramObjectARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ValidateProgramARB) {
-        void **procp = (void **) &disp->ValidateProgramARB;
-
-        snprintf(symboln, sizeof(symboln), "%sValidateProgram", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ValidateProgramARB) {
-        void **procp = (void **) &disp->ValidateProgramARB;
-
-        snprintf(symboln, sizeof(symboln), "%sValidateProgramARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->BindAttribLocationARB) {
-        void **procp = (void **) &disp->BindAttribLocationARB;
-
-        snprintf(symboln, sizeof(symboln), "%sBindAttribLocation",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->BindAttribLocationARB) {
-        void **procp = (void **) &disp->BindAttribLocationARB;
-
-        snprintf(symboln, sizeof(symboln), "%sBindAttribLocationARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetActiveAttribARB) {
-        void **procp = (void **) &disp->GetActiveAttribARB;
-
-        snprintf(symboln, sizeof(symboln), "%sGetActiveAttrib", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetActiveAttribARB) {
-        void **procp = (void **) &disp->GetActiveAttribARB;
-
-        snprintf(symboln, sizeof(symboln), "%sGetActiveAttribARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetAttribLocationARB) {
-        void **procp = (void **) &disp->GetAttribLocationARB;
-
-        snprintf(symboln, sizeof(symboln), "%sGetAttribLocation",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetAttribLocationARB) {
-        void **procp = (void **) &disp->GetAttribLocationARB;
-
-        snprintf(symboln, sizeof(symboln), "%sGetAttribLocationARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->DrawBuffersARB) {
-        void **procp = (void **) &disp->DrawBuffersARB;
-
-        snprintf(symboln, sizeof(symboln), "%sDrawBuffers", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->DrawBuffersARB) {
-        void **procp = (void **) &disp->DrawBuffersARB;
-
-        snprintf(symboln, sizeof(symboln), "%sDrawBuffersARB", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->DrawBuffersARB) {
-        void **procp = (void **) &disp->DrawBuffersARB;
-
-        snprintf(symboln, sizeof(symboln), "%sDrawBuffersATI", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->DrawBuffersARB) {
-        void **procp = (void **) &disp->DrawBuffersARB;
-
-        snprintf(symboln, sizeof(symboln), "%sDrawBuffersNV", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ClampColorARB) {
-        void **procp = (void **) &disp->ClampColorARB;
-
-        snprintf(symboln, sizeof(symboln), "%sClampColorARB", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->DrawArraysInstancedARB) {
-        void **procp = (void **) &disp->DrawArraysInstancedARB;
-
-        snprintf(symboln, sizeof(symboln), "%sDrawArraysInstancedARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->DrawArraysInstancedARB) {
-        void **procp = (void **) &disp->DrawArraysInstancedARB;
-
-        snprintf(symboln, sizeof(symboln), "%sDrawArraysInstancedEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->DrawArraysInstancedARB) {
-        void **procp = (void **) &disp->DrawArraysInstancedARB;
-
-        snprintf(symboln, sizeof(symboln), "%sDrawArraysInstanced",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->DrawElementsInstancedARB) {
-        void **procp = (void **) &disp->DrawElementsInstancedARB;
-
-        snprintf(symboln, sizeof(symboln), "%sDrawElementsInstancedARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->DrawElementsInstancedARB) {
-        void **procp = (void **) &disp->DrawElementsInstancedARB;
-
-        snprintf(symboln, sizeof(symboln), "%sDrawElementsInstancedEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->DrawElementsInstancedARB) {
-        void **procp = (void **) &disp->DrawElementsInstancedARB;
-
-        snprintf(symboln, sizeof(symboln), "%sDrawElementsInstanced",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->RenderbufferStorageMultisample) {
-        void **procp = (void **) &disp->RenderbufferStorageMultisample;
-
-        snprintf(symboln, sizeof(symboln), "%sRenderbufferStorageMultisample",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->RenderbufferStorageMultisample) {
-        void **procp = (void **) &disp->RenderbufferStorageMultisample;
-
-        snprintf(symboln, sizeof(symboln),
-                 "%sRenderbufferStorageMultisampleEXT", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->FramebufferTextureARB) {
-        void **procp = (void **) &disp->FramebufferTextureARB;
-
-        snprintf(symboln, sizeof(symboln), "%sFramebufferTextureARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->FramebufferTextureFaceARB) {
-        void **procp = (void **) &disp->FramebufferTextureFaceARB;
-
-        snprintf(symboln, sizeof(symboln), "%sFramebufferTextureFaceARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ProgramParameteriARB) {
-        void **procp = (void **) &disp->ProgramParameteriARB;
-
-        snprintf(symboln, sizeof(symboln), "%sProgramParameteriARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttribDivisorARB) {
-        void **procp = (void **) &disp->VertexAttribDivisorARB;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttribDivisorARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->FlushMappedBufferRange) {
-        void **procp = (void **) &disp->FlushMappedBufferRange;
-
-        snprintf(symboln, sizeof(symboln), "%sFlushMappedBufferRange",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MapBufferRange) {
-        void **procp = (void **) &disp->MapBufferRange;
-
-        snprintf(symboln, sizeof(symboln), "%sMapBufferRange", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TexBufferARB) {
-        void **procp = (void **) &disp->TexBufferARB;
-
-        snprintf(symboln, sizeof(symboln), "%sTexBufferARB", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->BindVertexArray) {
-        void **procp = (void **) &disp->BindVertexArray;
-
-        snprintf(symboln, sizeof(symboln), "%sBindVertexArray", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GenVertexArrays) {
-        void **procp = (void **) &disp->GenVertexArrays;
-
-        snprintf(symboln, sizeof(symboln), "%sGenVertexArrays", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->CopyBufferSubData) {
-        void **procp = (void **) &disp->CopyBufferSubData;
-
-        snprintf(symboln, sizeof(symboln), "%sCopyBufferSubData",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ClientWaitSync) {
-        void **procp = (void **) &disp->ClientWaitSync;
-
-        snprintf(symboln, sizeof(symboln), "%sClientWaitSync", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->DeleteSync) {
-        void **procp = (void **) &disp->DeleteSync;
-
-        snprintf(symboln, sizeof(symboln), "%sDeleteSync", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->FenceSync) {
-        void **procp = (void **) &disp->FenceSync;
-
-        snprintf(symboln, sizeof(symboln), "%sFenceSync", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetInteger64v) {
-        void **procp = (void **) &disp->GetInteger64v;
-
-        snprintf(symboln, sizeof(symboln), "%sGetInteger64v", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetSynciv) {
-        void **procp = (void **) &disp->GetSynciv;
-
-        snprintf(symboln, sizeof(symboln), "%sGetSynciv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->IsSync) {
-        void **procp = (void **) &disp->IsSync;
-
-        snprintf(symboln, sizeof(symboln), "%sIsSync", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->WaitSync) {
-        void **procp = (void **) &disp->WaitSync;
-
-        snprintf(symboln, sizeof(symboln), "%sWaitSync", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->DrawElementsBaseVertex) {
-        void **procp = (void **) &disp->DrawElementsBaseVertex;
-
-        snprintf(symboln, sizeof(symboln), "%sDrawElementsBaseVertex",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->DrawElementsInstancedBaseVertex) {
-        void **procp = (void **) &disp->DrawElementsInstancedBaseVertex;
-
-        snprintf(symboln, sizeof(symboln), "%sDrawElementsInstancedBaseVertex",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->DrawRangeElementsBaseVertex) {
-        void **procp = (void **) &disp->DrawRangeElementsBaseVertex;
-
-        snprintf(symboln, sizeof(symboln), "%sDrawRangeElementsBaseVertex",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultiDrawElementsBaseVertex) {
-        void **procp = (void **) &disp->MultiDrawElementsBaseVertex;
-
-        snprintf(symboln, sizeof(symboln), "%sMultiDrawElementsBaseVertex",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->BlendEquationSeparateiARB) {
-        void **procp = (void **) &disp->BlendEquationSeparateiARB;
-
-        snprintf(symboln, sizeof(symboln), "%sBlendEquationSeparateiARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->BlendEquationSeparateiARB) {
-        void **procp = (void **) &disp->BlendEquationSeparateiARB;
-
-        snprintf(symboln, sizeof(symboln), "%sBlendEquationSeparateIndexedAMD",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->BlendEquationiARB) {
-        void **procp = (void **) &disp->BlendEquationiARB;
-
-        snprintf(symboln, sizeof(symboln), "%sBlendEquationiARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->BlendEquationiARB) {
-        void **procp = (void **) &disp->BlendEquationiARB;
-
-        snprintf(symboln, sizeof(symboln), "%sBlendEquationIndexedAMD",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->BlendFuncSeparateiARB) {
-        void **procp = (void **) &disp->BlendFuncSeparateiARB;
-
-        snprintf(symboln, sizeof(symboln), "%sBlendFuncSeparateiARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->BlendFuncSeparateiARB) {
-        void **procp = (void **) &disp->BlendFuncSeparateiARB;
-
-        snprintf(symboln, sizeof(symboln), "%sBlendFuncSeparateIndexedAMD",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->BlendFunciARB) {
-        void **procp = (void **) &disp->BlendFunciARB;
-
-        snprintf(symboln, sizeof(symboln), "%sBlendFunciARB", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->BlendFunciARB) {
-        void **procp = (void **) &disp->BlendFunciARB;
-
-        snprintf(symboln, sizeof(symboln), "%sBlendFuncIndexedAMD",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->BindSampler) {
-        void **procp = (void **) &disp->BindSampler;
-
-        snprintf(symboln, sizeof(symboln), "%sBindSampler", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->DeleteSamplers) {
-        void **procp = (void **) &disp->DeleteSamplers;
-
-        snprintf(symboln, sizeof(symboln), "%sDeleteSamplers", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GenSamplers) {
-        void **procp = (void **) &disp->GenSamplers;
-
-        snprintf(symboln, sizeof(symboln), "%sGenSamplers", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetSamplerParameterIiv) {
-        void **procp = (void **) &disp->GetSamplerParameterIiv;
-
-        snprintf(symboln, sizeof(symboln), "%sGetSamplerParameterIiv",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetSamplerParameterIuiv) {
-        void **procp = (void **) &disp->GetSamplerParameterIuiv;
-
-        snprintf(symboln, sizeof(symboln), "%sGetSamplerParameterIuiv",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetSamplerParameterfv) {
-        void **procp = (void **) &disp->GetSamplerParameterfv;
-
-        snprintf(symboln, sizeof(symboln), "%sGetSamplerParameterfv",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetSamplerParameteriv) {
-        void **procp = (void **) &disp->GetSamplerParameteriv;
-
-        snprintf(symboln, sizeof(symboln), "%sGetSamplerParameteriv",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->IsSampler) {
-        void **procp = (void **) &disp->IsSampler;
-
-        snprintf(symboln, sizeof(symboln), "%sIsSampler", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->SamplerParameterIiv) {
-        void **procp = (void **) &disp->SamplerParameterIiv;
-
-        snprintf(symboln, sizeof(symboln), "%sSamplerParameterIiv",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->SamplerParameterIuiv) {
-        void **procp = (void **) &disp->SamplerParameterIuiv;
-
-        snprintf(symboln, sizeof(symboln), "%sSamplerParameterIuiv",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->SamplerParameterf) {
-        void **procp = (void **) &disp->SamplerParameterf;
-
-        snprintf(symboln, sizeof(symboln), "%sSamplerParameterf",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->SamplerParameterfv) {
-        void **procp = (void **) &disp->SamplerParameterfv;
-
-        snprintf(symboln, sizeof(symboln), "%sSamplerParameterfv",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->SamplerParameteri) {
-        void **procp = (void **) &disp->SamplerParameteri;
-
-        snprintf(symboln, sizeof(symboln), "%sSamplerParameteri",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->SamplerParameteriv) {
-        void **procp = (void **) &disp->SamplerParameteriv;
-
-        snprintf(symboln, sizeof(symboln), "%sSamplerParameteriv",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ColorP3ui) {
-        void **procp = (void **) &disp->ColorP3ui;
-
-        snprintf(symboln, sizeof(symboln), "%sColorP3ui", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ColorP3uiv) {
-        void **procp = (void **) &disp->ColorP3uiv;
-
-        snprintf(symboln, sizeof(symboln), "%sColorP3uiv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ColorP4ui) {
-        void **procp = (void **) &disp->ColorP4ui;
-
-        snprintf(symboln, sizeof(symboln), "%sColorP4ui", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ColorP4uiv) {
-        void **procp = (void **) &disp->ColorP4uiv;
-
-        snprintf(symboln, sizeof(symboln), "%sColorP4uiv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultiTexCoordP1ui) {
-        void **procp = (void **) &disp->MultiTexCoordP1ui;
-
-        snprintf(symboln, sizeof(symboln), "%sMultiTexCoordP1ui",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultiTexCoordP1uiv) {
-        void **procp = (void **) &disp->MultiTexCoordP1uiv;
-
-        snprintf(symboln, sizeof(symboln), "%sMultiTexCoordP1uiv",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultiTexCoordP2ui) {
-        void **procp = (void **) &disp->MultiTexCoordP2ui;
-
-        snprintf(symboln, sizeof(symboln), "%sMultiTexCoordP2ui",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultiTexCoordP2uiv) {
-        void **procp = (void **) &disp->MultiTexCoordP2uiv;
-
-        snprintf(symboln, sizeof(symboln), "%sMultiTexCoordP2uiv",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultiTexCoordP3ui) {
-        void **procp = (void **) &disp->MultiTexCoordP3ui;
-
-        snprintf(symboln, sizeof(symboln), "%sMultiTexCoordP3ui",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultiTexCoordP3uiv) {
-        void **procp = (void **) &disp->MultiTexCoordP3uiv;
-
-        snprintf(symboln, sizeof(symboln), "%sMultiTexCoordP3uiv",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultiTexCoordP4ui) {
-        void **procp = (void **) &disp->MultiTexCoordP4ui;
-
-        snprintf(symboln, sizeof(symboln), "%sMultiTexCoordP4ui",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultiTexCoordP4uiv) {
-        void **procp = (void **) &disp->MultiTexCoordP4uiv;
-
-        snprintf(symboln, sizeof(symboln), "%sMultiTexCoordP4uiv",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->NormalP3ui) {
-        void **procp = (void **) &disp->NormalP3ui;
-
-        snprintf(symboln, sizeof(symboln), "%sNormalP3ui", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->NormalP3uiv) {
-        void **procp = (void **) &disp->NormalP3uiv;
-
-        snprintf(symboln, sizeof(symboln), "%sNormalP3uiv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->SecondaryColorP3ui) {
-        void **procp = (void **) &disp->SecondaryColorP3ui;
-
-        snprintf(symboln, sizeof(symboln), "%sSecondaryColorP3ui",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->SecondaryColorP3uiv) {
-        void **procp = (void **) &disp->SecondaryColorP3uiv;
-
-        snprintf(symboln, sizeof(symboln), "%sSecondaryColorP3uiv",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TexCoordP1ui) {
-        void **procp = (void **) &disp->TexCoordP1ui;
-
-        snprintf(symboln, sizeof(symboln), "%sTexCoordP1ui", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TexCoordP1uiv) {
-        void **procp = (void **) &disp->TexCoordP1uiv;
-
-        snprintf(symboln, sizeof(symboln), "%sTexCoordP1uiv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TexCoordP2ui) {
-        void **procp = (void **) &disp->TexCoordP2ui;
-
-        snprintf(symboln, sizeof(symboln), "%sTexCoordP2ui", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TexCoordP2uiv) {
-        void **procp = (void **) &disp->TexCoordP2uiv;
-
-        snprintf(symboln, sizeof(symboln), "%sTexCoordP2uiv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TexCoordP3ui) {
-        void **procp = (void **) &disp->TexCoordP3ui;
-
-        snprintf(symboln, sizeof(symboln), "%sTexCoordP3ui", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TexCoordP3uiv) {
-        void **procp = (void **) &disp->TexCoordP3uiv;
-
-        snprintf(symboln, sizeof(symboln), "%sTexCoordP3uiv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TexCoordP4ui) {
-        void **procp = (void **) &disp->TexCoordP4ui;
-
-        snprintf(symboln, sizeof(symboln), "%sTexCoordP4ui", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TexCoordP4uiv) {
-        void **procp = (void **) &disp->TexCoordP4uiv;
-
-        snprintf(symboln, sizeof(symboln), "%sTexCoordP4uiv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttribP1ui) {
-        void **procp = (void **) &disp->VertexAttribP1ui;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttribP1ui", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttribP1uiv) {
-        void **procp = (void **) &disp->VertexAttribP1uiv;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttribP1uiv",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttribP2ui) {
-        void **procp = (void **) &disp->VertexAttribP2ui;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttribP2ui", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttribP2uiv) {
-        void **procp = (void **) &disp->VertexAttribP2uiv;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttribP2uiv",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttribP3ui) {
-        void **procp = (void **) &disp->VertexAttribP3ui;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttribP3ui", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttribP3uiv) {
-        void **procp = (void **) &disp->VertexAttribP3uiv;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttribP3uiv",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttribP4ui) {
-        void **procp = (void **) &disp->VertexAttribP4ui;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttribP4ui", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttribP4uiv) {
-        void **procp = (void **) &disp->VertexAttribP4uiv;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttribP4uiv",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexP2ui) {
-        void **procp = (void **) &disp->VertexP2ui;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexP2ui", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexP2uiv) {
-        void **procp = (void **) &disp->VertexP2uiv;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexP2uiv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexP3ui) {
-        void **procp = (void **) &disp->VertexP3ui;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexP3ui", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexP3uiv) {
-        void **procp = (void **) &disp->VertexP3uiv;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexP3uiv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexP4ui) {
-        void **procp = (void **) &disp->VertexP4ui;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexP4ui", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexP4uiv) {
-        void **procp = (void **) &disp->VertexP4uiv;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexP4uiv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->BindTransformFeedback) {
-        void **procp = (void **) &disp->BindTransformFeedback;
-
-        snprintf(symboln, sizeof(symboln), "%sBindTransformFeedback",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->DeleteTransformFeedbacks) {
-        void **procp = (void **) &disp->DeleteTransformFeedbacks;
-
-        snprintf(symboln, sizeof(symboln), "%sDeleteTransformFeedbacks",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->DrawTransformFeedback) {
-        void **procp = (void **) &disp->DrawTransformFeedback;
-
-        snprintf(symboln, sizeof(symboln), "%sDrawTransformFeedback",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GenTransformFeedbacks) {
-        void **procp = (void **) &disp->GenTransformFeedbacks;
-
-        snprintf(symboln, sizeof(symboln), "%sGenTransformFeedbacks",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->IsTransformFeedback) {
-        void **procp = (void **) &disp->IsTransformFeedback;
-
-        snprintf(symboln, sizeof(symboln), "%sIsTransformFeedback",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->PauseTransformFeedback) {
-        void **procp = (void **) &disp->PauseTransformFeedback;
-
-        snprintf(symboln, sizeof(symboln), "%sPauseTransformFeedback",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ResumeTransformFeedback) {
-        void **procp = (void **) &disp->ResumeTransformFeedback;
-
-        snprintf(symboln, sizeof(symboln), "%sResumeTransformFeedback",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ClearDepthf) {
-        void **procp = (void **) &disp->ClearDepthf;
-
-        snprintf(symboln, sizeof(symboln), "%sClearDepthf", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->DepthRangef) {
-        void **procp = (void **) &disp->DepthRangef;
-
-        snprintf(symboln, sizeof(symboln), "%sDepthRangef", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetShaderPrecisionFormat) {
-        void **procp = (void **) &disp->GetShaderPrecisionFormat;
-
-        snprintf(symboln, sizeof(symboln), "%sGetShaderPrecisionFormat",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ReleaseShaderCompiler) {
-        void **procp = (void **) &disp->ReleaseShaderCompiler;
-
-        snprintf(symboln, sizeof(symboln), "%sReleaseShaderCompiler",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ShaderBinary) {
-        void **procp = (void **) &disp->ShaderBinary;
-
-        snprintf(symboln, sizeof(symboln), "%sShaderBinary", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetGraphicsResetStatusARB) {
-        void **procp = (void **) &disp->GetGraphicsResetStatusARB;
-
-        snprintf(symboln, sizeof(symboln), "%sGetGraphicsResetStatusARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetnColorTableARB) {
-        void **procp = (void **) &disp->GetnColorTableARB;
-
-        snprintf(symboln, sizeof(symboln), "%sGetnColorTableARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetnCompressedTexImageARB) {
-        void **procp = (void **) &disp->GetnCompressedTexImageARB;
-
-        snprintf(symboln, sizeof(symboln), "%sGetnCompressedTexImageARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetnConvolutionFilterARB) {
-        void **procp = (void **) &disp->GetnConvolutionFilterARB;
-
-        snprintf(symboln, sizeof(symboln), "%sGetnConvolutionFilterARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetnHistogramARB) {
-        void **procp = (void **) &disp->GetnHistogramARB;
-
-        snprintf(symboln, sizeof(symboln), "%sGetnHistogramARB", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetnMapdvARB) {
-        void **procp = (void **) &disp->GetnMapdvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sGetnMapdvARB", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetnMapfvARB) {
-        void **procp = (void **) &disp->GetnMapfvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sGetnMapfvARB", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetnMapivARB) {
-        void **procp = (void **) &disp->GetnMapivARB;
-
-        snprintf(symboln, sizeof(symboln), "%sGetnMapivARB", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetnMinmaxARB) {
-        void **procp = (void **) &disp->GetnMinmaxARB;
-
-        snprintf(symboln, sizeof(symboln), "%sGetnMinmaxARB", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetnPixelMapfvARB) {
-        void **procp = (void **) &disp->GetnPixelMapfvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sGetnPixelMapfvARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetnPixelMapuivARB) {
-        void **procp = (void **) &disp->GetnPixelMapuivARB;
-
-        snprintf(symboln, sizeof(symboln), "%sGetnPixelMapuivARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetnPixelMapusvARB) {
-        void **procp = (void **) &disp->GetnPixelMapusvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sGetnPixelMapusvARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetnPolygonStippleARB) {
-        void **procp = (void **) &disp->GetnPolygonStippleARB;
-
-        snprintf(symboln, sizeof(symboln), "%sGetnPolygonStippleARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetnSeparableFilterARB) {
-        void **procp = (void **) &disp->GetnSeparableFilterARB;
-
-        snprintf(symboln, sizeof(symboln), "%sGetnSeparableFilterARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetnTexImageARB) {
-        void **procp = (void **) &disp->GetnTexImageARB;
-
-        snprintf(symboln, sizeof(symboln), "%sGetnTexImageARB", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetnUniformdvARB) {
-        void **procp = (void **) &disp->GetnUniformdvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sGetnUniformdvARB", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetnUniformfvARB) {
-        void **procp = (void **) &disp->GetnUniformfvARB;
-
-        snprintf(symboln, sizeof(symboln), "%sGetnUniformfvARB", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetnUniformivARB) {
-        void **procp = (void **) &disp->GetnUniformivARB;
-
-        snprintf(symboln, sizeof(symboln), "%sGetnUniformivARB", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetnUniformuivARB) {
-        void **procp = (void **) &disp->GetnUniformuivARB;
-
-        snprintf(symboln, sizeof(symboln), "%sGetnUniformuivARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ReadnPixelsARB) {
-        void **procp = (void **) &disp->ReadnPixelsARB;
-
-        snprintf(symboln, sizeof(symboln), "%sReadnPixelsARB", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TexStorage1D) {
-        void **procp = (void **) &disp->TexStorage1D;
-
-        snprintf(symboln, sizeof(symboln), "%sTexStorage1D", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TexStorage2D) {
-        void **procp = (void **) &disp->TexStorage2D;
-
-        snprintf(symboln, sizeof(symboln), "%sTexStorage2D", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TexStorage3D) {
-        void **procp = (void **) &disp->TexStorage3D;
-
-        snprintf(symboln, sizeof(symboln), "%sTexStorage3D", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TextureStorage1DEXT) {
-        void **procp = (void **) &disp->TextureStorage1DEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sTextureStorage1DEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TextureStorage2DEXT) {
-        void **procp = (void **) &disp->TextureStorage2DEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sTextureStorage2DEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TextureStorage3DEXT) {
-        void **procp = (void **) &disp->TextureStorage3DEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sTextureStorage3DEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->PolygonOffsetEXT) {
-        void **procp = (void **) &disp->PolygonOffsetEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sPolygonOffsetEXT", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetPixelTexGenParameterfvSGIS) {
-        void **procp = (void **) &disp->GetPixelTexGenParameterfvSGIS;
-
-        snprintf(symboln, sizeof(symboln), "%sGetPixelTexGenParameterfvSGIS",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetPixelTexGenParameterivSGIS) {
-        void **procp = (void **) &disp->GetPixelTexGenParameterivSGIS;
-
-        snprintf(symboln, sizeof(symboln), "%sGetPixelTexGenParameterivSGIS",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->PixelTexGenParameterfSGIS) {
-        void **procp = (void **) &disp->PixelTexGenParameterfSGIS;
-
-        snprintf(symboln, sizeof(symboln), "%sPixelTexGenParameterfSGIS",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->PixelTexGenParameterfvSGIS) {
-        void **procp = (void **) &disp->PixelTexGenParameterfvSGIS;
-
-        snprintf(symboln, sizeof(symboln), "%sPixelTexGenParameterfvSGIS",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->PixelTexGenParameteriSGIS) {
-        void **procp = (void **) &disp->PixelTexGenParameteriSGIS;
-
-        snprintf(symboln, sizeof(symboln), "%sPixelTexGenParameteriSGIS",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->PixelTexGenParameterivSGIS) {
-        void **procp = (void **) &disp->PixelTexGenParameterivSGIS;
-
-        snprintf(symboln, sizeof(symboln), "%sPixelTexGenParameterivSGIS",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->SampleMaskSGIS) {
-        void **procp = (void **) &disp->SampleMaskSGIS;
-
-        snprintf(symboln, sizeof(symboln), "%sSampleMaskSGIS", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->SampleMaskSGIS) {
-        void **procp = (void **) &disp->SampleMaskSGIS;
-
-        snprintf(symboln, sizeof(symboln), "%sSampleMaskEXT", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->SamplePatternSGIS) {
-        void **procp = (void **) &disp->SamplePatternSGIS;
-
-        snprintf(symboln, sizeof(symboln), "%sSamplePatternSGIS",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->SamplePatternSGIS) {
-        void **procp = (void **) &disp->SamplePatternSGIS;
-
-        snprintf(symboln, sizeof(symboln), "%sSamplePatternEXT", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ColorPointerEXT) {
-        void **procp = (void **) &disp->ColorPointerEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sColorPointerEXT", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->EdgeFlagPointerEXT) {
-        void **procp = (void **) &disp->EdgeFlagPointerEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sEdgeFlagPointerEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->IndexPointerEXT) {
-        void **procp = (void **) &disp->IndexPointerEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sIndexPointerEXT", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->NormalPointerEXT) {
-        void **procp = (void **) &disp->NormalPointerEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sNormalPointerEXT", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TexCoordPointerEXT) {
-        void **procp = (void **) &disp->TexCoordPointerEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sTexCoordPointerEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexPointerEXT) {
-        void **procp = (void **) &disp->VertexPointerEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexPointerEXT", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->PointParameterfEXT) {
-        void **procp = (void **) &disp->PointParameterfEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sPointParameterf", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->PointParameterfEXT) {
-        void **procp = (void **) &disp->PointParameterfEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sPointParameterfARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->PointParameterfEXT) {
-        void **procp = (void **) &disp->PointParameterfEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sPointParameterfEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->PointParameterfEXT) {
-        void **procp = (void **) &disp->PointParameterfEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sPointParameterfSGIS",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->PointParameterfvEXT) {
-        void **procp = (void **) &disp->PointParameterfvEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sPointParameterfv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->PointParameterfvEXT) {
-        void **procp = (void **) &disp->PointParameterfvEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sPointParameterfvARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->PointParameterfvEXT) {
-        void **procp = (void **) &disp->PointParameterfvEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sPointParameterfvEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->PointParameterfvEXT) {
-        void **procp = (void **) &disp->PointParameterfvEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sPointParameterfvSGIS",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->LockArraysEXT) {
-        void **procp = (void **) &disp->LockArraysEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sLockArraysEXT", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->UnlockArraysEXT) {
-        void **procp = (void **) &disp->UnlockArraysEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sUnlockArraysEXT", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->SecondaryColor3bEXT) {
-        void **procp = (void **) &disp->SecondaryColor3bEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sSecondaryColor3b", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->SecondaryColor3bEXT) {
-        void **procp = (void **) &disp->SecondaryColor3bEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sSecondaryColor3bEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->SecondaryColor3bvEXT) {
-        void **procp = (void **) &disp->SecondaryColor3bvEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sSecondaryColor3bv",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->SecondaryColor3bvEXT) {
-        void **procp = (void **) &disp->SecondaryColor3bvEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sSecondaryColor3bvEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->SecondaryColor3dEXT) {
-        void **procp = (void **) &disp->SecondaryColor3dEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sSecondaryColor3d", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->SecondaryColor3dEXT) {
-        void **procp = (void **) &disp->SecondaryColor3dEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sSecondaryColor3dEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->SecondaryColor3dvEXT) {
-        void **procp = (void **) &disp->SecondaryColor3dvEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sSecondaryColor3dv",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->SecondaryColor3dvEXT) {
-        void **procp = (void **) &disp->SecondaryColor3dvEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sSecondaryColor3dvEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->SecondaryColor3fEXT) {
-        void **procp = (void **) &disp->SecondaryColor3fEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sSecondaryColor3f", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->SecondaryColor3fEXT) {
-        void **procp = (void **) &disp->SecondaryColor3fEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sSecondaryColor3fEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->SecondaryColor3fvEXT) {
-        void **procp = (void **) &disp->SecondaryColor3fvEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sSecondaryColor3fv",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->SecondaryColor3fvEXT) {
-        void **procp = (void **) &disp->SecondaryColor3fvEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sSecondaryColor3fvEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->SecondaryColor3iEXT) {
-        void **procp = (void **) &disp->SecondaryColor3iEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sSecondaryColor3i", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->SecondaryColor3iEXT) {
-        void **procp = (void **) &disp->SecondaryColor3iEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sSecondaryColor3iEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->SecondaryColor3ivEXT) {
-        void **procp = (void **) &disp->SecondaryColor3ivEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sSecondaryColor3iv",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->SecondaryColor3ivEXT) {
-        void **procp = (void **) &disp->SecondaryColor3ivEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sSecondaryColor3ivEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->SecondaryColor3sEXT) {
-        void **procp = (void **) &disp->SecondaryColor3sEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sSecondaryColor3s", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->SecondaryColor3sEXT) {
-        void **procp = (void **) &disp->SecondaryColor3sEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sSecondaryColor3sEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->SecondaryColor3svEXT) {
-        void **procp = (void **) &disp->SecondaryColor3svEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sSecondaryColor3sv",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->SecondaryColor3svEXT) {
-        void **procp = (void **) &disp->SecondaryColor3svEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sSecondaryColor3svEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->SecondaryColor3ubEXT) {
-        void **procp = (void **) &disp->SecondaryColor3ubEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sSecondaryColor3ub",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->SecondaryColor3ubEXT) {
-        void **procp = (void **) &disp->SecondaryColor3ubEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sSecondaryColor3ubEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->SecondaryColor3ubvEXT) {
-        void **procp = (void **) &disp->SecondaryColor3ubvEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sSecondaryColor3ubv",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->SecondaryColor3ubvEXT) {
-        void **procp = (void **) &disp->SecondaryColor3ubvEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sSecondaryColor3ubvEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->SecondaryColor3uiEXT) {
-        void **procp = (void **) &disp->SecondaryColor3uiEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sSecondaryColor3ui",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->SecondaryColor3uiEXT) {
-        void **procp = (void **) &disp->SecondaryColor3uiEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sSecondaryColor3uiEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->SecondaryColor3uivEXT) {
-        void **procp = (void **) &disp->SecondaryColor3uivEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sSecondaryColor3uiv",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->SecondaryColor3uivEXT) {
-        void **procp = (void **) &disp->SecondaryColor3uivEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sSecondaryColor3uivEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->SecondaryColor3usEXT) {
-        void **procp = (void **) &disp->SecondaryColor3usEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sSecondaryColor3us",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->SecondaryColor3usEXT) {
-        void **procp = (void **) &disp->SecondaryColor3usEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sSecondaryColor3usEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->SecondaryColor3usvEXT) {
-        void **procp = (void **) &disp->SecondaryColor3usvEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sSecondaryColor3usv",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->SecondaryColor3usvEXT) {
-        void **procp = (void **) &disp->SecondaryColor3usvEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sSecondaryColor3usvEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->SecondaryColorPointerEXT) {
-        void **procp = (void **) &disp->SecondaryColorPointerEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sSecondaryColorPointer",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->SecondaryColorPointerEXT) {
-        void **procp = (void **) &disp->SecondaryColorPointerEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sSecondaryColorPointerEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultiDrawArraysEXT) {
-        void **procp = (void **) &disp->MultiDrawArraysEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sMultiDrawArrays", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultiDrawArraysEXT) {
-        void **procp = (void **) &disp->MultiDrawArraysEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sMultiDrawArraysEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultiDrawElementsEXT) {
-        void **procp = (void **) &disp->MultiDrawElementsEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sMultiDrawElements",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultiDrawElementsEXT) {
-        void **procp = (void **) &disp->MultiDrawElementsEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sMultiDrawElementsEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->FogCoordPointerEXT) {
-        void **procp = (void **) &disp->FogCoordPointerEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sFogCoordPointer", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->FogCoordPointerEXT) {
-        void **procp = (void **) &disp->FogCoordPointerEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sFogCoordPointerEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->FogCoorddEXT) {
-        void **procp = (void **) &disp->FogCoorddEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sFogCoordd", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->FogCoorddEXT) {
-        void **procp = (void **) &disp->FogCoorddEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sFogCoorddEXT", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->FogCoorddvEXT) {
-        void **procp = (void **) &disp->FogCoorddvEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sFogCoorddv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->FogCoorddvEXT) {
-        void **procp = (void **) &disp->FogCoorddvEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sFogCoorddvEXT", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->FogCoordfEXT) {
-        void **procp = (void **) &disp->FogCoordfEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sFogCoordf", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->FogCoordfEXT) {
-        void **procp = (void **) &disp->FogCoordfEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sFogCoordfEXT", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->FogCoordfvEXT) {
-        void **procp = (void **) &disp->FogCoordfvEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sFogCoordfv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->FogCoordfvEXT) {
-        void **procp = (void **) &disp->FogCoordfvEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sFogCoordfvEXT", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->PixelTexGenSGIX) {
-        void **procp = (void **) &disp->PixelTexGenSGIX;
-
-        snprintf(symboln, sizeof(symboln), "%sPixelTexGenSGIX", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->BlendFuncSeparateEXT) {
-        void **procp = (void **) &disp->BlendFuncSeparateEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sBlendFuncSeparate",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->BlendFuncSeparateEXT) {
-        void **procp = (void **) &disp->BlendFuncSeparateEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sBlendFuncSeparateEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->BlendFuncSeparateEXT) {
-        void **procp = (void **) &disp->BlendFuncSeparateEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sBlendFuncSeparateINGR",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->FlushVertexArrayRangeNV) {
-        void **procp = (void **) &disp->FlushVertexArrayRangeNV;
-
-        snprintf(symboln, sizeof(symboln), "%sFlushVertexArrayRangeNV",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexArrayRangeNV) {
-        void **procp = (void **) &disp->VertexArrayRangeNV;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexArrayRangeNV",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->CombinerInputNV) {
-        void **procp = (void **) &disp->CombinerInputNV;
-
-        snprintf(symboln, sizeof(symboln), "%sCombinerInputNV", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->CombinerOutputNV) {
-        void **procp = (void **) &disp->CombinerOutputNV;
-
-        snprintf(symboln, sizeof(symboln), "%sCombinerOutputNV", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->CombinerParameterfNV) {
-        void **procp = (void **) &disp->CombinerParameterfNV;
-
-        snprintf(symboln, sizeof(symboln), "%sCombinerParameterfNV",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->CombinerParameterfvNV) {
-        void **procp = (void **) &disp->CombinerParameterfvNV;
-
-        snprintf(symboln, sizeof(symboln), "%sCombinerParameterfvNV",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->CombinerParameteriNV) {
-        void **procp = (void **) &disp->CombinerParameteriNV;
-
-        snprintf(symboln, sizeof(symboln), "%sCombinerParameteriNV",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->CombinerParameterivNV) {
-        void **procp = (void **) &disp->CombinerParameterivNV;
-
-        snprintf(symboln, sizeof(symboln), "%sCombinerParameterivNV",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->FinalCombinerInputNV) {
-        void **procp = (void **) &disp->FinalCombinerInputNV;
-
-        snprintf(symboln, sizeof(symboln), "%sFinalCombinerInputNV",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetCombinerInputParameterfvNV) {
-        void **procp = (void **) &disp->GetCombinerInputParameterfvNV;
-
-        snprintf(symboln, sizeof(symboln), "%sGetCombinerInputParameterfvNV",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetCombinerInputParameterivNV) {
-        void **procp = (void **) &disp->GetCombinerInputParameterivNV;
-
-        snprintf(symboln, sizeof(symboln), "%sGetCombinerInputParameterivNV",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetCombinerOutputParameterfvNV) {
-        void **procp = (void **) &disp->GetCombinerOutputParameterfvNV;
-
-        snprintf(symboln, sizeof(symboln), "%sGetCombinerOutputParameterfvNV",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetCombinerOutputParameterivNV) {
-        void **procp = (void **) &disp->GetCombinerOutputParameterivNV;
-
-        snprintf(symboln, sizeof(symboln), "%sGetCombinerOutputParameterivNV",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetFinalCombinerInputParameterfvNV) {
-        void **procp = (void **) &disp->GetFinalCombinerInputParameterfvNV;
-
-        snprintf(symboln, sizeof(symboln),
-                 "%sGetFinalCombinerInputParameterfvNV", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetFinalCombinerInputParameterivNV) {
-        void **procp = (void **) &disp->GetFinalCombinerInputParameterivNV;
-
-        snprintf(symboln, sizeof(symboln),
-                 "%sGetFinalCombinerInputParameterivNV", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ResizeBuffersMESA) {
-        void **procp = (void **) &disp->ResizeBuffersMESA;
-
-        snprintf(symboln, sizeof(symboln), "%sResizeBuffersMESA",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->WindowPos2dMESA) {
-        void **procp = (void **) &disp->WindowPos2dMESA;
-
-        snprintf(symboln, sizeof(symboln), "%sWindowPos2d", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->WindowPos2dMESA) {
-        void **procp = (void **) &disp->WindowPos2dMESA;
-
-        snprintf(symboln, sizeof(symboln), "%sWindowPos2dARB", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->WindowPos2dMESA) {
-        void **procp = (void **) &disp->WindowPos2dMESA;
-
-        snprintf(symboln, sizeof(symboln), "%sWindowPos2dMESA", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->WindowPos2dvMESA) {
-        void **procp = (void **) &disp->WindowPos2dvMESA;
-
-        snprintf(symboln, sizeof(symboln), "%sWindowPos2dv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->WindowPos2dvMESA) {
-        void **procp = (void **) &disp->WindowPos2dvMESA;
-
-        snprintf(symboln, sizeof(symboln), "%sWindowPos2dvARB", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->WindowPos2dvMESA) {
-        void **procp = (void **) &disp->WindowPos2dvMESA;
-
-        snprintf(symboln, sizeof(symboln), "%sWindowPos2dvMESA", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->WindowPos2fMESA) {
-        void **procp = (void **) &disp->WindowPos2fMESA;
-
-        snprintf(symboln, sizeof(symboln), "%sWindowPos2f", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->WindowPos2fMESA) {
-        void **procp = (void **) &disp->WindowPos2fMESA;
-
-        snprintf(symboln, sizeof(symboln), "%sWindowPos2fARB", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->WindowPos2fMESA) {
-        void **procp = (void **) &disp->WindowPos2fMESA;
-
-        snprintf(symboln, sizeof(symboln), "%sWindowPos2fMESA", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->WindowPos2fvMESA) {
-        void **procp = (void **) &disp->WindowPos2fvMESA;
-
-        snprintf(symboln, sizeof(symboln), "%sWindowPos2fv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->WindowPos2fvMESA) {
-        void **procp = (void **) &disp->WindowPos2fvMESA;
-
-        snprintf(symboln, sizeof(symboln), "%sWindowPos2fvARB", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->WindowPos2fvMESA) {
-        void **procp = (void **) &disp->WindowPos2fvMESA;
-
-        snprintf(symboln, sizeof(symboln), "%sWindowPos2fvMESA", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->WindowPos2iMESA) {
-        void **procp = (void **) &disp->WindowPos2iMESA;
-
-        snprintf(symboln, sizeof(symboln), "%sWindowPos2i", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->WindowPos2iMESA) {
-        void **procp = (void **) &disp->WindowPos2iMESA;
-
-        snprintf(symboln, sizeof(symboln), "%sWindowPos2iARB", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->WindowPos2iMESA) {
-        void **procp = (void **) &disp->WindowPos2iMESA;
-
-        snprintf(symboln, sizeof(symboln), "%sWindowPos2iMESA", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->WindowPos2ivMESA) {
-        void **procp = (void **) &disp->WindowPos2ivMESA;
-
-        snprintf(symboln, sizeof(symboln), "%sWindowPos2iv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->WindowPos2ivMESA) {
-        void **procp = (void **) &disp->WindowPos2ivMESA;
-
-        snprintf(symboln, sizeof(symboln), "%sWindowPos2ivARB", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->WindowPos2ivMESA) {
-        void **procp = (void **) &disp->WindowPos2ivMESA;
-
-        snprintf(symboln, sizeof(symboln), "%sWindowPos2ivMESA", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->WindowPos2sMESA) {
-        void **procp = (void **) &disp->WindowPos2sMESA;
-
-        snprintf(symboln, sizeof(symboln), "%sWindowPos2s", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->WindowPos2sMESA) {
-        void **procp = (void **) &disp->WindowPos2sMESA;
-
-        snprintf(symboln, sizeof(symboln), "%sWindowPos2sARB", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->WindowPos2sMESA) {
-        void **procp = (void **) &disp->WindowPos2sMESA;
-
-        snprintf(symboln, sizeof(symboln), "%sWindowPos2sMESA", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->WindowPos2svMESA) {
-        void **procp = (void **) &disp->WindowPos2svMESA;
-
-        snprintf(symboln, sizeof(symboln), "%sWindowPos2sv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->WindowPos2svMESA) {
-        void **procp = (void **) &disp->WindowPos2svMESA;
-
-        snprintf(symboln, sizeof(symboln), "%sWindowPos2svARB", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->WindowPos2svMESA) {
-        void **procp = (void **) &disp->WindowPos2svMESA;
-
-        snprintf(symboln, sizeof(symboln), "%sWindowPos2svMESA", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->WindowPos3dMESA) {
-        void **procp = (void **) &disp->WindowPos3dMESA;
-
-        snprintf(symboln, sizeof(symboln), "%sWindowPos3d", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->WindowPos3dMESA) {
-        void **procp = (void **) &disp->WindowPos3dMESA;
-
-        snprintf(symboln, sizeof(symboln), "%sWindowPos3dARB", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->WindowPos3dMESA) {
-        void **procp = (void **) &disp->WindowPos3dMESA;
-
-        snprintf(symboln, sizeof(symboln), "%sWindowPos3dMESA", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->WindowPos3dvMESA) {
-        void **procp = (void **) &disp->WindowPos3dvMESA;
-
-        snprintf(symboln, sizeof(symboln), "%sWindowPos3dv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->WindowPos3dvMESA) {
-        void **procp = (void **) &disp->WindowPos3dvMESA;
-
-        snprintf(symboln, sizeof(symboln), "%sWindowPos3dvARB", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->WindowPos3dvMESA) {
-        void **procp = (void **) &disp->WindowPos3dvMESA;
-
-        snprintf(symboln, sizeof(symboln), "%sWindowPos3dvMESA", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->WindowPos3fMESA) {
-        void **procp = (void **) &disp->WindowPos3fMESA;
-
-        snprintf(symboln, sizeof(symboln), "%sWindowPos3f", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->WindowPos3fMESA) {
-        void **procp = (void **) &disp->WindowPos3fMESA;
-
-        snprintf(symboln, sizeof(symboln), "%sWindowPos3fARB", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->WindowPos3fMESA) {
-        void **procp = (void **) &disp->WindowPos3fMESA;
-
-        snprintf(symboln, sizeof(symboln), "%sWindowPos3fMESA", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->WindowPos3fvMESA) {
-        void **procp = (void **) &disp->WindowPos3fvMESA;
-
-        snprintf(symboln, sizeof(symboln), "%sWindowPos3fv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->WindowPos3fvMESA) {
-        void **procp = (void **) &disp->WindowPos3fvMESA;
-
-        snprintf(symboln, sizeof(symboln), "%sWindowPos3fvARB", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->WindowPos3fvMESA) {
-        void **procp = (void **) &disp->WindowPos3fvMESA;
-
-        snprintf(symboln, sizeof(symboln), "%sWindowPos3fvMESA", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->WindowPos3iMESA) {
-        void **procp = (void **) &disp->WindowPos3iMESA;
-
-        snprintf(symboln, sizeof(symboln), "%sWindowPos3i", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->WindowPos3iMESA) {
-        void **procp = (void **) &disp->WindowPos3iMESA;
-
-        snprintf(symboln, sizeof(symboln), "%sWindowPos3iARB", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->WindowPos3iMESA) {
-        void **procp = (void **) &disp->WindowPos3iMESA;
-
-        snprintf(symboln, sizeof(symboln), "%sWindowPos3iMESA", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->WindowPos3ivMESA) {
-        void **procp = (void **) &disp->WindowPos3ivMESA;
-
-        snprintf(symboln, sizeof(symboln), "%sWindowPos3iv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->WindowPos3ivMESA) {
-        void **procp = (void **) &disp->WindowPos3ivMESA;
-
-        snprintf(symboln, sizeof(symboln), "%sWindowPos3ivARB", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->WindowPos3ivMESA) {
-        void **procp = (void **) &disp->WindowPos3ivMESA;
-
-        snprintf(symboln, sizeof(symboln), "%sWindowPos3ivMESA", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->WindowPos3sMESA) {
-        void **procp = (void **) &disp->WindowPos3sMESA;
-
-        snprintf(symboln, sizeof(symboln), "%sWindowPos3s", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->WindowPos3sMESA) {
-        void **procp = (void **) &disp->WindowPos3sMESA;
-
-        snprintf(symboln, sizeof(symboln), "%sWindowPos3sARB", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->WindowPos3sMESA) {
-        void **procp = (void **) &disp->WindowPos3sMESA;
-
-        snprintf(symboln, sizeof(symboln), "%sWindowPos3sMESA", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->WindowPos3svMESA) {
-        void **procp = (void **) &disp->WindowPos3svMESA;
-
-        snprintf(symboln, sizeof(symboln), "%sWindowPos3sv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->WindowPos3svMESA) {
-        void **procp = (void **) &disp->WindowPos3svMESA;
-
-        snprintf(symboln, sizeof(symboln), "%sWindowPos3svARB", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->WindowPos3svMESA) {
-        void **procp = (void **) &disp->WindowPos3svMESA;
-
-        snprintf(symboln, sizeof(symboln), "%sWindowPos3svMESA", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->WindowPos4dMESA) {
-        void **procp = (void **) &disp->WindowPos4dMESA;
-
-        snprintf(symboln, sizeof(symboln), "%sWindowPos4dMESA", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->WindowPos4dvMESA) {
-        void **procp = (void **) &disp->WindowPos4dvMESA;
-
-        snprintf(symboln, sizeof(symboln), "%sWindowPos4dvMESA", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->WindowPos4fMESA) {
-        void **procp = (void **) &disp->WindowPos4fMESA;
-
-        snprintf(symboln, sizeof(symboln), "%sWindowPos4fMESA", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->WindowPos4fvMESA) {
-        void **procp = (void **) &disp->WindowPos4fvMESA;
-
-        snprintf(symboln, sizeof(symboln), "%sWindowPos4fvMESA", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->WindowPos4iMESA) {
-        void **procp = (void **) &disp->WindowPos4iMESA;
-
-        snprintf(symboln, sizeof(symboln), "%sWindowPos4iMESA", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->WindowPos4ivMESA) {
-        void **procp = (void **) &disp->WindowPos4ivMESA;
-
-        snprintf(symboln, sizeof(symboln), "%sWindowPos4ivMESA", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->WindowPos4sMESA) {
-        void **procp = (void **) &disp->WindowPos4sMESA;
-
-        snprintf(symboln, sizeof(symboln), "%sWindowPos4sMESA", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->WindowPos4svMESA) {
-        void **procp = (void **) &disp->WindowPos4svMESA;
-
-        snprintf(symboln, sizeof(symboln), "%sWindowPos4svMESA", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultiModeDrawArraysIBM) {
-        void **procp = (void **) &disp->MultiModeDrawArraysIBM;
-
-        snprintf(symboln, sizeof(symboln), "%sMultiModeDrawArraysIBM",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->MultiModeDrawElementsIBM) {
-        void **procp = (void **) &disp->MultiModeDrawElementsIBM;
-
-        snprintf(symboln, sizeof(symboln), "%sMultiModeDrawElementsIBM",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->DeleteFencesNV) {
-        void **procp = (void **) &disp->DeleteFencesNV;
-
-        snprintf(symboln, sizeof(symboln), "%sDeleteFencesNV", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->FinishFenceNV) {
-        void **procp = (void **) &disp->FinishFenceNV;
-
-        snprintf(symboln, sizeof(symboln), "%sFinishFenceNV", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GenFencesNV) {
-        void **procp = (void **) &disp->GenFencesNV;
-
-        snprintf(symboln, sizeof(symboln), "%sGenFencesNV", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetFenceivNV) {
-        void **procp = (void **) &disp->GetFenceivNV;
-
-        snprintf(symboln, sizeof(symboln), "%sGetFenceivNV", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->IsFenceNV) {
-        void **procp = (void **) &disp->IsFenceNV;
-
-        snprintf(symboln, sizeof(symboln), "%sIsFenceNV", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->SetFenceNV) {
-        void **procp = (void **) &disp->SetFenceNV;
-
-        snprintf(symboln, sizeof(symboln), "%sSetFenceNV", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TestFenceNV) {
-        void **procp = (void **) &disp->TestFenceNV;
-
-        snprintf(symboln, sizeof(symboln), "%sTestFenceNV", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->AreProgramsResidentNV) {
-        void **procp = (void **) &disp->AreProgramsResidentNV;
-
-        snprintf(symboln, sizeof(symboln), "%sAreProgramsResidentNV",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->BindProgramNV) {
-        void **procp = (void **) &disp->BindProgramNV;
-
-        snprintf(symboln, sizeof(symboln), "%sBindProgramARB", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->BindProgramNV) {
-        void **procp = (void **) &disp->BindProgramNV;
-
-        snprintf(symboln, sizeof(symboln), "%sBindProgramNV", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->DeleteProgramsNV) {
-        void **procp = (void **) &disp->DeleteProgramsNV;
-
-        snprintf(symboln, sizeof(symboln), "%sDeleteProgramsARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->DeleteProgramsNV) {
-        void **procp = (void **) &disp->DeleteProgramsNV;
-
-        snprintf(symboln, sizeof(symboln), "%sDeleteProgramsNV", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ExecuteProgramNV) {
-        void **procp = (void **) &disp->ExecuteProgramNV;
-
-        snprintf(symboln, sizeof(symboln), "%sExecuteProgramNV", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GenProgramsNV) {
-        void **procp = (void **) &disp->GenProgramsNV;
-
-        snprintf(symboln, sizeof(symboln), "%sGenProgramsARB", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GenProgramsNV) {
-        void **procp = (void **) &disp->GenProgramsNV;
-
-        snprintf(symboln, sizeof(symboln), "%sGenProgramsNV", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetProgramParameterdvNV) {
-        void **procp = (void **) &disp->GetProgramParameterdvNV;
-
-        snprintf(symboln, sizeof(symboln), "%sGetProgramParameterdvNV",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetProgramParameterfvNV) {
-        void **procp = (void **) &disp->GetProgramParameterfvNV;
-
-        snprintf(symboln, sizeof(symboln), "%sGetProgramParameterfvNV",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetProgramStringNV) {
-        void **procp = (void **) &disp->GetProgramStringNV;
-
-        snprintf(symboln, sizeof(symboln), "%sGetProgramStringNV",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetProgramivNV) {
-        void **procp = (void **) &disp->GetProgramivNV;
-
-        snprintf(symboln, sizeof(symboln), "%sGetProgramivNV", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetTrackMatrixivNV) {
-        void **procp = (void **) &disp->GetTrackMatrixivNV;
-
-        snprintf(symboln, sizeof(symboln), "%sGetTrackMatrixivNV",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetVertexAttribPointervNV) {
-        void **procp = (void **) &disp->GetVertexAttribPointervNV;
-
-        snprintf(symboln, sizeof(symboln), "%sGetVertexAttribPointerv",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetVertexAttribPointervNV) {
-        void **procp = (void **) &disp->GetVertexAttribPointervNV;
-
-        snprintf(symboln, sizeof(symboln), "%sGetVertexAttribPointervARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetVertexAttribPointervNV) {
-        void **procp = (void **) &disp->GetVertexAttribPointervNV;
-
-        snprintf(symboln, sizeof(symboln), "%sGetVertexAttribPointervNV",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetVertexAttribdvNV) {
-        void **procp = (void **) &disp->GetVertexAttribdvNV;
-
-        snprintf(symboln, sizeof(symboln), "%sGetVertexAttribdvNV",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetVertexAttribfvNV) {
-        void **procp = (void **) &disp->GetVertexAttribfvNV;
-
-        snprintf(symboln, sizeof(symboln), "%sGetVertexAttribfvNV",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetVertexAttribivNV) {
-        void **procp = (void **) &disp->GetVertexAttribivNV;
-
-        snprintf(symboln, sizeof(symboln), "%sGetVertexAttribivNV",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->IsProgramNV) {
-        void **procp = (void **) &disp->IsProgramNV;
-
-        snprintf(symboln, sizeof(symboln), "%sIsProgramARB", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->IsProgramNV) {
-        void **procp = (void **) &disp->IsProgramNV;
-
-        snprintf(symboln, sizeof(symboln), "%sIsProgramNV", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->LoadProgramNV) {
-        void **procp = (void **) &disp->LoadProgramNV;
-
-        snprintf(symboln, sizeof(symboln), "%sLoadProgramNV", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ProgramParameters4dvNV) {
-        void **procp = (void **) &disp->ProgramParameters4dvNV;
-
-        snprintf(symboln, sizeof(symboln), "%sProgramParameters4dvNV",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ProgramParameters4fvNV) {
-        void **procp = (void **) &disp->ProgramParameters4fvNV;
-
-        snprintf(symboln, sizeof(symboln), "%sProgramParameters4fvNV",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->RequestResidentProgramsNV) {
-        void **procp = (void **) &disp->RequestResidentProgramsNV;
-
-        snprintf(symboln, sizeof(symboln), "%sRequestResidentProgramsNV",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TrackMatrixNV) {
-        void **procp = (void **) &disp->TrackMatrixNV;
-
-        snprintf(symboln, sizeof(symboln), "%sTrackMatrixNV", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib1dNV) {
-        void **procp = (void **) &disp->VertexAttrib1dNV;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib1dNV", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib1dvNV) {
-        void **procp = (void **) &disp->VertexAttrib1dvNV;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib1dvNV",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib1fNV) {
-        void **procp = (void **) &disp->VertexAttrib1fNV;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib1fNV", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib1fvNV) {
-        void **procp = (void **) &disp->VertexAttrib1fvNV;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib1fvNV",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib1sNV) {
-        void **procp = (void **) &disp->VertexAttrib1sNV;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib1sNV", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib1svNV) {
-        void **procp = (void **) &disp->VertexAttrib1svNV;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib1svNV",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib2dNV) {
-        void **procp = (void **) &disp->VertexAttrib2dNV;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib2dNV", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib2dvNV) {
-        void **procp = (void **) &disp->VertexAttrib2dvNV;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib2dvNV",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib2fNV) {
-        void **procp = (void **) &disp->VertexAttrib2fNV;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib2fNV", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib2fvNV) {
-        void **procp = (void **) &disp->VertexAttrib2fvNV;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib2fvNV",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib2sNV) {
-        void **procp = (void **) &disp->VertexAttrib2sNV;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib2sNV", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib2svNV) {
-        void **procp = (void **) &disp->VertexAttrib2svNV;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib2svNV",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib3dNV) {
-        void **procp = (void **) &disp->VertexAttrib3dNV;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib3dNV", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib3dvNV) {
-        void **procp = (void **) &disp->VertexAttrib3dvNV;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib3dvNV",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib3fNV) {
-        void **procp = (void **) &disp->VertexAttrib3fNV;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib3fNV", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib3fvNV) {
-        void **procp = (void **) &disp->VertexAttrib3fvNV;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib3fvNV",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib3sNV) {
-        void **procp = (void **) &disp->VertexAttrib3sNV;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib3sNV", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib3svNV) {
-        void **procp = (void **) &disp->VertexAttrib3svNV;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib3svNV",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib4dNV) {
-        void **procp = (void **) &disp->VertexAttrib4dNV;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib4dNV", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib4dvNV) {
-        void **procp = (void **) &disp->VertexAttrib4dvNV;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib4dvNV",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib4fNV) {
-        void **procp = (void **) &disp->VertexAttrib4fNV;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib4fNV", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib4fvNV) {
-        void **procp = (void **) &disp->VertexAttrib4fvNV;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib4fvNV",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib4sNV) {
-        void **procp = (void **) &disp->VertexAttrib4sNV;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib4sNV", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib4svNV) {
-        void **procp = (void **) &disp->VertexAttrib4svNV;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib4svNV",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib4ubNV) {
-        void **procp = (void **) &disp->VertexAttrib4ubNV;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib4ubNV",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttrib4ubvNV) {
-        void **procp = (void **) &disp->VertexAttrib4ubvNV;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttrib4ubvNV",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttribPointerNV) {
-        void **procp = (void **) &disp->VertexAttribPointerNV;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttribPointerNV",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttribs1dvNV) {
-        void **procp = (void **) &disp->VertexAttribs1dvNV;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttribs1dvNV",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttribs1fvNV) {
-        void **procp = (void **) &disp->VertexAttribs1fvNV;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttribs1fvNV",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttribs1svNV) {
-        void **procp = (void **) &disp->VertexAttribs1svNV;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttribs1svNV",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttribs2dvNV) {
-        void **procp = (void **) &disp->VertexAttribs2dvNV;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttribs2dvNV",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttribs2fvNV) {
-        void **procp = (void **) &disp->VertexAttribs2fvNV;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttribs2fvNV",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttribs2svNV) {
-        void **procp = (void **) &disp->VertexAttribs2svNV;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttribs2svNV",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttribs3dvNV) {
-        void **procp = (void **) &disp->VertexAttribs3dvNV;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttribs3dvNV",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttribs3fvNV) {
-        void **procp = (void **) &disp->VertexAttribs3fvNV;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttribs3fvNV",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttribs3svNV) {
-        void **procp = (void **) &disp->VertexAttribs3svNV;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttribs3svNV",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttribs4dvNV) {
-        void **procp = (void **) &disp->VertexAttribs4dvNV;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttribs4dvNV",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttribs4fvNV) {
-        void **procp = (void **) &disp->VertexAttribs4fvNV;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttribs4fvNV",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttribs4svNV) {
-        void **procp = (void **) &disp->VertexAttribs4svNV;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttribs4svNV",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttribs4ubvNV) {
-        void **procp = (void **) &disp->VertexAttribs4ubvNV;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttribs4ubvNV",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetTexBumpParameterfvATI) {
-        void **procp = (void **) &disp->GetTexBumpParameterfvATI;
-
-        snprintf(symboln, sizeof(symboln), "%sGetTexBumpParameterfvATI",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetTexBumpParameterivATI) {
-        void **procp = (void **) &disp->GetTexBumpParameterivATI;
-
-        snprintf(symboln, sizeof(symboln), "%sGetTexBumpParameterivATI",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TexBumpParameterfvATI) {
-        void **procp = (void **) &disp->TexBumpParameterfvATI;
-
-        snprintf(symboln, sizeof(symboln), "%sTexBumpParameterfvATI",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TexBumpParameterivATI) {
-        void **procp = (void **) &disp->TexBumpParameterivATI;
-
-        snprintf(symboln, sizeof(symboln), "%sTexBumpParameterivATI",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->AlphaFragmentOp1ATI) {
-        void **procp = (void **) &disp->AlphaFragmentOp1ATI;
-
-        snprintf(symboln, sizeof(symboln), "%sAlphaFragmentOp1ATI",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->AlphaFragmentOp2ATI) {
-        void **procp = (void **) &disp->AlphaFragmentOp2ATI;
-
-        snprintf(symboln, sizeof(symboln), "%sAlphaFragmentOp2ATI",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->AlphaFragmentOp3ATI) {
-        void **procp = (void **) &disp->AlphaFragmentOp3ATI;
-
-        snprintf(symboln, sizeof(symboln), "%sAlphaFragmentOp3ATI",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->BeginFragmentShaderATI) {
-        void **procp = (void **) &disp->BeginFragmentShaderATI;
-
-        snprintf(symboln, sizeof(symboln), "%sBeginFragmentShaderATI",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->BindFragmentShaderATI) {
-        void **procp = (void **) &disp->BindFragmentShaderATI;
-
-        snprintf(symboln, sizeof(symboln), "%sBindFragmentShaderATI",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ColorFragmentOp1ATI) {
-        void **procp = (void **) &disp->ColorFragmentOp1ATI;
-
-        snprintf(symboln, sizeof(symboln), "%sColorFragmentOp1ATI",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ColorFragmentOp2ATI) {
-        void **procp = (void **) &disp->ColorFragmentOp2ATI;
-
-        snprintf(symboln, sizeof(symboln), "%sColorFragmentOp2ATI",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ColorFragmentOp3ATI) {
-        void **procp = (void **) &disp->ColorFragmentOp3ATI;
-
-        snprintf(symboln, sizeof(symboln), "%sColorFragmentOp3ATI",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->DeleteFragmentShaderATI) {
-        void **procp = (void **) &disp->DeleteFragmentShaderATI;
-
-        snprintf(symboln, sizeof(symboln), "%sDeleteFragmentShaderATI",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->EndFragmentShaderATI) {
-        void **procp = (void **) &disp->EndFragmentShaderATI;
-
-        snprintf(symboln, sizeof(symboln), "%sEndFragmentShaderATI",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GenFragmentShadersATI) {
-        void **procp = (void **) &disp->GenFragmentShadersATI;
-
-        snprintf(symboln, sizeof(symboln), "%sGenFragmentShadersATI",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->PassTexCoordATI) {
-        void **procp = (void **) &disp->PassTexCoordATI;
-
-        snprintf(symboln, sizeof(symboln), "%sPassTexCoordATI", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->SampleMapATI) {
-        void **procp = (void **) &disp->SampleMapATI;
-
-        snprintf(symboln, sizeof(symboln), "%sSampleMapATI", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->SetFragmentShaderConstantATI) {
-        void **procp = (void **) &disp->SetFragmentShaderConstantATI;
-
-        snprintf(symboln, sizeof(symboln), "%sSetFragmentShaderConstantATI",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->PointParameteriNV) {
-        void **procp = (void **) &disp->PointParameteriNV;
-
-        snprintf(symboln, sizeof(symboln), "%sPointParameteri", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->PointParameteriNV) {
-        void **procp = (void **) &disp->PointParameteriNV;
-
-        snprintf(symboln, sizeof(symboln), "%sPointParameteriNV",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->PointParameterivNV) {
-        void **procp = (void **) &disp->PointParameterivNV;
-
-        snprintf(symboln, sizeof(symboln), "%sPointParameteriv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->PointParameterivNV) {
-        void **procp = (void **) &disp->PointParameterivNV;
-
-        snprintf(symboln, sizeof(symboln), "%sPointParameterivNV",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ActiveStencilFaceEXT) {
-        void **procp = (void **) &disp->ActiveStencilFaceEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sActiveStencilFaceEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->BindVertexArrayAPPLE) {
-        void **procp = (void **) &disp->BindVertexArrayAPPLE;
-
-        snprintf(symboln, sizeof(symboln), "%sBindVertexArrayAPPLE",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->DeleteVertexArraysAPPLE) {
-        void **procp = (void **) &disp->DeleteVertexArraysAPPLE;
-
-        snprintf(symboln, sizeof(symboln), "%sDeleteVertexArrays",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->DeleteVertexArraysAPPLE) {
-        void **procp = (void **) &disp->DeleteVertexArraysAPPLE;
-
-        snprintf(symboln, sizeof(symboln), "%sDeleteVertexArraysAPPLE",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GenVertexArraysAPPLE) {
-        void **procp = (void **) &disp->GenVertexArraysAPPLE;
-
-        snprintf(symboln, sizeof(symboln), "%sGenVertexArraysAPPLE",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->IsVertexArrayAPPLE) {
-        void **procp = (void **) &disp->IsVertexArrayAPPLE;
-
-        snprintf(symboln, sizeof(symboln), "%sIsVertexArray", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->IsVertexArrayAPPLE) {
-        void **procp = (void **) &disp->IsVertexArrayAPPLE;
-
-        snprintf(symboln, sizeof(symboln), "%sIsVertexArrayAPPLE",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetProgramNamedParameterdvNV) {
-        void **procp = (void **) &disp->GetProgramNamedParameterdvNV;
-
-        snprintf(symboln, sizeof(symboln), "%sGetProgramNamedParameterdvNV",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetProgramNamedParameterfvNV) {
-        void **procp = (void **) &disp->GetProgramNamedParameterfvNV;
-
-        snprintf(symboln, sizeof(symboln), "%sGetProgramNamedParameterfvNV",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ProgramNamedParameter4dNV) {
-        void **procp = (void **) &disp->ProgramNamedParameter4dNV;
-
-        snprintf(symboln, sizeof(symboln), "%sProgramNamedParameter4dNV",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ProgramNamedParameter4dvNV) {
-        void **procp = (void **) &disp->ProgramNamedParameter4dvNV;
-
-        snprintf(symboln, sizeof(symboln), "%sProgramNamedParameter4dvNV",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ProgramNamedParameter4fNV) {
-        void **procp = (void **) &disp->ProgramNamedParameter4fNV;
-
-        snprintf(symboln, sizeof(symboln), "%sProgramNamedParameter4fNV",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ProgramNamedParameter4fvNV) {
-        void **procp = (void **) &disp->ProgramNamedParameter4fvNV;
-
-        snprintf(symboln, sizeof(symboln), "%sProgramNamedParameter4fvNV",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->PrimitiveRestartIndexNV) {
-        void **procp = (void **) &disp->PrimitiveRestartIndexNV;
-
-        snprintf(symboln, sizeof(symboln), "%sPrimitiveRestartIndexNV",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->PrimitiveRestartIndexNV) {
-        void **procp = (void **) &disp->PrimitiveRestartIndexNV;
-
-        snprintf(symboln, sizeof(symboln), "%sPrimitiveRestartIndex",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->PrimitiveRestartNV) {
-        void **procp = (void **) &disp->PrimitiveRestartNV;
-
-        snprintf(symboln, sizeof(symboln), "%sPrimitiveRestartNV",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->DepthBoundsEXT) {
-        void **procp = (void **) &disp->DepthBoundsEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sDepthBoundsEXT", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->BlendEquationSeparateEXT) {
-        void **procp = (void **) &disp->BlendEquationSeparateEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sBlendEquationSeparate",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->BlendEquationSeparateEXT) {
-        void **procp = (void **) &disp->BlendEquationSeparateEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sBlendEquationSeparateEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->BlendEquationSeparateEXT) {
-        void **procp = (void **) &disp->BlendEquationSeparateEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sBlendEquationSeparateATI",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->BindFramebufferEXT) {
-        void **procp = (void **) &disp->BindFramebufferEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sBindFramebuffer", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->BindFramebufferEXT) {
-        void **procp = (void **) &disp->BindFramebufferEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sBindFramebufferEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->BindRenderbufferEXT) {
-        void **procp = (void **) &disp->BindRenderbufferEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sBindRenderbuffer", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->BindRenderbufferEXT) {
-        void **procp = (void **) &disp->BindRenderbufferEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sBindRenderbufferEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->CheckFramebufferStatusEXT) {
-        void **procp = (void **) &disp->CheckFramebufferStatusEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sCheckFramebufferStatus",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->CheckFramebufferStatusEXT) {
-        void **procp = (void **) &disp->CheckFramebufferStatusEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sCheckFramebufferStatusEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->DeleteFramebuffersEXT) {
-        void **procp = (void **) &disp->DeleteFramebuffersEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sDeleteFramebuffers",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->DeleteFramebuffersEXT) {
-        void **procp = (void **) &disp->DeleteFramebuffersEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sDeleteFramebuffersEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->DeleteRenderbuffersEXT) {
-        void **procp = (void **) &disp->DeleteRenderbuffersEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sDeleteRenderbuffers",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->DeleteRenderbuffersEXT) {
-        void **procp = (void **) &disp->DeleteRenderbuffersEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sDeleteRenderbuffersEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->FramebufferRenderbufferEXT) {
-        void **procp = (void **) &disp->FramebufferRenderbufferEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sFramebufferRenderbuffer",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->FramebufferRenderbufferEXT) {
-        void **procp = (void **) &disp->FramebufferRenderbufferEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sFramebufferRenderbufferEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->FramebufferTexture1DEXT) {
-        void **procp = (void **) &disp->FramebufferTexture1DEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sFramebufferTexture1D",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->FramebufferTexture1DEXT) {
-        void **procp = (void **) &disp->FramebufferTexture1DEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sFramebufferTexture1DEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->FramebufferTexture2DEXT) {
-        void **procp = (void **) &disp->FramebufferTexture2DEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sFramebufferTexture2D",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->FramebufferTexture2DEXT) {
-        void **procp = (void **) &disp->FramebufferTexture2DEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sFramebufferTexture2DEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->FramebufferTexture3DEXT) {
-        void **procp = (void **) &disp->FramebufferTexture3DEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sFramebufferTexture3D",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->FramebufferTexture3DEXT) {
-        void **procp = (void **) &disp->FramebufferTexture3DEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sFramebufferTexture3DEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GenFramebuffersEXT) {
-        void **procp = (void **) &disp->GenFramebuffersEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sGenFramebuffers", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GenFramebuffersEXT) {
-        void **procp = (void **) &disp->GenFramebuffersEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sGenFramebuffersEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GenRenderbuffersEXT) {
-        void **procp = (void **) &disp->GenRenderbuffersEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sGenRenderbuffers", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GenRenderbuffersEXT) {
-        void **procp = (void **) &disp->GenRenderbuffersEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sGenRenderbuffersEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GenerateMipmapEXT) {
-        void **procp = (void **) &disp->GenerateMipmapEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sGenerateMipmap", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GenerateMipmapEXT) {
-        void **procp = (void **) &disp->GenerateMipmapEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sGenerateMipmapEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetFramebufferAttachmentParameterivEXT) {
-        void **procp = (void **) &disp->GetFramebufferAttachmentParameterivEXT;
-
-        snprintf(symboln, sizeof(symboln),
-                 "%sGetFramebufferAttachmentParameteriv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetFramebufferAttachmentParameterivEXT) {
-        void **procp = (void **) &disp->GetFramebufferAttachmentParameterivEXT;
-
-        snprintf(symboln, sizeof(symboln),
-                 "%sGetFramebufferAttachmentParameterivEXT", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetRenderbufferParameterivEXT) {
-        void **procp = (void **) &disp->GetRenderbufferParameterivEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sGetRenderbufferParameteriv",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetRenderbufferParameterivEXT) {
-        void **procp = (void **) &disp->GetRenderbufferParameterivEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sGetRenderbufferParameterivEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->IsFramebufferEXT) {
-        void **procp = (void **) &disp->IsFramebufferEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sIsFramebuffer", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->IsFramebufferEXT) {
-        void **procp = (void **) &disp->IsFramebufferEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sIsFramebufferEXT", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->IsRenderbufferEXT) {
-        void **procp = (void **) &disp->IsRenderbufferEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sIsRenderbuffer", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->IsRenderbufferEXT) {
-        void **procp = (void **) &disp->IsRenderbufferEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sIsRenderbufferEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->RenderbufferStorageEXT) {
-        void **procp = (void **) &disp->RenderbufferStorageEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sRenderbufferStorage",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->RenderbufferStorageEXT) {
-        void **procp = (void **) &disp->RenderbufferStorageEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sRenderbufferStorageEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->BlitFramebufferEXT) {
-        void **procp = (void **) &disp->BlitFramebufferEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sBlitFramebuffer", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->BlitFramebufferEXT) {
-        void **procp = (void **) &disp->BlitFramebufferEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sBlitFramebufferEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->BufferParameteriAPPLE) {
-        void **procp = (void **) &disp->BufferParameteriAPPLE;
-
-        snprintf(symboln, sizeof(symboln), "%sBufferParameteriAPPLE",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->FlushMappedBufferRangeAPPLE) {
-        void **procp = (void **) &disp->FlushMappedBufferRangeAPPLE;
-
-        snprintf(symboln, sizeof(symboln), "%sFlushMappedBufferRangeAPPLE",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->BindFragDataLocationEXT) {
-        void **procp = (void **) &disp->BindFragDataLocationEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sBindFragDataLocationEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->BindFragDataLocationEXT) {
-        void **procp = (void **) &disp->BindFragDataLocationEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sBindFragDataLocation",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetFragDataLocationEXT) {
-        void **procp = (void **) &disp->GetFragDataLocationEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sGetFragDataLocationEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetFragDataLocationEXT) {
-        void **procp = (void **) &disp->GetFragDataLocationEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sGetFragDataLocation",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetUniformuivEXT) {
-        void **procp = (void **) &disp->GetUniformuivEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sGetUniformuivEXT", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetUniformuivEXT) {
-        void **procp = (void **) &disp->GetUniformuivEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sGetUniformuiv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetVertexAttribIivEXT) {
-        void **procp = (void **) &disp->GetVertexAttribIivEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sGetVertexAttribIivEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetVertexAttribIivEXT) {
-        void **procp = (void **) &disp->GetVertexAttribIivEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sGetVertexAttribIiv",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetVertexAttribIuivEXT) {
-        void **procp = (void **) &disp->GetVertexAttribIuivEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sGetVertexAttribIuivEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetVertexAttribIuivEXT) {
-        void **procp = (void **) &disp->GetVertexAttribIuivEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sGetVertexAttribIuiv",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Uniform1uiEXT) {
-        void **procp = (void **) &disp->Uniform1uiEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sUniform1uiEXT", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Uniform1uiEXT) {
-        void **procp = (void **) &disp->Uniform1uiEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sUniform1ui", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Uniform1uivEXT) {
-        void **procp = (void **) &disp->Uniform1uivEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sUniform1uivEXT", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Uniform1uivEXT) {
-        void **procp = (void **) &disp->Uniform1uivEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sUniform1uiv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Uniform2uiEXT) {
-        void **procp = (void **) &disp->Uniform2uiEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sUniform2uiEXT", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Uniform2uiEXT) {
-        void **procp = (void **) &disp->Uniform2uiEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sUniform2ui", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Uniform2uivEXT) {
-        void **procp = (void **) &disp->Uniform2uivEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sUniform2uivEXT", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Uniform2uivEXT) {
-        void **procp = (void **) &disp->Uniform2uivEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sUniform2uiv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Uniform3uiEXT) {
-        void **procp = (void **) &disp->Uniform3uiEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sUniform3uiEXT", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Uniform3uiEXT) {
-        void **procp = (void **) &disp->Uniform3uiEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sUniform3ui", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Uniform3uivEXT) {
-        void **procp = (void **) &disp->Uniform3uivEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sUniform3uivEXT", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Uniform3uivEXT) {
-        void **procp = (void **) &disp->Uniform3uivEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sUniform3uiv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Uniform4uiEXT) {
-        void **procp = (void **) &disp->Uniform4uiEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sUniform4uiEXT", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Uniform4uiEXT) {
-        void **procp = (void **) &disp->Uniform4uiEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sUniform4ui", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Uniform4uivEXT) {
-        void **procp = (void **) &disp->Uniform4uivEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sUniform4uivEXT", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->Uniform4uivEXT) {
-        void **procp = (void **) &disp->Uniform4uivEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sUniform4uiv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttribI1iEXT) {
-        void **procp = (void **) &disp->VertexAttribI1iEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttribI1iEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttribI1iEXT) {
-        void **procp = (void **) &disp->VertexAttribI1iEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttribI1i", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttribI1ivEXT) {
-        void **procp = (void **) &disp->VertexAttribI1ivEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttribI1ivEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttribI1ivEXT) {
-        void **procp = (void **) &disp->VertexAttribI1ivEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttribI1iv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttribI1uiEXT) {
-        void **procp = (void **) &disp->VertexAttribI1uiEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttribI1uiEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttribI1uiEXT) {
-        void **procp = (void **) &disp->VertexAttribI1uiEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttribI1ui", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttribI1uivEXT) {
-        void **procp = (void **) &disp->VertexAttribI1uivEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttribI1uivEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttribI1uivEXT) {
-        void **procp = (void **) &disp->VertexAttribI1uivEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttribI1uiv",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttribI2iEXT) {
-        void **procp = (void **) &disp->VertexAttribI2iEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttribI2iEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttribI2iEXT) {
-        void **procp = (void **) &disp->VertexAttribI2iEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttribI2i", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttribI2ivEXT) {
-        void **procp = (void **) &disp->VertexAttribI2ivEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttribI2ivEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttribI2ivEXT) {
-        void **procp = (void **) &disp->VertexAttribI2ivEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttribI2iv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttribI2uiEXT) {
-        void **procp = (void **) &disp->VertexAttribI2uiEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttribI2uiEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttribI2uiEXT) {
-        void **procp = (void **) &disp->VertexAttribI2uiEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttribI2ui", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttribI2uivEXT) {
-        void **procp = (void **) &disp->VertexAttribI2uivEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttribI2uivEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttribI2uivEXT) {
-        void **procp = (void **) &disp->VertexAttribI2uivEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttribI2uiv",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttribI3iEXT) {
-        void **procp = (void **) &disp->VertexAttribI3iEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttribI3iEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttribI3iEXT) {
-        void **procp = (void **) &disp->VertexAttribI3iEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttribI3i", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttribI3ivEXT) {
-        void **procp = (void **) &disp->VertexAttribI3ivEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttribI3ivEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttribI3ivEXT) {
-        void **procp = (void **) &disp->VertexAttribI3ivEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttribI3iv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttribI3uiEXT) {
-        void **procp = (void **) &disp->VertexAttribI3uiEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttribI3uiEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttribI3uiEXT) {
-        void **procp = (void **) &disp->VertexAttribI3uiEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttribI3ui", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttribI3uivEXT) {
-        void **procp = (void **) &disp->VertexAttribI3uivEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttribI3uivEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttribI3uivEXT) {
-        void **procp = (void **) &disp->VertexAttribI3uivEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttribI3uiv",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttribI4bvEXT) {
-        void **procp = (void **) &disp->VertexAttribI4bvEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttribI4bvEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttribI4bvEXT) {
-        void **procp = (void **) &disp->VertexAttribI4bvEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttribI4bv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttribI4iEXT) {
-        void **procp = (void **) &disp->VertexAttribI4iEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttribI4iEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttribI4iEXT) {
-        void **procp = (void **) &disp->VertexAttribI4iEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttribI4i", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttribI4ivEXT) {
-        void **procp = (void **) &disp->VertexAttribI4ivEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttribI4ivEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttribI4ivEXT) {
-        void **procp = (void **) &disp->VertexAttribI4ivEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttribI4iv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttribI4svEXT) {
-        void **procp = (void **) &disp->VertexAttribI4svEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttribI4svEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttribI4svEXT) {
-        void **procp = (void **) &disp->VertexAttribI4svEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttribI4sv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttribI4ubvEXT) {
-        void **procp = (void **) &disp->VertexAttribI4ubvEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttribI4ubvEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttribI4ubvEXT) {
-        void **procp = (void **) &disp->VertexAttribI4ubvEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttribI4ubv",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttribI4uiEXT) {
-        void **procp = (void **) &disp->VertexAttribI4uiEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttribI4uiEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttribI4uiEXT) {
-        void **procp = (void **) &disp->VertexAttribI4uiEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttribI4ui", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttribI4uivEXT) {
-        void **procp = (void **) &disp->VertexAttribI4uivEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttribI4uivEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttribI4uivEXT) {
-        void **procp = (void **) &disp->VertexAttribI4uivEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttribI4uiv",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttribI4usvEXT) {
-        void **procp = (void **) &disp->VertexAttribI4usvEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttribI4usvEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttribI4usvEXT) {
-        void **procp = (void **) &disp->VertexAttribI4usvEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttribI4usv",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttribIPointerEXT) {
-        void **procp = (void **) &disp->VertexAttribIPointerEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttribIPointerEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->VertexAttribIPointerEXT) {
-        void **procp = (void **) &disp->VertexAttribIPointerEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sVertexAttribIPointer",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->FramebufferTextureLayerEXT) {
-        void **procp = (void **) &disp->FramebufferTextureLayerEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sFramebufferTextureLayer",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->FramebufferTextureLayerEXT) {
-        void **procp = (void **) &disp->FramebufferTextureLayerEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sFramebufferTextureLayerARB",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->FramebufferTextureLayerEXT) {
-        void **procp = (void **) &disp->FramebufferTextureLayerEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sFramebufferTextureLayerEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ColorMaskIndexedEXT) {
-        void **procp = (void **) &disp->ColorMaskIndexedEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sColorMaskIndexedEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ColorMaskIndexedEXT) {
-        void **procp = (void **) &disp->ColorMaskIndexedEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sColorMaski", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->DisableIndexedEXT) {
-        void **procp = (void **) &disp->DisableIndexedEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sDisableIndexedEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->DisableIndexedEXT) {
-        void **procp = (void **) &disp->DisableIndexedEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sDisablei", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->EnableIndexedEXT) {
-        void **procp = (void **) &disp->EnableIndexedEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sEnableIndexedEXT", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->EnableIndexedEXT) {
-        void **procp = (void **) &disp->EnableIndexedEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sEnablei", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetBooleanIndexedvEXT) {
-        void **procp = (void **) &disp->GetBooleanIndexedvEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sGetBooleanIndexedvEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetBooleanIndexedvEXT) {
-        void **procp = (void **) &disp->GetBooleanIndexedvEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sGetBooleani_v", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetIntegerIndexedvEXT) {
-        void **procp = (void **) &disp->GetIntegerIndexedvEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sGetIntegerIndexedvEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetIntegerIndexedvEXT) {
-        void **procp = (void **) &disp->GetIntegerIndexedvEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sGetIntegeri_v", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->IsEnabledIndexedEXT) {
-        void **procp = (void **) &disp->IsEnabledIndexedEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sIsEnabledIndexedEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->IsEnabledIndexedEXT) {
-        void **procp = (void **) &disp->IsEnabledIndexedEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sIsEnabledi", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ClearColorIiEXT) {
-        void **procp = (void **) &disp->ClearColorIiEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sClearColorIiEXT", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ClearColorIuiEXT) {
-        void **procp = (void **) &disp->ClearColorIuiEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sClearColorIuiEXT", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetTexParameterIivEXT) {
-        void **procp = (void **) &disp->GetTexParameterIivEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sGetTexParameterIivEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetTexParameterIivEXT) {
-        void **procp = (void **) &disp->GetTexParameterIivEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sGetTexParameterIiv",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetTexParameterIuivEXT) {
-        void **procp = (void **) &disp->GetTexParameterIuivEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sGetTexParameterIuivEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetTexParameterIuivEXT) {
-        void **procp = (void **) &disp->GetTexParameterIuivEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sGetTexParameterIuiv",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TexParameterIivEXT) {
-        void **procp = (void **) &disp->TexParameterIivEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sTexParameterIivEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TexParameterIivEXT) {
-        void **procp = (void **) &disp->TexParameterIivEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sTexParameterIiv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TexParameterIuivEXT) {
-        void **procp = (void **) &disp->TexParameterIuivEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sTexParameterIuivEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TexParameterIuivEXT) {
-        void **procp = (void **) &disp->TexParameterIuivEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sTexParameterIuiv", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->BeginConditionalRenderNV) {
-        void **procp = (void **) &disp->BeginConditionalRenderNV;
-
-        snprintf(symboln, sizeof(symboln), "%sBeginConditionalRenderNV",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->BeginConditionalRenderNV) {
-        void **procp = (void **) &disp->BeginConditionalRenderNV;
-
-        snprintf(symboln, sizeof(symboln), "%sBeginConditionalRender",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->EndConditionalRenderNV) {
-        void **procp = (void **) &disp->EndConditionalRenderNV;
-
-        snprintf(symboln, sizeof(symboln), "%sEndConditionalRenderNV",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->EndConditionalRenderNV) {
-        void **procp = (void **) &disp->EndConditionalRenderNV;
-
-        snprintf(symboln, sizeof(symboln), "%sEndConditionalRender",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->BeginTransformFeedbackEXT) {
-        void **procp = (void **) &disp->BeginTransformFeedbackEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sBeginTransformFeedbackEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->BeginTransformFeedbackEXT) {
-        void **procp = (void **) &disp->BeginTransformFeedbackEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sBeginTransformFeedback",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->BindBufferBaseEXT) {
-        void **procp = (void **) &disp->BindBufferBaseEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sBindBufferBaseEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->BindBufferBaseEXT) {
-        void **procp = (void **) &disp->BindBufferBaseEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sBindBufferBase", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->BindBufferOffsetEXT) {
-        void **procp = (void **) &disp->BindBufferOffsetEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sBindBufferOffsetEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->BindBufferRangeEXT) {
-        void **procp = (void **) &disp->BindBufferRangeEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sBindBufferRangeEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->BindBufferRangeEXT) {
-        void **procp = (void **) &disp->BindBufferRangeEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sBindBufferRange", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->EndTransformFeedbackEXT) {
-        void **procp = (void **) &disp->EndTransformFeedbackEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sEndTransformFeedbackEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->EndTransformFeedbackEXT) {
-        void **procp = (void **) &disp->EndTransformFeedbackEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sEndTransformFeedback",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetTransformFeedbackVaryingEXT) {
-        void **procp = (void **) &disp->GetTransformFeedbackVaryingEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sGetTransformFeedbackVaryingEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetTransformFeedbackVaryingEXT) {
-        void **procp = (void **) &disp->GetTransformFeedbackVaryingEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sGetTransformFeedbackVarying",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TransformFeedbackVaryingsEXT) {
-        void **procp = (void **) &disp->TransformFeedbackVaryingsEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sTransformFeedbackVaryingsEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TransformFeedbackVaryingsEXT) {
-        void **procp = (void **) &disp->TransformFeedbackVaryingsEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sTransformFeedbackVaryings",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ProvokingVertexEXT) {
-        void **procp = (void **) &disp->ProvokingVertexEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sProvokingVertexEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ProvokingVertexEXT) {
-        void **procp = (void **) &disp->ProvokingVertexEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sProvokingVertex", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetTexParameterPointervAPPLE) {
-        void **procp = (void **) &disp->GetTexParameterPointervAPPLE;
-
-        snprintf(symboln, sizeof(symboln), "%sGetTexParameterPointervAPPLE",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TextureRangeAPPLE) {
-        void **procp = (void **) &disp->TextureRangeAPPLE;
-
-        snprintf(symboln, sizeof(symboln), "%sTextureRangeAPPLE",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetObjectParameterivAPPLE) {
-        void **procp = (void **) &disp->GetObjectParameterivAPPLE;
-
-        snprintf(symboln, sizeof(symboln), "%sGetObjectParameterivAPPLE",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ObjectPurgeableAPPLE) {
-        void **procp = (void **) &disp->ObjectPurgeableAPPLE;
-
-        snprintf(symboln, sizeof(symboln), "%sObjectPurgeableAPPLE",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ObjectUnpurgeableAPPLE) {
-        void **procp = (void **) &disp->ObjectUnpurgeableAPPLE;
-
-        snprintf(symboln, sizeof(symboln), "%sObjectUnpurgeableAPPLE",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ActiveProgramEXT) {
-        void **procp = (void **) &disp->ActiveProgramEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sActiveProgramEXT", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->CreateShaderProgramEXT) {
-        void **procp = (void **) &disp->CreateShaderProgramEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sCreateShaderProgramEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->UseShaderProgramEXT) {
-        void **procp = (void **) &disp->UseShaderProgramEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sUseShaderProgramEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->TextureBarrierNV) {
-        void **procp = (void **) &disp->TextureBarrierNV;
-
-        snprintf(symboln, sizeof(symboln), "%sTextureBarrierNV", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->StencilFuncSeparateATI) {
-        void **procp = (void **) &disp->StencilFuncSeparateATI;
-
-        snprintf(symboln, sizeof(symboln), "%sStencilFuncSeparateATI",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ProgramEnvParameters4fvEXT) {
-        void **procp = (void **) &disp->ProgramEnvParameters4fvEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sProgramEnvParameters4fvEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->ProgramLocalParameters4fvEXT) {
-        void **procp = (void **) &disp->ProgramLocalParameters4fvEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sProgramLocalParameters4fvEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetQueryObjecti64vEXT) {
-        void **procp = (void **) &disp->GetQueryObjecti64vEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sGetQueryObjecti64vEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->GetQueryObjectui64vEXT) {
-        void **procp = (void **) &disp->GetQueryObjectui64vEXT;
-
-        snprintf(symboln, sizeof(symboln), "%sGetQueryObjectui64vEXT",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->EGLImageTargetRenderbufferStorageOES) {
-        void **procp = (void **) &disp->EGLImageTargetRenderbufferStorageOES;
-
-        snprintf(symboln, sizeof(symboln),
-                 "%sEGLImageTargetRenderbufferStorageOES", symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    if (!disp->EGLImageTargetTexture2DOES) {
-        void **procp = (void **) &disp->EGLImageTargetTexture2DOES;
-
-        snprintf(symboln, sizeof(symboln), "%sEGLImageTargetTexture2DOES",
-                 symbol_prefix);
-        *procp = dlsym(handle, symboln);
-    }
-
-    __glapi_gentable_set_remaining_noop(disp);
-
-    return disp;
-}
diff --git a/glx/glapitable.h b/glx/glapitable.h
deleted file mode 100644 (file)
index f7e7c6c..0000000
+++ /dev/null
@@ -1,1016 +0,0 @@
-/* DO NOT EDIT - This file generated automatically by gl_table.py (from Mesa) script */
-
-/*
- * Copyright (C) 1999-2003  Brian Paul   All Rights Reserved.
- * (C) Copyright IBM Corporation 2004
- * All Rights Reserved.
- * 
- * 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, sub license,
- * 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 NON-INFRINGEMENT.  IN NO EVENT SHALL
- * BRIAN PAUL, IBM,
- * AND/OR THEIR SUPPLIERS 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.
- */
-
-#if !defined( _GLAPI_TABLE_H_ )
-#define _GLAPI_TABLE_H_
-
-#ifndef GLAPIENTRYP
-#ifndef GLAPIENTRY
-#define GLAPIENTRY
-#endif
-
-#define GLAPIENTRYP GLAPIENTRY *
-#endif
-
-struct _glapi_table {
-    void (GLAPIENTRYP NewList) (GLuint list, GLenum mode);      /* 0 */
-    void (GLAPIENTRYP EndList) (void);  /* 1 */
-    void (GLAPIENTRYP CallList) (GLuint list);  /* 2 */
-    void (GLAPIENTRYP CallLists) (GLsizei n, GLenum type, const GLvoid * lists);        /* 3 */
-    void (GLAPIENTRYP DeleteLists) (GLuint list, GLsizei range);        /* 4 */
-     GLuint(GLAPIENTRYP GenLists) (GLsizei range);      /* 5 */
-    void (GLAPIENTRYP ListBase) (GLuint base);  /* 6 */
-    void (GLAPIENTRYP Begin) (GLenum mode);     /* 7 */
-    void (GLAPIENTRYP Bitmap) (GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte * bitmap);      /* 8 */
-    void (GLAPIENTRYP Color3b) (GLbyte red, GLbyte green, GLbyte blue); /* 9 */
-    void (GLAPIENTRYP Color3bv) (const GLbyte * v);     /* 10 */
-    void (GLAPIENTRYP Color3d) (GLdouble red, GLdouble green, GLdouble blue);   /* 11 */
-    void (GLAPIENTRYP Color3dv) (const GLdouble * v);   /* 12 */
-    void (GLAPIENTRYP Color3f) (GLfloat red, GLfloat green, GLfloat blue);      /* 13 */
-    void (GLAPIENTRYP Color3fv) (const GLfloat * v);    /* 14 */
-    void (GLAPIENTRYP Color3i) (GLint red, GLint green, GLint blue);    /* 15 */
-    void (GLAPIENTRYP Color3iv) (const GLint * v);      /* 16 */
-    void (GLAPIENTRYP Color3s) (GLshort red, GLshort green, GLshort blue);      /* 17 */
-    void (GLAPIENTRYP Color3sv) (const GLshort * v);    /* 18 */
-    void (GLAPIENTRYP Color3ub) (GLubyte red, GLubyte green, GLubyte blue);     /* 19 */
-    void (GLAPIENTRYP Color3ubv) (const GLubyte * v);   /* 20 */
-    void (GLAPIENTRYP Color3ui) (GLuint red, GLuint green, GLuint blue);        /* 21 */
-    void (GLAPIENTRYP Color3uiv) (const GLuint * v);    /* 22 */
-    void (GLAPIENTRYP Color3us) (GLushort red, GLushort green, GLushort blue);  /* 23 */
-    void (GLAPIENTRYP Color3usv) (const GLushort * v);  /* 24 */
-    void (GLAPIENTRYP Color4b) (GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha);   /* 25 */
-    void (GLAPIENTRYP Color4bv) (const GLbyte * v);     /* 26 */
-    void (GLAPIENTRYP Color4d) (GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha);   /* 27 */
-    void (GLAPIENTRYP Color4dv) (const GLdouble * v);   /* 28 */
-    void (GLAPIENTRYP Color4f) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);       /* 29 */
-    void (GLAPIENTRYP Color4fv) (const GLfloat * v);    /* 30 */
-    void (GLAPIENTRYP Color4i) (GLint red, GLint green, GLint blue, GLint alpha);       /* 31 */
-    void (GLAPIENTRYP Color4iv) (const GLint * v);      /* 32 */
-    void (GLAPIENTRYP Color4s) (GLshort red, GLshort green, GLshort blue, GLshort alpha);       /* 33 */
-    void (GLAPIENTRYP Color4sv) (const GLshort * v);    /* 34 */
-    void (GLAPIENTRYP Color4ub) (GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha);      /* 35 */
-    void (GLAPIENTRYP Color4ubv) (const GLubyte * v);   /* 36 */
-    void (GLAPIENTRYP Color4ui) (GLuint red, GLuint green, GLuint blue, GLuint alpha);  /* 37 */
-    void (GLAPIENTRYP Color4uiv) (const GLuint * v);    /* 38 */
-    void (GLAPIENTRYP Color4us) (GLushort red, GLushort green, GLushort blue, GLushort alpha);  /* 39 */
-    void (GLAPIENTRYP Color4usv) (const GLushort * v);  /* 40 */
-    void (GLAPIENTRYP EdgeFlag) (GLboolean flag);       /* 41 */
-    void (GLAPIENTRYP EdgeFlagv) (const GLboolean * flag);      /* 42 */
-    void (GLAPIENTRYP End) (void);      /* 43 */
-    void (GLAPIENTRYP Indexd) (GLdouble c);     /* 44 */
-    void (GLAPIENTRYP Indexdv) (const GLdouble * c);    /* 45 */
-    void (GLAPIENTRYP Indexf) (GLfloat c);      /* 46 */
-    void (GLAPIENTRYP Indexfv) (const GLfloat * c);     /* 47 */
-    void (GLAPIENTRYP Indexi) (GLint c);        /* 48 */
-    void (GLAPIENTRYP Indexiv) (const GLint * c);       /* 49 */
-    void (GLAPIENTRYP Indexs) (GLshort c);      /* 50 */
-    void (GLAPIENTRYP Indexsv) (const GLshort * c);     /* 51 */
-    void (GLAPIENTRYP Normal3b) (GLbyte nx, GLbyte ny, GLbyte nz);      /* 52 */
-    void (GLAPIENTRYP Normal3bv) (const GLbyte * v);    /* 53 */
-    void (GLAPIENTRYP Normal3d) (GLdouble nx, GLdouble ny, GLdouble nz);        /* 54 */
-    void (GLAPIENTRYP Normal3dv) (const GLdouble * v);  /* 55 */
-    void (GLAPIENTRYP Normal3f) (GLfloat nx, GLfloat ny, GLfloat nz);   /* 56 */
-    void (GLAPIENTRYP Normal3fv) (const GLfloat * v);   /* 57 */
-    void (GLAPIENTRYP Normal3i) (GLint nx, GLint ny, GLint nz); /* 58 */
-    void (GLAPIENTRYP Normal3iv) (const GLint * v);     /* 59 */
-    void (GLAPIENTRYP Normal3s) (GLshort nx, GLshort ny, GLshort nz);   /* 60 */
-    void (GLAPIENTRYP Normal3sv) (const GLshort * v);   /* 61 */
-    void (GLAPIENTRYP RasterPos2d) (GLdouble x, GLdouble y);    /* 62 */
-    void (GLAPIENTRYP RasterPos2dv) (const GLdouble * v);       /* 63 */
-    void (GLAPIENTRYP RasterPos2f) (GLfloat x, GLfloat y);      /* 64 */
-    void (GLAPIENTRYP RasterPos2fv) (const GLfloat * v);        /* 65 */
-    void (GLAPIENTRYP RasterPos2i) (GLint x, GLint y);  /* 66 */
-    void (GLAPIENTRYP RasterPos2iv) (const GLint * v);  /* 67 */
-    void (GLAPIENTRYP RasterPos2s) (GLshort x, GLshort y);      /* 68 */
-    void (GLAPIENTRYP RasterPos2sv) (const GLshort * v);        /* 69 */
-    void (GLAPIENTRYP RasterPos3d) (GLdouble x, GLdouble y, GLdouble z);        /* 70 */
-    void (GLAPIENTRYP RasterPos3dv) (const GLdouble * v);       /* 71 */
-    void (GLAPIENTRYP RasterPos3f) (GLfloat x, GLfloat y, GLfloat z);   /* 72 */
-    void (GLAPIENTRYP RasterPos3fv) (const GLfloat * v);        /* 73 */
-    void (GLAPIENTRYP RasterPos3i) (GLint x, GLint y, GLint z); /* 74 */
-    void (GLAPIENTRYP RasterPos3iv) (const GLint * v);  /* 75 */
-    void (GLAPIENTRYP RasterPos3s) (GLshort x, GLshort y, GLshort z);   /* 76 */
-    void (GLAPIENTRYP RasterPos3sv) (const GLshort * v);        /* 77 */
-    void (GLAPIENTRYP RasterPos4d) (GLdouble x, GLdouble y, GLdouble z, GLdouble w);    /* 78 */
-    void (GLAPIENTRYP RasterPos4dv) (const GLdouble * v);       /* 79 */
-    void (GLAPIENTRYP RasterPos4f) (GLfloat x, GLfloat y, GLfloat z, GLfloat w);        /* 80 */
-    void (GLAPIENTRYP RasterPos4fv) (const GLfloat * v);        /* 81 */
-    void (GLAPIENTRYP RasterPos4i) (GLint x, GLint y, GLint z, GLint w);        /* 82 */
-    void (GLAPIENTRYP RasterPos4iv) (const GLint * v);  /* 83 */
-    void (GLAPIENTRYP RasterPos4s) (GLshort x, GLshort y, GLshort z, GLshort w);        /* 84 */
-    void (GLAPIENTRYP RasterPos4sv) (const GLshort * v);        /* 85 */
-    void (GLAPIENTRYP Rectd) (GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2);      /* 86 */
-    void (GLAPIENTRYP Rectdv) (const GLdouble * v1, const GLdouble * v2);       /* 87 */
-    void (GLAPIENTRYP Rectf) (GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2);  /* 88 */
-    void (GLAPIENTRYP Rectfv) (const GLfloat * v1, const GLfloat * v2); /* 89 */
-    void (GLAPIENTRYP Recti) (GLint x1, GLint y1, GLint x2, GLint y2);  /* 90 */
-    void (GLAPIENTRYP Rectiv) (const GLint * v1, const GLint * v2);     /* 91 */
-    void (GLAPIENTRYP Rects) (GLshort x1, GLshort y1, GLshort x2, GLshort y2);  /* 92 */
-    void (GLAPIENTRYP Rectsv) (const GLshort * v1, const GLshort * v2); /* 93 */
-    void (GLAPIENTRYP TexCoord1d) (GLdouble s); /* 94 */
-    void (GLAPIENTRYP TexCoord1dv) (const GLdouble * v);        /* 95 */
-    void (GLAPIENTRYP TexCoord1f) (GLfloat s);  /* 96 */
-    void (GLAPIENTRYP TexCoord1fv) (const GLfloat * v); /* 97 */
-    void (GLAPIENTRYP TexCoord1i) (GLint s);    /* 98 */
-    void (GLAPIENTRYP TexCoord1iv) (const GLint * v);   /* 99 */
-    void (GLAPIENTRYP TexCoord1s) (GLshort s);  /* 100 */
-    void (GLAPIENTRYP TexCoord1sv) (const GLshort * v); /* 101 */
-    void (GLAPIENTRYP TexCoord2d) (GLdouble s, GLdouble t);     /* 102 */
-    void (GLAPIENTRYP TexCoord2dv) (const GLdouble * v);        /* 103 */
-    void (GLAPIENTRYP TexCoord2f) (GLfloat s, GLfloat t);       /* 104 */
-    void (GLAPIENTRYP TexCoord2fv) (const GLfloat * v); /* 105 */
-    void (GLAPIENTRYP TexCoord2i) (GLint s, GLint t);   /* 106 */
-    void (GLAPIENTRYP TexCoord2iv) (const GLint * v);   /* 107 */
-    void (GLAPIENTRYP TexCoord2s) (GLshort s, GLshort t);       /* 108 */
-    void (GLAPIENTRYP TexCoord2sv) (const GLshort * v); /* 109 */
-    void (GLAPIENTRYP TexCoord3d) (GLdouble s, GLdouble t, GLdouble r); /* 110 */
-    void (GLAPIENTRYP TexCoord3dv) (const GLdouble * v);        /* 111 */
-    void (GLAPIENTRYP TexCoord3f) (GLfloat s, GLfloat t, GLfloat r);    /* 112 */
-    void (GLAPIENTRYP TexCoord3fv) (const GLfloat * v); /* 113 */
-    void (GLAPIENTRYP TexCoord3i) (GLint s, GLint t, GLint r);  /* 114 */
-    void (GLAPIENTRYP TexCoord3iv) (const GLint * v);   /* 115 */
-    void (GLAPIENTRYP TexCoord3s) (GLshort s, GLshort t, GLshort r);    /* 116 */
-    void (GLAPIENTRYP TexCoord3sv) (const GLshort * v); /* 117 */
-    void (GLAPIENTRYP TexCoord4d) (GLdouble s, GLdouble t, GLdouble r, GLdouble q);     /* 118 */
-    void (GLAPIENTRYP TexCoord4dv) (const GLdouble * v);        /* 119 */
-    void (GLAPIENTRYP TexCoord4f) (GLfloat s, GLfloat t, GLfloat r, GLfloat q); /* 120 */
-    void (GLAPIENTRYP TexCoord4fv) (const GLfloat * v); /* 121 */
-    void (GLAPIENTRYP TexCoord4i) (GLint s, GLint t, GLint r, GLint q); /* 122 */
-    void (GLAPIENTRYP TexCoord4iv) (const GLint * v);   /* 123 */
-    void (GLAPIENTRYP TexCoord4s) (GLshort s, GLshort t, GLshort r, GLshort q); /* 124 */
-    void (GLAPIENTRYP TexCoord4sv) (const GLshort * v); /* 125 */
-    void (GLAPIENTRYP Vertex2d) (GLdouble x, GLdouble y);       /* 126 */
-    void (GLAPIENTRYP Vertex2dv) (const GLdouble * v);  /* 127 */
-    void (GLAPIENTRYP Vertex2f) (GLfloat x, GLfloat y); /* 128 */
-    void (GLAPIENTRYP Vertex2fv) (const GLfloat * v);   /* 129 */
-    void (GLAPIENTRYP Vertex2i) (GLint x, GLint y);     /* 130 */
-    void (GLAPIENTRYP Vertex2iv) (const GLint * v);     /* 131 */
-    void (GLAPIENTRYP Vertex2s) (GLshort x, GLshort y); /* 132 */
-    void (GLAPIENTRYP Vertex2sv) (const GLshort * v);   /* 133 */
-    void (GLAPIENTRYP Vertex3d) (GLdouble x, GLdouble y, GLdouble z);   /* 134 */
-    void (GLAPIENTRYP Vertex3dv) (const GLdouble * v);  /* 135 */
-    void (GLAPIENTRYP Vertex3f) (GLfloat x, GLfloat y, GLfloat z);      /* 136 */
-    void (GLAPIENTRYP Vertex3fv) (const GLfloat * v);   /* 137 */
-    void (GLAPIENTRYP Vertex3i) (GLint x, GLint y, GLint z);    /* 138 */
-    void (GLAPIENTRYP Vertex3iv) (const GLint * v);     /* 139 */
-    void (GLAPIENTRYP Vertex3s) (GLshort x, GLshort y, GLshort z);      /* 140 */
-    void (GLAPIENTRYP Vertex3sv) (const GLshort * v);   /* 141 */
-    void (GLAPIENTRYP Vertex4d) (GLdouble x, GLdouble y, GLdouble z, GLdouble w);       /* 142 */
-    void (GLAPIENTRYP Vertex4dv) (const GLdouble * v);  /* 143 */
-    void (GLAPIENTRYP Vertex4f) (GLfloat x, GLfloat y, GLfloat z, GLfloat w);   /* 144 */
-    void (GLAPIENTRYP Vertex4fv) (const GLfloat * v);   /* 145 */
-    void (GLAPIENTRYP Vertex4i) (GLint x, GLint y, GLint z, GLint w);   /* 146 */
-    void (GLAPIENTRYP Vertex4iv) (const GLint * v);     /* 147 */
-    void (GLAPIENTRYP Vertex4s) (GLshort x, GLshort y, GLshort z, GLshort w);   /* 148 */
-    void (GLAPIENTRYP Vertex4sv) (const GLshort * v);   /* 149 */
-    void (GLAPIENTRYP ClipPlane) (GLenum plane, const GLdouble * equation);     /* 150 */
-    void (GLAPIENTRYP ColorMaterial) (GLenum face, GLenum mode);        /* 151 */
-    void (GLAPIENTRYP CullFace) (GLenum mode);  /* 152 */
-    void (GLAPIENTRYP Fogf) (GLenum pname, GLfloat param);      /* 153 */
-    void (GLAPIENTRYP Fogfv) (GLenum pname, const GLfloat * params);    /* 154 */
-    void (GLAPIENTRYP Fogi) (GLenum pname, GLint param);        /* 155 */
-    void (GLAPIENTRYP Fogiv) (GLenum pname, const GLint * params);      /* 156 */
-    void (GLAPIENTRYP FrontFace) (GLenum mode); /* 157 */
-    void (GLAPIENTRYP Hint) (GLenum target, GLenum mode);       /* 158 */
-    void (GLAPIENTRYP Lightf) (GLenum light, GLenum pname, GLfloat param);      /* 159 */
-    void (GLAPIENTRYP Lightfv) (GLenum light, GLenum pname, const GLfloat * params);    /* 160 */
-    void (GLAPIENTRYP Lighti) (GLenum light, GLenum pname, GLint param);        /* 161 */
-    void (GLAPIENTRYP Lightiv) (GLenum light, GLenum pname, const GLint * params);      /* 162 */
-    void (GLAPIENTRYP LightModelf) (GLenum pname, GLfloat param);       /* 163 */
-    void (GLAPIENTRYP LightModelfv) (GLenum pname, const GLfloat * params);     /* 164 */
-    void (GLAPIENTRYP LightModeli) (GLenum pname, GLint param); /* 165 */
-    void (GLAPIENTRYP LightModeliv) (GLenum pname, const GLint * params);       /* 166 */
-    void (GLAPIENTRYP LineStipple) (GLint factor, GLushort pattern);    /* 167 */
-    void (GLAPIENTRYP LineWidth) (GLfloat width);       /* 168 */
-    void (GLAPIENTRYP Materialf) (GLenum face, GLenum pname, GLfloat param);    /* 169 */
-    void (GLAPIENTRYP Materialfv) (GLenum face, GLenum pname, const GLfloat * params);  /* 170 */
-    void (GLAPIENTRYP Materiali) (GLenum face, GLenum pname, GLint param);      /* 171 */
-    void (GLAPIENTRYP Materialiv) (GLenum face, GLenum pname, const GLint * params);    /* 172 */
-    void (GLAPIENTRYP PointSize) (GLfloat size);        /* 173 */
-    void (GLAPIENTRYP PolygonMode) (GLenum face, GLenum mode);  /* 174 */
-    void (GLAPIENTRYP PolygonStipple) (const GLubyte * mask);   /* 175 */
-    void (GLAPIENTRYP Scissor) (GLint x, GLint y, GLsizei width, GLsizei height);       /* 176 */
-    void (GLAPIENTRYP ShadeModel) (GLenum mode);        /* 177 */
-    void (GLAPIENTRYP TexParameterf) (GLenum target, GLenum pname, GLfloat param);      /* 178 */
-    void (GLAPIENTRYP TexParameterfv) (GLenum target, GLenum pname, const GLfloat * params);    /* 179 */
-    void (GLAPIENTRYP TexParameteri) (GLenum target, GLenum pname, GLint param);        /* 180 */
-    void (GLAPIENTRYP TexParameteriv) (GLenum target, GLenum pname, const GLint * params);      /* 181 */
-    void (GLAPIENTRYP TexImage1D) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid * pixels);   /* 182 */
-    void (GLAPIENTRYP TexImage2D) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid * pixels);   /* 183 */
-    void (GLAPIENTRYP TexEnvf) (GLenum target, GLenum pname, GLfloat param);    /* 184 */
-    void (GLAPIENTRYP TexEnvfv) (GLenum target, GLenum pname, const GLfloat * params);  /* 185 */
-    void (GLAPIENTRYP TexEnvi) (GLenum target, GLenum pname, GLint param);      /* 186 */
-    void (GLAPIENTRYP TexEnviv) (GLenum target, GLenum pname, const GLint * params);    /* 187 */
-    void (GLAPIENTRYP TexGend) (GLenum coord, GLenum pname, GLdouble param);    /* 188 */
-    void (GLAPIENTRYP TexGendv) (GLenum coord, GLenum pname, const GLdouble * params);  /* 189 */
-    void (GLAPIENTRYP TexGenf) (GLenum coord, GLenum pname, GLfloat param);     /* 190 */
-    void (GLAPIENTRYP TexGenfv) (GLenum coord, GLenum pname, const GLfloat * params);   /* 191 */
-    void (GLAPIENTRYP TexGeni) (GLenum coord, GLenum pname, GLint param);       /* 192 */
-    void (GLAPIENTRYP TexGeniv) (GLenum coord, GLenum pname, const GLint * params);     /* 193 */
-    void (GLAPIENTRYP FeedbackBuffer) (GLsizei size, GLenum type, GLfloat * buffer);    /* 194 */
-    void (GLAPIENTRYP SelectBuffer) (GLsizei size, GLuint * buffer);    /* 195 */
-     GLint(GLAPIENTRYP RenderMode) (GLenum mode);       /* 196 */
-    void (GLAPIENTRYP InitNames) (void);        /* 197 */
-    void (GLAPIENTRYP LoadName) (GLuint name);  /* 198 */
-    void (GLAPIENTRYP PassThrough) (GLfloat token);     /* 199 */
-    void (GLAPIENTRYP PopName) (void);  /* 200 */
-    void (GLAPIENTRYP PushName) (GLuint name);  /* 201 */
-    void (GLAPIENTRYP DrawBuffer) (GLenum mode);        /* 202 */
-    void (GLAPIENTRYP Clear) (GLbitfield mask); /* 203 */
-    void (GLAPIENTRYP ClearAccum) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);    /* 204 */
-    void (GLAPIENTRYP ClearIndex) (GLfloat c);  /* 205 */
-    void (GLAPIENTRYP ClearColor) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);        /* 206 */
-    void (GLAPIENTRYP ClearStencil) (GLint s);  /* 207 */
-    void (GLAPIENTRYP ClearDepth) (GLclampd depth);     /* 208 */
-    void (GLAPIENTRYP StencilMask) (GLuint mask);       /* 209 */
-    void (GLAPIENTRYP ColorMask) (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);     /* 210 */
-    void (GLAPIENTRYP DepthMask) (GLboolean flag);      /* 211 */
-    void (GLAPIENTRYP IndexMask) (GLuint mask); /* 212 */
-    void (GLAPIENTRYP Accum) (GLenum op, GLfloat value);        /* 213 */
-    void (GLAPIENTRYP Disable) (GLenum cap);    /* 214 */
-    void (GLAPIENTRYP Enable) (GLenum cap);     /* 215 */
-    void (GLAPIENTRYP Finish) (void);   /* 216 */
-    void (GLAPIENTRYP Flush) (void);    /* 217 */
-    void (GLAPIENTRYP PopAttrib) (void);        /* 218 */
-    void (GLAPIENTRYP PushAttrib) (GLbitfield mask);    /* 219 */
-    void (GLAPIENTRYP Map1d) (GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble * points);     /* 220 */
-    void (GLAPIENTRYP Map1f) (GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat * points);        /* 221 */
-    void (GLAPIENTRYP Map2d) (GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble * points);    /* 222 */
-    void (GLAPIENTRYP Map2f) (GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat * points); /* 223 */
-    void (GLAPIENTRYP MapGrid1d) (GLint un, GLdouble u1, GLdouble u2);  /* 224 */
-    void (GLAPIENTRYP MapGrid1f) (GLint un, GLfloat u1, GLfloat u2);    /* 225 */
-    void (GLAPIENTRYP MapGrid2d) (GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2);      /* 226 */
-    void (GLAPIENTRYP MapGrid2f) (GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2);  /* 227 */
-    void (GLAPIENTRYP EvalCoord1d) (GLdouble u);        /* 228 */
-    void (GLAPIENTRYP EvalCoord1dv) (const GLdouble * u);       /* 229 */
-    void (GLAPIENTRYP EvalCoord1f) (GLfloat u); /* 230 */
-    void (GLAPIENTRYP EvalCoord1fv) (const GLfloat * u);        /* 231 */
-    void (GLAPIENTRYP EvalCoord2d) (GLdouble u, GLdouble v);    /* 232 */
-    void (GLAPIENTRYP EvalCoord2dv) (const GLdouble * u);       /* 233 */
-    void (GLAPIENTRYP EvalCoord2f) (GLfloat u, GLfloat v);      /* 234 */
-    void (GLAPIENTRYP EvalCoord2fv) (const GLfloat * u);        /* 235 */
-    void (GLAPIENTRYP EvalMesh1) (GLenum mode, GLint i1, GLint i2);     /* 236 */
-    void (GLAPIENTRYP EvalPoint1) (GLint i);    /* 237 */
-    void (GLAPIENTRYP EvalMesh2) (GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2); /* 238 */
-    void (GLAPIENTRYP EvalPoint2) (GLint i, GLint j);   /* 239 */
-    void (GLAPIENTRYP AlphaFunc) (GLenum func, GLclampf ref);   /* 240 */
-    void (GLAPIENTRYP BlendFunc) (GLenum sfactor, GLenum dfactor);      /* 241 */
-    void (GLAPIENTRYP LogicOp) (GLenum opcode); /* 242 */
-    void (GLAPIENTRYP StencilFunc) (GLenum func, GLint ref, GLuint mask);       /* 243 */
-    void (GLAPIENTRYP StencilOp) (GLenum fail, GLenum zfail, GLenum zpass);     /* 244 */
-    void (GLAPIENTRYP DepthFunc) (GLenum func); /* 245 */
-    void (GLAPIENTRYP PixelZoom) (GLfloat xfactor, GLfloat yfactor);    /* 246 */
-    void (GLAPIENTRYP PixelTransferf) (GLenum pname, GLfloat param);    /* 247 */
-    void (GLAPIENTRYP PixelTransferi) (GLenum pname, GLint param);      /* 248 */
-    void (GLAPIENTRYP PixelStoref) (GLenum pname, GLfloat param);       /* 249 */
-    void (GLAPIENTRYP PixelStorei) (GLenum pname, GLint param); /* 250 */
-    void (GLAPIENTRYP PixelMapfv) (GLenum map, GLsizei mapsize, const GLfloat * values);        /* 251 */
-    void (GLAPIENTRYP PixelMapuiv) (GLenum map, GLsizei mapsize, const GLuint * values);        /* 252 */
-    void (GLAPIENTRYP PixelMapusv) (GLenum map, GLsizei mapsize, const GLushort * values);      /* 253 */
-    void (GLAPIENTRYP ReadBuffer) (GLenum mode);        /* 254 */
-    void (GLAPIENTRYP CopyPixels) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum type);       /* 255 */
-    void (GLAPIENTRYP ReadPixels) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid * pixels);       /* 256 */
-    void (GLAPIENTRYP DrawPixels) (GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * pixels);   /* 257 */
-    void (GLAPIENTRYP GetBooleanv) (GLenum pname, GLboolean * params);  /* 258 */
-    void (GLAPIENTRYP GetClipPlane) (GLenum plane, GLdouble * equation);        /* 259 */
-    void (GLAPIENTRYP GetDoublev) (GLenum pname, GLdouble * params);    /* 260 */
-     GLenum(GLAPIENTRYP GetError) (void);       /* 261 */
-    void (GLAPIENTRYP GetFloatv) (GLenum pname, GLfloat * params);      /* 262 */
-    void (GLAPIENTRYP GetIntegerv) (GLenum pname, GLint * params);      /* 263 */
-    void (GLAPIENTRYP GetLightfv) (GLenum light, GLenum pname, GLfloat * params);       /* 264 */
-    void (GLAPIENTRYP GetLightiv) (GLenum light, GLenum pname, GLint * params); /* 265 */
-    void (GLAPIENTRYP GetMapdv) (GLenum target, GLenum query, GLdouble * v);    /* 266 */
-    void (GLAPIENTRYP GetMapfv) (GLenum target, GLenum query, GLfloat * v);     /* 267 */
-    void (GLAPIENTRYP GetMapiv) (GLenum target, GLenum query, GLint * v);       /* 268 */
-    void (GLAPIENTRYP GetMaterialfv) (GLenum face, GLenum pname, GLfloat * params);     /* 269 */
-    void (GLAPIENTRYP GetMaterialiv) (GLenum face, GLenum pname, GLint * params);       /* 270 */
-    void (GLAPIENTRYP GetPixelMapfv) (GLenum map, GLfloat * values);    /* 271 */
-    void (GLAPIENTRYP GetPixelMapuiv) (GLenum map, GLuint * values);    /* 272 */
-    void (GLAPIENTRYP GetPixelMapusv) (GLenum map, GLushort * values);  /* 273 */
-    void (GLAPIENTRYP GetPolygonStipple) (GLubyte * mask);      /* 274 */
-    const GLubyte *(GLAPIENTRYP GetString) (GLenum name);       /* 275 */
-    void (GLAPIENTRYP GetTexEnvfv) (GLenum target, GLenum pname, GLfloat * params);     /* 276 */
-    void (GLAPIENTRYP GetTexEnviv) (GLenum target, GLenum pname, GLint * params);       /* 277 */
-    void (GLAPIENTRYP GetTexGendv) (GLenum coord, GLenum pname, GLdouble * params);     /* 278 */
-    void (GLAPIENTRYP GetTexGenfv) (GLenum coord, GLenum pname, GLfloat * params);      /* 279 */
-    void (GLAPIENTRYP GetTexGeniv) (GLenum coord, GLenum pname, GLint * params);        /* 280 */
-    void (GLAPIENTRYP GetTexImage) (GLenum target, GLint level, GLenum format, GLenum type, GLvoid * pixels);   /* 281 */
-    void (GLAPIENTRYP GetTexParameterfv) (GLenum target, GLenum pname, GLfloat * params);       /* 282 */
-    void (GLAPIENTRYP GetTexParameteriv) (GLenum target, GLenum pname, GLint * params); /* 283 */
-    void (GLAPIENTRYP GetTexLevelParameterfv) (GLenum target, GLint level, GLenum pname, GLfloat * params);     /* 284 */
-    void (GLAPIENTRYP GetTexLevelParameteriv) (GLenum target, GLint level, GLenum pname, GLint * params);       /* 285 */
-     GLboolean(GLAPIENTRYP IsEnabled) (GLenum cap);     /* 286 */
-     GLboolean(GLAPIENTRYP IsList) (GLuint list);       /* 287 */
-    void (GLAPIENTRYP DepthRange) (GLclampd zNear, GLclampd zFar);      /* 288 */
-    void (GLAPIENTRYP Frustum) (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);   /* 289 */
-    void (GLAPIENTRYP LoadIdentity) (void);     /* 290 */
-    void (GLAPIENTRYP LoadMatrixf) (const GLfloat * m); /* 291 */
-    void (GLAPIENTRYP LoadMatrixd) (const GLdouble * m);        /* 292 */
-    void (GLAPIENTRYP MatrixMode) (GLenum mode);        /* 293 */
-    void (GLAPIENTRYP MultMatrixf) (const GLfloat * m); /* 294 */
-    void (GLAPIENTRYP MultMatrixd) (const GLdouble * m);        /* 295 */
-    void (GLAPIENTRYP Ortho) (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);     /* 296 */
-    void (GLAPIENTRYP PopMatrix) (void);        /* 297 */
-    void (GLAPIENTRYP PushMatrix) (void);       /* 298 */
-    void (GLAPIENTRYP Rotated) (GLdouble angle, GLdouble x, GLdouble y, GLdouble z);    /* 299 */
-    void (GLAPIENTRYP Rotatef) (GLfloat angle, GLfloat x, GLfloat y, GLfloat z);        /* 300 */
-    void (GLAPIENTRYP Scaled) (GLdouble x, GLdouble y, GLdouble z);     /* 301 */
-    void (GLAPIENTRYP Scalef) (GLfloat x, GLfloat y, GLfloat z);        /* 302 */
-    void (GLAPIENTRYP Translated) (GLdouble x, GLdouble y, GLdouble z); /* 303 */
-    void (GLAPIENTRYP Translatef) (GLfloat x, GLfloat y, GLfloat z);    /* 304 */
-    void (GLAPIENTRYP Viewport) (GLint x, GLint y, GLsizei width, GLsizei height);      /* 305 */
-    void (GLAPIENTRYP ArrayElement) (GLint i);  /* 306 */
-    void (GLAPIENTRYP BindTexture) (GLenum target, GLuint texture);     /* 307 */
-    void (GLAPIENTRYP ColorPointer) (GLint size, GLenum type, GLsizei stride, const GLvoid * pointer);  /* 308 */
-    void (GLAPIENTRYP DisableClientState) (GLenum array);       /* 309 */
-    void (GLAPIENTRYP DrawArrays) (GLenum mode, GLint first, GLsizei count);    /* 310 */
-    void (GLAPIENTRYP DrawElements) (GLenum mode, GLsizei count, GLenum type, const GLvoid * indices);  /* 311 */
-    void (GLAPIENTRYP EdgeFlagPointer) (GLsizei stride, const GLvoid * pointer);        /* 312 */
-    void (GLAPIENTRYP EnableClientState) (GLenum array);        /* 313 */
-    void (GLAPIENTRYP IndexPointer) (GLenum type, GLsizei stride, const GLvoid * pointer);      /* 314 */
-    void (GLAPIENTRYP Indexub) (GLubyte c);     /* 315 */
-    void (GLAPIENTRYP Indexubv) (const GLubyte * c);    /* 316 */
-    void (GLAPIENTRYP InterleavedArrays) (GLenum format, GLsizei stride, const GLvoid * pointer);       /* 317 */
-    void (GLAPIENTRYP NormalPointer) (GLenum type, GLsizei stride, const GLvoid * pointer);     /* 318 */
-    void (GLAPIENTRYP PolygonOffset) (GLfloat factor, GLfloat units);   /* 319 */
-    void (GLAPIENTRYP TexCoordPointer) (GLint size, GLenum type, GLsizei stride, const GLvoid * pointer);       /* 320 */
-    void (GLAPIENTRYP VertexPointer) (GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 321 */
-     GLboolean(GLAPIENTRYP AreTexturesResident) (GLsizei n, const GLuint * textures, GLboolean * residences);   /* 322 */
-    void (GLAPIENTRYP CopyTexImage1D) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);       /* 323 */
-    void (GLAPIENTRYP CopyTexImage2D) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);       /* 324 */
-    void (GLAPIENTRYP CopyTexSubImage1D) (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);  /* 325 */
-    void (GLAPIENTRYP CopyTexSubImage2D) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);   /* 326 */
-    void (GLAPIENTRYP DeleteTextures) (GLsizei n, const GLuint * textures);     /* 327 */
-    void (GLAPIENTRYP GenTextures) (GLsizei n, GLuint * textures);      /* 328 */
-    void (GLAPIENTRYP GetPointerv) (GLenum pname, GLvoid ** params);    /* 329 */
-     GLboolean(GLAPIENTRYP IsTexture) (GLuint texture); /* 330 */
-    void (GLAPIENTRYP PrioritizeTextures) (GLsizei n, const GLuint * textures, const GLclampf * priorities);    /* 331 */
-    void (GLAPIENTRYP TexSubImage1D) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid * pixels);     /* 332 */
-    void (GLAPIENTRYP TexSubImage2D) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * pixels);      /* 333 */
-    void (GLAPIENTRYP PopClientAttrib) (void);  /* 334 */
-    void (GLAPIENTRYP PushClientAttrib) (GLbitfield mask);      /* 335 */
-    void (GLAPIENTRYP BlendColor) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);        /* 336 */
-    void (GLAPIENTRYP BlendEquation) (GLenum mode);     /* 337 */
-    void (GLAPIENTRYP DrawRangeElements) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid * indices);   /* 338 */
-    void (GLAPIENTRYP ColorTable) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid * table);      /* 339 */
-    void (GLAPIENTRYP ColorTableParameterfv) (GLenum target, GLenum pname, const GLfloat * params);     /* 340 */
-    void (GLAPIENTRYP ColorTableParameteriv) (GLenum target, GLenum pname, const GLint * params);       /* 341 */
-    void (GLAPIENTRYP CopyColorTable) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);  /* 342 */
-    void (GLAPIENTRYP GetColorTable) (GLenum target, GLenum format, GLenum type, GLvoid * table);       /* 343 */
-    void (GLAPIENTRYP GetColorTableParameterfv) (GLenum target, GLenum pname, GLfloat * params);        /* 344 */
-    void (GLAPIENTRYP GetColorTableParameteriv) (GLenum target, GLenum pname, GLint * params);  /* 345 */
-    void (GLAPIENTRYP ColorSubTable) (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid * data);    /* 346 */
-    void (GLAPIENTRYP CopyColorSubTable) (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width);       /* 347 */
-    void (GLAPIENTRYP ConvolutionFilter1D) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid * image);     /* 348 */
-    void (GLAPIENTRYP ConvolutionFilter2D) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * image);     /* 349 */
-    void (GLAPIENTRYP ConvolutionParameterf) (GLenum target, GLenum pname, GLfloat params);     /* 350 */
-    void (GLAPIENTRYP ConvolutionParameterfv) (GLenum target, GLenum pname, const GLfloat * params);    /* 351 */
-    void (GLAPIENTRYP ConvolutionParameteri) (GLenum target, GLenum pname, GLint params);       /* 352 */
-    void (GLAPIENTRYP ConvolutionParameteriv) (GLenum target, GLenum pname, const GLint * params);      /* 353 */
-    void (GLAPIENTRYP CopyConvolutionFilter1D) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); /* 354 */
-    void (GLAPIENTRYP CopyConvolutionFilter2D) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); /* 355 */
-    void (GLAPIENTRYP GetConvolutionFilter) (GLenum target, GLenum format, GLenum type, GLvoid * image);        /* 356 */
-    void (GLAPIENTRYP GetConvolutionParameterfv) (GLenum target, GLenum pname, GLfloat * params);       /* 357 */
-    void (GLAPIENTRYP GetConvolutionParameteriv) (GLenum target, GLenum pname, GLint * params); /* 358 */
-    void (GLAPIENTRYP GetSeparableFilter) (GLenum target, GLenum format, GLenum type, GLvoid * row, GLvoid * column, GLvoid * span);    /* 359 */
-    void (GLAPIENTRYP SeparableFilter2D) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * row, const GLvoid * column);  /* 360 */
-    void (GLAPIENTRYP GetHistogram) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid * values);      /* 361 */
-    void (GLAPIENTRYP GetHistogramParameterfv) (GLenum target, GLenum pname, GLfloat * params); /* 362 */
-    void (GLAPIENTRYP GetHistogramParameteriv) (GLenum target, GLenum pname, GLint * params);   /* 363 */
-    void (GLAPIENTRYP GetMinmax) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid * values); /* 364 */
-    void (GLAPIENTRYP GetMinmaxParameterfv) (GLenum target, GLenum pname, GLfloat * params);    /* 365 */
-    void (GLAPIENTRYP GetMinmaxParameteriv) (GLenum target, GLenum pname, GLint * params);      /* 366 */
-    void (GLAPIENTRYP Histogram) (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); /* 367 */
-    void (GLAPIENTRYP Minmax) (GLenum target, GLenum internalformat, GLboolean sink);   /* 368 */
-    void (GLAPIENTRYP ResetHistogram) (GLenum target);  /* 369 */
-    void (GLAPIENTRYP ResetMinmax) (GLenum target);     /* 370 */
-    void (GLAPIENTRYP TexImage3D) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid * pixels);    /* 371 */
-    void (GLAPIENTRYP TexSubImage3D) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid * pixels);        /* 372 */
-    void (GLAPIENTRYP CopyTexSubImage3D) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);    /* 373 */
-    void (GLAPIENTRYP ActiveTextureARB) (GLenum texture);       /* 374 */
-    void (GLAPIENTRYP ClientActiveTextureARB) (GLenum texture); /* 375 */
-    void (GLAPIENTRYP MultiTexCoord1dARB) (GLenum target, GLdouble s);  /* 376 */
-    void (GLAPIENTRYP MultiTexCoord1dvARB) (GLenum target, const GLdouble * v); /* 377 */
-    void (GLAPIENTRYP MultiTexCoord1fARB) (GLenum target, GLfloat s);   /* 378 */
-    void (GLAPIENTRYP MultiTexCoord1fvARB) (GLenum target, const GLfloat * v);  /* 379 */
-    void (GLAPIENTRYP MultiTexCoord1iARB) (GLenum target, GLint s);     /* 380 */
-    void (GLAPIENTRYP MultiTexCoord1ivARB) (GLenum target, const GLint * v);    /* 381 */
-    void (GLAPIENTRYP MultiTexCoord1sARB) (GLenum target, GLshort s);   /* 382 */
-    void (GLAPIENTRYP MultiTexCoord1svARB) (GLenum target, const GLshort * v);  /* 383 */
-    void (GLAPIENTRYP MultiTexCoord2dARB) (GLenum target, GLdouble s, GLdouble t);      /* 384 */
-    void (GLAPIENTRYP MultiTexCoord2dvARB) (GLenum target, const GLdouble * v); /* 385 */
-    void (GLAPIENTRYP MultiTexCoord2fARB) (GLenum target, GLfloat s, GLfloat t);        /* 386 */
-    void (GLAPIENTRYP MultiTexCoord2fvARB) (GLenum target, const GLfloat * v);  /* 387 */
-    void (GLAPIENTRYP MultiTexCoord2iARB) (GLenum target, GLint s, GLint t);    /* 388 */
-    void (GLAPIENTRYP MultiTexCoord2ivARB) (GLenum target, const GLint * v);    /* 389 */
-    void (GLAPIENTRYP MultiTexCoord2sARB) (GLenum target, GLshort s, GLshort t);        /* 390 */
-    void (GLAPIENTRYP MultiTexCoord2svARB) (GLenum target, const GLshort * v);  /* 391 */
-    void (GLAPIENTRYP MultiTexCoord3dARB) (GLenum target, GLdouble s, GLdouble t, GLdouble r);  /* 392 */
-    void (GLAPIENTRYP MultiTexCoord3dvARB) (GLenum target, const GLdouble * v); /* 393 */
-    void (GLAPIENTRYP MultiTexCoord3fARB) (GLenum target, GLfloat s, GLfloat t, GLfloat r);     /* 394 */
-    void (GLAPIENTRYP MultiTexCoord3fvARB) (GLenum target, const GLfloat * v);  /* 395 */
-    void (GLAPIENTRYP MultiTexCoord3iARB) (GLenum target, GLint s, GLint t, GLint r);   /* 396 */
-    void (GLAPIENTRYP MultiTexCoord3ivARB) (GLenum target, const GLint * v);    /* 397 */
-    void (GLAPIENTRYP MultiTexCoord3sARB) (GLenum target, GLshort s, GLshort t, GLshort r);     /* 398 */
-    void (GLAPIENTRYP MultiTexCoord3svARB) (GLenum target, const GLshort * v);  /* 399 */
-    void (GLAPIENTRYP MultiTexCoord4dARB) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q);      /* 400 */
-    void (GLAPIENTRYP MultiTexCoord4dvARB) (GLenum target, const GLdouble * v); /* 401 */
-    void (GLAPIENTRYP MultiTexCoord4fARB) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);  /* 402 */
-    void (GLAPIENTRYP MultiTexCoord4fvARB) (GLenum target, const GLfloat * v);  /* 403 */
-    void (GLAPIENTRYP MultiTexCoord4iARB) (GLenum target, GLint s, GLint t, GLint r, GLint q);  /* 404 */
-    void (GLAPIENTRYP MultiTexCoord4ivARB) (GLenum target, const GLint * v);    /* 405 */
-    void (GLAPIENTRYP MultiTexCoord4sARB) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q);  /* 406 */
-    void (GLAPIENTRYP MultiTexCoord4svARB) (GLenum target, const GLshort * v);  /* 407 */
-    void (GLAPIENTRYP AttachShader) (GLuint program, GLuint shader);    /* 408 */
-     GLuint(GLAPIENTRYP CreateProgram) (void);  /* 409 */
-     GLuint(GLAPIENTRYP CreateShader) (GLenum type);    /* 410 */
-    void (GLAPIENTRYP DeleteProgram) (GLuint program);  /* 411 */
-    void (GLAPIENTRYP DeleteShader) (GLuint program);   /* 412 */
-    void (GLAPIENTRYP DetachShader) (GLuint program, GLuint shader);    /* 413 */
-    void (GLAPIENTRYP GetAttachedShaders) (GLuint program, GLsizei maxCount, GLsizei * count, GLuint * obj);    /* 414 */
-    void (GLAPIENTRYP GetProgramInfoLog) (GLuint program, GLsizei bufSize, GLsizei * length, GLchar * infoLog); /* 415 */
-    void (GLAPIENTRYP GetProgramiv) (GLuint program, GLenum pname, GLint * params);     /* 416 */
-    void (GLAPIENTRYP GetShaderInfoLog) (GLuint shader, GLsizei bufSize, GLsizei * length, GLchar * infoLog);   /* 417 */
-    void (GLAPIENTRYP GetShaderiv) (GLuint shader, GLenum pname, GLint * params);       /* 418 */
-     GLboolean(GLAPIENTRYP IsProgram) (GLuint program); /* 419 */
-     GLboolean(GLAPIENTRYP IsShader) (GLuint shader);   /* 420 */
-    void (GLAPIENTRYP StencilFuncSeparate) (GLenum face, GLenum func, GLint ref, GLuint mask);  /* 421 */
-    void (GLAPIENTRYP StencilMaskSeparate) (GLenum face, GLuint mask);  /* 422 */
-    void (GLAPIENTRYP StencilOpSeparate) (GLenum face, GLenum sfail, GLenum zfail, GLenum zpass);       /* 423 */
-    void (GLAPIENTRYP UniformMatrix2x3fv) (GLint location, GLsizei count, GLboolean transpose, const GLfloat * value);  /* 424 */
-    void (GLAPIENTRYP UniformMatrix2x4fv) (GLint location, GLsizei count, GLboolean transpose, const GLfloat * value);  /* 425 */
-    void (GLAPIENTRYP UniformMatrix3x2fv) (GLint location, GLsizei count, GLboolean transpose, const GLfloat * value);  /* 426 */
-    void (GLAPIENTRYP UniformMatrix3x4fv) (GLint location, GLsizei count, GLboolean transpose, const GLfloat * value);  /* 427 */
-    void (GLAPIENTRYP UniformMatrix4x2fv) (GLint location, GLsizei count, GLboolean transpose, const GLfloat * value);  /* 428 */
-    void (GLAPIENTRYP UniformMatrix4x3fv) (GLint location, GLsizei count, GLboolean transpose, const GLfloat * value);  /* 429 */
-    void (GLAPIENTRYP ClampColor) (GLenum target, GLenum clamp);        /* 430 */
-    void (GLAPIENTRYP ClearBufferfi) (GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);   /* 431 */
-    void (GLAPIENTRYP ClearBufferfv) (GLenum buffer, GLint drawbuffer, const GLfloat * value);  /* 432 */
-    void (GLAPIENTRYP ClearBufferiv) (GLenum buffer, GLint drawbuffer, const GLint * value);    /* 433 */
-    void (GLAPIENTRYP ClearBufferuiv) (GLenum buffer, GLint drawbuffer, const GLuint * value);  /* 434 */
-    const GLubyte *(GLAPIENTRYP GetStringi) (GLenum name, GLuint index);        /* 435 */
-    void (GLAPIENTRYP TexBuffer) (GLenum target, GLenum internalFormat, GLuint buffer); /* 436 */
-    void (GLAPIENTRYP FramebufferTexture) (GLenum target, GLenum attachment, GLuint texture, GLint level);      /* 437 */
-    void (GLAPIENTRYP GetBufferParameteri64v) (GLenum target, GLenum pname, GLint64 * params);  /* 438 */
-    void (GLAPIENTRYP GetInteger64i_v) (GLenum cap, GLuint index, GLint64 * data);      /* 439 */
-    void (GLAPIENTRYP VertexAttribDivisor) (GLuint index, GLuint divisor);      /* 440 */
-    void (GLAPIENTRYP LoadTransposeMatrixdARB) (const GLdouble * m);    /* 441 */
-    void (GLAPIENTRYP LoadTransposeMatrixfARB) (const GLfloat * m);     /* 442 */
-    void (GLAPIENTRYP MultTransposeMatrixdARB) (const GLdouble * m);    /* 443 */
-    void (GLAPIENTRYP MultTransposeMatrixfARB) (const GLfloat * m);     /* 444 */
-    void (GLAPIENTRYP SampleCoverageARB) (GLclampf value, GLboolean invert);    /* 445 */
-    void (GLAPIENTRYP CompressedTexImage1DARB) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid * data);        /* 446 */
-    void (GLAPIENTRYP CompressedTexImage2DARB) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid * data);        /* 447 */
-    void (GLAPIENTRYP CompressedTexImage3DARB) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid * data); /* 448 */
-    void (GLAPIENTRYP CompressedTexSubImage1DARB) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid * data);    /* 449 */
-    void (GLAPIENTRYP CompressedTexSubImage2DARB) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid * data);     /* 450 */
-    void (GLAPIENTRYP CompressedTexSubImage3DARB) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid * data);       /* 451 */
-    void (GLAPIENTRYP GetCompressedTexImageARB) (GLenum target, GLint level, GLvoid * img);     /* 452 */
-    void (GLAPIENTRYP DisableVertexAttribArrayARB) (GLuint index);      /* 453 */
-    void (GLAPIENTRYP EnableVertexAttribArrayARB) (GLuint index);       /* 454 */
-    void (GLAPIENTRYP GetProgramEnvParameterdvARB) (GLenum target, GLuint index, GLdouble * params);    /* 455 */
-    void (GLAPIENTRYP GetProgramEnvParameterfvARB) (GLenum target, GLuint index, GLfloat * params);     /* 456 */
-    void (GLAPIENTRYP GetProgramLocalParameterdvARB) (GLenum target, GLuint index, GLdouble * params);  /* 457 */
-    void (GLAPIENTRYP GetProgramLocalParameterfvARB) (GLenum target, GLuint index, GLfloat * params);   /* 458 */
-    void (GLAPIENTRYP GetProgramStringARB) (GLenum target, GLenum pname, GLvoid * string);      /* 459 */
-    void (GLAPIENTRYP GetProgramivARB) (GLenum target, GLenum pname, GLint * params);   /* 460 */
-    void (GLAPIENTRYP GetVertexAttribdvARB) (GLuint index, GLenum pname, GLdouble * params);    /* 461 */
-    void (GLAPIENTRYP GetVertexAttribfvARB) (GLuint index, GLenum pname, GLfloat * params);     /* 462 */
-    void (GLAPIENTRYP GetVertexAttribivARB) (GLuint index, GLenum pname, GLint * params);       /* 463 */
-    void (GLAPIENTRYP ProgramEnvParameter4dARB) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);  /* 464 */
-    void (GLAPIENTRYP ProgramEnvParameter4dvARB) (GLenum target, GLuint index, const GLdouble * params);        /* 465 */
-    void (GLAPIENTRYP ProgramEnvParameter4fARB) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);      /* 466 */
-    void (GLAPIENTRYP ProgramEnvParameter4fvARB) (GLenum target, GLuint index, const GLfloat * params); /* 467 */
-    void (GLAPIENTRYP ProgramLocalParameter4dARB) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);        /* 468 */
-    void (GLAPIENTRYP ProgramLocalParameter4dvARB) (GLenum target, GLuint index, const GLdouble * params);      /* 469 */
-    void (GLAPIENTRYP ProgramLocalParameter4fARB) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);    /* 470 */
-    void (GLAPIENTRYP ProgramLocalParameter4fvARB) (GLenum target, GLuint index, const GLfloat * params);       /* 471 */
-    void (GLAPIENTRYP ProgramStringARB) (GLenum target, GLenum format, GLsizei len, const GLvoid * string);     /* 472 */
-    void (GLAPIENTRYP VertexAttrib1dARB) (GLuint index, GLdouble x);    /* 473 */
-    void (GLAPIENTRYP VertexAttrib1dvARB) (GLuint index, const GLdouble * v);   /* 474 */
-    void (GLAPIENTRYP VertexAttrib1fARB) (GLuint index, GLfloat x);     /* 475 */
-    void (GLAPIENTRYP VertexAttrib1fvARB) (GLuint index, const GLfloat * v);    /* 476 */
-    void (GLAPIENTRYP VertexAttrib1sARB) (GLuint index, GLshort x);     /* 477 */
-    void (GLAPIENTRYP VertexAttrib1svARB) (GLuint index, const GLshort * v);    /* 478 */
-    void (GLAPIENTRYP VertexAttrib2dARB) (GLuint index, GLdouble x, GLdouble y);        /* 479 */
-    void (GLAPIENTRYP VertexAttrib2dvARB) (GLuint index, const GLdouble * v);   /* 480 */
-    void (GLAPIENTRYP VertexAttrib2fARB) (GLuint index, GLfloat x, GLfloat y);  /* 481 */
-    void (GLAPIENTRYP VertexAttrib2fvARB) (GLuint index, const GLfloat * v);    /* 482 */
-    void (GLAPIENTRYP VertexAttrib2sARB) (GLuint index, GLshort x, GLshort y);  /* 483 */
-    void (GLAPIENTRYP VertexAttrib2svARB) (GLuint index, const GLshort * v);    /* 484 */
-    void (GLAPIENTRYP VertexAttrib3dARB) (GLuint index, GLdouble x, GLdouble y, GLdouble z);    /* 485 */
-    void (GLAPIENTRYP VertexAttrib3dvARB) (GLuint index, const GLdouble * v);   /* 486 */
-    void (GLAPIENTRYP VertexAttrib3fARB) (GLuint index, GLfloat x, GLfloat y, GLfloat z);       /* 487 */
-    void (GLAPIENTRYP VertexAttrib3fvARB) (GLuint index, const GLfloat * v);    /* 488 */
-    void (GLAPIENTRYP VertexAttrib3sARB) (GLuint index, GLshort x, GLshort y, GLshort z);       /* 489 */
-    void (GLAPIENTRYP VertexAttrib3svARB) (GLuint index, const GLshort * v);    /* 490 */
-    void (GLAPIENTRYP VertexAttrib4NbvARB) (GLuint index, const GLbyte * v);    /* 491 */
-    void (GLAPIENTRYP VertexAttrib4NivARB) (GLuint index, const GLint * v);     /* 492 */
-    void (GLAPIENTRYP VertexAttrib4NsvARB) (GLuint index, const GLshort * v);   /* 493 */
-    void (GLAPIENTRYP VertexAttrib4NubARB) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);  /* 494 */
-    void (GLAPIENTRYP VertexAttrib4NubvARB) (GLuint index, const GLubyte * v);  /* 495 */
-    void (GLAPIENTRYP VertexAttrib4NuivARB) (GLuint index, const GLuint * v);   /* 496 */
-    void (GLAPIENTRYP VertexAttrib4NusvARB) (GLuint index, const GLushort * v); /* 497 */
-    void (GLAPIENTRYP VertexAttrib4bvARB) (GLuint index, const GLbyte * v);     /* 498 */
-    void (GLAPIENTRYP VertexAttrib4dARB) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);        /* 499 */
-    void (GLAPIENTRYP VertexAttrib4dvARB) (GLuint index, const GLdouble * v);   /* 500 */
-    void (GLAPIENTRYP VertexAttrib4fARB) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);    /* 501 */
-    void (GLAPIENTRYP VertexAttrib4fvARB) (GLuint index, const GLfloat * v);    /* 502 */
-    void (GLAPIENTRYP VertexAttrib4ivARB) (GLuint index, const GLint * v);      /* 503 */
-    void (GLAPIENTRYP VertexAttrib4sARB) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);    /* 504 */
-    void (GLAPIENTRYP VertexAttrib4svARB) (GLuint index, const GLshort * v);    /* 505 */
-    void (GLAPIENTRYP VertexAttrib4ubvARB) (GLuint index, const GLubyte * v);   /* 506 */
-    void (GLAPIENTRYP VertexAttrib4uivARB) (GLuint index, const GLuint * v);    /* 507 */
-    void (GLAPIENTRYP VertexAttrib4usvARB) (GLuint index, const GLushort * v);  /* 508 */
-    void (GLAPIENTRYP VertexAttribPointerARB) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid * pointer);    /* 509 */
-    void (GLAPIENTRYP BindBufferARB) (GLenum target, GLuint buffer);    /* 510 */
-    void (GLAPIENTRYP BufferDataARB) (GLenum target, GLsizeiptrARB size, const GLvoid * data, GLenum usage);    /* 511 */
-    void (GLAPIENTRYP BufferSubDataARB) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid * data);   /* 512 */
-    void (GLAPIENTRYP DeleteBuffersARB) (GLsizei n, const GLuint * buffer);     /* 513 */
-    void (GLAPIENTRYP GenBuffersARB) (GLsizei n, GLuint * buffer);      /* 514 */
-    void (GLAPIENTRYP GetBufferParameterivARB) (GLenum target, GLenum pname, GLint * params);   /* 515 */
-    void (GLAPIENTRYP GetBufferPointervARB) (GLenum target, GLenum pname, GLvoid ** params);    /* 516 */
-    void (GLAPIENTRYP GetBufferSubDataARB) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, GLvoid * data);      /* 517 */
-     GLboolean(GLAPIENTRYP IsBufferARB) (GLuint buffer);        /* 518 */
-    GLvoid *(GLAPIENTRYP MapBufferARB) (GLenum target, GLenum access);  /* 519 */
-     GLboolean(GLAPIENTRYP UnmapBufferARB) (GLenum target);     /* 520 */
-    void (GLAPIENTRYP BeginQueryARB) (GLenum target, GLuint id);        /* 521 */
-    void (GLAPIENTRYP DeleteQueriesARB) (GLsizei n, const GLuint * ids);        /* 522 */
-    void (GLAPIENTRYP EndQueryARB) (GLenum target);     /* 523 */
-    void (GLAPIENTRYP GenQueriesARB) (GLsizei n, GLuint * ids); /* 524 */
-    void (GLAPIENTRYP GetQueryObjectivARB) (GLuint id, GLenum pname, GLint * params);   /* 525 */
-    void (GLAPIENTRYP GetQueryObjectuivARB) (GLuint id, GLenum pname, GLuint * params); /* 526 */
-    void (GLAPIENTRYP GetQueryivARB) (GLenum target, GLenum pname, GLint * params);     /* 527 */
-     GLboolean(GLAPIENTRYP IsQueryARB) (GLuint id);     /* 528 */
-    void (GLAPIENTRYP AttachObjectARB) (GLhandleARB containerObj, GLhandleARB obj);     /* 529 */
-    void (GLAPIENTRYP CompileShaderARB) (GLhandleARB shader);   /* 530 */
-     GLhandleARB(GLAPIENTRYP CreateProgramObjectARB) (void);    /* 531 */
-     GLhandleARB(GLAPIENTRYP CreateShaderObjectARB) (GLenum shaderType);        /* 532 */
-    void (GLAPIENTRYP DeleteObjectARB) (GLhandleARB obj);       /* 533 */
-    void (GLAPIENTRYP DetachObjectARB) (GLhandleARB containerObj, GLhandleARB attachedObj);     /* 534 */
-    void (GLAPIENTRYP GetActiveUniformARB) (GLhandleARB program, GLuint index, GLsizei bufSize, GLsizei * length, GLint * size, GLenum * type, GLcharARB * name);       /* 535 */
-    void (GLAPIENTRYP GetAttachedObjectsARB) (GLhandleARB containerObj, GLsizei maxLength, GLsizei * length, GLhandleARB * infoLog);    /* 536 */
-     GLhandleARB(GLAPIENTRYP GetHandleARB) (GLenum pname);      /* 537 */
-    void (GLAPIENTRYP GetInfoLogARB) (GLhandleARB obj, GLsizei maxLength, GLsizei * length, GLcharARB * infoLog);       /* 538 */
-    void (GLAPIENTRYP GetObjectParameterfvARB) (GLhandleARB obj, GLenum pname, GLfloat * params);       /* 539 */
-    void (GLAPIENTRYP GetObjectParameterivARB) (GLhandleARB obj, GLenum pname, GLint * params); /* 540 */
-    void (GLAPIENTRYP GetShaderSourceARB) (GLhandleARB shader, GLsizei bufSize, GLsizei * length, GLcharARB * source);  /* 541 */
-     GLint(GLAPIENTRYP GetUniformLocationARB) (GLhandleARB program, const GLcharARB * name);    /* 542 */
-    void (GLAPIENTRYP GetUniformfvARB) (GLhandleARB program, GLint location, GLfloat * params); /* 543 */
-    void (GLAPIENTRYP GetUniformivARB) (GLhandleARB program, GLint location, GLint * params);   /* 544 */
-    void (GLAPIENTRYP LinkProgramARB) (GLhandleARB program);    /* 545 */
-    void (GLAPIENTRYP ShaderSourceARB) (GLhandleARB shader, GLsizei count, const GLcharARB ** string, const GLint * length);    /* 546 */
-    void (GLAPIENTRYP Uniform1fARB) (GLint location, GLfloat v0);       /* 547 */
-    void (GLAPIENTRYP Uniform1fvARB) (GLint location, GLsizei count, const GLfloat * value);    /* 548 */
-    void (GLAPIENTRYP Uniform1iARB) (GLint location, GLint v0); /* 549 */
-    void (GLAPIENTRYP Uniform1ivARB) (GLint location, GLsizei count, const GLint * value);      /* 550 */
-    void (GLAPIENTRYP Uniform2fARB) (GLint location, GLfloat v0, GLfloat v1);   /* 551 */
-    void (GLAPIENTRYP Uniform2fvARB) (GLint location, GLsizei count, const GLfloat * value);    /* 552 */
-    void (GLAPIENTRYP Uniform2iARB) (GLint location, GLint v0, GLint v1);       /* 553 */
-    void (GLAPIENTRYP Uniform2ivARB) (GLint location, GLsizei count, const GLint * value);      /* 554 */
-    void (GLAPIENTRYP Uniform3fARB) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);       /* 555 */
-    void (GLAPIENTRYP Uniform3fvARB) (GLint location, GLsizei count, const GLfloat * value);    /* 556 */
-    void (GLAPIENTRYP Uniform3iARB) (GLint location, GLint v0, GLint v1, GLint v2);     /* 557 */
-    void (GLAPIENTRYP Uniform3ivARB) (GLint location, GLsizei count, const GLint * value);      /* 558 */
-    void (GLAPIENTRYP Uniform4fARB) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);   /* 559 */
-    void (GLAPIENTRYP Uniform4fvARB) (GLint location, GLsizei count, const GLfloat * value);    /* 560 */
-    void (GLAPIENTRYP Uniform4iARB) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);   /* 561 */
-    void (GLAPIENTRYP Uniform4ivARB) (GLint location, GLsizei count, const GLint * value);      /* 562 */
-    void (GLAPIENTRYP UniformMatrix2fvARB) (GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); /* 563 */
-    void (GLAPIENTRYP UniformMatrix3fvARB) (GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); /* 564 */
-    void (GLAPIENTRYP UniformMatrix4fvARB) (GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); /* 565 */
-    void (GLAPIENTRYP UseProgramObjectARB) (GLhandleARB program);       /* 566 */
-    void (GLAPIENTRYP ValidateProgramARB) (GLhandleARB program);        /* 567 */
-    void (GLAPIENTRYP BindAttribLocationARB) (GLhandleARB program, GLuint index, const GLcharARB * name);       /* 568 */
-    void (GLAPIENTRYP GetActiveAttribARB) (GLhandleARB program, GLuint index, GLsizei bufSize, GLsizei * length, GLint * size, GLenum * type, GLcharARB * name);        /* 569 */
-     GLint(GLAPIENTRYP GetAttribLocationARB) (GLhandleARB program, const GLcharARB * name);     /* 570 */
-    void (GLAPIENTRYP DrawBuffersARB) (GLsizei n, const GLenum * bufs); /* 571 */
-    void (GLAPIENTRYP ClampColorARB) (GLenum target, GLenum clamp);     /* 572 */
-    void (GLAPIENTRYP DrawArraysInstancedARB) (GLenum mode, GLint first, GLsizei count, GLsizei primcount);     /* 573 */
-    void (GLAPIENTRYP DrawElementsInstancedARB) (GLenum mode, GLsizei count, GLenum type, const GLvoid * indices, GLsizei primcount);   /* 574 */
-    void (GLAPIENTRYP RenderbufferStorageMultisample) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);   /* 575 */
-    void (GLAPIENTRYP FramebufferTextureARB) (GLenum target, GLenum attachment, GLuint texture, GLint level);   /* 576 */
-    void (GLAPIENTRYP FramebufferTextureFaceARB) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face);  /* 577 */
-    void (GLAPIENTRYP ProgramParameteriARB) (GLuint program, GLenum pname, GLint value);        /* 578 */
-    void (GLAPIENTRYP VertexAttribDivisorARB) (GLuint index, GLuint divisor);   /* 579 */
-    void (GLAPIENTRYP FlushMappedBufferRange) (GLenum target, GLintptr offset, GLsizeiptr length);      /* 580 */
-    GLvoid *(GLAPIENTRYP MapBufferRange) (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);        /* 581 */
-    void (GLAPIENTRYP TexBufferARB) (GLenum target, GLenum internalFormat, GLuint buffer);      /* 582 */
-    void (GLAPIENTRYP BindVertexArray) (GLuint array);  /* 583 */
-    void (GLAPIENTRYP GenVertexArrays) (GLsizei n, GLuint * arrays);    /* 584 */
-    void (GLAPIENTRYP CopyBufferSubData) (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);   /* 585 */
-     GLenum(GLAPIENTRYP ClientWaitSync) (GLsync sync, GLbitfield flags, GLuint64 timeout);      /* 586 */
-    void (GLAPIENTRYP DeleteSync) (GLsync sync);        /* 587 */
-     GLsync(GLAPIENTRYP FenceSync) (GLenum condition, GLbitfield flags);        /* 588 */
-    void (GLAPIENTRYP GetInteger64v) (GLenum pname, GLint64 * params);  /* 589 */
-    void (GLAPIENTRYP GetSynciv) (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * values);        /* 590 */
-     GLboolean(GLAPIENTRYP IsSync) (GLsync sync);       /* 591 */
-    void (GLAPIENTRYP WaitSync) (GLsync sync, GLbitfield flags, GLuint64 timeout);      /* 592 */
-    void (GLAPIENTRYP DrawElementsBaseVertex) (GLenum mode, GLsizei count, GLenum type, const GLvoid * indices, GLint basevertex);      /* 593 */
-    void (GLAPIENTRYP DrawElementsInstancedBaseVertex) (GLenum mode, GLsizei count, GLenum type, const GLvoid * indices, GLsizei primcount, GLint basevertex);  /* 594 */
-    void (GLAPIENTRYP DrawRangeElementsBaseVertex) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid * indices, GLint basevertex);       /* 595 */
-    void (GLAPIENTRYP MultiDrawElementsBaseVertex) (GLenum mode, const GLsizei * count, GLenum type, const GLvoid ** indices, GLsizei primcount, const GLint * basevertex);     /* 596 */
-    void (GLAPIENTRYP BlendEquationSeparateiARB) (GLuint buf, GLenum modeRGB, GLenum modeA);    /* 597 */
-    void (GLAPIENTRYP BlendEquationiARB) (GLuint buf, GLenum mode);     /* 598 */
-    void (GLAPIENTRYP BlendFuncSeparateiARB) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcA, GLenum dstA);      /* 599 */
-    void (GLAPIENTRYP BlendFunciARB) (GLuint buf, GLenum src, GLenum dst);      /* 600 */
-    void (GLAPIENTRYP BindSampler) (GLuint unit, GLuint sampler);       /* 601 */
-    void (GLAPIENTRYP DeleteSamplers) (GLsizei count, const GLuint * samplers); /* 602 */
-    void (GLAPIENTRYP GenSamplers) (GLsizei count, GLuint * samplers);  /* 603 */
-    void (GLAPIENTRYP GetSamplerParameterIiv) (GLuint sampler, GLenum pname, GLint * params);   /* 604 */
-    void (GLAPIENTRYP GetSamplerParameterIuiv) (GLuint sampler, GLenum pname, GLuint * params); /* 605 */
-    void (GLAPIENTRYP GetSamplerParameterfv) (GLuint sampler, GLenum pname, GLfloat * params);  /* 606 */
-    void (GLAPIENTRYP GetSamplerParameteriv) (GLuint sampler, GLenum pname, GLint * params);    /* 607 */
-     GLboolean(GLAPIENTRYP IsSampler) (GLuint sampler); /* 608 */
-    void (GLAPIENTRYP SamplerParameterIiv) (GLuint sampler, GLenum pname, const GLint * params);        /* 609 */
-    void (GLAPIENTRYP SamplerParameterIuiv) (GLuint sampler, GLenum pname, const GLuint * params);      /* 610 */
-    void (GLAPIENTRYP SamplerParameterf) (GLuint sampler, GLenum pname, GLfloat param); /* 611 */
-    void (GLAPIENTRYP SamplerParameterfv) (GLuint sampler, GLenum pname, const GLfloat * params);       /* 612 */
-    void (GLAPIENTRYP SamplerParameteri) (GLuint sampler, GLenum pname, GLint param);   /* 613 */
-    void (GLAPIENTRYP SamplerParameteriv) (GLuint sampler, GLenum pname, const GLint * params); /* 614 */
-    void (GLAPIENTRYP ColorP3ui) (GLenum type, GLuint color);   /* 615 */
-    void (GLAPIENTRYP ColorP3uiv) (GLenum type, const GLuint * color);  /* 616 */
-    void (GLAPIENTRYP ColorP4ui) (GLenum type, GLuint color);   /* 617 */
-    void (GLAPIENTRYP ColorP4uiv) (GLenum type, const GLuint * color);  /* 618 */
-    void (GLAPIENTRYP MultiTexCoordP1ui) (GLenum texture, GLenum type, GLuint coords);  /* 619 */
-    void (GLAPIENTRYP MultiTexCoordP1uiv) (GLenum texture, GLenum type, const GLuint * coords); /* 620 */
-    void (GLAPIENTRYP MultiTexCoordP2ui) (GLenum texture, GLenum type, GLuint coords);  /* 621 */
-    void (GLAPIENTRYP MultiTexCoordP2uiv) (GLenum texture, GLenum type, const GLuint * coords); /* 622 */
-    void (GLAPIENTRYP MultiTexCoordP3ui) (GLenum texture, GLenum type, GLuint coords);  /* 623 */
-    void (GLAPIENTRYP MultiTexCoordP3uiv) (GLenum texture, GLenum type, const GLuint * coords); /* 624 */
-    void (GLAPIENTRYP MultiTexCoordP4ui) (GLenum texture, GLenum type, GLuint coords);  /* 625 */
-    void (GLAPIENTRYP MultiTexCoordP4uiv) (GLenum texture, GLenum type, const GLuint * coords); /* 626 */
-    void (GLAPIENTRYP NormalP3ui) (GLenum type, GLuint coords); /* 627 */
-    void (GLAPIENTRYP NormalP3uiv) (GLenum type, const GLuint * coords);        /* 628 */
-    void (GLAPIENTRYP SecondaryColorP3ui) (GLenum type, GLuint color);  /* 629 */
-    void (GLAPIENTRYP SecondaryColorP3uiv) (GLenum type, const GLuint * color); /* 630 */
-    void (GLAPIENTRYP TexCoordP1ui) (GLenum type, GLuint coords);       /* 631 */
-    void (GLAPIENTRYP TexCoordP1uiv) (GLenum type, const GLuint * coords);      /* 632 */
-    void (GLAPIENTRYP TexCoordP2ui) (GLenum type, GLuint coords);       /* 633 */
-    void (GLAPIENTRYP TexCoordP2uiv) (GLenum type, const GLuint * coords);      /* 634 */
-    void (GLAPIENTRYP TexCoordP3ui) (GLenum type, GLuint coords);       /* 635 */
-    void (GLAPIENTRYP TexCoordP3uiv) (GLenum type, const GLuint * coords);      /* 636 */
-    void (GLAPIENTRYP TexCoordP4ui) (GLenum type, GLuint coords);       /* 637 */
-    void (GLAPIENTRYP TexCoordP4uiv) (GLenum type, const GLuint * coords);      /* 638 */
-    void (GLAPIENTRYP VertexAttribP1ui) (GLuint index, GLenum type, GLboolean normalized, GLuint value);        /* 639 */
-    void (GLAPIENTRYP VertexAttribP1uiv) (GLuint index, GLenum type, GLboolean normalized, const GLuint * value);       /* 640 */
-    void (GLAPIENTRYP VertexAttribP2ui) (GLuint index, GLenum type, GLboolean normalized, GLuint value);        /* 641 */
-    void (GLAPIENTRYP VertexAttribP2uiv) (GLuint index, GLenum type, GLboolean normalized, const GLuint * value);       /* 642 */
-    void (GLAPIENTRYP VertexAttribP3ui) (GLuint index, GLenum type, GLboolean normalized, GLuint value);        /* 643 */
-    void (GLAPIENTRYP VertexAttribP3uiv) (GLuint index, GLenum type, GLboolean normalized, const GLuint * value);       /* 644 */
-    void (GLAPIENTRYP VertexAttribP4ui) (GLuint index, GLenum type, GLboolean normalized, GLuint value);        /* 645 */
-    void (GLAPIENTRYP VertexAttribP4uiv) (GLuint index, GLenum type, GLboolean normalized, const GLuint * value);       /* 646 */
-    void (GLAPIENTRYP VertexP2ui) (GLenum type, GLuint value);  /* 647 */
-    void (GLAPIENTRYP VertexP2uiv) (GLenum type, const GLuint * value); /* 648 */
-    void (GLAPIENTRYP VertexP3ui) (GLenum type, GLuint value);  /* 649 */
-    void (GLAPIENTRYP VertexP3uiv) (GLenum type, const GLuint * value); /* 650 */
-    void (GLAPIENTRYP VertexP4ui) (GLenum type, GLuint value);  /* 651 */
-    void (GLAPIENTRYP VertexP4uiv) (GLenum type, const GLuint * value); /* 652 */
-    void (GLAPIENTRYP BindTransformFeedback) (GLenum target, GLuint id);        /* 653 */
-    void (GLAPIENTRYP DeleteTransformFeedbacks) (GLsizei n, const GLuint * ids);        /* 654 */
-    void (GLAPIENTRYP DrawTransformFeedback) (GLenum mode, GLuint id);  /* 655 */
-    void (GLAPIENTRYP GenTransformFeedbacks) (GLsizei n, GLuint * ids); /* 656 */
-     GLboolean(GLAPIENTRYP IsTransformFeedback) (GLuint id);    /* 657 */
-    void (GLAPIENTRYP PauseTransformFeedback) (void);   /* 658 */
-    void (GLAPIENTRYP ResumeTransformFeedback) (void);  /* 659 */
-    void (GLAPIENTRYP ClearDepthf) (GLclampf depth);    /* 660 */
-    void (GLAPIENTRYP DepthRangef) (GLclampf zNear, GLclampf zFar);     /* 661 */
-    void (GLAPIENTRYP GetShaderPrecisionFormat) (GLenum shadertype, GLenum precisiontype, GLint * range, GLint * precision);    /* 662 */
-    void (GLAPIENTRYP ReleaseShaderCompiler) (void);    /* 663 */
-    void (GLAPIENTRYP ShaderBinary) (GLsizei n, const GLuint * shaders, GLenum binaryformat, const GLvoid * binary, GLsizei length);    /* 664 */
-     GLenum(GLAPIENTRYP GetGraphicsResetStatusARB) (void);      /* 665 */
-    void (GLAPIENTRYP GetnColorTableARB) (GLenum target, GLenum format, GLenum type, GLsizei bufSize, GLvoid * table);  /* 666 */
-    void (GLAPIENTRYP GetnCompressedTexImageARB) (GLenum target, GLint lod, GLsizei bufSize, GLvoid * img);     /* 667 */
-    void (GLAPIENTRYP GetnConvolutionFilterARB) (GLenum target, GLenum format, GLenum type, GLsizei bufSize, GLvoid * image);   /* 668 */
-    void (GLAPIENTRYP GetnHistogramARB) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, GLvoid * values); /* 669 */
-    void (GLAPIENTRYP GetnMapdvARB) (GLenum target, GLenum query, GLsizei bufSize, GLdouble * v);       /* 670 */
-    void (GLAPIENTRYP GetnMapfvARB) (GLenum target, GLenum query, GLsizei bufSize, GLfloat * v);        /* 671 */
-    void (GLAPIENTRYP GetnMapivARB) (GLenum target, GLenum query, GLsizei bufSize, GLint * v);  /* 672 */
-    void (GLAPIENTRYP GetnMinmaxARB) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, GLvoid * values);    /* 673 */
-    void (GLAPIENTRYP GetnPixelMapfvARB) (GLenum map, GLsizei bufSize, GLfloat * values);       /* 674 */
-    void (GLAPIENTRYP GetnPixelMapuivARB) (GLenum map, GLsizei bufSize, GLuint * values);       /* 675 */
-    void (GLAPIENTRYP GetnPixelMapusvARB) (GLenum map, GLsizei bufSize, GLushort * values);     /* 676 */
-    void (GLAPIENTRYP GetnPolygonStippleARB) (GLsizei bufSize, GLubyte * pattern);      /* 677 */
-    void (GLAPIENTRYP GetnSeparableFilterARB) (GLenum target, GLenum format, GLenum type, GLsizei rowBufSize, GLvoid * row, GLsizei columnBufSize, GLvoid * column, GLvoid * span);     /* 678 */
-    void (GLAPIENTRYP GetnTexImageARB) (GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, GLvoid * img); /* 679 */
-    void (GLAPIENTRYP GetnUniformdvARB) (GLhandleARB program, GLint location, GLsizei bufSize, GLdouble * params);      /* 680 */
-    void (GLAPIENTRYP GetnUniformfvARB) (GLhandleARB program, GLint location, GLsizei bufSize, GLfloat * params);       /* 681 */
-    void (GLAPIENTRYP GetnUniformivARB) (GLhandleARB program, GLint location, GLsizei bufSize, GLint * params); /* 682 */
-    void (GLAPIENTRYP GetnUniformuivARB) (GLhandleARB program, GLint location, GLsizei bufSize, GLuint * params);       /* 683 */
-    void (GLAPIENTRYP ReadnPixelsARB) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, GLvoid * data);    /* 684 */
-    void (GLAPIENTRYP TexStorage1D) (GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width);      /* 685 */
-    void (GLAPIENTRYP TexStorage2D) (GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height);      /* 686 */
-    void (GLAPIENTRYP TexStorage3D) (GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth);       /* 687 */
-    void (GLAPIENTRYP TextureStorage1DEXT) (GLuint texture, GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width);       /* 688 */
-    void (GLAPIENTRYP TextureStorage2DEXT) (GLuint texture, GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height);       /* 689 */
-    void (GLAPIENTRYP TextureStorage3DEXT) (GLuint texture, GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth);        /* 690 */
-    void (GLAPIENTRYP PolygonOffsetEXT) (GLfloat factor, GLfloat bias); /* 691 */
-    void (GLAPIENTRYP GetPixelTexGenParameterfvSGIS) (GLenum pname, GLfloat * params);  /* 692 */
-    void (GLAPIENTRYP GetPixelTexGenParameterivSGIS) (GLenum pname, GLint * params);    /* 693 */
-    void (GLAPIENTRYP PixelTexGenParameterfSGIS) (GLenum pname, GLfloat param); /* 694 */
-    void (GLAPIENTRYP PixelTexGenParameterfvSGIS) (GLenum pname, const GLfloat * params);       /* 695 */
-    void (GLAPIENTRYP PixelTexGenParameteriSGIS) (GLenum pname, GLint param);   /* 696 */
-    void (GLAPIENTRYP PixelTexGenParameterivSGIS) (GLenum pname, const GLint * params); /* 697 */
-    void (GLAPIENTRYP SampleMaskSGIS) (GLclampf value, GLboolean invert);       /* 698 */
-    void (GLAPIENTRYP SamplePatternSGIS) (GLenum pattern);      /* 699 */
-    void (GLAPIENTRYP ColorPointerEXT) (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer);        /* 700 */
-    void (GLAPIENTRYP EdgeFlagPointerEXT) (GLsizei stride, GLsizei count, const GLboolean * pointer);   /* 701 */
-    void (GLAPIENTRYP IndexPointerEXT) (GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer);    /* 702 */
-    void (GLAPIENTRYP NormalPointerEXT) (GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer);   /* 703 */
-    void (GLAPIENTRYP TexCoordPointerEXT) (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer);     /* 704 */
-    void (GLAPIENTRYP VertexPointerEXT) (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer);       /* 705 */
-    void (GLAPIENTRYP PointParameterfEXT) (GLenum pname, GLfloat param);        /* 706 */
-    void (GLAPIENTRYP PointParameterfvEXT) (GLenum pname, const GLfloat * params);      /* 707 */
-    void (GLAPIENTRYP LockArraysEXT) (GLint first, GLsizei count);      /* 708 */
-    void (GLAPIENTRYP UnlockArraysEXT) (void);  /* 709 */
-    void (GLAPIENTRYP SecondaryColor3bEXT) (GLbyte red, GLbyte green, GLbyte blue);     /* 710 */
-    void (GLAPIENTRYP SecondaryColor3bvEXT) (const GLbyte * v); /* 711 */
-    void (GLAPIENTRYP SecondaryColor3dEXT) (GLdouble red, GLdouble green, GLdouble blue);       /* 712 */
-    void (GLAPIENTRYP SecondaryColor3dvEXT) (const GLdouble * v);       /* 713 */
-    void (GLAPIENTRYP SecondaryColor3fEXT) (GLfloat red, GLfloat green, GLfloat blue);  /* 714 */
-    void (GLAPIENTRYP SecondaryColor3fvEXT) (const GLfloat * v);        /* 715 */
-    void (GLAPIENTRYP SecondaryColor3iEXT) (GLint red, GLint green, GLint blue);        /* 716 */
-    void (GLAPIENTRYP SecondaryColor3ivEXT) (const GLint * v);  /* 717 */
-    void (GLAPIENTRYP SecondaryColor3sEXT) (GLshort red, GLshort green, GLshort blue);  /* 718 */
-    void (GLAPIENTRYP SecondaryColor3svEXT) (const GLshort * v);        /* 719 */
-    void (GLAPIENTRYP SecondaryColor3ubEXT) (GLubyte red, GLubyte green, GLubyte blue); /* 720 */
-    void (GLAPIENTRYP SecondaryColor3ubvEXT) (const GLubyte * v);       /* 721 */
-    void (GLAPIENTRYP SecondaryColor3uiEXT) (GLuint red, GLuint green, GLuint blue);    /* 722 */
-    void (GLAPIENTRYP SecondaryColor3uivEXT) (const GLuint * v);        /* 723 */
-    void (GLAPIENTRYP SecondaryColor3usEXT) (GLushort red, GLushort green, GLushort blue);      /* 724 */
-    void (GLAPIENTRYP SecondaryColor3usvEXT) (const GLushort * v);      /* 725 */
-    void (GLAPIENTRYP SecondaryColorPointerEXT) (GLint size, GLenum type, GLsizei stride, const GLvoid * pointer);      /* 726 */
-    void (GLAPIENTRYP MultiDrawArraysEXT) (GLenum mode, const GLint * first, const GLsizei * count, GLsizei primcount); /* 727 */
-    void (GLAPIENTRYP MultiDrawElementsEXT) (GLenum mode, const GLsizei * count, GLenum type, const GLvoid ** indices, GLsizei primcount);      /* 728 */
-    void (GLAPIENTRYP FogCoordPointerEXT) (GLenum type, GLsizei stride, const GLvoid * pointer);        /* 729 */
-    void (GLAPIENTRYP FogCoorddEXT) (GLdouble coord);   /* 730 */
-    void (GLAPIENTRYP FogCoorddvEXT) (const GLdouble * coord);  /* 731 */
-    void (GLAPIENTRYP FogCoordfEXT) (GLfloat coord);    /* 732 */
-    void (GLAPIENTRYP FogCoordfvEXT) (const GLfloat * coord);   /* 733 */
-    void (GLAPIENTRYP PixelTexGenSGIX) (GLenum mode);   /* 734 */
-    void (GLAPIENTRYP BlendFuncSeparateEXT) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);   /* 735 */
-    void (GLAPIENTRYP FlushVertexArrayRangeNV) (void);  /* 736 */
-    void (GLAPIENTRYP VertexArrayRangeNV) (GLsizei length, const GLvoid * pointer);     /* 737 */
-    void (GLAPIENTRYP CombinerInputNV) (GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage);    /* 738 */
-    void (GLAPIENTRYP CombinerOutputNV) (GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum);        /* 739 */
-    void (GLAPIENTRYP CombinerParameterfNV) (GLenum pname, GLfloat param);      /* 740 */
-    void (GLAPIENTRYP CombinerParameterfvNV) (GLenum pname, const GLfloat * params);    /* 741 */
-    void (GLAPIENTRYP CombinerParameteriNV) (GLenum pname, GLint param);        /* 742 */
-    void (GLAPIENTRYP CombinerParameterivNV) (GLenum pname, const GLint * params);      /* 743 */
-    void (GLAPIENTRYP FinalCombinerInputNV) (GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage);     /* 744 */
-    void (GLAPIENTRYP GetCombinerInputParameterfvNV) (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLfloat * params);   /* 745 */
-    void (GLAPIENTRYP GetCombinerInputParameterivNV) (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLint * params);     /* 746 */
-    void (GLAPIENTRYP GetCombinerOutputParameterfvNV) (GLenum stage, GLenum portion, GLenum pname, GLfloat * params);   /* 747 */
-    void (GLAPIENTRYP GetCombinerOutputParameterivNV) (GLenum stage, GLenum portion, GLenum pname, GLint * params);     /* 748 */
-    void (GLAPIENTRYP GetFinalCombinerInputParameterfvNV) (GLenum variable, GLenum pname, GLfloat * params);    /* 749 */
-    void (GLAPIENTRYP GetFinalCombinerInputParameterivNV) (GLenum variable, GLenum pname, GLint * params);      /* 750 */
-    void (GLAPIENTRYP ResizeBuffersMESA) (void);        /* 751 */
-    void (GLAPIENTRYP WindowPos2dMESA) (GLdouble x, GLdouble y);        /* 752 */
-    void (GLAPIENTRYP WindowPos2dvMESA) (const GLdouble * v);   /* 753 */
-    void (GLAPIENTRYP WindowPos2fMESA) (GLfloat x, GLfloat y);  /* 754 */
-    void (GLAPIENTRYP WindowPos2fvMESA) (const GLfloat * v);    /* 755 */
-    void (GLAPIENTRYP WindowPos2iMESA) (GLint x, GLint y);      /* 756 */
-    void (GLAPIENTRYP WindowPos2ivMESA) (const GLint * v);      /* 757 */
-    void (GLAPIENTRYP WindowPos2sMESA) (GLshort x, GLshort y);  /* 758 */
-    void (GLAPIENTRYP WindowPos2svMESA) (const GLshort * v);    /* 759 */
-    void (GLAPIENTRYP WindowPos3dMESA) (GLdouble x, GLdouble y, GLdouble z);    /* 760 */
-    void (GLAPIENTRYP WindowPos3dvMESA) (const GLdouble * v);   /* 761 */
-    void (GLAPIENTRYP WindowPos3fMESA) (GLfloat x, GLfloat y, GLfloat z);       /* 762 */
-    void (GLAPIENTRYP WindowPos3fvMESA) (const GLfloat * v);    /* 763 */
-    void (GLAPIENTRYP WindowPos3iMESA) (GLint x, GLint y, GLint z);     /* 764 */
-    void (GLAPIENTRYP WindowPos3ivMESA) (const GLint * v);      /* 765 */
-    void (GLAPIENTRYP WindowPos3sMESA) (GLshort x, GLshort y, GLshort z);       /* 766 */
-    void (GLAPIENTRYP WindowPos3svMESA) (const GLshort * v);    /* 767 */
-    void (GLAPIENTRYP WindowPos4dMESA) (GLdouble x, GLdouble y, GLdouble z, GLdouble w);        /* 768 */
-    void (GLAPIENTRYP WindowPos4dvMESA) (const GLdouble * v);   /* 769 */
-    void (GLAPIENTRYP WindowPos4fMESA) (GLfloat x, GLfloat y, GLfloat z, GLfloat w);    /* 770 */
-    void (GLAPIENTRYP WindowPos4fvMESA) (const GLfloat * v);    /* 771 */
-    void (GLAPIENTRYP WindowPos4iMESA) (GLint x, GLint y, GLint z, GLint w);    /* 772 */
-    void (GLAPIENTRYP WindowPos4ivMESA) (const GLint * v);      /* 773 */
-    void (GLAPIENTRYP WindowPos4sMESA) (GLshort x, GLshort y, GLshort z, GLshort w);    /* 774 */
-    void (GLAPIENTRYP WindowPos4svMESA) (const GLshort * v);    /* 775 */
-    void (GLAPIENTRYP MultiModeDrawArraysIBM) (const GLenum * mode, const GLint * first, const GLsizei * count, GLsizei primcount, GLint modestride);   /* 776 */
-    void (GLAPIENTRYP MultiModeDrawElementsIBM) (const GLenum * mode, const GLsizei * count, GLenum type, const GLvoid * const *indices, GLsizei primcount, GLint modestride);  /* 777 */
-    void (GLAPIENTRYP DeleteFencesNV) (GLsizei n, const GLuint * fences);       /* 778 */
-    void (GLAPIENTRYP FinishFenceNV) (GLuint fence);    /* 779 */
-    void (GLAPIENTRYP GenFencesNV) (GLsizei n, GLuint * fences);        /* 780 */
-    void (GLAPIENTRYP GetFenceivNV) (GLuint fence, GLenum pname, GLint * params);       /* 781 */
-     GLboolean(GLAPIENTRYP IsFenceNV) (GLuint fence);   /* 782 */
-    void (GLAPIENTRYP SetFenceNV) (GLuint fence, GLenum condition);     /* 783 */
-     GLboolean(GLAPIENTRYP TestFenceNV) (GLuint fence); /* 784 */
-     GLboolean(GLAPIENTRYP AreProgramsResidentNV) (GLsizei n, const GLuint * ids, GLboolean * residences);      /* 785 */
-    void (GLAPIENTRYP BindProgramNV) (GLenum target, GLuint program);   /* 786 */
-    void (GLAPIENTRYP DeleteProgramsNV) (GLsizei n, const GLuint * programs);   /* 787 */
-    void (GLAPIENTRYP ExecuteProgramNV) (GLenum target, GLuint id, const GLfloat * params);     /* 788 */
-    void (GLAPIENTRYP GenProgramsNV) (GLsizei n, GLuint * programs);    /* 789 */
-    void (GLAPIENTRYP GetProgramParameterdvNV) (GLenum target, GLuint index, GLenum pname, GLdouble * params);  /* 790 */
-    void (GLAPIENTRYP GetProgramParameterfvNV) (GLenum target, GLuint index, GLenum pname, GLfloat * params);   /* 791 */
-    void (GLAPIENTRYP GetProgramStringNV) (GLuint id, GLenum pname, GLubyte * program); /* 792 */
-    void (GLAPIENTRYP GetProgramivNV) (GLuint id, GLenum pname, GLint * params);        /* 793 */
-    void (GLAPIENTRYP GetTrackMatrixivNV) (GLenum target, GLuint address, GLenum pname, GLint * params);        /* 794 */
-    void (GLAPIENTRYP GetVertexAttribPointervNV) (GLuint index, GLenum pname, GLvoid ** pointer);       /* 795 */
-    void (GLAPIENTRYP GetVertexAttribdvNV) (GLuint index, GLenum pname, GLdouble * params);     /* 796 */
-    void (GLAPIENTRYP GetVertexAttribfvNV) (GLuint index, GLenum pname, GLfloat * params);      /* 797 */
-    void (GLAPIENTRYP GetVertexAttribivNV) (GLuint index, GLenum pname, GLint * params);        /* 798 */
-     GLboolean(GLAPIENTRYP IsProgramNV) (GLuint program);       /* 799 */
-    void (GLAPIENTRYP LoadProgramNV) (GLenum target, GLuint id, GLsizei len, const GLubyte * program);  /* 800 */
-    void (GLAPIENTRYP ProgramParameters4dvNV) (GLenum target, GLuint index, GLsizei num, const GLdouble * params);      /* 801 */
-    void (GLAPIENTRYP ProgramParameters4fvNV) (GLenum target, GLuint index, GLsizei num, const GLfloat * params);       /* 802 */
-    void (GLAPIENTRYP RequestResidentProgramsNV) (GLsizei n, const GLuint * ids);       /* 803 */
-    void (GLAPIENTRYP TrackMatrixNV) (GLenum target, GLuint address, GLenum matrix, GLenum transform);  /* 804 */
-    void (GLAPIENTRYP VertexAttrib1dNV) (GLuint index, GLdouble x);     /* 805 */
-    void (GLAPIENTRYP VertexAttrib1dvNV) (GLuint index, const GLdouble * v);    /* 806 */
-    void (GLAPIENTRYP VertexAttrib1fNV) (GLuint index, GLfloat x);      /* 807 */
-    void (GLAPIENTRYP VertexAttrib1fvNV) (GLuint index, const GLfloat * v);     /* 808 */
-    void (GLAPIENTRYP VertexAttrib1sNV) (GLuint index, GLshort x);      /* 809 */
-    void (GLAPIENTRYP VertexAttrib1svNV) (GLuint index, const GLshort * v);     /* 810 */
-    void (GLAPIENTRYP VertexAttrib2dNV) (GLuint index, GLdouble x, GLdouble y); /* 811 */
-    void (GLAPIENTRYP VertexAttrib2dvNV) (GLuint index, const GLdouble * v);    /* 812 */
-    void (GLAPIENTRYP VertexAttrib2fNV) (GLuint index, GLfloat x, GLfloat y);   /* 813 */
-    void (GLAPIENTRYP VertexAttrib2fvNV) (GLuint index, const GLfloat * v);     /* 814 */
-    void (GLAPIENTRYP VertexAttrib2sNV) (GLuint index, GLshort x, GLshort y);   /* 815 */
-    void (GLAPIENTRYP VertexAttrib2svNV) (GLuint index, const GLshort * v);     /* 816 */
-    void (GLAPIENTRYP VertexAttrib3dNV) (GLuint index, GLdouble x, GLdouble y, GLdouble z);     /* 817 */
-    void (GLAPIENTRYP VertexAttrib3dvNV) (GLuint index, const GLdouble * v);    /* 818 */
-    void (GLAPIENTRYP VertexAttrib3fNV) (GLuint index, GLfloat x, GLfloat y, GLfloat z);        /* 819 */
-    void (GLAPIENTRYP VertexAttrib3fvNV) (GLuint index, const GLfloat * v);     /* 820 */
-    void (GLAPIENTRYP VertexAttrib3sNV) (GLuint index, GLshort x, GLshort y, GLshort z);        /* 821 */
-    void (GLAPIENTRYP VertexAttrib3svNV) (GLuint index, const GLshort * v);     /* 822 */
-    void (GLAPIENTRYP VertexAttrib4dNV) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 823 */
-    void (GLAPIENTRYP VertexAttrib4dvNV) (GLuint index, const GLdouble * v);    /* 824 */
-    void (GLAPIENTRYP VertexAttrib4fNV) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);     /* 825 */
-    void (GLAPIENTRYP VertexAttrib4fvNV) (GLuint index, const GLfloat * v);     /* 826 */
-    void (GLAPIENTRYP VertexAttrib4sNV) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);     /* 827 */
-    void (GLAPIENTRYP VertexAttrib4svNV) (GLuint index, const GLshort * v);     /* 828 */
-    void (GLAPIENTRYP VertexAttrib4ubNV) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);    /* 829 */
-    void (GLAPIENTRYP VertexAttrib4ubvNV) (GLuint index, const GLubyte * v);    /* 830 */
-    void (GLAPIENTRYP VertexAttribPointerNV) (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid * pointer);   /* 831 */
-    void (GLAPIENTRYP VertexAttribs1dvNV) (GLuint index, GLsizei n, const GLdouble * v);        /* 832 */
-    void (GLAPIENTRYP VertexAttribs1fvNV) (GLuint index, GLsizei n, const GLfloat * v); /* 833 */
-    void (GLAPIENTRYP VertexAttribs1svNV) (GLuint index, GLsizei n, const GLshort * v); /* 834 */
-    void (GLAPIENTRYP VertexAttribs2dvNV) (GLuint index, GLsizei n, const GLdouble * v);        /* 835 */
-    void (GLAPIENTRYP VertexAttribs2fvNV) (GLuint index, GLsizei n, const GLfloat * v); /* 836 */
-    void (GLAPIENTRYP VertexAttribs2svNV) (GLuint index, GLsizei n, const GLshort * v); /* 837 */
-    void (GLAPIENTRYP VertexAttribs3dvNV) (GLuint index, GLsizei n, const GLdouble * v);        /* 838 */
-    void (GLAPIENTRYP VertexAttribs3fvNV) (GLuint index, GLsizei n, const GLfloat * v); /* 839 */
-    void (GLAPIENTRYP VertexAttribs3svNV) (GLuint index, GLsizei n, const GLshort * v); /* 840 */
-    void (GLAPIENTRYP VertexAttribs4dvNV) (GLuint index, GLsizei n, const GLdouble * v);        /* 841 */
-    void (GLAPIENTRYP VertexAttribs4fvNV) (GLuint index, GLsizei n, const GLfloat * v); /* 842 */
-    void (GLAPIENTRYP VertexAttribs4svNV) (GLuint index, GLsizei n, const GLshort * v); /* 843 */
-    void (GLAPIENTRYP VertexAttribs4ubvNV) (GLuint index, GLsizei n, const GLubyte * v);        /* 844 */
-    void (GLAPIENTRYP GetTexBumpParameterfvATI) (GLenum pname, GLfloat * param);        /* 845 */
-    void (GLAPIENTRYP GetTexBumpParameterivATI) (GLenum pname, GLint * param);  /* 846 */
-    void (GLAPIENTRYP TexBumpParameterfvATI) (GLenum pname, const GLfloat * param);     /* 847 */
-    void (GLAPIENTRYP TexBumpParameterivATI) (GLenum pname, const GLint * param);       /* 848 */
-    void (GLAPIENTRYP AlphaFragmentOp1ATI) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); /* 849 */
-    void (GLAPIENTRYP AlphaFragmentOp2ATI) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod);    /* 850 */
-    void (GLAPIENTRYP AlphaFragmentOp3ATI) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod);       /* 851 */
-    void (GLAPIENTRYP BeginFragmentShaderATI) (void);   /* 852 */
-    void (GLAPIENTRYP BindFragmentShaderATI) (GLuint id);       /* 853 */
-    void (GLAPIENTRYP ColorFragmentOp1ATI) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); /* 854 */
-    void (GLAPIENTRYP ColorFragmentOp2ATI) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod);    /* 855 */
-    void (GLAPIENTRYP ColorFragmentOp3ATI) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod);       /* 856 */
-    void (GLAPIENTRYP DeleteFragmentShaderATI) (GLuint id);     /* 857 */
-    void (GLAPIENTRYP EndFragmentShaderATI) (void);     /* 858 */
-     GLuint(GLAPIENTRYP GenFragmentShadersATI) (GLuint range);  /* 859 */
-    void (GLAPIENTRYP PassTexCoordATI) (GLuint dst, GLuint coord, GLenum swizzle);      /* 860 */
-    void (GLAPIENTRYP SampleMapATI) (GLuint dst, GLuint interp, GLenum swizzle);        /* 861 */
-    void (GLAPIENTRYP SetFragmentShaderConstantATI) (GLuint dst, const GLfloat * value);        /* 862 */
-    void (GLAPIENTRYP PointParameteriNV) (GLenum pname, GLint param);   /* 863 */
-    void (GLAPIENTRYP PointParameterivNV) (GLenum pname, const GLint * params); /* 864 */
-    void (GLAPIENTRYP ActiveStencilFaceEXT) (GLenum face);      /* 865 */
-    void (GLAPIENTRYP BindVertexArrayAPPLE) (GLuint array);     /* 866 */
-    void (GLAPIENTRYP DeleteVertexArraysAPPLE) (GLsizei n, const GLuint * arrays);      /* 867 */
-    void (GLAPIENTRYP GenVertexArraysAPPLE) (GLsizei n, GLuint * arrays);       /* 868 */
-     GLboolean(GLAPIENTRYP IsVertexArrayAPPLE) (GLuint array);  /* 869 */
-    void (GLAPIENTRYP GetProgramNamedParameterdvNV) (GLuint id, GLsizei len, const GLubyte * name, GLdouble * params);  /* 870 */
-    void (GLAPIENTRYP GetProgramNamedParameterfvNV) (GLuint id, GLsizei len, const GLubyte * name, GLfloat * params);   /* 871 */
-    void (GLAPIENTRYP ProgramNamedParameter4dNV) (GLuint id, GLsizei len, const GLubyte * name, GLdouble x, GLdouble y, GLdouble z, GLdouble w);        /* 872 */
-    void (GLAPIENTRYP ProgramNamedParameter4dvNV) (GLuint id, GLsizei len, const GLubyte * name, const GLdouble * v);   /* 873 */
-    void (GLAPIENTRYP ProgramNamedParameter4fNV) (GLuint id, GLsizei len, const GLubyte * name, GLfloat x, GLfloat y, GLfloat z, GLfloat w);    /* 874 */
-    void (GLAPIENTRYP ProgramNamedParameter4fvNV) (GLuint id, GLsizei len, const GLubyte * name, const GLfloat * v);    /* 875 */
-    void (GLAPIENTRYP PrimitiveRestartIndexNV) (GLuint index);  /* 876 */
-    void (GLAPIENTRYP PrimitiveRestartNV) (void);       /* 877 */
-    void (GLAPIENTRYP DepthBoundsEXT) (GLclampd zmin, GLclampd zmax);   /* 878 */
-    void (GLAPIENTRYP BlendEquationSeparateEXT) (GLenum modeRGB, GLenum modeA); /* 879 */
-    void (GLAPIENTRYP BindFramebufferEXT) (GLenum target, GLuint framebuffer);  /* 880 */
-    void (GLAPIENTRYP BindRenderbufferEXT) (GLenum target, GLuint renderbuffer);        /* 881 */
-     GLenum(GLAPIENTRYP CheckFramebufferStatusEXT) (GLenum target);     /* 882 */
-    void (GLAPIENTRYP DeleteFramebuffersEXT) (GLsizei n, const GLuint * framebuffers);  /* 883 */
-    void (GLAPIENTRYP DeleteRenderbuffersEXT) (GLsizei n, const GLuint * renderbuffers);        /* 884 */
-    void (GLAPIENTRYP FramebufferRenderbufferEXT) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);   /* 885 */
-    void (GLAPIENTRYP FramebufferTexture1DEXT) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);       /* 886 */
-    void (GLAPIENTRYP FramebufferTexture2DEXT) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);       /* 887 */
-    void (GLAPIENTRYP FramebufferTexture3DEXT) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);        /* 888 */
-    void (GLAPIENTRYP GenFramebuffersEXT) (GLsizei n, GLuint * framebuffers);   /* 889 */
-    void (GLAPIENTRYP GenRenderbuffersEXT) (GLsizei n, GLuint * renderbuffers); /* 890 */
-    void (GLAPIENTRYP GenerateMipmapEXT) (GLenum target);       /* 891 */
-    void (GLAPIENTRYP GetFramebufferAttachmentParameterivEXT) (GLenum target, GLenum attachment, GLenum pname, GLint * params); /* 892 */
-    void (GLAPIENTRYP GetRenderbufferParameterivEXT) (GLenum target, GLenum pname, GLint * params);     /* 893 */
-     GLboolean(GLAPIENTRYP IsFramebufferEXT) (GLuint framebuffer);      /* 894 */
-     GLboolean(GLAPIENTRYP IsRenderbufferEXT) (GLuint renderbuffer);    /* 895 */
-    void (GLAPIENTRYP RenderbufferStorageEXT) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);    /* 896 */
-    void (GLAPIENTRYP BlitFramebufferEXT) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);     /* 897 */
-    void (GLAPIENTRYP BufferParameteriAPPLE) (GLenum target, GLenum pname, GLint param);        /* 898 */
-    void (GLAPIENTRYP FlushMappedBufferRangeAPPLE) (GLenum target, GLintptr offset, GLsizeiptr size);   /* 899 */
-    void (GLAPIENTRYP BindFragDataLocationEXT) (GLuint program, GLuint colorNumber, const GLchar * name);       /* 900 */
-     GLint(GLAPIENTRYP GetFragDataLocationEXT) (GLuint program, const GLchar * name);   /* 901 */
-    void (GLAPIENTRYP GetUniformuivEXT) (GLuint program, GLint location, GLuint * params);      /* 902 */
-    void (GLAPIENTRYP GetVertexAttribIivEXT) (GLuint index, GLenum pname, GLint * params);      /* 903 */
-    void (GLAPIENTRYP GetVertexAttribIuivEXT) (GLuint index, GLenum pname, GLuint * params);    /* 904 */
-    void (GLAPIENTRYP Uniform1uiEXT) (GLint location, GLuint x);        /* 905 */
-    void (GLAPIENTRYP Uniform1uivEXT) (GLint location, GLsizei count, const GLuint * value);    /* 906 */
-    void (GLAPIENTRYP Uniform2uiEXT) (GLint location, GLuint x, GLuint y);      /* 907 */
-    void (GLAPIENTRYP Uniform2uivEXT) (GLint location, GLsizei count, const GLuint * value);    /* 908 */
-    void (GLAPIENTRYP Uniform3uiEXT) (GLint location, GLuint x, GLuint y, GLuint z);    /* 909 */
-    void (GLAPIENTRYP Uniform3uivEXT) (GLint location, GLsizei count, const GLuint * value);    /* 910 */
-    void (GLAPIENTRYP Uniform4uiEXT) (GLint location, GLuint x, GLuint y, GLuint z, GLuint w);  /* 911 */
-    void (GLAPIENTRYP Uniform4uivEXT) (GLint location, GLsizei count, const GLuint * value);    /* 912 */
-    void (GLAPIENTRYP VertexAttribI1iEXT) (GLuint index, GLint x);      /* 913 */
-    void (GLAPIENTRYP VertexAttribI1ivEXT) (GLuint index, const GLint * v);     /* 914 */
-    void (GLAPIENTRYP VertexAttribI1uiEXT) (GLuint index, GLuint x);    /* 915 */
-    void (GLAPIENTRYP VertexAttribI1uivEXT) (GLuint index, const GLuint * v);   /* 916 */
-    void (GLAPIENTRYP VertexAttribI2iEXT) (GLuint index, GLint x, GLint y);     /* 917 */
-    void (GLAPIENTRYP VertexAttribI2ivEXT) (GLuint index, const GLint * v);     /* 918 */
-    void (GLAPIENTRYP VertexAttribI2uiEXT) (GLuint index, GLuint x, GLuint y);  /* 919 */
-    void (GLAPIENTRYP VertexAttribI2uivEXT) (GLuint index, const GLuint * v);   /* 920 */
-    void (GLAPIENTRYP VertexAttribI3iEXT) (GLuint index, GLint x, GLint y, GLint z);    /* 921 */
-    void (GLAPIENTRYP VertexAttribI3ivEXT) (GLuint index, const GLint * v);     /* 922 */
-    void (GLAPIENTRYP VertexAttribI3uiEXT) (GLuint index, GLuint x, GLuint y, GLuint z);        /* 923 */
-    void (GLAPIENTRYP VertexAttribI3uivEXT) (GLuint index, const GLuint * v);   /* 924 */
-    void (GLAPIENTRYP VertexAttribI4bvEXT) (GLuint index, const GLbyte * v);    /* 925 */
-    void (GLAPIENTRYP VertexAttribI4iEXT) (GLuint index, GLint x, GLint y, GLint z, GLint w);   /* 926 */
-    void (GLAPIENTRYP VertexAttribI4ivEXT) (GLuint index, const GLint * v);     /* 927 */
-    void (GLAPIENTRYP VertexAttribI4svEXT) (GLuint index, const GLshort * v);   /* 928 */
-    void (GLAPIENTRYP VertexAttribI4ubvEXT) (GLuint index, const GLubyte * v);  /* 929 */
-    void (GLAPIENTRYP VertexAttribI4uiEXT) (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);      /* 930 */
-    void (GLAPIENTRYP VertexAttribI4uivEXT) (GLuint index, const GLuint * v);   /* 931 */
-    void (GLAPIENTRYP VertexAttribI4usvEXT) (GLuint index, const GLushort * v); /* 932 */
-    void (GLAPIENTRYP VertexAttribIPointerEXT) (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 933 */
-    void (GLAPIENTRYP FramebufferTextureLayerEXT) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); /* 934 */
-    void (GLAPIENTRYP ColorMaskIndexedEXT) (GLuint buf, GLboolean r, GLboolean g, GLboolean b, GLboolean a);    /* 935 */
-    void (GLAPIENTRYP DisableIndexedEXT) (GLenum target, GLuint index); /* 936 */
-    void (GLAPIENTRYP EnableIndexedEXT) (GLenum target, GLuint index);  /* 937 */
-    void (GLAPIENTRYP GetBooleanIndexedvEXT) (GLenum value, GLuint index, GLboolean * data);    /* 938 */
-    void (GLAPIENTRYP GetIntegerIndexedvEXT) (GLenum value, GLuint index, GLint * data);        /* 939 */
-     GLboolean(GLAPIENTRYP IsEnabledIndexedEXT) (GLenum target, GLuint index);  /* 940 */
-    void (GLAPIENTRYP ClearColorIiEXT) (GLint r, GLint g, GLint b, GLint a);    /* 941 */
-    void (GLAPIENTRYP ClearColorIuiEXT) (GLuint r, GLuint g, GLuint b, GLuint a);       /* 942 */
-    void (GLAPIENTRYP GetTexParameterIivEXT) (GLenum target, GLenum pname, GLint * params);     /* 943 */
-    void (GLAPIENTRYP GetTexParameterIuivEXT) (GLenum target, GLenum pname, GLuint * params);   /* 944 */
-    void (GLAPIENTRYP TexParameterIivEXT) (GLenum target, GLenum pname, const GLint * params);  /* 945 */
-    void (GLAPIENTRYP TexParameterIuivEXT) (GLenum target, GLenum pname, const GLuint * params);        /* 946 */
-    void (GLAPIENTRYP BeginConditionalRenderNV) (GLuint query, GLenum mode);    /* 947 */
-    void (GLAPIENTRYP EndConditionalRenderNV) (void);   /* 948 */
-    void (GLAPIENTRYP BeginTransformFeedbackEXT) (GLenum mode); /* 949 */
-    void (GLAPIENTRYP BindBufferBaseEXT) (GLenum target, GLuint index, GLuint buffer);  /* 950 */
-    void (GLAPIENTRYP BindBufferOffsetEXT) (GLenum target, GLuint index, GLuint buffer, GLintptr offset);       /* 951 */
-    void (GLAPIENTRYP BindBufferRangeEXT) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);       /* 952 */
-    void (GLAPIENTRYP EndTransformFeedbackEXT) (void);  /* 953 */
-    void (GLAPIENTRYP GetTransformFeedbackVaryingEXT) (GLuint program, GLuint index, GLsizei bufSize, GLsizei * length, GLsizei * size, GLenum * type, GLchar * name);  /* 954 */
-    void (GLAPIENTRYP TransformFeedbackVaryingsEXT) (GLuint program, GLsizei count, const char **varyings, GLenum bufferMode);  /* 955 */
-    void (GLAPIENTRYP ProvokingVertexEXT) (GLenum mode);        /* 956 */
-    void (GLAPIENTRYP GetTexParameterPointervAPPLE) (GLenum target, GLenum pname, GLvoid ** params);    /* 957 */
-    void (GLAPIENTRYP TextureRangeAPPLE) (GLenum target, GLsizei length, GLvoid * pointer);     /* 958 */
-    void (GLAPIENTRYP GetObjectParameterivAPPLE) (GLenum objectType, GLuint name, GLenum pname, GLint * value); /* 959 */
-     GLenum(GLAPIENTRYP ObjectPurgeableAPPLE) (GLenum objectType, GLuint name, GLenum option);  /* 960 */
-     GLenum(GLAPIENTRYP ObjectUnpurgeableAPPLE) (GLenum objectType, GLuint name, GLenum option);        /* 961 */
-    void (GLAPIENTRYP ActiveProgramEXT) (GLuint program);       /* 962 */
-     GLuint(GLAPIENTRYP CreateShaderProgramEXT) (GLenum type, const GLchar * string);   /* 963 */
-    void (GLAPIENTRYP UseShaderProgramEXT) (GLenum type, GLuint program);       /* 964 */
-    void (GLAPIENTRYP TextureBarrierNV) (void); /* 965 */
-    void (GLAPIENTRYP StencilFuncSeparateATI) (GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask);      /* 966 */
-    void (GLAPIENTRYP ProgramEnvParameters4fvEXT) (GLenum target, GLuint index, GLsizei count, const GLfloat * params); /* 967 */
-    void (GLAPIENTRYP ProgramLocalParameters4fvEXT) (GLenum target, GLuint index, GLsizei count, const GLfloat * params);       /* 968 */
-    void (GLAPIENTRYP GetQueryObjecti64vEXT) (GLuint id, GLenum pname, GLint64EXT * params);    /* 969 */
-    void (GLAPIENTRYP GetQueryObjectui64vEXT) (GLuint id, GLenum pname, GLuint64EXT * params);  /* 970 */
-    void (GLAPIENTRYP EGLImageTargetRenderbufferStorageOES) (GLenum target, GLvoid * writeOffset);      /* 971 */
-    void (GLAPIENTRYP EGLImageTargetTexture2DOES) (GLenum target, GLvoid * writeOffset);        /* 972 */
-};
-
-#endif                          /* !defined( _GLAPI_TABLE_H_ ) */
diff --git a/glx/glprocs.h b/glx/glprocs.h
deleted file mode 100644 (file)
index 8706364..0000000
+++ /dev/null
@@ -1,3534 +0,0 @@
-/* DO NOT EDIT - This file generated automatically by gl_procs.py (from Mesa) script */
-
-/*
- * Copyright (C) 1999-2001  Brian Paul   All Rights Reserved.
- * (C) Copyright IBM Corporation 2004, 2006
- * All Rights Reserved.
- * 
- * 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, sub license,
- * 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 NON-INFRINGEMENT.  IN NO EVENT SHALL
- * BRIAN PAUL, IBM,
- * AND/OR THEIR SUPPLIERS 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.
- */
-
-/* This file is only included by glapi.c and is used for
- * the GetProcAddress() function
- */
-
-typedef struct {
-    GLint Name_offset;
-#if defined(NEED_FUNCTION_POINTER) || defined(GLX_INDIRECT_RENDERING)
-    _glapi_proc Address;
-#endif
-    GLuint Offset;
-} glprocs_table_t;
-
-#if   !defined(NEED_FUNCTION_POINTER) && !defined(GLX_INDIRECT_RENDERING)
-#define NAME_FUNC_OFFSET(n,f1,f2,f3,o) { n , o }
-#elif  defined(NEED_FUNCTION_POINTER) && !defined(GLX_INDIRECT_RENDERING)
-#define NAME_FUNC_OFFSET(n,f1,f2,f3,o) { n , (_glapi_proc) f1 , o }
-#elif  defined(NEED_FUNCTION_POINTER) &&  defined(GLX_INDIRECT_RENDERING)
-#define NAME_FUNC_OFFSET(n,f1,f2,f3,o) { n , (_glapi_proc) f2 , o }
-#elif !defined(NEED_FUNCTION_POINTER) &&  defined(GLX_INDIRECT_RENDERING)
-#define NAME_FUNC_OFFSET(n,f1,f2,f3,o) { n , (_glapi_proc) f3 , o }
-#endif
-
-static const char gl_string_table[] =
-    "glNewList\0"
-    "glEndList\0"
-    "glCallList\0"
-    "glCallLists\0"
-    "glDeleteLists\0"
-    "glGenLists\0"
-    "glListBase\0"
-    "glBegin\0"
-    "glBitmap\0"
-    "glColor3b\0"
-    "glColor3bv\0"
-    "glColor3d\0"
-    "glColor3dv\0"
-    "glColor3f\0"
-    "glColor3fv\0"
-    "glColor3i\0"
-    "glColor3iv\0"
-    "glColor3s\0"
-    "glColor3sv\0"
-    "glColor3ub\0"
-    "glColor3ubv\0"
-    "glColor3ui\0"
-    "glColor3uiv\0"
-    "glColor3us\0"
-    "glColor3usv\0"
-    "glColor4b\0"
-    "glColor4bv\0"
-    "glColor4d\0"
-    "glColor4dv\0"
-    "glColor4f\0"
-    "glColor4fv\0"
-    "glColor4i\0"
-    "glColor4iv\0"
-    "glColor4s\0"
-    "glColor4sv\0"
-    "glColor4ub\0"
-    "glColor4ubv\0"
-    "glColor4ui\0"
-    "glColor4uiv\0"
-    "glColor4us\0"
-    "glColor4usv\0"
-    "glEdgeFlag\0"
-    "glEdgeFlagv\0"
-    "glEnd\0"
-    "glIndexd\0"
-    "glIndexdv\0"
-    "glIndexf\0"
-    "glIndexfv\0"
-    "glIndexi\0"
-    "glIndexiv\0"
-    "glIndexs\0"
-    "glIndexsv\0"
-    "glNormal3b\0"
-    "glNormal3bv\0"
-    "glNormal3d\0"
-    "glNormal3dv\0"
-    "glNormal3f\0"
-    "glNormal3fv\0"
-    "glNormal3i\0"
-    "glNormal3iv\0"
-    "glNormal3s\0"
-    "glNormal3sv\0"
-    "glRasterPos2d\0"
-    "glRasterPos2dv\0"
-    "glRasterPos2f\0"
-    "glRasterPos2fv\0"
-    "glRasterPos2i\0"
-    "glRasterPos2iv\0"
-    "glRasterPos2s\0"
-    "glRasterPos2sv\0"
-    "glRasterPos3d\0"
-    "glRasterPos3dv\0"
-    "glRasterPos3f\0"
-    "glRasterPos3fv\0"
-    "glRasterPos3i\0"
-    "glRasterPos3iv\0"
-    "glRasterPos3s\0"
-    "glRasterPos3sv\0"
-    "glRasterPos4d\0"
-    "glRasterPos4dv\0"
-    "glRasterPos4f\0"
-    "glRasterPos4fv\0"
-    "glRasterPos4i\0"
-    "glRasterPos4iv\0"
-    "glRasterPos4s\0"
-    "glRasterPos4sv\0"
-    "glRectd\0"
-    "glRectdv\0"
-    "glRectf\0"
-    "glRectfv\0"
-    "glRecti\0"
-    "glRectiv\0"
-    "glRects\0"
-    "glRectsv\0"
-    "glTexCoord1d\0"
-    "glTexCoord1dv\0"
-    "glTexCoord1f\0"
-    "glTexCoord1fv\0"
-    "glTexCoord1i\0"
-    "glTexCoord1iv\0"
-    "glTexCoord1s\0"
-    "glTexCoord1sv\0"
-    "glTexCoord2d\0"
-    "glTexCoord2dv\0"
-    "glTexCoord2f\0"
-    "glTexCoord2fv\0"
-    "glTexCoord2i\0"
-    "glTexCoord2iv\0"
-    "glTexCoord2s\0"
-    "glTexCoord2sv\0"
-    "glTexCoord3d\0"
-    "glTexCoord3dv\0"
-    "glTexCoord3f\0"
-    "glTexCoord3fv\0"
-    "glTexCoord3i\0"
-    "glTexCoord3iv\0"
-    "glTexCoord3s\0"
-    "glTexCoord3sv\0"
-    "glTexCoord4d\0"
-    "glTexCoord4dv\0"
-    "glTexCoord4f\0"
-    "glTexCoord4fv\0"
-    "glTexCoord4i\0"
-    "glTexCoord4iv\0"
-    "glTexCoord4s\0"
-    "glTexCoord4sv\0"
-    "glVertex2d\0"
-    "glVertex2dv\0"
-    "glVertex2f\0"
-    "glVertex2fv\0"
-    "glVertex2i\0"
-    "glVertex2iv\0"
-    "glVertex2s\0"
-    "glVertex2sv\0"
-    "glVertex3d\0"
-    "glVertex3dv\0"
-    "glVertex3f\0"
-    "glVertex3fv\0"
-    "glVertex3i\0"
-    "glVertex3iv\0"
-    "glVertex3s\0"
-    "glVertex3sv\0"
-    "glVertex4d\0"
-    "glVertex4dv\0"
-    "glVertex4f\0"
-    "glVertex4fv\0"
-    "glVertex4i\0"
-    "glVertex4iv\0"
-    "glVertex4s\0"
-    "glVertex4sv\0"
-    "glClipPlane\0"
-    "glColorMaterial\0"
-    "glCullFace\0"
-    "glFogf\0"
-    "glFogfv\0"
-    "glFogi\0"
-    "glFogiv\0"
-    "glFrontFace\0"
-    "glHint\0"
-    "glLightf\0"
-    "glLightfv\0"
-    "glLighti\0"
-    "glLightiv\0"
-    "glLightModelf\0"
-    "glLightModelfv\0"
-    "glLightModeli\0"
-    "glLightModeliv\0"
-    "glLineStipple\0"
-    "glLineWidth\0"
-    "glMaterialf\0"
-    "glMaterialfv\0"
-    "glMateriali\0"
-    "glMaterialiv\0"
-    "glPointSize\0"
-    "glPolygonMode\0"
-    "glPolygonStipple\0"
-    "glScissor\0"
-    "glShadeModel\0"
-    "glTexParameterf\0"
-    "glTexParameterfv\0"
-    "glTexParameteri\0"
-    "glTexParameteriv\0"
-    "glTexImage1D\0"
-    "glTexImage2D\0"
-    "glTexEnvf\0"
-    "glTexEnvfv\0"
-    "glTexEnvi\0"
-    "glTexEnviv\0"
-    "glTexGend\0"
-    "glTexGendv\0"
-    "glTexGenf\0"
-    "glTexGenfv\0"
-    "glTexGeni\0"
-    "glTexGeniv\0"
-    "glFeedbackBuffer\0"
-    "glSelectBuffer\0"
-    "glRenderMode\0"
-    "glInitNames\0"
-    "glLoadName\0"
-    "glPassThrough\0"
-    "glPopName\0"
-    "glPushName\0"
-    "glDrawBuffer\0"
-    "glClear\0"
-    "glClearAccum\0"
-    "glClearIndex\0"
-    "glClearColor\0"
-    "glClearStencil\0"
-    "glClearDepth\0"
-    "glStencilMask\0"
-    "glColorMask\0"
-    "glDepthMask\0"
-    "glIndexMask\0"
-    "glAccum\0"
-    "glDisable\0"
-    "glEnable\0"
-    "glFinish\0"
-    "glFlush\0"
-    "glPopAttrib\0"
-    "glPushAttrib\0"
-    "glMap1d\0"
-    "glMap1f\0"
-    "glMap2d\0"
-    "glMap2f\0"
-    "glMapGrid1d\0"
-    "glMapGrid1f\0"
-    "glMapGrid2d\0"
-    "glMapGrid2f\0"
-    "glEvalCoord1d\0"
-    "glEvalCoord1dv\0"
-    "glEvalCoord1f\0"
-    "glEvalCoord1fv\0"
-    "glEvalCoord2d\0"
-    "glEvalCoord2dv\0"
-    "glEvalCoord2f\0"
-    "glEvalCoord2fv\0"
-    "glEvalMesh1\0"
-    "glEvalPoint1\0"
-    "glEvalMesh2\0"
-    "glEvalPoint2\0"
-    "glAlphaFunc\0"
-    "glBlendFunc\0"
-    "glLogicOp\0"
-    "glStencilFunc\0"
-    "glStencilOp\0"
-    "glDepthFunc\0"
-    "glPixelZoom\0"
-    "glPixelTransferf\0"
-    "glPixelTransferi\0"
-    "glPixelStoref\0"
-    "glPixelStorei\0"
-    "glPixelMapfv\0"
-    "glPixelMapuiv\0"
-    "glPixelMapusv\0"
-    "glReadBuffer\0"
-    "glCopyPixels\0"
-    "glReadPixels\0"
-    "glDrawPixels\0"
-    "glGetBooleanv\0"
-    "glGetClipPlane\0"
-    "glGetDoublev\0"
-    "glGetError\0"
-    "glGetFloatv\0"
-    "glGetIntegerv\0"
-    "glGetLightfv\0"
-    "glGetLightiv\0"
-    "glGetMapdv\0"
-    "glGetMapfv\0"
-    "glGetMapiv\0"
-    "glGetMaterialfv\0"
-    "glGetMaterialiv\0"
-    "glGetPixelMapfv\0"
-    "glGetPixelMapuiv\0"
-    "glGetPixelMapusv\0"
-    "glGetPolygonStipple\0"
-    "glGetString\0"
-    "glGetTexEnvfv\0"
-    "glGetTexEnviv\0"
-    "glGetTexGendv\0"
-    "glGetTexGenfv\0"
-    "glGetTexGeniv\0"
-    "glGetTexImage\0"
-    "glGetTexParameterfv\0"
-    "glGetTexParameteriv\0"
-    "glGetTexLevelParameterfv\0"
-    "glGetTexLevelParameteriv\0"
-    "glIsEnabled\0"
-    "glIsList\0"
-    "glDepthRange\0"
-    "glFrustum\0"
-    "glLoadIdentity\0"
-    "glLoadMatrixf\0"
-    "glLoadMatrixd\0"
-    "glMatrixMode\0"
-    "glMultMatrixf\0"
-    "glMultMatrixd\0"
-    "glOrtho\0"
-    "glPopMatrix\0"
-    "glPushMatrix\0"
-    "glRotated\0"
-    "glRotatef\0"
-    "glScaled\0"
-    "glScalef\0"
-    "glTranslated\0"
-    "glTranslatef\0"
-    "glViewport\0"
-    "glArrayElement\0"
-    "glBindTexture\0"
-    "glColorPointer\0"
-    "glDisableClientState\0"
-    "glDrawArrays\0"
-    "glDrawElements\0"
-    "glEdgeFlagPointer\0"
-    "glEnableClientState\0"
-    "glIndexPointer\0"
-    "glIndexub\0"
-    "glIndexubv\0"
-    "glInterleavedArrays\0"
-    "glNormalPointer\0"
-    "glPolygonOffset\0"
-    "glTexCoordPointer\0"
-    "glVertexPointer\0"
-    "glAreTexturesResident\0"
-    "glCopyTexImage1D\0"
-    "glCopyTexImage2D\0"
-    "glCopyTexSubImage1D\0"
-    "glCopyTexSubImage2D\0"
-    "glDeleteTextures\0"
-    "glGenTextures\0"
-    "glGetPointerv\0"
-    "glIsTexture\0"
-    "glPrioritizeTextures\0"
-    "glTexSubImage1D\0"
-    "glTexSubImage2D\0"
-    "glPopClientAttrib\0"
-    "glPushClientAttrib\0"
-    "glBlendColor\0"
-    "glBlendEquation\0"
-    "glDrawRangeElements\0"
-    "glColorTable\0"
-    "glColorTableParameterfv\0"
-    "glColorTableParameteriv\0"
-    "glCopyColorTable\0"
-    "glGetColorTable\0"
-    "glGetColorTableParameterfv\0"
-    "glGetColorTableParameteriv\0"
-    "glColorSubTable\0"
-    "glCopyColorSubTable\0"
-    "glConvolutionFilter1D\0"
-    "glConvolutionFilter2D\0"
-    "glConvolutionParameterf\0"
-    "glConvolutionParameterfv\0"
-    "glConvolutionParameteri\0"
-    "glConvolutionParameteriv\0"
-    "glCopyConvolutionFilter1D\0"
-    "glCopyConvolutionFilter2D\0"
-    "glGetConvolutionFilter\0"
-    "glGetConvolutionParameterfv\0"
-    "glGetConvolutionParameteriv\0"
-    "glGetSeparableFilter\0"
-    "glSeparableFilter2D\0"
-    "glGetHistogram\0"
-    "glGetHistogramParameterfv\0"
-    "glGetHistogramParameteriv\0"
-    "glGetMinmax\0"
-    "glGetMinmaxParameterfv\0"
-    "glGetMinmaxParameteriv\0"
-    "glHistogram\0"
-    "glMinmax\0"
-    "glResetHistogram\0"
-    "glResetMinmax\0"
-    "glTexImage3D\0"
-    "glTexSubImage3D\0"
-    "glCopyTexSubImage3D\0"
-    "glActiveTextureARB\0"
-    "glClientActiveTextureARB\0"
-    "glMultiTexCoord1dARB\0"
-    "glMultiTexCoord1dvARB\0"
-    "glMultiTexCoord1fARB\0"
-    "glMultiTexCoord1fvARB\0"
-    "glMultiTexCoord1iARB\0"
-    "glMultiTexCoord1ivARB\0"
-    "glMultiTexCoord1sARB\0"
-    "glMultiTexCoord1svARB\0"
-    "glMultiTexCoord2dARB\0"
-    "glMultiTexCoord2dvARB\0"
-    "glMultiTexCoord2fARB\0"
-    "glMultiTexCoord2fvARB\0"
-    "glMultiTexCoord2iARB\0"
-    "glMultiTexCoord2ivARB\0"
-    "glMultiTexCoord2sARB\0"
-    "glMultiTexCoord2svARB\0"
-    "glMultiTexCoord3dARB\0"
-    "glMultiTexCoord3dvARB\0"
-    "glMultiTexCoord3fARB\0"
-    "glMultiTexCoord3fvARB\0"
-    "glMultiTexCoord3iARB\0"
-    "glMultiTexCoord3ivARB\0"
-    "glMultiTexCoord3sARB\0"
-    "glMultiTexCoord3svARB\0"
-    "glMultiTexCoord4dARB\0"
-    "glMultiTexCoord4dvARB\0"
-    "glMultiTexCoord4fARB\0"
-    "glMultiTexCoord4fvARB\0"
-    "glMultiTexCoord4iARB\0"
-    "glMultiTexCoord4ivARB\0"
-    "glMultiTexCoord4sARB\0"
-    "glMultiTexCoord4svARB\0"
-    "glAttachShader\0"
-    "glCreateProgram\0"
-    "glCreateShader\0"
-    "glDeleteProgram\0"
-    "glDeleteShader\0"
-    "glDetachShader\0"
-    "glGetAttachedShaders\0"
-    "glGetProgramInfoLog\0"
-    "glGetProgramiv\0"
-    "glGetShaderInfoLog\0"
-    "glGetShaderiv\0"
-    "glIsProgram\0"
-    "glIsShader\0"
-    "glStencilFuncSeparate\0"
-    "glStencilMaskSeparate\0"
-    "glStencilOpSeparate\0"
-    "glUniformMatrix2x3fv\0"
-    "glUniformMatrix2x4fv\0"
-    "glUniformMatrix3x2fv\0"
-    "glUniformMatrix3x4fv\0"
-    "glUniformMatrix4x2fv\0"
-    "glUniformMatrix4x3fv\0"
-    "glClampColor\0"
-    "glClearBufferfi\0"
-    "glClearBufferfv\0"
-    "glClearBufferiv\0"
-    "glClearBufferuiv\0"
-    "glGetStringi\0"
-    "glTexBuffer\0"
-    "glFramebufferTexture\0"
-    "glGetBufferParameteri64v\0"
-    "glGetInteger64i_v\0"
-    "glVertexAttribDivisor\0"
-    "glLoadTransposeMatrixdARB\0"
-    "glLoadTransposeMatrixfARB\0"
-    "glMultTransposeMatrixdARB\0"
-    "glMultTransposeMatrixfARB\0"
-    "glSampleCoverageARB\0"
-    "glCompressedTexImage1DARB\0"
-    "glCompressedTexImage2DARB\0"
-    "glCompressedTexImage3DARB\0"
-    "glCompressedTexSubImage1DARB\0"
-    "glCompressedTexSubImage2DARB\0"
-    "glCompressedTexSubImage3DARB\0"
-    "glGetCompressedTexImageARB\0"
-    "glDisableVertexAttribArrayARB\0"
-    "glEnableVertexAttribArrayARB\0"
-    "glGetProgramEnvParameterdvARB\0"
-    "glGetProgramEnvParameterfvARB\0"
-    "glGetProgramLocalParameterdvARB\0"
-    "glGetProgramLocalParameterfvARB\0"
-    "glGetProgramStringARB\0"
-    "glGetProgramivARB\0"
-    "glGetVertexAttribdvARB\0"
-    "glGetVertexAttribfvARB\0"
-    "glGetVertexAttribivARB\0"
-    "glProgramEnvParameter4dARB\0"
-    "glProgramEnvParameter4dvARB\0"
-    "glProgramEnvParameter4fARB\0"
-    "glProgramEnvParameter4fvARB\0"
-    "glProgramLocalParameter4dARB\0"
-    "glProgramLocalParameter4dvARB\0"
-    "glProgramLocalParameter4fARB\0"
-    "glProgramLocalParameter4fvARB\0"
-    "glProgramStringARB\0"
-    "glVertexAttrib1dARB\0"
-    "glVertexAttrib1dvARB\0"
-    "glVertexAttrib1fARB\0"
-    "glVertexAttrib1fvARB\0"
-    "glVertexAttrib1sARB\0"
-    "glVertexAttrib1svARB\0"
-    "glVertexAttrib2dARB\0"
-    "glVertexAttrib2dvARB\0"
-    "glVertexAttrib2fARB\0"
-    "glVertexAttrib2fvARB\0"
-    "glVertexAttrib2sARB\0"
-    "glVertexAttrib2svARB\0"
-    "glVertexAttrib3dARB\0"
-    "glVertexAttrib3dvARB\0"
-    "glVertexAttrib3fARB\0"
-    "glVertexAttrib3fvARB\0"
-    "glVertexAttrib3sARB\0"
-    "glVertexAttrib3svARB\0"
-    "glVertexAttrib4NbvARB\0"
-    "glVertexAttrib4NivARB\0"
-    "glVertexAttrib4NsvARB\0"
-    "glVertexAttrib4NubARB\0"
-    "glVertexAttrib4NubvARB\0"
-    "glVertexAttrib4NuivARB\0"
-    "glVertexAttrib4NusvARB\0"
-    "glVertexAttrib4bvARB\0"
-    "glVertexAttrib4dARB\0"
-    "glVertexAttrib4dvARB\0"
-    "glVertexAttrib4fARB\0"
-    "glVertexAttrib4fvARB\0"
-    "glVertexAttrib4ivARB\0"
-    "glVertexAttrib4sARB\0"
-    "glVertexAttrib4svARB\0"
-    "glVertexAttrib4ubvARB\0"
-    "glVertexAttrib4uivARB\0"
-    "glVertexAttrib4usvARB\0"
-    "glVertexAttribPointerARB\0"
-    "glBindBufferARB\0"
-    "glBufferDataARB\0"
-    "glBufferSubDataARB\0"
-    "glDeleteBuffersARB\0"
-    "glGenBuffersARB\0"
-    "glGetBufferParameterivARB\0"
-    "glGetBufferPointervARB\0"
-    "glGetBufferSubDataARB\0"
-    "glIsBufferARB\0"
-    "glMapBufferARB\0"
-    "glUnmapBufferARB\0"
-    "glBeginQueryARB\0"
-    "glDeleteQueriesARB\0"
-    "glEndQueryARB\0"
-    "glGenQueriesARB\0"
-    "glGetQueryObjectivARB\0"
-    "glGetQueryObjectuivARB\0"
-    "glGetQueryivARB\0"
-    "glIsQueryARB\0"
-    "glAttachObjectARB\0"
-    "glCompileShaderARB\0"
-    "glCreateProgramObjectARB\0"
-    "glCreateShaderObjectARB\0"
-    "glDeleteObjectARB\0"
-    "glDetachObjectARB\0"
-    "glGetActiveUniformARB\0"
-    "glGetAttachedObjectsARB\0"
-    "glGetHandleARB\0"
-    "glGetInfoLogARB\0"
-    "glGetObjectParameterfvARB\0"
-    "glGetObjectParameterivARB\0"
-    "glGetShaderSourceARB\0"
-    "glGetUniformLocationARB\0"
-    "glGetUniformfvARB\0"
-    "glGetUniformivARB\0"
-    "glLinkProgramARB\0"
-    "glShaderSourceARB\0"
-    "glUniform1fARB\0"
-    "glUniform1fvARB\0"
-    "glUniform1iARB\0"
-    "glUniform1ivARB\0"
-    "glUniform2fARB\0"
-    "glUniform2fvARB\0"
-    "glUniform2iARB\0"
-    "glUniform2ivARB\0"
-    "glUniform3fARB\0"
-    "glUniform3fvARB\0"
-    "glUniform3iARB\0"
-    "glUniform3ivARB\0"
-    "glUniform4fARB\0"
-    "glUniform4fvARB\0"
-    "glUniform4iARB\0"
-    "glUniform4ivARB\0"
-    "glUniformMatrix2fvARB\0"
-    "glUniformMatrix3fvARB\0"
-    "glUniformMatrix4fvARB\0"
-    "glUseProgramObjectARB\0"
-    "glValidateProgramARB\0"
-    "glBindAttribLocationARB\0"
-    "glGetActiveAttribARB\0"
-    "glGetAttribLocationARB\0"
-    "glDrawBuffersARB\0"
-    "glClampColorARB\0"
-    "glDrawArraysInstancedARB\0"
-    "glDrawElementsInstancedARB\0"
-    "glRenderbufferStorageMultisample\0"
-    "glFramebufferTextureARB\0"
-    "glFramebufferTextureFaceARB\0"
-    "glProgramParameteriARB\0"
-    "glVertexAttribDivisorARB\0"
-    "glFlushMappedBufferRange\0"
-    "glMapBufferRange\0"
-    "glTexBufferARB\0"
-    "glBindVertexArray\0"
-    "glGenVertexArrays\0"
-    "glCopyBufferSubData\0"
-    "glClientWaitSync\0"
-    "glDeleteSync\0"
-    "glFenceSync\0"
-    "glGetInteger64v\0"
-    "glGetSynciv\0"
-    "glIsSync\0"
-    "glWaitSync\0"
-    "glDrawElementsBaseVertex\0"
-    "glDrawElementsInstancedBaseVertex\0"
-    "glDrawRangeElementsBaseVertex\0"
-    "glMultiDrawElementsBaseVertex\0"
-    "glBlendEquationSeparateiARB\0"
-    "glBlendEquationiARB\0"
-    "glBlendFuncSeparateiARB\0"
-    "glBlendFunciARB\0"
-    "glBindSampler\0"
-    "glDeleteSamplers\0"
-    "glGenSamplers\0"
-    "glGetSamplerParameterIiv\0"
-    "glGetSamplerParameterIuiv\0"
-    "glGetSamplerParameterfv\0"
-    "glGetSamplerParameteriv\0"
-    "glIsSampler\0"
-    "glSamplerParameterIiv\0"
-    "glSamplerParameterIuiv\0"
-    "glSamplerParameterf\0"
-    "glSamplerParameterfv\0"
-    "glSamplerParameteri\0"
-    "glSamplerParameteriv\0"
-    "glColorP3ui\0"
-    "glColorP3uiv\0"
-    "glColorP4ui\0"
-    "glColorP4uiv\0"
-    "glMultiTexCoordP1ui\0"
-    "glMultiTexCoordP1uiv\0"
-    "glMultiTexCoordP2ui\0"
-    "glMultiTexCoordP2uiv\0"
-    "glMultiTexCoordP3ui\0"
-    "glMultiTexCoordP3uiv\0"
-    "glMultiTexCoordP4ui\0"
-    "glMultiTexCoordP4uiv\0"
-    "glNormalP3ui\0"
-    "glNormalP3uiv\0"
-    "glSecondaryColorP3ui\0"
-    "glSecondaryColorP3uiv\0"
-    "glTexCoordP1ui\0"
-    "glTexCoordP1uiv\0"
-    "glTexCoordP2ui\0"
-    "glTexCoordP2uiv\0"
-    "glTexCoordP3ui\0"
-    "glTexCoordP3uiv\0"
-    "glTexCoordP4ui\0"
-    "glTexCoordP4uiv\0"
-    "glVertexAttribP1ui\0"
-    "glVertexAttribP1uiv\0"
-    "glVertexAttribP2ui\0"
-    "glVertexAttribP2uiv\0"
-    "glVertexAttribP3ui\0"
-    "glVertexAttribP3uiv\0"
-    "glVertexAttribP4ui\0"
-    "glVertexAttribP4uiv\0"
-    "glVertexP2ui\0"
-    "glVertexP2uiv\0"
-    "glVertexP3ui\0"
-    "glVertexP3uiv\0"
-    "glVertexP4ui\0"
-    "glVertexP4uiv\0"
-    "glBindTransformFeedback\0"
-    "glDeleteTransformFeedbacks\0"
-    "glDrawTransformFeedback\0"
-    "glGenTransformFeedbacks\0"
-    "glIsTransformFeedback\0"
-    "glPauseTransformFeedback\0"
-    "glResumeTransformFeedback\0"
-    "glClearDepthf\0"
-    "glDepthRangef\0"
-    "glGetShaderPrecisionFormat\0"
-    "glReleaseShaderCompiler\0"
-    "glShaderBinary\0"
-    "glGetGraphicsResetStatusARB\0"
-    "glGetnColorTableARB\0"
-    "glGetnCompressedTexImageARB\0"
-    "glGetnConvolutionFilterARB\0"
-    "glGetnHistogramARB\0"
-    "glGetnMapdvARB\0"
-    "glGetnMapfvARB\0"
-    "glGetnMapivARB\0"
-    "glGetnMinmaxARB\0"
-    "glGetnPixelMapfvARB\0"
-    "glGetnPixelMapuivARB\0"
-    "glGetnPixelMapusvARB\0"
-    "glGetnPolygonStippleARB\0"
-    "glGetnSeparableFilterARB\0"
-    "glGetnTexImageARB\0"
-    "glGetnUniformdvARB\0"
-    "glGetnUniformfvARB\0"
-    "glGetnUniformivARB\0"
-    "glGetnUniformuivARB\0"
-    "glReadnPixelsARB\0"
-    "glTexStorage1D\0"
-    "glTexStorage2D\0"
-    "glTexStorage3D\0"
-    "glTextureStorage1DEXT\0"
-    "glTextureStorage2DEXT\0"
-    "glTextureStorage3DEXT\0"
-    "glPolygonOffsetEXT\0"
-    "glGetPixelTexGenParameterfvSGIS\0"
-    "glGetPixelTexGenParameterivSGIS\0"
-    "glPixelTexGenParameterfSGIS\0"
-    "glPixelTexGenParameterfvSGIS\0"
-    "glPixelTexGenParameteriSGIS\0"
-    "glPixelTexGenParameterivSGIS\0"
-    "glSampleMaskSGIS\0"
-    "glSamplePatternSGIS\0"
-    "glColorPointerEXT\0"
-    "glEdgeFlagPointerEXT\0"
-    "glIndexPointerEXT\0"
-    "glNormalPointerEXT\0"
-    "glTexCoordPointerEXT\0"
-    "glVertexPointerEXT\0"
-    "glPointParameterfEXT\0"
-    "glPointParameterfvEXT\0"
-    "glLockArraysEXT\0"
-    "glUnlockArraysEXT\0"
-    "glSecondaryColor3bEXT\0"
-    "glSecondaryColor3bvEXT\0"
-    "glSecondaryColor3dEXT\0"
-    "glSecondaryColor3dvEXT\0"
-    "glSecondaryColor3fEXT\0"
-    "glSecondaryColor3fvEXT\0"
-    "glSecondaryColor3iEXT\0"
-    "glSecondaryColor3ivEXT\0"
-    "glSecondaryColor3sEXT\0"
-    "glSecondaryColor3svEXT\0"
-    "glSecondaryColor3ubEXT\0"
-    "glSecondaryColor3ubvEXT\0"
-    "glSecondaryColor3uiEXT\0"
-    "glSecondaryColor3uivEXT\0"
-    "glSecondaryColor3usEXT\0"
-    "glSecondaryColor3usvEXT\0"
-    "glSecondaryColorPointerEXT\0"
-    "glMultiDrawArraysEXT\0"
-    "glMultiDrawElementsEXT\0"
-    "glFogCoordPointerEXT\0"
-    "glFogCoorddEXT\0"
-    "glFogCoorddvEXT\0"
-    "glFogCoordfEXT\0"
-    "glFogCoordfvEXT\0"
-    "glPixelTexGenSGIX\0"
-    "glBlendFuncSeparateEXT\0"
-    "glFlushVertexArrayRangeNV\0"
-    "glVertexArrayRangeNV\0"
-    "glCombinerInputNV\0"
-    "glCombinerOutputNV\0"
-    "glCombinerParameterfNV\0"
-    "glCombinerParameterfvNV\0"
-    "glCombinerParameteriNV\0"
-    "glCombinerParameterivNV\0"
-    "glFinalCombinerInputNV\0"
-    "glGetCombinerInputParameterfvNV\0"
-    "glGetCombinerInputParameterivNV\0"
-    "glGetCombinerOutputParameterfvNV\0"
-    "glGetCombinerOutputParameterivNV\0"
-    "glGetFinalCombinerInputParameterfvNV\0"
-    "glGetFinalCombinerInputParameterivNV\0"
-    "glResizeBuffersMESA\0"
-    "glWindowPos2dMESA\0"
-    "glWindowPos2dvMESA\0"
-    "glWindowPos2fMESA\0"
-    "glWindowPos2fvMESA\0"
-    "glWindowPos2iMESA\0"
-    "glWindowPos2ivMESA\0"
-    "glWindowPos2sMESA\0"
-    "glWindowPos2svMESA\0"
-    "glWindowPos3dMESA\0"
-    "glWindowPos3dvMESA\0"
-    "glWindowPos3fMESA\0"
-    "glWindowPos3fvMESA\0"
-    "glWindowPos3iMESA\0"
-    "glWindowPos3ivMESA\0"
-    "glWindowPos3sMESA\0"
-    "glWindowPos3svMESA\0"
-    "glWindowPos4dMESA\0"
-    "glWindowPos4dvMESA\0"
-    "glWindowPos4fMESA\0"
-    "glWindowPos4fvMESA\0"
-    "glWindowPos4iMESA\0"
-    "glWindowPos4ivMESA\0"
-    "glWindowPos4sMESA\0"
-    "glWindowPos4svMESA\0"
-    "glMultiModeDrawArraysIBM\0"
-    "glMultiModeDrawElementsIBM\0"
-    "glDeleteFencesNV\0"
-    "glFinishFenceNV\0"
-    "glGenFencesNV\0"
-    "glGetFenceivNV\0"
-    "glIsFenceNV\0"
-    "glSetFenceNV\0"
-    "glTestFenceNV\0"
-    "glAreProgramsResidentNV\0"
-    "glBindProgramNV\0"
-    "glDeleteProgramsNV\0"
-    "glExecuteProgramNV\0"
-    "glGenProgramsNV\0"
-    "glGetProgramParameterdvNV\0"
-    "glGetProgramParameterfvNV\0"
-    "glGetProgramStringNV\0"
-    "glGetProgramivNV\0"
-    "glGetTrackMatrixivNV\0"
-    "glGetVertexAttribPointervNV\0"
-    "glGetVertexAttribdvNV\0"
-    "glGetVertexAttribfvNV\0"
-    "glGetVertexAttribivNV\0"
-    "glIsProgramNV\0"
-    "glLoadProgramNV\0"
-    "glProgramParameters4dvNV\0"
-    "glProgramParameters4fvNV\0"
-    "glRequestResidentProgramsNV\0"
-    "glTrackMatrixNV\0"
-    "glVertexAttrib1dNV\0"
-    "glVertexAttrib1dvNV\0"
-    "glVertexAttrib1fNV\0"
-    "glVertexAttrib1fvNV\0"
-    "glVertexAttrib1sNV\0"
-    "glVertexAttrib1svNV\0"
-    "glVertexAttrib2dNV\0"
-    "glVertexAttrib2dvNV\0"
-    "glVertexAttrib2fNV\0"
-    "glVertexAttrib2fvNV\0"
-    "glVertexAttrib2sNV\0"
-    "glVertexAttrib2svNV\0"
-    "glVertexAttrib3dNV\0"
-    "glVertexAttrib3dvNV\0"
-    "glVertexAttrib3fNV\0"
-    "glVertexAttrib3fvNV\0"
-    "glVertexAttrib3sNV\0"
-    "glVertexAttrib3svNV\0"
-    "glVertexAttrib4dNV\0"
-    "glVertexAttrib4dvNV\0"
-    "glVertexAttrib4fNV\0"
-    "glVertexAttrib4fvNV\0"
-    "glVertexAttrib4sNV\0"
-    "glVertexAttrib4svNV\0"
-    "glVertexAttrib4ubNV\0"
-    "glVertexAttrib4ubvNV\0"
-    "glVertexAttribPointerNV\0"
-    "glVertexAttribs1dvNV\0"
-    "glVertexAttribs1fvNV\0"
-    "glVertexAttribs1svNV\0"
-    "glVertexAttribs2dvNV\0"
-    "glVertexAttribs2fvNV\0"
-    "glVertexAttribs2svNV\0"
-    "glVertexAttribs3dvNV\0"
-    "glVertexAttribs3fvNV\0"
-    "glVertexAttribs3svNV\0"
-    "glVertexAttribs4dvNV\0"
-    "glVertexAttribs4fvNV\0"
-    "glVertexAttribs4svNV\0"
-    "glVertexAttribs4ubvNV\0"
-    "glGetTexBumpParameterfvATI\0"
-    "glGetTexBumpParameterivATI\0"
-    "glTexBumpParameterfvATI\0"
-    "glTexBumpParameterivATI\0"
-    "glAlphaFragmentOp1ATI\0"
-    "glAlphaFragmentOp2ATI\0"
-    "glAlphaFragmentOp3ATI\0"
-    "glBeginFragmentShaderATI\0"
-    "glBindFragmentShaderATI\0"
-    "glColorFragmentOp1ATI\0"
-    "glColorFragmentOp2ATI\0"
-    "glColorFragmentOp3ATI\0"
-    "glDeleteFragmentShaderATI\0"
-    "glEndFragmentShaderATI\0"
-    "glGenFragmentShadersATI\0"
-    "glPassTexCoordATI\0"
-    "glSampleMapATI\0"
-    "glSetFragmentShaderConstantATI\0"
-    "glPointParameteriNV\0"
-    "glPointParameterivNV\0"
-    "glActiveStencilFaceEXT\0"
-    "glBindVertexArrayAPPLE\0"
-    "glDeleteVertexArraysAPPLE\0"
-    "glGenVertexArraysAPPLE\0"
-    "glIsVertexArrayAPPLE\0"
-    "glGetProgramNamedParameterdvNV\0"
-    "glGetProgramNamedParameterfvNV\0"
-    "glProgramNamedParameter4dNV\0"
-    "glProgramNamedParameter4dvNV\0"
-    "glProgramNamedParameter4fNV\0"
-    "glProgramNamedParameter4fvNV\0"
-    "glPrimitiveRestartIndexNV\0"
-    "glPrimitiveRestartNV\0"
-    "glDepthBoundsEXT\0"
-    "glBlendEquationSeparateEXT\0"
-    "glBindFramebufferEXT\0"
-    "glBindRenderbufferEXT\0"
-    "glCheckFramebufferStatusEXT\0"
-    "glDeleteFramebuffersEXT\0"
-    "glDeleteRenderbuffersEXT\0"
-    "glFramebufferRenderbufferEXT\0"
-    "glFramebufferTexture1DEXT\0"
-    "glFramebufferTexture2DEXT\0"
-    "glFramebufferTexture3DEXT\0"
-    "glGenFramebuffersEXT\0"
-    "glGenRenderbuffersEXT\0"
-    "glGenerateMipmapEXT\0"
-    "glGetFramebufferAttachmentParameterivEXT\0"
-    "glGetRenderbufferParameterivEXT\0"
-    "glIsFramebufferEXT\0"
-    "glIsRenderbufferEXT\0"
-    "glRenderbufferStorageEXT\0"
-    "glBlitFramebufferEXT\0"
-    "glBufferParameteriAPPLE\0"
-    "glFlushMappedBufferRangeAPPLE\0"
-    "glBindFragDataLocationEXT\0"
-    "glGetFragDataLocationEXT\0"
-    "glGetUniformuivEXT\0"
-    "glGetVertexAttribIivEXT\0"
-    "glGetVertexAttribIuivEXT\0"
-    "glUniform1uiEXT\0"
-    "glUniform1uivEXT\0"
-    "glUniform2uiEXT\0"
-    "glUniform2uivEXT\0"
-    "glUniform3uiEXT\0"
-    "glUniform3uivEXT\0"
-    "glUniform4uiEXT\0"
-    "glUniform4uivEXT\0"
-    "glVertexAttribI1iEXT\0"
-    "glVertexAttribI1ivEXT\0"
-    "glVertexAttribI1uiEXT\0"
-    "glVertexAttribI1uivEXT\0"
-    "glVertexAttribI2iEXT\0"
-    "glVertexAttribI2ivEXT\0"
-    "glVertexAttribI2uiEXT\0"
-    "glVertexAttribI2uivEXT\0"
-    "glVertexAttribI3iEXT\0"
-    "glVertexAttribI3ivEXT\0"
-    "glVertexAttribI3uiEXT\0"
-    "glVertexAttribI3uivEXT\0"
-    "glVertexAttribI4bvEXT\0"
-    "glVertexAttribI4iEXT\0"
-    "glVertexAttribI4ivEXT\0"
-    "glVertexAttribI4svEXT\0"
-    "glVertexAttribI4ubvEXT\0"
-    "glVertexAttribI4uiEXT\0"
-    "glVertexAttribI4uivEXT\0"
-    "glVertexAttribI4usvEXT\0"
-    "glVertexAttribIPointerEXT\0"
-    "glFramebufferTextureLayerEXT\0"
-    "glColorMaskIndexedEXT\0"
-    "glDisableIndexedEXT\0"
-    "glEnableIndexedEXT\0"
-    "glGetBooleanIndexedvEXT\0"
-    "glGetIntegerIndexedvEXT\0"
-    "glIsEnabledIndexedEXT\0"
-    "glClearColorIiEXT\0"
-    "glClearColorIuiEXT\0"
-    "glGetTexParameterIivEXT\0"
-    "glGetTexParameterIuivEXT\0"
-    "glTexParameterIivEXT\0"
-    "glTexParameterIuivEXT\0"
-    "glBeginConditionalRenderNV\0"
-    "glEndConditionalRenderNV\0"
-    "glBeginTransformFeedbackEXT\0"
-    "glBindBufferBaseEXT\0"
-    "glBindBufferOffsetEXT\0"
-    "glBindBufferRangeEXT\0"
-    "glEndTransformFeedbackEXT\0"
-    "glGetTransformFeedbackVaryingEXT\0"
-    "glTransformFeedbackVaryingsEXT\0"
-    "glProvokingVertexEXT\0"
-    "glGetTexParameterPointervAPPLE\0"
-    "glTextureRangeAPPLE\0"
-    "glGetObjectParameterivAPPLE\0"
-    "glObjectPurgeableAPPLE\0"
-    "glObjectUnpurgeableAPPLE\0"
-    "glActiveProgramEXT\0"
-    "glCreateShaderProgramEXT\0"
-    "glUseShaderProgramEXT\0"
-    "glTextureBarrierNV\0"
-    "glStencilFuncSeparateATI\0"
-    "glProgramEnvParameters4fvEXT\0"
-    "glProgramLocalParameters4fvEXT\0"
-    "glGetQueryObjecti64vEXT\0"
-    "glGetQueryObjectui64vEXT\0"
-    "glEGLImageTargetRenderbufferStorageOES\0"
-    "glEGLImageTargetTexture2DOES\0"
-    "glArrayElementEXT\0"
-    "glBindTextureEXT\0"
-    "glDrawArraysEXT\0"
-    "glAreTexturesResidentEXT\0"
-    "glCopyTexImage1DEXT\0"
-    "glCopyTexImage2DEXT\0"
-    "glCopyTexSubImage1DEXT\0"
-    "glCopyTexSubImage2DEXT\0"
-    "glDeleteTexturesEXT\0"
-    "glGenTexturesEXT\0"
-    "glGetPointervEXT\0"
-    "glIsTextureEXT\0"
-    "glPrioritizeTexturesEXT\0"
-    "glTexSubImage1DEXT\0"
-    "glTexSubImage2DEXT\0"
-    "glBlendColorEXT\0"
-    "glBlendEquationEXT\0"
-    "glDrawRangeElementsEXT\0"
-    "glColorTableSGI\0"
-    "glColorTableEXT\0"
-    "glColorTableParameterfvSGI\0"
-    "glColorTableParameterivSGI\0"
-    "glCopyColorTableSGI\0"
-    "glGetColorTableSGI\0"
-    "glGetColorTableEXT\0"
-    "glGetColorTableParameterfvSGI\0"
-    "glGetColorTableParameterfvEXT\0"
-    "glGetColorTableParameterivSGI\0"
-    "glGetColorTableParameterivEXT\0"
-    "glColorSubTableEXT\0"
-    "glCopyColorSubTableEXT\0"
-    "glConvolutionFilter1DEXT\0"
-    "glConvolutionFilter2DEXT\0"
-    "glConvolutionParameterfEXT\0"
-    "glConvolutionParameterfvEXT\0"
-    "glConvolutionParameteriEXT\0"
-    "glConvolutionParameterivEXT\0"
-    "glCopyConvolutionFilter1DEXT\0"
-    "glCopyConvolutionFilter2DEXT\0"
-    "glGetConvolutionFilterEXT\0"
-    "glGetConvolutionParameterfvEXT\0"
-    "glGetConvolutionParameterivEXT\0"
-    "glGetSeparableFilterEXT\0"
-    "glSeparableFilter2DEXT\0"
-    "glGetHistogramEXT\0"
-    "glGetHistogramParameterfvEXT\0"
-    "glGetHistogramParameterivEXT\0"
-    "glGetMinmaxEXT\0"
-    "glGetMinmaxParameterfvEXT\0"
-    "glGetMinmaxParameterivEXT\0"
-    "glHistogramEXT\0"
-    "glMinmaxEXT\0"
-    "glResetHistogramEXT\0"
-    "glResetMinmaxEXT\0"
-    "glTexImage3DEXT\0"
-    "glTexSubImage3DEXT\0"
-    "glCopyTexSubImage3DEXT\0"
-    "glActiveTexture\0"
-    "glClientActiveTexture\0"
-    "glMultiTexCoord1d\0"
-    "glMultiTexCoord1dv\0"
-    "glMultiTexCoord1f\0"
-    "glMultiTexCoord1fv\0"
-    "glMultiTexCoord1i\0"
-    "glMultiTexCoord1iv\0"
-    "glMultiTexCoord1s\0"
-    "glMultiTexCoord1sv\0"
-    "glMultiTexCoord2d\0"
-    "glMultiTexCoord2dv\0"
-    "glMultiTexCoord2f\0"
-    "glMultiTexCoord2fv\0"
-    "glMultiTexCoord2i\0"
-    "glMultiTexCoord2iv\0"
-    "glMultiTexCoord2s\0"
-    "glMultiTexCoord2sv\0"
-    "glMultiTexCoord3d\0"
-    "glMultiTexCoord3dv\0"
-    "glMultiTexCoord3f\0"
-    "glMultiTexCoord3fv\0"
-    "glMultiTexCoord3i\0"
-    "glMultiTexCoord3iv\0"
-    "glMultiTexCoord3s\0"
-    "glMultiTexCoord3sv\0"
-    "glMultiTexCoord4d\0"
-    "glMultiTexCoord4dv\0"
-    "glMultiTexCoord4f\0"
-    "glMultiTexCoord4fv\0"
-    "glMultiTexCoord4i\0"
-    "glMultiTexCoord4iv\0"
-    "glMultiTexCoord4s\0"
-    "glMultiTexCoord4sv\0"
-    "glStencilOpSeparateATI\0"
-    "glLoadTransposeMatrixd\0"
-    "glLoadTransposeMatrixf\0"
-    "glMultTransposeMatrixd\0"
-    "glMultTransposeMatrixf\0"
-    "glSampleCoverage\0"
-    "glCompressedTexImage1D\0"
-    "glCompressedTexImage2D\0"
-    "glCompressedTexImage3D\0"
-    "glCompressedTexSubImage1D\0"
-    "glCompressedTexSubImage2D\0"
-    "glCompressedTexSubImage3D\0"
-    "glGetCompressedTexImage\0"
-    "glDisableVertexAttribArray\0"
-    "glEnableVertexAttribArray\0"
-    "glGetVertexAttribdv\0"
-    "glGetVertexAttribfv\0"
-    "glGetVertexAttribiv\0"
-    "glProgramParameter4dNV\0"
-    "glProgramParameter4dvNV\0"
-    "glProgramParameter4fNV\0"
-    "glProgramParameter4fvNV\0"
-    "glVertexAttrib1d\0"
-    "glVertexAttrib1dv\0"
-    "glVertexAttrib1f\0"
-    "glVertexAttrib1fv\0"
-    "glVertexAttrib1s\0"
-    "glVertexAttrib1sv\0"
-    "glVertexAttrib2d\0"
-    "glVertexAttrib2dv\0"
-    "glVertexAttrib2f\0"
-    "glVertexAttrib2fv\0"
-    "glVertexAttrib2s\0"
-    "glVertexAttrib2sv\0"
-    "glVertexAttrib3d\0"
-    "glVertexAttrib3dv\0"
-    "glVertexAttrib3f\0"
-    "glVertexAttrib3fv\0"
-    "glVertexAttrib3s\0"
-    "glVertexAttrib3sv\0"
-    "glVertexAttrib4Nbv\0"
-    "glVertexAttrib4Niv\0"
-    "glVertexAttrib4Nsv\0"
-    "glVertexAttrib4Nub\0"
-    "glVertexAttrib4Nubv\0"
-    "glVertexAttrib4Nuiv\0"
-    "glVertexAttrib4Nusv\0"
-    "glVertexAttrib4bv\0"
-    "glVertexAttrib4d\0"
-    "glVertexAttrib4dv\0"
-    "glVertexAttrib4f\0"
-    "glVertexAttrib4fv\0"
-    "glVertexAttrib4iv\0"
-    "glVertexAttrib4s\0"
-    "glVertexAttrib4sv\0"
-    "glVertexAttrib4ubv\0"
-    "glVertexAttrib4uiv\0"
-    "glVertexAttrib4usv\0"
-    "glVertexAttribPointer\0"
-    "glBindBuffer\0"
-    "glBufferData\0"
-    "glBufferSubData\0"
-    "glDeleteBuffers\0"
-    "glGenBuffers\0"
-    "glGetBufferParameteriv\0"
-    "glGetBufferPointerv\0"
-    "glGetBufferSubData\0"
-    "glIsBuffer\0"
-    "glMapBuffer\0"
-    "glUnmapBuffer\0"
-    "glBeginQuery\0"
-    "glDeleteQueries\0"
-    "glEndQuery\0"
-    "glGenQueries\0"
-    "glGetQueryObjectiv\0"
-    "glGetQueryObjectuiv\0"
-    "glGetQueryiv\0"
-    "glIsQuery\0"
-    "glCompileShader\0"
-    "glGetActiveUniform\0"
-    "glGetShaderSource\0"
-    "glGetUniformLocation\0"
-    "glGetUniformfv\0"
-    "glGetUniformiv\0"
-    "glLinkProgram\0"
-    "glShaderSource\0"
-    "glUniform1f\0"
-    "glUniform1fv\0"
-    "glUniform1i\0"
-    "glUniform1iv\0"
-    "glUniform2f\0"
-    "glUniform2fv\0"
-    "glUniform2i\0"
-    "glUniform2iv\0"
-    "glUniform3f\0"
-    "glUniform3fv\0"
-    "glUniform3i\0"
-    "glUniform3iv\0"
-    "glUniform4f\0"
-    "glUniform4fv\0"
-    "glUniform4i\0"
-    "glUniform4iv\0"
-    "glUniformMatrix2fv\0"
-    "glUniformMatrix3fv\0"
-    "glUniformMatrix4fv\0"
-    "glUseProgram\0"
-    "glValidateProgram\0"
-    "glBindAttribLocation\0"
-    "glGetActiveAttrib\0"
-    "glGetAttribLocation\0"
-    "glDrawBuffers\0"
-    "glDrawBuffersATI\0"
-    "glDrawBuffersNV\0"
-    "glDrawArraysInstancedEXT\0"
-    "glDrawArraysInstanced\0"
-    "glDrawElementsInstancedEXT\0"
-    "glDrawElementsInstanced\0"
-    "glRenderbufferStorageMultisampleEXT\0"
-    "glBlendEquationSeparateIndexedAMD\0"
-    "glBlendEquationIndexedAMD\0"
-    "glBlendFuncSeparateIndexedAMD\0"
-    "glBlendFuncIndexedAMD\0"
-    "glSampleMaskEXT\0"
-    "glSamplePatternEXT\0"
-    "glPointParameterf\0"
-    "glPointParameterfARB\0"
-    "glPointParameterfSGIS\0"
-    "glPointParameterfv\0"
-    "glPointParameterfvARB\0"
-    "glPointParameterfvSGIS\0"
-    "glSecondaryColor3b\0"
-    "glSecondaryColor3bv\0"
-    "glSecondaryColor3d\0"
-    "glSecondaryColor3dv\0"
-    "glSecondaryColor3f\0"
-    "glSecondaryColor3fv\0"
-    "glSecondaryColor3i\0"
-    "glSecondaryColor3iv\0"
-    "glSecondaryColor3s\0"
-    "glSecondaryColor3sv\0"
-    "glSecondaryColor3ub\0"
-    "glSecondaryColor3ubv\0"
-    "glSecondaryColor3ui\0"
-    "glSecondaryColor3uiv\0"
-    "glSecondaryColor3us\0"
-    "glSecondaryColor3usv\0"
-    "glSecondaryColorPointer\0"
-    "glMultiDrawArrays\0"
-    "glMultiDrawElements\0"
-    "glFogCoordPointer\0"
-    "glFogCoordd\0"
-    "glFogCoorddv\0"
-    "glFogCoordf\0"
-    "glFogCoordfv\0"
-    "glBlendFuncSeparate\0"
-    "glBlendFuncSeparateINGR\0"
-    "glWindowPos2d\0"
-    "glWindowPos2dARB\0"
-    "glWindowPos2dv\0"
-    "glWindowPos2dvARB\0"
-    "glWindowPos2f\0"
-    "glWindowPos2fARB\0"
-    "glWindowPos2fv\0"
-    "glWindowPos2fvARB\0"
-    "glWindowPos2i\0"
-    "glWindowPos2iARB\0"
-    "glWindowPos2iv\0"
-    "glWindowPos2ivARB\0"
-    "glWindowPos2s\0"
-    "glWindowPos2sARB\0"
-    "glWindowPos2sv\0"
-    "glWindowPos2svARB\0"
-    "glWindowPos3d\0"
-    "glWindowPos3dARB\0"
-    "glWindowPos3dv\0"
-    "glWindowPos3dvARB\0"
-    "glWindowPos3f\0"
-    "glWindowPos3fARB\0"
-    "glWindowPos3fv\0"
-    "glWindowPos3fvARB\0"
-    "glWindowPos3i\0"
-    "glWindowPos3iARB\0"
-    "glWindowPos3iv\0"
-    "glWindowPos3ivARB\0"
-    "glWindowPos3s\0"
-    "glWindowPos3sARB\0"
-    "glWindowPos3sv\0"
-    "glWindowPos3svARB\0"
-    "glBindProgramARB\0"
-    "glDeleteProgramsARB\0"
-    "glGenProgramsARB\0"
-    "glGetVertexAttribPointerv\0"
-    "glGetVertexAttribPointervARB\0"
-    "glIsProgramARB\0"
-    "glPointParameteri\0"
-    "glPointParameteriv\0"
-    "glDeleteVertexArrays\0"
-    "glIsVertexArray\0"
-    "glPrimitiveRestartIndex\0"
-    "glBlendEquationSeparate\0"
-    "glBlendEquationSeparateATI\0"
-    "glBindFramebuffer\0"
-    "glBindRenderbuffer\0"
-    "glCheckFramebufferStatus\0"
-    "glDeleteFramebuffers\0"
-    "glDeleteRenderbuffers\0"
-    "glFramebufferRenderbuffer\0"
-    "glFramebufferTexture1D\0"
-    "glFramebufferTexture2D\0"
-    "glFramebufferTexture3D\0"
-    "glGenFramebuffers\0"
-    "glGenRenderbuffers\0"
-    "glGenerateMipmap\0"
-    "glGetFramebufferAttachmentParameteriv\0"
-    "glGetRenderbufferParameteriv\0"
-    "glIsFramebuffer\0"
-    "glIsRenderbuffer\0"
-    "glRenderbufferStorage\0"
-    "glBlitFramebuffer\0"
-    "glBindFragDataLocation\0"
-    "glGetFragDataLocation\0"
-    "glGetUniformuiv\0"
-    "glGetVertexAttribIiv\0"
-    "glGetVertexAttribIuiv\0"
-    "glUniform1ui\0"
-    "glUniform1uiv\0"
-    "glUniform2ui\0"
-    "glUniform2uiv\0"
-    "glUniform3ui\0"
-    "glUniform3uiv\0"
-    "glUniform4ui\0"
-    "glUniform4uiv\0"
-    "glVertexAttribI1i\0"
-    "glVertexAttribI1iv\0"
-    "glVertexAttribI1ui\0"
-    "glVertexAttribI1uiv\0"
-    "glVertexAttribI2i\0"
-    "glVertexAttribI2iv\0"
-    "glVertexAttribI2ui\0"
-    "glVertexAttribI2uiv\0"
-    "glVertexAttribI3i\0"
-    "glVertexAttribI3iv\0"
-    "glVertexAttribI3ui\0"
-    "glVertexAttribI3uiv\0"
-    "glVertexAttribI4bv\0"
-    "glVertexAttribI4i\0"
-    "glVertexAttribI4iv\0"
-    "glVertexAttribI4sv\0"
-    "glVertexAttribI4ubv\0"
-    "glVertexAttribI4ui\0"
-    "glVertexAttribI4uiv\0"
-    "glVertexAttribI4usv\0"
-    "glVertexAttribIPointer\0"
-    "glFramebufferTextureLayer\0"
-    "glFramebufferTextureLayerARB\0"
-    "glColorMaski\0"
-    "glDisablei\0"
-    "glEnablei\0"
-    "glGetBooleani_v\0"
-    "glGetIntegeri_v\0"
-    "glIsEnabledi\0"
-    "glGetTexParameterIiv\0"
-    "glGetTexParameterIuiv\0"
-    "glTexParameterIiv\0"
-    "glTexParameterIuiv\0"
-    "glBeginConditionalRender\0"
-    "glEndConditionalRender\0"
-    "glBeginTransformFeedback\0"
-    "glBindBufferBase\0"
-    "glBindBufferRange\0"
-    "glEndTransformFeedback\0"
-    "glGetTransformFeedbackVarying\0"
-    "glTransformFeedbackVaryings\0" "glProvokingVertex\0";
-
-#ifdef USE_MGL_NAMESPACE
-#define gl_dispatch_stub_343 mgl_dispatch_stub_343
-#define gl_dispatch_stub_344 mgl_dispatch_stub_344
-#define gl_dispatch_stub_345 mgl_dispatch_stub_345
-#define gl_dispatch_stub_356 mgl_dispatch_stub_356
-#define gl_dispatch_stub_357 mgl_dispatch_stub_357
-#define gl_dispatch_stub_358 mgl_dispatch_stub_358
-#define gl_dispatch_stub_359 mgl_dispatch_stub_359
-#define gl_dispatch_stub_361 mgl_dispatch_stub_361
-#define gl_dispatch_stub_362 mgl_dispatch_stub_362
-#define gl_dispatch_stub_363 mgl_dispatch_stub_363
-#define gl_dispatch_stub_364 mgl_dispatch_stub_364
-#define gl_dispatch_stub_365 mgl_dispatch_stub_365
-#define gl_dispatch_stub_366 mgl_dispatch_stub_366
-#define gl_dispatch_stub_692 mgl_dispatch_stub_692
-#define gl_dispatch_stub_693 mgl_dispatch_stub_693
-#define gl_dispatch_stub_694 mgl_dispatch_stub_694
-#define gl_dispatch_stub_695 mgl_dispatch_stub_695
-#define gl_dispatch_stub_696 mgl_dispatch_stub_696
-#define gl_dispatch_stub_697 mgl_dispatch_stub_697
-#define gl_dispatch_stub_698 mgl_dispatch_stub_698
-#define gl_dispatch_stub_699 mgl_dispatch_stub_699
-#define gl_dispatch_stub_734 mgl_dispatch_stub_734
-#define gl_dispatch_stub_776 mgl_dispatch_stub_776
-#define gl_dispatch_stub_777 mgl_dispatch_stub_777
-#define gl_dispatch_stub_778 mgl_dispatch_stub_778
-#define gl_dispatch_stub_779 mgl_dispatch_stub_779
-#define gl_dispatch_stub_780 mgl_dispatch_stub_780
-#define gl_dispatch_stub_781 mgl_dispatch_stub_781
-#define gl_dispatch_stub_782 mgl_dispatch_stub_782
-#define gl_dispatch_stub_783 mgl_dispatch_stub_783
-#define gl_dispatch_stub_784 mgl_dispatch_stub_784
-#define gl_dispatch_stub_865 mgl_dispatch_stub_865
-#define gl_dispatch_stub_866 mgl_dispatch_stub_866
-#define gl_dispatch_stub_867 mgl_dispatch_stub_867
-#define gl_dispatch_stub_868 mgl_dispatch_stub_868
-#define gl_dispatch_stub_869 mgl_dispatch_stub_869
-#define gl_dispatch_stub_878 mgl_dispatch_stub_878
-#define gl_dispatch_stub_879 mgl_dispatch_stub_879
-#define gl_dispatch_stub_897 mgl_dispatch_stub_897
-#define gl_dispatch_stub_898 mgl_dispatch_stub_898
-#define gl_dispatch_stub_899 mgl_dispatch_stub_899
-#define gl_dispatch_stub_957 mgl_dispatch_stub_957
-#define gl_dispatch_stub_958 mgl_dispatch_stub_958
-#define gl_dispatch_stub_966 mgl_dispatch_stub_966
-#define gl_dispatch_stub_967 mgl_dispatch_stub_967
-#define gl_dispatch_stub_968 mgl_dispatch_stub_968
-#define gl_dispatch_stub_969 mgl_dispatch_stub_969
-#define gl_dispatch_stub_970 mgl_dispatch_stub_970
-#endif                          /* USE_MGL_NAMESPACE */
-
-#if defined(NEED_FUNCTION_POINTER) || defined(GLX_INDIRECT_RENDERING)
-void GLAPIENTRY gl_dispatch_stub_343(GLenum target, GLenum format, GLenum type,
-                                     GLvoid * table);
-void GLAPIENTRY gl_dispatch_stub_344(GLenum target, GLenum pname,
-                                     GLfloat * params);
-void GLAPIENTRY gl_dispatch_stub_345(GLenum target, GLenum pname,
-                                     GLint * params);
-void GLAPIENTRY gl_dispatch_stub_356(GLenum target, GLenum format, GLenum type,
-                                     GLvoid * image);
-void GLAPIENTRY gl_dispatch_stub_357(GLenum target, GLenum pname,
-                                     GLfloat * params);
-void GLAPIENTRY gl_dispatch_stub_358(GLenum target, GLenum pname,
-                                     GLint * params);
-void GLAPIENTRY gl_dispatch_stub_359(GLenum target, GLenum format, GLenum type,
-                                     GLvoid * row, GLvoid * column,
-                                     GLvoid * span);
-void GLAPIENTRY gl_dispatch_stub_361(GLenum target, GLboolean reset,
-                                     GLenum format, GLenum type,
-                                     GLvoid * values);
-void GLAPIENTRY gl_dispatch_stub_362(GLenum target, GLenum pname,
-                                     GLfloat * params);
-void GLAPIENTRY gl_dispatch_stub_363(GLenum target, GLenum pname,
-                                     GLint * params);
-void GLAPIENTRY gl_dispatch_stub_364(GLenum target, GLboolean reset,
-                                     GLenum format, GLenum type,
-                                     GLvoid * values);
-void GLAPIENTRY gl_dispatch_stub_365(GLenum target, GLenum pname,
-                                     GLfloat * params);
-void GLAPIENTRY gl_dispatch_stub_366(GLenum target, GLenum pname,
-                                     GLint * params);
-void GLAPIENTRY gl_dispatch_stub_692(GLenum pname, GLfloat * params);
-void GLAPIENTRY gl_dispatch_stub_693(GLenum pname, GLint * params);
-void GLAPIENTRY gl_dispatch_stub_694(GLenum pname, GLfloat param);
-void GLAPIENTRY gl_dispatch_stub_695(GLenum pname, const GLfloat * params);
-void GLAPIENTRY gl_dispatch_stub_696(GLenum pname, GLint param);
-void GLAPIENTRY gl_dispatch_stub_697(GLenum pname, const GLint * params);
-void GLAPIENTRY gl_dispatch_stub_698(GLclampf value, GLboolean invert);
-void GLAPIENTRY gl_dispatch_stub_699(GLenum pattern);
-void GLAPIENTRY gl_dispatch_stub_734(GLenum mode);
-void GLAPIENTRY gl_dispatch_stub_776(const GLenum * mode, const GLint * first,
-                                     const GLsizei * count, GLsizei primcount,
-                                     GLint modestride);
-void GLAPIENTRY gl_dispatch_stub_777(const GLenum * mode, const GLsizei * count,
-                                     GLenum type, const GLvoid * const *indices,
-                                     GLsizei primcount, GLint modestride);
-void GLAPIENTRY gl_dispatch_stub_778(GLsizei n, const GLuint * fences);
-void GLAPIENTRY gl_dispatch_stub_779(GLuint fence);
-void GLAPIENTRY gl_dispatch_stub_780(GLsizei n, GLuint * fences);
-void GLAPIENTRY gl_dispatch_stub_781(GLuint fence, GLenum pname,
-                                     GLint * params);
-GLboolean GLAPIENTRY gl_dispatch_stub_782(GLuint fence);
-void GLAPIENTRY gl_dispatch_stub_783(GLuint fence, GLenum condition);
-GLboolean GLAPIENTRY gl_dispatch_stub_784(GLuint fence);
-void GLAPIENTRY gl_dispatch_stub_865(GLenum face);
-void GLAPIENTRY gl_dispatch_stub_866(GLuint array);
-void GLAPIENTRY gl_dispatch_stub_867(GLsizei n, const GLuint * arrays);
-void GLAPIENTRY gl_dispatch_stub_868(GLsizei n, GLuint * arrays);
-GLboolean GLAPIENTRY gl_dispatch_stub_869(GLuint array);
-void GLAPIENTRY gl_dispatch_stub_878(GLclampd zmin, GLclampd zmax);
-void GLAPIENTRY gl_dispatch_stub_879(GLenum modeRGB, GLenum modeA);
-void GLAPIENTRY gl_dispatch_stub_897(GLint srcX0, GLint srcY0, GLint srcX1,
-                                     GLint srcY1, GLint dstX0, GLint dstY0,
-                                     GLint dstX1, GLint dstY1, GLbitfield mask,
-                                     GLenum filter);
-void GLAPIENTRY gl_dispatch_stub_898(GLenum target, GLenum pname, GLint param);
-void GLAPIENTRY gl_dispatch_stub_899(GLenum target, GLintptr offset,
-                                     GLsizeiptr size);
-void GLAPIENTRY gl_dispatch_stub_957(GLenum target, GLenum pname,
-                                     GLvoid ** params);
-void GLAPIENTRY gl_dispatch_stub_958(GLenum target, GLsizei length,
-                                     GLvoid * pointer);
-void GLAPIENTRY gl_dispatch_stub_966(GLenum frontfunc, GLenum backfunc,
-                                     GLint ref, GLuint mask);
-void GLAPIENTRY gl_dispatch_stub_967(GLenum target, GLuint index, GLsizei count,
-                                     const GLfloat * params);
-void GLAPIENTRY gl_dispatch_stub_968(GLenum target, GLuint index, GLsizei count,
-                                     const GLfloat * params);
-void GLAPIENTRY gl_dispatch_stub_969(GLuint id, GLenum pname,
-                                     GLint64EXT * params);
-void GLAPIENTRY gl_dispatch_stub_970(GLuint id, GLenum pname,
-                                     GLuint64EXT * params);
-#endif                          /* defined(NEED_FUNCTION_POINTER) || defined(GLX_INDIRECT_RENDERING) */
-
-static const glprocs_table_t static_functions[] = {
-    NAME_FUNC_OFFSET(0, glNewList, glNewList, NULL, 0),
-    NAME_FUNC_OFFSET(10, glEndList, glEndList, NULL, 1),
-    NAME_FUNC_OFFSET(20, glCallList, glCallList, NULL, 2),
-    NAME_FUNC_OFFSET(31, glCallLists, glCallLists, NULL, 3),
-    NAME_FUNC_OFFSET(43, glDeleteLists, glDeleteLists, NULL, 4),
-    NAME_FUNC_OFFSET(57, glGenLists, glGenLists, NULL, 5),
-    NAME_FUNC_OFFSET(68, glListBase, glListBase, NULL, 6),
-    NAME_FUNC_OFFSET(79, glBegin, glBegin, NULL, 7),
-    NAME_FUNC_OFFSET(87, glBitmap, glBitmap, NULL, 8),
-    NAME_FUNC_OFFSET(96, glColor3b, glColor3b, NULL, 9),
-    NAME_FUNC_OFFSET(106, glColor3bv, glColor3bv, NULL, 10),
-    NAME_FUNC_OFFSET(117, glColor3d, glColor3d, NULL, 11),
-    NAME_FUNC_OFFSET(127, glColor3dv, glColor3dv, NULL, 12),
-    NAME_FUNC_OFFSET(138, glColor3f, glColor3f, NULL, 13),
-    NAME_FUNC_OFFSET(148, glColor3fv, glColor3fv, NULL, 14),
-    NAME_FUNC_OFFSET(159, glColor3i, glColor3i, NULL, 15),
-    NAME_FUNC_OFFSET(169, glColor3iv, glColor3iv, NULL, 16),
-    NAME_FUNC_OFFSET(180, glColor3s, glColor3s, NULL, 17),
-    NAME_FUNC_OFFSET(190, glColor3sv, glColor3sv, NULL, 18),
-    NAME_FUNC_OFFSET(201, glColor3ub, glColor3ub, NULL, 19),
-    NAME_FUNC_OFFSET(212, glColor3ubv, glColor3ubv, NULL, 20),
-    NAME_FUNC_OFFSET(224, glColor3ui, glColor3ui, NULL, 21),
-    NAME_FUNC_OFFSET(235, glColor3uiv, glColor3uiv, NULL, 22),
-    NAME_FUNC_OFFSET(247, glColor3us, glColor3us, NULL, 23),
-    NAME_FUNC_OFFSET(258, glColor3usv, glColor3usv, NULL, 24),
-    NAME_FUNC_OFFSET(270, glColor4b, glColor4b, NULL, 25),
-    NAME_FUNC_OFFSET(280, glColor4bv, glColor4bv, NULL, 26),
-    NAME_FUNC_OFFSET(291, glColor4d, glColor4d, NULL, 27),
-    NAME_FUNC_OFFSET(301, glColor4dv, glColor4dv, NULL, 28),
-    NAME_FUNC_OFFSET(312, glColor4f, glColor4f, NULL, 29),
-    NAME_FUNC_OFFSET(322, glColor4fv, glColor4fv, NULL, 30),
-    NAME_FUNC_OFFSET(333, glColor4i, glColor4i, NULL, 31),
-    NAME_FUNC_OFFSET(343, glColor4iv, glColor4iv, NULL, 32),
-    NAME_FUNC_OFFSET(354, glColor4s, glColor4s, NULL, 33),
-    NAME_FUNC_OFFSET(364, glColor4sv, glColor4sv, NULL, 34),
-    NAME_FUNC_OFFSET(375, glColor4ub, glColor4ub, NULL, 35),
-    NAME_FUNC_OFFSET(386, glColor4ubv, glColor4ubv, NULL, 36),
-    NAME_FUNC_OFFSET(398, glColor4ui, glColor4ui, NULL, 37),
-    NAME_FUNC_OFFSET(409, glColor4uiv, glColor4uiv, NULL, 38),
-    NAME_FUNC_OFFSET(421, glColor4us, glColor4us, NULL, 39),
-    NAME_FUNC_OFFSET(432, glColor4usv, glColor4usv, NULL, 40),
-    NAME_FUNC_OFFSET(444, glEdgeFlag, glEdgeFlag, NULL, 41),
-    NAME_FUNC_OFFSET(455, glEdgeFlagv, glEdgeFlagv, NULL, 42),
-    NAME_FUNC_OFFSET(467, glEnd, glEnd, NULL, 43),
-    NAME_FUNC_OFFSET(473, glIndexd, glIndexd, NULL, 44),
-    NAME_FUNC_OFFSET(482, glIndexdv, glIndexdv, NULL, 45),
-    NAME_FUNC_OFFSET(492, glIndexf, glIndexf, NULL, 46),
-    NAME_FUNC_OFFSET(501, glIndexfv, glIndexfv, NULL, 47),
-    NAME_FUNC_OFFSET(511, glIndexi, glIndexi, NULL, 48),
-    NAME_FUNC_OFFSET(520, glIndexiv, glIndexiv, NULL, 49),
-    NAME_FUNC_OFFSET(530, glIndexs, glIndexs, NULL, 50),
-    NAME_FUNC_OFFSET(539, glIndexsv, glIndexsv, NULL, 51),
-    NAME_FUNC_OFFSET(549, glNormal3b, glNormal3b, NULL, 52),
-    NAME_FUNC_OFFSET(560, glNormal3bv, glNormal3bv, NULL, 53),
-    NAME_FUNC_OFFSET(572, glNormal3d, glNormal3d, NULL, 54),
-    NAME_FUNC_OFFSET(583, glNormal3dv, glNormal3dv, NULL, 55),
-    NAME_FUNC_OFFSET(595, glNormal3f, glNormal3f, NULL, 56),
-    NAME_FUNC_OFFSET(606, glNormal3fv, glNormal3fv, NULL, 57),
-    NAME_FUNC_OFFSET(618, glNormal3i, glNormal3i, NULL, 58),
-    NAME_FUNC_OFFSET(629, glNormal3iv, glNormal3iv, NULL, 59),
-    NAME_FUNC_OFFSET(641, glNormal3s, glNormal3s, NULL, 60),
-    NAME_FUNC_OFFSET(652, glNormal3sv, glNormal3sv, NULL, 61),
-    NAME_FUNC_OFFSET(664, glRasterPos2d, glRasterPos2d, NULL, 62),
-    NAME_FUNC_OFFSET(678, glRasterPos2dv, glRasterPos2dv, NULL, 63),
-    NAME_FUNC_OFFSET(693, glRasterPos2f, glRasterPos2f, NULL, 64),
-    NAME_FUNC_OFFSET(707, glRasterPos2fv, glRasterPos2fv, NULL, 65),
-    NAME_FUNC_OFFSET(722, glRasterPos2i, glRasterPos2i, NULL, 66),
-    NAME_FUNC_OFFSET(736, glRasterPos2iv, glRasterPos2iv, NULL, 67),
-    NAME_FUNC_OFFSET(751, glRasterPos2s, glRasterPos2s, NULL, 68),
-    NAME_FUNC_OFFSET(765, glRasterPos2sv, glRasterPos2sv, NULL, 69),
-    NAME_FUNC_OFFSET(780, glRasterPos3d, glRasterPos3d, NULL, 70),
-    NAME_FUNC_OFFSET(794, glRasterPos3dv, glRasterPos3dv, NULL, 71),
-    NAME_FUNC_OFFSET(809, glRasterPos3f, glRasterPos3f, NULL, 72),
-    NAME_FUNC_OFFSET(823, glRasterPos3fv, glRasterPos3fv, NULL, 73),
-    NAME_FUNC_OFFSET(838, glRasterPos3i, glRasterPos3i, NULL, 74),
-    NAME_FUNC_OFFSET(852, glRasterPos3iv, glRasterPos3iv, NULL, 75),
-    NAME_FUNC_OFFSET(867, glRasterPos3s, glRasterPos3s, NULL, 76),
-    NAME_FUNC_OFFSET(881, glRasterPos3sv, glRasterPos3sv, NULL, 77),
-    NAME_FUNC_OFFSET(896, glRasterPos4d, glRasterPos4d, NULL, 78),
-    NAME_FUNC_OFFSET(910, glRasterPos4dv, glRasterPos4dv, NULL, 79),
-    NAME_FUNC_OFFSET(925, glRasterPos4f, glRasterPos4f, NULL, 80),
-    NAME_FUNC_OFFSET(939, glRasterPos4fv, glRasterPos4fv, NULL, 81),
-    NAME_FUNC_OFFSET(954, glRasterPos4i, glRasterPos4i, NULL, 82),
-    NAME_FUNC_OFFSET(968, glRasterPos4iv, glRasterPos4iv, NULL, 83),
-    NAME_FUNC_OFFSET(983, glRasterPos4s, glRasterPos4s, NULL, 84),
-    NAME_FUNC_OFFSET(997, glRasterPos4sv, glRasterPos4sv, NULL, 85),
-    NAME_FUNC_OFFSET(1012, glRectd, glRectd, NULL, 86),
-    NAME_FUNC_OFFSET(1020, glRectdv, glRectdv, NULL, 87),
-    NAME_FUNC_OFFSET(1029, glRectf, glRectf, NULL, 88),
-    NAME_FUNC_OFFSET(1037, glRectfv, glRectfv, NULL, 89),
-    NAME_FUNC_OFFSET(1046, glRecti, glRecti, NULL, 90),
-    NAME_FUNC_OFFSET(1054, glRectiv, glRectiv, NULL, 91),
-    NAME_FUNC_OFFSET(1063, glRects, glRects, NULL, 92),
-    NAME_FUNC_OFFSET(1071, glRectsv, glRectsv, NULL, 93),
-    NAME_FUNC_OFFSET(1080, glTexCoord1d, glTexCoord1d, NULL, 94),
-    NAME_FUNC_OFFSET(1093, glTexCoord1dv, glTexCoord1dv, NULL, 95),
-    NAME_FUNC_OFFSET(1107, glTexCoord1f, glTexCoord1f, NULL, 96),
-    NAME_FUNC_OFFSET(1120, glTexCoord1fv, glTexCoord1fv, NULL, 97),
-    NAME_FUNC_OFFSET(1134, glTexCoord1i, glTexCoord1i, NULL, 98),
-    NAME_FUNC_OFFSET(1147, glTexCoord1iv, glTexCoord1iv, NULL, 99),
-    NAME_FUNC_OFFSET(1161, glTexCoord1s, glTexCoord1s, NULL, 100),
-    NAME_FUNC_OFFSET(1174, glTexCoord1sv, glTexCoord1sv, NULL, 101),
-    NAME_FUNC_OFFSET(1188, glTexCoord2d, glTexCoord2d, NULL, 102),
-    NAME_FUNC_OFFSET(1201, glTexCoord2dv, glTexCoord2dv, NULL, 103),
-    NAME_FUNC_OFFSET(1215, glTexCoord2f, glTexCoord2f, NULL, 104),
-    NAME_FUNC_OFFSET(1228, glTexCoord2fv, glTexCoord2fv, NULL, 105),
-    NAME_FUNC_OFFSET(1242, glTexCoord2i, glTexCoord2i, NULL, 106),
-    NAME_FUNC_OFFSET(1255, glTexCoord2iv, glTexCoord2iv, NULL, 107),
-    NAME_FUNC_OFFSET(1269, glTexCoord2s, glTexCoord2s, NULL, 108),
-    NAME_FUNC_OFFSET(1282, glTexCoord2sv, glTexCoord2sv, NULL, 109),
-    NAME_FUNC_OFFSET(1296, glTexCoord3d, glTexCoord3d, NULL, 110),
-    NAME_FUNC_OFFSET(1309, glTexCoord3dv, glTexCoord3dv, NULL, 111),
-    NAME_FUNC_OFFSET(1323, glTexCoord3f, glTexCoord3f, NULL, 112),
-    NAME_FUNC_OFFSET(1336, glTexCoord3fv, glTexCoord3fv, NULL, 113),
-    NAME_FUNC_OFFSET(1350, glTexCoord3i, glTexCoord3i, NULL, 114),
-    NAME_FUNC_OFFSET(1363, glTexCoord3iv, glTexCoord3iv, NULL, 115),
-    NAME_FUNC_OFFSET(1377, glTexCoord3s, glTexCoord3s, NULL, 116),
-    NAME_FUNC_OFFSET(1390, glTexCoord3sv, glTexCoord3sv, NULL, 117),
-    NAME_FUNC_OFFSET(1404, glTexCoord4d, glTexCoord4d, NULL, 118),
-    NAME_FUNC_OFFSET(1417, glTexCoord4dv, glTexCoord4dv, NULL, 119),
-    NAME_FUNC_OFFSET(1431, glTexCoord4f, glTexCoord4f, NULL, 120),
-    NAME_FUNC_OFFSET(1444, glTexCoord4fv, glTexCoord4fv, NULL, 121),
-    NAME_FUNC_OFFSET(1458, glTexCoord4i, glTexCoord4i, NULL, 122),
-    NAME_FUNC_OFFSET(1471, glTexCoord4iv, glTexCoord4iv, NULL, 123),
-    NAME_FUNC_OFFSET(1485, glTexCoord4s, glTexCoord4s, NULL, 124),
-    NAME_FUNC_OFFSET(1498, glTexCoord4sv, glTexCoord4sv, NULL, 125),
-    NAME_FUNC_OFFSET(1512, glVertex2d, glVertex2d, NULL, 126),
-    NAME_FUNC_OFFSET(1523, glVertex2dv, glVertex2dv, NULL, 127),
-    NAME_FUNC_OFFSET(1535, glVertex2f, glVertex2f, NULL, 128),
-    NAME_FUNC_OFFSET(1546, glVertex2fv, glVertex2fv, NULL, 129),
-    NAME_FUNC_OFFSET(1558, glVertex2i, glVertex2i, NULL, 130),
-    NAME_FUNC_OFFSET(1569, glVertex2iv, glVertex2iv, NULL, 131),
-    NAME_FUNC_OFFSET(1581, glVertex2s, glVertex2s, NULL, 132),
-    NAME_FUNC_OFFSET(1592, glVertex2sv, glVertex2sv, NULL, 133),
-    NAME_FUNC_OFFSET(1604, glVertex3d, glVertex3d, NULL, 134),
-    NAME_FUNC_OFFSET(1615, glVertex3dv, glVertex3dv, NULL, 135),
-    NAME_FUNC_OFFSET(1627, glVertex3f, glVertex3f, NULL, 136),
-    NAME_FUNC_OFFSET(1638, glVertex3fv, glVertex3fv, NULL, 137),
-    NAME_FUNC_OFFSET(1650, glVertex3i, glVertex3i, NULL, 138),
-    NAME_FUNC_OFFSET(1661, glVertex3iv, glVertex3iv, NULL, 139),
-    NAME_FUNC_OFFSET(1673, glVertex3s, glVertex3s, NULL, 140),
-    NAME_FUNC_OFFSET(1684, glVertex3sv, glVertex3sv, NULL, 141),
-    NAME_FUNC_OFFSET(1696, glVertex4d, glVertex4d, NULL, 142),
-    NAME_FUNC_OFFSET(1707, glVertex4dv, glVertex4dv, NULL, 143),
-    NAME_FUNC_OFFSET(1719, glVertex4f, glVertex4f, NULL, 144),
-    NAME_FUNC_OFFSET(1730, glVertex4fv, glVertex4fv, NULL, 145),
-    NAME_FUNC_OFFSET(1742, glVertex4i, glVertex4i, NULL, 146),
-    NAME_FUNC_OFFSET(1753, glVertex4iv, glVertex4iv, NULL, 147),
-    NAME_FUNC_OFFSET(1765, glVertex4s, glVertex4s, NULL, 148),
-    NAME_FUNC_OFFSET(1776, glVertex4sv, glVertex4sv, NULL, 149),
-    NAME_FUNC_OFFSET(1788, glClipPlane, glClipPlane, NULL, 150),
-    NAME_FUNC_OFFSET(1800, glColorMaterial, glColorMaterial, NULL, 151),
-    NAME_FUNC_OFFSET(1816, glCullFace, glCullFace, NULL, 152),
-    NAME_FUNC_OFFSET(1827, glFogf, glFogf, NULL, 153),
-    NAME_FUNC_OFFSET(1834, glFogfv, glFogfv, NULL, 154),
-    NAME_FUNC_OFFSET(1842, glFogi, glFogi, NULL, 155),
-    NAME_FUNC_OFFSET(1849, glFogiv, glFogiv, NULL, 156),
-    NAME_FUNC_OFFSET(1857, glFrontFace, glFrontFace, NULL, 157),
-    NAME_FUNC_OFFSET(1869, glHint, glHint, NULL, 158),
-    NAME_FUNC_OFFSET(1876, glLightf, glLightf, NULL, 159),
-    NAME_FUNC_OFFSET(1885, glLightfv, glLightfv, NULL, 160),
-    NAME_FUNC_OFFSET(1895, glLighti, glLighti, NULL, 161),
-    NAME_FUNC_OFFSET(1904, glLightiv, glLightiv, NULL, 162),
-    NAME_FUNC_OFFSET(1914, glLightModelf, glLightModelf, NULL, 163),
-    NAME_FUNC_OFFSET(1928, glLightModelfv, glLightModelfv, NULL, 164),
-    NAME_FUNC_OFFSET(1943, glLightModeli, glLightModeli, NULL, 165),
-    NAME_FUNC_OFFSET(1957, glLightModeliv, glLightModeliv, NULL, 166),
-    NAME_FUNC_OFFSET(1972, glLineStipple, glLineStipple, NULL, 167),
-    NAME_FUNC_OFFSET(1986, glLineWidth, glLineWidth, NULL, 168),
-    NAME_FUNC_OFFSET(1998, glMaterialf, glMaterialf, NULL, 169),
-    NAME_FUNC_OFFSET(2010, glMaterialfv, glMaterialfv, NULL, 170),
-    NAME_FUNC_OFFSET(2023, glMateriali, glMateriali, NULL, 171),
-    NAME_FUNC_OFFSET(2035, glMaterialiv, glMaterialiv, NULL, 172),
-    NAME_FUNC_OFFSET(2048, glPointSize, glPointSize, NULL, 173),
-    NAME_FUNC_OFFSET(2060, glPolygonMode, glPolygonMode, NULL, 174),
-    NAME_FUNC_OFFSET(2074, glPolygonStipple, glPolygonStipple, NULL, 175),
-    NAME_FUNC_OFFSET(2091, glScissor, glScissor, NULL, 176),
-    NAME_FUNC_OFFSET(2101, glShadeModel, glShadeModel, NULL, 177),
-    NAME_FUNC_OFFSET(2114, glTexParameterf, glTexParameterf, NULL, 178),
-    NAME_FUNC_OFFSET(2130, glTexParameterfv, glTexParameterfv, NULL, 179),
-    NAME_FUNC_OFFSET(2147, glTexParameteri, glTexParameteri, NULL, 180),
-    NAME_FUNC_OFFSET(2163, glTexParameteriv, glTexParameteriv, NULL, 181),
-    NAME_FUNC_OFFSET(2180, glTexImage1D, glTexImage1D, NULL, 182),
-    NAME_FUNC_OFFSET(2193, glTexImage2D, glTexImage2D, NULL, 183),
-    NAME_FUNC_OFFSET(2206, glTexEnvf, glTexEnvf, NULL, 184),
-    NAME_FUNC_OFFSET(2216, glTexEnvfv, glTexEnvfv, NULL, 185),
-    NAME_FUNC_OFFSET(2227, glTexEnvi, glTexEnvi, NULL, 186),
-    NAME_FUNC_OFFSET(2237, glTexEnviv, glTexEnviv, NULL, 187),
-    NAME_FUNC_OFFSET(2248, glTexGend, glTexGend, NULL, 188),
-    NAME_FUNC_OFFSET(2258, glTexGendv, glTexGendv, NULL, 189),
-    NAME_FUNC_OFFSET(2269, glTexGenf, glTexGenf, NULL, 190),
-    NAME_FUNC_OFFSET(2279, glTexGenfv, glTexGenfv, NULL, 191),
-    NAME_FUNC_OFFSET(2290, glTexGeni, glTexGeni, NULL, 192),
-    NAME_FUNC_OFFSET(2300, glTexGeniv, glTexGeniv, NULL, 193),
-    NAME_FUNC_OFFSET(2311, glFeedbackBuffer, glFeedbackBuffer, NULL, 194),
-    NAME_FUNC_OFFSET(2328, glSelectBuffer, glSelectBuffer, NULL, 195),
-    NAME_FUNC_OFFSET(2343, glRenderMode, glRenderMode, NULL, 196),
-    NAME_FUNC_OFFSET(2356, glInitNames, glInitNames, NULL, 197),
-    NAME_FUNC_OFFSET(2368, glLoadName, glLoadName, NULL, 198),
-    NAME_FUNC_OFFSET(2379, glPassThrough, glPassThrough, NULL, 199),
-    NAME_FUNC_OFFSET(2393, glPopName, glPopName, NULL, 200),
-    NAME_FUNC_OFFSET(2403, glPushName, glPushName, NULL, 201),
-    NAME_FUNC_OFFSET(2414, glDrawBuffer, glDrawBuffer, NULL, 202),
-    NAME_FUNC_OFFSET(2427, glClear, glClear, NULL, 203),
-    NAME_FUNC_OFFSET(2435, glClearAccum, glClearAccum, NULL, 204),
-    NAME_FUNC_OFFSET(2448, glClearIndex, glClearIndex, NULL, 205),
-    NAME_FUNC_OFFSET(2461, glClearColor, glClearColor, NULL, 206),
-    NAME_FUNC_OFFSET(2474, glClearStencil, glClearStencil, NULL, 207),
-    NAME_FUNC_OFFSET(2489, glClearDepth, glClearDepth, NULL, 208),
-    NAME_FUNC_OFFSET(2502, glStencilMask, glStencilMask, NULL, 209),
-    NAME_FUNC_OFFSET(2516, glColorMask, glColorMask, NULL, 210),
-    NAME_FUNC_OFFSET(2528, glDepthMask, glDepthMask, NULL, 211),
-    NAME_FUNC_OFFSET(2540, glIndexMask, glIndexMask, NULL, 212),
-    NAME_FUNC_OFFSET(2552, glAccum, glAccum, NULL, 213),
-    NAME_FUNC_OFFSET(2560, glDisable, glDisable, NULL, 214),
-    NAME_FUNC_OFFSET(2570, glEnable, glEnable, NULL, 215),
-    NAME_FUNC_OFFSET(2579, glFinish, glFinish, NULL, 216),
-    NAME_FUNC_OFFSET(2588, glFlush, glFlush, NULL, 217),
-    NAME_FUNC_OFFSET(2596, glPopAttrib, glPopAttrib, NULL, 218),
-    NAME_FUNC_OFFSET(2608, glPushAttrib, glPushAttrib, NULL, 219),
-    NAME_FUNC_OFFSET(2621, glMap1d, glMap1d, NULL, 220),
-    NAME_FUNC_OFFSET(2629, glMap1f, glMap1f, NULL, 221),
-    NAME_FUNC_OFFSET(2637, glMap2d, glMap2d, NULL, 222),
-    NAME_FUNC_OFFSET(2645, glMap2f, glMap2f, NULL, 223),
-    NAME_FUNC_OFFSET(2653, glMapGrid1d, glMapGrid1d, NULL, 224),
-    NAME_FUNC_OFFSET(2665, glMapGrid1f, glMapGrid1f, NULL, 225),
-    NAME_FUNC_OFFSET(2677, glMapGrid2d, glMapGrid2d, NULL, 226),
-    NAME_FUNC_OFFSET(2689, glMapGrid2f, glMapGrid2f, NULL, 227),
-    NAME_FUNC_OFFSET(2701, glEvalCoord1d, glEvalCoord1d, NULL, 228),
-    NAME_FUNC_OFFSET(2715, glEvalCoord1dv, glEvalCoord1dv, NULL, 229),
-    NAME_FUNC_OFFSET(2730, glEvalCoord1f, glEvalCoord1f, NULL, 230),
-    NAME_FUNC_OFFSET(2744, glEvalCoord1fv, glEvalCoord1fv, NULL, 231),
-    NAME_FUNC_OFFSET(2759, glEvalCoord2d, glEvalCoord2d, NULL, 232),
-    NAME_FUNC_OFFSET(2773, glEvalCoord2dv, glEvalCoord2dv, NULL, 233),
-    NAME_FUNC_OFFSET(2788, glEvalCoord2f, glEvalCoord2f, NULL, 234),
-    NAME_FUNC_OFFSET(2802, glEvalCoord2fv, glEvalCoord2fv, NULL, 235),
-    NAME_FUNC_OFFSET(2817, glEvalMesh1, glEvalMesh1, NULL, 236),
-    NAME_FUNC_OFFSET(2829, glEvalPoint1, glEvalPoint1, NULL, 237),
-    NAME_FUNC_OFFSET(2842, glEvalMesh2, glEvalMesh2, NULL, 238),
-    NAME_FUNC_OFFSET(2854, glEvalPoint2, glEvalPoint2, NULL, 239),
-    NAME_FUNC_OFFSET(2867, glAlphaFunc, glAlphaFunc, NULL, 240),
-    NAME_FUNC_OFFSET(2879, glBlendFunc, glBlendFunc, NULL, 241),
-    NAME_FUNC_OFFSET(2891, glLogicOp, glLogicOp, NULL, 242),
-    NAME_FUNC_OFFSET(2901, glStencilFunc, glStencilFunc, NULL, 243),
-    NAME_FUNC_OFFSET(2915, glStencilOp, glStencilOp, NULL, 244),
-    NAME_FUNC_OFFSET(2927, glDepthFunc, glDepthFunc, NULL, 245),
-    NAME_FUNC_OFFSET(2939, glPixelZoom, glPixelZoom, NULL, 246),
-    NAME_FUNC_OFFSET(2951, glPixelTransferf, glPixelTransferf, NULL, 247),
-    NAME_FUNC_OFFSET(2968, glPixelTransferi, glPixelTransferi, NULL, 248),
-    NAME_FUNC_OFFSET(2985, glPixelStoref, glPixelStoref, NULL, 249),
-    NAME_FUNC_OFFSET(2999, glPixelStorei, glPixelStorei, NULL, 250),
-    NAME_FUNC_OFFSET(3013, glPixelMapfv, glPixelMapfv, NULL, 251),
-    NAME_FUNC_OFFSET(3026, glPixelMapuiv, glPixelMapuiv, NULL, 252),
-    NAME_FUNC_OFFSET(3040, glPixelMapusv, glPixelMapusv, NULL, 253),
-    NAME_FUNC_OFFSET(3054, glReadBuffer, glReadBuffer, NULL, 254),
-    NAME_FUNC_OFFSET(3067, glCopyPixels, glCopyPixels, NULL, 255),
-    NAME_FUNC_OFFSET(3080, glReadPixels, glReadPixels, NULL, 256),
-    NAME_FUNC_OFFSET(3093, glDrawPixels, glDrawPixels, NULL, 257),
-    NAME_FUNC_OFFSET(3106, glGetBooleanv, glGetBooleanv, NULL, 258),
-    NAME_FUNC_OFFSET(3120, glGetClipPlane, glGetClipPlane, NULL, 259),
-    NAME_FUNC_OFFSET(3135, glGetDoublev, glGetDoublev, NULL, 260),
-    NAME_FUNC_OFFSET(3148, glGetError, glGetError, NULL, 261),
-    NAME_FUNC_OFFSET(3159, glGetFloatv, glGetFloatv, NULL, 262),
-    NAME_FUNC_OFFSET(3171, glGetIntegerv, glGetIntegerv, NULL, 263),
-    NAME_FUNC_OFFSET(3185, glGetLightfv, glGetLightfv, NULL, 264),
-    NAME_FUNC_OFFSET(3198, glGetLightiv, glGetLightiv, NULL, 265),
-    NAME_FUNC_OFFSET(3211, glGetMapdv, glGetMapdv, NULL, 266),
-    NAME_FUNC_OFFSET(3222, glGetMapfv, glGetMapfv, NULL, 267),
-    NAME_FUNC_OFFSET(3233, glGetMapiv, glGetMapiv, NULL, 268),
-    NAME_FUNC_OFFSET(3244, glGetMaterialfv, glGetMaterialfv, NULL, 269),
-    NAME_FUNC_OFFSET(3260, glGetMaterialiv, glGetMaterialiv, NULL, 270),
-    NAME_FUNC_OFFSET(3276, glGetPixelMapfv, glGetPixelMapfv, NULL, 271),
-    NAME_FUNC_OFFSET(3292, glGetPixelMapuiv, glGetPixelMapuiv, NULL, 272),
-    NAME_FUNC_OFFSET(3309, glGetPixelMapusv, glGetPixelMapusv, NULL, 273),
-    NAME_FUNC_OFFSET(3326, glGetPolygonStipple, glGetPolygonStipple, NULL, 274),
-    NAME_FUNC_OFFSET(3346, glGetString, glGetString, NULL, 275),
-    NAME_FUNC_OFFSET(3358, glGetTexEnvfv, glGetTexEnvfv, NULL, 276),
-    NAME_FUNC_OFFSET(3372, glGetTexEnviv, glGetTexEnviv, NULL, 277),
-    NAME_FUNC_OFFSET(3386, glGetTexGendv, glGetTexGendv, NULL, 278),
-    NAME_FUNC_OFFSET(3400, glGetTexGenfv, glGetTexGenfv, NULL, 279),
-    NAME_FUNC_OFFSET(3414, glGetTexGeniv, glGetTexGeniv, NULL, 280),
-    NAME_FUNC_OFFSET(3428, glGetTexImage, glGetTexImage, NULL, 281),
-    NAME_FUNC_OFFSET(3442, glGetTexParameterfv, glGetTexParameterfv, NULL, 282),
-    NAME_FUNC_OFFSET(3462, glGetTexParameteriv, glGetTexParameteriv, NULL, 283),
-    NAME_FUNC_OFFSET(3482, glGetTexLevelParameterfv, glGetTexLevelParameterfv,
-                     NULL, 284),
-    NAME_FUNC_OFFSET(3507, glGetTexLevelParameteriv, glGetTexLevelParameteriv,
-                     NULL, 285),
-    NAME_FUNC_OFFSET(3532, glIsEnabled, glIsEnabled, NULL, 286),
-    NAME_FUNC_OFFSET(3544, glIsList, glIsList, NULL, 287),
-    NAME_FUNC_OFFSET(3553, glDepthRange, glDepthRange, NULL, 288),
-    NAME_FUNC_OFFSET(3566, glFrustum, glFrustum, NULL, 289),
-    NAME_FUNC_OFFSET(3576, glLoadIdentity, glLoadIdentity, NULL, 290),
-    NAME_FUNC_OFFSET(3591, glLoadMatrixf, glLoadMatrixf, NULL, 291),
-    NAME_FUNC_OFFSET(3605, glLoadMatrixd, glLoadMatrixd, NULL, 292),
-    NAME_FUNC_OFFSET(3619, glMatrixMode, glMatrixMode, NULL, 293),
-    NAME_FUNC_OFFSET(3632, glMultMatrixf, glMultMatrixf, NULL, 294),
-    NAME_FUNC_OFFSET(3646, glMultMatrixd, glMultMatrixd, NULL, 295),
-    NAME_FUNC_OFFSET(3660, glOrtho, glOrtho, NULL, 296),
-    NAME_FUNC_OFFSET(3668, glPopMatrix, glPopMatrix, NULL, 297),
-    NAME_FUNC_OFFSET(3680, glPushMatrix, glPushMatrix, NULL, 298),
-    NAME_FUNC_OFFSET(3693, glRotated, glRotated, NULL, 299),
-    NAME_FUNC_OFFSET(3703, glRotatef, glRotatef, NULL, 300),
-    NAME_FUNC_OFFSET(3713, glScaled, glScaled, NULL, 301),
-    NAME_FUNC_OFFSET(3722, glScalef, glScalef, NULL, 302),
-    NAME_FUNC_OFFSET(3731, glTranslated, glTranslated, NULL, 303),
-    NAME_FUNC_OFFSET(3744, glTranslatef, glTranslatef, NULL, 304),
-    NAME_FUNC_OFFSET(3757, glViewport, glViewport, NULL, 305),
-    NAME_FUNC_OFFSET(3768, glArrayElement, glArrayElement, NULL, 306),
-    NAME_FUNC_OFFSET(3783, glBindTexture, glBindTexture, NULL, 307),
-    NAME_FUNC_OFFSET(3797, glColorPointer, glColorPointer, NULL, 308),
-    NAME_FUNC_OFFSET(3812, glDisableClientState, glDisableClientState, NULL,
-                     309),
-    NAME_FUNC_OFFSET(3833, glDrawArrays, glDrawArrays, NULL, 310),
-    NAME_FUNC_OFFSET(3846, glDrawElements, glDrawElements, NULL, 311),
-    NAME_FUNC_OFFSET(3861, glEdgeFlagPointer, glEdgeFlagPointer, NULL, 312),
-    NAME_FUNC_OFFSET(3879, glEnableClientState, glEnableClientState, NULL, 313),
-    NAME_FUNC_OFFSET(3899, glIndexPointer, glIndexPointer, NULL, 314),
-    NAME_FUNC_OFFSET(3914, glIndexub, glIndexub, NULL, 315),
-    NAME_FUNC_OFFSET(3924, glIndexubv, glIndexubv, NULL, 316),
-    NAME_FUNC_OFFSET(3935, glInterleavedArrays, glInterleavedArrays, NULL, 317),
-    NAME_FUNC_OFFSET(3955, glNormalPointer, glNormalPointer, NULL, 318),
-    NAME_FUNC_OFFSET(3971, glPolygonOffset, glPolygonOffset, NULL, 319),
-    NAME_FUNC_OFFSET(3987, glTexCoordPointer, glTexCoordPointer, NULL, 320),
-    NAME_FUNC_OFFSET(4005, glVertexPointer, glVertexPointer, NULL, 321),
-    NAME_FUNC_OFFSET(4021, glAreTexturesResident, glAreTexturesResident, NULL,
-                     322),
-    NAME_FUNC_OFFSET(4043, glCopyTexImage1D, glCopyTexImage1D, NULL, 323),
-    NAME_FUNC_OFFSET(4060, glCopyTexImage2D, glCopyTexImage2D, NULL, 324),
-    NAME_FUNC_OFFSET(4077, glCopyTexSubImage1D, glCopyTexSubImage1D, NULL, 325),
-    NAME_FUNC_OFFSET(4097, glCopyTexSubImage2D, glCopyTexSubImage2D, NULL, 326),
-    NAME_FUNC_OFFSET(4117, glDeleteTextures, glDeleteTextures, NULL, 327),
-    NAME_FUNC_OFFSET(4134, glGenTextures, glGenTextures, NULL, 328),
-    NAME_FUNC_OFFSET(4148, glGetPointerv, glGetPointerv, NULL, 329),
-    NAME_FUNC_OFFSET(4162, glIsTexture, glIsTexture, NULL, 330),
-    NAME_FUNC_OFFSET(4174, glPrioritizeTextures, glPrioritizeTextures, NULL,
-                     331),
-    NAME_FUNC_OFFSET(4195, glTexSubImage1D, glTexSubImage1D, NULL, 332),
-    NAME_FUNC_OFFSET(4211, glTexSubImage2D, glTexSubImage2D, NULL, 333),
-    NAME_FUNC_OFFSET(4227, glPopClientAttrib, glPopClientAttrib, NULL, 334),
-    NAME_FUNC_OFFSET(4245, glPushClientAttrib, glPushClientAttrib, NULL, 335),
-    NAME_FUNC_OFFSET(4264, glBlendColor, glBlendColor, NULL, 336),
-    NAME_FUNC_OFFSET(4277, glBlendEquation, glBlendEquation, NULL, 337),
-    NAME_FUNC_OFFSET(4293, glDrawRangeElements, glDrawRangeElements, NULL, 338),
-    NAME_FUNC_OFFSET(4313, glColorTable, glColorTable, NULL, 339),
-    NAME_FUNC_OFFSET(4326, glColorTableParameterfv, glColorTableParameterfv,
-                     NULL, 340),
-    NAME_FUNC_OFFSET(4350, glColorTableParameteriv, glColorTableParameteriv,
-                     NULL, 341),
-    NAME_FUNC_OFFSET(4374, glCopyColorTable, glCopyColorTable, NULL, 342),
-    NAME_FUNC_OFFSET(4391, glGetColorTable, glGetColorTable, NULL, 343),
-    NAME_FUNC_OFFSET(4407, glGetColorTableParameterfv,
-                     glGetColorTableParameterfv, NULL, 344),
-    NAME_FUNC_OFFSET(4434, glGetColorTableParameteriv,
-                     glGetColorTableParameteriv, NULL, 345),
-    NAME_FUNC_OFFSET(4461, glColorSubTable, glColorSubTable, NULL, 346),
-    NAME_FUNC_OFFSET(4477, glCopyColorSubTable, glCopyColorSubTable, NULL, 347),
-    NAME_FUNC_OFFSET(4497, glConvolutionFilter1D, glConvolutionFilter1D, NULL,
-                     348),
-    NAME_FUNC_OFFSET(4519, glConvolutionFilter2D, glConvolutionFilter2D, NULL,
-                     349),
-    NAME_FUNC_OFFSET(4541, glConvolutionParameterf, glConvolutionParameterf,
-                     NULL, 350),
-    NAME_FUNC_OFFSET(4565, glConvolutionParameterfv, glConvolutionParameterfv,
-                     NULL, 351),
-    NAME_FUNC_OFFSET(4590, glConvolutionParameteri, glConvolutionParameteri,
-                     NULL, 352),
-    NAME_FUNC_OFFSET(4614, glConvolutionParameteriv, glConvolutionParameteriv,
-                     NULL, 353),
-    NAME_FUNC_OFFSET(4639, glCopyConvolutionFilter1D, glCopyConvolutionFilter1D,
-                     NULL, 354),
-    NAME_FUNC_OFFSET(4665, glCopyConvolutionFilter2D, glCopyConvolutionFilter2D,
-                     NULL, 355),
-    NAME_FUNC_OFFSET(4691, glGetConvolutionFilter, glGetConvolutionFilter, NULL,
-                     356),
-    NAME_FUNC_OFFSET(4714, glGetConvolutionParameterfv,
-                     glGetConvolutionParameterfv, NULL, 357),
-    NAME_FUNC_OFFSET(4742, glGetConvolutionParameteriv,
-                     glGetConvolutionParameteriv, NULL, 358),
-    NAME_FUNC_OFFSET(4770, glGetSeparableFilter, glGetSeparableFilter, NULL,
-                     359),
-    NAME_FUNC_OFFSET(4791, glSeparableFilter2D, glSeparableFilter2D, NULL, 360),
-    NAME_FUNC_OFFSET(4811, glGetHistogram, glGetHistogram, NULL, 361),
-    NAME_FUNC_OFFSET(4826, glGetHistogramParameterfv, glGetHistogramParameterfv,
-                     NULL, 362),
-    NAME_FUNC_OFFSET(4852, glGetHistogramParameteriv, glGetHistogramParameteriv,
-                     NULL, 363),
-    NAME_FUNC_OFFSET(4878, glGetMinmax, glGetMinmax, NULL, 364),
-    NAME_FUNC_OFFSET(4890, glGetMinmaxParameterfv, glGetMinmaxParameterfv, NULL,
-                     365),
-    NAME_FUNC_OFFSET(4913, glGetMinmaxParameteriv, glGetMinmaxParameteriv, NULL,
-                     366),
-    NAME_FUNC_OFFSET(4936, glHistogram, glHistogram, NULL, 367),
-    NAME_FUNC_OFFSET(4948, glMinmax, glMinmax, NULL, 368),
-    NAME_FUNC_OFFSET(4957, glResetHistogram, glResetHistogram, NULL, 369),
-    NAME_FUNC_OFFSET(4974, glResetMinmax, glResetMinmax, NULL, 370),
-    NAME_FUNC_OFFSET(4988, glTexImage3D, glTexImage3D, NULL, 371),
-    NAME_FUNC_OFFSET(5001, glTexSubImage3D, glTexSubImage3D, NULL, 372),
-    NAME_FUNC_OFFSET(5017, glCopyTexSubImage3D, glCopyTexSubImage3D, NULL, 373),
-    NAME_FUNC_OFFSET(5037, glActiveTextureARB, glActiveTextureARB, NULL, 374),
-    NAME_FUNC_OFFSET(5056, glClientActiveTextureARB, glClientActiveTextureARB,
-                     NULL, 375),
-    NAME_FUNC_OFFSET(5081, glMultiTexCoord1dARB, glMultiTexCoord1dARB, NULL,
-                     376),
-    NAME_FUNC_OFFSET(5102, glMultiTexCoord1dvARB, glMultiTexCoord1dvARB, NULL,
-                     377),
-    NAME_FUNC_OFFSET(5124, glMultiTexCoord1fARB, glMultiTexCoord1fARB, NULL,
-                     378),
-    NAME_FUNC_OFFSET(5145, glMultiTexCoord1fvARB, glMultiTexCoord1fvARB, NULL,
-                     379),
-    NAME_FUNC_OFFSET(5167, glMultiTexCoord1iARB, glMultiTexCoord1iARB, NULL,
-                     380),
-    NAME_FUNC_OFFSET(5188, glMultiTexCoord1ivARB, glMultiTexCoord1ivARB, NULL,
-                     381),
-    NAME_FUNC_OFFSET(5210, glMultiTexCoord1sARB, glMultiTexCoord1sARB, NULL,
-                     382),
-    NAME_FUNC_OFFSET(5231, glMultiTexCoord1svARB, glMultiTexCoord1svARB, NULL,
-                     383),
-    NAME_FUNC_OFFSET(5253, glMultiTexCoord2dARB, glMultiTexCoord2dARB, NULL,
-                     384),
-    NAME_FUNC_OFFSET(5274, glMultiTexCoord2dvARB, glMultiTexCoord2dvARB, NULL,
-                     385),
-    NAME_FUNC_OFFSET(5296, glMultiTexCoord2fARB, glMultiTexCoord2fARB, NULL,
-                     386),
-    NAME_FUNC_OFFSET(5317, glMultiTexCoord2fvARB, glMultiTexCoord2fvARB, NULL,
-                     387),
-    NAME_FUNC_OFFSET(5339, glMultiTexCoord2iARB, glMultiTexCoord2iARB, NULL,
-                     388),
-    NAME_FUNC_OFFSET(5360, glMultiTexCoord2ivARB, glMultiTexCoord2ivARB, NULL,
-                     389),
-    NAME_FUNC_OFFSET(5382, glMultiTexCoord2sARB, glMultiTexCoord2sARB, NULL,
-                     390),
-    NAME_FUNC_OFFSET(5403, glMultiTexCoord2svARB, glMultiTexCoord2svARB, NULL,
-                     391),
-    NAME_FUNC_OFFSET(5425, glMultiTexCoord3dARB, glMultiTexCoord3dARB, NULL,
-                     392),
-    NAME_FUNC_OFFSET(5446, glMultiTexCoord3dvARB, glMultiTexCoord3dvARB, NULL,
-                     393),
-    NAME_FUNC_OFFSET(5468, glMultiTexCoord3fARB, glMultiTexCoord3fARB, NULL,
-                     394),
-    NAME_FUNC_OFFSET(5489, glMultiTexCoord3fvARB, glMultiTexCoord3fvARB, NULL,
-                     395),
-    NAME_FUNC_OFFSET(5511, glMultiTexCoord3iARB, glMultiTexCoord3iARB, NULL,
-                     396),
-    NAME_FUNC_OFFSET(5532, glMultiTexCoord3ivARB, glMultiTexCoord3ivARB, NULL,
-                     397),
-    NAME_FUNC_OFFSET(5554, glMultiTexCoord3sARB, glMultiTexCoord3sARB, NULL,
-                     398),
-    NAME_FUNC_OFFSET(5575, glMultiTexCoord3svARB, glMultiTexCoord3svARB, NULL,
-                     399),
-    NAME_FUNC_OFFSET(5597, glMultiTexCoord4dARB, glMultiTexCoord4dARB, NULL,
-                     400),
-    NAME_FUNC_OFFSET(5618, glMultiTexCoord4dvARB, glMultiTexCoord4dvARB, NULL,
-                     401),
-    NAME_FUNC_OFFSET(5640, glMultiTexCoord4fARB, glMultiTexCoord4fARB, NULL,
-                     402),
-    NAME_FUNC_OFFSET(5661, glMultiTexCoord4fvARB, glMultiTexCoord4fvARB, NULL,
-                     403),
-    NAME_FUNC_OFFSET(5683, glMultiTexCoord4iARB, glMultiTexCoord4iARB, NULL,
-                     404),
-    NAME_FUNC_OFFSET(5704, glMultiTexCoord4ivARB, glMultiTexCoord4ivARB, NULL,
-                     405),
-    NAME_FUNC_OFFSET(5726, glMultiTexCoord4sARB, glMultiTexCoord4sARB, NULL,
-                     406),
-    NAME_FUNC_OFFSET(5747, glMultiTexCoord4svARB, glMultiTexCoord4svARB, NULL,
-                     407),
-    NAME_FUNC_OFFSET(5769, glAttachShader, glAttachShader, NULL, 408),
-    NAME_FUNC_OFFSET(5784, glCreateProgram, glCreateProgram, NULL, 409),
-    NAME_FUNC_OFFSET(5800, glCreateShader, glCreateShader, NULL, 410),
-    NAME_FUNC_OFFSET(5815, glDeleteProgram, glDeleteProgram, NULL, 411),
-    NAME_FUNC_OFFSET(5831, glDeleteShader, glDeleteShader, NULL, 412),
-    NAME_FUNC_OFFSET(5846, glDetachShader, glDetachShader, NULL, 413),
-    NAME_FUNC_OFFSET(5861, glGetAttachedShaders, glGetAttachedShaders, NULL,
-                     414),
-    NAME_FUNC_OFFSET(5882, glGetProgramInfoLog, glGetProgramInfoLog, NULL, 415),
-    NAME_FUNC_OFFSET(5902, glGetProgramiv, glGetProgramiv, NULL, 416),
-    NAME_FUNC_OFFSET(5917, glGetShaderInfoLog, glGetShaderInfoLog, NULL, 417),
-    NAME_FUNC_OFFSET(5936, glGetShaderiv, glGetShaderiv, NULL, 418),
-    NAME_FUNC_OFFSET(5950, glIsProgram, glIsProgram, NULL, 419),
-    NAME_FUNC_OFFSET(5962, glIsShader, glIsShader, NULL, 420),
-    NAME_FUNC_OFFSET(5973, glStencilFuncSeparate, glStencilFuncSeparate, NULL,
-                     421),
-    NAME_FUNC_OFFSET(5995, glStencilMaskSeparate, glStencilMaskSeparate, NULL,
-                     422),
-    NAME_FUNC_OFFSET(6017, glStencilOpSeparate, glStencilOpSeparate, NULL, 423),
-    NAME_FUNC_OFFSET(6037, glUniformMatrix2x3fv, glUniformMatrix2x3fv, NULL,
-                     424),
-    NAME_FUNC_OFFSET(6058, glUniformMatrix2x4fv, glUniformMatrix2x4fv, NULL,
-                     425),
-    NAME_FUNC_OFFSET(6079, glUniformMatrix3x2fv, glUniformMatrix3x2fv, NULL,
-                     426),
-    NAME_FUNC_OFFSET(6100, glUniformMatrix3x4fv, glUniformMatrix3x4fv, NULL,
-                     427),
-    NAME_FUNC_OFFSET(6121, glUniformMatrix4x2fv, glUniformMatrix4x2fv, NULL,
-                     428),
-    NAME_FUNC_OFFSET(6142, glUniformMatrix4x3fv, glUniformMatrix4x3fv, NULL,
-                     429),
-    NAME_FUNC_OFFSET(6163, glClampColor, glClampColor, NULL, 430),
-    NAME_FUNC_OFFSET(6176, glClearBufferfi, glClearBufferfi, NULL, 431),
-    NAME_FUNC_OFFSET(6192, glClearBufferfv, glClearBufferfv, NULL, 432),
-    NAME_FUNC_OFFSET(6208, glClearBufferiv, glClearBufferiv, NULL, 433),
-    NAME_FUNC_OFFSET(6224, glClearBufferuiv, glClearBufferuiv, NULL, 434),
-    NAME_FUNC_OFFSET(6241, glGetStringi, glGetStringi, NULL, 435),
-    NAME_FUNC_OFFSET(6254, glTexBuffer, glTexBuffer, NULL, 436),
-    NAME_FUNC_OFFSET(6266, glFramebufferTexture, glFramebufferTexture, NULL,
-                     437),
-    NAME_FUNC_OFFSET(6287, glGetBufferParameteri64v, glGetBufferParameteri64v,
-                     NULL, 438),
-    NAME_FUNC_OFFSET(6312, glGetInteger64i_v, glGetInteger64i_v, NULL, 439),
-    NAME_FUNC_OFFSET(6330, glVertexAttribDivisor, glVertexAttribDivisor, NULL,
-                     440),
-    NAME_FUNC_OFFSET(6352, glLoadTransposeMatrixdARB, glLoadTransposeMatrixdARB,
-                     NULL, 441),
-    NAME_FUNC_OFFSET(6378, glLoadTransposeMatrixfARB, glLoadTransposeMatrixfARB,
-                     NULL, 442),
-    NAME_FUNC_OFFSET(6404, glMultTransposeMatrixdARB, glMultTransposeMatrixdARB,
-                     NULL, 443),
-    NAME_FUNC_OFFSET(6430, glMultTransposeMatrixfARB, glMultTransposeMatrixfARB,
-                     NULL, 444),
-    NAME_FUNC_OFFSET(6456, glSampleCoverageARB, glSampleCoverageARB, NULL, 445),
-    NAME_FUNC_OFFSET(6476, glCompressedTexImage1DARB, glCompressedTexImage1DARB,
-                     NULL, 446),
-    NAME_FUNC_OFFSET(6502, glCompressedTexImage2DARB, glCompressedTexImage2DARB,
-                     NULL, 447),
-    NAME_FUNC_OFFSET(6528, glCompressedTexImage3DARB, glCompressedTexImage3DARB,
-                     NULL, 448),
-    NAME_FUNC_OFFSET(6554, glCompressedTexSubImage1DARB,
-                     glCompressedTexSubImage1DARB, NULL, 449),
-    NAME_FUNC_OFFSET(6583, glCompressedTexSubImage2DARB,
-                     glCompressedTexSubImage2DARB, NULL, 450),
-    NAME_FUNC_OFFSET(6612, glCompressedTexSubImage3DARB,
-                     glCompressedTexSubImage3DARB, NULL, 451),
-    NAME_FUNC_OFFSET(6641, glGetCompressedTexImageARB,
-                     glGetCompressedTexImageARB, NULL, 452),
-    NAME_FUNC_OFFSET(6668, glDisableVertexAttribArrayARB,
-                     glDisableVertexAttribArrayARB, NULL, 453),
-    NAME_FUNC_OFFSET(6698, glEnableVertexAttribArrayARB,
-                     glEnableVertexAttribArrayARB, NULL, 454),
-    NAME_FUNC_OFFSET(6727, glGetProgramEnvParameterdvARB,
-                     glGetProgramEnvParameterdvARB, NULL, 455),
-    NAME_FUNC_OFFSET(6757, glGetProgramEnvParameterfvARB,
-                     glGetProgramEnvParameterfvARB, NULL, 456),
-    NAME_FUNC_OFFSET(6787, glGetProgramLocalParameterdvARB,
-                     glGetProgramLocalParameterdvARB, NULL, 457),
-    NAME_FUNC_OFFSET(6819, glGetProgramLocalParameterfvARB,
-                     glGetProgramLocalParameterfvARB, NULL, 458),
-    NAME_FUNC_OFFSET(6851, glGetProgramStringARB, glGetProgramStringARB, NULL,
-                     459),
-    NAME_FUNC_OFFSET(6873, glGetProgramivARB, glGetProgramivARB, NULL, 460),
-    NAME_FUNC_OFFSET(6891, glGetVertexAttribdvARB, glGetVertexAttribdvARB, NULL,
-                     461),
-    NAME_FUNC_OFFSET(6914, glGetVertexAttribfvARB, glGetVertexAttribfvARB, NULL,
-                     462),
-    NAME_FUNC_OFFSET(6937, glGetVertexAttribivARB, glGetVertexAttribivARB, NULL,
-                     463),
-    NAME_FUNC_OFFSET(6960, glProgramEnvParameter4dARB,
-                     glProgramEnvParameter4dARB, NULL, 464),
-    NAME_FUNC_OFFSET(6987, glProgramEnvParameter4dvARB,
-                     glProgramEnvParameter4dvARB, NULL, 465),
-    NAME_FUNC_OFFSET(7015, glProgramEnvParameter4fARB,
-                     glProgramEnvParameter4fARB, NULL, 466),
-    NAME_FUNC_OFFSET(7042, glProgramEnvParameter4fvARB,
-                     glProgramEnvParameter4fvARB, NULL, 467),
-    NAME_FUNC_OFFSET(7070, glProgramLocalParameter4dARB,
-                     glProgramLocalParameter4dARB, NULL, 468),
-    NAME_FUNC_OFFSET(7099, glProgramLocalParameter4dvARB,
-                     glProgramLocalParameter4dvARB, NULL, 469),
-    NAME_FUNC_OFFSET(7129, glProgramLocalParameter4fARB,
-                     glProgramLocalParameter4fARB, NULL, 470),
-    NAME_FUNC_OFFSET(7158, glProgramLocalParameter4fvARB,
-                     glProgramLocalParameter4fvARB, NULL, 471),
-    NAME_FUNC_OFFSET(7188, glProgramStringARB, glProgramStringARB, NULL, 472),
-    NAME_FUNC_OFFSET(7207, glVertexAttrib1dARB, glVertexAttrib1dARB, NULL, 473),
-    NAME_FUNC_OFFSET(7227, glVertexAttrib1dvARB, glVertexAttrib1dvARB, NULL,
-                     474),
-    NAME_FUNC_OFFSET(7248, glVertexAttrib1fARB, glVertexAttrib1fARB, NULL, 475),
-    NAME_FUNC_OFFSET(7268, glVertexAttrib1fvARB, glVertexAttrib1fvARB, NULL,
-                     476),
-    NAME_FUNC_OFFSET(7289, glVertexAttrib1sARB, glVertexAttrib1sARB, NULL, 477),
-    NAME_FUNC_OFFSET(7309, glVertexAttrib1svARB, glVertexAttrib1svARB, NULL,
-                     478),
-    NAME_FUNC_OFFSET(7330, glVertexAttrib2dARB, glVertexAttrib2dARB, NULL, 479),
-    NAME_FUNC_OFFSET(7350, glVertexAttrib2dvARB, glVertexAttrib2dvARB, NULL,
-                     480),
-    NAME_FUNC_OFFSET(7371, glVertexAttrib2fARB, glVertexAttrib2fARB, NULL, 481),
-    NAME_FUNC_OFFSET(7391, glVertexAttrib2fvARB, glVertexAttrib2fvARB, NULL,
-                     482),
-    NAME_FUNC_OFFSET(7412, glVertexAttrib2sARB, glVertexAttrib2sARB, NULL, 483),
-    NAME_FUNC_OFFSET(7432, glVertexAttrib2svARB, glVertexAttrib2svARB, NULL,
-                     484),
-    NAME_FUNC_OFFSET(7453, glVertexAttrib3dARB, glVertexAttrib3dARB, NULL, 485),
-    NAME_FUNC_OFFSET(7473, glVertexAttrib3dvARB, glVertexAttrib3dvARB, NULL,
-                     486),
-    NAME_FUNC_OFFSET(7494, glVertexAttrib3fARB, glVertexAttrib3fARB, NULL, 487),
-    NAME_FUNC_OFFSET(7514, glVertexAttrib3fvARB, glVertexAttrib3fvARB, NULL,
-                     488),
-    NAME_FUNC_OFFSET(7535, glVertexAttrib3sARB, glVertexAttrib3sARB, NULL, 489),
-    NAME_FUNC_OFFSET(7555, glVertexAttrib3svARB, glVertexAttrib3svARB, NULL,
-                     490),
-    NAME_FUNC_OFFSET(7576, glVertexAttrib4NbvARB, glVertexAttrib4NbvARB, NULL,
-                     491),
-    NAME_FUNC_OFFSET(7598, glVertexAttrib4NivARB, glVertexAttrib4NivARB, NULL,
-                     492),
-    NAME_FUNC_OFFSET(7620, glVertexAttrib4NsvARB, glVertexAttrib4NsvARB, NULL,
-                     493),
-    NAME_FUNC_OFFSET(7642, glVertexAttrib4NubARB, glVertexAttrib4NubARB, NULL,
-                     494),
-    NAME_FUNC_OFFSET(7664, glVertexAttrib4NubvARB, glVertexAttrib4NubvARB, NULL,
-                     495),
-    NAME_FUNC_OFFSET(7687, glVertexAttrib4NuivARB, glVertexAttrib4NuivARB, NULL,
-                     496),
-    NAME_FUNC_OFFSET(7710, glVertexAttrib4NusvARB, glVertexAttrib4NusvARB, NULL,
-                     497),
-    NAME_FUNC_OFFSET(7733, glVertexAttrib4bvARB, glVertexAttrib4bvARB, NULL,
-                     498),
-    NAME_FUNC_OFFSET(7754, glVertexAttrib4dARB, glVertexAttrib4dARB, NULL, 499),
-    NAME_FUNC_OFFSET(7774, glVertexAttrib4dvARB, glVertexAttrib4dvARB, NULL,
-                     500),
-    NAME_FUNC_OFFSET(7795, glVertexAttrib4fARB, glVertexAttrib4fARB, NULL, 501),
-    NAME_FUNC_OFFSET(7815, glVertexAttrib4fvARB, glVertexAttrib4fvARB, NULL,
-                     502),
-    NAME_FUNC_OFFSET(7836, glVertexAttrib4ivARB, glVertexAttrib4ivARB, NULL,
-                     503),
-    NAME_FUNC_OFFSET(7857, glVertexAttrib4sARB, glVertexAttrib4sARB, NULL, 504),
-    NAME_FUNC_OFFSET(7877, glVertexAttrib4svARB, glVertexAttrib4svARB, NULL,
-                     505),
-    NAME_FUNC_OFFSET(7898, glVertexAttrib4ubvARB, glVertexAttrib4ubvARB, NULL,
-                     506),
-    NAME_FUNC_OFFSET(7920, glVertexAttrib4uivARB, glVertexAttrib4uivARB, NULL,
-                     507),
-    NAME_FUNC_OFFSET(7942, glVertexAttrib4usvARB, glVertexAttrib4usvARB, NULL,
-                     508),
-    NAME_FUNC_OFFSET(7964, glVertexAttribPointerARB, glVertexAttribPointerARB,
-                     NULL, 509),
-    NAME_FUNC_OFFSET(7989, glBindBufferARB, glBindBufferARB, NULL, 510),
-    NAME_FUNC_OFFSET(8005, glBufferDataARB, glBufferDataARB, NULL, 511),
-    NAME_FUNC_OFFSET(8021, glBufferSubDataARB, glBufferSubDataARB, NULL, 512),
-    NAME_FUNC_OFFSET(8040, glDeleteBuffersARB, glDeleteBuffersARB, NULL, 513),
-    NAME_FUNC_OFFSET(8059, glGenBuffersARB, glGenBuffersARB, NULL, 514),
-    NAME_FUNC_OFFSET(8075, glGetBufferParameterivARB, glGetBufferParameterivARB,
-                     NULL, 515),
-    NAME_FUNC_OFFSET(8101, glGetBufferPointervARB, glGetBufferPointervARB, NULL,
-                     516),
-    NAME_FUNC_OFFSET(8124, glGetBufferSubDataARB, glGetBufferSubDataARB, NULL,
-                     517),
-    NAME_FUNC_OFFSET(8146, glIsBufferARB, glIsBufferARB, NULL, 518),
-    NAME_FUNC_OFFSET(8160, glMapBufferARB, glMapBufferARB, NULL, 519),
-    NAME_FUNC_OFFSET(8175, glUnmapBufferARB, glUnmapBufferARB, NULL, 520),
-    NAME_FUNC_OFFSET(8192, glBeginQueryARB, glBeginQueryARB, NULL, 521),
-    NAME_FUNC_OFFSET(8208, glDeleteQueriesARB, glDeleteQueriesARB, NULL, 522),
-    NAME_FUNC_OFFSET(8227, glEndQueryARB, glEndQueryARB, NULL, 523),
-    NAME_FUNC_OFFSET(8241, glGenQueriesARB, glGenQueriesARB, NULL, 524),
-    NAME_FUNC_OFFSET(8257, glGetQueryObjectivARB, glGetQueryObjectivARB, NULL,
-                     525),
-    NAME_FUNC_OFFSET(8279, glGetQueryObjectuivARB, glGetQueryObjectuivARB, NULL,
-                     526),
-    NAME_FUNC_OFFSET(8302, glGetQueryivARB, glGetQueryivARB, NULL, 527),
-    NAME_FUNC_OFFSET(8318, glIsQueryARB, glIsQueryARB, NULL, 528),
-    NAME_FUNC_OFFSET(8331, glAttachObjectARB, glAttachObjectARB, NULL, 529),
-    NAME_FUNC_OFFSET(8349, glCompileShaderARB, glCompileShaderARB, NULL, 530),
-    NAME_FUNC_OFFSET(8368, glCreateProgramObjectARB, glCreateProgramObjectARB,
-                     NULL, 531),
-    NAME_FUNC_OFFSET(8393, glCreateShaderObjectARB, glCreateShaderObjectARB,
-                     NULL, 532),
-    NAME_FUNC_OFFSET(8417, glDeleteObjectARB, glDeleteObjectARB, NULL, 533),
-    NAME_FUNC_OFFSET(8435, glDetachObjectARB, glDetachObjectARB, NULL, 534),
-    NAME_FUNC_OFFSET(8453, glGetActiveUniformARB, glGetActiveUniformARB, NULL,
-                     535),
-    NAME_FUNC_OFFSET(8475, glGetAttachedObjectsARB, glGetAttachedObjectsARB,
-                     NULL, 536),
-    NAME_FUNC_OFFSET(8499, glGetHandleARB, glGetHandleARB, NULL, 537),
-    NAME_FUNC_OFFSET(8514, glGetInfoLogARB, glGetInfoLogARB, NULL, 538),
-    NAME_FUNC_OFFSET(8530, glGetObjectParameterfvARB, glGetObjectParameterfvARB,
-                     NULL, 539),
-    NAME_FUNC_OFFSET(8556, glGetObjectParameterivARB, glGetObjectParameterivARB,
-                     NULL, 540),
-    NAME_FUNC_OFFSET(8582, glGetShaderSourceARB, glGetShaderSourceARB, NULL,
-                     541),
-    NAME_FUNC_OFFSET(8603, glGetUniformLocationARB, glGetUniformLocationARB,
-                     NULL, 542),
-    NAME_FUNC_OFFSET(8627, glGetUniformfvARB, glGetUniformfvARB, NULL, 543),
-    NAME_FUNC_OFFSET(8645, glGetUniformivARB, glGetUniformivARB, NULL, 544),
-    NAME_FUNC_OFFSET(8663, glLinkProgramARB, glLinkProgramARB, NULL, 545),
-    NAME_FUNC_OFFSET(8680, glShaderSourceARB, glShaderSourceARB, NULL, 546),
-    NAME_FUNC_OFFSET(8698, glUniform1fARB, glUniform1fARB, NULL, 547),
-    NAME_FUNC_OFFSET(8713, glUniform1fvARB, glUniform1fvARB, NULL, 548),
-    NAME_FUNC_OFFSET(8729, glUniform1iARB, glUniform1iARB, NULL, 549),
-    NAME_FUNC_OFFSET(8744, glUniform1ivARB, glUniform1ivARB, NULL, 550),
-    NAME_FUNC_OFFSET(8760, glUniform2fARB, glUniform2fARB, NULL, 551),
-    NAME_FUNC_OFFSET(8775, glUniform2fvARB, glUniform2fvARB, NULL, 552),
-    NAME_FUNC_OFFSET(8791, glUniform2iARB, glUniform2iARB, NULL, 553),
-    NAME_FUNC_OFFSET(8806, glUniform2ivARB, glUniform2ivARB, NULL, 554),
-    NAME_FUNC_OFFSET(8822, glUniform3fARB, glUniform3fARB, NULL, 555),
-    NAME_FUNC_OFFSET(8837, glUniform3fvARB, glUniform3fvARB, NULL, 556),
-    NAME_FUNC_OFFSET(8853, glUniform3iARB, glUniform3iARB, NULL, 557),
-    NAME_FUNC_OFFSET(8868, glUniform3ivARB, glUniform3ivARB, NULL, 558),
-    NAME_FUNC_OFFSET(8884, glUniform4fARB, glUniform4fARB, NULL, 559),
-    NAME_FUNC_OFFSET(8899, glUniform4fvARB, glUniform4fvARB, NULL, 560),
-    NAME_FUNC_OFFSET(8915, glUniform4iARB, glUniform4iARB, NULL, 561),
-    NAME_FUNC_OFFSET(8930, glUniform4ivARB, glUniform4ivARB, NULL, 562),
-    NAME_FUNC_OFFSET(8946, glUniformMatrix2fvARB, glUniformMatrix2fvARB, NULL,
-                     563),
-    NAME_FUNC_OFFSET(8968, glUniformMatrix3fvARB, glUniformMatrix3fvARB, NULL,
-                     564),
-    NAME_FUNC_OFFSET(8990, glUniformMatrix4fvARB, glUniformMatrix4fvARB, NULL,
-                     565),
-    NAME_FUNC_OFFSET(9012, glUseProgramObjectARB, glUseProgramObjectARB, NULL,
-                     566),
-    NAME_FUNC_OFFSET(9034, glValidateProgramARB, glValidateProgramARB, NULL,
-                     567),
-    NAME_FUNC_OFFSET(9055, glBindAttribLocationARB, glBindAttribLocationARB,
-                     NULL, 568),
-    NAME_FUNC_OFFSET(9079, glGetActiveAttribARB, glGetActiveAttribARB, NULL,
-                     569),
-    NAME_FUNC_OFFSET(9100, glGetAttribLocationARB, glGetAttribLocationARB, NULL,
-                     570),
-    NAME_FUNC_OFFSET(9123, glDrawBuffersARB, glDrawBuffersARB, NULL, 571),
-    NAME_FUNC_OFFSET(9140, glClampColorARB, glClampColorARB, NULL, 572),
-    NAME_FUNC_OFFSET(9156, glDrawArraysInstancedARB, glDrawArraysInstancedARB,
-                     NULL, 573),
-    NAME_FUNC_OFFSET(9181, glDrawElementsInstancedARB,
-                     glDrawElementsInstancedARB, NULL, 574),
-    NAME_FUNC_OFFSET(9208, glRenderbufferStorageMultisample,
-                     glRenderbufferStorageMultisample, NULL, 575),
-    NAME_FUNC_OFFSET(9241, glFramebufferTextureARB, glFramebufferTextureARB,
-                     NULL, 576),
-    NAME_FUNC_OFFSET(9265, glFramebufferTextureFaceARB,
-                     glFramebufferTextureFaceARB, NULL, 577),
-    NAME_FUNC_OFFSET(9293, glProgramParameteriARB, glProgramParameteriARB, NULL,
-                     578),
-    NAME_FUNC_OFFSET(9316, glVertexAttribDivisorARB, glVertexAttribDivisorARB,
-                     NULL, 579),
-    NAME_FUNC_OFFSET(9341, glFlushMappedBufferRange, glFlushMappedBufferRange,
-                     NULL, 580),
-    NAME_FUNC_OFFSET(9366, glMapBufferRange, glMapBufferRange, NULL, 581),
-    NAME_FUNC_OFFSET(9383, glTexBufferARB, glTexBufferARB, NULL, 582),
-    NAME_FUNC_OFFSET(9398, glBindVertexArray, glBindVertexArray, NULL, 583),
-    NAME_FUNC_OFFSET(9416, glGenVertexArrays, glGenVertexArrays, NULL, 584),
-    NAME_FUNC_OFFSET(9434, glCopyBufferSubData, glCopyBufferSubData, NULL, 585),
-    NAME_FUNC_OFFSET(9454, glClientWaitSync, glClientWaitSync, NULL, 586),
-    NAME_FUNC_OFFSET(9471, glDeleteSync, glDeleteSync, NULL, 587),
-    NAME_FUNC_OFFSET(9484, glFenceSync, glFenceSync, NULL, 588),
-    NAME_FUNC_OFFSET(9496, glGetInteger64v, glGetInteger64v, NULL, 589),
-    NAME_FUNC_OFFSET(9512, glGetSynciv, glGetSynciv, NULL, 590),
-    NAME_FUNC_OFFSET(9524, glIsSync, glIsSync, NULL, 591),
-    NAME_FUNC_OFFSET(9533, glWaitSync, glWaitSync, NULL, 592),
-    NAME_FUNC_OFFSET(9544, glDrawElementsBaseVertex, glDrawElementsBaseVertex,
-                     NULL, 593),
-    NAME_FUNC_OFFSET(9569, glDrawElementsInstancedBaseVertex,
-                     glDrawElementsInstancedBaseVertex, NULL, 594),
-    NAME_FUNC_OFFSET(9603, glDrawRangeElementsBaseVertex,
-                     glDrawRangeElementsBaseVertex, NULL, 595),
-    NAME_FUNC_OFFSET(9633, glMultiDrawElementsBaseVertex,
-                     glMultiDrawElementsBaseVertex, NULL, 596),
-    NAME_FUNC_OFFSET(9663, glBlendEquationSeparateiARB,
-                     glBlendEquationSeparateiARB, NULL, 597),
-    NAME_FUNC_OFFSET(9691, glBlendEquationiARB, glBlendEquationiARB, NULL, 598),
-    NAME_FUNC_OFFSET(9711, glBlendFuncSeparateiARB, glBlendFuncSeparateiARB,
-                     NULL, 599),
-    NAME_FUNC_OFFSET(9735, glBlendFunciARB, glBlendFunciARB, NULL, 600),
-    NAME_FUNC_OFFSET(9751, glBindSampler, glBindSampler, NULL, 601),
-    NAME_FUNC_OFFSET(9765, glDeleteSamplers, glDeleteSamplers, NULL, 602),
-    NAME_FUNC_OFFSET(9782, glGenSamplers, glGenSamplers, NULL, 603),
-    NAME_FUNC_OFFSET(9796, glGetSamplerParameterIiv, glGetSamplerParameterIiv,
-                     NULL, 604),
-    NAME_FUNC_OFFSET(9821, glGetSamplerParameterIuiv, glGetSamplerParameterIuiv,
-                     NULL, 605),
-    NAME_FUNC_OFFSET(9847, glGetSamplerParameterfv, glGetSamplerParameterfv,
-                     NULL, 606),
-    NAME_FUNC_OFFSET(9871, glGetSamplerParameteriv, glGetSamplerParameteriv,
-                     NULL, 607),
-    NAME_FUNC_OFFSET(9895, glIsSampler, glIsSampler, NULL, 608),
-    NAME_FUNC_OFFSET(9907, glSamplerParameterIiv, glSamplerParameterIiv, NULL,
-                     609),
-    NAME_FUNC_OFFSET(9929, glSamplerParameterIuiv, glSamplerParameterIuiv, NULL,
-                     610),
-    NAME_FUNC_OFFSET(9952, glSamplerParameterf, glSamplerParameterf, NULL, 611),
-    NAME_FUNC_OFFSET(9972, glSamplerParameterfv, glSamplerParameterfv, NULL,
-                     612),
-    NAME_FUNC_OFFSET(9993, glSamplerParameteri, glSamplerParameteri, NULL, 613),
-    NAME_FUNC_OFFSET(10013, glSamplerParameteriv, glSamplerParameteriv, NULL,
-                     614),
-    NAME_FUNC_OFFSET(10034, glColorP3ui, glColorP3ui, NULL, 615),
-    NAME_FUNC_OFFSET(10046, glColorP3uiv, glColorP3uiv, NULL, 616),
-    NAME_FUNC_OFFSET(10059, glColorP4ui, glColorP4ui, NULL, 617),
-    NAME_FUNC_OFFSET(10071, glColorP4uiv, glColorP4uiv, NULL, 618),
-    NAME_FUNC_OFFSET(10084, glMultiTexCoordP1ui, glMultiTexCoordP1ui, NULL,
-                     619),
-    NAME_FUNC_OFFSET(10104, glMultiTexCoordP1uiv, glMultiTexCoordP1uiv, NULL,
-                     620),
-    NAME_FUNC_OFFSET(10125, glMultiTexCoordP2ui, glMultiTexCoordP2ui, NULL,
-                     621),
-    NAME_FUNC_OFFSET(10145, glMultiTexCoordP2uiv, glMultiTexCoordP2uiv, NULL,
-                     622),
-    NAME_FUNC_OFFSET(10166, glMultiTexCoordP3ui, glMultiTexCoordP3ui, NULL,
-                     623),
-    NAME_FUNC_OFFSET(10186, glMultiTexCoordP3uiv, glMultiTexCoordP3uiv, NULL,
-                     624),
-    NAME_FUNC_OFFSET(10207, glMultiTexCoordP4ui, glMultiTexCoordP4ui, NULL,
-                     625),
-    NAME_FUNC_OFFSET(10227, glMultiTexCoordP4uiv, glMultiTexCoordP4uiv, NULL,
-                     626),
-    NAME_FUNC_OFFSET(10248, glNormalP3ui, glNormalP3ui, NULL, 627),
-    NAME_FUNC_OFFSET(10261, glNormalP3uiv, glNormalP3uiv, NULL, 628),
-    NAME_FUNC_OFFSET(10275, glSecondaryColorP3ui, glSecondaryColorP3ui, NULL,
-                     629),
-    NAME_FUNC_OFFSET(10296, glSecondaryColorP3uiv, glSecondaryColorP3uiv, NULL,
-                     630),
-    NAME_FUNC_OFFSET(10318, glTexCoordP1ui, glTexCoordP1ui, NULL, 631),
-    NAME_FUNC_OFFSET(10333, glTexCoordP1uiv, glTexCoordP1uiv, NULL, 632),
-    NAME_FUNC_OFFSET(10349, glTexCoordP2ui, glTexCoordP2ui, NULL, 633),
-    NAME_FUNC_OFFSET(10364, glTexCoordP2uiv, glTexCoordP2uiv, NULL, 634),
-    NAME_FUNC_OFFSET(10380, glTexCoordP3ui, glTexCoordP3ui, NULL, 635),
-    NAME_FUNC_OFFSET(10395, glTexCoordP3uiv, glTexCoordP3uiv, NULL, 636),
-    NAME_FUNC_OFFSET(10411, glTexCoordP4ui, glTexCoordP4ui, NULL, 637),
-    NAME_FUNC_OFFSET(10426, glTexCoordP4uiv, glTexCoordP4uiv, NULL, 638),
-    NAME_FUNC_OFFSET(10442, glVertexAttribP1ui, glVertexAttribP1ui, NULL, 639),
-    NAME_FUNC_OFFSET(10461, glVertexAttribP1uiv, glVertexAttribP1uiv, NULL,
-                     640),
-    NAME_FUNC_OFFSET(10481, glVertexAttribP2ui, glVertexAttribP2ui, NULL, 641),
-    NAME_FUNC_OFFSET(10500, glVertexAttribP2uiv, glVertexAttribP2uiv, NULL,
-                     642),
-    NAME_FUNC_OFFSET(10520, glVertexAttribP3ui, glVertexAttribP3ui, NULL, 643),
-    NAME_FUNC_OFFSET(10539, glVertexAttribP3uiv, glVertexAttribP3uiv, NULL,
-                     644),
-    NAME_FUNC_OFFSET(10559, glVertexAttribP4ui, glVertexAttribP4ui, NULL, 645),
-    NAME_FUNC_OFFSET(10578, glVertexAttribP4uiv, glVertexAttribP4uiv, NULL,
-                     646),
-    NAME_FUNC_OFFSET(10598, glVertexP2ui, glVertexP2ui, NULL, 647),
-    NAME_FUNC_OFFSET(10611, glVertexP2uiv, glVertexP2uiv, NULL, 648),
-    NAME_FUNC_OFFSET(10625, glVertexP3ui, glVertexP3ui, NULL, 649),
-    NAME_FUNC_OFFSET(10638, glVertexP3uiv, glVertexP3uiv, NULL, 650),
-    NAME_FUNC_OFFSET(10652, glVertexP4ui, glVertexP4ui, NULL, 651),
-    NAME_FUNC_OFFSET(10665, glVertexP4uiv, glVertexP4uiv, NULL, 652),
-    NAME_FUNC_OFFSET(10679, glBindTransformFeedback, glBindTransformFeedback,
-                     NULL, 653),
-    NAME_FUNC_OFFSET(10703, glDeleteTransformFeedbacks,
-                     glDeleteTransformFeedbacks, NULL, 654),
-    NAME_FUNC_OFFSET(10730, glDrawTransformFeedback, glDrawTransformFeedback,
-                     NULL, 655),
-    NAME_FUNC_OFFSET(10754, glGenTransformFeedbacks, glGenTransformFeedbacks,
-                     NULL, 656),
-    NAME_FUNC_OFFSET(10778, glIsTransformFeedback, glIsTransformFeedback, NULL,
-                     657),
-    NAME_FUNC_OFFSET(10800, glPauseTransformFeedback, glPauseTransformFeedback,
-                     NULL, 658),
-    NAME_FUNC_OFFSET(10825, glResumeTransformFeedback,
-                     glResumeTransformFeedback, NULL, 659),
-    NAME_FUNC_OFFSET(10851, glClearDepthf, glClearDepthf, NULL, 660),
-    NAME_FUNC_OFFSET(10865, glDepthRangef, glDepthRangef, NULL, 661),
-    NAME_FUNC_OFFSET(10879, glGetShaderPrecisionFormat,
-                     glGetShaderPrecisionFormat, NULL, 662),
-    NAME_FUNC_OFFSET(10906, glReleaseShaderCompiler, glReleaseShaderCompiler,
-                     NULL, 663),
-    NAME_FUNC_OFFSET(10930, glShaderBinary, glShaderBinary, NULL, 664),
-    NAME_FUNC_OFFSET(10945, glGetGraphicsResetStatusARB,
-                     glGetGraphicsResetStatusARB, NULL, 665),
-    NAME_FUNC_OFFSET(10973, glGetnColorTableARB, glGetnColorTableARB, NULL,
-                     666),
-    NAME_FUNC_OFFSET(10993, glGetnCompressedTexImageARB,
-                     glGetnCompressedTexImageARB, NULL, 667),
-    NAME_FUNC_OFFSET(11021, glGetnConvolutionFilterARB,
-                     glGetnConvolutionFilterARB, NULL, 668),
-    NAME_FUNC_OFFSET(11048, glGetnHistogramARB, glGetnHistogramARB, NULL, 669),
-    NAME_FUNC_OFFSET(11067, glGetnMapdvARB, glGetnMapdvARB, NULL, 670),
-    NAME_FUNC_OFFSET(11082, glGetnMapfvARB, glGetnMapfvARB, NULL, 671),
-    NAME_FUNC_OFFSET(11097, glGetnMapivARB, glGetnMapivARB, NULL, 672),
-    NAME_FUNC_OFFSET(11112, glGetnMinmaxARB, glGetnMinmaxARB, NULL, 673),
-    NAME_FUNC_OFFSET(11128, glGetnPixelMapfvARB, glGetnPixelMapfvARB, NULL,
-                     674),
-    NAME_FUNC_OFFSET(11148, glGetnPixelMapuivARB, glGetnPixelMapuivARB, NULL,
-                     675),
-    NAME_FUNC_OFFSET(11169, glGetnPixelMapusvARB, glGetnPixelMapusvARB, NULL,
-                     676),
-    NAME_FUNC_OFFSET(11190, glGetnPolygonStippleARB, glGetnPolygonStippleARB,
-                     NULL, 677),
-    NAME_FUNC_OFFSET(11214, glGetnSeparableFilterARB, glGetnSeparableFilterARB,
-                     NULL, 678),
-    NAME_FUNC_OFFSET(11239, glGetnTexImageARB, glGetnTexImageARB, NULL, 679),
-    NAME_FUNC_OFFSET(11257, glGetnUniformdvARB, glGetnUniformdvARB, NULL, 680),
-    NAME_FUNC_OFFSET(11276, glGetnUniformfvARB, glGetnUniformfvARB, NULL, 681),
-    NAME_FUNC_OFFSET(11295, glGetnUniformivARB, glGetnUniformivARB, NULL, 682),
-    NAME_FUNC_OFFSET(11314, glGetnUniformuivARB, glGetnUniformuivARB, NULL,
-                     683),
-    NAME_FUNC_OFFSET(11334, glReadnPixelsARB, glReadnPixelsARB, NULL, 684),
-    NAME_FUNC_OFFSET(11351, glTexStorage1D, glTexStorage1D, NULL, 685),
-    NAME_FUNC_OFFSET(11366, glTexStorage2D, glTexStorage2D, NULL, 686),
-    NAME_FUNC_OFFSET(11381, glTexStorage3D, glTexStorage3D, NULL, 687),
-    NAME_FUNC_OFFSET(11396, glTextureStorage1DEXT, glTextureStorage1DEXT, NULL,
-                     688),
-    NAME_FUNC_OFFSET(11418, glTextureStorage2DEXT, glTextureStorage2DEXT, NULL,
-                     689),
-    NAME_FUNC_OFFSET(11440, glTextureStorage3DEXT, glTextureStorage3DEXT, NULL,
-                     690),
-    NAME_FUNC_OFFSET(11462, glPolygonOffsetEXT, glPolygonOffsetEXT, NULL, 691),
-    NAME_FUNC_OFFSET(11481, gl_dispatch_stub_692, gl_dispatch_stub_692, NULL,
-                     692),
-    NAME_FUNC_OFFSET(11513, gl_dispatch_stub_693, gl_dispatch_stub_693, NULL,
-                     693),
-    NAME_FUNC_OFFSET(11545, gl_dispatch_stub_694, gl_dispatch_stub_694, NULL,
-                     694),
-    NAME_FUNC_OFFSET(11573, gl_dispatch_stub_695, gl_dispatch_stub_695, NULL,
-                     695),
-    NAME_FUNC_OFFSET(11602, gl_dispatch_stub_696, gl_dispatch_stub_696, NULL,
-                     696),
-    NAME_FUNC_OFFSET(11630, gl_dispatch_stub_697, gl_dispatch_stub_697, NULL,
-                     697),
-    NAME_FUNC_OFFSET(11659, gl_dispatch_stub_698, gl_dispatch_stub_698, NULL,
-                     698),
-    NAME_FUNC_OFFSET(11676, gl_dispatch_stub_699, gl_dispatch_stub_699, NULL,
-                     699),
-    NAME_FUNC_OFFSET(11696, glColorPointerEXT, glColorPointerEXT, NULL, 700),
-    NAME_FUNC_OFFSET(11714, glEdgeFlagPointerEXT, glEdgeFlagPointerEXT, NULL,
-                     701),
-    NAME_FUNC_OFFSET(11735, glIndexPointerEXT, glIndexPointerEXT, NULL, 702),
-    NAME_FUNC_OFFSET(11753, glNormalPointerEXT, glNormalPointerEXT, NULL, 703),
-    NAME_FUNC_OFFSET(11772, glTexCoordPointerEXT, glTexCoordPointerEXT, NULL,
-                     704),
-    NAME_FUNC_OFFSET(11793, glVertexPointerEXT, glVertexPointerEXT, NULL, 705),
-    NAME_FUNC_OFFSET(11812, glPointParameterfEXT, glPointParameterfEXT, NULL,
-                     706),
-    NAME_FUNC_OFFSET(11833, glPointParameterfvEXT, glPointParameterfvEXT, NULL,
-                     707),
-    NAME_FUNC_OFFSET(11855, glLockArraysEXT, glLockArraysEXT, NULL, 708),
-    NAME_FUNC_OFFSET(11871, glUnlockArraysEXT, glUnlockArraysEXT, NULL, 709),
-    NAME_FUNC_OFFSET(11889, glSecondaryColor3bEXT, glSecondaryColor3bEXT, NULL,
-                     710),
-    NAME_FUNC_OFFSET(11911, glSecondaryColor3bvEXT, glSecondaryColor3bvEXT,
-                     NULL, 711),
-    NAME_FUNC_OFFSET(11934, glSecondaryColor3dEXT, glSecondaryColor3dEXT, NULL,
-                     712),
-    NAME_FUNC_OFFSET(11956, glSecondaryColor3dvEXT, glSecondaryColor3dvEXT,
-                     NULL, 713),
-    NAME_FUNC_OFFSET(11979, glSecondaryColor3fEXT, glSecondaryColor3fEXT, NULL,
-                     714),
-    NAME_FUNC_OFFSET(12001, glSecondaryColor3fvEXT, glSecondaryColor3fvEXT,
-                     NULL, 715),
-    NAME_FUNC_OFFSET(12024, glSecondaryColor3iEXT, glSecondaryColor3iEXT, NULL,
-                     716),
-    NAME_FUNC_OFFSET(12046, glSecondaryColor3ivEXT, glSecondaryColor3ivEXT,
-                     NULL, 717),
-    NAME_FUNC_OFFSET(12069, glSecondaryColor3sEXT, glSecondaryColor3sEXT, NULL,
-                     718),
-    NAME_FUNC_OFFSET(12091, glSecondaryColor3svEXT, glSecondaryColor3svEXT,
-                     NULL, 719),
-    NAME_FUNC_OFFSET(12114, glSecondaryColor3ubEXT, glSecondaryColor3ubEXT,
-                     NULL, 720),
-    NAME_FUNC_OFFSET(12137, glSecondaryColor3ubvEXT, glSecondaryColor3ubvEXT,
-                     NULL, 721),
-    NAME_FUNC_OFFSET(12161, glSecondaryColor3uiEXT, glSecondaryColor3uiEXT,
-                     NULL, 722),
-    NAME_FUNC_OFFSET(12184, glSecondaryColor3uivEXT, glSecondaryColor3uivEXT,
-                     NULL, 723),
-    NAME_FUNC_OFFSET(12208, glSecondaryColor3usEXT, glSecondaryColor3usEXT,
-                     NULL, 724),
-    NAME_FUNC_OFFSET(12231, glSecondaryColor3usvEXT, glSecondaryColor3usvEXT,
-                     NULL, 725),
-    NAME_FUNC_OFFSET(12255, glSecondaryColorPointerEXT,
-                     glSecondaryColorPointerEXT, NULL, 726),
-    NAME_FUNC_OFFSET(12282, glMultiDrawArraysEXT, glMultiDrawArraysEXT, NULL,
-                     727),
-    NAME_FUNC_OFFSET(12303, glMultiDrawElementsEXT, glMultiDrawElementsEXT,
-                     NULL, 728),
-    NAME_FUNC_OFFSET(12326, glFogCoordPointerEXT, glFogCoordPointerEXT, NULL,
-                     729),
-    NAME_FUNC_OFFSET(12347, glFogCoorddEXT, glFogCoorddEXT, NULL, 730),
-    NAME_FUNC_OFFSET(12362, glFogCoorddvEXT, glFogCoorddvEXT, NULL, 731),
-    NAME_FUNC_OFFSET(12378, glFogCoordfEXT, glFogCoordfEXT, NULL, 732),
-    NAME_FUNC_OFFSET(12393, glFogCoordfvEXT, glFogCoordfvEXT, NULL, 733),
-    NAME_FUNC_OFFSET(12409, gl_dispatch_stub_734, gl_dispatch_stub_734, NULL,
-                     734),
-    NAME_FUNC_OFFSET(12427, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT,
-                     NULL, 735),
-    NAME_FUNC_OFFSET(12450, glFlushVertexArrayRangeNV,
-                     glFlushVertexArrayRangeNV, NULL, 736),
-    NAME_FUNC_OFFSET(12476, glVertexArrayRangeNV, glVertexArrayRangeNV, NULL,
-                     737),
-    NAME_FUNC_OFFSET(12497, glCombinerInputNV, glCombinerInputNV, NULL, 738),
-    NAME_FUNC_OFFSET(12515, glCombinerOutputNV, glCombinerOutputNV, NULL, 739),
-    NAME_FUNC_OFFSET(12534, glCombinerParameterfNV, glCombinerParameterfNV,
-                     NULL, 740),
-    NAME_FUNC_OFFSET(12557, glCombinerParameterfvNV, glCombinerParameterfvNV,
-                     NULL, 741),
-    NAME_FUNC_OFFSET(12581, glCombinerParameteriNV, glCombinerParameteriNV,
-                     NULL, 742),
-    NAME_FUNC_OFFSET(12604, glCombinerParameterivNV, glCombinerParameterivNV,
-                     NULL, 743),
-    NAME_FUNC_OFFSET(12628, glFinalCombinerInputNV, glFinalCombinerInputNV,
-                     NULL, 744),
-    NAME_FUNC_OFFSET(12651, glGetCombinerInputParameterfvNV,
-                     glGetCombinerInputParameterfvNV, NULL, 745),
-    NAME_FUNC_OFFSET(12683, glGetCombinerInputParameterivNV,
-                     glGetCombinerInputParameterivNV, NULL, 746),
-    NAME_FUNC_OFFSET(12715, glGetCombinerOutputParameterfvNV,
-                     glGetCombinerOutputParameterfvNV, NULL, 747),
-    NAME_FUNC_OFFSET(12748, glGetCombinerOutputParameterivNV,
-                     glGetCombinerOutputParameterivNV, NULL, 748),
-    NAME_FUNC_OFFSET(12781, glGetFinalCombinerInputParameterfvNV,
-                     glGetFinalCombinerInputParameterfvNV, NULL, 749),
-    NAME_FUNC_OFFSET(12818, glGetFinalCombinerInputParameterivNV,
-                     glGetFinalCombinerInputParameterivNV, NULL, 750),
-    NAME_FUNC_OFFSET(12855, glResizeBuffersMESA, glResizeBuffersMESA, NULL,
-                     751),
-    NAME_FUNC_OFFSET(12875, glWindowPos2dMESA, glWindowPos2dMESA, NULL, 752),
-    NAME_FUNC_OFFSET(12893, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, 753),
-    NAME_FUNC_OFFSET(12912, glWindowPos2fMESA, glWindowPos2fMESA, NULL, 754),
-    NAME_FUNC_OFFSET(12930, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, 755),
-    NAME_FUNC_OFFSET(12949, glWindowPos2iMESA, glWindowPos2iMESA, NULL, 756),
-    NAME_FUNC_OFFSET(12967, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, 757),
-    NAME_FUNC_OFFSET(12986, glWindowPos2sMESA, glWindowPos2sMESA, NULL, 758),
-    NAME_FUNC_OFFSET(13004, glWindowPos2svMESA, glWindowPos2svMESA, NULL, 759),
-    NAME_FUNC_OFFSET(13023, glWindowPos3dMESA, glWindowPos3dMESA, NULL, 760),
-    NAME_FUNC_OFFSET(13041, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, 761),
-    NAME_FUNC_OFFSET(13060, glWindowPos3fMESA, glWindowPos3fMESA, NULL, 762),
-    NAME_FUNC_OFFSET(13078, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, 763),
-    NAME_FUNC_OFFSET(13097, glWindowPos3iMESA, glWindowPos3iMESA, NULL, 764),
-    NAME_FUNC_OFFSET(13115, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, 765),
-    NAME_FUNC_OFFSET(13134, glWindowPos3sMESA, glWindowPos3sMESA, NULL, 766),
-    NAME_FUNC_OFFSET(13152, glWindowPos3svMESA, glWindowPos3svMESA, NULL, 767),
-    NAME_FUNC_OFFSET(13171, glWindowPos4dMESA, glWindowPos4dMESA, NULL, 768),
-    NAME_FUNC_OFFSET(13189, glWindowPos4dvMESA, glWindowPos4dvMESA, NULL, 769),
-    NAME_FUNC_OFFSET(13208, glWindowPos4fMESA, glWindowPos4fMESA, NULL, 770),
-    NAME_FUNC_OFFSET(13226, glWindowPos4fvMESA, glWindowPos4fvMESA, NULL, 771),
-    NAME_FUNC_OFFSET(13245, glWindowPos4iMESA, glWindowPos4iMESA, NULL, 772),
-    NAME_FUNC_OFFSET(13263, glWindowPos4ivMESA, glWindowPos4ivMESA, NULL, 773),
-    NAME_FUNC_OFFSET(13282, glWindowPos4sMESA, glWindowPos4sMESA, NULL, 774),
-    NAME_FUNC_OFFSET(13300, glWindowPos4svMESA, glWindowPos4svMESA, NULL, 775),
-    NAME_FUNC_OFFSET(13319, gl_dispatch_stub_776, gl_dispatch_stub_776, NULL,
-                     776),
-    NAME_FUNC_OFFSET(13344, gl_dispatch_stub_777, gl_dispatch_stub_777, NULL,
-                     777),
-    NAME_FUNC_OFFSET(13371, gl_dispatch_stub_778, gl_dispatch_stub_778, NULL,
-                     778),
-    NAME_FUNC_OFFSET(13388, gl_dispatch_stub_779, gl_dispatch_stub_779, NULL,
-                     779),
-    NAME_FUNC_OFFSET(13404, gl_dispatch_stub_780, gl_dispatch_stub_780, NULL,
-                     780),
-    NAME_FUNC_OFFSET(13418, gl_dispatch_stub_781, gl_dispatch_stub_781, NULL,
-                     781),
-    NAME_FUNC_OFFSET(13433, gl_dispatch_stub_782, gl_dispatch_stub_782, NULL,
-                     782),
-    NAME_FUNC_OFFSET(13445, gl_dispatch_stub_783, gl_dispatch_stub_783, NULL,
-                     783),
-    NAME_FUNC_OFFSET(13458, gl_dispatch_stub_784, gl_dispatch_stub_784, NULL,
-                     784),
-    NAME_FUNC_OFFSET(13472, glAreProgramsResidentNV, glAreProgramsResidentNV,
-                     NULL, 785),
-    NAME_FUNC_OFFSET(13496, glBindProgramNV, glBindProgramNV, NULL, 786),
-    NAME_FUNC_OFFSET(13512, glDeleteProgramsNV, glDeleteProgramsNV, NULL, 787),
-    NAME_FUNC_OFFSET(13531, glExecuteProgramNV, glExecuteProgramNV, NULL, 788),
-    NAME_FUNC_OFFSET(13550, glGenProgramsNV, glGenProgramsNV, NULL, 789),
-    NAME_FUNC_OFFSET(13566, glGetProgramParameterdvNV,
-                     glGetProgramParameterdvNV, NULL, 790),
-    NAME_FUNC_OFFSET(13592, glGetProgramParameterfvNV,
-                     glGetProgramParameterfvNV, NULL, 791),
-    NAME_FUNC_OFFSET(13618, glGetProgramStringNV, glGetProgramStringNV, NULL,
-                     792),
-    NAME_FUNC_OFFSET(13639, glGetProgramivNV, glGetProgramivNV, NULL, 793),
-    NAME_FUNC_OFFSET(13656, glGetTrackMatrixivNV, glGetTrackMatrixivNV, NULL,
-                     794),
-    NAME_FUNC_OFFSET(13677, glGetVertexAttribPointervNV,
-                     glGetVertexAttribPointervNV, NULL, 795),
-    NAME_FUNC_OFFSET(13705, glGetVertexAttribdvNV, glGetVertexAttribdvNV, NULL,
-                     796),
-    NAME_FUNC_OFFSET(13727, glGetVertexAttribfvNV, glGetVertexAttribfvNV, NULL,
-                     797),
-    NAME_FUNC_OFFSET(13749, glGetVertexAttribivNV, glGetVertexAttribivNV, NULL,
-                     798),
-    NAME_FUNC_OFFSET(13771, glIsProgramNV, glIsProgramNV, NULL, 799),
-    NAME_FUNC_OFFSET(13785, glLoadProgramNV, glLoadProgramNV, NULL, 800),
-    NAME_FUNC_OFFSET(13801, glProgramParameters4dvNV, glProgramParameters4dvNV,
-                     NULL, 801),
-    NAME_FUNC_OFFSET(13826, glProgramParameters4fvNV, glProgramParameters4fvNV,
-                     NULL, 802),
-    NAME_FUNC_OFFSET(13851, glRequestResidentProgramsNV,
-                     glRequestResidentProgramsNV, NULL, 803),
-    NAME_FUNC_OFFSET(13879, glTrackMatrixNV, glTrackMatrixNV, NULL, 804),
-    NAME_FUNC_OFFSET(13895, glVertexAttrib1dNV, glVertexAttrib1dNV, NULL, 805),
-    NAME_FUNC_OFFSET(13914, glVertexAttrib1dvNV, glVertexAttrib1dvNV, NULL,
-                     806),
-    NAME_FUNC_OFFSET(13934, glVertexAttrib1fNV, glVertexAttrib1fNV, NULL, 807),
-    NAME_FUNC_OFFSET(13953, glVertexAttrib1fvNV, glVertexAttrib1fvNV, NULL,
-                     808),
-    NAME_FUNC_OFFSET(13973, glVertexAttrib1sNV, glVertexAttrib1sNV, NULL, 809),
-    NAME_FUNC_OFFSET(13992, glVertexAttrib1svNV, glVertexAttrib1svNV, NULL,
-                     810),
-    NAME_FUNC_OFFSET(14012, glVertexAttrib2dNV, glVertexAttrib2dNV, NULL, 811),
-    NAME_FUNC_OFFSET(14031, glVertexAttrib2dvNV, glVertexAttrib2dvNV, NULL,
-                     812),
-    NAME_FUNC_OFFSET(14051, glVertexAttrib2fNV, glVertexAttrib2fNV, NULL, 813),
-    NAME_FUNC_OFFSET(14070, glVertexAttrib2fvNV, glVertexAttrib2fvNV, NULL,
-                     814),
-    NAME_FUNC_OFFSET(14090, glVertexAttrib2sNV, glVertexAttrib2sNV, NULL, 815),
-    NAME_FUNC_OFFSET(14109, glVertexAttrib2svNV, glVertexAttrib2svNV, NULL,
-                     816),
-    NAME_FUNC_OFFSET(14129, glVertexAttrib3dNV, glVertexAttrib3dNV, NULL, 817),
-    NAME_FUNC_OFFSET(14148, glVertexAttrib3dvNV, glVertexAttrib3dvNV, NULL,
-                     818),
-    NAME_FUNC_OFFSET(14168, glVertexAttrib3fNV, glVertexAttrib3fNV, NULL, 819),
-    NAME_FUNC_OFFSET(14187, glVertexAttrib3fvNV, glVertexAttrib3fvNV, NULL,
-                     820),
-    NAME_FUNC_OFFSET(14207, glVertexAttrib3sNV, glVertexAttrib3sNV, NULL, 821),
-    NAME_FUNC_OFFSET(14226, glVertexAttrib3svNV, glVertexAttrib3svNV, NULL,
-                     822),
-    NAME_FUNC_OFFSET(14246, glVertexAttrib4dNV, glVertexAttrib4dNV, NULL, 823),
-    NAME_FUNC_OFFSET(14265, glVertexAttrib4dvNV, glVertexAttrib4dvNV, NULL,
-                     824),
-    NAME_FUNC_OFFSET(14285, glVertexAttrib4fNV, glVertexAttrib4fNV, NULL, 825),
-    NAME_FUNC_OFFSET(14304, glVertexAttrib4fvNV, glVertexAttrib4fvNV, NULL,
-                     826),
-    NAME_FUNC_OFFSET(14324, glVertexAttrib4sNV, glVertexAttrib4sNV, NULL, 827),
-    NAME_FUNC_OFFSET(14343, glVertexAttrib4svNV, glVertexAttrib4svNV, NULL,
-                     828),
-    NAME_FUNC_OFFSET(14363, glVertexAttrib4ubNV, glVertexAttrib4ubNV, NULL,
-                     829),
-    NAME_FUNC_OFFSET(14383, glVertexAttrib4ubvNV, glVertexAttrib4ubvNV, NULL,
-                     830),
-    NAME_FUNC_OFFSET(14404, glVertexAttribPointerNV, glVertexAttribPointerNV,
-                     NULL, 831),
-    NAME_FUNC_OFFSET(14428, glVertexAttribs1dvNV, glVertexAttribs1dvNV, NULL,
-                     832),
-    NAME_FUNC_OFFSET(14449, glVertexAttribs1fvNV, glVertexAttribs1fvNV, NULL,
-                     833),
-    NAME_FUNC_OFFSET(14470, glVertexAttribs1svNV, glVertexAttribs1svNV, NULL,
-                     834),
-    NAME_FUNC_OFFSET(14491, glVertexAttribs2dvNV, glVertexAttribs2dvNV, NULL,
-                     835),
-    NAME_FUNC_OFFSET(14512, glVertexAttribs2fvNV, glVertexAttribs2fvNV, NULL,
-                     836),
-    NAME_FUNC_OFFSET(14533, glVertexAttribs2svNV, glVertexAttribs2svNV, NULL,
-                     837),
-    NAME_FUNC_OFFSET(14554, glVertexAttribs3dvNV, glVertexAttribs3dvNV, NULL,
-                     838),
-    NAME_FUNC_OFFSET(14575, glVertexAttribs3fvNV, glVertexAttribs3fvNV, NULL,
-                     839),
-    NAME_FUNC_OFFSET(14596, glVertexAttribs3svNV, glVertexAttribs3svNV, NULL,
-                     840),
-    NAME_FUNC_OFFSET(14617, glVertexAttribs4dvNV, glVertexAttribs4dvNV, NULL,
-                     841),
-    NAME_FUNC_OFFSET(14638, glVertexAttribs4fvNV, glVertexAttribs4fvNV, NULL,
-                     842),
-    NAME_FUNC_OFFSET(14659, glVertexAttribs4svNV, glVertexAttribs4svNV, NULL,
-                     843),
-    NAME_FUNC_OFFSET(14680, glVertexAttribs4ubvNV, glVertexAttribs4ubvNV, NULL,
-                     844),
-    NAME_FUNC_OFFSET(14702, glGetTexBumpParameterfvATI,
-                     glGetTexBumpParameterfvATI, NULL, 845),
-    NAME_FUNC_OFFSET(14729, glGetTexBumpParameterivATI,
-                     glGetTexBumpParameterivATI, NULL, 846),
-    NAME_FUNC_OFFSET(14756, glTexBumpParameterfvATI, glTexBumpParameterfvATI,
-                     NULL, 847),
-    NAME_FUNC_OFFSET(14780, glTexBumpParameterivATI, glTexBumpParameterivATI,
-                     NULL, 848),
-    NAME_FUNC_OFFSET(14804, glAlphaFragmentOp1ATI, glAlphaFragmentOp1ATI, NULL,
-                     849),
-    NAME_FUNC_OFFSET(14826, glAlphaFragmentOp2ATI, glAlphaFragmentOp2ATI, NULL,
-                     850),
-    NAME_FUNC_OFFSET(14848, glAlphaFragmentOp3ATI, glAlphaFragmentOp3ATI, NULL,
-                     851),
-    NAME_FUNC_OFFSET(14870, glBeginFragmentShaderATI, glBeginFragmentShaderATI,
-                     NULL, 852),
-    NAME_FUNC_OFFSET(14895, glBindFragmentShaderATI, glBindFragmentShaderATI,
-                     NULL, 853),
-    NAME_FUNC_OFFSET(14919, glColorFragmentOp1ATI, glColorFragmentOp1ATI, NULL,
-                     854),
-    NAME_FUNC_OFFSET(14941, glColorFragmentOp2ATI, glColorFragmentOp2ATI, NULL,
-                     855),
-    NAME_FUNC_OFFSET(14963, glColorFragmentOp3ATI, glColorFragmentOp3ATI, NULL,
-                     856),
-    NAME_FUNC_OFFSET(14985, glDeleteFragmentShaderATI,
-                     glDeleteFragmentShaderATI, NULL, 857),
-    NAME_FUNC_OFFSET(15011, glEndFragmentShaderATI, glEndFragmentShaderATI,
-                     NULL, 858),
-    NAME_FUNC_OFFSET(15034, glGenFragmentShadersATI, glGenFragmentShadersATI,
-                     NULL, 859),
-    NAME_FUNC_OFFSET(15058, glPassTexCoordATI, glPassTexCoordATI, NULL, 860),
-    NAME_FUNC_OFFSET(15076, glSampleMapATI, glSampleMapATI, NULL, 861),
-    NAME_FUNC_OFFSET(15091, glSetFragmentShaderConstantATI,
-                     glSetFragmentShaderConstantATI, NULL, 862),
-    NAME_FUNC_OFFSET(15122, glPointParameteriNV, glPointParameteriNV, NULL,
-                     863),
-    NAME_FUNC_OFFSET(15142, glPointParameterivNV, glPointParameterivNV, NULL,
-                     864),
-    NAME_FUNC_OFFSET(15163, gl_dispatch_stub_865, gl_dispatch_stub_865, NULL,
-                     865),
-    NAME_FUNC_OFFSET(15186, gl_dispatch_stub_866, gl_dispatch_stub_866, NULL,
-                     866),
-    NAME_FUNC_OFFSET(15209, gl_dispatch_stub_867, gl_dispatch_stub_867, NULL,
-                     867),
-    NAME_FUNC_OFFSET(15235, gl_dispatch_stub_868, gl_dispatch_stub_868, NULL,
-                     868),
-    NAME_FUNC_OFFSET(15258, gl_dispatch_stub_869, gl_dispatch_stub_869, NULL,
-                     869),
-    NAME_FUNC_OFFSET(15279, glGetProgramNamedParameterdvNV,
-                     glGetProgramNamedParameterdvNV, NULL, 870),
-    NAME_FUNC_OFFSET(15310, glGetProgramNamedParameterfvNV,
-                     glGetProgramNamedParameterfvNV, NULL, 871),
-    NAME_FUNC_OFFSET(15341, glProgramNamedParameter4dNV,
-                     glProgramNamedParameter4dNV, NULL, 872),
-    NAME_FUNC_OFFSET(15369, glProgramNamedParameter4dvNV,
-                     glProgramNamedParameter4dvNV, NULL, 873),
-    NAME_FUNC_OFFSET(15398, glProgramNamedParameter4fNV,
-                     glProgramNamedParameter4fNV, NULL, 874),
-    NAME_FUNC_OFFSET(15426, glProgramNamedParameter4fvNV,
-                     glProgramNamedParameter4fvNV, NULL, 875),
-    NAME_FUNC_OFFSET(15455, glPrimitiveRestartIndexNV,
-                     glPrimitiveRestartIndexNV, NULL, 876),
-    NAME_FUNC_OFFSET(15481, glPrimitiveRestartNV, glPrimitiveRestartNV, NULL,
-                     877),
-    NAME_FUNC_OFFSET(15502, gl_dispatch_stub_878, gl_dispatch_stub_878, NULL,
-                     878),
-    NAME_FUNC_OFFSET(15519, gl_dispatch_stub_879, gl_dispatch_stub_879, NULL,
-                     879),
-    NAME_FUNC_OFFSET(15546, glBindFramebufferEXT, glBindFramebufferEXT, NULL,
-                     880),
-    NAME_FUNC_OFFSET(15567, glBindRenderbufferEXT, glBindRenderbufferEXT, NULL,
-                     881),
-    NAME_FUNC_OFFSET(15589, glCheckFramebufferStatusEXT,
-                     glCheckFramebufferStatusEXT, NULL, 882),
-    NAME_FUNC_OFFSET(15617, glDeleteFramebuffersEXT, glDeleteFramebuffersEXT,
-                     NULL, 883),
-    NAME_FUNC_OFFSET(15641, glDeleteRenderbuffersEXT, glDeleteRenderbuffersEXT,
-                     NULL, 884),
-    NAME_FUNC_OFFSET(15666, glFramebufferRenderbufferEXT,
-                     glFramebufferRenderbufferEXT, NULL, 885),
-    NAME_FUNC_OFFSET(15695, glFramebufferTexture1DEXT,
-                     glFramebufferTexture1DEXT, NULL, 886),
-    NAME_FUNC_OFFSET(15721, glFramebufferTexture2DEXT,
-                     glFramebufferTexture2DEXT, NULL, 887),
-    NAME_FUNC_OFFSET(15747, glFramebufferTexture3DEXT,
-                     glFramebufferTexture3DEXT, NULL, 888),
-    NAME_FUNC_OFFSET(15773, glGenFramebuffersEXT, glGenFramebuffersEXT, NULL,
-                     889),
-    NAME_FUNC_OFFSET(15794, glGenRenderbuffersEXT, glGenRenderbuffersEXT, NULL,
-                     890),
-    NAME_FUNC_OFFSET(15816, glGenerateMipmapEXT, glGenerateMipmapEXT, NULL,
-                     891),
-    NAME_FUNC_OFFSET(15836, glGetFramebufferAttachmentParameterivEXT,
-                     glGetFramebufferAttachmentParameterivEXT, NULL, 892),
-    NAME_FUNC_OFFSET(15877, glGetRenderbufferParameterivEXT,
-                     glGetRenderbufferParameterivEXT, NULL, 893),
-    NAME_FUNC_OFFSET(15909, glIsFramebufferEXT, glIsFramebufferEXT, NULL, 894),
-    NAME_FUNC_OFFSET(15928, glIsRenderbufferEXT, glIsRenderbufferEXT, NULL,
-                     895),
-    NAME_FUNC_OFFSET(15948, glRenderbufferStorageEXT, glRenderbufferStorageEXT,
-                     NULL, 896),
-    NAME_FUNC_OFFSET(15973, gl_dispatch_stub_897, gl_dispatch_stub_897, NULL,
-                     897),
-    NAME_FUNC_OFFSET(15994, gl_dispatch_stub_898, gl_dispatch_stub_898, NULL,
-                     898),
-    NAME_FUNC_OFFSET(16018, gl_dispatch_stub_899, gl_dispatch_stub_899, NULL,
-                     899),
-    NAME_FUNC_OFFSET(16048, glBindFragDataLocationEXT,
-                     glBindFragDataLocationEXT, NULL, 900),
-    NAME_FUNC_OFFSET(16074, glGetFragDataLocationEXT, glGetFragDataLocationEXT,
-                     NULL, 901),
-    NAME_FUNC_OFFSET(16099, glGetUniformuivEXT, glGetUniformuivEXT, NULL, 902),
-    NAME_FUNC_OFFSET(16118, glGetVertexAttribIivEXT, glGetVertexAttribIivEXT,
-                     NULL, 903),
-    NAME_FUNC_OFFSET(16142, glGetVertexAttribIuivEXT, glGetVertexAttribIuivEXT,
-                     NULL, 904),
-    NAME_FUNC_OFFSET(16167, glUniform1uiEXT, glUniform1uiEXT, NULL, 905),
-    NAME_FUNC_OFFSET(16183, glUniform1uivEXT, glUniform1uivEXT, NULL, 906),
-    NAME_FUNC_OFFSET(16200, glUniform2uiEXT, glUniform2uiEXT, NULL, 907),
-    NAME_FUNC_OFFSET(16216, glUniform2uivEXT, glUniform2uivEXT, NULL, 908),
-    NAME_FUNC_OFFSET(16233, glUniform3uiEXT, glUniform3uiEXT, NULL, 909),
-    NAME_FUNC_OFFSET(16249, glUniform3uivEXT, glUniform3uivEXT, NULL, 910),
-    NAME_FUNC_OFFSET(16266, glUniform4uiEXT, glUniform4uiEXT, NULL, 911),
-    NAME_FUNC_OFFSET(16282, glUniform4uivEXT, glUniform4uivEXT, NULL, 912),
-    NAME_FUNC_OFFSET(16299, glVertexAttribI1iEXT, glVertexAttribI1iEXT, NULL,
-                     913),
-    NAME_FUNC_OFFSET(16320, glVertexAttribI1ivEXT, glVertexAttribI1ivEXT, NULL,
-                     914),
-    NAME_FUNC_OFFSET(16342, glVertexAttribI1uiEXT, glVertexAttribI1uiEXT, NULL,
-                     915),
-    NAME_FUNC_OFFSET(16364, glVertexAttribI1uivEXT, glVertexAttribI1uivEXT,
-                     NULL, 916),
-    NAME_FUNC_OFFSET(16387, glVertexAttribI2iEXT, glVertexAttribI2iEXT, NULL,
-                     917),
-    NAME_FUNC_OFFSET(16408, glVertexAttribI2ivEXT, glVertexAttribI2ivEXT, NULL,
-                     918),
-    NAME_FUNC_OFFSET(16430, glVertexAttribI2uiEXT, glVertexAttribI2uiEXT, NULL,
-                     919),
-    NAME_FUNC_OFFSET(16452, glVertexAttribI2uivEXT, glVertexAttribI2uivEXT,
-                     NULL, 920),
-    NAME_FUNC_OFFSET(16475, glVertexAttribI3iEXT, glVertexAttribI3iEXT, NULL,
-                     921),
-    NAME_FUNC_OFFSET(16496, glVertexAttribI3ivEXT, glVertexAttribI3ivEXT, NULL,
-                     922),
-    NAME_FUNC_OFFSET(16518, glVertexAttribI3uiEXT, glVertexAttribI3uiEXT, NULL,
-                     923),
-    NAME_FUNC_OFFSET(16540, glVertexAttribI3uivEXT, glVertexAttribI3uivEXT,
-                     NULL, 924),
-    NAME_FUNC_OFFSET(16563, glVertexAttribI4bvEXT, glVertexAttribI4bvEXT, NULL,
-                     925),
-    NAME_FUNC_OFFSET(16585, glVertexAttribI4iEXT, glVertexAttribI4iEXT, NULL,
-                     926),
-    NAME_FUNC_OFFSET(16606, glVertexAttribI4ivEXT, glVertexAttribI4ivEXT, NULL,
-                     927),
-    NAME_FUNC_OFFSET(16628, glVertexAttribI4svEXT, glVertexAttribI4svEXT, NULL,
-                     928),
-    NAME_FUNC_OFFSET(16650, glVertexAttribI4ubvEXT, glVertexAttribI4ubvEXT,
-                     NULL, 929),
-    NAME_FUNC_OFFSET(16673, glVertexAttribI4uiEXT, glVertexAttribI4uiEXT, NULL,
-                     930),
-    NAME_FUNC_OFFSET(16695, glVertexAttribI4uivEXT, glVertexAttribI4uivEXT,
-                     NULL, 931),
-    NAME_FUNC_OFFSET(16718, glVertexAttribI4usvEXT, glVertexAttribI4usvEXT,
-                     NULL, 932),
-    NAME_FUNC_OFFSET(16741, glVertexAttribIPointerEXT,
-                     glVertexAttribIPointerEXT, NULL, 933),
-    NAME_FUNC_OFFSET(16767, glFramebufferTextureLayerEXT,
-                     glFramebufferTextureLayerEXT, NULL, 934),
-    NAME_FUNC_OFFSET(16796, glColorMaskIndexedEXT, glColorMaskIndexedEXT, NULL,
-                     935),
-    NAME_FUNC_OFFSET(16818, glDisableIndexedEXT, glDisableIndexedEXT, NULL,
-                     936),
-    NAME_FUNC_OFFSET(16838, glEnableIndexedEXT, glEnableIndexedEXT, NULL, 937),
-    NAME_FUNC_OFFSET(16857, glGetBooleanIndexedvEXT, glGetBooleanIndexedvEXT,
-                     NULL, 938),
-    NAME_FUNC_OFFSET(16881, glGetIntegerIndexedvEXT, glGetIntegerIndexedvEXT,
-                     NULL, 939),
-    NAME_FUNC_OFFSET(16905, glIsEnabledIndexedEXT, glIsEnabledIndexedEXT, NULL,
-                     940),
-    NAME_FUNC_OFFSET(16927, glClearColorIiEXT, glClearColorIiEXT, NULL, 941),
-    NAME_FUNC_OFFSET(16945, glClearColorIuiEXT, glClearColorIuiEXT, NULL, 942),
-    NAME_FUNC_OFFSET(16964, glGetTexParameterIivEXT, glGetTexParameterIivEXT,
-                     NULL, 943),
-    NAME_FUNC_OFFSET(16988, glGetTexParameterIuivEXT, glGetTexParameterIuivEXT,
-                     NULL, 944),
-    NAME_FUNC_OFFSET(17013, glTexParameterIivEXT, glTexParameterIivEXT, NULL,
-                     945),
-    NAME_FUNC_OFFSET(17034, glTexParameterIuivEXT, glTexParameterIuivEXT, NULL,
-                     946),
-    NAME_FUNC_OFFSET(17056, glBeginConditionalRenderNV,
-                     glBeginConditionalRenderNV, NULL, 947),
-    NAME_FUNC_OFFSET(17083, glEndConditionalRenderNV, glEndConditionalRenderNV,
-                     NULL, 948),
-    NAME_FUNC_OFFSET(17108, glBeginTransformFeedbackEXT,
-                     glBeginTransformFeedbackEXT, NULL, 949),
-    NAME_FUNC_OFFSET(17136, glBindBufferBaseEXT, glBindBufferBaseEXT, NULL,
-                     950),
-    NAME_FUNC_OFFSET(17156, glBindBufferOffsetEXT, glBindBufferOffsetEXT, NULL,
-                     951),
-    NAME_FUNC_OFFSET(17178, glBindBufferRangeEXT, glBindBufferRangeEXT, NULL,
-                     952),
-    NAME_FUNC_OFFSET(17199, glEndTransformFeedbackEXT,
-                     glEndTransformFeedbackEXT, NULL, 953),
-    NAME_FUNC_OFFSET(17225, glGetTransformFeedbackVaryingEXT,
-                     glGetTransformFeedbackVaryingEXT, NULL, 954),
-    NAME_FUNC_OFFSET(17258, glTransformFeedbackVaryingsEXT,
-                     glTransformFeedbackVaryingsEXT, NULL, 955),
-    NAME_FUNC_OFFSET(17289, glProvokingVertexEXT, glProvokingVertexEXT, NULL,
-                     956),
-    NAME_FUNC_OFFSET(17310, gl_dispatch_stub_957, gl_dispatch_stub_957, NULL,
-                     957),
-    NAME_FUNC_OFFSET(17341, gl_dispatch_stub_958, gl_dispatch_stub_958, NULL,
-                     958),
-    NAME_FUNC_OFFSET(17361, glGetObjectParameterivAPPLE,
-                     glGetObjectParameterivAPPLE, NULL, 959),
-    NAME_FUNC_OFFSET(17389, glObjectPurgeableAPPLE, glObjectPurgeableAPPLE,
-                     NULL, 960),
-    NAME_FUNC_OFFSET(17412, glObjectUnpurgeableAPPLE, glObjectUnpurgeableAPPLE,
-                     NULL, 961),
-    NAME_FUNC_OFFSET(17437, glActiveProgramEXT, glActiveProgramEXT, NULL, 962),
-    NAME_FUNC_OFFSET(17456, glCreateShaderProgramEXT, glCreateShaderProgramEXT,
-                     NULL, 963),
-    NAME_FUNC_OFFSET(17481, glUseShaderProgramEXT, glUseShaderProgramEXT, NULL,
-                     964),
-    NAME_FUNC_OFFSET(17503, glTextureBarrierNV, glTextureBarrierNV, NULL, 965),
-    NAME_FUNC_OFFSET(17522, gl_dispatch_stub_966, gl_dispatch_stub_966, NULL,
-                     966),
-    NAME_FUNC_OFFSET(17547, gl_dispatch_stub_967, gl_dispatch_stub_967, NULL,
-                     967),
-    NAME_FUNC_OFFSET(17576, gl_dispatch_stub_968, gl_dispatch_stub_968, NULL,
-                     968),
-    NAME_FUNC_OFFSET(17607, gl_dispatch_stub_969, gl_dispatch_stub_969, NULL,
-                     969),
-    NAME_FUNC_OFFSET(17631, gl_dispatch_stub_970, gl_dispatch_stub_970, NULL,
-                     970),
-    NAME_FUNC_OFFSET(17656, glEGLImageTargetRenderbufferStorageOES,
-                     glEGLImageTargetRenderbufferStorageOES, NULL, 971),
-    NAME_FUNC_OFFSET(17695, glEGLImageTargetTexture2DOES,
-                     glEGLImageTargetTexture2DOES, NULL, 972),
-    NAME_FUNC_OFFSET(17724, glArrayElement, glArrayElement, NULL, 306),
-    NAME_FUNC_OFFSET(17742, glBindTexture, glBindTexture, NULL, 307),
-    NAME_FUNC_OFFSET(17759, glDrawArrays, glDrawArrays, NULL, 310),
-    NAME_FUNC_OFFSET(17775, glAreTexturesResident, glAreTexturesResidentEXT,
-                     glAreTexturesResidentEXT, 322),
-    NAME_FUNC_OFFSET(17800, glCopyTexImage1D, glCopyTexImage1D, NULL, 323),
-    NAME_FUNC_OFFSET(17820, glCopyTexImage2D, glCopyTexImage2D, NULL, 324),
-    NAME_FUNC_OFFSET(17840, glCopyTexSubImage1D, glCopyTexSubImage1D, NULL,
-                     325),
-    NAME_FUNC_OFFSET(17863, glCopyTexSubImage2D, glCopyTexSubImage2D, NULL,
-                     326),
-    NAME_FUNC_OFFSET(17886, glDeleteTextures, glDeleteTexturesEXT,
-                     glDeleteTexturesEXT, 327),
-    NAME_FUNC_OFFSET(17906, glGenTextures, glGenTexturesEXT, glGenTexturesEXT,
-                     328),
-    NAME_FUNC_OFFSET(17923, glGetPointerv, glGetPointerv, NULL, 329),
-    NAME_FUNC_OFFSET(17940, glIsTexture, glIsTextureEXT, glIsTextureEXT, 330),
-    NAME_FUNC_OFFSET(17955, glPrioritizeTextures, glPrioritizeTextures, NULL,
-                     331),
-    NAME_FUNC_OFFSET(17979, glTexSubImage1D, glTexSubImage1D, NULL, 332),
-    NAME_FUNC_OFFSET(17998, glTexSubImage2D, glTexSubImage2D, NULL, 333),
-    NAME_FUNC_OFFSET(18017, glBlendColor, glBlendColor, NULL, 336),
-    NAME_FUNC_OFFSET(18033, glBlendEquation, glBlendEquation, NULL, 337),
-    NAME_FUNC_OFFSET(18052, glDrawRangeElements, glDrawRangeElements, NULL,
-                     338),
-    NAME_FUNC_OFFSET(18075, glColorTable, glColorTable, NULL, 339),
-    NAME_FUNC_OFFSET(18091, glColorTable, glColorTable, NULL, 339),
-    NAME_FUNC_OFFSET(18107, glColorTableParameterfv, glColorTableParameterfv,
-                     NULL, 340),
-    NAME_FUNC_OFFSET(18134, glColorTableParameteriv, glColorTableParameteriv,
-                     NULL, 341),
-    NAME_FUNC_OFFSET(18161, glCopyColorTable, glCopyColorTable, NULL, 342),
-    NAME_FUNC_OFFSET(18181, glGetColorTable, glGetColorTableEXT,
-                     glGetColorTableEXT, 343),
-    NAME_FUNC_OFFSET(18200, glGetColorTable, glGetColorTableEXT,
-                     glGetColorTableEXT, 343),
-    NAME_FUNC_OFFSET(18219, glGetColorTableParameterfv,
-                     glGetColorTableParameterfvEXT,
-                     glGetColorTableParameterfvEXT, 344),
-    NAME_FUNC_OFFSET(18249, glGetColorTableParameterfv,
-                     glGetColorTableParameterfvEXT,
-                     glGetColorTableParameterfvEXT, 344),
-    NAME_FUNC_OFFSET(18279, glGetColorTableParameteriv,
-                     glGetColorTableParameterivEXT,
-                     glGetColorTableParameterivEXT, 345),
-    NAME_FUNC_OFFSET(18309, glGetColorTableParameteriv,
-                     glGetColorTableParameterivEXT,
-                     glGetColorTableParameterivEXT, 345),
-    NAME_FUNC_OFFSET(18339, glColorSubTable, glColorSubTable, NULL, 346),
-    NAME_FUNC_OFFSET(18358, glCopyColorSubTable, glCopyColorSubTable, NULL,
-                     347),
-    NAME_FUNC_OFFSET(18381, glConvolutionFilter1D, glConvolutionFilter1D, NULL,
-                     348),
-    NAME_FUNC_OFFSET(18406, glConvolutionFilter2D, glConvolutionFilter2D, NULL,
-                     349),
-    NAME_FUNC_OFFSET(18431, glConvolutionParameterf, glConvolutionParameterf,
-                     NULL, 350),
-    NAME_FUNC_OFFSET(18458, glConvolutionParameterfv, glConvolutionParameterfv,
-                     NULL, 351),
-    NAME_FUNC_OFFSET(18486, glConvolutionParameteri, glConvolutionParameteri,
-                     NULL, 352),
-    NAME_FUNC_OFFSET(18513, glConvolutionParameteriv, glConvolutionParameteriv,
-                     NULL, 353),
-    NAME_FUNC_OFFSET(18541, glCopyConvolutionFilter1D,
-                     glCopyConvolutionFilter1D, NULL, 354),
-    NAME_FUNC_OFFSET(18570, glCopyConvolutionFilter2D,
-                     glCopyConvolutionFilter2D, NULL, 355),
-    NAME_FUNC_OFFSET(18599, glGetConvolutionFilter, gl_dispatch_stub_356,
-                     gl_dispatch_stub_356, 356),
-    NAME_FUNC_OFFSET(18625, glGetConvolutionParameterfv, gl_dispatch_stub_357,
-                     gl_dispatch_stub_357, 357),
-    NAME_FUNC_OFFSET(18656, glGetConvolutionParameteriv, gl_dispatch_stub_358,
-                     gl_dispatch_stub_358, 358),
-    NAME_FUNC_OFFSET(18687, glGetSeparableFilter, gl_dispatch_stub_359,
-                     gl_dispatch_stub_359, 359),
-    NAME_FUNC_OFFSET(18711, glSeparableFilter2D, glSeparableFilter2D, NULL,
-                     360),
-    NAME_FUNC_OFFSET(18734, glGetHistogram, gl_dispatch_stub_361,
-                     gl_dispatch_stub_361, 361),
-    NAME_FUNC_OFFSET(18752, glGetHistogramParameterfv, gl_dispatch_stub_362,
-                     gl_dispatch_stub_362, 362),
-    NAME_FUNC_OFFSET(18781, glGetHistogramParameteriv, gl_dispatch_stub_363,
-                     gl_dispatch_stub_363, 363),
-    NAME_FUNC_OFFSET(18810, glGetMinmax, gl_dispatch_stub_364,
-                     gl_dispatch_stub_364, 364),
-    NAME_FUNC_OFFSET(18825, glGetMinmaxParameterfv, gl_dispatch_stub_365,
-                     gl_dispatch_stub_365, 365),
-    NAME_FUNC_OFFSET(18851, glGetMinmaxParameteriv, gl_dispatch_stub_366,
-                     gl_dispatch_stub_366, 366),
-    NAME_FUNC_OFFSET(18877, glHistogram, glHistogram, NULL, 367),
-    NAME_FUNC_OFFSET(18892, glMinmax, glMinmax, NULL, 368),
-    NAME_FUNC_OFFSET(18904, glResetHistogram, glResetHistogram, NULL, 369),
-    NAME_FUNC_OFFSET(18924, glResetMinmax, glResetMinmax, NULL, 370),
-    NAME_FUNC_OFFSET(18941, glTexImage3D, glTexImage3D, NULL, 371),
-    NAME_FUNC_OFFSET(18957, glTexSubImage3D, glTexSubImage3D, NULL, 372),
-    NAME_FUNC_OFFSET(18976, glCopyTexSubImage3D, glCopyTexSubImage3D, NULL,
-                     373),
-    NAME_FUNC_OFFSET(18999, glActiveTextureARB, glActiveTextureARB, NULL, 374),
-    NAME_FUNC_OFFSET(19015, glClientActiveTextureARB, glClientActiveTextureARB,
-                     NULL, 375),
-    NAME_FUNC_OFFSET(19037, glMultiTexCoord1dARB, glMultiTexCoord1dARB, NULL,
-                     376),
-    NAME_FUNC_OFFSET(19055, glMultiTexCoord1dvARB, glMultiTexCoord1dvARB, NULL,
-                     377),
-    NAME_FUNC_OFFSET(19074, glMultiTexCoord1fARB, glMultiTexCoord1fARB, NULL,
-                     378),
-    NAME_FUNC_OFFSET(19092, glMultiTexCoord1fvARB, glMultiTexCoord1fvARB, NULL,
-                     379),
-    NAME_FUNC_OFFSET(19111, glMultiTexCoord1iARB, glMultiTexCoord1iARB, NULL,
-                     380),
-    NAME_FUNC_OFFSET(19129, glMultiTexCoord1ivARB, glMultiTexCoord1ivARB, NULL,
-                     381),
-    NAME_FUNC_OFFSET(19148, glMultiTexCoord1sARB, glMultiTexCoord1sARB, NULL,
-                     382),
-    NAME_FUNC_OFFSET(19166, glMultiTexCoord1svARB, glMultiTexCoord1svARB, NULL,
-                     383),
-    NAME_FUNC_OFFSET(19185, glMultiTexCoord2dARB, glMultiTexCoord2dARB, NULL,
-                     384),
-    NAME_FUNC_OFFSET(19203, glMultiTexCoord2dvARB, glMultiTexCoord2dvARB, NULL,
-                     385),
-    NAME_FUNC_OFFSET(19222, glMultiTexCoord2fARB, glMultiTexCoord2fARB, NULL,
-                     386),
-    NAME_FUNC_OFFSET(19240, glMultiTexCoord2fvARB, glMultiTexCoord2fvARB, NULL,
-                     387),
-    NAME_FUNC_OFFSET(19259, glMultiTexCoord2iARB, glMultiTexCoord2iARB, NULL,
-                     388),
-    NAME_FUNC_OFFSET(19277, glMultiTexCoord2ivARB, glMultiTexCoord2ivARB, NULL,
-                     389),
-    NAME_FUNC_OFFSET(19296, glMultiTexCoord2sARB, glMultiTexCoord2sARB, NULL,
-                     390),
-    NAME_FUNC_OFFSET(19314, glMultiTexCoord2svARB, glMultiTexCoord2svARB, NULL,
-                     391),
-    NAME_FUNC_OFFSET(19333, glMultiTexCoord3dARB, glMultiTexCoord3dARB, NULL,
-                     392),
-    NAME_FUNC_OFFSET(19351, glMultiTexCoord3dvARB, glMultiTexCoord3dvARB, NULL,
-                     393),
-    NAME_FUNC_OFFSET(19370, glMultiTexCoord3fARB, glMultiTexCoord3fARB, NULL,
-                     394),
-    NAME_FUNC_OFFSET(19388, glMultiTexCoord3fvARB, glMultiTexCoord3fvARB, NULL,
-                     395),
-    NAME_FUNC_OFFSET(19407, glMultiTexCoord3iARB, glMultiTexCoord3iARB, NULL,
-                     396),
-    NAME_FUNC_OFFSET(19425, glMultiTexCoord3ivARB, glMultiTexCoord3ivARB, NULL,
-                     397),
-    NAME_FUNC_OFFSET(19444, glMultiTexCoord3sARB, glMultiTexCoord3sARB, NULL,
-                     398),
-    NAME_FUNC_OFFSET(19462, glMultiTexCoord3svARB, glMultiTexCoord3svARB, NULL,
-                     399),
-    NAME_FUNC_OFFSET(19481, glMultiTexCoord4dARB, glMultiTexCoord4dARB, NULL,
-                     400),
-    NAME_FUNC_OFFSET(19499, glMultiTexCoord4dvARB, glMultiTexCoord4dvARB, NULL,
-                     401),
-    NAME_FUNC_OFFSET(19518, glMultiTexCoord4fARB, glMultiTexCoord4fARB, NULL,
-                     402),
-    NAME_FUNC_OFFSET(19536, glMultiTexCoord4fvARB, glMultiTexCoord4fvARB, NULL,
-                     403),
-    NAME_FUNC_OFFSET(19555, glMultiTexCoord4iARB, glMultiTexCoord4iARB, NULL,
-                     404),
-    NAME_FUNC_OFFSET(19573, glMultiTexCoord4ivARB, glMultiTexCoord4ivARB, NULL,
-                     405),
-    NAME_FUNC_OFFSET(19592, glMultiTexCoord4sARB, glMultiTexCoord4sARB, NULL,
-                     406),
-    NAME_FUNC_OFFSET(19610, glMultiTexCoord4svARB, glMultiTexCoord4svARB, NULL,
-                     407),
-    NAME_FUNC_OFFSET(19629, glStencilOpSeparate, glStencilOpSeparate, NULL,
-                     423),
-    NAME_FUNC_OFFSET(19652, glLoadTransposeMatrixdARB,
-                     glLoadTransposeMatrixdARB, NULL, 441),
-    NAME_FUNC_OFFSET(19675, glLoadTransposeMatrixfARB,
-                     glLoadTransposeMatrixfARB, NULL, 442),
-    NAME_FUNC_OFFSET(19698, glMultTransposeMatrixdARB,
-                     glMultTransposeMatrixdARB, NULL, 443),
-    NAME_FUNC_OFFSET(19721, glMultTransposeMatrixfARB,
-                     glMultTransposeMatrixfARB, NULL, 444),
-    NAME_FUNC_OFFSET(19744, glSampleCoverageARB, glSampleCoverageARB, NULL,
-                     445),
-    NAME_FUNC_OFFSET(19761, glCompressedTexImage1DARB,
-                     glCompressedTexImage1DARB, NULL, 446),
-    NAME_FUNC_OFFSET(19784, glCompressedTexImage2DARB,
-                     glCompressedTexImage2DARB, NULL, 447),
-    NAME_FUNC_OFFSET(19807, glCompressedTexImage3DARB,
-                     glCompressedTexImage3DARB, NULL, 448),
-    NAME_FUNC_OFFSET(19830, glCompressedTexSubImage1DARB,
-                     glCompressedTexSubImage1DARB, NULL, 449),
-    NAME_FUNC_OFFSET(19856, glCompressedTexSubImage2DARB,
-                     glCompressedTexSubImage2DARB, NULL, 450),
-    NAME_FUNC_OFFSET(19882, glCompressedTexSubImage3DARB,
-                     glCompressedTexSubImage3DARB, NULL, 451),
-    NAME_FUNC_OFFSET(19908, glGetCompressedTexImageARB,
-                     glGetCompressedTexImageARB, NULL, 452),
-    NAME_FUNC_OFFSET(19932, glDisableVertexAttribArrayARB,
-                     glDisableVertexAttribArrayARB, NULL, 453),
-    NAME_FUNC_OFFSET(19959, glEnableVertexAttribArrayARB,
-                     glEnableVertexAttribArrayARB, NULL, 454),
-    NAME_FUNC_OFFSET(19985, glGetVertexAttribdvARB, glGetVertexAttribdvARB,
-                     NULL, 461),
-    NAME_FUNC_OFFSET(20005, glGetVertexAttribfvARB, glGetVertexAttribfvARB,
-                     NULL, 462),
-    NAME_FUNC_OFFSET(20025, glGetVertexAttribivARB, glGetVertexAttribivARB,
-                     NULL, 463),
-    NAME_FUNC_OFFSET(20045, glProgramEnvParameter4dARB,
-                     glProgramEnvParameter4dARB, NULL, 464),
-    NAME_FUNC_OFFSET(20068, glProgramEnvParameter4dvARB,
-                     glProgramEnvParameter4dvARB, NULL, 465),
-    NAME_FUNC_OFFSET(20092, glProgramEnvParameter4fARB,
-                     glProgramEnvParameter4fARB, NULL, 466),
-    NAME_FUNC_OFFSET(20115, glProgramEnvParameter4fvARB,
-                     glProgramEnvParameter4fvARB, NULL, 467),
-    NAME_FUNC_OFFSET(20139, glVertexAttrib1dARB, glVertexAttrib1dARB, NULL,
-                     473),
-    NAME_FUNC_OFFSET(20156, glVertexAttrib1dvARB, glVertexAttrib1dvARB, NULL,
-                     474),
-    NAME_FUNC_OFFSET(20174, glVertexAttrib1fARB, glVertexAttrib1fARB, NULL,
-                     475),
-    NAME_FUNC_OFFSET(20191, glVertexAttrib1fvARB, glVertexAttrib1fvARB, NULL,
-                     476),
-    NAME_FUNC_OFFSET(20209, glVertexAttrib1sARB, glVertexAttrib1sARB, NULL,
-                     477),
-    NAME_FUNC_OFFSET(20226, glVertexAttrib1svARB, glVertexAttrib1svARB, NULL,
-                     478),
-    NAME_FUNC_OFFSET(20244, glVertexAttrib2dARB, glVertexAttrib2dARB, NULL,
-                     479),
-    NAME_FUNC_OFFSET(20261, glVertexAttrib2dvARB, glVertexAttrib2dvARB, NULL,
-                     480),
-    NAME_FUNC_OFFSET(20279, glVertexAttrib2fARB, glVertexAttrib2fARB, NULL,
-                     481),
-    NAME_FUNC_OFFSET(20296, glVertexAttrib2fvARB, glVertexAttrib2fvARB, NULL,
-                     482),
-    NAME_FUNC_OFFSET(20314, glVertexAttrib2sARB, glVertexAttrib2sARB, NULL,
-                     483),
-    NAME_FUNC_OFFSET(20331, glVertexAttrib2svARB, glVertexAttrib2svARB, NULL,
-                     484),
-    NAME_FUNC_OFFSET(20349, glVertexAttrib3dARB, glVertexAttrib3dARB, NULL,
-                     485),
-    NAME_FUNC_OFFSET(20366, glVertexAttrib3dvARB, glVertexAttrib3dvARB, NULL,
-                     486),
-    NAME_FUNC_OFFSET(20384, glVertexAttrib3fARB, glVertexAttrib3fARB, NULL,
-                     487),
-    NAME_FUNC_OFFSET(20401, glVertexAttrib3fvARB, glVertexAttrib3fvARB, NULL,
-                     488),
-    NAME_FUNC_OFFSET(20419, glVertexAttrib3sARB, glVertexAttrib3sARB, NULL,
-                     489),
-    NAME_FUNC_OFFSET(20436, glVertexAttrib3svARB, glVertexAttrib3svARB, NULL,
-                     490),
-    NAME_FUNC_OFFSET(20454, glVertexAttrib4NbvARB, glVertexAttrib4NbvARB, NULL,
-                     491),
-    NAME_FUNC_OFFSET(20473, glVertexAttrib4NivARB, glVertexAttrib4NivARB, NULL,
-                     492),
-    NAME_FUNC_OFFSET(20492, glVertexAttrib4NsvARB, glVertexAttrib4NsvARB, NULL,
-                     493),
-    NAME_FUNC_OFFSET(20511, glVertexAttrib4NubARB, glVertexAttrib4NubARB, NULL,
-                     494),
-    NAME_FUNC_OFFSET(20530, glVertexAttrib4NubvARB, glVertexAttrib4NubvARB,
-                     NULL, 495),
-    NAME_FUNC_OFFSET(20550, glVertexAttrib4NuivARB, glVertexAttrib4NuivARB,
-                     NULL, 496),
-    NAME_FUNC_OFFSET(20570, glVertexAttrib4NusvARB, glVertexAttrib4NusvARB,
-                     NULL, 497),
-    NAME_FUNC_OFFSET(20590, glVertexAttrib4bvARB, glVertexAttrib4bvARB, NULL,
-                     498),
-    NAME_FUNC_OFFSET(20608, glVertexAttrib4dARB, glVertexAttrib4dARB, NULL,
-                     499),
-    NAME_FUNC_OFFSET(20625, glVertexAttrib4dvARB, glVertexAttrib4dvARB, NULL,
-                     500),
-    NAME_FUNC_OFFSET(20643, glVertexAttrib4fARB, glVertexAttrib4fARB, NULL,
-                     501),
-    NAME_FUNC_OFFSET(20660, glVertexAttrib4fvARB, glVertexAttrib4fvARB, NULL,
-                     502),
-    NAME_FUNC_OFFSET(20678, glVertexAttrib4ivARB, glVertexAttrib4ivARB, NULL,
-                     503),
-    NAME_FUNC_OFFSET(20696, glVertexAttrib4sARB, glVertexAttrib4sARB, NULL,
-                     504),
-    NAME_FUNC_OFFSET(20713, glVertexAttrib4svARB, glVertexAttrib4svARB, NULL,
-                     505),
-    NAME_FUNC_OFFSET(20731, glVertexAttrib4ubvARB, glVertexAttrib4ubvARB, NULL,
-                     506),
-    NAME_FUNC_OFFSET(20750, glVertexAttrib4uivARB, glVertexAttrib4uivARB, NULL,
-                     507),
-    NAME_FUNC_OFFSET(20769, glVertexAttrib4usvARB, glVertexAttrib4usvARB, NULL,
-                     508),
-    NAME_FUNC_OFFSET(20788, glVertexAttribPointerARB, glVertexAttribPointerARB,
-                     NULL, 509),
-    NAME_FUNC_OFFSET(20810, glBindBufferARB, glBindBufferARB, NULL, 510),
-    NAME_FUNC_OFFSET(20823, glBufferDataARB, glBufferDataARB, NULL, 511),
-    NAME_FUNC_OFFSET(20836, glBufferSubDataARB, glBufferSubDataARB, NULL, 512),
-    NAME_FUNC_OFFSET(20852, glDeleteBuffersARB, glDeleteBuffersARB, NULL, 513),
-    NAME_FUNC_OFFSET(20868, glGenBuffersARB, glGenBuffersARB, NULL, 514),
-    NAME_FUNC_OFFSET(20881, glGetBufferParameterivARB,
-                     glGetBufferParameterivARB, NULL, 515),
-    NAME_FUNC_OFFSET(20904, glGetBufferPointervARB, glGetBufferPointervARB,
-                     NULL, 516),
-    NAME_FUNC_OFFSET(20924, glGetBufferSubDataARB, glGetBufferSubDataARB, NULL,
-                     517),
-    NAME_FUNC_OFFSET(20943, glIsBufferARB, glIsBufferARB, NULL, 518),
-    NAME_FUNC_OFFSET(20954, glMapBufferARB, glMapBufferARB, NULL, 519),
-    NAME_FUNC_OFFSET(20966, glUnmapBufferARB, glUnmapBufferARB, NULL, 520),
-    NAME_FUNC_OFFSET(20980, glBeginQueryARB, glBeginQueryARB, NULL, 521),
-    NAME_FUNC_OFFSET(20993, glDeleteQueriesARB, glDeleteQueriesARB, NULL, 522),
-    NAME_FUNC_OFFSET(21009, glEndQueryARB, glEndQueryARB, NULL, 523),
-    NAME_FUNC_OFFSET(21020, glGenQueriesARB, glGenQueriesARB, NULL, 524),
-    NAME_FUNC_OFFSET(21033, glGetQueryObjectivARB, glGetQueryObjectivARB, NULL,
-                     525),
-    NAME_FUNC_OFFSET(21052, glGetQueryObjectuivARB, glGetQueryObjectuivARB,
-                     NULL, 526),
-    NAME_FUNC_OFFSET(21072, glGetQueryivARB, glGetQueryivARB, NULL, 527),
-    NAME_FUNC_OFFSET(21085, glIsQueryARB, glIsQueryARB, NULL, 528),
-    NAME_FUNC_OFFSET(21095, glCompileShaderARB, glCompileShaderARB, NULL, 530),
-    NAME_FUNC_OFFSET(21111, glGetActiveUniformARB, glGetActiveUniformARB, NULL,
-                     535),
-    NAME_FUNC_OFFSET(21130, glGetShaderSourceARB, glGetShaderSourceARB, NULL,
-                     541),
-    NAME_FUNC_OFFSET(21148, glGetUniformLocationARB, glGetUniformLocationARB,
-                     NULL, 542),
-    NAME_FUNC_OFFSET(21169, glGetUniformfvARB, glGetUniformfvARB, NULL, 543),
-    NAME_FUNC_OFFSET(21184, glGetUniformivARB, glGetUniformivARB, NULL, 544),
-    NAME_FUNC_OFFSET(21199, glLinkProgramARB, glLinkProgramARB, NULL, 545),
-    NAME_FUNC_OFFSET(21213, glShaderSourceARB, glShaderSourceARB, NULL, 546),
-    NAME_FUNC_OFFSET(21228, glUniform1fARB, glUniform1fARB, NULL, 547),
-    NAME_FUNC_OFFSET(21240, glUniform1fvARB, glUniform1fvARB, NULL, 548),
-    NAME_FUNC_OFFSET(21253, glUniform1iARB, glUniform1iARB, NULL, 549),
-    NAME_FUNC_OFFSET(21265, glUniform1ivARB, glUniform1ivARB, NULL, 550),
-    NAME_FUNC_OFFSET(21278, glUniform2fARB, glUniform2fARB, NULL, 551),
-    NAME_FUNC_OFFSET(21290, glUniform2fvARB, glUniform2fvARB, NULL, 552),
-    NAME_FUNC_OFFSET(21303, glUniform2iARB, glUniform2iARB, NULL, 553),
-    NAME_FUNC_OFFSET(21315, glUniform2ivARB, glUniform2ivARB, NULL, 554),
-    NAME_FUNC_OFFSET(21328, glUniform3fARB, glUniform3fARB, NULL, 555),
-    NAME_FUNC_OFFSET(21340, glUniform3fvARB, glUniform3fvARB, NULL, 556),
-    NAME_FUNC_OFFSET(21353, glUniform3iARB, glUniform3iARB, NULL, 557),
-    NAME_FUNC_OFFSET(21365, glUniform3ivARB, glUniform3ivARB, NULL, 558),
-    NAME_FUNC_OFFSET(21378, glUniform4fARB, glUniform4fARB, NULL, 559),
-    NAME_FUNC_OFFSET(21390, glUniform4fvARB, glUniform4fvARB, NULL, 560),
-    NAME_FUNC_OFFSET(21403, glUniform4iARB, glUniform4iARB, NULL, 561),
-    NAME_FUNC_OFFSET(21415, glUniform4ivARB, glUniform4ivARB, NULL, 562),
-    NAME_FUNC_OFFSET(21428, glUniformMatrix2fvARB, glUniformMatrix2fvARB, NULL,
-                     563),
-    NAME_FUNC_OFFSET(21447, glUniformMatrix3fvARB, glUniformMatrix3fvARB, NULL,
-                     564),
-    NAME_FUNC_OFFSET(21466, glUniformMatrix4fvARB, glUniformMatrix4fvARB, NULL,
-                     565),
-    NAME_FUNC_OFFSET(21485, glUseProgramObjectARB, glUseProgramObjectARB, NULL,
-                     566),
-    NAME_FUNC_OFFSET(21498, glValidateProgramARB, glValidateProgramARB, NULL,
-                     567),
-    NAME_FUNC_OFFSET(21516, glBindAttribLocationARB, glBindAttribLocationARB,
-                     NULL, 568),
-    NAME_FUNC_OFFSET(21537, glGetActiveAttribARB, glGetActiveAttribARB, NULL,
-                     569),
-    NAME_FUNC_OFFSET(21555, glGetAttribLocationARB, glGetAttribLocationARB,
-                     NULL, 570),
-    NAME_FUNC_OFFSET(21575, glDrawBuffersARB, glDrawBuffersARB, NULL, 571),
-    NAME_FUNC_OFFSET(21589, glDrawBuffersARB, glDrawBuffersARB, NULL, 571),
-    NAME_FUNC_OFFSET(21606, glDrawBuffersARB, glDrawBuffersARB, NULL, 571),
-    NAME_FUNC_OFFSET(21622, glDrawArraysInstancedARB, glDrawArraysInstancedARB,
-                     NULL, 573),
-    NAME_FUNC_OFFSET(21647, glDrawArraysInstancedARB, glDrawArraysInstancedARB,
-                     NULL, 573),
-    NAME_FUNC_OFFSET(21669, glDrawElementsInstancedARB,
-                     glDrawElementsInstancedARB, NULL, 574),
-    NAME_FUNC_OFFSET(21696, glDrawElementsInstancedARB,
-                     glDrawElementsInstancedARB, NULL, 574),
-    NAME_FUNC_OFFSET(21720, glRenderbufferStorageMultisample,
-                     glRenderbufferStorageMultisample, NULL, 575),
-    NAME_FUNC_OFFSET(21756, glBlendEquationSeparateiARB,
-                     glBlendEquationSeparateiARB, NULL, 597),
-    NAME_FUNC_OFFSET(21790, glBlendEquationiARB, glBlendEquationiARB, NULL,
-                     598),
-    NAME_FUNC_OFFSET(21816, glBlendFuncSeparateiARB, glBlendFuncSeparateiARB,
-                     NULL, 599),
-    NAME_FUNC_OFFSET(21846, glBlendFunciARB, glBlendFunciARB, NULL, 600),
-    NAME_FUNC_OFFSET(21868, gl_dispatch_stub_698, gl_dispatch_stub_698, NULL,
-                     698),
-    NAME_FUNC_OFFSET(21884, gl_dispatch_stub_699, gl_dispatch_stub_699, NULL,
-                     699),
-    NAME_FUNC_OFFSET(21903, glPointParameterfEXT, glPointParameterfEXT, NULL,
-                     706),
-    NAME_FUNC_OFFSET(21921, glPointParameterfEXT, glPointParameterfEXT, NULL,
-                     706),
-    NAME_FUNC_OFFSET(21942, glPointParameterfEXT, glPointParameterfEXT, NULL,
-                     706),
-    NAME_FUNC_OFFSET(21964, glPointParameterfvEXT, glPointParameterfvEXT, NULL,
-                     707),
-    NAME_FUNC_OFFSET(21983, glPointParameterfvEXT, glPointParameterfvEXT, NULL,
-                     707),
-    NAME_FUNC_OFFSET(22005, glPointParameterfvEXT, glPointParameterfvEXT, NULL,
-                     707),
-    NAME_FUNC_OFFSET(22028, glSecondaryColor3bEXT, glSecondaryColor3bEXT, NULL,
-                     710),
-    NAME_FUNC_OFFSET(22047, glSecondaryColor3bvEXT, glSecondaryColor3bvEXT,
-                     NULL, 711),
-    NAME_FUNC_OFFSET(22067, glSecondaryColor3dEXT, glSecondaryColor3dEXT, NULL,
-                     712),
-    NAME_FUNC_OFFSET(22086, glSecondaryColor3dvEXT, glSecondaryColor3dvEXT,
-                     NULL, 713),
-    NAME_FUNC_OFFSET(22106, glSecondaryColor3fEXT, glSecondaryColor3fEXT, NULL,
-                     714),
-    NAME_FUNC_OFFSET(22125, glSecondaryColor3fvEXT, glSecondaryColor3fvEXT,
-                     NULL, 715),
-    NAME_FUNC_OFFSET(22145, glSecondaryColor3iEXT, glSecondaryColor3iEXT, NULL,
-                     716),
-    NAME_FUNC_OFFSET(22164, glSecondaryColor3ivEXT, glSecondaryColor3ivEXT,
-                     NULL, 717),
-    NAME_FUNC_OFFSET(22184, glSecondaryColor3sEXT, glSecondaryColor3sEXT, NULL,
-                     718),
-    NAME_FUNC_OFFSET(22203, glSecondaryColor3svEXT, glSecondaryColor3svEXT,
-                     NULL, 719),
-    NAME_FUNC_OFFSET(22223, glSecondaryColor3ubEXT, glSecondaryColor3ubEXT,
-                     NULL, 720),
-    NAME_FUNC_OFFSET(22243, glSecondaryColor3ubvEXT, glSecondaryColor3ubvEXT,
-                     NULL, 721),
-    NAME_FUNC_OFFSET(22264, glSecondaryColor3uiEXT, glSecondaryColor3uiEXT,
-                     NULL, 722),
-    NAME_FUNC_OFFSET(22284, glSecondaryColor3uivEXT, glSecondaryColor3uivEXT,
-                     NULL, 723),
-    NAME_FUNC_OFFSET(22305, glSecondaryColor3usEXT, glSecondaryColor3usEXT,
-                     NULL, 724),
-    NAME_FUNC_OFFSET(22325, glSecondaryColor3usvEXT, glSecondaryColor3usvEXT,
-                     NULL, 725),
-    NAME_FUNC_OFFSET(22346, glSecondaryColorPointerEXT,
-                     glSecondaryColorPointerEXT, NULL, 726),
-    NAME_FUNC_OFFSET(22370, glMultiDrawArraysEXT, glMultiDrawArraysEXT, NULL,
-                     727),
-    NAME_FUNC_OFFSET(22388, glMultiDrawElementsEXT, glMultiDrawElementsEXT,
-                     NULL, 728),
-    NAME_FUNC_OFFSET(22408, glFogCoordPointerEXT, glFogCoordPointerEXT, NULL,
-                     729),
-    NAME_FUNC_OFFSET(22426, glFogCoorddEXT, glFogCoorddEXT, NULL, 730),
-    NAME_FUNC_OFFSET(22438, glFogCoorddvEXT, glFogCoorddvEXT, NULL, 731),
-    NAME_FUNC_OFFSET(22451, glFogCoordfEXT, glFogCoordfEXT, NULL, 732),
-    NAME_FUNC_OFFSET(22463, glFogCoordfvEXT, glFogCoordfvEXT, NULL, 733),
-    NAME_FUNC_OFFSET(22476, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT,
-                     NULL, 735),
-    NAME_FUNC_OFFSET(22496, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT,
-                     NULL, 735),
-    NAME_FUNC_OFFSET(22520, glWindowPos2dMESA, glWindowPos2dMESA, NULL, 752),
-    NAME_FUNC_OFFSET(22534, glWindowPos2dMESA, glWindowPos2dMESA, NULL, 752),
-    NAME_FUNC_OFFSET(22551, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, 753),
-    NAME_FUNC_OFFSET(22566, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, 753),
-    NAME_FUNC_OFFSET(22584, glWindowPos2fMESA, glWindowPos2fMESA, NULL, 754),
-    NAME_FUNC_OFFSET(22598, glWindowPos2fMESA, glWindowPos2fMESA, NULL, 754),
-    NAME_FUNC_OFFSET(22615, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, 755),
-    NAME_FUNC_OFFSET(22630, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, 755),
-    NAME_FUNC_OFFSET(22648, glWindowPos2iMESA, glWindowPos2iMESA, NULL, 756),
-    NAME_FUNC_OFFSET(22662, glWindowPos2iMESA, glWindowPos2iMESA, NULL, 756),
-    NAME_FUNC_OFFSET(22679, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, 757),
-    NAME_FUNC_OFFSET(22694, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, 757),
-    NAME_FUNC_OFFSET(22712, glWindowPos2sMESA, glWindowPos2sMESA, NULL, 758),
-    NAME_FUNC_OFFSET(22726, glWindowPos2sMESA, glWindowPos2sMESA, NULL, 758),
-    NAME_FUNC_OFFSET(22743, glWindowPos2svMESA, glWindowPos2svMESA, NULL, 759),
-    NAME_FUNC_OFFSET(22758, glWindowPos2svMESA, glWindowPos2svMESA, NULL, 759),
-    NAME_FUNC_OFFSET(22776, glWindowPos3dMESA, glWindowPos3dMESA, NULL, 760),
-    NAME_FUNC_OFFSET(22790, glWindowPos3dMESA, glWindowPos3dMESA, NULL, 760),
-    NAME_FUNC_OFFSET(22807, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, 761),
-    NAME_FUNC_OFFSET(22822, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, 761),
-    NAME_FUNC_OFFSET(22840, glWindowPos3fMESA, glWindowPos3fMESA, NULL, 762),
-    NAME_FUNC_OFFSET(22854, glWindowPos3fMESA, glWindowPos3fMESA, NULL, 762),
-    NAME_FUNC_OFFSET(22871, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, 763),
-    NAME_FUNC_OFFSET(22886, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, 763),
-    NAME_FUNC_OFFSET(22904, glWindowPos3iMESA, glWindowPos3iMESA, NULL, 764),
-    NAME_FUNC_OFFSET(22918, glWindowPos3iMESA, glWindowPos3iMESA, NULL, 764),
-    NAME_FUNC_OFFSET(22935, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, 765),
-    NAME_FUNC_OFFSET(22950, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, 765),
-    NAME_FUNC_OFFSET(22968, glWindowPos3sMESA, glWindowPos3sMESA, NULL, 766),
-    NAME_FUNC_OFFSET(22982, glWindowPos3sMESA, glWindowPos3sMESA, NULL, 766),
-    NAME_FUNC_OFFSET(22999, glWindowPos3svMESA, glWindowPos3svMESA, NULL, 767),
-    NAME_FUNC_OFFSET(23014, glWindowPos3svMESA, glWindowPos3svMESA, NULL, 767),
-    NAME_FUNC_OFFSET(23032, glBindProgramNV, glBindProgramNV, NULL, 786),
-    NAME_FUNC_OFFSET(23049, glDeleteProgramsNV, glDeleteProgramsNV, NULL, 787),
-    NAME_FUNC_OFFSET(23069, glGenProgramsNV, glGenProgramsNV, NULL, 789),
-    NAME_FUNC_OFFSET(23086, glGetVertexAttribPointervNV,
-                     glGetVertexAttribPointervNV, NULL, 795),
-    NAME_FUNC_OFFSET(23112, glGetVertexAttribPointervNV,
-                     glGetVertexAttribPointervNV, NULL, 795),
-    NAME_FUNC_OFFSET(23141, glIsProgramNV, glIsProgramNV, NULL, 799),
-    NAME_FUNC_OFFSET(23156, glPointParameteriNV, glPointParameteriNV, NULL,
-                     863),
-    NAME_FUNC_OFFSET(23174, glPointParameterivNV, glPointParameterivNV, NULL,
-                     864),
-    NAME_FUNC_OFFSET(23193, gl_dispatch_stub_867, gl_dispatch_stub_867, NULL,
-                     867),
-    NAME_FUNC_OFFSET(23214, gl_dispatch_stub_869, gl_dispatch_stub_869, NULL,
-                     869),
-    NAME_FUNC_OFFSET(23230, glPrimitiveRestartIndexNV,
-                     glPrimitiveRestartIndexNV, NULL, 876),
-    NAME_FUNC_OFFSET(23254, gl_dispatch_stub_879, gl_dispatch_stub_879, NULL,
-                     879),
-    NAME_FUNC_OFFSET(23278, gl_dispatch_stub_879, gl_dispatch_stub_879, NULL,
-                     879),
-    NAME_FUNC_OFFSET(23305, glBindFramebufferEXT, glBindFramebufferEXT, NULL,
-                     880),
-    NAME_FUNC_OFFSET(23323, glBindRenderbufferEXT, glBindRenderbufferEXT, NULL,
-                     881),
-    NAME_FUNC_OFFSET(23342, glCheckFramebufferStatusEXT,
-                     glCheckFramebufferStatusEXT, NULL, 882),
-    NAME_FUNC_OFFSET(23367, glDeleteFramebuffersEXT, glDeleteFramebuffersEXT,
-                     NULL, 883),
-    NAME_FUNC_OFFSET(23388, glDeleteRenderbuffersEXT, glDeleteRenderbuffersEXT,
-                     NULL, 884),
-    NAME_FUNC_OFFSET(23410, glFramebufferRenderbufferEXT,
-                     glFramebufferRenderbufferEXT, NULL, 885),
-    NAME_FUNC_OFFSET(23436, glFramebufferTexture1DEXT,
-                     glFramebufferTexture1DEXT, NULL, 886),
-    NAME_FUNC_OFFSET(23459, glFramebufferTexture2DEXT,
-                     glFramebufferTexture2DEXT, NULL, 887),
-    NAME_FUNC_OFFSET(23482, glFramebufferTexture3DEXT,
-                     glFramebufferTexture3DEXT, NULL, 888),
-    NAME_FUNC_OFFSET(23505, glGenFramebuffersEXT, glGenFramebuffersEXT, NULL,
-                     889),
-    NAME_FUNC_OFFSET(23523, glGenRenderbuffersEXT, glGenRenderbuffersEXT, NULL,
-                     890),
-    NAME_FUNC_OFFSET(23542, glGenerateMipmapEXT, glGenerateMipmapEXT, NULL,
-                     891),
-    NAME_FUNC_OFFSET(23559, glGetFramebufferAttachmentParameterivEXT,
-                     glGetFramebufferAttachmentParameterivEXT, NULL, 892),
-    NAME_FUNC_OFFSET(23597, glGetRenderbufferParameterivEXT,
-                     glGetRenderbufferParameterivEXT, NULL, 893),
-    NAME_FUNC_OFFSET(23626, glIsFramebufferEXT, glIsFramebufferEXT, NULL, 894),
-    NAME_FUNC_OFFSET(23642, glIsRenderbufferEXT, glIsRenderbufferEXT, NULL,
-                     895),
-    NAME_FUNC_OFFSET(23659, glRenderbufferStorageEXT, glRenderbufferStorageEXT,
-                     NULL, 896),
-    NAME_FUNC_OFFSET(23681, gl_dispatch_stub_897, gl_dispatch_stub_897, NULL,
-                     897),
-    NAME_FUNC_OFFSET(23699, glBindFragDataLocationEXT,
-                     glBindFragDataLocationEXT, NULL, 900),
-    NAME_FUNC_OFFSET(23722, glGetFragDataLocationEXT, glGetFragDataLocationEXT,
-                     NULL, 901),
-    NAME_FUNC_OFFSET(23744, glGetUniformuivEXT, glGetUniformuivEXT, NULL, 902),
-    NAME_FUNC_OFFSET(23760, glGetVertexAttribIivEXT, glGetVertexAttribIivEXT,
-                     NULL, 903),
-    NAME_FUNC_OFFSET(23781, glGetVertexAttribIuivEXT, glGetVertexAttribIuivEXT,
-                     NULL, 904),
-    NAME_FUNC_OFFSET(23803, glUniform1uiEXT, glUniform1uiEXT, NULL, 905),
-    NAME_FUNC_OFFSET(23816, glUniform1uivEXT, glUniform1uivEXT, NULL, 906),
-    NAME_FUNC_OFFSET(23830, glUniform2uiEXT, glUniform2uiEXT, NULL, 907),
-    NAME_FUNC_OFFSET(23843, glUniform2uivEXT, glUniform2uivEXT, NULL, 908),
-    NAME_FUNC_OFFSET(23857, glUniform3uiEXT, glUniform3uiEXT, NULL, 909),
-    NAME_FUNC_OFFSET(23870, glUniform3uivEXT, glUniform3uivEXT, NULL, 910),
-    NAME_FUNC_OFFSET(23884, glUniform4uiEXT, glUniform4uiEXT, NULL, 911),
-    NAME_FUNC_OFFSET(23897, glUniform4uivEXT, glUniform4uivEXT, NULL, 912),
-    NAME_FUNC_OFFSET(23911, glVertexAttribI1iEXT, glVertexAttribI1iEXT, NULL,
-                     913),
-    NAME_FUNC_OFFSET(23929, glVertexAttribI1ivEXT, glVertexAttribI1ivEXT, NULL,
-                     914),
-    NAME_FUNC_OFFSET(23948, glVertexAttribI1uiEXT, glVertexAttribI1uiEXT, NULL,
-                     915),
-    NAME_FUNC_OFFSET(23967, glVertexAttribI1uivEXT, glVertexAttribI1uivEXT,
-                     NULL, 916),
-    NAME_FUNC_OFFSET(23987, glVertexAttribI2iEXT, glVertexAttribI2iEXT, NULL,
-                     917),
-    NAME_FUNC_OFFSET(24005, glVertexAttribI2ivEXT, glVertexAttribI2ivEXT, NULL,
-                     918),
-    NAME_FUNC_OFFSET(24024, glVertexAttribI2uiEXT, glVertexAttribI2uiEXT, NULL,
-                     919),
-    NAME_FUNC_OFFSET(24043, glVertexAttribI2uivEXT, glVertexAttribI2uivEXT,
-                     NULL, 920),
-    NAME_FUNC_OFFSET(24063, glVertexAttribI3iEXT, glVertexAttribI3iEXT, NULL,
-                     921),
-    NAME_FUNC_OFFSET(24081, glVertexAttribI3ivEXT, glVertexAttribI3ivEXT, NULL,
-                     922),
-    NAME_FUNC_OFFSET(24100, glVertexAttribI3uiEXT, glVertexAttribI3uiEXT, NULL,
-                     923),
-    NAME_FUNC_OFFSET(24119, glVertexAttribI3uivEXT, glVertexAttribI3uivEXT,
-                     NULL, 924),
-    NAME_FUNC_OFFSET(24139, glVertexAttribI4bvEXT, glVertexAttribI4bvEXT, NULL,
-                     925),
-    NAME_FUNC_OFFSET(24158, glVertexAttribI4iEXT, glVertexAttribI4iEXT, NULL,
-                     926),
-    NAME_FUNC_OFFSET(24176, glVertexAttribI4ivEXT, glVertexAttribI4ivEXT, NULL,
-                     927),
-    NAME_FUNC_OFFSET(24195, glVertexAttribI4svEXT, glVertexAttribI4svEXT, NULL,
-                     928),
-    NAME_FUNC_OFFSET(24214, glVertexAttribI4ubvEXT, glVertexAttribI4ubvEXT,
-                     NULL, 929),
-    NAME_FUNC_OFFSET(24234, glVertexAttribI4uiEXT, glVertexAttribI4uiEXT, NULL,
-                     930),
-    NAME_FUNC_OFFSET(24253, glVertexAttribI4uivEXT, glVertexAttribI4uivEXT,
-                     NULL, 931),
-    NAME_FUNC_OFFSET(24273, glVertexAttribI4usvEXT, glVertexAttribI4usvEXT,
-                     NULL, 932),
-    NAME_FUNC_OFFSET(24293, glVertexAttribIPointerEXT,
-                     glVertexAttribIPointerEXT, NULL, 933),
-    NAME_FUNC_OFFSET(24316, glFramebufferTextureLayerEXT,
-                     glFramebufferTextureLayerEXT, NULL, 934),
-    NAME_FUNC_OFFSET(24342, glFramebufferTextureLayerEXT,
-                     glFramebufferTextureLayerEXT, NULL, 934),
-    NAME_FUNC_OFFSET(24371, glColorMaskIndexedEXT, glColorMaskIndexedEXT, NULL,
-                     935),
-    NAME_FUNC_OFFSET(24384, glDisableIndexedEXT, glDisableIndexedEXT, NULL,
-                     936),
-    NAME_FUNC_OFFSET(24395, glEnableIndexedEXT, glEnableIndexedEXT, NULL, 937),
-    NAME_FUNC_OFFSET(24405, glGetBooleanIndexedvEXT, glGetBooleanIndexedvEXT,
-                     NULL, 938),
-    NAME_FUNC_OFFSET(24421, glGetIntegerIndexedvEXT, glGetIntegerIndexedvEXT,
-                     NULL, 939),
-    NAME_FUNC_OFFSET(24437, glIsEnabledIndexedEXT, glIsEnabledIndexedEXT, NULL,
-                     940),
-    NAME_FUNC_OFFSET(24450, glGetTexParameterIivEXT, glGetTexParameterIivEXT,
-                     NULL, 943),
-    NAME_FUNC_OFFSET(24471, glGetTexParameterIuivEXT, glGetTexParameterIuivEXT,
-                     NULL, 944),
-    NAME_FUNC_OFFSET(24493, glTexParameterIivEXT, glTexParameterIivEXT, NULL,
-                     945),
-    NAME_FUNC_OFFSET(24511, glTexParameterIuivEXT, glTexParameterIuivEXT, NULL,
-                     946),
-    NAME_FUNC_OFFSET(24530, glBeginConditionalRenderNV,
-                     glBeginConditionalRenderNV, NULL, 947),
-    NAME_FUNC_OFFSET(24555, glEndConditionalRenderNV, glEndConditionalRenderNV,
-                     NULL, 948),
-    NAME_FUNC_OFFSET(24578, glBeginTransformFeedbackEXT,
-                     glBeginTransformFeedbackEXT, NULL, 949),
-    NAME_FUNC_OFFSET(24603, glBindBufferBaseEXT, glBindBufferBaseEXT, NULL,
-                     950),
-    NAME_FUNC_OFFSET(24620, glBindBufferRangeEXT, glBindBufferRangeEXT, NULL,
-                     952),
-    NAME_FUNC_OFFSET(24638, glEndTransformFeedbackEXT,
-                     glEndTransformFeedbackEXT, NULL, 953),
-    NAME_FUNC_OFFSET(24661, glGetTransformFeedbackVaryingEXT,
-                     glGetTransformFeedbackVaryingEXT, NULL, 954),
-    NAME_FUNC_OFFSET(24691, glTransformFeedbackVaryingsEXT,
-                     glTransformFeedbackVaryingsEXT, NULL, 955),
-    NAME_FUNC_OFFSET(24719, glProvokingVertexEXT, glProvokingVertexEXT, NULL,
-                     956),
-    NAME_FUNC_OFFSET(-1, NULL, NULL, NULL, 0)
-};
-
-#undef NAME_FUNC_OFFSET
diff --git a/glx/glthread.c b/glx/glthread.c
deleted file mode 100644 (file)
index fd4c6cc..0000000
+++ /dev/null
@@ -1,204 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version:  6.5.1
- *
- * Copyright (C) 1999-2006  Brian Paul   All Rights Reserved.
- *
- * 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 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
- * BRIAN PAUL 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.
- */
-
-/*
- * XXX There's probably some work to do in order to make this file
- * truly reusable outside of Mesa.
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#include <X11/Xfuncproto.h>
-#endif
-
-#include <stdlib.h>
-#include <stdio.h>
-#include "glthread.h"
-
-/*
- * This file should still compile even when THREADS is not defined.
- * This is to make things easier to deal with on the makefile scene..
- */
-#ifdef THREADS
-#include <errno.h>
-
-/*
- * Error messages
- */
-#define INIT_TSD_ERROR "_glthread_: failed to allocate key for thread specific data"
-#define GET_TSD_ERROR "_glthread_: failed to get thread specific data"
-#define SET_TSD_ERROR "_glthread_: thread failed to set thread specific data"
-
-/*
- * Magic number to determine if a TSD object has been initialized.
- * Kind of a hack but there doesn't appear to be a better cross-platform
- * solution.
- */
-#define INIT_MAGIC 0xff8adc98
-
-/*
- * POSIX Threads -- The best way to go if your platform supports them.
- *                  Solaris >= 2.5 have POSIX threads, IRIX >= 6.4 reportedly
- *                  has them, and many of the free Unixes now have them.
- *                  Be sure to use appropriate -mt or -D_REENTRANT type
- *                  compile flags when building.
- */
-#ifdef PTHREADS
-
-_X_EXPORT unsigned long
-_glthread_GetID(void)
-{
-    return (unsigned long) pthread_self();
-}
-
-void
-_glthread_InitTSD(_glthread_TSD * tsd)
-{
-    if (pthread_key_create(&tsd->key, NULL /*free */ ) != 0) {
-        perror(INIT_TSD_ERROR);
-        exit(-1);
-    }
-    tsd->initMagic = INIT_MAGIC;
-}
-
-void *
-_glthread_GetTSD(_glthread_TSD * tsd)
-{
-    if (tsd->initMagic != (int) INIT_MAGIC) {
-        _glthread_InitTSD(tsd);
-    }
-    return pthread_getspecific(tsd->key);
-}
-
-void
-_glthread_SetTSD(_glthread_TSD * tsd, void *ptr)
-{
-    if (tsd->initMagic != (int) INIT_MAGIC) {
-        _glthread_InitTSD(tsd);
-    }
-    if (pthread_setspecific(tsd->key, ptr) != 0) {
-        perror(SET_TSD_ERROR);
-        exit(-1);
-    }
-}
-
-#endif                          /* PTHREADS */
-
-/*
- * Win32 Threads.  The only available option for Windows 95/NT.
- * Be sure that you compile using the Multithreaded runtime, otherwise
- * bad things will happen.
- */
-#ifdef WIN32_THREADS
-
-void
-FreeTSD(_glthread_TSD * p)
-{
-    if (p->initMagic == INIT_MAGIC) {
-        TlsFree(p->key);
-        p->initMagic = 0;
-    }
-}
-
-void
-InsteadOf_exit(int nCode)
-{
-    DWORD dwErr = GetLastError();
-}
-
-unsigned long
-_glthread_GetID(void)
-{
-    return GetCurrentThreadId();
-}
-
-void
-_glthread_InitTSD(_glthread_TSD * tsd)
-{
-    tsd->key = TlsAlloc();
-    if (tsd->key == TLS_OUT_OF_INDEXES) {
-        perror("Mesa:_glthread_InitTSD");
-        InsteadOf_exit(-1);
-    }
-    tsd->initMagic = INIT_MAGIC;
-}
-
-void *
-_glthread_GetTSD(_glthread_TSD * tsd)
-{
-    if (tsd->initMagic != INIT_MAGIC) {
-        _glthread_InitTSD(tsd);
-    }
-    return TlsGetValue(tsd->key);
-}
-
-void
-_glthread_SetTSD(_glthread_TSD * tsd, void *ptr)
-{
-    /* the following code assumes that the _glthread_TSD has been initialized
-       to zero at creation */
-    if (tsd->initMagic != INIT_MAGIC) {
-        _glthread_InitTSD(tsd);
-    }
-    if (TlsSetValue(tsd->key, ptr) == 0) {
-        perror("Mesa:_glthread_SetTSD");
-        InsteadOf_exit(-1);
-    }
-}
-
-#endif                          /* WIN32_THREADS */
-
-#else                           /* THREADS */
-
-/*
- * no-op functions
- */
-
-_X_EXPORT unsigned long
-_glthread_GetID(void)
-{
-    return 0;
-}
-
-void
-_glthread_InitTSD(_glthread_TSD * tsd)
-{
-    (void) tsd;
-}
-
-void *
-_glthread_GetTSD(_glthread_TSD * tsd)
-{
-    (void) tsd;
-    return NULL;
-}
-
-void
-_glthread_SetTSD(_glthread_TSD * tsd, void *ptr)
-{
-    (void) tsd;
-    (void) ptr;
-}
-
-#endif                          /* THREADS */
diff --git a/glx/glthread.h b/glx/glthread.h
deleted file mode 100644 (file)
index 62c9bd4..0000000
+++ /dev/null
@@ -1,234 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version:  6.5.2
- *
- * Copyright (C) 1999-2006  Brian Paul   All Rights Reserved.
- *
- * 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 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
- * BRIAN PAUL 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.
- */
-
-/*
- * Thread support for gl dispatch.
- *
- * Initial version by John Stone (j.stone@acm.org) (johns@cs.umr.edu)
- *                and Christoph Poliwoda (poliwoda@volumegraphics.com)
- * Revised by Keith Whitwell
- * Adapted for new gl dispatcher by Brian Paul
- *
- *
- *
- * DOCUMENTATION
- *
- * This thread module exports the following types:
- *   _glthread_TSD     Thread-specific data area
- *   _glthread_Thread  Thread datatype
- *   _glthread_Mutex   Mutual exclusion lock
- *
- * Macros:
- *   _glthread_DECLARE_STATIC_MUTEX(name)   Declare a non-local mutex
- *   _glthread_INIT_MUTEX(name)             Initialize a mutex
- *   _glthread_LOCK_MUTEX(name)             Lock a mutex
- *   _glthread_UNLOCK_MUTEX(name)           Unlock a mutex
- *
- * Functions:
- *   _glthread_GetID(v)      Get integer thread ID
- *   _glthread_InitTSD()     Initialize thread-specific data
- *   _glthread_GetTSD()      Get thread-specific data
- *   _glthread_SetTSD()      Set thread-specific data
- *
- */
-
-/*
- * If this file is accidentally included by a non-threaded build,
- * it should not cause the build to fail, or otherwise cause problems.
- * In general, it should only be included when needed however.
- */
-
-#ifndef GLTHREAD_H
-#define GLTHREAD_H
-
-#if defined(USE_MGL_NAMESPACE)
-#define _glapi_Dispatch _mglapi_Dispatch
-#endif
-
-#if (defined(PTHREADS) || defined(WIN32_THREADS)) \
-    && !defined(THREADS)
-#define THREADS
-#endif
-
-#ifdef VMS
-#include <GL/vms_x_fix.h>
-#endif
-
-/*
- * POSIX threads. This should be your choice in the Unix world
- * whenever possible.  When building with POSIX threads, be sure
- * to enable any compiler flags which will cause the MT-safe
- * libc (if one exists) to be used when linking, as well as any
- * header macros for MT-safe errno, etc.  For Solaris, this is the -mt
- * compiler flag.  On Solaris with gcc, use -D_REENTRANT to enable
- * proper compiling for MT-safe libc etc.
- */
-#if defined(PTHREADS)
-#include <pthread.h>            /* POSIX threads headers */
-
-typedef struct {
-    pthread_key_t key;
-    int initMagic;
-} _glthread_TSD;
-
-typedef pthread_t _glthread_Thread;
-
-typedef pthread_mutex_t _glthread_Mutex;
-
-#define _glthread_DECLARE_STATIC_MUTEX(name) \
-   static _glthread_Mutex name = PTHREAD_MUTEX_INITIALIZER
-
-#define _glthread_INIT_MUTEX(name) \
-   pthread_mutex_init(&(name), NULL)
-
-#define _glthread_DESTROY_MUTEX(name) \
-   pthread_mutex_destroy(&(name))
-
-#define _glthread_LOCK_MUTEX(name) \
-   (void) pthread_mutex_lock(&(name))
-
-#define _glthread_UNLOCK_MUTEX(name) \
-   (void) pthread_mutex_unlock(&(name))
-
-#endif                          /* PTHREADS */
-
-/*
- * Solaris threads. Use only up to Solaris 2.4.
- * Solaris 2.5 and higher provide POSIX threads.
- * Be sure to compile with -mt on the Solaris compilers, or
- * use -D_REENTRANT if using gcc.
- */
-
-/*
- * Windows threads. Should work with Windows NT and 95.
- * IMPORTANT: Link with multithreaded runtime library when THREADS are
- * used!
- */
-#ifdef WIN32_THREADS
-#include <windows.h>
-
-typedef struct {
-    DWORD key;
-    int initMagic;
-} _glthread_TSD;
-
-typedef HANDLE _glthread_Thread;
-
-typedef CRITICAL_SECTION _glthread_Mutex;
-
-#define _glthread_DECLARE_STATIC_MUTEX(name)  /*static*/ _glthread_Mutex name = {0,0,0,0,0,0}
-#define _glthread_INIT_MUTEX(name)  InitializeCriticalSection(&name)
-#define _glthread_DESTROY_MUTEX(name)  DeleteCriticalSection(&name)
-#define _glthread_LOCK_MUTEX(name)  EnterCriticalSection(&name)
-#define _glthread_UNLOCK_MUTEX(name)  LeaveCriticalSection(&name)
-
-#endif                          /* WIN32_THREADS */
-
-/*
- * BeOS threads. R5.x required.
- */
-#ifdef BEOS_THREADS
-
-#include <kernel/OS.h>
-#include <support/TLS.h>
-
-typedef struct {
-    int32 key;
-    int initMagic;
-} _glthread_TSD;
-
-typedef thread_id _glthread_Thread;
-
-/* Use Benaphore, aka speeder semaphore */
-typedef struct {
-    int32 lock;
-    sem_id sem;
-} benaphore;
-typedef benaphore _glthread_Mutex;
-
-#define _glthread_DECLARE_STATIC_MUTEX(name)  static _glthread_Mutex name = { 0, 0 }
-#define _glthread_INIT_MUTEX(name)     name.sem = create_sem(0, #name"_benaphore"), name.lock = 0
-#define _glthread_DESTROY_MUTEX(name)  delete_sem(name.sem), name.lock = 0
-#define _glthread_LOCK_MUTEX(name)     if (name.sem == 0) _glthread_INIT_MUTEX(name); \
-                                                                               if (atomic_add(&(name.lock), 1) >= 1) acquire_sem(name.sem)
-#define _glthread_UNLOCK_MUTEX(name)   if (atomic_add(&(name.lock), -1) > 1) release_sem(name.sem)
-
-#endif                          /* BEOS_THREADS */
-
-#ifndef THREADS
-
-/*
- * THREADS not defined
- */
-
-typedef int _glthread_TSD;
-
-typedef int _glthread_Thread;
-
-typedef int _glthread_Mutex;
-
-#define _glthread_DECLARE_STATIC_MUTEX(name)  static _glthread_Mutex name = 0
-
-#define _glthread_INIT_MUTEX(name)  (void) name
-
-#define _glthread_DESTROY_MUTEX(name)  (void) name
-
-#define _glthread_LOCK_MUTEX(name)  (void) name
-
-#define _glthread_UNLOCK_MUTEX(name)  (void) name
-
-#endif                          /* THREADS */
-
-/*
- * Platform independent thread specific data API.
- */
-
-extern unsigned long
- _glthread_GetID(void);
-
-extern void
- _glthread_InitTSD(_glthread_TSD *);
-
-extern void *_glthread_GetTSD(_glthread_TSD *);
-
-extern void
- _glthread_SetTSD(_glthread_TSD *, void *);
-
-#if defined(GLX_USE_TLS)
-
-extern TLS struct _glapi_table *_glapi_tls_Dispatch;
-
-#define GET_DISPATCH() _glapi_tls_Dispatch
-
-#elif !defined(GL_CALL)
-#if defined(THREADS)
-#define GET_DISPATCH() \
-   ((__builtin_expect( _glapi_Dispatch != NULL, 1 )) \
-       ? _glapi_Dispatch : _glapi_get_dispatch())
-#else
-#define GET_DISPATCH() _glapi_Dispatch
-#endif                          /* defined(THREADS) */
-#endif                          /* ndef GL_CALL */
-
-#endif                          /* THREADS_H */
index c1f4e22..2fc3f4c 100644 (file)
 #include <windowstr.h>
 #include "glxutil.h"
 #include "glxext.h"
-#include "glapitable.h"
-#include "glapi.h"
-#include "glthread.h"
-#include "dispatch.h"
 #include "indirect_dispatch.h"
 #include "indirect_table.h"
 #include "indirect_util.h"
 
+static char GLXServerVendorName[] = "SGI";
+
 _X_HIDDEN int
 validGlxScreen(ClientPtr client, int screen, __GLXscreen ** pGlxScreen,
                int *err)
@@ -135,7 +133,7 @@ _X_HIDDEN int
 validGlxContext(ClientPtr client, XID id, int access_mode,
                 __GLXcontext ** context, int *err)
 {
-    *err = dixLookupResourceByType((pointer *) context, id,
+    *err = dixLookupResourceByType((void **) context, id,
                                    __glXContextRes, client, access_mode);
     if (*err != Success || (*context)->idExists == GL_FALSE) {
         client->errorValue = id;
@@ -153,7 +151,7 @@ validGlxDrawable(ClientPtr client, XID id, int type, int access_mode,
 {
     int rc;
 
-    rc = dixLookupResourceByType((pointer *) drawable, id,
+    rc = dixLookupResourceByType((void **) drawable, id,
                                  __glXDrawableRes, client, access_mode);
     if (rc != Success && rc != BadValue) {
         *err = rc;
@@ -190,7 +188,7 @@ validGlxDrawable(ClientPtr client, XID id, int type, int access_mode,
 void
 __glXContextDestroy(__GLXcontext * context)
 {
-    __glXFlushContextCache();
+    lastGLContext = NULL;
 }
 
 static void
@@ -277,6 +275,17 @@ DoCreateContext(__GLXclientState * cl, GLXContextID gcId,
      ** Allocate memory for the new context
      */
     if (!isDirect) {
+        /* Only allow creating indirect GLX contexts if allowed by
+         * server command line.  Indirect GLX is of limited use (since
+         * it's only GL 1.4), it's slower than direct contexts, and
+         * it's a massive attack surface for buffer overflow type
+         * errors.
+         */
+        if (!enableIndirectGLX) {
+            client->errorValue = isDirect;
+            return BadValue;
+        }
+
         /* Without any attributes, the only error that the driver should be
          * able to generate is BadAlloc.  As result, just drop the error
          * returned from the driver on the floor.
@@ -297,7 +306,7 @@ DoCreateContext(__GLXclientState * cl, GLXContextID gcId,
     glxc->id = gcId;
     glxc->share_id = shareList;
     glxc->idExists = GL_TRUE;
-    glxc->isCurrent = GL_FALSE;
+    glxc->currentClient = NULL;
     glxc->isDirect = isDirect;
     glxc->hasUnflushedCommands = GL_FALSE;
     glxc->renderMode = GL_RENDER;
@@ -404,9 +413,7 @@ __glXDisp_DestroyContext(__GLXclientState * cl, GLbyte * pc)
                          &glxc, &err))
         return err;
 
-    glxc->idExists = GL_FALSE;
-    if (!glxc->isCurrent)
-        FreeResourceByType(req->context, __glXContextRes, FALSE);
+    FreeResourceByType(req->context, __glXContextRes, FALSE);
 
     return Success;
 }
@@ -438,11 +445,7 @@ static void
 StopUsingContext(__GLXcontext * glxc)
 {
     if (glxc) {
-        if (glxc == __glXLastContext) {
-            /* Tell server GL library */
-            __glXLastContext = 0;
-        }
-        glxc->isCurrent = GL_FALSE;
+        glxc->currentClient = NULL;
         if (!glxc->idExists) {
             FreeResourceByType(glxc->id, __glXContextRes, FALSE);
         }
@@ -452,8 +455,7 @@ StopUsingContext(__GLXcontext * glxc)
 static void
 StartUsingContext(__GLXclientState * cl, __GLXcontext * glxc)
 {
-    glxc->isCurrent = GL_TRUE;
-    __glXLastContext = glxc;
+    glxc->currentClient = cl->client;
 }
 
 /**
@@ -513,6 +515,10 @@ __glXGetDrawable(__GLXcontext * glxc, GLXDrawable drawId, ClientPtr client,
                                                 pDraw, drawId,
                                                 GLX_DRAWABLE_WINDOW,
                                                 drawId, glxc->config);
+    if (!pGlxDraw) {
+       *error = BadAlloc;
+       return NULL;
+    }
 
     /* since we are creating the drawablePrivate, drawId should be new */
     if (!AddResource(drawId, __glXDrawableRes, pGlxDraw)) {
@@ -583,7 +589,7 @@ DoMakeCurrent(__GLXclientState * cl,
 
         if (!validGlxContext(client, contextId, DixUseAccess, &glxc, &error))
             return error;
-        if ((glxc != prevglxc) && glxc->isCurrent) {
+        if ((glxc != prevglxc) && glxc->currentClient) {
             /* Context is current to somebody else */
             return BadAccess;
         }
@@ -613,7 +619,7 @@ DoMakeCurrent(__GLXclientState * cl,
          */
         if (prevglxc->hasUnflushedCommands) {
             if (__glXForceCurrent(cl, tag, (int *) &error)) {
-                CALL_Flush(GET_DISPATCH(), ());
+                glFlush();
                 prevglxc->hasUnflushedCommands = GL_FALSE;
             }
             else {
@@ -627,7 +633,7 @@ DoMakeCurrent(__GLXclientState * cl,
         if (!(*prevglxc->loseCurrent) (prevglxc)) {
             return __glXError(GLXBadContext);
         }
-        __glXFlushContextCache();
+        lastGLContext = NULL;
         if (!prevglxc->isDirect) {
             prevglxc->drawPriv = NULL;
             prevglxc->readPriv = NULL;
@@ -640,13 +646,15 @@ DoMakeCurrent(__GLXclientState * cl,
         glxc->readPriv = readPriv;
 
         /* make the context current */
+        lastGLContext = glxc;
         if (!(*glxc->makeCurrent) (glxc)) {
+            lastGLContext = NULL;
             glxc->drawPriv = NULL;
             glxc->readPriv = NULL;
             return __glXError(GLXBadContext);
         }
 
-        glxc->isCurrent = GL_TRUE;
+        glxc->currentClient = client;
     }
 
     StopUsingContext(prevglxc);
@@ -796,7 +804,7 @@ __glXDisp_WaitGL(__GLXclientState * cl, GLbyte * pc)
         if (!__glXForceCurrent(cl, req->contextTag, &error))
             return error;
 
-        CALL_Finish(GET_DISPATCH(), ());
+        glFinish();
     }
 
     if (glxc && glxc->drawPriv->waitGL)
@@ -867,7 +875,7 @@ __glXDisp_CopyContext(__GLXclientState * cl, GLbyte * pc)
     /*
      ** The destination context must not be current for any client.
      */
-    if (dst->isCurrent) {
+    if (dst->currentClient) {
         client->errorValue = dest;
         return BadAccess;
     }
@@ -894,7 +902,7 @@ __glXDisp_CopyContext(__GLXclientState * cl, GLbyte * pc)
              ** Do whatever is needed to make sure that all preceding requests
              ** in both streams are completed before the copy is executed.
              */
-            CALL_Finish(GET_DISPATCH(), ());
+            glFinish();
             tagcx->hasUnflushedCommands = GL_FALSE;
         }
         else {
@@ -913,7 +921,7 @@ __glXDisp_CopyContext(__GLXclientState * cl, GLbyte * pc)
 
 enum {
     GLX_VIS_CONFIG_UNPAIRED = 18,
-    GLX_VIS_CONFIG_PAIRED = 20
+    GLX_VIS_CONFIG_PAIRED = 22
 };
 
 enum {
@@ -1005,8 +1013,17 @@ __glXDisp_GetVisualConfigs(__GLXclientState * cl, GLbyte * pc)
         buf[p++] = modes->samples;
         buf[p++] = GLX_SAMPLE_BUFFERS_SGIS;
         buf[p++] = modes->sampleBuffers;
-        buf[p++] = 0;           /* copy over visualSelectGroup (GLX_VISUAL_SELECT_GROUP_SGIX)? */
-        buf[p++] = 0;
+        /* Add attribute only if its value is not default. */
+        if (modes->sRGBCapable != GL_FALSE) {
+            buf[p++] = GLX_FRAMEBUFFER_SRGB_CAPABLE_EXT;
+            buf[p++] = modes->sRGBCapable;
+        }
+        /* Don't add visualSelectGroup (GLX_VISUAL_SELECT_GROUP_SGIX)?
+         * Pad the remaining place with zeroes, so that attributes count is constant. */
+        while (p < GLX_VIS_CONFIG_TOTAL) {
+            buf[p++] = 0;
+            buf[p++] = 0;
+        }
 
         assert(p == GLX_VIS_CONFIG_TOTAL);
         if (client->swapped) {
@@ -1017,7 +1034,7 @@ __glXDisp_GetVisualConfigs(__GLXclientState * cl, GLbyte * pc)
     return Success;
 }
 
-#define __GLX_TOTAL_FBCONFIG_ATTRIBS (36)
+#define __GLX_TOTAL_FBCONFIG_ATTRIBS (44)
 #define __GLX_FBCONFIG_ATTRIBS_LENGTH (__GLX_TOTAL_FBCONFIG_ATTRIBS * 2)
 /**
  * Send the set of GLXFBConfigs to the client.  There is not currently
@@ -1102,13 +1119,33 @@ DoGetFBConfigs(__GLXclientState * cl, unsigned screen)
         WRITE_PAIR(GLX_SWAP_METHOD_OML, modes->swapMethod);
         WRITE_PAIR(GLX_SAMPLES_SGIS, modes->samples);
         WRITE_PAIR(GLX_SAMPLE_BUFFERS_SGIS, modes->sampleBuffers);
-        /* GLX_VISUAL_SELECT_GROUP_SGIX ? */
+        WRITE_PAIR(GLX_VISUAL_SELECT_GROUP_SGIX, modes->visualSelectGroup);
         WRITE_PAIR(GLX_DRAWABLE_TYPE, modes->drawableType);
         WRITE_PAIR(GLX_BIND_TO_TEXTURE_RGB_EXT, modes->bindToTextureRgb);
         WRITE_PAIR(GLX_BIND_TO_TEXTURE_RGBA_EXT, modes->bindToTextureRgba);
         WRITE_PAIR(GLX_BIND_TO_MIPMAP_TEXTURE_EXT, modes->bindToMipmapTexture);
         WRITE_PAIR(GLX_BIND_TO_TEXTURE_TARGETS_EXT,
                    modes->bindToTextureTargets);
+       /* can't report honestly until mesa is fixed */
+       WRITE_PAIR(GLX_Y_INVERTED_EXT, GLX_DONT_CARE);
+       if (modes->drawableType & GLX_PBUFFER_BIT) {
+           WRITE_PAIR(GLX_MAX_PBUFFER_WIDTH, modes->maxPbufferWidth);
+           WRITE_PAIR(GLX_MAX_PBUFFER_HEIGHT, modes->maxPbufferHeight);
+           WRITE_PAIR(GLX_MAX_PBUFFER_PIXELS, modes->maxPbufferPixels);
+           WRITE_PAIR(GLX_OPTIMAL_PBUFFER_WIDTH_SGIX,
+                      modes->optimalPbufferWidth);
+           WRITE_PAIR(GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX,
+                      modes->optimalPbufferHeight);
+       }
+        /* Add attribute only if its value is not default. */
+        if (modes->sRGBCapable != GL_FALSE) {
+            WRITE_PAIR(GLX_FRAMEBUFFER_SRGB_CAPABLE_EXT, modes->sRGBCapable);
+        }
+        /* Pad the remaining place with zeroes, so that attributes count is constant. */
+        while (p < __GLX_FBCONFIG_ATTRIBS_LENGTH) {
+            WRITE_PAIR(0, 0);
+        }
+        assert(p == __GLX_FBCONFIG_ATTRIBS_LENGTH);
 
         if (client->swapped) {
             __GLX_SWAP_INT_ARRAY(buf, __GLX_FBCONFIG_ATTRIBS_LENGTH);
@@ -1215,7 +1252,8 @@ DoCreateGLXPixmap(ClientPtr client, __GLXscreen * pGlxScreen,
     err = DoCreateGLXDrawable(client, pGlxScreen, config, pDraw, drawableId,
                               glxDrawableId, GLX_DRAWABLE_PIXMAP);
 
-    ((PixmapPtr) pDraw)->refcnt++;
+    if (err == Success)
+        ((PixmapPtr) pDraw)->refcnt++;
 
     return err;
 }
@@ -1396,6 +1434,8 @@ DoCreatePbuffer(ClientPtr client, int screenNum, XID fbconfigId,
                                                     width, height,
                                                     config->rgbBits, 0);
     __glXleaveServer(GL_FALSE);
+    if (!pPixmap)
+        return BadAlloc;
 
     /* Assign the pixmap the same id as the pbuffer and add it as a
      * resource so it and the DRI2 drawable will be reclaimed when the
@@ -1437,7 +1477,6 @@ __glXDisp_CreatePbuffer(__GLXclientState * cl, GLbyte * pc)
             height = attrs[i * 2 + 1];
             break;
         case GLX_LARGEST_PBUFFER:
-        case GLX_PRESERVED_CONTENTS:
             /* FIXME: huh... */
             break;
         }
@@ -1455,6 +1494,10 @@ __glXDisp_CreateGLXPbufferSGIX(__GLXclientState * cl, GLbyte * pc)
 
     REQUEST_AT_LEAST_SIZE(xGLXCreateGLXPbufferSGIXReq);
 
+    /*
+     * We should really handle attributes correctly, but this extension
+     * is so rare I have difficulty caring.
+     */
     return DoCreatePbuffer(cl->client, req->screen, req->fbconfig,
                            req->width, req->height, req->pbuffer);
 }
@@ -1637,7 +1680,7 @@ __glXDisp_SwapBuffers(__GLXclientState * cl, GLbyte * pc)
              ** Do whatever is needed to make sure that all preceding requests
              ** in both streams are completed before the swap is executed.
              */
-            CALL_Finish(GET_DISPATCH(), ());
+            glFinish();
             glxc->hasUnflushedCommands = GL_FALSE;
         }
         else {
@@ -1662,15 +1705,14 @@ DoQueryContext(__GLXclientState * cl, GLXContextID gcId)
     ClientPtr client = cl->client;
     __GLXcontext *ctx;
     xGLXQueryContextInfoEXTReply reply;
-    int nProps;
-    int *sendBuf, *pSendBuf;
+    int nProps = 3;
+    int sendBuf[nProps * 2];
     int nReplyBytes;
     int err;
 
     if (!validGlxContext(cl->client, gcId, DixReadAccess, &ctx, &err))
         return err;
 
-    nProps = 3;
     reply = (xGLXQueryContextInfoEXTReply) {
         .type = X_Reply,
         .sequenceNumber = client->sequence,
@@ -1679,17 +1721,12 @@ DoQueryContext(__GLXclientState * cl, GLXContextID gcId)
     };
 
     nReplyBytes = reply.length << 2;
-    sendBuf = (int *) malloc((size_t) nReplyBytes);
-    if (sendBuf == NULL) {
-        return __glXError(GLXBadContext);       /* XXX: Is this correct? */
-    }
-    pSendBuf = sendBuf;
-    *pSendBuf++ = GLX_SHARE_CONTEXT_EXT;
-    *pSendBuf++ = (int) (ctx->share_id);
-    *pSendBuf++ = GLX_VISUAL_ID_EXT;
-    *pSendBuf++ = (int) (ctx->config->visualID);
-    *pSendBuf++ = GLX_SCREEN_EXT;
-    *pSendBuf++ = (int) (ctx->pGlxScreen->pScreen->myNum);
+    sendBuf[0] = GLX_SHARE_CONTEXT_EXT;
+    sendBuf[1] = (int) (ctx->share_id);
+    sendBuf[2] = GLX_VISUAL_ID_EXT;
+    sendBuf[3] = (int) (ctx->config->visualID);
+    sendBuf[4] = GLX_SCREEN_EXT;
+    sendBuf[5] = (int) (ctx->pGlxScreen->pScreen->myNum);
 
     if (client->swapped) {
         __glXSwapQueryContextInfoEXTReply(client, &reply, sendBuf);
@@ -1698,7 +1735,6 @@ DoQueryContext(__GLXclientState * cl, GLXContextID gcId)
         WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, &reply);
         WriteToClient(client, nReplyBytes, sendBuf);
     }
-    free((char *) sendBuf);
 
     return Success;
 }
@@ -1841,7 +1877,7 @@ __glXDisp_CopySubBufferMESA(__GLXclientState * cl, GLbyte * pc)
              ** Do whatever is needed to make sure that all preceding requests
              ** in both streams are completed before the swap is executed.
              */
-            CALL_Finish(GET_DISPATCH(), ());
+            glFinish();
             glxc->hasUnflushedCommands = GL_FALSE;
         }
         else {
@@ -1872,28 +1908,44 @@ DoGetDrawableAttributes(__GLXclientState * cl, XID drawId)
     ClientPtr client = cl->client;
     xGLXGetDrawableAttributesReply reply;
     __GLXdrawable *pGlxDraw;
-    CARD32 attributes[6];
-    int numAttribs, error;
+    CARD32 attributes[14];
+    int numAttribs = 0, error;
 
     if (!validGlxDrawable(client, drawId, GLX_DRAWABLE_ANY,
                           DixGetAttrAccess, &pGlxDraw, &error))
         return error;
 
-    numAttribs = 3;
-    reply = (xGLXGetDrawableAttributesReply) {
-        .type = X_Reply,
-        .sequenceNumber = client->sequence,
-        .length = numAttribs << 1,
-        .numAttribs = numAttribs
-    };
-
     attributes[0] = GLX_TEXTURE_TARGET_EXT;
     attributes[1] = pGlxDraw->target == GL_TEXTURE_2D ? GLX_TEXTURE_2D_EXT :
         GLX_TEXTURE_RECTANGLE_EXT;
+    numAttribs++;
     attributes[2] = GLX_Y_INVERTED_EXT;
     attributes[3] = GL_FALSE;
+    numAttribs++;
     attributes[4] = GLX_EVENT_MASK;
     attributes[5] = pGlxDraw->eventMask;
+    numAttribs++;
+    attributes[6] = GLX_WIDTH;
+    attributes[7] = pGlxDraw->pDraw->width;
+    numAttribs++;
+    attributes[8] = GLX_HEIGHT;
+    attributes[9] = pGlxDraw->pDraw->height;
+    numAttribs++;
+    attributes[10] = GLX_FBCONFIG_ID;
+    attributes[11] = pGlxDraw->config->fbconfigID;
+    numAttribs++;
+    if (pGlxDraw->type == GLX_DRAWABLE_PBUFFER) {
+        attributes[12] = GLX_PRESERVED_CONTENTS;
+        attributes[13] = GL_TRUE;
+        numAttribs++;
+    }
+
+    reply = (xGLXGetDrawableAttributesReply) {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = numAttribs << 1,
+        .numAttribs = numAttribs
+    };
 
     if (client->swapped) {
         __glXSwapGetDrawableAttributesReply(client, &reply, attributes);
@@ -2142,15 +2194,12 @@ __glXDisp_RenderLarge(__GLXclientState * cl, GLbyte * pc)
          ** Make enough space in the buffer, then copy the entire request.
          */
         if (cl->largeCmdBufSize < cmdlen) {
-            if (!cl->largeCmdBuf) {
-                cl->largeCmdBuf = (GLbyte *) malloc(cmdlen);
-            }
-            else {
-                cl->largeCmdBuf = (GLbyte *) realloc(cl->largeCmdBuf, cmdlen);
-            }
-            if (!cl->largeCmdBuf) {
-                return BadAlloc;
-            }
+           GLbyte *newbuf = cl->largeCmdBuf;
+
+           if (!(newbuf = realloc(newbuf, cmdlen)))
+               return BadAlloc;
+
+           cl->largeCmdBuf = newbuf;
             cl->largeCmdBufSize = cmdlen;
         }
         memcpy(cl->largeCmdBuf, pc, dataBytes);
@@ -2366,7 +2415,7 @@ __glXDisp_QueryServerString(__GLXclientState * cl, GLbyte * pc)
 
     switch (req->name) {
     case GLX_VENDOR:
-        ptr = pGlxScreen->GLXvendor;
+        ptr = GLXServerVendorName;
         break;
     case GLX_VERSION:
         /* Return to the server version rather than the screen version
@@ -2427,3 +2476,64 @@ __glXDisp_ClientInfo(__GLXclientState * cl, GLbyte * pc)
 
     return Success;
 }
+
+#include <GL/glxtokens.h>
+
+void
+__glXsendSwapEvent(__GLXdrawable *drawable, int type, CARD64 ust,
+                   CARD64 msc, CARD32 sbc)
+{
+    ClientPtr client = clients[CLIENT_ID(drawable->drawId)];
+
+    xGLXBufferSwapComplete2 wire =  {
+        .type = __glXEventBase + GLX_BufferSwapComplete
+    };
+
+    if (!client)
+        return;
+
+    if (!(drawable->eventMask & GLX_BUFFER_SWAP_COMPLETE_INTEL_MASK))
+        return;
+
+    wire.event_type = type;
+    wire.drawable = drawable->drawId;
+    wire.ust_hi = ust >> 32;
+    wire.ust_lo = ust & 0xffffffff;
+    wire.msc_hi = msc >> 32;
+    wire.msc_lo = msc & 0xffffffff;
+    wire.sbc = sbc;
+
+    WriteEventsToClient(client, 1, (xEvent *) &wire);
+}
+
+#if PRESENT
+static void
+__glXpresentCompleteNotify(WindowPtr window, CARD8 present_mode, CARD32 serial,
+                           uint64_t ust, uint64_t msc)
+{
+    __GLXdrawable *drawable;
+    int glx_type;
+    int rc;
+
+    rc = dixLookupResourceByType((void **) &drawable, window->drawable.id,
+                                 __glXDrawableRes, serverClient, DixGetAttrAccess);
+
+    if (rc != Success)
+        return;
+
+    if (present_mode == PresentCompleteModeFlip)
+        glx_type = GLX_FLIP_COMPLETE_INTEL;
+    else
+        glx_type = GLX_BLIT_COMPLETE_INTEL;
+        
+    __glXsendSwapEvent(drawable, glx_type, ust, msc, serial);
+}
+
+#include <present.h>
+
+void
+__glXregisterPresentCompleteNotify(void)
+{
+    present_register_complete_notify(__glXpresentCompleteNotify);
+}
+#endif
index 43f88d3..5d179f3 100644 (file)
 #include <pixmapstr.h>
 #include <windowstr.h>
 #include "glxext.h"
-#include "glapitable.h"
-#include "glapi.h"
-#include "glthread.h"
-#include "dispatch.h"
 #include "indirect_dispatch.h"
 #include "indirect_table.h"
 #include "indirect_util.h"
index 4764e56..677898a 100644 (file)
@@ -55,7 +55,6 @@ struct __GLXcontext {
     /*
      ** list of context structs
      */
-    __GLXcontext *last;
     __GLXcontext *next;
 
     /*
@@ -70,6 +69,11 @@ struct __GLXcontext {
     __GLXscreen *pGlxScreen;
 
     /*
+     ** If this context is current for a client, this will be that client
+     */
+    ClientPtr currentClient;
+
+    /*
      ** The XID of this context.
      */
     XID id;
@@ -85,11 +89,6 @@ struct __GLXcontext {
     GLboolean idExists;
 
     /*
-     ** Whether this context is current for some client.
-     */
-    GLboolean isCurrent;
-
-    /*
      ** Whether this context is a direct rendering context.
      */
     GLboolean isDirect;
diff --git a/glx/glxdri.c b/glx/glxdri.c
deleted file mode 100644 (file)
index a5d87ec..0000000
+++ /dev/null
@@ -1,1166 +0,0 @@
-/*
- * Copyright Â© 2006 Red Hat, Inc
- *
- * 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 Red Hat,
- * Inc not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior
- * permission.  Red Hat, Inc makes no representations about the
- * suitability of this software for any purpose.  It is provided "as
- * is" without express or implied warranty.
- *
- * RED HAT, INC DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL RED HAT, INC 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_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <stdint.h>
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include <sys/time.h>
-#include <dlfcn.h>
-
-#include <drm.h>
-#include <GL/gl.h>
-#include <GL/internal/dri_interface.h>
-#include <GL/glxtokens.h>
-
-#include <windowstr.h>
-#include <os.h>
-#include <damage.h>
-
-#define _XF86DRI_SERVER_
-#include <drm_sarea.h>
-#include <xf86drm.h>
-#include <X11/dri/xf86driproto.h>
-#include <xf86str.h>
-#include <xf86.h>
-#include <dri.h>
-
-#include "servermd.h"
-
-#define DRI_NEW_INTERFACE_ONLY
-#include "glxserver.h"
-#include "glxutil.h"
-#include "glxdricommon.h"
-
-#include "glapitable.h"
-#include "glapi.h"
-#include "glthread.h"
-#include "dispatch.h"
-#include "extension_string.h"
-
-typedef struct __GLXDRIscreen __GLXDRIscreen;
-typedef struct __GLXDRIcontext __GLXDRIcontext;
-typedef struct __GLXDRIdrawable __GLXDRIdrawable;
-
-struct __GLXDRIscreen {
-    __GLXscreen base;
-    __DRIscreen *driScreen;
-    void *driver;
-
-    xf86EnterVTProc *enterVT;
-    xf86LeaveVTProc *leaveVT;
-
-    const __DRIcoreExtension *core;
-    const __DRIlegacyExtension *legacy;
-    const __DRIcopySubBufferExtension *copySubBuffer;
-    const __DRIswapControlExtension *swapControl;
-    const __DRIconfig **driConfigs;
-
-#ifdef __DRI_TEX_OFFSET
-    const __DRItexOffsetExtension *texOffset;
-    DRITexOffsetStartProcPtr texOffsetStart;
-    DRITexOffsetFinishProcPtr texOffsetFinish;
-    __GLXDRIdrawable *texOffsetOverride[16];
-    GLuint lastTexOffsetOverride;
-#endif
-
-    unsigned char glx_enable_bits[__GLX_EXT_BYTES];
-};
-
-struct __GLXDRIcontext {
-    __GLXcontext base;
-    __DRIcontext *driContext;
-    XID hwContextID;
-};
-
-struct __GLXDRIdrawable {
-    __GLXdrawable base;
-    __DRIdrawable *driDrawable;
-
-    /* Pulled in from old __GLXpixmap */
-#ifdef __DRI_TEX_OFFSET
-    GLint texname;
-    __GLXDRIcontext *ctx;
-    unsigned long long offset;
-    DamagePtr pDamage;
-#endif
-};
-
-static void
-__glXDRIleaveServer(GLboolean rendering)
-{
-    int i;
-
-    for (i = 0; rendering && i < screenInfo.numScreens; i++) {
-        __GLXDRIscreen *const screen =
-            (__GLXDRIscreen *) glxGetScreen(screenInfo.screens[i]);
-        GLuint lastOverride = screen->lastTexOffsetOverride;
-
-        if (lastOverride) {
-            __GLXDRIdrawable **texOffsetOverride = screen->texOffsetOverride;
-            int j;
-
-            for (j = 0; j < lastOverride; j++) {
-                __GLXDRIdrawable *pGlxPix = texOffsetOverride[j];
-
-                if (pGlxPix && pGlxPix->texname) {
-                    pGlxPix->offset =
-                        screen->texOffsetStart((PixmapPtr) pGlxPix->base.pDraw);
-                }
-            }
-        }
-    }
-
-    DRIBlockHandler(NULL, NULL, NULL);
-
-    for (i = 0; rendering && i < screenInfo.numScreens; i++) {
-        __GLXDRIscreen *const screen =
-            (__GLXDRIscreen *) glxGetScreen(screenInfo.screens[i]);
-        GLuint lastOverride = screen->lastTexOffsetOverride;
-
-        if (lastOverride) {
-            __GLXDRIdrawable **texOffsetOverride = screen->texOffsetOverride;
-            int j;
-
-            for (j = 0; j < lastOverride; j++) {
-                __GLXDRIdrawable *pGlxPix = texOffsetOverride[j];
-
-                if (pGlxPix && pGlxPix->texname) {
-                    screen->texOffset->setTexOffset(pGlxPix->ctx->driContext,
-                                                    pGlxPix->texname,
-                                                    pGlxPix->offset,
-                                                    pGlxPix->base.pDraw->depth,
-                                                    ((PixmapPtr) pGlxPix->base.
-                                                     pDraw)->devKind);
-                }
-            }
-        }
-    }
-}
-
-static void
-__glXDRIenterServer(GLboolean rendering)
-{
-    int i;
-
-    for (i = 0; rendering && i < screenInfo.numScreens; i++) {
-        __GLXDRIscreen *const screen = (__GLXDRIscreen *)
-            glxGetScreen(screenInfo.screens[i]);
-
-        if (screen->lastTexOffsetOverride) {
-            CALL_Flush(GET_DISPATCH(), ());
-            break;
-        }
-    }
-
-    DRIWakeupHandler(NULL, 0, NULL);
-}
-
-static void
-__glXDRIdoReleaseTexImage(__GLXDRIscreen * screen, __GLXDRIdrawable * drawable)
-{
-    GLuint lastOverride = screen->lastTexOffsetOverride;
-
-    if (lastOverride) {
-        __GLXDRIdrawable **texOffsetOverride = screen->texOffsetOverride;
-        int i;
-
-        for (i = 0; i < lastOverride; i++) {
-            if (texOffsetOverride[i] == drawable) {
-                if (screen->texOffsetFinish)
-                    screen->texOffsetFinish((PixmapPtr) drawable->base.pDraw);
-
-                texOffsetOverride[i] = NULL;
-
-                if (i + 1 == lastOverride) {
-                    lastOverride = 0;
-
-                    while (i--) {
-                        if (texOffsetOverride[i]) {
-                            lastOverride = i + 1;
-                            break;
-                        }
-                    }
-
-                    screen->lastTexOffsetOverride = lastOverride;
-
-                    break;
-                }
-            }
-        }
-    }
-}
-
-static void
-__glXDRIdrawableDestroy(__GLXdrawable * drawable)
-{
-    __GLXDRIdrawable *private = (__GLXDRIdrawable *) drawable;
-    __GLXDRIscreen *screen;
-    int i;
-
-    for (i = 0; i < screenInfo.numScreens; i++) {
-        screen = (__GLXDRIscreen *) glxGetScreen(screenInfo.screens[i]);
-        __glXDRIdoReleaseTexImage(screen, private);
-    }
-
-    /* If the X window was destroyed, the dri DestroyWindow hook will
-     * aready have taken care of this, so only call if pDraw isn't NULL. */
-    if (drawable->pDraw != NULL) {
-        screen = (__GLXDRIscreen *) glxGetScreen(drawable->pDraw->pScreen);
-        (*screen->core->destroyDrawable) (private->driDrawable);
-
-        __glXenterServer(GL_FALSE);
-        DRIDestroyDrawable(drawable->pDraw->pScreen,
-                           serverClient, drawable->pDraw);
-        __glXleaveServer(GL_FALSE);
-    }
-
-    __glXDrawableRelease(drawable);
-
-    free(private);
-}
-
-static GLboolean
-__glXDRIdrawableSwapBuffers(ClientPtr client, __GLXdrawable * basePrivate)
-{
-    __GLXDRIdrawable *private = (__GLXDRIdrawable *) basePrivate;
-    __GLXDRIscreen *screen =
-        (__GLXDRIscreen *) glxGetScreen(basePrivate->pDraw->pScreen);
-
-    (*screen->core->swapBuffers) (private->driDrawable);
-
-    return TRUE;
-}
-
-static int
-__glXDRIdrawableSwapInterval(__GLXdrawable * baseDrawable, int interval)
-{
-    __GLXDRIdrawable *draw = (__GLXDRIdrawable *) baseDrawable;
-    __GLXDRIscreen *screen =
-        (__GLXDRIscreen *) glxGetScreen(baseDrawable->pDraw->pScreen);
-
-    if (screen->swapControl)
-        screen->swapControl->setSwapInterval(draw->driDrawable, interval);
-
-    return 0;
-}
-
-static void
-__glXDRIdrawableCopySubBuffer(__GLXdrawable * basePrivate,
-                              int x, int y, int w, int h)
-{
-    __GLXDRIdrawable *private = (__GLXDRIdrawable *) basePrivate;
-    __GLXDRIscreen *screen = (__GLXDRIscreen *)
-        glxGetScreen(basePrivate->pDraw->pScreen);
-
-    if (screen->copySubBuffer)
-        screen->copySubBuffer->copySubBuffer(private->driDrawable, x, y, w, h);
-}
-
-static void
-__glXDRIcontextDestroy(__GLXcontext * baseContext)
-{
-    __GLXDRIcontext *context = (__GLXDRIcontext *) baseContext;
-    __GLXDRIscreen *screen = (__GLXDRIscreen *) context->base.pGlxScreen;
-    Bool retval;
-
-    screen->core->destroyContext(context->driContext);
-
-    __glXenterServer(GL_FALSE);
-    retval = DRIDestroyContext(baseContext->pGlxScreen->pScreen,
-                               context->hwContextID);
-    __glXleaveServer(GL_FALSE);
-
-    __glXContextDestroy(&context->base);
-    free(context);
-}
-
-static int
-__glXDRIcontextMakeCurrent(__GLXcontext * baseContext)
-{
-    __GLXDRIcontext *context = (__GLXDRIcontext *) baseContext;
-    __GLXDRIscreen *screen = (__GLXDRIscreen *) context->base.pGlxScreen;
-    __GLXDRIdrawable *draw = (__GLXDRIdrawable *) baseContext->drawPriv;
-    __GLXDRIdrawable *read = (__GLXDRIdrawable *) baseContext->readPriv;
-
-    return (*screen->core->bindContext) (context->driContext,
-                                         draw->driDrawable, read->driDrawable);
-}
-
-static int
-__glXDRIcontextLoseCurrent(__GLXcontext * baseContext)
-{
-    __GLXDRIcontext *context = (__GLXDRIcontext *) baseContext;
-    __GLXDRIscreen *screen = (__GLXDRIscreen *) context->base.pGlxScreen;
-
-    return (*screen->core->unbindContext) (context->driContext);
-}
-
-static int
-__glXDRIcontextCopy(__GLXcontext * baseDst, __GLXcontext * baseSrc,
-                    unsigned long mask)
-{
-    __GLXDRIcontext *dst = (__GLXDRIcontext *) baseDst;
-    __GLXDRIcontext *src = (__GLXDRIcontext *) baseSrc;
-    __GLXDRIscreen *screen = (__GLXDRIscreen *) dst->base.pGlxScreen;
-
-    return (*screen->core->copyContext) (dst->driContext,
-                                         src->driContext, mask);
-}
-
-static void
-glxFillAlphaChannel(CARD32 *pixels, CARD32 rowstride, int width, int height)
-{
-    int i;
-    CARD32 *p, *end;
-
-    rowstride /= 4;
-
-    for (i = 0; i < height; i++) {
-        p = pixels;
-        end = p + width;
-        while (p < end)
-            *p++ |= 0xFF000000;
-        pixels += rowstride;
-    }
-}
-
-static Bool
-testTexOffset(__GLXDRIscreen * const screen, PixmapPtr pPixmap)
-{
-    Bool ret;
-
-    if (!screen->texOffsetStart || !screen->texOffset)
-        return FALSE;
-
-    __glXenterServer(GL_FALSE);
-    ret = screen->texOffsetStart(pPixmap) != ~0ULL;
-    __glXleaveServer(GL_FALSE);
-
-    return ret;
-}
-
-/*
- * (sticking this here for lack of a better place)
- * Known issues with the GLX_EXT_texture_from_pixmap implementation:
- * - In general we ignore the fbconfig, lots of examples follow
- * - No fbconfig handling for multiple mipmap levels
- * - No fbconfig handling for 1D textures
- * - No fbconfig handling for TEXTURE_TARGET
- * - No fbconfig exposure of Y inversion state
- * - No GenerateMipmapEXT support (due to no FBO support)
- * - No support for anything but 16bpp and 32bpp-sparse pixmaps
- */
-
-static int
-__glXDRIbindTexImage(__GLXcontext * baseContext,
-                     int buffer, __GLXdrawable * glxPixmap)
-{
-    RegionPtr pRegion = NULL;
-    PixmapPtr pixmap;
-    int bpp, override = 0, texname;
-    GLenum format, type;
-    ScreenPtr pScreen = glxPixmap->pDraw->pScreen;
-    __GLXDRIdrawable *driDraw = (__GLXDRIdrawable *) glxPixmap;
-    __GLXDRIscreen *const screen = (__GLXDRIscreen *) glxGetScreen(pScreen);
-
-    CALL_GetIntegerv(GET_DISPATCH(), (glxPixmap->target == GL_TEXTURE_2D ?
-                                      GL_TEXTURE_BINDING_2D :
-                                      GL_TEXTURE_BINDING_RECTANGLE_NV,
-                                      &texname));
-
-    if (!texname)
-        return __glXError(GLXBadContextState);
-
-    pixmap = (PixmapPtr) glxPixmap->pDraw;
-
-    if (testTexOffset(screen, pixmap)) {
-        __GLXDRIdrawable **texOffsetOverride = screen->texOffsetOverride;
-        int i, firstEmpty = 16;
-
-        for (i = 0; i < 16; i++) {
-            if (texOffsetOverride[i] == driDraw)
-                goto alreadyin;
-
-            if (firstEmpty == 16 && !texOffsetOverride[i])
-                firstEmpty = i;
-        }
-
-        if (firstEmpty == 16) {
-            ErrorF("%s: Failed to register texture offset override\n",
-                   __func__);
-            goto nooverride;
-        }
-
-        if (firstEmpty >= screen->lastTexOffsetOverride)
-            screen->lastTexOffsetOverride = firstEmpty + 1;
-
-        texOffsetOverride[firstEmpty] = driDraw;
-
- alreadyin:
-        override = 1;
-
-        driDraw->ctx = (__GLXDRIcontext *) baseContext;
-
-        if (texname == driDraw->texname)
-            return Success;
-
-        driDraw->texname = texname;
-
-        screen->texOffset->setTexOffset(driDraw->ctx->driContext, texname, 0,
-                                        pixmap->drawable.depth,
-                                        pixmap->devKind);
-    }
- nooverride:
-
-    if (!driDraw->pDamage) {
-        if (!override) {
-            driDraw->pDamage = DamageCreate(NULL, NULL, DamageReportNone,
-                                            TRUE, pScreen, NULL);
-            if (!driDraw->pDamage)
-                return BadAlloc;
-
-            DamageRegister((DrawablePtr) pixmap, driDraw->pDamage);
-        }
-
-        pRegion = NULL;
-    }
-    else {
-        pRegion = DamageRegion(driDraw->pDamage);
-        if (RegionNil(pRegion))
-            return Success;
-    }
-
-    /* XXX 24bpp packed, 8, etc */
-    if (pixmap->drawable.depth >= 24) {
-        bpp = 4;
-        format = GL_BGRA;
-        type =
-#if X_BYTE_ORDER == X_BIG_ENDIAN
-            !override ? GL_UNSIGNED_INT_8_8_8_8_REV :
-#endif
-            GL_UNSIGNED_BYTE;
-    }
-    else {
-        bpp = 2;
-        format = GL_RGB;
-        type = GL_UNSIGNED_SHORT_5_6_5;
-    }
-
-    if (pRegion == NULL) {
-        void *data = NULL;
-
-        if (!override) {
-            unsigned pitch = PixmapBytePad(pixmap->drawable.width,
-                                           pixmap->drawable.depth);
-
-            data = malloc(pitch * pixmap->drawable.height);
-
-            __glXenterServer(GL_FALSE);
-            pScreen->GetImage(&pixmap->drawable, 0 /*pixmap->drawable.x */ ,
-                              0 /*pixmap->drawable.y */ ,
-                              pixmap->drawable.width,
-                              pixmap->drawable.height, ZPixmap, ~0, data);
-            __glXleaveServer(GL_FALSE);
-
-            if (pixmap->drawable.depth == 24)
-                glxFillAlphaChannel(data,
-                                    pitch,
-                                    pixmap->drawable.width,
-                                    pixmap->drawable.height);
-
-            CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH,
-                                              pitch / bpp));
-            CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, 0));
-            CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, 0));
-        }
-
-        CALL_TexImage2D(GET_DISPATCH(),
-                        (glxPixmap->target,
-                         0,
-                         bpp == 4 ? 4 : 3,
-                         pixmap->drawable.width,
-                         pixmap->drawable.height, 0, format, type, data));
-
-        free(data);
-    }
-    else if (!override) {
-        int i, numRects;
-        BoxPtr p;
-
-        numRects = RegionNumRects(pRegion);
-        p = RegionRects(pRegion);
-
-        CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, 0));
-        CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, 0));
-
-        for (i = 0; i < numRects; i++) {
-            unsigned pitch = PixmapBytePad(p[i].x2 - p[i].x1,
-                                           pixmap->drawable.depth);
-            void *data = malloc(pitch * (p[i].y2 - p[i].y1));
-
-            __glXenterServer(GL_FALSE);
-            pScreen->GetImage(&pixmap->drawable, /*pixmap->drawable.x + */
-                              p[i].x1,
-                              /*pixmap->drawable.y */ +p[i].y1,
-                              p[i].x2 - p[i].x1,
-                              p[i].y2 - p[i].y1, ZPixmap, ~0, data);
-            __glXleaveServer(GL_FALSE);
-
-            if (pixmap->drawable.depth == 24)
-                glxFillAlphaChannel(data,
-                                    pitch,
-                                    p[i].x2 - p[i].x1, p[i].y2 - p[i].y1);
-
-            CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH,
-                                              pitch / bpp));
-
-            CALL_TexSubImage2D(GET_DISPATCH(),
-                               (glxPixmap->target,
-                                0,
-                                p[i].x1, p[i].y1,
-                                p[i].x2 - p[i].x1, p[i].y2 - p[i].y1,
-                                format, type, data));
-
-            free(data);
-        }
-    }
-
-    if (!override)
-        DamageEmpty(driDraw->pDamage);
-
-    return Success;
-}
-
-static int
-__glXDRIreleaseTexImage(__GLXcontext * baseContext,
-                        int buffer, __GLXdrawable * pixmap)
-{
-    __GLXDRIscreen *screen =
-        (__GLXDRIscreen *) glxGetScreen(pixmap->pDraw->pScreen);
-    __GLXDRIdrawable *drawable = (__GLXDRIdrawable *) pixmap;
-
-    __glXDRIdoReleaseTexImage(screen, drawable);
-
-    return Success;
-}
-
-static __GLXtextureFromPixmap __glXDRItextureFromPixmap = {
-    __glXDRIbindTexImage,
-    __glXDRIreleaseTexImage
-};
-
-static void
-__glXDRIscreenDestroy(__GLXscreen * baseScreen)
-{
-    int i;
-
-    __GLXDRIscreen *screen = (__GLXDRIscreen *) baseScreen;
-
-    screen->core->destroyScreen(screen->driScreen);
-
-    dlclose(screen->driver);
-
-    __glXScreenDestroy(baseScreen);
-
-    if (screen->driConfigs) {
-        for (i = 0; screen->driConfigs[i] != NULL; i++)
-            free((__DRIconfig **) screen->driConfigs[i]);
-        free(screen->driConfigs);
-    }
-
-    free(screen);
-}
-
-static __GLXcontext *
-__glXDRIscreenCreateContext(__GLXscreen * baseScreen,
-                            __GLXconfig * glxConfig,
-                            __GLXcontext * baseShareContext,
-                            unsigned num_attribs,
-                            const uint32_t *attribs,
-                            int *error)
-{
-    __GLXDRIscreen *screen = (__GLXDRIscreen *) baseScreen;
-    __GLXDRIcontext *context, *shareContext;
-    __GLXDRIconfig *config = (__GLXDRIconfig *) glxConfig;
-    VisualPtr visual;
-    int i;
-    GLboolean retval;
-    __DRIcontext *driShare;
-    drm_context_t hwContext;
-    ScreenPtr pScreen = baseScreen->pScreen;
-
-    /* DRI1 cannot support createContextAttribs, so these parameters will
-     * never be used.
-     */
-    (void) num_attribs;
-    (void) attribs;
-    (void) error;
-
-    shareContext = (__GLXDRIcontext *) baseShareContext;
-    if (shareContext)
-        driShare = shareContext->driContext;
-    else
-        driShare = NULL;
-
-    if (baseShareContext && baseShareContext->isDirect)
-        return NULL;
-
-    context = calloc(1, sizeof *context);
-    if (context == NULL)
-        return NULL;
-
-    context->base.destroy = __glXDRIcontextDestroy;
-    context->base.makeCurrent = __glXDRIcontextMakeCurrent;
-    context->base.loseCurrent = __glXDRIcontextLoseCurrent;
-    context->base.copy = __glXDRIcontextCopy;
-
-    context->base.textureFromPixmap = &__glXDRItextureFromPixmap;
-    /* Find the requested X visual */
-    visual = pScreen->visuals;
-    for (i = 0; i < pScreen->numVisuals; i++, visual++)
-        if (visual->vid == glxConfig->visualID)
-            break;
-    if (i == pScreen->numVisuals)
-        return NULL;
-
-    context->hwContextID = FakeClientID(0);
-
-    __glXenterServer(GL_FALSE);
-    retval = DRICreateContext(baseScreen->pScreen, visual,
-                              context->hwContextID, &hwContext);
-    __glXleaveServer(GL_FALSE);
-
-    if (!retval)
-        return NULL;
-
-    context->driContext = screen->legacy->createNewContext(screen->driScreen, config->driConfig, 0,     /* render type */
-                                                           driShare,
-                                                           hwContext, context);
-
-    if (context->driContext == NULL) {
-        __glXenterServer(GL_FALSE);
-        retval = DRIDestroyContext(baseScreen->pScreen, context->hwContextID);
-        __glXleaveServer(GL_FALSE);
-        free(context);
-        return NULL;
-    }
-
-    return &context->base;
-}
-
-static __GLXdrawable *
-__glXDRIscreenCreateDrawable(ClientPtr client,
-                             __GLXscreen * screen,
-                             DrawablePtr pDraw,
-                             XID drawId,
-                             int type, XID glxDrawId, __GLXconfig * glxConfig)
-{
-    __GLXDRIscreen *driScreen = (__GLXDRIscreen *) screen;
-    __GLXDRIconfig *config = (__GLXDRIconfig *) glxConfig;
-    __GLXDRIdrawable *private;
-    GLboolean retval;
-    drm_drawable_t hwDrawable;
-
-    private = calloc(1, sizeof *private);
-    if (private == NULL)
-        return NULL;
-
-    if (!__glXDrawableInit(&private->base, screen,
-                           pDraw, type, glxDrawId, glxConfig)) {
-        free(private);
-        return NULL;
-    }
-
-    private->base.destroy = __glXDRIdrawableDestroy;
-    private->base.swapBuffers = __glXDRIdrawableSwapBuffers;
-    private->base.copySubBuffer = __glXDRIdrawableCopySubBuffer;
-    private->base.waitX = NULL;
-    private->base.waitGL = NULL;
-
-    __glXenterServer(GL_FALSE);
-    retval = DRICreateDrawable(screen->pScreen, serverClient,
-                               pDraw, &hwDrawable);
-    __glXleaveServer(GL_FALSE);
-
-    if (!retval) {
-        free(private);
-        return NULL;
-    }
-
-    /* The last argument is 'attrs', which is used with pbuffers which
-     * we currently don't support. */
-
-    private->driDrawable =
-        (driScreen->legacy->createNewDrawable) (driScreen->driScreen,
-                                                config->driConfig,
-                                                hwDrawable, 0, NULL, private);
-
-    if (private->driDrawable == NULL) {
-        __glXenterServer(GL_FALSE);
-        DRIDestroyDrawable(screen->pScreen, serverClient, pDraw);
-        __glXleaveServer(GL_FALSE);
-        free(private);
-        return NULL;
-    }
-
-    return &private->base;
-}
-
-static GLboolean
-getDrawableInfo(__DRIdrawable * driDrawable,
-                unsigned int *index, unsigned int *stamp,
-                int *x, int *y, int *width, int *height,
-                int *numClipRects, drm_clip_rect_t ** ppClipRects,
-                int *backX, int *backY,
-                int *numBackClipRects, drm_clip_rect_t ** ppBackClipRects,
-                void *data)
-{
-    __GLXDRIdrawable *drawable = data;
-    ScreenPtr pScreen;
-    drm_clip_rect_t *pClipRects, *pBackClipRects;
-    GLboolean retval;
-    size_t size;
-
-    /* If the X window has been destroyed, give up here. */
-    if (drawable->base.pDraw == NULL)
-        return GL_FALSE;
-
-    pScreen = drawable->base.pDraw->pScreen;
-    __glXenterServer(GL_FALSE);
-    retval = DRIGetDrawableInfo(pScreen, drawable->base.pDraw, index, stamp,
-                                x, y, width, height,
-                                numClipRects, &pClipRects,
-                                backX, backY,
-                                numBackClipRects, &pBackClipRects);
-    __glXleaveServer(GL_FALSE);
-
-    if (retval && *numClipRects > 0) {
-        size = sizeof(drm_clip_rect_t) * *numClipRects;
-        *ppClipRects = malloc(size);
-
-        /* Clip cliprects to screen dimensions (redirected windows) */
-        if (*ppClipRects != NULL) {
-            int i, j;
-
-            for (i = 0, j = 0; i < *numClipRects; i++) {
-                (*ppClipRects)[j].x1 = max(pClipRects[i].x1, 0);
-                (*ppClipRects)[j].y1 = max(pClipRects[i].y1, 0);
-                (*ppClipRects)[j].x2 = min(pClipRects[i].x2, pScreen->width);
-                (*ppClipRects)[j].y2 = min(pClipRects[i].y2, pScreen->height);
-
-                if ((*ppClipRects)[j].x1 < (*ppClipRects)[j].x2 &&
-                    (*ppClipRects)[j].y1 < (*ppClipRects)[j].y2) {
-                    j++;
-                }
-            }
-
-            if (*numClipRects != j) {
-                *numClipRects = j;
-                *ppClipRects = realloc(*ppClipRects,
-                                       sizeof(drm_clip_rect_t) * *numClipRects);
-            }
-        }
-        else
-            *numClipRects = 0;
-    }
-    else {
-        *ppClipRects = NULL;
-        *numClipRects = 0;
-    }
-
-    if (retval && *numBackClipRects > 0) {
-        size = sizeof(drm_clip_rect_t) * *numBackClipRects;
-        *ppBackClipRects = malloc(size);
-        if (*ppBackClipRects != NULL)
-            memcpy(*ppBackClipRects, pBackClipRects, size);
-        else
-            *numBackClipRects = 0;
-    }
-    else {
-        *ppBackClipRects = NULL;
-        *numBackClipRects = 0;
-    }
-
-    return retval;
-}
-
-static void
-__glXReportDamage(__DRIdrawable * driDraw,
-                  int x, int y,
-                  drm_clip_rect_t * rects, int num_rects,
-                  GLboolean front_buffer, void *data)
-{
-    __GLXDRIdrawable *drawable = data;
-    DrawablePtr pDraw = drawable->base.pDraw;
-    RegionRec region;
-
-    __glXenterServer(GL_FALSE);
-
-    if (RegionInitBoxes(&region, (BoxPtr) rects, num_rects)) {
-        RegionTranslate(&region, pDraw->x, pDraw->y);
-        DamageDamageRegion(pDraw, &region);
-        RegionUninit(&region);
-    }
-    else {
-        while (num_rects--) {
-            RegionInit(&region, (BoxPtr) rects++, 1);
-            RegionTranslate(&region, pDraw->x, pDraw->y);
-            DamageDamageRegion(pDraw, &region);
-            RegionUninit(&region);
-        }
-    }
-
-    __glXleaveServer(GL_FALSE);
-}
-
-static const __DRIgetDrawableInfoExtension getDrawableInfoExtension = {
-    {__DRI_GET_DRAWABLE_INFO, __DRI_GET_DRAWABLE_INFO_VERSION},
-    getDrawableInfo
-};
-
-static const __DRIdamageExtension damageExtension = {
-    {__DRI_DAMAGE, __DRI_DAMAGE_VERSION},
-    __glXReportDamage,
-};
-
-static const __DRIextension *loader_extensions[] = {
-    &systemTimeExtension.base,
-    &getDrawableInfoExtension.base,
-    &damageExtension.base,
-    NULL
-};
-
-static Bool
-glxDRIEnterVT(ScrnInfoPtr scrn)
-{
-    Bool ret;
-    __GLXDRIscreen *screen = (__GLXDRIscreen *)
-        glxGetScreen(xf86ScrnToScreen(scrn));
-
-    LogMessage(X_INFO, "AIGLX: Resuming AIGLX clients after VT switch\n");
-
-    scrn->EnterVT = screen->enterVT;
-
-    ret = scrn->EnterVT(scrn);
-
-    screen->enterVT = scrn->EnterVT;
-    scrn->EnterVT = glxDRIEnterVT;
-
-    if (!ret)
-        return FALSE;
-
-    glxResumeClients();
-
-    return TRUE;
-}
-
-static void
-glxDRILeaveVT(ScrnInfoPtr scrn)
-{
-    __GLXDRIscreen *screen = (__GLXDRIscreen *)
-        glxGetScreen(xf86ScrnToScreen(scrn));
-
-    LogMessage(X_INFO, "AIGLX: Suspending AIGLX clients for VT switch\n");
-
-    glxSuspendClients();
-
-    scrn->LeaveVT = screen->leaveVT;
-    (*screen->leaveVT) (scrn);
-    screen->leaveVT = scrn->LeaveVT;
-    scrn->LeaveVT = glxDRILeaveVT;
-}
-
-static void
-initializeExtensions(__GLXDRIscreen * screen)
-{
-    const __DRIextension **extensions;
-    int i;
-
-    extensions = screen->core->getExtensions(screen->driScreen);
-
-    for (i = 0; extensions[i]; i++) {
-#ifdef __DRI_READ_DRAWABLE
-        if (strcmp(extensions[i]->name, __DRI_READ_DRAWABLE) == 0) {
-            __glXEnableExtension(screen->glx_enable_bits,
-                                 "GLX_SGI_make_current_read");
-
-            LogMessage(X_INFO, "AIGLX: enabled GLX_SGI_make_current_read\n");
-        }
-#endif
-
-#ifdef __DRI_COPY_SUB_BUFFER
-        if (strcmp(extensions[i]->name, __DRI_COPY_SUB_BUFFER) == 0) {
-            screen->copySubBuffer =
-                (__DRIcopySubBufferExtension *) extensions[i];
-            __glXEnableExtension(screen->glx_enable_bits,
-                                 "GLX_MESA_copy_sub_buffer");
-
-            LogMessage(X_INFO, "AIGLX: enabled GLX_MESA_copy_sub_buffer\n");
-        }
-#endif
-
-#ifdef __DRI_SWAP_CONTROL
-        if (strcmp(extensions[i]->name, __DRI_SWAP_CONTROL) == 0) {
-            screen->swapControl = (__DRIswapControlExtension *) extensions[i];
-            __glXEnableExtension(screen->glx_enable_bits,
-                                 "GLX_SGI_swap_control");
-            __glXEnableExtension(screen->glx_enable_bits,
-                                 "GLX_MESA_swap_control");
-
-            LogMessage(X_INFO,
-                       "AIGLX: enabled GLX_SGI_swap_control and GLX_MESA_swap_control\n");
-        }
-#endif
-
-#ifdef __DRI_TEX_OFFSET
-        if (strcmp(extensions[i]->name, __DRI_TEX_OFFSET) == 0) {
-            screen->texOffset = (__DRItexOffsetExtension *) extensions[i];
-            LogMessage(X_INFO,
-                       "AIGLX: enabled GLX_texture_from_pixmap with driver support\n");
-        }
-#endif
-        /* Ignore unknown extensions */
-    }
-}
-
-static __GLXscreen *
-__glXDRIscreenProbe(ScreenPtr pScreen)
-{
-    drm_handle_t hSAREA;
-    drmAddress pSAREA = NULL;
-    char *BusID;
-    __DRIversion ddx_version;
-    __DRIversion dri_version;
-    __DRIversion drm_version;
-    __DRIframebuffer framebuffer;
-    int fd = -1;
-    int status;
-    drm_magic_t magic;
-    drmVersionPtr version;
-    int newlyopened;
-    char *driverName;
-    drm_handle_t hFB;
-    int junk;
-    __GLXDRIscreen *screen;
-    Bool isCapable;
-    size_t buffer_size;
-    ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
-
-    if (!xf86LoaderCheckSymbol("DRIQueryDirectRenderingCapable") ||
-        !DRIQueryDirectRenderingCapable(pScreen, &isCapable) || !isCapable) {
-        LogMessage(X_INFO,
-                   "AIGLX: Screen %d is not DRI capable\n", pScreen->myNum);
-        return NULL;
-    }
-
-    screen = calloc(1, sizeof *screen);
-    if (screen == NULL)
-        return NULL;
-
-    screen->base.destroy = __glXDRIscreenDestroy;
-    screen->base.createContext = __glXDRIscreenCreateContext;
-    screen->base.createDrawable = __glXDRIscreenCreateDrawable;
-    screen->base.swapInterval = __glXDRIdrawableSwapInterval;
-    screen->base.pScreen = pScreen;
-
-    __glXInitExtensionEnableBits(screen->glx_enable_bits);
-
-    /* DRI protocol version. */
-    dri_version.major = XF86DRI_MAJOR_VERSION;
-    dri_version.minor = XF86DRI_MINOR_VERSION;
-    dri_version.patch = XF86DRI_PATCH_VERSION;
-
-    if (!DRIOpenConnection(pScreen, &hSAREA, &BusID)) {
-        LogMessage(X_ERROR, "AIGLX error: DRIOpenConnection failed\n");
-        goto handle_error;
-    }
-
-    fd = drmOpenOnce(NULL, BusID, &newlyopened);
-
-    if (fd < 0) {
-        LogMessage(X_ERROR, "AIGLX error: drmOpenOnce failed (%s)\n",
-                   strerror(-fd));
-        goto handle_error;
-    }
-
-    if (drmGetMagic(fd, &magic)) {
-        LogMessage(X_ERROR, "AIGLX error: drmGetMagic failed\n");
-        goto handle_error;
-    }
-
-    version = drmGetVersion(fd);
-    if (version) {
-        drm_version.major = version->version_major;
-        drm_version.minor = version->version_minor;
-        drm_version.patch = version->version_patchlevel;
-        drmFreeVersion(version);
-    }
-    else {
-        drm_version.major = -1;
-        drm_version.minor = -1;
-        drm_version.patch = -1;
-    }
-
-    if (newlyopened && !DRIAuthConnection(pScreen, magic)) {
-        LogMessage(X_ERROR, "AIGLX error: DRIAuthConnection failed\n");
-        goto handle_error;
-    }
-
-    /* Get device name (like "tdfx") and the ddx version numbers.
-     * We'll check the version in each DRI driver's "createNewScreen"
-     * function. */
-    if (!DRIGetClientDriverName(pScreen,
-                                &ddx_version.major,
-                                &ddx_version.minor,
-                                &ddx_version.patch, &driverName)) {
-        LogMessage(X_ERROR, "AIGLX error: DRIGetClientDriverName failed\n");
-        goto handle_error;
-    }
-
-    screen->driver = glxProbeDriver(driverName,
-                                    (void **) &screen->core,
-                                    __DRI_CORE, __DRI_CORE_VERSION,
-                                    (void **) &screen->legacy,
-                                    __DRI_LEGACY, __DRI_LEGACY_VERSION);
-    if (screen->driver == NULL) {
-        goto handle_error;
-    }
-
-    /*
-     * Get device-specific info.  pDevPriv will point to a struct
-     * (such as DRIRADEONRec in xfree86/driver/ati/radeon_dri.h) that
-     * has information about the screen size, depth, pitch, ancilliary
-     * buffers, DRM mmap handles, etc.
-     */
-    if (!DRIGetDeviceInfo(pScreen, &hFB, &junk,
-                          &framebuffer.size, &framebuffer.stride,
-                          &framebuffer.dev_priv_size, &framebuffer.dev_priv)) {
-        LogMessage(X_ERROR, "AIGLX error: XF86DRIGetDeviceInfo failed\n");
-        goto handle_error;
-    }
-
-    framebuffer.width = pScreen->width;
-    framebuffer.height = pScreen->height;
-
-    /* Map the framebuffer region. */
-    status = drmMap(fd, hFB, framebuffer.size,
-                    (drmAddressPtr) & framebuffer.base);
-    if (status != 0) {
-        LogMessage(X_ERROR, "AIGLX error: drmMap of framebuffer failed (%s)\n",
-                   strerror(-status));
-        goto handle_error;
-    }
-
-    /* Map the SAREA region.  Further mmap regions may be setup in
-     * each DRI driver's "createNewScreen" function.
-     */
-    status = drmMap(fd, hSAREA, SAREA_MAX, &pSAREA);
-    if (status != 0) {
-        LogMessage(X_ERROR, "AIGLX error: drmMap of SAREA failed (%s)\n",
-                   strerror(-status));
-        goto handle_error;
-    }
-
-    screen->driScreen =
-        (*screen->legacy->createNewScreen) (pScreen->myNum,
-                                            &ddx_version,
-                                            &dri_version,
-                                            &drm_version,
-                                            &framebuffer,
-                                            pSAREA,
-                                            fd,
-                                            loader_extensions,
-                                            &screen->driConfigs, screen);
-
-    if (screen->driScreen == NULL) {
-        LogMessage(X_ERROR, "AIGLX error: Calling driver entry point failed\n");
-        goto handle_error;
-    }
-
-    screen->base.fbconfigs = glxConvertConfigs(screen->core,
-                                               screen->driConfigs,
-                                               GLX_WINDOW_BIT);
-
-    initializeExtensions(screen);
-
-    DRIGetTexOffsetFuncs(pScreen, &screen->texOffsetStart,
-                         &screen->texOffsetFinish);
-
-    __glXScreenInit(&screen->base, pScreen);
-
-    /* The first call simply determines the length of the extension string.
-     * This allows us to allocate some memory to hold the extension string,
-     * but it requires that we call __glXGetExtensionString a second time.
-     */
-    buffer_size = __glXGetExtensionString(screen->glx_enable_bits, NULL);
-    if (buffer_size > 0) {
-        free(screen->base.GLXextensions);
-
-        screen->base.GLXextensions = xnfalloc(buffer_size);
-        (void) __glXGetExtensionString(screen->glx_enable_bits,
-                                       screen->base.GLXextensions);
-    }
-
-    __glXsetEnterLeaveServerFuncs(__glXDRIenterServer, __glXDRIleaveServer);
-
-    screen->enterVT = pScrn->EnterVT;
-    pScrn->EnterVT = glxDRIEnterVT;
-    screen->leaveVT = pScrn->LeaveVT;
-    pScrn->LeaveVT = glxDRILeaveVT;
-
-    LogMessage(X_INFO, "AIGLX: Loaded and initialized %s\n", driverName);
-
-    return &screen->base;
-
- handle_error:
-    if (pSAREA != NULL)
-        drmUnmap(pSAREA, SAREA_MAX);
-
-    if (framebuffer.base != NULL)
-        drmUnmap((drmAddress) framebuffer.base, framebuffer.size);
-
-    if (fd >= 0)
-        drmCloseOnce(fd);
-
-    DRICloseConnection(pScreen);
-
-    if (screen->driver)
-        dlclose(screen->driver);
-
-    free(screen);
-
-    LogMessage(X_ERROR, "AIGLX: reverting to software rendering\n");
-
-    return NULL;
-}
-
-_X_EXPORT __GLXprovider __glXDRIProvider = {
-    __glXDRIscreenProbe,
-    "DRI",
-    NULL
-};
old mode 100755 (executable)
new mode 100644 (file)
index bce1bfa..c756bf5
 #include "glxdricommon.h"
 #include <GL/glxtokens.h>
 
-#include "glapitable.h"
-#include "glapi.h"
-#include "glthread.h"
-#include "dispatch.h"
 #include "extension_string.h"
 
 typedef struct __GLXDRIscreen __GLXDRIscreen;
 typedef struct __GLXDRIcontext __GLXDRIcontext;
 typedef struct __GLXDRIdrawable __GLXDRIdrawable;
 
-
-#ifdef __DRI2_ROBUSTNESS
 #define ALL_DRI_CTX_FLAGS (__DRI_CTX_FLAG_DEBUG                         \
                            | __DRI_CTX_FLAG_FORWARD_COMPATIBLE          \
                            | __DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS)
-#else
-#define ALL_DRI_CTX_FLAGS (__DRI_CTX_FLAG_DEBUG                         \
-                           | __DRI_CTX_FLAG_FORWARD_COMPATIBLE)
-#endif
 
 struct __GLXDRIscreen {
     __GLXscreen base;
@@ -125,55 +115,54 @@ __glXDRIdrawableDestroy(__GLXdrawable * drawable)
 }
 
 static void
-__glXDRIdrawableCopySubBuffer(__GLXdrawable * drawable,
-                              int x, int y, int w, int h)
+copy_box(__GLXdrawable * drawable,
+         int dst, int src,
+         int x, int y, int w, int h)
 {
-    __GLXDRIdrawable *private = (__GLXDRIdrawable *) drawable;
     BoxRec box;
     RegionRec region;
+    __GLXcontext *cx = lastGLContext;
 
     box.x1 = x;
-    box.y1 = private->height - y - h;
+    box.y1 = y;
     box.x2 = x + w;
-    box.y2 = private->height - y;
+    box.y2 = y + h;
     RegionInit(&region, &box, 0);
 
-    DRI2CopyRegion(drawable->pDraw, &region,
-                   DRI2BufferFrontLeft, DRI2BufferBackLeft);
+    DRI2CopyRegion(drawable->pDraw, &region, dst, src);
+    if (cx != lastGLContext) {
+        lastGLContext = cx;
+        cx->makeCurrent(cx);
+    }
 }
 
 static void
-__glXDRIdrawableWaitX(__GLXdrawable * drawable)
+__glXDRIdrawableCopySubBuffer(__GLXdrawable * drawable,
+                              int x, int y, int w, int h)
 {
     __GLXDRIdrawable *private = (__GLXDRIdrawable *) drawable;
-    BoxRec box;
-    RegionRec region;
 
-    box.x1 = 0;
-    box.y1 = 0;
-    box.x2 = private->width;
-    box.y2 = private->height;
-    RegionInit(&region, &box, 0);
+    copy_box(drawable, x, private->height - y - h,
+             w, h,
+             DRI2BufferFrontLeft, DRI2BufferBackLeft);
+}
+
+static void
+__glXDRIdrawableWaitX(__GLXdrawable * drawable)
+{
+    __GLXDRIdrawable *private = (__GLXDRIdrawable *) drawable;
 
-    DRI2CopyRegion(drawable->pDraw, &region,
-                   DRI2BufferFakeFrontLeft, DRI2BufferFrontLeft);
+    copy_box(drawable, DRI2BufferFakeFrontLeft, DRI2BufferFrontLeft,
+             0, 0, private->width, private->height);
 }
 
 static void
 __glXDRIdrawableWaitGL(__GLXdrawable * drawable)
 {
     __GLXDRIdrawable *private = (__GLXDRIdrawable *) drawable;
-    BoxRec box;
-    RegionRec region;
-
-    box.x1 = 0;
-    box.y1 = 0;
-    box.x2 = private->width;
-    box.y2 = private->height;
-    RegionInit(&region, &box, 0);
 
-    DRI2CopyRegion(drawable->pDraw, &region,
-                   DRI2BufferFrontLeft, DRI2BufferFakeFrontLeft);
+    copy_box(drawable, DRI2BufferFrontLeft, DRI2BufferFakeFrontLeft,
+             0, 0, private->width, private->height);
 }
 
 static void
@@ -181,36 +170,25 @@ __glXdriSwapEvent(ClientPtr client, void *data, int type, CARD64 ust,
                   CARD64 msc, CARD32 sbc)
 {
     __GLXdrawable *drawable = data;
-    xGLXBufferSwapComplete2 wire =  {
-        .type = __glXEventBase + GLX_BufferSwapComplete
-    };
-
-    if (!(drawable->eventMask & GLX_BUFFER_SWAP_COMPLETE_INTEL_MASK))
-        return;
-
+    int glx_type;
     switch (type) {
     case DRI2_EXCHANGE_COMPLETE:
-        wire.event_type = GLX_EXCHANGE_COMPLETE_INTEL;
+        glx_type = GLX_EXCHANGE_COMPLETE_INTEL;
         break;
+    default:
+        /* unknown swap completion type,
+         * BLIT is a reasonable default, so
+         * fall through ...
+         */
     case DRI2_BLIT_COMPLETE:
-        wire.event_type = GLX_BLIT_COMPLETE_INTEL;
+        glx_type = GLX_BLIT_COMPLETE_INTEL;
         break;
     case DRI2_FLIP_COMPLETE:
-        wire.event_type = GLX_FLIP_COMPLETE_INTEL;
-        break;
-    default:
-        /* unknown swap completion type */
-        wire.event_type = 0;
+        glx_type = GLX_FLIP_COMPLETE_INTEL;
         break;
     }
-    wire.drawable = drawable->drawId;
-    wire.ust_hi = ust >> 32;
-    wire.ust_lo = ust & 0xffffffff;
-    wire.msc_hi = msc >> 32;
-    wire.msc_lo = msc & 0xffffffff;
-    wire.sbc = sbc;
-
-    WriteEventsToClient(client, 1, (xEvent *) &wire);
+    
+    __glXsendSwapEvent(drawable, glx_type, ust, msc, sbc);
 }
 
 /*
@@ -225,31 +203,37 @@ __glXDRIdrawableSwapBuffers(ClientPtr client, __GLXdrawable * drawable)
     __GLXDRIdrawable *priv = (__GLXDRIdrawable *) drawable;
     __GLXDRIscreen *screen = priv->screen;
     CARD64 unused;
+    __GLXcontext *cx = lastGLContext;
+    int status;
 
-#if __DRI2_FLUSH_VERSION >= 3
     if (screen->flush) {
         (*screen->flush->flush) (priv->driDrawable);
         (*screen->flush->invalidate) (priv->driDrawable);
     }
-#else
-    if (screen->flush)
-        (*screen->flush->flushInvalidate) (priv->driDrawable);
-#endif
 
-    if (DRI2SwapBuffers(client, drawable->pDraw, 0, 0, 0, &unused,
-                        __glXdriSwapEvent, drawable) != Success)
-        return FALSE;
+    status = DRI2SwapBuffers(client, drawable->pDraw, 0, 0, 0, &unused,
+                             __glXdriSwapEvent, drawable);
+    if (cx != lastGLContext) {
+        lastGLContext = cx;
+        cx->makeCurrent(cx);
+    }
 
-    return TRUE;
+    return status == Success;
 }
 
 static int
 __glXDRIdrawableSwapInterval(__GLXdrawable * drawable, int interval)
 {
+    __GLXcontext *cx = lastGLContext;
+
     if (interval <= 0)          /* || interval > BIGNUM? */
         return GLX_BAD_VALUE;
 
     DRI2SwapInterval(drawable->pDraw, interval);
+    if (cx != lastGLContext) {
+        lastGLContext = cx;
+        cx->makeCurrent(cx);
+    }
 
     return 0;
 }
@@ -302,7 +286,16 @@ static Bool
 __glXDRIcontextWait(__GLXcontext * baseContext,
                     __GLXclientState * cl, int *error)
 {
-    if (DRI2WaitSwap(cl->client, baseContext->drawPriv->pDraw)) {
+    __GLXcontext *cx = lastGLContext;
+    Bool ret;
+
+    ret = DRI2WaitSwap(cl->client, baseContext->drawPriv->pDraw);
+    if (cx != lastGLContext) {
+        lastGLContext = cx;
+        cx->makeCurrent(cx);
+    }
+
+    if (ret) {
         *error = cl->client->noClientException;
         return TRUE;
     }
@@ -310,8 +303,6 @@ __glXDRIcontextWait(__GLXcontext * baseContext,
     return FALSE;
 }
 
-#ifdef __DRI_TEX_BUFFER
-
 static int
 __glXDRIbindTexImage(__GLXcontext * baseContext,
                      int buffer, __GLXdrawable * glxPixmap)
@@ -323,14 +314,12 @@ __glXDRIbindTexImage(__GLXcontext * baseContext,
     if (texBuffer == NULL)
         return Success;
 
-#if __DRI_TEX_BUFFER_VERSION >= 2
     if (texBuffer->base.version >= 2 && texBuffer->setTexBuffer2 != NULL) {
         (*texBuffer->setTexBuffer2) (context->driContext,
                                      glxPixmap->target,
                                      glxPixmap->format, drawable->driDrawable);
     }
     else
-#endif
     {
         texBuffer->setTexBuffer(context->driContext,
                                 glxPixmap->target, drawable->driDrawable);
@@ -347,24 +336,6 @@ __glXDRIreleaseTexImage(__GLXcontext * baseContext,
     return Success;
 }
 
-#else
-
-static int
-__glXDRIbindTexImage(__GLXcontext * baseContext,
-                     int buffer, __GLXdrawable * glxPixmap)
-{
-    return Success;
-}
-
-static int
-__glXDRIreleaseTexImage(__GLXcontext * baseContext,
-                        int buffer, __GLXdrawable * pixmap)
-{
-    return Success;
-}
-
-#endif
-
 static __GLXtextureFromPixmap __glXDRItextureFromPixmap = {
     __glXDRIbindTexImage,
     __glXDRIreleaseTexImage
@@ -375,6 +346,7 @@ __glXDRIscreenDestroy(__GLXscreen * baseScreen)
 {
     int i;
 
+    ScrnInfoPtr pScrn = xf86ScreenToScrn(baseScreen->pScreen);
     __GLXDRIscreen *screen = (__GLXDRIscreen *) baseScreen;
 
     (*screen->core->destroyScreen) (screen->driScreen);
@@ -389,6 +361,9 @@ __glXDRIscreenDestroy(__GLXscreen * baseScreen)
         free(screen->driConfigs);
     }
 
+    pScrn->EnterVT = screen->enterVT;
+    pScrn->LeaveVT = screen->leaveVT;
+
     free(screen);
 }
 
@@ -410,11 +385,7 @@ dri2_convert_glx_attribs(__GLXDRIscreen *screen, unsigned num_attribs,
 
     *major_ver = 1;
     *minor_ver = 0;
-#ifdef __DRI2_ROBUSTNESS
     *reset = __DRI_CTX_RESET_NO_NOTIFICATION;
-#else
-    (void) reset;
-#endif
 
     for (i = 0; i < num_attribs; i++) {
         switch (attribs[i * 2]) {
@@ -445,7 +416,6 @@ dri2_convert_glx_attribs(__GLXDRIscreen *screen, unsigned num_attribs,
                 return False;
             }
             break;
-#ifdef __DRI2_ROBUSTNESS
         case GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB:
             if (screen->dri2->base.version >= 4) {
                 *error = BadValue;
@@ -464,7 +434,6 @@ dri2_convert_glx_attribs(__GLXDRIscreen *screen, unsigned num_attribs,
                 return False;
             }
             break;
-#endif
         default:
             /* If an unknown attribute is received, fail.
              */
@@ -505,16 +474,15 @@ create_driver_context(__GLXDRIcontext * context,
 {
     context->driContext = NULL;
 
-#if __DRI_DRI2_VERSION >= 3
     if (screen->dri2->base.version >= 3) {
         uint32_t ctx_attribs[3 * 2];
         unsigned num_ctx_attribs = 0;
         unsigned dri_err = 0;
         unsigned major_ver;
         unsigned minor_ver;
-        uint32_t flags;
+        uint32_t flags = 0;
         int reset;
-        int api;
+        int api = __DRI_API_OPENGL;
 
         if (num_attribs != 0) {
             if (!dri2_convert_glx_attribs(screen, num_attribs, attribs,
@@ -537,13 +505,11 @@ create_driver_context(__GLXDRIcontext * context,
                 ctx_attribs[num_ctx_attribs++] = flags;
             }
 
-#ifdef __DRI2_ROBUSTNESS
             if (reset != __DRI_CTX_RESET_NO_NOTIFICATION) {
                 ctx_attribs[num_ctx_attribs++] =
                     __DRI_CTX_ATTRIB_RESET_STRATEGY;
                 ctx_attribs[num_ctx_attribs++] = reset;
             }
-#endif
         }
 
         context->driContext =
@@ -579,7 +545,6 @@ create_driver_context(__GLXDRIcontext * context,
 
         return;
     }
-#endif
 
     if (num_attribs != 0) {
         *error = BadValue;
@@ -637,13 +602,11 @@ __glXDRIscreenCreateContext(__GLXscreen * baseScreen,
 static void
 __glXDRIinvalidateBuffers(DrawablePtr pDraw, void *priv, XID id)
 {
-#if __DRI2_FLUSH_VERSION >= 3
     __GLXDRIdrawable *private = priv;
     __GLXDRIscreen *screen = private->screen;
 
     if (screen->flush)
         (*screen->flush->invalidate) (private->driDrawable);
-#endif
 }
 
 static __GLXdrawable *
@@ -656,6 +619,8 @@ __glXDRIscreenCreateDrawable(ClientPtr client,
     __GLXDRIscreen *driScreen = (__GLXDRIscreen *) screen;
     __GLXDRIconfig *config = (__GLXDRIconfig *) glxConfig;
     __GLXDRIdrawable *private;
+    __GLXcontext *cx = lastGLContext;
+    Bool ret;
 
     private = calloc(1, sizeof *private);
     if (private == NULL)
@@ -674,9 +639,15 @@ __glXDRIscreenCreateDrawable(ClientPtr client,
     private->base.waitGL = __glXDRIdrawableWaitGL;
     private->base.waitX = __glXDRIdrawableWaitX;
 
-    if (DRI2CreateDrawable2(client, pDraw, drawId,
-                            __glXDRIinvalidateBuffers, private,
-                            &private->dri2_id)) {
+    ret = DRI2CreateDrawable2(client, pDraw, drawId,
+                              __glXDRIinvalidateBuffers, private,
+                              &private->dri2_id);
+    if (cx != lastGLContext) {
+        lastGLContext = cx;
+        cx->makeCurrent(cx);
+    }
+
+    if (ret) {
         free(private);
         return NULL;
     }
@@ -698,9 +669,22 @@ dri2GetBuffers(__DRIdrawable * driDrawable,
     DRI2BufferPtr *buffers;
     int i;
     int j;
+    __GLXcontext *cx = lastGLContext;
 
     buffers = DRI2GetBuffers(private->base.pDraw,
                              width, height, attachments, count, out_count);
+    if (cx != lastGLContext) {
+        lastGLContext = cx;
+        cx->makeCurrent(cx);
+
+        /* If DRI2GetBuffers() changed the GL context, it may also have
+         * invalidated the DRI2 buffers, so let's get them again
+         */
+        buffers = DRI2GetBuffers(private->base.pDraw,
+                                 width, height, attachments, count, out_count);
+        assert(lastGLContext == cx);
+    }
+
     if (*out_count > MAX_DRAWABLE_BUFFERS) {
         *out_count = 0;
         return NULL;
@@ -742,10 +726,24 @@ dri2GetBuffersWithFormat(__DRIdrawable * driDrawable,
     DRI2BufferPtr *buffers;
     int i;
     int j = 0;
+    __GLXcontext *cx = lastGLContext;
 
     buffers = DRI2GetBuffersWithFormat(private->base.pDraw,
                                        width, height, attachments, count,
                                        out_count);
+    if (cx != lastGLContext) {
+        lastGLContext = cx;
+        cx->makeCurrent(cx);
+
+        /* If DRI2GetBuffersWithFormat() changed the GL context, it may also have
+         * invalidated the DRI2 buffers, so let's get them again
+         */
+        buffers = DRI2GetBuffersWithFormat(private->base.pDraw,
+                                           width, height, attachments, count,
+                                           out_count);
+        assert(lastGLContext == cx);
+    }
+
     if (*out_count > MAX_DRAWABLE_BUFFERS) {
         *out_count = 0;
         return NULL;
@@ -784,24 +782,20 @@ dri2FlushFrontBuffer(__DRIdrawable * driDrawable, void *loaderPrivate)
 }
 
 static const __DRIdri2LoaderExtension loaderExtension = {
-    {__DRI_DRI2_LOADER, __DRI_DRI2_LOADER_VERSION},
+    {__DRI_DRI2_LOADER, 3},
     dri2GetBuffers,
     dri2FlushFrontBuffer,
     dri2GetBuffersWithFormat,
 };
 
-#ifdef __DRI_USE_INVALIDATE
 static const __DRIuseInvalidateExtension dri2UseInvalidate = {
-    {__DRI_USE_INVALIDATE, __DRI_USE_INVALIDATE_VERSION}
+    {__DRI_USE_INVALIDATE, 1}
 };
-#endif
 
 static const __DRIextension *loader_extensions[] = {
     &systemTimeExtension.base,
     &loaderExtension.base,
-#ifdef __DRI_USE_INVALIDATE
     &dri2UseInvalidate.base,
-#endif
     NULL
 };
 
@@ -835,7 +829,7 @@ glxDRILeaveVT(ScrnInfoPtr scrn)
     __GLXDRIscreen *screen = (__GLXDRIscreen *)
         glxGetScreen(xf86ScrnToScreen(scrn));
 
-    LogMessage(X_INFO, "AIGLX: Suspending AIGLX clients for VT switch\n");
+    LogMessageVerbSigSafe(X_INFO, -1, "AIGLX: Suspending AIGLX clients for VT switch\n");
 
     glxSuspendClients();
 
@@ -845,6 +839,11 @@ glxDRILeaveVT(ScrnInfoPtr scrn)
     scrn->LeaveVT = glxDRILeaveVT;
 }
 
+/**
+ * Initialize extension flags in glx_enable_bits when a new screen is created
+ *
+ * @param screen The screen where glx_enable_bits are to be set.
+ */
 static void
 initializeExtensions(__GLXDRIscreen * screen)
 {
@@ -857,10 +856,6 @@ initializeExtensions(__GLXDRIscreen * screen)
     __glXEnableExtension(screen->glx_enable_bits, "GLX_MESA_copy_sub_buffer");
     LogMessage(X_INFO, "AIGLX: enabled GLX_MESA_copy_sub_buffer\n");
 
-    __glXEnableExtension(screen->glx_enable_bits, "GLX_INTEL_swap_event");
-    LogMessage(X_INFO, "AIGLX: enabled GLX_INTEL_swap_event\n");
-
-#if __DRI_DRI2_VERSION >= 3
     if (screen->dri2->base.version >= 3) {
         __glXEnableExtension(screen->glx_enable_bits,
                              "GLX_ARB_create_context");
@@ -873,42 +868,49 @@ initializeExtensions(__GLXDRIscreen * screen)
         LogMessage(X_INFO,
                    "AIGLX: enabled GLX_EXT_create_context_es2_profile\n");
     }
-#endif
 
     if (DRI2HasSwapControl(pScreen)) {
+        __glXEnableExtension(screen->glx_enable_bits, "GLX_INTEL_swap_event");
         __glXEnableExtension(screen->glx_enable_bits, "GLX_SGI_swap_control");
         __glXEnableExtension(screen->glx_enable_bits, "GLX_MESA_swap_control");
+        LogMessage(X_INFO, "AIGLX: enabled GLX_INTEL_swap_event\n");
         LogMessage(X_INFO,
                    "AIGLX: enabled GLX_SGI_swap_control and GLX_MESA_swap_control\n");
     }
 
+    /* enable EXT_framebuffer_sRGB extension (even if there are no sRGB capable fbconfigs) */
+    {
+        __glXEnableExtension(screen->glx_enable_bits,
+                 "GLX_EXT_framebuffer_sRGB");
+        LogMessage(X_INFO, "AIGLX: enabled GLX_EXT_framebuffer_sRGB\n");
+    }
+
+    /* enable ARB_fbconfig_float extension (even if there are no float fbconfigs) */
+    {
+        __glXEnableExtension(screen->glx_enable_bits, "GLX_ARB_fbconfig_float");
+        LogMessage(X_INFO, "AIGLX: enabled GLX_ARB_fbconfig_float\n");
+    }
+
     for (i = 0; extensions[i]; i++) {
-#ifdef __DRI_READ_DRAWABLE
         if (strcmp(extensions[i]->name, __DRI_READ_DRAWABLE) == 0) {
             __glXEnableExtension(screen->glx_enable_bits,
                                  "GLX_SGI_make_current_read");
 
             LogMessage(X_INFO, "AIGLX: enabled GLX_SGI_make_current_read\n");
         }
-#endif
 
-#ifdef __DRI_TEX_BUFFER
         if (strcmp(extensions[i]->name, __DRI_TEX_BUFFER) == 0) {
             screen->texBuffer = (const __DRItexBufferExtension *) extensions[i];
             /* GLX_EXT_texture_from_pixmap is always enabled. */
             LogMessage(X_INFO,
                        "AIGLX: GLX_EXT_texture_from_pixmap backed by buffer objects\n");
         }
-#endif
 
-#ifdef __DRI2_FLUSH
         if (strcmp(extensions[i]->name, __DRI2_FLUSH) == 0 &&
             extensions[i]->version >= 3) {
             screen->flush = (__DRI2flushExtension *) extensions[i];
         }
-#endif
 
-#ifdef __DRI2_ROBUSTNESS
         if (strcmp(extensions[i]->name, __DRI2_ROBUSTNESS) == 0 &&
             screen->dri2->base.version >= 3) {
             __glXEnableExtension(screen->glx_enable_bits,
@@ -916,12 +918,14 @@ initializeExtensions(__GLXDRIscreen * screen)
             LogMessage(X_INFO,
                        "AIGLX: enabled GLX_ARB_create_context_robustness\n");
         }
-#endif
 
         /* Ignore unknown extensions */
     }
 }
 
+/* white lie */
+extern glx_func_ptr glXGetProcAddressARB(const char *);
+
 static __GLXscreen *
 __glXDRIscreenProbe(ScreenPtr pScreen)
 {
@@ -934,12 +938,11 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
     if (screen == NULL)
         return NULL;
 
-    if (!xf86LoaderCheckSymbol("DRI2Connect") ||
-        !DRI2Connect(serverClient, pScreen, DRI2DriverDRI,
+    if (!DRI2Connect(serverClient, pScreen, DRI2DriverDRI,
                      &screen->fd, &driverName, &deviceName)) {
         LogMessage(X_INFO,
                    "AIGLX: Screen %d is not DRI2 capable\n", pScreen->myNum);
-        return NULL;
+        goto handle_error;
     }
 
     screen->base.destroy = __glXDRIscreenDestroy;
@@ -1007,6 +1010,8 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
     screen->leaveVT = pScrn->LeaveVT;
     pScrn->LeaveVT = glxDRILeaveVT;
 
+    __glXsetGetProcAddress(glXGetProcAddressARB);
+
     LogMessage(X_INFO, "AIGLX: Loaded and initialized %s\n", driverName);
 
     return &screen->base;
index c90f380..62cce13 100644 (file)
@@ -36,6 +36,7 @@
 #include <GL/internal/dri_interface.h>
 #include <os.h>
 #include "glxserver.h"
+#include "glxext.h"
 #include "glxcontext.h"
 #include "glxscreens.h"
 #include "glxdricommon.h"
@@ -58,7 +59,7 @@ getUST(int64_t * ust)
 }
 
 const __DRIsystemTimeExtension systemTimeExtension = {
-    {__DRI_SYSTEM_TIME, __DRI_SYSTEM_TIME_VERSION},
+    {__DRI_SYSTEM_TIME, 1},
     getUST,
     NULL,
 };
@@ -105,7 +106,9 @@ __ATTRIB(__DRI_ATTRIB_BUFFER_SIZE, rgbBits),
         __ATTRIB(__DRI_ATTRIB_BIND_TO_TEXTURE_RGB, bindToTextureRgb),
         __ATTRIB(__DRI_ATTRIB_BIND_TO_TEXTURE_RGBA, bindToTextureRgba),
         __ATTRIB(__DRI_ATTRIB_BIND_TO_MIPMAP_TEXTURE, bindToMipmapTexture),
-        __ATTRIB(__DRI_ATTRIB_YINVERTED, yInverted),};
+        __ATTRIB(__DRI_ATTRIB_YINVERTED, yInverted),
+        __ATTRIB(__DRI_ATTRIB_FRAMEBUFFER_SRGB_CAPABLE, sRGBCapable),
+        };
 
 static void
 setScalar(__GLXconfig * config, unsigned int attrib, unsigned int value)
@@ -125,10 +128,11 @@ createModeFromConfig(const __DRIcoreExtension * core,
                      unsigned int visualType, unsigned int drawableType)
 {
     __GLXDRIconfig *config;
+    GLint renderType = 0;
     unsigned int attrib, value;
     int i;
 
-    config = malloc(sizeof *config);
+    config = calloc(1, sizeof *config);
 
     config->driConfig = driConfig;
 
@@ -136,11 +140,14 @@ createModeFromConfig(const __DRIcoreExtension * core,
     while (core->indexConfigAttrib(driConfig, i++, &attrib, &value)) {
         switch (attrib) {
         case __DRI_ATTRIB_RENDER_TYPE:
-            config->config.renderType = 0;
             if (value & __DRI_ATTRIB_RGBA_BIT)
-                config->config.renderType |= GLX_RGBA_BIT;
+                renderType |= GLX_RGBA_BIT;
             if (value & __DRI_ATTRIB_COLOR_INDEX_BIT)
-                config->config.renderType |= GLX_COLOR_INDEX_BIT;
+                renderType |= GLX_COLOR_INDEX_BIT;
+            if (value & __DRI_ATTRIB_FLOAT_BIT)
+                renderType |= GLX_RGBA_FLOAT_BIT_ARB;
+            if (value & __DRI_ATTRIB_UNSIGNED_FLOAT_BIT)
+                renderType |= GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT;
             break;
         case __DRI_ATTRIB_CONFIG_CAVEAT:
             if (value & __DRI_ATTRIB_NON_CONFORMANT_CONFIG)
@@ -169,11 +176,27 @@ createModeFromConfig(const __DRIcoreExtension * core,
     config->config.next = NULL;
     config->config.xRenderable = GL_TRUE;
     config->config.visualType = visualType;
+    config->config.renderType = renderType;
     config->config.drawableType = drawableType;
+    config->config.yInverted = GL_TRUE;
 
     return &config->config;
 }
 
+static Bool
+render_type_is_pbuffer_only(unsigned renderType)
+{
+    /* The GL_ARB_color_buffer_float spec says:
+     *
+     *     "Note that floating point rendering is only supported for
+     *     GLXPbuffer drawables.  The GLX_DRAWABLE_TYPE attribute of the
+     *     GLXFBConfig must have the GLX_PBUFFER_BIT bit set and the
+     *     GLX_RENDER_TYPE attribute must have the GLX_RGBA_FLOAT_BIT set."
+     */
+    return !!(renderType & (__DRI_ATTRIB_UNSIGNED_FLOAT_BIT
+                            | __DRI_ATTRIB_FLOAT_BIT));
+}
+
 __GLXconfig *
 glxConvertConfigs(const __DRIcoreExtension * core,
                   const __DRIconfig ** configs, unsigned int drawableType)
@@ -185,6 +208,14 @@ glxConvertConfigs(const __DRIcoreExtension * core,
     head.next = NULL;
 
     for (i = 0; configs[i]; i++) {
+        unsigned renderType = 0;
+        if (core->getConfigAttrib(configs[i], __DRI_ATTRIB_RENDER_TYPE,
+                                  &renderType)) {
+            if (render_type_is_pbuffer_only(renderType) &&
+                !(drawableType & GLX_PBUFFER_BIT))
+                continue;
+        }
+        /* Add all the others */
         tail->next = createModeFromConfig(core,
                                           configs[i], GLX_TRUE_COLOR,
                                           drawableType);
@@ -195,6 +226,14 @@ glxConvertConfigs(const __DRIcoreExtension * core,
     }
 
     for (i = 0; configs[i]; i++) {
+        unsigned int renderType = 0;
+        if (core->getConfigAttrib(configs[i], __DRI_ATTRIB_RENDER_TYPE,
+                                  &renderType)) {
+            if (render_type_is_pbuffer_only(renderType) &&
+                !(drawableType & GLX_PBUFFER_BIT))
+                continue;
+        }
+        /* Add all the others */
         tail->next = createModeFromConfig(core,
                                           configs[i], GLX_DIRECT_COLOR,
                                           drawableType);
@@ -209,6 +248,14 @@ glxConvertConfigs(const __DRIcoreExtension * core,
 
 static const char dri_driver_path[] = DRI_DRIVER_PATH;
 
+/* Temporary define to allow building without a dri_interface.h from
+ * updated Mesa.  Some day when we don't care about Mesa that old any
+ * more this can be removed.
+ */
+#ifndef __DRI_DRIVER_GET_EXTENSIONS
+#define __DRI_DRIVER_GET_EXTENSIONS "__driDriverGetExtensions"
+#endif
+
 void *
 glxProbeDriver(const char *driverName,
                void **coreExt, const char *coreName, int coreVersion,
@@ -217,7 +264,8 @@ glxProbeDriver(const char *driverName,
     int i;
     void *driver;
     char filename[PATH_MAX];
-    const __DRIextension **extensions;
+    char *get_extensions_name;
+    const __DRIextension **extensions = NULL;
 
     snprintf(filename, sizeof filename, "%s/%s_dri.so",
              dri_driver_path, driverName);
@@ -229,7 +277,18 @@ glxProbeDriver(const char *driverName,
         goto cleanup_failure;
     }
 
-    extensions = dlsym(driver, __DRI_DRIVER_EXTENSIONS);
+    if (asprintf(&get_extensions_name, "%s_%s",
+                 __DRI_DRIVER_GET_EXTENSIONS, driverName) != -1) {
+        const __DRIextension **(*get_extensions)(void);
+
+        get_extensions = dlsym(driver, get_extensions_name);
+        if (get_extensions)
+            extensions = get_extensions();
+        free(get_extensions_name);
+    }
+
+    if (!extensions)
+        extensions = dlsym(driver, __DRI_DRIVER_EXTENSIONS);
     if (extensions == NULL) {
         LogMessage(X_ERROR, "AIGLX error: %s exports no extensions (%s)\n",
                    driverName, dlerror());
index b478398..c30ce9a 100644 (file)
 #include "glxutil.h"
 #include "glxdricommon.h"
 
-#include "glapitable.h"
-#include "glapi.h"
-#include "glthread.h"
-#include "dispatch.h"
 #include "extension_string.h"
 
 /* RTLD_LOCAL is not defined on Cygwin */
@@ -174,8 +170,6 @@ __glXDRIcontextCopy(__GLXcontext * baseDst, __GLXcontext * baseSrc,
                                          src->driContext, mask);
 }
 
-#ifdef __DRI_TEX_BUFFER
-
 static int
 __glXDRIbindTexImage(__GLXcontext * baseContext,
                      int buffer, __GLXdrawable * glxPixmap)
@@ -209,24 +203,6 @@ __glXDRIreleaseTexImage(__GLXcontext * baseContext,
     return Success;
 }
 
-#else
-
-static int
-__glXDRIbindTexImage(__GLXcontext * baseContext,
-                     int buffer, __GLXdrawable * glxPixmap)
-{
-    return Success;
-}
-
-static int
-__glXDRIreleaseTexImage(__GLXcontext * baseContext,
-                        int buffer, __GLXdrawable * pixmap)
-{
-    return Success;
-}
-
-#endif
-
 static __GLXtextureFromPixmap __glXDRItextureFromPixmap = {
     __glXDRIbindTexImage,
     __glXDRIreleaseTexImage
@@ -361,6 +337,7 @@ swrastPutImage(__DRIdrawable * draw, int op,
     __GLXDRIdrawable *drawable = loaderPrivate;
     DrawablePtr pDraw = drawable->base.pDraw;
     GCPtr gc;
+    __GLXcontext *cx = lastGLContext;
 
     switch (op) {
     case __DRI_SWRAST_IMAGE_OP_DRAW:
@@ -376,6 +353,10 @@ swrastPutImage(__DRIdrawable * draw, int op,
     ValidateGC(pDraw, gc);
 
     gc->ops->PutImage(pDraw, gc, pDraw->depth, x, y, w, h, 0, ZPixmap, data);
+    if (cx != lastGLContext) {
+        lastGLContext = cx;
+        cx->makeCurrent(cx);
+    }
 }
 
 static void
@@ -385,12 +366,17 @@ swrastGetImage(__DRIdrawable * draw,
     __GLXDRIdrawable *drawable = loaderPrivate;
     DrawablePtr pDraw = drawable->base.pDraw;
     ScreenPtr pScreen = pDraw->pScreen;
+    __GLXcontext *cx = lastGLContext;
 
     pScreen->GetImage(pDraw, x, y, w, h, ZPixmap, ~0L, data);
+    if (cx != lastGLContext) {
+        lastGLContext = cx;
+        cx->makeCurrent(cx);
+    }
 }
 
 static const __DRIswrastLoaderExtension swrastLoaderExtension = {
-    {__DRI_SWRAST_LOADER, __DRI_SWRAST_LOADER_VERSION},
+    {__DRI_SWRAST_LOADER, 1},
     swrastGetDrawableInfo,
     swrastPutImage,
     swrastGetImage
@@ -411,24 +397,24 @@ initializeExtensions(__GLXDRIscreen * screen)
     extensions = screen->core->getExtensions(screen->driScreen);
 
     for (i = 0; extensions[i]; i++) {
-#ifdef __DRI_COPY_SUB_BUFFER
         if (strcmp(extensions[i]->name, __DRI_COPY_SUB_BUFFER) == 0) {
             screen->copySubBuffer =
                 (const __DRIcopySubBufferExtension *) extensions[i];
             /* GLX_MESA_copy_sub_buffer is always enabled. */
         }
-#endif
 
-#ifdef __DRI_TEX_BUFFER
         if (strcmp(extensions[i]->name, __DRI_TEX_BUFFER) == 0) {
             screen->texBuffer = (const __DRItexBufferExtension *) extensions[i];
             /* GLX_EXT_texture_from_pixmap is always enabled. */
         }
-#endif
+
         /* Ignore unknown extensions */
     }
 }
 
+/* white lie */
+extern glx_func_ptr glXGetProcAddressARB(const char *);
+
 static __GLXscreen *
 __glXDRIscreenProbe(ScreenPtr pScreen)
 {
@@ -447,9 +433,9 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
 
     screen->driver = glxProbeDriver(driverName,
                                     (void **) &screen->core,
-                                    __DRI_CORE, __DRI_CORE_VERSION,
+                                    __DRI_CORE, 1,
                                     (void **) &screen->swrast,
-                                    __DRI_SWRAST, __DRI_SWRAST_VERSION);
+                                    __DRI_SWRAST, 1);
     if (screen->driver == NULL) {
         goto handle_error;
     }
@@ -476,6 +462,8 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
     screen->base.GLXmajor = 1;
     screen->base.GLXminor = 4;
 
+    __glXsetGetProcAddress(glXGetProcAddressARB);
+
     LogMessage(X_INFO, "AIGLX: Loaded and initialized %s\n", driverName);
 
     return &screen->base;
index bc7fe82..c2de3ce 100644 (file)
 #include "indirect_util.h"
 
 /*
-** The last context used by the server.  It is the context that is current
-** from the server's perspective.
-*/
-__GLXcontext *__glXLastContext;
-
-/*
 ** X resources.
 */
 RESTYPE __glXContextRes;
@@ -79,7 +73,7 @@ static int __glXDispatch(ClientPtr);
 static void
 ResetExtension(ExtensionEntry * extEntry)
 {
-    __glXFlushContextCache();
+    lastGLContext = NULL;
 }
 
 /*
@@ -95,16 +89,15 @@ __glXResetLargeCommandStatus(__GLXclientState * cl)
 }
 
 /*
-** This procedure is called when the client who created the context goes
-** away OR when glXDestroyContext is called.  In either case, all we do is
-** flag that the ID is no longer valid, and (maybe) free the context.
-** use.
-*/
+ * This procedure is called when the client who created the context goes away
+ * OR when glXDestroyContext is called.  In either case, all we do is flag that
+ * the ID is no longer valid, and (maybe) free the context.
+ */
 static int
 ContextGone(__GLXcontext * cx, XID id)
 {
     cx->idExists = GL_FALSE;
-    if (!cx->isCurrent) {
+    if (!cx->currentClient) {
         __glXFreeContext(cx);
     }
 
@@ -138,11 +131,11 @@ DrawableGone(__GLXdrawable * glxPriv, XID xid)
 
     for (c = glxAllContexts; c; c = next) {
         next = c->next;
-        if (c->isCurrent && (c->drawPriv == glxPriv || c->readPriv == glxPriv)) {
+        if (c->currentClient &&
+               (c->drawPriv == glxPriv || c->readPriv == glxPriv)) {
+            /* just force a re-bind the next time through */
             (*c->loseCurrent) (c);
-            c->isCurrent = GL_FALSE;
-            if (c == __glXLastContext)
-                __glXFlushContextCache();
+            lastGLContext = NULL;
         }
         if (c->drawPriv == glxPriv)
             c->drawPriv = NULL;
@@ -164,7 +157,7 @@ __glXAddContext(__GLXcontext * cx)
 {
     /* Register this context as a resource.
      */
-    if (!AddResource(cx->id, __glXContextRes, (pointer)cx)) {
+    if (!AddResource(cx->id, __glXContextRes, (void *)cx)) {
        return False;
     }
 
@@ -196,17 +189,17 @@ __glXRemoveFromContextList(__GLXcontext * cx)
 GLboolean
 __glXFreeContext(__GLXcontext * cx)
 {
-    if (cx->idExists || cx->isCurrent)
+    if (cx->idExists || cx->currentClient)
         return GL_FALSE;
 
+    __glXRemoveFromContextList(cx);
+
     free(cx->feedbackBuf);
     free(cx->selectBuf);
-    if (cx == __glXLastContext) {
-        __glXFlushContextCache();
+    if (cx == lastGLContext) {
+        lastGLContext = NULL;
     }
 
-    __glXRemoveFromContextList(cx);
-
     /* We can get here through both regular dispatching from
      * __glXDispatch() or as a callback from the resource manager.  In
      * the latter case we need to lift the DRI lock manually. */
@@ -278,22 +271,30 @@ glxGetClient(ClientPtr pClient)
 }
 
 static void
-glxClientCallback(CallbackListPtr *list, pointer closure, pointer data)
+glxClientCallback(CallbackListPtr *list, void *closure, void *data)
 {
     NewClientInfoRec *clientinfo = (NewClientInfoRec *) data;
     ClientPtr pClient = clientinfo->client;
     __GLXclientState *cl = glxGetClient(pClient);
+    __GLXcontext *c, *next;
 
     switch (pClient->clientState) {
     case ClientStateRunning:
-        /*
-         ** By default, assume that the client supports
-         ** GLX major version 1 minor version 0 protocol.
-         */
         cl->client = pClient;
         break;
 
     case ClientStateGone:
+        /* detach from all current contexts */
+        for (c = glxAllContexts; c; c = next) {
+            next = c->next;
+            if (c->currentClient == pClient) {
+                c->loseCurrent(c);
+                lastGLContext = NULL;
+                c->currentClient = NULL;
+                __glXFreeContext(c);
+            }
+        }
+
         free(cl->returnBuf);
         free(cl->largeCmdBuf);
         free(cl->GLClientextensions);
@@ -315,6 +316,23 @@ GlxPushProvider(__GLXprovider * provider)
     __glXProviderStack = provider;
 }
 
+static Bool
+checkScreenVisuals(void)
+{
+    int i, j;
+
+    for (i = 0; i < screenInfo.numScreens; i++) {
+        ScreenPtr screen = screenInfo.screens[i];
+        for (j = 0; j < screen->numVisuals; j++) {
+            if (screen->visuals[j].class == TrueColor ||
+                screen->visuals[j].class == DirectColor)
+                return True;
+        }
+    }
+
+    return False;
+}
+
 /*
 ** Initialize the GLX extension.
 */
@@ -333,6 +351,10 @@ GlxExtensionInit(void)
         *stack = &__glXDRISWRastProvider;
     }
 
+    /* Mesa requires at least one True/DirectColor visual */
+    if (!checkScreenVisuals())
+        return;
+
     __glXContextRes = CreateNewResourceType((DeleteType) ContextGone,
                                             "GLXContext");
     __glXDrawableRes = CreateNewResourceType((DeleteType) DrawableGone,
@@ -392,16 +414,13 @@ GlxExtensionInit(void)
 
     __glXErrorBase = extEntry->errorBase;
     __glXEventBase = extEntry->eventBase;
+#if PRESENT
+    __glXregisterPresentCompleteNotify();
+#endif
 }
 
 /************************************************************************/
 
-void
-__glXFlushContextCache(void)
-{
-    __glXLastContext = 0;
-}
-
 /*
 ** Make a context the current one for the GL (in this implementation, there
 ** is only one instance of the GL, and we use it to serve all GL clients by
@@ -439,21 +458,22 @@ __glXForceCurrent(__GLXclientState * cl, GLXContextTag tag, int *error)
     if (cx->wait && (*cx->wait) (cx, cl, error))
         return NULL;
 
-    if (cx == __glXLastContext) {
+    if (cx == lastGLContext) {
         /* No need to re-bind */
         return cx;
     }
 
     /* Make this context the current one for the GL. */
     if (!cx->isDirect) {
+        lastGLContext = cx;
         if (!(*cx->makeCurrent) (cx)) {
             /* Bind failed, and set the error code.  Bummer */
+            lastGLContext = NULL;
             cl->client->errorValue = cx->id;
             *error = __glXError(GLXBadContextState);
             return 0;
         }
     }
-    __glXLastContext = cx;
     return cx;
 }
 
@@ -534,6 +554,21 @@ __glXleaveServer(GLboolean rendering)
     glxServerLeaveCount++;
 }
 
+static glx_gpa_proc _get_proc_address;
+
+void
+__glXsetGetProcAddress(glx_gpa_proc get_proc_address)
+{
+    _get_proc_address = get_proc_address;
+}
+
+void *__glGetProcAddress(const char *proc)
+{
+    void *ret = (void *) _get_proc_address(proc);
+
+    return ret ? ret : (void *) NoopDDA;
+}
+
 /*
 ** Top level dispatcher; all commands are executed from here down.
 */
index 9b0978b..3f2dee6 100644 (file)
  * Silicon Graphics, Inc.
  */
 
+/* doing #include <GL/glx.h> & #include <GL/glxext.h> could cause problems
+ * with overlapping definitions, so let's use the easy way
+ */
+#ifndef GLX_RGBA_FLOAT_BIT_ARB
+#define GLX_RGBA_FLOAT_BIT_ARB             0x00000004
+#endif
+#ifndef GLX_RGBA_FLOAT_TYPE_ARB
+#define GLX_RGBA_FLOAT_TYPE_ARB            0x20B9
+#endif
+#ifndef GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT
+#define GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT    0x00000008
+#endif
+#ifndef GLX_RGBA_UNSIGNED_FLOAT_TYPE_EXT
+#define GLX_RGBA_UNSIGNED_FLOAT_TYPE_EXT   0x20B1
+#endif
+
 extern GLboolean __glXFreeContext(__GLXcontext * glxc);
 extern void __glXFlushContextCache(void);
 
index 61d590c..78769f4 100644 (file)
@@ -128,7 +128,6 @@ static const char GLServerExtensions[] =
     "GL_NV_blend_square "
     "GL_NV_depth_clamp "
     "GL_NV_fog_distance "
-    "GL_NV_fragment_program "
     "GL_NV_fragment_program_option "
     "GL_NV_fragment_program2 "
     "GL_NV_light_max_exponent "
@@ -139,9 +138,6 @@ static const char GLServerExtensions[] =
     "GL_NV_texture_env_combine4 "
     "GL_NV_texture_expand_normal "
     "GL_NV_texture_rectangle "
-    "GL_NV_vertex_program "
-    "GL_NV_vertex_program1_1 "
-    "GL_NV_vertex_program2 "
     "GL_NV_vertex_program2_option "
     "GL_NV_vertex_program3 "
     "GL_OES_compressed_paletted_texture "
@@ -154,13 +150,14 @@ static const char GLServerExtensions[] =
     "GL_SGIS_texture_edge_clamp "
     "GL_SGIS_texture_lod "
     "GL_SGIX_depth_texture "
-    "GL_SGIX_shadow " "GL_SGIX_shadow_ambient " "GL_SUN_slice_accum ";
+    "GL_SGIX_shadow "
+    "GL_SGIX_shadow_ambient "
+    "GL_SUN_slice_accum ";
 
 /*
 ** We have made the simplifying assuption that the same extensions are 
 ** supported across all screens in a multi-screen system.
 */
-static char GLXServerVendorName[] = "SGI";
 unsigned glxMajorVersion = SERVER_GLX_MAJOR_VERSION;
 unsigned glxMinorVersion = SERVER_GLX_MINOR_VERSION;
 static char GLXServerExtensions[] =
@@ -169,12 +166,14 @@ static char GLXServerExtensions[] =
     "GLX_EXT_visual_rating "
     "GLX_EXT_import_context "
     "GLX_EXT_texture_from_pixmap "
-    "GLX_OML_swap_method " "GLX_SGI_make_current_read "
+    "GLX_OML_swap_method "
+    "GLX_SGI_make_current_read "
 #ifndef __APPLE__
     "GLX_SGIS_multisample "
 #endif
     "GLX_SGIX_fbconfig "
-    "GLX_SGIX_pbuffer " "GLX_MESA_copy_sub_buffer ";
+    "GLX_SGIX_pbuffer "
+    "GLX_MESA_copy_sub_buffer ";
 
 static Bool
 glxCloseScreen(ScreenPtr pScreen)
@@ -330,7 +329,6 @@ __glXScreenInit(__GLXscreen * pGlxScreen, ScreenPtr pScreen)
 
     pGlxScreen->pScreen = pScreen;
     pGlxScreen->GLextensions = strdup(GLServerExtensions);
-    pGlxScreen->GLXvendor = strdup(GLXServerVendorName);
     pGlxScreen->GLXextensions = strdup(GLXServerExtensions);
 
     /* All GLX providers must support all of the functionality required for at
@@ -420,7 +418,6 @@ __glXScreenInit(__GLXscreen * pGlxScreen, ScreenPtr pScreen)
 void
 __glXScreenDestroy(__GLXscreen * screen)
 {
-    free(screen->GLXvendor);
     free(screen->GLXextensions);
     free(screen->GLextensions);
     free(screen->visuals);
index b29df58..c8119fd 100644 (file)
@@ -54,8 +54,6 @@ struct __GLXconfig {
 
     GLint level;
 
-    GLint pixmapMode;
-
     /* GLX */
     GLint visualID;
     GLint visualType;     /**< One of the GLX X visual types. (i.e., 
@@ -94,14 +92,15 @@ struct __GLXconfig {
     /* OML_swap_method */
     GLint swapMethod;
 
-    GLint screen;
-
     /* EXT_texture_from_pixmap */
     GLint bindToTextureRgb;
     GLint bindToTextureRgba;
     GLint bindToMipmapTexture;
     GLint bindToTextureTargets;
     GLint yInverted;
+
+    /* ARB_framebuffer_sRGB */
+    GLint sRGBCapable;
 };
 
 GLint glxConvertToXVisualType(int visualType);
@@ -142,7 +141,6 @@ struct __GLXscreen {
 
     char *GLextensions;
 
-    char *GLXvendor;
     char *GLXextensions;
 
     /**
index 1021aec..a324b29 100644 (file)
@@ -47,6 +47,7 @@
 #include <scrnintstr.h>
 
 #include <GL/gl.h>
+#include <GL/glext.h>
 #include <GL/glxproto.h>
 
 /*
@@ -83,7 +84,6 @@ void __glXScreenInitVisuals(__GLXscreen * screen);
 /*
 ** The last context used (from the server's persective) is cached.
 */
-extern __GLXcontext *__glXLastContext;
 extern __GLXcontext *__glXForceCurrent(__GLXclientState *, GLXContextTag,
                                        int *);
 
@@ -115,6 +115,20 @@ void __glXleaveServer(GLboolean rendering);
 void glxSuspendClients(void);
 void glxResumeClients(void);
 
+typedef void (*glx_func_ptr)(void);
+typedef glx_func_ptr (*glx_gpa_proc)(const char *);
+void __glXsetGetProcAddress(glx_gpa_proc get_proc_address);
+void *__glGetProcAddress(const char *);
+
+void
+__glXsendSwapEvent(__GLXdrawable *drawable, int type, CARD64 ust,
+                   CARD64 msc, CARD32 sbc);
+
+#if PRESENT
+void
+__glXregisterPresentCompleteNotify(void);
+#endif
+
 /*
 ** State kept per client.
 */
index 0a7623c..329b2e6 100644 (file)
  * SOFTWARE.
  */
 
-#include <X11/Xmd.h>
-#include <GL/gl.h>
-#include <GL/glxproto.h>
 #include <inttypes.h>
+#include "glxserver.h"
 #include "indirect_size.h"
 #include "indirect_size_get.h"
 #include "indirect_dispatch.h"
-#include "glxserver.h"
 #include "glxbyteorder.h"
 #include "indirect_util.h"
 #include "singlesize.h"
-#include "glapi.h"
-#include "glapitable.h"
-#include "glthread.h"
-#include "dispatch.h"
 
 #define __GLX_PAD(x)  (((x) + 3) & ~3)
 
@@ -61,8 +54,7 @@ __glXDisp_NewList(__GLXclientState * cl, GLbyte * pc)
 
     pc += __GLX_SINGLE_HDR_SIZE;
     if (cx != NULL) {
-        CALL_NewList(GET_DISPATCH(), (*(GLuint *) (pc + 0), *(GLenum *) (pc + 4)
-                     ));
+        glNewList(*(GLuint *) (pc + 0), *(GLenum *) (pc + 4));
         error = Success;
     }
 
@@ -78,7 +70,7 @@ __glXDisp_EndList(__GLXclientState * cl, GLbyte * pc)
 
     pc += __GLX_SINGLE_HDR_SIZE;
     if (cx != NULL) {
-        CALL_EndList(GET_DISPATCH(), ());
+        glEndList();
         error = Success;
     }
 
@@ -88,8 +80,7 @@ __glXDisp_EndList(__GLXclientState * cl, GLbyte * pc)
 void
 __glXDisp_CallList(GLbyte * pc)
 {
-    CALL_CallList(GET_DISPATCH(), (*(GLuint *) (pc + 0)
-                  ));
+    glCallList(*(GLuint *) (pc + 0));
 }
 
 void
@@ -101,7 +92,7 @@ __glXDisp_CallLists(GLbyte * pc)
 
     lists = (const GLvoid *) (pc + 8);
 
-    CALL_CallLists(GET_DISPATCH(), (n, type, lists));
+    glCallLists(n, type, lists);
 }
 
 int
@@ -113,9 +104,7 @@ __glXDisp_DeleteLists(__GLXclientState * cl, GLbyte * pc)
 
     pc += __GLX_SINGLE_HDR_SIZE;
     if (cx != NULL) {
-        CALL_DeleteLists(GET_DISPATCH(), (*(GLuint *) (pc + 0),
-                                          *(GLsizei *) (pc + 4)
-                         ));
+        glDeleteLists(*(GLuint *) (pc + 0), *(GLsizei *) (pc + 4));
         error = Success;
     }
 
@@ -133,8 +122,7 @@ __glXDisp_GenLists(__GLXclientState * cl, GLbyte * pc)
     if (cx != NULL) {
         GLuint retval;
 
-        retval = CALL_GenLists(GET_DISPATCH(), (*(GLsizei *) (pc + 0)
-                               ));
+        retval = glGenLists(*(GLsizei *) (pc + 0));
         __glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval);
         error = Success;
     }
@@ -145,15 +133,13 @@ __glXDisp_GenLists(__GLXclientState * cl, GLbyte * pc)
 void
 __glXDisp_ListBase(GLbyte * pc)
 {
-    CALL_ListBase(GET_DISPATCH(), (*(GLuint *) (pc + 0)
-                  ));
+    glListBase(*(GLuint *) (pc + 0));
 }
 
 void
 __glXDisp_Begin(GLbyte * pc)
 {
-    CALL_Begin(GET_DISPATCH(), (*(GLenum *) (pc + 0)
-               ));
+    glBegin(*(GLenum *) (pc + 0));
 }
 
 void
@@ -162,29 +148,23 @@ __glXDisp_Bitmap(GLbyte * pc)
     const GLubyte *const bitmap = (const GLubyte *) ((pc + 44));
     __GLXpixelHeader *const hdr = (__GLXpixelHeader *) (pc);
 
-    CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment));
+    glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst);
+    glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength);
+    glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows);
+    glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels);
+    glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment);
 
-    CALL_Bitmap(GET_DISPATCH(), (*(GLsizei *) (pc + 20),
-                                 *(GLsizei *) (pc + 24),
-                                 *(GLfloat *) (pc + 28),
-                                 *(GLfloat *) (pc + 32),
-                                 *(GLfloat *) (pc + 36),
-                                 *(GLfloat *) (pc + 40), bitmap));
+    glBitmap(*(GLsizei *) (pc + 20),
+             *(GLsizei *) (pc + 24),
+             *(GLfloat *) (pc + 28),
+             *(GLfloat *) (pc + 32),
+             *(GLfloat *) (pc + 36), *(GLfloat *) (pc + 40), bitmap);
 }
 
 void
 __glXDisp_Color3bv(GLbyte * pc)
 {
-    CALL_Color3bv(GET_DISPATCH(), ((const GLbyte *) (pc + 0)
-                  ));
+    glColor3bv((const GLbyte *) (pc + 0));
 }
 
 void
@@ -197,57 +177,49 @@ __glXDisp_Color3dv(GLbyte * pc)
     }
 #endif
 
-    CALL_Color3dv(GET_DISPATCH(), ((const GLdouble *) (pc + 0)
-                  ));
+    glColor3dv((const GLdouble *) (pc + 0));
 }
 
 void
 __glXDisp_Color3fv(GLbyte * pc)
 {
-    CALL_Color3fv(GET_DISPATCH(), ((const GLfloat *) (pc + 0)
-                  ));
+    glColor3fv((const GLfloat *) (pc + 0));
 }
 
 void
 __glXDisp_Color3iv(GLbyte * pc)
 {
-    CALL_Color3iv(GET_DISPATCH(), ((const GLint *) (pc + 0)
-                  ));
+    glColor3iv((const GLint *) (pc + 0));
 }
 
 void
 __glXDisp_Color3sv(GLbyte * pc)
 {
-    CALL_Color3sv(GET_DISPATCH(), ((const GLshort *) (pc + 0)
-                  ));
+    glColor3sv((const GLshort *) (pc + 0));
 }
 
 void
 __glXDisp_Color3ubv(GLbyte * pc)
 {
-    CALL_Color3ubv(GET_DISPATCH(), ((const GLubyte *) (pc + 0)
-                   ));
+    glColor3ubv((const GLubyte *) (pc + 0));
 }
 
 void
 __glXDisp_Color3uiv(GLbyte * pc)
 {
-    CALL_Color3uiv(GET_DISPATCH(), ((const GLuint *) (pc + 0)
-                   ));
+    glColor3uiv((const GLuint *) (pc + 0));
 }
 
 void
 __glXDisp_Color3usv(GLbyte * pc)
 {
-    CALL_Color3usv(GET_DISPATCH(), ((const GLushort *) (pc + 0)
-                   ));
+    glColor3usv((const GLushort *) (pc + 0));
 }
 
 void
 __glXDisp_Color4bv(GLbyte * pc)
 {
-    CALL_Color4bv(GET_DISPATCH(), ((const GLbyte *) (pc + 0)
-                  ));
+    glColor4bv((const GLbyte *) (pc + 0));
 }
 
 void
@@ -260,63 +232,55 @@ __glXDisp_Color4dv(GLbyte * pc)
     }
 #endif
 
-    CALL_Color4dv(GET_DISPATCH(), ((const GLdouble *) (pc + 0)
-                  ));
+    glColor4dv((const GLdouble *) (pc + 0));
 }
 
 void
 __glXDisp_Color4fv(GLbyte * pc)
 {
-    CALL_Color4fv(GET_DISPATCH(), ((const GLfloat *) (pc + 0)
-                  ));
+    glColor4fv((const GLfloat *) (pc + 0));
 }
 
 void
 __glXDisp_Color4iv(GLbyte * pc)
 {
-    CALL_Color4iv(GET_DISPATCH(), ((const GLint *) (pc + 0)
-                  ));
+    glColor4iv((const GLint *) (pc + 0));
 }
 
 void
 __glXDisp_Color4sv(GLbyte * pc)
 {
-    CALL_Color4sv(GET_DISPATCH(), ((const GLshort *) (pc + 0)
-                  ));
+    glColor4sv((const GLshort *) (pc + 0));
 }
 
 void
 __glXDisp_Color4ubv(GLbyte * pc)
 {
-    CALL_Color4ubv(GET_DISPATCH(), ((const GLubyte *) (pc + 0)
-                   ));
+    glColor4ubv((const GLubyte *) (pc + 0));
 }
 
 void
 __glXDisp_Color4uiv(GLbyte * pc)
 {
-    CALL_Color4uiv(GET_DISPATCH(), ((const GLuint *) (pc + 0)
-                   ));
+    glColor4uiv((const GLuint *) (pc + 0));
 }
 
 void
 __glXDisp_Color4usv(GLbyte * pc)
 {
-    CALL_Color4usv(GET_DISPATCH(), ((const GLushort *) (pc + 0)
-                   ));
+    glColor4usv((const GLushort *) (pc + 0));
 }
 
 void
 __glXDisp_EdgeFlagv(GLbyte * pc)
 {
-    CALL_EdgeFlagv(GET_DISPATCH(), ((const GLboolean *) (pc + 0)
-                   ));
+    glEdgeFlagv((const GLboolean *) (pc + 0));
 }
 
 void
 __glXDisp_End(GLbyte * pc)
 {
-    CALL_End(GET_DISPATCH(), ());
+    glEnd();
 }
 
 void
@@ -329,36 +293,31 @@ __glXDisp_Indexdv(GLbyte * pc)
     }
 #endif
 
-    CALL_Indexdv(GET_DISPATCH(), ((const GLdouble *) (pc + 0)
-                 ));
+    glIndexdv((const GLdouble *) (pc + 0));
 }
 
 void
 __glXDisp_Indexfv(GLbyte * pc)
 {
-    CALL_Indexfv(GET_DISPATCH(), ((const GLfloat *) (pc + 0)
-                 ));
+    glIndexfv((const GLfloat *) (pc + 0));
 }
 
 void
 __glXDisp_Indexiv(GLbyte * pc)
 {
-    CALL_Indexiv(GET_DISPATCH(), ((const GLint *) (pc + 0)
-                 ));
+    glIndexiv((const GLint *) (pc + 0));
 }
 
 void
 __glXDisp_Indexsv(GLbyte * pc)
 {
-    CALL_Indexsv(GET_DISPATCH(), ((const GLshort *) (pc + 0)
-                 ));
+    glIndexsv((const GLshort *) (pc + 0));
 }
 
 void
 __glXDisp_Normal3bv(GLbyte * pc)
 {
-    CALL_Normal3bv(GET_DISPATCH(), ((const GLbyte *) (pc + 0)
-                   ));
+    glNormal3bv((const GLbyte *) (pc + 0));
 }
 
 void
@@ -371,29 +330,25 @@ __glXDisp_Normal3dv(GLbyte * pc)
     }
 #endif
 
-    CALL_Normal3dv(GET_DISPATCH(), ((const GLdouble *) (pc + 0)
-                   ));
+    glNormal3dv((const GLdouble *) (pc + 0));
 }
 
 void
 __glXDisp_Normal3fv(GLbyte * pc)
 {
-    CALL_Normal3fv(GET_DISPATCH(), ((const GLfloat *) (pc + 0)
-                   ));
+    glNormal3fv((const GLfloat *) (pc + 0));
 }
 
 void
 __glXDisp_Normal3iv(GLbyte * pc)
 {
-    CALL_Normal3iv(GET_DISPATCH(), ((const GLint *) (pc + 0)
-                   ));
+    glNormal3iv((const GLint *) (pc + 0));
 }
 
 void
 __glXDisp_Normal3sv(GLbyte * pc)
 {
-    CALL_Normal3sv(GET_DISPATCH(), ((const GLshort *) (pc + 0)
-                   ));
+    glNormal3sv((const GLshort *) (pc + 0));
 }
 
 void
@@ -406,29 +361,25 @@ __glXDisp_RasterPos2dv(GLbyte * pc)
     }
 #endif
 
-    CALL_RasterPos2dv(GET_DISPATCH(), ((const GLdouble *) (pc + 0)
-                      ));
+    glRasterPos2dv((const GLdouble *) (pc + 0));
 }
 
 void
 __glXDisp_RasterPos2fv(GLbyte * pc)
 {
-    CALL_RasterPos2fv(GET_DISPATCH(), ((const GLfloat *) (pc + 0)
-                      ));
+    glRasterPos2fv((const GLfloat *) (pc + 0));
 }
 
 void
 __glXDisp_RasterPos2iv(GLbyte * pc)
 {
-    CALL_RasterPos2iv(GET_DISPATCH(), ((const GLint *) (pc + 0)
-                      ));
+    glRasterPos2iv((const GLint *) (pc + 0));
 }
 
 void
 __glXDisp_RasterPos2sv(GLbyte * pc)
 {
-    CALL_RasterPos2sv(GET_DISPATCH(), ((const GLshort *) (pc + 0)
-                      ));
+    glRasterPos2sv((const GLshort *) (pc + 0));
 }
 
 void
@@ -441,29 +392,25 @@ __glXDisp_RasterPos3dv(GLbyte * pc)
     }
 #endif
 
-    CALL_RasterPos3dv(GET_DISPATCH(), ((const GLdouble *) (pc + 0)
-                      ));
+    glRasterPos3dv((const GLdouble *) (pc + 0));
 }
 
 void
 __glXDisp_RasterPos3fv(GLbyte * pc)
 {
-    CALL_RasterPos3fv(GET_DISPATCH(), ((const GLfloat *) (pc + 0)
-                      ));
+    glRasterPos3fv((const GLfloat *) (pc + 0));
 }
 
 void
 __glXDisp_RasterPos3iv(GLbyte * pc)
 {
-    CALL_RasterPos3iv(GET_DISPATCH(), ((const GLint *) (pc + 0)
-                      ));
+    glRasterPos3iv((const GLint *) (pc + 0));
 }
 
 void
 __glXDisp_RasterPos3sv(GLbyte * pc)
 {
-    CALL_RasterPos3sv(GET_DISPATCH(), ((const GLshort *) (pc + 0)
-                      ));
+    glRasterPos3sv((const GLshort *) (pc + 0));
 }
 
 void
@@ -476,29 +423,25 @@ __glXDisp_RasterPos4dv(GLbyte * pc)
     }
 #endif
 
-    CALL_RasterPos4dv(GET_DISPATCH(), ((const GLdouble *) (pc + 0)
-                      ));
+    glRasterPos4dv((const GLdouble *) (pc + 0));
 }
 
 void
 __glXDisp_RasterPos4fv(GLbyte * pc)
 {
-    CALL_RasterPos4fv(GET_DISPATCH(), ((const GLfloat *) (pc + 0)
-                      ));
+    glRasterPos4fv((const GLfloat *) (pc + 0));
 }
 
 void
 __glXDisp_RasterPos4iv(GLbyte * pc)
 {
-    CALL_RasterPos4iv(GET_DISPATCH(), ((const GLint *) (pc + 0)
-                      ));
+    glRasterPos4iv((const GLint *) (pc + 0));
 }
 
 void
 __glXDisp_RasterPos4sv(GLbyte * pc)
 {
-    CALL_RasterPos4sv(GET_DISPATCH(), ((const GLshort *) (pc + 0)
-                      ));
+    glRasterPos4sv((const GLshort *) (pc + 0));
 }
 
 void
@@ -511,33 +454,25 @@ __glXDisp_Rectdv(GLbyte * pc)
     }
 #endif
 
-    CALL_Rectdv(GET_DISPATCH(), ((const GLdouble *) (pc + 0),
-                                 (const GLdouble *) (pc + 16)
-                ));
+    glRectdv((const GLdouble *) (pc + 0), (const GLdouble *) (pc + 16));
 }
 
 void
 __glXDisp_Rectfv(GLbyte * pc)
 {
-    CALL_Rectfv(GET_DISPATCH(), ((const GLfloat *) (pc + 0),
-                                 (const GLfloat *) (pc + 8)
-                ));
+    glRectfv((const GLfloat *) (pc + 0), (const GLfloat *) (pc + 8));
 }
 
 void
 __glXDisp_Rectiv(GLbyte * pc)
 {
-    CALL_Rectiv(GET_DISPATCH(), ((const GLint *) (pc + 0),
-                                 (const GLint *) (pc + 8)
-                ));
+    glRectiv((const GLint *) (pc + 0), (const GLint *) (pc + 8));
 }
 
 void
 __glXDisp_Rectsv(GLbyte * pc)
 {
-    CALL_Rectsv(GET_DISPATCH(), ((const GLshort *) (pc + 0),
-                                 (const GLshort *) (pc + 4)
-                ));
+    glRectsv((const GLshort *) (pc + 0), (const GLshort *) (pc + 4));
 }
 
 void
@@ -550,29 +485,25 @@ __glXDisp_TexCoord1dv(GLbyte * pc)
     }
 #endif
 
-    CALL_TexCoord1dv(GET_DISPATCH(), ((const GLdouble *) (pc + 0)
-                     ));
+    glTexCoord1dv((const GLdouble *) (pc + 0));
 }
 
 void
 __glXDisp_TexCoord1fv(GLbyte * pc)
 {
-    CALL_TexCoord1fv(GET_DISPATCH(), ((const GLfloat *) (pc + 0)
-                     ));
+    glTexCoord1fv((const GLfloat *) (pc + 0));
 }
 
 void
 __glXDisp_TexCoord1iv(GLbyte * pc)
 {
-    CALL_TexCoord1iv(GET_DISPATCH(), ((const GLint *) (pc + 0)
-                     ));
+    glTexCoord1iv((const GLint *) (pc + 0));
 }
 
 void
 __glXDisp_TexCoord1sv(GLbyte * pc)
 {
-    CALL_TexCoord1sv(GET_DISPATCH(), ((const GLshort *) (pc + 0)
-                     ));
+    glTexCoord1sv((const GLshort *) (pc + 0));
 }
 
 void
@@ -585,29 +516,25 @@ __glXDisp_TexCoord2dv(GLbyte * pc)
     }
 #endif
 
-    CALL_TexCoord2dv(GET_DISPATCH(), ((const GLdouble *) (pc + 0)
-                     ));
+    glTexCoord2dv((const GLdouble *) (pc + 0));
 }
 
 void
 __glXDisp_TexCoord2fv(GLbyte * pc)
 {
-    CALL_TexCoord2fv(GET_DISPATCH(), ((const GLfloat *) (pc + 0)
-                     ));
+    glTexCoord2fv((const GLfloat *) (pc + 0));
 }
 
 void
 __glXDisp_TexCoord2iv(GLbyte * pc)
 {
-    CALL_TexCoord2iv(GET_DISPATCH(), ((const GLint *) (pc + 0)
-                     ));
+    glTexCoord2iv((const GLint *) (pc + 0));
 }
 
 void
 __glXDisp_TexCoord2sv(GLbyte * pc)
 {
-    CALL_TexCoord2sv(GET_DISPATCH(), ((const GLshort *) (pc + 0)
-                     ));
+    glTexCoord2sv((const GLshort *) (pc + 0));
 }
 
 void
@@ -620,29 +547,25 @@ __glXDisp_TexCoord3dv(GLbyte * pc)
     }
 #endif
 
-    CALL_TexCoord3dv(GET_DISPATCH(), ((const GLdouble *) (pc + 0)
-                     ));
+    glTexCoord3dv((const GLdouble *) (pc + 0));
 }
 
 void
 __glXDisp_TexCoord3fv(GLbyte * pc)
 {
-    CALL_TexCoord3fv(GET_DISPATCH(), ((const GLfloat *) (pc + 0)
-                     ));
+    glTexCoord3fv((const GLfloat *) (pc + 0));
 }
 
 void
 __glXDisp_TexCoord3iv(GLbyte * pc)
 {
-    CALL_TexCoord3iv(GET_DISPATCH(), ((const GLint *) (pc + 0)
-                     ));
+    glTexCoord3iv((const GLint *) (pc + 0));
 }
 
 void
 __glXDisp_TexCoord3sv(GLbyte * pc)
 {
-    CALL_TexCoord3sv(GET_DISPATCH(), ((const GLshort *) (pc + 0)
-                     ));
+    glTexCoord3sv((const GLshort *) (pc + 0));
 }
 
 void
@@ -655,29 +578,25 @@ __glXDisp_TexCoord4dv(GLbyte * pc)
     }
 #endif
 
-    CALL_TexCoord4dv(GET_DISPATCH(), ((const GLdouble *) (pc + 0)
-                     ));
+    glTexCoord4dv((const GLdouble *) (pc + 0));
 }
 
 void
 __glXDisp_TexCoord4fv(GLbyte * pc)
 {
-    CALL_TexCoord4fv(GET_DISPATCH(), ((const GLfloat *) (pc + 0)
-                     ));
+    glTexCoord4fv((const GLfloat *) (pc + 0));
 }
 
 void
 __glXDisp_TexCoord4iv(GLbyte * pc)
 {
-    CALL_TexCoord4iv(GET_DISPATCH(), ((const GLint *) (pc + 0)
-                     ));
+    glTexCoord4iv((const GLint *) (pc + 0));
 }
 
 void
 __glXDisp_TexCoord4sv(GLbyte * pc)
 {
-    CALL_TexCoord4sv(GET_DISPATCH(), ((const GLshort *) (pc + 0)
-                     ));
+    glTexCoord4sv((const GLshort *) (pc + 0));
 }
 
 void
@@ -690,29 +609,25 @@ __glXDisp_Vertex2dv(GLbyte * pc)
     }
 #endif
 
-    CALL_Vertex2dv(GET_DISPATCH(), ((const GLdouble *) (pc + 0)
-                   ));
+    glVertex2dv((const GLdouble *) (pc + 0));
 }
 
 void
 __glXDisp_Vertex2fv(GLbyte * pc)
 {
-    CALL_Vertex2fv(GET_DISPATCH(), ((const GLfloat *) (pc + 0)
-                   ));
+    glVertex2fv((const GLfloat *) (pc + 0));
 }
 
 void
 __glXDisp_Vertex2iv(GLbyte * pc)
 {
-    CALL_Vertex2iv(GET_DISPATCH(), ((const GLint *) (pc + 0)
-                   ));
+    glVertex2iv((const GLint *) (pc + 0));
 }
 
 void
 __glXDisp_Vertex2sv(GLbyte * pc)
 {
-    CALL_Vertex2sv(GET_DISPATCH(), ((const GLshort *) (pc + 0)
-                   ));
+    glVertex2sv((const GLshort *) (pc + 0));
 }
 
 void
@@ -725,29 +640,25 @@ __glXDisp_Vertex3dv(GLbyte * pc)
     }
 #endif
 
-    CALL_Vertex3dv(GET_DISPATCH(), ((const GLdouble *) (pc + 0)
-                   ));
+    glVertex3dv((const GLdouble *) (pc + 0));
 }
 
 void
 __glXDisp_Vertex3fv(GLbyte * pc)
 {
-    CALL_Vertex3fv(GET_DISPATCH(), ((const GLfloat *) (pc + 0)
-                   ));
+    glVertex3fv((const GLfloat *) (pc + 0));
 }
 
 void
 __glXDisp_Vertex3iv(GLbyte * pc)
 {
-    CALL_Vertex3iv(GET_DISPATCH(), ((const GLint *) (pc + 0)
-                   ));
+    glVertex3iv((const GLint *) (pc + 0));
 }
 
 void
 __glXDisp_Vertex3sv(GLbyte * pc)
 {
-    CALL_Vertex3sv(GET_DISPATCH(), ((const GLshort *) (pc + 0)
-                   ));
+    glVertex3sv((const GLshort *) (pc + 0));
 }
 
 void
@@ -760,29 +671,25 @@ __glXDisp_Vertex4dv(GLbyte * pc)
     }
 #endif
 
-    CALL_Vertex4dv(GET_DISPATCH(), ((const GLdouble *) (pc + 0)
-                   ));
+    glVertex4dv((const GLdouble *) (pc + 0));
 }
 
 void
 __glXDisp_Vertex4fv(GLbyte * pc)
 {
-    CALL_Vertex4fv(GET_DISPATCH(), ((const GLfloat *) (pc + 0)
-                   ));
+    glVertex4fv((const GLfloat *) (pc + 0));
 }
 
 void
 __glXDisp_Vertex4iv(GLbyte * pc)
 {
-    CALL_Vertex4iv(GET_DISPATCH(), ((const GLint *) (pc + 0)
-                   ));
+    glVertex4iv((const GLint *) (pc + 0));
 }
 
 void
 __glXDisp_Vertex4sv(GLbyte * pc)
 {
-    CALL_Vertex4sv(GET_DISPATCH(), ((const GLshort *) (pc + 0)
-                   ));
+    glVertex4sv((const GLshort *) (pc + 0));
 }
 
 void
@@ -795,31 +702,25 @@ __glXDisp_ClipPlane(GLbyte * pc)
     }
 #endif
 
-    CALL_ClipPlane(GET_DISPATCH(), (*(GLenum *) (pc + 32),
-                                    (const GLdouble *) (pc + 0)
-                   ));
+    glClipPlane(*(GLenum *) (pc + 32), (const GLdouble *) (pc + 0));
 }
 
 void
 __glXDisp_ColorMaterial(GLbyte * pc)
 {
-    CALL_ColorMaterial(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                        *(GLenum *) (pc + 4)
-                       ));
+    glColorMaterial(*(GLenum *) (pc + 0), *(GLenum *) (pc + 4));
 }
 
 void
 __glXDisp_CullFace(GLbyte * pc)
 {
-    CALL_CullFace(GET_DISPATCH(), (*(GLenum *) (pc + 0)
-                  ));
+    glCullFace(*(GLenum *) (pc + 0));
 }
 
 void
 __glXDisp_Fogf(GLbyte * pc)
 {
-    CALL_Fogf(GET_DISPATCH(), (*(GLenum *) (pc + 0), *(GLfloat *) (pc + 4)
-              ));
+    glFogf(*(GLenum *) (pc + 0), *(GLfloat *) (pc + 4));
 }
 
 void
@@ -830,14 +731,13 @@ __glXDisp_Fogfv(GLbyte * pc)
 
     params = (const GLfloat *) (pc + 4);
 
-    CALL_Fogfv(GET_DISPATCH(), (pname, params));
+    glFogfv(pname, params);
 }
 
 void
 __glXDisp_Fogi(GLbyte * pc)
 {
-    CALL_Fogi(GET_DISPATCH(), (*(GLenum *) (pc + 0), *(GLint *) (pc + 4)
-              ));
+    glFogi(*(GLenum *) (pc + 0), *(GLint *) (pc + 4));
 }
 
 void
@@ -848,29 +748,25 @@ __glXDisp_Fogiv(GLbyte * pc)
 
     params = (const GLint *) (pc + 4);
 
-    CALL_Fogiv(GET_DISPATCH(), (pname, params));
+    glFogiv(pname, params);
 }
 
 void
 __glXDisp_FrontFace(GLbyte * pc)
 {
-    CALL_FrontFace(GET_DISPATCH(), (*(GLenum *) (pc + 0)
-                   ));
+    glFrontFace(*(GLenum *) (pc + 0));
 }
 
 void
 __glXDisp_Hint(GLbyte * pc)
 {
-    CALL_Hint(GET_DISPATCH(), (*(GLenum *) (pc + 0), *(GLenum *) (pc + 4)
-              ));
+    glHint(*(GLenum *) (pc + 0), *(GLenum *) (pc + 4));
 }
 
 void
 __glXDisp_Lightf(GLbyte * pc)
 {
-    CALL_Lightf(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                 *(GLenum *) (pc + 4), *(GLfloat *) (pc + 8)
-                ));
+    glLightf(*(GLenum *) (pc + 0), *(GLenum *) (pc + 4), *(GLfloat *) (pc + 8));
 }
 
 void
@@ -881,15 +777,13 @@ __glXDisp_Lightfv(GLbyte * pc)
 
     params = (const GLfloat *) (pc + 8);
 
-    CALL_Lightfv(GET_DISPATCH(), (*(GLenum *) (pc + 0), pname, params));
+    glLightfv(*(GLenum *) (pc + 0), pname, params);
 }
 
 void
 __glXDisp_Lighti(GLbyte * pc)
 {
-    CALL_Lighti(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                 *(GLenum *) (pc + 4), *(GLint *) (pc + 8)
-                ));
+    glLighti(*(GLenum *) (pc + 0), *(GLenum *) (pc + 4), *(GLint *) (pc + 8));
 }
 
 void
@@ -900,15 +794,13 @@ __glXDisp_Lightiv(GLbyte * pc)
 
     params = (const GLint *) (pc + 8);
 
-    CALL_Lightiv(GET_DISPATCH(), (*(GLenum *) (pc + 0), pname, params));
+    glLightiv(*(GLenum *) (pc + 0), pname, params);
 }
 
 void
 __glXDisp_LightModelf(GLbyte * pc)
 {
-    CALL_LightModelf(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                      *(GLfloat *) (pc + 4)
-                     ));
+    glLightModelf(*(GLenum *) (pc + 0), *(GLfloat *) (pc + 4));
 }
 
 void
@@ -919,14 +811,13 @@ __glXDisp_LightModelfv(GLbyte * pc)
 
     params = (const GLfloat *) (pc + 4);
 
-    CALL_LightModelfv(GET_DISPATCH(), (pname, params));
+    glLightModelfv(pname, params);
 }
 
 void
 __glXDisp_LightModeli(GLbyte * pc)
 {
-    CALL_LightModeli(GET_DISPATCH(), (*(GLenum *) (pc + 0), *(GLint *) (pc + 4)
-                     ));
+    glLightModeli(*(GLenum *) (pc + 0), *(GLint *) (pc + 4));
 }
 
 void
@@ -937,30 +828,26 @@ __glXDisp_LightModeliv(GLbyte * pc)
 
     params = (const GLint *) (pc + 4);
 
-    CALL_LightModeliv(GET_DISPATCH(), (pname, params));
+    glLightModeliv(pname, params);
 }
 
 void
 __glXDisp_LineStipple(GLbyte * pc)
 {
-    CALL_LineStipple(GET_DISPATCH(), (*(GLint *) (pc + 0),
-                                      *(GLushort *) (pc + 4)
-                     ));
+    glLineStipple(*(GLint *) (pc + 0), *(GLushort *) (pc + 4));
 }
 
 void
 __glXDisp_LineWidth(GLbyte * pc)
 {
-    CALL_LineWidth(GET_DISPATCH(), (*(GLfloat *) (pc + 0)
-                   ));
+    glLineWidth(*(GLfloat *) (pc + 0));
 }
 
 void
 __glXDisp_Materialf(GLbyte * pc)
 {
-    CALL_Materialf(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                    *(GLenum *) (pc + 4), *(GLfloat *) (pc + 8)
-                   ));
+    glMaterialf(*(GLenum *) (pc + 0),
+                *(GLenum *) (pc + 4), *(GLfloat *) (pc + 8));
 }
 
 void
@@ -971,15 +858,14 @@ __glXDisp_Materialfv(GLbyte * pc)
 
     params = (const GLfloat *) (pc + 8);
 
-    CALL_Materialfv(GET_DISPATCH(), (*(GLenum *) (pc + 0), pname, params));
+    glMaterialfv(*(GLenum *) (pc + 0), pname, params);
 }
 
 void
 __glXDisp_Materiali(GLbyte * pc)
 {
-    CALL_Materiali(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                    *(GLenum *) (pc + 4), *(GLint *) (pc + 8)
-                   ));
+    glMateriali(*(GLenum *) (pc + 0),
+                *(GLenum *) (pc + 4), *(GLint *) (pc + 8));
 }
 
 void
@@ -990,21 +876,19 @@ __glXDisp_Materialiv(GLbyte * pc)
 
     params = (const GLint *) (pc + 8);
 
-    CALL_Materialiv(GET_DISPATCH(), (*(GLenum *) (pc + 0), pname, params));
+    glMaterialiv(*(GLenum *) (pc + 0), pname, params);
 }
 
 void
 __glXDisp_PointSize(GLbyte * pc)
 {
-    CALL_PointSize(GET_DISPATCH(), (*(GLfloat *) (pc + 0)
-                   ));
+    glPointSize(*(GLfloat *) (pc + 0));
 }
 
 void
 __glXDisp_PolygonMode(GLbyte * pc)
 {
-    CALL_PolygonMode(GET_DISPATCH(), (*(GLenum *) (pc + 0), *(GLenum *) (pc + 4)
-                     ));
+    glPolygonMode(*(GLenum *) (pc + 0), *(GLenum *) (pc + 4));
 }
 
 void
@@ -1013,42 +897,34 @@ __glXDisp_PolygonStipple(GLbyte * pc)
     const GLubyte *const mask = (const GLubyte *) ((pc + 20));
     __GLXpixelHeader *const hdr = (__GLXpixelHeader *) (pc);
 
-    CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment));
+    glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst);
+    glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength);
+    glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows);
+    glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels);
+    glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment);
 
-    CALL_PolygonStipple(GET_DISPATCH(), (mask));
+    glPolygonStipple(mask);
 }
 
 void
 __glXDisp_Scissor(GLbyte * pc)
 {
-    CALL_Scissor(GET_DISPATCH(), (*(GLint *) (pc + 0),
-                                  *(GLint *) (pc + 4),
-                                  *(GLsizei *) (pc + 8), *(GLsizei *) (pc + 12)
-                 ));
+    glScissor(*(GLint *) (pc + 0),
+              *(GLint *) (pc + 4),
+              *(GLsizei *) (pc + 8), *(GLsizei *) (pc + 12));
 }
 
 void
 __glXDisp_ShadeModel(GLbyte * pc)
 {
-    CALL_ShadeModel(GET_DISPATCH(), (*(GLenum *) (pc + 0)
-                    ));
+    glShadeModel(*(GLenum *) (pc + 0));
 }
 
 void
 __glXDisp_TexParameterf(GLbyte * pc)
 {
-    CALL_TexParameterf(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                        *(GLenum *) (pc + 4),
-                                        *(GLfloat *) (pc + 8)
-                       ));
+    glTexParameterf(*(GLenum *) (pc + 0),
+                    *(GLenum *) (pc + 4), *(GLfloat *) (pc + 8));
 }
 
 void
@@ -1059,16 +935,14 @@ __glXDisp_TexParameterfv(GLbyte * pc)
 
     params = (const GLfloat *) (pc + 8);
 
-    CALL_TexParameterfv(GET_DISPATCH(), (*(GLenum *) (pc + 0), pname, params));
+    glTexParameterfv(*(GLenum *) (pc + 0), pname, params);
 }
 
 void
 __glXDisp_TexParameteri(GLbyte * pc)
 {
-    CALL_TexParameteri(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                        *(GLenum *) (pc + 4),
-                                        *(GLint *) (pc + 8)
-                       ));
+    glTexParameteri(*(GLenum *) (pc + 0),
+                    *(GLenum *) (pc + 4), *(GLint *) (pc + 8));
 }
 
 void
@@ -1079,7 +953,7 @@ __glXDisp_TexParameteriv(GLbyte * pc)
 
     params = (const GLint *) (pc + 8);
 
-    CALL_TexParameteriv(GET_DISPATCH(), (*(GLenum *) (pc + 0), pname, params));
+    glTexParameteriv(*(GLenum *) (pc + 0), pname, params);
 }
 
 void
@@ -1088,24 +962,19 @@ __glXDisp_TexImage1D(GLbyte * pc)
     const GLvoid *const pixels = (const GLvoid *) ((pc + 52));
     __GLXpixelHeader *const hdr = (__GLXpixelHeader *) (pc);
 
-    CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes));
-    CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment));
+    glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes);
+    glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst);
+    glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength);
+    glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows);
+    glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels);
+    glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment);
 
-    CALL_TexImage1D(GET_DISPATCH(), (*(GLenum *) (pc + 20),
-                                     *(GLint *) (pc + 24),
-                                     *(GLint *) (pc + 28),
-                                     *(GLsizei *) (pc + 32),
-                                     *(GLint *) (pc + 40),
-                                     *(GLenum *) (pc + 44),
-                                     *(GLenum *) (pc + 48), pixels));
+    glTexImage1D(*(GLenum *) (pc + 20),
+                 *(GLint *) (pc + 24),
+                 *(GLint *) (pc + 28),
+                 *(GLsizei *) (pc + 32),
+                 *(GLint *) (pc + 40),
+                 *(GLenum *) (pc + 44), *(GLenum *) (pc + 48), pixels);
 }
 
 void
@@ -1114,33 +983,27 @@ __glXDisp_TexImage2D(GLbyte * pc)
     const GLvoid *const pixels = (const GLvoid *) ((pc + 52));
     __GLXpixelHeader *const hdr = (__GLXpixelHeader *) (pc);
 
-    CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes));
-    CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment));
+    glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes);
+    glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst);
+    glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength);
+    glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows);
+    glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels);
+    glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment);
 
-    CALL_TexImage2D(GET_DISPATCH(), (*(GLenum *) (pc + 20),
-                                     *(GLint *) (pc + 24),
-                                     *(GLint *) (pc + 28),
-                                     *(GLsizei *) (pc + 32),
-                                     *(GLsizei *) (pc + 36),
-                                     *(GLint *) (pc + 40),
-                                     *(GLenum *) (pc + 44),
-                                     *(GLenum *) (pc + 48), pixels));
+    glTexImage2D(*(GLenum *) (pc + 20),
+                 *(GLint *) (pc + 24),
+                 *(GLint *) (pc + 28),
+                 *(GLsizei *) (pc + 32),
+                 *(GLsizei *) (pc + 36),
+                 *(GLint *) (pc + 40),
+                 *(GLenum *) (pc + 44), *(GLenum *) (pc + 48), pixels);
 }
 
 void
 __glXDisp_TexEnvf(GLbyte * pc)
 {
-    CALL_TexEnvf(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                  *(GLenum *) (pc + 4), *(GLfloat *) (pc + 8)
-                 ));
+    glTexEnvf(*(GLenum *) (pc + 0),
+              *(GLenum *) (pc + 4), *(GLfloat *) (pc + 8));
 }
 
 void
@@ -1151,15 +1014,13 @@ __glXDisp_TexEnvfv(GLbyte * pc)
 
     params = (const GLfloat *) (pc + 8);
 
-    CALL_TexEnvfv(GET_DISPATCH(), (*(GLenum *) (pc + 0), pname, params));
+    glTexEnvfv(*(GLenum *) (pc + 0), pname, params);
 }
 
 void
 __glXDisp_TexEnvi(GLbyte * pc)
 {
-    CALL_TexEnvi(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                  *(GLenum *) (pc + 4), *(GLint *) (pc + 8)
-                 ));
+    glTexEnvi(*(GLenum *) (pc + 0), *(GLenum *) (pc + 4), *(GLint *) (pc + 8));
 }
 
 void
@@ -1170,7 +1031,7 @@ __glXDisp_TexEnviv(GLbyte * pc)
 
     params = (const GLint *) (pc + 8);
 
-    CALL_TexEnviv(GET_DISPATCH(), (*(GLenum *) (pc + 0), pname, params));
+    glTexEnviv(*(GLenum *) (pc + 0), pname, params);
 }
 
 void
@@ -1183,9 +1044,8 @@ __glXDisp_TexGend(GLbyte * pc)
     }
 #endif
 
-    CALL_TexGend(GET_DISPATCH(), (*(GLenum *) (pc + 8),
-                                  *(GLenum *) (pc + 12), *(GLdouble *) (pc + 0)
-                 ));
+    glTexGend(*(GLenum *) (pc + 8),
+              *(GLenum *) (pc + 12), *(GLdouble *) (pc + 0));
 }
 
 void
@@ -1206,15 +1066,14 @@ __glXDisp_TexGendv(GLbyte * pc)
 
     params = (const GLdouble *) (pc + 8);
 
-    CALL_TexGendv(GET_DISPATCH(), (*(GLenum *) (pc + 0), pname, params));
+    glTexGendv(*(GLenum *) (pc + 0), pname, params);
 }
 
 void
 __glXDisp_TexGenf(GLbyte * pc)
 {
-    CALL_TexGenf(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                  *(GLenum *) (pc + 4), *(GLfloat *) (pc + 8)
-                 ));
+    glTexGenf(*(GLenum *) (pc + 0),
+              *(GLenum *) (pc + 4), *(GLfloat *) (pc + 8));
 }
 
 void
@@ -1225,15 +1084,13 @@ __glXDisp_TexGenfv(GLbyte * pc)
 
     params = (const GLfloat *) (pc + 8);
 
-    CALL_TexGenfv(GET_DISPATCH(), (*(GLenum *) (pc + 0), pname, params));
+    glTexGenfv(*(GLenum *) (pc + 0), pname, params);
 }
 
 void
 __glXDisp_TexGeni(GLbyte * pc)
 {
-    CALL_TexGeni(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                  *(GLenum *) (pc + 4), *(GLint *) (pc + 8)
-                 ));
+    glTexGeni(*(GLenum *) (pc + 0), *(GLenum *) (pc + 4), *(GLint *) (pc + 8));
 }
 
 void
@@ -1244,88 +1101,77 @@ __glXDisp_TexGeniv(GLbyte * pc)
 
     params = (const GLint *) (pc + 8);
 
-    CALL_TexGeniv(GET_DISPATCH(), (*(GLenum *) (pc + 0), pname, params));
+    glTexGeniv(*(GLenum *) (pc + 0), pname, params);
 }
 
 void
 __glXDisp_InitNames(GLbyte * pc)
 {
-    CALL_InitNames(GET_DISPATCH(), ());
+    glInitNames();
 }
 
 void
 __glXDisp_LoadName(GLbyte * pc)
 {
-    CALL_LoadName(GET_DISPATCH(), (*(GLuint *) (pc + 0)
-                  ));
+    glLoadName(*(GLuint *) (pc + 0));
 }
 
 void
 __glXDisp_PassThrough(GLbyte * pc)
 {
-    CALL_PassThrough(GET_DISPATCH(), (*(GLfloat *) (pc + 0)
-                     ));
+    glPassThrough(*(GLfloat *) (pc + 0));
 }
 
 void
 __glXDisp_PopName(GLbyte * pc)
 {
-    CALL_PopName(GET_DISPATCH(), ());
+    glPopName();
 }
 
 void
 __glXDisp_PushName(GLbyte * pc)
 {
-    CALL_PushName(GET_DISPATCH(), (*(GLuint *) (pc + 0)
-                  ));
+    glPushName(*(GLuint *) (pc + 0));
 }
 
 void
 __glXDisp_DrawBuffer(GLbyte * pc)
 {
-    CALL_DrawBuffer(GET_DISPATCH(), (*(GLenum *) (pc + 0)
-                    ));
+    glDrawBuffer(*(GLenum *) (pc + 0));
 }
 
 void
 __glXDisp_Clear(GLbyte * pc)
 {
-    CALL_Clear(GET_DISPATCH(), (*(GLbitfield *) (pc + 0)
-               ));
+    glClear(*(GLbitfield *) (pc + 0));
 }
 
 void
 __glXDisp_ClearAccum(GLbyte * pc)
 {
-    CALL_ClearAccum(GET_DISPATCH(), (*(GLfloat *) (pc + 0),
-                                     *(GLfloat *) (pc + 4),
-                                     *(GLfloat *) (pc + 8),
-                                     *(GLfloat *) (pc + 12)
-                    ));
+    glClearAccum(*(GLfloat *) (pc + 0),
+                 *(GLfloat *) (pc + 4),
+                 *(GLfloat *) (pc + 8), *(GLfloat *) (pc + 12));
 }
 
 void
 __glXDisp_ClearIndex(GLbyte * pc)
 {
-    CALL_ClearIndex(GET_DISPATCH(), (*(GLfloat *) (pc + 0)
-                    ));
+    glClearIndex(*(GLfloat *) (pc + 0));
 }
 
 void
 __glXDisp_ClearColor(GLbyte * pc)
 {
-    CALL_ClearColor(GET_DISPATCH(), (*(GLclampf *) (pc + 0),
-                                     *(GLclampf *) (pc + 4),
-                                     *(GLclampf *) (pc + 8),
-                                     *(GLclampf *) (pc + 12)
-                    ));
+    glClearColor(*(GLclampf *) (pc + 0),
+                 *(GLclampf *) (pc + 4),
+                 *(GLclampf *) (pc + 8), *(GLclampf *) (pc + 12));
 }
 
 void
 __glXDisp_ClearStencil(GLbyte * pc)
 {
-    CALL_ClearStencil(GET_DISPATCH(), (*(GLint *) (pc + 0)
-                      ));
+    glClearStencil(*(GLint *) (pc + 0));
 }
 
 void
@@ -1338,73 +1184,63 @@ __glXDisp_ClearDepth(GLbyte * pc)
     }
 #endif
 
-    CALL_ClearDepth(GET_DISPATCH(), (*(GLclampd *) (pc + 0)
-                    ));
+    glClearDepth(*(GLclampd *) (pc + 0));
 }
 
 void
 __glXDisp_StencilMask(GLbyte * pc)
 {
-    CALL_StencilMask(GET_DISPATCH(), (*(GLuint *) (pc + 0)
-                     ));
+    glStencilMask(*(GLuint *) (pc + 0));
 }
 
 void
 __glXDisp_ColorMask(GLbyte * pc)
 {
-    CALL_ColorMask(GET_DISPATCH(), (*(GLboolean *) (pc + 0),
-                                    *(GLboolean *) (pc + 1),
-                                    *(GLboolean *) (pc + 2),
-                                    *(GLboolean *) (pc + 3)
-                   ));
+    glColorMask(*(GLboolean *) (pc + 0),
+                *(GLboolean *) (pc + 1),
+                *(GLboolean *) (pc + 2), *(GLboolean *) (pc + 3));
 }
 
 void
 __glXDisp_DepthMask(GLbyte * pc)
 {
-    CALL_DepthMask(GET_DISPATCH(), (*(GLboolean *) (pc + 0)
-                   ));
+    glDepthMask(*(GLboolean *) (pc + 0));
 }
 
 void
 __glXDisp_IndexMask(GLbyte * pc)
 {
-    CALL_IndexMask(GET_DISPATCH(), (*(GLuint *) (pc + 0)
-                   ));
+    glIndexMask(*(GLuint *) (pc + 0));
 }
 
 void
 __glXDisp_Accum(GLbyte * pc)
 {
-    CALL_Accum(GET_DISPATCH(), (*(GLenum *) (pc + 0), *(GLfloat *) (pc + 4)
-               ));
+    glAccum(*(GLenum *) (pc + 0), *(GLfloat *) (pc + 4));
 }
 
 void
 __glXDisp_Disable(GLbyte * pc)
 {
-    CALL_Disable(GET_DISPATCH(), (*(GLenum *) (pc + 0)
-                 ));
+    glDisable(*(GLenum *) (pc + 0));
 }
 
 void
 __glXDisp_Enable(GLbyte * pc)
 {
-    CALL_Enable(GET_DISPATCH(), (*(GLenum *) (pc + 0)
-                ));
+    glEnable(*(GLenum *) (pc + 0));
 }
 
 void
 __glXDisp_PopAttrib(GLbyte * pc)
 {
-    CALL_PopAttrib(GET_DISPATCH(), ());
+    glPopAttrib();
 }
 
 void
 __glXDisp_PushAttrib(GLbyte * pc)
 {
-    CALL_PushAttrib(GET_DISPATCH(), (*(GLbitfield *) (pc + 0)
-                    ));
+    glPushAttrib(*(GLbitfield *) (pc + 0));
 }
 
 void
@@ -1417,18 +1253,15 @@ __glXDisp_MapGrid1d(GLbyte * pc)
     }
 #endif
 
-    CALL_MapGrid1d(GET_DISPATCH(), (*(GLint *) (pc + 16),
-                                    *(GLdouble *) (pc + 0),
-                                    *(GLdouble *) (pc + 8)
-                   ));
+    glMapGrid1d(*(GLint *) (pc + 16),
+                *(GLdouble *) (pc + 0), *(GLdouble *) (pc + 8));
 }
 
 void
 __glXDisp_MapGrid1f(GLbyte * pc)
 {
-    CALL_MapGrid1f(GET_DISPATCH(), (*(GLint *) (pc + 0),
-                                    *(GLfloat *) (pc + 4), *(GLfloat *) (pc + 8)
-                   ));
+    glMapGrid1f(*(GLint *) (pc + 0),
+                *(GLfloat *) (pc + 4), *(GLfloat *) (pc + 8));
 }
 
 void
@@ -1441,25 +1274,21 @@ __glXDisp_MapGrid2d(GLbyte * pc)
     }
 #endif
 
-    CALL_MapGrid2d(GET_DISPATCH(), (*(GLint *) (pc + 32),
-                                    *(GLdouble *) (pc + 0),
-                                    *(GLdouble *) (pc + 8),
-                                    *(GLint *) (pc + 36),
-                                    *(GLdouble *) (pc + 16),
-                                    *(GLdouble *) (pc + 24)
-                   ));
+    glMapGrid2d(*(GLint *) (pc + 32),
+                *(GLdouble *) (pc + 0),
+                *(GLdouble *) (pc + 8),
+                *(GLint *) (pc + 36),
+                *(GLdouble *) (pc + 16), *(GLdouble *) (pc + 24));
 }
 
 void
 __glXDisp_MapGrid2f(GLbyte * pc)
 {
-    CALL_MapGrid2f(GET_DISPATCH(), (*(GLint *) (pc + 0),
-                                    *(GLfloat *) (pc + 4),
-                                    *(GLfloat *) (pc + 8),
-                                    *(GLint *) (pc + 12),
-                                    *(GLfloat *) (pc + 16),
-                                    *(GLfloat *) (pc + 20)
-                   ));
+    glMapGrid2f(*(GLint *) (pc + 0),
+                *(GLfloat *) (pc + 4),
+                *(GLfloat *) (pc + 8),
+                *(GLint *) (pc + 12),
+                *(GLfloat *) (pc + 16), *(GLfloat *) (pc + 20));
 }
 
 void
@@ -1472,15 +1301,13 @@ __glXDisp_EvalCoord1dv(GLbyte * pc)
     }
 #endif
 
-    CALL_EvalCoord1dv(GET_DISPATCH(), ((const GLdouble *) (pc + 0)
-                      ));
+    glEvalCoord1dv((const GLdouble *) (pc + 0));
 }
 
 void
 __glXDisp_EvalCoord1fv(GLbyte * pc)
 {
-    CALL_EvalCoord1fv(GET_DISPATCH(), ((const GLfloat *) (pc + 0)
-                      ));
+    glEvalCoord1fv((const GLfloat *) (pc + 0));
 }
 
 void
@@ -1493,114 +1320,96 @@ __glXDisp_EvalCoord2dv(GLbyte * pc)
     }
 #endif
 
-    CALL_EvalCoord2dv(GET_DISPATCH(), ((const GLdouble *) (pc + 0)
-                      ));
+    glEvalCoord2dv((const GLdouble *) (pc + 0));
 }
 
 void
 __glXDisp_EvalCoord2fv(GLbyte * pc)
 {
-    CALL_EvalCoord2fv(GET_DISPATCH(), ((const GLfloat *) (pc + 0)
-                      ));
+    glEvalCoord2fv((const GLfloat *) (pc + 0));
 }
 
 void
 __glXDisp_EvalMesh1(GLbyte * pc)
 {
-    CALL_EvalMesh1(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                    *(GLint *) (pc + 4), *(GLint *) (pc + 8)
-                   ));
+    glEvalMesh1(*(GLenum *) (pc + 0), *(GLint *) (pc + 4), *(GLint *) (pc + 8));
 }
 
 void
 __glXDisp_EvalPoint1(GLbyte * pc)
 {
-    CALL_EvalPoint1(GET_DISPATCH(), (*(GLint *) (pc + 0)
-                    ));
+    glEvalPoint1(*(GLint *) (pc + 0));
 }
 
 void
 __glXDisp_EvalMesh2(GLbyte * pc)
 {
-    CALL_EvalMesh2(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                    *(GLint *) (pc + 4),
-                                    *(GLint *) (pc + 8),
-                                    *(GLint *) (pc + 12), *(GLint *) (pc + 16)
-                   ));
+    glEvalMesh2(*(GLenum *) (pc + 0),
+                *(GLint *) (pc + 4),
+                *(GLint *) (pc + 8),
+                *(GLint *) (pc + 12), *(GLint *) (pc + 16));
 }
 
 void
 __glXDisp_EvalPoint2(GLbyte * pc)
 {
-    CALL_EvalPoint2(GET_DISPATCH(), (*(GLint *) (pc + 0), *(GLint *) (pc + 4)
-                    ));
+    glEvalPoint2(*(GLint *) (pc + 0), *(GLint *) (pc + 4));
 }
 
 void
 __glXDisp_AlphaFunc(GLbyte * pc)
 {
-    CALL_AlphaFunc(GET_DISPATCH(), (*(GLenum *) (pc + 0), *(GLclampf *) (pc + 4)
-                   ));
+    glAlphaFunc(*(GLenum *) (pc + 0), *(GLclampf *) (pc + 4));
 }
 
 void
 __glXDisp_BlendFunc(GLbyte * pc)
 {
-    CALL_BlendFunc(GET_DISPATCH(), (*(GLenum *) (pc + 0), *(GLenum *) (pc + 4)
-                   ));
+    glBlendFunc(*(GLenum *) (pc + 0), *(GLenum *) (pc + 4));
 }
 
 void
 __glXDisp_LogicOp(GLbyte * pc)
 {
-    CALL_LogicOp(GET_DISPATCH(), (*(GLenum *) (pc + 0)
-                 ));
+    glLogicOp(*(GLenum *) (pc + 0));
 }
 
 void
 __glXDisp_StencilFunc(GLbyte * pc)
 {
-    CALL_StencilFunc(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                      *(GLint *) (pc + 4), *(GLuint *) (pc + 8)
-                     ));
+    glStencilFunc(*(GLenum *) (pc + 0),
+                  *(GLint *) (pc + 4), *(GLuint *) (pc + 8));
 }
 
 void
 __glXDisp_StencilOp(GLbyte * pc)
 {
-    CALL_StencilOp(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                    *(GLenum *) (pc + 4), *(GLenum *) (pc + 8)
-                   ));
+    glStencilOp(*(GLenum *) (pc + 0),
+                *(GLenum *) (pc + 4), *(GLenum *) (pc + 8));
 }
 
 void
 __glXDisp_DepthFunc(GLbyte * pc)
 {
-    CALL_DepthFunc(GET_DISPATCH(), (*(GLenum *) (pc + 0)
-                   ));
+    glDepthFunc(*(GLenum *) (pc + 0));
 }
 
 void
 __glXDisp_PixelZoom(GLbyte * pc)
 {
-    CALL_PixelZoom(GET_DISPATCH(), (*(GLfloat *) (pc + 0), *(GLfloat *) (pc + 4)
-                   ));
+    glPixelZoom(*(GLfloat *) (pc + 0), *(GLfloat *) (pc + 4));
 }
 
 void
 __glXDisp_PixelTransferf(GLbyte * pc)
 {
-    CALL_PixelTransferf(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                         *(GLfloat *) (pc + 4)
-                        ));
+    glPixelTransferf(*(GLenum *) (pc + 0), *(GLfloat *) (pc + 4));
 }
 
 void
 __glXDisp_PixelTransferi(GLbyte * pc)
 {
-    CALL_PixelTransferi(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                         *(GLint *) (pc + 4)
-                        ));
+    glPixelTransferi(*(GLenum *) (pc + 0), *(GLint *) (pc + 4));
 }
 
 int
@@ -1612,9 +1421,7 @@ __glXDisp_PixelStoref(__GLXclientState * cl, GLbyte * pc)
 
     pc += __GLX_SINGLE_HDR_SIZE;
     if (cx != NULL) {
-        CALL_PixelStoref(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                          *(GLfloat *) (pc + 4)
-                         ));
+        glPixelStoref(*(GLenum *) (pc + 0), *(GLfloat *) (pc + 4));
         error = Success;
     }
 
@@ -1630,9 +1437,7 @@ __glXDisp_PixelStorei(__GLXclientState * cl, GLbyte * pc)
 
     pc += __GLX_SINGLE_HDR_SIZE;
     if (cx != NULL) {
-        CALL_PixelStorei(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                          *(GLint *) (pc + 4)
-                         ));
+        glPixelStorei(*(GLenum *) (pc + 0), *(GLint *) (pc + 4));
         error = Success;
     }
 
@@ -1644,9 +1449,7 @@ __glXDisp_PixelMapfv(GLbyte * pc)
 {
     const GLsizei mapsize = *(GLsizei *) (pc + 4);
 
-    CALL_PixelMapfv(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                     mapsize, (const GLfloat *) (pc + 8)
-                    ));
+    glPixelMapfv(*(GLenum *) (pc + 0), mapsize, (const GLfloat *) (pc + 8));
 }
 
 void
@@ -1654,9 +1457,7 @@ __glXDisp_PixelMapuiv(GLbyte * pc)
 {
     const GLsizei mapsize = *(GLsizei *) (pc + 4);
 
-    CALL_PixelMapuiv(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                      mapsize, (const GLuint *) (pc + 8)
-                     ));
+    glPixelMapuiv(*(GLenum *) (pc + 0), mapsize, (const GLuint *) (pc + 8));
 }
 
 void
@@ -1664,27 +1465,22 @@ __glXDisp_PixelMapusv(GLbyte * pc)
 {
     const GLsizei mapsize = *(GLsizei *) (pc + 4);
 
-    CALL_PixelMapusv(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                      mapsize, (const GLushort *) (pc + 8)
-                     ));
+    glPixelMapusv(*(GLenum *) (pc + 0), mapsize, (const GLushort *) (pc + 8));
 }
 
 void
 __glXDisp_ReadBuffer(GLbyte * pc)
 {
-    CALL_ReadBuffer(GET_DISPATCH(), (*(GLenum *) (pc + 0)
-                    ));
+    glReadBuffer(*(GLenum *) (pc + 0));
 }
 
 void
 __glXDisp_CopyPixels(GLbyte * pc)
 {
-    CALL_CopyPixels(GET_DISPATCH(), (*(GLint *) (pc + 0),
-                                     *(GLint *) (pc + 4),
-                                     *(GLsizei *) (pc + 8),
-                                     *(GLsizei *) (pc + 12),
-                                     *(GLenum *) (pc + 16)
-                    ));
+    glCopyPixels(*(GLint *) (pc + 0),
+                 *(GLint *) (pc + 4),
+                 *(GLsizei *) (pc + 8),
+                 *(GLsizei *) (pc + 12), *(GLenum *) (pc + 16));
 }
 
 void
@@ -1693,21 +1489,16 @@ __glXDisp_DrawPixels(GLbyte * pc)
     const GLvoid *const pixels = (const GLvoid *) ((pc + 36));
     __GLXpixelHeader *const hdr = (__GLXpixelHeader *) (pc);
 
-    CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes));
-    CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment));
+    glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes);
+    glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst);
+    glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength);
+    glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows);
+    glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels);
+    glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment);
 
-    CALL_DrawPixels(GET_DISPATCH(), (*(GLsizei *) (pc + 20),
-                                     *(GLsizei *) (pc + 24),
-                                     *(GLenum *) (pc + 28),
-                                     *(GLenum *) (pc + 32), pixels));
+    glDrawPixels(*(GLsizei *) (pc + 20),
+                 *(GLsizei *) (pc + 24),
+                 *(GLenum *) (pc + 28), *(GLenum *) (pc + 32), pixels);
 }
 
 int
@@ -1731,7 +1522,7 @@ __glXDisp_GetBooleanv(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetBooleanv(GET_DISPATCH(), (pname, params));
+        glGetBooleanv(pname, params);
         __glXSendReply(cl->client, params, compsize, 1, GL_FALSE, 0);
         error = Success;
     }
@@ -1750,7 +1541,7 @@ __glXDisp_GetClipPlane(__GLXclientState * cl, GLbyte * pc)
     if (cx != NULL) {
         GLdouble equation[4];
 
-        CALL_GetClipPlane(GET_DISPATCH(), (*(GLenum *) (pc + 0), equation));
+        glGetClipPlane(*(GLenum *) (pc + 0), equation);
         __glXSendReply(cl->client, equation, 4, 8, GL_TRUE, 0);
         error = Success;
     }
@@ -1779,7 +1570,7 @@ __glXDisp_GetDoublev(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetDoublev(GET_DISPATCH(), (pname, params));
+        glGetDoublev(pname, params);
         __glXSendReply(cl->client, params, compsize, 8, GL_FALSE, 0);
         error = Success;
     }
@@ -1798,7 +1589,7 @@ __glXDisp_GetError(__GLXclientState * cl, GLbyte * pc)
     if (cx != NULL) {
         GLenum retval;
 
-        retval = CALL_GetError(GET_DISPATCH(), ());
+        retval = glGetError();
         __glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval);
         error = Success;
     }
@@ -1827,7 +1618,7 @@ __glXDisp_GetFloatv(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetFloatv(GET_DISPATCH(), (pname, params));
+        glGetFloatv(pname, params);
         __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
         error = Success;
     }
@@ -1856,7 +1647,7 @@ __glXDisp_GetIntegerv(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetIntegerv(GET_DISPATCH(), (pname, params));
+        glGetIntegerv(pname, params);
         __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
         error = Success;
     }
@@ -1885,7 +1676,7 @@ __glXDisp_GetLightfv(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetLightfv(GET_DISPATCH(), (*(GLenum *) (pc + 0), pname, params));
+        glGetLightfv(*(GLenum *) (pc + 0), pname, params);
         __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
         error = Success;
     }
@@ -1914,7 +1705,7 @@ __glXDisp_GetLightiv(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetLightiv(GET_DISPATCH(), (*(GLenum *) (pc + 0), pname, params));
+        glGetLightiv(*(GLenum *) (pc + 0), pname, params);
         __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
         error = Success;
     }
@@ -1944,7 +1735,7 @@ __glXDisp_GetMapdv(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetMapdv(GET_DISPATCH(), (target, query, v));
+        glGetMapdv(target, query, v);
         __glXSendReply(cl->client, v, compsize, 8, GL_FALSE, 0);
         error = Success;
     }
@@ -1974,7 +1765,7 @@ __glXDisp_GetMapfv(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetMapfv(GET_DISPATCH(), (target, query, v));
+        glGetMapfv(target, query, v);
         __glXSendReply(cl->client, v, compsize, 4, GL_FALSE, 0);
         error = Success;
     }
@@ -2004,7 +1795,7 @@ __glXDisp_GetMapiv(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetMapiv(GET_DISPATCH(), (target, query, v));
+        glGetMapiv(target, query, v);
         __glXSendReply(cl->client, v, compsize, 4, GL_FALSE, 0);
         error = Success;
     }
@@ -2033,8 +1824,7 @@ __glXDisp_GetMaterialfv(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetMaterialfv(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                            pname, params));
+        glGetMaterialfv(*(GLenum *) (pc + 0), pname, params);
         __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
         error = Success;
     }
@@ -2063,8 +1853,7 @@ __glXDisp_GetMaterialiv(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetMaterialiv(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                            pname, params));
+        glGetMaterialiv(*(GLenum *) (pc + 0), pname, params);
         __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
         error = Success;
     }
@@ -2093,7 +1882,7 @@ __glXDisp_GetPixelMapfv(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetPixelMapfv(GET_DISPATCH(), (map, values));
+        glGetPixelMapfv(map, values);
         __glXSendReply(cl->client, values, compsize, 4, GL_FALSE, 0);
         error = Success;
     }
@@ -2122,7 +1911,7 @@ __glXDisp_GetPixelMapuiv(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetPixelMapuiv(GET_DISPATCH(), (map, values));
+        glGetPixelMapuiv(map, values);
         __glXSendReply(cl->client, values, compsize, 4, GL_FALSE, 0);
         error = Success;
     }
@@ -2151,7 +1940,7 @@ __glXDisp_GetPixelMapusv(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetPixelMapusv(GET_DISPATCH(), (map, values));
+        glGetPixelMapusv(map, values);
         __glXSendReply(cl->client, values, compsize, 2, GL_FALSE, 0);
         error = Success;
     }
@@ -2180,7 +1969,7 @@ __glXDisp_GetTexEnvfv(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetTexEnvfv(GET_DISPATCH(), (*(GLenum *) (pc + 0), pname, params));
+        glGetTexEnvfv(*(GLenum *) (pc + 0), pname, params);
         __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
         error = Success;
     }
@@ -2209,7 +1998,7 @@ __glXDisp_GetTexEnviv(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetTexEnviv(GET_DISPATCH(), (*(GLenum *) (pc + 0), pname, params));
+        glGetTexEnviv(*(GLenum *) (pc + 0), pname, params);
         __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
         error = Success;
     }
@@ -2238,7 +2027,7 @@ __glXDisp_GetTexGendv(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetTexGendv(GET_DISPATCH(), (*(GLenum *) (pc + 0), pname, params));
+        glGetTexGendv(*(GLenum *) (pc + 0), pname, params);
         __glXSendReply(cl->client, params, compsize, 8, GL_FALSE, 0);
         error = Success;
     }
@@ -2267,7 +2056,7 @@ __glXDisp_GetTexGenfv(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetTexGenfv(GET_DISPATCH(), (*(GLenum *) (pc + 0), pname, params));
+        glGetTexGenfv(*(GLenum *) (pc + 0), pname, params);
         __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
         error = Success;
     }
@@ -2296,7 +2085,7 @@ __glXDisp_GetTexGeniv(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetTexGeniv(GET_DISPATCH(), (*(GLenum *) (pc + 0), pname, params));
+        glGetTexGeniv(*(GLenum *) (pc + 0), pname, params);
         __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
         error = Success;
     }
@@ -2325,8 +2114,7 @@ __glXDisp_GetTexParameterfv(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetTexParameterfv(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                                pname, params));
+        glGetTexParameterfv(*(GLenum *) (pc + 0), pname, params);
         __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
         error = Success;
     }
@@ -2355,8 +2143,7 @@ __glXDisp_GetTexParameteriv(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetTexParameteriv(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                                pname, params));
+        glGetTexParameteriv(*(GLenum *) (pc + 0), pname, params);
         __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
         error = Success;
     }
@@ -2385,9 +2172,8 @@ __glXDisp_GetTexLevelParameterfv(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetTexLevelParameterfv(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                                     *(GLint *) (pc + 4),
-                                                     pname, params));
+        glGetTexLevelParameterfv(*(GLenum *) (pc + 0),
+                                 *(GLint *) (pc + 4), pname, params);
         __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
         error = Success;
     }
@@ -2416,9 +2202,8 @@ __glXDisp_GetTexLevelParameteriv(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetTexLevelParameteriv(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                                     *(GLint *) (pc + 4),
-                                                     pname, params));
+        glGetTexLevelParameteriv(*(GLenum *) (pc + 0),
+                                 *(GLint *) (pc + 4), pname, params);
         __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
         error = Success;
     }
@@ -2437,8 +2222,7 @@ __glXDisp_IsEnabled(__GLXclientState * cl, GLbyte * pc)
     if (cx != NULL) {
         GLboolean retval;
 
-        retval = CALL_IsEnabled(GET_DISPATCH(), (*(GLenum *) (pc + 0)
-                                ));
+        retval = glIsEnabled(*(GLenum *) (pc + 0));
         __glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval);
         error = Success;
     }
@@ -2457,8 +2241,7 @@ __glXDisp_IsList(__GLXclientState * cl, GLbyte * pc)
     if (cx != NULL) {
         GLboolean retval;
 
-        retval = CALL_IsList(GET_DISPATCH(), (*(GLuint *) (pc + 0)
-                             ));
+        retval = glIsList(*(GLuint *) (pc + 0));
         __glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval);
         error = Success;
     }
@@ -2476,9 +2259,7 @@ __glXDisp_DepthRange(GLbyte * pc)
     }
 #endif
 
-    CALL_DepthRange(GET_DISPATCH(), (*(GLclampd *) (pc + 0),
-                                     *(GLclampd *) (pc + 8)
-                    ));
+    glDepthRange(*(GLclampd *) (pc + 0), *(GLclampd *) (pc + 8));
 }
 
 void
@@ -2491,26 +2272,23 @@ __glXDisp_Frustum(GLbyte * pc)
     }
 #endif
 
-    CALL_Frustum(GET_DISPATCH(), (*(GLdouble *) (pc + 0),
-                                  *(GLdouble *) (pc + 8),
-                                  *(GLdouble *) (pc + 16),
-                                  *(GLdouble *) (pc + 24),
-                                  *(GLdouble *) (pc + 32),
-                                  *(GLdouble *) (pc + 40)
-                 ));
+    glFrustum(*(GLdouble *) (pc + 0),
+              *(GLdouble *) (pc + 8),
+              *(GLdouble *) (pc + 16),
+              *(GLdouble *) (pc + 24),
+              *(GLdouble *) (pc + 32), *(GLdouble *) (pc + 40));
 }
 
 void
 __glXDisp_LoadIdentity(GLbyte * pc)
 {
-    CALL_LoadIdentity(GET_DISPATCH(), ());
+    glLoadIdentity();
 }
 
 void
 __glXDisp_LoadMatrixf(GLbyte * pc)
 {
-    CALL_LoadMatrixf(GET_DISPATCH(), ((const GLfloat *) (pc + 0)
-                     ));
+    glLoadMatrixf((const GLfloat *) (pc + 0));
 }
 
 void
@@ -2523,22 +2301,19 @@ __glXDisp_LoadMatrixd(GLbyte * pc)
     }
 #endif
 
-    CALL_LoadMatrixd(GET_DISPATCH(), ((const GLdouble *) (pc + 0)
-                     ));
+    glLoadMatrixd((const GLdouble *) (pc + 0));
 }
 
 void
 __glXDisp_MatrixMode(GLbyte * pc)
 {
-    CALL_MatrixMode(GET_DISPATCH(), (*(GLenum *) (pc + 0)
-                    ));
+    glMatrixMode(*(GLenum *) (pc + 0));
 }
 
 void
 __glXDisp_MultMatrixf(GLbyte * pc)
 {
-    CALL_MultMatrixf(GET_DISPATCH(), ((const GLfloat *) (pc + 0)
-                     ));
+    glMultMatrixf((const GLfloat *) (pc + 0));
 }
 
 void
@@ -2551,8 +2326,7 @@ __glXDisp_MultMatrixd(GLbyte * pc)
     }
 #endif
 
-    CALL_MultMatrixd(GET_DISPATCH(), ((const GLdouble *) (pc + 0)
-                     ));
+    glMultMatrixd((const GLdouble *) (pc + 0));
 }
 
 void
@@ -2565,24 +2339,23 @@ __glXDisp_Ortho(GLbyte * pc)
     }
 #endif
 
-    CALL_Ortho(GET_DISPATCH(), (*(GLdouble *) (pc + 0),
-                                *(GLdouble *) (pc + 8),
-                                *(GLdouble *) (pc + 16),
-                                *(GLdouble *) (pc + 24),
-                                *(GLdouble *) (pc + 32), *(GLdouble *) (pc + 40)
-               ));
+    glOrtho(*(GLdouble *) (pc + 0),
+            *(GLdouble *) (pc + 8),
+            *(GLdouble *) (pc + 16),
+            *(GLdouble *) (pc + 24),
+            *(GLdouble *) (pc + 32), *(GLdouble *) (pc + 40));
 }
 
 void
 __glXDisp_PopMatrix(GLbyte * pc)
 {
-    CALL_PopMatrix(GET_DISPATCH(), ());
+    glPopMatrix();
 }
 
 void
 __glXDisp_PushMatrix(GLbyte * pc)
 {
-    CALL_PushMatrix(GET_DISPATCH(), ());
+    glPushMatrix();
 }
 
 void
@@ -2595,20 +2368,17 @@ __glXDisp_Rotated(GLbyte * pc)
     }
 #endif
 
-    CALL_Rotated(GET_DISPATCH(), (*(GLdouble *) (pc + 0),
-                                  *(GLdouble *) (pc + 8),
-                                  *(GLdouble *) (pc + 16),
-                                  *(GLdouble *) (pc + 24)
-                 ));
+    glRotated(*(GLdouble *) (pc + 0),
+              *(GLdouble *) (pc + 8),
+              *(GLdouble *) (pc + 16), *(GLdouble *) (pc + 24));
 }
 
 void
 __glXDisp_Rotatef(GLbyte * pc)
 {
-    CALL_Rotatef(GET_DISPATCH(), (*(GLfloat *) (pc + 0),
-                                  *(GLfloat *) (pc + 4),
-                                  *(GLfloat *) (pc + 8), *(GLfloat *) (pc + 12)
-                 ));
+    glRotatef(*(GLfloat *) (pc + 0),
+              *(GLfloat *) (pc + 4),
+              *(GLfloat *) (pc + 8), *(GLfloat *) (pc + 12));
 }
 
 void
@@ -2621,17 +2391,15 @@ __glXDisp_Scaled(GLbyte * pc)
     }
 #endif
 
-    CALL_Scaled(GET_DISPATCH(), (*(GLdouble *) (pc + 0),
-                                 *(GLdouble *) (pc + 8), *(GLdouble *) (pc + 16)
-                ));
+    glScaled(*(GLdouble *) (pc + 0),
+             *(GLdouble *) (pc + 8), *(GLdouble *) (pc + 16));
 }
 
 void
 __glXDisp_Scalef(GLbyte * pc)
 {
-    CALL_Scalef(GET_DISPATCH(), (*(GLfloat *) (pc + 0),
-                                 *(GLfloat *) (pc + 4), *(GLfloat *) (pc + 8)
-                ));
+    glScalef(*(GLfloat *) (pc + 0),
+             *(GLfloat *) (pc + 4), *(GLfloat *) (pc + 8));
 }
 
 void
@@ -2644,50 +2412,41 @@ __glXDisp_Translated(GLbyte * pc)
     }
 #endif
 
-    CALL_Translated(GET_DISPATCH(), (*(GLdouble *) (pc + 0),
-                                     *(GLdouble *) (pc + 8),
-                                     *(GLdouble *) (pc + 16)
-                    ));
+    glTranslated(*(GLdouble *) (pc + 0),
+                 *(GLdouble *) (pc + 8), *(GLdouble *) (pc + 16));
 }
 
 void
 __glXDisp_Translatef(GLbyte * pc)
 {
-    CALL_Translatef(GET_DISPATCH(), (*(GLfloat *) (pc + 0),
-                                     *(GLfloat *) (pc + 4),
-                                     *(GLfloat *) (pc + 8)
-                    ));
+    glTranslatef(*(GLfloat *) (pc + 0),
+                 *(GLfloat *) (pc + 4), *(GLfloat *) (pc + 8));
 }
 
 void
 __glXDisp_Viewport(GLbyte * pc)
 {
-    CALL_Viewport(GET_DISPATCH(), (*(GLint *) (pc + 0),
-                                   *(GLint *) (pc + 4),
-                                   *(GLsizei *) (pc + 8), *(GLsizei *) (pc + 12)
-                  ));
+    glViewport(*(GLint *) (pc + 0),
+               *(GLint *) (pc + 4),
+               *(GLsizei *) (pc + 8), *(GLsizei *) (pc + 12));
 }
 
 void
 __glXDisp_BindTexture(GLbyte * pc)
 {
-    CALL_BindTexture(GET_DISPATCH(), (*(GLenum *) (pc + 0), *(GLuint *) (pc + 4)
-                     ));
+    glBindTexture(*(GLenum *) (pc + 0), *(GLuint *) (pc + 4));
 }
 
 void
 __glXDisp_Indexubv(GLbyte * pc)
 {
-    CALL_Indexubv(GET_DISPATCH(), ((const GLubyte *) (pc + 0)
-                  ));
+    glIndexubv((const GLubyte *) (pc + 0));
 }
 
 void
 __glXDisp_PolygonOffset(GLbyte * pc)
 {
-    CALL_PolygonOffset(GET_DISPATCH(), (*(GLfloat *) (pc + 0),
-                                        *(GLfloat *) (pc + 4)
-                       ));
+    glPolygonOffset(*(GLfloat *) (pc + 0), *(GLfloat *) (pc + 4));
 }
 
 int
@@ -2706,9 +2465,7 @@ __glXDisp_AreTexturesResident(__GLXclientState * cl, GLbyte * pc)
         GLboolean *residences =
             __glXGetAnswerBuffer(cl, n, answerBuffer, sizeof(answerBuffer), 1);
         retval =
-            CALL_AreTexturesResident(GET_DISPATCH(),
-                                     (n, (const GLuint *) (pc + 4),
-                                      residences));
+            glAreTexturesResident(n, (const GLuint *) (pc + 4), residences);
         __glXSendReply(cl->client, residences, n, 1, GL_TRUE, retval);
         error = Success;
     }
@@ -2732,9 +2489,7 @@ __glXDisp_AreTexturesResidentEXT(__GLXclientState * cl, GLbyte * pc)
         GLboolean *residences =
             __glXGetAnswerBuffer(cl, n, answerBuffer, sizeof(answerBuffer), 1);
         retval =
-            CALL_AreTexturesResident(GET_DISPATCH(),
-                                     (n, (const GLuint *) (pc + 4),
-                                      residences));
+            glAreTexturesResident(n, (const GLuint *) (pc + 4), residences);
         __glXSendReply(cl->client, residences, n, 1, GL_TRUE, retval);
         error = Success;
     }
@@ -2745,54 +2500,46 @@ __glXDisp_AreTexturesResidentEXT(__GLXclientState * cl, GLbyte * pc)
 void
 __glXDisp_CopyTexImage1D(GLbyte * pc)
 {
-    CALL_CopyTexImage1D(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                         *(GLint *) (pc + 4),
-                                         *(GLenum *) (pc + 8),
-                                         *(GLint *) (pc + 12),
-                                         *(GLint *) (pc + 16),
-                                         *(GLsizei *) (pc + 20),
-                                         *(GLint *) (pc + 24)
-                        ));
+    glCopyTexImage1D(*(GLenum *) (pc + 0),
+                     *(GLint *) (pc + 4),
+                     *(GLenum *) (pc + 8),
+                     *(GLint *) (pc + 12),
+                     *(GLint *) (pc + 16),
+                     *(GLsizei *) (pc + 20), *(GLint *) (pc + 24));
 }
 
 void
 __glXDisp_CopyTexImage2D(GLbyte * pc)
 {
-    CALL_CopyTexImage2D(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                         *(GLint *) (pc + 4),
-                                         *(GLenum *) (pc + 8),
-                                         *(GLint *) (pc + 12),
-                                         *(GLint *) (pc + 16),
-                                         *(GLsizei *) (pc + 20),
-                                         *(GLsizei *) (pc + 24),
-                                         *(GLint *) (pc + 28)
-                        ));
+    glCopyTexImage2D(*(GLenum *) (pc + 0),
+                     *(GLint *) (pc + 4),
+                     *(GLenum *) (pc + 8),
+                     *(GLint *) (pc + 12),
+                     *(GLint *) (pc + 16),
+                     *(GLsizei *) (pc + 20),
+                     *(GLsizei *) (pc + 24), *(GLint *) (pc + 28));
 }
 
 void
 __glXDisp_CopyTexSubImage1D(GLbyte * pc)
 {
-    CALL_CopyTexSubImage1D(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                            *(GLint *) (pc + 4),
-                                            *(GLint *) (pc + 8),
-                                            *(GLint *) (pc + 12),
-                                            *(GLint *) (pc + 16),
-                                            *(GLsizei *) (pc + 20)
-                           ));
+    glCopyTexSubImage1D(*(GLenum *) (pc + 0),
+                        *(GLint *) (pc + 4),
+                        *(GLint *) (pc + 8),
+                        *(GLint *) (pc + 12),
+                        *(GLint *) (pc + 16), *(GLsizei *) (pc + 20));
 }
 
 void
 __glXDisp_CopyTexSubImage2D(GLbyte * pc)
 {
-    CALL_CopyTexSubImage2D(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                            *(GLint *) (pc + 4),
-                                            *(GLint *) (pc + 8),
-                                            *(GLint *) (pc + 12),
-                                            *(GLint *) (pc + 16),
-                                            *(GLint *) (pc + 20),
-                                            *(GLsizei *) (pc + 24),
-                                            *(GLsizei *) (pc + 28)
-                           ));
+    glCopyTexSubImage2D(*(GLenum *) (pc + 0),
+                        *(GLint *) (pc + 4),
+                        *(GLint *) (pc + 8),
+                        *(GLint *) (pc + 12),
+                        *(GLint *) (pc + 16),
+                        *(GLint *) (pc + 20),
+                        *(GLsizei *) (pc + 24), *(GLsizei *) (pc + 28));
 }
 
 int
@@ -2806,8 +2553,7 @@ __glXDisp_DeleteTextures(__GLXclientState * cl, GLbyte * pc)
     if (cx != NULL) {
         const GLsizei n = *(GLsizei *) (pc + 0);
 
-        CALL_DeleteTextures(GET_DISPATCH(), (n, (const GLuint *) (pc + 4)
-                            ));
+        glDeleteTextures(n, (const GLuint *) (pc + 4));
         error = Success;
     }
 
@@ -2825,8 +2571,7 @@ __glXDisp_DeleteTexturesEXT(__GLXclientState * cl, GLbyte * pc)
     if (cx != NULL) {
         const GLsizei n = *(GLsizei *) (pc + 0);
 
-        CALL_DeleteTextures(GET_DISPATCH(), (n, (const GLuint *) (pc + 4)
-                            ));
+        glDeleteTextures(n, (const GLuint *) (pc + 4));
         error = Success;
     }
 
@@ -2848,7 +2593,7 @@ __glXDisp_GenTextures(__GLXclientState * cl, GLbyte * pc)
         GLuint *textures =
             __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer),
                                  4);
-        CALL_GenTextures(GET_DISPATCH(), (n, textures));
+        glGenTextures(n, textures);
         __glXSendReply(cl->client, textures, n, 4, GL_TRUE, 0);
         error = Success;
     }
@@ -2871,7 +2616,7 @@ __glXDisp_GenTexturesEXT(__GLXclientState * cl, GLbyte * pc)
         GLuint *textures =
             __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer),
                                  4);
-        CALL_GenTextures(GET_DISPATCH(), (n, textures));
+        glGenTextures(n, textures);
         __glXSendReply(cl->client, textures, n, 4, GL_TRUE, 0);
         error = Success;
     }
@@ -2890,8 +2635,7 @@ __glXDisp_IsTexture(__GLXclientState * cl, GLbyte * pc)
     if (cx != NULL) {
         GLboolean retval;
 
-        retval = CALL_IsTexture(GET_DISPATCH(), (*(GLuint *) (pc + 0)
-                                ));
+        retval = glIsTexture(*(GLuint *) (pc + 0));
         __glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval);
         error = Success;
     }
@@ -2910,8 +2654,7 @@ __glXDisp_IsTextureEXT(__GLXclientState * cl, GLbyte * pc)
     if (cx != NULL) {
         GLboolean retval;
 
-        retval = CALL_IsTexture(GET_DISPATCH(), (*(GLuint *) (pc + 0)
-                                ));
+        retval = glIsTexture(*(GLuint *) (pc + 0));
         __glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval);
         error = Success;
     }
@@ -2924,10 +2667,9 @@ __glXDisp_PrioritizeTextures(GLbyte * pc)
 {
     const GLsizei n = *(GLsizei *) (pc + 0);
 
-    CALL_PrioritizeTextures(GET_DISPATCH(), (n,
-                                             (const GLuint *) (pc + 4),
-                                             (const GLclampf *) (pc + 4)
-                            ));
+    glPrioritizeTextures(n,
+                         (const GLuint *) (pc + 4),
+                         (const GLclampf *) (pc + 4));
 }
 
 void
@@ -2936,23 +2678,18 @@ __glXDisp_TexSubImage1D(GLbyte * pc)
     const GLvoid *const pixels = (const GLvoid *) ((pc + 56));
     __GLXpixelHeader *const hdr = (__GLXpixelHeader *) (pc);
 
-    CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes));
-    CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment));
+    glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes);
+    glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst);
+    glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength);
+    glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows);
+    glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels);
+    glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment);
 
-    CALL_TexSubImage1D(GET_DISPATCH(), (*(GLenum *) (pc + 20),
-                                        *(GLint *) (pc + 24),
-                                        *(GLint *) (pc + 28),
-                                        *(GLsizei *) (pc + 36),
-                                        *(GLenum *) (pc + 44),
-                                        *(GLenum *) (pc + 48), pixels));
+    glTexSubImage1D(*(GLenum *) (pc + 20),
+                    *(GLint *) (pc + 24),
+                    *(GLint *) (pc + 28),
+                    *(GLsizei *) (pc + 36),
+                    *(GLenum *) (pc + 44), *(GLenum *) (pc + 48), pixels);
 }
 
 void
@@ -2961,42 +2698,34 @@ __glXDisp_TexSubImage2D(GLbyte * pc)
     const GLvoid *const pixels = (const GLvoid *) ((pc + 56));
     __GLXpixelHeader *const hdr = (__GLXpixelHeader *) (pc);
 
-    CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes));
-    CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment));
+    glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes);
+    glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst);
+    glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength);
+    glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows);
+    glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels);
+    glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment);
 
-    CALL_TexSubImage2D(GET_DISPATCH(), (*(GLenum *) (pc + 20),
-                                        *(GLint *) (pc + 24),
-                                        *(GLint *) (pc + 28),
-                                        *(GLint *) (pc + 32),
-                                        *(GLsizei *) (pc + 36),
-                                        *(GLsizei *) (pc + 40),
-                                        *(GLenum *) (pc + 44),
-                                        *(GLenum *) (pc + 48), pixels));
+    glTexSubImage2D(*(GLenum *) (pc + 20),
+                    *(GLint *) (pc + 24),
+                    *(GLint *) (pc + 28),
+                    *(GLint *) (pc + 32),
+                    *(GLsizei *) (pc + 36),
+                    *(GLsizei *) (pc + 40),
+                    *(GLenum *) (pc + 44), *(GLenum *) (pc + 48), pixels);
 }
 
 void
 __glXDisp_BlendColor(GLbyte * pc)
 {
-    CALL_BlendColor(GET_DISPATCH(), (*(GLclampf *) (pc + 0),
-                                     *(GLclampf *) (pc + 4),
-                                     *(GLclampf *) (pc + 8),
-                                     *(GLclampf *) (pc + 12)
-                    ));
+    glBlendColor(*(GLclampf *) (pc + 0),
+                 *(GLclampf *) (pc + 4),
+                 *(GLclampf *) (pc + 8), *(GLclampf *) (pc + 12));
 }
 
 void
 __glXDisp_BlendEquation(GLbyte * pc)
 {
-    CALL_BlendEquation(GET_DISPATCH(), (*(GLenum *) (pc + 0)
-                       ));
+    glBlendEquation(*(GLenum *) (pc + 0));
 }
 
 void
@@ -3005,22 +2734,17 @@ __glXDisp_ColorTable(GLbyte * pc)
     const GLvoid *const table = (const GLvoid *) ((pc + 40));
     __GLXpixelHeader *const hdr = (__GLXpixelHeader *) (pc);
 
-    CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes));
-    CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment));
+    glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes);
+    glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst);
+    glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength);
+    glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows);
+    glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels);
+    glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment);
 
-    CALL_ColorTable(GET_DISPATCH(), (*(GLenum *) (pc + 20),
-                                     *(GLenum *) (pc + 24),
-                                     *(GLsizei *) (pc + 28),
-                                     *(GLenum *) (pc + 32),
-                                     *(GLenum *) (pc + 36), table));
+    glColorTable(*(GLenum *) (pc + 20),
+                 *(GLenum *) (pc + 24),
+                 *(GLsizei *) (pc + 28),
+                 *(GLenum *) (pc + 32), *(GLenum *) (pc + 36), table);
 }
 
 void
@@ -3031,8 +2755,7 @@ __glXDisp_ColorTableParameterfv(GLbyte * pc)
 
     params = (const GLfloat *) (pc + 8);
 
-    CALL_ColorTableParameterfv(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                                pname, params));
+    glColorTableParameterfv(*(GLenum *) (pc + 0), pname, params);
 }
 
 void
@@ -3043,19 +2766,16 @@ __glXDisp_ColorTableParameteriv(GLbyte * pc)
 
     params = (const GLint *) (pc + 8);
 
-    CALL_ColorTableParameteriv(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                                pname, params));
+    glColorTableParameteriv(*(GLenum *) (pc + 0), pname, params);
 }
 
 void
 __glXDisp_CopyColorTable(GLbyte * pc)
 {
-    CALL_CopyColorTable(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                         *(GLenum *) (pc + 4),
-                                         *(GLint *) (pc + 8),
-                                         *(GLint *) (pc + 12),
-                                         *(GLsizei *) (pc + 16)
-                        ));
+    glCopyColorTable(*(GLenum *) (pc + 0),
+                     *(GLenum *) (pc + 4),
+                     *(GLint *) (pc + 8),
+                     *(GLint *) (pc + 12), *(GLsizei *) (pc + 16));
 }
 
 int
@@ -3079,8 +2799,7 @@ __glXDisp_GetColorTableParameterfv(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetColorTableParameterfv(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                                       pname, params));
+        glGetColorTableParameterfv(*(GLenum *) (pc + 0), pname, params);
         __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
         error = Success;
     }
@@ -3109,8 +2828,7 @@ __glXDisp_GetColorTableParameterfvSGI(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetColorTableParameterfv(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                                       pname, params));
+        glGetColorTableParameterfv(*(GLenum *) (pc + 0), pname, params);
         __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
         error = Success;
     }
@@ -3139,8 +2857,7 @@ __glXDisp_GetColorTableParameteriv(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetColorTableParameteriv(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                                       pname, params));
+        glGetColorTableParameteriv(*(GLenum *) (pc + 0), pname, params);
         __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
         error = Success;
     }
@@ -3169,8 +2886,7 @@ __glXDisp_GetColorTableParameterivSGI(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetColorTableParameteriv(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                                       pname, params));
+        glGetColorTableParameteriv(*(GLenum *) (pc + 0), pname, params);
         __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
         error = Success;
     }
@@ -3184,33 +2900,26 @@ __glXDisp_ColorSubTable(GLbyte * pc)
     const GLvoid *const data = (const GLvoid *) ((pc + 40));
     __GLXpixelHeader *const hdr = (__GLXpixelHeader *) (pc);
 
-    CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes));
-    CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment));
+    glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes);
+    glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst);
+    glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength);
+    glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows);
+    glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels);
+    glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment);
 
-    CALL_ColorSubTable(GET_DISPATCH(), (*(GLenum *) (pc + 20),
-                                        *(GLsizei *) (pc + 24),
-                                        *(GLsizei *) (pc + 28),
-                                        *(GLenum *) (pc + 32),
-                                        *(GLenum *) (pc + 36), data));
+    glColorSubTable(*(GLenum *) (pc + 20),
+                    *(GLsizei *) (pc + 24),
+                    *(GLsizei *) (pc + 28),
+                    *(GLenum *) (pc + 32), *(GLenum *) (pc + 36), data);
 }
 
 void
 __glXDisp_CopyColorSubTable(GLbyte * pc)
 {
-    CALL_CopyColorSubTable(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                            *(GLsizei *) (pc + 4),
-                                            *(GLint *) (pc + 8),
-                                            *(GLint *) (pc + 12),
-                                            *(GLsizei *) (pc + 16)
-                           ));
+    glCopyColorSubTable(*(GLenum *) (pc + 0),
+                        *(GLsizei *) (pc + 4),
+                        *(GLint *) (pc + 8),
+                        *(GLint *) (pc + 12), *(GLsizei *) (pc + 16));
 }
 
 void
@@ -3219,22 +2928,17 @@ __glXDisp_ConvolutionFilter1D(GLbyte * pc)
     const GLvoid *const image = (const GLvoid *) ((pc + 44));
     __GLXpixelHeader *const hdr = (__GLXpixelHeader *) (pc);
 
-    CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes));
-    CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment));
+    glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes);
+    glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst);
+    glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength);
+    glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows);
+    glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels);
+    glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment);
 
-    CALL_ConvolutionFilter1D(GET_DISPATCH(), (*(GLenum *) (pc + 20),
-                                              *(GLenum *) (pc + 24),
-                                              *(GLsizei *) (pc + 28),
-                                              *(GLenum *) (pc + 36),
-                                              *(GLenum *) (pc + 40), image));
+    glConvolutionFilter1D(*(GLenum *) (pc + 20),
+                          *(GLenum *) (pc + 24),
+                          *(GLsizei *) (pc + 28),
+                          *(GLenum *) (pc + 36), *(GLenum *) (pc + 40), image);
 }
 
 void
@@ -3243,32 +2947,25 @@ __glXDisp_ConvolutionFilter2D(GLbyte * pc)
     const GLvoid *const image = (const GLvoid *) ((pc + 44));
     __GLXpixelHeader *const hdr = (__GLXpixelHeader *) (pc);
 
-    CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes));
-    CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment));
+    glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes);
+    glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst);
+    glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength);
+    glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows);
+    glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels);
+    glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment);
 
-    CALL_ConvolutionFilter2D(GET_DISPATCH(), (*(GLenum *) (pc + 20),
-                                              *(GLenum *) (pc + 24),
-                                              *(GLsizei *) (pc + 28),
-                                              *(GLsizei *) (pc + 32),
-                                              *(GLenum *) (pc + 36),
-                                              *(GLenum *) (pc + 40), image));
+    glConvolutionFilter2D(*(GLenum *) (pc + 20),
+                          *(GLenum *) (pc + 24),
+                          *(GLsizei *) (pc + 28),
+                          *(GLsizei *) (pc + 32),
+                          *(GLenum *) (pc + 36), *(GLenum *) (pc + 40), image);
 }
 
 void
 __glXDisp_ConvolutionParameterf(GLbyte * pc)
 {
-    CALL_ConvolutionParameterf(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                                *(GLenum *) (pc + 4),
-                                                *(GLfloat *) (pc + 8)
-                               ));
+    glConvolutionParameterf(*(GLenum *) (pc + 0),
+                            *(GLenum *) (pc + 4), *(GLfloat *) (pc + 8));
 }
 
 void
@@ -3279,17 +2976,14 @@ __glXDisp_ConvolutionParameterfv(GLbyte * pc)
 
     params = (const GLfloat *) (pc + 8);
 
-    CALL_ConvolutionParameterfv(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                                 pname, params));
+    glConvolutionParameterfv(*(GLenum *) (pc + 0), pname, params);
 }
 
 void
 __glXDisp_ConvolutionParameteri(GLbyte * pc)
 {
-    CALL_ConvolutionParameteri(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                                *(GLenum *) (pc + 4),
-                                                *(GLint *) (pc + 8)
-                               ));
+    glConvolutionParameteri(*(GLenum *) (pc + 0),
+                            *(GLenum *) (pc + 4), *(GLint *) (pc + 8));
 }
 
 void
@@ -3300,31 +2994,26 @@ __glXDisp_ConvolutionParameteriv(GLbyte * pc)
 
     params = (const GLint *) (pc + 8);
 
-    CALL_ConvolutionParameteriv(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                                 pname, params));
+    glConvolutionParameteriv(*(GLenum *) (pc + 0), pname, params);
 }
 
 void
 __glXDisp_CopyConvolutionFilter1D(GLbyte * pc)
 {
-    CALL_CopyConvolutionFilter1D(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                                  *(GLenum *) (pc + 4),
-                                                  *(GLint *) (pc + 8),
-                                                  *(GLint *) (pc + 12),
-                                                  *(GLsizei *) (pc + 16)
-                                 ));
+    glCopyConvolutionFilter1D(*(GLenum *) (pc + 0),
+                              *(GLenum *) (pc + 4),
+                              *(GLint *) (pc + 8),
+                              *(GLint *) (pc + 12), *(GLsizei *) (pc + 16));
 }
 
 void
 __glXDisp_CopyConvolutionFilter2D(GLbyte * pc)
 {
-    CALL_CopyConvolutionFilter2D(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                                  *(GLenum *) (pc + 4),
-                                                  *(GLint *) (pc + 8),
-                                                  *(GLint *) (pc + 12),
-                                                  *(GLsizei *) (pc + 16),
-                                                  *(GLsizei *) (pc + 20)
-                                 ));
+    glCopyConvolutionFilter2D(*(GLenum *) (pc + 0),
+                              *(GLenum *) (pc + 4),
+                              *(GLint *) (pc + 8),
+                              *(GLint *) (pc + 12),
+                              *(GLsizei *) (pc + 16), *(GLsizei *) (pc + 20));
 }
 
 int
@@ -3348,8 +3037,7 @@ __glXDisp_GetConvolutionParameterfv(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetConvolutionParameterfv(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                                        pname, params));
+        glGetConvolutionParameterfv(*(GLenum *) (pc + 0), pname, params);
         __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
         error = Success;
     }
@@ -3378,8 +3066,7 @@ __glXDisp_GetConvolutionParameterfvEXT(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetConvolutionParameterfv(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                                        pname, params));
+        glGetConvolutionParameterfv(*(GLenum *) (pc + 0), pname, params);
         __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
         error = Success;
     }
@@ -3408,8 +3095,7 @@ __glXDisp_GetConvolutionParameteriv(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetConvolutionParameteriv(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                                        pname, params));
+        glGetConvolutionParameteriv(*(GLenum *) (pc + 0), pname, params);
         __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
         error = Success;
     }
@@ -3438,8 +3124,7 @@ __glXDisp_GetConvolutionParameterivEXT(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetConvolutionParameteriv(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                                        pname, params));
+        glGetConvolutionParameteriv(*(GLenum *) (pc + 0), pname, params);
         __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
         error = Success;
     }
@@ -3468,8 +3153,7 @@ __glXDisp_GetHistogramParameterfv(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetHistogramParameterfv(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                                      pname, params));
+        glGetHistogramParameterfv(*(GLenum *) (pc + 0), pname, params);
         __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
         error = Success;
     }
@@ -3498,8 +3182,7 @@ __glXDisp_GetHistogramParameterfvEXT(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetHistogramParameterfv(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                                      pname, params));
+        glGetHistogramParameterfv(*(GLenum *) (pc + 0), pname, params);
         __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
         error = Success;
     }
@@ -3528,8 +3211,7 @@ __glXDisp_GetHistogramParameteriv(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetHistogramParameteriv(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                                      pname, params));
+        glGetHistogramParameteriv(*(GLenum *) (pc + 0), pname, params);
         __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
         error = Success;
     }
@@ -3558,8 +3240,7 @@ __glXDisp_GetHistogramParameterivEXT(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetHistogramParameteriv(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                                      pname, params));
+        glGetHistogramParameteriv(*(GLenum *) (pc + 0), pname, params);
         __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
         error = Success;
     }
@@ -3588,8 +3269,7 @@ __glXDisp_GetMinmaxParameterfv(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetMinmaxParameterfv(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                                   pname, params));
+        glGetMinmaxParameterfv(*(GLenum *) (pc + 0), pname, params);
         __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
         error = Success;
     }
@@ -3618,8 +3298,7 @@ __glXDisp_GetMinmaxParameterfvEXT(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetMinmaxParameterfv(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                                   pname, params));
+        glGetMinmaxParameterfv(*(GLenum *) (pc + 0), pname, params);
         __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
         error = Success;
     }
@@ -3648,8 +3327,7 @@ __glXDisp_GetMinmaxParameteriv(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetMinmaxParameteriv(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                                   pname, params));
+        glGetMinmaxParameteriv(*(GLenum *) (pc + 0), pname, params);
         __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
         error = Success;
     }
@@ -3678,8 +3356,7 @@ __glXDisp_GetMinmaxParameterivEXT(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetMinmaxParameteriv(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                                   pname, params));
+        glGetMinmaxParameteriv(*(GLenum *) (pc + 0), pname, params);
         __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
         error = Success;
     }
@@ -3690,33 +3367,28 @@ __glXDisp_GetMinmaxParameterivEXT(__GLXclientState * cl, GLbyte * pc)
 void
 __glXDisp_Histogram(GLbyte * pc)
 {
-    CALL_Histogram(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                    *(GLsizei *) (pc + 4),
-                                    *(GLenum *) (pc + 8),
-                                    *(GLboolean *) (pc + 12)
-                   ));
+    glHistogram(*(GLenum *) (pc + 0),
+                *(GLsizei *) (pc + 4),
+                *(GLenum *) (pc + 8), *(GLboolean *) (pc + 12));
 }
 
 void
 __glXDisp_Minmax(GLbyte * pc)
 {
-    CALL_Minmax(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                 *(GLenum *) (pc + 4), *(GLboolean *) (pc + 8)
-                ));
+    glMinmax(*(GLenum *) (pc + 0),
+             *(GLenum *) (pc + 4), *(GLboolean *) (pc + 8));
 }
 
 void
 __glXDisp_ResetHistogram(GLbyte * pc)
 {
-    CALL_ResetHistogram(GET_DISPATCH(), (*(GLenum *) (pc + 0)
-                        ));
+    glResetHistogram(*(GLenum *) (pc + 0));
 }
 
 void
 __glXDisp_ResetMinmax(GLbyte * pc)
 {
-    CALL_ResetMinmax(GET_DISPATCH(), (*(GLenum *) (pc + 0)
-                     ));
+    glResetMinmax(*(GLenum *) (pc + 0));
 }
 
 void
@@ -3727,30 +3399,23 @@ __glXDisp_TexImage3D(GLbyte * pc)
         (const GLvoid *) ((ptr_is_null != 0) ? NULL : (pc + 80));
     __GLXpixel3DHeader *const hdr = (__GLXpixel3DHeader *) (pc);
 
-    CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes));
-    CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_IMAGE_HEIGHT, (GLint) hdr->imageHeight));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_SKIP_IMAGES, (GLint) hdr->skipImages));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment));
-
-    CALL_TexImage3D(GET_DISPATCH(), (*(GLenum *) (pc + 36),
-                                     *(GLint *) (pc + 40),
-                                     *(GLint *) (pc + 44),
-                                     *(GLsizei *) (pc + 48),
-                                     *(GLsizei *) (pc + 52),
-                                     *(GLsizei *) (pc + 56),
-                                     *(GLint *) (pc + 64),
-                                     *(GLenum *) (pc + 68),
-                                     *(GLenum *) (pc + 72), pixels));
+    glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes);
+    glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst);
+    glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength);
+    glPixelStorei(GL_UNPACK_IMAGE_HEIGHT, (GLint) hdr->imageHeight);
+    glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows);
+    glPixelStorei(GL_UNPACK_SKIP_IMAGES, (GLint) hdr->skipImages);
+    glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels);
+    glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment);
+
+    glTexImage3D(*(GLenum *) (pc + 36),
+                 *(GLint *) (pc + 40),
+                 *(GLint *) (pc + 44),
+                 *(GLsizei *) (pc + 48),
+                 *(GLsizei *) (pc + 52),
+                 *(GLsizei *) (pc + 56),
+                 *(GLint *) (pc + 64),
+                 *(GLenum *) (pc + 68), *(GLenum *) (pc + 72), pixels);
 }
 
 void
@@ -3759,57 +3424,47 @@ __glXDisp_TexSubImage3D(GLbyte * pc)
     const GLvoid *const pixels = (const GLvoid *) ((pc + 88));
     __GLXpixel3DHeader *const hdr = (__GLXpixel3DHeader *) (pc);
 
-    CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes));
-    CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_IMAGE_HEIGHT, (GLint) hdr->imageHeight));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_SKIP_IMAGES, (GLint) hdr->skipImages));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment));
-
-    CALL_TexSubImage3D(GET_DISPATCH(), (*(GLenum *) (pc + 36),
-                                        *(GLint *) (pc + 40),
-                                        *(GLint *) (pc + 44),
-                                        *(GLint *) (pc + 48),
-                                        *(GLint *) (pc + 52),
-                                        *(GLsizei *) (pc + 60),
-                                        *(GLsizei *) (pc + 64),
-                                        *(GLsizei *) (pc + 68),
-                                        *(GLenum *) (pc + 76),
-                                        *(GLenum *) (pc + 80), pixels));
+    glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes);
+    glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst);
+    glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength);
+    glPixelStorei(GL_UNPACK_IMAGE_HEIGHT, (GLint) hdr->imageHeight);
+    glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows);
+    glPixelStorei(GL_UNPACK_SKIP_IMAGES, (GLint) hdr->skipImages);
+    glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels);
+    glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment);
+
+    glTexSubImage3D(*(GLenum *) (pc + 36),
+                    *(GLint *) (pc + 40),
+                    *(GLint *) (pc + 44),
+                    *(GLint *) (pc + 48),
+                    *(GLint *) (pc + 52),
+                    *(GLsizei *) (pc + 60),
+                    *(GLsizei *) (pc + 64),
+                    *(GLsizei *) (pc + 68),
+                    *(GLenum *) (pc + 76), *(GLenum *) (pc + 80), pixels);
 }
 
 void
 __glXDisp_CopyTexSubImage3D(GLbyte * pc)
 {
-    CALL_CopyTexSubImage3D(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                            *(GLint *) (pc + 4),
-                                            *(GLint *) (pc + 8),
-                                            *(GLint *) (pc + 12),
-                                            *(GLint *) (pc + 16),
-                                            *(GLint *) (pc + 20),
-                                            *(GLint *) (pc + 24),
-                                            *(GLsizei *) (pc + 28),
-                                            *(GLsizei *) (pc + 32)
-                           ));
+    glCopyTexSubImage3D(*(GLenum *) (pc + 0),
+                        *(GLint *) (pc + 4),
+                        *(GLint *) (pc + 8),
+                        *(GLint *) (pc + 12),
+                        *(GLint *) (pc + 16),
+                        *(GLint *) (pc + 20),
+                        *(GLint *) (pc + 24),
+                        *(GLsizei *) (pc + 28), *(GLsizei *) (pc + 32));
 }
 
 void
-__glXDisp_ActiveTextureARB(GLbyte * pc)
+__glXDisp_ActiveTexture(GLbyte * pc)
 {
-    CALL_ActiveTextureARB(GET_DISPATCH(), (*(GLenum *) (pc + 0)
-                          ));
+    glActiveTextureARB(*(GLenum *) (pc + 0));
 }
 
 void
-__glXDisp_MultiTexCoord1dvARB(GLbyte * pc)
+__glXDisp_MultiTexCoord1dv(GLbyte * pc)
 {
 #ifdef __GLX_ALIGN64
     if ((unsigned long) (pc) & 7) {
@@ -3818,37 +3473,29 @@ __glXDisp_MultiTexCoord1dvARB(GLbyte * pc)
     }
 #endif
 
-    CALL_MultiTexCoord1dvARB(GET_DISPATCH(), (*(GLenum *) (pc + 8),
-                                              (const GLdouble *) (pc + 0)
-                             ));
+    glMultiTexCoord1dvARB(*(GLenum *) (pc + 8), (const GLdouble *) (pc + 0));
 }
 
 void
 __glXDisp_MultiTexCoord1fvARB(GLbyte * pc)
 {
-    CALL_MultiTexCoord1fvARB(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                              (const GLfloat *) (pc + 4)
-                             ));
+    glMultiTexCoord1fvARB(*(GLenum *) (pc + 0), (const GLfloat *) (pc + 4));
 }
 
 void
-__glXDisp_MultiTexCoord1ivARB(GLbyte * pc)
+__glXDisp_MultiTexCoord1iv(GLbyte * pc)
 {
-    CALL_MultiTexCoord1ivARB(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                              (const GLint *) (pc + 4)
-                             ));
+    glMultiTexCoord1ivARB(*(GLenum *) (pc + 0), (const GLint *) (pc + 4));
 }
 
 void
-__glXDisp_MultiTexCoord1svARB(GLbyte * pc)
+__glXDisp_MultiTexCoord1sv(GLbyte * pc)
 {
-    CALL_MultiTexCoord1svARB(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                              (const GLshort *) (pc + 4)
-                             ));
+    glMultiTexCoord1svARB(*(GLenum *) (pc + 0), (const GLshort *) (pc + 4));
 }
 
 void
-__glXDisp_MultiTexCoord2dvARB(GLbyte * pc)
+__glXDisp_MultiTexCoord2dv(GLbyte * pc)
 {
 #ifdef __GLX_ALIGN64
     if ((unsigned long) (pc) & 7) {
@@ -3857,37 +3504,29 @@ __glXDisp_MultiTexCoord2dvARB(GLbyte * pc)
     }
 #endif
 
-    CALL_MultiTexCoord2dvARB(GET_DISPATCH(), (*(GLenum *) (pc + 16),
-                                              (const GLdouble *) (pc + 0)
-                             ));
+    glMultiTexCoord2dvARB(*(GLenum *) (pc + 16), (const GLdouble *) (pc + 0));
 }
 
 void
 __glXDisp_MultiTexCoord2fvARB(GLbyte * pc)
 {
-    CALL_MultiTexCoord2fvARB(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                              (const GLfloat *) (pc + 4)
-                             ));
+    glMultiTexCoord2fvARB(*(GLenum *) (pc + 0), (const GLfloat *) (pc + 4));
 }
 
 void
-__glXDisp_MultiTexCoord2ivARB(GLbyte * pc)
+__glXDisp_MultiTexCoord2iv(GLbyte * pc)
 {
-    CALL_MultiTexCoord2ivARB(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                              (const GLint *) (pc + 4)
-                             ));
+    glMultiTexCoord2ivARB(*(GLenum *) (pc + 0), (const GLint *) (pc + 4));
 }
 
 void
-__glXDisp_MultiTexCoord2svARB(GLbyte * pc)
+__glXDisp_MultiTexCoord2sv(GLbyte * pc)
 {
-    CALL_MultiTexCoord2svARB(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                              (const GLshort *) (pc + 4)
-                             ));
+    glMultiTexCoord2svARB(*(GLenum *) (pc + 0), (const GLshort *) (pc + 4));
 }
 
 void
-__glXDisp_MultiTexCoord3dvARB(GLbyte * pc)
+__glXDisp_MultiTexCoord3dv(GLbyte * pc)
 {
 #ifdef __GLX_ALIGN64
     if ((unsigned long) (pc) & 7) {
@@ -3896,37 +3535,29 @@ __glXDisp_MultiTexCoord3dvARB(GLbyte * pc)
     }
 #endif
 
-    CALL_MultiTexCoord3dvARB(GET_DISPATCH(), (*(GLenum *) (pc + 24),
-                                              (const GLdouble *) (pc + 0)
-                             ));
+    glMultiTexCoord3dvARB(*(GLenum *) (pc + 24), (const GLdouble *) (pc + 0));
 }
 
 void
 __glXDisp_MultiTexCoord3fvARB(GLbyte * pc)
 {
-    CALL_MultiTexCoord3fvARB(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                              (const GLfloat *) (pc + 4)
-                             ));
+    glMultiTexCoord3fvARB(*(GLenum *) (pc + 0), (const GLfloat *) (pc + 4));
 }
 
 void
-__glXDisp_MultiTexCoord3ivARB(GLbyte * pc)
+__glXDisp_MultiTexCoord3iv(GLbyte * pc)
 {
-    CALL_MultiTexCoord3ivARB(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                              (const GLint *) (pc + 4)
-                             ));
+    glMultiTexCoord3ivARB(*(GLenum *) (pc + 0), (const GLint *) (pc + 4));
 }
 
 void
-__glXDisp_MultiTexCoord3svARB(GLbyte * pc)
+__glXDisp_MultiTexCoord3sv(GLbyte * pc)
 {
-    CALL_MultiTexCoord3svARB(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                              (const GLshort *) (pc + 4)
-                             ));
+    glMultiTexCoord3svARB(*(GLenum *) (pc + 0), (const GLshort *) (pc + 4));
 }
 
 void
-__glXDisp_MultiTexCoord4dvARB(GLbyte * pc)
+__glXDisp_MultiTexCoord4dv(GLbyte * pc)
 {
 #ifdef __GLX_ALIGN64
     if ((unsigned long) (pc) & 7) {
@@ -3935,250 +3566,325 @@ __glXDisp_MultiTexCoord4dvARB(GLbyte * pc)
     }
 #endif
 
-    CALL_MultiTexCoord4dvARB(GET_DISPATCH(), (*(GLenum *) (pc + 32),
-                                              (const GLdouble *) (pc + 0)
-                             ));
+    glMultiTexCoord4dvARB(*(GLenum *) (pc + 32), (const GLdouble *) (pc + 0));
 }
 
 void
 __glXDisp_MultiTexCoord4fvARB(GLbyte * pc)
 {
-    CALL_MultiTexCoord4fvARB(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                              (const GLfloat *) (pc + 4)
-                             ));
-}
-
-void
-__glXDisp_MultiTexCoord4ivARB(GLbyte * pc)
-{
-    CALL_MultiTexCoord4ivARB(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                              (const GLint *) (pc + 4)
-                             ));
+    glMultiTexCoord4fvARB(*(GLenum *) (pc + 0), (const GLfloat *) (pc + 4));
 }
 
 void
-__glXDisp_MultiTexCoord4svARB(GLbyte * pc)
+__glXDisp_MultiTexCoord4iv(GLbyte * pc)
 {
-    CALL_MultiTexCoord4svARB(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                              (const GLshort *) (pc + 4)
-                             ));
+    glMultiTexCoord4ivARB(*(GLenum *) (pc + 0), (const GLint *) (pc + 4));
 }
 
 void
-__glXDisp_SampleCoverageARB(GLbyte * pc)
+__glXDisp_MultiTexCoord4sv(GLbyte * pc)
 {
-    CALL_SampleCoverageARB(GET_DISPATCH(), (*(GLclampf *) (pc + 0),
-                                            *(GLboolean *) (pc + 4)
-                           ));
+    glMultiTexCoord4svARB(*(GLenum *) (pc + 0), (const GLshort *) (pc + 4));
 }
 
 void
-__glXDisp_CompressedTexImage1DARB(GLbyte * pc)
+__glXDisp_CompressedTexImage1D(GLbyte * pc)
 {
+    PFNGLCOMPRESSEDTEXIMAGE1DPROC CompressedTexImage1D =
+        __glGetProcAddress("glCompressedTexImage1D");
     const GLsizei imageSize = *(GLsizei *) (pc + 20);
 
-    CALL_CompressedTexImage1DARB(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                                  *(GLint *) (pc + 4),
-                                                  *(GLenum *) (pc + 8),
-                                                  *(GLsizei *) (pc + 12),
-                                                  *(GLint *) (pc + 16),
-                                                  imageSize,
-                                                  (const GLvoid *) (pc + 24)
-                                 ));
+    CompressedTexImage1D(*(GLenum *) (pc + 0),
+                         *(GLint *) (pc + 4),
+                         *(GLenum *) (pc + 8),
+                         *(GLsizei *) (pc + 12),
+                         *(GLint *) (pc + 16),
+                         imageSize, (const GLvoid *) (pc + 24));
 }
 
 void
-__glXDisp_CompressedTexImage2DARB(GLbyte * pc)
+__glXDisp_CompressedTexImage2D(GLbyte * pc)
 {
+    PFNGLCOMPRESSEDTEXIMAGE2DPROC CompressedTexImage2D =
+        __glGetProcAddress("glCompressedTexImage2D");
     const GLsizei imageSize = *(GLsizei *) (pc + 24);
 
-    CALL_CompressedTexImage2DARB(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                                  *(GLint *) (pc + 4),
-                                                  *(GLenum *) (pc + 8),
-                                                  *(GLsizei *) (pc + 12),
-                                                  *(GLsizei *) (pc + 16),
-                                                  *(GLint *) (pc + 20),
-                                                  imageSize,
-                                                  (const GLvoid *) (pc + 28)
-                                 ));
+    CompressedTexImage2D(*(GLenum *) (pc + 0),
+                         *(GLint *) (pc + 4),
+                         *(GLenum *) (pc + 8),
+                         *(GLsizei *) (pc + 12),
+                         *(GLsizei *) (pc + 16),
+                         *(GLint *) (pc + 20),
+                         imageSize, (const GLvoid *) (pc + 28));
 }
 
 void
-__glXDisp_CompressedTexImage3DARB(GLbyte * pc)
+__glXDisp_CompressedTexImage3D(GLbyte * pc)
 {
+    PFNGLCOMPRESSEDTEXIMAGE3DPROC CompressedTexImage3D =
+        __glGetProcAddress("glCompressedTexImage3D");
     const GLsizei imageSize = *(GLsizei *) (pc + 28);
 
-    CALL_CompressedTexImage3DARB(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                                  *(GLint *) (pc + 4),
-                                                  *(GLenum *) (pc + 8),
-                                                  *(GLsizei *) (pc + 12),
-                                                  *(GLsizei *) (pc + 16),
-                                                  *(GLsizei *) (pc + 20),
-                                                  *(GLint *) (pc + 24),
-                                                  imageSize,
-                                                  (const GLvoid *) (pc + 32)
-                                 ));
+    CompressedTexImage3D(*(GLenum *) (pc + 0),
+                         *(GLint *) (pc + 4),
+                         *(GLenum *) (pc + 8),
+                         *(GLsizei *) (pc + 12),
+                         *(GLsizei *) (pc + 16),
+                         *(GLsizei *) (pc + 20),
+                         *(GLint *) (pc + 24),
+                         imageSize, (const GLvoid *) (pc + 32));
 }
 
 void
-__glXDisp_CompressedTexSubImage1DARB(GLbyte * pc)
+__glXDisp_CompressedTexSubImage1D(GLbyte * pc)
 {
+    PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC CompressedTexSubImage1D =
+        __glGetProcAddress("glCompressedTexSubImage1D");
     const GLsizei imageSize = *(GLsizei *) (pc + 20);
 
-    CALL_CompressedTexSubImage1DARB(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                                     *(GLint *) (pc + 4),
-                                                     *(GLint *) (pc + 8),
-                                                     *(GLsizei *) (pc + 12),
-                                                     *(GLenum *) (pc + 16),
-                                                     imageSize,
-                                                     (const GLvoid *) (pc + 24)
-                                    ));
+    CompressedTexSubImage1D(*(GLenum *) (pc + 0),
+                            *(GLint *) (pc + 4),
+                            *(GLint *) (pc + 8),
+                            *(GLsizei *) (pc + 12),
+                            *(GLenum *) (pc + 16),
+                            imageSize, (const GLvoid *) (pc + 24));
 }
 
 void
-__glXDisp_CompressedTexSubImage2DARB(GLbyte * pc)
+__glXDisp_CompressedTexSubImage2D(GLbyte * pc)
 {
+    PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC CompressedTexSubImage2D =
+        __glGetProcAddress("glCompressedTexSubImage2D");
     const GLsizei imageSize = *(GLsizei *) (pc + 28);
 
-    CALL_CompressedTexSubImage2DARB(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                                     *(GLint *) (pc + 4),
-                                                     *(GLint *) (pc + 8),
-                                                     *(GLint *) (pc + 12),
-                                                     *(GLsizei *) (pc + 16),
-                                                     *(GLsizei *) (pc + 20),
-                                                     *(GLenum *) (pc + 24),
-                                                     imageSize,
-                                                     (const GLvoid *) (pc + 32)
-                                    ));
+    CompressedTexSubImage2D(*(GLenum *) (pc + 0),
+                            *(GLint *) (pc + 4),
+                            *(GLint *) (pc + 8),
+                            *(GLint *) (pc + 12),
+                            *(GLsizei *) (pc + 16),
+                            *(GLsizei *) (pc + 20),
+                            *(GLenum *) (pc + 24),
+                            imageSize, (const GLvoid *) (pc + 32));
 }
 
 void
-__glXDisp_CompressedTexSubImage3DARB(GLbyte * pc)
+__glXDisp_CompressedTexSubImage3D(GLbyte * pc)
 {
+    PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC CompressedTexSubImage3D =
+        __glGetProcAddress("glCompressedTexSubImage3D");
     const GLsizei imageSize = *(GLsizei *) (pc + 36);
 
-    CALL_CompressedTexSubImage3DARB(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                                     *(GLint *) (pc + 4),
-                                                     *(GLint *) (pc + 8),
-                                                     *(GLint *) (pc + 12),
-                                                     *(GLint *) (pc + 16),
-                                                     *(GLsizei *) (pc + 20),
-                                                     *(GLsizei *) (pc + 24),
-                                                     *(GLsizei *) (pc + 28),
-                                                     *(GLenum *) (pc + 32),
-                                                     imageSize,
-                                                     (const GLvoid *) (pc + 40)
-                                    ));
+    CompressedTexSubImage3D(*(GLenum *) (pc + 0),
+                            *(GLint *) (pc + 4),
+                            *(GLint *) (pc + 8),
+                            *(GLint *) (pc + 12),
+                            *(GLint *) (pc + 16),
+                            *(GLsizei *) (pc + 20),
+                            *(GLsizei *) (pc + 24),
+                            *(GLsizei *) (pc + 28),
+                            *(GLenum *) (pc + 32),
+                            imageSize, (const GLvoid *) (pc + 40));
 }
 
-int
-__glXDisp_GetProgramEnvParameterdvARB(__GLXclientState * cl, GLbyte * pc)
+void
+__glXDisp_SampleCoverage(GLbyte * pc)
 {
-    xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc;
-    int error;
-    __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error);
+    PFNGLSAMPLECOVERAGEPROC SampleCoverage =
+        __glGetProcAddress("glSampleCoverage");
+    SampleCoverage(*(GLclampf *) (pc + 0), *(GLboolean *) (pc + 4));
+}
 
-    pc += __GLX_VENDPRIV_HDR_SIZE;
-    if (cx != NULL) {
-        GLdouble params[4];
+void
+__glXDisp_BlendFuncSeparate(GLbyte * pc)
+{
+    PFNGLBLENDFUNCSEPARATEPROC BlendFuncSeparate =
+        __glGetProcAddress("glBlendFuncSeparate");
+    BlendFuncSeparate(*(GLenum *) (pc + 0), *(GLenum *) (pc + 4),
+                      *(GLenum *) (pc + 8), *(GLenum *) (pc + 12));
+}
 
-        CALL_GetProgramEnvParameterdvARB(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                                          *(GLuint *) (pc + 4),
-                                                          params));
-        __glXSendReply(cl->client, params, 4, 8, GL_FALSE, 0);
-        error = Success;
+void
+__glXDisp_FogCoorddv(GLbyte * pc)
+{
+    PFNGLFOGCOORDDVPROC FogCoorddv = __glGetProcAddress("glFogCoorddv");
+
+#ifdef __GLX_ALIGN64
+    if ((unsigned long) (pc) & 7) {
+        (void) memmove(pc - 4, pc, 8);
+        pc -= 4;
     }
+#endif
 
-    return error;
+    FogCoorddv((const GLdouble *) (pc + 0));
 }
 
-int
-__glXDisp_GetProgramEnvParameterfvARB(__GLXclientState * cl, GLbyte * pc)
+void
+__glXDisp_PointParameterf(GLbyte * pc)
 {
-    xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc;
-    int error;
-    __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error);
+    PFNGLPOINTPARAMETERFPROC PointParameterf =
+        __glGetProcAddress("glPointParameterf");
+    PointParameterf(*(GLenum *) (pc + 0), *(GLfloat *) (pc + 4));
+}
 
-    pc += __GLX_VENDPRIV_HDR_SIZE;
-    if (cx != NULL) {
-        GLfloat params[4];
+void
+__glXDisp_PointParameterfv(GLbyte * pc)
+{
+    PFNGLPOINTPARAMETERFVPROC PointParameterfv =
+        __glGetProcAddress("glPointParameterfv");
+    const GLenum pname = *(GLenum *) (pc + 0);
+    const GLfloat *params;
 
-        CALL_GetProgramEnvParameterfvARB(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                                          *(GLuint *) (pc + 4),
-                                                          params));
-        __glXSendReply(cl->client, params, 4, 4, GL_FALSE, 0);
-        error = Success;
-    }
+    params = (const GLfloat *) (pc + 4);
 
-    return error;
+    PointParameterfv(pname, params);
 }
 
-int
-__glXDisp_GetProgramLocalParameterdvARB(__GLXclientState * cl, GLbyte * pc)
+void
+__glXDisp_PointParameteri(GLbyte * pc)
 {
-    xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc;
-    int error;
-    __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error);
+    PFNGLPOINTPARAMETERIPROC PointParameteri =
+        __glGetProcAddress("glPointParameteri");
+    PointParameteri(*(GLenum *) (pc + 0), *(GLint *) (pc + 4));
+}
 
-    pc += __GLX_VENDPRIV_HDR_SIZE;
-    if (cx != NULL) {
-        GLdouble params[4];
+void
+__glXDisp_PointParameteriv(GLbyte * pc)
+{
+    PFNGLPOINTPARAMETERIVPROC PointParameteriv =
+        __glGetProcAddress("glPointParameteriv");
+    const GLenum pname = *(GLenum *) (pc + 0);
+    const GLint *params;
 
-        CALL_GetProgramLocalParameterdvARB(GET_DISPATCH(),
-                                           (*(GLenum *) (pc + 0),
-                                            *(GLuint *) (pc + 4), params));
-        __glXSendReply(cl->client, params, 4, 8, GL_FALSE, 0);
-        error = Success;
+    params = (const GLint *) (pc + 4);
+
+    PointParameteriv(pname, params);
+}
+
+void
+__glXDisp_SecondaryColor3bv(GLbyte * pc)
+{
+    PFNGLSECONDARYCOLOR3BVPROC SecondaryColor3bv =
+        __glGetProcAddress("glSecondaryColor3bv");
+    SecondaryColor3bv((const GLbyte *) (pc + 0));
+}
+
+void
+__glXDisp_SecondaryColor3dv(GLbyte * pc)
+{
+    PFNGLSECONDARYCOLOR3DVPROC SecondaryColor3dv =
+        __glGetProcAddress("glSecondaryColor3dv");
+#ifdef __GLX_ALIGN64
+    if ((unsigned long) (pc) & 7) {
+        (void) memmove(pc - 4, pc, 24);
+        pc -= 4;
     }
+#endif
 
-    return error;
+    SecondaryColor3dv((const GLdouble *) (pc + 0));
+}
+
+void
+__glXDisp_SecondaryColor3iv(GLbyte * pc)
+{
+    PFNGLSECONDARYCOLOR3IVPROC SecondaryColor3iv =
+        __glGetProcAddress("glSecondaryColor3iv");
+    SecondaryColor3iv((const GLint *) (pc + 0));
+}
+
+void
+__glXDisp_SecondaryColor3sv(GLbyte * pc)
+{
+    PFNGLSECONDARYCOLOR3SVPROC SecondaryColor3sv =
+        __glGetProcAddress("glSecondaryColor3sv");
+    SecondaryColor3sv((const GLshort *) (pc + 0));
+}
+
+void
+__glXDisp_SecondaryColor3ubv(GLbyte * pc)
+{
+    PFNGLSECONDARYCOLOR3UBVPROC SecondaryColor3ubv =
+        __glGetProcAddress("glSecondaryColor3ubv");
+    SecondaryColor3ubv((const GLubyte *) (pc + 0));
+}
+
+void
+__glXDisp_SecondaryColor3uiv(GLbyte * pc)
+{
+    PFNGLSECONDARYCOLOR3UIVPROC SecondaryColor3uiv =
+        __glGetProcAddress("glSecondaryColor3uiv");
+    SecondaryColor3uiv((const GLuint *) (pc + 0));
+}
+
+void
+__glXDisp_SecondaryColor3usv(GLbyte * pc)
+{
+    PFNGLSECONDARYCOLOR3USVPROC SecondaryColor3usv =
+        __glGetProcAddress("glSecondaryColor3usv");
+    SecondaryColor3usv((const GLushort *) (pc + 0));
+}
+
+void
+__glXDisp_WindowPos3fv(GLbyte * pc)
+{
+    PFNGLWINDOWPOS3FVPROC WindowPos3fv = __glGetProcAddress("glWindowPos3fv");
+
+    WindowPos3fv((const GLfloat *) (pc + 0));
+}
+
+void
+__glXDisp_BeginQuery(GLbyte * pc)
+{
+    PFNGLBEGINQUERYPROC BeginQuery = __glGetProcAddress("glBeginQuery");
+
+    BeginQuery(*(GLenum *) (pc + 0), *(GLuint *) (pc + 4));
 }
 
 int
-__glXDisp_GetProgramLocalParameterfvARB(__GLXclientState * cl, GLbyte * pc)
+__glXDisp_DeleteQueries(__GLXclientState * cl, GLbyte * pc)
 {
-    xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc;
+    PFNGLDELETEQUERIESPROC DeleteQueries =
+        __glGetProcAddress("glDeleteQueries");
+    xGLXSingleReq *const req = (xGLXSingleReq *) pc;
     int error;
     __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error);
 
-    pc += __GLX_VENDPRIV_HDR_SIZE;
+    pc += __GLX_SINGLE_HDR_SIZE;
     if (cx != NULL) {
-        GLfloat params[4];
+        const GLsizei n = *(GLsizei *) (pc + 0);
 
-        CALL_GetProgramLocalParameterfvARB(GET_DISPATCH(),
-                                           (*(GLenum *) (pc + 0),
-                                            *(GLuint *) (pc + 4), params));
-        __glXSendReply(cl->client, params, 4, 4, GL_FALSE, 0);
+        DeleteQueries(n, (const GLuint *) (pc + 4));
         error = Success;
     }
 
     return error;
 }
 
+void
+__glXDisp_EndQuery(GLbyte * pc)
+{
+    PFNGLENDQUERYPROC EndQuery = __glGetProcAddress("glEndQuery");
+
+    EndQuery(*(GLenum *) (pc + 0));
+}
+
 int
-__glXDisp_GetProgramivARB(__GLXclientState * cl, GLbyte * pc)
+__glXDisp_GenQueries(__GLXclientState * cl, GLbyte * pc)
 {
-    xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc;
+    PFNGLGENQUERIESPROC GenQueries = __glGetProcAddress("glGenQueries");
+    xGLXSingleReq *const req = (xGLXSingleReq *) pc;
     int error;
     __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error);
 
-    pc += __GLX_VENDPRIV_HDR_SIZE;
+    pc += __GLX_SINGLE_HDR_SIZE;
     if (cx != NULL) {
-        const GLenum pname = *(GLenum *) (pc + 4);
-
-        const GLuint compsize = __glGetProgramivARB_size(pname);
-        GLint answerBuffer[200];
-        GLint *params =
-            __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer,
-                                 sizeof(answerBuffer), 4);
-
-        if (params == NULL)
-            return BadAlloc;
-        __glXClearErrorOccured();
+        const GLsizei n = *(GLsizei *) (pc + 0);
 
-        CALL_GetProgramivARB(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                              pname, params));
-        __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
+        GLuint answerBuffer[200];
+        GLuint *ids =
+            __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer),
+                                 4);
+        GenQueries(n, ids);
+        __glXSendReply(cl->client, ids, n, 4, GL_TRUE, 0);
         error = Success;
     }
 
@@ -4186,29 +3892,30 @@ __glXDisp_GetProgramivARB(__GLXclientState * cl, GLbyte * pc)
 }
 
 int
-__glXDisp_GetVertexAttribdvARB(__GLXclientState * cl, GLbyte * pc)
+__glXDisp_GetQueryObjectiv(__GLXclientState * cl, GLbyte * pc)
 {
-    xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc;
+    PFNGLGETQUERYOBJECTIVPROC GetQueryObjectiv =
+        __glGetProcAddress("glGetQueryObjectiv");
+    xGLXSingleReq *const req = (xGLXSingleReq *) pc;
     int error;
     __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error);
 
-    pc += __GLX_VENDPRIV_HDR_SIZE;
+    pc += __GLX_SINGLE_HDR_SIZE;
     if (cx != NULL) {
         const GLenum pname = *(GLenum *) (pc + 4);
 
-        const GLuint compsize = __glGetVertexAttribdvARB_size(pname);
-        GLdouble answerBuffer[200];
-        GLdouble *params =
-            __glXGetAnswerBuffer(cl, compsize * 8, answerBuffer,
-                                 sizeof(answerBuffer), 8);
+        const GLuint compsize = __glGetQueryObjectiv_size(pname);
+        GLint answerBuffer[200];
+        GLint *params =
+            __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer,
+                                 sizeof(answerBuffer), 4);
 
         if (params == NULL)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetVertexAttribdvARB(GET_DISPATCH(), (*(GLuint *) (pc + 0),
-                                                   pname, params));
-        __glXSendReply(cl->client, params, compsize, 8, GL_FALSE, 0);
+        GetQueryObjectiv(*(GLuint *) (pc + 0), pname, params);
+        __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
         error = Success;
     }
 
@@ -4216,19 +3923,21 @@ __glXDisp_GetVertexAttribdvARB(__GLXclientState * cl, GLbyte * pc)
 }
 
 int
-__glXDisp_GetVertexAttribfvARB(__GLXclientState * cl, GLbyte * pc)
+__glXDisp_GetQueryObjectuiv(__GLXclientState * cl, GLbyte * pc)
 {
-    xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc;
+    PFNGLGETQUERYOBJECTUIVPROC GetQueryObjectuiv =
+        __glGetProcAddress("glGetQueryObjectuiv");
+    xGLXSingleReq *const req = (xGLXSingleReq *) pc;
     int error;
     __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error);
 
-    pc += __GLX_VENDPRIV_HDR_SIZE;
+    pc += __GLX_SINGLE_HDR_SIZE;
     if (cx != NULL) {
         const GLenum pname = *(GLenum *) (pc + 4);
 
-        const GLuint compsize = __glGetVertexAttribfvARB_size(pname);
-        GLfloat answerBuffer[200];
-        GLfloat *params =
+        const GLuint compsize = __glGetQueryObjectuiv_size(pname);
+        GLuint answerBuffer[200];
+        GLuint *params =
             __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer,
                                  sizeof(answerBuffer), 4);
 
@@ -4236,8 +3945,7 @@ __glXDisp_GetVertexAttribfvARB(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetVertexAttribfvARB(GET_DISPATCH(), (*(GLuint *) (pc + 0),
-                                                   pname, params));
+        GetQueryObjectuiv(*(GLuint *) (pc + 0), pname, params);
         __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
         error = Success;
     }
@@ -4246,17 +3954,18 @@ __glXDisp_GetVertexAttribfvARB(__GLXclientState * cl, GLbyte * pc)
 }
 
 int
-__glXDisp_GetVertexAttribivARB(__GLXclientState * cl, GLbyte * pc)
+__glXDisp_GetQueryiv(__GLXclientState * cl, GLbyte * pc)
 {
-    xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc;
+    PFNGLGETQUERYIVPROC GetQueryiv = __glGetProcAddress("glGetQueryiv");
+    xGLXSingleReq *const req = (xGLXSingleReq *) pc;
     int error;
     __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error);
 
-    pc += __GLX_VENDPRIV_HDR_SIZE;
+    pc += __GLX_SINGLE_HDR_SIZE;
     if (cx != NULL) {
         const GLenum pname = *(GLenum *) (pc + 4);
 
-        const GLuint compsize = __glGetVertexAttribivARB_size(pname);
+        const GLuint compsize = __glGetQueryiv_size(pname);
         GLint answerBuffer[200];
         GLint *params =
             __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer,
@@ -4266,8 +3975,7 @@ __glXDisp_GetVertexAttribivARB(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetVertexAttribivARB(GET_DISPATCH(), (*(GLuint *) (pc + 0),
-                                                   pname, params));
+        GetQueryiv(*(GLenum *) (pc + 0), pname, params);
         __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
         error = Success;
     }
@@ -4275,71 +3983,48 @@ __glXDisp_GetVertexAttribivARB(__GLXclientState * cl, GLbyte * pc)
     return error;
 }
 
-void
-__glXDisp_ProgramEnvParameter4dvARB(GLbyte * pc)
+int
+__glXDisp_IsQuery(__GLXclientState * cl, GLbyte * pc)
 {
-#ifdef __GLX_ALIGN64
-    if ((unsigned long) (pc) & 7) {
-        (void) memmove(pc - 4, pc, 40);
-        pc -= 4;
-    }
-#endif
-
-    CALL_ProgramEnvParameter4dvARB(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                                    *(GLuint *) (pc + 4),
-                                                    (const GLdouble *) (pc + 8)
-                                   ));
-}
+    PFNGLISQUERYPROC IsQuery = __glGetProcAddress("glIsQuery");
+    xGLXSingleReq *const req = (xGLXSingleReq *) pc;
+    int error;
+    __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error);
 
-void
-__glXDisp_ProgramEnvParameter4fvARB(GLbyte * pc)
-{
-    CALL_ProgramEnvParameter4fvARB(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                                    *(GLuint *) (pc + 4),
-                                                    (const GLfloat *) (pc + 8)
-                                   ));
-}
+    pc += __GLX_SINGLE_HDR_SIZE;
+    if (cx != NULL) {
+        GLboolean retval;
 
-void
-__glXDisp_ProgramLocalParameter4dvARB(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
-    if ((unsigned long) (pc) & 7) {
-        (void) memmove(pc - 4, pc, 40);
-        pc -= 4;
+        retval = IsQuery(*(GLuint *) (pc + 0));
+        __glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval);
+        error = Success;
     }
-#endif
 
-    CALL_ProgramLocalParameter4dvARB(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                                      *(GLuint *) (pc + 4),
-                                                      (const GLdouble *) (pc +
-                                                                          8)
-                                     ));
+    return error;
 }
 
 void
-__glXDisp_ProgramLocalParameter4fvARB(GLbyte * pc)
+__glXDisp_BlendEquationSeparate(GLbyte * pc)
 {
-    CALL_ProgramLocalParameter4fvARB(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                                      *(GLuint *) (pc + 4),
-                                                      (const GLfloat *) (pc + 8)
-                                     ));
+    PFNGLBLENDEQUATIONSEPARATEPROC BlendEquationSeparate =
+        __glGetProcAddress("glBlendEquationSeparate");
+    BlendEquationSeparate(*(GLenum *) (pc + 0), *(GLenum *) (pc + 4));
 }
 
 void
-__glXDisp_ProgramStringARB(GLbyte * pc)
+__glXDisp_DrawBuffers(GLbyte * pc)
 {
-    const GLsizei len = *(GLsizei *) (pc + 8);
+    PFNGLDRAWBUFFERSPROC DrawBuffers = __glGetProcAddress("glDrawBuffers");
+    const GLsizei n = *(GLsizei *) (pc + 0);
 
-    CALL_ProgramStringARB(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                           *(GLenum *) (pc + 4),
-                                           len, (const GLvoid *) (pc + 12)
-                          ));
+    DrawBuffers(n, (const GLenum *) (pc + 4));
 }
 
 void
-__glXDisp_VertexAttrib1dvARB(GLbyte * pc)
+__glXDisp_VertexAttrib1dv(GLbyte * pc)
 {
+    PFNGLVERTEXATTRIB1DVPROC VertexAttrib1dv =
+        __glGetProcAddress("glVertexAttrib1dv");
 #ifdef __GLX_ALIGN64
     if ((unsigned long) (pc) & 7) {
         (void) memmove(pc - 4, pc, 12);
@@ -4347,30 +4032,22 @@ __glXDisp_VertexAttrib1dvARB(GLbyte * pc)
     }
 #endif
 
-    CALL_VertexAttrib1dvARB(GET_DISPATCH(), (*(GLuint *) (pc + 0),
-                                             (const GLdouble *) (pc + 4)
-                            ));
-}
-
-void
-__glXDisp_VertexAttrib1fvARB(GLbyte * pc)
-{
-    CALL_VertexAttrib1fvARB(GET_DISPATCH(), (*(GLuint *) (pc + 0),
-                                             (const GLfloat *) (pc + 4)
-                            ));
+    VertexAttrib1dv(*(GLuint *) (pc + 0), (const GLdouble *) (pc + 4));
 }
 
 void
-__glXDisp_VertexAttrib1svARB(GLbyte * pc)
+__glXDisp_VertexAttrib1sv(GLbyte * pc)
 {
-    CALL_VertexAttrib1svARB(GET_DISPATCH(), (*(GLuint *) (pc + 0),
-                                             (const GLshort *) (pc + 4)
-                            ));
+    PFNGLVERTEXATTRIB1SVPROC VertexAttrib1sv =
+        __glGetProcAddress("glVertexAttrib1sv");
+    VertexAttrib1sv(*(GLuint *) (pc + 0), (const GLshort *) (pc + 4));
 }
 
 void
-__glXDisp_VertexAttrib2dvARB(GLbyte * pc)
+__glXDisp_VertexAttrib2dv(GLbyte * pc)
 {
+    PFNGLVERTEXATTRIB2DVPROC VertexAttrib2dv =
+        __glGetProcAddress("glVertexAttrib2dv");
 #ifdef __GLX_ALIGN64
     if ((unsigned long) (pc) & 7) {
         (void) memmove(pc - 4, pc, 20);
@@ -4378,30 +4055,22 @@ __glXDisp_VertexAttrib2dvARB(GLbyte * pc)
     }
 #endif
 
-    CALL_VertexAttrib2dvARB(GET_DISPATCH(), (*(GLuint *) (pc + 0),
-                                             (const GLdouble *) (pc + 4)
-                            ));
+    VertexAttrib2dv(*(GLuint *) (pc + 0), (const GLdouble *) (pc + 4));
 }
 
 void
-__glXDisp_VertexAttrib2fvARB(GLbyte * pc)
-{
-    CALL_VertexAttrib2fvARB(GET_DISPATCH(), (*(GLuint *) (pc + 0),
-                                             (const GLfloat *) (pc + 4)
-                            ));
-}
-
-void
-__glXDisp_VertexAttrib2svARB(GLbyte * pc)
+__glXDisp_VertexAttrib2sv(GLbyte * pc)
 {
-    CALL_VertexAttrib2svARB(GET_DISPATCH(), (*(GLuint *) (pc + 0),
-                                             (const GLshort *) (pc + 4)
-                            ));
+    PFNGLVERTEXATTRIB2SVPROC VertexAttrib2sv =
+        __glGetProcAddress("glVertexAttrib2sv");
+    VertexAttrib2sv(*(GLuint *) (pc + 0), (const GLshort *) (pc + 4));
 }
 
 void
-__glXDisp_VertexAttrib3dvARB(GLbyte * pc)
+__glXDisp_VertexAttrib3dv(GLbyte * pc)
 {
+    PFNGLVERTEXATTRIB3DVPROC VertexAttrib3dv =
+        __glGetProcAddress("glVertexAttrib3dv");
 #ifdef __GLX_ALIGN64
     if ((unsigned long) (pc) & 7) {
         (void) memmove(pc - 4, pc, 28);
@@ -4409,86 +4078,78 @@ __glXDisp_VertexAttrib3dvARB(GLbyte * pc)
     }
 #endif
 
-    CALL_VertexAttrib3dvARB(GET_DISPATCH(), (*(GLuint *) (pc + 0),
-                                             (const GLdouble *) (pc + 4)
-                            ));
-}
-
-void
-__glXDisp_VertexAttrib3fvARB(GLbyte * pc)
-{
-    CALL_VertexAttrib3fvARB(GET_DISPATCH(), (*(GLuint *) (pc + 0),
-                                             (const GLfloat *) (pc + 4)
-                            ));
+    VertexAttrib3dv(*(GLuint *) (pc + 0), (const GLdouble *) (pc + 4));
 }
 
 void
-__glXDisp_VertexAttrib3svARB(GLbyte * pc)
+__glXDisp_VertexAttrib3sv(GLbyte * pc)
 {
-    CALL_VertexAttrib3svARB(GET_DISPATCH(), (*(GLuint *) (pc + 0),
-                                             (const GLshort *) (pc + 4)
-                            ));
+    PFNGLVERTEXATTRIB3SVPROC VertexAttrib3sv =
+        __glGetProcAddress("glVertexAttrib3sv");
+    VertexAttrib3sv(*(GLuint *) (pc + 0), (const GLshort *) (pc + 4));
 }
 
 void
-__glXDisp_VertexAttrib4NbvARB(GLbyte * pc)
+__glXDisp_VertexAttrib4Nbv(GLbyte * pc)
 {
-    CALL_VertexAttrib4NbvARB(GET_DISPATCH(), (*(GLuint *) (pc + 0),
-                                              (const GLbyte *) (pc + 4)
-                             ));
+    PFNGLVERTEXATTRIB4NBVPROC VertexAttrib4Nbv =
+        __glGetProcAddress("glVertexAttrib4Nbv");
+    VertexAttrib4Nbv(*(GLuint *) (pc + 0), (const GLbyte *) (pc + 4));
 }
 
 void
-__glXDisp_VertexAttrib4NivARB(GLbyte * pc)
+__glXDisp_VertexAttrib4Niv(GLbyte * pc)
 {
-    CALL_VertexAttrib4NivARB(GET_DISPATCH(), (*(GLuint *) (pc + 0),
-                                              (const GLint *) (pc + 4)
-                             ));
+    PFNGLVERTEXATTRIB4NIVPROC VertexAttrib4Niv =
+        __glGetProcAddress("glVertexAttrib4Niv");
+    VertexAttrib4Niv(*(GLuint *) (pc + 0), (const GLint *) (pc + 4));
 }
 
 void
-__glXDisp_VertexAttrib4NsvARB(GLbyte * pc)
+__glXDisp_VertexAttrib4Nsv(GLbyte * pc)
 {
-    CALL_VertexAttrib4NsvARB(GET_DISPATCH(), (*(GLuint *) (pc + 0),
-                                              (const GLshort *) (pc + 4)
-                             ));
+    PFNGLVERTEXATTRIB4NSVPROC VertexAttrib4Nsv =
+        __glGetProcAddress("glVertexAttrib4Nsv");
+    VertexAttrib4Nsv(*(GLuint *) (pc + 0), (const GLshort *) (pc + 4));
 }
 
 void
-__glXDisp_VertexAttrib4NubvARB(GLbyte * pc)
+__glXDisp_VertexAttrib4Nubv(GLbyte * pc)
 {
-    CALL_VertexAttrib4NubvARB(GET_DISPATCH(), (*(GLuint *) (pc + 0),
-                                               (const GLubyte *) (pc + 4)
-                              ));
+    PFNGLVERTEXATTRIB4NUBVPROC VertexAttrib4Nubv =
+        __glGetProcAddress("glVertexAttrib4Nubv");
+    VertexAttrib4Nubv(*(GLuint *) (pc + 0), (const GLubyte *) (pc + 4));
 }
 
 void
-__glXDisp_VertexAttrib4NuivARB(GLbyte * pc)
+__glXDisp_VertexAttrib4Nuiv(GLbyte * pc)
 {
-    CALL_VertexAttrib4NuivARB(GET_DISPATCH(), (*(GLuint *) (pc + 0),
-                                               (const GLuint *) (pc + 4)
-                              ));
+    PFNGLVERTEXATTRIB4NUIVPROC VertexAttrib4Nuiv =
+        __glGetProcAddress("glVertexAttrib4Nuiv");
+    VertexAttrib4Nuiv(*(GLuint *) (pc + 0), (const GLuint *) (pc + 4));
 }
 
 void
-__glXDisp_VertexAttrib4NusvARB(GLbyte * pc)
+__glXDisp_VertexAttrib4Nusv(GLbyte * pc)
 {
-    CALL_VertexAttrib4NusvARB(GET_DISPATCH(), (*(GLuint *) (pc + 0),
-                                               (const GLushort *) (pc + 4)
-                              ));
+    PFNGLVERTEXATTRIB4NUSVPROC VertexAttrib4Nusv =
+        __glGetProcAddress("glVertexAttrib4Nusv");
+    VertexAttrib4Nusv(*(GLuint *) (pc + 0), (const GLushort *) (pc + 4));
 }
 
 void
-__glXDisp_VertexAttrib4bvARB(GLbyte * pc)
+__glXDisp_VertexAttrib4bv(GLbyte * pc)
 {
-    CALL_VertexAttrib4bvARB(GET_DISPATCH(), (*(GLuint *) (pc + 0),
-                                             (const GLbyte *) (pc + 4)
-                            ));
+    PFNGLVERTEXATTRIB4BVPROC VertexAttrib4bv =
+        __glGetProcAddress("glVertexAttrib4bv");
+    VertexAttrib4bv(*(GLuint *) (pc + 0), (const GLbyte *) (pc + 4));
 }
 
 void
-__glXDisp_VertexAttrib4dvARB(GLbyte * pc)
+__glXDisp_VertexAttrib4dv(GLbyte * pc)
 {
+    PFNGLVERTEXATTRIB4DVPROC VertexAttrib4dv =
+        __glGetProcAddress("glVertexAttrib4dv");
 #ifdef __GLX_ALIGN64
     if ((unsigned long) (pc) & 7) {
         (void) memmove(pc - 4, pc, 36);
@@ -4496,110 +4157,104 @@ __glXDisp_VertexAttrib4dvARB(GLbyte * pc)
     }
 #endif
 
-    CALL_VertexAttrib4dvARB(GET_DISPATCH(), (*(GLuint *) (pc + 0),
-                                             (const GLdouble *) (pc + 4)
-                            ));
+    VertexAttrib4dv(*(GLuint *) (pc + 0), (const GLdouble *) (pc + 4));
 }
 
 void
-__glXDisp_VertexAttrib4fvARB(GLbyte * pc)
+__glXDisp_VertexAttrib4iv(GLbyte * pc)
 {
-    CALL_VertexAttrib4fvARB(GET_DISPATCH(), (*(GLuint *) (pc + 0),
-                                             (const GLfloat *) (pc + 4)
-                            ));
+    PFNGLVERTEXATTRIB4IVPROC VertexAttrib4iv =
+        __glGetProcAddress("glVertexAttrib4iv");
+    VertexAttrib4iv(*(GLuint *) (pc + 0), (const GLint *) (pc + 4));
 }
 
 void
-__glXDisp_VertexAttrib4ivARB(GLbyte * pc)
+__glXDisp_VertexAttrib4sv(GLbyte * pc)
 {
-    CALL_VertexAttrib4ivARB(GET_DISPATCH(), (*(GLuint *) (pc + 0),
-                                             (const GLint *) (pc + 4)
-                            ));
+    PFNGLVERTEXATTRIB4SVPROC VertexAttrib4sv =
+        __glGetProcAddress("glVertexAttrib4sv");
+    VertexAttrib4sv(*(GLuint *) (pc + 0), (const GLshort *) (pc + 4));
 }
 
 void
-__glXDisp_VertexAttrib4svARB(GLbyte * pc)
+__glXDisp_VertexAttrib4ubv(GLbyte * pc)
 {
-    CALL_VertexAttrib4svARB(GET_DISPATCH(), (*(GLuint *) (pc + 0),
-                                             (const GLshort *) (pc + 4)
-                            ));
+    PFNGLVERTEXATTRIB4UBVPROC VertexAttrib4ubv =
+        __glGetProcAddress("glVertexAttrib4ubv");
+    VertexAttrib4ubv(*(GLuint *) (pc + 0), (const GLubyte *) (pc + 4));
 }
 
 void
-__glXDisp_VertexAttrib4ubvARB(GLbyte * pc)
+__glXDisp_VertexAttrib4uiv(GLbyte * pc)
 {
-    CALL_VertexAttrib4ubvARB(GET_DISPATCH(), (*(GLuint *) (pc + 0),
-                                              (const GLubyte *) (pc + 4)
-                             ));
+    PFNGLVERTEXATTRIB4UIVPROC VertexAttrib4uiv =
+        __glGetProcAddress("glVertexAttrib4uiv");
+    VertexAttrib4uiv(*(GLuint *) (pc + 0), (const GLuint *) (pc + 4));
 }
 
 void
-__glXDisp_VertexAttrib4uivARB(GLbyte * pc)
+__glXDisp_VertexAttrib4usv(GLbyte * pc)
 {
-    CALL_VertexAttrib4uivARB(GET_DISPATCH(), (*(GLuint *) (pc + 0),
-                                              (const GLuint *) (pc + 4)
-                             ));
+    PFNGLVERTEXATTRIB4USVPROC VertexAttrib4usv =
+        __glGetProcAddress("glVertexAttrib4usv");
+    VertexAttrib4usv(*(GLuint *) (pc + 0), (const GLushort *) (pc + 4));
 }
 
 void
-__glXDisp_VertexAttrib4usvARB(GLbyte * pc)
+__glXDisp_ClampColor(GLbyte * pc)
 {
-    CALL_VertexAttrib4usvARB(GET_DISPATCH(), (*(GLuint *) (pc + 0),
-                                              (const GLushort *) (pc + 4)
-                             ));
+    PFNGLCLAMPCOLORPROC ClampColor = __glGetProcAddress("glClampColor");
+
+    ClampColor(*(GLenum *) (pc + 0), *(GLenum *) (pc + 4));
 }
 
 void
-__glXDisp_BeginQueryARB(GLbyte * pc)
+__glXDisp_BindProgramARB(GLbyte * pc)
 {
-    CALL_BeginQueryARB(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                        *(GLuint *) (pc + 4)
-                       ));
+    PFNGLBINDPROGRAMARBPROC BindProgramARB =
+        __glGetProcAddress("glBindProgramARB");
+    BindProgramARB(*(GLenum *) (pc + 0), *(GLuint *) (pc + 4));
 }
 
 int
-__glXDisp_DeleteQueriesARB(__GLXclientState * cl, GLbyte * pc)
+__glXDisp_DeleteProgramsARB(__GLXclientState * cl, GLbyte * pc)
 {
-    xGLXSingleReq *const req = (xGLXSingleReq *) pc;
+    PFNGLDELETEPROGRAMSARBPROC DeleteProgramsARB =
+        __glGetProcAddress("glDeleteProgramsARB");
+    xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc;
     int error;
     __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error);
 
-    pc += __GLX_SINGLE_HDR_SIZE;
+    pc += __GLX_VENDPRIV_HDR_SIZE;
     if (cx != NULL) {
         const GLsizei n = *(GLsizei *) (pc + 0);
 
-        CALL_DeleteQueriesARB(GET_DISPATCH(), (n, (const GLuint *) (pc + 4)
-                              ));
+        DeleteProgramsARB(n, (const GLuint *) (pc + 4));
         error = Success;
     }
 
     return error;
 }
 
-void
-__glXDisp_EndQueryARB(GLbyte * pc)
-{
-    CALL_EndQueryARB(GET_DISPATCH(), (*(GLenum *) (pc + 0)
-                     ));
-}
-
 int
-__glXDisp_GenQueriesARB(__GLXclientState * cl, GLbyte * pc)
+__glXDisp_GenProgramsARB(__GLXclientState * cl, GLbyte * pc)
 {
-    xGLXSingleReq *const req = (xGLXSingleReq *) pc;
+    PFNGLGENPROGRAMSARBPROC GenProgramsARB =
+        __glGetProcAddress("glGenProgramsARB");
+    xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc;
     int error;
     __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error);
 
-    pc += __GLX_SINGLE_HDR_SIZE;
+    pc += __GLX_VENDPRIV_HDR_SIZE;
     if (cx != NULL) {
         const GLsizei n = *(GLsizei *) (pc + 0);
 
         GLuint answerBuffer[200];
-        GLuint *ids =
+        GLuint *programs =
             __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer),
                                  4);
-        CALL_GenQueriesARB(GET_DISPATCH(), (n, ids));
-        __glXSendReply(cl->client, ids, n, 4, GL_TRUE, 0);
+        GenProgramsARB(n, programs);
+        __glXSendReply(cl->client, programs, n, 4, GL_TRUE, 0);
         error = Success;
     }
 
@@ -4607,29 +4262,43 @@ __glXDisp_GenQueriesARB(__GLXclientState * cl, GLbyte * pc)
 }
 
 int
-__glXDisp_GetQueryObjectivARB(__GLXclientState * cl, GLbyte * pc)
+__glXDisp_GetProgramEnvParameterdvARB(__GLXclientState * cl, GLbyte * pc)
 {
-    xGLXSingleReq *const req = (xGLXSingleReq *) pc;
+    PFNGLGETPROGRAMENVPARAMETERDVARBPROC GetProgramEnvParameterdvARB =
+        __glGetProcAddress("glGetProgramEnvParameterdvARB");
+    xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc;
     int error;
     __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error);
 
-    pc += __GLX_SINGLE_HDR_SIZE;
+    pc += __GLX_VENDPRIV_HDR_SIZE;
     if (cx != NULL) {
-        const GLenum pname = *(GLenum *) (pc + 4);
-
-        const GLuint compsize = __glGetQueryObjectivARB_size(pname);
-        GLint answerBuffer[200];
-        GLint *params =
-            __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer,
-                                 sizeof(answerBuffer), 4);
+        GLdouble params[4];
 
-        if (params == NULL)
-            return BadAlloc;
-        __glXClearErrorOccured();
+        GetProgramEnvParameterdvARB(*(GLenum *) (pc + 0),
+                                    *(GLuint *) (pc + 4), params);
+        __glXSendReply(cl->client, params, 4, 8, GL_FALSE, 0);
+        error = Success;
+    }
 
-        CALL_GetQueryObjectivARB(GET_DISPATCH(), (*(GLuint *) (pc + 0),
-                                                  pname, params));
-        __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
+    return error;
+}
+
+int
+__glXDisp_GetProgramEnvParameterfvARB(__GLXclientState * cl, GLbyte * pc)
+{
+    PFNGLGETPROGRAMENVPARAMETERFVARBPROC GetProgramEnvParameterfvARB =
+        __glGetProcAddress("glGetProgramEnvParameterfvARB");
+    xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc;
+    int error;
+    __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+    pc += __GLX_VENDPRIV_HDR_SIZE;
+    if (cx != NULL) {
+        GLfloat params[4];
+
+        GetProgramEnvParameterfvARB(*(GLenum *) (pc + 0),
+                                    *(GLuint *) (pc + 4), params);
+        __glXSendReply(cl->client, params, 4, 4, GL_FALSE, 0);
         error = Success;
     }
 
@@ -4637,29 +4306,43 @@ __glXDisp_GetQueryObjectivARB(__GLXclientState * cl, GLbyte * pc)
 }
 
 int
-__glXDisp_GetQueryObjectuivARB(__GLXclientState * cl, GLbyte * pc)
+__glXDisp_GetProgramLocalParameterdvARB(__GLXclientState * cl, GLbyte * pc)
 {
-    xGLXSingleReq *const req = (xGLXSingleReq *) pc;
+    PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC GetProgramLocalParameterdvARB =
+        __glGetProcAddress("glGetProgramLocalParameterdvARB");
+    xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc;
     int error;
     __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error);
 
-    pc += __GLX_SINGLE_HDR_SIZE;
+    pc += __GLX_VENDPRIV_HDR_SIZE;
     if (cx != NULL) {
-        const GLenum pname = *(GLenum *) (pc + 4);
+        GLdouble params[4];
 
-        const GLuint compsize = __glGetQueryObjectuivARB_size(pname);
-        GLuint answerBuffer[200];
-        GLuint *params =
-            __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer,
-                                 sizeof(answerBuffer), 4);
+        GetProgramLocalParameterdvARB(*(GLenum *) (pc + 0),
+                                      *(GLuint *) (pc + 4), params);
+        __glXSendReply(cl->client, params, 4, 8, GL_FALSE, 0);
+        error = Success;
+    }
 
-        if (params == NULL)
-            return BadAlloc;
-        __glXClearErrorOccured();
+    return error;
+}
 
-        CALL_GetQueryObjectuivARB(GET_DISPATCH(), (*(GLuint *) (pc + 0),
-                                                   pname, params));
-        __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
+int
+__glXDisp_GetProgramLocalParameterfvARB(__GLXclientState * cl, GLbyte * pc)
+{
+    PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC GetProgramLocalParameterfvARB =
+        __glGetProcAddress("glGetProgramLocalParameterfvARB");
+    xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc;
+    int error;
+    __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+    pc += __GLX_VENDPRIV_HDR_SIZE;
+    if (cx != NULL) {
+        GLfloat params[4];
+
+        GetProgramLocalParameterfvARB(*(GLenum *) (pc + 0),
+                                      *(GLuint *) (pc + 4), params);
+        __glXSendReply(cl->client, params, 4, 4, GL_FALSE, 0);
         error = Success;
     }
 
@@ -4667,17 +4350,19 @@ __glXDisp_GetQueryObjectuivARB(__GLXclientState * cl, GLbyte * pc)
 }
 
 int
-__glXDisp_GetQueryivARB(__GLXclientState * cl, GLbyte * pc)
+__glXDisp_GetProgramivARB(__GLXclientState * cl, GLbyte * pc)
 {
-    xGLXSingleReq *const req = (xGLXSingleReq *) pc;
+    PFNGLGETPROGRAMIVARBPROC GetProgramivARB =
+        __glGetProcAddress("glGetProgramivARB");
+    xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc;
     int error;
     __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error);
 
-    pc += __GLX_SINGLE_HDR_SIZE;
+    pc += __GLX_VENDPRIV_HDR_SIZE;
     if (cx != NULL) {
         const GLenum pname = *(GLenum *) (pc + 4);
 
-        const GLuint compsize = __glGetQueryivARB_size(pname);
+        const GLuint compsize = __glGetProgramivARB_size(pname);
         GLint answerBuffer[200];
         GLint *params =
             __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer,
@@ -4687,8 +4372,7 @@ __glXDisp_GetQueryivARB(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetQueryivARB(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                            pname, params));
+        GetProgramivARB(*(GLenum *) (pc + 0), pname, params);
         __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
         error = Success;
     }
@@ -4697,18 +4381,18 @@ __glXDisp_GetQueryivARB(__GLXclientState * cl, GLbyte * pc)
 }
 
 int
-__glXDisp_IsQueryARB(__GLXclientState * cl, GLbyte * pc)
+__glXDisp_IsProgramARB(__GLXclientState * cl, GLbyte * pc)
 {
-    xGLXSingleReq *const req = (xGLXSingleReq *) pc;
+    PFNGLISPROGRAMARBPROC IsProgramARB = __glGetProcAddress("glIsProgramARB");
+    xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc;
     int error;
     __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error);
 
-    pc += __GLX_SINGLE_HDR_SIZE;
+    pc += __GLX_VENDPRIV_HDR_SIZE;
     if (cx != NULL) {
         GLboolean retval;
 
-        retval = CALL_IsQueryARB(GET_DISPATCH(), (*(GLuint *) (pc + 0)
-                                 ));
+        retval = IsProgramARB(*(GLuint *) (pc + 0));
         __glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval);
         error = Success;
     }
@@ -4717,171 +4401,223 @@ __glXDisp_IsQueryARB(__GLXclientState * cl, GLbyte * pc)
 }
 
 void
-__glXDisp_DrawBuffersARB(GLbyte * pc)
+__glXDisp_ProgramEnvParameter4dvARB(GLbyte * pc)
 {
-    const GLsizei n = *(GLsizei *) (pc + 0);
+    PFNGLPROGRAMENVPARAMETER4DVARBPROC ProgramEnvParameter4dvARB =
+        __glGetProcAddress("glProgramEnvParameter4dvARB");
+#ifdef __GLX_ALIGN64
+    if ((unsigned long) (pc) & 7) {
+        (void) memmove(pc - 4, pc, 40);
+        pc -= 4;
+    }
+#endif
 
-    CALL_DrawBuffersARB(GET_DISPATCH(), (n, (const GLenum *) (pc + 4)
-                        ));
+    ProgramEnvParameter4dvARB(*(GLenum *) (pc + 0),
+                              *(GLuint *) (pc + 4),
+                              (const GLdouble *) (pc + 8));
 }
 
 void
-__glXDisp_ClampColorARB(GLbyte * pc)
+__glXDisp_ProgramEnvParameter4fvARB(GLbyte * pc)
 {
-    CALL_ClampColorARB(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                        *(GLenum *) (pc + 4)
-                       ));
+    PFNGLPROGRAMENVPARAMETER4FVARBPROC ProgramEnvParameter4fvARB =
+        __glGetProcAddress("glProgramEnvParameter4fvARB");
+    ProgramEnvParameter4fvARB(*(GLenum *) (pc + 0), *(GLuint *) (pc + 4),
+                              (const GLfloat *) (pc + 8));
 }
 
 void
-__glXDisp_RenderbufferStorageMultisample(GLbyte * pc)
+__glXDisp_ProgramLocalParameter4dvARB(GLbyte * pc)
 {
-    CALL_RenderbufferStorageMultisample(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                                         *(GLsizei *) (pc + 4),
-                                                         *(GLenum *) (pc + 8),
-                                                         *(GLsizei *) (pc + 12),
-                                                         *(GLsizei *) (pc + 16)
-                                        ));
+    PFNGLPROGRAMLOCALPARAMETER4DVARBPROC ProgramLocalParameter4dvARB =
+        __glGetProcAddress("glProgramLocalParameter4dvARB");
+#ifdef __GLX_ALIGN64
+    if ((unsigned long) (pc) & 7) {
+        (void) memmove(pc - 4, pc, 40);
+        pc -= 4;
+    }
+#endif
+
+    ProgramLocalParameter4dvARB(*(GLenum *) (pc + 0),
+                                *(GLuint *) (pc + 4),
+                                (const GLdouble *) (pc + 8));
 }
 
 void
-__glXDisp_SampleMaskSGIS(GLbyte * pc)
+__glXDisp_ProgramLocalParameter4fvARB(GLbyte * pc)
 {
-    CALL_SampleMaskSGIS(GET_DISPATCH(), (*(GLclampf *) (pc + 0),
-                                         *(GLboolean *) (pc + 4)
-                        ));
+    PFNGLPROGRAMLOCALPARAMETER4FVARBPROC ProgramLocalParameter4fvARB =
+        __glGetProcAddress("glProgramLocalParameter4fvARB");
+    ProgramLocalParameter4fvARB(*(GLenum *) (pc + 0), *(GLuint *) (pc + 4),
+                                (const GLfloat *) (pc + 8));
 }
 
 void
-__glXDisp_SamplePatternSGIS(GLbyte * pc)
+__glXDisp_ProgramStringARB(GLbyte * pc)
 {
-    CALL_SamplePatternSGIS(GET_DISPATCH(), (*(GLenum *) (pc + 0)
-                           ));
+    PFNGLPROGRAMSTRINGARBPROC ProgramStringARB =
+        __glGetProcAddress("glProgramStringARB");
+    const GLsizei len = *(GLsizei *) (pc + 8);
+
+    ProgramStringARB(*(GLenum *) (pc + 0),
+                     *(GLenum *) (pc + 4), len, (const GLvoid *) (pc + 12));
 }
 
 void
-__glXDisp_PointParameterfEXT(GLbyte * pc)
+__glXDisp_VertexAttrib1fvARB(GLbyte * pc)
 {
-    CALL_PointParameterfEXT(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                             *(GLfloat *) (pc + 4)
-                            ));
+    PFNGLVERTEXATTRIB1FVARBPROC VertexAttrib1fvARB =
+        __glGetProcAddress("glVertexAttrib1fvARB");
+    VertexAttrib1fvARB(*(GLuint *) (pc + 0), (const GLfloat *) (pc + 4));
 }
 
 void
-__glXDisp_PointParameterfvEXT(GLbyte * pc)
+__glXDisp_VertexAttrib2fvARB(GLbyte * pc)
 {
-    const GLenum pname = *(GLenum *) (pc + 0);
-    const GLfloat *params;
-
-    params = (const GLfloat *) (pc + 4);
-
-    CALL_PointParameterfvEXT(GET_DISPATCH(), (pname, params));
+    PFNGLVERTEXATTRIB2FVARBPROC VertexAttrib2fvARB =
+        __glGetProcAddress("glVertexAttrib2fvARB");
+    VertexAttrib2fvARB(*(GLuint *) (pc + 0), (const GLfloat *) (pc + 4));
 }
 
 void
-__glXDisp_SecondaryColor3bvEXT(GLbyte * pc)
+__glXDisp_VertexAttrib3fvARB(GLbyte * pc)
 {
-    CALL_SecondaryColor3bvEXT(GET_DISPATCH(), ((const GLbyte *) (pc + 0)
-                              ));
+    PFNGLVERTEXATTRIB3FVARBPROC VertexAttrib3fvARB =
+        __glGetProcAddress("glVertexAttrib3fvARB");
+    VertexAttrib3fvARB(*(GLuint *) (pc + 0), (const GLfloat *) (pc + 4));
 }
 
 void
-__glXDisp_SecondaryColor3dvEXT(GLbyte * pc)
+__glXDisp_VertexAttrib4fvARB(GLbyte * pc)
 {
-#ifdef __GLX_ALIGN64
-    if ((unsigned long) (pc) & 7) {
-        (void) memmove(pc - 4, pc, 24);
-        pc -= 4;
-    }
-#endif
-
-    CALL_SecondaryColor3dvEXT(GET_DISPATCH(), ((const GLdouble *) (pc + 0)
-                              ));
+    PFNGLVERTEXATTRIB4FVARBPROC VertexAttrib4fvARB =
+        __glGetProcAddress("glVertexAttrib4fvARB");
+    VertexAttrib4fvARB(*(GLuint *) (pc + 0), (const GLfloat *) (pc + 4));
 }
 
 void
-__glXDisp_SecondaryColor3fvEXT(GLbyte * pc)
+__glXDisp_BindFramebuffer(GLbyte * pc)
 {
-    CALL_SecondaryColor3fvEXT(GET_DISPATCH(), ((const GLfloat *) (pc + 0)
-                              ));
+    PFNGLBINDFRAMEBUFFERPROC BindFramebuffer =
+        __glGetProcAddress("glBindFramebuffer");
+    BindFramebuffer(*(GLenum *) (pc + 0), *(GLuint *) (pc + 4));
 }
 
 void
-__glXDisp_SecondaryColor3ivEXT(GLbyte * pc)
+__glXDisp_BindRenderbuffer(GLbyte * pc)
 {
-    CALL_SecondaryColor3ivEXT(GET_DISPATCH(), ((const GLint *) (pc + 0)
-                              ));
+    PFNGLBINDRENDERBUFFERPROC BindRenderbuffer =
+        __glGetProcAddress("glBindRenderbuffer");
+    BindRenderbuffer(*(GLenum *) (pc + 0), *(GLuint *) (pc + 4));
 }
 
 void
-__glXDisp_SecondaryColor3svEXT(GLbyte * pc)
+__glXDisp_BlitFramebuffer(GLbyte * pc)
 {
-    CALL_SecondaryColor3svEXT(GET_DISPATCH(), ((const GLshort *) (pc + 0)
-                              ));
+    PFNGLBLITFRAMEBUFFERPROC BlitFramebuffer =
+        __glGetProcAddress("glBlitFramebuffer");
+    BlitFramebuffer(*(GLint *) (pc + 0), *(GLint *) (pc + 4),
+                    *(GLint *) (pc + 8), *(GLint *) (pc + 12),
+                    *(GLint *) (pc + 16), *(GLint *) (pc + 20),
+                    *(GLint *) (pc + 24), *(GLint *) (pc + 28),
+                    *(GLbitfield *) (pc + 32), *(GLenum *) (pc + 36));
 }
 
-void
-__glXDisp_SecondaryColor3ubvEXT(GLbyte * pc)
+int
+__glXDisp_CheckFramebufferStatus(__GLXclientState * cl, GLbyte * pc)
 {
-    CALL_SecondaryColor3ubvEXT(GET_DISPATCH(), ((const GLubyte *) (pc + 0)
-                               ));
+    PFNGLCHECKFRAMEBUFFERSTATUSPROC CheckFramebufferStatus =
+        __glGetProcAddress("glCheckFramebufferStatus");
+    xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc;
+    int error;
+    __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error);
+
+    pc += __GLX_VENDPRIV_HDR_SIZE;
+    if (cx != NULL) {
+        GLenum retval;
+
+        retval = CheckFramebufferStatus(*(GLenum *) (pc + 0));
+        __glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval);
+        error = Success;
+    }
+
+    return error;
 }
 
 void
-__glXDisp_SecondaryColor3uivEXT(GLbyte * pc)
+__glXDisp_DeleteFramebuffers(GLbyte * pc)
 {
-    CALL_SecondaryColor3uivEXT(GET_DISPATCH(), ((const GLuint *) (pc + 0)
-                               ));
+    PFNGLDELETEFRAMEBUFFERSPROC DeleteFramebuffers =
+        __glGetProcAddress("glDeleteFramebuffers");
+    const GLsizei n = *(GLsizei *) (pc + 0);
+
+    DeleteFramebuffers(n, (const GLuint *) (pc + 4));
 }
 
 void
-__glXDisp_SecondaryColor3usvEXT(GLbyte * pc)
+__glXDisp_DeleteRenderbuffers(GLbyte * pc)
 {
-    CALL_SecondaryColor3usvEXT(GET_DISPATCH(), ((const GLushort *) (pc + 0)
-                               ));
+    PFNGLDELETERENDERBUFFERSPROC DeleteRenderbuffers =
+        __glGetProcAddress("glDeleteRenderbuffers");
+    const GLsizei n = *(GLsizei *) (pc + 0);
+
+    DeleteRenderbuffers(n, (const GLuint *) (pc + 4));
 }
 
 void
-__glXDisp_FogCoorddvEXT(GLbyte * pc)
+__glXDisp_FramebufferRenderbuffer(GLbyte * pc)
 {
-#ifdef __GLX_ALIGN64
-    if ((unsigned long) (pc) & 7) {
-        (void) memmove(pc - 4, pc, 8);
-        pc -= 4;
-    }
-#endif
+    PFNGLFRAMEBUFFERRENDERBUFFERPROC FramebufferRenderbuffer =
+        __glGetProcAddress("glFramebufferRenderbuffer");
+    FramebufferRenderbuffer(*(GLenum *) (pc + 0), *(GLenum *) (pc + 4),
+                            *(GLenum *) (pc + 8), *(GLuint *) (pc + 12));
+}
 
-    CALL_FogCoorddvEXT(GET_DISPATCH(), ((const GLdouble *) (pc + 0)
-                       ));
+void
+__glXDisp_FramebufferTexture1D(GLbyte * pc)
+{
+    PFNGLFRAMEBUFFERTEXTURE1DPROC FramebufferTexture1D =
+        __glGetProcAddress("glFramebufferTexture1D");
+    FramebufferTexture1D(*(GLenum *) (pc + 0), *(GLenum *) (pc + 4),
+                         *(GLenum *) (pc + 8), *(GLuint *) (pc + 12),
+                         *(GLint *) (pc + 16));
 }
 
 void
-__glXDisp_FogCoordfvEXT(GLbyte * pc)
+__glXDisp_FramebufferTexture2D(GLbyte * pc)
 {
-    CALL_FogCoordfvEXT(GET_DISPATCH(), ((const GLfloat *) (pc + 0)
-                       ));
+    PFNGLFRAMEBUFFERTEXTURE2DPROC FramebufferTexture2D =
+        __glGetProcAddress("glFramebufferTexture2D");
+    FramebufferTexture2D(*(GLenum *) (pc + 0), *(GLenum *) (pc + 4),
+                         *(GLenum *) (pc + 8), *(GLuint *) (pc + 12),
+                         *(GLint *) (pc + 16));
 }
 
 void
-__glXDisp_BlendFuncSeparateEXT(GLbyte * pc)
+__glXDisp_FramebufferTexture3D(GLbyte * pc)
 {
-    CALL_BlendFuncSeparateEXT(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                               *(GLenum *) (pc + 4),
-                                               *(GLenum *) (pc + 8),
-                                               *(GLenum *) (pc + 12)
-                              ));
+    PFNGLFRAMEBUFFERTEXTURE3DPROC FramebufferTexture3D =
+        __glGetProcAddress("glFramebufferTexture3D");
+    FramebufferTexture3D(*(GLenum *) (pc + 0), *(GLenum *) (pc + 4),
+                         *(GLenum *) (pc + 8), *(GLuint *) (pc + 12),
+                         *(GLint *) (pc + 16), *(GLint *) (pc + 20));
 }
 
 void
-__glXDisp_WindowPos3fvMESA(GLbyte * pc)
+__glXDisp_FramebufferTextureLayer(GLbyte * pc)
 {
-    CALL_WindowPos3fvMESA(GET_DISPATCH(), ((const GLfloat *) (pc + 0)
-                          ));
+    PFNGLFRAMEBUFFERTEXTURELAYERPROC FramebufferTextureLayer =
+        __glGetProcAddress("glFramebufferTextureLayer");
+    FramebufferTextureLayer(*(GLenum *) (pc + 0), *(GLenum *) (pc + 4),
+                            *(GLuint *) (pc + 8), *(GLint *) (pc + 12),
+                            *(GLint *) (pc + 16));
 }
 
 int
-__glXDisp_AreProgramsResidentNV(__GLXclientState * cl, GLbyte * pc)
+__glXDisp_GenFramebuffers(__GLXclientState * cl, GLbyte * pc)
 {
+    PFNGLGENFRAMEBUFFERSPROC GenFramebuffers =
+        __glGetProcAddress("glGenFramebuffers");
     xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc;
     int error;
     __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error);
@@ -4890,32 +4626,23 @@ __glXDisp_AreProgramsResidentNV(__GLXclientState * cl, GLbyte * pc)
     if (cx != NULL) {
         const GLsizei n = *(GLsizei *) (pc + 0);
 
-        GLboolean retval;
-        GLboolean answerBuffer[200];
-        GLboolean *residences =
-            __glXGetAnswerBuffer(cl, n, answerBuffer, sizeof(answerBuffer), 1);
-        retval =
-            CALL_AreProgramsResidentNV(GET_DISPATCH(),
-                                       (n, (const GLuint *) (pc + 4),
-                                        residences));
-        __glXSendReply(cl->client, residences, n, 1, GL_FALSE, retval);
+        GLuint answerBuffer[200];
+        GLuint *framebuffers =
+            __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer),
+                                 4);
+        GenFramebuffers(n, framebuffers);
+        __glXSendReply(cl->client, framebuffers, n, 4, GL_TRUE, 0);
         error = Success;
     }
 
     return error;
 }
 
-void
-__glXDisp_BindProgramNV(GLbyte * pc)
-{
-    CALL_BindProgramNV(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                        *(GLuint *) (pc + 4)
-                       ));
-}
-
 int
-__glXDisp_DeleteProgramsNV(__GLXclientState * cl, GLbyte * pc)
+__glXDisp_GenRenderbuffers(__GLXclientState * cl, GLbyte * pc)
 {
+    PFNGLGENRENDERBUFFERSPROC GenRenderbuffers =
+        __glGetProcAddress("glGenRenderbuffers");
     xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc;
     int error;
     __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error);
@@ -4924,8 +4651,12 @@ __glXDisp_DeleteProgramsNV(__GLXclientState * cl, GLbyte * pc)
     if (cx != NULL) {
         const GLsizei n = *(GLsizei *) (pc + 0);
 
-        CALL_DeleteProgramsNV(GET_DISPATCH(), (n, (const GLuint *) (pc + 4)
-                              ));
+        GLuint answerBuffer[200];
+        GLuint *renderbuffers =
+            __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer),
+                                 4);
+        GenRenderbuffers(n, renderbuffers);
+        __glXSendReply(cl->client, renderbuffers, n, 4, GL_TRUE, 0);
         error = Success;
     }
 
@@ -4933,31 +4664,32 @@ __glXDisp_DeleteProgramsNV(__GLXclientState * cl, GLbyte * pc)
 }
 
 void
-__glXDisp_ExecuteProgramNV(GLbyte * pc)
+__glXDisp_GenerateMipmap(GLbyte * pc)
 {
-    CALL_ExecuteProgramNV(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                           *(GLuint *) (pc + 4),
-                                           (const GLfloat *) (pc + 8)
-                          ));
+    PFNGLGENERATEMIPMAPPROC GenerateMipmap =
+        __glGetProcAddress("glGenerateMipmap");
+    GenerateMipmap(*(GLenum *) (pc + 0));
 }
 
 int
-__glXDisp_GenProgramsNV(__GLXclientState * cl, GLbyte * pc)
+__glXDisp_GetFramebufferAttachmentParameteriv(__GLXclientState * cl,
+                                              GLbyte * pc)
 {
+    PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC
+        GetFramebufferAttachmentParameteriv =
+        __glGetProcAddress("glGetFramebufferAttachmentParameteriv");
     xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc;
     int error;
     __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error);
 
     pc += __GLX_VENDPRIV_HDR_SIZE;
     if (cx != NULL) {
-        const GLsizei n = *(GLsizei *) (pc + 0);
+        GLint params[1];
 
-        GLuint answerBuffer[200];
-        GLuint *programs =
-            __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer),
-                                 4);
-        CALL_GenProgramsNV(GET_DISPATCH(), (n, programs));
-        __glXSendReply(cl->client, programs, n, 4, GL_TRUE, 0);
+        GetFramebufferAttachmentParameteriv(*(GLenum *) (pc + 0),
+                                            *(GLenum *) (pc + 4),
+                                            *(GLenum *) (pc + 8), params);
+        __glXSendReply(cl->client, params, 1, 4, GL_FALSE, 0);
         error = Success;
     }
 
@@ -4965,21 +4697,21 @@ __glXDisp_GenProgramsNV(__GLXclientState * cl, GLbyte * pc)
 }
 
 int
-__glXDisp_GetProgramParameterdvNV(__GLXclientState * cl, GLbyte * pc)
+__glXDisp_GetRenderbufferParameteriv(__GLXclientState * cl, GLbyte * pc)
 {
+    PFNGLGETRENDERBUFFERPARAMETERIVPROC GetRenderbufferParameteriv =
+        __glGetProcAddress("glGetRenderbufferParameteriv");
     xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc;
     int error;
     __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error);
 
     pc += __GLX_VENDPRIV_HDR_SIZE;
     if (cx != NULL) {
-        GLdouble params[4];
+        GLint params[1];
 
-        CALL_GetProgramParameterdvNV(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                                      *(GLuint *) (pc + 4),
-                                                      *(GLenum *) (pc + 8),
-                                                      params));
-        __glXSendReply(cl->client, params, 4, 8, GL_FALSE, 0);
+        GetRenderbufferParameteriv(*(GLenum *) (pc + 0),
+                                   *(GLenum *) (pc + 4), params);
+        __glXSendReply(cl->client, params, 1, 4, GL_FALSE, 0);
         error = Success;
     }
 
@@ -4987,21 +4719,20 @@ __glXDisp_GetProgramParameterdvNV(__GLXclientState * cl, GLbyte * pc)
 }
 
 int
-__glXDisp_GetProgramParameterfvNV(__GLXclientState * cl, GLbyte * pc)
+__glXDisp_IsFramebuffer(__GLXclientState * cl, GLbyte * pc)
 {
+    PFNGLISFRAMEBUFFERPROC IsFramebuffer =
+        __glGetProcAddress("glIsFramebuffer");
     xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc;
     int error;
     __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error);
 
     pc += __GLX_VENDPRIV_HDR_SIZE;
     if (cx != NULL) {
-        GLfloat params[4];
+        GLboolean retval;
 
-        CALL_GetProgramParameterfvNV(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                                      *(GLuint *) (pc + 4),
-                                                      *(GLenum *) (pc + 8),
-                                                      params));
-        __glXSendReply(cl->client, params, 4, 4, GL_FALSE, 0);
+        retval = IsFramebuffer(*(GLuint *) (pc + 0));
+        __glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval);
         error = Success;
     }
 
@@ -5009,294 +4740,128 @@ __glXDisp_GetProgramParameterfvNV(__GLXclientState * cl, GLbyte * pc)
 }
 
 int
-__glXDisp_GetProgramivNV(__GLXclientState * cl, GLbyte * pc)
+__glXDisp_IsRenderbuffer(__GLXclientState * cl, GLbyte * pc)
 {
+    PFNGLISRENDERBUFFERPROC IsRenderbuffer =
+        __glGetProcAddress("glIsRenderbuffer");
     xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc;
     int error;
     __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error);
 
     pc += __GLX_VENDPRIV_HDR_SIZE;
     if (cx != NULL) {
-        const GLenum pname = *(GLenum *) (pc + 4);
-
-        const GLuint compsize = __glGetProgramivNV_size(pname);
-        GLint answerBuffer[200];
-        GLint *params =
-            __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer,
-                                 sizeof(answerBuffer), 4);
-
-        if (params == NULL)
-            return BadAlloc;
-        __glXClearErrorOccured();
+        GLboolean retval;
 
-        CALL_GetProgramivNV(GET_DISPATCH(), (*(GLuint *) (pc + 0),
-                                             pname, params));
-        __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
+        retval = IsRenderbuffer(*(GLuint *) (pc + 0));
+        __glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval);
         error = Success;
     }
 
     return error;
 }
 
-int
-__glXDisp_GetTrackMatrixivNV(__GLXclientState * cl, GLbyte * pc)
+void
+__glXDisp_RenderbufferStorage(GLbyte * pc)
 {
-    xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc;
-    int error;
-    __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error);
+    PFNGLRENDERBUFFERSTORAGEPROC RenderbufferStorage =
+        __glGetProcAddress("glRenderbufferStorage");
+    RenderbufferStorage(*(GLenum *) (pc + 0), *(GLenum *) (pc + 4),
+                        *(GLsizei *) (pc + 8), *(GLsizei *) (pc + 12));
+}
 
-    pc += __GLX_VENDPRIV_HDR_SIZE;
-    if (cx != NULL) {
-        GLint params[1];
+void
+__glXDisp_RenderbufferStorageMultisample(GLbyte * pc)
+{
+    PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC RenderbufferStorageMultisample =
+        __glGetProcAddress("glRenderbufferStorageMultisample");
+    RenderbufferStorageMultisample(*(GLenum *) (pc + 0), *(GLsizei *) (pc + 4),
+                                   *(GLenum *) (pc + 8), *(GLsizei *) (pc + 12),
+                                   *(GLsizei *) (pc + 16));
+}
 
-        CALL_GetTrackMatrixivNV(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                                 *(GLuint *) (pc + 4),
-                                                 *(GLenum *) (pc + 8), params));
-        __glXSendReply(cl->client, params, 1, 4, GL_FALSE, 0);
-        error = Success;
-    }
+void
+__glXDisp_SecondaryColor3fvEXT(GLbyte * pc)
+{
+    PFNGLSECONDARYCOLOR3FVEXTPROC SecondaryColor3fvEXT =
+        __glGetProcAddress("glSecondaryColor3fvEXT");
+    SecondaryColor3fvEXT((const GLfloat *) (pc + 0));
+}
 
-    return error;
+void
+__glXDisp_FogCoordfvEXT(GLbyte * pc)
+{
+    PFNGLFOGCOORDFVEXTPROC FogCoordfvEXT =
+        __glGetProcAddress("glFogCoordfvEXT");
+    FogCoordfvEXT((const GLfloat *) (pc + 0));
 }
 
-int
-__glXDisp_GetVertexAttribdvNV(__GLXclientState * cl, GLbyte * pc)
+void
+__glXDisp_VertexAttrib1dvNV(GLbyte * pc)
 {
-    xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc;
-    int error;
-    __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error);
+    PFNGLVERTEXATTRIB1DVNVPROC VertexAttrib1dvNV =
+        __glGetProcAddress("glVertexAttrib1dvNV");
+#ifdef __GLX_ALIGN64
+    if ((unsigned long) (pc) & 7) {
+        (void) memmove(pc - 4, pc, 12);
+        pc -= 4;
+    }
+#endif
 
-    pc += __GLX_VENDPRIV_HDR_SIZE;
-    if (cx != NULL) {
-        const GLenum pname = *(GLenum *) (pc + 4);
+    VertexAttrib1dvNV(*(GLuint *) (pc + 0), (const GLdouble *) (pc + 4));
+}
 
-        const GLuint compsize = __glGetVertexAttribdvNV_size(pname);
-        GLdouble answerBuffer[200];
-        GLdouble *params =
-            __glXGetAnswerBuffer(cl, compsize * 8, answerBuffer,
-                                 sizeof(answerBuffer), 8);
+void
+__glXDisp_VertexAttrib1fvNV(GLbyte * pc)
+{
+    PFNGLVERTEXATTRIB1FVNVPROC VertexAttrib1fvNV =
+        __glGetProcAddress("glVertexAttrib1fvNV");
+    VertexAttrib1fvNV(*(GLuint *) (pc + 0), (const GLfloat *) (pc + 4));
+}
 
-        if (params == NULL)
-            return BadAlloc;
-        __glXClearErrorOccured();
+void
+__glXDisp_VertexAttrib1svNV(GLbyte * pc)
+{
+    PFNGLVERTEXATTRIB1SVNVPROC VertexAttrib1svNV =
+        __glGetProcAddress("glVertexAttrib1svNV");
+    VertexAttrib1svNV(*(GLuint *) (pc + 0), (const GLshort *) (pc + 4));
+}
 
-        CALL_GetVertexAttribdvNV(GET_DISPATCH(), (*(GLuint *) (pc + 0),
-                                                  pname, params));
-        __glXSendReply(cl->client, params, compsize, 8, GL_FALSE, 0);
-        error = Success;
+void
+__glXDisp_VertexAttrib2dvNV(GLbyte * pc)
+{
+    PFNGLVERTEXATTRIB2DVNVPROC VertexAttrib2dvNV =
+        __glGetProcAddress("glVertexAttrib2dvNV");
+#ifdef __GLX_ALIGN64
+    if ((unsigned long) (pc) & 7) {
+        (void) memmove(pc - 4, pc, 20);
+        pc -= 4;
     }
+#endif
 
-    return error;
+    VertexAttrib2dvNV(*(GLuint *) (pc + 0), (const GLdouble *) (pc + 4));
 }
 
-int
-__glXDisp_GetVertexAttribfvNV(__GLXclientState * cl, GLbyte * pc)
+void
+__glXDisp_VertexAttrib2fvNV(GLbyte * pc)
 {
-    xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc;
-    int error;
-    __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
-    pc += __GLX_VENDPRIV_HDR_SIZE;
-    if (cx != NULL) {
-        const GLenum pname = *(GLenum *) (pc + 4);
-
-        const GLuint compsize = __glGetVertexAttribfvNV_size(pname);
-        GLfloat answerBuffer[200];
-        GLfloat *params =
-            __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer,
-                                 sizeof(answerBuffer), 4);
-
-        if (params == NULL)
-            return BadAlloc;
-        __glXClearErrorOccured();
-
-        CALL_GetVertexAttribfvNV(GET_DISPATCH(), (*(GLuint *) (pc + 0),
-                                                  pname, params));
-        __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
-        error = Success;
-    }
-
-    return error;
-}
-
-int
-__glXDisp_GetVertexAttribivNV(__GLXclientState * cl, GLbyte * pc)
-{
-    xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc;
-    int error;
-    __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
-    pc += __GLX_VENDPRIV_HDR_SIZE;
-    if (cx != NULL) {
-        const GLenum pname = *(GLenum *) (pc + 4);
-
-        const GLuint compsize = __glGetVertexAttribivNV_size(pname);
-        GLint answerBuffer[200];
-        GLint *params =
-            __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer,
-                                 sizeof(answerBuffer), 4);
-
-        if (params == NULL)
-            return BadAlloc;
-        __glXClearErrorOccured();
-
-        CALL_GetVertexAttribivNV(GET_DISPATCH(), (*(GLuint *) (pc + 0),
-                                                  pname, params));
-        __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
-        error = Success;
-    }
-
-    return error;
-}
-
-int
-__glXDisp_IsProgramNV(__GLXclientState * cl, GLbyte * pc)
-{
-    xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc;
-    int error;
-    __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
-    pc += __GLX_VENDPRIV_HDR_SIZE;
-    if (cx != NULL) {
-        GLboolean retval;
-
-        retval = CALL_IsProgramNV(GET_DISPATCH(), (*(GLuint *) (pc + 0)
-                                  ));
-        __glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval);
-        error = Success;
-    }
-
-    return error;
-}
-
-void
-__glXDisp_LoadProgramNV(GLbyte * pc)
-{
-    const GLsizei len = *(GLsizei *) (pc + 8);
-
-    CALL_LoadProgramNV(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                        *(GLuint *) (pc + 4),
-                                        len, (const GLubyte *) (pc + 12)
-                       ));
-}
-
-void
-__glXDisp_ProgramParameters4dvNV(GLbyte * pc)
-{
-    const GLsizei num = *(GLsizei *) (pc + 8);
-
-#ifdef __GLX_ALIGN64
-    const GLuint cmdlen = 16 + __GLX_PAD((num * 32)) - 4;
-
-    if ((unsigned long) (pc) & 7) {
-        (void) memmove(pc - 4, pc, cmdlen);
-        pc -= 4;
-    }
-#endif
-
-    CALL_ProgramParameters4dvNV(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                                 *(GLuint *) (pc + 4),
-                                                 num,
-                                                 (const GLdouble *) (pc + 12)
-                                ));
-}
-
-void
-__glXDisp_ProgramParameters4fvNV(GLbyte * pc)
-{
-    const GLsizei num = *(GLsizei *) (pc + 8);
-
-    CALL_ProgramParameters4fvNV(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                                 *(GLuint *) (pc + 4),
-                                                 num,
-                                                 (const GLfloat *) (pc + 12)
-                                ));
-}
-
-void
-__glXDisp_RequestResidentProgramsNV(GLbyte * pc)
-{
-    const GLsizei n = *(GLsizei *) (pc + 0);
-
-    CALL_RequestResidentProgramsNV(GET_DISPATCH(), (n, (const GLuint *) (pc + 4)
-                                   ));
-}
-
-void
-__glXDisp_TrackMatrixNV(GLbyte * pc)
-{
-    CALL_TrackMatrixNV(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                        *(GLuint *) (pc + 4),
-                                        *(GLenum *) (pc + 8),
-                                        *(GLenum *) (pc + 12)
-                       ));
-}
-
-void
-__glXDisp_VertexAttrib1dvNV(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
-    if ((unsigned long) (pc) & 7) {
-        (void) memmove(pc - 4, pc, 12);
-        pc -= 4;
-    }
-#endif
-
-    CALL_VertexAttrib1dvNV(GET_DISPATCH(), (*(GLuint *) (pc + 0),
-                                            (const GLdouble *) (pc + 4)
-                           ));
-}
-
-void
-__glXDisp_VertexAttrib1fvNV(GLbyte * pc)
-{
-    CALL_VertexAttrib1fvNV(GET_DISPATCH(), (*(GLuint *) (pc + 0),
-                                            (const GLfloat *) (pc + 4)
-                           ));
-}
-
-void
-__glXDisp_VertexAttrib1svNV(GLbyte * pc)
-{
-    CALL_VertexAttrib1svNV(GET_DISPATCH(), (*(GLuint *) (pc + 0),
-                                            (const GLshort *) (pc + 4)
-                           ));
-}
-
-void
-__glXDisp_VertexAttrib2dvNV(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
-    if ((unsigned long) (pc) & 7) {
-        (void) memmove(pc - 4, pc, 20);
-        pc -= 4;
-    }
-#endif
-
-    CALL_VertexAttrib2dvNV(GET_DISPATCH(), (*(GLuint *) (pc + 0),
-                                            (const GLdouble *) (pc + 4)
-                           ));
-}
-
-void
-__glXDisp_VertexAttrib2fvNV(GLbyte * pc)
-{
-    CALL_VertexAttrib2fvNV(GET_DISPATCH(), (*(GLuint *) (pc + 0),
-                                            (const GLfloat *) (pc + 4)
-                           ));
-}
+    PFNGLVERTEXATTRIB2FVNVPROC VertexAttrib2fvNV =
+        __glGetProcAddress("glVertexAttrib2fvNV");
+    VertexAttrib2fvNV(*(GLuint *) (pc + 0), (const GLfloat *) (pc + 4));
+}
 
 void
 __glXDisp_VertexAttrib2svNV(GLbyte * pc)
 {
-    CALL_VertexAttrib2svNV(GET_DISPATCH(), (*(GLuint *) (pc + 0),
-                                            (const GLshort *) (pc + 4)
-                           ));
+    PFNGLVERTEXATTRIB2SVNVPROC VertexAttrib2svNV =
+        __glGetProcAddress("glVertexAttrib2svNV");
+    VertexAttrib2svNV(*(GLuint *) (pc + 0), (const GLshort *) (pc + 4));
 }
 
 void
 __glXDisp_VertexAttrib3dvNV(GLbyte * pc)
 {
+    PFNGLVERTEXATTRIB3DVNVPROC VertexAttrib3dvNV =
+        __glGetProcAddress("glVertexAttrib3dvNV");
 #ifdef __GLX_ALIGN64
     if ((unsigned long) (pc) & 7) {
         (void) memmove(pc - 4, pc, 28);
@@ -5304,30 +4869,30 @@ __glXDisp_VertexAttrib3dvNV(GLbyte * pc)
     }
 #endif
 
-    CALL_VertexAttrib3dvNV(GET_DISPATCH(), (*(GLuint *) (pc + 0),
-                                            (const GLdouble *) (pc + 4)
-                           ));
+    VertexAttrib3dvNV(*(GLuint *) (pc + 0), (const GLdouble *) (pc + 4));
 }
 
 void
 __glXDisp_VertexAttrib3fvNV(GLbyte * pc)
 {
-    CALL_VertexAttrib3fvNV(GET_DISPATCH(), (*(GLuint *) (pc + 0),
-                                            (const GLfloat *) (pc + 4)
-                           ));
+    PFNGLVERTEXATTRIB3FVNVPROC VertexAttrib3fvNV =
+        __glGetProcAddress("glVertexAttrib3fvNV");
+    VertexAttrib3fvNV(*(GLuint *) (pc + 0), (const GLfloat *) (pc + 4));
 }
 
 void
 __glXDisp_VertexAttrib3svNV(GLbyte * pc)
 {
-    CALL_VertexAttrib3svNV(GET_DISPATCH(), (*(GLuint *) (pc + 0),
-                                            (const GLshort *) (pc + 4)
-                           ));
+    PFNGLVERTEXATTRIB3SVNVPROC VertexAttrib3svNV =
+        __glGetProcAddress("glVertexAttrib3svNV");
+    VertexAttrib3svNV(*(GLuint *) (pc + 0), (const GLshort *) (pc + 4));
 }
 
 void
 __glXDisp_VertexAttrib4dvNV(GLbyte * pc)
 {
+    PFNGLVERTEXATTRIB4DVNVPROC VertexAttrib4dvNV =
+        __glGetProcAddress("glVertexAttrib4dvNV");
 #ifdef __GLX_ALIGN64
     if ((unsigned long) (pc) & 7) {
         (void) memmove(pc - 4, pc, 36);
@@ -5335,38 +4900,38 @@ __glXDisp_VertexAttrib4dvNV(GLbyte * pc)
     }
 #endif
 
-    CALL_VertexAttrib4dvNV(GET_DISPATCH(), (*(GLuint *) (pc + 0),
-                                            (const GLdouble *) (pc + 4)
-                           ));
+    VertexAttrib4dvNV(*(GLuint *) (pc + 0), (const GLdouble *) (pc + 4));
 }
 
 void
 __glXDisp_VertexAttrib4fvNV(GLbyte * pc)
 {
-    CALL_VertexAttrib4fvNV(GET_DISPATCH(), (*(GLuint *) (pc + 0),
-                                            (const GLfloat *) (pc + 4)
-                           ));
+    PFNGLVERTEXATTRIB4FVNVPROC VertexAttrib4fvNV =
+        __glGetProcAddress("glVertexAttrib4fvNV");
+    VertexAttrib4fvNV(*(GLuint *) (pc + 0), (const GLfloat *) (pc + 4));
 }
 
 void
 __glXDisp_VertexAttrib4svNV(GLbyte * pc)
 {
-    CALL_VertexAttrib4svNV(GET_DISPATCH(), (*(GLuint *) (pc + 0),
-                                            (const GLshort *) (pc + 4)
-                           ));
+    PFNGLVERTEXATTRIB4SVNVPROC VertexAttrib4svNV =
+        __glGetProcAddress("glVertexAttrib4svNV");
+    VertexAttrib4svNV(*(GLuint *) (pc + 0), (const GLshort *) (pc + 4));
 }
 
 void
 __glXDisp_VertexAttrib4ubvNV(GLbyte * pc)
 {
-    CALL_VertexAttrib4ubvNV(GET_DISPATCH(), (*(GLuint *) (pc + 0),
-                                             (const GLubyte *) (pc + 4)
-                            ));
+    PFNGLVERTEXATTRIB4UBVNVPROC VertexAttrib4ubvNV =
+        __glGetProcAddress("glVertexAttrib4ubvNV");
+    VertexAttrib4ubvNV(*(GLuint *) (pc + 0), (const GLubyte *) (pc + 4));
 }
 
 void
 __glXDisp_VertexAttribs1dvNV(GLbyte * pc)
 {
+    PFNGLVERTEXATTRIBS1DVNVPROC VertexAttribs1dvNV =
+        __glGetProcAddress("glVertexAttribs1dvNV");
     const GLsizei n = *(GLsizei *) (pc + 4);
 
 #ifdef __GLX_ALIGN64
@@ -5378,34 +4943,34 @@ __glXDisp_VertexAttribs1dvNV(GLbyte * pc)
     }
 #endif
 
-    CALL_VertexAttribs1dvNV(GET_DISPATCH(), (*(GLuint *) (pc + 0),
-                                             n, (const GLdouble *) (pc + 8)
-                            ));
+    VertexAttribs1dvNV(*(GLuint *) (pc + 0), n, (const GLdouble *) (pc + 8));
 }
 
 void
 __glXDisp_VertexAttribs1fvNV(GLbyte * pc)
 {
+    PFNGLVERTEXATTRIBS1FVNVPROC VertexAttribs1fvNV =
+        __glGetProcAddress("glVertexAttribs1fvNV");
     const GLsizei n = *(GLsizei *) (pc + 4);
 
-    CALL_VertexAttribs1fvNV(GET_DISPATCH(), (*(GLuint *) (pc + 0),
-                                             n, (const GLfloat *) (pc + 8)
-                            ));
+    VertexAttribs1fvNV(*(GLuint *) (pc + 0), n, (const GLfloat *) (pc + 8));
 }
 
 void
 __glXDisp_VertexAttribs1svNV(GLbyte * pc)
 {
+    PFNGLVERTEXATTRIBS1SVNVPROC VertexAttribs1svNV =
+        __glGetProcAddress("glVertexAttribs1svNV");
     const GLsizei n = *(GLsizei *) (pc + 4);
 
-    CALL_VertexAttribs1svNV(GET_DISPATCH(), (*(GLuint *) (pc + 0),
-                                             n, (const GLshort *) (pc + 8)
-                            ));
+    VertexAttribs1svNV(*(GLuint *) (pc + 0), n, (const GLshort *) (pc + 8));
 }
 
 void
 __glXDisp_VertexAttribs2dvNV(GLbyte * pc)
 {
+    PFNGLVERTEXATTRIBS2DVNVPROC VertexAttribs2dvNV =
+        __glGetProcAddress("glVertexAttribs2dvNV");
     const GLsizei n = *(GLsizei *) (pc + 4);
 
 #ifdef __GLX_ALIGN64
@@ -5417,34 +4982,34 @@ __glXDisp_VertexAttribs2dvNV(GLbyte * pc)
     }
 #endif
 
-    CALL_VertexAttribs2dvNV(GET_DISPATCH(), (*(GLuint *) (pc + 0),
-                                             n, (const GLdouble *) (pc + 8)
-                            ));
+    VertexAttribs2dvNV(*(GLuint *) (pc + 0), n, (const GLdouble *) (pc + 8));
 }
 
 void
 __glXDisp_VertexAttribs2fvNV(GLbyte * pc)
 {
+    PFNGLVERTEXATTRIBS2FVNVPROC VertexAttribs2fvNV =
+        __glGetProcAddress("glVertexAttribs2fvNV");
     const GLsizei n = *(GLsizei *) (pc + 4);
 
-    CALL_VertexAttribs2fvNV(GET_DISPATCH(), (*(GLuint *) (pc + 0),
-                                             n, (const GLfloat *) (pc + 8)
-                            ));
+    VertexAttribs2fvNV(*(GLuint *) (pc + 0), n, (const GLfloat *) (pc + 8));
 }
 
 void
 __glXDisp_VertexAttribs2svNV(GLbyte * pc)
 {
+    PFNGLVERTEXATTRIBS2SVNVPROC VertexAttribs2svNV =
+        __glGetProcAddress("glVertexAttribs2svNV");
     const GLsizei n = *(GLsizei *) (pc + 4);
 
-    CALL_VertexAttribs2svNV(GET_DISPATCH(), (*(GLuint *) (pc + 0),
-                                             n, (const GLshort *) (pc + 8)
-                            ));
+    VertexAttribs2svNV(*(GLuint *) (pc + 0), n, (const GLshort *) (pc + 8));
 }
 
 void
 __glXDisp_VertexAttribs3dvNV(GLbyte * pc)
 {
+    PFNGLVERTEXATTRIBS3DVNVPROC VertexAttribs3dvNV =
+        __glGetProcAddress("glVertexAttribs3dvNV");
     const GLsizei n = *(GLsizei *) (pc + 4);
 
 #ifdef __GLX_ALIGN64
@@ -5456,34 +5021,34 @@ __glXDisp_VertexAttribs3dvNV(GLbyte * pc)
     }
 #endif
 
-    CALL_VertexAttribs3dvNV(GET_DISPATCH(), (*(GLuint *) (pc + 0),
-                                             n, (const GLdouble *) (pc + 8)
-                            ));
+    VertexAttribs3dvNV(*(GLuint *) (pc + 0), n, (const GLdouble *) (pc + 8));
 }
 
 void
 __glXDisp_VertexAttribs3fvNV(GLbyte * pc)
 {
+    PFNGLVERTEXATTRIBS3FVNVPROC VertexAttribs3fvNV =
+        __glGetProcAddress("glVertexAttribs3fvNV");
     const GLsizei n = *(GLsizei *) (pc + 4);
 
-    CALL_VertexAttribs3fvNV(GET_DISPATCH(), (*(GLuint *) (pc + 0),
-                                             n, (const GLfloat *) (pc + 8)
-                            ));
+    VertexAttribs3fvNV(*(GLuint *) (pc + 0), n, (const GLfloat *) (pc + 8));
 }
 
 void
 __glXDisp_VertexAttribs3svNV(GLbyte * pc)
 {
+    PFNGLVERTEXATTRIBS3SVNVPROC VertexAttribs3svNV =
+        __glGetProcAddress("glVertexAttribs3svNV");
     const GLsizei n = *(GLsizei *) (pc + 4);
 
-    CALL_VertexAttribs3svNV(GET_DISPATCH(), (*(GLuint *) (pc + 0),
-                                             n, (const GLshort *) (pc + 8)
-                            ));
+    VertexAttribs3svNV(*(GLuint *) (pc + 0), n, (const GLshort *) (pc + 8));
 }
 
 void
 __glXDisp_VertexAttribs4dvNV(GLbyte * pc)
 {
+    PFNGLVERTEXATTRIBS4DVNVPROC VertexAttribs4dvNV =
+        __glGetProcAddress("glVertexAttribs4dvNV");
     const GLsizei n = *(GLsizei *) (pc + 4);
 
 #ifdef __GLX_ALIGN64
@@ -5495,432 +5060,43 @@ __glXDisp_VertexAttribs4dvNV(GLbyte * pc)
     }
 #endif
 
-    CALL_VertexAttribs4dvNV(GET_DISPATCH(), (*(GLuint *) (pc + 0),
-                                             n, (const GLdouble *) (pc + 8)
-                            ));
+    VertexAttribs4dvNV(*(GLuint *) (pc + 0), n, (const GLdouble *) (pc + 8));
 }
 
 void
 __glXDisp_VertexAttribs4fvNV(GLbyte * pc)
 {
+    PFNGLVERTEXATTRIBS4FVNVPROC VertexAttribs4fvNV =
+        __glGetProcAddress("glVertexAttribs4fvNV");
     const GLsizei n = *(GLsizei *) (pc + 4);
 
-    CALL_VertexAttribs4fvNV(GET_DISPATCH(), (*(GLuint *) (pc + 0),
-                                             n, (const GLfloat *) (pc + 8)
-                            ));
+    VertexAttribs4fvNV(*(GLuint *) (pc + 0), n, (const GLfloat *) (pc + 8));
 }
 
 void
 __glXDisp_VertexAttribs4svNV(GLbyte * pc)
 {
+    PFNGLVERTEXATTRIBS4SVNVPROC VertexAttribs4svNV =
+        __glGetProcAddress("glVertexAttribs4svNV");
     const GLsizei n = *(GLsizei *) (pc + 4);
 
-    CALL_VertexAttribs4svNV(GET_DISPATCH(), (*(GLuint *) (pc + 0),
-                                             n, (const GLshort *) (pc + 8)
-                            ));
+    VertexAttribs4svNV(*(GLuint *) (pc + 0), n, (const GLshort *) (pc + 8));
 }
 
 void
 __glXDisp_VertexAttribs4ubvNV(GLbyte * pc)
 {
+    PFNGLVERTEXATTRIBS4UBVNVPROC VertexAttribs4ubvNV =
+        __glGetProcAddress("glVertexAttribs4ubvNV");
     const GLsizei n = *(GLsizei *) (pc + 4);
 
-    CALL_VertexAttribs4ubvNV(GET_DISPATCH(), (*(GLuint *) (pc + 0),
-                                              n, (const GLubyte *) (pc + 8)
-                             ));
-}
-
-void
-__glXDisp_PointParameteriNV(GLbyte * pc)
-{
-    CALL_PointParameteriNV(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                            *(GLint *) (pc + 4)
-                           ));
-}
-
-void
-__glXDisp_PointParameterivNV(GLbyte * pc)
-{
-    const GLenum pname = *(GLenum *) (pc + 0);
-    const GLint *params;
-
-    params = (const GLint *) (pc + 4);
-
-    CALL_PointParameterivNV(GET_DISPATCH(), (pname, params));
+    VertexAttribs4ubvNV(*(GLuint *) (pc + 0), n, (const GLubyte *) (pc + 8));
 }
 
 void
 __glXDisp_ActiveStencilFaceEXT(GLbyte * pc)
 {
-    CALL_ActiveStencilFaceEXT(GET_DISPATCH(), (*(GLenum *) (pc + 0)
-                              ));
-}
-
-int
-__glXDisp_GetProgramNamedParameterdvNV(__GLXclientState * cl, GLbyte * pc)
-{
-    xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc;
-    int error;
-    __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
-    pc += __GLX_VENDPRIV_HDR_SIZE;
-    if (cx != NULL) {
-        const GLsizei len = *(GLsizei *) (pc + 4);
-
-        GLdouble params[4];
-
-        CALL_GetProgramNamedParameterdvNV(GET_DISPATCH(), (*(GLuint *) (pc + 0),
-                                                           len,
-                                                           (const GLubyte *) (pc
-                                                                              +
-                                                                              8),
-                                                           params));
-        __glXSendReply(cl->client, params, 4, 8, GL_TRUE, 0);
-        error = Success;
-    }
-
-    return error;
-}
-
-int
-__glXDisp_GetProgramNamedParameterfvNV(__GLXclientState * cl, GLbyte * pc)
-{
-    xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc;
-    int error;
-    __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
-    pc += __GLX_VENDPRIV_HDR_SIZE;
-    if (cx != NULL) {
-        const GLsizei len = *(GLsizei *) (pc + 4);
-
-        GLfloat params[4];
-
-        CALL_GetProgramNamedParameterfvNV(GET_DISPATCH(), (*(GLuint *) (pc + 0),
-                                                           len,
-                                                           (const GLubyte *) (pc
-                                                                              +
-                                                                              8),
-                                                           params));
-        __glXSendReply(cl->client, params, 4, 4, GL_TRUE, 0);
-        error = Success;
-    }
-
-    return error;
-}
-
-void
-__glXDisp_ProgramNamedParameter4dvNV(GLbyte * pc)
-{
-    const GLsizei len = *(GLsizei *) (pc + 36);
-
-#ifdef __GLX_ALIGN64
-    const GLuint cmdlen = 44 + __GLX_PAD(len) - 4;
-
-    if ((unsigned long) (pc) & 7) {
-        (void) memmove(pc - 4, pc, cmdlen);
-        pc -= 4;
-    }
-#endif
-
-    CALL_ProgramNamedParameter4dvNV(GET_DISPATCH(), (*(GLuint *) (pc + 32),
-                                                     len,
-                                                     (const GLubyte *) (pc +
-                                                                        40),
-                                                     (const GLdouble *) (pc + 0)
-                                    ));
-}
-
-void
-__glXDisp_ProgramNamedParameter4fvNV(GLbyte * pc)
-{
-    const GLsizei len = *(GLsizei *) (pc + 4);
-
-    CALL_ProgramNamedParameter4fvNV(GET_DISPATCH(), (*(GLuint *) (pc + 0),
-                                                     len,
-                                                     (const GLubyte *) (pc +
-                                                                        24),
-                                                     (const GLfloat *) (pc + 8)
-                                    ));
-}
-
-void
-__glXDisp_BlendEquationSeparateEXT(GLbyte * pc)
-{
-    CALL_BlendEquationSeparateEXT(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                                   *(GLenum *) (pc + 4)
-                                  ));
-}
-
-void
-__glXDisp_BindFramebufferEXT(GLbyte * pc)
-{
-    CALL_BindFramebufferEXT(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                             *(GLuint *) (pc + 4)
-                            ));
-}
-
-void
-__glXDisp_BindRenderbufferEXT(GLbyte * pc)
-{
-    CALL_BindRenderbufferEXT(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                              *(GLuint *) (pc + 4)
-                             ));
-}
-
-int
-__glXDisp_CheckFramebufferStatusEXT(__GLXclientState * cl, GLbyte * pc)
-{
-    xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc;
-    int error;
-    __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
-    pc += __GLX_VENDPRIV_HDR_SIZE;
-    if (cx != NULL) {
-        GLenum retval;
-
-        retval =
-            CALL_CheckFramebufferStatusEXT(GET_DISPATCH(), (*(GLenum *) (pc + 0)
-                                           ));
-        __glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval);
-        error = Success;
-    }
-
-    return error;
-}
-
-void
-__glXDisp_DeleteFramebuffersEXT(GLbyte * pc)
-{
-    const GLsizei n = *(GLsizei *) (pc + 0);
-
-    CALL_DeleteFramebuffersEXT(GET_DISPATCH(), (n, (const GLuint *) (pc + 4)
-                               ));
-}
-
-void
-__glXDisp_DeleteRenderbuffersEXT(GLbyte * pc)
-{
-    const GLsizei n = *(GLsizei *) (pc + 0);
-
-    CALL_DeleteRenderbuffersEXT(GET_DISPATCH(), (n, (const GLuint *) (pc + 4)
-                                ));
-}
-
-void
-__glXDisp_FramebufferRenderbufferEXT(GLbyte * pc)
-{
-    CALL_FramebufferRenderbufferEXT(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                                     *(GLenum *) (pc + 4),
-                                                     *(GLenum *) (pc + 8),
-                                                     *(GLuint *) (pc + 12)
-                                    ));
-}
-
-void
-__glXDisp_FramebufferTexture1DEXT(GLbyte * pc)
-{
-    CALL_FramebufferTexture1DEXT(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                                  *(GLenum *) (pc + 4),
-                                                  *(GLenum *) (pc + 8),
-                                                  *(GLuint *) (pc + 12),
-                                                  *(GLint *) (pc + 16)
-                                 ));
-}
-
-void
-__glXDisp_FramebufferTexture2DEXT(GLbyte * pc)
-{
-    CALL_FramebufferTexture2DEXT(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                                  *(GLenum *) (pc + 4),
-                                                  *(GLenum *) (pc + 8),
-                                                  *(GLuint *) (pc + 12),
-                                                  *(GLint *) (pc + 16)
-                                 ));
-}
-
-void
-__glXDisp_FramebufferTexture3DEXT(GLbyte * pc)
-{
-    CALL_FramebufferTexture3DEXT(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                                  *(GLenum *) (pc + 4),
-                                                  *(GLenum *) (pc + 8),
-                                                  *(GLuint *) (pc + 12),
-                                                  *(GLint *) (pc + 16),
-                                                  *(GLint *) (pc + 20)
-                                 ));
-}
-
-int
-__glXDisp_GenFramebuffersEXT(__GLXclientState * cl, GLbyte * pc)
-{
-    xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc;
-    int error;
-    __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
-    pc += __GLX_VENDPRIV_HDR_SIZE;
-    if (cx != NULL) {
-        const GLsizei n = *(GLsizei *) (pc + 0);
-
-        GLuint answerBuffer[200];
-        GLuint *framebuffers =
-            __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer),
-                                 4);
-        CALL_GenFramebuffersEXT(GET_DISPATCH(), (n, framebuffers));
-        __glXSendReply(cl->client, framebuffers, n, 4, GL_TRUE, 0);
-        error = Success;
-    }
-
-    return error;
-}
-
-int
-__glXDisp_GenRenderbuffersEXT(__GLXclientState * cl, GLbyte * pc)
-{
-    xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc;
-    int error;
-    __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
-    pc += __GLX_VENDPRIV_HDR_SIZE;
-    if (cx != NULL) {
-        const GLsizei n = *(GLsizei *) (pc + 0);
-
-        GLuint answerBuffer[200];
-        GLuint *renderbuffers =
-            __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer),
-                                 4);
-        CALL_GenRenderbuffersEXT(GET_DISPATCH(), (n, renderbuffers));
-        __glXSendReply(cl->client, renderbuffers, n, 4, GL_TRUE, 0);
-        error = Success;
-    }
-
-    return error;
-}
-
-void
-__glXDisp_GenerateMipmapEXT(GLbyte * pc)
-{
-    CALL_GenerateMipmapEXT(GET_DISPATCH(), (*(GLenum *) (pc + 0)
-                           ));
-}
-
-int
-__glXDisp_GetFramebufferAttachmentParameterivEXT(__GLXclientState * cl,
-                                                 GLbyte * pc)
-{
-    xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc;
-    int error;
-    __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
-    pc += __GLX_VENDPRIV_HDR_SIZE;
-    if (cx != NULL) {
-        GLint params[1];
-
-        CALL_GetFramebufferAttachmentParameterivEXT(GET_DISPATCH(),
-                                                    (*(GLenum *) (pc + 0),
-                                                     *(GLenum *) (pc + 4),
-                                                     *(GLenum *) (pc + 8),
-                                                     params));
-        __glXSendReply(cl->client, params, 1, 4, GL_FALSE, 0);
-        error = Success;
-    }
-
-    return error;
-}
-
-int
-__glXDisp_GetRenderbufferParameterivEXT(__GLXclientState * cl, GLbyte * pc)
-{
-    xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc;
-    int error;
-    __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
-    pc += __GLX_VENDPRIV_HDR_SIZE;
-    if (cx != NULL) {
-        GLint params[1];
-
-        CALL_GetRenderbufferParameterivEXT(GET_DISPATCH(),
-                                           (*(GLenum *) (pc + 0),
-                                            *(GLenum *) (pc + 4), params));
-        __glXSendReply(cl->client, params, 1, 4, GL_FALSE, 0);
-        error = Success;
-    }
-
-    return error;
-}
-
-int
-__glXDisp_IsFramebufferEXT(__GLXclientState * cl, GLbyte * pc)
-{
-    xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc;
-    int error;
-    __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
-    pc += __GLX_VENDPRIV_HDR_SIZE;
-    if (cx != NULL) {
-        GLboolean retval;
-
-        retval = CALL_IsFramebufferEXT(GET_DISPATCH(), (*(GLuint *) (pc + 0)
-                                       ));
-        __glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval);
-        error = Success;
-    }
-
-    return error;
-}
-
-int
-__glXDisp_IsRenderbufferEXT(__GLXclientState * cl, GLbyte * pc)
-{
-    xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc;
-    int error;
-    __GLXcontext *const cx = __glXForceCurrent(cl, req->contextTag, &error);
-
-    pc += __GLX_VENDPRIV_HDR_SIZE;
-    if (cx != NULL) {
-        GLboolean retval;
-
-        retval = CALL_IsRenderbufferEXT(GET_DISPATCH(), (*(GLuint *) (pc + 0)
-                                        ));
-        __glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval);
-        error = Success;
-    }
-
-    return error;
-}
-
-void
-__glXDisp_RenderbufferStorageEXT(GLbyte * pc)
-{
-    CALL_RenderbufferStorageEXT(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                                 *(GLenum *) (pc + 4),
-                                                 *(GLsizei *) (pc + 8),
-                                                 *(GLsizei *) (pc + 12)
-                                ));
-}
-
-void
-__glXDisp_BlitFramebufferEXT(GLbyte * pc)
-{
-    CALL_BlitFramebufferEXT(GET_DISPATCH(), (*(GLint *) (pc + 0),
-                                             *(GLint *) (pc + 4),
-                                             *(GLint *) (pc + 8),
-                                             *(GLint *) (pc + 12),
-                                             *(GLint *) (pc + 16),
-                                             *(GLint *) (pc + 20),
-                                             *(GLint *) (pc + 24),
-                                             *(GLint *) (pc + 28),
-                                             *(GLbitfield *) (pc + 32),
-                                             *(GLenum *) (pc + 36)
-                            ));
-}
-
-void
-__glXDisp_FramebufferTextureLayerEXT(GLbyte * pc)
-{
-    CALL_FramebufferTextureLayerEXT(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                                     *(GLenum *) (pc + 4),
-                                                     *(GLuint *) (pc + 8),
-                                                     *(GLint *) (pc + 12),
-                                                     *(GLint *) (pc + 16)
-                                    ));
+    PFNGLACTIVESTENCILFACEEXTPROC ActiveStencilFaceEXT =
+        __glGetProcAddress("glActiveStencilFaceEXT");
+    ActiveStencilFaceEXT(*(GLenum *) (pc + 0));
 }
index d75dbe0..e6e3fda 100644 (file)
@@ -41,32 +41,18 @@ extern _X_HIDDEN int __glXDispSwap_NewList(struct __GLXclientStateRec *,
                                            GLbyte *);
 extern _X_HIDDEN void __glXDisp_LoadIdentity(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_LoadIdentity(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_SampleCoverageARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_SampleCoverageARB(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_ConvolutionFilter1D(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_ConvolutionFilter1D(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_BeginQueryARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_BeginQueryARB(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_RasterPos3dv(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_RasterPos3dv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_PointParameteriNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_PointParameteriNV(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_TexCoord1iv(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_TexCoord1iv(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_TexCoord4sv(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_TexCoord4sv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_ActiveTextureARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_ActiveTextureARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_BlitFramebufferEXT(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_BlitFramebufferEXT(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_VertexAttrib3dv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_VertexAttrib3dv(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_VertexAttrib4ubvNV(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_VertexAttrib4ubvNV(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_GetProgramNamedParameterdvNV(struct
-                                                            __GLXclientStateRec
-                                                            *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetProgramNamedParameterdvNV(struct
-                                                                __GLXclientStateRec
-                                                                *, GLbyte *);
 extern _X_HIDDEN void __glXDisp_Histogram(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_Histogram(GLbyte * pc);
 extern _X_HIDDEN int __glXDisp_GetMapfv(struct __GLXclientStateRec *, GLbyte *);
@@ -76,8 +62,8 @@ extern _X_HIDDEN void __glXDisp_RasterPos4dv(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_RasterPos4dv(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_PolygonStipple(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_PolygonStipple(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_BlendEquationSeparateEXT(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_BlendEquationSeparateEXT(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_MultiTexCoord1dv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_MultiTexCoord1dv(GLbyte * pc);
 extern _X_HIDDEN int __glXDisp_GetPixelMapfv(struct __GLXclientStateRec *,
                                              GLbyte *);
 extern _X_HIDDEN int __glXDispSwap_GetPixelMapfv(struct __GLXclientStateRec *,
@@ -96,6 +82,8 @@ extern _X_HIDDEN int __glXDisp_DestroyPixmap(struct __GLXclientStateRec *,
                                              GLbyte *);
 extern _X_HIDDEN int __glXDispSwap_DestroyPixmap(struct __GLXclientStateRec *,
                                                  GLbyte *);
+extern _X_HIDDEN void __glXDisp_FramebufferTexture1D(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_FramebufferTexture1D(GLbyte * pc);
 extern _X_HIDDEN int __glXDisp_GetMapiv(struct __GLXclientStateRec *, GLbyte *);
 extern _X_HIDDEN int __glXDispSwap_GetMapiv(struct __GLXclientStateRec *,
                                             GLbyte *);
@@ -108,10 +96,6 @@ extern _X_HIDDEN void __glXDispSwap_Indexubv(GLbyte * pc);
 extern _X_HIDDEN int __glXDisp_Render(struct __GLXclientStateRec *, GLbyte *);
 extern _X_HIDDEN int __glXDispSwap_Render(struct __GLXclientStateRec *,
                                           GLbyte *);
-extern _X_HIDDEN int __glXDisp_GetQueryivARB(struct __GLXclientStateRec *,
-                                             GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetQueryivARB(struct __GLXclientStateRec *,
-                                                 GLbyte *);
 extern _X_HIDDEN void __glXDisp_TexImage3D(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_TexImage3D(GLbyte * pc);
 extern _X_HIDDEN int __glXDisp_MakeContextCurrent(struct __GLXclientStateRec *,
@@ -122,23 +106,14 @@ extern _X_HIDDEN int __glXDisp_GetFBConfigs(struct __GLXclientStateRec *,
                                             GLbyte *);
 extern _X_HIDDEN int __glXDispSwap_GetFBConfigs(struct __GLXclientStateRec *,
                                                 GLbyte *);
+extern _X_HIDDEN void __glXDisp_VertexAttrib1sv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_VertexAttrib1sv(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_Color3ubv(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_Color3ubv(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_GetQueryObjectivARB(struct __GLXclientStateRec *,
-                                                   GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetQueryObjectivARB(struct
-                                                       __GLXclientStateRec *,
-                                                       GLbyte *);
 extern _X_HIDDEN void __glXDisp_Vertex3dv(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_Vertex3dv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_CompressedTexSubImage2DARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_CompressedTexSubImage2DARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_VertexAttribs3fvNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_VertexAttribs3fvNV(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_LightModeliv(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_LightModeliv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_VertexAttrib1svARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_VertexAttrib1svARB(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_VertexAttribs1dvNV(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_VertexAttribs1dvNV(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_Normal3bv(GLbyte * pc);
@@ -149,46 +124,52 @@ extern _X_HIDDEN int __glXDispSwap_VendorPrivate(struct __GLXclientStateRec *,
                                                  GLbyte *);
 extern _X_HIDDEN void __glXDisp_TexGeniv(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_TexGeniv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_VertexAttrib1fvNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_VertexAttrib1fvNV(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_Vertex3iv(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_Vertex3iv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_RenderbufferStorage(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_RenderbufferStorage(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_CopyConvolutionFilter1D(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_CopyConvolutionFilter1D(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_GenQueries(struct __GLXclientStateRec *,
+                                          GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GenQueries(struct __GLXclientStateRec *,
+                                              GLbyte *);
 extern _X_HIDDEN void __glXDisp_BlendColor(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_BlendColor(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_CompressedTexImage3D(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_CompressedTexImage3D(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_Scalef(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_Scalef(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_Normal3iv(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_Normal3iv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_SecondaryColor3dv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_SecondaryColor3dv(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_PassThrough(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_PassThrough(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_FramebufferTextureLayerEXT(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_FramebufferTextureLayerEXT(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_Viewport(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_Viewport(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_VertexAttrib4NusvARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_VertexAttrib4NusvARB(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_CopyTexSubImage2D(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_CopyTexSubImage2D(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_DepthRange(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_DepthRange(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_GetQueryiv(struct __GLXclientStateRec *,
+                                          GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetQueryiv(struct __GLXclientStateRec *,
+                                              GLbyte *);
 extern _X_HIDDEN void __glXDisp_ResetHistogram(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_ResetHistogram(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_GetProgramNamedParameterfvNV(struct
-                                                            __GLXclientStateRec
-                                                            *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetProgramNamedParameterfvNV(struct
-                                                                __GLXclientStateRec
-                                                                *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_PointParameterfEXT(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_PointParameterfEXT(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_CompressedTexSubImage2D(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_CompressedTexSubImage2D(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_SecondaryColor3uiv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_SecondaryColor3uiv(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_TexCoord2sv(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_TexCoord2sv(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_Vertex4dv(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_Vertex4dv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_CompressedTexImage3DARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_CompressedTexImage3DARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_VertexAttrib4Nbv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_VertexAttrib4Nbv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_VertexAttribs2svNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_VertexAttribs2svNV(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_Color3sv(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_Color3sv(GLbyte * pc);
 extern _X_HIDDEN int __glXDisp_GetConvolutionParameteriv(struct
@@ -209,6 +190,8 @@ extern _X_HIDDEN int __glXDisp_GetVisualConfigs(struct __GLXclientStateRec *,
                                                 GLbyte *);
 extern _X_HIDDEN int __glXDispSwap_GetVisualConfigs(struct __GLXclientStateRec
                                                     *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_DeleteRenderbuffers(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_DeleteRenderbuffers(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_MultiTexCoord1fvARB(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_MultiTexCoord1fvARB(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_TexCoord3iv(GLbyte * pc);
@@ -217,16 +200,24 @@ extern _X_HIDDEN int __glXDisp_CopyContext(struct __GLXclientStateRec *,
                                            GLbyte *);
 extern _X_HIDDEN int __glXDispSwap_CopyContext(struct __GLXclientStateRec *,
                                                GLbyte *);
+extern _X_HIDDEN void __glXDisp_VertexAttrib4usv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_VertexAttrib4usv(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_Color3fv(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_Color3fv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_MultiTexCoord4sv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_MultiTexCoord4sv(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_PointSize(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_PointSize(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_PopName(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_PopName(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_VertexAttrib4NbvARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_VertexAttrib4NbvARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_VertexAttrib2dv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_VertexAttrib2dv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_VertexAttrib4Nusv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_VertexAttrib4Nusv(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_Vertex4sv(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_Vertex4sv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_ClampColor(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_ClampColor(GLbyte * pc);
 extern _X_HIDDEN int __glXDisp_GetTexEnvfv(struct __GLXclientStateRec *,
                                            GLbyte *);
 extern _X_HIDDEN int __glXDispSwap_GetTexEnvfv(struct __GLXclientStateRec *,
@@ -251,8 +242,6 @@ extern _X_HIDDEN void __glXDisp_AlphaFunc(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_AlphaFunc(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_TexCoord2iv(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_TexCoord2iv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_CompressedTexImage1DARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_CompressedTexImage1DARB(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_Rotated(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_Rotated(GLbyte * pc);
 extern _X_HIDDEN int __glXDisp_ReadPixels(struct __GLXclientStateRec *,
@@ -261,6 +250,8 @@ extern _X_HIDDEN int __glXDispSwap_ReadPixels(struct __GLXclientStateRec *,
                                               GLbyte *);
 extern _X_HIDDEN void __glXDisp_EdgeFlagv(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_EdgeFlagv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_CompressedTexSubImage1D(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_CompressedTexSubImage1D(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_TexParameterf(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_TexParameterf(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_TexParameteri(GLbyte * pc);
@@ -271,12 +262,8 @@ extern _X_HIDDEN int __glXDispSwap_DestroyContext(struct __GLXclientStateRec *,
                                                   GLbyte *);
 extern _X_HIDDEN void __glXDisp_DrawPixels(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_DrawPixels(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_MultiTexCoord2svARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_MultiTexCoord2svARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_MultiTexCoord3svARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_MultiTexCoord3svARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_GenerateMipmapEXT(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_GenerateMipmapEXT(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_MultiTexCoord3sv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_MultiTexCoord3sv(GLbyte * pc);
 extern _X_HIDDEN int __glXDisp_GenLists(struct __GLXclientStateRec *, GLbyte *);
 extern _X_HIDDEN int __glXDispSwap_GenLists(struct __GLXclientStateRec *,
                                             GLbyte *);
@@ -300,6 +287,8 @@ extern _X_HIDDEN void __glXDisp_PixelMapfv(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_PixelMapfv(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_Color3usv(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_Color3usv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_MultiTexCoord2iv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_MultiTexCoord2iv(GLbyte * pc);
 extern _X_HIDDEN int __glXDisp_AreTexturesResident(struct __GLXclientStateRec *,
                                                    GLbyte *);
 extern _X_HIDDEN int __glXDispSwap_AreTexturesResident(struct
@@ -310,20 +299,16 @@ extern _X_HIDDEN int __glXDisp_AreTexturesResidentEXT(struct __GLXclientStateRec
 extern _X_HIDDEN int __glXDispSwap_AreTexturesResidentEXT(struct
                                                           __GLXclientStateRec *,
                                                           GLbyte *);
-extern _X_HIDDEN void __glXDisp_PointParameterfvEXT(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_PointParameterfvEXT(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_Color3bv(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_Color3bv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_SecondaryColor3bvEXT(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_SecondaryColor3bvEXT(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_VertexAttrib2fvARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_VertexAttrib2fvARB(GLbyte * pc);
 extern _X_HIDDEN int __glXDisp_GetProgramLocalParameterfvARB(struct
                                                              __GLXclientStateRec
                                                              *, GLbyte *);
 extern _X_HIDDEN int __glXDispSwap_GetProgramLocalParameterfvARB(struct
                                                                  __GLXclientStateRec
                                                                  *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_RenderbufferStorageEXT(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_RenderbufferStorageEXT(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_ColorTable(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_ColorTable(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_Accum(GLbyte * pc);
@@ -339,8 +324,6 @@ extern _X_HIDDEN int __glXDispSwap_Finish(struct __GLXclientStateRec *,
                                           GLbyte *);
 extern _X_HIDDEN void __glXDisp_ClearStencil(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_ClearStencil(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_VertexAttrib3dvARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_VertexAttrib3dvARB(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_VertexAttribs4ubvNV(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_VertexAttribs4ubvNV(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_ConvolutionParameteriv(GLbyte * pc);
@@ -349,6 +332,8 @@ extern _X_HIDDEN void __glXDisp_RasterPos2fv(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_RasterPos2fv(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_TexCoord1fv(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_TexCoord1fv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_MultiTexCoord4dv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_MultiTexCoord4dv(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_ProgramEnvParameter4fvARB(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_ProgramEnvParameter4fvARB(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_RasterPos4fv(GLbyte * pc);
@@ -365,39 +350,29 @@ extern _X_HIDDEN int __glXDisp_GetTexGendv(struct __GLXclientStateRec *,
                                            GLbyte *);
 extern _X_HIDDEN int __glXDispSwap_GetTexGendv(struct __GLXclientStateRec *,
                                                GLbyte *);
-extern _X_HIDDEN int __glXDisp_GetVertexAttribfvNV(struct __GLXclientStateRec *,
-                                                   GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetVertexAttribfvNV(struct
-                                                       __GLXclientStateRec *,
-                                                       GLbyte *);
-extern _X_HIDDEN void __glXDisp_LoadProgramNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_LoadProgramNV(GLbyte * pc);
 extern _X_HIDDEN int __glXDisp_EndList(struct __GLXclientStateRec *, GLbyte *);
 extern _X_HIDDEN int __glXDispSwap_EndList(struct __GLXclientStateRec *,
                                            GLbyte *);
-extern _X_HIDDEN void __glXDisp_VertexAttrib4fvNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_VertexAttrib4fvNV(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_EvalCoord1fv(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_EvalCoord1fv(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_EvalMesh2(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_EvalMesh2(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_Vertex4fv(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_Vertex4fv(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_CheckFramebufferStatusEXT(struct
-                                                         __GLXclientStateRec *,
-                                                         GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_CheckFramebufferStatusEXT(struct
-                                                             __GLXclientStateRec
-                                                             *, GLbyte *);
-extern _X_HIDDEN int __glXDisp_GetVertexAttribivARB(struct __GLXclientStateRec
-                                                    *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetVertexAttribivARB(struct
-                                                        __GLXclientStateRec *,
-                                                        GLbyte *);
+extern _X_HIDDEN void __glXDisp_VertexAttribs3fvNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_VertexAttribs3fvNV(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_GetProgramEnvParameterdvARB(struct
+                                                           __GLXclientStateRec
+                                                           *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetProgramEnvParameterdvARB(struct
+                                                               __GLXclientStateRec
+                                                               *, GLbyte *);
 extern _X_HIDDEN int __glXDisp_GetFBConfigsSGIX(struct __GLXclientStateRec *,
                                                 GLbyte *);
 extern _X_HIDDEN int __glXDispSwap_GetFBConfigsSGIX(struct __GLXclientStateRec
                                                     *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_BindFramebuffer(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_BindFramebuffer(GLbyte * pc);
 extern _X_HIDDEN int __glXDisp_CreateNewContext(struct __GLXclientStateRec *,
                                                 GLbyte *);
 extern _X_HIDDEN int __glXDispSwap_CreateNewContext(struct __GLXclientStateRec
@@ -410,14 +385,16 @@ extern _X_HIDDEN int __glXDisp_GetMinmaxEXT(struct __GLXclientStateRec *,
                                             GLbyte *);
 extern _X_HIDDEN int __glXDispSwap_GetMinmaxEXT(struct __GLXclientStateRec *,
                                                 GLbyte *);
+extern _X_HIDDEN void __glXDisp_BlendFuncSeparate(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_BlendFuncSeparate(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_Normal3fv(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_Normal3fv(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_ProgramEnvParameter4dvARB(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_ProgramEnvParameter4dvARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_VertexAttrib4ivARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_VertexAttrib4ivARB(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_End(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_End(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_VertexAttribs3svNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_VertexAttribs3svNV(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_VertexAttribs2dvNV(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_VertexAttribs2dvNV(GLbyte * pc);
 extern _X_HIDDEN int __glXDisp_CreateContextAttribsARB(struct
@@ -426,28 +403,24 @@ extern _X_HIDDEN int __glXDisp_CreateContextAttribsARB(struct
 extern _X_HIDDEN int __glXDispSwap_CreateContextAttribsARB(struct
                                                            __GLXclientStateRec
                                                            *, GLbyte *);
-extern _X_HIDDEN int __glXDisp_GetProgramParameterfvNV(struct
-                                                       __GLXclientStateRec *,
-                                                       GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetProgramParameterfvNV(struct
-                                                           __GLXclientStateRec
-                                                           *, GLbyte *);
 extern _X_HIDDEN void __glXDisp_BindTexture(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_BindTexture(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_VertexAttrib2sv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_VertexAttrib2sv(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_TexSubImage2D(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_TexSubImage2D(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_TexGenfv(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_TexGenfv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_VertexAttrib4bvARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_VertexAttrib4bvARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_VertexAttrib4dvNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_VertexAttrib4dvNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_DrawBuffers(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_DrawBuffers(GLbyte * pc);
 extern _X_HIDDEN int __glXDisp_CreateContextWithConfigSGIX(struct
                                                            __GLXclientStateRec
                                                            *, GLbyte *);
 extern _X_HIDDEN int __glXDispSwap_CreateContextWithConfigSGIX(struct
                                                                __GLXclientStateRec
                                                                *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_FramebufferTexture3DEXT(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_FramebufferTexture3DEXT(GLbyte * pc);
 extern _X_HIDDEN int __glXDisp_CopySubBufferMESA(struct __GLXclientStateRec *,
                                                  GLbyte *);
 extern _X_HIDDEN int __glXDispSwap_CopySubBufferMESA(struct __GLXclientStateRec
@@ -461,25 +434,21 @@ extern _X_HIDDEN void __glXDisp_TexCoord3dv(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_TexCoord3dv(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_Indexdv(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_Indexdv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_FramebufferTexture2DEXT(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_FramebufferTexture2DEXT(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_PushName(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_PushName(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_MultiTexCoord2dvARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_MultiTexCoord2dvARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_ProgramNamedParameter4fvNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_ProgramNamedParameter4fvNV(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_VertexAttrib4fvARB(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_VertexAttrib4fvARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_VertexAttrib1dv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_VertexAttrib1dv(GLbyte * pc);
 extern _X_HIDDEN int __glXDisp_CreateGLXPbufferSGIX(struct __GLXclientStateRec
                                                     *, GLbyte *);
 extern _X_HIDDEN int __glXDispSwap_CreateGLXPbufferSGIX(struct
                                                         __GLXclientStateRec *,
                                                         GLbyte *);
-extern _X_HIDDEN void __glXDisp_MultiTexCoord1svARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_MultiTexCoord1svARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_EndQueryARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_EndQueryARB(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_IsRenderbuffer(struct __GLXclientStateRec *,
+                                              GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_IsRenderbuffer(struct __GLXclientStateRec *,
+                                                  GLbyte *);
 extern _X_HIDDEN void __glXDisp_DepthMask(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_DepthMask(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_Color4iv(GLbyte * pc);
@@ -490,6 +459,8 @@ extern _X_HIDDEN int __glXDispSwap_GetMaterialiv(struct __GLXclientStateRec *,
                                                  GLbyte *);
 extern _X_HIDDEN void __glXDisp_StencilOp(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_StencilOp(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_FramebufferTextureLayer(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_FramebufferTextureLayer(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_Ortho(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_Ortho(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_TexEnvfv(GLbyte * pc);
@@ -502,8 +473,11 @@ extern _X_HIDDEN void __glXDisp_LoadMatrixf(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_LoadMatrixf(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_Color4bv(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_Color4bv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_SecondaryColor3usvEXT(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_SecondaryColor3usvEXT(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_GetCompressedTexImage(struct __GLXclientStateRec
+                                                     *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetCompressedTexImage(struct
+                                                         __GLXclientStateRec *,
+                                                         GLbyte *);
 extern _X_HIDDEN void __glXDisp_VertexAttrib2fvNV(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_VertexAttrib2fvNV(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_ProgramLocalParameter4dvARB(GLbyte * pc);
@@ -518,13 +492,13 @@ extern _X_HIDDEN void __glXDisp_RenderbufferStorageMultisample(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_RenderbufferStorageMultisample(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_TexCoord4fv(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_TexCoord4fv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_ActiveTexture(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_ActiveTexture(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_SecondaryColor3bv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_SecondaryColor3bv(GLbyte * pc);
 extern _X_HIDDEN int __glXDisp_WaitX(struct __GLXclientStateRec *, GLbyte *);
 extern _X_HIDDEN int __glXDispSwap_WaitX(struct __GLXclientStateRec *,
                                          GLbyte *);
-extern _X_HIDDEN void __glXDisp_SecondaryColor3uivEXT(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_SecondaryColor3uivEXT(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_FramebufferRenderbufferEXT(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_FramebufferRenderbufferEXT(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_VertexAttrib1dvNV(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_VertexAttrib1dvNV(GLbyte * pc);
 extern _X_HIDDEN int __glXDisp_GenTextures(struct __GLXclientStateRec *,
@@ -535,8 +509,6 @@ extern _X_HIDDEN int __glXDisp_GenTexturesEXT(struct __GLXclientStateRec *,
                                               GLbyte *);
 extern _X_HIDDEN int __glXDispSwap_GenTexturesEXT(struct __GLXclientStateRec *,
                                                   GLbyte *);
-extern _X_HIDDEN void __glXDisp_FramebufferTexture1DEXT(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_FramebufferTexture1DEXT(GLbyte * pc);
 extern _X_HIDDEN int __glXDisp_GetDrawableAttributes(struct __GLXclientStateRec
                                                      *, GLbyte *);
 extern _X_HIDDEN int __glXDispSwap_GetDrawableAttributes(struct
@@ -550,6 +522,8 @@ extern _X_HIDDEN void __glXDisp_DrawBuffer(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_DrawBuffer(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_TexCoord2fv(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_TexCoord2fv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_MultiTexCoord4iv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_MultiTexCoord4iv(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_TexCoord1sv(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_TexCoord1sv(GLbyte * pc);
 extern _X_HIDDEN int __glXDisp_CreateGLXPixmapWithConfigSGIX(struct
@@ -562,26 +536,22 @@ extern _X_HIDDEN void __glXDisp_DepthFunc(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_DepthFunc(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_PixelMapusv(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_PixelMapusv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_PointParameterivNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_PointParameterivNV(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_BlendFunc(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_BlendFunc(GLbyte * pc);
 extern _X_HIDDEN int __glXDisp_WaitGL(struct __GLXclientStateRec *, GLbyte *);
 extern _X_HIDDEN int __glXDispSwap_WaitGL(struct __GLXclientStateRec *,
                                           GLbyte *);
-extern _X_HIDDEN void __glXDisp_MultiTexCoord3dvARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_MultiTexCoord3dvARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_ProgramNamedParameter4dvNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_ProgramNamedParameter4dvNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_CompressedTexImage2D(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_CompressedTexImage2D(GLbyte * pc);
 extern _X_HIDDEN int __glXDisp_Flush(struct __GLXclientStateRec *, GLbyte *);
 extern _X_HIDDEN int __glXDispSwap_Flush(struct __GLXclientStateRec *,
                                          GLbyte *);
 extern _X_HIDDEN void __glXDisp_Color4uiv(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_Color4uiv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_MultiTexCoord1sv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_MultiTexCoord1sv(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_RasterPos3sv(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_RasterPos3sv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_BindFramebufferEXT(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_BindFramebufferEXT(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_PushAttrib(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_PushAttrib(GLbyte * pc);
 extern _X_HIDDEN int __glXDisp_DestroyPbuffer(struct __GLXclientStateRec *,
@@ -590,10 +560,6 @@ extern _X_HIDDEN int __glXDispSwap_DestroyPbuffer(struct __GLXclientStateRec *,
                                                   GLbyte *);
 extern _X_HIDDEN void __glXDisp_TexParameteriv(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_TexParameteriv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_WindowPos3fvMESA(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_WindowPos3fvMESA(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_VertexAttrib1svNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_VertexAttrib1svNV(GLbyte * pc);
 extern _X_HIDDEN int __glXDisp_QueryExtensionsString(struct __GLXclientStateRec
                                                      *, GLbyte *);
 extern _X_HIDDEN int __glXDispSwap_QueryExtensionsString(struct
@@ -619,6 +585,8 @@ extern _X_HIDDEN int __glXDispSwap_CreateContext(struct __GLXclientStateRec *,
                                                  GLbyte *);
 extern _X_HIDDEN void __glXDisp_CopyColorTable(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_CopyColorTable(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_PointParameterfv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_PointParameterfv(GLbyte * pc);
 extern _X_HIDDEN int __glXDisp_GetHistogramParameterfv(struct
                                                        __GLXclientStateRec *,
                                                        GLbyte *);
@@ -643,15 +611,10 @@ extern _X_HIDDEN int __glXDispSwap_CreateGLXPixmap(struct __GLXclientStateRec *,
                                                    GLbyte *);
 extern _X_HIDDEN void __glXDisp_TexEnvf(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_TexEnvf(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_GetProgramStringARB(struct __GLXclientStateRec *,
-                                                   GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetProgramStringARB(struct
-                                                       __GLXclientStateRec *,
-                                                       GLbyte *);
-extern _X_HIDDEN void __glXDisp_MultiTexCoord3ivARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_MultiTexCoord3ivARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_VertexAttrib1dvARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_VertexAttrib1dvARB(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_GenProgramsARB(struct __GLXclientStateRec *,
+                                              GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GenProgramsARB(struct __GLXclientStateRec *,
+                                                  GLbyte *);
 extern _X_HIDDEN int __glXDisp_DeleteTextures(struct __GLXclientStateRec *,
                                               GLbyte *);
 extern _X_HIDDEN int __glXDispSwap_DeleteTextures(struct __GLXclientStateRec *,
@@ -671,15 +634,10 @@ extern _X_HIDDEN int __glXDisp_QueryVersion(struct __GLXclientStateRec *,
                                             GLbyte *);
 extern _X_HIDDEN int __glXDispSwap_QueryVersion(struct __GLXclientStateRec *,
                                                 GLbyte *);
-extern _X_HIDDEN int __glXDisp_GetVertexAttribfvARB(struct __GLXclientStateRec
-                                                    *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetVertexAttribfvARB(struct
-                                                        __GLXclientStateRec *,
-                                                        GLbyte *);
-extern _X_HIDDEN void __glXDisp_SecondaryColor3ivEXT(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_SecondaryColor3ivEXT(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_TexCoord4iv(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_TexCoord4iv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_FramebufferTexture3D(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_FramebufferTexture3D(GLbyte * pc);
 extern _X_HIDDEN int __glXDisp_GetDrawableAttributesSGIX(struct
                                                          __GLXclientStateRec *,
                                                          GLbyte *);
@@ -688,69 +646,60 @@ extern _X_HIDDEN int __glXDispSwap_GetDrawableAttributesSGIX(struct
                                                              *, GLbyte *);
 extern _X_HIDDEN void __glXDisp_ColorTableParameteriv(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_ColorTableParameteriv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_VertexAttrib4ubvARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_VertexAttrib4ubvARB(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_CopyTexImage2D(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_CopyTexImage2D(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_MultiTexCoord2dv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_MultiTexCoord2dv(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_Lightfv(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_Lightfv(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_GetFramebufferAttachmentParameteriv(struct
+                                                                   __GLXclientStateRec
+                                                                   *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetFramebufferAttachmentParameteriv(struct
+                                                                       __GLXclientStateRec
+                                                                       *,
+                                                                       GLbyte
+                                                                       *);
 extern _X_HIDDEN void __glXDisp_ClearDepth(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_ClearDepth(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_ColorSubTable(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_ColorSubTable(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_Color4fv(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_Color4fv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_MultiTexCoord4ivARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_MultiTexCoord4ivARB(GLbyte * pc);
 extern _X_HIDDEN int __glXDisp_CreatePixmap(struct __GLXclientStateRec *,
                                             GLbyte *);
 extern _X_HIDDEN int __glXDispSwap_CreatePixmap(struct __GLXclientStateRec *,
                                                 GLbyte *);
 extern _X_HIDDEN void __glXDisp_Lightiv(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_Lightiv(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_GetQueryObjectuivARB(struct __GLXclientStateRec
-                                                    *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetQueryObjectuivARB(struct
-                                                        __GLXclientStateRec *,
-                                                        GLbyte *);
 extern _X_HIDDEN int __glXDisp_GetTexParameteriv(struct __GLXclientStateRec *,
                                                  GLbyte *);
 extern _X_HIDDEN int __glXDispSwap_GetTexParameteriv(struct __GLXclientStateRec
                                                      *, GLbyte *);
-extern _X_HIDDEN int __glXDisp_GenRenderbuffersEXT(struct __GLXclientStateRec *,
-                                                   GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GenRenderbuffersEXT(struct
-                                                       __GLXclientStateRec *,
-                                                       GLbyte *);
-extern _X_HIDDEN void __glXDisp_VertexAttrib2dvARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_VertexAttrib2dvARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_VertexAttribs2svNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_VertexAttribs2svNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_VertexAttrib3sv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_VertexAttrib3sv(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_IsQuery(struct __GLXclientStateRec *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_IsQuery(struct __GLXclientStateRec *,
+                                           GLbyte *);
 extern _X_HIDDEN void __glXDisp_Rectdv(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_Rectdv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_VertexAttrib4NivARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_VertexAttrib4NivARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_VertexAttrib4dv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_VertexAttrib4dv(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_Materialiv(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_Materialiv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_SampleMaskSGIS(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_SampleMaskSGIS(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_SecondaryColor3fvEXT(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_SecondaryColor3fvEXT(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_PolygonMode(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_PolygonMode(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_CompressedTexSubImage1DARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_CompressedTexSubImage1DARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_VertexAttrib2dvNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_VertexAttrib2dvNV(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_GetVertexAttribivNV(struct __GLXclientStateRec *,
+extern _X_HIDDEN void __glXDisp_SecondaryColor3iv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_SecondaryColor3iv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_VertexAttrib4Niv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_VertexAttrib4Niv(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_GetProgramStringARB(struct __GLXclientStateRec *,
                                                    GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetVertexAttribivNV(struct
+extern _X_HIDDEN int __glXDispSwap_GetProgramStringARB(struct
                                                        __GLXclientStateRec *,
                                                        GLbyte *);
-extern _X_HIDDEN int __glXDisp_IsQueryARB(struct __GLXclientStateRec *,
-                                          GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_IsQueryARB(struct __GLXclientStateRec *,
-                                              GLbyte *);
 extern _X_HIDDEN void __glXDisp_TexGeni(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_TexGeni(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_TexGenf(GLbyte * pc);
@@ -763,23 +712,16 @@ extern _X_HIDDEN int __glXDispSwap_GetPolygonStipple(struct __GLXclientStateRec
                                                      *, GLbyte *);
 extern _X_HIDDEN void __glXDisp_VertexAttrib2svNV(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_VertexAttrib2svNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_VertexAttrib4NuivARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_VertexAttrib4NuivARB(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_GetVertexAttribdvNV(struct __GLXclientStateRec *,
-                                                   GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetVertexAttribdvNV(struct
-                                                       __GLXclientStateRec *,
-                                                       GLbyte *);
+extern _X_HIDDEN void __glXDisp_VertexAttribs1fvNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_VertexAttribs1fvNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_VertexAttrib2dvNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_VertexAttrib2dvNV(GLbyte * pc);
 extern _X_HIDDEN int __glXDisp_DestroyWindow(struct __GLXclientStateRec *,
                                              GLbyte *);
 extern _X_HIDDEN int __glXDispSwap_DestroyWindow(struct __GLXclientStateRec *,
                                                  GLbyte *);
 extern _X_HIDDEN void __glXDisp_Color4sv(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_Color4sv(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_IsProgramNV(struct __GLXclientStateRec *,
-                                           GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_IsProgramNV(struct __GLXclientStateRec *,
-                                               GLbyte *);
 extern _X_HIDDEN void __glXDisp_PixelZoom(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_PixelZoom(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_ColorTableParameterfv(GLbyte * pc);
@@ -796,23 +738,23 @@ extern _X_HIDDEN int __glXDisp_IsTextureEXT(struct __GLXclientStateRec *,
                                             GLbyte *);
 extern _X_HIDDEN int __glXDispSwap_IsTextureEXT(struct __GLXclientStateRec *,
                                                 GLbyte *);
+extern _X_HIDDEN void __glXDisp_VertexAttrib4fvNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_VertexAttrib4fvNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_BeginQuery(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_BeginQuery(GLbyte * pc);
 extern _X_HIDDEN int __glXDisp_SetClientInfo2ARB(struct __GLXclientStateRec *,
                                                  GLbyte *);
 extern _X_HIDDEN int __glXDispSwap_SetClientInfo2ARB(struct __GLXclientStateRec
                                                      *, GLbyte *);
-extern _X_HIDDEN int __glXDisp_DeleteQueriesARB(struct __GLXclientStateRec *,
-                                                GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_DeleteQueriesARB(struct __GLXclientStateRec
-                                                    *, GLbyte *);
 extern _X_HIDDEN int __glXDisp_GetMapdv(struct __GLXclientStateRec *, GLbyte *);
 extern _X_HIDDEN int __glXDispSwap_GetMapdv(struct __GLXclientStateRec *,
                                             GLbyte *);
+extern _X_HIDDEN void __glXDisp_MultiTexCoord3iv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_MultiTexCoord3iv(GLbyte * pc);
 extern _X_HIDDEN int __glXDisp_DestroyGLXPixmap(struct __GLXclientStateRec *,
                                                 GLbyte *);
 extern _X_HIDDEN int __glXDispSwap_DestroyGLXPixmap(struct __GLXclientStateRec
                                                     *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_SamplePatternSGIS(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_SamplePatternSGIS(GLbyte * pc);
 extern _X_HIDDEN int __glXDisp_PixelStoref(struct __GLXclientStateRec *,
                                            GLbyte *);
 extern _X_HIDDEN int __glXDispSwap_PixelStoref(struct __GLXclientStateRec *,
@@ -823,8 +765,6 @@ extern _X_HIDDEN int __glXDisp_PixelStorei(struct __GLXclientStateRec *,
                                            GLbyte *);
 extern _X_HIDDEN int __glXDispSwap_PixelStorei(struct __GLXclientStateRec *,
                                                GLbyte *);
-extern _X_HIDDEN void __glXDisp_VertexAttrib4usvARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_VertexAttrib4usvARB(GLbyte * pc);
 extern _X_HIDDEN int __glXDisp_DestroyGLXPbufferSGIX(struct __GLXclientStateRec
                                                      *, GLbyte *);
 extern _X_HIDDEN int __glXDispSwap_DestroyGLXPbufferSGIX(struct
@@ -832,21 +772,12 @@ extern _X_HIDDEN int __glXDispSwap_DestroyGLXPbufferSGIX(struct
                                                          GLbyte *);
 extern _X_HIDDEN void __glXDisp_EvalCoord2dv(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_EvalCoord2dv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_VertexAttrib3svARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_VertexAttrib3svARB(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_ColorMaterial(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_ColorMaterial(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_CompressedTexSubImage3DARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_CompressedTexSubImage3DARB(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_IsFramebufferEXT(struct __GLXclientStateRec *,
-                                                GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_IsFramebufferEXT(struct __GLXclientStateRec
-                                                    *, GLbyte *);
-extern _X_HIDDEN int __glXDisp_GetVertexAttribdvARB(struct __GLXclientStateRec
-                                                    *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetVertexAttribdvARB(struct
-                                                        __GLXclientStateRec *,
-                                                        GLbyte *);
+extern _X_HIDDEN void __glXDisp_VertexAttribs1svNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_VertexAttribs1svNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_VertexAttrib1fvNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_VertexAttrib1fvNV(GLbyte * pc);
 extern _X_HIDDEN int __glXDisp_GetSeparableFilter(struct __GLXclientStateRec *,
                                                   GLbyte *);
 extern _X_HIDDEN int __glXDispSwap_GetSeparableFilter(struct __GLXclientStateRec
@@ -856,8 +787,6 @@ extern _X_HIDDEN int __glXDisp_GetSeparableFilterEXT(struct __GLXclientStateRec
 extern _X_HIDDEN int __glXDispSwap_GetSeparableFilterEXT(struct
                                                          __GLXclientStateRec *,
                                                          GLbyte *);
-extern _X_HIDDEN void __glXDisp_RequestResidentProgramsNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_RequestResidentProgramsNV(GLbyte * pc);
 extern _X_HIDDEN int __glXDisp_FeedbackBuffer(struct __GLXclientStateRec *,
                                               GLbyte *);
 extern _X_HIDDEN int __glXDispSwap_FeedbackBuffer(struct __GLXclientStateRec *,
@@ -872,12 +801,8 @@ extern _X_HIDDEN int __glXDisp_RenderLarge(struct __GLXclientStateRec *,
                                            GLbyte *);
 extern _X_HIDDEN int __glXDispSwap_RenderLarge(struct __GLXclientStateRec *,
                                                GLbyte *);
-extern _X_HIDDEN void __glXDisp_VertexAttrib4dvARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_VertexAttrib4dvARB(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_PolygonOffset(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_PolygonOffset(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_ExecuteProgramNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_ExecuteProgramNV(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_Normal3dv(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_Normal3dv(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_Lightf(GLbyte * pc);
@@ -890,23 +815,22 @@ extern _X_HIDDEN int __glXDispSwap_GetPixelMapusv(struct __GLXclientStateRec *,
                                                   GLbyte *);
 extern _X_HIDDEN void __glXDisp_Lighti(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_Lighti(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_GetFramebufferAttachmentParameterivEXT(struct
-                                                                      __GLXclientStateRec
-                                                                      *,
-                                                                      GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetFramebufferAttachmentParameterivEXT(struct
-                                                                          __GLXclientStateRec
-                                                                          *,
-                                                                          GLbyte
-                                                                          *);
+extern _X_HIDDEN int __glXDisp_GenFramebuffers(struct __GLXclientStateRec *,
+                                               GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GenFramebuffers(struct __GLXclientStateRec *,
+                                                   GLbyte *);
+extern _X_HIDDEN int __glXDisp_IsFramebuffer(struct __GLXclientStateRec *,
+                                             GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_IsFramebuffer(struct __GLXclientStateRec *,
+                                                 GLbyte *);
 extern _X_HIDDEN int __glXDisp_ChangeDrawableAttributesSGIX(struct
                                                             __GLXclientStateRec
                                                             *, GLbyte *);
 extern _X_HIDDEN int __glXDispSwap_ChangeDrawableAttributesSGIX(struct
                                                                 __GLXclientStateRec
                                                                 *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_MultiTexCoord4dvARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_MultiTexCoord4dvARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_BlendEquationSeparate(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_BlendEquationSeparate(GLbyte * pc);
 extern _X_HIDDEN int __glXDisp_CreatePbuffer(struct __GLXclientStateRec *,
                                              GLbyte *);
 extern _X_HIDDEN int __glXDispSwap_CreatePbuffer(struct __GLXclientStateRec *,
@@ -919,12 +843,12 @@ extern _X_HIDDEN void __glXDisp_MultMatrixd(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_MultMatrixd(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_MultMatrixf(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_MultMatrixf(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_CompressedTexImage1D(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_CompressedTexImage1D(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_MultiTexCoord4fvARB(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_MultiTexCoord4fvARB(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_RasterPos4sv(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_RasterPos4sv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_VertexAttrib4NsvARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_VertexAttrib4NsvARB(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_VertexAttrib3fvARB(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_VertexAttrib3fvARB(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_ClearColor(GLbyte * pc);
@@ -932,12 +856,20 @@ extern _X_HIDDEN void __glXDispSwap_ClearColor(GLbyte * pc);
 extern _X_HIDDEN int __glXDisp_IsDirect(struct __GLXclientStateRec *, GLbyte *);
 extern _X_HIDDEN int __glXDispSwap_IsDirect(struct __GLXclientStateRec *,
                                             GLbyte *);
-extern _X_HIDDEN void __glXDisp_DeleteFramebuffersEXT(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_DeleteFramebuffersEXT(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_VertexAttrib1svNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_VertexAttrib1svNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_SecondaryColor3ubv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_SecondaryColor3ubv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_PointParameteri(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_PointParameteri(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_PointParameterf(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_PointParameterf(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_TexEnviv(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_TexEnviv(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_TexSubImage3D(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_TexSubImage3D(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_VertexAttrib4iv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_VertexAttrib4iv(GLbyte * pc);
 extern _X_HIDDEN int __glXDisp_SwapIntervalSGI(struct __GLXclientStateRec *,
                                                GLbyte *);
 extern _X_HIDDEN int __glXDispSwap_SwapIntervalSGI(struct __GLXclientStateRec *,
@@ -954,6 +886,8 @@ extern _X_HIDDEN int __glXDisp_GetColorTableParameterfvSGI(struct
 extern _X_HIDDEN int __glXDispSwap_GetColorTableParameterfvSGI(struct
                                                                __GLXclientStateRec
                                                                *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_FramebufferTexture2D(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_FramebufferTexture2D(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_Bitmap(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_Bitmap(GLbyte * pc);
 extern _X_HIDDEN int __glXDisp_GetTexLevelParameterfv(struct __GLXclientStateRec
@@ -961,32 +895,25 @@ extern _X_HIDDEN int __glXDisp_GetTexLevelParameterfv(struct __GLXclientStateRec
 extern _X_HIDDEN int __glXDispSwap_GetTexLevelParameterfv(struct
                                                           __GLXclientStateRec *,
                                                           GLbyte *);
-extern _X_HIDDEN int __glXDisp_GenFramebuffersEXT(struct __GLXclientStateRec *,
-                                                  GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GenFramebuffersEXT(struct __GLXclientStateRec
+extern _X_HIDDEN int __glXDisp_CheckFramebufferStatus(struct __GLXclientStateRec
                                                       *, GLbyte *);
-extern _X_HIDDEN int __glXDisp_GetProgramParameterdvNV(struct
-                                                       __GLXclientStateRec *,
-                                                       GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetProgramParameterdvNV(struct
-                                                           __GLXclientStateRec
-                                                           *, GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_CheckFramebufferStatus(struct
+                                                          __GLXclientStateRec *,
+                                                          GLbyte *);
 extern _X_HIDDEN void __glXDisp_Vertex2sv(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_Vertex2sv(GLbyte * pc);
 extern _X_HIDDEN int __glXDisp_GetIntegerv(struct __GLXclientStateRec *,
                                            GLbyte *);
 extern _X_HIDDEN int __glXDispSwap_GetIntegerv(struct __GLXclientStateRec *,
                                                GLbyte *);
+extern _X_HIDDEN void __glXDisp_BindProgramARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_BindProgramARB(GLbyte * pc);
 extern _X_HIDDEN int __glXDisp_GetProgramEnvParameterfvARB(struct
                                                            __GLXclientStateRec
                                                            *, GLbyte *);
 extern _X_HIDDEN int __glXDispSwap_GetProgramEnvParameterfvARB(struct
                                                                __GLXclientStateRec
                                                                *, GLbyte *);
-extern _X_HIDDEN int __glXDisp_GetTrackMatrixivNV(struct __GLXclientStateRec *,
-                                                  GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetTrackMatrixivNV(struct __GLXclientStateRec
-                                                      *, GLbyte *);
 extern _X_HIDDEN void __glXDisp_VertexAttrib3svNV(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_VertexAttrib3svNV(GLbyte * pc);
 extern _X_HIDDEN int __glXDisp_GetTexEnviv(struct __GLXclientStateRec *,
@@ -1000,20 +927,16 @@ extern _X_HIDDEN int __glXDispSwap_VendorPrivateWithReply(struct
                                                           GLbyte *);
 extern _X_HIDDEN void __glXDisp_SeparableFilter2D(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_SeparableFilter2D(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_GetQueryObjectuiv(struct __GLXclientStateRec *,
+                                                 GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetQueryObjectuiv(struct __GLXclientStateRec
+                                                     *, GLbyte *);
 extern _X_HIDDEN void __glXDisp_Map1d(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_Map1d(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_Map1f(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_Map1f(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_CompressedTexImage2DARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_CompressedTexImage2DARB(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_TexImage2D(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_TexImage2D(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_ProgramParameters4fvNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_ProgramParameters4fvNV(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_GetProgramivNV(struct __GLXclientStateRec *,
-                                              GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetProgramivNV(struct __GLXclientStateRec *,
-                                                  GLbyte *);
 extern _X_HIDDEN int __glXDisp_ChangeDrawableAttributes(struct
                                                         __GLXclientStateRec *,
                                                         GLbyte *);
@@ -1039,12 +962,12 @@ extern _X_HIDDEN void __glXDisp_RasterPos2dv(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_RasterPos2dv(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_Fogiv(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_Fogiv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_EndQuery(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_EndQuery(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_TexCoord1dv(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_TexCoord1dv(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_PixelTransferi(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_PixelTransferi(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_SecondaryColor3ubvEXT(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_SecondaryColor3ubvEXT(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_VertexAttrib3fvNV(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_VertexAttrib3fvNV(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_Clear(GLbyte * pc);
@@ -1053,6 +976,8 @@ extern _X_HIDDEN void __glXDisp_ReadBuffer(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_ReadBuffer(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_ConvolutionParameteri(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_ConvolutionParameteri(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_VertexAttrib4sv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_VertexAttrib4sv(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_LightModeli(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_LightModeli(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_ListBase(GLbyte * pc);
@@ -1077,18 +1002,20 @@ extern _X_HIDDEN int __glXDispSwap_ReleaseTexImageEXT(struct __GLXclientStateRec
                                                       *, GLbyte *);
 extern _X_HIDDEN void __glXDisp_CallList(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_CallList(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_VertexAttribs2fvNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_VertexAttribs2fvNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_GenerateMipmap(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_GenerateMipmap(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_Rectiv(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_Rectiv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_SecondaryColor3dvEXT(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_SecondaryColor3dvEXT(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_MultiTexCoord1iv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_MultiTexCoord1iv(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_Vertex2fv(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_Vertex2fv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_BindRenderbufferEXT(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_BindRenderbufferEXT(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_Vertex3sv(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_Vertex3sv(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_GetQueryObjectiv(struct __GLXclientStateRec *,
+                                                GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetQueryObjectiv(struct __GLXclientStateRec
+                                                    *, GLbyte *);
 extern _X_HIDDEN int __glXDisp_SetClientInfoARB(struct __GLXclientStateRec *,
                                                 GLbyte *);
 extern _X_HIDDEN int __glXDispSwap_SetClientInfoARB(struct __GLXclientStateRec
@@ -1099,26 +1026,14 @@ extern _X_HIDDEN int __glXDispSwap_BindTexImageEXT(struct __GLXclientStateRec *,
                                                    GLbyte *);
 extern _X_HIDDEN void __glXDisp_ProgramLocalParameter4fvARB(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_ProgramLocalParameter4fvARB(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_DeleteProgramsNV(struct __GLXclientStateRec *,
-                                                GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_DeleteProgramsNV(struct __GLXclientStateRec
-                                                    *, GLbyte *);
 extern _X_HIDDEN void __glXDisp_EvalMesh1(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_EvalMesh1(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_VertexAttribs1fvNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_VertexAttribs1fvNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_MultiTexCoord1dvARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_MultiTexCoord1dvARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_CompressedTexSubImage3D(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_CompressedTexSubImage3D(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_Vertex2iv(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_Vertex2iv(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_GetProgramStringNV(struct __GLXclientStateRec *,
-                                                  GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetProgramStringNV(struct __GLXclientStateRec
-                                                      *, GLbyte *);
 extern _X_HIDDEN void __glXDisp_LineWidth(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_LineWidth(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_VertexAttrib2fvARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_VertexAttrib2fvARB(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_TexGendv(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_TexGendv(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_ResetMinmax(GLbyte * pc);
@@ -1135,12 +1050,16 @@ extern _X_HIDDEN int __glXDisp_GetConvolutionParameterfvEXT(struct
 extern _X_HIDDEN int __glXDispSwap_GetConvolutionParameterfvEXT(struct
                                                                 __GLXclientStateRec
                                                                 *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_VertexAttribs4dvNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_VertexAttribs4dvNV(GLbyte * pc);
 extern _X_HIDDEN int __glXDisp_GetMaterialfv(struct __GLXclientStateRec *,
                                              GLbyte *);
 extern _X_HIDDEN int __glXDispSwap_GetMaterialfv(struct __GLXclientStateRec *,
                                                  GLbyte *);
+extern _X_HIDDEN void __glXDisp_WindowPos3fv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_WindowPos3fv(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_DeleteProgramsARB(struct __GLXclientStateRec *,
+                                                 GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_DeleteProgramsARB(struct __GLXclientStateRec
+                                                     *, GLbyte *);
 extern _X_HIDDEN int __glXDisp_UseXFont(struct __GLXclientStateRec *, GLbyte *);
 extern _X_HIDDEN int __glXDispSwap_UseXFont(struct __GLXclientStateRec *,
                                             GLbyte *);
@@ -1152,14 +1071,14 @@ extern _X_HIDDEN void __glXDisp_TexCoord3fv(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_TexCoord3fv(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_FogCoordfvEXT(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_FogCoordfvEXT(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_MultiTexCoord1ivARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_MultiTexCoord1ivARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_MultiTexCoord2ivARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_MultiTexCoord2ivARB(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_DrawArrays(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_DrawArrays(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_SampleCoverage(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_SampleCoverage(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_Color3iv(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_Color3iv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_VertexAttrib4ubv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_VertexAttrib4ubv(GLbyte * pc);
 extern _X_HIDDEN int __glXDisp_GetProgramLocalParameterdvARB(struct
                                                              __GLXclientStateRec
                                                              *, GLbyte *);
@@ -1178,22 +1097,24 @@ extern _X_HIDDEN int __glXDisp_GetHistogramParameterivEXT(struct
 extern _X_HIDDEN int __glXDispSwap_GetHistogramParameterivEXT(struct
                                                               __GLXclientStateRec
                                                               *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_PointParameteriv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_PointParameteriv(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_Rotatef(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_Rotatef(GLbyte * pc);
 extern _X_HIDDEN int __glXDisp_GetProgramivARB(struct __GLXclientStateRec *,
                                                GLbyte *);
 extern _X_HIDDEN int __glXDispSwap_GetProgramivARB(struct __GLXclientStateRec *,
                                                    GLbyte *);
-extern _X_HIDDEN void __glXDisp_BlendFuncSeparateEXT(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_BlendFuncSeparateEXT(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_ProgramParameters4dvNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_ProgramParameters4dvNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_BindRenderbuffer(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_BindRenderbuffer(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_EvalPoint2(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_EvalPoint2(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_EvalPoint1(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_EvalPoint1(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_PopMatrix(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_PopMatrix(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_DeleteFramebuffers(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_DeleteFramebuffers(GLbyte * pc);
 extern _X_HIDDEN int __glXDisp_MakeCurrentReadSGI(struct __GLXclientStateRec *,
                                                   GLbyte *);
 extern _X_HIDDEN int __glXDispSwap_MakeCurrentReadSGI(struct __GLXclientStateRec
@@ -1206,12 +1127,24 @@ extern _X_HIDDEN int __glXDisp_MakeCurrent(struct __GLXclientStateRec *,
                                            GLbyte *);
 extern _X_HIDDEN int __glXDispSwap_MakeCurrent(struct __GLXclientStateRec *,
                                                GLbyte *);
+extern _X_HIDDEN void __glXDisp_FramebufferRenderbuffer(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_FramebufferRenderbuffer(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_IsProgramARB(struct __GLXclientStateRec *,
+                                            GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_IsProgramARB(struct __GLXclientStateRec *,
+                                                GLbyte *);
+extern _X_HIDDEN void __glXDisp_VertexAttrib4uiv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_VertexAttrib4uiv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_VertexAttrib4Nsv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_VertexAttrib4Nsv(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_Map2d(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_Map2d(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_Map2f(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_Map2f(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_ProgramStringARB(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_ProgramStringARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_VertexAttrib4bv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_VertexAttrib4bv(GLbyte * pc);
 extern _X_HIDDEN int __glXDisp_GetConvolutionFilter(struct __GLXclientStateRec
                                                     *, GLbyte *);
 extern _X_HIDDEN int __glXDispSwap_GetConvolutionFilter(struct
@@ -1223,12 +1156,8 @@ extern _X_HIDDEN int __glXDisp_GetConvolutionFilterEXT(struct
 extern _X_HIDDEN int __glXDispSwap_GetConvolutionFilterEXT(struct
                                                            __GLXclientStateRec
                                                            *, GLbyte *);
-extern _X_HIDDEN int __glXDisp_GetCompressedTexImageARB(struct
-                                                        __GLXclientStateRec *,
-                                                        GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetCompressedTexImageARB(struct
-                                                            __GLXclientStateRec
-                                                            *, GLbyte *);
+extern _X_HIDDEN void __glXDisp_VertexAttribs4dvNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_VertexAttribs4dvNV(GLbyte * pc);
 extern _X_HIDDEN int __glXDisp_GetTexGenfv(struct __GLXclientStateRec *,
                                            GLbyte *);
 extern _X_HIDDEN int __glXDispSwap_GetTexGenfv(struct __GLXclientStateRec *,
@@ -1249,16 +1178,12 @@ extern _X_HIDDEN void __glXDisp_Materiali(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_Materiali(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_Indexsv(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_Indexsv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_MultiTexCoord4svARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_MultiTexCoord4svARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_VertexAttrib1fvARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_VertexAttrib1fvARB(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_LightModelfv(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_LightModelfv(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_TexCoord2dv(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_TexCoord2dv(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_GenQueriesARB(struct __GLXclientStateRec *,
-                                             GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GenQueriesARB(struct __GLXclientStateRec *,
-                                                 GLbyte *);
 extern _X_HIDDEN void __glXDisp_EvalCoord1dv(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_EvalCoord1dv(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_Translated(GLbyte * pc);
@@ -1267,8 +1192,6 @@ extern _X_HIDDEN void __glXDisp_Translatef(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_Translatef(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_StencilMask(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_StencilMask(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_ClampColorARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_ClampColorARB(GLbyte * pc);
 extern _X_HIDDEN int __glXDisp_CreateWindow(struct __GLXclientStateRec *,
                                             GLbyte *);
 extern _X_HIDDEN int __glXDispSwap_CreateWindow(struct __GLXclientStateRec *,
@@ -1284,8 +1207,6 @@ extern _X_HIDDEN int __glXDisp_RenderMode(struct __GLXclientStateRec *,
                                           GLbyte *);
 extern _X_HIDDEN int __glXDispSwap_RenderMode(struct __GLXclientStateRec *,
                                               GLbyte *);
-extern _X_HIDDEN void __glXDisp_DrawBuffersARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_DrawBuffersARB(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_LoadName(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_LoadName(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_CopyTexSubImage1D(GLbyte * pc);
@@ -1297,8 +1218,8 @@ extern _X_HIDDEN int __glXDisp_QueryContextInfoEXT(struct __GLXclientStateRec *,
 extern _X_HIDDEN int __glXDispSwap_QueryContextInfoEXT(struct
                                                        __GLXclientStateRec *,
                                                        GLbyte *);
-extern _X_HIDDEN void __glXDisp_VertexAttribs3svNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_VertexAttribs3svNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_VertexAttribs2fvNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_VertexAttribs2fvNV(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_StencilFunc(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_StencilFunc(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_CopyPixels(GLbyte * pc);
@@ -1309,12 +1230,14 @@ extern _X_HIDDEN void __glXDisp_CopyConvolutionFilter2D(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_CopyConvolutionFilter2D(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_TexParameterfv(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_TexParameterfv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_VertexAttrib4uivARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_VertexAttrib4uivARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_VertexAttrib4Nubv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_VertexAttrib4Nubv(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_ClipPlane(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_ClipPlane(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_TrackMatrixNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_TrackMatrixNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_SecondaryColor3usv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_SecondaryColor3usv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_MultiTexCoord3dv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_MultiTexCoord3dv(GLbyte * pc);
 extern _X_HIDDEN int __glXDisp_GetPixelMapuiv(struct __GLXclientStateRec *,
                                               GLbyte *);
 extern _X_HIDDEN int __glXDispSwap_GetPixelMapuiv(struct __GLXclientStateRec *,
@@ -1325,22 +1248,20 @@ extern _X_HIDDEN int __glXDisp_QueryContext(struct __GLXclientStateRec *,
                                             GLbyte *);
 extern _X_HIDDEN int __glXDispSwap_QueryContext(struct __GLXclientStateRec *,
                                                 GLbyte *);
-extern _X_HIDDEN void __glXDisp_SecondaryColor3svEXT(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_SecondaryColor3svEXT(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_MultiTexCoord3fvARB(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_MultiTexCoord3fvARB(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_BlitFramebuffer(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_BlitFramebuffer(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_IndexMask(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_IndexMask(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_BindProgramNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_BindProgramNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_VertexAttrib4svARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_VertexAttrib4svARB(GLbyte * pc);
 extern _X_HIDDEN int __glXDisp_GetFloatv(struct __GLXclientStateRec *,
                                          GLbyte *);
 extern _X_HIDDEN int __glXDispSwap_GetFloatv(struct __GLXclientStateRec *,
                                              GLbyte *);
 extern _X_HIDDEN void __glXDisp_TexCoord3sv(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_TexCoord3sv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_FogCoorddv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_FogCoorddv(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_PopAttrib(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_PopAttrib(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_Fogfv(GLbyte * pc);
@@ -1351,8 +1272,10 @@ extern _X_HIDDEN void __glXDisp_Normal3sv(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_Normal3sv(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_Minmax(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_Minmax(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_FogCoorddvEXT(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_FogCoorddvEXT(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_DeleteQueries(struct __GLXclientStateRec *,
+                                             GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_DeleteQueries(struct __GLXclientStateRec *,
+                                                 GLbyte *);
 extern _X_HIDDEN int __glXDisp_GetBooleanv(struct __GLXclientStateRec *,
                                            GLbyte *);
 extern _X_HIDDEN int __glXDispSwap_GetBooleanv(struct __GLXclientStateRec *,
@@ -1361,29 +1284,12 @@ extern _X_HIDDEN void __glXDisp_Hint(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_Hint(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_Color4dv(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_Color4dv(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_VertexAttrib2svARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_VertexAttrib2svARB(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_AreProgramsResidentNV(struct __GLXclientStateRec
-                                                     *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_AreProgramsResidentNV(struct
-                                                         __GLXclientStateRec *,
-                                                         GLbyte *);
 extern _X_HIDDEN void __glXDisp_CopyColorSubTable(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_CopyColorSubTable(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_DeleteRenderbuffersEXT(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_DeleteRenderbuffersEXT(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_VertexAttrib4NubvARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_VertexAttrib4NubvARB(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_VertexAttrib3dvNV(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_VertexAttrib3dvNV(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_Vertex4iv(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_Vertex4iv(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_GetProgramEnvParameterdvARB(struct
-                                                           __GLXclientStateRec
-                                                           *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetProgramEnvParameterdvARB(struct
-                                                               __GLXclientStateRec
-                                                               *, GLbyte *);
 extern _X_HIDDEN void __glXDisp_TexCoord4dv(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_TexCoord4dv(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_Begin(GLbyte * pc);
@@ -1408,12 +1314,6 @@ extern _X_HIDDEN void __glXDisp_Disable(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_Disable(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_MultiTexCoord2fvARB(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_MultiTexCoord2fvARB(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_GetRenderbufferParameterivEXT(struct
-                                                             __GLXclientStateRec
-                                                             *, GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GetRenderbufferParameterivEXT(struct
-                                                                 __GLXclientStateRec
-                                                                 *, GLbyte *);
 extern _X_HIDDEN int __glXDisp_SelectBuffer(struct __GLXclientStateRec *,
                                             GLbyte *);
 extern _X_HIDDEN int __glXDispSwap_SelectBuffer(struct __GLXclientStateRec *,
@@ -1424,8 +1324,18 @@ extern _X_HIDDEN void __glXDisp_RasterPos4iv(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_RasterPos4iv(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_Enable(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_Enable(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_GetRenderbufferParameteriv(struct
+                                                          __GLXclientStateRec *,
+                                                          GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GetRenderbufferParameteriv(struct
+                                                              __GLXclientStateRec
+                                                              *, GLbyte *);
 extern _X_HIDDEN void __glXDisp_VertexAttribs4svNV(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_VertexAttribs4svNV(GLbyte * pc);
+extern _X_HIDDEN int __glXDisp_GenRenderbuffers(struct __GLXclientStateRec *,
+                                                GLbyte *);
+extern _X_HIDDEN int __glXDispSwap_GenRenderbuffers(struct __GLXclientStateRec
+                                                    *, GLbyte *);
 extern _X_HIDDEN int __glXDisp_GetMinmaxParameterfv(struct __GLXclientStateRec
                                                     *, GLbyte *);
 extern _X_HIDDEN int __glXDispSwap_GetMinmaxParameterfv(struct
@@ -1437,21 +1347,13 @@ extern _X_HIDDEN int __glXDisp_GetMinmaxParameterfvEXT(struct
 extern _X_HIDDEN int __glXDispSwap_GetMinmaxParameterfvEXT(struct
                                                            __GLXclientStateRec
                                                            *, GLbyte *);
-extern _X_HIDDEN void __glXDisp_VertexAttrib1fvARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_VertexAttrib1fvARB(GLbyte * pc);
-extern _X_HIDDEN void __glXDisp_VertexAttribs1svNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_VertexAttribs1svNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_VertexAttrib4Nuiv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_VertexAttrib4Nuiv(GLbyte * pc);
 extern _X_HIDDEN void __glXDisp_Vertex3fv(GLbyte * pc);
 extern _X_HIDDEN void __glXDispSwap_Vertex3fv(GLbyte * pc);
-extern _X_HIDDEN int __glXDisp_IsRenderbufferEXT(struct __GLXclientStateRec *,
-                                                 GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_IsRenderbufferEXT(struct __GLXclientStateRec
-                                                     *, GLbyte *);
-extern _X_HIDDEN int __glXDisp_GenProgramsNV(struct __GLXclientStateRec *,
-                                             GLbyte *);
-extern _X_HIDDEN int __glXDispSwap_GenProgramsNV(struct __GLXclientStateRec *,
-                                                 GLbyte *);
-extern _X_HIDDEN void __glXDisp_VertexAttrib4dvNV(GLbyte * pc);
-extern _X_HIDDEN void __glXDispSwap_VertexAttrib4dvNV(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_SecondaryColor3sv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_SecondaryColor3sv(GLbyte * pc);
+extern _X_HIDDEN void __glXDisp_MultiTexCoord2sv(GLbyte * pc);
+extern _X_HIDDEN void __glXDispSwap_MultiTexCoord2sv(GLbyte * pc);
 
 #endif                          /* !defined( _INDIRECT_DISPATCH_H_ ) */
index 80010b3..647d0c9 100644 (file)
  * SOFTWARE.
  */
 
-#include <X11/Xmd.h>
-#include <GL/gl.h>
-#include <GL/glxproto.h>
 #include <inttypes.h>
+#include "glxserver.h"
 #include "indirect_size.h"
 #include "indirect_size_get.h"
 #include "indirect_dispatch.h"
-#include "glxserver.h"
 #include "glxbyteorder.h"
 #include "indirect_util.h"
 #include "singlesize.h"
-#include "glapi.h"
-#include "glapitable.h"
-#include "glthread.h"
-#include "dispatch.h"
 
 #define __GLX_PAD(x)  (((x) + 3) & ~3)
 
@@ -176,9 +169,7 @@ __glXDispSwap_NewList(__GLXclientState * cl, GLbyte * pc)
 
     pc += __GLX_SINGLE_HDR_SIZE;
     if (cx != NULL) {
-        CALL_NewList(GET_DISPATCH(), ((GLuint) bswap_CARD32(pc + 0),
-                                      (GLenum) bswap_ENUM(pc + 4)
-                     ));
+        glNewList((GLuint) bswap_CARD32(pc + 0), (GLenum) bswap_ENUM(pc + 4));
         error = Success;
     }
 
@@ -195,7 +186,7 @@ __glXDispSwap_EndList(__GLXclientState * cl, GLbyte * pc)
 
     pc += __GLX_SINGLE_HDR_SIZE;
     if (cx != NULL) {
-        CALL_EndList(GET_DISPATCH(), ());
+        glEndList();
         error = Success;
     }
 
@@ -205,8 +196,7 @@ __glXDispSwap_EndList(__GLXclientState * cl, GLbyte * pc)
 void
 __glXDispSwap_CallList(GLbyte * pc)
 {
-    CALL_CallList(GET_DISPATCH(), ((GLuint) bswap_CARD32(pc + 0)
-                  ));
+    glCallList((GLuint) bswap_CARD32(pc + 0));
 }
 
 void
@@ -237,7 +227,7 @@ __glXDispSwap_CallLists(GLbyte * pc)
         return;
     }
 
-    CALL_CallLists(GET_DISPATCH(), (n, type, lists));
+    glCallLists(n, type, lists);
 }
 
 int
@@ -250,9 +240,8 @@ __glXDispSwap_DeleteLists(__GLXclientState * cl, GLbyte * pc)
 
     pc += __GLX_SINGLE_HDR_SIZE;
     if (cx != NULL) {
-        CALL_DeleteLists(GET_DISPATCH(), ((GLuint) bswap_CARD32(pc + 0),
-                                          (GLsizei) bswap_CARD32(pc + 4)
-                         ));
+        glDeleteLists((GLuint) bswap_CARD32(pc + 0),
+                      (GLsizei) bswap_CARD32(pc + 4));
         error = Success;
     }
 
@@ -271,8 +260,7 @@ __glXDispSwap_GenLists(__GLXclientState * cl, GLbyte * pc)
     if (cx != NULL) {
         GLuint retval;
 
-        retval = CALL_GenLists(GET_DISPATCH(), ((GLsizei) bswap_CARD32(pc + 0)
-                               ));
+        retval = glGenLists((GLsizei) bswap_CARD32(pc + 0));
         __glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval);
         error = Success;
     }
@@ -283,15 +271,13 @@ __glXDispSwap_GenLists(__GLXclientState * cl, GLbyte * pc)
 void
 __glXDispSwap_ListBase(GLbyte * pc)
 {
-    CALL_ListBase(GET_DISPATCH(), ((GLuint) bswap_CARD32(pc + 0)
-                  ));
+    glListBase((GLuint) bswap_CARD32(pc + 0));
 }
 
 void
 __glXDispSwap_Begin(GLbyte * pc)
 {
-    CALL_Begin(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0)
-               ));
+    glBegin((GLenum) bswap_ENUM(pc + 0));
 }
 
 void
@@ -300,33 +286,25 @@ __glXDispSwap_Bitmap(GLbyte * pc)
     const GLubyte *const bitmap = (const GLubyte *) ((pc + 44));
     __GLXpixelHeader *const hdr = (__GLXpixelHeader *) (pc);
 
-    CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_ROW_LENGTH,
-                      (GLint) bswap_CARD32(&hdr->rowLength)));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_SKIP_ROWS,
-                      (GLint) bswap_CARD32(&hdr->skipRows)));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_SKIP_PIXELS,
-                      (GLint) bswap_CARD32(&hdr->skipPixels)));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_ALIGNMENT,
-                      (GLint) bswap_CARD32(&hdr->alignment)));
-
-    CALL_Bitmap(GET_DISPATCH(), ((GLsizei) bswap_CARD32(pc + 20),
-                                 (GLsizei) bswap_CARD32(pc + 24),
-                                 (GLfloat) bswap_FLOAT32(pc + 28),
-                                 (GLfloat) bswap_FLOAT32(pc + 32),
-                                 (GLfloat) bswap_FLOAT32(pc + 36),
-                                 (GLfloat) bswap_FLOAT32(pc + 40), bitmap));
+    glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst);
+    glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32(&hdr->rowLength));
+    glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32(&hdr->skipRows));
+    glPixelStorei(GL_UNPACK_SKIP_PIXELS,
+                  (GLint) bswap_CARD32(&hdr->skipPixels));
+    glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32(&hdr->alignment));
+
+    glBitmap((GLsizei) bswap_CARD32(pc + 20),
+             (GLsizei) bswap_CARD32(pc + 24),
+             (GLfloat) bswap_FLOAT32(pc + 28),
+             (GLfloat) bswap_FLOAT32(pc + 32),
+             (GLfloat) bswap_FLOAT32(pc + 36),
+             (GLfloat) bswap_FLOAT32(pc + 40), bitmap);
 }
 
 void
 __glXDispSwap_Color3bv(GLbyte * pc)
 {
-    CALL_Color3bv(GET_DISPATCH(), ((const GLbyte *) (pc + 0)
-                  ));
+    glColor3bv((const GLbyte *) (pc + 0));
 }
 
 void
@@ -339,63 +317,49 @@ __glXDispSwap_Color3dv(GLbyte * pc)
     }
 #endif
 
-    CALL_Color3dv(GET_DISPATCH(), ((const GLdouble *)
-                                   bswap_64_array((uint64_t *) (pc + 0), 3)
-                  ));
+    glColor3dv((const GLdouble *) bswap_64_array((uint64_t *) (pc + 0), 3));
 }
 
 void
 __glXDispSwap_Color3fv(GLbyte * pc)
 {
-    CALL_Color3fv(GET_DISPATCH(), ((const GLfloat *)
-                                   bswap_32_array((uint32_t *) (pc + 0), 3)
-                  ));
+    glColor3fv((const GLfloat *) bswap_32_array((uint32_t *) (pc + 0), 3));
 }
 
 void
 __glXDispSwap_Color3iv(GLbyte * pc)
 {
-    CALL_Color3iv(GET_DISPATCH(), ((const GLint *)
-                                   bswap_32_array((uint32_t *) (pc + 0), 3)
-                  ));
+    glColor3iv((const GLint *) bswap_32_array((uint32_t *) (pc + 0), 3));
 }
 
 void
 __glXDispSwap_Color3sv(GLbyte * pc)
 {
-    CALL_Color3sv(GET_DISPATCH(), ((const GLshort *)
-                                   bswap_16_array((uint16_t *) (pc + 0), 3)
-                  ));
+    glColor3sv((const GLshort *) bswap_16_array((uint16_t *) (pc + 0), 3));
 }
 
 void
 __glXDispSwap_Color3ubv(GLbyte * pc)
 {
-    CALL_Color3ubv(GET_DISPATCH(), ((const GLubyte *) (pc + 0)
-                   ));
+    glColor3ubv((const GLubyte *) (pc + 0));
 }
 
 void
 __glXDispSwap_Color3uiv(GLbyte * pc)
 {
-    CALL_Color3uiv(GET_DISPATCH(), ((const GLuint *)
-                                    bswap_32_array((uint32_t *) (pc + 0), 3)
-                   ));
+    glColor3uiv((const GLuint *) bswap_32_array((uint32_t *) (pc + 0), 3));
 }
 
 void
 __glXDispSwap_Color3usv(GLbyte * pc)
 {
-    CALL_Color3usv(GET_DISPATCH(), ((const GLushort *)
-                                    bswap_16_array((uint16_t *) (pc + 0), 3)
-                   ));
+    glColor3usv((const GLushort *) bswap_16_array((uint16_t *) (pc + 0), 3));
 }
 
 void
 __glXDispSwap_Color4bv(GLbyte * pc)
 {
-    CALL_Color4bv(GET_DISPATCH(), ((const GLbyte *) (pc + 0)
-                  ));
+    glColor4bv((const GLbyte *) (pc + 0));
 }
 
 void
@@ -408,69 +372,55 @@ __glXDispSwap_Color4dv(GLbyte * pc)
     }
 #endif
 
-    CALL_Color4dv(GET_DISPATCH(), ((const GLdouble *)
-                                   bswap_64_array((uint64_t *) (pc + 0), 4)
-                  ));
+    glColor4dv((const GLdouble *) bswap_64_array((uint64_t *) (pc + 0), 4));
 }
 
 void
 __glXDispSwap_Color4fv(GLbyte * pc)
 {
-    CALL_Color4fv(GET_DISPATCH(), ((const GLfloat *)
-                                   bswap_32_array((uint32_t *) (pc + 0), 4)
-                  ));
+    glColor4fv((const GLfloat *) bswap_32_array((uint32_t *) (pc + 0), 4));
 }
 
 void
 __glXDispSwap_Color4iv(GLbyte * pc)
 {
-    CALL_Color4iv(GET_DISPATCH(), ((const GLint *)
-                                   bswap_32_array((uint32_t *) (pc + 0), 4)
-                  ));
+    glColor4iv((const GLint *) bswap_32_array((uint32_t *) (pc + 0), 4));
 }
 
 void
 __glXDispSwap_Color4sv(GLbyte * pc)
 {
-    CALL_Color4sv(GET_DISPATCH(), ((const GLshort *)
-                                   bswap_16_array((uint16_t *) (pc + 0), 4)
-                  ));
+    glColor4sv((const GLshort *) bswap_16_array((uint16_t *) (pc + 0), 4));
 }
 
 void
 __glXDispSwap_Color4ubv(GLbyte * pc)
 {
-    CALL_Color4ubv(GET_DISPATCH(), ((const GLubyte *) (pc + 0)
-                   ));
+    glColor4ubv((const GLubyte *) (pc + 0));
 }
 
 void
 __glXDispSwap_Color4uiv(GLbyte * pc)
 {
-    CALL_Color4uiv(GET_DISPATCH(), ((const GLuint *)
-                                    bswap_32_array((uint32_t *) (pc + 0), 4)
-                   ));
+    glColor4uiv((const GLuint *) bswap_32_array((uint32_t *) (pc + 0), 4));
 }
 
 void
 __glXDispSwap_Color4usv(GLbyte * pc)
 {
-    CALL_Color4usv(GET_DISPATCH(), ((const GLushort *)
-                                    bswap_16_array((uint16_t *) (pc + 0), 4)
-                   ));
+    glColor4usv((const GLushort *) bswap_16_array((uint16_t *) (pc + 0), 4));
 }
 
 void
 __glXDispSwap_EdgeFlagv(GLbyte * pc)
 {
-    CALL_EdgeFlagv(GET_DISPATCH(), ((const GLboolean *) (pc + 0)
-                   ));
+    glEdgeFlagv((const GLboolean *) (pc + 0));
 }
 
 void
 __glXDispSwap_End(GLbyte * pc)
 {
-    CALL_End(GET_DISPATCH(), ());
+    glEnd();
 }
 
 void
@@ -483,40 +433,31 @@ __glXDispSwap_Indexdv(GLbyte * pc)
     }
 #endif
 
-    CALL_Indexdv(GET_DISPATCH(), ((const GLdouble *)
-                                  bswap_64_array((uint64_t *) (pc + 0), 1)
-                 ));
+    glIndexdv((const GLdouble *) bswap_64_array((uint64_t *) (pc + 0), 1));
 }
 
 void
 __glXDispSwap_Indexfv(GLbyte * pc)
 {
-    CALL_Indexfv(GET_DISPATCH(), ((const GLfloat *)
-                                  bswap_32_array((uint32_t *) (pc + 0), 1)
-                 ));
+    glIndexfv((const GLfloat *) bswap_32_array((uint32_t *) (pc + 0), 1));
 }
 
 void
 __glXDispSwap_Indexiv(GLbyte * pc)
 {
-    CALL_Indexiv(GET_DISPATCH(), ((const GLint *)
-                                  bswap_32_array((uint32_t *) (pc + 0), 1)
-                 ));
+    glIndexiv((const GLint *) bswap_32_array((uint32_t *) (pc + 0), 1));
 }
 
 void
 __glXDispSwap_Indexsv(GLbyte * pc)
 {
-    CALL_Indexsv(GET_DISPATCH(), ((const GLshort *)
-                                  bswap_16_array((uint16_t *) (pc + 0), 1)
-                 ));
+    glIndexsv((const GLshort *) bswap_16_array((uint16_t *) (pc + 0), 1));
 }
 
 void
 __glXDispSwap_Normal3bv(GLbyte * pc)
 {
-    CALL_Normal3bv(GET_DISPATCH(), ((const GLbyte *) (pc + 0)
-                   ));
+    glNormal3bv((const GLbyte *) (pc + 0));
 }
 
 void
@@ -529,33 +470,25 @@ __glXDispSwap_Normal3dv(GLbyte * pc)
     }
 #endif
 
-    CALL_Normal3dv(GET_DISPATCH(), ((const GLdouble *)
-                                    bswap_64_array((uint64_t *) (pc + 0), 3)
-                   ));
+    glNormal3dv((const GLdouble *) bswap_64_array((uint64_t *) (pc + 0), 3));
 }
 
 void
 __glXDispSwap_Normal3fv(GLbyte * pc)
 {
-    CALL_Normal3fv(GET_DISPATCH(), ((const GLfloat *)
-                                    bswap_32_array((uint32_t *) (pc + 0), 3)
-                   ));
+    glNormal3fv((const GLfloat *) bswap_32_array((uint32_t *) (pc + 0), 3));
 }
 
 void
 __glXDispSwap_Normal3iv(GLbyte * pc)
 {
-    CALL_Normal3iv(GET_DISPATCH(), ((const GLint *)
-                                    bswap_32_array((uint32_t *) (pc + 0), 3)
-                   ));
+    glNormal3iv((const GLint *) bswap_32_array((uint32_t *) (pc + 0), 3));
 }
 
 void
 __glXDispSwap_Normal3sv(GLbyte * pc)
 {
-    CALL_Normal3sv(GET_DISPATCH(), ((const GLshort *)
-                                    bswap_16_array((uint16_t *) (pc + 0), 3)
-                   ));
+    glNormal3sv((const GLshort *) bswap_16_array((uint16_t *) (pc + 0), 3));
 }
 
 void
@@ -568,33 +501,25 @@ __glXDispSwap_RasterPos2dv(GLbyte * pc)
     }
 #endif
 
-    CALL_RasterPos2dv(GET_DISPATCH(), ((const GLdouble *)
-                                       bswap_64_array((uint64_t *) (pc + 0), 2)
-                      ));
+    glRasterPos2dv((const GLdouble *) bswap_64_array((uint64_t *) (pc + 0), 2));
 }
 
 void
 __glXDispSwap_RasterPos2fv(GLbyte * pc)
 {
-    CALL_RasterPos2fv(GET_DISPATCH(), ((const GLfloat *)
-                                       bswap_32_array((uint32_t *) (pc + 0), 2)
-                      ));
+    glRasterPos2fv((const GLfloat *) bswap_32_array((uint32_t *) (pc + 0), 2));
 }
 
 void
 __glXDispSwap_RasterPos2iv(GLbyte * pc)
 {
-    CALL_RasterPos2iv(GET_DISPATCH(), ((const GLint *)
-                                       bswap_32_array((uint32_t *) (pc + 0), 2)
-                      ));
+    glRasterPos2iv((const GLint *) bswap_32_array((uint32_t *) (pc + 0), 2));
 }
 
 void
 __glXDispSwap_RasterPos2sv(GLbyte * pc)
 {
-    CALL_RasterPos2sv(GET_DISPATCH(), ((const GLshort *)
-                                       bswap_16_array((uint16_t *) (pc + 0), 2)
-                      ));
+    glRasterPos2sv((const GLshort *) bswap_16_array((uint16_t *) (pc + 0), 2));
 }
 
 void
@@ -607,33 +532,25 @@ __glXDispSwap_RasterPos3dv(GLbyte * pc)
     }
 #endif
 
-    CALL_RasterPos3dv(GET_DISPATCH(), ((const GLdouble *)
-                                       bswap_64_array((uint64_t *) (pc + 0), 3)
-                      ));
+    glRasterPos3dv((const GLdouble *) bswap_64_array((uint64_t *) (pc + 0), 3));
 }
 
 void
 __glXDispSwap_RasterPos3fv(GLbyte * pc)
 {
-    CALL_RasterPos3fv(GET_DISPATCH(), ((const GLfloat *)
-                                       bswap_32_array((uint32_t *) (pc + 0), 3)
-                      ));
+    glRasterPos3fv((const GLfloat *) bswap_32_array((uint32_t *) (pc + 0), 3));
 }
 
 void
 __glXDispSwap_RasterPos3iv(GLbyte * pc)
 {
-    CALL_RasterPos3iv(GET_DISPATCH(), ((const GLint *)
-                                       bswap_32_array((uint32_t *) (pc + 0), 3)
-                      ));
+    glRasterPos3iv((const GLint *) bswap_32_array((uint32_t *) (pc + 0), 3));
 }
 
 void
 __glXDispSwap_RasterPos3sv(GLbyte * pc)
 {
-    CALL_RasterPos3sv(GET_DISPATCH(), ((const GLshort *)
-                                       bswap_16_array((uint16_t *) (pc + 0), 3)
-                      ));
+    glRasterPos3sv((const GLshort *) bswap_16_array((uint16_t *) (pc + 0), 3));
 }
 
 void
@@ -646,33 +563,25 @@ __glXDispSwap_RasterPos4dv(GLbyte * pc)
     }
 #endif
 
-    CALL_RasterPos4dv(GET_DISPATCH(), ((const GLdouble *)
-                                       bswap_64_array((uint64_t *) (pc + 0), 4)
-                      ));
+    glRasterPos4dv((const GLdouble *) bswap_64_array((uint64_t *) (pc + 0), 4));
 }
 
 void
 __glXDispSwap_RasterPos4fv(GLbyte * pc)
 {
-    CALL_RasterPos4fv(GET_DISPATCH(), ((const GLfloat *)
-                                       bswap_32_array((uint32_t *) (pc + 0), 4)
-                      ));
+    glRasterPos4fv((const GLfloat *) bswap_32_array((uint32_t *) (pc + 0), 4));
 }
 
 void
 __glXDispSwap_RasterPos4iv(GLbyte * pc)
 {
-    CALL_RasterPos4iv(GET_DISPATCH(), ((const GLint *)
-                                       bswap_32_array((uint32_t *) (pc + 0), 4)
-                      ));
+    glRasterPos4iv((const GLint *) bswap_32_array((uint32_t *) (pc + 0), 4));
 }
 
 void
 __glXDispSwap_RasterPos4sv(GLbyte * pc)
 {
-    CALL_RasterPos4sv(GET_DISPATCH(), ((const GLshort *)
-                                       bswap_16_array((uint16_t *) (pc + 0), 4)
-                      ));
+    glRasterPos4sv((const GLshort *) bswap_16_array((uint16_t *) (pc + 0), 4));
 }
 
 void
@@ -685,41 +594,29 @@ __glXDispSwap_Rectdv(GLbyte * pc)
     }
 #endif
 
-    CALL_Rectdv(GET_DISPATCH(), ((const GLdouble *)
-                                 bswap_64_array((uint64_t *) (pc + 0), 2),
-                                 (const GLdouble *)
-                                 bswap_64_array((uint64_t *) (pc + 16), 2)
-                ));
+    glRectdv((const GLdouble *) bswap_64_array((uint64_t *) (pc + 0), 2),
+             (const GLdouble *) bswap_64_array((uint64_t *) (pc + 16), 2));
 }
 
 void
 __glXDispSwap_Rectfv(GLbyte * pc)
 {
-    CALL_Rectfv(GET_DISPATCH(), ((const GLfloat *)
-                                 bswap_32_array((uint32_t *) (pc + 0), 2),
-                                 (const GLfloat *)
-                                 bswap_32_array((uint32_t *) (pc + 8), 2)
-                ));
+    glRectfv((const GLfloat *) bswap_32_array((uint32_t *) (pc + 0), 2),
+             (const GLfloat *) bswap_32_array((uint32_t *) (pc + 8), 2));
 }
 
 void
 __glXDispSwap_Rectiv(GLbyte * pc)
 {
-    CALL_Rectiv(GET_DISPATCH(), ((const GLint *)
-                                 bswap_32_array((uint32_t *) (pc + 0), 2),
-                                 (const GLint *)
-                                 bswap_32_array((uint32_t *) (pc + 8), 2)
-                ));
+    glRectiv((const GLint *) bswap_32_array((uint32_t *) (pc + 0), 2),
+             (const GLint *) bswap_32_array((uint32_t *) (pc + 8), 2));
 }
 
 void
 __glXDispSwap_Rectsv(GLbyte * pc)
 {
-    CALL_Rectsv(GET_DISPATCH(), ((const GLshort *)
-                                 bswap_16_array((uint16_t *) (pc + 0), 2),
-                                 (const GLshort *)
-                                 bswap_16_array((uint16_t *) (pc + 4), 2)
-                ));
+    glRectsv((const GLshort *) bswap_16_array((uint16_t *) (pc + 0), 2),
+             (const GLshort *) bswap_16_array((uint16_t *) (pc + 4), 2));
 }
 
 void
@@ -732,33 +629,25 @@ __glXDispSwap_TexCoord1dv(GLbyte * pc)
     }
 #endif
 
-    CALL_TexCoord1dv(GET_DISPATCH(), ((const GLdouble *)
-                                      bswap_64_array((uint64_t *) (pc + 0), 1)
-                     ));
+    glTexCoord1dv((const GLdouble *) bswap_64_array((uint64_t *) (pc + 0), 1));
 }
 
 void
 __glXDispSwap_TexCoord1fv(GLbyte * pc)
 {
-    CALL_TexCoord1fv(GET_DISPATCH(), ((const GLfloat *)
-                                      bswap_32_array((uint32_t *) (pc + 0), 1)
-                     ));
+    glTexCoord1fv((const GLfloat *) bswap_32_array((uint32_t *) (pc + 0), 1));
 }
 
 void
 __glXDispSwap_TexCoord1iv(GLbyte * pc)
 {
-    CALL_TexCoord1iv(GET_DISPATCH(), ((const GLint *)
-                                      bswap_32_array((uint32_t *) (pc + 0), 1)
-                     ));
+    glTexCoord1iv((const GLint *) bswap_32_array((uint32_t *) (pc + 0), 1));
 }
 
 void
 __glXDispSwap_TexCoord1sv(GLbyte * pc)
 {
-    CALL_TexCoord1sv(GET_DISPATCH(), ((const GLshort *)
-                                      bswap_16_array((uint16_t *) (pc + 0), 1)
-                     ));
+    glTexCoord1sv((const GLshort *) bswap_16_array((uint16_t *) (pc + 0), 1));
 }
 
 void
@@ -771,33 +660,25 @@ __glXDispSwap_TexCoord2dv(GLbyte * pc)
     }
 #endif
 
-    CALL_TexCoord2dv(GET_DISPATCH(), ((const GLdouble *)
-                                      bswap_64_array((uint64_t *) (pc + 0), 2)
-                     ));
+    glTexCoord2dv((const GLdouble *) bswap_64_array((uint64_t *) (pc + 0), 2));
 }
 
 void
 __glXDispSwap_TexCoord2fv(GLbyte * pc)
 {
-    CALL_TexCoord2fv(GET_DISPATCH(), ((const GLfloat *)
-                                      bswap_32_array((uint32_t *) (pc + 0), 2)
-                     ));
+    glTexCoord2fv((const GLfloat *) bswap_32_array((uint32_t *) (pc + 0), 2));
 }
 
 void
 __glXDispSwap_TexCoord2iv(GLbyte * pc)
 {
-    CALL_TexCoord2iv(GET_DISPATCH(), ((const GLint *)
-                                      bswap_32_array((uint32_t *) (pc + 0), 2)
-                     ));
+    glTexCoord2iv((const GLint *) bswap_32_array((uint32_t *) (pc + 0), 2));
 }
 
 void
 __glXDispSwap_TexCoord2sv(GLbyte * pc)
 {
-    CALL_TexCoord2sv(GET_DISPATCH(), ((const GLshort *)
-                                      bswap_16_array((uint16_t *) (pc + 0), 2)
-                     ));
+    glTexCoord2sv((const GLshort *) bswap_16_array((uint16_t *) (pc + 0), 2));
 }
 
 void
@@ -810,33 +691,25 @@ __glXDispSwap_TexCoord3dv(GLbyte * pc)
     }
 #endif
 
-    CALL_TexCoord3dv(GET_DISPATCH(), ((const GLdouble *)
-                                      bswap_64_array((uint64_t *) (pc + 0), 3)
-                     ));
+    glTexCoord3dv((const GLdouble *) bswap_64_array((uint64_t *) (pc + 0), 3));
 }
 
 void
 __glXDispSwap_TexCoord3fv(GLbyte * pc)
 {
-    CALL_TexCoord3fv(GET_DISPATCH(), ((const GLfloat *)
-                                      bswap_32_array((uint32_t *) (pc + 0), 3)
-                     ));
+    glTexCoord3fv((const GLfloat *) bswap_32_array((uint32_t *) (pc + 0), 3));
 }
 
 void
 __glXDispSwap_TexCoord3iv(GLbyte * pc)
 {
-    CALL_TexCoord3iv(GET_DISPATCH(), ((const GLint *)
-                                      bswap_32_array((uint32_t *) (pc + 0), 3)
-                     ));
+    glTexCoord3iv((const GLint *) bswap_32_array((uint32_t *) (pc + 0), 3));
 }
 
 void
 __glXDispSwap_TexCoord3sv(GLbyte * pc)
 {
-    CALL_TexCoord3sv(GET_DISPATCH(), ((const GLshort *)
-                                      bswap_16_array((uint16_t *) (pc + 0), 3)
-                     ));
+    glTexCoord3sv((const GLshort *) bswap_16_array((uint16_t *) (pc + 0), 3));
 }
 
 void
@@ -849,33 +722,25 @@ __glXDispSwap_TexCoord4dv(GLbyte * pc)
     }
 #endif
 
-    CALL_TexCoord4dv(GET_DISPATCH(), ((const GLdouble *)
-                                      bswap_64_array((uint64_t *) (pc + 0), 4)
-                     ));
+    glTexCoord4dv((const GLdouble *) bswap_64_array((uint64_t *) (pc + 0), 4));
 }
 
 void
 __glXDispSwap_TexCoord4fv(GLbyte * pc)
 {
-    CALL_TexCoord4fv(GET_DISPATCH(), ((const GLfloat *)
-                                      bswap_32_array((uint32_t *) (pc + 0), 4)
-                     ));
+    glTexCoord4fv((const GLfloat *) bswap_32_array((uint32_t *) (pc + 0), 4));
 }
 
 void
 __glXDispSwap_TexCoord4iv(GLbyte * pc)
 {
-    CALL_TexCoord4iv(GET_DISPATCH(), ((const GLint *)
-                                      bswap_32_array((uint32_t *) (pc + 0), 4)
-                     ));
+    glTexCoord4iv((const GLint *) bswap_32_array((uint32_t *) (pc + 0), 4));
 }
 
 void
 __glXDispSwap_TexCoord4sv(GLbyte * pc)
 {
-    CALL_TexCoord4sv(GET_DISPATCH(), ((const GLshort *)
-                                      bswap_16_array((uint16_t *) (pc + 0), 4)
-                     ));
+    glTexCoord4sv((const GLshort *) bswap_16_array((uint16_t *) (pc + 0), 4));
 }
 
 void
@@ -888,33 +753,25 @@ __glXDispSwap_Vertex2dv(GLbyte * pc)
     }
 #endif
 
-    CALL_Vertex2dv(GET_DISPATCH(), ((const GLdouble *)
-                                    bswap_64_array((uint64_t *) (pc + 0), 2)
-                   ));
+    glVertex2dv((const GLdouble *) bswap_64_array((uint64_t *) (pc + 0), 2));
 }
 
 void
 __glXDispSwap_Vertex2fv(GLbyte * pc)
 {
-    CALL_Vertex2fv(GET_DISPATCH(), ((const GLfloat *)
-                                    bswap_32_array((uint32_t *) (pc + 0), 2)
-                   ));
+    glVertex2fv((const GLfloat *) bswap_32_array((uint32_t *) (pc + 0), 2));
 }
 
 void
 __glXDispSwap_Vertex2iv(GLbyte * pc)
 {
-    CALL_Vertex2iv(GET_DISPATCH(), ((const GLint *)
-                                    bswap_32_array((uint32_t *) (pc + 0), 2)
-                   ));
+    glVertex2iv((const GLint *) bswap_32_array((uint32_t *) (pc + 0), 2));
 }
 
 void
 __glXDispSwap_Vertex2sv(GLbyte * pc)
 {
-    CALL_Vertex2sv(GET_DISPATCH(), ((const GLshort *)
-                                    bswap_16_array((uint16_t *) (pc + 0), 2)
-                   ));
+    glVertex2sv((const GLshort *) bswap_16_array((uint16_t *) (pc + 0), 2));
 }
 
 void
@@ -927,33 +784,25 @@ __glXDispSwap_Vertex3dv(GLbyte * pc)
     }
 #endif
 
-    CALL_Vertex3dv(GET_DISPATCH(), ((const GLdouble *)
-                                    bswap_64_array((uint64_t *) (pc + 0), 3)
-                   ));
+    glVertex3dv((const GLdouble *) bswap_64_array((uint64_t *) (pc + 0), 3));
 }
 
 void
 __glXDispSwap_Vertex3fv(GLbyte * pc)
 {
-    CALL_Vertex3fv(GET_DISPATCH(), ((const GLfloat *)
-                                    bswap_32_array((uint32_t *) (pc + 0), 3)
-                   ));
+    glVertex3fv((const GLfloat *) bswap_32_array((uint32_t *) (pc + 0), 3));
 }
 
 void
 __glXDispSwap_Vertex3iv(GLbyte * pc)
 {
-    CALL_Vertex3iv(GET_DISPATCH(), ((const GLint *)
-                                    bswap_32_array((uint32_t *) (pc + 0), 3)
-                   ));
+    glVertex3iv((const GLint *) bswap_32_array((uint32_t *) (pc + 0), 3));
 }
 
 void
 __glXDispSwap_Vertex3sv(GLbyte * pc)
 {
-    CALL_Vertex3sv(GET_DISPATCH(), ((const GLshort *)
-                                    bswap_16_array((uint16_t *) (pc + 0), 3)
-                   ));
+    glVertex3sv((const GLshort *) bswap_16_array((uint16_t *) (pc + 0), 3));
 }
 
 void
@@ -966,33 +815,25 @@ __glXDispSwap_Vertex4dv(GLbyte * pc)
     }
 #endif
 
-    CALL_Vertex4dv(GET_DISPATCH(), ((const GLdouble *)
-                                    bswap_64_array((uint64_t *) (pc + 0), 4)
-                   ));
+    glVertex4dv((const GLdouble *) bswap_64_array((uint64_t *) (pc + 0), 4));
 }
 
 void
 __glXDispSwap_Vertex4fv(GLbyte * pc)
 {
-    CALL_Vertex4fv(GET_DISPATCH(), ((const GLfloat *)
-                                    bswap_32_array((uint32_t *) (pc + 0), 4)
-                   ));
+    glVertex4fv((const GLfloat *) bswap_32_array((uint32_t *) (pc + 0), 4));
 }
 
 void
 __glXDispSwap_Vertex4iv(GLbyte * pc)
 {
-    CALL_Vertex4iv(GET_DISPATCH(), ((const GLint *)
-                                    bswap_32_array((uint32_t *) (pc + 0), 4)
-                   ));
+    glVertex4iv((const GLint *) bswap_32_array((uint32_t *) (pc + 0), 4));
 }
 
 void
 __glXDispSwap_Vertex4sv(GLbyte * pc)
 {
-    CALL_Vertex4sv(GET_DISPATCH(), ((const GLshort *)
-                                    bswap_16_array((uint16_t *) (pc + 0), 4)
-                   ));
+    glVertex4sv((const GLshort *) bswap_16_array((uint16_t *) (pc + 0), 4));
 }
 
 void
@@ -1005,33 +846,26 @@ __glXDispSwap_ClipPlane(GLbyte * pc)
     }
 #endif
 
-    CALL_ClipPlane(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 32),
-                                    (const GLdouble *)
-                                    bswap_64_array((uint64_t *) (pc + 0), 4)
-                   ));
+    glClipPlane((GLenum) bswap_ENUM(pc + 32),
+                (const GLdouble *) bswap_64_array((uint64_t *) (pc + 0), 4));
 }
 
 void
 __glXDispSwap_ColorMaterial(GLbyte * pc)
 {
-    CALL_ColorMaterial(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                        (GLenum) bswap_ENUM(pc + 4)
-                       ));
+    glColorMaterial((GLenum) bswap_ENUM(pc + 0), (GLenum) bswap_ENUM(pc + 4));
 }
 
 void
 __glXDispSwap_CullFace(GLbyte * pc)
 {
-    CALL_CullFace(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0)
-                  ));
+    glCullFace((GLenum) bswap_ENUM(pc + 0));
 }
 
 void
 __glXDispSwap_Fogf(GLbyte * pc)
 {
-    CALL_Fogf(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                               (GLfloat) bswap_FLOAT32(pc + 4)
-              ));
+    glFogf((GLenum) bswap_ENUM(pc + 0), (GLfloat) bswap_FLOAT32(pc + 4));
 }
 
 void
@@ -1044,15 +878,13 @@ __glXDispSwap_Fogfv(GLbyte * pc)
         (const GLfloat *) bswap_32_array((uint32_t *) (pc + 4),
                                          __glFogfv_size(pname));
 
-    CALL_Fogfv(GET_DISPATCH(), (pname, params));
+    glFogfv(pname, params);
 }
 
 void
 __glXDispSwap_Fogi(GLbyte * pc)
 {
-    CALL_Fogi(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                               (GLint) bswap_CARD32(pc + 4)
-              ));
+    glFogi((GLenum) bswap_ENUM(pc + 0), (GLint) bswap_CARD32(pc + 4));
 }
 
 void
@@ -1065,31 +897,26 @@ __glXDispSwap_Fogiv(GLbyte * pc)
         (const GLint *) bswap_32_array((uint32_t *) (pc + 4),
                                        __glFogiv_size(pname));
 
-    CALL_Fogiv(GET_DISPATCH(), (pname, params));
+    glFogiv(pname, params);
 }
 
 void
 __glXDispSwap_FrontFace(GLbyte * pc)
 {
-    CALL_FrontFace(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0)
-                   ));
+    glFrontFace((GLenum) bswap_ENUM(pc + 0));
 }
 
 void
 __glXDispSwap_Hint(GLbyte * pc)
 {
-    CALL_Hint(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                               (GLenum) bswap_ENUM(pc + 4)
-              ));
+    glHint((GLenum) bswap_ENUM(pc + 0), (GLenum) bswap_ENUM(pc + 4));
 }
 
 void
 __glXDispSwap_Lightf(GLbyte * pc)
 {
-    CALL_Lightf(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                 (GLenum) bswap_ENUM(pc + 4),
-                                 (GLfloat) bswap_FLOAT32(pc + 8)
-                ));
+    glLightf((GLenum) bswap_ENUM(pc + 0),
+             (GLenum) bswap_ENUM(pc + 4), (GLfloat) bswap_FLOAT32(pc + 8));
 }
 
 void
@@ -1102,16 +929,14 @@ __glXDispSwap_Lightfv(GLbyte * pc)
         (const GLfloat *) bswap_32_array((uint32_t *) (pc + 8),
                                          __glLightfv_size(pname));
 
-    CALL_Lightfv(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0), pname, params));
+    glLightfv((GLenum) bswap_ENUM(pc + 0), pname, params);
 }
 
 void
 __glXDispSwap_Lighti(GLbyte * pc)
 {
-    CALL_Lighti(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                 (GLenum) bswap_ENUM(pc + 4),
-                                 (GLint) bswap_CARD32(pc + 8)
-                ));
+    glLighti((GLenum) bswap_ENUM(pc + 0),
+             (GLenum) bswap_ENUM(pc + 4), (GLint) bswap_CARD32(pc + 8));
 }
 
 void
@@ -1124,15 +949,13 @@ __glXDispSwap_Lightiv(GLbyte * pc)
         (const GLint *) bswap_32_array((uint32_t *) (pc + 8),
                                        __glLightiv_size(pname));
 
-    CALL_Lightiv(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0), pname, params));
+    glLightiv((GLenum) bswap_ENUM(pc + 0), pname, params);
 }
 
 void
 __glXDispSwap_LightModelf(GLbyte * pc)
 {
-    CALL_LightModelf(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                      (GLfloat) bswap_FLOAT32(pc + 4)
-                     ));
+    glLightModelf((GLenum) bswap_ENUM(pc + 0), (GLfloat) bswap_FLOAT32(pc + 4));
 }
 
 void
@@ -1145,15 +968,13 @@ __glXDispSwap_LightModelfv(GLbyte * pc)
         (const GLfloat *) bswap_32_array((uint32_t *) (pc + 4),
                                          __glLightModelfv_size(pname));
 
-    CALL_LightModelfv(GET_DISPATCH(), (pname, params));
+    glLightModelfv(pname, params);
 }
 
 void
 __glXDispSwap_LightModeli(GLbyte * pc)
 {
-    CALL_LightModeli(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                      (GLint) bswap_CARD32(pc + 4)
-                     ));
+    glLightModeli((GLenum) bswap_ENUM(pc + 0), (GLint) bswap_CARD32(pc + 4));
 }
 
 void
@@ -1166,31 +987,27 @@ __glXDispSwap_LightModeliv(GLbyte * pc)
         (const GLint *) bswap_32_array((uint32_t *) (pc + 4),
                                        __glLightModeliv_size(pname));
 
-    CALL_LightModeliv(GET_DISPATCH(), (pname, params));
+    glLightModeliv(pname, params);
 }
 
 void
 __glXDispSwap_LineStipple(GLbyte * pc)
 {
-    CALL_LineStipple(GET_DISPATCH(), ((GLint) bswap_CARD32(pc + 0),
-                                      (GLushort) bswap_CARD16(pc + 4)
-                     ));
+    glLineStipple((GLint) bswap_CARD32(pc + 0),
+                  (GLushort) bswap_CARD16(pc + 4));
 }
 
 void
 __glXDispSwap_LineWidth(GLbyte * pc)
 {
-    CALL_LineWidth(GET_DISPATCH(), ((GLfloat) bswap_FLOAT32(pc + 0)
-                   ));
+    glLineWidth((GLfloat) bswap_FLOAT32(pc + 0));
 }
 
 void
 __glXDispSwap_Materialf(GLbyte * pc)
 {
-    CALL_Materialf(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                    (GLenum) bswap_ENUM(pc + 4),
-                                    (GLfloat) bswap_FLOAT32(pc + 8)
-                   ));
+    glMaterialf((GLenum) bswap_ENUM(pc + 0),
+                (GLenum) bswap_ENUM(pc + 4), (GLfloat) bswap_FLOAT32(pc + 8));
 }
 
 void
@@ -1203,17 +1020,14 @@ __glXDispSwap_Materialfv(GLbyte * pc)
         (const GLfloat *) bswap_32_array((uint32_t *) (pc + 8),
                                          __glMaterialfv_size(pname));
 
-    CALL_Materialfv(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                     pname, params));
+    glMaterialfv((GLenum) bswap_ENUM(pc + 0), pname, params);
 }
 
 void
 __glXDispSwap_Materiali(GLbyte * pc)
 {
-    CALL_Materiali(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                    (GLenum) bswap_ENUM(pc + 4),
-                                    (GLint) bswap_CARD32(pc + 8)
-                   ));
+    glMateriali((GLenum) bswap_ENUM(pc + 0),
+                (GLenum) bswap_ENUM(pc + 4), (GLint) bswap_CARD32(pc + 8));
 }
 
 void
@@ -1226,23 +1040,19 @@ __glXDispSwap_Materialiv(GLbyte * pc)
         (const GLint *) bswap_32_array((uint32_t *) (pc + 8),
                                        __glMaterialiv_size(pname));
 
-    CALL_Materialiv(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                     pname, params));
+    glMaterialiv((GLenum) bswap_ENUM(pc + 0), pname, params);
 }
 
 void
 __glXDispSwap_PointSize(GLbyte * pc)
 {
-    CALL_PointSize(GET_DISPATCH(), ((GLfloat) bswap_FLOAT32(pc + 0)
-                   ));
+    glPointSize((GLfloat) bswap_FLOAT32(pc + 0));
 }
 
 void
 __glXDispSwap_PolygonMode(GLbyte * pc)
 {
-    CALL_PolygonMode(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                      (GLenum) bswap_ENUM(pc + 4)
-                     ));
+    glPolygonMode((GLenum) bswap_ENUM(pc + 0), (GLenum) bswap_ENUM(pc + 4));
 }
 
 void
@@ -1251,47 +1061,36 @@ __glXDispSwap_PolygonStipple(GLbyte * pc)
     const GLubyte *const mask = (const GLubyte *) ((pc + 20));
     __GLXpixelHeader *const hdr = (__GLXpixelHeader *) (pc);
 
-    CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_ROW_LENGTH,
-                      (GLint) bswap_CARD32(&hdr->rowLength)));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_SKIP_ROWS,
-                      (GLint) bswap_CARD32(&hdr->skipRows)));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_SKIP_PIXELS,
-                      (GLint) bswap_CARD32(&hdr->skipPixels)));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_ALIGNMENT,
-                      (GLint) bswap_CARD32(&hdr->alignment)));
+    glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst);
+    glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32(&hdr->rowLength));
+    glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32(&hdr->skipRows));
+    glPixelStorei(GL_UNPACK_SKIP_PIXELS,
+                  (GLint) bswap_CARD32(&hdr->skipPixels));
+    glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32(&hdr->alignment));
 
-    CALL_PolygonStipple(GET_DISPATCH(), (mask));
+    glPolygonStipple(mask);
 }
 
 void
 __glXDispSwap_Scissor(GLbyte * pc)
 {
-    CALL_Scissor(GET_DISPATCH(), ((GLint) bswap_CARD32(pc + 0),
-                                  (GLint) bswap_CARD32(pc + 4),
-                                  (GLsizei) bswap_CARD32(pc + 8),
-                                  (GLsizei) bswap_CARD32(pc + 12)
-                 ));
+    glScissor((GLint) bswap_CARD32(pc + 0),
+              (GLint) bswap_CARD32(pc + 4),
+              (GLsizei) bswap_CARD32(pc + 8), (GLsizei) bswap_CARD32(pc + 12));
 }
 
 void
 __glXDispSwap_ShadeModel(GLbyte * pc)
 {
-    CALL_ShadeModel(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0)
-                    ));
+    glShadeModel((GLenum) bswap_ENUM(pc + 0));
 }
 
 void
 __glXDispSwap_TexParameterf(GLbyte * pc)
 {
-    CALL_TexParameterf(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                        (GLenum) bswap_ENUM(pc + 4),
-                                        (GLfloat) bswap_FLOAT32(pc + 8)
-                       ));
+    glTexParameterf((GLenum) bswap_ENUM(pc + 0),
+                    (GLenum) bswap_ENUM(pc + 4),
+                    (GLfloat) bswap_FLOAT32(pc + 8));
 }
 
 void
@@ -1304,17 +1103,14 @@ __glXDispSwap_TexParameterfv(GLbyte * pc)
         (const GLfloat *) bswap_32_array((uint32_t *) (pc + 8),
                                          __glTexParameterfv_size(pname));
 
-    CALL_TexParameterfv(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                         pname, params));
+    glTexParameterfv((GLenum) bswap_ENUM(pc + 0), pname, params);
 }
 
 void
 __glXDispSwap_TexParameteri(GLbyte * pc)
 {
-    CALL_TexParameteri(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                        (GLenum) bswap_ENUM(pc + 4),
-                                        (GLint) bswap_CARD32(pc + 8)
-                       ));
+    glTexParameteri((GLenum) bswap_ENUM(pc + 0),
+                    (GLenum) bswap_ENUM(pc + 4), (GLint) bswap_CARD32(pc + 8));
 }
 
 void
@@ -1327,8 +1123,7 @@ __glXDispSwap_TexParameteriv(GLbyte * pc)
         (const GLint *) bswap_32_array((uint32_t *) (pc + 8),
                                        __glTexParameteriv_size(pname));
 
-    CALL_TexParameteriv(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                         pname, params));
+    glTexParameteriv((GLenum) bswap_ENUM(pc + 0), pname, params);
 }
 
 void
@@ -1337,28 +1132,21 @@ __glXDispSwap_TexImage1D(GLbyte * pc)
     const GLvoid *const pixels = (const GLvoid *) ((pc + 52));
     __GLXpixelHeader *const hdr = (__GLXpixelHeader *) (pc);
 
-    CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes));
-    CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_ROW_LENGTH,
-                      (GLint) bswap_CARD32(&hdr->rowLength)));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_SKIP_ROWS,
-                      (GLint) bswap_CARD32(&hdr->skipRows)));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_SKIP_PIXELS,
-                      (GLint) bswap_CARD32(&hdr->skipPixels)));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_ALIGNMENT,
-                      (GLint) bswap_CARD32(&hdr->alignment)));
-
-    CALL_TexImage1D(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 20),
-                                     (GLint) bswap_CARD32(pc + 24),
-                                     (GLint) bswap_CARD32(pc + 28),
-                                     (GLsizei) bswap_CARD32(pc + 32),
-                                     (GLint) bswap_CARD32(pc + 40),
-                                     (GLenum) bswap_ENUM(pc + 44),
-                                     (GLenum) bswap_ENUM(pc + 48), pixels));
+    glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes);
+    glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst);
+    glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32(&hdr->rowLength));
+    glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32(&hdr->skipRows));
+    glPixelStorei(GL_UNPACK_SKIP_PIXELS,
+                  (GLint) bswap_CARD32(&hdr->skipPixels));
+    glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32(&hdr->alignment));
+
+    glTexImage1D((GLenum) bswap_ENUM(pc + 20),
+                 (GLint) bswap_CARD32(pc + 24),
+                 (GLint) bswap_CARD32(pc + 28),
+                 (GLsizei) bswap_CARD32(pc + 32),
+                 (GLint) bswap_CARD32(pc + 40),
+                 (GLenum) bswap_ENUM(pc + 44),
+                 (GLenum) bswap_ENUM(pc + 48), pixels);
 }
 
 void
@@ -1367,38 +1155,29 @@ __glXDispSwap_TexImage2D(GLbyte * pc)
     const GLvoid *const pixels = (const GLvoid *) ((pc + 52));
     __GLXpixelHeader *const hdr = (__GLXpixelHeader *) (pc);
 
-    CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes));
-    CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_ROW_LENGTH,
-                      (GLint) bswap_CARD32(&hdr->rowLength)));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_SKIP_ROWS,
-                      (GLint) bswap_CARD32(&hdr->skipRows)));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_SKIP_PIXELS,
-                      (GLint) bswap_CARD32(&hdr->skipPixels)));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_ALIGNMENT,
-                      (GLint) bswap_CARD32(&hdr->alignment)));
-
-    CALL_TexImage2D(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 20),
-                                     (GLint) bswap_CARD32(pc + 24),
-                                     (GLint) bswap_CARD32(pc + 28),
-                                     (GLsizei) bswap_CARD32(pc + 32),
-                                     (GLsizei) bswap_CARD32(pc + 36),
-                                     (GLint) bswap_CARD32(pc + 40),
-                                     (GLenum) bswap_ENUM(pc + 44),
-                                     (GLenum) bswap_ENUM(pc + 48), pixels));
+    glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes);
+    glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst);
+    glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32(&hdr->rowLength));
+    glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32(&hdr->skipRows));
+    glPixelStorei(GL_UNPACK_SKIP_PIXELS,
+                  (GLint) bswap_CARD32(&hdr->skipPixels));
+    glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32(&hdr->alignment));
+
+    glTexImage2D((GLenum) bswap_ENUM(pc + 20),
+                 (GLint) bswap_CARD32(pc + 24),
+                 (GLint) bswap_CARD32(pc + 28),
+                 (GLsizei) bswap_CARD32(pc + 32),
+                 (GLsizei) bswap_CARD32(pc + 36),
+                 (GLint) bswap_CARD32(pc + 40),
+                 (GLenum) bswap_ENUM(pc + 44),
+                 (GLenum) bswap_ENUM(pc + 48), pixels);
 }
 
 void
 __glXDispSwap_TexEnvf(GLbyte * pc)
 {
-    CALL_TexEnvf(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                  (GLenum) bswap_ENUM(pc + 4),
-                                  (GLfloat) bswap_FLOAT32(pc + 8)
-                 ));
+    glTexEnvf((GLenum) bswap_ENUM(pc + 0),
+              (GLenum) bswap_ENUM(pc + 4), (GLfloat) bswap_FLOAT32(pc + 8));
 }
 
 void
@@ -1411,16 +1190,14 @@ __glXDispSwap_TexEnvfv(GLbyte * pc)
         (const GLfloat *) bswap_32_array((uint32_t *) (pc + 8),
                                          __glTexEnvfv_size(pname));
 
-    CALL_TexEnvfv(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0), pname, params));
+    glTexEnvfv((GLenum) bswap_ENUM(pc + 0), pname, params);
 }
 
 void
 __glXDispSwap_TexEnvi(GLbyte * pc)
 {
-    CALL_TexEnvi(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                  (GLenum) bswap_ENUM(pc + 4),
-                                  (GLint) bswap_CARD32(pc + 8)
-                 ));
+    glTexEnvi((GLenum) bswap_ENUM(pc + 0),
+              (GLenum) bswap_ENUM(pc + 4), (GLint) bswap_CARD32(pc + 8));
 }
 
 void
@@ -1433,7 +1210,7 @@ __glXDispSwap_TexEnviv(GLbyte * pc)
         (const GLint *) bswap_32_array((uint32_t *) (pc + 8),
                                        __glTexEnviv_size(pname));
 
-    CALL_TexEnviv(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0), pname, params));
+    glTexEnviv((GLenum) bswap_ENUM(pc + 0), pname, params);
 }
 
 void
@@ -1446,10 +1223,8 @@ __glXDispSwap_TexGend(GLbyte * pc)
     }
 #endif
 
-    CALL_TexGend(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 8),
-                                  (GLenum) bswap_ENUM(pc + 12),
-                                  (GLdouble) bswap_FLOAT64(pc + 0)
-                 ));
+    glTexGend((GLenum) bswap_ENUM(pc + 8),
+              (GLenum) bswap_ENUM(pc + 12), (GLdouble) bswap_FLOAT64(pc + 0));
 }
 
 void
@@ -1472,16 +1247,14 @@ __glXDispSwap_TexGendv(GLbyte * pc)
         (const GLdouble *) bswap_64_array((uint64_t *) (pc + 8),
                                           __glTexGendv_size(pname));
 
-    CALL_TexGendv(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0), pname, params));
+    glTexGendv((GLenum) bswap_ENUM(pc + 0), pname, params);
 }
 
 void
 __glXDispSwap_TexGenf(GLbyte * pc)
 {
-    CALL_TexGenf(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                  (GLenum) bswap_ENUM(pc + 4),
-                                  (GLfloat) bswap_FLOAT32(pc + 8)
-                 ));
+    glTexGenf((GLenum) bswap_ENUM(pc + 0),
+              (GLenum) bswap_ENUM(pc + 4), (GLfloat) bswap_FLOAT32(pc + 8));
 }
 
 void
@@ -1494,16 +1267,14 @@ __glXDispSwap_TexGenfv(GLbyte * pc)
         (const GLfloat *) bswap_32_array((uint32_t *) (pc + 8),
                                          __glTexGenfv_size(pname));
 
-    CALL_TexGenfv(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0), pname, params));
+    glTexGenfv((GLenum) bswap_ENUM(pc + 0), pname, params);
 }
 
 void
 __glXDispSwap_TexGeni(GLbyte * pc)
 {
-    CALL_TexGeni(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                  (GLenum) bswap_ENUM(pc + 4),
-                                  (GLint) bswap_CARD32(pc + 8)
-                 ));
+    glTexGeni((GLenum) bswap_ENUM(pc + 0),
+              (GLenum) bswap_ENUM(pc + 4), (GLint) bswap_CARD32(pc + 8));
 }
 
 void
@@ -1516,88 +1287,79 @@ __glXDispSwap_TexGeniv(GLbyte * pc)
         (const GLint *) bswap_32_array((uint32_t *) (pc + 8),
                                        __glTexGeniv_size(pname));
 
-    CALL_TexGeniv(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0), pname, params));
+    glTexGeniv((GLenum) bswap_ENUM(pc + 0), pname, params);
 }
 
 void
 __glXDispSwap_InitNames(GLbyte * pc)
 {
-    CALL_InitNames(GET_DISPATCH(), ());
+    glInitNames();
 }
 
 void
 __glXDispSwap_LoadName(GLbyte * pc)
 {
-    CALL_LoadName(GET_DISPATCH(), ((GLuint) bswap_CARD32(pc + 0)
-                  ));
+    glLoadName((GLuint) bswap_CARD32(pc + 0));
 }
 
 void
 __glXDispSwap_PassThrough(GLbyte * pc)
 {
-    CALL_PassThrough(GET_DISPATCH(), ((GLfloat) bswap_FLOAT32(pc + 0)
-                     ));
+    glPassThrough((GLfloat) bswap_FLOAT32(pc + 0));
 }
 
 void
 __glXDispSwap_PopName(GLbyte * pc)
 {
-    CALL_PopName(GET_DISPATCH(), ());
+    glPopName();
 }
 
 void
 __glXDispSwap_PushName(GLbyte * pc)
 {
-    CALL_PushName(GET_DISPATCH(), ((GLuint) bswap_CARD32(pc + 0)
-                  ));
+    glPushName((GLuint) bswap_CARD32(pc + 0));
 }
 
 void
 __glXDispSwap_DrawBuffer(GLbyte * pc)
 {
-    CALL_DrawBuffer(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0)
-                    ));
+    glDrawBuffer((GLenum) bswap_ENUM(pc + 0));
 }
 
 void
 __glXDispSwap_Clear(GLbyte * pc)
 {
-    CALL_Clear(GET_DISPATCH(), ((GLbitfield) bswap_CARD32(pc + 0)
-               ));
+    glClear((GLbitfield) bswap_CARD32(pc + 0));
 }
 
 void
 __glXDispSwap_ClearAccum(GLbyte * pc)
 {
-    CALL_ClearAccum(GET_DISPATCH(), ((GLfloat) bswap_FLOAT32(pc + 0),
-                                     (GLfloat) bswap_FLOAT32(pc + 4),
-                                     (GLfloat) bswap_FLOAT32(pc + 8),
-                                     (GLfloat) bswap_FLOAT32(pc + 12)
-                    ));
+    glClearAccum((GLfloat) bswap_FLOAT32(pc + 0),
+                 (GLfloat) bswap_FLOAT32(pc + 4),
+                 (GLfloat) bswap_FLOAT32(pc + 8),
+                 (GLfloat) bswap_FLOAT32(pc + 12));
 }
 
 void
 __glXDispSwap_ClearIndex(GLbyte * pc)
 {
-    CALL_ClearIndex(GET_DISPATCH(), ((GLfloat) bswap_FLOAT32(pc + 0)
-                    ));
+    glClearIndex((GLfloat) bswap_FLOAT32(pc + 0));
 }
 
 void
 __glXDispSwap_ClearColor(GLbyte * pc)
 {
-    CALL_ClearColor(GET_DISPATCH(), ((GLclampf) bswap_FLOAT32(pc + 0),
-                                     (GLclampf) bswap_FLOAT32(pc + 4),
-                                     (GLclampf) bswap_FLOAT32(pc + 8),
-                                     (GLclampf) bswap_FLOAT32(pc + 12)
-                    ));
+    glClearColor((GLclampf) bswap_FLOAT32(pc + 0),
+                 (GLclampf) bswap_FLOAT32(pc + 4),
+                 (GLclampf) bswap_FLOAT32(pc + 8),
+                 (GLclampf) bswap_FLOAT32(pc + 12));
 }
 
 void
 __glXDispSwap_ClearStencil(GLbyte * pc)
 {
-    CALL_ClearStencil(GET_DISPATCH(), ((GLint) bswap_CARD32(pc + 0)
-                      ));
+    glClearStencil((GLint) bswap_CARD32(pc + 0));
 }
 
 void
@@ -1610,74 +1372,63 @@ __glXDispSwap_ClearDepth(GLbyte * pc)
     }
 #endif
 
-    CALL_ClearDepth(GET_DISPATCH(), ((GLclampd) bswap_FLOAT64(pc + 0)
-                    ));
+    glClearDepth((GLclampd) bswap_FLOAT64(pc + 0));
 }
 
 void
 __glXDispSwap_StencilMask(GLbyte * pc)
 {
-    CALL_StencilMask(GET_DISPATCH(), ((GLuint) bswap_CARD32(pc + 0)
-                     ));
+    glStencilMask((GLuint) bswap_CARD32(pc + 0));
 }
 
 void
 __glXDispSwap_ColorMask(GLbyte * pc)
 {
-    CALL_ColorMask(GET_DISPATCH(), (*(GLboolean *) (pc + 0),
-                                    *(GLboolean *) (pc + 1),
-                                    *(GLboolean *) (pc + 2),
-                                    *(GLboolean *) (pc + 3)
-                   ));
+    glColorMask(*(GLboolean *) (pc + 0),
+                *(GLboolean *) (pc + 1),
+                *(GLboolean *) (pc + 2), *(GLboolean *) (pc + 3));
 }
 
 void
 __glXDispSwap_DepthMask(GLbyte * pc)
 {
-    CALL_DepthMask(GET_DISPATCH(), (*(GLboolean *) (pc + 0)
-                   ));
+    glDepthMask(*(GLboolean *) (pc + 0));
 }
 
 void
 __glXDispSwap_IndexMask(GLbyte * pc)
 {
-    CALL_IndexMask(GET_DISPATCH(), ((GLuint) bswap_CARD32(pc + 0)
-                   ));
+    glIndexMask((GLuint) bswap_CARD32(pc + 0));
 }
 
 void
 __glXDispSwap_Accum(GLbyte * pc)
 {
-    CALL_Accum(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                (GLfloat) bswap_FLOAT32(pc + 4)
-               ));
+    glAccum((GLenum) bswap_ENUM(pc + 0), (GLfloat) bswap_FLOAT32(pc + 4));
 }
 
 void
 __glXDispSwap_Disable(GLbyte * pc)
 {
-    CALL_Disable(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0)
-                 ));
+    glDisable((GLenum) bswap_ENUM(pc + 0));
 }
 
 void
 __glXDispSwap_Enable(GLbyte * pc)
 {
-    CALL_Enable(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0)
-                ));
+    glEnable((GLenum) bswap_ENUM(pc + 0));
 }
 
 void
 __glXDispSwap_PopAttrib(GLbyte * pc)
 {
-    CALL_PopAttrib(GET_DISPATCH(), ());
+    glPopAttrib();
 }
 
 void
 __glXDispSwap_PushAttrib(GLbyte * pc)
 {
-    CALL_PushAttrib(GET_DISPATCH(), ((GLbitfield) bswap_CARD32(pc + 0)
-                    ));
+    glPushAttrib((GLbitfield) bswap_CARD32(pc + 0));
 }
 
 void
@@ -1690,19 +1441,17 @@ __glXDispSwap_MapGrid1d(GLbyte * pc)
     }
 #endif
 
-    CALL_MapGrid1d(GET_DISPATCH(), ((GLint) bswap_CARD32(pc + 16),
-                                    (GLdouble) bswap_FLOAT64(pc + 0),
-                                    (GLdouble) bswap_FLOAT64(pc + 8)
-                   ));
+    glMapGrid1d((GLint) bswap_CARD32(pc + 16),
+                (GLdouble) bswap_FLOAT64(pc + 0),
+                (GLdouble) bswap_FLOAT64(pc + 8));
 }
 
 void
 __glXDispSwap_MapGrid1f(GLbyte * pc)
 {
-    CALL_MapGrid1f(GET_DISPATCH(), ((GLint) bswap_CARD32(pc + 0),
-                                    (GLfloat) bswap_FLOAT32(pc + 4),
-                                    (GLfloat) bswap_FLOAT32(pc + 8)
-                   ));
+    glMapGrid1f((GLint) bswap_CARD32(pc + 0),
+                (GLfloat) bswap_FLOAT32(pc + 4),
+                (GLfloat) bswap_FLOAT32(pc + 8));
 }
 
 void
@@ -1715,25 +1464,23 @@ __glXDispSwap_MapGrid2d(GLbyte * pc)
     }
 #endif
 
-    CALL_MapGrid2d(GET_DISPATCH(), ((GLint) bswap_CARD32(pc + 32),
-                                    (GLdouble) bswap_FLOAT64(pc + 0),
-                                    (GLdouble) bswap_FLOAT64(pc + 8),
-                                    (GLint) bswap_CARD32(pc + 36),
-                                    (GLdouble) bswap_FLOAT64(pc + 16),
-                                    (GLdouble) bswap_FLOAT64(pc + 24)
-                   ));
+    glMapGrid2d((GLint) bswap_CARD32(pc + 32),
+                (GLdouble) bswap_FLOAT64(pc + 0),
+                (GLdouble) bswap_FLOAT64(pc + 8),
+                (GLint) bswap_CARD32(pc + 36),
+                (GLdouble) bswap_FLOAT64(pc + 16),
+                (GLdouble) bswap_FLOAT64(pc + 24));
 }
 
 void
 __glXDispSwap_MapGrid2f(GLbyte * pc)
 {
-    CALL_MapGrid2f(GET_DISPATCH(), ((GLint) bswap_CARD32(pc + 0),
-                                    (GLfloat) bswap_FLOAT32(pc + 4),
-                                    (GLfloat) bswap_FLOAT32(pc + 8),
-                                    (GLint) bswap_CARD32(pc + 12),
-                                    (GLfloat) bswap_FLOAT32(pc + 16),
-                                    (GLfloat) bswap_FLOAT32(pc + 20)
-                   ));
+    glMapGrid2f((GLint) bswap_CARD32(pc + 0),
+                (GLfloat) bswap_FLOAT32(pc + 4),
+                (GLfloat) bswap_FLOAT32(pc + 8),
+                (GLint) bswap_CARD32(pc + 12),
+                (GLfloat) bswap_FLOAT32(pc + 16),
+                (GLfloat) bswap_FLOAT32(pc + 20));
 }
 
 void
@@ -1746,17 +1493,13 @@ __glXDispSwap_EvalCoord1dv(GLbyte * pc)
     }
 #endif
 
-    CALL_EvalCoord1dv(GET_DISPATCH(), ((const GLdouble *)
-                                       bswap_64_array((uint64_t *) (pc + 0), 1)
-                      ));
+    glEvalCoord1dv((const GLdouble *) bswap_64_array((uint64_t *) (pc + 0), 1));
 }
 
 void
 __glXDispSwap_EvalCoord1fv(GLbyte * pc)
 {
-    CALL_EvalCoord1fv(GET_DISPATCH(), ((const GLfloat *)
-                                       bswap_32_array((uint32_t *) (pc + 0), 1)
-                      ));
+    glEvalCoord1fv((const GLfloat *) bswap_32_array((uint32_t *) (pc + 0), 1));
 }
 
 void
@@ -1769,124 +1512,99 @@ __glXDispSwap_EvalCoord2dv(GLbyte * pc)
     }
 #endif
 
-    CALL_EvalCoord2dv(GET_DISPATCH(), ((const GLdouble *)
-                                       bswap_64_array((uint64_t *) (pc + 0), 2)
-                      ));
+    glEvalCoord2dv((const GLdouble *) bswap_64_array((uint64_t *) (pc + 0), 2));
 }
 
 void
 __glXDispSwap_EvalCoord2fv(GLbyte * pc)
 {
-    CALL_EvalCoord2fv(GET_DISPATCH(), ((const GLfloat *)
-                                       bswap_32_array((uint32_t *) (pc + 0), 2)
-                      ));
+    glEvalCoord2fv((const GLfloat *) bswap_32_array((uint32_t *) (pc + 0), 2));
 }
 
 void
 __glXDispSwap_EvalMesh1(GLbyte * pc)
 {
-    CALL_EvalMesh1(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                    (GLint) bswap_CARD32(pc + 4),
-                                    (GLint) bswap_CARD32(pc + 8)
-                   ));
+    glEvalMesh1((GLenum) bswap_ENUM(pc + 0),
+                (GLint) bswap_CARD32(pc + 4), (GLint) bswap_CARD32(pc + 8));
 }
 
 void
 __glXDispSwap_EvalPoint1(GLbyte * pc)
 {
-    CALL_EvalPoint1(GET_DISPATCH(), ((GLint) bswap_CARD32(pc + 0)
-                    ));
+    glEvalPoint1((GLint) bswap_CARD32(pc + 0));
 }
 
 void
 __glXDispSwap_EvalMesh2(GLbyte * pc)
 {
-    CALL_EvalMesh2(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                    (GLint) bswap_CARD32(pc + 4),
-                                    (GLint) bswap_CARD32(pc + 8),
-                                    (GLint) bswap_CARD32(pc + 12),
-                                    (GLint) bswap_CARD32(pc + 16)
-                   ));
+    glEvalMesh2((GLenum) bswap_ENUM(pc + 0),
+                (GLint) bswap_CARD32(pc + 4),
+                (GLint) bswap_CARD32(pc + 8),
+                (GLint) bswap_CARD32(pc + 12), (GLint) bswap_CARD32(pc + 16));
 }
 
 void
 __glXDispSwap_EvalPoint2(GLbyte * pc)
 {
-    CALL_EvalPoint2(GET_DISPATCH(), ((GLint) bswap_CARD32(pc + 0),
-                                     (GLint) bswap_CARD32(pc + 4)
-                    ));
+    glEvalPoint2((GLint) bswap_CARD32(pc + 0), (GLint) bswap_CARD32(pc + 4));
 }
 
 void
 __glXDispSwap_AlphaFunc(GLbyte * pc)
 {
-    CALL_AlphaFunc(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                    (GLclampf) bswap_FLOAT32(pc + 4)
-                   ));
+    glAlphaFunc((GLenum) bswap_ENUM(pc + 0), (GLclampf) bswap_FLOAT32(pc + 4));
 }
 
 void
 __glXDispSwap_BlendFunc(GLbyte * pc)
 {
-    CALL_BlendFunc(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                    (GLenum) bswap_ENUM(pc + 4)
-                   ));
+    glBlendFunc((GLenum) bswap_ENUM(pc + 0), (GLenum) bswap_ENUM(pc + 4));
 }
 
 void
 __glXDispSwap_LogicOp(GLbyte * pc)
 {
-    CALL_LogicOp(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0)
-                 ));
+    glLogicOp((GLenum) bswap_ENUM(pc + 0));
 }
 
 void
 __glXDispSwap_StencilFunc(GLbyte * pc)
 {
-    CALL_StencilFunc(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                      (GLint) bswap_CARD32(pc + 4),
-                                      (GLuint) bswap_CARD32(pc + 8)
-                     ));
+    glStencilFunc((GLenum) bswap_ENUM(pc + 0),
+                  (GLint) bswap_CARD32(pc + 4), (GLuint) bswap_CARD32(pc + 8));
 }
 
 void
 __glXDispSwap_StencilOp(GLbyte * pc)
 {
-    CALL_StencilOp(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                    (GLenum) bswap_ENUM(pc + 4),
-                                    (GLenum) bswap_ENUM(pc + 8)
-                   ));
+    glStencilOp((GLenum) bswap_ENUM(pc + 0),
+                (GLenum) bswap_ENUM(pc + 4), (GLenum) bswap_ENUM(pc + 8));
 }
 
 void
 __glXDispSwap_DepthFunc(GLbyte * pc)
 {
-    CALL_DepthFunc(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0)
-                   ));
+    glDepthFunc((GLenum) bswap_ENUM(pc + 0));
 }
 
 void
 __glXDispSwap_PixelZoom(GLbyte * pc)
 {
-    CALL_PixelZoom(GET_DISPATCH(), ((GLfloat) bswap_FLOAT32(pc + 0),
-                                    (GLfloat) bswap_FLOAT32(pc + 4)
-                   ));
+    glPixelZoom((GLfloat) bswap_FLOAT32(pc + 0),
+                (GLfloat) bswap_FLOAT32(pc + 4));
 }
 
 void
 __glXDispSwap_PixelTransferf(GLbyte * pc)
 {
-    CALL_PixelTransferf(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                         (GLfloat) bswap_FLOAT32(pc + 4)
-                        ));
+    glPixelTransferf((GLenum) bswap_ENUM(pc + 0),
+                     (GLfloat) bswap_FLOAT32(pc + 4));
 }
 
 void
 __glXDispSwap_PixelTransferi(GLbyte * pc)
 {
-    CALL_PixelTransferi(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                         (GLint) bswap_CARD32(pc + 4)
-                        ));
+    glPixelTransferi((GLenum) bswap_ENUM(pc + 0), (GLint) bswap_CARD32(pc + 4));
 }
 
 int
@@ -1899,9 +1617,8 @@ __glXDispSwap_PixelStoref(__GLXclientState * cl, GLbyte * pc)
 
     pc += __GLX_SINGLE_HDR_SIZE;
     if (cx != NULL) {
-        CALL_PixelStoref(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                          (GLfloat) bswap_FLOAT32(pc + 4)
-                         ));
+        glPixelStoref((GLenum) bswap_ENUM(pc + 0),
+                      (GLfloat) bswap_FLOAT32(pc + 4));
         error = Success;
     }
 
@@ -1918,9 +1635,8 @@ __glXDispSwap_PixelStorei(__GLXclientState * cl, GLbyte * pc)
 
     pc += __GLX_SINGLE_HDR_SIZE;
     if (cx != NULL) {
-        CALL_PixelStorei(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                          (GLint) bswap_CARD32(pc + 4)
-                         ));
+        glPixelStorei((GLenum) bswap_ENUM(pc + 0),
+                      (GLint) bswap_CARD32(pc + 4));
         error = Success;
     }
 
@@ -1932,11 +1648,9 @@ __glXDispSwap_PixelMapfv(GLbyte * pc)
 {
     const GLsizei mapsize = (GLsizei) bswap_CARD32(pc + 4);
 
-    CALL_PixelMapfv(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                     mapsize,
-                                     (const GLfloat *)
-                                     bswap_32_array((uint32_t *) (pc + 8), 0)
-                    ));
+    glPixelMapfv((GLenum) bswap_ENUM(pc + 0),
+                 mapsize,
+                 (const GLfloat *) bswap_32_array((uint32_t *) (pc + 8), 0));
 }
 
 void
@@ -1944,11 +1658,9 @@ __glXDispSwap_PixelMapuiv(GLbyte * pc)
 {
     const GLsizei mapsize = (GLsizei) bswap_CARD32(pc + 4);
 
-    CALL_PixelMapuiv(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                      mapsize,
-                                      (const GLuint *)
-                                      bswap_32_array((uint32_t *) (pc + 8), 0)
-                     ));
+    glPixelMapuiv((GLenum) bswap_ENUM(pc + 0),
+                  mapsize,
+                  (const GLuint *) bswap_32_array((uint32_t *) (pc + 8), 0));
 }
 
 void
@@ -1956,29 +1668,24 @@ __glXDispSwap_PixelMapusv(GLbyte * pc)
 {
     const GLsizei mapsize = (GLsizei) bswap_CARD32(pc + 4);
 
-    CALL_PixelMapusv(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                      mapsize,
-                                      (const GLushort *)
-                                      bswap_16_array((uint16_t *) (pc + 8), 0)
-                     ));
+    glPixelMapusv((GLenum) bswap_ENUM(pc + 0),
+                  mapsize,
+                  (const GLushort *) bswap_16_array((uint16_t *) (pc + 8), 0));
 }
 
 void
 __glXDispSwap_ReadBuffer(GLbyte * pc)
 {
-    CALL_ReadBuffer(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0)
-                    ));
+    glReadBuffer((GLenum) bswap_ENUM(pc + 0));
 }
 
 void
 __glXDispSwap_CopyPixels(GLbyte * pc)
 {
-    CALL_CopyPixels(GET_DISPATCH(), ((GLint) bswap_CARD32(pc + 0),
-                                     (GLint) bswap_CARD32(pc + 4),
-                                     (GLsizei) bswap_CARD32(pc + 8),
-                                     (GLsizei) bswap_CARD32(pc + 12),
-                                     (GLenum) bswap_ENUM(pc + 16)
-                    ));
+    glCopyPixels((GLint) bswap_CARD32(pc + 0),
+                 (GLint) bswap_CARD32(pc + 4),
+                 (GLsizei) bswap_CARD32(pc + 8),
+                 (GLsizei) bswap_CARD32(pc + 12), (GLenum) bswap_ENUM(pc + 16));
 }
 
 void
@@ -1987,25 +1694,18 @@ __glXDispSwap_DrawPixels(GLbyte * pc)
     const GLvoid *const pixels = (const GLvoid *) ((pc + 36));
     __GLXpixelHeader *const hdr = (__GLXpixelHeader *) (pc);
 
-    CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes));
-    CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_ROW_LENGTH,
-                      (GLint) bswap_CARD32(&hdr->rowLength)));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_SKIP_ROWS,
-                      (GLint) bswap_CARD32(&hdr->skipRows)));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_SKIP_PIXELS,
-                      (GLint) bswap_CARD32(&hdr->skipPixels)));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_ALIGNMENT,
-                      (GLint) bswap_CARD32(&hdr->alignment)));
-
-    CALL_DrawPixels(GET_DISPATCH(), ((GLsizei) bswap_CARD32(pc + 20),
-                                     (GLsizei) bswap_CARD32(pc + 24),
-                                     (GLenum) bswap_ENUM(pc + 28),
-                                     (GLenum) bswap_ENUM(pc + 32), pixels));
+    glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes);
+    glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst);
+    glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32(&hdr->rowLength));
+    glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32(&hdr->skipRows));
+    glPixelStorei(GL_UNPACK_SKIP_PIXELS,
+                  (GLint) bswap_CARD32(&hdr->skipPixels));
+    glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32(&hdr->alignment));
+
+    glDrawPixels((GLsizei) bswap_CARD32(pc + 20),
+                 (GLsizei) bswap_CARD32(pc + 24),
+                 (GLenum) bswap_ENUM(pc + 28),
+                 (GLenum) bswap_ENUM(pc + 32), pixels);
 }
 
 int
@@ -2030,7 +1730,7 @@ __glXDispSwap_GetBooleanv(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetBooleanv(GET_DISPATCH(), (pname, params));
+        glGetBooleanv(pname, params);
         __glXSendReplySwap(cl->client, params, compsize, 1, GL_FALSE, 0);
         error = Success;
     }
@@ -2050,8 +1750,7 @@ __glXDispSwap_GetClipPlane(__GLXclientState * cl, GLbyte * pc)
     if (cx != NULL) {
         GLdouble equation[4];
 
-        CALL_GetClipPlane(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                           equation));
+        glGetClipPlane((GLenum) bswap_ENUM(pc + 0), equation);
         (void) bswap_64_array((uint64_t *) equation, 4);
         __glXSendReplySwap(cl->client, equation, 4, 8, GL_TRUE, 0);
         error = Success;
@@ -2082,7 +1781,7 @@ __glXDispSwap_GetDoublev(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetDoublev(GET_DISPATCH(), (pname, params));
+        glGetDoublev(pname, params);
         (void) bswap_64_array((uint64_t *) params, compsize);
         __glXSendReplySwap(cl->client, params, compsize, 8, GL_FALSE, 0);
         error = Success;
@@ -2103,7 +1802,7 @@ __glXDispSwap_GetError(__GLXclientState * cl, GLbyte * pc)
     if (cx != NULL) {
         GLenum retval;
 
-        retval = CALL_GetError(GET_DISPATCH(), ());
+        retval = glGetError();
         __glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval);
         error = Success;
     }
@@ -2133,7 +1832,7 @@ __glXDispSwap_GetFloatv(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetFloatv(GET_DISPATCH(), (pname, params));
+        glGetFloatv(pname, params);
         (void) bswap_32_array((uint32_t *) params, compsize);
         __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
         error = Success;
@@ -2164,7 +1863,7 @@ __glXDispSwap_GetIntegerv(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetIntegerv(GET_DISPATCH(), (pname, params));
+        glGetIntegerv(pname, params);
         (void) bswap_32_array((uint32_t *) params, compsize);
         __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
         error = Success;
@@ -2195,8 +1894,7 @@ __glXDispSwap_GetLightfv(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetLightfv(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                         pname, params));
+        glGetLightfv((GLenum) bswap_ENUM(pc + 0), pname, params);
         (void) bswap_32_array((uint32_t *) params, compsize);
         __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
         error = Success;
@@ -2227,8 +1925,7 @@ __glXDispSwap_GetLightiv(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetLightiv(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                         pname, params));
+        glGetLightiv((GLenum) bswap_ENUM(pc + 0), pname, params);
         (void) bswap_32_array((uint32_t *) params, compsize);
         __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
         error = Success;
@@ -2260,7 +1957,7 @@ __glXDispSwap_GetMapdv(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetMapdv(GET_DISPATCH(), (target, query, v));
+        glGetMapdv(target, query, v);
         (void) bswap_64_array((uint64_t *) v, compsize);
         __glXSendReplySwap(cl->client, v, compsize, 8, GL_FALSE, 0);
         error = Success;
@@ -2292,7 +1989,7 @@ __glXDispSwap_GetMapfv(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetMapfv(GET_DISPATCH(), (target, query, v));
+        glGetMapfv(target, query, v);
         (void) bswap_32_array((uint32_t *) v, compsize);
         __glXSendReplySwap(cl->client, v, compsize, 4, GL_FALSE, 0);
         error = Success;
@@ -2324,7 +2021,7 @@ __glXDispSwap_GetMapiv(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetMapiv(GET_DISPATCH(), (target, query, v));
+        glGetMapiv(target, query, v);
         (void) bswap_32_array((uint32_t *) v, compsize);
         __glXSendReplySwap(cl->client, v, compsize, 4, GL_FALSE, 0);
         error = Success;
@@ -2355,8 +2052,7 @@ __glXDispSwap_GetMaterialfv(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetMaterialfv(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                            pname, params));
+        glGetMaterialfv((GLenum) bswap_ENUM(pc + 0), pname, params);
         (void) bswap_32_array((uint32_t *) params, compsize);
         __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
         error = Success;
@@ -2387,8 +2083,7 @@ __glXDispSwap_GetMaterialiv(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetMaterialiv(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                            pname, params));
+        glGetMaterialiv((GLenum) bswap_ENUM(pc + 0), pname, params);
         (void) bswap_32_array((uint32_t *) params, compsize);
         __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
         error = Success;
@@ -2419,7 +2114,7 @@ __glXDispSwap_GetPixelMapfv(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetPixelMapfv(GET_DISPATCH(), (map, values));
+        glGetPixelMapfv(map, values);
         (void) bswap_32_array((uint32_t *) values, compsize);
         __glXSendReplySwap(cl->client, values, compsize, 4, GL_FALSE, 0);
         error = Success;
@@ -2450,7 +2145,7 @@ __glXDispSwap_GetPixelMapuiv(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetPixelMapuiv(GET_DISPATCH(), (map, values));
+        glGetPixelMapuiv(map, values);
         (void) bswap_32_array((uint32_t *) values, compsize);
         __glXSendReplySwap(cl->client, values, compsize, 4, GL_FALSE, 0);
         error = Success;
@@ -2481,7 +2176,7 @@ __glXDispSwap_GetPixelMapusv(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetPixelMapusv(GET_DISPATCH(), (map, values));
+        glGetPixelMapusv(map, values);
         (void) bswap_16_array((uint16_t *) values, compsize);
         __glXSendReplySwap(cl->client, values, compsize, 2, GL_FALSE, 0);
         error = Success;
@@ -2512,8 +2207,7 @@ __glXDispSwap_GetTexEnvfv(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetTexEnvfv(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                          pname, params));
+        glGetTexEnvfv((GLenum) bswap_ENUM(pc + 0), pname, params);
         (void) bswap_32_array((uint32_t *) params, compsize);
         __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
         error = Success;
@@ -2544,8 +2238,7 @@ __glXDispSwap_GetTexEnviv(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetTexEnviv(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                          pname, params));
+        glGetTexEnviv((GLenum) bswap_ENUM(pc + 0), pname, params);
         (void) bswap_32_array((uint32_t *) params, compsize);
         __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
         error = Success;
@@ -2576,8 +2269,7 @@ __glXDispSwap_GetTexGendv(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetTexGendv(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                          pname, params));
+        glGetTexGendv((GLenum) bswap_ENUM(pc + 0), pname, params);
         (void) bswap_64_array((uint64_t *) params, compsize);
         __glXSendReplySwap(cl->client, params, compsize, 8, GL_FALSE, 0);
         error = Success;
@@ -2608,8 +2300,7 @@ __glXDispSwap_GetTexGenfv(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetTexGenfv(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                          pname, params));
+        glGetTexGenfv((GLenum) bswap_ENUM(pc + 0), pname, params);
         (void) bswap_32_array((uint32_t *) params, compsize);
         __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
         error = Success;
@@ -2640,8 +2331,7 @@ __glXDispSwap_GetTexGeniv(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetTexGeniv(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                          pname, params));
+        glGetTexGeniv((GLenum) bswap_ENUM(pc + 0), pname, params);
         (void) bswap_32_array((uint32_t *) params, compsize);
         __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
         error = Success;
@@ -2672,8 +2362,7 @@ __glXDispSwap_GetTexParameterfv(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetTexParameterfv(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                                pname, params));
+        glGetTexParameterfv((GLenum) bswap_ENUM(pc + 0), pname, params);
         (void) bswap_32_array((uint32_t *) params, compsize);
         __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
         error = Success;
@@ -2704,8 +2393,7 @@ __glXDispSwap_GetTexParameteriv(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetTexParameteriv(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                                pname, params));
+        glGetTexParameteriv((GLenum) bswap_ENUM(pc + 0), pname, params);
         (void) bswap_32_array((uint32_t *) params, compsize);
         __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
         error = Success;
@@ -2736,11 +2424,8 @@ __glXDispSwap_GetTexLevelParameterfv(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetTexLevelParameterfv(GET_DISPATCH(), ((GLenum)
-                                                     bswap_ENUM(pc + 0),
-                                                     (GLint) bswap_CARD32(pc +
-                                                                          4),
-                                                     pname, params));
+        glGetTexLevelParameterfv((GLenum) bswap_ENUM(pc + 0),
+                                 (GLint) bswap_CARD32(pc + 4), pname, params);
         (void) bswap_32_array((uint32_t *) params, compsize);
         __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
         error = Success;
@@ -2771,11 +2456,8 @@ __glXDispSwap_GetTexLevelParameteriv(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetTexLevelParameteriv(GET_DISPATCH(), ((GLenum)
-                                                     bswap_ENUM(pc + 0),
-                                                     (GLint) bswap_CARD32(pc +
-                                                                          4),
-                                                     pname, params));
+        glGetTexLevelParameteriv((GLenum) bswap_ENUM(pc + 0),
+                                 (GLint) bswap_CARD32(pc + 4), pname, params);
         (void) bswap_32_array((uint32_t *) params, compsize);
         __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
         error = Success;
@@ -2796,8 +2478,7 @@ __glXDispSwap_IsEnabled(__GLXclientState * cl, GLbyte * pc)
     if (cx != NULL) {
         GLboolean retval;
 
-        retval = CALL_IsEnabled(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0)
-                                ));
+        retval = glIsEnabled((GLenum) bswap_ENUM(pc + 0));
         __glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval);
         error = Success;
     }
@@ -2817,8 +2498,7 @@ __glXDispSwap_IsList(__GLXclientState * cl, GLbyte * pc)
     if (cx != NULL) {
         GLboolean retval;
 
-        retval = CALL_IsList(GET_DISPATCH(), ((GLuint) bswap_CARD32(pc + 0)
-                             ));
+        retval = glIsList((GLuint) bswap_CARD32(pc + 0));
         __glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval);
         error = Success;
     }
@@ -2836,9 +2516,8 @@ __glXDispSwap_DepthRange(GLbyte * pc)
     }
 #endif
 
-    CALL_DepthRange(GET_DISPATCH(), ((GLclampd) bswap_FLOAT64(pc + 0),
-                                     (GLclampd) bswap_FLOAT64(pc + 8)
-                    ));
+    glDepthRange((GLclampd) bswap_FLOAT64(pc + 0),
+                 (GLclampd) bswap_FLOAT64(pc + 8));
 }
 
 void
@@ -2851,27 +2530,24 @@ __glXDispSwap_Frustum(GLbyte * pc)
     }
 #endif
 
-    CALL_Frustum(GET_DISPATCH(), ((GLdouble) bswap_FLOAT64(pc + 0),
-                                  (GLdouble) bswap_FLOAT64(pc + 8),
-                                  (GLdouble) bswap_FLOAT64(pc + 16),
-                                  (GLdouble) bswap_FLOAT64(pc + 24),
-                                  (GLdouble) bswap_FLOAT64(pc + 32),
-                                  (GLdouble) bswap_FLOAT64(pc + 40)
-                 ));
+    glFrustum((GLdouble) bswap_FLOAT64(pc + 0),
+              (GLdouble) bswap_FLOAT64(pc + 8),
+              (GLdouble) bswap_FLOAT64(pc + 16),
+              (GLdouble) bswap_FLOAT64(pc + 24),
+              (GLdouble) bswap_FLOAT64(pc + 32),
+              (GLdouble) bswap_FLOAT64(pc + 40));
 }
 
 void
 __glXDispSwap_LoadIdentity(GLbyte * pc)
 {
-    CALL_LoadIdentity(GET_DISPATCH(), ());
+    glLoadIdentity();
 }
 
 void
 __glXDispSwap_LoadMatrixf(GLbyte * pc)
 {
-    CALL_LoadMatrixf(GET_DISPATCH(), ((const GLfloat *)
-                                      bswap_32_array((uint32_t *) (pc + 0), 16)
-                     ));
+    glLoadMatrixf((const GLfloat *) bswap_32_array((uint32_t *) (pc + 0), 16));
 }
 
 void
@@ -2884,24 +2560,19 @@ __glXDispSwap_LoadMatrixd(GLbyte * pc)
     }
 #endif
 
-    CALL_LoadMatrixd(GET_DISPATCH(), ((const GLdouble *)
-                                      bswap_64_array((uint64_t *) (pc + 0), 16)
-                     ));
+    glLoadMatrixd((const GLdouble *) bswap_64_array((uint64_t *) (pc + 0), 16));
 }
 
 void
 __glXDispSwap_MatrixMode(GLbyte * pc)
 {
-    CALL_MatrixMode(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0)
-                    ));
+    glMatrixMode((GLenum) bswap_ENUM(pc + 0));
 }
 
 void
 __glXDispSwap_MultMatrixf(GLbyte * pc)
 {
-    CALL_MultMatrixf(GET_DISPATCH(), ((const GLfloat *)
-                                      bswap_32_array((uint32_t *) (pc + 0), 16)
-                     ));
+    glMultMatrixf((const GLfloat *) bswap_32_array((uint32_t *) (pc + 0), 16));
 }
 
 void
@@ -2914,9 +2585,7 @@ __glXDispSwap_MultMatrixd(GLbyte * pc)
     }
 #endif
 
-    CALL_MultMatrixd(GET_DISPATCH(), ((const GLdouble *)
-                                      bswap_64_array((uint64_t *) (pc + 0), 16)
-                     ));
+    glMultMatrixd((const GLdouble *) bswap_64_array((uint64_t *) (pc + 0), 16));
 }
 
 void
@@ -2929,25 +2598,24 @@ __glXDispSwap_Ortho(GLbyte * pc)
     }
 #endif
 
-    CALL_Ortho(GET_DISPATCH(), ((GLdouble) bswap_FLOAT64(pc + 0),
-                                (GLdouble) bswap_FLOAT64(pc + 8),
-                                (GLdouble) bswap_FLOAT64(pc + 16),
-                                (GLdouble) bswap_FLOAT64(pc + 24),
-                                (GLdouble) bswap_FLOAT64(pc + 32),
-                                (GLdouble) bswap_FLOAT64(pc + 40)
-               ));
+    glOrtho((GLdouble) bswap_FLOAT64(pc + 0),
+            (GLdouble) bswap_FLOAT64(pc + 8),
+            (GLdouble) bswap_FLOAT64(pc + 16),
+            (GLdouble) bswap_FLOAT64(pc + 24),
+            (GLdouble) bswap_FLOAT64(pc + 32),
+            (GLdouble) bswap_FLOAT64(pc + 40));
 }
 
 void
 __glXDispSwap_PopMatrix(GLbyte * pc)
 {
-    CALL_PopMatrix(GET_DISPATCH(), ());
+    glPopMatrix();
 }
 
 void
 __glXDispSwap_PushMatrix(GLbyte * pc)
 {
-    CALL_PushMatrix(GET_DISPATCH(), ());
+    glPushMatrix();
 }
 
 void
@@ -2960,21 +2628,19 @@ __glXDispSwap_Rotated(GLbyte * pc)
     }
 #endif
 
-    CALL_Rotated(GET_DISPATCH(), ((GLdouble) bswap_FLOAT64(pc + 0),
-                                  (GLdouble) bswap_FLOAT64(pc + 8),
-                                  (GLdouble) bswap_FLOAT64(pc + 16),
-                                  (GLdouble) bswap_FLOAT64(pc + 24)
-                 ));
+    glRotated((GLdouble) bswap_FLOAT64(pc + 0),
+              (GLdouble) bswap_FLOAT64(pc + 8),
+              (GLdouble) bswap_FLOAT64(pc + 16),
+              (GLdouble) bswap_FLOAT64(pc + 24));
 }
 
 void
 __glXDispSwap_Rotatef(GLbyte * pc)
 {
-    CALL_Rotatef(GET_DISPATCH(), ((GLfloat) bswap_FLOAT32(pc + 0),
-                                  (GLfloat) bswap_FLOAT32(pc + 4),
-                                  (GLfloat) bswap_FLOAT32(pc + 8),
-                                  (GLfloat) bswap_FLOAT32(pc + 12)
-                 ));
+    glRotatef((GLfloat) bswap_FLOAT32(pc + 0),
+              (GLfloat) bswap_FLOAT32(pc + 4),
+              (GLfloat) bswap_FLOAT32(pc + 8),
+              (GLfloat) bswap_FLOAT32(pc + 12));
 }
 
 void
@@ -2987,19 +2653,16 @@ __glXDispSwap_Scaled(GLbyte * pc)
     }
 #endif
 
-    CALL_Scaled(GET_DISPATCH(), ((GLdouble) bswap_FLOAT64(pc + 0),
-                                 (GLdouble) bswap_FLOAT64(pc + 8),
-                                 (GLdouble) bswap_FLOAT64(pc + 16)
-                ));
+    glScaled((GLdouble) bswap_FLOAT64(pc + 0),
+             (GLdouble) bswap_FLOAT64(pc + 8),
+             (GLdouble) bswap_FLOAT64(pc + 16));
 }
 
 void
 __glXDispSwap_Scalef(GLbyte * pc)
 {
-    CALL_Scalef(GET_DISPATCH(), ((GLfloat) bswap_FLOAT32(pc + 0),
-                                 (GLfloat) bswap_FLOAT32(pc + 4),
-                                 (GLfloat) bswap_FLOAT32(pc + 8)
-                ));
+    glScalef((GLfloat) bswap_FLOAT32(pc + 0),
+             (GLfloat) bswap_FLOAT32(pc + 4), (GLfloat) bswap_FLOAT32(pc + 8));
 }
 
 void
@@ -3012,52 +2675,44 @@ __glXDispSwap_Translated(GLbyte * pc)
     }
 #endif
 
-    CALL_Translated(GET_DISPATCH(), ((GLdouble) bswap_FLOAT64(pc + 0),
-                                     (GLdouble) bswap_FLOAT64(pc + 8),
-                                     (GLdouble) bswap_FLOAT64(pc + 16)
-                    ));
+    glTranslated((GLdouble) bswap_FLOAT64(pc + 0),
+                 (GLdouble) bswap_FLOAT64(pc + 8),
+                 (GLdouble) bswap_FLOAT64(pc + 16));
 }
 
 void
 __glXDispSwap_Translatef(GLbyte * pc)
 {
-    CALL_Translatef(GET_DISPATCH(), ((GLfloat) bswap_FLOAT32(pc + 0),
-                                     (GLfloat) bswap_FLOAT32(pc + 4),
-                                     (GLfloat) bswap_FLOAT32(pc + 8)
-                    ));
+    glTranslatef((GLfloat) bswap_FLOAT32(pc + 0),
+                 (GLfloat) bswap_FLOAT32(pc + 4),
+                 (GLfloat) bswap_FLOAT32(pc + 8));
 }
 
 void
 __glXDispSwap_Viewport(GLbyte * pc)
 {
-    CALL_Viewport(GET_DISPATCH(), ((GLint) bswap_CARD32(pc + 0),
-                                   (GLint) bswap_CARD32(pc + 4),
-                                   (GLsizei) bswap_CARD32(pc + 8),
-                                   (GLsizei) bswap_CARD32(pc + 12)
-                  ));
+    glViewport((GLint) bswap_CARD32(pc + 0),
+               (GLint) bswap_CARD32(pc + 4),
+               (GLsizei) bswap_CARD32(pc + 8), (GLsizei) bswap_CARD32(pc + 12));
 }
 
 void
 __glXDispSwap_BindTexture(GLbyte * pc)
 {
-    CALL_BindTexture(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                      (GLuint) bswap_CARD32(pc + 4)
-                     ));
+    glBindTexture((GLenum) bswap_ENUM(pc + 0), (GLuint) bswap_CARD32(pc + 4));
 }
 
 void
 __glXDispSwap_Indexubv(GLbyte * pc)
 {
-    CALL_Indexubv(GET_DISPATCH(), ((const GLubyte *) (pc + 0)
-                  ));
+    glIndexubv((const GLubyte *) (pc + 0));
 }
 
 void
 __glXDispSwap_PolygonOffset(GLbyte * pc)
 {
-    CALL_PolygonOffset(GET_DISPATCH(), ((GLfloat) bswap_FLOAT32(pc + 0),
-                                        (GLfloat) bswap_FLOAT32(pc + 4)
-                       ));
+    glPolygonOffset((GLfloat) bswap_FLOAT32(pc + 0),
+                    (GLfloat) bswap_FLOAT32(pc + 4));
 }
 
 int
@@ -3077,11 +2732,10 @@ __glXDispSwap_AreTexturesResident(__GLXclientState * cl, GLbyte * pc)
         GLboolean *residences =
             __glXGetAnswerBuffer(cl, n, answerBuffer, sizeof(answerBuffer), 1);
         retval =
-            CALL_AreTexturesResident(GET_DISPATCH(),
-                                     (n,
-                                      (const GLuint *)
-                                      bswap_32_array((uint32_t *) (pc + 4), 0),
-                                      residences));
+            glAreTexturesResident(n,
+                                  (const GLuint *)
+                                  bswap_32_array((uint32_t *) (pc + 4), 0),
+                                  residences);
         __glXSendReplySwap(cl->client, residences, n, 1, GL_TRUE, retval);
         error = Success;
     }
@@ -3106,11 +2760,10 @@ __glXDispSwap_AreTexturesResidentEXT(__GLXclientState * cl, GLbyte * pc)
         GLboolean *residences =
             __glXGetAnswerBuffer(cl, n, answerBuffer, sizeof(answerBuffer), 1);
         retval =
-            CALL_AreTexturesResident(GET_DISPATCH(),
-                                     (n,
-                                      (const GLuint *)
-                                      bswap_32_array((uint32_t *) (pc + 4), 0),
-                                      residences));
+            glAreTexturesResident(n,
+                                  (const GLuint *)
+                                  bswap_32_array((uint32_t *) (pc + 4), 0),
+                                  residences);
         __glXSendReplySwap(cl->client, residences, n, 1, GL_TRUE, retval);
         error = Success;
     }
@@ -3121,54 +2774,50 @@ __glXDispSwap_AreTexturesResidentEXT(__GLXclientState * cl, GLbyte * pc)
 void
 __glXDispSwap_CopyTexImage1D(GLbyte * pc)
 {
-    CALL_CopyTexImage1D(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                         (GLint) bswap_CARD32(pc + 4),
-                                         (GLenum) bswap_ENUM(pc + 8),
-                                         (GLint) bswap_CARD32(pc + 12),
-                                         (GLint) bswap_CARD32(pc + 16),
-                                         (GLsizei) bswap_CARD32(pc + 20),
-                                         (GLint) bswap_CARD32(pc + 24)
-                        ));
+    glCopyTexImage1D((GLenum) bswap_ENUM(pc + 0),
+                     (GLint) bswap_CARD32(pc + 4),
+                     (GLenum) bswap_ENUM(pc + 8),
+                     (GLint) bswap_CARD32(pc + 12),
+                     (GLint) bswap_CARD32(pc + 16),
+                     (GLsizei) bswap_CARD32(pc + 20),
+                     (GLint) bswap_CARD32(pc + 24));
 }
 
 void
 __glXDispSwap_CopyTexImage2D(GLbyte * pc)
 {
-    CALL_CopyTexImage2D(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                         (GLint) bswap_CARD32(pc + 4),
-                                         (GLenum) bswap_ENUM(pc + 8),
-                                         (GLint) bswap_CARD32(pc + 12),
-                                         (GLint) bswap_CARD32(pc + 16),
-                                         (GLsizei) bswap_CARD32(pc + 20),
-                                         (GLsizei) bswap_CARD32(pc + 24),
-                                         (GLint) bswap_CARD32(pc + 28)
-                        ));
+    glCopyTexImage2D((GLenum) bswap_ENUM(pc + 0),
+                     (GLint) bswap_CARD32(pc + 4),
+                     (GLenum) bswap_ENUM(pc + 8),
+                     (GLint) bswap_CARD32(pc + 12),
+                     (GLint) bswap_CARD32(pc + 16),
+                     (GLsizei) bswap_CARD32(pc + 20),
+                     (GLsizei) bswap_CARD32(pc + 24),
+                     (GLint) bswap_CARD32(pc + 28));
 }
 
 void
 __glXDispSwap_CopyTexSubImage1D(GLbyte * pc)
 {
-    CALL_CopyTexSubImage1D(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                            (GLint) bswap_CARD32(pc + 4),
-                                            (GLint) bswap_CARD32(pc + 8),
-                                            (GLint) bswap_CARD32(pc + 12),
-                                            (GLint) bswap_CARD32(pc + 16),
-                                            (GLsizei) bswap_CARD32(pc + 20)
-                           ));
+    glCopyTexSubImage1D((GLenum) bswap_ENUM(pc + 0),
+                        (GLint) bswap_CARD32(pc + 4),
+                        (GLint) bswap_CARD32(pc + 8),
+                        (GLint) bswap_CARD32(pc + 12),
+                        (GLint) bswap_CARD32(pc + 16),
+                        (GLsizei) bswap_CARD32(pc + 20));
 }
 
 void
 __glXDispSwap_CopyTexSubImage2D(GLbyte * pc)
 {
-    CALL_CopyTexSubImage2D(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                            (GLint) bswap_CARD32(pc + 4),
-                                            (GLint) bswap_CARD32(pc + 8),
-                                            (GLint) bswap_CARD32(pc + 12),
-                                            (GLint) bswap_CARD32(pc + 16),
-                                            (GLint) bswap_CARD32(pc + 20),
-                                            (GLsizei) bswap_CARD32(pc + 24),
-                                            (GLsizei) bswap_CARD32(pc + 28)
-                           ));
+    glCopyTexSubImage2D((GLenum) bswap_ENUM(pc + 0),
+                        (GLint) bswap_CARD32(pc + 4),
+                        (GLint) bswap_CARD32(pc + 8),
+                        (GLint) bswap_CARD32(pc + 12),
+                        (GLint) bswap_CARD32(pc + 16),
+                        (GLint) bswap_CARD32(pc + 20),
+                        (GLsizei) bswap_CARD32(pc + 24),
+                        (GLsizei) bswap_CARD32(pc + 28));
 }
 
 int
@@ -3183,11 +2832,9 @@ __glXDispSwap_DeleteTextures(__GLXclientState * cl, GLbyte * pc)
     if (cx != NULL) {
         const GLsizei n = (GLsizei) bswap_CARD32(pc + 0);
 
-        CALL_DeleteTextures(GET_DISPATCH(), (n,
-                                             (const GLuint *)
-                                             bswap_32_array((uint32_t *) (pc +
-                                                                          4), 0)
-                            ));
+        glDeleteTextures(n,
+                         (const GLuint *) bswap_32_array((uint32_t *) (pc + 4),
+                                                         0));
         error = Success;
     }
 
@@ -3206,11 +2853,9 @@ __glXDispSwap_DeleteTexturesEXT(__GLXclientState * cl, GLbyte * pc)
     if (cx != NULL) {
         const GLsizei n = (GLsizei) bswap_CARD32(pc + 0);
 
-        CALL_DeleteTextures(GET_DISPATCH(), (n,
-                                             (const GLuint *)
-                                             bswap_32_array((uint32_t *) (pc +
-                                                                          4), 0)
-                            ));
+        glDeleteTextures(n,
+                         (const GLuint *) bswap_32_array((uint32_t *) (pc + 4),
+                                                         0));
         error = Success;
     }
 
@@ -3233,7 +2878,7 @@ __glXDispSwap_GenTextures(__GLXclientState * cl, GLbyte * pc)
         GLuint *textures =
             __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer),
                                  4);
-        CALL_GenTextures(GET_DISPATCH(), (n, textures));
+        glGenTextures(n, textures);
         (void) bswap_32_array((uint32_t *) textures, n);
         __glXSendReplySwap(cl->client, textures, n, 4, GL_TRUE, 0);
         error = Success;
@@ -3258,7 +2903,7 @@ __glXDispSwap_GenTexturesEXT(__GLXclientState * cl, GLbyte * pc)
         GLuint *textures =
             __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer),
                                  4);
-        CALL_GenTextures(GET_DISPATCH(), (n, textures));
+        glGenTextures(n, textures);
         (void) bswap_32_array((uint32_t *) textures, n);
         __glXSendReplySwap(cl->client, textures, n, 4, GL_TRUE, 0);
         error = Success;
@@ -3279,8 +2924,7 @@ __glXDispSwap_IsTexture(__GLXclientState * cl, GLbyte * pc)
     if (cx != NULL) {
         GLboolean retval;
 
-        retval = CALL_IsTexture(GET_DISPATCH(), ((GLuint) bswap_CARD32(pc + 0)
-                                ));
+        retval = glIsTexture((GLuint) bswap_CARD32(pc + 0));
         __glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval);
         error = Success;
     }
@@ -3300,8 +2944,7 @@ __glXDispSwap_IsTextureEXT(__GLXclientState * cl, GLbyte * pc)
     if (cx != NULL) {
         GLboolean retval;
 
-        retval = CALL_IsTexture(GET_DISPATCH(), ((GLuint) bswap_CARD32(pc + 0)
-                                ));
+        retval = glIsTexture((GLuint) bswap_CARD32(pc + 0));
         __glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval);
         error = Success;
     }
@@ -3314,15 +2957,11 @@ __glXDispSwap_PrioritizeTextures(GLbyte * pc)
 {
     const GLsizei n = (GLsizei) bswap_CARD32(pc + 0);
 
-    CALL_PrioritizeTextures(GET_DISPATCH(), (n,
-                                             (const GLuint *)
-                                             bswap_32_array((uint32_t *) (pc +
-                                                                          4),
-                                                            0),
-                                             (const GLclampf *)
-                                             bswap_32_array((uint32_t *) (pc +
-                                                                          4), 0)
-                            ));
+    glPrioritizeTextures(n,
+                         (const GLuint *) bswap_32_array((uint32_t *) (pc + 4),
+                                                         0),
+                         (const GLclampf *)
+                         bswap_32_array((uint32_t *) (pc + 4), 0));
 }
 
 void
@@ -3331,27 +2970,20 @@ __glXDispSwap_TexSubImage1D(GLbyte * pc)
     const GLvoid *const pixels = (const GLvoid *) ((pc + 56));
     __GLXpixelHeader *const hdr = (__GLXpixelHeader *) (pc);
 
-    CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes));
-    CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_ROW_LENGTH,
-                      (GLint) bswap_CARD32(&hdr->rowLength)));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_SKIP_ROWS,
-                      (GLint) bswap_CARD32(&hdr->skipRows)));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_SKIP_PIXELS,
-                      (GLint) bswap_CARD32(&hdr->skipPixels)));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_ALIGNMENT,
-                      (GLint) bswap_CARD32(&hdr->alignment)));
-
-    CALL_TexSubImage1D(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 20),
-                                        (GLint) bswap_CARD32(pc + 24),
-                                        (GLint) bswap_CARD32(pc + 28),
-                                        (GLsizei) bswap_CARD32(pc + 36),
-                                        (GLenum) bswap_ENUM(pc + 44),
-                                        (GLenum) bswap_ENUM(pc + 48), pixels));
+    glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes);
+    glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst);
+    glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32(&hdr->rowLength));
+    glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32(&hdr->skipRows));
+    glPixelStorei(GL_UNPACK_SKIP_PIXELS,
+                  (GLint) bswap_CARD32(&hdr->skipPixels));
+    glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32(&hdr->alignment));
+
+    glTexSubImage1D((GLenum) bswap_ENUM(pc + 20),
+                    (GLint) bswap_CARD32(pc + 24),
+                    (GLint) bswap_CARD32(pc + 28),
+                    (GLsizei) bswap_CARD32(pc + 36),
+                    (GLenum) bswap_ENUM(pc + 44),
+                    (GLenum) bswap_ENUM(pc + 48), pixels);
 }
 
 void
@@ -3360,46 +2992,37 @@ __glXDispSwap_TexSubImage2D(GLbyte * pc)
     const GLvoid *const pixels = (const GLvoid *) ((pc + 56));
     __GLXpixelHeader *const hdr = (__GLXpixelHeader *) (pc);
 
-    CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes));
-    CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_ROW_LENGTH,
-                      (GLint) bswap_CARD32(&hdr->rowLength)));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_SKIP_ROWS,
-                      (GLint) bswap_CARD32(&hdr->skipRows)));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_SKIP_PIXELS,
-                      (GLint) bswap_CARD32(&hdr->skipPixels)));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_ALIGNMENT,
-                      (GLint) bswap_CARD32(&hdr->alignment)));
-
-    CALL_TexSubImage2D(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 20),
-                                        (GLint) bswap_CARD32(pc + 24),
-                                        (GLint) bswap_CARD32(pc + 28),
-                                        (GLint) bswap_CARD32(pc + 32),
-                                        (GLsizei) bswap_CARD32(pc + 36),
-                                        (GLsizei) bswap_CARD32(pc + 40),
-                                        (GLenum) bswap_ENUM(pc + 44),
-                                        (GLenum) bswap_ENUM(pc + 48), pixels));
+    glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes);
+    glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst);
+    glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32(&hdr->rowLength));
+    glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32(&hdr->skipRows));
+    glPixelStorei(GL_UNPACK_SKIP_PIXELS,
+                  (GLint) bswap_CARD32(&hdr->skipPixels));
+    glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32(&hdr->alignment));
+
+    glTexSubImage2D((GLenum) bswap_ENUM(pc + 20),
+                    (GLint) bswap_CARD32(pc + 24),
+                    (GLint) bswap_CARD32(pc + 28),
+                    (GLint) bswap_CARD32(pc + 32),
+                    (GLsizei) bswap_CARD32(pc + 36),
+                    (GLsizei) bswap_CARD32(pc + 40),
+                    (GLenum) bswap_ENUM(pc + 44),
+                    (GLenum) bswap_ENUM(pc + 48), pixels);
 }
 
 void
 __glXDispSwap_BlendColor(GLbyte * pc)
 {
-    CALL_BlendColor(GET_DISPATCH(), ((GLclampf) bswap_FLOAT32(pc + 0),
-                                     (GLclampf) bswap_FLOAT32(pc + 4),
-                                     (GLclampf) bswap_FLOAT32(pc + 8),
-                                     (GLclampf) bswap_FLOAT32(pc + 12)
-                    ));
+    glBlendColor((GLclampf) bswap_FLOAT32(pc + 0),
+                 (GLclampf) bswap_FLOAT32(pc + 4),
+                 (GLclampf) bswap_FLOAT32(pc + 8),
+                 (GLclampf) bswap_FLOAT32(pc + 12));
 }
 
 void
 __glXDispSwap_BlendEquation(GLbyte * pc)
 {
-    CALL_BlendEquation(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0)
-                       ));
+    glBlendEquation((GLenum) bswap_ENUM(pc + 0));
 }
 
 void
@@ -3408,26 +3031,19 @@ __glXDispSwap_ColorTable(GLbyte * pc)
     const GLvoid *const table = (const GLvoid *) ((pc + 40));
     __GLXpixelHeader *const hdr = (__GLXpixelHeader *) (pc);
 
-    CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes));
-    CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_ROW_LENGTH,
-                      (GLint) bswap_CARD32(&hdr->rowLength)));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_SKIP_ROWS,
-                      (GLint) bswap_CARD32(&hdr->skipRows)));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_SKIP_PIXELS,
-                      (GLint) bswap_CARD32(&hdr->skipPixels)));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_ALIGNMENT,
-                      (GLint) bswap_CARD32(&hdr->alignment)));
-
-    CALL_ColorTable(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 20),
-                                     (GLenum) bswap_ENUM(pc + 24),
-                                     (GLsizei) bswap_CARD32(pc + 28),
-                                     (GLenum) bswap_ENUM(pc + 32),
-                                     (GLenum) bswap_ENUM(pc + 36), table));
+    glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes);
+    glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst);
+    glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32(&hdr->rowLength));
+    glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32(&hdr->skipRows));
+    glPixelStorei(GL_UNPACK_SKIP_PIXELS,
+                  (GLint) bswap_CARD32(&hdr->skipPixels));
+    glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32(&hdr->alignment));
+
+    glColorTable((GLenum) bswap_ENUM(pc + 20),
+                 (GLenum) bswap_ENUM(pc + 24),
+                 (GLsizei) bswap_CARD32(pc + 28),
+                 (GLenum) bswap_ENUM(pc + 32),
+                 (GLenum) bswap_ENUM(pc + 36), table);
 }
 
 void
@@ -3440,8 +3056,7 @@ __glXDispSwap_ColorTableParameterfv(GLbyte * pc)
         (const GLfloat *) bswap_32_array((uint32_t *) (pc + 8),
                                          __glColorTableParameterfv_size(pname));
 
-    CALL_ColorTableParameterfv(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                                pname, params));
+    glColorTableParameterfv((GLenum) bswap_ENUM(pc + 0), pname, params);
 }
 
 void
@@ -3454,19 +3069,17 @@ __glXDispSwap_ColorTableParameteriv(GLbyte * pc)
         (const GLint *) bswap_32_array((uint32_t *) (pc + 8),
                                        __glColorTableParameteriv_size(pname));
 
-    CALL_ColorTableParameteriv(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                                pname, params));
+    glColorTableParameteriv((GLenum) bswap_ENUM(pc + 0), pname, params);
 }
 
 void
 __glXDispSwap_CopyColorTable(GLbyte * pc)
 {
-    CALL_CopyColorTable(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                         (GLenum) bswap_ENUM(pc + 4),
-                                         (GLint) bswap_CARD32(pc + 8),
-                                         (GLint) bswap_CARD32(pc + 12),
-                                         (GLsizei) bswap_CARD32(pc + 16)
-                        ));
+    glCopyColorTable((GLenum) bswap_ENUM(pc + 0),
+                     (GLenum) bswap_ENUM(pc + 4),
+                     (GLint) bswap_CARD32(pc + 8),
+                     (GLint) bswap_CARD32(pc + 12),
+                     (GLsizei) bswap_CARD32(pc + 16));
 }
 
 int
@@ -3491,9 +3104,7 @@ __glXDispSwap_GetColorTableParameterfv(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetColorTableParameterfv(GET_DISPATCH(), ((GLenum)
-                                                       bswap_ENUM(pc + 0),
-                                                       pname, params));
+        glGetColorTableParameterfv((GLenum) bswap_ENUM(pc + 0), pname, params);
         (void) bswap_32_array((uint32_t *) params, compsize);
         __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
         error = Success;
@@ -3524,9 +3135,7 @@ __glXDispSwap_GetColorTableParameterfvSGI(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetColorTableParameterfv(GET_DISPATCH(), ((GLenum)
-                                                       bswap_ENUM(pc + 0),
-                                                       pname, params));
+        glGetColorTableParameterfv((GLenum) bswap_ENUM(pc + 0), pname, params);
         (void) bswap_32_array((uint32_t *) params, compsize);
         __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
         error = Success;
@@ -3557,9 +3166,7 @@ __glXDispSwap_GetColorTableParameteriv(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetColorTableParameteriv(GET_DISPATCH(), ((GLenum)
-                                                       bswap_ENUM(pc + 0),
-                                                       pname, params));
+        glGetColorTableParameteriv((GLenum) bswap_ENUM(pc + 0), pname, params);
         (void) bswap_32_array((uint32_t *) params, compsize);
         __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
         error = Success;
@@ -3590,9 +3197,7 @@ __glXDispSwap_GetColorTableParameterivSGI(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetColorTableParameteriv(GET_DISPATCH(), ((GLenum)
-                                                       bswap_ENUM(pc + 0),
-                                                       pname, params));
+        glGetColorTableParameteriv((GLenum) bswap_ENUM(pc + 0), pname, params);
         (void) bswap_32_array((uint32_t *) params, compsize);
         __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
         error = Success;
@@ -3607,37 +3212,29 @@ __glXDispSwap_ColorSubTable(GLbyte * pc)
     const GLvoid *const data = (const GLvoid *) ((pc + 40));
     __GLXpixelHeader *const hdr = (__GLXpixelHeader *) (pc);
 
-    CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes));
-    CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_ROW_LENGTH,
-                      (GLint) bswap_CARD32(&hdr->rowLength)));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_SKIP_ROWS,
-                      (GLint) bswap_CARD32(&hdr->skipRows)));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_SKIP_PIXELS,
-                      (GLint) bswap_CARD32(&hdr->skipPixels)));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_ALIGNMENT,
-                      (GLint) bswap_CARD32(&hdr->alignment)));
-
-    CALL_ColorSubTable(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 20),
-                                        (GLsizei) bswap_CARD32(pc + 24),
-                                        (GLsizei) bswap_CARD32(pc + 28),
-                                        (GLenum) bswap_ENUM(pc + 32),
-                                        (GLenum) bswap_ENUM(pc + 36), data));
+    glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes);
+    glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst);
+    glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32(&hdr->rowLength));
+    glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32(&hdr->skipRows));
+    glPixelStorei(GL_UNPACK_SKIP_PIXELS,
+                  (GLint) bswap_CARD32(&hdr->skipPixels));
+    glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32(&hdr->alignment));
+
+    glColorSubTable((GLenum) bswap_ENUM(pc + 20),
+                    (GLsizei) bswap_CARD32(pc + 24),
+                    (GLsizei) bswap_CARD32(pc + 28),
+                    (GLenum) bswap_ENUM(pc + 32),
+                    (GLenum) bswap_ENUM(pc + 36), data);
 }
 
 void
 __glXDispSwap_CopyColorSubTable(GLbyte * pc)
 {
-    CALL_CopyColorSubTable(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                            (GLsizei) bswap_CARD32(pc + 4),
-                                            (GLint) bswap_CARD32(pc + 8),
-                                            (GLint) bswap_CARD32(pc + 12),
-                                            (GLsizei) bswap_CARD32(pc + 16)
-                           ));
+    glCopyColorSubTable((GLenum) bswap_ENUM(pc + 0),
+                        (GLsizei) bswap_CARD32(pc + 4),
+                        (GLint) bswap_CARD32(pc + 8),
+                        (GLint) bswap_CARD32(pc + 12),
+                        (GLsizei) bswap_CARD32(pc + 16));
 }
 
 void
@@ -3646,27 +3243,19 @@ __glXDispSwap_ConvolutionFilter1D(GLbyte * pc)
     const GLvoid *const image = (const GLvoid *) ((pc + 44));
     __GLXpixelHeader *const hdr = (__GLXpixelHeader *) (pc);
 
-    CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes));
-    CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_ROW_LENGTH,
-                      (GLint) bswap_CARD32(&hdr->rowLength)));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_SKIP_ROWS,
-                      (GLint) bswap_CARD32(&hdr->skipRows)));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_SKIP_PIXELS,
-                      (GLint) bswap_CARD32(&hdr->skipPixels)));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_ALIGNMENT,
-                      (GLint) bswap_CARD32(&hdr->alignment)));
-
-    CALL_ConvolutionFilter1D(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 20),
-                                              (GLenum) bswap_ENUM(pc + 24),
-                                              (GLsizei) bswap_CARD32(pc + 28),
-                                              (GLenum) bswap_ENUM(pc + 36),
-                                              (GLenum) bswap_ENUM(pc + 40),
-                                              image));
+    glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes);
+    glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst);
+    glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32(&hdr->rowLength));
+    glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32(&hdr->skipRows));
+    glPixelStorei(GL_UNPACK_SKIP_PIXELS,
+                  (GLint) bswap_CARD32(&hdr->skipPixels));
+    glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32(&hdr->alignment));
+
+    glConvolutionFilter1D((GLenum) bswap_ENUM(pc + 20),
+                          (GLenum) bswap_ENUM(pc + 24),
+                          (GLsizei) bswap_CARD32(pc + 28),
+                          (GLenum) bswap_ENUM(pc + 36),
+                          (GLenum) bswap_ENUM(pc + 40), image);
 }
 
 void
@@ -3675,37 +3264,28 @@ __glXDispSwap_ConvolutionFilter2D(GLbyte * pc)
     const GLvoid *const image = (const GLvoid *) ((pc + 44));
     __GLXpixelHeader *const hdr = (__GLXpixelHeader *) (pc);
 
-    CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes));
-    CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_ROW_LENGTH,
-                      (GLint) bswap_CARD32(&hdr->rowLength)));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_SKIP_ROWS,
-                      (GLint) bswap_CARD32(&hdr->skipRows)));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_SKIP_PIXELS,
-                      (GLint) bswap_CARD32(&hdr->skipPixels)));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_ALIGNMENT,
-                      (GLint) bswap_CARD32(&hdr->alignment)));
-
-    CALL_ConvolutionFilter2D(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 20),
-                                              (GLenum) bswap_ENUM(pc + 24),
-                                              (GLsizei) bswap_CARD32(pc + 28),
-                                              (GLsizei) bswap_CARD32(pc + 32),
-                                              (GLenum) bswap_ENUM(pc + 36),
-                                              (GLenum) bswap_ENUM(pc + 40),
-                                              image));
+    glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes);
+    glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst);
+    glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32(&hdr->rowLength));
+    glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32(&hdr->skipRows));
+    glPixelStorei(GL_UNPACK_SKIP_PIXELS,
+                  (GLint) bswap_CARD32(&hdr->skipPixels));
+    glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32(&hdr->alignment));
+
+    glConvolutionFilter2D((GLenum) bswap_ENUM(pc + 20),
+                          (GLenum) bswap_ENUM(pc + 24),
+                          (GLsizei) bswap_CARD32(pc + 28),
+                          (GLsizei) bswap_CARD32(pc + 32),
+                          (GLenum) bswap_ENUM(pc + 36),
+                          (GLenum) bswap_ENUM(pc + 40), image);
 }
 
 void
 __glXDispSwap_ConvolutionParameterf(GLbyte * pc)
 {
-    CALL_ConvolutionParameterf(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                                (GLenum) bswap_ENUM(pc + 4),
-                                                (GLfloat) bswap_FLOAT32(pc + 8)
-                               ));
+    glConvolutionParameterf((GLenum) bswap_ENUM(pc + 0),
+                            (GLenum) bswap_ENUM(pc + 4),
+                            (GLfloat) bswap_FLOAT32(pc + 8));
 }
 
 void
@@ -3719,17 +3299,15 @@ __glXDispSwap_ConvolutionParameterfv(GLbyte * pc)
                                          __glConvolutionParameterfv_size
                                          (pname));
 
-    CALL_ConvolutionParameterfv(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                                 pname, params));
+    glConvolutionParameterfv((GLenum) bswap_ENUM(pc + 0), pname, params);
 }
 
 void
 __glXDispSwap_ConvolutionParameteri(GLbyte * pc)
 {
-    CALL_ConvolutionParameteri(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                                (GLenum) bswap_ENUM(pc + 4),
-                                                (GLint) bswap_CARD32(pc + 8)
-                               ));
+    glConvolutionParameteri((GLenum) bswap_ENUM(pc + 0),
+                            (GLenum) bswap_ENUM(pc + 4),
+                            (GLint) bswap_CARD32(pc + 8));
 }
 
 void
@@ -3742,34 +3320,28 @@ __glXDispSwap_ConvolutionParameteriv(GLbyte * pc)
         (const GLint *) bswap_32_array((uint32_t *) (pc + 8),
                                        __glConvolutionParameteriv_size(pname));
 
-    CALL_ConvolutionParameteriv(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                                 pname, params));
+    glConvolutionParameteriv((GLenum) bswap_ENUM(pc + 0), pname, params);
 }
 
 void
 __glXDispSwap_CopyConvolutionFilter1D(GLbyte * pc)
 {
-    CALL_CopyConvolutionFilter1D(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                                  (GLenum) bswap_ENUM(pc + 4),
-                                                  (GLint) bswap_CARD32(pc + 8),
-                                                  (GLint) bswap_CARD32(pc + 12),
-                                                  (GLsizei) bswap_CARD32(pc +
-                                                                         16)
-                                 ));
+    glCopyConvolutionFilter1D((GLenum) bswap_ENUM(pc + 0),
+                              (GLenum) bswap_ENUM(pc + 4),
+                              (GLint) bswap_CARD32(pc + 8),
+                              (GLint) bswap_CARD32(pc + 12),
+                              (GLsizei) bswap_CARD32(pc + 16));
 }
 
 void
 __glXDispSwap_CopyConvolutionFilter2D(GLbyte * pc)
 {
-    CALL_CopyConvolutionFilter2D(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                                  (GLenum) bswap_ENUM(pc + 4),
-                                                  (GLint) bswap_CARD32(pc + 8),
-                                                  (GLint) bswap_CARD32(pc + 12),
-                                                  (GLsizei) bswap_CARD32(pc +
-                                                                         16),
-                                                  (GLsizei) bswap_CARD32(pc +
-                                                                         20)
-                                 ));
+    glCopyConvolutionFilter2D((GLenum) bswap_ENUM(pc + 0),
+                              (GLenum) bswap_ENUM(pc + 4),
+                              (GLint) bswap_CARD32(pc + 8),
+                              (GLint) bswap_CARD32(pc + 12),
+                              (GLsizei) bswap_CARD32(pc + 16),
+                              (GLsizei) bswap_CARD32(pc + 20));
 }
 
 int
@@ -3794,9 +3366,7 @@ __glXDispSwap_GetConvolutionParameterfv(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetConvolutionParameterfv(GET_DISPATCH(), ((GLenum)
-                                                        bswap_ENUM(pc + 0),
-                                                        pname, params));
+        glGetConvolutionParameterfv((GLenum) bswap_ENUM(pc + 0), pname, params);
         (void) bswap_32_array((uint32_t *) params, compsize);
         __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
         error = Success;
@@ -3827,9 +3397,7 @@ __glXDispSwap_GetConvolutionParameterfvEXT(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetConvolutionParameterfv(GET_DISPATCH(), ((GLenum)
-                                                        bswap_ENUM(pc + 0),
-                                                        pname, params));
+        glGetConvolutionParameterfv((GLenum) bswap_ENUM(pc + 0), pname, params);
         (void) bswap_32_array((uint32_t *) params, compsize);
         __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
         error = Success;
@@ -3860,9 +3428,7 @@ __glXDispSwap_GetConvolutionParameteriv(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetConvolutionParameteriv(GET_DISPATCH(), ((GLenum)
-                                                        bswap_ENUM(pc + 0),
-                                                        pname, params));
+        glGetConvolutionParameteriv((GLenum) bswap_ENUM(pc + 0), pname, params);
         (void) bswap_32_array((uint32_t *) params, compsize);
         __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
         error = Success;
@@ -3893,9 +3459,7 @@ __glXDispSwap_GetConvolutionParameterivEXT(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetConvolutionParameteriv(GET_DISPATCH(), ((GLenum)
-                                                        bswap_ENUM(pc + 0),
-                                                        pname, params));
+        glGetConvolutionParameteriv((GLenum) bswap_ENUM(pc + 0), pname, params);
         (void) bswap_32_array((uint32_t *) params, compsize);
         __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
         error = Success;
@@ -3926,9 +3490,7 @@ __glXDispSwap_GetHistogramParameterfv(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetHistogramParameterfv(GET_DISPATCH(), ((GLenum)
-                                                      bswap_ENUM(pc + 0), pname,
-                                                      params));
+        glGetHistogramParameterfv((GLenum) bswap_ENUM(pc + 0), pname, params);
         (void) bswap_32_array((uint32_t *) params, compsize);
         __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
         error = Success;
@@ -3959,9 +3521,7 @@ __glXDispSwap_GetHistogramParameterfvEXT(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetHistogramParameterfv(GET_DISPATCH(), ((GLenum)
-                                                      bswap_ENUM(pc + 0), pname,
-                                                      params));
+        glGetHistogramParameterfv((GLenum) bswap_ENUM(pc + 0), pname, params);
         (void) bswap_32_array((uint32_t *) params, compsize);
         __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
         error = Success;
@@ -3992,9 +3552,7 @@ __glXDispSwap_GetHistogramParameteriv(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetHistogramParameteriv(GET_DISPATCH(), ((GLenum)
-                                                      bswap_ENUM(pc + 0), pname,
-                                                      params));
+        glGetHistogramParameteriv((GLenum) bswap_ENUM(pc + 0), pname, params);
         (void) bswap_32_array((uint32_t *) params, compsize);
         __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
         error = Success;
@@ -4025,9 +3583,7 @@ __glXDispSwap_GetHistogramParameterivEXT(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetHistogramParameteriv(GET_DISPATCH(), ((GLenum)
-                                                      bswap_ENUM(pc + 0), pname,
-                                                      params));
+        glGetHistogramParameteriv((GLenum) bswap_ENUM(pc + 0), pname, params);
         (void) bswap_32_array((uint32_t *) params, compsize);
         __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
         error = Success;
@@ -4058,8 +3614,7 @@ __glXDispSwap_GetMinmaxParameterfv(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetMinmaxParameterfv(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                                   pname, params));
+        glGetMinmaxParameterfv((GLenum) bswap_ENUM(pc + 0), pname, params);
         (void) bswap_32_array((uint32_t *) params, compsize);
         __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
         error = Success;
@@ -4090,8 +3645,7 @@ __glXDispSwap_GetMinmaxParameterfvEXT(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetMinmaxParameterfv(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                                   pname, params));
+        glGetMinmaxParameterfv((GLenum) bswap_ENUM(pc + 0), pname, params);
         (void) bswap_32_array((uint32_t *) params, compsize);
         __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
         error = Success;
@@ -4122,8 +3676,7 @@ __glXDispSwap_GetMinmaxParameteriv(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetMinmaxParameteriv(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                                   pname, params));
+        glGetMinmaxParameteriv((GLenum) bswap_ENUM(pc + 0), pname, params);
         (void) bswap_32_array((uint32_t *) params, compsize);
         __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
         error = Success;
@@ -4154,8 +3707,7 @@ __glXDispSwap_GetMinmaxParameterivEXT(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetMinmaxParameteriv(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                                   pname, params));
+        glGetMinmaxParameteriv((GLenum) bswap_ENUM(pc + 0), pname, params);
         (void) bswap_32_array((uint32_t *) params, compsize);
         __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
         error = Success;
@@ -4167,34 +3719,28 @@ __glXDispSwap_GetMinmaxParameterivEXT(__GLXclientState * cl, GLbyte * pc)
 void
 __glXDispSwap_Histogram(GLbyte * pc)
 {
-    CALL_Histogram(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                    (GLsizei) bswap_CARD32(pc + 4),
-                                    (GLenum) bswap_ENUM(pc + 8),
-                                    *(GLboolean *) (pc + 12)
-                   ));
+    glHistogram((GLenum) bswap_ENUM(pc + 0),
+                (GLsizei) bswap_CARD32(pc + 4),
+                (GLenum) bswap_ENUM(pc + 8), *(GLboolean *) (pc + 12));
 }
 
 void
 __glXDispSwap_Minmax(GLbyte * pc)
 {
-    CALL_Minmax(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                 (GLenum) bswap_ENUM(pc + 4),
-                                 *(GLboolean *) (pc + 8)
-                ));
+    glMinmax((GLenum) bswap_ENUM(pc + 0),
+             (GLenum) bswap_ENUM(pc + 4), *(GLboolean *) (pc + 8));
 }
 
 void
 __glXDispSwap_ResetHistogram(GLbyte * pc)
 {
-    CALL_ResetHistogram(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0)
-                        ));
+    glResetHistogram((GLenum) bswap_ENUM(pc + 0));
 }
 
 void
 __glXDispSwap_ResetMinmax(GLbyte * pc)
 {
-    CALL_ResetMinmax(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0)
-                     ));
+    glResetMinmax((GLenum) bswap_ENUM(pc + 0));
 }
 
 void
@@ -4205,36 +3751,27 @@ __glXDispSwap_TexImage3D(GLbyte * pc)
         (const GLvoid *) ((ptr_is_null != 0) ? NULL : (pc + 80));
     __GLXpixel3DHeader *const hdr = (__GLXpixel3DHeader *) (pc);
 
-    CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes));
-    CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_ROW_LENGTH,
-                      (GLint) bswap_CARD32(&hdr->rowLength)));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_IMAGE_HEIGHT,
-                      (GLint) bswap_CARD32(&hdr->imageHeight)));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_SKIP_ROWS,
-                      (GLint) bswap_CARD32(&hdr->skipRows)));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_SKIP_IMAGES,
-                      (GLint) bswap_CARD32(&hdr->skipImages)));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_SKIP_PIXELS,
-                      (GLint) bswap_CARD32(&hdr->skipPixels)));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_ALIGNMENT,
-                      (GLint) bswap_CARD32(&hdr->alignment)));
-
-    CALL_TexImage3D(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 36),
-                                     (GLint) bswap_CARD32(pc + 40),
-                                     (GLint) bswap_CARD32(pc + 44),
-                                     (GLsizei) bswap_CARD32(pc + 48),
-                                     (GLsizei) bswap_CARD32(pc + 52),
-                                     (GLsizei) bswap_CARD32(pc + 56),
-                                     (GLint) bswap_CARD32(pc + 64),
-                                     (GLenum) bswap_ENUM(pc + 68),
-                                     (GLenum) bswap_ENUM(pc + 72), pixels));
+    glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes);
+    glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst);
+    glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32(&hdr->rowLength));
+    glPixelStorei(GL_UNPACK_IMAGE_HEIGHT,
+                  (GLint) bswap_CARD32(&hdr->imageHeight));
+    glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32(&hdr->skipRows));
+    glPixelStorei(GL_UNPACK_SKIP_IMAGES,
+                  (GLint) bswap_CARD32(&hdr->skipImages));
+    glPixelStorei(GL_UNPACK_SKIP_PIXELS,
+                  (GLint) bswap_CARD32(&hdr->skipPixels));
+    glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32(&hdr->alignment));
+
+    glTexImage3D((GLenum) bswap_ENUM(pc + 36),
+                 (GLint) bswap_CARD32(pc + 40),
+                 (GLint) bswap_CARD32(pc + 44),
+                 (GLsizei) bswap_CARD32(pc + 48),
+                 (GLsizei) bswap_CARD32(pc + 52),
+                 (GLsizei) bswap_CARD32(pc + 56),
+                 (GLint) bswap_CARD32(pc + 64),
+                 (GLenum) bswap_ENUM(pc + 68),
+                 (GLenum) bswap_ENUM(pc + 72), pixels);
 }
 
 void
@@ -4243,63 +3780,52 @@ __glXDispSwap_TexSubImage3D(GLbyte * pc)
     const GLvoid *const pixels = (const GLvoid *) ((pc + 88));
     __GLXpixel3DHeader *const hdr = (__GLXpixel3DHeader *) (pc);
 
-    CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes));
-    CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_ROW_LENGTH,
-                      (GLint) bswap_CARD32(&hdr->rowLength)));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_IMAGE_HEIGHT,
-                      (GLint) bswap_CARD32(&hdr->imageHeight)));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_SKIP_ROWS,
-                      (GLint) bswap_CARD32(&hdr->skipRows)));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_SKIP_IMAGES,
-                      (GLint) bswap_CARD32(&hdr->skipImages)));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_SKIP_PIXELS,
-                      (GLint) bswap_CARD32(&hdr->skipPixels)));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_ALIGNMENT,
-                      (GLint) bswap_CARD32(&hdr->alignment)));
-
-    CALL_TexSubImage3D(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 36),
-                                        (GLint) bswap_CARD32(pc + 40),
-                                        (GLint) bswap_CARD32(pc + 44),
-                                        (GLint) bswap_CARD32(pc + 48),
-                                        (GLint) bswap_CARD32(pc + 52),
-                                        (GLsizei) bswap_CARD32(pc + 60),
-                                        (GLsizei) bswap_CARD32(pc + 64),
-                                        (GLsizei) bswap_CARD32(pc + 68),
-                                        (GLenum) bswap_ENUM(pc + 76),
-                                        (GLenum) bswap_ENUM(pc + 80), pixels));
+    glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes);
+    glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst);
+    glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32(&hdr->rowLength));
+    glPixelStorei(GL_UNPACK_IMAGE_HEIGHT,
+                  (GLint) bswap_CARD32(&hdr->imageHeight));
+    glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32(&hdr->skipRows));
+    glPixelStorei(GL_UNPACK_SKIP_IMAGES,
+                  (GLint) bswap_CARD32(&hdr->skipImages));
+    glPixelStorei(GL_UNPACK_SKIP_PIXELS,
+                  (GLint) bswap_CARD32(&hdr->skipPixels));
+    glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32(&hdr->alignment));
+
+    glTexSubImage3D((GLenum) bswap_ENUM(pc + 36),
+                    (GLint) bswap_CARD32(pc + 40),
+                    (GLint) bswap_CARD32(pc + 44),
+                    (GLint) bswap_CARD32(pc + 48),
+                    (GLint) bswap_CARD32(pc + 52),
+                    (GLsizei) bswap_CARD32(pc + 60),
+                    (GLsizei) bswap_CARD32(pc + 64),
+                    (GLsizei) bswap_CARD32(pc + 68),
+                    (GLenum) bswap_ENUM(pc + 76),
+                    (GLenum) bswap_ENUM(pc + 80), pixels);
 }
 
 void
 __glXDispSwap_CopyTexSubImage3D(GLbyte * pc)
 {
-    CALL_CopyTexSubImage3D(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                            (GLint) bswap_CARD32(pc + 4),
-                                            (GLint) bswap_CARD32(pc + 8),
-                                            (GLint) bswap_CARD32(pc + 12),
-                                            (GLint) bswap_CARD32(pc + 16),
-                                            (GLint) bswap_CARD32(pc + 20),
-                                            (GLint) bswap_CARD32(pc + 24),
-                                            (GLsizei) bswap_CARD32(pc + 28),
-                                            (GLsizei) bswap_CARD32(pc + 32)
-                           ));
+    glCopyTexSubImage3D((GLenum) bswap_ENUM(pc + 0),
+                        (GLint) bswap_CARD32(pc + 4),
+                        (GLint) bswap_CARD32(pc + 8),
+                        (GLint) bswap_CARD32(pc + 12),
+                        (GLint) bswap_CARD32(pc + 16),
+                        (GLint) bswap_CARD32(pc + 20),
+                        (GLint) bswap_CARD32(pc + 24),
+                        (GLsizei) bswap_CARD32(pc + 28),
+                        (GLsizei) bswap_CARD32(pc + 32));
 }
 
 void
-__glXDispSwap_ActiveTextureARB(GLbyte * pc)
+__glXDispSwap_ActiveTexture(GLbyte * pc)
 {
-    CALL_ActiveTextureARB(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0)
-                          ));
+    glActiveTextureARB((GLenum) bswap_ENUM(pc + 0));
 }
 
 void
-__glXDispSwap_MultiTexCoord1dvARB(GLbyte * pc)
+__glXDispSwap_MultiTexCoord1dv(GLbyte * pc)
 {
 #ifdef __GLX_ALIGN64
     if ((unsigned long) (pc) & 7) {
@@ -4308,49 +3834,37 @@ __glXDispSwap_MultiTexCoord1dvARB(GLbyte * pc)
     }
 #endif
 
-    CALL_MultiTexCoord1dvARB(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 8),
-                                              (const GLdouble *)
-                                              bswap_64_array((uint64_t *) (pc +
-                                                                           0),
-                                                             1)
-                             ));
+    glMultiTexCoord1dvARB((GLenum) bswap_ENUM(pc + 8),
+                          (const GLdouble *) bswap_64_array((uint64_t *) (pc + 0),
+                                                         1));
 }
 
 void
 __glXDispSwap_MultiTexCoord1fvARB(GLbyte * pc)
 {
-    CALL_MultiTexCoord1fvARB(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                              (const GLfloat *)
-                                              bswap_32_array((uint32_t *) (pc +
-                                                                           4),
-                                                             1)
-                             ));
+    glMultiTexCoord1fvARB((GLenum) bswap_ENUM(pc + 0),
+                          (const GLfloat *)
+                          bswap_32_array((uint32_t *) (pc + 4), 1));
 }
 
 void
-__glXDispSwap_MultiTexCoord1ivARB(GLbyte * pc)
+__glXDispSwap_MultiTexCoord1iv(GLbyte * pc)
 {
-    CALL_MultiTexCoord1ivARB(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                              (const GLint *)
-                                              bswap_32_array((uint32_t *) (pc +
-                                                                           4),
-                                                             1)
-                             ));
+    glMultiTexCoord1ivARB((GLenum) bswap_ENUM(pc + 0),
+                          (const GLint *) bswap_32_array((uint32_t *) (pc + 4),
+                                                         1));
 }
 
 void
-__glXDispSwap_MultiTexCoord1svARB(GLbyte * pc)
+__glXDispSwap_MultiTexCoord1sv(GLbyte * pc)
 {
-    CALL_MultiTexCoord1svARB(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                              (const GLshort *)
-                                              bswap_16_array((uint16_t *) (pc +
-                                                                           4),
-                                                             1)
-                             ));
+    glMultiTexCoord1svARB((GLenum) bswap_ENUM(pc + 0),
+                          (const GLshort *) bswap_16_array((uint16_t *) (pc + 4),
+                                                           1));
 }
 
 void
-__glXDispSwap_MultiTexCoord2dvARB(GLbyte * pc)
+__glXDispSwap_MultiTexCoord2dv(GLbyte * pc)
 {
 #ifdef __GLX_ALIGN64
     if ((unsigned long) (pc) & 7) {
@@ -4359,49 +3873,37 @@ __glXDispSwap_MultiTexCoord2dvARB(GLbyte * pc)
     }
 #endif
 
-    CALL_MultiTexCoord2dvARB(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 16),
-                                              (const GLdouble *)
-                                              bswap_64_array((uint64_t *) (pc +
-                                                                           0),
-                                                             2)
-                             ));
+    glMultiTexCoord2dvARB((GLenum) bswap_ENUM(pc + 16),
+                          (const GLdouble *) bswap_64_array((uint64_t *) (pc + 0),
+                                                            2));
 }
 
 void
 __glXDispSwap_MultiTexCoord2fvARB(GLbyte * pc)
 {
-    CALL_MultiTexCoord2fvARB(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                              (const GLfloat *)
-                                              bswap_32_array((uint32_t *) (pc +
-                                                                           4),
-                                                             2)
-                             ));
+    glMultiTexCoord2fvARB((GLenum) bswap_ENUM(pc + 0),
+                          (const GLfloat *)
+                          bswap_32_array((uint32_t *) (pc + 4), 2));
 }
 
 void
-__glXDispSwap_MultiTexCoord2ivARB(GLbyte * pc)
+__glXDispSwap_MultiTexCoord2iv(GLbyte * pc)
 {
-    CALL_MultiTexCoord2ivARB(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                              (const GLint *)
-                                              bswap_32_array((uint32_t *) (pc +
-                                                                           4),
-                                                             2)
-                             ));
+    glMultiTexCoord2ivARB((GLenum) bswap_ENUM(pc + 0),
+                          (const GLint *) bswap_32_array((uint32_t *) (pc + 4),
+                                                         2));
 }
 
 void
-__glXDispSwap_MultiTexCoord2svARB(GLbyte * pc)
+__glXDispSwap_MultiTexCoord2sv(GLbyte * pc)
 {
-    CALL_MultiTexCoord2svARB(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                              (const GLshort *)
-                                              bswap_16_array((uint16_t *) (pc +
-                                                                           4),
-                                                             2)
-                             ));
+    glMultiTexCoord2svARB((GLenum) bswap_ENUM(pc + 0),
+                          (const GLshort *) bswap_16_array((uint16_t *) (pc + 4),
+                                                           2));
 }
 
 void
-__glXDispSwap_MultiTexCoord3dvARB(GLbyte * pc)
+__glXDispSwap_MultiTexCoord3dv(GLbyte * pc)
 {
 #ifdef __GLX_ALIGN64
     if ((unsigned long) (pc) & 7) {
@@ -4410,49 +3912,37 @@ __glXDispSwap_MultiTexCoord3dvARB(GLbyte * pc)
     }
 #endif
 
-    CALL_MultiTexCoord3dvARB(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 24),
-                                              (const GLdouble *)
-                                              bswap_64_array((uint64_t *) (pc +
-                                                                           0),
-                                                             3)
-                             ));
+    glMultiTexCoord3dvARB((GLenum) bswap_ENUM(pc + 24),
+                          (const GLdouble *) bswap_64_array((uint64_t *) (pc + 0),
+                                                            3));
 }
 
 void
 __glXDispSwap_MultiTexCoord3fvARB(GLbyte * pc)
 {
-    CALL_MultiTexCoord3fvARB(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                              (const GLfloat *)
-                                              bswap_32_array((uint32_t *) (pc +
-                                                                           4),
-                                                             3)
-                             ));
+    glMultiTexCoord3fvARB((GLenum) bswap_ENUM(pc + 0),
+                          (const GLfloat *)
+                          bswap_32_array((uint32_t *) (pc + 4), 3));
 }
 
 void
-__glXDispSwap_MultiTexCoord3ivARB(GLbyte * pc)
+__glXDispSwap_MultiTexCoord3iv(GLbyte * pc)
 {
-    CALL_MultiTexCoord3ivARB(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                              (const GLint *)
-                                              bswap_32_array((uint32_t *) (pc +
-                                                                           4),
-                                                             3)
-                             ));
+    glMultiTexCoord3ivARB((GLenum) bswap_ENUM(pc + 0),
+                          (const GLint *) bswap_32_array((uint32_t *) (pc + 4),
+                                                         3));
 }
 
 void
-__glXDispSwap_MultiTexCoord3svARB(GLbyte * pc)
+__glXDispSwap_MultiTexCoord3sv(GLbyte * pc)
 {
-    CALL_MultiTexCoord3svARB(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                              (const GLshort *)
-                                              bswap_16_array((uint16_t *) (pc +
-                                                                           4),
-                                                             3)
-                             ));
+    glMultiTexCoord3svARB((GLenum) bswap_ENUM(pc + 0),
+                          (const GLshort *) bswap_16_array((uint16_t *) (pc + 4),
+                                                           3));
 }
 
 void
-__glXDispSwap_MultiTexCoord4dvARB(GLbyte * pc)
+__glXDispSwap_MultiTexCoord4dv(GLbyte * pc)
 {
 #ifdef __GLX_ALIGN64
     if ((unsigned long) (pc) & 7) {
@@ -4461,277 +3951,348 @@ __glXDispSwap_MultiTexCoord4dvARB(GLbyte * pc)
     }
 #endif
 
-    CALL_MultiTexCoord4dvARB(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 32),
-                                              (const GLdouble *)
-                                              bswap_64_array((uint64_t *) (pc +
-                                                                           0),
-                                                             4)
-                             ));
+    glMultiTexCoord4dvARB((GLenum) bswap_ENUM(pc + 32),
+                          (const GLdouble *) bswap_64_array((uint64_t *) (pc + 0),
+                                                            4));
 }
 
 void
 __glXDispSwap_MultiTexCoord4fvARB(GLbyte * pc)
 {
-    CALL_MultiTexCoord4fvARB(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                              (const GLfloat *)
-                                              bswap_32_array((uint32_t *) (pc +
-                                                                           4),
-                                                             4)
-                             ));
-}
-
-void
-__glXDispSwap_MultiTexCoord4ivARB(GLbyte * pc)
-{
-    CALL_MultiTexCoord4ivARB(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                              (const GLint *)
-                                              bswap_32_array((uint32_t *) (pc +
-                                                                           4),
-                                                             4)
-                             ));
+    glMultiTexCoord4fvARB((GLenum) bswap_ENUM(pc + 0),
+                          (const GLfloat *)
+                          bswap_32_array((uint32_t *) (pc + 4), 4));
 }
 
 void
-__glXDispSwap_MultiTexCoord4svARB(GLbyte * pc)
+__glXDispSwap_MultiTexCoord4iv(GLbyte * pc)
 {
-    CALL_MultiTexCoord4svARB(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                              (const GLshort *)
-                                              bswap_16_array((uint16_t *) (pc +
-                                                                           4),
-                                                             4)
-                             ));
+    glMultiTexCoord4ivARB((GLenum) bswap_ENUM(pc + 0),
+                          (const GLint *) bswap_32_array((uint32_t *) (pc + 4),
+                                                         4));
 }
 
 void
-__glXDispSwap_SampleCoverageARB(GLbyte * pc)
+__glXDispSwap_MultiTexCoord4sv(GLbyte * pc)
 {
-    CALL_SampleCoverageARB(GET_DISPATCH(), ((GLclampf) bswap_FLOAT32(pc + 0),
-                                            *(GLboolean *) (pc + 4)
-                           ));
+    glMultiTexCoord4svARB((GLenum) bswap_ENUM(pc + 0),
+                          (const GLshort *) bswap_16_array((uint16_t *) (pc + 4),
+                                                           4));
 }
 
 void
-__glXDispSwap_CompressedTexImage1DARB(GLbyte * pc)
+__glXDispSwap_CompressedTexImage1D(GLbyte * pc)
 {
+    PFNGLCOMPRESSEDTEXIMAGE1DPROC CompressedTexImage1D =
+        __glGetProcAddress("glCompressedTexImage1D");
     const GLsizei imageSize = (GLsizei) bswap_CARD32(pc + 20);
 
-    CALL_CompressedTexImage1DARB(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                                  (GLint) bswap_CARD32(pc + 4),
-                                                  (GLenum) bswap_ENUM(pc + 8),
-                                                  (GLsizei) bswap_CARD32(pc +
-                                                                         12),
-                                                  (GLint) bswap_CARD32(pc + 16),
-                                                  imageSize,
-                                                  (const GLvoid *) (pc + 24)
-                                 ));
+    CompressedTexImage1D((GLenum) bswap_ENUM(pc + 0),
+                         (GLint) bswap_CARD32(pc + 4),
+                         (GLenum) bswap_ENUM(pc + 8),
+                         (GLsizei) bswap_CARD32(pc + 12),
+                         (GLint) bswap_CARD32(pc + 16),
+                         imageSize, (const GLvoid *) (pc + 24));
 }
 
 void
-__glXDispSwap_CompressedTexImage2DARB(GLbyte * pc)
+__glXDispSwap_CompressedTexImage2D(GLbyte * pc)
 {
+    PFNGLCOMPRESSEDTEXIMAGE2DPROC CompressedTexImage2D =
+        __glGetProcAddress("glCompressedTexImage2D");
     const GLsizei imageSize = (GLsizei) bswap_CARD32(pc + 24);
 
-    CALL_CompressedTexImage2DARB(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                                  (GLint) bswap_CARD32(pc + 4),
-                                                  (GLenum) bswap_ENUM(pc + 8),
-                                                  (GLsizei) bswap_CARD32(pc +
-                                                                         12),
-                                                  (GLsizei) bswap_CARD32(pc +
-                                                                         16),
-                                                  (GLint) bswap_CARD32(pc + 20),
-                                                  imageSize,
-                                                  (const GLvoid *) (pc + 28)
-                                 ));
+    CompressedTexImage2D((GLenum) bswap_ENUM(pc + 0),
+                         (GLint) bswap_CARD32(pc + 4),
+                         (GLenum) bswap_ENUM(pc + 8),
+                         (GLsizei) bswap_CARD32(pc + 12),
+                         (GLsizei) bswap_CARD32(pc + 16),
+                         (GLint) bswap_CARD32(pc + 20),
+                         imageSize, (const GLvoid *) (pc + 28));
 }
 
 void
-__glXDispSwap_CompressedTexImage3DARB(GLbyte * pc)
+__glXDispSwap_CompressedTexImage3D(GLbyte * pc)
 {
+    PFNGLCOMPRESSEDTEXIMAGE3DPROC CompressedTexImage3D =
+        __glGetProcAddress("glCompressedTexImage3D");
     const GLsizei imageSize = (GLsizei) bswap_CARD32(pc + 28);
 
-    CALL_CompressedTexImage3DARB(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                                  (GLint) bswap_CARD32(pc + 4),
-                                                  (GLenum) bswap_ENUM(pc + 8),
-                                                  (GLsizei) bswap_CARD32(pc +
-                                                                         12),
-                                                  (GLsizei) bswap_CARD32(pc +
-                                                                         16),
-                                                  (GLsizei) bswap_CARD32(pc +
-                                                                         20),
-                                                  (GLint) bswap_CARD32(pc + 24),
-                                                  imageSize,
-                                                  (const GLvoid *) (pc + 32)
-                                 ));
+    CompressedTexImage3D((GLenum) bswap_ENUM(pc + 0),
+                         (GLint) bswap_CARD32(pc + 4),
+                         (GLenum) bswap_ENUM(pc + 8),
+                         (GLsizei) bswap_CARD32(pc + 12),
+                         (GLsizei) bswap_CARD32(pc + 16),
+                         (GLsizei) bswap_CARD32(pc + 20),
+                         (GLint) bswap_CARD32(pc + 24),
+                         imageSize, (const GLvoid *) (pc + 32));
 }
 
 void
-__glXDispSwap_CompressedTexSubImage1DARB(GLbyte * pc)
+__glXDispSwap_CompressedTexSubImage1D(GLbyte * pc)
 {
+    PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC CompressedTexSubImage1D =
+        __glGetProcAddress("glCompressedTexSubImage1D");
     const GLsizei imageSize = (GLsizei) bswap_CARD32(pc + 20);
 
-    CALL_CompressedTexSubImage1DARB(GET_DISPATCH(), ((GLenum)
-                                                     bswap_ENUM(pc + 0),
-                                                     (GLint) bswap_CARD32(pc +
-                                                                          4),
-                                                     (GLint) bswap_CARD32(pc +
-                                                                          8),
-                                                     (GLsizei) bswap_CARD32(pc +
-                                                                            12),
-                                                     (GLenum) bswap_ENUM(pc +
-                                                                         16),
-                                                     imageSize,
-                                                     (const GLvoid *) (pc + 24)
-                                    ));
+    CompressedTexSubImage1D((GLenum) bswap_ENUM(pc + 0),
+                            (GLint) bswap_CARD32(pc + 4),
+                            (GLint) bswap_CARD32(pc + 8),
+                            (GLsizei) bswap_CARD32(pc + 12),
+                            (GLenum) bswap_ENUM(pc + 16),
+                            imageSize, (const GLvoid *) (pc + 24));
 }
 
 void
-__glXDispSwap_CompressedTexSubImage2DARB(GLbyte * pc)
+__glXDispSwap_CompressedTexSubImage2D(GLbyte * pc)
 {
+    PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC CompressedTexSubImage2D =
+        __glGetProcAddress("glCompressedTexSubImage2D");
     const GLsizei imageSize = (GLsizei) bswap_CARD32(pc + 28);
 
-    CALL_CompressedTexSubImage2DARB(GET_DISPATCH(), ((GLenum)
-                                                     bswap_ENUM(pc + 0),
-                                                     (GLint) bswap_CARD32(pc +
-                                                                          4),
-                                                     (GLint) bswap_CARD32(pc +
-                                                                          8),
-                                                     (GLint) bswap_CARD32(pc +
-                                                                          12),
-                                                     (GLsizei) bswap_CARD32(pc +
-                                                                            16),
-                                                     (GLsizei) bswap_CARD32(pc +
-                                                                            20),
-                                                     (GLenum) bswap_ENUM(pc +
-                                                                         24),
-                                                     imageSize,
-                                                     (const GLvoid *) (pc + 32)
-                                    ));
+    CompressedTexSubImage2D((GLenum) bswap_ENUM(pc + 0),
+                            (GLint) bswap_CARD32(pc + 4),
+                            (GLint) bswap_CARD32(pc + 8),
+                            (GLint) bswap_CARD32(pc + 12),
+                            (GLsizei) bswap_CARD32(pc + 16),
+                            (GLsizei) bswap_CARD32(pc + 20),
+                            (GLenum) bswap_ENUM(pc + 24),
+                            imageSize, (const GLvoid *) (pc + 32));
 }
 
 void
-__glXDispSwap_CompressedTexSubImage3DARB(GLbyte * pc)
+__glXDispSwap_CompressedTexSubImage3D(GLbyte * pc)
 {
+    PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC CompressedTexSubImage3D =
+        __glGetProcAddress("glCompressedTexSubImage3D");
     const GLsizei imageSize = (GLsizei) bswap_CARD32(pc + 36);
 
-    CALL_CompressedTexSubImage3DARB(GET_DISPATCH(), ((GLenum)
-                                                     bswap_ENUM(pc + 0),
-                                                     (GLint) bswap_CARD32(pc +
-                                                                          4),
-                                                     (GLint) bswap_CARD32(pc +
-                                                                          8),
-                                                     (GLint) bswap_CARD32(pc +
-                                                                          12),
-                                                     (GLint) bswap_CARD32(pc +
-                                                                          16),
-                                                     (GLsizei) bswap_CARD32(pc +
-                                                                            20),
-                                                     (GLsizei) bswap_CARD32(pc +
-                                                                            24),
-                                                     (GLsizei) bswap_CARD32(pc +
-                                                                            28),
-                                                     (GLenum) bswap_ENUM(pc +
-                                                                         32),
-                                                     imageSize,
-                                                     (const GLvoid *) (pc + 40)
-                                    ));
+    CompressedTexSubImage3D((GLenum) bswap_ENUM(pc + 0),
+                            (GLint) bswap_CARD32(pc + 4),
+                            (GLint) bswap_CARD32(pc + 8),
+                            (GLint) bswap_CARD32(pc + 12),
+                            (GLint) bswap_CARD32(pc + 16),
+                            (GLsizei) bswap_CARD32(pc + 20),
+                            (GLsizei) bswap_CARD32(pc + 24),
+                            (GLsizei) bswap_CARD32(pc + 28),
+                            (GLenum) bswap_ENUM(pc + 32),
+                            imageSize, (const GLvoid *) (pc + 40));
 }
 
-int
-__glXDispSwap_GetProgramEnvParameterdvARB(__GLXclientState * cl, GLbyte * pc)
+void
+__glXDispSwap_SampleCoverage(GLbyte * pc)
 {
-    xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc;
-    int error;
-    __GLXcontext *const cx =
-        __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error);
+    PFNGLSAMPLECOVERAGEPROC SampleCoverage =
+        __glGetProcAddress("glSampleCoverage");
+    SampleCoverage((GLclampf) bswap_FLOAT32(pc + 0), *(GLboolean *) (pc + 4));
+}
 
-    pc += __GLX_VENDPRIV_HDR_SIZE;
-    if (cx != NULL) {
-        GLdouble params[4];
+void
+__glXDispSwap_BlendFuncSeparate(GLbyte * pc)
+{
+    PFNGLBLENDFUNCSEPARATEPROC BlendFuncSeparate =
+        __glGetProcAddress("glBlendFuncSeparate");
+    BlendFuncSeparate((GLenum) bswap_ENUM(pc + 0), (GLenum) bswap_ENUM(pc + 4),
+                      (GLenum) bswap_ENUM(pc + 8),
+                      (GLenum) bswap_ENUM(pc + 12));
+}
 
-        CALL_GetProgramEnvParameterdvARB(GET_DISPATCH(), ((GLenum)
-                                                          bswap_ENUM(pc + 0),
-                                                          (GLuint)
-                                                          bswap_CARD32(pc + 4),
-                                                          params));
-        (void) bswap_64_array((uint64_t *) params, 4);
-        __glXSendReplySwap(cl->client, params, 4, 8, GL_FALSE, 0);
-        error = Success;
+void
+__glXDispSwap_FogCoorddv(GLbyte * pc)
+{
+    PFNGLFOGCOORDDVPROC FogCoorddv = __glGetProcAddress("glFogCoorddv");
+
+#ifdef __GLX_ALIGN64
+    if ((unsigned long) (pc) & 7) {
+        (void) memmove(pc - 4, pc, 8);
+        pc -= 4;
     }
+#endif
 
-    return error;
+    FogCoorddv((const GLdouble *) bswap_64_array((uint64_t *) (pc + 0), 1));
 }
 
-int
-__glXDispSwap_GetProgramEnvParameterfvARB(__GLXclientState * cl, GLbyte * pc)
+void
+__glXDispSwap_PointParameterf(GLbyte * pc)
 {
-    xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc;
-    int error;
-    __GLXcontext *const cx =
-        __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error);
+    PFNGLPOINTPARAMETERFPROC PointParameterf =
+        __glGetProcAddress("glPointParameterf");
+    PointParameterf((GLenum) bswap_ENUM(pc + 0),
+                    (GLfloat) bswap_FLOAT32(pc + 4));
+}
 
-    pc += __GLX_VENDPRIV_HDR_SIZE;
-    if (cx != NULL) {
-        GLfloat params[4];
+void
+__glXDispSwap_PointParameterfv(GLbyte * pc)
+{
+    PFNGLPOINTPARAMETERFVPROC PointParameterfv =
+        __glGetProcAddress("glPointParameterfv");
+    const GLenum pname = (GLenum) bswap_ENUM(pc + 0);
+    const GLfloat *params;
 
-        CALL_GetProgramEnvParameterfvARB(GET_DISPATCH(), ((GLenum)
-                                                          bswap_ENUM(pc + 0),
-                                                          (GLuint)
-                                                          bswap_CARD32(pc + 4),
-                                                          params));
-        (void) bswap_32_array((uint32_t *) params, 4);
-        __glXSendReplySwap(cl->client, params, 4, 4, GL_FALSE, 0);
-        error = Success;
+    params =
+        (const GLfloat *) bswap_32_array((uint32_t *) (pc + 4),
+                                         __glPointParameterfv_size(pname));
+
+    PointParameterfv(pname, params);
+}
+
+void
+__glXDispSwap_PointParameteri(GLbyte * pc)
+{
+    PFNGLPOINTPARAMETERIPROC PointParameteri =
+        __glGetProcAddress("glPointParameteri");
+    PointParameteri((GLenum) bswap_ENUM(pc + 0), (GLint) bswap_CARD32(pc + 4));
+}
+
+void
+__glXDispSwap_PointParameteriv(GLbyte * pc)
+{
+    PFNGLPOINTPARAMETERIVPROC PointParameteriv =
+        __glGetProcAddress("glPointParameteriv");
+    const GLenum pname = (GLenum) bswap_ENUM(pc + 0);
+    const GLint *params;
+
+    params =
+        (const GLint *) bswap_32_array((uint32_t *) (pc + 4),
+                                       __glPointParameteriv_size(pname));
+
+    PointParameteriv(pname, params);
+}
+
+void
+__glXDispSwap_SecondaryColor3bv(GLbyte * pc)
+{
+    PFNGLSECONDARYCOLOR3BVPROC SecondaryColor3bv =
+        __glGetProcAddress("glSecondaryColor3bv");
+    SecondaryColor3bv((const GLbyte *) (pc + 0));
+}
+
+void
+__glXDispSwap_SecondaryColor3dv(GLbyte * pc)
+{
+    PFNGLSECONDARYCOLOR3DVPROC SecondaryColor3dv =
+        __glGetProcAddress("glSecondaryColor3dv");
+#ifdef __GLX_ALIGN64
+    if ((unsigned long) (pc) & 7) {
+        (void) memmove(pc - 4, pc, 24);
+        pc -= 4;
     }
+#endif
 
-    return error;
+    SecondaryColor3dv((const GLdouble *)
+                      bswap_64_array((uint64_t *) (pc + 0), 3));
+}
+
+void
+__glXDispSwap_SecondaryColor3iv(GLbyte * pc)
+{
+    PFNGLSECONDARYCOLOR3IVPROC SecondaryColor3iv =
+        __glGetProcAddress("glSecondaryColor3iv");
+    SecondaryColor3iv((const GLint *) bswap_32_array((uint32_t *) (pc + 0), 3));
+}
+
+void
+__glXDispSwap_SecondaryColor3sv(GLbyte * pc)
+{
+    PFNGLSECONDARYCOLOR3SVPROC SecondaryColor3sv =
+        __glGetProcAddress("glSecondaryColor3sv");
+    SecondaryColor3sv((const GLshort *)
+                      bswap_16_array((uint16_t *) (pc + 0), 3));
+}
+
+void
+__glXDispSwap_SecondaryColor3ubv(GLbyte * pc)
+{
+    PFNGLSECONDARYCOLOR3UBVPROC SecondaryColor3ubv =
+        __glGetProcAddress("glSecondaryColor3ubv");
+    SecondaryColor3ubv((const GLubyte *) (pc + 0));
+}
+
+void
+__glXDispSwap_SecondaryColor3uiv(GLbyte * pc)
+{
+    PFNGLSECONDARYCOLOR3UIVPROC SecondaryColor3uiv =
+        __glGetProcAddress("glSecondaryColor3uiv");
+    SecondaryColor3uiv((const GLuint *)
+                       bswap_32_array((uint32_t *) (pc + 0), 3));
+}
+
+void
+__glXDispSwap_SecondaryColor3usv(GLbyte * pc)
+{
+    PFNGLSECONDARYCOLOR3USVPROC SecondaryColor3usv =
+        __glGetProcAddress("glSecondaryColor3usv");
+    SecondaryColor3usv((const GLushort *)
+                       bswap_16_array((uint16_t *) (pc + 0), 3));
+}
+
+void
+__glXDispSwap_WindowPos3fv(GLbyte * pc)
+{
+    PFNGLWINDOWPOS3FVPROC WindowPos3fv = __glGetProcAddress("glWindowPos3fv");
+
+    WindowPos3fv((const GLfloat *) bswap_32_array((uint32_t *) (pc + 0), 3));
+}
+
+void
+__glXDispSwap_BeginQuery(GLbyte * pc)
+{
+    PFNGLBEGINQUERYPROC BeginQuery = __glGetProcAddress("glBeginQuery");
+
+    BeginQuery((GLenum) bswap_ENUM(pc + 0), (GLuint) bswap_CARD32(pc + 4));
 }
 
 int
-__glXDispSwap_GetProgramLocalParameterdvARB(__GLXclientState * cl, GLbyte * pc)
+__glXDispSwap_DeleteQueries(__GLXclientState * cl, GLbyte * pc)
 {
-    xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc;
+    PFNGLDELETEQUERIESPROC DeleteQueries =
+        __glGetProcAddress("glDeleteQueries");
+    xGLXSingleReq *const req = (xGLXSingleReq *) pc;
     int error;
     __GLXcontext *const cx =
         __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error);
 
-    pc += __GLX_VENDPRIV_HDR_SIZE;
+    pc += __GLX_SINGLE_HDR_SIZE;
     if (cx != NULL) {
-        GLdouble params[4];
+        const GLsizei n = (GLsizei) bswap_CARD32(pc + 0);
 
-        CALL_GetProgramLocalParameterdvARB(GET_DISPATCH(), ((GLenum)
-                                                            bswap_ENUM(pc + 0),
-                                                            (GLuint)
-                                                            bswap_CARD32(pc +
-                                                                         4),
-                                                            params));
-        (void) bswap_64_array((uint64_t *) params, 4);
-        __glXSendReplySwap(cl->client, params, 4, 8, GL_FALSE, 0);
+        DeleteQueries(n,
+                      (const GLuint *) bswap_32_array((uint32_t *) (pc + 4),
+                                                      0));
         error = Success;
     }
 
     return error;
 }
 
+void
+__glXDispSwap_EndQuery(GLbyte * pc)
+{
+    PFNGLENDQUERYPROC EndQuery = __glGetProcAddress("glEndQuery");
+
+    EndQuery((GLenum) bswap_ENUM(pc + 0));
+}
+
 int
-__glXDispSwap_GetProgramLocalParameterfvARB(__GLXclientState * cl, GLbyte * pc)
+__glXDispSwap_GenQueries(__GLXclientState * cl, GLbyte * pc)
 {
-    xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc;
+    PFNGLGENQUERIESPROC GenQueries = __glGetProcAddress("glGenQueries");
+    xGLXSingleReq *const req = (xGLXSingleReq *) pc;
     int error;
     __GLXcontext *const cx =
         __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error);
 
-    pc += __GLX_VENDPRIV_HDR_SIZE;
+    pc += __GLX_SINGLE_HDR_SIZE;
     if (cx != NULL) {
-        GLfloat params[4];
+        const GLsizei n = (GLsizei) bswap_CARD32(pc + 0);
 
-        CALL_GetProgramLocalParameterfvARB(GET_DISPATCH(), ((GLenum)
-                                                            bswap_ENUM(pc + 0),
-                                                            (GLuint)
-                                                            bswap_CARD32(pc +
-                                                                         4),
-                                                            params));
-        (void) bswap_32_array((uint32_t *) params, 4);
-        __glXSendReplySwap(cl->client, params, 4, 4, GL_FALSE, 0);
+        GLuint answerBuffer[200];
+        GLuint *ids =
+            __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer),
+                                 4);
+        GenQueries(n, ids);
+        (void) bswap_32_array((uint32_t *) ids, n);
+        __glXSendReplySwap(cl->client, ids, n, 4, GL_TRUE, 0);
         error = Success;
     }
 
@@ -4739,18 +4300,20 @@ __glXDispSwap_GetProgramLocalParameterfvARB(__GLXclientState * cl, GLbyte * pc)
 }
 
 int
-__glXDispSwap_GetProgramivARB(__GLXclientState * cl, GLbyte * pc)
+__glXDispSwap_GetQueryObjectiv(__GLXclientState * cl, GLbyte * pc)
 {
-    xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc;
+    PFNGLGETQUERYOBJECTIVPROC GetQueryObjectiv =
+        __glGetProcAddress("glGetQueryObjectiv");
+    xGLXSingleReq *const req = (xGLXSingleReq *) pc;
     int error;
     __GLXcontext *const cx =
         __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error);
 
-    pc += __GLX_VENDPRIV_HDR_SIZE;
+    pc += __GLX_SINGLE_HDR_SIZE;
     if (cx != NULL) {
         const GLenum pname = (GLenum) bswap_ENUM(pc + 4);
 
-        const GLuint compsize = __glGetProgramivARB_size(pname);
+        const GLuint compsize = __glGetQueryObjectiv_size(pname);
         GLint answerBuffer[200];
         GLint *params =
             __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer,
@@ -4760,8 +4323,7 @@ __glXDispSwap_GetProgramivARB(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetProgramivARB(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                              pname, params));
+        GetQueryObjectiv((GLuint) bswap_CARD32(pc + 0), pname, params);
         (void) bswap_32_array((uint32_t *) params, compsize);
         __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
         error = Success;
@@ -4771,32 +4333,32 @@ __glXDispSwap_GetProgramivARB(__GLXclientState * cl, GLbyte * pc)
 }
 
 int
-__glXDispSwap_GetVertexAttribdvARB(__GLXclientState * cl, GLbyte * pc)
+__glXDispSwap_GetQueryObjectuiv(__GLXclientState * cl, GLbyte * pc)
 {
-    xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc;
+    PFNGLGETQUERYOBJECTUIVPROC GetQueryObjectuiv =
+        __glGetProcAddress("glGetQueryObjectuiv");
+    xGLXSingleReq *const req = (xGLXSingleReq *) pc;
     int error;
     __GLXcontext *const cx =
         __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error);
 
-    pc += __GLX_VENDPRIV_HDR_SIZE;
+    pc += __GLX_SINGLE_HDR_SIZE;
     if (cx != NULL) {
         const GLenum pname = (GLenum) bswap_ENUM(pc + 4);
 
-        const GLuint compsize = __glGetVertexAttribdvARB_size(pname);
-        GLdouble answerBuffer[200];
-        GLdouble *params =
-            __glXGetAnswerBuffer(cl, compsize * 8, answerBuffer,
-                                 sizeof(answerBuffer), 8);
+        const GLuint compsize = __glGetQueryObjectuiv_size(pname);
+        GLuint answerBuffer[200];
+        GLuint *params =
+            __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer,
+                                 sizeof(answerBuffer), 4);
 
         if (params == NULL)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetVertexAttribdvARB(GET_DISPATCH(), ((GLuint)
-                                                   bswap_CARD32(pc + 0), pname,
-                                                   params));
-        (void) bswap_64_array((uint64_t *) params, compsize);
-        __glXSendReplySwap(cl->client, params, compsize, 8, GL_FALSE, 0);
+        GetQueryObjectuiv((GLuint) bswap_CARD32(pc + 0), pname, params);
+        (void) bswap_32_array((uint32_t *) params, compsize);
+        __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
         error = Success;
     }
 
@@ -4804,20 +4366,21 @@ __glXDispSwap_GetVertexAttribdvARB(__GLXclientState * cl, GLbyte * pc)
 }
 
 int
-__glXDispSwap_GetVertexAttribfvARB(__GLXclientState * cl, GLbyte * pc)
+__glXDispSwap_GetQueryiv(__GLXclientState * cl, GLbyte * pc)
 {
-    xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc;
+    PFNGLGETQUERYIVPROC GetQueryiv = __glGetProcAddress("glGetQueryiv");
+    xGLXSingleReq *const req = (xGLXSingleReq *) pc;
     int error;
     __GLXcontext *const cx =
         __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error);
 
-    pc += __GLX_VENDPRIV_HDR_SIZE;
+    pc += __GLX_SINGLE_HDR_SIZE;
     if (cx != NULL) {
         const GLenum pname = (GLenum) bswap_ENUM(pc + 4);
 
-        const GLuint compsize = __glGetVertexAttribfvARB_size(pname);
-        GLfloat answerBuffer[200];
-        GLfloat *params =
+        const GLuint compsize = __glGetQueryiv_size(pname);
+        GLint answerBuffer[200];
+        GLint *params =
             __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer,
                                  sizeof(answerBuffer), 4);
 
@@ -4825,9 +4388,7 @@ __glXDispSwap_GetVertexAttribfvARB(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetVertexAttribfvARB(GET_DISPATCH(), ((GLuint)
-                                                   bswap_CARD32(pc + 0), pname,
-                                                   params));
+        GetQueryiv((GLenum) bswap_ENUM(pc + 0), pname, params);
         (void) bswap_32_array((uint32_t *) params, compsize);
         __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
         error = Success;
@@ -4837,32 +4398,20 @@ __glXDispSwap_GetVertexAttribfvARB(__GLXclientState * cl, GLbyte * pc)
 }
 
 int
-__glXDispSwap_GetVertexAttribivARB(__GLXclientState * cl, GLbyte * pc)
+__glXDispSwap_IsQuery(__GLXclientState * cl, GLbyte * pc)
 {
-    xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc;
+    PFNGLISQUERYPROC IsQuery = __glGetProcAddress("glIsQuery");
+    xGLXSingleReq *const req = (xGLXSingleReq *) pc;
     int error;
     __GLXcontext *const cx =
         __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error);
 
-    pc += __GLX_VENDPRIV_HDR_SIZE;
+    pc += __GLX_SINGLE_HDR_SIZE;
     if (cx != NULL) {
-        const GLenum pname = (GLenum) bswap_ENUM(pc + 4);
-
-        const GLuint compsize = __glGetVertexAttribivARB_size(pname);
-        GLint answerBuffer[200];
-        GLint *params =
-            __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer,
-                                 sizeof(answerBuffer), 4);
-
-        if (params == NULL)
-            return BadAlloc;
-        __glXClearErrorOccured();
+        GLboolean retval;
 
-        CALL_GetVertexAttribivARB(GET_DISPATCH(), ((GLuint)
-                                                   bswap_CARD32(pc + 0), pname,
-                                                   params));
-        (void) bswap_32_array((uint32_t *) params, compsize);
-        __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
+        retval = IsQuery((GLuint) bswap_CARD32(pc + 0));
+        __glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval);
         error = Success;
     }
 
@@ -4870,87 +4419,28 @@ __glXDispSwap_GetVertexAttribivARB(__GLXclientState * cl, GLbyte * pc)
 }
 
 void
-__glXDispSwap_ProgramEnvParameter4dvARB(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
-    if ((unsigned long) (pc) & 7) {
-        (void) memmove(pc - 4, pc, 40);
-        pc -= 4;
-    }
-#endif
-
-    CALL_ProgramEnvParameter4dvARB(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                                    (GLuint) bswap_CARD32(pc +
-                                                                          4),
-                                                    (const GLdouble *)
-                                                    bswap_64_array((uint64_t
-                                                                    *) (pc + 8),
-                                                                   4)
-                                   ));
-}
-
-void
-__glXDispSwap_ProgramEnvParameter4fvARB(GLbyte * pc)
-{
-    CALL_ProgramEnvParameter4fvARB(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                                    (GLuint) bswap_CARD32(pc +
-                                                                          4),
-                                                    (const GLfloat *)
-                                                    bswap_32_array((uint32_t
-                                                                    *) (pc + 8),
-                                                                   4)
-                                   ));
-}
-
-void
-__glXDispSwap_ProgramLocalParameter4dvARB(GLbyte * pc)
-{
-#ifdef __GLX_ALIGN64
-    if ((unsigned long) (pc) & 7) {
-        (void) memmove(pc - 4, pc, 40);
-        pc -= 4;
-    }
-#endif
-
-    CALL_ProgramLocalParameter4dvARB(GET_DISPATCH(), ((GLenum)
-                                                      bswap_ENUM(pc + 0),
-                                                      (GLuint) bswap_CARD32(pc +
-                                                                            4),
-                                                      (const GLdouble *)
-                                                      bswap_64_array((uint64_t
-                                                                      *) (pc +
-                                                                          8), 4)
-                                     ));
-}
-
-void
-__glXDispSwap_ProgramLocalParameter4fvARB(GLbyte * pc)
+__glXDispSwap_BlendEquationSeparate(GLbyte * pc)
 {
-    CALL_ProgramLocalParameter4fvARB(GET_DISPATCH(), ((GLenum)
-                                                      bswap_ENUM(pc + 0),
-                                                      (GLuint) bswap_CARD32(pc +
-                                                                            4),
-                                                      (const GLfloat *)
-                                                      bswap_32_array((uint32_t
-                                                                      *) (pc +
-                                                                          8), 4)
-                                     ));
+    PFNGLBLENDEQUATIONSEPARATEPROC BlendEquationSeparate =
+        __glGetProcAddress("glBlendEquationSeparate");
+    BlendEquationSeparate((GLenum) bswap_ENUM(pc + 0),
+                          (GLenum) bswap_ENUM(pc + 4));
 }
 
 void
-__glXDispSwap_ProgramStringARB(GLbyte * pc)
+__glXDispSwap_DrawBuffers(GLbyte * pc)
 {
-    const GLsizei len = (GLsizei) bswap_CARD32(pc + 8);
+    PFNGLDRAWBUFFERSPROC DrawBuffers = __glGetProcAddress("glDrawBuffers");
+    const GLsizei n = (GLsizei) bswap_CARD32(pc + 0);
 
-    CALL_ProgramStringARB(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                           (GLenum) bswap_ENUM(pc + 4),
-                                           len, (const GLvoid *) (pc + 12)
-                          ));
+    DrawBuffers(n, (const GLenum *) bswap_32_array((uint32_t *) (pc + 4), 0));
 }
 
 void
-__glXDispSwap_VertexAttrib1dvARB(GLbyte * pc)
+__glXDispSwap_VertexAttrib1dv(GLbyte * pc)
 {
+    PFNGLVERTEXATTRIB1DVPROC VertexAttrib1dv =
+        __glGetProcAddress("glVertexAttrib1dv");
 #ifdef __GLX_ALIGN64
     if ((unsigned long) (pc) & 7) {
         (void) memmove(pc - 4, pc, 12);
@@ -4958,36 +4448,25 @@ __glXDispSwap_VertexAttrib1dvARB(GLbyte * pc)
     }
 #endif
 
-    CALL_VertexAttrib1dvARB(GET_DISPATCH(), ((GLuint) bswap_CARD32(pc + 0),
-                                             (const GLdouble *)
-                                             bswap_64_array((uint64_t *) (pc +
-                                                                          4), 1)
-                            ));
-}
-
-void
-__glXDispSwap_VertexAttrib1fvARB(GLbyte * pc)
-{
-    CALL_VertexAttrib1fvARB(GET_DISPATCH(), ((GLuint) bswap_CARD32(pc + 0),
-                                             (const GLfloat *)
-                                             bswap_32_array((uint32_t *) (pc +
-                                                                          4), 1)
-                            ));
+    VertexAttrib1dv((GLuint) bswap_CARD32(pc + 0),
+                    (const GLdouble *) bswap_64_array((uint64_t *) (pc + 4),
+                                                      1));
 }
 
 void
-__glXDispSwap_VertexAttrib1svARB(GLbyte * pc)
+__glXDispSwap_VertexAttrib1sv(GLbyte * pc)
 {
-    CALL_VertexAttrib1svARB(GET_DISPATCH(), ((GLuint) bswap_CARD32(pc + 0),
-                                             (const GLshort *)
-                                             bswap_16_array((uint16_t *) (pc +
-                                                                          4), 1)
-                            ));
+    PFNGLVERTEXATTRIB1SVPROC VertexAttrib1sv =
+        __glGetProcAddress("glVertexAttrib1sv");
+    VertexAttrib1sv((GLuint) bswap_CARD32(pc + 0),
+                    (const GLshort *) bswap_16_array((uint16_t *) (pc + 4), 1));
 }
 
 void
-__glXDispSwap_VertexAttrib2dvARB(GLbyte * pc)
+__glXDispSwap_VertexAttrib2dv(GLbyte * pc)
 {
+    PFNGLVERTEXATTRIB2DVPROC VertexAttrib2dv =
+        __glGetProcAddress("glVertexAttrib2dv");
 #ifdef __GLX_ALIGN64
     if ((unsigned long) (pc) & 7) {
         (void) memmove(pc - 4, pc, 20);
@@ -4995,36 +4474,25 @@ __glXDispSwap_VertexAttrib2dvARB(GLbyte * pc)
     }
 #endif
 
-    CALL_VertexAttrib2dvARB(GET_DISPATCH(), ((GLuint) bswap_CARD32(pc + 0),
-                                             (const GLdouble *)
-                                             bswap_64_array((uint64_t *) (pc +
-                                                                          4), 2)
-                            ));
-}
-
-void
-__glXDispSwap_VertexAttrib2fvARB(GLbyte * pc)
-{
-    CALL_VertexAttrib2fvARB(GET_DISPATCH(), ((GLuint) bswap_CARD32(pc + 0),
-                                             (const GLfloat *)
-                                             bswap_32_array((uint32_t *) (pc +
-                                                                          4), 2)
-                            ));
+    VertexAttrib2dv((GLuint) bswap_CARD32(pc + 0),
+                    (const GLdouble *) bswap_64_array((uint64_t *) (pc + 4),
+                                                      2));
 }
 
 void
-__glXDispSwap_VertexAttrib2svARB(GLbyte * pc)
+__glXDispSwap_VertexAttrib2sv(GLbyte * pc)
 {
-    CALL_VertexAttrib2svARB(GET_DISPATCH(), ((GLuint) bswap_CARD32(pc + 0),
-                                             (const GLshort *)
-                                             bswap_16_array((uint16_t *) (pc +
-                                                                          4), 2)
-                            ));
+    PFNGLVERTEXATTRIB2SVPROC VertexAttrib2sv =
+        __glGetProcAddress("glVertexAttrib2sv");
+    VertexAttrib2sv((GLuint) bswap_CARD32(pc + 0),
+                    (const GLshort *) bswap_16_array((uint16_t *) (pc + 4), 2));
 }
 
 void
-__glXDispSwap_VertexAttrib3dvARB(GLbyte * pc)
+__glXDispSwap_VertexAttrib3dv(GLbyte * pc)
 {
+    PFNGLVERTEXATTRIB3DVPROC VertexAttrib3dv =
+        __glGetProcAddress("glVertexAttrib3dv");
 #ifdef __GLX_ALIGN64
     if ((unsigned long) (pc) & 7) {
         (void) memmove(pc - 4, pc, 28);
@@ -5032,104 +4500,89 @@ __glXDispSwap_VertexAttrib3dvARB(GLbyte * pc)
     }
 #endif
 
-    CALL_VertexAttrib3dvARB(GET_DISPATCH(), ((GLuint) bswap_CARD32(pc + 0),
-                                             (const GLdouble *)
-                                             bswap_64_array((uint64_t *) (pc +
-                                                                          4), 3)
-                            ));
-}
-
-void
-__glXDispSwap_VertexAttrib3fvARB(GLbyte * pc)
-{
-    CALL_VertexAttrib3fvARB(GET_DISPATCH(), ((GLuint) bswap_CARD32(pc + 0),
-                                             (const GLfloat *)
-                                             bswap_32_array((uint32_t *) (pc +
-                                                                          4), 3)
-                            ));
+    VertexAttrib3dv((GLuint) bswap_CARD32(pc + 0),
+                    (const GLdouble *) bswap_64_array((uint64_t *) (pc + 4),
+                                                      3));
 }
 
 void
-__glXDispSwap_VertexAttrib3svARB(GLbyte * pc)
+__glXDispSwap_VertexAttrib3sv(GLbyte * pc)
 {
-    CALL_VertexAttrib3svARB(GET_DISPATCH(), ((GLuint) bswap_CARD32(pc + 0),
-                                             (const GLshort *)
-                                             bswap_16_array((uint16_t *) (pc +
-                                                                          4), 3)
-                            ));
+    PFNGLVERTEXATTRIB3SVPROC VertexAttrib3sv =
+        __glGetProcAddress("glVertexAttrib3sv");
+    VertexAttrib3sv((GLuint) bswap_CARD32(pc + 0),
+                    (const GLshort *) bswap_16_array((uint16_t *) (pc + 4), 3));
 }
 
 void
-__glXDispSwap_VertexAttrib4NbvARB(GLbyte * pc)
+__glXDispSwap_VertexAttrib4Nbv(GLbyte * pc)
 {
-    CALL_VertexAttrib4NbvARB(GET_DISPATCH(), ((GLuint) bswap_CARD32(pc + 0),
-                                              (const GLbyte *) (pc + 4)
-                             ));
+    PFNGLVERTEXATTRIB4NBVPROC VertexAttrib4Nbv =
+        __glGetProcAddress("glVertexAttrib4Nbv");
+    VertexAttrib4Nbv((GLuint) bswap_CARD32(pc + 0), (const GLbyte *) (pc + 4));
 }
 
 void
-__glXDispSwap_VertexAttrib4NivARB(GLbyte * pc)
+__glXDispSwap_VertexAttrib4Niv(GLbyte * pc)
 {
-    CALL_VertexAttrib4NivARB(GET_DISPATCH(), ((GLuint) bswap_CARD32(pc + 0),
-                                              (const GLint *)
-                                              bswap_32_array((uint32_t *) (pc +
-                                                                           4),
-                                                             4)
-                             ));
+    PFNGLVERTEXATTRIB4NIVPROC VertexAttrib4Niv =
+        __glGetProcAddress("glVertexAttrib4Niv");
+    VertexAttrib4Niv((GLuint) bswap_CARD32(pc + 0),
+                     (const GLint *) bswap_32_array((uint32_t *) (pc + 4), 4));
 }
 
 void
-__glXDispSwap_VertexAttrib4NsvARB(GLbyte * pc)
+__glXDispSwap_VertexAttrib4Nsv(GLbyte * pc)
 {
-    CALL_VertexAttrib4NsvARB(GET_DISPATCH(), ((GLuint) bswap_CARD32(pc + 0),
-                                              (const GLshort *)
-                                              bswap_16_array((uint16_t *) (pc +
-                                                                           4),
-                                                             4)
-                             ));
+    PFNGLVERTEXATTRIB4NSVPROC VertexAttrib4Nsv =
+        __glGetProcAddress("glVertexAttrib4Nsv");
+    VertexAttrib4Nsv((GLuint) bswap_CARD32(pc + 0),
+                     (const GLshort *) bswap_16_array((uint16_t *) (pc + 4),
+                                                      4));
 }
 
 void
-__glXDispSwap_VertexAttrib4NubvARB(GLbyte * pc)
+__glXDispSwap_VertexAttrib4Nubv(GLbyte * pc)
 {
-    CALL_VertexAttrib4NubvARB(GET_DISPATCH(), ((GLuint) bswap_CARD32(pc + 0),
-                                               (const GLubyte *) (pc + 4)
-                              ));
+    PFNGLVERTEXATTRIB4NUBVPROC VertexAttrib4Nubv =
+        __glGetProcAddress("glVertexAttrib4Nubv");
+    VertexAttrib4Nubv((GLuint) bswap_CARD32(pc + 0),
+                      (const GLubyte *) (pc + 4));
 }
 
 void
-__glXDispSwap_VertexAttrib4NuivARB(GLbyte * pc)
+__glXDispSwap_VertexAttrib4Nuiv(GLbyte * pc)
 {
-    CALL_VertexAttrib4NuivARB(GET_DISPATCH(), ((GLuint) bswap_CARD32(pc + 0),
-                                               (const GLuint *)
-                                               bswap_32_array((uint32_t *) (pc +
-                                                                            4),
-                                                              4)
-                              ));
+    PFNGLVERTEXATTRIB4NUIVPROC VertexAttrib4Nuiv =
+        __glGetProcAddress("glVertexAttrib4Nuiv");
+    VertexAttrib4Nuiv((GLuint) bswap_CARD32(pc + 0),
+                      (const GLuint *) bswap_32_array((uint32_t *) (pc + 4),
+                                                      4));
 }
 
 void
-__glXDispSwap_VertexAttrib4NusvARB(GLbyte * pc)
+__glXDispSwap_VertexAttrib4Nusv(GLbyte * pc)
 {
-    CALL_VertexAttrib4NusvARB(GET_DISPATCH(), ((GLuint) bswap_CARD32(pc + 0),
-                                               (const GLushort *)
-                                               bswap_16_array((uint16_t *) (pc +
-                                                                            4),
-                                                              4)
-                              ));
+    PFNGLVERTEXATTRIB4NUSVPROC VertexAttrib4Nusv =
+        __glGetProcAddress("glVertexAttrib4Nusv");
+    VertexAttrib4Nusv((GLuint) bswap_CARD32(pc + 0),
+                      (const GLushort *) bswap_16_array((uint16_t *) (pc + 4),
+                                                        4));
 }
 
 void
-__glXDispSwap_VertexAttrib4bvARB(GLbyte * pc)
+__glXDispSwap_VertexAttrib4bv(GLbyte * pc)
 {
-    CALL_VertexAttrib4bvARB(GET_DISPATCH(), ((GLuint) bswap_CARD32(pc + 0),
-                                             (const GLbyte *) (pc + 4)
-                            ));
+    PFNGLVERTEXATTRIB4BVPROC VertexAttrib4bv =
+        __glGetProcAddress("glVertexAttrib4bv");
+    VertexAttrib4bv((GLuint) bswap_CARD32(pc + 0), (const GLbyte *) (pc + 4));
 }
 
 void
-__glXDispSwap_VertexAttrib4dvARB(GLbyte * pc)
+__glXDispSwap_VertexAttrib4dv(GLbyte * pc)
 {
+    PFNGLVERTEXATTRIB4DVPROC VertexAttrib4dv =
+        __glGetProcAddress("glVertexAttrib4dv");
 #ifdef __GLX_ALIGN64
     if ((unsigned long) (pc) & 7) {
         (void) memmove(pc - 4, pc, 36);
@@ -5137,131 +4590,116 @@ __glXDispSwap_VertexAttrib4dvARB(GLbyte * pc)
     }
 #endif
 
-    CALL_VertexAttrib4dvARB(GET_DISPATCH(), ((GLuint) bswap_CARD32(pc + 0),
-                                             (const GLdouble *)
-                                             bswap_64_array((uint64_t *) (pc +
-                                                                          4), 4)
-                            ));
+    VertexAttrib4dv((GLuint) bswap_CARD32(pc + 0),
+                    (const GLdouble *) bswap_64_array((uint64_t *) (pc + 4),
+                                                      4));
 }
 
 void
-__glXDispSwap_VertexAttrib4fvARB(GLbyte * pc)
+__glXDispSwap_VertexAttrib4iv(GLbyte * pc)
 {
-    CALL_VertexAttrib4fvARB(GET_DISPATCH(), ((GLuint) bswap_CARD32(pc + 0),
-                                             (const GLfloat *)
-                                             bswap_32_array((uint32_t *) (pc +
-                                                                          4), 4)
-                            ));
+    PFNGLVERTEXATTRIB4IVPROC VertexAttrib4iv =
+        __glGetProcAddress("glVertexAttrib4iv");
+    VertexAttrib4iv((GLuint) bswap_CARD32(pc + 0),
+                    (const GLint *) bswap_32_array((uint32_t *) (pc + 4), 4));
 }
 
 void
-__glXDispSwap_VertexAttrib4ivARB(GLbyte * pc)
+__glXDispSwap_VertexAttrib4sv(GLbyte * pc)
 {
-    CALL_VertexAttrib4ivARB(GET_DISPATCH(), ((GLuint) bswap_CARD32(pc + 0),
-                                             (const GLint *)
-                                             bswap_32_array((uint32_t *) (pc +
-                                                                          4), 4)
-                            ));
+    PFNGLVERTEXATTRIB4SVPROC VertexAttrib4sv =
+        __glGetProcAddress("glVertexAttrib4sv");
+    VertexAttrib4sv((GLuint) bswap_CARD32(pc + 0),
+                    (const GLshort *) bswap_16_array((uint16_t *) (pc + 4), 4));
 }
 
 void
-__glXDispSwap_VertexAttrib4svARB(GLbyte * pc)
+__glXDispSwap_VertexAttrib4ubv(GLbyte * pc)
 {
-    CALL_VertexAttrib4svARB(GET_DISPATCH(), ((GLuint) bswap_CARD32(pc + 0),
-                                             (const GLshort *)
-                                             bswap_16_array((uint16_t *) (pc +
-                                                                          4), 4)
-                            ));
+    PFNGLVERTEXATTRIB4UBVPROC VertexAttrib4ubv =
+        __glGetProcAddress("glVertexAttrib4ubv");
+    VertexAttrib4ubv((GLuint) bswap_CARD32(pc + 0), (const GLubyte *) (pc + 4));
 }
 
 void
-__glXDispSwap_VertexAttrib4ubvARB(GLbyte * pc)
+__glXDispSwap_VertexAttrib4uiv(GLbyte * pc)
 {
-    CALL_VertexAttrib4ubvARB(GET_DISPATCH(), ((GLuint) bswap_CARD32(pc + 0),
-                                              (const GLubyte *) (pc + 4)
-                             ));
+    PFNGLVERTEXATTRIB4UIVPROC VertexAttrib4uiv =
+        __glGetProcAddress("glVertexAttrib4uiv");
+    VertexAttrib4uiv((GLuint) bswap_CARD32(pc + 0),
+                     (const GLuint *) bswap_32_array((uint32_t *) (pc + 4), 4));
 }
 
 void
-__glXDispSwap_VertexAttrib4uivARB(GLbyte * pc)
+__glXDispSwap_VertexAttrib4usv(GLbyte * pc)
 {
-    CALL_VertexAttrib4uivARB(GET_DISPATCH(), ((GLuint) bswap_CARD32(pc + 0),
-                                              (const GLuint *)
-                                              bswap_32_array((uint32_t *) (pc +
-                                                                           4),
-                                                             4)
-                             ));
+    PFNGLVERTEXATTRIB4USVPROC VertexAttrib4usv =
+        __glGetProcAddress("glVertexAttrib4usv");
+    VertexAttrib4usv((GLuint) bswap_CARD32(pc + 0),
+                     (const GLushort *) bswap_16_array((uint16_t *) (pc + 4),
+                                                       4));
 }
 
 void
-__glXDispSwap_VertexAttrib4usvARB(GLbyte * pc)
+__glXDispSwap_ClampColor(GLbyte * pc)
 {
-    CALL_VertexAttrib4usvARB(GET_DISPATCH(), ((GLuint) bswap_CARD32(pc + 0),
-                                              (const GLushort *)
-                                              bswap_16_array((uint16_t *) (pc +
-                                                                           4),
-                                                             4)
-                             ));
+    PFNGLCLAMPCOLORPROC ClampColor = __glGetProcAddress("glClampColor");
+
+    ClampColor((GLenum) bswap_ENUM(pc + 0), (GLenum) bswap_ENUM(pc + 4));
 }
 
 void
-__glXDispSwap_BeginQueryARB(GLbyte * pc)
+__glXDispSwap_BindProgramARB(GLbyte * pc)
 {
-    CALL_BeginQueryARB(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                        (GLuint) bswap_CARD32(pc + 4)
-                       ));
+    PFNGLBINDPROGRAMARBPROC BindProgramARB =
+        __glGetProcAddress("glBindProgramARB");
+    BindProgramARB((GLenum) bswap_ENUM(pc + 0), (GLuint) bswap_CARD32(pc + 4));
 }
 
 int
-__glXDispSwap_DeleteQueriesARB(__GLXclientState * cl, GLbyte * pc)
+__glXDispSwap_DeleteProgramsARB(__GLXclientState * cl, GLbyte * pc)
 {
-    xGLXSingleReq *const req = (xGLXSingleReq *) pc;
+    PFNGLDELETEPROGRAMSARBPROC DeleteProgramsARB =
+        __glGetProcAddress("glDeleteProgramsARB");
+    xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc;
     int error;
     __GLXcontext *const cx =
         __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error);
 
-    pc += __GLX_SINGLE_HDR_SIZE;
+    pc += __GLX_VENDPRIV_HDR_SIZE;
     if (cx != NULL) {
         const GLsizei n = (GLsizei) bswap_CARD32(pc + 0);
 
-        CALL_DeleteQueriesARB(GET_DISPATCH(), (n,
-                                               (const GLuint *)
-                                               bswap_32_array((uint32_t *) (pc +
-                                                                            4),
-                                                              0)
-                              ));
+        DeleteProgramsARB(n,
+                          (const GLuint *) bswap_32_array((uint32_t *) (pc + 4),
+                                                          0));
         error = Success;
     }
 
     return error;
 }
 
-void
-__glXDispSwap_EndQueryARB(GLbyte * pc)
-{
-    CALL_EndQueryARB(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0)
-                     ));
-}
-
 int
-__glXDispSwap_GenQueriesARB(__GLXclientState * cl, GLbyte * pc)
+__glXDispSwap_GenProgramsARB(__GLXclientState * cl, GLbyte * pc)
 {
-    xGLXSingleReq *const req = (xGLXSingleReq *) pc;
+    PFNGLGENPROGRAMSARBPROC GenProgramsARB =
+        __glGetProcAddress("glGenProgramsARB");
+    xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc;
     int error;
     __GLXcontext *const cx =
         __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error);
 
-    pc += __GLX_SINGLE_HDR_SIZE;
+    pc += __GLX_VENDPRIV_HDR_SIZE;
     if (cx != NULL) {
         const GLsizei n = (GLsizei) bswap_CARD32(pc + 0);
 
         GLuint answerBuffer[200];
-        GLuint *ids =
+        GLuint *programs =
             __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer),
                                  4);
-        CALL_GenQueriesARB(GET_DISPATCH(), (n, ids));
-        (void) bswap_32_array((uint32_t *) ids, n);
-        __glXSendReplySwap(cl->client, ids, n, 4, GL_TRUE, 0);
+        GenProgramsARB(n, programs);
+        (void) bswap_32_array((uint32_t *) programs, n);
+        __glXSendReplySwap(cl->client, programs, n, 4, GL_TRUE, 0);
         error = Success;
     }
 
@@ -5269,31 +4707,47 @@ __glXDispSwap_GenQueriesARB(__GLXclientState * cl, GLbyte * pc)
 }
 
 int
-__glXDispSwap_GetQueryObjectivARB(__GLXclientState * cl, GLbyte * pc)
+__glXDispSwap_GetProgramEnvParameterdvARB(__GLXclientState * cl, GLbyte * pc)
 {
-    xGLXSingleReq *const req = (xGLXSingleReq *) pc;
+    PFNGLGETPROGRAMENVPARAMETERDVARBPROC GetProgramEnvParameterdvARB =
+        __glGetProcAddress("glGetProgramEnvParameterdvARB");
+    xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc;
     int error;
     __GLXcontext *const cx =
         __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error);
 
-    pc += __GLX_SINGLE_HDR_SIZE;
+    pc += __GLX_VENDPRIV_HDR_SIZE;
     if (cx != NULL) {
-        const GLenum pname = (GLenum) bswap_ENUM(pc + 4);
+        GLdouble params[4];
 
-        const GLuint compsize = __glGetQueryObjectivARB_size(pname);
-        GLint answerBuffer[200];
-        GLint *params =
-            __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer,
-                                 sizeof(answerBuffer), 4);
+        GetProgramEnvParameterdvARB((GLenum) bswap_ENUM(pc + 0),
+                                    (GLuint) bswap_CARD32(pc + 4), params);
+        (void) bswap_64_array((uint64_t *) params, 4);
+        __glXSendReplySwap(cl->client, params, 4, 8, GL_FALSE, 0);
+        error = Success;
+    }
 
-        if (params == NULL)
-            return BadAlloc;
-        __glXClearErrorOccured();
+    return error;
+}
 
-        CALL_GetQueryObjectivARB(GET_DISPATCH(), ((GLuint) bswap_CARD32(pc + 0),
-                                                  pname, params));
-        (void) bswap_32_array((uint32_t *) params, compsize);
-        __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
+int
+__glXDispSwap_GetProgramEnvParameterfvARB(__GLXclientState * cl, GLbyte * pc)
+{
+    PFNGLGETPROGRAMENVPARAMETERFVARBPROC GetProgramEnvParameterfvARB =
+        __glGetProcAddress("glGetProgramEnvParameterfvARB");
+    xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc;
+    int error;
+    __GLXcontext *const cx =
+        __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error);
+
+    pc += __GLX_VENDPRIV_HDR_SIZE;
+    if (cx != NULL) {
+        GLfloat params[4];
+
+        GetProgramEnvParameterfvARB((GLenum) bswap_ENUM(pc + 0),
+                                    (GLuint) bswap_CARD32(pc + 4), params);
+        (void) bswap_32_array((uint32_t *) params, 4);
+        __glXSendReplySwap(cl->client, params, 4, 4, GL_FALSE, 0);
         error = Success;
     }
 
@@ -5301,32 +4755,47 @@ __glXDispSwap_GetQueryObjectivARB(__GLXclientState * cl, GLbyte * pc)
 }
 
 int
-__glXDispSwap_GetQueryObjectuivARB(__GLXclientState * cl, GLbyte * pc)
+__glXDispSwap_GetProgramLocalParameterdvARB(__GLXclientState * cl, GLbyte * pc)
 {
-    xGLXSingleReq *const req = (xGLXSingleReq *) pc;
+    PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC GetProgramLocalParameterdvARB =
+        __glGetProcAddress("glGetProgramLocalParameterdvARB");
+    xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc;
     int error;
     __GLXcontext *const cx =
         __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error);
 
-    pc += __GLX_SINGLE_HDR_SIZE;
+    pc += __GLX_VENDPRIV_HDR_SIZE;
     if (cx != NULL) {
-        const GLenum pname = (GLenum) bswap_ENUM(pc + 4);
+        GLdouble params[4];
 
-        const GLuint compsize = __glGetQueryObjectuivARB_size(pname);
-        GLuint answerBuffer[200];
-        GLuint *params =
-            __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer,
-                                 sizeof(answerBuffer), 4);
+        GetProgramLocalParameterdvARB((GLenum) bswap_ENUM(pc + 0),
+                                      (GLuint) bswap_CARD32(pc + 4), params);
+        (void) bswap_64_array((uint64_t *) params, 4);
+        __glXSendReplySwap(cl->client, params, 4, 8, GL_FALSE, 0);
+        error = Success;
+    }
 
-        if (params == NULL)
-            return BadAlloc;
-        __glXClearErrorOccured();
+    return error;
+}
 
-        CALL_GetQueryObjectuivARB(GET_DISPATCH(), ((GLuint)
-                                                   bswap_CARD32(pc + 0), pname,
-                                                   params));
-        (void) bswap_32_array((uint32_t *) params, compsize);
-        __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
+int
+__glXDispSwap_GetProgramLocalParameterfvARB(__GLXclientState * cl, GLbyte * pc)
+{
+    PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC GetProgramLocalParameterfvARB =
+        __glGetProcAddress("glGetProgramLocalParameterfvARB");
+    xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc;
+    int error;
+    __GLXcontext *const cx =
+        __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error);
+
+    pc += __GLX_VENDPRIV_HDR_SIZE;
+    if (cx != NULL) {
+        GLfloat params[4];
+
+        GetProgramLocalParameterfvARB((GLenum) bswap_ENUM(pc + 0),
+                                      (GLuint) bswap_CARD32(pc + 4), params);
+        (void) bswap_32_array((uint32_t *) params, 4);
+        __glXSendReplySwap(cl->client, params, 4, 4, GL_FALSE, 0);
         error = Success;
     }
 
@@ -5334,18 +4803,20 @@ __glXDispSwap_GetQueryObjectuivARB(__GLXclientState * cl, GLbyte * pc)
 }
 
 int
-__glXDispSwap_GetQueryivARB(__GLXclientState * cl, GLbyte * pc)
+__glXDispSwap_GetProgramivARB(__GLXclientState * cl, GLbyte * pc)
 {
-    xGLXSingleReq *const req = (xGLXSingleReq *) pc;
+    PFNGLGETPROGRAMIVARBPROC GetProgramivARB =
+        __glGetProcAddress("glGetProgramivARB");
+    xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc;
     int error;
     __GLXcontext *const cx =
         __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error);
 
-    pc += __GLX_SINGLE_HDR_SIZE;
+    pc += __GLX_VENDPRIV_HDR_SIZE;
     if (cx != NULL) {
         const GLenum pname = (GLenum) bswap_ENUM(pc + 4);
 
-        const GLuint compsize = __glGetQueryivARB_size(pname);
+        const GLuint compsize = __glGetProgramivARB_size(pname);
         GLint answerBuffer[200];
         GLint *params =
             __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer,
@@ -5355,8 +4826,7 @@ __glXDispSwap_GetQueryivARB(__GLXclientState * cl, GLbyte * pc)
             return BadAlloc;
         __glXClearErrorOccured();
 
-        CALL_GetQueryivARB(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                            pname, params));
+        GetProgramivARB((GLenum) bswap_ENUM(pc + 0), pname, params);
         (void) bswap_32_array((uint32_t *) params, compsize);
         __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
         error = Success;
@@ -5366,19 +4836,19 @@ __glXDispSwap_GetQueryivARB(__GLXclientState * cl, GLbyte * pc)
 }
 
 int
-__glXDispSwap_IsQueryARB(__GLXclientState * cl, GLbyte * pc)
+__glXDispSwap_IsProgramARB(__GLXclientState * cl, GLbyte * pc)
 {
-    xGLXSingleReq *const req = (xGLXSingleReq *) pc;
+    PFNGLISPROGRAMARBPROC IsProgramARB = __glGetProcAddress("glIsProgramARB");
+    xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc;
     int error;
     __GLXcontext *const cx =
         __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error);
 
-    pc += __GLX_SINGLE_HDR_SIZE;
+    pc += __GLX_VENDPRIV_HDR_SIZE;
     if (cx != NULL) {
         GLboolean retval;
 
-        retval = CALL_IsQueryARB(GET_DISPATCH(), ((GLuint) bswap_CARD32(pc + 0)
-                                 ));
+        retval = IsProgramARB((GLuint) bswap_CARD32(pc + 0));
         __glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval);
         error = Success;
     }
@@ -5387,206 +4857,152 @@ __glXDispSwap_IsQueryARB(__GLXclientState * cl, GLbyte * pc)
 }
 
 void
-__glXDispSwap_DrawBuffersARB(GLbyte * pc)
-{
-    const GLsizei n = (GLsizei) bswap_CARD32(pc + 0);
-
-    CALL_DrawBuffersARB(GET_DISPATCH(), (n,
-                                         (const GLenum *)
-                                         bswap_32_array((uint32_t *) (pc + 4),
-                                                        0)
-                        ));
-}
-
-void
-__glXDispSwap_ClampColorARB(GLbyte * pc)
-{
-    CALL_ClampColorARB(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                        (GLenum) bswap_ENUM(pc + 4)
-                       ));
-}
-
-void
-__glXDispSwap_RenderbufferStorageMultisample(GLbyte * pc)
-{
-    CALL_RenderbufferStorageMultisample(GET_DISPATCH(), ((GLenum)
-                                                         bswap_ENUM(pc + 0),
-                                                         (GLsizei)
-                                                         bswap_CARD32(pc + 4),
-                                                         (GLenum) bswap_ENUM(pc
-                                                                             +
-                                                                             8),
-                                                         (GLsizei)
-                                                         bswap_CARD32(pc + 12),
-                                                         (GLsizei)
-                                                         bswap_CARD32(pc + 16)
-                                        ));
-}
-
-void
-__glXDispSwap_SampleMaskSGIS(GLbyte * pc)
-{
-    CALL_SampleMaskSGIS(GET_DISPATCH(), ((GLclampf) bswap_FLOAT32(pc + 0),
-                                         *(GLboolean *) (pc + 4)
-                        ));
-}
-
-void
-__glXDispSwap_SamplePatternSGIS(GLbyte * pc)
-{
-    CALL_SamplePatternSGIS(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0)
-                           ));
-}
-
-void
-__glXDispSwap_PointParameterfEXT(GLbyte * pc)
-{
-    CALL_PointParameterfEXT(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                             (GLfloat) bswap_FLOAT32(pc + 4)
-                            ));
-}
-
-void
-__glXDispSwap_PointParameterfvEXT(GLbyte * pc)
+__glXDispSwap_ProgramEnvParameter4dvARB(GLbyte * pc)
 {
-    const GLenum pname = (GLenum) bswap_ENUM(pc + 0);
-    const GLfloat *params;
-
-    params =
-        (const GLfloat *) bswap_32_array((uint32_t *) (pc + 4),
-                                         __glPointParameterfvEXT_size(pname));
+    PFNGLPROGRAMENVPARAMETER4DVARBPROC ProgramEnvParameter4dvARB =
+        __glGetProcAddress("glProgramEnvParameter4dvARB");
+#ifdef __GLX_ALIGN64
+    if ((unsigned long) (pc) & 7) {
+        (void) memmove(pc - 4, pc, 40);
+        pc -= 4;
+    }
+#endif
 
-    CALL_PointParameterfvEXT(GET_DISPATCH(), (pname, params));
+    ProgramEnvParameter4dvARB((GLenum) bswap_ENUM(pc + 0),
+                              (GLuint) bswap_CARD32(pc + 4),
+                              (const GLdouble *)
+                              bswap_64_array((uint64_t *) (pc + 8), 4));
 }
 
 void
-__glXDispSwap_SecondaryColor3bvEXT(GLbyte * pc)
+__glXDispSwap_ProgramEnvParameter4fvARB(GLbyte * pc)
 {
-    CALL_SecondaryColor3bvEXT(GET_DISPATCH(), ((const GLbyte *) (pc + 0)
-                              ));
+    PFNGLPROGRAMENVPARAMETER4FVARBPROC ProgramEnvParameter4fvARB =
+        __glGetProcAddress("glProgramEnvParameter4fvARB");
+    ProgramEnvParameter4fvARB((GLenum) bswap_ENUM(pc + 0),
+                              (GLuint) bswap_CARD32(pc + 4),
+                              (const GLfloat *)
+                              bswap_32_array((uint32_t *) (pc + 8), 4));
 }
 
 void
-__glXDispSwap_SecondaryColor3dvEXT(GLbyte * pc)
+__glXDispSwap_ProgramLocalParameter4dvARB(GLbyte * pc)
 {
+    PFNGLPROGRAMLOCALPARAMETER4DVARBPROC ProgramLocalParameter4dvARB =
+        __glGetProcAddress("glProgramLocalParameter4dvARB");
 #ifdef __GLX_ALIGN64
     if ((unsigned long) (pc) & 7) {
-        (void) memmove(pc - 4, pc, 24);
+        (void) memmove(pc - 4, pc, 40);
         pc -= 4;
     }
 #endif
 
-    CALL_SecondaryColor3dvEXT(GET_DISPATCH(), ((const GLdouble *)
-                                               bswap_64_array((uint64_t *) (pc +
-                                                                            0),
-                                                              3)
-                              ));
+    ProgramLocalParameter4dvARB((GLenum) bswap_ENUM(pc + 0),
+                                (GLuint) bswap_CARD32(pc + 4),
+                                (const GLdouble *)
+                                bswap_64_array((uint64_t *) (pc + 8), 4));
 }
 
 void
-__glXDispSwap_SecondaryColor3fvEXT(GLbyte * pc)
+__glXDispSwap_ProgramLocalParameter4fvARB(GLbyte * pc)
 {
-    CALL_SecondaryColor3fvEXT(GET_DISPATCH(), ((const GLfloat *)
-                                               bswap_32_array((uint32_t *) (pc +
-                                                                            0),
-                                                              3)
-                              ));
+    PFNGLPROGRAMLOCALPARAMETER4FVARBPROC ProgramLocalParameter4fvARB =
+        __glGetProcAddress("glProgramLocalParameter4fvARB");
+    ProgramLocalParameter4fvARB((GLenum) bswap_ENUM(pc + 0),
+                                (GLuint) bswap_CARD32(pc + 4),
+                                (const GLfloat *)
+                                bswap_32_array((uint32_t *) (pc + 8), 4));
 }
 
 void
-__glXDispSwap_SecondaryColor3ivEXT(GLbyte * pc)
+__glXDispSwap_ProgramStringARB(GLbyte * pc)
 {
-    CALL_SecondaryColor3ivEXT(GET_DISPATCH(), ((const GLint *)
-                                               bswap_32_array((uint32_t *) (pc +
-                                                                            0),
-                                                              3)
-                              ));
-}
+    PFNGLPROGRAMSTRINGARBPROC ProgramStringARB =
+        __glGetProcAddress("glProgramStringARB");
+    const GLsizei len = (GLsizei) bswap_CARD32(pc + 8);
 
-void
-__glXDispSwap_SecondaryColor3svEXT(GLbyte * pc)
-{
-    CALL_SecondaryColor3svEXT(GET_DISPATCH(), ((const GLshort *)
-                                               bswap_16_array((uint16_t *) (pc +
-                                                                            0),
-                                                              3)
-                              ));
+    ProgramStringARB((GLenum) bswap_ENUM(pc + 0),
+                     (GLenum) bswap_ENUM(pc + 4),
+                     len, (const GLvoid *) (pc + 12));
 }
 
 void
-__glXDispSwap_SecondaryColor3ubvEXT(GLbyte * pc)
+__glXDispSwap_VertexAttrib1fvARB(GLbyte * pc)
 {
-    CALL_SecondaryColor3ubvEXT(GET_DISPATCH(), ((const GLubyte *) (pc + 0)
-                               ));
+    PFNGLVERTEXATTRIB1FVARBPROC VertexAttrib1fvARB =
+        __glGetProcAddress("glVertexAttrib1fvARB");
+    VertexAttrib1fvARB((GLuint) bswap_CARD32(pc + 0),
+                       (const GLfloat *) bswap_32_array((uint32_t *) (pc + 4),
+                                                        1));
 }
 
 void
-__glXDispSwap_SecondaryColor3uivEXT(GLbyte * pc)
+__glXDispSwap_VertexAttrib2fvARB(GLbyte * pc)
 {
-    CALL_SecondaryColor3uivEXT(GET_DISPATCH(), ((const GLuint *)
-                                                bswap_32_array((uint32_t *) (pc
-                                                                             +
-                                                                             0),
-                                                               3)
-                               ));
+    PFNGLVERTEXATTRIB2FVARBPROC VertexAttrib2fvARB =
+        __glGetProcAddress("glVertexAttrib2fvARB");
+    VertexAttrib2fvARB((GLuint) bswap_CARD32(pc + 0),
+                       (const GLfloat *) bswap_32_array((uint32_t *) (pc + 4),
+                                                        2));
 }
 
 void
-__glXDispSwap_SecondaryColor3usvEXT(GLbyte * pc)
+__glXDispSwap_VertexAttrib3fvARB(GLbyte * pc)
 {
-    CALL_SecondaryColor3usvEXT(GET_DISPATCH(), ((const GLushort *)
-                                                bswap_16_array((uint16_t *) (pc
-                                                                             +
-                                                                             0),
-                                                               3)
-                               ));
+    PFNGLVERTEXATTRIB3FVARBPROC VertexAttrib3fvARB =
+        __glGetProcAddress("glVertexAttrib3fvARB");
+    VertexAttrib3fvARB((GLuint) bswap_CARD32(pc + 0),
+                       (const GLfloat *) bswap_32_array((uint32_t *) (pc + 4),
+                                                        3));
 }
 
 void
-__glXDispSwap_FogCoorddvEXT(GLbyte * pc)
+__glXDispSwap_VertexAttrib4fvARB(GLbyte * pc)
 {
-#ifdef __GLX_ALIGN64
-    if ((unsigned long) (pc) & 7) {
-        (void) memmove(pc - 4, pc, 8);
-        pc -= 4;
-    }
-#endif
-
-    CALL_FogCoorddvEXT(GET_DISPATCH(), ((const GLdouble *)
-                                        bswap_64_array((uint64_t *) (pc + 0), 1)
-                       ));
+    PFNGLVERTEXATTRIB4FVARBPROC VertexAttrib4fvARB =
+        __glGetProcAddress("glVertexAttrib4fvARB");
+    VertexAttrib4fvARB((GLuint) bswap_CARD32(pc + 0),
+                       (const GLfloat *) bswap_32_array((uint32_t *) (pc + 4),
+                                                        4));
 }
 
 void
-__glXDispSwap_FogCoordfvEXT(GLbyte * pc)
+__glXDispSwap_BindFramebuffer(GLbyte * pc)
 {
-    CALL_FogCoordfvEXT(GET_DISPATCH(), ((const GLfloat *)
-                                        bswap_32_array((uint32_t *) (pc + 0), 1)
-                       ));
+    PFNGLBINDFRAMEBUFFERPROC BindFramebuffer =
+        __glGetProcAddress("glBindFramebuffer");
+    BindFramebuffer((GLenum) bswap_ENUM(pc + 0), (GLuint) bswap_CARD32(pc + 4));
 }
 
 void
-__glXDispSwap_BlendFuncSeparateEXT(GLbyte * pc)
+__glXDispSwap_BindRenderbuffer(GLbyte * pc)
 {
-    CALL_BlendFuncSeparateEXT(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                               (GLenum) bswap_ENUM(pc + 4),
-                                               (GLenum) bswap_ENUM(pc + 8),
-                                               (GLenum) bswap_ENUM(pc + 12)
-                              ));
+    PFNGLBINDRENDERBUFFERPROC BindRenderbuffer =
+        __glGetProcAddress("glBindRenderbuffer");
+    BindRenderbuffer((GLenum) bswap_ENUM(pc + 0),
+                     (GLuint) bswap_CARD32(pc + 4));
 }
 
 void
-__glXDispSwap_WindowPos3fvMESA(GLbyte * pc)
+__glXDispSwap_BlitFramebuffer(GLbyte * pc)
 {
-    CALL_WindowPos3fvMESA(GET_DISPATCH(), ((const GLfloat *)
-                                           bswap_32_array((uint32_t *) (pc + 0),
-                                                          3)
-                          ));
+    PFNGLBLITFRAMEBUFFERPROC BlitFramebuffer =
+        __glGetProcAddress("glBlitFramebuffer");
+    BlitFramebuffer((GLint) bswap_CARD32(pc + 0), (GLint) bswap_CARD32(pc + 4),
+                    (GLint) bswap_CARD32(pc + 8), (GLint) bswap_CARD32(pc + 12),
+                    (GLint) bswap_CARD32(pc + 16),
+                    (GLint) bswap_CARD32(pc + 20),
+                    (GLint) bswap_CARD32(pc + 24),
+                    (GLint) bswap_CARD32(pc + 28),
+                    (GLbitfield) bswap_CARD32(pc + 32),
+                    (GLenum) bswap_ENUM(pc + 36));
 }
 
 int
-__glXDispSwap_AreProgramsResidentNV(__GLXclientState * cl, GLbyte * pc)
+__glXDispSwap_CheckFramebufferStatus(__GLXclientState * cl, GLbyte * pc)
 {
+    PFNGLCHECKFRAMEBUFFERSTATUSPROC CheckFramebufferStatus =
+        __glGetProcAddress("glCheckFramebufferStatus");
     xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc;
     int error;
     __GLXcontext *const cx =
@@ -5594,19 +5010,10 @@ __glXDispSwap_AreProgramsResidentNV(__GLXclientState * cl, GLbyte * pc)
 
     pc += __GLX_VENDPRIV_HDR_SIZE;
     if (cx != NULL) {
-        const GLsizei n = (GLsizei) bswap_CARD32(pc + 0);
+        GLenum retval;
 
-        GLboolean retval;
-        GLboolean answerBuffer[200];
-        GLboolean *residences =
-            __glXGetAnswerBuffer(cl, n, answerBuffer, sizeof(answerBuffer), 1);
-        retval =
-            CALL_AreProgramsResidentNV(GET_DISPATCH(),
-                                       (n,
-                                        (const GLuint *)
-                                        bswap_32_array((uint32_t *) (pc + 4),
-                                                       0), residences));
-        __glXSendReplySwap(cl->client, residences, n, 1, GL_FALSE, retval);
+        retval = CheckFramebufferStatus((GLenum) bswap_ENUM(pc + 0));
+        __glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval);
         error = Success;
     }
 
@@ -5614,51 +5021,94 @@ __glXDispSwap_AreProgramsResidentNV(__GLXclientState * cl, GLbyte * pc)
 }
 
 void
-__glXDispSwap_BindProgramNV(GLbyte * pc)
+__glXDispSwap_DeleteFramebuffers(GLbyte * pc)
 {
-    CALL_BindProgramNV(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                        (GLuint) bswap_CARD32(pc + 4)
-                       ));
+    PFNGLDELETEFRAMEBUFFERSPROC DeleteFramebuffers =
+        __glGetProcAddress("glDeleteFramebuffers");
+    const GLsizei n = (GLsizei) bswap_CARD32(pc + 0);
+
+    DeleteFramebuffers(n,
+                       (const GLuint *) bswap_32_array((uint32_t *) (pc + 4),
+                                                       0));
 }
 
-int
-__glXDispSwap_DeleteProgramsNV(__GLXclientState * cl, GLbyte * pc)
+void
+__glXDispSwap_DeleteRenderbuffers(GLbyte * pc)
 {
-    xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc;
-    int error;
-    __GLXcontext *const cx =
-        __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error);
+    PFNGLDELETERENDERBUFFERSPROC DeleteRenderbuffers =
+        __glGetProcAddress("glDeleteRenderbuffers");
+    const GLsizei n = (GLsizei) bswap_CARD32(pc + 0);
 
-    pc += __GLX_VENDPRIV_HDR_SIZE;
-    if (cx != NULL) {
-        const GLsizei n = (GLsizei) bswap_CARD32(pc + 0);
+    DeleteRenderbuffers(n,
+                        (const GLuint *) bswap_32_array((uint32_t *) (pc + 4),
+                                                        0));
+}
 
-        CALL_DeleteProgramsNV(GET_DISPATCH(), (n,
-                                               (const GLuint *)
-                                               bswap_32_array((uint32_t *) (pc +
-                                                                            4),
-                                                              0)
-                              ));
-        error = Success;
-    }
+void
+__glXDispSwap_FramebufferRenderbuffer(GLbyte * pc)
+{
+    PFNGLFRAMEBUFFERRENDERBUFFERPROC FramebufferRenderbuffer =
+        __glGetProcAddress("glFramebufferRenderbuffer");
+    FramebufferRenderbuffer((GLenum) bswap_ENUM(pc + 0),
+                            (GLenum) bswap_ENUM(pc + 4),
+                            (GLenum) bswap_ENUM(pc + 8),
+                            (GLuint) bswap_CARD32(pc + 12));
+}
 
-    return error;
+void
+__glXDispSwap_FramebufferTexture1D(GLbyte * pc)
+{
+    PFNGLFRAMEBUFFERTEXTURE1DPROC FramebufferTexture1D =
+        __glGetProcAddress("glFramebufferTexture1D");
+    FramebufferTexture1D((GLenum) bswap_ENUM(pc + 0),
+                         (GLenum) bswap_ENUM(pc + 4),
+                         (GLenum) bswap_ENUM(pc + 8),
+                         (GLuint) bswap_CARD32(pc + 12),
+                         (GLint) bswap_CARD32(pc + 16));
+}
+
+void
+__glXDispSwap_FramebufferTexture2D(GLbyte * pc)
+{
+    PFNGLFRAMEBUFFERTEXTURE2DPROC FramebufferTexture2D =
+        __glGetProcAddress("glFramebufferTexture2D");
+    FramebufferTexture2D((GLenum) bswap_ENUM(pc + 0),
+                         (GLenum) bswap_ENUM(pc + 4),
+                         (GLenum) bswap_ENUM(pc + 8),
+                         (GLuint) bswap_CARD32(pc + 12),
+                         (GLint) bswap_CARD32(pc + 16));
+}
+
+void
+__glXDispSwap_FramebufferTexture3D(GLbyte * pc)
+{
+    PFNGLFRAMEBUFFERTEXTURE3DPROC FramebufferTexture3D =
+        __glGetProcAddress("glFramebufferTexture3D");
+    FramebufferTexture3D((GLenum) bswap_ENUM(pc + 0),
+                         (GLenum) bswap_ENUM(pc + 4),
+                         (GLenum) bswap_ENUM(pc + 8),
+                         (GLuint) bswap_CARD32(pc + 12),
+                         (GLint) bswap_CARD32(pc + 16),
+                         (GLint) bswap_CARD32(pc + 20));
 }
 
 void
-__glXDispSwap_ExecuteProgramNV(GLbyte * pc)
+__glXDispSwap_FramebufferTextureLayer(GLbyte * pc)
 {
-    CALL_ExecuteProgramNV(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                           (GLuint) bswap_CARD32(pc + 4),
-                                           (const GLfloat *)
-                                           bswap_32_array((uint32_t *) (pc + 8),
-                                                          4)
-                          ));
+    PFNGLFRAMEBUFFERTEXTURELAYERPROC FramebufferTextureLayer =
+        __glGetProcAddress("glFramebufferTextureLayer");
+    FramebufferTextureLayer((GLenum) bswap_ENUM(pc + 0),
+                            (GLenum) bswap_ENUM(pc + 4),
+                            (GLuint) bswap_CARD32(pc + 8),
+                            (GLint) bswap_CARD32(pc + 12),
+                            (GLint) bswap_CARD32(pc + 16));
 }
 
 int
-__glXDispSwap_GenProgramsNV(__GLXclientState * cl, GLbyte * pc)
+__glXDispSwap_GenFramebuffers(__GLXclientState * cl, GLbyte * pc)
 {
+    PFNGLGENFRAMEBUFFERSPROC GenFramebuffers =
+        __glGetProcAddress("glGenFramebuffers");
     xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc;
     int error;
     __GLXcontext *const cx =
@@ -5669,12 +5119,12 @@ __glXDispSwap_GenProgramsNV(__GLXclientState * cl, GLbyte * pc)
         const GLsizei n = (GLsizei) bswap_CARD32(pc + 0);
 
         GLuint answerBuffer[200];
-        GLuint *programs =
+        GLuint *framebuffers =
             __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer),
                                  4);
-        CALL_GenProgramsNV(GET_DISPATCH(), (n, programs));
-        (void) bswap_32_array((uint32_t *) programs, n);
-        __glXSendReplySwap(cl->client, programs, n, 4, GL_TRUE, 0);
+        GenFramebuffers(n, framebuffers);
+        (void) bswap_32_array((uint32_t *) framebuffers, n);
+        __glXSendReplySwap(cl->client, framebuffers, n, 4, GL_TRUE, 0);
         error = Success;
     }
 
@@ -5682,8 +5132,10 @@ __glXDispSwap_GenProgramsNV(__GLXclientState * cl, GLbyte * pc)
 }
 
 int
-__glXDispSwap_GetProgramParameterdvNV(__GLXclientState * cl, GLbyte * pc)
+__glXDispSwap_GenRenderbuffers(__GLXclientState * cl, GLbyte * pc)
 {
+    PFNGLGENRENDERBUFFERSPROC GenRenderbuffers =
+        __glGetProcAddress("glGenRenderbuffers");
     xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc;
     int error;
     __GLXcontext *const cx =
@@ -5691,26 +5143,36 @@ __glXDispSwap_GetProgramParameterdvNV(__GLXclientState * cl, GLbyte * pc)
 
     pc += __GLX_VENDPRIV_HDR_SIZE;
     if (cx != NULL) {
-        GLdouble params[4];
+        const GLsizei n = (GLsizei) bswap_CARD32(pc + 0);
 
-        CALL_GetProgramParameterdvNV(GET_DISPATCH(), ((GLenum)
-                                                      bswap_ENUM(pc + 0),
-                                                      (GLuint) bswap_CARD32(pc +
-                                                                            4),
-                                                      (GLenum) bswap_ENUM(pc +
-                                                                          8),
-                                                      params));
-        (void) bswap_64_array((uint64_t *) params, 4);
-        __glXSendReplySwap(cl->client, params, 4, 8, GL_FALSE, 0);
+        GLuint answerBuffer[200];
+        GLuint *renderbuffers =
+            __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer),
+                                 4);
+        GenRenderbuffers(n, renderbuffers);
+        (void) bswap_32_array((uint32_t *) renderbuffers, n);
+        __glXSendReplySwap(cl->client, renderbuffers, n, 4, GL_TRUE, 0);
         error = Success;
     }
 
     return error;
 }
 
+void
+__glXDispSwap_GenerateMipmap(GLbyte * pc)
+{
+    PFNGLGENERATEMIPMAPPROC GenerateMipmap =
+        __glGetProcAddress("glGenerateMipmap");
+    GenerateMipmap((GLenum) bswap_ENUM(pc + 0));
+}
+
 int
-__glXDispSwap_GetProgramParameterfvNV(__GLXclientState * cl, GLbyte * pc)
+__glXDispSwap_GetFramebufferAttachmentParameteriv(__GLXclientState * cl,
+                                                  GLbyte * pc)
 {
+    PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC
+        GetFramebufferAttachmentParameteriv =
+        __glGetProcAddress("glGetFramebufferAttachmentParameteriv");
     xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc;
     int error;
     __GLXcontext *const cx =
@@ -5718,17 +5180,14 @@ __glXDispSwap_GetProgramParameterfvNV(__GLXclientState * cl, GLbyte * pc)
 
     pc += __GLX_VENDPRIV_HDR_SIZE;
     if (cx != NULL) {
-        GLfloat params[4];
+        GLint params[1];
 
-        CALL_GetProgramParameterfvNV(GET_DISPATCH(), ((GLenum)
-                                                      bswap_ENUM(pc + 0),
-                                                      (GLuint) bswap_CARD32(pc +
-                                                                            4),
-                                                      (GLenum) bswap_ENUM(pc +
-                                                                          8),
-                                                      params));
-        (void) bswap_32_array((uint32_t *) params, 4);
-        __glXSendReplySwap(cl->client, params, 4, 4, GL_FALSE, 0);
+        GetFramebufferAttachmentParameteriv((GLenum) bswap_ENUM(pc + 0),
+                                            (GLenum) bswap_ENUM(pc + 4),
+                                            (GLenum) bswap_ENUM(pc + 8),
+                                            params);
+        (void) bswap_32_array((uint32_t *) params, 1);
+        __glXSendReplySwap(cl->client, params, 1, 4, GL_FALSE, 0);
         error = Success;
     }
 
@@ -5736,8 +5195,10 @@ __glXDispSwap_GetProgramParameterfvNV(__GLXclientState * cl, GLbyte * pc)
 }
 
 int
-__glXDispSwap_GetProgramivNV(__GLXclientState * cl, GLbyte * pc)
+__glXDispSwap_GetRenderbufferParameteriv(__GLXclientState * cl, GLbyte * pc)
 {
+    PFNGLGETRENDERBUFFERPARAMETERIVPROC GetRenderbufferParameteriv =
+        __glGetProcAddress("glGetRenderbufferParameteriv");
     xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc;
     int error;
     __GLXcontext *const cx =
@@ -5745,22 +5206,12 @@ __glXDispSwap_GetProgramivNV(__GLXclientState * cl, GLbyte * pc)
 
     pc += __GLX_VENDPRIV_HDR_SIZE;
     if (cx != NULL) {
-        const GLenum pname = (GLenum) bswap_ENUM(pc + 4);
-
-        const GLuint compsize = __glGetProgramivNV_size(pname);
-        GLint answerBuffer[200];
-        GLint *params =
-            __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer,
-                                 sizeof(answerBuffer), 4);
-
-        if (params == NULL)
-            return BadAlloc;
-        __glXClearErrorOccured();
+        GLint params[1];
 
-        CALL_GetProgramivNV(GET_DISPATCH(), ((GLuint) bswap_CARD32(pc + 0),
-                                             pname, params));
-        (void) bswap_32_array((uint32_t *) params, compsize);
-        __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
+        GetRenderbufferParameteriv((GLenum) bswap_ENUM(pc + 0),
+                                   (GLenum) bswap_ENUM(pc + 4), params);
+        (void) bswap_32_array((uint32_t *) params, 1);
+        __glXSendReplySwap(cl->client, params, 1, 4, GL_FALSE, 0);
         error = Success;
     }
 
@@ -5768,8 +5219,10 @@ __glXDispSwap_GetProgramivNV(__GLXclientState * cl, GLbyte * pc)
 }
 
 int
-__glXDispSwap_GetTrackMatrixivNV(__GLXclientState * cl, GLbyte * pc)
+__glXDispSwap_IsFramebuffer(__GLXclientState * cl, GLbyte * pc)
 {
+    PFNGLISFRAMEBUFFERPROC IsFramebuffer =
+        __glGetProcAddress("glIsFramebuffer");
     xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc;
     int error;
     __GLXcontext *const cx =
@@ -5777,14 +5230,10 @@ __glXDispSwap_GetTrackMatrixivNV(__GLXclientState * cl, GLbyte * pc)
 
     pc += __GLX_VENDPRIV_HDR_SIZE;
     if (cx != NULL) {
-        GLint params[1];
+        GLboolean retval;
 
-        CALL_GetTrackMatrixivNV(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                                 (GLuint) bswap_CARD32(pc + 4),
-                                                 (GLenum) bswap_ENUM(pc + 8),
-                                                 params));
-        (void) bswap_32_array((uint32_t *) params, 1);
-        __glXSendReplySwap(cl->client, params, 1, 4, GL_FALSE, 0);
+        retval = IsFramebuffer((GLuint) bswap_CARD32(pc + 0));
+        __glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval);
         error = Success;
     }
 
@@ -5792,8 +5241,10 @@ __glXDispSwap_GetTrackMatrixivNV(__GLXclientState * cl, GLbyte * pc)
 }
 
 int
-__glXDispSwap_GetVertexAttribdvNV(__GLXclientState * cl, GLbyte * pc)
+__glXDispSwap_IsRenderbuffer(__GLXclientState * cl, GLbyte * pc)
 {
+    PFNGLISRENDERBUFFERPROC IsRenderbuffer =
+        __glGetProcAddress("glIsRenderbuffer");
     xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc;
     int error;
     __GLXcontext *const cx =
@@ -5801,191 +5252,61 @@ __glXDispSwap_GetVertexAttribdvNV(__GLXclientState * cl, GLbyte * pc)
 
     pc += __GLX_VENDPRIV_HDR_SIZE;
     if (cx != NULL) {
-        const GLenum pname = (GLenum) bswap_ENUM(pc + 4);
-
-        const GLuint compsize = __glGetVertexAttribdvNV_size(pname);
-        GLdouble answerBuffer[200];
-        GLdouble *params =
-            __glXGetAnswerBuffer(cl, compsize * 8, answerBuffer,
-                                 sizeof(answerBuffer), 8);
-
-        if (params == NULL)
-            return BadAlloc;
-        __glXClearErrorOccured();
+        GLboolean retval;
 
-        CALL_GetVertexAttribdvNV(GET_DISPATCH(), ((GLuint) bswap_CARD32(pc + 0),
-                                                  pname, params));
-        (void) bswap_64_array((uint64_t *) params, compsize);
-        __glXSendReplySwap(cl->client, params, compsize, 8, GL_FALSE, 0);
+        retval = IsRenderbuffer((GLuint) bswap_CARD32(pc + 0));
+        __glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval);
         error = Success;
     }
 
     return error;
 }
 
-int
-__glXDispSwap_GetVertexAttribfvNV(__GLXclientState * cl, GLbyte * pc)
+void
+__glXDispSwap_RenderbufferStorage(GLbyte * pc)
 {
-    xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc;
-    int error;
-    __GLXcontext *const cx =
-        __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error);
-
-    pc += __GLX_VENDPRIV_HDR_SIZE;
-    if (cx != NULL) {
-        const GLenum pname = (GLenum) bswap_ENUM(pc + 4);
-
-        const GLuint compsize = __glGetVertexAttribfvNV_size(pname);
-        GLfloat answerBuffer[200];
-        GLfloat *params =
-            __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer,
-                                 sizeof(answerBuffer), 4);
-
-        if (params == NULL)
-            return BadAlloc;
-        __glXClearErrorOccured();
-
-        CALL_GetVertexAttribfvNV(GET_DISPATCH(), ((GLuint) bswap_CARD32(pc + 0),
-                                                  pname, params));
-        (void) bswap_32_array((uint32_t *) params, compsize);
-        __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
-        error = Success;
-    }
-
-    return error;
-}
-
-int
-__glXDispSwap_GetVertexAttribivNV(__GLXclientState * cl, GLbyte * pc)
-{
-    xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc;
-    int error;
-    __GLXcontext *const cx =
-        __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error);
-
-    pc += __GLX_VENDPRIV_HDR_SIZE;
-    if (cx != NULL) {
-        const GLenum pname = (GLenum) bswap_ENUM(pc + 4);
-
-        const GLuint compsize = __glGetVertexAttribivNV_size(pname);
-        GLint answerBuffer[200];
-        GLint *params =
-            __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer,
-                                 sizeof(answerBuffer), 4);
-
-        if (params == NULL)
-            return BadAlloc;
-        __glXClearErrorOccured();
-
-        CALL_GetVertexAttribivNV(GET_DISPATCH(), ((GLuint) bswap_CARD32(pc + 0),
-                                                  pname, params));
-        (void) bswap_32_array((uint32_t *) params, compsize);
-        __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
-        error = Success;
-    }
-
-    return error;
-}
-
-int
-__glXDispSwap_IsProgramNV(__GLXclientState * cl, GLbyte * pc)
-{
-    xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc;
-    int error;
-    __GLXcontext *const cx =
-        __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error);
-
-    pc += __GLX_VENDPRIV_HDR_SIZE;
-    if (cx != NULL) {
-        GLboolean retval;
-
-        retval = CALL_IsProgramNV(GET_DISPATCH(), ((GLuint) bswap_CARD32(pc + 0)
-                                  ));
-        __glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval);
-        error = Success;
-    }
-
-    return error;
+    PFNGLRENDERBUFFERSTORAGEPROC RenderbufferStorage =
+        __glGetProcAddress("glRenderbufferStorage");
+    RenderbufferStorage((GLenum) bswap_ENUM(pc + 0),
+                        (GLenum) bswap_ENUM(pc + 4),
+                        (GLsizei) bswap_CARD32(pc + 8),
+                        (GLsizei) bswap_CARD32(pc + 12));
 }
 
 void
-__glXDispSwap_LoadProgramNV(GLbyte * pc)
-{
-    const GLsizei len = (GLsizei) bswap_CARD32(pc + 8);
-
-    CALL_LoadProgramNV(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                        (GLuint) bswap_CARD32(pc + 4),
-                                        len, (const GLubyte *) (pc + 12)
-                       ));
-}
-
-void
-__glXDispSwap_ProgramParameters4dvNV(GLbyte * pc)
-{
-    const GLsizei num = (GLsizei) bswap_CARD32(pc + 8);
-
-#ifdef __GLX_ALIGN64
-    const GLuint cmdlen = 16 + __GLX_PAD((num * 32)) - 4;
-
-    if ((unsigned long) (pc) & 7) {
-        (void) memmove(pc - 4, pc, cmdlen);
-        pc -= 4;
-    }
-#endif
-
-    CALL_ProgramParameters4dvNV(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                                 (GLuint) bswap_CARD32(pc + 4),
-                                                 num,
-                                                 (const GLdouble *)
-                                                 bswap_64_array((uint64_t *) (pc
-                                                                              +
-                                                                              12),
-                                                                0)
-                                ));
-}
-
-void
-__glXDispSwap_ProgramParameters4fvNV(GLbyte * pc)
+__glXDispSwap_RenderbufferStorageMultisample(GLbyte * pc)
 {
-    const GLsizei num = (GLsizei) bswap_CARD32(pc + 8);
-
-    CALL_ProgramParameters4fvNV(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                                 (GLuint) bswap_CARD32(pc + 4),
-                                                 num,
-                                                 (const GLfloat *)
-                                                 bswap_32_array((uint32_t *) (pc
-                                                                              +
-                                                                              12),
-                                                                0)
-                                ));
+    PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC RenderbufferStorageMultisample =
+        __glGetProcAddress("glRenderbufferStorageMultisample");
+    RenderbufferStorageMultisample((GLenum) bswap_ENUM(pc + 0),
+                                   (GLsizei) bswap_CARD32(pc + 4),
+                                   (GLenum) bswap_ENUM(pc + 8),
+                                   (GLsizei) bswap_CARD32(pc + 12),
+                                   (GLsizei) bswap_CARD32(pc + 16));
 }
 
 void
-__glXDispSwap_RequestResidentProgramsNV(GLbyte * pc)
+__glXDispSwap_SecondaryColor3fvEXT(GLbyte * pc)
 {
-    const GLsizei n = (GLsizei) bswap_CARD32(pc + 0);
-
-    CALL_RequestResidentProgramsNV(GET_DISPATCH(), (n,
-                                                    (const GLuint *)
-                                                    bswap_32_array((uint32_t
-                                                                    *) (pc + 4),
-                                                                   0)
-                                   ));
+    PFNGLSECONDARYCOLOR3FVEXTPROC SecondaryColor3fvEXT =
+        __glGetProcAddress("glSecondaryColor3fvEXT");
+    SecondaryColor3fvEXT((const GLfloat *)
+                         bswap_32_array((uint32_t *) (pc + 0), 3));
 }
 
 void
-__glXDispSwap_TrackMatrixNV(GLbyte * pc)
+__glXDispSwap_FogCoordfvEXT(GLbyte * pc)
 {
-    CALL_TrackMatrixNV(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                        (GLuint) bswap_CARD32(pc + 4),
-                                        (GLenum) bswap_ENUM(pc + 8),
-                                        (GLenum) bswap_ENUM(pc + 12)
-                       ));
+    PFNGLFOGCOORDFVEXTPROC FogCoordfvEXT =
+        __glGetProcAddress("glFogCoordfvEXT");
+    FogCoordfvEXT((const GLfloat *) bswap_32_array((uint32_t *) (pc + 0), 1));
 }
 
 void
 __glXDispSwap_VertexAttrib1dvNV(GLbyte * pc)
 {
+    PFNGLVERTEXATTRIB1DVNVPROC VertexAttrib1dvNV =
+        __glGetProcAddress("glVertexAttrib1dvNV");
 #ifdef __GLX_ALIGN64
     if ((unsigned long) (pc) & 7) {
         (void) memmove(pc - 4, pc, 12);
@@ -5993,36 +5314,36 @@ __glXDispSwap_VertexAttrib1dvNV(GLbyte * pc)
     }
 #endif
 
-    CALL_VertexAttrib1dvNV(GET_DISPATCH(), ((GLuint) bswap_CARD32(pc + 0),
-                                            (const GLdouble *)
-                                            bswap_64_array((uint64_t *) (pc +
-                                                                         4), 1)
-                           ));
+    VertexAttrib1dvNV((GLuint) bswap_CARD32(pc + 0),
+                      (const GLdouble *) bswap_64_array((uint64_t *) (pc + 4),
+                                                        1));
 }
 
 void
 __glXDispSwap_VertexAttrib1fvNV(GLbyte * pc)
 {
-    CALL_VertexAttrib1fvNV(GET_DISPATCH(), ((GLuint) bswap_CARD32(pc + 0),
-                                            (const GLfloat *)
-                                            bswap_32_array((uint32_t *) (pc +
-                                                                         4), 1)
-                           ));
+    PFNGLVERTEXATTRIB1FVNVPROC VertexAttrib1fvNV =
+        __glGetProcAddress("glVertexAttrib1fvNV");
+    VertexAttrib1fvNV((GLuint) bswap_CARD32(pc + 0),
+                      (const GLfloat *) bswap_32_array((uint32_t *) (pc + 4),
+                                                       1));
 }
 
 void
 __glXDispSwap_VertexAttrib1svNV(GLbyte * pc)
 {
-    CALL_VertexAttrib1svNV(GET_DISPATCH(), ((GLuint) bswap_CARD32(pc + 0),
-                                            (const GLshort *)
-                                            bswap_16_array((uint16_t *) (pc +
-                                                                         4), 1)
-                           ));
+    PFNGLVERTEXATTRIB1SVNVPROC VertexAttrib1svNV =
+        __glGetProcAddress("glVertexAttrib1svNV");
+    VertexAttrib1svNV((GLuint) bswap_CARD32(pc + 0),
+                      (const GLshort *) bswap_16_array((uint16_t *) (pc + 4),
+                                                       1));
 }
 
 void
 __glXDispSwap_VertexAttrib2dvNV(GLbyte * pc)
 {
+    PFNGLVERTEXATTRIB2DVNVPROC VertexAttrib2dvNV =
+        __glGetProcAddress("glVertexAttrib2dvNV");
 #ifdef __GLX_ALIGN64
     if ((unsigned long) (pc) & 7) {
         (void) memmove(pc - 4, pc, 20);
@@ -6030,36 +5351,36 @@ __glXDispSwap_VertexAttrib2dvNV(GLbyte * pc)
     }
 #endif
 
-    CALL_VertexAttrib2dvNV(GET_DISPATCH(), ((GLuint) bswap_CARD32(pc + 0),
-                                            (const GLdouble *)
-                                            bswap_64_array((uint64_t *) (pc +
-                                                                         4), 2)
-                           ));
+    VertexAttrib2dvNV((GLuint) bswap_CARD32(pc + 0),
+                      (const GLdouble *) bswap_64_array((uint64_t *) (pc + 4),
+                                                        2));
 }
 
 void
 __glXDispSwap_VertexAttrib2fvNV(GLbyte * pc)
 {
-    CALL_VertexAttrib2fvNV(GET_DISPATCH(), ((GLuint) bswap_CARD32(pc + 0),
-                                            (const GLfloat *)
-                                            bswap_32_array((uint32_t *) (pc +
-                                                                         4), 2)
-                           ));
+    PFNGLVERTEXATTRIB2FVNVPROC VertexAttrib2fvNV =
+        __glGetProcAddress("glVertexAttrib2fvNV");
+    VertexAttrib2fvNV((GLuint) bswap_CARD32(pc + 0),
+                      (const GLfloat *) bswap_32_array((uint32_t *) (pc + 4),
+                                                       2));
 }
 
 void
 __glXDispSwap_VertexAttrib2svNV(GLbyte * pc)
 {
-    CALL_VertexAttrib2svNV(GET_DISPATCH(), ((GLuint) bswap_CARD32(pc + 0),
-                                            (const GLshort *)
-                                            bswap_16_array((uint16_t *) (pc +
-                                                                         4), 2)
-                           ));
+    PFNGLVERTEXATTRIB2SVNVPROC VertexAttrib2svNV =
+        __glGetProcAddress("glVertexAttrib2svNV");
+    VertexAttrib2svNV((GLuint) bswap_CARD32(pc + 0),
+                      (const GLshort *) bswap_16_array((uint16_t *) (pc + 4),
+                                                       2));
 }
 
 void
 __glXDispSwap_VertexAttrib3dvNV(GLbyte * pc)
 {
+    PFNGLVERTEXATTRIB3DVNVPROC VertexAttrib3dvNV =
+        __glGetProcAddress("glVertexAttrib3dvNV");
 #ifdef __GLX_ALIGN64
     if ((unsigned long) (pc) & 7) {
         (void) memmove(pc - 4, pc, 28);
@@ -6067,36 +5388,36 @@ __glXDispSwap_VertexAttrib3dvNV(GLbyte * pc)
     }
 #endif
 
-    CALL_VertexAttrib3dvNV(GET_DISPATCH(), ((GLuint) bswap_CARD32(pc + 0),
-                                            (const GLdouble *)
-                                            bswap_64_array((uint64_t *) (pc +
-                                                                         4), 3)
-                           ));
+    VertexAttrib3dvNV((GLuint) bswap_CARD32(pc + 0),
+                      (const GLdouble *) bswap_64_array((uint64_t *) (pc + 4),
+                                                        3));
 }
 
 void
 __glXDispSwap_VertexAttrib3fvNV(GLbyte * pc)
 {
-    CALL_VertexAttrib3fvNV(GET_DISPATCH(), ((GLuint) bswap_CARD32(pc + 0),
-                                            (const GLfloat *)
-                                            bswap_32_array((uint32_t *) (pc +
-                                                                         4), 3)
-                           ));
+    PFNGLVERTEXATTRIB3FVNVPROC VertexAttrib3fvNV =
+        __glGetProcAddress("glVertexAttrib3fvNV");
+    VertexAttrib3fvNV((GLuint) bswap_CARD32(pc + 0),
+                      (const GLfloat *) bswap_32_array((uint32_t *) (pc + 4),
+                                                       3));
 }
 
 void
 __glXDispSwap_VertexAttrib3svNV(GLbyte * pc)
 {
-    CALL_VertexAttrib3svNV(GET_DISPATCH(), ((GLuint) bswap_CARD32(pc + 0),
-                                            (const GLshort *)
-                                            bswap_16_array((uint16_t *) (pc +
-                                                                         4), 3)
-                           ));
+    PFNGLVERTEXATTRIB3SVNVPROC VertexAttrib3svNV =
+        __glGetProcAddress("glVertexAttrib3svNV");
+    VertexAttrib3svNV((GLuint) bswap_CARD32(pc + 0),
+                      (const GLshort *) bswap_16_array((uint16_t *) (pc + 4),
+                                                       3));
 }
 
 void
 __glXDispSwap_VertexAttrib4dvNV(GLbyte * pc)
 {
+    PFNGLVERTEXATTRIB4DVNVPROC VertexAttrib4dvNV =
+        __glGetProcAddress("glVertexAttrib4dvNV");
 #ifdef __GLX_ALIGN64
     if ((unsigned long) (pc) & 7) {
         (void) memmove(pc - 4, pc, 36);
@@ -6104,44 +5425,45 @@ __glXDispSwap_VertexAttrib4dvNV(GLbyte * pc)
     }
 #endif
 
-    CALL_VertexAttrib4dvNV(GET_DISPATCH(), ((GLuint) bswap_CARD32(pc + 0),
-                                            (const GLdouble *)
-                                            bswap_64_array((uint64_t *) (pc +
-                                                                         4), 4)
-                           ));
+    VertexAttrib4dvNV((GLuint) bswap_CARD32(pc + 0),
+                      (const GLdouble *) bswap_64_array((uint64_t *) (pc + 4),
+                                                        4));
 }
 
 void
 __glXDispSwap_VertexAttrib4fvNV(GLbyte * pc)
 {
-    CALL_VertexAttrib4fvNV(GET_DISPATCH(), ((GLuint) bswap_CARD32(pc + 0),
-                                            (const GLfloat *)
-                                            bswap_32_array((uint32_t *) (pc +
-                                                                         4), 4)
-                           ));
+    PFNGLVERTEXATTRIB4FVNVPROC VertexAttrib4fvNV =
+        __glGetProcAddress("glVertexAttrib4fvNV");
+    VertexAttrib4fvNV((GLuint) bswap_CARD32(pc + 0),
+                      (const GLfloat *) bswap_32_array((uint32_t *) (pc + 4),
+                                                       4));
 }
 
 void
 __glXDispSwap_VertexAttrib4svNV(GLbyte * pc)
 {
-    CALL_VertexAttrib4svNV(GET_DISPATCH(), ((GLuint) bswap_CARD32(pc + 0),
-                                            (const GLshort *)
-                                            bswap_16_array((uint16_t *) (pc +
-                                                                         4), 4)
-                           ));
+    PFNGLVERTEXATTRIB4SVNVPROC VertexAttrib4svNV =
+        __glGetProcAddress("glVertexAttrib4svNV");
+    VertexAttrib4svNV((GLuint) bswap_CARD32(pc + 0),
+                      (const GLshort *) bswap_16_array((uint16_t *) (pc + 4),
+                                                       4));
 }
 
 void
 __glXDispSwap_VertexAttrib4ubvNV(GLbyte * pc)
 {
-    CALL_VertexAttrib4ubvNV(GET_DISPATCH(), ((GLuint) bswap_CARD32(pc + 0),
-                                             (const GLubyte *) (pc + 4)
-                            ));
+    PFNGLVERTEXATTRIB4UBVNVPROC VertexAttrib4ubvNV =
+        __glGetProcAddress("glVertexAttrib4ubvNV");
+    VertexAttrib4ubvNV((GLuint) bswap_CARD32(pc + 0),
+                       (const GLubyte *) (pc + 4));
 }
 
 void
 __glXDispSwap_VertexAttribs1dvNV(GLbyte * pc)
 {
+    PFNGLVERTEXATTRIBS1DVNVPROC VertexAttribs1dvNV =
+        __glGetProcAddress("glVertexAttribs1dvNV");
     const GLsizei n = (GLsizei) bswap_CARD32(pc + 4);
 
 #ifdef __GLX_ALIGN64
@@ -6153,43 +5475,43 @@ __glXDispSwap_VertexAttribs1dvNV(GLbyte * pc)
     }
 #endif
 
-    CALL_VertexAttribs1dvNV(GET_DISPATCH(), ((GLuint) bswap_CARD32(pc + 0),
-                                             n,
-                                             (const GLdouble *)
-                                             bswap_64_array((uint64_t *) (pc +
-                                                                          8), 0)
-                            ));
+    VertexAttribs1dvNV((GLuint) bswap_CARD32(pc + 0),
+                       n,
+                       (const GLdouble *) bswap_64_array((uint64_t *) (pc + 8),
+                                                         0));
 }
 
 void
 __glXDispSwap_VertexAttribs1fvNV(GLbyte * pc)
 {
+    PFNGLVERTEXATTRIBS1FVNVPROC VertexAttribs1fvNV =
+        __glGetProcAddress("glVertexAttribs1fvNV");
     const GLsizei n = (GLsizei) bswap_CARD32(pc + 4);
 
-    CALL_VertexAttribs1fvNV(GET_DISPATCH(), ((GLuint) bswap_CARD32(pc + 0),
-                                             n,
-                                             (const GLfloat *)
-                                             bswap_32_array((uint32_t *) (pc +
-                                                                          8), 0)
-                            ));
+    VertexAttribs1fvNV((GLuint) bswap_CARD32(pc + 0),
+                       n,
+                       (const GLfloat *) bswap_32_array((uint32_t *) (pc + 8),
+                                                        0));
 }
 
 void
 __glXDispSwap_VertexAttribs1svNV(GLbyte * pc)
 {
+    PFNGLVERTEXATTRIBS1SVNVPROC VertexAttribs1svNV =
+        __glGetProcAddress("glVertexAttribs1svNV");
     const GLsizei n = (GLsizei) bswap_CARD32(pc + 4);
 
-    CALL_VertexAttribs1svNV(GET_DISPATCH(), ((GLuint) bswap_CARD32(pc + 0),
-                                             n,
-                                             (const GLshort *)
-                                             bswap_16_array((uint16_t *) (pc +
-                                                                          8), 0)
-                            ));
+    VertexAttribs1svNV((GLuint) bswap_CARD32(pc + 0),
+                       n,
+                       (const GLshort *) bswap_16_array((uint16_t *) (pc + 8),
+                                                        0));
 }
 
 void
 __glXDispSwap_VertexAttribs2dvNV(GLbyte * pc)
 {
+    PFNGLVERTEXATTRIBS2DVNVPROC VertexAttribs2dvNV =
+        __glGetProcAddress("glVertexAttribs2dvNV");
     const GLsizei n = (GLsizei) bswap_CARD32(pc + 4);
 
 #ifdef __GLX_ALIGN64
@@ -6201,43 +5523,43 @@ __glXDispSwap_VertexAttribs2dvNV(GLbyte * pc)
     }
 #endif
 
-    CALL_VertexAttribs2dvNV(GET_DISPATCH(), ((GLuint) bswap_CARD32(pc + 0),
-                                             n,
-                                             (const GLdouble *)
-                                             bswap_64_array((uint64_t *) (pc +
-                                                                          8), 0)
-                            ));
+    VertexAttribs2dvNV((GLuint) bswap_CARD32(pc + 0),
+                       n,
+                       (const GLdouble *) bswap_64_array((uint64_t *) (pc + 8),
+                                                         0));
 }
 
 void
 __glXDispSwap_VertexAttribs2fvNV(GLbyte * pc)
 {
+    PFNGLVERTEXATTRIBS2FVNVPROC VertexAttribs2fvNV =
+        __glGetProcAddress("glVertexAttribs2fvNV");
     const GLsizei n = (GLsizei) bswap_CARD32(pc + 4);
 
-    CALL_VertexAttribs2fvNV(GET_DISPATCH(), ((GLuint) bswap_CARD32(pc + 0),
-                                             n,
-                                             (const GLfloat *)
-                                             bswap_32_array((uint32_t *) (pc +
-                                                                          8), 0)
-                            ));
+    VertexAttribs2fvNV((GLuint) bswap_CARD32(pc + 0),
+                       n,
+                       (const GLfloat *) bswap_32_array((uint32_t *) (pc + 8),
+                                                        0));
 }
 
 void
 __glXDispSwap_VertexAttribs2svNV(GLbyte * pc)
 {
+    PFNGLVERTEXATTRIBS2SVNVPROC VertexAttribs2svNV =
+        __glGetProcAddress("glVertexAttribs2svNV");
     const GLsizei n = (GLsizei) bswap_CARD32(pc + 4);
 
-    CALL_VertexAttribs2svNV(GET_DISPATCH(), ((GLuint) bswap_CARD32(pc + 0),
-                                             n,
-                                             (const GLshort *)
-                                             bswap_16_array((uint16_t *) (pc +
-                                                                          8), 0)
-                            ));
+    VertexAttribs2svNV((GLuint) bswap_CARD32(pc + 0),
+                       n,
+                       (const GLshort *) bswap_16_array((uint16_t *) (pc + 8),
+                                                        0));
 }
 
 void
 __glXDispSwap_VertexAttribs3dvNV(GLbyte * pc)
 {
+    PFNGLVERTEXATTRIBS3DVNVPROC VertexAttribs3dvNV =
+        __glGetProcAddress("glVertexAttribs3dvNV");
     const GLsizei n = (GLsizei) bswap_CARD32(pc + 4);
 
 #ifdef __GLX_ALIGN64
@@ -6249,43 +5571,43 @@ __glXDispSwap_VertexAttribs3dvNV(GLbyte * pc)
     }
 #endif
 
-    CALL_VertexAttribs3dvNV(GET_DISPATCH(), ((GLuint) bswap_CARD32(pc + 0),
-                                             n,
-                                             (const GLdouble *)
-                                             bswap_64_array((uint64_t *) (pc +
-                                                                          8), 0)
-                            ));
+    VertexAttribs3dvNV((GLuint) bswap_CARD32(pc + 0),
+                       n,
+                       (const GLdouble *) bswap_64_array((uint64_t *) (pc + 8),
+                                                         0));
 }
 
 void
 __glXDispSwap_VertexAttribs3fvNV(GLbyte * pc)
 {
+    PFNGLVERTEXATTRIBS3FVNVPROC VertexAttribs3fvNV =
+        __glGetProcAddress("glVertexAttribs3fvNV");
     const GLsizei n = (GLsizei) bswap_CARD32(pc + 4);
 
-    CALL_VertexAttribs3fvNV(GET_DISPATCH(), ((GLuint) bswap_CARD32(pc + 0),
-                                             n,
-                                             (const GLfloat *)
-                                             bswap_32_array((uint32_t *) (pc +
-                                                                          8), 0)
-                            ));
+    VertexAttribs3fvNV((GLuint) bswap_CARD32(pc + 0),
+                       n,
+                       (const GLfloat *) bswap_32_array((uint32_t *) (pc + 8),
+                                                        0));
 }
 
 void
 __glXDispSwap_VertexAttribs3svNV(GLbyte * pc)
 {
+    PFNGLVERTEXATTRIBS3SVNVPROC VertexAttribs3svNV =
+        __glGetProcAddress("glVertexAttribs3svNV");
     const GLsizei n = (GLsizei) bswap_CARD32(pc + 4);
 
-    CALL_VertexAttribs3svNV(GET_DISPATCH(), ((GLuint) bswap_CARD32(pc + 0),
-                                             n,
-                                             (const GLshort *)
-                                             bswap_16_array((uint16_t *) (pc +
-                                                                          8), 0)
-                            ));
+    VertexAttribs3svNV((GLuint) bswap_CARD32(pc + 0),
+                       n,
+                       (const GLshort *) bswap_16_array((uint16_t *) (pc + 8),
+                                                        0));
 }
 
 void
 __glXDispSwap_VertexAttribs4dvNV(GLbyte * pc)
 {
+    PFNGLVERTEXATTRIBS4DVNVPROC VertexAttribs4dvNV =
+        __glGetProcAddress("glVertexAttribs4dvNV");
     const GLsizei n = (GLsizei) bswap_CARD32(pc + 4);
 
 #ifdef __GLX_ALIGN64
@@ -6297,498 +5619,53 @@ __glXDispSwap_VertexAttribs4dvNV(GLbyte * pc)
     }
 #endif
 
-    CALL_VertexAttribs4dvNV(GET_DISPATCH(), ((GLuint) bswap_CARD32(pc + 0),
-                                             n,
-                                             (const GLdouble *)
-                                             bswap_64_array((uint64_t *) (pc +
-                                                                          8), 0)
-                            ));
+    VertexAttribs4dvNV((GLuint) bswap_CARD32(pc + 0),
+                       n,
+                       (const GLdouble *) bswap_64_array((uint64_t *) (pc + 8),
+                                                         0));
 }
 
 void
 __glXDispSwap_VertexAttribs4fvNV(GLbyte * pc)
 {
+    PFNGLVERTEXATTRIBS4FVNVPROC VertexAttribs4fvNV =
+        __glGetProcAddress("glVertexAttribs4fvNV");
     const GLsizei n = (GLsizei) bswap_CARD32(pc + 4);
 
-    CALL_VertexAttribs4fvNV(GET_DISPATCH(), ((GLuint) bswap_CARD32(pc + 0),
-                                             n,
-                                             (const GLfloat *)
-                                             bswap_32_array((uint32_t *) (pc +
-                                                                          8), 0)
-                            ));
+    VertexAttribs4fvNV((GLuint) bswap_CARD32(pc + 0),
+                       n,
+                       (const GLfloat *) bswap_32_array((uint32_t *) (pc + 8),
+                                                        0));
 }
 
 void
 __glXDispSwap_VertexAttribs4svNV(GLbyte * pc)
 {
+    PFNGLVERTEXATTRIBS4SVNVPROC VertexAttribs4svNV =
+        __glGetProcAddress("glVertexAttribs4svNV");
     const GLsizei n = (GLsizei) bswap_CARD32(pc + 4);
 
-    CALL_VertexAttribs4svNV(GET_DISPATCH(), ((GLuint) bswap_CARD32(pc + 0),
-                                             n,
-                                             (const GLshort *)
-                                             bswap_16_array((uint16_t *) (pc +
-                                                                          8), 0)
-                            ));
+    VertexAttribs4svNV((GLuint) bswap_CARD32(pc + 0),
+                       n,
+                       (const GLshort *) bswap_16_array((uint16_t *) (pc + 8),
+                                                        0));
 }
 
 void
 __glXDispSwap_VertexAttribs4ubvNV(GLbyte * pc)
 {
+    PFNGLVERTEXATTRIBS4UBVNVPROC VertexAttribs4ubvNV =
+        __glGetProcAddress("glVertexAttribs4ubvNV");
     const GLsizei n = (GLsizei) bswap_CARD32(pc + 4);
 
-    CALL_VertexAttribs4ubvNV(GET_DISPATCH(), ((GLuint) bswap_CARD32(pc + 0),
-                                              n, (const GLubyte *) (pc + 8)
-                             ));
-}
-
-void
-__glXDispSwap_PointParameteriNV(GLbyte * pc)
-{
-    CALL_PointParameteriNV(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                            (GLint) bswap_CARD32(pc + 4)
-                           ));
-}
-
-void
-__glXDispSwap_PointParameterivNV(GLbyte * pc)
-{
-    const GLenum pname = (GLenum) bswap_ENUM(pc + 0);
-    const GLint *params;
-
-    params =
-        (const GLint *) bswap_32_array((uint32_t *) (pc + 4),
-                                       __glPointParameterivNV_size(pname));
-
-    CALL_PointParameterivNV(GET_DISPATCH(), (pname, params));
+    VertexAttribs4ubvNV((GLuint) bswap_CARD32(pc + 0),
+                        n, (const GLubyte *) (pc + 8));
 }
 
 void
 __glXDispSwap_ActiveStencilFaceEXT(GLbyte * pc)
 {
-    CALL_ActiveStencilFaceEXT(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0)
-                              ));
-}
-
-int
-__glXDispSwap_GetProgramNamedParameterdvNV(__GLXclientState * cl, GLbyte * pc)
-{
-    xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc;
-    int error;
-    __GLXcontext *const cx =
-        __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error);
-
-    pc += __GLX_VENDPRIV_HDR_SIZE;
-    if (cx != NULL) {
-        const GLsizei len = (GLsizei) bswap_CARD32(pc + 4);
-
-        GLdouble params[4];
-
-        CALL_GetProgramNamedParameterdvNV(GET_DISPATCH(), ((GLuint)
-                                                           bswap_CARD32(pc + 0),
-                                                           len,
-                                                           (const GLubyte *) (pc
-                                                                              +
-                                                                              8),
-                                                           params));
-        (void) bswap_64_array((uint64_t *) params, 4);
-        __glXSendReplySwap(cl->client, params, 4, 8, GL_TRUE, 0);
-        error = Success;
-    }
-
-    return error;
-}
-
-int
-__glXDispSwap_GetProgramNamedParameterfvNV(__GLXclientState * cl, GLbyte * pc)
-{
-    xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc;
-    int error;
-    __GLXcontext *const cx =
-        __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error);
-
-    pc += __GLX_VENDPRIV_HDR_SIZE;
-    if (cx != NULL) {
-        const GLsizei len = (GLsizei) bswap_CARD32(pc + 4);
-
-        GLfloat params[4];
-
-        CALL_GetProgramNamedParameterfvNV(GET_DISPATCH(), ((GLuint)
-                                                           bswap_CARD32(pc + 0),
-                                                           len,
-                                                           (const GLubyte *) (pc
-                                                                              +
-                                                                              8),
-                                                           params));
-        (void) bswap_32_array((uint32_t *) params, 4);
-        __glXSendReplySwap(cl->client, params, 4, 4, GL_TRUE, 0);
-        error = Success;
-    }
-
-    return error;
-}
-
-void
-__glXDispSwap_ProgramNamedParameter4dvNV(GLbyte * pc)
-{
-    const GLsizei len = (GLsizei) bswap_CARD32(pc + 36);
-
-#ifdef __GLX_ALIGN64
-    const GLuint cmdlen = 44 + __GLX_PAD(len) - 4;
-
-    if ((unsigned long) (pc) & 7) {
-        (void) memmove(pc - 4, pc, cmdlen);
-        pc -= 4;
-    }
-#endif
-
-    CALL_ProgramNamedParameter4dvNV(GET_DISPATCH(), ((GLuint)
-                                                     bswap_CARD32(pc + 32), len,
-                                                     (const GLubyte *) (pc +
-                                                                        40),
-                                                     (const GLdouble *)
-                                                     bswap_64_array((uint64_t
-                                                                     *) (pc +
-                                                                         0), 4)
-                                    ));
-}
-
-void
-__glXDispSwap_ProgramNamedParameter4fvNV(GLbyte * pc)
-{
-    const GLsizei len = (GLsizei) bswap_CARD32(pc + 4);
-
-    CALL_ProgramNamedParameter4fvNV(GET_DISPATCH(), ((GLuint)
-                                                     bswap_CARD32(pc + 0), len,
-                                                     (const GLubyte *) (pc +
-                                                                        24),
-                                                     (const GLfloat *)
-                                                     bswap_32_array((uint32_t
-                                                                     *) (pc +
-                                                                         8), 4)
-                                    ));
-}
-
-void
-__glXDispSwap_BlendEquationSeparateEXT(GLbyte * pc)
-{
-    CALL_BlendEquationSeparateEXT(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                                   (GLenum) bswap_ENUM(pc + 4)
-                                  ));
-}
-
-void
-__glXDispSwap_BindFramebufferEXT(GLbyte * pc)
-{
-    CALL_BindFramebufferEXT(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                             (GLuint) bswap_CARD32(pc + 4)
-                            ));
-}
-
-void
-__glXDispSwap_BindRenderbufferEXT(GLbyte * pc)
-{
-    CALL_BindRenderbufferEXT(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                              (GLuint) bswap_CARD32(pc + 4)
-                             ));
-}
-
-int
-__glXDispSwap_CheckFramebufferStatusEXT(__GLXclientState * cl, GLbyte * pc)
-{
-    xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc;
-    int error;
-    __GLXcontext *const cx =
-        __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error);
-
-    pc += __GLX_VENDPRIV_HDR_SIZE;
-    if (cx != NULL) {
-        GLenum retval;
-
-        retval = CALL_CheckFramebufferStatusEXT(GET_DISPATCH(), ((GLenum)
-                                                                 bswap_ENUM(pc +
-                                                                            0)
-                                                ));
-        __glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval);
-        error = Success;
-    }
-
-    return error;
-}
-
-void
-__glXDispSwap_DeleteFramebuffersEXT(GLbyte * pc)
-{
-    const GLsizei n = (GLsizei) bswap_CARD32(pc + 0);
-
-    CALL_DeleteFramebuffersEXT(GET_DISPATCH(), (n,
-                                                (const GLuint *)
-                                                bswap_32_array((uint32_t *) (pc
-                                                                             +
-                                                                             4),
-                                                               0)
-                               ));
-}
-
-void
-__glXDispSwap_DeleteRenderbuffersEXT(GLbyte * pc)
-{
-    const GLsizei n = (GLsizei) bswap_CARD32(pc + 0);
-
-    CALL_DeleteRenderbuffersEXT(GET_DISPATCH(), (n,
-                                                 (const GLuint *)
-                                                 bswap_32_array((uint32_t *) (pc
-                                                                              +
-                                                                              4),
-                                                                0)
-                                ));
-}
-
-void
-__glXDispSwap_FramebufferRenderbufferEXT(GLbyte * pc)
-{
-    CALL_FramebufferRenderbufferEXT(GET_DISPATCH(), ((GLenum)
-                                                     bswap_ENUM(pc + 0),
-                                                     (GLenum) bswap_ENUM(pc +
-                                                                         4),
-                                                     (GLenum) bswap_ENUM(pc +
-                                                                         8),
-                                                     (GLuint) bswap_CARD32(pc +
-                                                                           12)
-                                    ));
-}
-
-void
-__glXDispSwap_FramebufferTexture1DEXT(GLbyte * pc)
-{
-    CALL_FramebufferTexture1DEXT(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                                  (GLenum) bswap_ENUM(pc + 4),
-                                                  (GLenum) bswap_ENUM(pc + 8),
-                                                  (GLuint) bswap_CARD32(pc +
-                                                                        12),
-                                                  (GLint) bswap_CARD32(pc + 16)
-                                 ));
-}
-
-void
-__glXDispSwap_FramebufferTexture2DEXT(GLbyte * pc)
-{
-    CALL_FramebufferTexture2DEXT(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                                  (GLenum) bswap_ENUM(pc + 4),
-                                                  (GLenum) bswap_ENUM(pc + 8),
-                                                  (GLuint) bswap_CARD32(pc +
-                                                                        12),
-                                                  (GLint) bswap_CARD32(pc + 16)
-                                 ));
-}
-
-void
-__glXDispSwap_FramebufferTexture3DEXT(GLbyte * pc)
-{
-    CALL_FramebufferTexture3DEXT(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                                  (GLenum) bswap_ENUM(pc + 4),
-                                                  (GLenum) bswap_ENUM(pc + 8),
-                                                  (GLuint) bswap_CARD32(pc +
-                                                                        12),
-                                                  (GLint) bswap_CARD32(pc + 16),
-                                                  (GLint) bswap_CARD32(pc + 20)
-                                 ));
-}
-
-int
-__glXDispSwap_GenFramebuffersEXT(__GLXclientState * cl, GLbyte * pc)
-{
-    xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc;
-    int error;
-    __GLXcontext *const cx =
-        __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error);
-
-    pc += __GLX_VENDPRIV_HDR_SIZE;
-    if (cx != NULL) {
-        const GLsizei n = (GLsizei) bswap_CARD32(pc + 0);
-
-        GLuint answerBuffer[200];
-        GLuint *framebuffers =
-            __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer),
-                                 4);
-        CALL_GenFramebuffersEXT(GET_DISPATCH(), (n, framebuffers));
-        (void) bswap_32_array((uint32_t *) framebuffers, n);
-        __glXSendReplySwap(cl->client, framebuffers, n, 4, GL_TRUE, 0);
-        error = Success;
-    }
-
-    return error;
-}
-
-int
-__glXDispSwap_GenRenderbuffersEXT(__GLXclientState * cl, GLbyte * pc)
-{
-    xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc;
-    int error;
-    __GLXcontext *const cx =
-        __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error);
-
-    pc += __GLX_VENDPRIV_HDR_SIZE;
-    if (cx != NULL) {
-        const GLsizei n = (GLsizei) bswap_CARD32(pc + 0);
-
-        GLuint answerBuffer[200];
-        GLuint *renderbuffers =
-            __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer),
-                                 4);
-        CALL_GenRenderbuffersEXT(GET_DISPATCH(), (n, renderbuffers));
-        (void) bswap_32_array((uint32_t *) renderbuffers, n);
-        __glXSendReplySwap(cl->client, renderbuffers, n, 4, GL_TRUE, 0);
-        error = Success;
-    }
-
-    return error;
-}
-
-void
-__glXDispSwap_GenerateMipmapEXT(GLbyte * pc)
-{
-    CALL_GenerateMipmapEXT(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0)
-                           ));
-}
-
-int
-__glXDispSwap_GetFramebufferAttachmentParameterivEXT(__GLXclientState * cl,
-                                                     GLbyte * pc)
-{
-    xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc;
-    int error;
-    __GLXcontext *const cx =
-        __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error);
-
-    pc += __GLX_VENDPRIV_HDR_SIZE;
-    if (cx != NULL) {
-        GLint params[1];
-
-        CALL_GetFramebufferAttachmentParameterivEXT(GET_DISPATCH(), ((GLenum)
-                                                                     bswap_ENUM
-                                                                     (pc + 0),
-                                                                     (GLenum)
-                                                                     bswap_ENUM
-                                                                     (pc + 4),
-                                                                     (GLenum)
-                                                                     bswap_ENUM
-                                                                     (pc + 8),
-                                                                     params));
-        (void) bswap_32_array((uint32_t *) params, 1);
-        __glXSendReplySwap(cl->client, params, 1, 4, GL_FALSE, 0);
-        error = Success;
-    }
-
-    return error;
-}
-
-int
-__glXDispSwap_GetRenderbufferParameterivEXT(__GLXclientState * cl, GLbyte * pc)
-{
-    xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc;
-    int error;
-    __GLXcontext *const cx =
-        __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error);
-
-    pc += __GLX_VENDPRIV_HDR_SIZE;
-    if (cx != NULL) {
-        GLint params[1];
-
-        CALL_GetRenderbufferParameterivEXT(GET_DISPATCH(), ((GLenum)
-                                                            bswap_ENUM(pc + 0),
-                                                            (GLenum)
-                                                            bswap_ENUM(pc + 4),
-                                                            params));
-        (void) bswap_32_array((uint32_t *) params, 1);
-        __glXSendReplySwap(cl->client, params, 1, 4, GL_FALSE, 0);
-        error = Success;
-    }
-
-    return error;
-}
-
-int
-__glXDispSwap_IsFramebufferEXT(__GLXclientState * cl, GLbyte * pc)
-{
-    xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc;
-    int error;
-    __GLXcontext *const cx =
-        __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error);
-
-    pc += __GLX_VENDPRIV_HDR_SIZE;
-    if (cx != NULL) {
-        GLboolean retval;
-
-        retval = CALL_IsFramebufferEXT(GET_DISPATCH(), ((GLuint)
-                                                        bswap_CARD32(pc + 0)
-                                       ));
-        __glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval);
-        error = Success;
-    }
-
-    return error;
-}
-
-int
-__glXDispSwap_IsRenderbufferEXT(__GLXclientState * cl, GLbyte * pc)
-{
-    xGLXVendorPrivateReq *const req = (xGLXVendorPrivateReq *) pc;
-    int error;
-    __GLXcontext *const cx =
-        __glXForceCurrent(cl, bswap_CARD32(&req->contextTag), &error);
-
-    pc += __GLX_VENDPRIV_HDR_SIZE;
-    if (cx != NULL) {
-        GLboolean retval;
-
-        retval = CALL_IsRenderbufferEXT(GET_DISPATCH(), ((GLuint)
-                                                         bswap_CARD32(pc + 0)
-                                        ));
-        __glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval);
-        error = Success;
-    }
-
-    return error;
-}
-
-void
-__glXDispSwap_RenderbufferStorageEXT(GLbyte * pc)
-{
-    CALL_RenderbufferStorageEXT(GET_DISPATCH(), ((GLenum) bswap_ENUM(pc + 0),
-                                                 (GLenum) bswap_ENUM(pc + 4),
-                                                 (GLsizei) bswap_CARD32(pc + 8),
-                                                 (GLsizei) bswap_CARD32(pc + 12)
-                                ));
-}
-
-void
-__glXDispSwap_BlitFramebufferEXT(GLbyte * pc)
-{
-    CALL_BlitFramebufferEXT(GET_DISPATCH(), ((GLint) bswap_CARD32(pc + 0),
-                                             (GLint) bswap_CARD32(pc + 4),
-                                             (GLint) bswap_CARD32(pc + 8),
-                                             (GLint) bswap_CARD32(pc + 12),
-                                             (GLint) bswap_CARD32(pc + 16),
-                                             (GLint) bswap_CARD32(pc + 20),
-                                             (GLint) bswap_CARD32(pc + 24),
-                                             (GLint) bswap_CARD32(pc + 28),
-                                             (GLbitfield) bswap_CARD32(pc + 32),
-                                             (GLenum) bswap_ENUM(pc + 36)
-                            ));
-}
-
-void
-__glXDispSwap_FramebufferTextureLayerEXT(GLbyte * pc)
-{
-    CALL_FramebufferTextureLayerEXT(GET_DISPATCH(), ((GLenum)
-                                                     bswap_ENUM(pc + 0),
-                                                     (GLenum) bswap_ENUM(pc +
-                                                                         4),
-                                                     (GLuint) bswap_CARD32(pc +
-                                                                           8),
-                                                     (GLint) bswap_CARD32(pc +
-                                                                          12),
-                                                     (GLint) bswap_CARD32(pc +
-                                                                          16)
-                                    ));
+    PFNGLACTIVESTENCILFACEEXTPROC ActiveStencilFaceEXT =
+        __glGetProcAddress("glActiveStencilFaceEXT");
+    ActiveStencilFaceEXT((GLenum) bswap_ENUM(pc + 0));
 }
index 3b50ecd..d503262 100644 (file)
 #include "unpack.h"
 #include "indirect_size_get.h"
 #include "indirect_dispatch.h"
-#include "glapitable.h"
-#include "glapi.h"
-#include "glthread.h"
-#include "dispatch.h"
-
-static int DoGetProgramString(struct __GLXclientStateRec *cl, GLbyte * pc,
-                              unsigned get_programiv_offset,
-                              unsigned get_program_string_offset, Bool do_swap);
 
 /**
  * Handle both types of glGetProgramString calls.
- *
- * This single function handles both \c glGetProgramStringARB and
- * \c glGetProgramStringNV.  The dispatch offsets for the functions to use
- * for \c glGetProgramivARB and \c glGetProgramStringARB are passed in by the
- * caller.  These can be the offsets of either the ARB versions or the NV
- * versions.
  */
-int
+static int
 DoGetProgramString(struct __GLXclientStateRec *cl, GLbyte * pc,
-                   unsigned get_programiv_offset,
-                   unsigned get_program_string_offset, Bool do_swap)
+                   PFNGLGETPROGRAMIVARBPROC get_programiv,
+                   PFNGLGETPROGRAMSTRINGARBPROC get_program_string,
+                   Bool do_swap)
 {
     xGLXVendorPrivateWithReplyReq *const req =
         (xGLXVendorPrivateWithReplyReq *) pc;
@@ -88,19 +75,13 @@ DoGetProgramString(struct __GLXclientStateRec *cl, GLbyte * pc,
         /* The value of the GL_PROGRAM_LENGTH_ARB and GL_PROGRAM_LENGTH_NV
          * enumerants is the same.
          */
-        CALL_by_offset(GET_DISPATCH(),
-                       (void (GLAPIENTRYP) (GLuint, GLenum, GLint *)),
-                       get_programiv_offset,
-                       (target, GL_PROGRAM_LENGTH_ARB, &compsize));
+        get_programiv(target, GL_PROGRAM_LENGTH_ARB, &compsize);
 
         if (compsize != 0) {
             __GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1);
             __glXClearErrorOccured();
 
-            CALL_by_offset(GET_DISPATCH(),
-                           (void (GLAPIENTRYP) (GLuint, GLenum, GLubyte *)),
-                           get_program_string_offset,
-                           (target, pname, (GLubyte *) answer));
+            get_program_string(target, pname, (GLubyte *) answer);
         }
 
         if (__glXErrorOccured()) {
@@ -109,7 +90,7 @@ DoGetProgramString(struct __GLXclientStateRec *cl, GLbyte * pc,
         }
         else {
             __GLX_BEGIN_REPLY(compsize);
-            ((xGLXGetTexImageReply *) & __glXReply)->width = compsize;
+            ((xGLXGetTexImageReply *) &__glXReply)->width = compsize;
             __GLX_SEND_HEADER();
             __GLX_SEND_VOID_ARRAY(compsize);
         }
@@ -123,27 +104,21 @@ DoGetProgramString(struct __GLXclientStateRec *cl, GLbyte * pc,
 int
 __glXDisp_GetProgramStringARB(struct __GLXclientStateRec *cl, GLbyte * pc)
 {
-    return DoGetProgramString(cl, pc, _gloffset_GetProgramivARB,
-                              _gloffset_GetProgramStringARB, False);
-}
+    PFNGLGETPROGRAMIVARBPROC get_program =
+        __glGetProcAddress("glGetProgramivARB");
+    PFNGLGETPROGRAMSTRINGARBPROC get_program_string =
+        __glGetProcAddress("glGetProgramStringARB");
 
-int
-__glXDispSwap_GetProgramStringARB(struct __GLXclientStateRec *cl, GLbyte * pc)
-{
-    return DoGetProgramString(cl, pc, _gloffset_GetProgramivARB,
-                              _gloffset_GetProgramStringARB, True);
+    return DoGetProgramString(cl, pc, get_program, get_program_string, False);
 }
 
 int
-__glXDisp_GetProgramStringNV(struct __GLXclientStateRec *cl, GLbyte * pc)
+__glXDispSwap_GetProgramStringARB(struct __GLXclientStateRec *cl, GLbyte * pc)
 {
-    return DoGetProgramString(cl, pc, _gloffset_GetProgramivNV,
-                              _gloffset_GetProgramStringNV, False);
-}
+    PFNGLGETPROGRAMIVARBPROC get_program =
+        __glGetProcAddress("glGetProgramivARB");
+    PFNGLGETPROGRAMSTRINGARBPROC get_program_string =
+        __glGetProcAddress("glGetProgramStringARB");
 
-int
-__glXDispSwap_GetProgramStringNV(struct __GLXclientStateRec *cl, GLbyte * pc)
-{
-    return DoGetProgramString(cl, pc, _gloffset_GetProgramivNV,
-                              _gloffset_GetProgramStringNV, True);
+    return DoGetProgramString(cl, pc, get_program, get_program_string, True);
 }
index 86ea970..026afb6 100644 (file)
@@ -613,7 +613,7 @@ __glXTexSubImage3DReqSize(const GLbyte * pc, Bool swap)
 }
 
 int
-__glXCompressedTexImage1DARBReqSize(const GLbyte * pc, Bool swap)
+__glXCompressedTexImage1DReqSize(const GLbyte * pc, Bool swap)
 {
     GLsizei imageSize = *(GLsizei *) (pc + 20);
 
@@ -625,7 +625,7 @@ __glXCompressedTexImage1DARBReqSize(const GLbyte * pc, Bool swap)
 }
 
 int
-__glXCompressedTexImage2DARBReqSize(const GLbyte * pc, Bool swap)
+__glXCompressedTexImage2DReqSize(const GLbyte * pc, Bool swap)
 {
     GLsizei imageSize = *(GLsizei *) (pc + 24);
 
@@ -637,7 +637,7 @@ __glXCompressedTexImage2DARBReqSize(const GLbyte * pc, Bool swap)
 }
 
 int
-__glXCompressedTexImage3DARBReqSize(const GLbyte * pc, Bool swap)
+__glXCompressedTexImage3DReqSize(const GLbyte * pc, Bool swap)
 {
     GLsizei imageSize = *(GLsizei *) (pc + 28);
 
@@ -649,7 +649,7 @@ __glXCompressedTexImage3DARBReqSize(const GLbyte * pc, Bool swap)
 }
 
 int
-__glXCompressedTexSubImage3DARBReqSize(const GLbyte * pc, Bool swap)
+__glXCompressedTexSubImage3DReqSize(const GLbyte * pc, Bool swap)
 {
     GLsizei imageSize = *(GLsizei *) (pc + 36);
 
@@ -661,31 +661,7 @@ __glXCompressedTexSubImage3DARBReqSize(const GLbyte * pc, Bool swap)
 }
 
 int
-__glXProgramStringARBReqSize(const GLbyte * pc, Bool swap)
-{
-    GLsizei len = *(GLsizei *) (pc + 8);
-
-    if (swap) {
-        len = bswap_32(len);
-    }
-
-    return __GLX_PAD(len);
-}
-
-int
-__glXDrawBuffersARBReqSize(const GLbyte * pc, Bool swap)
-{
-    GLsizei n = *(GLsizei *) (pc + 0);
-
-    if (swap) {
-        n = bswap_32(n);
-    }
-
-    return __GLX_PAD((n * 4));
-}
-
-int
-__glXPointParameterfvEXTReqSize(const GLbyte * pc, Bool swap)
+__glXPointParameterfvReqSize(const GLbyte * pc, Bool swap)
 {
     GLenum pname = *(GLenum *) (pc + 0);
     GLsizei compsize;
@@ -694,32 +670,32 @@ __glXPointParameterfvEXTReqSize(const GLbyte * pc, Bool swap)
         pname = bswap_32(pname);
     }
 
-    compsize = __glPointParameterfvEXT_size(pname);
+    compsize = __glPointParameterfv_size(pname);
     return __GLX_PAD((compsize * 4));
 }
 
 int
-__glXProgramParameters4dvNVReqSize(const GLbyte * pc, Bool swap)
+__glXDrawBuffersReqSize(const GLbyte * pc, Bool swap)
 {
-    GLsizei num = *(GLsizei *) (pc + 8);
+    GLsizei n = *(GLsizei *) (pc + 0);
 
     if (swap) {
-        num = bswap_32(num);
+        n = bswap_32(n);
     }
 
-    return __GLX_PAD((num * 32));
+    return __GLX_PAD((n * 4));
 }
 
 int
-__glXProgramParameters4fvNVReqSize(const GLbyte * pc, Bool swap)
+__glXProgramStringARBReqSize(const GLbyte * pc, Bool swap)
 {
-    GLsizei num = *(GLsizei *) (pc + 8);
+    GLsizei len = *(GLsizei *) (pc + 8);
 
     if (swap) {
-        num = bswap_32(num);
+        len = bswap_32(len);
     }
 
-    return __GLX_PAD((num * 16));
+    return __GLX_PAD(len);
 }
 
 int
@@ -794,18 +770,6 @@ __glXVertexAttribs4dvNVReqSize(const GLbyte * pc, Bool swap)
     return __GLX_PAD((n * 32));
 }
 
-int
-__glXProgramNamedParameter4fvNVReqSize(const GLbyte * pc, Bool swap)
-{
-    GLsizei len = *(GLsizei *) (pc + 4);
-
-    if (swap) {
-        len = bswap_32(len);
-    }
-
-    return __GLX_PAD(len);
-}
-
 ALIAS(Fogiv, Fogfv)
     ALIAS(Lightiv, Lightfv)
     ALIAS(LightModeliv, LightModelfv)
@@ -816,10 +780,11 @@ ALIAS(Fogiv, Fogfv)
     ALIAS(PixelMapuiv, PixelMapfv)
     ALIAS(ColorTableParameteriv, ColorTableParameterfv)
     ALIAS(ConvolutionParameteriv, ConvolutionParameterfv)
-    ALIAS(CompressedTexSubImage1DARB, CompressedTexImage1DARB)
-    ALIAS(CompressedTexSubImage2DARB, CompressedTexImage3DARB)
-    ALIAS(LoadProgramNV, ProgramStringARB)
-    ALIAS(RequestResidentProgramsNV, DrawBuffersARB)
+    ALIAS(CompressedTexSubImage1D, CompressedTexImage1D)
+    ALIAS(CompressedTexSubImage2D, CompressedTexImage3D)
+    ALIAS(PointParameteriv, PointParameterfv)
+    ALIAS(DeleteFramebuffers, DrawBuffers)
+    ALIAS(DeleteRenderbuffers, DrawBuffers)
     ALIAS(VertexAttribs1fvNV, PixelMapfv)
     ALIAS(VertexAttribs1svNV, PixelMapusv)
     ALIAS(VertexAttribs2fvNV, VertexAttribs1dvNV)
@@ -827,7 +792,3 @@ ALIAS(Fogiv, Fogfv)
     ALIAS(VertexAttribs4fvNV, VertexAttribs2dvNV)
     ALIAS(VertexAttribs4svNV, VertexAttribs1dvNV)
     ALIAS(VertexAttribs4ubvNV, PixelMapfv)
-    ALIAS(PointParameterivNV, PointParameterfvEXT)
-    ALIAS(ProgramNamedParameter4dvNV, CompressedTexSubImage3DARB)
-    ALIAS(DeleteFramebuffersEXT, DrawBuffersARB)
-    ALIAS(DeleteRenderbuffersEXT, DrawBuffersARB)
index d2c1da7..43e1e69 100644 (file)
@@ -96,32 +96,29 @@ extern PURE _X_HIDDEN int __glXSeparableFilter2DReqSize(const GLbyte * pc,
 extern PURE _X_HIDDEN int __glXTexImage3DReqSize(const GLbyte * pc, Bool swap);
 extern PURE _X_HIDDEN int __glXTexSubImage3DReqSize(const GLbyte * pc,
                                                     Bool swap);
-extern PURE _X_HIDDEN int __glXCompressedTexImage1DARBReqSize(const GLbyte * pc,
+extern PURE _X_HIDDEN int __glXCompressedTexImage1DReqSize(const GLbyte * pc,
+                                                           Bool swap);
+extern PURE _X_HIDDEN int __glXCompressedTexImage2DReqSize(const GLbyte * pc,
+                                                           Bool swap);
+extern PURE _X_HIDDEN int __glXCompressedTexImage3DReqSize(const GLbyte * pc,
+                                                           Bool swap);
+extern PURE _X_HIDDEN int __glXCompressedTexSubImage1DReqSize(const GLbyte * pc,
                                                               Bool swap);
-extern PURE _X_HIDDEN int __glXCompressedTexImage2DARBReqSize(const GLbyte * pc,
+extern PURE _X_HIDDEN int __glXCompressedTexSubImage2DReqSize(const GLbyte * pc,
                                                               Bool swap);
-extern PURE _X_HIDDEN int __glXCompressedTexImage3DARBReqSize(const GLbyte * pc,
+extern PURE _X_HIDDEN int __glXCompressedTexSubImage3DReqSize(const GLbyte * pc,
                                                               Bool swap);
-extern PURE _X_HIDDEN int __glXCompressedTexSubImage1DARBReqSize(const GLbyte *
-                                                                 pc, Bool swap);
-extern PURE _X_HIDDEN int __glXCompressedTexSubImage2DARBReqSize(const GLbyte *
-                                                                 pc, Bool swap);
-extern PURE _X_HIDDEN int __glXCompressedTexSubImage3DARBReqSize(const GLbyte *
-                                                                 pc, Bool swap);
+extern PURE _X_HIDDEN int __glXPointParameterfvReqSize(const GLbyte * pc,
+                                                       Bool swap);
+extern PURE _X_HIDDEN int __glXPointParameterivReqSize(const GLbyte * pc,
+                                                       Bool swap);
+extern PURE _X_HIDDEN int __glXDrawBuffersReqSize(const GLbyte * pc, Bool swap);
 extern PURE _X_HIDDEN int __glXProgramStringARBReqSize(const GLbyte * pc,
                                                        Bool swap);
-extern PURE _X_HIDDEN int __glXDrawBuffersARBReqSize(const GLbyte * pc,
-                                                     Bool swap);
-extern PURE _X_HIDDEN int __glXPointParameterfvEXTReqSize(const GLbyte * pc,
+extern PURE _X_HIDDEN int __glXDeleteFramebuffersReqSize(const GLbyte * pc,
+                                                         Bool swap);
+extern PURE _X_HIDDEN int __glXDeleteRenderbuffersReqSize(const GLbyte * pc,
                                                           Bool swap);
-extern PURE _X_HIDDEN int __glXLoadProgramNVReqSize(const GLbyte * pc,
-                                                    Bool swap);
-extern PURE _X_HIDDEN int __glXProgramParameters4dvNVReqSize(const GLbyte * pc,
-                                                             Bool swap);
-extern PURE _X_HIDDEN int __glXProgramParameters4fvNVReqSize(const GLbyte * pc,
-                                                             Bool swap);
-extern PURE _X_HIDDEN int __glXRequestResidentProgramsNVReqSize(const GLbyte *
-                                                                pc, Bool swap);
 extern PURE _X_HIDDEN int __glXVertexAttribs1dvNVReqSize(const GLbyte * pc,
                                                          Bool swap);
 extern PURE _X_HIDDEN int __glXVertexAttribs1fvNVReqSize(const GLbyte * pc,
@@ -148,16 +145,6 @@ extern PURE _X_HIDDEN int __glXVertexAttribs4svNVReqSize(const GLbyte * pc,
                                                          Bool swap);
 extern PURE _X_HIDDEN int __glXVertexAttribs4ubvNVReqSize(const GLbyte * pc,
                                                           Bool swap);
-extern PURE _X_HIDDEN int __glXPointParameterivNVReqSize(const GLbyte * pc,
-                                                         Bool swap);
-extern PURE _X_HIDDEN int __glXProgramNamedParameter4dvNVReqSize(const GLbyte *
-                                                                 pc, Bool swap);
-extern PURE _X_HIDDEN int __glXProgramNamedParameter4fvNVReqSize(const GLbyte *
-                                                                 pc, Bool swap);
-extern PURE _X_HIDDEN int __glXDeleteFramebuffersEXTReqSize(const GLbyte * pc,
-                                                            Bool swap);
-extern PURE _X_HIDDEN int __glXDeleteRenderbuffersEXTReqSize(const GLbyte * pc,
-                                                             Bool swap);
 
 #undef PURE
 
index 56ffc1c..fec7ed3 100644 (file)
@@ -72,12 +72,14 @@ extern _X_INTERNAL PURE FASTCALL GLint __glMap2d_size(GLenum);
 extern _X_INTERNAL PURE FASTCALL GLint __glMap2f_size(GLenum);
 extern _X_INTERNAL PURE FASTCALL GLint __glColorTableParameterfv_size(GLenum);
 extern _X_INTERNAL PURE FASTCALL GLint __glColorTableParameteriv_size(GLenum);
-extern _X_INTERNAL PURE FASTCALL GLint __glConvolutionParameterfv_size(GLenum);
-extern _X_INTERNAL PURE FASTCALL GLint __glConvolutionParameteriv_size(GLenum);
-extern _X_INTERNAL PURE FASTCALL GLint __glPointParameterfvEXT_size(GLenum);
-extern _X_INTERNAL PURE FASTCALL GLint __glPointParameterivNV_size(GLenum);
+extern _X_INTERNAL PURE FASTCALL GLint
+__glConvolutionParameterfv_size(GLenum);
+extern _X_INTERNAL PURE FASTCALL GLint
+__glConvolutionParameteriv_size(GLenum);
+extern _X_INTERNAL PURE FASTCALL GLint __glPointParameterfv_size(GLenum);
+extern _X_INTERNAL PURE FASTCALL GLint __glPointParameteriv_size(GLenum);
 
 #undef PURE
 #undef FASTCALL
 
-#endif                          /* !defined( _INDIRECT_SIZE_H_ ) */
+#endif /* !defined( _INDIRECT_SIZE_H_ ) */
index da3a6cb..f879311 100644 (file)
@@ -25,6 +25,7 @@
  * SOFTWARE.
  */
 
+
 #include <X11/Xfuncproto.h>
 #include <GL/gl.h>
 #include "indirect_size_get.h"
@@ -44,6 +45,7 @@
 #define FASTCALL
 #endif
 
+
 #if defined(__CYGWIN__) || defined(__MINGW32__) || defined(GLX_USE_APPLEGL)
 #undef HAVE_ALIAS
 #endif
@@ -58,6 +60,7 @@
     { return __gl ## to ## _size( e ); }
 #endif
 
+
 _X_INTERNAL PURE FASTCALL GLint
 __glCallLists_size(GLenum e)
 {
@@ -599,6 +602,7 @@ __glGetBooleanv_size(GLenum e)
     case GL_OCCLUSION_TEST_HP:
     case GL_OCCLUSION_TEST_RESULT_HP:
     case GL_LIGHT_MODEL_COLOR_CONTROL:
+    case GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_ARB:
     case GL_RESET_NOTIFICATION_STRATEGY_ARB:
     case GL_CURRENT_FOG_COORD:
     case GL_FOG_COORDINATE_ARRAY_TYPE:
@@ -664,11 +668,11 @@ __glGetBooleanv_size(GLenum e)
     case GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI:
     case GL_FRAGMENT_PROGRAM_ARB:
     case GL_MAX_DRAW_BUFFERS_ARB:
-/*      case GL_MAX_DRAW_BUFFERS_NV:*/
+/*      case GL_MAX_DRAW_BUFFERS_ATI:*/
     case GL_DRAW_BUFFER0_ARB:
 /*      case GL_DRAW_BUFFER0_ATI:*/
     case GL_DRAW_BUFFER1_ARB:
-/*      case GL_DRAW_BUFFER1_NV:*/
+/*      case GL_DRAW_BUFFER1_ATI:*/
     case GL_DRAW_BUFFER2_ARB:
 /*      case GL_DRAW_BUFFER2_ATI:*/
     case GL_DRAW_BUFFER3_ARB:
@@ -686,15 +690,15 @@ __glGetBooleanv_size(GLenum e)
     case GL_DRAW_BUFFER9_ARB:
 /*      case GL_DRAW_BUFFER9_ATI:*/
     case GL_DRAW_BUFFER10_ARB:
-/*      case GL_DRAW_BUFFER10_NV:*/
+/*      case GL_DRAW_BUFFER10_ATI:*/
     case GL_DRAW_BUFFER11_ARB:
-/*      case GL_DRAW_BUFFER11_NV:*/
+/*      case GL_DRAW_BUFFER11_ATI:*/
     case GL_DRAW_BUFFER12_ARB:
 /*      case GL_DRAW_BUFFER12_ATI:*/
     case GL_DRAW_BUFFER13_ARB:
 /*      case GL_DRAW_BUFFER13_ATI:*/
     case GL_DRAW_BUFFER14_ARB:
-/*      case GL_DRAW_BUFFER14_NV:*/
+/*      case GL_DRAW_BUFFER14_ATI:*/
     case GL_DRAW_BUFFER15_ARB:
 /*      case GL_DRAW_BUFFER15_ATI:*/
     case GL_BLEND_EQUATION_ALPHA_EXT:
@@ -708,6 +712,7 @@ __glGetBooleanv_size(GLenum e)
     case GL_MATRIX_INDEX_ARRAY_TYPE_ARB:
     case GL_MATRIX_INDEX_ARRAY_STRIDE_ARB:
     case GL_COMPARE_REF_DEPTH_TO_TEXTURE_EXT:
+    case GL_TEXTURE_CUBE_MAP_SEAMLESS:
     case GL_POINT_SPRITE_ARB:
 /*      case GL_POINT_SPRITE_NV:*/
     case GL_POINT_SPRITE_R_MODE_NV:
@@ -726,7 +731,6 @@ __glGetBooleanv_size(GLenum e)
     case GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB:
     case GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB:
     case GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB:
-    case GL_TEXTURE_CUBE_MAP_SEAMLESS:
     case GL_MAX_ARRAY_TEXTURE_LAYERS_EXT:
     case GL_STENCIL_TEST_TWO_SIDE_EXT:
     case GL_ACTIVE_STENCIL_FACE_EXT:
@@ -744,6 +748,9 @@ __glGetBooleanv_size(GLenum e)
     case GL_MAX_SAMPLES:
 /*      case GL_MAX_SAMPLES_EXT:*/
     case GL_MAX_SERVER_WAIT_TIMEOUT:
+    case GL_MAX_DEBUG_MESSAGE_LENGTH_ARB:
+    case GL_MAX_DEBUG_LOGGED_MESSAGES_ARB:
+    case GL_DEBUG_LOGGED_MESSAGES_ARB:
     case GL_RASTER_POSITION_UNCLIPPED_IBM:
         return 1;
     case GL_SMOOTH_POINT_SIZE_RANGE:
@@ -917,6 +924,18 @@ __glGetTexLevelParameterfv_size(GLenum e)
 }
 
 _X_INTERNAL PURE FASTCALL GLint
+__glGetPointerv_size(GLenum e)
+{
+    switch (e) {
+    case GL_DEBUG_CALLBACK_FUNCTION_ARB:
+    case GL_DEBUG_CALLBACK_USER_PARAM_ARB:
+        return 1;
+    default:
+        return 0;
+    }
+}
+
+_X_INTERNAL PURE FASTCALL GLint
 __glColorTableParameterfv_size(GLenum e)
 {
     switch (e) {
@@ -1036,6 +1055,56 @@ __glGetMinmaxParameterfv_size(GLenum e)
 }
 
 _X_INTERNAL PURE FASTCALL GLint
+__glPointParameterfv_size(GLenum e)
+{
+    switch (e) {
+    case GL_POINT_SIZE_MIN:
+/*      case GL_POINT_SIZE_MIN_ARB:*/
+/*      case GL_POINT_SIZE_MIN_SGIS:*/
+    case GL_POINT_SIZE_MAX:
+/*      case GL_POINT_SIZE_MAX_ARB:*/
+/*      case GL_POINT_SIZE_MAX_SGIS:*/
+    case GL_POINT_FADE_THRESHOLD_SIZE:
+/*      case GL_POINT_FADE_THRESHOLD_SIZE_ARB:*/
+/*      case GL_POINT_FADE_THRESHOLD_SIZE_SGIS:*/
+    case GL_POINT_SPRITE_R_MODE_NV:
+    case GL_POINT_SPRITE_COORD_ORIGIN:
+        return 1;
+    case GL_POINT_DISTANCE_ATTENUATION:
+/*      case GL_POINT_DISTANCE_ATTENUATION_ARB:*/
+/*      case GL_POINT_DISTANCE_ATTENUATION_SGIS:*/
+        return 3;
+    default:
+        return 0;
+    }
+}
+
+_X_INTERNAL PURE FASTCALL GLint
+__glGetQueryObjectiv_size(GLenum e)
+{
+    switch (e) {
+    case GL_QUERY_RESULT_ARB:
+    case GL_QUERY_RESULT_AVAILABLE_ARB:
+        return 1;
+    default:
+        return 0;
+    }
+}
+
+_X_INTERNAL PURE FASTCALL GLint
+__glGetQueryiv_size(GLenum e)
+{
+    switch (e) {
+    case GL_QUERY_COUNTER_BITS_ARB:
+    case GL_CURRENT_QUERY_ARB:
+    case GL_ANY_SAMPLES_PASSED:
+        return 1;
+    default:
+        return 0;
+    }
+}
+
+_X_INTERNAL PURE FASTCALL GLint
 __glGetProgramivARB_size(GLenum e)
 {
     switch (e) {
@@ -1089,106 +1158,25 @@ __glGetProgramivARB_size(GLenum e)
 }
 
 _X_INTERNAL PURE FASTCALL GLint
-__glGetVertexAttribdvARB_size(GLenum e)
-{
-    switch (e) {
-    case GL_VERTEX_PROGRAM_ARB:
-    case GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB:
-    case GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB:
-    case GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB:
-    case GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB:
-    case GL_CURRENT_VERTEX_ATTRIB_ARB:
-    case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB:
-        return 1;
-    default:
-        return 0;
-    }
-}
-
-_X_INTERNAL PURE FASTCALL GLint
-__glGetQueryObjectivARB_size(GLenum e)
-{
-    switch (e) {
-    case GL_QUERY_RESULT_ARB:
-    case GL_QUERY_RESULT_AVAILABLE_ARB:
-        return 1;
-    default:
-        return 0;
-    }
-}
-
-_X_INTERNAL PURE FASTCALL GLint
-__glGetQueryivARB_size(GLenum e)
-{
-    switch (e) {
-    case GL_QUERY_COUNTER_BITS_ARB:
-    case GL_CURRENT_QUERY_ARB:
-        return 1;
-    default:
-        return 0;
-    }
-}
-
-_X_INTERNAL PURE FASTCALL GLint
-__glPointParameterfvEXT_size(GLenum e)
-{
-    switch (e) {
-    case GL_POINT_SIZE_MIN:
-/*      case GL_POINT_SIZE_MIN_ARB:*/
-/*      case GL_POINT_SIZE_MIN_SGIS:*/
-    case GL_POINT_SIZE_MAX:
-/*      case GL_POINT_SIZE_MAX_ARB:*/
-/*      case GL_POINT_SIZE_MAX_SGIS:*/
-    case GL_POINT_FADE_THRESHOLD_SIZE:
-/*      case GL_POINT_FADE_THRESHOLD_SIZE_ARB:*/
-/*      case GL_POINT_FADE_THRESHOLD_SIZE_SGIS:*/
-    case GL_POINT_SPRITE_R_MODE_NV:
-    case GL_POINT_SPRITE_COORD_ORIGIN:
-        return 1;
-    case GL_POINT_DISTANCE_ATTENUATION:
-/*      case GL_POINT_DISTANCE_ATTENUATION_ARB:*/
-/*      case GL_POINT_DISTANCE_ATTENUATION_SGIS:*/
-        return 3;
-    default:
-        return 0;
-    }
-}
-
-_X_INTERNAL PURE FASTCALL GLint
-__glGetProgramivNV_size(GLenum e)
-{
-    switch (e) {
-    case GL_PROGRAM_LENGTH_NV:
-    case GL_PROGRAM_TARGET_NV:
-    case GL_PROGRAM_RESIDENT_NV:
-        return 1;
-    default:
-        return 0;
-    }
-}
-
-_X_INTERNAL PURE FASTCALL GLint
-__glGetVertexAttribdvNV_size(GLenum e)
-{
-    switch (e) {
-    case GL_ATTRIB_ARRAY_SIZE_NV:
-    case GL_ATTRIB_ARRAY_STRIDE_NV:
-    case GL_ATTRIB_ARRAY_TYPE_NV:
-    case GL_CURRENT_ATTRIB_NV:
-        return 1;
-    default:
-        return 0;
-    }
-}
-
-_X_INTERNAL PURE FASTCALL GLint
-__glGetFramebufferAttachmentParameterivEXT_size(GLenum e)
+__glGetFramebufferAttachmentParameteriv_size(GLenum e)
 {
     switch (e) {
-    case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT:
-    case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT:
-    case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT:
-    case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT:
+    case GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING:
+    case GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE:
+    case GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE:
+    case GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE:
+    case GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE:
+    case GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE:
+    case GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE:
+    case GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE:
+    case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:
+/*      case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT:*/
+    case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:
+/*      case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT:*/
+    case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL:
+/*      case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT:*/
+    case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE:
+/*      case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT:*/
     case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT:
         return 1;
     default:
@@ -1226,11 +1214,7 @@ ALIAS(Fogiv, Fogfv)
     ALIAS(GetConvolutionParameteriv, GetConvolutionParameterfv)
     ALIAS(GetHistogramParameteriv, GetHistogramParameterfv)
     ALIAS(GetMinmaxParameteriv, GetMinmaxParameterfv)
-    ALIAS(GetVertexAttribfvARB, GetVertexAttribdvARB)
-    ALIAS(GetVertexAttribivARB, GetVertexAttribdvARB)
-    ALIAS(GetQueryObjectuivARB, GetQueryObjectivARB)
-    ALIAS(GetVertexAttribfvNV, GetVertexAttribdvNV)
-    ALIAS(GetVertexAttribivNV, GetVertexAttribdvNV)
-    ALIAS(PointParameterivNV, PointParameterfvEXT)
+    ALIAS(PointParameteriv, PointParameterfv)
+    ALIAS(GetQueryObjectuiv, GetQueryObjectiv)
 #undef PURE
 #undef FASTCALL
index 4cfb3a6..9b62036 100644 (file)
@@ -67,6 +67,7 @@ extern _X_INTERNAL PURE FASTCALL GLint __glGetTexParameterfv_size(GLenum);
 extern _X_INTERNAL PURE FASTCALL GLint __glGetTexParameteriv_size(GLenum);
 extern _X_INTERNAL PURE FASTCALL GLint __glGetTexLevelParameterfv_size(GLenum);
 extern _X_INTERNAL PURE FASTCALL GLint __glGetTexLevelParameteriv_size(GLenum);
+extern _X_INTERNAL PURE FASTCALL GLint __glGetPointerv_size(GLenum);
 extern _X_INTERNAL PURE FASTCALL GLint
 __glGetColorTableParameterfv_size(GLenum);
 extern _X_INTERNAL PURE FASTCALL GLint
@@ -79,19 +80,12 @@ extern _X_INTERNAL PURE FASTCALL GLint __glGetHistogramParameterfv_size(GLenum);
 extern _X_INTERNAL PURE FASTCALL GLint __glGetHistogramParameteriv_size(GLenum);
 extern _X_INTERNAL PURE FASTCALL GLint __glGetMinmaxParameterfv_size(GLenum);
 extern _X_INTERNAL PURE FASTCALL GLint __glGetMinmaxParameteriv_size(GLenum);
+extern _X_INTERNAL PURE FASTCALL GLint __glGetQueryObjectiv_size(GLenum);
+extern _X_INTERNAL PURE FASTCALL GLint __glGetQueryObjectuiv_size(GLenum);
+extern _X_INTERNAL PURE FASTCALL GLint __glGetQueryiv_size(GLenum);
 extern _X_INTERNAL PURE FASTCALL GLint __glGetProgramivARB_size(GLenum);
-extern _X_INTERNAL PURE FASTCALL GLint __glGetVertexAttribdvARB_size(GLenum);
-extern _X_INTERNAL PURE FASTCALL GLint __glGetVertexAttribfvARB_size(GLenum);
-extern _X_INTERNAL PURE FASTCALL GLint __glGetVertexAttribivARB_size(GLenum);
-extern _X_INTERNAL PURE FASTCALL GLint __glGetQueryObjectivARB_size(GLenum);
-extern _X_INTERNAL PURE FASTCALL GLint __glGetQueryObjectuivARB_size(GLenum);
-extern _X_INTERNAL PURE FASTCALL GLint __glGetQueryivARB_size(GLenum);
-extern _X_INTERNAL PURE FASTCALL GLint __glGetProgramivNV_size(GLenum);
-extern _X_INTERNAL PURE FASTCALL GLint __glGetVertexAttribdvNV_size(GLenum);
-extern _X_INTERNAL PURE FASTCALL GLint __glGetVertexAttribfvNV_size(GLenum);
-extern _X_INTERNAL PURE FASTCALL GLint __glGetVertexAttribivNV_size(GLenum);
 extern _X_INTERNAL PURE FASTCALL GLint
-__glGetFramebufferAttachmentParameterivEXT_size(GLenum);
+__glGetFramebufferAttachmentParameteriv_size(GLenum);
 
 #undef PURE
 #undef FASTCALL
index 8922e43..33e3d6a 100644 (file)
@@ -213,17 +213,16 @@ static const void *Single_function_table[112][2] = {
                           __glXDispSwap_GetMinmaxParameterfv},
     /* [ 103] =   159 */ {__glXDisp_GetMinmaxParameteriv,
                           __glXDispSwap_GetMinmaxParameteriv},
-    /* [ 104] =   160 */ {__glXDisp_GetCompressedTexImageARB,
-                          __glXDispSwap_GetCompressedTexImageARB},
-    /* [ 105] =   161 */ {__glXDisp_DeleteQueriesARB,
-                          __glXDispSwap_DeleteQueriesARB},
-    /* [ 106] =   162 */ {__glXDisp_GenQueriesARB, __glXDispSwap_GenQueriesARB},
-    /* [ 107] =   163 */ {__glXDisp_IsQueryARB, __glXDispSwap_IsQueryARB},
-    /* [ 108] =   164 */ {__glXDisp_GetQueryivARB, __glXDispSwap_GetQueryivARB},
-    /* [ 109] =   165 */ {__glXDisp_GetQueryObjectivARB,
-                          __glXDispSwap_GetQueryObjectivARB},
-    /* [ 110] =   166 */ {__glXDisp_GetQueryObjectuivARB,
-                          __glXDispSwap_GetQueryObjectuivARB},
+    /* [ 104] =   160 */ {__glXDisp_GetCompressedTexImage,
+                          __glXDispSwap_GetCompressedTexImage},
+    /* [ 105] =   161 */ {__glXDisp_DeleteQueries, __glXDispSwap_DeleteQueries},
+    /* [ 106] =   162 */ {__glXDisp_GenQueries, __glXDispSwap_GenQueries},
+    /* [ 107] =   163 */ {__glXDisp_IsQuery, __glXDispSwap_IsQuery},
+    /* [ 108] =   164 */ {__glXDisp_GetQueryiv, __glXDispSwap_GetQueryiv},
+    /* [ 109] =   165 */ {__glXDisp_GetQueryObjectiv,
+                          __glXDispSwap_GetQueryObjectiv},
+    /* [ 110] =   166 */ {__glXDisp_GetQueryObjectuiv,
+                          __glXDispSwap_GetQueryObjectuiv},
     /* [ 111] =   167 */ {NULL, NULL},
 };
 
@@ -576,52 +575,51 @@ static const void *Render_function_table[408][2] = {
     /* [ 195] =   195 */ {__glXDisp_ColorSubTable, __glXDispSwap_ColorSubTable},
     /* [ 196] =   196 */ {__glXDisp_CopyColorSubTable,
                           __glXDispSwap_CopyColorSubTable},
-    /* [ 197] =   197 */ {__glXDisp_ActiveTextureARB,
-                          __glXDispSwap_ActiveTextureARB},
-    /* [ 198] =   198 */ {__glXDisp_MultiTexCoord1dvARB,
-                          __glXDispSwap_MultiTexCoord1dvARB},
+    /* [ 197] =   197 */ {__glXDisp_ActiveTexture, __glXDispSwap_ActiveTexture},
+    /* [ 198] =   198 */ {__glXDisp_MultiTexCoord1dv,
+                          __glXDispSwap_MultiTexCoord1dv},
     /* [ 199] =   199 */ {__glXDisp_MultiTexCoord1fvARB,
                           __glXDispSwap_MultiTexCoord1fvARB},
-    /* [ 200] =   200 */ {__glXDisp_MultiTexCoord1ivARB,
-                          __glXDispSwap_MultiTexCoord1ivARB},
-    /* [ 201] =   201 */ {__glXDisp_MultiTexCoord1svARB,
-                          __glXDispSwap_MultiTexCoord1svARB},
-    /* [ 202] =   202 */ {__glXDisp_MultiTexCoord2dvARB,
-                          __glXDispSwap_MultiTexCoord2dvARB},
+    /* [ 200] =   200 */ {__glXDisp_MultiTexCoord1iv,
+                          __glXDispSwap_MultiTexCoord1iv},
+    /* [ 201] =   201 */ {__glXDisp_MultiTexCoord1sv,
+                          __glXDispSwap_MultiTexCoord1sv},
+    /* [ 202] =   202 */ {__glXDisp_MultiTexCoord2dv,
+                          __glXDispSwap_MultiTexCoord2dv},
     /* [ 203] =   203 */ {__glXDisp_MultiTexCoord2fvARB,
                           __glXDispSwap_MultiTexCoord2fvARB},
-    /* [ 204] =   204 */ {__glXDisp_MultiTexCoord2ivARB,
-                          __glXDispSwap_MultiTexCoord2ivARB},
-    /* [ 205] =   205 */ {__glXDisp_MultiTexCoord2svARB,
-                          __glXDispSwap_MultiTexCoord2svARB},
-    /* [ 206] =   206 */ {__glXDisp_MultiTexCoord3dvARB,
-                          __glXDispSwap_MultiTexCoord3dvARB},
+    /* [ 204] =   204 */ {__glXDisp_MultiTexCoord2iv,
+                          __glXDispSwap_MultiTexCoord2iv},
+    /* [ 205] =   205 */ {__glXDisp_MultiTexCoord2sv,
+                          __glXDispSwap_MultiTexCoord2sv},
+    /* [ 206] =   206 */ {__glXDisp_MultiTexCoord3dv,
+                          __glXDispSwap_MultiTexCoord3dv},
     /* [ 207] =   207 */ {__glXDisp_MultiTexCoord3fvARB,
                           __glXDispSwap_MultiTexCoord3fvARB},
-    /* [ 208] =   208 */ {__glXDisp_MultiTexCoord3ivARB,
-                          __glXDispSwap_MultiTexCoord3ivARB},
-    /* [ 209] =   209 */ {__glXDisp_MultiTexCoord3svARB,
-                          __glXDispSwap_MultiTexCoord3svARB},
-    /* [ 210] =   210 */ {__glXDisp_MultiTexCoord4dvARB,
-                          __glXDispSwap_MultiTexCoord4dvARB},
+    /* [ 208] =   208 */ {__glXDisp_MultiTexCoord3iv,
+                          __glXDispSwap_MultiTexCoord3iv},
+    /* [ 209] =   209 */ {__glXDisp_MultiTexCoord3sv,
+                          __glXDispSwap_MultiTexCoord3sv},
+    /* [ 210] =   210 */ {__glXDisp_MultiTexCoord4dv,
+                          __glXDispSwap_MultiTexCoord4dv},
     /* [ 211] =   211 */ {__glXDisp_MultiTexCoord4fvARB,
                           __glXDispSwap_MultiTexCoord4fvARB},
-    /* [ 212] =   212 */ {__glXDisp_MultiTexCoord4ivARB,
-                          __glXDispSwap_MultiTexCoord4ivARB},
-    /* [ 213] =   213 */ {__glXDisp_MultiTexCoord4svARB,
-                          __glXDispSwap_MultiTexCoord4svARB},
-    /* [ 214] =   214 */ {__glXDisp_CompressedTexImage1DARB,
-                          __glXDispSwap_CompressedTexImage1DARB},
-    /* [ 215] =   215 */ {__glXDisp_CompressedTexImage2DARB,
-                          __glXDispSwap_CompressedTexImage2DARB},
-    /* [ 216] =   216 */ {__glXDisp_CompressedTexImage3DARB,
-                          __glXDispSwap_CompressedTexImage3DARB},
-    /* [ 217] =   217 */ {__glXDisp_CompressedTexSubImage1DARB,
-                          __glXDispSwap_CompressedTexSubImage1DARB},
-    /* [ 218] =   218 */ {__glXDisp_CompressedTexSubImage2DARB,
-                          __glXDispSwap_CompressedTexSubImage2DARB},
-    /* [ 219] =   219 */ {__glXDisp_CompressedTexSubImage3DARB,
-                          __glXDispSwap_CompressedTexSubImage3DARB},
+    /* [ 212] =   212 */ {__glXDisp_MultiTexCoord4iv,
+                          __glXDispSwap_MultiTexCoord4iv},
+    /* [ 213] =   213 */ {__glXDisp_MultiTexCoord4sv,
+                          __glXDispSwap_MultiTexCoord4sv},
+    /* [ 214] =   214 */ {__glXDisp_CompressedTexImage1D,
+                          __glXDispSwap_CompressedTexImage1D},
+    /* [ 215] =   215 */ {__glXDisp_CompressedTexImage2D,
+                          __glXDispSwap_CompressedTexImage2D},
+    /* [ 216] =   216 */ {__glXDisp_CompressedTexImage3D,
+                          __glXDispSwap_CompressedTexImage3D},
+    /* [ 217] =   217 */ {__glXDisp_CompressedTexSubImage1D,
+                          __glXDispSwap_CompressedTexSubImage1D},
+    /* [ 218] =   218 */ {__glXDisp_CompressedTexSubImage2D,
+                          __glXDispSwap_CompressedTexSubImage2D},
+    /* [ 219] =   219 */ {__glXDisp_CompressedTexSubImage3D,
+                          __glXDispSwap_CompressedTexSubImage3D},
     /* [ 220] =   220 */ {NULL, NULL},
     /* [ 221] =   221 */ {NULL, NULL},
     /* [ 222] =   222 */ {NULL, NULL},
@@ -631,25 +629,21 @@ static const void *Render_function_table[408][2] = {
     /* [ 226] =   226 */ {NULL, NULL},
     /* [ 227] =   227 */ {NULL, NULL},
     /* [ 228] =   228 */ {NULL, NULL},
-    /* [ 229] =   229 */ {__glXDisp_SampleCoverageARB,
-                          __glXDispSwap_SampleCoverageARB},
-    /* [ 230] =   230 */ {__glXDisp_WindowPos3fvMESA,
-                          __glXDispSwap_WindowPos3fvMESA},
-    /* [ 231] =   231 */ {__glXDisp_BeginQueryARB, __glXDispSwap_BeginQueryARB},
-    /* [ 232] =   232 */ {__glXDisp_EndQueryARB, __glXDispSwap_EndQueryARB},
-    /* [ 233] =   233 */ {__glXDisp_DrawBuffersARB,
-                          __glXDispSwap_DrawBuffersARB},
-    /* [ 234] =   234 */ {__glXDisp_ClampColorARB, __glXDispSwap_ClampColorARB},
+    /* [ 229] =   229 */ {__glXDisp_SampleCoverage,
+                          __glXDispSwap_SampleCoverage},
+    /* [ 230] =   230 */ {__glXDisp_WindowPos3fv, __glXDispSwap_WindowPos3fv},
+    /* [ 231] =   231 */ {__glXDisp_BeginQuery, __glXDispSwap_BeginQuery},
+    /* [ 232] =   232 */ {__glXDisp_EndQuery, __glXDispSwap_EndQuery},
+    /* [ 233] =   233 */ {__glXDisp_DrawBuffers, __glXDispSwap_DrawBuffers},
+    /* [ 234] =   234 */ {__glXDisp_ClampColor, __glXDispSwap_ClampColor},
     /* [ 235] =   235 */ {NULL, NULL},
     /* [ 236] =   236 */ {NULL, NULL},
-    /* [ 237] =   237 */ {__glXDisp_FramebufferTextureLayerEXT,
-                          __glXDispSwap_FramebufferTextureLayerEXT},
+    /* [ 237] =   237 */ {__glXDisp_FramebufferTextureLayer,
+                          __glXDispSwap_FramebufferTextureLayer},
     /* [ 238] =   238 */ {NULL, NULL},
     /* [ 239] =   239 */ {NULL, NULL},
-    /* [ 240] =  2048 */ {__glXDisp_SampleMaskSGIS,
-                          __glXDispSwap_SampleMaskSGIS},
-    /* [ 241] =  2049 */ {__glXDisp_SamplePatternSGIS,
-                          __glXDispSwap_SamplePatternSGIS},
+    /* [ 240] =  2048 */ {NULL, NULL},
+    /* [ 241] =  2049 */ {NULL, NULL},
     /* [ 242] =  2050 */ {NULL, NULL},
     /* [ 243] =  2051 */ {NULL, NULL},
     /* [ 244] =  2052 */ {NULL, NULL},
@@ -668,10 +662,10 @@ static const void *Render_function_table[408][2] = {
     /* [ 254] =  2062 */ {NULL, NULL},
     /* [ 255] =  2063 */ {NULL, NULL},
     /* [ 256] =  2064 */ {NULL, NULL},
-    /* [ 257] =  2065 */ {__glXDisp_PointParameterfEXT,
-                          __glXDispSwap_PointParameterfEXT},
-    /* [ 258] =  2066 */ {__glXDisp_PointParameterfvEXT,
-                          __glXDispSwap_PointParameterfvEXT},
+    /* [ 257] =  2065 */ {__glXDisp_PointParameterf,
+                          __glXDispSwap_PointParameterf},
+    /* [ 258] =  2066 */ {__glXDisp_PointParameterfv,
+                          __glXDispSwap_PointParameterfv},
     /* [ 259] =  2067 */ {NULL, NULL},
     /* [ 260] =  2068 */ {NULL, NULL},
     /* [ 261] =  2069 */ {NULL, NULL},
@@ -722,38 +716,35 @@ static const void *Render_function_table[408][2] = {
     /* [ 291] =  4123 */ {__glXDisp_CopyTexSubImage3D,
                           __glXDispSwap_CopyTexSubImage3D},
     /* [ 292] =  4124 */ {__glXDisp_FogCoordfvEXT, __glXDispSwap_FogCoordfvEXT},
-    /* [ 293] =  4125 */ {__glXDisp_FogCoorddvEXT, __glXDispSwap_FogCoorddvEXT},
-    /* [ 294] =  4126 */ {__glXDisp_SecondaryColor3bvEXT,
-                          __glXDispSwap_SecondaryColor3bvEXT},
-    /* [ 295] =  4127 */ {__glXDisp_SecondaryColor3svEXT,
-                          __glXDispSwap_SecondaryColor3svEXT},
+    /* [ 293] =  4125 */ {__glXDisp_FogCoorddv, __glXDispSwap_FogCoorddv},
+    /* [ 294] =  4126 */ {__glXDisp_SecondaryColor3bv,
+                          __glXDispSwap_SecondaryColor3bv},
+    /* [ 295] =  4127 */ {__glXDisp_SecondaryColor3sv,
+                          __glXDispSwap_SecondaryColor3sv},
     /* [ 296] =  4176 */ {NULL, NULL},
     /* [ 297] =  4177 */ {NULL, NULL},
     /* [ 298] =  4178 */ {NULL, NULL},
     /* [ 299] =  4179 */ {NULL, NULL},
-    /* [ 300] =  4180 */ {__glXDisp_BindProgramNV, __glXDispSwap_BindProgramNV},
-    /* [ 301] =  4181 */ {__glXDisp_ExecuteProgramNV,
-                          __glXDispSwap_ExecuteProgramNV},
-    /* [ 302] =  4182 */ {__glXDisp_RequestResidentProgramsNV,
-                          __glXDispSwap_RequestResidentProgramsNV},
-    /* [ 303] =  4183 */ {__glXDisp_LoadProgramNV, __glXDispSwap_LoadProgramNV},
+    /* [ 300] =  4180 */ {__glXDisp_BindProgramARB,
+                          __glXDispSwap_BindProgramARB},
+    /* [ 301] =  4181 */ {NULL, NULL},
+    /* [ 302] =  4182 */ {NULL, NULL},
+    /* [ 303] =  4183 */ {NULL, NULL},
     /* [ 304] =  4184 */ {__glXDisp_ProgramEnvParameter4fvARB,
                           __glXDispSwap_ProgramEnvParameter4fvARB},
     /* [ 305] =  4185 */ {__glXDisp_ProgramEnvParameter4dvARB,
                           __glXDispSwap_ProgramEnvParameter4dvARB},
-    /* [ 306] =  4186 */ {__glXDisp_ProgramParameters4fvNV,
-                          __glXDispSwap_ProgramParameters4fvNV},
-    /* [ 307] =  4187 */ {__glXDisp_ProgramParameters4dvNV,
-                          __glXDispSwap_ProgramParameters4dvNV},
-    /* [ 308] =  4188 */ {__glXDisp_TrackMatrixNV, __glXDispSwap_TrackMatrixNV},
-    /* [ 309] =  4189 */ {__glXDisp_VertexAttrib1svARB,
-                          __glXDispSwap_VertexAttrib1svARB},
-    /* [ 310] =  4190 */ {__glXDisp_VertexAttrib2svARB,
-                          __glXDispSwap_VertexAttrib2svARB},
-    /* [ 311] =  4191 */ {__glXDisp_VertexAttrib3svARB,
-                          __glXDispSwap_VertexAttrib3svARB},
-    /* [ 312] =  4192 */ {__glXDisp_VertexAttrib4svARB,
-                          __glXDispSwap_VertexAttrib4svARB},
+    /* [ 306] =  4186 */ {NULL, NULL},
+    /* [ 307] =  4187 */ {NULL, NULL},
+    /* [ 308] =  4188 */ {NULL, NULL},
+    /* [ 309] =  4189 */ {__glXDisp_VertexAttrib1sv,
+                          __glXDispSwap_VertexAttrib1sv},
+    /* [ 310] =  4190 */ {__glXDisp_VertexAttrib2sv,
+                          __glXDispSwap_VertexAttrib2sv},
+    /* [ 311] =  4191 */ {__glXDisp_VertexAttrib3sv,
+                          __glXDispSwap_VertexAttrib3sv},
+    /* [ 312] =  4192 */ {__glXDisp_VertexAttrib4sv,
+                          __glXDispSwap_VertexAttrib4sv},
     /* [ 313] =  4193 */ {__glXDisp_VertexAttrib1fvARB,
                           __glXDispSwap_VertexAttrib1fvARB},
     /* [ 314] =  4194 */ {__glXDisp_VertexAttrib2fvARB,
@@ -762,16 +753,16 @@ static const void *Render_function_table[408][2] = {
                           __glXDispSwap_VertexAttrib3fvARB},
     /* [ 316] =  4196 */ {__glXDisp_VertexAttrib4fvARB,
                           __glXDispSwap_VertexAttrib4fvARB},
-    /* [ 317] =  4197 */ {__glXDisp_VertexAttrib1dvARB,
-                          __glXDispSwap_VertexAttrib1dvARB},
-    /* [ 318] =  4198 */ {__glXDisp_VertexAttrib2dvARB,
-                          __glXDispSwap_VertexAttrib2dvARB},
-    /* [ 319] =  4199 */ {__glXDisp_VertexAttrib3dvARB,
-                          __glXDispSwap_VertexAttrib3dvARB},
-    /* [ 320] =  4200 */ {__glXDisp_VertexAttrib4dvARB,
-                          __glXDispSwap_VertexAttrib4dvARB},
-    /* [ 321] =  4201 */ {__glXDisp_VertexAttrib4NubvARB,
-                          __glXDispSwap_VertexAttrib4NubvARB},
+    /* [ 317] =  4197 */ {__glXDisp_VertexAttrib1dv,
+                          __glXDispSwap_VertexAttrib1dv},
+    /* [ 318] =  4198 */ {__glXDisp_VertexAttrib2dv,
+                          __glXDispSwap_VertexAttrib2dv},
+    /* [ 319] =  4199 */ {__glXDisp_VertexAttrib3dv,
+                          __glXDispSwap_VertexAttrib3dv},
+    /* [ 320] =  4200 */ {__glXDisp_VertexAttrib4dv,
+                          __glXDispSwap_VertexAttrib4dv},
+    /* [ 321] =  4201 */ {__glXDisp_VertexAttrib4Nubv,
+                          __glXDispSwap_VertexAttrib4Nubv},
     /* [ 322] =  4202 */ {__glXDisp_VertexAttribs1svNV,
                           __glXDispSwap_VertexAttribs1svNV},
     /* [ 323] =  4203 */ {__glXDisp_VertexAttribs2svNV,
@@ -804,82 +795,80 @@ static const void *Render_function_table[408][2] = {
                           __glXDispSwap_ProgramLocalParameter4dvARB},
     /* [ 337] =  4217 */ {__glXDisp_ProgramStringARB,
                           __glXDispSwap_ProgramStringARB},
-    /* [ 338] =  4218 */ {__glXDisp_ProgramNamedParameter4fvNV,
-                          __glXDispSwap_ProgramNamedParameter4fvNV},
-    /* [ 339] =  4219 */ {__glXDisp_ProgramNamedParameter4dvNV,
-                          __glXDispSwap_ProgramNamedParameter4dvNV},
+    /* [ 338] =  4218 */ {NULL, NULL},
+    /* [ 339] =  4219 */ {NULL, NULL},
     /* [ 340] =  4220 */ {__glXDisp_ActiveStencilFaceEXT,
                           __glXDispSwap_ActiveStencilFaceEXT},
-    /* [ 341] =  4221 */ {__glXDisp_PointParameteriNV,
-                          __glXDispSwap_PointParameteriNV},
-    /* [ 342] =  4222 */ {__glXDisp_PointParameterivNV,
-                          __glXDispSwap_PointParameterivNV},
+    /* [ 341] =  4221 */ {__glXDisp_PointParameteri,
+                          __glXDispSwap_PointParameteri},
+    /* [ 342] =  4222 */ {__glXDisp_PointParameteriv,
+                          __glXDispSwap_PointParameteriv},
     /* [ 343] =  4223 */ {NULL, NULL},
     /* [ 344] =  4224 */ {NULL, NULL},
     /* [ 345] =  4225 */ {NULL, NULL},
     /* [ 346] =  4226 */ {NULL, NULL},
     /* [ 347] =  4227 */ {NULL, NULL},
-    /* [ 348] =  4228 */ {__glXDisp_BlendEquationSeparateEXT,
-                          __glXDispSwap_BlendEquationSeparateEXT},
+    /* [ 348] =  4228 */ {__glXDisp_BlendEquationSeparate,
+                          __glXDispSwap_BlendEquationSeparate},
     /* [ 349] =  4229 */ {NULL, NULL},
-    /* [ 350] =  4230 */ {__glXDisp_VertexAttrib4bvARB,
-                          __glXDispSwap_VertexAttrib4bvARB},
-    /* [ 351] =  4231 */ {__glXDisp_VertexAttrib4ivARB,
-                          __glXDispSwap_VertexAttrib4ivARB},
-    /* [ 352] =  4232 */ {__glXDisp_VertexAttrib4ubvARB,
-                          __glXDispSwap_VertexAttrib4ubvARB},
-    /* [ 353] =  4233 */ {__glXDisp_VertexAttrib4usvARB,
-                          __glXDispSwap_VertexAttrib4usvARB},
-    /* [ 354] =  4234 */ {__glXDisp_VertexAttrib4uivARB,
-                          __glXDispSwap_VertexAttrib4uivARB},
-    /* [ 355] =  4235 */ {__glXDisp_VertexAttrib4NbvARB,
-                          __glXDispSwap_VertexAttrib4NbvARB},
-    /* [ 356] =  4236 */ {__glXDisp_VertexAttrib4NsvARB,
-                          __glXDispSwap_VertexAttrib4NsvARB},
-    /* [ 357] =  4237 */ {__glXDisp_VertexAttrib4NivARB,
-                          __glXDispSwap_VertexAttrib4NivARB},
-    /* [ 358] =  4238 */ {__glXDisp_VertexAttrib4NusvARB,
-                          __glXDispSwap_VertexAttrib4NusvARB},
-    /* [ 359] =  4239 */ {__glXDisp_VertexAttrib4NuivARB,
-                          __glXDispSwap_VertexAttrib4NuivARB},
-    /* [ 360] =  4320 */ {__glXDisp_DeleteFramebuffersEXT,
-                          __glXDispSwap_DeleteFramebuffersEXT},
-    /* [ 361] =  4321 */ {__glXDisp_FramebufferTexture1DEXT,
-                          __glXDispSwap_FramebufferTexture1DEXT},
-    /* [ 362] =  4322 */ {__glXDisp_FramebufferTexture2DEXT,
-                          __glXDispSwap_FramebufferTexture2DEXT},
-    /* [ 363] =  4323 */ {__glXDisp_FramebufferTexture3DEXT,
-                          __glXDispSwap_FramebufferTexture3DEXT},
-    /* [ 364] =  4324 */ {__glXDisp_FramebufferRenderbufferEXT,
-                          __glXDispSwap_FramebufferRenderbufferEXT},
-    /* [ 365] =  4325 */ {__glXDisp_GenerateMipmapEXT,
-                          __glXDispSwap_GenerateMipmapEXT},
+    /* [ 350] =  4230 */ {__glXDisp_VertexAttrib4bv,
+                          __glXDispSwap_VertexAttrib4bv},
+    /* [ 351] =  4231 */ {__glXDisp_VertexAttrib4iv,
+                          __glXDispSwap_VertexAttrib4iv},
+    /* [ 352] =  4232 */ {__glXDisp_VertexAttrib4ubv,
+                          __glXDispSwap_VertexAttrib4ubv},
+    /* [ 353] =  4233 */ {__glXDisp_VertexAttrib4usv,
+                          __glXDispSwap_VertexAttrib4usv},
+    /* [ 354] =  4234 */ {__glXDisp_VertexAttrib4uiv,
+                          __glXDispSwap_VertexAttrib4uiv},
+    /* [ 355] =  4235 */ {__glXDisp_VertexAttrib4Nbv,
+                          __glXDispSwap_VertexAttrib4Nbv},
+    /* [ 356] =  4236 */ {__glXDisp_VertexAttrib4Nsv,
+                          __glXDispSwap_VertexAttrib4Nsv},
+    /* [ 357] =  4237 */ {__glXDisp_VertexAttrib4Niv,
+                          __glXDispSwap_VertexAttrib4Niv},
+    /* [ 358] =  4238 */ {__glXDisp_VertexAttrib4Nusv,
+                          __glXDispSwap_VertexAttrib4Nusv},
+    /* [ 359] =  4239 */ {__glXDisp_VertexAttrib4Nuiv,
+                          __glXDispSwap_VertexAttrib4Nuiv},
+    /* [ 360] =  4320 */ {__glXDisp_DeleteFramebuffers,
+                          __glXDispSwap_DeleteFramebuffers},
+    /* [ 361] =  4321 */ {__glXDisp_FramebufferTexture1D,
+                          __glXDispSwap_FramebufferTexture1D},
+    /* [ 362] =  4322 */ {__glXDisp_FramebufferTexture2D,
+                          __glXDispSwap_FramebufferTexture2D},
+    /* [ 363] =  4323 */ {__glXDisp_FramebufferTexture3D,
+                          __glXDispSwap_FramebufferTexture3D},
+    /* [ 364] =  4324 */ {__glXDisp_FramebufferRenderbuffer,
+                          __glXDispSwap_FramebufferRenderbuffer},
+    /* [ 365] =  4325 */ {__glXDisp_GenerateMipmap,
+                          __glXDispSwap_GenerateMipmap},
     /* [ 366] =  4326 */ {NULL, NULL},
     /* [ 367] =  4327 */ {NULL, NULL},
     /* [ 368] =  4328 */ {NULL, NULL},
     /* [ 369] =  4329 */ {NULL, NULL},
-    /* [ 370] =  4330 */ {__glXDisp_BlitFramebufferEXT,
-                          __glXDispSwap_BlitFramebufferEXT},
+    /* [ 370] =  4330 */ {__glXDisp_BlitFramebuffer,
+                          __glXDispSwap_BlitFramebuffer},
     /* [ 371] =  4331 */ {__glXDisp_RenderbufferStorageMultisample,
                           __glXDispSwap_RenderbufferStorageMultisample},
     /* [ 372] =  4332 */ {NULL, NULL},
     /* [ 373] =  4333 */ {NULL, NULL},
     /* [ 374] =  4334 */ {NULL, NULL},
     /* [ 375] =  4335 */ {NULL, NULL},
-    /* [ 376] =  4128 */ {__glXDisp_SecondaryColor3ivEXT,
-                          __glXDispSwap_SecondaryColor3ivEXT},
+    /* [ 376] =  4128 */ {__glXDisp_SecondaryColor3iv,
+                          __glXDispSwap_SecondaryColor3iv},
     /* [ 377] =  4129 */ {__glXDisp_SecondaryColor3fvEXT,
                           __glXDispSwap_SecondaryColor3fvEXT},
-    /* [ 378] =  4130 */ {__glXDisp_SecondaryColor3dvEXT,
-                          __glXDispSwap_SecondaryColor3dvEXT},
-    /* [ 379] =  4131 */ {__glXDisp_SecondaryColor3ubvEXT,
-                          __glXDispSwap_SecondaryColor3ubvEXT},
-    /* [ 380] =  4132 */ {__glXDisp_SecondaryColor3usvEXT,
-                          __glXDispSwap_SecondaryColor3usvEXT},
-    /* [ 381] =  4133 */ {__glXDisp_SecondaryColor3uivEXT,
-                          __glXDispSwap_SecondaryColor3uivEXT},
-    /* [ 382] =  4134 */ {__glXDisp_BlendFuncSeparateEXT,
-                          __glXDispSwap_BlendFuncSeparateEXT},
+    /* [ 378] =  4130 */ {__glXDisp_SecondaryColor3dv,
+                          __glXDispSwap_SecondaryColor3dv},
+    /* [ 379] =  4131 */ {__glXDisp_SecondaryColor3ubv,
+                          __glXDispSwap_SecondaryColor3ubv},
+    /* [ 380] =  4132 */ {__glXDisp_SecondaryColor3usv,
+                          __glXDispSwap_SecondaryColor3usv},
+    /* [ 381] =  4133 */ {__glXDisp_SecondaryColor3uiv,
+                          __glXDispSwap_SecondaryColor3uiv},
+    /* [ 382] =  4134 */ {__glXDisp_BlendFuncSeparate,
+                          __glXDispSwap_BlendFuncSeparate},
     /* [ 383] =  4135 */ {NULL, NULL},
     /* [ 384] =  4264 */ {NULL, NULL},
     /* [ 385] =  4265 */ {__glXDisp_VertexAttrib1svNV,
@@ -914,14 +903,14 @@ static const void *Render_function_table[408][2] = {
     /* [ 401] =  4313 */ {NULL, NULL},
     /* [ 402] =  4314 */ {NULL, NULL},
     /* [ 403] =  4315 */ {NULL, NULL},
-    /* [ 404] =  4316 */ {__glXDisp_BindRenderbufferEXT,
-                          __glXDispSwap_BindRenderbufferEXT},
-    /* [ 405] =  4317 */ {__glXDisp_DeleteRenderbuffersEXT,
-                          __glXDispSwap_DeleteRenderbuffersEXT},
-    /* [ 406] =  4318 */ {__glXDisp_RenderbufferStorageEXT,
-                          __glXDispSwap_RenderbufferStorageEXT},
-    /* [ 407] =  4319 */ {__glXDisp_BindFramebufferEXT,
-                          __glXDispSwap_BindFramebufferEXT},
+    /* [ 404] =  4316 */ {__glXDisp_BindRenderbuffer,
+                          __glXDispSwap_BindRenderbuffer},
+    /* [ 405] =  4317 */ {__glXDisp_DeleteRenderbuffers,
+                          __glXDispSwap_DeleteRenderbuffers},
+    /* [ 406] =  4318 */ {__glXDisp_RenderbufferStorage,
+                          __glXDispSwap_RenderbufferStorage},
+    /* [ 407] =  4319 */ {__glXDisp_BindFramebuffer,
+                          __glXDispSwap_BindFramebuffer},
 };
 
 static const int_fast16_t Render_size_table[408][2] = {
@@ -1165,8 +1154,8 @@ static const int_fast16_t Render_size_table[408][2] = {
     /* [237] =   237 */ {24, ~0},
     /* [238] =   238 */ {0, ~0},
     /* [239] =   239 */ {0, ~0},
-    /* [240] =  2048 */ {12, ~0},
-    /* [241] =  2049 */ {8, ~0},
+    /* [240] =  2048 */ {0, ~0},
+    /* [241] =  2049 */ {0, ~0},
     /* [242] =  2050 */ {0, ~0},
     /* [243] =  2051 */ {0, ~0},
     /* [244] =  2052 */ {0, ~0},
@@ -1226,14 +1215,14 @@ static const int_fast16_t Render_size_table[408][2] = {
     /* [298] =  4178 */ {0, ~0},
     /* [299] =  4179 */ {0, ~0},
     /* [300] =  4180 */ {12, ~0},
-    /* [301] =  4181 */ {28, ~0},
-    /* [302] =  4182 */ {8, 51},
-    /* [303] =  4183 */ {16, 52},
+    /* [301] =  4181 */ {0, ~0},
+    /* [302] =  4182 */ {0, ~0},
+    /* [303] =  4183 */ {0, ~0},
     /* [304] =  4184 */ {28, ~0},
     /* [305] =  4185 */ {44, ~0},
-    /* [306] =  4186 */ {16, 53},
-    /* [307] =  4187 */ {16, 54},
-    /* [308] =  4188 */ {20, ~0},
+    /* [306] =  4186 */ {0, ~0},
+    /* [307] =  4187 */ {0, ~0},
+    /* [308] =  4188 */ {0, ~0},
     /* [309] =  4189 */ {12, ~0},
     /* [310] =  4190 */ {12, ~0},
     /* [311] =  4191 */ {16, ~0},
@@ -1247,27 +1236,27 @@ static const int_fast16_t Render_size_table[408][2] = {
     /* [319] =  4199 */ {32, ~0},
     /* [320] =  4200 */ {40, ~0},
     /* [321] =  4201 */ {12, ~0},
-    /* [322] =  4202 */ {12, 55},
-    /* [323] =  4203 */ {12, 56},
-    /* [324] =  4204 */ {12, 57},
-    /* [325] =  4205 */ {12, 58},
-    /* [326] =  4206 */ {12, 59},
-    /* [327] =  4207 */ {12, 60},
-    /* [328] =  4208 */ {12, 61},
-    /* [329] =  4209 */ {12, 62},
-    /* [330] =  4210 */ {12, 63},
-    /* [331] =  4211 */ {12, 64},
-    /* [332] =  4212 */ {12, 65},
-    /* [333] =  4213 */ {12, 66},
-    /* [334] =  4214 */ {12, 67},
+    /* [322] =  4202 */ {12, 51},
+    /* [323] =  4203 */ {12, 52},
+    /* [324] =  4204 */ {12, 53},
+    /* [325] =  4205 */ {12, 54},
+    /* [326] =  4206 */ {12, 55},
+    /* [327] =  4207 */ {12, 56},
+    /* [328] =  4208 */ {12, 57},
+    /* [329] =  4209 */ {12, 58},
+    /* [330] =  4210 */ {12, 59},
+    /* [331] =  4211 */ {12, 60},
+    /* [332] =  4212 */ {12, 61},
+    /* [333] =  4213 */ {12, 62},
+    /* [334] =  4214 */ {12, 63},
     /* [335] =  4215 */ {28, ~0},
     /* [336] =  4216 */ {44, ~0},
-    /* [337] =  4217 */ {16, 68},
-    /* [338] =  4218 */ {28, 69},
-    /* [339] =  4219 */ {44, 70},
+    /* [337] =  4217 */ {16, 64},
+    /* [338] =  4218 */ {0, ~0},
+    /* [339] =  4219 */ {0, ~0},
     /* [340] =  4220 */ {8, ~0},
     /* [341] =  4221 */ {12, ~0},
-    /* [342] =  4222 */ {8, 71},
+    /* [342] =  4222 */ {8, 65},
     /* [343] =  4223 */ {0, ~0},
     /* [344] =  4224 */ {0, ~0},
     /* [345] =  4225 */ {0, ~0},
@@ -1285,7 +1274,7 @@ static const int_fast16_t Render_size_table[408][2] = {
     /* [357] =  4237 */ {24, ~0},
     /* [358] =  4238 */ {16, ~0},
     /* [359] =  4239 */ {24, ~0},
-    /* [360] =  4320 */ {8, 72},
+    /* [360] =  4320 */ {8, 66},
     /* [361] =  4321 */ {24, ~0},
     /* [362] =  4322 */ {24, ~0},
     /* [363] =  4323 */ {28, ~0},
@@ -1330,12 +1319,12 @@ static const int_fast16_t Render_size_table[408][2] = {
     /* [402] =  4314 */ {0, ~0},
     /* [403] =  4315 */ {0, ~0},
     /* [404] =  4316 */ {12, ~0},
-    /* [405] =  4317 */ {8, 73},
+    /* [405] =  4317 */ {8, 67},
     /* [406] =  4318 */ {20, ~0},
     /* [407] =  4319 */ {12, ~0},
 };
 
-static const gl_proto_size_func Render_size_func_table[74] = {
+static const gl_proto_size_func Render_size_func_table[68] = {
     __glXCallListsReqSize,
     __glXBitmapReqSize,
     __glXFogfvReqSize,
@@ -1366,17 +1355,17 @@ static const gl_proto_size_func Render_size_func_table[74] = {
     __glXDrawPixelsReqSize,
     __glXDrawArraysReqSize,
     __glXColorSubTableReqSize,
-    __glXCompressedTexImage1DARBReqSize,
-    __glXCompressedTexImage2DARBReqSize,
-    __glXCompressedTexImage3DARBReqSize,
-    __glXCompressedTexSubImage1DARBReqSize,
-    __glXCompressedTexSubImage2DARBReqSize,
-    __glXCompressedTexSubImage3DARBReqSize,
-    __glXDrawBuffersARBReqSize,
+    __glXCompressedTexImage1DReqSize,
+    __glXCompressedTexImage2DReqSize,
+    __glXCompressedTexImage3DReqSize,
+    __glXCompressedTexSubImage1DReqSize,
+    __glXCompressedTexSubImage2DReqSize,
+    __glXCompressedTexSubImage3DReqSize,
+    __glXDrawBuffersReqSize,
     __glXColorTableReqSize,
     __glXColorTableParameterfvReqSize,
     __glXColorTableParameterivReqSize,
-    __glXPointParameterfvEXTReqSize,
+    __glXPointParameterfvReqSize,
     __glXTexSubImage1DReqSize,
     __glXTexSubImage2DReqSize,
     __glXConvolutionFilter1DReqSize,
@@ -1387,10 +1376,6 @@ static const gl_proto_size_func Render_size_func_table[74] = {
     __glXTexImage3DReqSize,
     __glXTexSubImage3DReqSize,
     __glXPrioritizeTexturesReqSize,
-    __glXRequestResidentProgramsNVReqSize,
-    __glXLoadProgramNVReqSize,
-    __glXProgramParameters4fvNVReqSize,
-    __glXProgramParameters4dvNVReqSize,
     __glXVertexAttribs1svNVReqSize,
     __glXVertexAttribs2svNVReqSize,
     __glXVertexAttribs3svNVReqSize,
@@ -1405,11 +1390,9 @@ static const gl_proto_size_func Render_size_func_table[74] = {
     __glXVertexAttribs4dvNVReqSize,
     __glXVertexAttribs4ubvNVReqSize,
     __glXProgramStringARBReqSize,
-    __glXProgramNamedParameter4fvNVReqSize,
-    __glXProgramNamedParameter4dvNVReqSize,
-    __glXPointParameterivNVReqSize,
-    __glXDeleteFramebuffersEXTReqSize,
-    __glXDeleteRenderbuffersEXTReqSize,
+    __glXPointParameterivReqSize,
+    __glXDeleteFramebuffersReqSize,
+    __glXDeleteRenderbuffersReqSize,
 };
 
 const struct __glXDispatchInfo Render_dispatch_info = {
@@ -1711,19 +1694,13 @@ static const void *VendorPriv_function_table[104][2] = {
                          __glXDispSwap_GetProgramEnvParameterfvARB},
     /* [ 25] =  1297 */ {__glXDisp_GetProgramEnvParameterdvARB,
                          __glXDispSwap_GetProgramEnvParameterdvARB},
-    /* [ 26] =  1298 */ {__glXDisp_GetProgramivNV,
-                         __glXDispSwap_GetProgramivNV},
-    /* [ 27] =  1299 */ {__glXDisp_GetProgramStringNV,
-                         __glXDispSwap_GetProgramStringNV},
-    /* [ 28] =  1300 */ {__glXDisp_GetTrackMatrixivNV,
-                         __glXDispSwap_GetTrackMatrixivNV},
-    /* [ 29] =  1301 */ {__glXDisp_GetVertexAttribdvARB,
-                         __glXDispSwap_GetVertexAttribdvARB},
-    /* [ 30] =  1302 */ {__glXDisp_GetVertexAttribfvARB,
-                         __glXDispSwap_GetVertexAttribfvARB},
-    /* [ 31] =  1303 */ {__glXDisp_GetVertexAttribivNV,
-                         __glXDispSwap_GetVertexAttribivNV},
-    /* [ 32] =  1304 */ {__glXDisp_IsProgramNV, __glXDispSwap_IsProgramNV},
+    /* [ 26] =  1298 */ {NULL, NULL},
+    /* [ 27] =  1299 */ {NULL, NULL},
+    /* [ 28] =  1300 */ {NULL, NULL},
+    /* [ 29] =  1301 */ {NULL, NULL},
+    /* [ 30] =  1302 */ {NULL, NULL},
+    /* [ 31] =  1303 */ {NULL, NULL},
+    /* [ 32] =  1304 */ {__glXDisp_IsProgramARB, __glXDispSwap_IsProgramARB},
     /* [ 33] =  1305 */ {__glXDisp_GetProgramLocalParameterfvARB,
                          __glXDispSwap_GetProgramLocalParameterfvARB},
     /* [ 34] =  1306 */ {__glXDisp_GetProgramLocalParameterdvARB,
@@ -1733,20 +1710,18 @@ static const void *VendorPriv_function_table[104][2] = {
     /* [ 36] =  1308 */ {__glXDisp_GetProgramStringARB,
                          __glXDispSwap_GetProgramStringARB},
     /* [ 37] =  1309 */ {NULL, NULL},
-    /* [ 38] =  1310 */ {__glXDisp_GetProgramNamedParameterfvNV,
-                         __glXDispSwap_GetProgramNamedParameterfvNV},
-    /* [ 39] =  1311 */ {__glXDisp_GetProgramNamedParameterdvNV,
-                         __glXDispSwap_GetProgramNamedParameterdvNV},
+    /* [ 38] =  1310 */ {NULL, NULL},
+    /* [ 39] =  1311 */ {NULL, NULL},
     /* [ 40] =  1288 */ {NULL, NULL},
     /* [ 41] =  1289 */ {NULL, NULL},
     /* [ 42] =  1290 */ {NULL, NULL},
     /* [ 43] =  1291 */ {NULL, NULL},
     /* [ 44] =  1292 */ {NULL, NULL},
-    /* [ 45] =  1293 */ {__glXDisp_AreProgramsResidentNV,
-                         __glXDispSwap_AreProgramsResidentNV},
-    /* [ 46] =  1294 */ {__glXDisp_DeleteProgramsNV,
-                         __glXDispSwap_DeleteProgramsNV},
-    /* [ 47] =  1295 */ {__glXDisp_GenProgramsNV, __glXDispSwap_GenProgramsNV},
+    /* [ 45] =  1293 */ {NULL, NULL},
+    /* [ 46] =  1294 */ {__glXDisp_DeleteProgramsARB,
+                         __glXDispSwap_DeleteProgramsARB},
+    /* [ 47] =  1295 */ {__glXDisp_GenProgramsARB,
+                         __glXDispSwap_GenProgramsARB},
     /* [ 48] =  1328 */ {NULL, NULL},
     /* [ 49] =  1329 */ {NULL, NULL},
     /* [ 50] =  1330 */ {__glXDisp_BindTexImageEXT,
@@ -1763,20 +1738,19 @@ static const void *VendorPriv_function_table[104][2] = {
     /* [ 59] =  1419 */ {NULL, NULL},
     /* [ 60] =  1420 */ {NULL, NULL},
     /* [ 61] =  1421 */ {NULL, NULL},
-    /* [ 62] =  1422 */ {__glXDisp_IsRenderbufferEXT,
-                         __glXDispSwap_IsRenderbufferEXT},
-    /* [ 63] =  1423 */ {__glXDisp_GenRenderbuffersEXT,
-                         __glXDispSwap_GenRenderbuffersEXT},
-    /* [ 64] =  1424 */ {__glXDisp_GetRenderbufferParameterivEXT,
-                         __glXDispSwap_GetRenderbufferParameterivEXT},
-    /* [ 65] =  1425 */ {__glXDisp_IsFramebufferEXT,
-                         __glXDispSwap_IsFramebufferEXT},
-    /* [ 66] =  1426 */ {__glXDisp_GenFramebuffersEXT,
-                         __glXDispSwap_GenFramebuffersEXT},
-    /* [ 67] =  1427 */ {__glXDisp_CheckFramebufferStatusEXT,
-                         __glXDispSwap_CheckFramebufferStatusEXT},
-    /* [ 68] =  1428 */ {__glXDisp_GetFramebufferAttachmentParameterivEXT,
-                         __glXDispSwap_GetFramebufferAttachmentParameterivEXT},
+    /* [ 62] =  1422 */ {__glXDisp_IsRenderbuffer,
+                         __glXDispSwap_IsRenderbuffer},
+    /* [ 63] =  1423 */ {__glXDisp_GenRenderbuffers,
+                         __glXDispSwap_GenRenderbuffers},
+    /* [ 64] =  1424 */ {__glXDisp_GetRenderbufferParameteriv,
+                         __glXDispSwap_GetRenderbufferParameteriv},
+    /* [ 65] =  1425 */ {__glXDisp_IsFramebuffer, __glXDispSwap_IsFramebuffer},
+    /* [ 66] =  1426 */ {__glXDisp_GenFramebuffers,
+                         __glXDispSwap_GenFramebuffers},
+    /* [ 67] =  1427 */ {__glXDisp_CheckFramebufferStatus,
+                         __glXDispSwap_CheckFramebufferStatus},
+    /* [ 68] =  1428 */ {__glXDisp_GetFramebufferAttachmentParameteriv,
+                         __glXDispSwap_GetFramebufferAttachmentParameteriv},
     /* [ 69] =  1429 */ {NULL, NULL},
     /* [ 70] =  1430 */ {NULL, NULL},
     /* [ 71] =  1431 */ {NULL, NULL},
index 49d6db5..2018de6 100644 (file)
 #include "unpack.h"
 #include "indirect_size_get.h"
 #include "indirect_dispatch.h"
-#include "glapitable.h"
-#include "glapi.h"
-#include "glthread.h"
-#include "dispatch.h"
 
 int
-__glXDisp_GetCompressedTexImageARB(struct __GLXclientStateRec *cl, GLbyte * pc)
+__glXDisp_GetCompressedTexImage(struct __GLXclientStateRec *cl, GLbyte * pc)
 {
     xGLXSingleReq *const req = (xGLXSingleReq *) pc;
     int error;
@@ -54,16 +50,15 @@ __glXDisp_GetCompressedTexImageARB(struct __GLXclientStateRec *cl, GLbyte * pc)
         GLint compsize = 0;
         char *answer = NULL, answerBuffer[200];
 
-        CALL_GetTexLevelParameteriv(GET_DISPATCH(),
-                                    (target, level,
-                                     GL_TEXTURE_COMPRESSED_IMAGE_SIZE,
-                                     &compsize));
+        glGetTexLevelParameteriv(target, level, GL_TEXTURE_COMPRESSED_IMAGE_SIZE,
+                                 &compsize);
 
         if (compsize != 0) {
+            PFNGLGETCOMPRESSEDTEXIMAGEARBPROC GetCompressedTexImageARB =
+                __glGetProcAddress("glGetCompressedTexImageARB");
             __GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1);
             __glXClearErrorOccured();
-            CALL_GetCompressedTexImageARB(GET_DISPATCH(),
-                                          (target, level, answer));
+            GetCompressedTexImageARB(target, level, answer);
         }
 
         if (__glXErrorOccured()) {
@@ -72,7 +67,7 @@ __glXDisp_GetCompressedTexImageARB(struct __GLXclientStateRec *cl, GLbyte * pc)
         }
         else {
             __GLX_BEGIN_REPLY(compsize);
-            ((xGLXGetTexImageReply *) & __glXReply)->width = compsize;
+            ((xGLXGetTexImageReply *) &__glXReply)->width = compsize;
             __GLX_SEND_HEADER();
             __GLX_SEND_VOID_ARRAY(compsize);
         }
@@ -84,8 +79,7 @@ __glXDisp_GetCompressedTexImageARB(struct __GLXclientStateRec *cl, GLbyte * pc)
 }
 
 int
-__glXDispSwap_GetCompressedTexImageARB(struct __GLXclientStateRec *cl,
-                                       GLbyte * pc)
+__glXDispSwap_GetCompressedTexImage(struct __GLXclientStateRec *cl, GLbyte * pc)
 {
     xGLXSingleReq *const req = (xGLXSingleReq *) pc;
     int error;
@@ -100,16 +94,15 @@ __glXDispSwap_GetCompressedTexImageARB(struct __GLXclientStateRec *cl,
         GLint compsize = 0;
         char *answer = NULL, answerBuffer[200];
 
-        CALL_GetTexLevelParameteriv(GET_DISPATCH(),
-                                    (target, level,
-                                     GL_TEXTURE_COMPRESSED_IMAGE_SIZE,
-                                     &compsize));
+        glGetTexLevelParameteriv(target, level, GL_TEXTURE_COMPRESSED_IMAGE_SIZE,
+                                 &compsize);
 
         if (compsize != 0) {
+            PFNGLGETCOMPRESSEDTEXIMAGEARBPROC GetCompressedTexImageARB =
+                __glGetProcAddress("glGetCompressedTexImageARB");
             __GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1);
             __glXClearErrorOccured();
-            CALL_GetCompressedTexImageARB(GET_DISPATCH(),
-                                          (target, level, answer));
+            GetCompressedTexImageARB(target, level, answer);
         }
 
         if (__glXErrorOccured()) {
@@ -118,7 +111,7 @@ __glXDispSwap_GetCompressedTexImageARB(struct __GLXclientStateRec *cl,
         }
         else {
             __GLX_BEGIN_REPLY(compsize);
-            ((xGLXGetTexImageReply *) & __glXReply)->width = compsize;
+            ((xGLXGetTexImageReply *) &__glXReply)->width = compsize;
             __GLX_SEND_HEADER();
             __GLX_SEND_VOID_ARRAY(compsize);
         }
index a30b1f8..f9d1243 100644 (file)
 #include "glxserver.h"
 #include "glxbyteorder.h"
 #include "singlesize.h"
-#include "glapitable.h"
-#include "glapi.h"
-#include "glthread.h"
-#include "dispatch.h"
 #include "glxext.h"
 #include "indirect_table.h"
 #include "indirect_util.h"
@@ -57,8 +53,7 @@ __glGetBooleanv_variable_size(GLenum e)
     if (e == GL_COMPRESSED_TEXTURE_FORMATS) {
         GLint temp;
 
-        CALL_GetIntegerv(GET_DISPATCH(),
-                         (GL_NUM_COMPRESSED_TEXTURE_FORMATS, &temp));
+        glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &temp);
         return temp;
     }
     else {
index 8cf74a6..8d9b5f4 100644 (file)
 #include "unpack.h"
 #include "indirect_size.h"
 #include "indirect_dispatch.h"
-#include "glapitable.h"
-#include "glapi.h"
-#include "glthread.h"
-#include "dispatch.h"
 
 void
 __glXDisp_Map1f(GLbyte * pc)
@@ -55,7 +51,7 @@ __glXDisp_Map1f(GLbyte * pc)
     points = (GLfloat *) (pc + 16);
     k = __glMap1f_size(target);
 
-    CALL_Map1f(GET_DISPATCH(), (target, u1, u2, k, order, points));
+    glMap1f(target, u1, u2, k, order, points);
 }
 
 void
@@ -78,9 +74,7 @@ __glXDisp_Map2f(GLbyte * pc)
     ustride = vorder * k;
     vstride = k;
 
-    CALL_Map2f(GET_DISPATCH(),
-               (target, u1, u2, ustride, uorder, v1, v2, vstride, vorder,
-                points));
+    glMap2f(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points);
 }
 
 void
@@ -126,7 +120,7 @@ __glXDisp_Map1d(GLbyte * pc)
 #else
     points = (GLdouble *) pc;
 #endif
-    CALL_Map1d(GET_DISPATCH(), (target, u1, u2, k, order, points));
+    glMap1d(target, u1, u2, k, order, points);
 }
 
 void
@@ -178,9 +172,7 @@ __glXDisp_Map2d(GLbyte * pc)
 #else
     points = (GLdouble *) pc;
 #endif
-    CALL_Map2d(GET_DISPATCH(),
-               (target, u1, u2, ustride, uorder, v1, v2, vstride, vorder,
-                points));
+    glMap2d(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points);
 }
 
 void
@@ -215,40 +207,45 @@ __glXDisp_DrawArrays(GLbyte * pc)
 
         switch (component) {
         case GL_VERTEX_ARRAY:
-            CALL_EnableClientState(GET_DISPATCH(), (GL_VERTEX_ARRAY));
-            CALL_VertexPointer(GET_DISPATCH(), (numVals, datatype, stride, pc));
+            glEnableClientState(GL_VERTEX_ARRAY);
+            glVertexPointer(numVals, datatype, stride, pc);
             break;
         case GL_NORMAL_ARRAY:
-            CALL_EnableClientState(GET_DISPATCH(), (GL_NORMAL_ARRAY));
-            CALL_NormalPointer(GET_DISPATCH(), (datatype, stride, pc));
+            glEnableClientState(GL_NORMAL_ARRAY);
+            glNormalPointer(datatype, stride, pc);
             break;
         case GL_COLOR_ARRAY:
-            CALL_EnableClientState(GET_DISPATCH(), (GL_COLOR_ARRAY));
-            CALL_ColorPointer(GET_DISPATCH(), (numVals, datatype, stride, pc));
+            glEnableClientState(GL_COLOR_ARRAY);
+            glColorPointer(numVals, datatype, stride, pc);
             break;
         case GL_INDEX_ARRAY:
-            CALL_EnableClientState(GET_DISPATCH(), (GL_INDEX_ARRAY));
-            CALL_IndexPointer(GET_DISPATCH(), (datatype, stride, pc));
+            glEnableClientState(GL_INDEX_ARRAY);
+            glIndexPointer(datatype, stride, pc);
             break;
         case GL_TEXTURE_COORD_ARRAY:
-            CALL_EnableClientState(GET_DISPATCH(), (GL_TEXTURE_COORD_ARRAY));
-            CALL_TexCoordPointer(GET_DISPATCH(),
-                                 (numVals, datatype, stride, pc));
+            glEnableClientState(GL_TEXTURE_COORD_ARRAY);
+            glTexCoordPointer(numVals, datatype, stride, pc);
             break;
         case GL_EDGE_FLAG_ARRAY:
-            CALL_EnableClientState(GET_DISPATCH(), (GL_EDGE_FLAG_ARRAY));
-            CALL_EdgeFlagPointer(GET_DISPATCH(),
-                                 (stride, (const GLboolean *) pc));
+            glEnableClientState(GL_EDGE_FLAG_ARRAY);
+            glEdgeFlagPointer(stride, (const GLboolean *) pc);
             break;
         case GL_SECONDARY_COLOR_ARRAY:
-            CALL_EnableClientState(GET_DISPATCH(), (GL_SECONDARY_COLOR_ARRAY));
-            CALL_SecondaryColorPointerEXT(GET_DISPATCH(),
-                                          (numVals, datatype, stride, pc));
+        {
+            PFNGLSECONDARYCOLORPOINTERPROC SecondaryColorPointerEXT =
+                __glGetProcAddress("glSecondaryColorPointerEXT");
+            glEnableClientState(GL_SECONDARY_COLOR_ARRAY);
+            SecondaryColorPointerEXT(numVals, datatype, stride, pc);
             break;
+        }
         case GL_FOG_COORD_ARRAY:
-            CALL_EnableClientState(GET_DISPATCH(), (GL_FOG_COORD_ARRAY));
-            CALL_FogCoordPointerEXT(GET_DISPATCH(), (datatype, stride, pc));
+        {
+            PFNGLFOGCOORDPOINTERPROC FogCoordPointerEXT =
+                __glGetProcAddress("glFogCoordPointerEXT");
+            glEnableClientState(GL_FOG_COORD_ARRAY);
+            FogCoordPointerEXT(datatype, stride, pc);
             break;
+        }
         default:
             break;
         }
@@ -256,15 +253,15 @@ __glXDisp_DrawArrays(GLbyte * pc)
         pc += __GLX_PAD(numVals * __glXTypeSize(datatype));
     }
 
-    CALL_DrawArrays(GET_DISPATCH(), (primType, 0, numVertexes));
+    glDrawArrays(primType, 0, numVertexes);
 
     /* turn off anything we might have turned on */
-    CALL_DisableClientState(GET_DISPATCH(), (GL_VERTEX_ARRAY));
-    CALL_DisableClientState(GET_DISPATCH(), (GL_NORMAL_ARRAY));
-    CALL_DisableClientState(GET_DISPATCH(), (GL_COLOR_ARRAY));
-    CALL_DisableClientState(GET_DISPATCH(), (GL_INDEX_ARRAY));
-    CALL_DisableClientState(GET_DISPATCH(), (GL_TEXTURE_COORD_ARRAY));
-    CALL_DisableClientState(GET_DISPATCH(), (GL_EDGE_FLAG_ARRAY));
-    CALL_DisableClientState(GET_DISPATCH(), (GL_SECONDARY_COLOR_ARRAY));
-    CALL_DisableClientState(GET_DISPATCH(), (GL_FOG_COORD_ARRAY));
+    glDisableClientState(GL_VERTEX_ARRAY);
+    glDisableClientState(GL_NORMAL_ARRAY);
+    glDisableClientState(GL_COLOR_ARRAY);
+    glDisableClientState(GL_INDEX_ARRAY);
+    glDisableClientState(GL_TEXTURE_COORD_ARRAY);
+    glDisableClientState(GL_EDGE_FLAG_ARRAY);
+    glDisableClientState(GL_SECONDARY_COLOR_ARRAY);
+    glDisableClientState(GL_FOG_COORD_ARRAY);
 }
index 8b5d9da..6ed364f 100644 (file)
 #include "unpack.h"
 #include "indirect_size.h"
 #include "indirect_dispatch.h"
-#include "glapitable.h"
-#include "glapi.h"
-#include "glthread.h"
-#include "dispatch.h"
 
 void
 __glXDispSwap_Map1f(GLbyte * pc)
@@ -73,7 +69,7 @@ __glXDispSwap_Map1f(GLbyte * pc)
     }
     __GLX_SWAP_FLOAT_ARRAY(points, compsize);
 
-    CALL_Map1f(GET_DISPATCH(), (target, u1, u2, k, order, points));
+    glMap1f(target, u1, u2, k, order, points);
 }
 
 void
@@ -117,9 +113,7 @@ __glXDispSwap_Map2f(GLbyte * pc)
     }
     __GLX_SWAP_FLOAT_ARRAY(points, compsize);
 
-    CALL_Map2f(GET_DISPATCH(),
-               (target, u1, u2, ustride, uorder, v1, v2, vstride, vorder,
-                points));
+    glMap2f(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points);
 }
 
 void
@@ -167,7 +161,7 @@ __glXDispSwap_Map1d(GLbyte * pc)
 #else
     points = (GLdouble *) pc;
 #endif
-    CALL_Map1d(GET_DISPATCH(), (target, u1, u2, k, order, points));
+    glMap1d(target, u1, u2, k, order, points);
 }
 
 void
@@ -223,9 +217,7 @@ __glXDispSwap_Map2d(GLbyte * pc)
 #else
     points = (GLdouble *) pc;
 #endif
-    CALL_Map2d(GET_DISPATCH(),
-               (target, u1, u2, ustride, uorder, v1, v2, vstride, vorder,
-                points));
+    glMap2d(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points);
 }
 
 static void
@@ -337,40 +329,45 @@ __glXDispSwap_DrawArrays(GLbyte * pc)
 
         switch (component) {
         case GL_VERTEX_ARRAY:
-            CALL_EnableClientState(GET_DISPATCH(), (GL_VERTEX_ARRAY));
-            CALL_VertexPointer(GET_DISPATCH(), (numVals, datatype, stride, pc));
+            glEnableClientState(GL_VERTEX_ARRAY);
+            glVertexPointer(numVals, datatype, stride, pc);
             break;
         case GL_NORMAL_ARRAY:
-            CALL_EnableClientState(GET_DISPATCH(), (GL_NORMAL_ARRAY));
-            CALL_NormalPointer(GET_DISPATCH(), (datatype, stride, pc));
+            glEnableClientState(GL_NORMAL_ARRAY);
+            glNormalPointer(datatype, stride, pc);
             break;
         case GL_COLOR_ARRAY:
-            CALL_EnableClientState(GET_DISPATCH(), (GL_COLOR_ARRAY));
-            CALL_ColorPointer(GET_DISPATCH(), (numVals, datatype, stride, pc));
+            glEnableClientState(GL_COLOR_ARRAY);
+            glColorPointer(numVals, datatype, stride, pc);
             break;
         case GL_INDEX_ARRAY:
-            CALL_EnableClientState(GET_DISPATCH(), (GL_INDEX_ARRAY));
-            CALL_IndexPointer(GET_DISPATCH(), (datatype, stride, pc));
+            glEnableClientState(GL_INDEX_ARRAY);
+            glIndexPointer(datatype, stride, pc);
             break;
         case GL_TEXTURE_COORD_ARRAY:
-            CALL_EnableClientState(GET_DISPATCH(), (GL_TEXTURE_COORD_ARRAY));
-            CALL_TexCoordPointer(GET_DISPATCH(),
-                                 (numVals, datatype, stride, pc));
+            glEnableClientState(GL_TEXTURE_COORD_ARRAY);
+            glTexCoordPointer(numVals, datatype, stride, pc);
             break;
         case GL_EDGE_FLAG_ARRAY:
-            CALL_EnableClientState(GET_DISPATCH(), (GL_EDGE_FLAG_ARRAY));
-            CALL_EdgeFlagPointer(GET_DISPATCH(),
-                                 (stride, (const GLboolean *) pc));
+            glEnableClientState(GL_EDGE_FLAG_ARRAY);
+            glEdgeFlagPointer(stride, (const GLboolean *) pc);
             break;
         case GL_SECONDARY_COLOR_ARRAY:
-            CALL_EnableClientState(GET_DISPATCH(), (GL_SECONDARY_COLOR_ARRAY));
-            CALL_SecondaryColorPointerEXT(GET_DISPATCH(),
-                                          (numVals, datatype, stride, pc));
+        {
+            PFNGLSECONDARYCOLORPOINTERPROC SecondaryColorPointerEXT =
+                __glGetProcAddress("glSecondaryColorPointerEXT");
+            glEnableClientState(GL_SECONDARY_COLOR_ARRAY);
+            SecondaryColorPointerEXT(numVals, datatype, stride, pc);
             break;
+        }
         case GL_FOG_COORD_ARRAY:
-            CALL_EnableClientState(GET_DISPATCH(), (GL_FOG_COORD_ARRAY));
-            CALL_FogCoordPointerEXT(GET_DISPATCH(), (datatype, stride, pc));
+        {
+            PFNGLFOGCOORDPOINTERPROC FogCoordPointerEXT =
+                __glGetProcAddress("glFogCoordPointerEXT");
+            glEnableClientState(GL_FOG_COORD_ARRAY);
+            FogCoordPointerEXT(datatype, stride, pc);
             break;
+        }
         default:
             break;
         }
@@ -378,15 +375,15 @@ __glXDispSwap_DrawArrays(GLbyte * pc)
         pc += __GLX_PAD(numVals * __glXTypeSize(datatype));
     }
 
-    CALL_DrawArrays(GET_DISPATCH(), (primType, 0, numVertexes));
+    glDrawArrays(primType, 0, numVertexes);
 
     /* turn off anything we might have turned on */
-    CALL_DisableClientState(GET_DISPATCH(), (GL_VERTEX_ARRAY));
-    CALL_DisableClientState(GET_DISPATCH(), (GL_NORMAL_ARRAY));
-    CALL_DisableClientState(GET_DISPATCH(), (GL_COLOR_ARRAY));
-    CALL_DisableClientState(GET_DISPATCH(), (GL_INDEX_ARRAY));
-    CALL_DisableClientState(GET_DISPATCH(), (GL_TEXTURE_COORD_ARRAY));
-    CALL_DisableClientState(GET_DISPATCH(), (GL_EDGE_FLAG_ARRAY));
-    CALL_DisableClientState(GET_DISPATCH(), (GL_SECONDARY_COLOR_ARRAY));
-    CALL_DisableClientState(GET_DISPATCH(), (GL_FOG_COORD_ARRAY));
+    glDisableClientState(GL_VERTEX_ARRAY);
+    glDisableClientState(GL_NORMAL_ARRAY);
+    glDisableClientState(GL_COLOR_ARRAY);
+    glDisableClientState(GL_INDEX_ARRAY);
+    glDisableClientState(GL_TEXTURE_COORD_ARRAY);
+    glDisableClientState(GL_EDGE_FLAG_ARRAY);
+    glDisableClientState(GL_SECONDARY_COLOR_ARRAY);
+    glDisableClientState(GL_FOG_COORD_ARRAY);
 }
index 6fccde6..91ba911 100644 (file)
 #include "glxserver.h"
 #include "unpack.h"
 #include "indirect_dispatch.h"
-#include "glapitable.h"
-#include "glapi.h"
-#include "glthread.h"
-#include "dispatch.h"
 
 void
 __glXDisp_SeparableFilter2D(GLbyte * pc)
@@ -49,12 +45,12 @@ __glXDisp_SeparableFilter2D(GLbyte * pc)
 
     hdrlen = __GLX_PAD(__GLX_CONV_FILT_CMD_DISPATCH_HDR_SIZE);
 
-    CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes));
-    CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst));
-    CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, hdr->rowLength));
-    CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, hdr->skipRows));
-    CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, hdr->skipPixels));
-    CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, hdr->alignment));
+    glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes);
+    glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst);
+    glPixelStorei(GL_UNPACK_ROW_LENGTH, hdr->rowLength);
+    glPixelStorei(GL_UNPACK_SKIP_ROWS, hdr->skipRows);
+    glPixelStorei(GL_UNPACK_SKIP_PIXELS, hdr->skipPixels);
+    glPixelStorei(GL_UNPACK_ALIGNMENT, hdr->alignment);
 
     /* XXX check this usage - internal code called
      ** a version without the packing parameters
@@ -64,10 +60,8 @@ __glXDisp_SeparableFilter2D(GLbyte * pc)
                                hdr->alignment);
     image1len = __GLX_PAD(image1len);
 
-    CALL_SeparableFilter2D(GET_DISPATCH(), (hdr->target, hdr->internalformat,
-                                            hdr->width, hdr->height,
-                                            hdr->format, hdr->type,
-                                            ((GLubyte *) hdr + hdrlen),
-                                            ((GLubyte *) hdr + hdrlen +
-                                             image1len)));
+    glSeparableFilter2D(hdr->target, hdr->internalformat, hdr->width,
+                        hdr->height, hdr->format, hdr->type,
+                        ((GLubyte *) hdr + hdrlen),
+                        ((GLubyte *) hdr + hdrlen + image1len));
 }
index 0655b74..a4cb246 100644 (file)
 #include "glxserver.h"
 #include "unpack.h"
 #include "indirect_dispatch.h"
-#include "glapitable.h"
-#include "glapi.h"
-#include "glthread.h"
-#include "dispatch.h"
 
 void
 __glXDispSwap_SeparableFilter2D(GLbyte * pc)
@@ -51,28 +47,28 @@ __glXDispSwap_SeparableFilter2D(GLbyte * pc)
 
     hdrlen = __GLX_PAD(__GLX_CONV_FILT_CMD_HDR_SIZE);
 
-    __GLX_SWAP_INT((GLbyte *) & hdr->rowLength);
-    __GLX_SWAP_INT((GLbyte *) & hdr->skipRows);
-    __GLX_SWAP_INT((GLbyte *) & hdr->skipPixels);
-    __GLX_SWAP_INT((GLbyte *) & hdr->alignment);
+    __GLX_SWAP_INT((GLbyte *) &hdr->rowLength);
+    __GLX_SWAP_INT((GLbyte *) &hdr->skipRows);
+    __GLX_SWAP_INT((GLbyte *) &hdr->skipPixels);
+    __GLX_SWAP_INT((GLbyte *) &hdr->alignment);
 
-    __GLX_SWAP_INT((GLbyte *) & hdr->target);
-    __GLX_SWAP_INT((GLbyte *) & hdr->internalformat);
-    __GLX_SWAP_INT((GLbyte *) & hdr->width);
-    __GLX_SWAP_INT((GLbyte *) & hdr->height);
-    __GLX_SWAP_INT((GLbyte *) & hdr->format);
-    __GLX_SWAP_INT((GLbyte *) & hdr->type);
+    __GLX_SWAP_INT((GLbyte *) &hdr->target);
+    __GLX_SWAP_INT((GLbyte *) &hdr->internalformat);
+    __GLX_SWAP_INT((GLbyte *) &hdr->width);
+    __GLX_SWAP_INT((GLbyte *) &hdr->height);
+    __GLX_SWAP_INT((GLbyte *) &hdr->format);
+    __GLX_SWAP_INT((GLbyte *) &hdr->type);
 
     /*
      ** Just invert swapBytes flag; the GL will figure out if it needs to swap
      ** the pixel data.
      */
-    CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, !hdr->swapBytes));
-    CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst));
-    CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, hdr->rowLength));
-    CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, hdr->skipRows));
-    CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, hdr->skipPixels));
-    CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, hdr->alignment));
+    glPixelStorei(GL_UNPACK_SWAP_BYTES, !hdr->swapBytes);
+    glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst);
+    glPixelStorei(GL_UNPACK_ROW_LENGTH, hdr->rowLength);
+    glPixelStorei(GL_UNPACK_SKIP_ROWS, hdr->skipRows);
+    glPixelStorei(GL_UNPACK_SKIP_PIXELS, hdr->skipPixels);
+    glPixelStorei(GL_UNPACK_ALIGNMENT, hdr->alignment);
 
     /* XXX check this usage - internal code called
      ** a version without the packing parameters
@@ -82,10 +78,8 @@ __glXDispSwap_SeparableFilter2D(GLbyte * pc)
                                hdr->alignment);
     image1len = __GLX_PAD(image1len);
 
-    CALL_SeparableFilter2D(GET_DISPATCH(), (hdr->target, hdr->internalformat,
-                                            hdr->width, hdr->height,
-                                            hdr->format, hdr->type,
-                                            ((GLubyte *) hdr + hdrlen),
-                                            ((GLubyte *) hdr + hdrlen +
-                                             image1len)));
+    glSeparableFilter2D(hdr->target, hdr->internalformat, hdr->width,
+                        hdr->height, hdr->format, hdr->type,
+                        ((GLubyte *) hdr + hdrlen),
+                        ((GLubyte *) hdr + hdrlen + image1len));
 }
index 9597d29..53b661d 100644 (file)
 #include "glxext.h"
 #include "indirect_dispatch.h"
 #include "unpack.h"
-#include "glapitable.h"
-#include "glapi.h"
-#include "glthread.h"
-#include "dispatch.h"
 
 int
 __glXDisp_FeedbackBuffer(__GLXclientState * cl, GLbyte * pc)
@@ -72,7 +68,7 @@ __glXDisp_FeedbackBuffer(__GLXclientState * cl, GLbyte * pc)
         }
         cx->feedbackBufSize = size;
     }
-    CALL_FeedbackBuffer(GET_DISPATCH(), (size, type, cx->feedbackBuf));
+    glFeedbackBuffer(size, type, cx->feedbackBuf);
     cx->hasUnflushedCommands = GL_TRUE;
     return Success;
 }
@@ -100,7 +96,7 @@ __glXDisp_SelectBuffer(__GLXclientState * cl, GLbyte * pc)
         }
         cx->selectBufSize = size;
     }
-    CALL_SelectBuffer(GET_DISPATCH(), (size, cx->selectBuf));
+    glSelectBuffer(size, cx->selectBuf);
     cx->hasUnflushedCommands = GL_TRUE;
     return Success;
 }
@@ -123,10 +119,10 @@ __glXDisp_RenderMode(__GLXclientState * cl, GLbyte * pc)
 
     pc += __GLX_SINGLE_HDR_SIZE;
     newMode = *(GLenum *) pc;
-    retval = CALL_RenderMode(GET_DISPATCH(), (newMode));
+    retval = glRenderMode(newMode);
 
     /* Check that render mode worked */
-    CALL_GetIntegerv(GET_DISPATCH(), (GL_RENDER_MODE, &newModeCheck));
+    glGetIntegerv(GL_RENDER_MODE, &newModeCheck);
     if (newModeCheck != newMode) {
         /* Render mode change failed.  Bail */
         newMode = newModeCheck;
@@ -219,7 +215,7 @@ __glXDisp_Flush(__GLXclientState * cl, GLbyte * pc)
         return error;
     }
 
-    CALL_Flush(GET_DISPATCH(), ());
+    glFlush();
     cx->hasUnflushedCommands = GL_FALSE;
     return Success;
 }
@@ -237,7 +233,7 @@ __glXDisp_Finish(__GLXclientState * cl, GLbyte * pc)
     }
 
     /* Do a local glFinish */
-    CALL_Finish(GET_DISPATCH(), ());
+    glFinish();
     cx->hasUnflushedCommands = GL_FALSE;
 
     /* Send empty reply packet to indicate finish is finished */
@@ -346,7 +342,7 @@ DoGetString(__GLXclientState * cl, GLbyte * pc, GLboolean need_swap)
 
     pc += __GLX_SINGLE_HDR_SIZE;
     name = *(GLenum *) (pc + 0);
-    string = (const char *) CALL_GetString(GET_DISPATCH(), (name));
+    string = (const char *) glGetString(name);
     client = cl->client;
 
     if (string == NULL)
index 1ca5328..764501f 100644 (file)
 #include "glxext.h"
 #include "indirect_dispatch.h"
 #include "unpack.h"
-#include "glapitable.h"
-#include "glapi.h"
-#include "glthread.h"
-#include "dispatch.h"
 
 int
 __glXDispSwap_FeedbackBuffer(__GLXclientState * cl, GLbyte * pc)
@@ -73,7 +69,7 @@ __glXDispSwap_FeedbackBuffer(__GLXclientState * cl, GLbyte * pc)
         }
         cx->feedbackBufSize = size;
     }
-    CALL_FeedbackBuffer(GET_DISPATCH(), (size, type, cx->feedbackBuf));
+    glFeedbackBuffer(size, type, cx->feedbackBuf);
     cx->hasUnflushedCommands = GL_TRUE;
     return Success;
 }
@@ -105,7 +101,7 @@ __glXDispSwap_SelectBuffer(__GLXclientState * cl, GLbyte * pc)
         }
         cx->selectBufSize = size;
     }
-    CALL_SelectBuffer(GET_DISPATCH(), (size, cx->selectBuf));
+    glSelectBuffer(size, cx->selectBuf);
     cx->hasUnflushedCommands = GL_TRUE;
     return Success;
 }
@@ -133,10 +129,10 @@ __glXDispSwap_RenderMode(__GLXclientState * cl, GLbyte * pc)
     pc += __GLX_SINGLE_HDR_SIZE;
     __GLX_SWAP_INT(pc);
     newMode = *(GLenum *) pc;
-    retval = CALL_RenderMode(GET_DISPATCH(), (newMode));
+    retval = glRenderMode(newMode);
 
     /* Check that render mode worked */
-    CALL_GetIntegerv(GET_DISPATCH(), (GL_RENDER_MODE, &newModeCheck));
+    glGetIntegerv(GL_RENDER_MODE, &newModeCheck);
     if (newModeCheck != newMode) {
         /* Render mode change failed.  Bail */
         newMode = newModeCheck;
@@ -239,7 +235,7 @@ __glXDispSwap_Flush(__GLXclientState * cl, GLbyte * pc)
         return error;
     }
 
-    CALL_Flush(GET_DISPATCH(), ());
+    glFlush();
     cx->hasUnflushedCommands = GL_FALSE;
     return Success;
 }
@@ -260,7 +256,7 @@ __glXDispSwap_Finish(__GLXclientState * cl, GLbyte * pc)
     }
 
     /* Do a local glFinish */
-    CALL_Finish(GET_DISPATCH(), ());
+    glFinish();
     cx->hasUnflushedCommands = GL_FALSE;
 
     /* Send empty reply packet to indicate finish is finished */
index 55cd443..506fdaa 100644 (file)
 #include "unpack.h"
 #include "indirect_size_get.h"
 #include "indirect_dispatch.h"
-#include "glapitable.h"
-#include "glapi.h"
-#include "glthread.h"
-#include "dispatch.h"
 
 int
 __glXDisp_ReadPixels(__GLXclientState * cl, GLbyte * pc)
@@ -71,16 +67,13 @@ __glXDisp_ReadPixels(__GLXclientState * cl, GLbyte * pc)
     if (compsize < 0)
         compsize = 0;
 
-    CALL_PixelStorei(GET_DISPATCH(), (GL_PACK_SWAP_BYTES, swapBytes));
-    CALL_PixelStorei(GET_DISPATCH(), (GL_PACK_LSB_FIRST, lsbFirst));
+    glPixelStorei(GL_PACK_SWAP_BYTES, swapBytes);
+    glPixelStorei(GL_PACK_LSB_FIRST, lsbFirst);
     __GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1);
     __glXClearErrorOccured();
-    CALL_ReadPixels(GET_DISPATCH(), (*(GLint *) (pc + 0),
-                                     *(GLint *) (pc + 4),
-                                     *(GLsizei *) (pc + 8),
-                                     *(GLsizei *) (pc + 12),
-                                     *(GLenum *) (pc + 16),
-                                     *(GLenum *) (pc + 20), answer));
+    glReadPixels(*(GLint *) (pc + 0), *(GLint *) (pc + 4),
+                 *(GLsizei *) (pc + 8), *(GLsizei *) (pc + 12),
+                 *(GLenum *) (pc + 16), *(GLenum *) (pc + 20), answer);
 
     if (__glXErrorOccured()) {
         __GLX_BEGIN_REPLY(0);
@@ -119,13 +112,10 @@ __glXDisp_GetTexImage(__GLXclientState * cl, GLbyte * pc)
     target = *(GLenum *) (pc + 0);
     swapBytes = *(GLboolean *) (pc + 16);
 
-    CALL_GetTexLevelParameteriv(GET_DISPATCH(),
-                                (target, level, GL_TEXTURE_WIDTH, &width));
-    CALL_GetTexLevelParameteriv(GET_DISPATCH(),
-                                (target, level, GL_TEXTURE_HEIGHT, &height));
+    glGetTexLevelParameteriv(target, level, GL_TEXTURE_WIDTH, &width);
+    glGetTexLevelParameteriv(target, level, GL_TEXTURE_HEIGHT, &height);
     if (target == GL_TEXTURE_3D) {
-        CALL_GetTexLevelParameteriv(GET_DISPATCH(),
-                                    (target, level, GL_TEXTURE_DEPTH, &depth));
+        glGetTexLevelParameteriv(target, level, GL_TEXTURE_DEPTH, &depth);
     }
     /*
      * The three queries above might fail if we're in a state where queries
@@ -136,13 +126,11 @@ __glXDisp_GetTexImage(__GLXclientState * cl, GLbyte * pc)
     if (compsize < 0)
         compsize = 0;
 
-    CALL_PixelStorei(GET_DISPATCH(), (GL_PACK_SWAP_BYTES, swapBytes));
+    glPixelStorei(GL_PACK_SWAP_BYTES, swapBytes);
     __GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1);
     __glXClearErrorOccured();
-    CALL_GetTexImage(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                      *(GLint *) (pc + 4),
-                                      *(GLenum *) (pc + 8),
-                                      *(GLenum *) (pc + 12), answer));
+    glGetTexImage(*(GLenum *) (pc + 0), *(GLint *) (pc + 4),
+                  *(GLenum *) (pc + 8), *(GLenum *) (pc + 12), answer);
 
     if (__glXErrorOccured()) {
         __GLX_BEGIN_REPLY(0);
@@ -150,9 +138,9 @@ __glXDisp_GetTexImage(__GLXclientState * cl, GLbyte * pc)
     }
     else {
         __GLX_BEGIN_REPLY(compsize);
-        ((xGLXGetTexImageReply *) & __glXReply)->width = width;
-        ((xGLXGetTexImageReply *) & __glXReply)->height = height;
-        ((xGLXGetTexImageReply *) & __glXReply)->depth = depth;
+        ((xGLXGetTexImageReply *) &__glXReply)->width = width;
+        ((xGLXGetTexImageReply *) &__glXReply)->height = height;
+        ((xGLXGetTexImageReply *) &__glXReply)->depth = depth;
         __GLX_SEND_HEADER();
         __GLX_SEND_VOID_ARRAY(compsize);
     }
@@ -177,11 +165,11 @@ __glXDisp_GetPolygonStipple(__GLXclientState * cl, GLbyte * pc)
     pc += __GLX_SINGLE_HDR_SIZE;
     lsbFirst = *(GLboolean *) (pc + 0);
 
-    CALL_PixelStorei(GET_DISPATCH(), (GL_PACK_LSB_FIRST, lsbFirst));
+    glPixelStorei(GL_PACK_LSB_FIRST, lsbFirst);
     __GLX_GET_ANSWER_BUFFER(answer, cl, 128, 1);
 
     __glXClearErrorOccured();
-    CALL_GetPolygonStipple(GET_DISPATCH(), ((GLubyte *) answer));
+    glGetPolygonStipple((GLubyte *) answer);
 
     if (__glXErrorOccured()) {
         __GLX_BEGIN_REPLY(0);
@@ -220,10 +208,8 @@ GetSeparableFilter(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag)
     /* target must be SEPARABLE_2D, however I guess we can let the GL
        barf on this one.... */
 
-    CALL_GetConvolutionParameteriv(GET_DISPATCH(),
-                                   (target, GL_CONVOLUTION_WIDTH, &width));
-    CALL_GetConvolutionParameteriv(GET_DISPATCH(),
-                                   (target, GL_CONVOLUTION_HEIGHT, &height));
+    glGetConvolutionParameteriv(target, GL_CONVOLUTION_WIDTH, &width);
+    glGetConvolutionParameteriv(target, GL_CONVOLUTION_HEIGHT, &height);
     /*
      * The two queries above might fail if we're in a state where queries
      * are illegal, but then width and height would still be zero anyway.
@@ -238,13 +224,11 @@ GetSeparableFilter(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag)
     compsize = __GLX_PAD(compsize);
     compsize2 = __GLX_PAD(compsize2);
 
-    CALL_PixelStorei(GET_DISPATCH(), (GL_PACK_SWAP_BYTES, swapBytes));
+    glPixelStorei(GL_PACK_SWAP_BYTES, swapBytes);
     __GLX_GET_ANSWER_BUFFER(answer, cl, compsize + compsize2, 1);
     __glXClearErrorOccured();
-    CALL_GetSeparableFilter(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                             *(GLenum *) (pc + 4),
-                                             *(GLenum *) (pc + 8),
-                                             answer, answer + compsize, NULL));
+    glGetSeparableFilter(*(GLenum *) (pc + 0), *(GLenum *) (pc + 4),
+                         *(GLenum *) (pc + 8), answer, answer + compsize, NULL);
 
     if (__glXErrorOccured()) {
         __GLX_BEGIN_REPLY(0);
@@ -252,8 +236,8 @@ GetSeparableFilter(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag)
     }
     else {
         __GLX_BEGIN_REPLY(compsize + compsize2);
-        ((xGLXGetSeparableFilterReply *) & __glXReply)->width = width;
-        ((xGLXGetSeparableFilterReply *) & __glXReply)->height = height;
+        ((xGLXGetSeparableFilterReply *) &__glXReply)->width = width;
+        ((xGLXGetSeparableFilterReply *) &__glXReply)->height = height;
         __GLX_SEND_HEADER();
         __GLX_SEND_VOID_ARRAY(compsize + compsize2);
     }
@@ -299,15 +283,12 @@ GetConvolutionFilter(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag)
     target = *(GLenum *) (pc + 0);
     swapBytes = *(GLboolean *) (pc + 12);
 
-    CALL_GetConvolutionParameteriv(GET_DISPATCH(),
-                                   (target, GL_CONVOLUTION_WIDTH, &width));
+    glGetConvolutionParameteriv(target, GL_CONVOLUTION_WIDTH, &width);
     if (target == GL_CONVOLUTION_1D) {
         height = 1;
     }
     else {
-        CALL_GetConvolutionParameteriv(GET_DISPATCH(),
-                                       (target, GL_CONVOLUTION_HEIGHT,
-                                        &height));
+        glGetConvolutionParameteriv(target, GL_CONVOLUTION_HEIGHT, &height);
     }
     /*
      * The two queries above might fail if we're in a state where queries
@@ -317,12 +298,11 @@ GetConvolutionFilter(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag)
     if (compsize < 0)
         compsize = 0;
 
-    CALL_PixelStorei(GET_DISPATCH(), (GL_PACK_SWAP_BYTES, swapBytes));
+    glPixelStorei(GL_PACK_SWAP_BYTES, swapBytes);
     __GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1);
     __glXClearErrorOccured();
-    CALL_GetConvolutionFilter(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                               *(GLenum *) (pc + 4),
-                                               *(GLenum *) (pc + 8), answer));
+    glGetConvolutionFilter(*(GLenum *) (pc + 0), *(GLenum *) (pc + 4),
+                           *(GLenum *) (pc + 8), answer);
 
     if (__glXErrorOccured()) {
         __GLX_BEGIN_REPLY(0);
@@ -330,8 +310,8 @@ GetConvolutionFilter(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag)
     }
     else {
         __GLX_BEGIN_REPLY(compsize);
-        ((xGLXGetConvolutionFilterReply *) & __glXReply)->width = width;
-        ((xGLXGetConvolutionFilterReply *) & __glXReply)->height = height;
+        ((xGLXGetConvolutionFilterReply *) &__glXReply)->width = width;
+        ((xGLXGetConvolutionFilterReply *) &__glXReply)->height = height;
         __GLX_SEND_HEADER();
         __GLX_SEND_VOID_ARRAY(compsize);
     }
@@ -378,8 +358,7 @@ GetHistogram(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag)
     swapBytes = *(GLboolean *) (pc + 12);
     reset = *(GLboolean *) (pc + 13);
 
-    CALL_GetHistogramParameteriv(GET_DISPATCH(),
-                                 (target, GL_HISTOGRAM_WIDTH, &width));
+    glGetHistogramParameteriv(target, GL_HISTOGRAM_WIDTH, &width);
     /*
      * The one query above might fail if we're in a state where queries
      * are illegal, but then width would still be zero anyway.
@@ -388,10 +367,10 @@ GetHistogram(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag)
     if (compsize < 0)
         compsize = 0;
 
-    CALL_PixelStorei(GET_DISPATCH(), (GL_PACK_SWAP_BYTES, swapBytes));
+    glPixelStorei(GL_PACK_SWAP_BYTES, swapBytes);
     __GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1);
     __glXClearErrorOccured();
-    CALL_GetHistogram(GET_DISPATCH(), (target, reset, format, type, answer));
+    glGetHistogram(target, reset, format, type, answer);
 
     if (__glXErrorOccured()) {
         __GLX_BEGIN_REPLY(0);
@@ -399,7 +378,7 @@ GetHistogram(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag)
     }
     else {
         __GLX_BEGIN_REPLY(compsize);
-        ((xGLXGetHistogramReply *) & __glXReply)->width = width;
+        ((xGLXGetHistogramReply *) &__glXReply)->width = width;
         __GLX_SEND_HEADER();
         __GLX_SEND_VOID_ARRAY(compsize);
     }
@@ -449,10 +428,10 @@ GetMinmax(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag)
     if (compsize < 0)
         compsize = 0;
 
-    CALL_PixelStorei(GET_DISPATCH(), (GL_PACK_SWAP_BYTES, swapBytes));
+    glPixelStorei(GL_PACK_SWAP_BYTES, swapBytes);
     __GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1);
     __glXClearErrorOccured();
-    CALL_GetMinmax(GET_DISPATCH(), (target, reset, format, type, answer));
+    glGetMinmax(target, reset, format, type, answer);
 
     if (__glXErrorOccured()) {
         __GLX_BEGIN_REPLY(0);
@@ -505,8 +484,7 @@ GetColorTable(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag)
     type = *(GLenum *) (pc + 8);
     swapBytes = *(GLboolean *) (pc + 12);
 
-    CALL_GetColorTableParameteriv(GET_DISPATCH(),
-                                  (target, GL_COLOR_TABLE_WIDTH, &width));
+    glGetColorTableParameteriv(target, GL_COLOR_TABLE_WIDTH, &width);
     /*
      * The one query above might fail if we're in a state where queries
      * are illegal, but then width would still be zero anyway.
@@ -515,12 +493,11 @@ GetColorTable(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag)
     if (compsize < 0)
         compsize = 0;
 
-    CALL_PixelStorei(GET_DISPATCH(), (GL_PACK_SWAP_BYTES, swapBytes));
+    glPixelStorei(GL_PACK_SWAP_BYTES, swapBytes);
     __GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1);
     __glXClearErrorOccured();
-    CALL_GetColorTable(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                        *(GLenum *) (pc + 4),
-                                        *(GLenum *) (pc + 8), answer));
+    glGetColorTable(*(GLenum *) (pc + 0), *(GLenum *) (pc + 4),
+                    *(GLenum *) (pc + 8), answer);
 
     if (__glXErrorOccured()) {
         __GLX_BEGIN_REPLY(0);
@@ -528,7 +505,7 @@ GetColorTable(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag)
     }
     else {
         __GLX_BEGIN_REPLY(compsize);
-        ((xGLXGetColorTableReply *) & __glXReply)->width = width;
+        ((xGLXGetColorTableReply *) &__glXReply)->width = width;
         __GLX_SEND_HEADER();
         __GLX_SEND_VOID_ARRAY(compsize);
     }
index b6d6283..8469101 100644 (file)
 #include "unpack.h"
 #include "indirect_dispatch.h"
 #include "indirect_size_get.h"
-#include "glapitable.h"
-#include "glapi.h"
-#include "glthread.h"
-#include "dispatch.h"
 
 int
 __glXDispSwap_ReadPixels(__GLXclientState * cl, GLbyte * pc)
@@ -81,17 +77,13 @@ __glXDispSwap_ReadPixels(__GLXclientState * cl, GLbyte * pc)
     if (compsize < 0)
         compsize = 0;
 
-    CALL_PixelStorei(GET_DISPATCH(), (GL_PACK_SWAP_BYTES, !swapBytes));
-    CALL_PixelStorei(GET_DISPATCH(), (GL_PACK_LSB_FIRST, lsbFirst));
+    glPixelStorei(GL_PACK_SWAP_BYTES, !swapBytes);
+    glPixelStorei(GL_PACK_LSB_FIRST, lsbFirst);
     __GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1);
     __glXClearErrorOccured();
-    CALL_ReadPixels(GET_DISPATCH(),
-                    (*(GLint *) (pc + 0),
-                     *(GLint *) (pc + 4),
-                     *(GLsizei *) (pc + 8),
-                     *(GLsizei *) (pc + 12),
-                     *(GLenum *) (pc + 16), *(GLenum *) (pc + 20), answer)
-        );
+    glReadPixels(*(GLint *) (pc + 0), *(GLint *) (pc + 4),
+                 *(GLsizei *) (pc + 8), *(GLsizei *) (pc + 12),
+                 *(GLenum *) (pc + 16), *(GLenum *) (pc + 20), answer);
 
     if (__glXErrorOccured()) {
         __GLX_BEGIN_REPLY(0);
@@ -140,13 +132,10 @@ __glXDispSwap_GetTexImage(__GLXclientState * cl, GLbyte * pc)
     target = *(GLenum *) (pc + 0);
     swapBytes = *(GLboolean *) (pc + 16);
 
-    CALL_GetTexLevelParameteriv(GET_DISPATCH(),
-                                (target, level, GL_TEXTURE_WIDTH, &width));
-    CALL_GetTexLevelParameteriv(GET_DISPATCH(),
-                                (target, level, GL_TEXTURE_HEIGHT, &height));
+    glGetTexLevelParameteriv(target, level, GL_TEXTURE_WIDTH, &width);
+    glGetTexLevelParameteriv(target, level, GL_TEXTURE_HEIGHT, &height);
     if (target == GL_TEXTURE_3D) {
-        CALL_GetTexLevelParameteriv(GET_DISPATCH(),
-                                    (target, level, GL_TEXTURE_DEPTH, &depth));
+        glGetTexLevelParameteriv(target, level, GL_TEXTURE_DEPTH, &depth);
     }
     /*
      * The three queries above might fail if we're in a state where queries
@@ -157,13 +146,11 @@ __glXDispSwap_GetTexImage(__GLXclientState * cl, GLbyte * pc)
     if (compsize < 0)
         compsize = 0;
 
-    CALL_PixelStorei(GET_DISPATCH(), (GL_PACK_SWAP_BYTES, !swapBytes));
+    glPixelStorei(GL_PACK_SWAP_BYTES, !swapBytes);
     __GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1);
     __glXClearErrorOccured();
-    CALL_GetTexImage(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                      *(GLint *) (pc + 4),
-                                      *(GLenum *) (pc + 8),
-                                      *(GLenum *) (pc + 12), answer));
+    glGetTexImage(*(GLenum *) (pc + 0), *(GLint *) (pc + 4),
+                  *(GLenum *) (pc + 8), *(GLenum *) (pc + 12), answer);
 
     if (__glXErrorOccured()) {
         __GLX_BEGIN_REPLY(0);
@@ -176,9 +163,9 @@ __glXDispSwap_GetTexImage(__GLXclientState * cl, GLbyte * pc)
         __GLX_SWAP_INT(&width);
         __GLX_SWAP_INT(&height);
         __GLX_SWAP_INT(&depth);
-        ((xGLXGetTexImageReply *) & __glXReply)->width = width;
-        ((xGLXGetTexImageReply *) & __glXReply)->height = height;
-        ((xGLXGetTexImageReply *) & __glXReply)->depth = depth;
+        ((xGLXGetTexImageReply *) &__glXReply)->width = width;
+        ((xGLXGetTexImageReply *) &__glXReply)->height = height;
+        ((xGLXGetTexImageReply *) &__glXReply)->depth = depth;
         __GLX_SEND_HEADER();
         __GLX_SEND_VOID_ARRAY(compsize);
     }
@@ -205,11 +192,11 @@ __glXDispSwap_GetPolygonStipple(__GLXclientState * cl, GLbyte * pc)
     pc += __GLX_SINGLE_HDR_SIZE;
     lsbFirst = *(GLboolean *) (pc + 0);
 
-    CALL_PixelStorei(GET_DISPATCH(), (GL_PACK_LSB_FIRST, lsbFirst));
+    glPixelStorei(GL_PACK_LSB_FIRST, lsbFirst);
     __GLX_GET_ANSWER_BUFFER(answer, cl, 128, 1);
 
     __glXClearErrorOccured();
-    CALL_GetPolygonStipple(GET_DISPATCH(), ((GLubyte *) answer));
+    glGetPolygonStipple((GLubyte *) answer);
     if (__glXErrorOccured()) {
         __GLX_BEGIN_REPLY(0);
         __GLX_SWAP_REPLY_HEADER();
@@ -255,10 +242,8 @@ GetSeparableFilter(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag)
     /* target must be SEPARABLE_2D, however I guess we can let the GL
        barf on this one.... */
 
-    CALL_GetConvolutionParameteriv(GET_DISPATCH(),
-                                   (target, GL_CONVOLUTION_WIDTH, &width));
-    CALL_GetConvolutionParameteriv(GET_DISPATCH(),
-                                   (target, GL_CONVOLUTION_HEIGHT, &height));
+    glGetConvolutionParameteriv(target, GL_CONVOLUTION_WIDTH, &width);
+    glGetConvolutionParameteriv(target, GL_CONVOLUTION_HEIGHT, &height);
     /*
      * The two queries above might fail if we're in a state where queries
      * are illegal, but then width and height would still be zero anyway.
@@ -273,13 +258,11 @@ GetSeparableFilter(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag)
     compsize = __GLX_PAD(compsize);
     compsize2 = __GLX_PAD(compsize2);
 
-    CALL_PixelStorei(GET_DISPATCH(), (GL_PACK_SWAP_BYTES, !swapBytes));
+    glPixelStorei(GL_PACK_SWAP_BYTES, !swapBytes);
     __GLX_GET_ANSWER_BUFFER(answer, cl, compsize + compsize2, 1);
     __glXClearErrorOccured();
-    CALL_GetSeparableFilter(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                             *(GLenum *) (pc + 4),
-                                             *(GLenum *) (pc + 8),
-                                             answer, answer + compsize, NULL));
+    glGetSeparableFilter(*(GLenum *) (pc + 0), *(GLenum *) (pc + 4),
+                         *(GLenum *) (pc + 8), answer, answer + compsize, NULL);
 
     if (__glXErrorOccured()) {
         __GLX_BEGIN_REPLY(0);
@@ -290,8 +273,8 @@ GetSeparableFilter(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag)
         __GLX_SWAP_REPLY_HEADER();
         __GLX_SWAP_INT(&width);
         __GLX_SWAP_INT(&height);
-        ((xGLXGetSeparableFilterReply *) & __glXReply)->width = width;
-        ((xGLXGetSeparableFilterReply *) & __glXReply)->height = height;
+        ((xGLXGetSeparableFilterReply *) &__glXReply)->width = width;
+        ((xGLXGetSeparableFilterReply *) &__glXReply)->height = height;
         __GLX_SEND_VOID_ARRAY(compsize + compsize2);
     }
 
@@ -342,15 +325,12 @@ GetConvolutionFilter(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag)
     target = *(GLenum *) (pc + 0);
     swapBytes = *(GLboolean *) (pc + 12);
 
-    CALL_GetConvolutionParameteriv(GET_DISPATCH(),
-                                   (target, GL_CONVOLUTION_WIDTH, &width));
+    glGetConvolutionParameteriv(target, GL_CONVOLUTION_WIDTH, &width);
     if (target == GL_CONVOLUTION_2D) {
         height = 1;
     }
     else {
-        CALL_GetConvolutionParameteriv(GET_DISPATCH(),
-                                       (target, GL_CONVOLUTION_HEIGHT,
-                                        &height));
+        glGetConvolutionParameteriv(target, GL_CONVOLUTION_HEIGHT, &height);
     }
     /*
      * The two queries above might fail if we're in a state where queries
@@ -360,12 +340,11 @@ GetConvolutionFilter(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag)
     if (compsize < 0)
         compsize = 0;
 
-    CALL_PixelStorei(GET_DISPATCH(), (GL_PACK_SWAP_BYTES, !swapBytes));
+    glPixelStorei(GL_PACK_SWAP_BYTES, !swapBytes);
     __GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1);
     __glXClearErrorOccured();
-    CALL_GetConvolutionFilter(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                               *(GLenum *) (pc + 4),
-                                               *(GLenum *) (pc + 8), answer));
+    glGetConvolutionFilter(*(GLenum *) (pc + 0), *(GLenum *) (pc + 4),
+                           *(GLenum *) (pc + 8), answer);
 
     if (__glXErrorOccured()) {
         __GLX_BEGIN_REPLY(0);
@@ -376,8 +355,8 @@ GetConvolutionFilter(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag)
         __GLX_SWAP_REPLY_HEADER();
         __GLX_SWAP_INT(&width);
         __GLX_SWAP_INT(&height);
-        ((xGLXGetConvolutionFilterReply *) & __glXReply)->width = width;
-        ((xGLXGetConvolutionFilterReply *) & __glXReply)->height = height;
+        ((xGLXGetConvolutionFilterReply *) &__glXReply)->width = width;
+        ((xGLXGetConvolutionFilterReply *) &__glXReply)->height = height;
         __GLX_SEND_VOID_ARRAY(compsize);
     }
 
@@ -429,8 +408,7 @@ GetHistogram(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag)
     swapBytes = *(GLboolean *) (pc + 12);
     reset = *(GLboolean *) (pc + 13);
 
-    CALL_GetHistogramParameteriv(GET_DISPATCH(),
-                                 (target, GL_HISTOGRAM_WIDTH, &width));
+    glGetHistogramParameteriv(target, GL_HISTOGRAM_WIDTH, &width);
     /*
      * The one query above might fail if we're in a state where queries
      * are illegal, but then width would still be zero anyway.
@@ -439,10 +417,10 @@ GetHistogram(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag)
     if (compsize < 0)
         compsize = 0;
 
-    CALL_PixelStorei(GET_DISPATCH(), (GL_PACK_SWAP_BYTES, !swapBytes));
+    glPixelStorei(GL_PACK_SWAP_BYTES, !swapBytes);
     __GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1);
     __glXClearErrorOccured();
-    CALL_GetHistogram(GET_DISPATCH(), (target, reset, format, type, answer));
+    glGetHistogram(target, reset, format, type, answer);
 
     if (__glXErrorOccured()) {
         __GLX_BEGIN_REPLY(0);
@@ -452,7 +430,7 @@ GetHistogram(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag)
         __GLX_BEGIN_REPLY(compsize);
         __GLX_SWAP_REPLY_HEADER();
         __GLX_SWAP_INT(&width);
-        ((xGLXGetHistogramReply *) & __glXReply)->width = width;
+        ((xGLXGetHistogramReply *) &__glXReply)->width = width;
         __GLX_SEND_VOID_ARRAY(compsize);
     }
 
@@ -507,10 +485,10 @@ GetMinmax(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag)
     if (compsize < 0)
         compsize = 0;
 
-    CALL_PixelStorei(GET_DISPATCH(), (GL_PACK_SWAP_BYTES, !swapBytes));
+    glPixelStorei(GL_PACK_SWAP_BYTES, !swapBytes);
     __GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1);
     __glXClearErrorOccured();
-    CALL_GetMinmax(GET_DISPATCH(), (target, reset, format, type, answer));
+    glGetMinmax(target, reset, format, type, answer);
 
     if (__glXErrorOccured()) {
         __GLX_BEGIN_REPLY(0);
@@ -569,8 +547,7 @@ GetColorTable(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag)
     target = *(GLenum *) (pc + 0);
     swapBytes = *(GLboolean *) (pc + 12);
 
-    CALL_GetColorTableParameteriv(GET_DISPATCH(),
-                                  (target, GL_COLOR_TABLE_WIDTH, &width));
+    glGetColorTableParameteriv(target, GL_COLOR_TABLE_WIDTH, &width);
     /*
      * The one query above might fail if we're in a state where queries
      * are illegal, but then width would still be zero anyway.
@@ -579,12 +556,11 @@ GetColorTable(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag)
     if (compsize < 0)
         compsize = 0;
 
-    CALL_PixelStorei(GET_DISPATCH(), (GL_PACK_SWAP_BYTES, !swapBytes));
+    glPixelStorei(GL_PACK_SWAP_BYTES, !swapBytes);
     __GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1);
     __glXClearErrorOccured();
-    CALL_GetColorTable(GET_DISPATCH(), (*(GLenum *) (pc + 0),
-                                        *(GLenum *) (pc + 4),
-                                        *(GLenum *) (pc + 8), answer));
+    glGetColorTable(*(GLenum *) (pc + 0), *(GLenum *) (pc + 4),
+                    *(GLenum *) (pc + 8), answer);
 
     if (__glXErrorOccured()) {
         __GLX_BEGIN_REPLY(0);
@@ -594,7 +570,7 @@ GetColorTable(__GLXclientState * cl, GLbyte * pc, GLXContextTag tag)
         __GLX_BEGIN_REPLY(compsize);
         __GLX_SWAP_REPLY_HEADER();
         __GLX_SWAP_INT(&width);
-        ((xGLXGetColorTableReply *) & __glXReply)->width = width;
+        ((xGLXGetColorTableReply *) &__glXReply)->width = width;
         __GLX_SEND_VOID_ARRAY(compsize);
     }
 
index 777ebb3..4c60b69 100644 (file)
 #include "glxserver.h"
 #include "singlesize.h"
 #include "indirect_size_get.h"
-#include "glapitable.h"
-#include "glapi.h"
-#include "glthread.h"
-#include "dispatch.h"
 
 /*
 ** These routines compute the size of variable-size returned parameters.
@@ -75,7 +71,7 @@ __glGetMap_size(GLenum target, GLenum query)
         switch (query) {
         case GL_COEFF:
             k = __glMap1d_size(target);
-            CALL_GetMapiv(GET_DISPATCH(), (target, GL_ORDER, &order));
+            glGetMapiv(target, GL_ORDER, &order);
             /*
              ** The query above might fail, but then order will be zero anyway.
              */
@@ -99,7 +95,7 @@ __glGetMap_size(GLenum target, GLenum query)
         case GL_COEFF:
             k = __glMap2d_size(target);
             majorMinor[0] = majorMinor[1] = 0;
-            CALL_GetMapiv(GET_DISPATCH(), (target, GL_ORDER, majorMinor));
+            glGetMapiv(target, GL_ORDER, majorMinor);
             /*
              ** The query above might fail, but then majorMinor will be zeroes
              */
@@ -172,7 +168,7 @@ __glGetPixelMap_size(GLenum map)
     default:
         return -1;
     }
-    CALL_GetIntegerv(GET_DISPATCH(), (query, &size));
+    glGetIntegerv(query, &size);
     return size;
 }
 
index 7533d26..17bc992 100644 (file)
 #include "unpack.h"
 #include "indirect_size_get.h"
 #include "indirect_dispatch.h"
-#include "glapitable.h"
-#include "glapi.h"
-#include "glthread.h"
-#include "dispatch.h"
 #include "glxbyteorder.h"
 
 static int DoSwapInterval(__GLXclientState * cl, GLbyte * pc, int do_swap);
index 037ed9e..83a455d 100644 (file)
 #include "glxserver.h"
 #include "glxutil.h"
 #include "unpack.h"
-#include "glapitable.h"
-#include "glapi.h"
-#include "glthread.h"
-#include "dispatch.h"
 #include "indirect_dispatch.h"
 #include <GL/gl.h>
 #include <pixmapstr.h>
@@ -94,10 +90,8 @@ __glXMakeBitmapFromGlyph(FontPtr font, CharInfoPtr pci)
         pglyph -= widthPadded;
         p += widthPadded;
     }
-    CALL_Bitmap(GET_DISPATCH(), (w, h, -pci->metrics.leftSideBearing,
-                                 pci->metrics.descent,
-                                 pci->metrics.characterWidth, 0,
-                                 allocbuf ? allocbuf : buf));
+    glBitmap(w, h, -pci->metrics.leftSideBearing, pci->metrics.descent,
+             pci->metrics.characterWidth, 0, allocbuf ? allocbuf : buf);
 
     free(allocbuf);
     return Success;
@@ -118,13 +112,12 @@ MakeBitmapsFromFont(FontPtr pFont, int first, int count, int list_base)
     int rv;                     /* return value */
     int encoding = (FONTLASTROW(pFont) == 0) ? Linear16Bit : TwoD16Bit;
 
-    CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, FALSE));
-    CALL_PixelStorei(GET_DISPATCH(),
-                     (GL_UNPACK_LSB_FIRST, BITMAP_BIT_ORDER == LSBFirst));
-    CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, 0));
-    CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, 0));
-    CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, 0));
-    CALL_PixelStorei(GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, GLYPHPADBYTES));
+    glPixelStorei(GL_UNPACK_SWAP_BYTES, FALSE);
+    glPixelStorei(GL_UNPACK_LSB_FIRST, BITMAP_BIT_ORDER == LSBFirst);
+    glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
+    glPixelStorei(GL_UNPACK_SKIP_ROWS, 0);
+    glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0);
+    glPixelStorei(GL_UNPACK_ALIGNMENT, GLYPHPADBYTES);
     for (i = 0; i < count; i++) {
         chs[0] = (first + i) >> 8;      /* high byte is first byte */
         chs[1] = first + i;
@@ -135,14 +128,14 @@ MakeBitmapsFromFont(FontPtr pFont, int first, int count, int list_base)
         /*
          ** Define a display list containing just a glBitmap() call.
          */
-        CALL_NewList(GET_DISPATCH(), (list_base + i, GL_COMPILE));
+        glNewList(list_base + i, GL_COMPILE);
         if (nglyphs) {
             rv = __glXMakeBitmapFromGlyph(pFont, pci);
             if (rv) {
                 return rv;
             }
         }
-        CALL_EndList(GET_DISPATCH(), ());
+        glEndList();
     }
     return Success;
 }
@@ -167,8 +160,7 @@ __glXDisp_UseXFont(__GLXclientState * cl, GLbyte * pc)
         return error;
     }
 
-    CALL_GetIntegerv(GET_DISPATCH(),
-                     (GL_LIST_INDEX, (GLint *) & currentListIndex));
+    glGetIntegerv(GL_LIST_INDEX, (GLint *) &currentListIndex);
     if (currentListIndex != 0) {
         /*
          ** A display list is currently being made.  It is an error
index 6c2cc6b..19895dc 100644 (file)
@@ -26,6 +26,10 @@ if XQUARTZ
 XQUARTZ_SUBDIRS = xquartz
 endif
 
+if XWAYLAND
+XWAYLAND_SUBDIRS = xwayland
+endif
+
 SUBDIRS =                      \
        $(XORG_SUBDIRS)         \
        $(XWIN_SUBDIRS)         \
@@ -33,9 +37,10 @@ SUBDIRS =                    \
        $(XNEST_SUBDIRS)        \
        $(DMX_SUBDIRS)          \
        $(KDRIVE_SUBDIRS)       \
-       $(XQUARTZ_SUBDIRS)
+       $(XQUARTZ_SUBDIRS)      \
+       $(XWAYLAND_SUBDIRS)
 
-DIST_SUBDIRS = dmx xfree86 vfb xnest xwin xquartz kdrive
+DIST_SUBDIRS = dmx xfree86 vfb xnest xwin xquartz kdrive xwayland
 
 relink:
        $(AM_V_at)for i in $(SUBDIRS) ; do $(MAKE) -C $$i relink || exit 1 ; done
index fb727e6..eef84cb 100644 (file)
@@ -56,8 +56,6 @@ Xdmx_SOURCES = dmx.c \
                dmxprop.h \
                dmxscrinit.c \
                dmxscrinit.h \
-               dmxshadow.c \
-               dmxshadow.h \
                dmxstat.c \
                dmxstat.h \
                dmxsync.c \
@@ -67,7 +65,6 @@ Xdmx_SOURCES = dmx.c \
                dmxwindow.c \
                dmxwindow.h \
                $(top_srcdir)/mi/miinitext.c \
-               $(top_srcdir)/fb/fbcmap_mi.c \
                $(GLX_SRCS) 
 
 
index 34a47a2..1031033 100644 (file)
@@ -76,7 +76,7 @@ CanvasExpose(Widget w, XEvent * event, Region region)
 
     if (!XtIsRealized(w))
         return;
-    XtCallCallbacks(w, XtNcanvasExposeCallback, (XtPointer) & data);
+    XtCallCallbacks(w, XtNcanvasExposeCallback, (XtPointer) &data);
 }
 
 static void
@@ -98,10 +98,10 @@ static XtResource resources[] = {
     {XtNcallback, XtCCallback, XtRCallback,
      sizeof(XtCallbackList), offset(input_callback), XtRCallback, NULL}
     ,
-    {XtNcanvasExposeCallback, XtCcanvasExposeCallback, XtRCallback,
+    {(char *) XtNcanvasExposeCallback, (char *) XtCcanvasExposeCallback, XtRCallback,
      sizeof(XtCallbackList), offset(expose_callback), XtRCallback, NULL}
     ,
-    {XtNcanvasResizeCallback, XtCcanvasResizeCallback, XtRCallback,
+    {(char *) XtNcanvasResizeCallback, (char *) XtCcanvasResizeCallback, XtRCallback,
      sizeof(XtCallbackList), offset(resize_callback), XtRCallback, NULL}
     ,
 };
@@ -109,7 +109,7 @@ static XtResource resources[] = {
 #undef offset
 
 static XtActionsRec actions[] = {
-    {"canvas", CanvasAction},
+    {(char *) "canvas", CanvasAction},
 };
 
 static char translations[] = "<Key>:    canvas()\n\
@@ -123,7 +123,7 @@ CanvasClassRec canvasClassRec = {
     /* core */
     {
      (WidgetClass) Superclass,  /* superclass */
-     "Canvas",                  /* class_name */
+     (char *) "Canvas",         /* class_name */
      sizeof(CanvasRec),         /* widget_size */
      NULL,                      /* class_initialize */
      NULL,                      /* class_part_initialize */
@@ -162,4 +162,4 @@ CanvasClassRec canvasClassRec = {
      }
 };
 
-WidgetClass canvasWidgetClass = (WidgetClass) & canvasClassRec;
+WidgetClass canvasWidgetClass = (WidgetClass) &canvasClassRec;
index bd9f127..107991a 100644 (file)
@@ -228,5 +228,9 @@ dmxVDLRead(const char *filename)
             break;
         }
     }
+
+    if (str != stdin)
+        fclose(str);
+
     return entry;
 }
index f308412..0540d01 100644 (file)
@@ -31,9 +31,6 @@
  *
  */
 
-#ifdef HAVE_DMX_CONFIG_H
-#include <dmx-config.h>
-#endif
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -306,7 +303,6 @@ dmxConfigCanvasUpdate(void)
     fs = XQueryFont(dpy, gcontext);
     for (pt = dmxConfigCurrent->subentry; pt; pt = pt->next) {
         int x, y, len;
-        int xo = 3, yo = fs->ascent + fs->descent + 2;
         GC gc;
 
         if (pt->type != dmxConfigDisplay)
@@ -324,6 +320,8 @@ dmxConfigCanvasUpdate(void)
             y = dmxConfigWidgetHeight - 1;
         XDrawRectangle(dpy, win, gc, x, y, w, h);
         if (fs && len) {
+            int xo = 3, yo = fs->ascent + fs->descent + 2;
+
             while (len && XTextWidth(fs, pt->display->name, len) >= w - 2 * xo)
                 --len;
             if (len)
@@ -977,9 +975,9 @@ main(int argc, char **argv)
     const char *canvastrans =
         "<Btn3Down>: placeMenu() XtMenuPopup(buttonpopup)";
     XtActionsRec actiontable[] = {
-        {"openOk", dmxConfigOkAction},
-        {"placeMenu", dmxConfigPlaceMenu},
-        {"noop", NULL}
+        {(char *) "openOk", dmxConfigOkAction},
+        {(char *) "placeMenu", dmxConfigPlaceMenu},
+        {(char *) "noop", NULL}
     };
 
     dmxConfigFilename = XtNewString((argc >= 2) ? argv[1] : "");
index 0f7cb5c..99e970c 100644 (file)
@@ -268,7 +268,7 @@ ProcDMXForceWindowCreation(ClientPtr client)
         PanoramiXRes *win;
         int i;
 
-        if (Success != dixLookupResourceByType((pointer *) &win,
+        if (Success != dixLookupResourceByType((void **) &win,
                                                stuff->window, XRT_WINDOW,
                                                client, DixReadAccess))
             return -1;          /* BadWindow */
@@ -556,7 +556,7 @@ dmxPopulatePanoramiX(ClientPtr client, Window window,
     int count = 0;
     DMXWindowAttributesRec attr;
 
-    if (Success != dixLookupResourceByType((pointer *) &win,
+    if (Success != dixLookupResourceByType((void **) &win,
                                            window, XRT_WINDOW,
                                            client, DixReadAccess))
         return -1;              /* BadWindow */
index d7c6204..7242e43 100644 (file)
@@ -254,10 +254,6 @@ typedef struct _DMXScreenInfo {
 /* Global variables available to all Xserver/hw/dmx routines. */
 extern int dmxNumScreens;                       /**< Number of dmxScreens */
 extern DMXScreenInfo *dmxScreens;               /**< List of outputs */
-extern int dmxShadowFB;                         /**< Non-zero if using
-
-                                                 * shadow frame-buffer
-                                                 * (deprecated) */
 extern XErrorEvent dmxLastErrorEvent;           /**< Last error that
 
                                                  * occurred */
@@ -407,4 +403,6 @@ extern DevPrivateKeyRec dmxGlyphSetPrivateKeyRec;
 
 #define dmxGlyphSetPrivateKey (&dmxGlyphSetPrivateKeyRec) /**< Private index for GlyphSets */
 
+void DMXExtensionInit(void);
+
 #endif                          /* DMX_H */
index 9fcc0e5..b3bd3b7 100644 (file)
@@ -37,6 +37,7 @@
 #include <GL/glxproto.h>
 #include <X11/extensions/Xext.h>
 #include <X11/extensions/extutil.h>
+#include <limits.h>
 
 #include "dmx_glxvisuals.h"
 
@@ -61,7 +62,7 @@ GetGLXVisualConfigs(Display * dpy, int screen, int *nconfigs)
     req->reqType = majorOpcode;
     req->glxCode = X_GLXGetVisualConfigs;
     req->screen = screen;
-    if (!_XReply(dpy, (xReply *) & reply, 0, False)) {
+    if (!_XReply(dpy, (xReply *) &reply, 0, False)) {
         /* Something is busted. Punt. */
         UnlockDisplay(dpy);
         SyncHandle();
@@ -84,7 +85,10 @@ GetGLXVisualConfigs(Display * dpy, int screen, int *nconfigs)
         SyncHandle();
         return NULL;
     }
-    props = (INT32 *) Xmalloc(nprops * __GLX_SIZE_CARD32);
+    if (nprops < (INT_MAX / __GLX_SIZE_CARD32))
+        props = Xmalloc(nprops * __GLX_SIZE_CARD32);
+    else
+        props = NULL;
     if (!props) {
         UnlockDisplay(dpy);
         SyncHandle();
@@ -92,15 +96,16 @@ GetGLXVisualConfigs(Display * dpy, int screen, int *nconfigs)
     }
 
     /* Allocate memory for our config structure */
-    config = (__GLXvisualConfig *)
-        Xmalloc(nvisuals * sizeof(__GLXvisualConfig));
+    if (nvisuals < (INT_MAX / sizeof(__GLXvisualConfig)))
+        config = Xcalloc(nvisuals, sizeof(__GLXvisualConfig));
+    else
+        config = NULL;
     if (!config) {
         free(props);
         UnlockDisplay(dpy);
         SyncHandle();
         return NULL;
     }
-    memset(config, 0, nvisuals * sizeof(__GLXvisualConfig));
     configs = config;
     num_good_visuals = 0;
 
@@ -252,7 +257,7 @@ GetGLXFBConfigs(Display * dpy, int glxMajorOpcode, int *nconfigs)
 
     *nconfigs = 0;
 
-    if (!_XReply(dpy, (xReply *) & reply, 0, False)) {
+    if (!_XReply(dpy, (xReply *) &reply, 0, False)) {
         /* Something is busted. Punt. */
         UnlockDisplay(dpy);
         SyncHandle();
@@ -274,7 +279,10 @@ GetGLXFBConfigs(Display * dpy, int glxMajorOpcode, int *nconfigs)
         return NULL;
     }
 
-    attrs = (INT32 *) Xmalloc(2 * numAttribs * __GLX_SIZE_CARD32);
+    if (numAttribs < (INT_MAX / (2 * __GLX_SIZE_CARD32)))
+        attrs = Xmalloc(2 * numAttribs * __GLX_SIZE_CARD32);
+    else
+        attrs = NULL;
     if (!attrs) {
         UnlockDisplay(dpy);
         SyncHandle();
@@ -282,15 +290,16 @@ GetGLXFBConfigs(Display * dpy, int glxMajorOpcode, int *nconfigs)
     }
 
     /* Allocate memory for our config structure */
-    config = (__GLXFBConfig *)
-        Xmalloc(numFBConfigs * sizeof(__GLXFBConfig));
+    if (numFBConfigs < (INT_MAX / sizeof(__GLXFBConfig)))
+        config = Xcalloc(numFBConfigs, sizeof(__GLXFBConfig));
+    else
+        config = NULL;
     if (!config) {
         free(attrs);
         UnlockDisplay(dpy);
         SyncHandle();
         return NULL;
     }
-    memset(config, 0, numFBConfigs * sizeof(__GLXFBConfig));
     fbconfigs = config;
 
     /* Convert attribute list into our format */
@@ -439,7 +448,12 @@ GetGLXFBConfigs(Display * dpy, int glxMajorOpcode, int *nconfigs)
         /* Fill in derived values */
         config->screen = screen;
 
-        config->rgbMode = config->renderType & GLX_RGBA_BIT;
+        /* The rgbMode should be true for any mode which has distinguishible
+         * R, G and B components
+         */
+        config->rgbMode = (config->renderType
+                           & (GLX_RGBA_BIT | GLX_RGBA_FLOAT_BIT_ARB
+                              | GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT)) != 0;
         config->colorIndexMode = !config->rgbMode;
 
         config->haveAccumBuffer =
index 19dfdbe..be8116f 100644 (file)
@@ -118,17 +118,6 @@ typedef XID KeySym64;
 #undef KeySym
 #endif
 
-/* These are in exglobals.h, but that conflicts with xkbsrv.h */
-extern int ProximityIn;
-extern int ProximityOut;
-extern int DeviceValuator;
-extern int DeviceMotionNotify;
-extern int DeviceFocusIn;
-extern int DeviceFocusOut;
-extern int DeviceStateNotify;
-extern int DeviceMappingNotify;
-extern int ChangeDeviceNotify;
-
 /* Some protocol gets included last, after undefines. */
 #include <X11/XKBlib.h>
 #include <X11/extensions/XKBproto.h>
index 1a77c7d..70f2bc4 100644 (file)
@@ -197,8 +197,6 @@ miPointerScreenFuncRec dmxPointerCursorFuncs = {
     dmxCursorOffScreen,
     dmxCrossScreen,
     dmxWarpCursor,
-    NULL,
-    NULL,
 };
 
 /** Create a list of screens that we'll manipulate. */
@@ -346,6 +344,8 @@ dmxComputeScreenOrigins(void)
             screenInfo.screens[i]->y -= minY;
         }
     }
+
+    update_desktop_dimensions();
 }
 
 /** Recompute origin information in the #dmxScreens list.  This is
index d7296ae..fcc97e3 100644 (file)
@@ -68,6 +68,9 @@
  * _any_ header files. */
 extern FontPtr defaultFont;
 
+/* Hack to get Present to build (present requires RandR) */
+RESTYPE RRCrtcType;
+
 /** This routine provides information to the DMX protocol extension
  * about a particular screen. */
 Bool
@@ -725,7 +728,7 @@ static Bool FoundPixImage;
  *  another screen with the same image.  If so, copy the pixmap image
  *  from the existing screen to the newly created pixmap. */
 static void
-dmxBERestorePixmapImage(pointer value, XID id, RESTYPE type, pointer p)
+dmxBERestorePixmapImage(void *value, XID id, RESTYPE type, void *p)
 {
     if ((type & TypeMask) == (XRT_PIXMAP & TypeMask)) {
         PixmapPtr pDst = (PixmapPtr) p;
@@ -734,7 +737,7 @@ dmxBERestorePixmapImage(pointer value, XID id, RESTYPE type, pointer p)
         PixmapPtr pPix;
         int i;
 
-        dixLookupResourceByType((pointer *) &pPix, pXinPix->info[idx].id,
+        dixLookupResourceByType((void **) &pPix, pXinPix->info[idx].id,
                                 RT_PIXMAP, NullClient, DixUnknownAccess);
         if (pPix != pDst)
             return;             /* Not a match.... Next! */
@@ -746,7 +749,7 @@ dmxBERestorePixmapImage(pointer value, XID id, RESTYPE type, pointer p)
             if (i == idx)
                 continue;       /* Self replication is bad */
 
-            dixLookupResourceByType((pointer *) &pSrc, pXinPix->info[i].id,
+            dixLookupResourceByType((void **) &pSrc, pXinPix->info[i].id,
                                     RT_PIXMAP, NullClient, DixUnknownAccess);
             pSrcPriv = DMX_GET_PIXMAP_PRIV(pSrc);
             if (pSrcPriv->pixmap) {
@@ -825,7 +828,7 @@ dmxBERestorePixmap(PixmapPtr pPixmap)
     for (i = currentMaxClients; --i >= 0;)
         if (clients[i])
             FindAllClientResources(clients[i], dmxBERestorePixmapImage,
-                                   (pointer) pPixmap);
+                                   (void *) pPixmap);
 
     /* No corresponding pixmap image was found on other screens, so we
      * need to copy it from the saved image when the screen was detached
@@ -892,7 +895,7 @@ dmxBERestorePixmap(PixmapPtr pPixmap)
  *  number passed in as \a n and calls the appropriate DMX function to
  *  create the associated resource on the back-end server. */
 static void
-dmxBECreateResources(pointer value, XID id, RESTYPE type, pointer n)
+dmxBECreateResources(void *value, XID id, RESTYPE type, void *n)
 {
     int scrnNum = (uintptr_t) n;
     ScreenPtr pScreen = screenInfo.screens[scrnNum];
@@ -1118,7 +1121,7 @@ dmxCompareScreens(DMXScreenInfo * new, DMXScreenInfo * old)
 
 /** Restore Render's picture */
 static void
-dmxBERestoreRenderPict(pointer value, XID id, pointer n)
+dmxBERestoreRenderPict(void *value, XID id, void *n)
 {
     PicturePtr pPicture = value;        /* The picture */
     DrawablePtr pDraw = pPicture->pDrawable;    /* The picture's drawable */
@@ -1142,7 +1145,7 @@ dmxBERestoreRenderPict(pointer value, XID id, pointer n)
 
 /** Restore Render's glyphs */
 static void
-dmxBERestoreRenderGlyph(pointer value, XID id, pointer n)
+dmxBERestoreRenderGlyph(void *value, XID id, void *n)
 {
     GlyphSetPtr glyphSet = value;
     int scrnNum = (uintptr_t) n;
@@ -1337,7 +1340,7 @@ dmxAttachScreen(int idx, DMXScreenAttributesPtr attr)
     for (i = currentMaxClients; --i >= 0;)
         if (clients[i])
             FindAllClientResources(clients[i], dmxBECreateResources,
-                                   (pointer) (uintptr_t) idx);
+                                   (void *) (uintptr_t) idx);
 
     /* Create window hierarchy (top down) */
     dmxBECreateWindowTree(idx);
@@ -1347,14 +1350,14 @@ dmxAttachScreen(int idx, DMXScreenAttributesPtr attr)
         if (clients[i])
             FindClientResourcesByType(clients[i], PictureType,
                                       dmxBERestoreRenderPict,
-                                      (pointer) (uintptr_t) idx);
+                                      (void *) (uintptr_t) idx);
 
     /* Restore the glyph state for RENDER */
     for (i = currentMaxClients; --i >= 0;)
         if (clients[i])
             FindClientResourcesByType(clients[i], GlyphSetType,
                                       dmxBERestoreRenderGlyph,
-                                      (pointer) (uintptr_t) idx);
+                                      (void *) (uintptr_t) idx);
 
     /* Refresh screen by generating exposure events for all windows */
     dmxForceExposures(idx);
@@ -1422,7 +1425,7 @@ dmxAttachScreen(int idx, DMXScreenAttributesPtr attr)
 /** Search the Xinerama XRT_PIXMAP resources for the pixmap that needs
  *  to have its image saved. */
 static void
-dmxBEFindPixmapImage(pointer value, XID id, RESTYPE type, pointer p)
+dmxBEFindPixmapImage(void *value, XID id, RESTYPE type, void *p)
 {
     if ((type & TypeMask) == (XRT_PIXMAP & TypeMask)) {
         PixmapPtr pDst = (PixmapPtr) p;
@@ -1431,7 +1434,7 @@ dmxBEFindPixmapImage(pointer value, XID id, RESTYPE type, pointer p)
         PixmapPtr pPix;
         int i;
 
-        dixLookupResourceByType((pointer *) &pPix, pXinPix->info[idx].id,
+        dixLookupResourceByType((void **) &pPix, pXinPix->info[idx].id,
                                 RT_PIXMAP, NullClient, DixUnknownAccess);
         if (pPix != pDst)
             return;             /* Not a match.... Next! */
@@ -1443,7 +1446,7 @@ dmxBEFindPixmapImage(pointer value, XID id, RESTYPE type, pointer p)
             if (i == idx)
                 continue;       /* Self replication is bad */
 
-            dixLookupResourceByType((pointer *) &pSrc, pXinPix->info[i].id,
+            dixLookupResourceByType((void **) &pSrc, pXinPix->info[i].id,
                                     RT_PIXMAP, NullClient, DixUnknownAccess);
             pSrcPriv = DMX_GET_PIXMAP_PRIV(pSrc);
             if (pSrcPriv->pixmap) {
@@ -1479,7 +1482,7 @@ dmxBESavePixmap(PixmapPtr pPixmap)
     for (i = currentMaxClients; --i >= 0;)
         if (clients[i])
             FindAllClientResources(clients[i], dmxBEFindPixmapImage,
-                                   (pointer) pPixmap);
+                                   (void *) pPixmap);
 
     /* Save the image only if there is no other screens that have a
      * pixmap that corresponds to the one we are trying to save. */
@@ -1519,7 +1522,7 @@ dmxBESavePixmap(PixmapPtr pPixmap)
  *  number passed in as \a n and calls the appropriate DMX function to
  *  free the associated resource on the back-end server. */
 static void
-dmxBEDestroyResources(pointer value, XID id, RESTYPE type, pointer n)
+dmxBEDestroyResources(void *value, XID id, RESTYPE type, void *n)
 {
     int scrnNum = (uintptr_t) n;
     ScreenPtr pScreen = screenInfo.screens[scrnNum];
@@ -1680,7 +1683,7 @@ dmxDetachScreen(int idx)
     for (i = currentMaxClients; --i >= 0;)
         if (clients[i])
             FindAllClientResources(clients[i], dmxBEDestroyResources,
-                                   (pointer) (uintptr_t) idx);
+                                   (void *) (uintptr_t) idx);
 
     /* Free scratch GCs */
     dmxBEDestroyScratchGCs(idx);
index 7ef7ad9..115422d 100644 (file)
@@ -397,12 +397,12 @@ dmxBELoadFont(ScreenPtr pScreen, FontPtr pFont)
                    "font-path-related options, see the Xdmx man page.\n");
         }
 
+        free(goodfps);
         if (!dmxIgnoreBadFontPaths ||
             (dmxIgnoreBadFontPaths && dmxSetFontPath(dmxScreen))) {
             /* We still have errors so return with error */
             dmxFreeFontPath(fp);
             XFreeFontPath(oldFontPath);
-            free(goodfps);
             return FALSE;
         }
     }
@@ -460,7 +460,7 @@ dmxRealizeFont(ScreenPtr pScreen, FontPtr pFont)
         pFontPriv->refcnt = 0;
     }
 
-    FontSetPrivate(pFont, dmxFontPrivateIndex, (pointer) pFontPriv);
+    FontSetPrivate(pFont, dmxFontPrivateIndex, (void *) pFontPriv);
 
     if (dmxScreen->beDisplay) {
         if (!dmxBELoadFont(pScreen, pFont))
index 703aeb3..2d61ea2 100644 (file)
@@ -378,7 +378,7 @@ dmxDestroyGC(GCPtr pGC)
 
 /** Change the clip rects for a GC. */
 void
-dmxChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects)
+dmxChangeClip(GCPtr pGC, int type, void *pvalue, int nrects)
 {
     ScreenPtr pScreen = pGC->pScreen;
     DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
index 7b99d88..c8ecb53 100644 (file)
@@ -55,7 +55,7 @@ extern void dmxValidateGC(GCPtr pGC, unsigned long changes,
 extern void dmxChangeGC(GCPtr pGC, unsigned long mask);
 extern void dmxCopyGC(GCPtr pGCSrc, unsigned long changes, GCPtr pGCDst);
 extern void dmxDestroyGC(GCPtr pGC);
-extern void dmxChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects);
+extern void dmxChangeClip(GCPtr pGC, int type, void *pvalue, int nrects);
 extern void dmxDestroyClip(GCPtr pGC);
 extern void dmxCopyClip(GCPtr pGCDst, GCPtr pGCSrc);
 
index 1933066..aa7c8eb 100644 (file)
@@ -508,7 +508,7 @@ dmxImageText16(DrawablePtr pDrawable, GCPtr pGC,
 void
 dmxImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
                  int x, int y, unsigned int nglyph,
-                 CharInfoPtr * ppci, pointer pglyphBase)
+                 CharInfoPtr * ppci, void *pglyphBase)
 {
     /* Error -- this should never happen! */
 }
@@ -517,7 +517,7 @@ dmxImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
 void
 dmxPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
                 int x, int y, unsigned int nglyph,
-                CharInfoPtr * ppci, pointer pglyphBase)
+                CharInfoPtr * ppci, void *pglyphBase)
 {
     /* Error -- this should never happen! */
 }
@@ -551,7 +551,7 @@ dmxFindAlternatePixmap(DrawablePtr pDrawable, XID *draw)
     if (pDrawable->type != DRAWABLE_PIXMAP)
         return NULL;
 
-    if (Success != dixLookupResourceByType((pointer *) &pXinPix,
+    if (Success != dixLookupResourceByType((void **) &pXinPix,
                                            pDrawable->id, XRT_PIXMAP,
                                            NullClient, DixUnknownAccess))
         return NULL;
@@ -562,7 +562,7 @@ dmxFindAlternatePixmap(DrawablePtr pDrawable, XID *draw)
             PixmapPtr pSrc;
             dmxPixPrivPtr pSrcPriv;
 
-            dixLookupResourceByType((pointer *) &pSrc, pXinPix->info[i].id,
+            dixLookupResourceByType((void **) &pSrc, pXinPix->info[i].id,
                                     RT_PIXMAP, NullClient, DixUnknownAccess);
             pSrcPriv = DMX_GET_PIXMAP_PRIV(pSrc);
             if (pSrcPriv->pixmap) {
index 4ba0ad5..529b6ff 100644 (file)
@@ -78,10 +78,10 @@ extern void dmxImageText16(DrawablePtr pDrawable, GCPtr pGC,
                            int x, int y, int count, unsigned short *chars);
 extern void dmxImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
                              int x, int y, unsigned int nglyph,
-                             CharInfoPtr * ppci, pointer pglyphBase);
+                             CharInfoPtr * ppci, void *pglyphBase);
 extern void dmxPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
                             int x, int y, unsigned int nglyph,
-                            CharInfoPtr * ppci, pointer pglyphBase);
+                            CharInfoPtr * ppci, void *pglyphBase);
 extern void dmxPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDst,
                           int w, int h, int x, int y);
 
index 5804353..fd2ade0 100644 (file)
 #include <GL/glx.h>
 #include <GL/glxint.h>
 #include "dmx_glxvisuals.h"
+#include "glx_extinit.h"
 #include <X11/extensions/Xext.h>
 #include <X11/extensions/extutil.h>
 #endif                          /* GLXEXT */
 
+#include <X11/extensions/dmxproto.h>
+
 /* Global variables available to all Xserver/hw/dmx routines. */
 int dmxNumScreens;
 DMXScreenInfo *dmxScreens;
@@ -79,8 +82,6 @@ DMXScreenInfo *dmxScreens;
 int dmxNumInputs;
 DMXInputInfo *dmxInputs;
 
-int dmxShadowFB = FALSE;
-
 XErrorEvent dmxLastErrorEvent;
 Bool dmxErrorOccurred = FALSE;
 
@@ -108,6 +109,8 @@ Bool dmxGLXSyncSwap = FALSE;
 Bool dmxGLXFinishSwap = FALSE;
 #endif
 
+RESTYPE RRProviderType = 0;
+
 Bool dmxIgnoreBadFontPaths = FALSE;
 
 Bool dmxAddRemoveScreens = FALSE;
@@ -586,6 +589,18 @@ dmxExecHost(void)
     return buffer;
 }
 
+static void dmxAddExtensions(Bool glxSupported)
+{
+    const ExtensionModule dmxExtensions[] = {
+        { DMXExtensionInit, DMX_EXTENSION_NAME, NULL },
+#ifdef GLXEXT
+        { GlxExtensionInit, "GLX", &glxSupported },
+#endif
+    };
+
+    LoadExtensionList(dmxExtensions, ARRAY_SIZE(dmxExtensions), TRUE);
+}
+
 /** This routine is called in Xserver/dix/main.c from \a main(). */
 void
 InitOutput(ScreenInfo * pScreenInfo, int argc, char *argv[])
@@ -594,7 +609,9 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char *argv[])
     static unsigned long dmxGeneration = 0;
 
 #ifdef GLXEXT
-    Bool glxSupported = TRUE;
+    static Bool glxSupported = TRUE;
+#else
+    const Bool glxSupported = FALSE;
 #endif
 
     if (dmxGeneration != serverGeneration) {
@@ -725,6 +742,9 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char *argv[])
         glxSupported &= (dmxScreens[i].glxMajorOpcode > 0);
 #endif
 
+    if (serverGeneration == 1)
+        dmxAddExtensions(glxSupported);
+
     /* Tell dix layer about the backend displays */
     for (i = 0; i < dmxNumScreens; i++) {
 
@@ -834,9 +854,6 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char *argv[])
     /* Initialized things that need timer hooks */
     dmxStatInit();
     dmxSyncInit();              /* Calls RegisterBlockAndWakeupHandlers */
-
-    dmxLog(dmxInfo, "Shadow framebuffer support %s\n",
-           dmxShadowFB ? "enabled" : "disabled");
 }
 
 /* RATS: Assuming the fp string (which comes from the command-line argv
@@ -931,10 +948,6 @@ ddxProcessArgument(int argc, char *argv[], int i)
         retval = 2;
     }
     else if (!strcmp(argv[i], "-noshadowfb")) {
-        dmxLog(dmxWarning,
-               "-noshadowfb has been deprecated "
-               "since it is now the default\n");
-        dmxShadowFB = FALSE;
         retval = 1;
     }
     else if (!strcmp(argv[i], "-nomulticursor")) {
@@ -942,7 +955,6 @@ ddxProcessArgument(int argc, char *argv[], int i)
         retval = 1;
     }
     else if (!strcmp(argv[i], "-shadowfb")) {
-        dmxShadowFB = TRUE;
         retval = 1;
     }
     else if (!strcmp(argv[i], "-configfile")) {
index b1177cf..64d0ae1 100644 (file)
@@ -141,10 +141,6 @@ dmxPictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats)
     DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
     PictureScreenPtr ps;
 
-    /* The shadow framebuffer only relies on FB to be initialized */
-    if (dmxShadowFB)
-        return fbPictureInit(pScreen, formats, nformats);
-
     if (!miPictureInit(pScreen, formats, nformats))
         return FALSE;
 
@@ -289,7 +285,7 @@ dmxProcRenderCreateGlyphSet(ClientPtr client)
         /* Store glyphsets from backends in glyphSet->devPrivate ????? */
         /* Make sure we handle all errors here!! */
 
-        dixLookupResourceByType((pointer *) &glyphSet,
+        dixLookupResourceByType((void **) &glyphSet,
                                 stuff->gsid, GlyphSetType,
                                 client, DixDestroyAccess);
 
@@ -336,7 +332,7 @@ dmxProcRenderFreeGlyphSet(ClientPtr client)
     REQUEST(xRenderFreeGlyphSetReq);
 
     REQUEST_SIZE_MATCH(xRenderFreeGlyphSetReq);
-    dixLookupResourceByType((pointer *) &glyphSet,
+    dixLookupResourceByType((void **) &glyphSet,
                             stuff->glyphset, GlyphSetType,
                             client, DixDestroyAccess);
 
@@ -382,7 +378,7 @@ dmxProcRenderAddGlyphs(ClientPtr client)
         CARD8 *bits;
         int nbytes;
 
-        dixLookupResourceByType((pointer *) &glyphSet,
+        dixLookupResourceByType((void **) &glyphSet,
                                 stuff->glyphset, GlyphSetType,
                                 client, DixReadAccess);
         glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet);
@@ -427,7 +423,7 @@ dmxProcRenderFreeGlyphs(ClientPtr client)
     REQUEST(xRenderFreeGlyphsReq);
 
     REQUEST_AT_LEAST_SIZE(xRenderFreeGlyphsReq);
-    dixLookupResourceByType((pointer *) &glyphSet,
+    dixLookupResourceByType((void **) &glyphSet,
                             stuff->glyphset, GlyphSetType,
                             client, DixWriteAccess);
 
@@ -502,14 +498,14 @@ dmxProcRenderCompositeGlyphs(ClientPtr client)
         GlyphSetPtr glyphSet;
         dmxGlyphPrivPtr glyphPriv;
 
-        dixLookupResourceByType((pointer *) &pSrc,
+        dixLookupResourceByType((void **) &pSrc,
                                 stuff->src, PictureType, client, DixReadAccess);
 
         pSrcPriv = DMX_GET_PICT_PRIV(pSrc);
         if (!pSrcPriv->pict)
             return ret;
 
-        dixLookupResourceByType((pointer *) &pDst,
+        dixLookupResourceByType((void **) &pDst,
                                 stuff->dst, PictureType,
                                 client, DixWriteAccess);
 
@@ -528,7 +524,7 @@ dmxProcRenderCompositeGlyphs(ClientPtr client)
             return ret;
 
         if (stuff->maskFormat)
-            dixLookupResourceByType((pointer *) &pFmt,
+            dixLookupResourceByType((void **) &pFmt,
                                     stuff->maskFormat, PictFormatType,
                                     client, DixReadAccess);
         else
@@ -589,7 +585,7 @@ dmxProcRenderCompositeGlyphs(ClientPtr client)
         curGlyph = glyphs;
         curElt = elts;
 
-        dixLookupResourceByType((pointer *) &glyphSet,
+        dixLookupResourceByType((void **) &glyphSet,
                                 stuff->glyphset, GlyphSetType,
                                 client, DixReadAccess);
         glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet);
@@ -599,7 +595,7 @@ dmxProcRenderCompositeGlyphs(ClientPtr client)
             buffer += sizeof(xGlyphElt);
 
             if (elt->len == 0xff) {
-                dixLookupResourceByType((pointer *) &glyphSet,
+                dixLookupResourceByType((void **) &glyphSet,
                                         *((CARD32 *) buffer),
                                         GlyphSetType, client, DixReadAccess);
                 glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet);
@@ -898,7 +894,7 @@ dmxDestroyPicture(PicturePtr pPicture)
 
 /** Change the picture's list of clip rectangles. */
 int
-dmxChangePictureClip(PicturePtr pPicture, int clipType, pointer value, int n)
+dmxChangePictureClip(PicturePtr pPicture, int clipType, void *value, int n)
 {
     ScreenPtr pScreen = pPicture->pDrawable->pScreen;
     DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
index 6c37be9..080da3b 100644 (file)
@@ -65,7 +65,7 @@ extern Bool dmxDestroyPictureList(WindowPtr pWindow);
 extern int dmxCreatePicture(PicturePtr pPicture);
 extern void dmxDestroyPicture(PicturePtr pPicture);
 extern int dmxChangePictureClip(PicturePtr pPicture, int clipType,
-                                pointer value, int n);
+                                void *value, int n);
 extern void dmxDestroyPictureClip(PicturePtr pPicture);
 extern void dmxChangePicture(PicturePtr pPicture, Mask mask);
 extern void dmxValidatePicture(PicturePtr pPicture, Mask mask);
index 849ef16..963d3a9 100644 (file)
@@ -41,7 +41,6 @@
 
 #include "dmx.h"
 #include "dmxsync.h"
-#include "dmxshadow.h"
 #include "dmxscrinit.h"
 #include "dmxcursor.h"
 #include "dmxgc.h"
@@ -159,37 +158,18 @@ dmxBEScreenInit(ScreenPtr pScreen)
 
     XMapWindow(dmxScreen->beDisplay, dmxScreen->scrnWin);
 
-    if (dmxShadowFB) {
-        mask = (GCFunction | GCPlaneMask | GCClipMask);
-        gcvals.function = GXcopy;
-        gcvals.plane_mask = AllPlanes;
-        gcvals.clip_mask = None;
-
-        dmxScreen->shadowGC = XCreateGC(dmxScreen->beDisplay,
-                                        dmxScreen->scrnWin, mask, &gcvals);
-
-        dmxScreen->shadowFBImage =
-            XCreateImage(dmxScreen->beDisplay,
-                         dmxScreen->beVisuals[dmxScreen->beDefVisualIndex].
-                         visual, dmxScreen->beDepth, ZPixmap, 0,
-                         (char *) dmxScreen->shadow, dmxScreen->scrnWidth,
-                         dmxScreen->scrnHeight, dmxScreen->beBPP,
-                         PixmapBytePad(dmxScreen->scrnWidth, dmxScreen->beBPP));
-    }
-    else {
-        /* Create default drawables (used during GC creation) */
-        for (i = 0; i < dmxScreen->beNumPixmapFormats; i++)
-            for (j = 0; j < dmxScreen->beNumDepths; j++)
-                if ((dmxScreen->bePixmapFormats[i].depth == 1) ||
-                    (dmxScreen->bePixmapFormats[i].depth ==
-                     dmxScreen->beDepths[j])) {
-                    dmxScreen->scrnDefDrawables[i] = (Drawable)
-                        XCreatePixmap(dmxScreen->beDisplay, dmxScreen->scrnWin,
-                                      1, 1,
-                                      dmxScreen->bePixmapFormats[i].depth);
-                    break;
-                }
-    }
+    /* Create default drawables (used during GC creation) */
+    for (i = 0; i < dmxScreen->beNumPixmapFormats; i++)
+       for (j = 0; j < dmxScreen->beNumDepths; j++)
+           if ((dmxScreen->bePixmapFormats[i].depth == 1) ||
+               (dmxScreen->bePixmapFormats[i].depth ==
+                dmxScreen->beDepths[j])) {
+               dmxScreen->scrnDefDrawables[i] = (Drawable)
+                   XCreatePixmap(dmxScreen->beDisplay, dmxScreen->scrnWin,
+                                 1, 1,
+                                 dmxScreen->bePixmapFormats[i].depth);
+               break;
+           }
 }
 
 /** Initialize screen number \a pScreen->myNum. */
@@ -215,19 +195,12 @@ dmxScreenInit(ScreenPtr pScreen, int argc, char *argv[])
         dmxGeneration = serverGeneration;
     }
 
-    if (dmxShadowFB) {
-        dmxScreen->shadow = shadowAlloc(dmxScreen->scrnWidth,
-                                        dmxScreen->scrnHeight,
-                                        dmxScreen->beBPP);
-    }
-    else {
-        if (!dmxInitGC(pScreen))
-            return FALSE;
-        if (!dmxInitWindow(pScreen))
-            return FALSE;
-        if (!dmxInitPixmap(pScreen))
-            return FALSE;
-    }
+    if (!dmxInitGC(pScreen))
+       return FALSE;
+    if (!dmxInitWindow(pScreen))
+       return FALSE;
+    if (!dmxInitPixmap(pScreen))
+       return FALSE;
 
     /*
      * Initalise the visual types.  miSetVisualTypesAndMasks() requires
@@ -267,7 +240,7 @@ dmxScreenInit(ScreenPtr pScreen, int argc, char *argv[])
     }
 
     fbScreenInit(pScreen,
-                 dmxShadowFB ? dmxScreen->shadow : NULL,
+                 NULL,
                  dmxScreen->scrnWidth,
                  dmxScreen->scrnHeight,
                  dmxScreen->beXDPI,
@@ -278,22 +251,14 @@ dmxScreenInit(ScreenPtr pScreen, int argc, char *argv[])
     pScreen->GetWindowPixmap = NULL;
     pScreen->SetWindowPixmap = NULL;
 
-    if (dmxShadowFB && !shadowInit(pScreen, dmxShadowUpdateProc, NULL))
-        return FALSE;
+    MAXSCREENSALLOC(dmxCursorGeneration);
+    if (dmxCursorGeneration[pScreen->myNum] != serverGeneration) {
+       if (!(miPointerInitialize(pScreen,
+                                 &dmxPointerSpriteFuncs,
+                                 &dmxPointerCursorFuncs, FALSE)))
+           return FALSE;
 
-    if (dmxShadowFB) {
-        miDCInitialize(pScreen, &dmxPointerCursorFuncs);
-    }
-    else {
-        MAXSCREENSALLOC(dmxCursorGeneration);
-        if (dmxCursorGeneration[pScreen->myNum] != serverGeneration) {
-            if (!(miPointerInitialize(pScreen,
-                                      &dmxPointerSpriteFuncs,
-                                      &dmxPointerCursorFuncs, FALSE)))
-                return FALSE;
-
-            dmxCursorGeneration[pScreen->myNum] = serverGeneration;
-        }
+       dmxCursorGeneration[pScreen->myNum] = serverGeneration;
     }
 
     DMX_WRAP(CloseScreen, dmxCloseScreen, dmxScreen, pScreen);
@@ -301,49 +266,47 @@ dmxScreenInit(ScreenPtr pScreen, int argc, char *argv[])
 
     dmxBEScreenInit(pScreen);
 
-    if (!dmxShadowFB) {
-        /* Wrap GC functions */
-        DMX_WRAP(CreateGC, dmxCreateGC, dmxScreen, pScreen);
-
-        /* Wrap Window functions */
-        DMX_WRAP(CreateWindow, dmxCreateWindow, dmxScreen, pScreen);
-        DMX_WRAP(DestroyWindow, dmxDestroyWindow, dmxScreen, pScreen);
-        DMX_WRAP(PositionWindow, dmxPositionWindow, dmxScreen, pScreen);
-        DMX_WRAP(ChangeWindowAttributes, dmxChangeWindowAttributes, dmxScreen,
-                 pScreen);
-        DMX_WRAP(RealizeWindow, dmxRealizeWindow, dmxScreen, pScreen);
-        DMX_WRAP(UnrealizeWindow, dmxUnrealizeWindow, dmxScreen, pScreen);
-        DMX_WRAP(RestackWindow, dmxRestackWindow, dmxScreen, pScreen);
-        DMX_WRAP(WindowExposures, dmxWindowExposures, dmxScreen, pScreen);
-        DMX_WRAP(CopyWindow, dmxCopyWindow, dmxScreen, pScreen);
-
-        DMX_WRAP(ResizeWindow, dmxResizeWindow, dmxScreen, pScreen);
-        DMX_WRAP(ReparentWindow, dmxReparentWindow, dmxScreen, pScreen);
-
-        DMX_WRAP(ChangeBorderWidth, dmxChangeBorderWidth, dmxScreen, pScreen);
-
-        /* Wrap Image functions */
-        DMX_WRAP(GetImage, dmxGetImage, dmxScreen, pScreen);
-        DMX_WRAP(GetSpans, dmxGetSpans, dmxScreen, pScreen);
-
-        /* Wrap Pixmap functions */
-        DMX_WRAP(CreatePixmap, dmxCreatePixmap, dmxScreen, pScreen);
-        DMX_WRAP(DestroyPixmap, dmxDestroyPixmap, dmxScreen, pScreen);
-        DMX_WRAP(BitmapToRegion, dmxBitmapToRegion, dmxScreen, pScreen);
-
-        /* Wrap Font functions */
-        DMX_WRAP(RealizeFont, dmxRealizeFont, dmxScreen, pScreen);
-        DMX_WRAP(UnrealizeFont, dmxUnrealizeFont, dmxScreen, pScreen);
-
-        /* Wrap Colormap functions */
-        DMX_WRAP(CreateColormap, dmxCreateColormap, dmxScreen, pScreen);
-        DMX_WRAP(DestroyColormap, dmxDestroyColormap, dmxScreen, pScreen);
-        DMX_WRAP(InstallColormap, dmxInstallColormap, dmxScreen, pScreen);
-        DMX_WRAP(StoreColors, dmxStoreColors, dmxScreen, pScreen);
-
-        /* Wrap Shape functions */
-        DMX_WRAP(SetShape, dmxSetShape, dmxScreen, pScreen);
-    }
+    /* Wrap GC functions */
+    DMX_WRAP(CreateGC, dmxCreateGC, dmxScreen, pScreen);
+
+    /* Wrap Window functions */
+    DMX_WRAP(CreateWindow, dmxCreateWindow, dmxScreen, pScreen);
+    DMX_WRAP(DestroyWindow, dmxDestroyWindow, dmxScreen, pScreen);
+    DMX_WRAP(PositionWindow, dmxPositionWindow, dmxScreen, pScreen);
+    DMX_WRAP(ChangeWindowAttributes, dmxChangeWindowAttributes, dmxScreen,
+            pScreen);
+    DMX_WRAP(RealizeWindow, dmxRealizeWindow, dmxScreen, pScreen);
+    DMX_WRAP(UnrealizeWindow, dmxUnrealizeWindow, dmxScreen, pScreen);
+    DMX_WRAP(RestackWindow, dmxRestackWindow, dmxScreen, pScreen);
+    DMX_WRAP(WindowExposures, dmxWindowExposures, dmxScreen, pScreen);
+    DMX_WRAP(CopyWindow, dmxCopyWindow, dmxScreen, pScreen);
+
+    DMX_WRAP(ResizeWindow, dmxResizeWindow, dmxScreen, pScreen);
+    DMX_WRAP(ReparentWindow, dmxReparentWindow, dmxScreen, pScreen);
+
+    DMX_WRAP(ChangeBorderWidth, dmxChangeBorderWidth, dmxScreen, pScreen);
+
+    /* Wrap Image functions */
+    DMX_WRAP(GetImage, dmxGetImage, dmxScreen, pScreen);
+    DMX_WRAP(GetSpans, dmxGetSpans, dmxScreen, pScreen);
+
+    /* Wrap Pixmap functions */
+    DMX_WRAP(CreatePixmap, dmxCreatePixmap, dmxScreen, pScreen);
+    DMX_WRAP(DestroyPixmap, dmxDestroyPixmap, dmxScreen, pScreen);
+    DMX_WRAP(BitmapToRegion, dmxBitmapToRegion, dmxScreen, pScreen);
+
+    /* Wrap Font functions */
+    DMX_WRAP(RealizeFont, dmxRealizeFont, dmxScreen, pScreen);
+    DMX_WRAP(UnrealizeFont, dmxUnrealizeFont, dmxScreen, pScreen);
+
+    /* Wrap Colormap functions */
+    DMX_WRAP(CreateColormap, dmxCreateColormap, dmxScreen, pScreen);
+    DMX_WRAP(DestroyColormap, dmxDestroyColormap, dmxScreen, pScreen);
+    DMX_WRAP(InstallColormap, dmxInstallColormap, dmxScreen, pScreen);
+    DMX_WRAP(StoreColors, dmxStoreColors, dmxScreen, pScreen);
+
+    /* Wrap Shape functions */
+    DMX_WRAP(SetShape, dmxSetShape, dmxScreen, pScreen);
 
     if (!dmxCreateDefColormap(pScreen))
         return FALSE;
@@ -370,22 +333,13 @@ dmxBECloseScreen(ScreenPtr pScreen)
     XDestroyWindow(dmxScreen->beDisplay, dmxScreen->scrnWin);
     dmxScreen->scrnWin = (Window) 0;
 
-    if (dmxShadowFB) {
-        /* Free the shadow GC and image assocated with the back-end server */
-        XFreeGC(dmxScreen->beDisplay, dmxScreen->shadowGC);
-        dmxScreen->shadowGC = NULL;
-        XFree(dmxScreen->shadowFBImage);
-        dmxScreen->shadowFBImage = NULL;
-    }
-    else {
-        /* Free the default drawables */
-        for (i = 0; i < dmxScreen->beNumPixmapFormats; i++) {
-            if (dmxScreen->scrnDefDrawables[i]) {
-                XFreePixmap(dmxScreen->beDisplay,
-                            dmxScreen->scrnDefDrawables[i]);
-                dmxScreen->scrnDefDrawables[i] = (Drawable) 0;
-            }
-        }
+    /* Free the default drawables */
+    for (i = 0; i < dmxScreen->beNumPixmapFormats; i++) {
+       if (dmxScreen->scrnDefDrawables[i]) {
+           XFreePixmap(dmxScreen->beDisplay,
+                       dmxScreen->scrnDefDrawables[i]);
+           dmxScreen->scrnDefDrawables[i] = (Drawable) 0;
+       }
     }
 
     /* Free resources allocated during initialization (in dmxinit.c) */
@@ -432,48 +386,41 @@ dmxCloseScreen(ScreenPtr pScreen)
         dmxResetFonts();
     }
 
-    if (dmxShadowFB) {
-        /* Free the shadow framebuffer */
-        free(dmxScreen->shadow);
-    }
-    else {
-
-        /* Unwrap Shape functions */
-        DMX_UNWRAP(SetShape, dmxScreen, pScreen);
+    /* Unwrap Shape functions */
+    DMX_UNWRAP(SetShape, dmxScreen, pScreen);
 
-        /* Unwrap the pScreen functions */
-        DMX_UNWRAP(CreateGC, dmxScreen, pScreen);
+    /* Unwrap the pScreen functions */
+    DMX_UNWRAP(CreateGC, dmxScreen, pScreen);
 
-        DMX_UNWRAP(CreateWindow, dmxScreen, pScreen);
-        DMX_UNWRAP(DestroyWindow, dmxScreen, pScreen);
-        DMX_UNWRAP(PositionWindow, dmxScreen, pScreen);
-        DMX_UNWRAP(ChangeWindowAttributes, dmxScreen, pScreen);
-        DMX_UNWRAP(RealizeWindow, dmxScreen, pScreen);
-        DMX_UNWRAP(UnrealizeWindow, dmxScreen, pScreen);
-        DMX_UNWRAP(RestackWindow, dmxScreen, pScreen);
-        DMX_UNWRAP(WindowExposures, dmxScreen, pScreen);
-        DMX_UNWRAP(CopyWindow, dmxScreen, pScreen);
+    DMX_UNWRAP(CreateWindow, dmxScreen, pScreen);
+    DMX_UNWRAP(DestroyWindow, dmxScreen, pScreen);
+    DMX_UNWRAP(PositionWindow, dmxScreen, pScreen);
+    DMX_UNWRAP(ChangeWindowAttributes, dmxScreen, pScreen);
+    DMX_UNWRAP(RealizeWindow, dmxScreen, pScreen);
+    DMX_UNWRAP(UnrealizeWindow, dmxScreen, pScreen);
+    DMX_UNWRAP(RestackWindow, dmxScreen, pScreen);
+    DMX_UNWRAP(WindowExposures, dmxScreen, pScreen);
+    DMX_UNWRAP(CopyWindow, dmxScreen, pScreen);
 
-        DMX_UNWRAP(ResizeWindow, dmxScreen, pScreen);
-        DMX_UNWRAP(ReparentWindow, dmxScreen, pScreen);
+    DMX_UNWRAP(ResizeWindow, dmxScreen, pScreen);
+    DMX_UNWRAP(ReparentWindow, dmxScreen, pScreen);
 
-        DMX_UNWRAP(ChangeBorderWidth, dmxScreen, pScreen);
+    DMX_UNWRAP(ChangeBorderWidth, dmxScreen, pScreen);
 
-        DMX_UNWRAP(GetImage, dmxScreen, pScreen);
-        DMX_UNWRAP(GetSpans, dmxScreen, pScreen);
+    DMX_UNWRAP(GetImage, dmxScreen, pScreen);
+    DMX_UNWRAP(GetSpans, dmxScreen, pScreen);
 
-        DMX_UNWRAP(CreatePixmap, dmxScreen, pScreen);
-        DMX_UNWRAP(DestroyPixmap, dmxScreen, pScreen);
-        DMX_UNWRAP(BitmapToRegion, dmxScreen, pScreen);
+    DMX_UNWRAP(CreatePixmap, dmxScreen, pScreen);
+    DMX_UNWRAP(DestroyPixmap, dmxScreen, pScreen);
+    DMX_UNWRAP(BitmapToRegion, dmxScreen, pScreen);
 
-        DMX_UNWRAP(RealizeFont, dmxScreen, pScreen);
-        DMX_UNWRAP(UnrealizeFont, dmxScreen, pScreen);
+    DMX_UNWRAP(RealizeFont, dmxScreen, pScreen);
+    DMX_UNWRAP(UnrealizeFont, dmxScreen, pScreen);
 
-        DMX_UNWRAP(CreateColormap, dmxScreen, pScreen);
-        DMX_UNWRAP(DestroyColormap, dmxScreen, pScreen);
-        DMX_UNWRAP(InstallColormap, dmxScreen, pScreen);
-        DMX_UNWRAP(StoreColors, dmxScreen, pScreen);
-    }
+    DMX_UNWRAP(CreateColormap, dmxScreen, pScreen);
+    DMX_UNWRAP(DestroyColormap, dmxScreen, pScreen);
+    DMX_UNWRAP(InstallColormap, dmxScreen, pScreen);
+    DMX_UNWRAP(StoreColors, dmxScreen, pScreen);
 
     DMX_UNWRAP(SaveScreen, dmxScreen, pScreen);
 
diff --git a/hw/dmx/dmxshadow.c b/hw/dmx/dmxshadow.c
deleted file mode 100644 (file)
index 9b4bafc..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright 2001 Red Hat Inc., Durham, North Carolina.
- *
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation on the rights to use, copy, modify, merge,
- * publish, distribute, 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
- * NON-INFRINGEMENT.  IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-/*
- * Authors:
- *   Kevin E. Martin <kem@redhat.com>
- *   David H. Dawes <dawes@xfree86.org>
- *
- */
-
-#ifdef HAVE_DMX_CONFIG_H
-#include <dmx-config.h>
-#endif
-
-#include "dmx.h"
-#include "dmxsync.h"
-#include "dmxshadow.h"
-
-/** \file
- * This file provides support for the shadow frame buffer. */
-
-/** Update the screen from the shadow frame buffer. */
-void
-dmxShadowUpdateProc(ScreenPtr pScreen, shadowBufPtr pBuf)
-{
-    RegionPtr damage = &pBuf->damage;
-    int nbox = RegionNumRects(damage);
-    BoxPtr pbox = RegionRects(damage);
-    DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
-
-    if (!dmxScreen->beDisplay)
-        return;
-
-    while (nbox--) {
-        XPutImage(dmxScreen->beDisplay,
-                  dmxScreen->scrnWin,
-                  dmxScreen->shadowGC,
-                  dmxScreen->shadowFBImage,
-                  pbox->x1, pbox->y1,
-                  pbox->x1, pbox->y1, pbox->x2 - pbox->x1, pbox->y2 - pbox->y1);
-
-        pbox++;
-    }
-
-    dmxSync(dmxScreen, FALSE);
-}
diff --git a/hw/dmx/dmxshadow.h b/hw/dmx/dmxshadow.h
deleted file mode 100644 (file)
index 081b4d1..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright 2001 Red Hat Inc., Durham, North Carolina.
- *
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation on the rights to use, copy, modify, merge,
- * publish, distribute, 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
- * NON-INFRINGEMENT.  IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-/*
- * Authors:
- *   Kevin E. Martin <kem@redhat.com>
- *   David H. Dawes <dawes@xfree86.org>
- *
- */
-
-/** \file
- * Interface for shadow framebuffer support.  \see dmxshadow.c */
-
-#ifndef DMXSHADOW_H
-#define DMXSHADOW_H
-
-#include "shadow.h"
-#include "scrnintstr.h"
-
-extern void dmxShadowUpdateProc(ScreenPtr pScreen, shadowBufPtr pBuf);
-
-#endif                          /* DMXSHADOW_H */
index 0d8c22a..0ae5107 100644 (file)
@@ -175,7 +175,7 @@ dmxStatSync(DMXScreenInfo * dmxScreen,
 
 /* Actually do the work of printing out the human-readable message. */
 static CARD32
-dmxStatCallback(OsTimerPtr timer, CARD32 t, pointer arg)
+dmxStatCallback(OsTimerPtr timer, CARD32 t, void *arg)
 {
     int i, j;
     static int header = 0;
index bf28584..81dbbc6 100644 (file)
@@ -82,7 +82,7 @@ dmxDoSync(DMXScreenInfo * dmxScreen)
 }
 
 static CARD32
-dmxSyncCallback(OsTimerPtr timer, CARD32 time, pointer arg)
+dmxSyncCallback(OsTimerPtr timer, CARD32 time, void *arg)
 {
     int i;
 
@@ -99,13 +99,13 @@ dmxSyncCallback(OsTimerPtr timer, CARD32 time, pointer arg)
 }
 
 static void
-dmxSyncBlockHandler(pointer blockData, OSTimePtr pTimeout, pointer pReadMask)
+dmxSyncBlockHandler(void *blockData, OSTimePtr pTimeout, void *pReadMask)
 {
     TimerForce(dmxSyncTimer);
 }
 
 static void
-dmxSyncWakeupHandler(pointer blockData, int result, pointer pReadMask)
+dmxSyncWakeupHandler(void *blockData, int result, void *pReadMask)
 {
 }
 
index 855e56b..1c23527 100644 (file)
@@ -86,7 +86,7 @@ dmxCreateRootWindow(WindowPtr pWindow)
     parent = dmxScreen->scrnWin;        /* This is our "Screen" window */
     visual = dmxScreen->beVisuals[dmxScreen->beDefVisualIndex].visual;
 
-    dixLookupResourceByType((pointer *) &pCmap, wColormap(pWindow),
+    dixLookupResourceByType((void **) &pCmap, wColormap(pWindow),
                             RT_COLORMAP, NullClient, DixUnknownAccess);
     pCmapPriv = DMX_GET_COLORMAP_PRIV(pCmap);
 
@@ -192,7 +192,7 @@ dmxGetDefaultWindowAttributes(WindowPtr pWindow,
             ColormapPtr pCmap;
             dmxColormapPrivPtr pCmapPriv;
 
-            dixLookupResourceByType((pointer *) &pCmap, wColormap(pWindow),
+            dixLookupResourceByType((void **) &pCmap, wColormap(pWindow),
                                     RT_COLORMAP, NullClient, DixUnknownAccess);
             pCmapPriv = DMX_GET_COLORMAP_PRIV(pCmap);
             *cmap = pCmapPriv->cmap;
@@ -561,7 +561,7 @@ dmxDoChangeWindowAttributes(WindowPtr pWindow,
         ColormapPtr pCmap;
         dmxColormapPrivPtr pCmapPriv;
 
-        dixLookupResourceByType((pointer *) &pCmap, wColormap(pWindow),
+        dixLookupResourceByType((void **) &pCmap, wColormap(pWindow),
                                 RT_COLORMAP, NullClient, DixUnknownAccess);
         pCmapPriv = DMX_GET_COLORMAP_PRIV(pCmap);
         attribs->colormap = pCmapPriv->cmap;
@@ -786,7 +786,7 @@ dmxWindowExposures(WindowPtr pWindow, RegionPtr prgn, RegionPtr other_exposed)
     if (pWinPriv->window) {
         while (XCheckIfEvent(dmxScreen->beDisplay, &ev,
                              dmxWindowExposurePredicate,
-                             (XPointer) & pWinPriv->window)) {
+                             (XPointer) &pWinPriv->window)) {
             /* Handle expose events -- this should not be necessary
                since the base window in which the root window was
                created is guaranteed to be on top (override_redirect),
index 793aace..6d7df41 100644 (file)
@@ -1215,14 +1215,6 @@ area.  Common functions to wrap are CloseScreen() and SaveScreen().
 </para></listitem></varlistentry>
 
 <varlistentry>
-<term>miInitializeBackingStore()</term>
-<listitem>
-<para>This MI function initializes the
-screen's backing storage functions, which are used to save areas of
-windows that are currently covered by other windows.
-</para></listitem></varlistentry>
-
-<varlistentry>
 <term>miDCInitialize()</term>
 <listitem>
 <para>This MI function initializes the MI cursor
@@ -1320,8 +1312,8 @@ initialize each of its screens.
 <para>Xnest's ScreenInit() function is called
 xnestOpenScreen().  This function initializes its screen's depth and
 visual information, and then calls miScreenInit() to set up the default
-screen functions.  It then calls miInitializeBackingStore() and
-miDCInitialize() to initialize backing store and the software cursor.
+screen functions.  It then calls miDCInitialize() to initialize the
+software cursor.
 Finally, it replaces many of the screen functions with its own
 functions that repackage and send the requests to the real X server to
 which Xnest is attached.
index db66010..6eddc6a 100644 (file)
@@ -303,8 +303,8 @@ main(int argc, char **argv)
 
             XNextEvent(display, &event);
             for (i = 0; i < cnt; i++) {
-                XDeviceMotionEvent *e = (XDeviceMotionEvent *) & event;
-                XDeviceButtonEvent *b = (XDeviceButtonEvent *) & event;
+                XDeviceMotionEvent *e = (XDeviceMotionEvent *) &event;
+                XDeviceButtonEvent *b = (XDeviceButtonEvent *) &event;
 
                 if (event.type == event_type[i]) {
                     printf("%s id=%lu (%d @ %d,%d; s=0x%04x, d=%d, t=%lu)"
index 4ee1036..c3df169 100644 (file)
@@ -22,7 +22,6 @@ libglxproxy_a_SOURCES = compsize.c \
                         glxsingle.h \
                         glxswap.c \
                         glxswap.h \
-                        glxutil.c \
                         glxutil.h \
                         glxvendor.c \
                         glxvendor.h \
index 91011d1..23c3366 100644 (file)
@@ -123,6 +123,28 @@ GetBackEndDisplay(__GLXclientState * cl, int s)
     return cl->be_displays[s];
 }
 
+/**
+ * Convert the render type bits from fbconfig into context render type.
+ */
+static int
+renderTypeBitsToRenderTypeEnum(int fbRenderType)
+{
+    if (fbRenderType & GLX_RGBA_BIT)
+        return GLX_RGBA_TYPE;
+
+    if (fbRenderType & GLX_COLOR_INDEX_BIT)
+        return  GLX_COLOR_INDEX_TYPE;
+
+    if (fbRenderType & GLX_RGBA_FLOAT_BIT_ARB)
+        return GLX_RGBA_FLOAT_TYPE_ARB;
+
+    if (fbRenderType & GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT)
+        return GLX_RGBA_UNSIGNED_FLOAT_TYPE_EXT;
+
+    /* There's no recognized renderType in the config */
+    return GLX_RGBA_TYPE;
+}
+
 /*
 ** Create a GL context with the given properties.
 */
@@ -173,7 +195,7 @@ CreateContext(__GLXclientState * cl,
         shareglxc = NULL;
     }
     else {
-        dixLookupResourceByType((pointer *) &shareglxc, shareList,
+        dixLookupResourceByType((void **) &shareglxc, shareList,
                                 __glXContextRes, NullClient, DixUnknownAccess);
         if (!shareglxc) {
             client->errorValue = shareList;
@@ -308,12 +330,14 @@ CreateContext(__GLXclientState * cl,
         /* send the create context request to the back-end server */
         dpy = GetBackEndDisplay(cl, screen);
         if (glxc->pFBConfig) {
-            /*Since for a certain visual both RGB and COLOR INDEX
-             *can be on then the only parmeter to choose the renderType
-             * should be the class of the colormap since all 4 first 
-             * classes does not support RGB mode only COLOR INDEX ,
-             * and so TrueColor and DirectColor does not support COLOR INDEX*/
-            int renderType = glxc->pFBConfig->renderType;
+            /* For a specific visual, multiple render types (i.e., both RGB
+             * and COLOR INDEX) can be accessible. The only parameter to
+             * choose the renderType should be the class of the colormap,
+             * since the first classes do not support RGB mode (only COLOR
+             * INDEX), and TrueColor and DirectColor do not support COLOR
+             * INDEX.
+             */
+            int renderType = GLX_RGBA_TYPE;
 
             if (pVisual) {
                 switch (pVisual->class) {
@@ -329,7 +353,11 @@ CreateContext(__GLXclientState * cl,
                     renderType = GLX_RGBA_TYPE;
                     break;
                 }
+            } else {
+                renderType =
+                    renderTypeBitsToRenderTypeEnum(glxc->pFBConfig->renderType);
             }
+
             if (__GLX_IS_VERSION_SUPPORTED(1, 3)) {
                 LockDisplay(dpy);
                 GetReq(GLXCreateNewContext, be_new_req);
@@ -397,7 +425,7 @@ CreateContext(__GLXclientState * cl,
     /*
      ** Register this context as a resource.
      */
-    if (!AddResource(gcId, __glXContextRes, (pointer) glxc)) {
+    if (!AddResource(gcId, __glXContextRes, (void *) glxc)) {
         free(glxc->real_ids);
         free(glxc->real_vids);
         free(glxc);
@@ -483,14 +511,14 @@ __glXBindSwapBarrierSGIX(__GLXclientState * cl, GLbyte * pc)
 
     rc = dixLookupDrawable(&pDraw, req->drawable, client, 0, DixGetAttrAccess);
     if (rc != Success) {
-        dixLookupResourceByType((pointer *) &pGlxPixmap, req->drawable,
+        dixLookupResourceByType((void **) &pGlxPixmap, req->drawable,
                                 __glXPixmapRes, NullClient, DixUnknownAccess);
         if (pGlxPixmap)
             pDraw = pGlxPixmap->pDraw;
     }
 
     if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1, 3)) {
-        dixLookupResourceByType((pointer *) &pGlxWindow, req->drawable,
+        dixLookupResourceByType((void **) &pGlxWindow, req->drawable,
                                 __glXWindowRes, NullClient, DixUnknownAccess);
         if (pGlxWindow)
             pDraw = pGlxWindow->pDraw;
@@ -516,14 +544,14 @@ __glXJoinSwapGroupSGIX(__GLXclientState * cl, GLbyte * pc)
 
     rc = dixLookupDrawable(&pDraw, req->drawable, client, 0, DixManageAccess);
     if (rc != Success) {
-        dixLookupResourceByType((pointer *) &pGlxPixmap, req->drawable,
+        dixLookupResourceByType((void **) &pGlxPixmap, req->drawable,
                                 __glXPixmapRes, NullClient, DixUnknownAccess);
         if (pGlxPixmap)
             pDraw = pGlxPixmap->pDraw;
     }
 
     if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1, 3)) {
-        dixLookupResourceByType((pointer *) &pGlxWindow, req->drawable,
+        dixLookupResourceByType((void **) &pGlxWindow, req->drawable,
                                 __glXWindowRes, NullClient, DixUnknownAccess);
         if (pGlxWindow)
             pDraw = pGlxWindow->pDraw;
@@ -538,7 +566,7 @@ __glXJoinSwapGroupSGIX(__GLXclientState * cl, GLbyte * pc)
         rc = dixLookupDrawable(&pMember, req->member, client, 0,
                                DixGetAttrAccess);
         if (rc != Success) {
-            dixLookupResourceByType((pointer *) &pGlxPixmap, req->member,
+            dixLookupResourceByType((void **) &pGlxPixmap, req->member,
                                     __glXPixmapRes, NullClient,
                                     DixUnknownAccess);
             if (pGlxPixmap)
@@ -546,7 +574,7 @@ __glXJoinSwapGroupSGIX(__GLXclientState * cl, GLbyte * pc)
         }
 
         if (!pMember && __GLX_IS_VERSION_SUPPORTED(1, 3)) {
-            dixLookupResourceByType((pointer *) &pGlxWindow, req->member,
+            dixLookupResourceByType((void **) &pGlxWindow, req->member,
                                     __glXWindowRes, NullClient,
                                     DixUnknownAccess);
             if (pGlxWindow)
@@ -577,7 +605,7 @@ __glXDestroyContext(__GLXclientState * cl, GLbyte * pc)
     int to_screen = 0;
     int s;
 
-    dixLookupResourceByType((pointer *) &glxc, gcId, __glXContextRes,
+    dixLookupResourceByType((void **) &glxc, gcId, __glXContextRes,
                             NullClient, DixUnknownAccess);
     if (glxc) {
         /*
@@ -852,7 +880,7 @@ MakeCurrent(__GLXclientState * cl,
      ** Lookup new context.  It must not be current for someone else.
      */
     if (contextId != None) {
-        dixLookupResourceByType((pointer *) &glxc, contextId, __glXContextRes,
+        dixLookupResourceByType((void **) &glxc, contextId, __glXContextRes,
                                 NullClient, DixUnknownAccess);
         if (!glxc) {
             client->errorValue = contextId;
@@ -907,7 +935,7 @@ MakeCurrent(__GLXclientState * cl,
         }
 
         if (!pDraw) {
-            dixLookupResourceByType((pointer *) &pGlxPixmap, drawId,
+            dixLookupResourceByType((void **) &pGlxPixmap, drawId,
                                     __glXPixmapRes, NullClient,
                                     DixUnknownAccess);
             if (pGlxPixmap) {
@@ -932,7 +960,7 @@ MakeCurrent(__GLXclientState * cl,
         }
 
         if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1, 3)) {
-            dixLookupResourceByType((pointer *) &pGlxWindow, drawId,
+            dixLookupResourceByType((void **) &pGlxWindow, drawId,
                                     __glXWindowRes, NullClient,
                                     DixUnknownAccess);
             if (pGlxWindow) {
@@ -955,7 +983,7 @@ MakeCurrent(__GLXclientState * cl,
         }
 
         if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1, 3)) {
-            dixLookupResourceByType((pointer *) &pGlxPbuffer, drawId,
+            dixLookupResourceByType((void **) &pGlxPbuffer, drawId,
                                     __glXPbufferRes, NullClient,
                                     DixUnknownAccess);
             if (pGlxPbuffer) {
@@ -1022,7 +1050,7 @@ MakeCurrent(__GLXclientState * cl,
         }
 
         if (!pReadDraw) {
-            dixLookupResourceByType((pointer *) &pReadGlxPixmap, readId,
+            dixLookupResourceByType((void **) &pReadGlxPixmap, readId,
                                     __glXPixmapRes, NullClient,
                                     DixUnknownAccess);
             if (pReadGlxPixmap) {
@@ -1044,7 +1072,7 @@ MakeCurrent(__GLXclientState * cl,
         }
 
         if (!pReadDraw && __GLX_IS_VERSION_SUPPORTED(1, 3)) {
-            dixLookupResourceByType((pointer *) &pGlxReadWindow, readId,
+            dixLookupResourceByType((void **) &pGlxReadWindow, readId,
                                     __glXWindowRes, NullClient,
                                     DixUnknownAccess);
             if (pGlxReadWindow) {
@@ -1066,7 +1094,7 @@ MakeCurrent(__GLXclientState * cl,
         }
 
         if (!pReadDraw && __GLX_IS_VERSION_SUPPORTED(1, 3)) {
-            dixLookupResourceByType((pointer *) &pGlxReadPbuffer, readId,
+            dixLookupResourceByType((void **) &pGlxReadPbuffer, readId,
                                     __glXPbufferRes, NullClient,
                                     DixUnknownAccess);
             if (pGlxReadPbuffer) {
@@ -1208,14 +1236,14 @@ MakeCurrent(__GLXclientState * cl,
         to_screen = screenInfo.numScreens - 1;
 
         if (pDraw && new_reply.writeType != GLX_PBUFFER_TYPE) {
-            dixLookupResourceByClass((pointer *) &pXinDraw,
+            dixLookupResourceByClass((void **) &pXinDraw,
                                      pDraw->id, XRC_DRAWABLE,
                                      client, DixReadAccess);
         }
 
         if (pReadDraw && pReadDraw != pDraw &&
             new_reply.readType != GLX_PBUFFER_TYPE) {
-            dixLookupResourceByClass((pointer *) &pXinReadDraw,
+            dixLookupResourceByClass((void **) &pXinReadDraw,
                                      pReadDraw->id, XRC_DRAWABLE,
                                      client, DixReadAccess);
         }
@@ -1276,7 +1304,7 @@ MakeCurrent(__GLXclientState * cl,
             be_req->context =
                 (unsigned int) (glxc ? glxc->real_ids[s - from_screen] : 0);
             be_req->oldContextTag = GetCurrentBackEndTag(cl, tag, s);
-            if (!_XReply(dpy, (xReply *) & be_reply, 0, False)) {
+            if (!_XReply(dpy, (xReply *) &be_reply, 0, False)) {
 
                 /* The make current failed */
                 UnlockDisplay(dpy);
@@ -1331,7 +1359,7 @@ MakeCurrent(__GLXclientState * cl,
                 be_new_req->context =
                     (unsigned int) (glxc ? glxc->real_ids[s - from_screen] : 0);
                 be_new_req->oldContextTag = GetCurrentBackEndTag(cl, tag, s);
-                if (!_XReply(dpy, (xReply *) & be_new_reply, 0, False)) {
+                if (!_XReply(dpy, (xReply *) &be_new_reply, 0, False)) {
 
                     /* The make current failed */
                     UnlockDisplay(dpy);
@@ -1362,7 +1390,7 @@ MakeCurrent(__GLXclientState * cl,
                 ext_req->context =
                     (unsigned int) (glxc ? glxc->real_ids[s - from_screen] : 0);
                 ext_req->oldContextTag = GetCurrentBackEndTag(cl, tag, s);
-                if (!_XReply(dpy, (xReply *) & ext_reply, 0, False)) {
+                if (!_XReply(dpy, (xReply *) &ext_reply, 0, False)) {
 
                     /* The make current failed */
                     UnlockDisplay(dpy);
@@ -1432,7 +1460,7 @@ __glXIsDirect(__GLXclientState * cl, GLbyte * pc)
     /*
      ** Find the GL context.
      */
-    dixLookupResourceByType((pointer *) &glxc, req->context, __glXContextRes,
+    dixLookupResourceByType((void **) &glxc, req->context, __glXContextRes,
                             NullClient, DixUnknownAccess);
     if (!glxc) {
         client->errorValue = req->context;
@@ -1591,13 +1619,13 @@ __glXCopyContext(__GLXclientState * cl, GLbyte * pc)
     /*
      ** Check that each context exists.
      */
-    dixLookupResourceByType((pointer *) &src, source, __glXContextRes,
+    dixLookupResourceByType((void **) &src, source, __glXContextRes,
                             NullClient, DixUnknownAccess);
     if (!src) {
         client->errorValue = source;
         return __glXBadContext;
     }
-    dixLookupResourceByType((pointer *) &dst, dest, __glXContextRes,
+    dixLookupResourceByType((void **) &dst, dest, __glXContextRes,
                             NullClient, DixUnknownAccess);
     if (!dst) {
         client->errorValue = dest;
@@ -1897,7 +1925,7 @@ CreateGLXPixmap(__GLXclientState * cl,
         from_screen = 0;
         to_screen = screenInfo.numScreens - 1;
 
-        dixLookupResourceByClass((pointer *) &pXinDraw,
+        dixLookupResourceByClass((void **) &pXinDraw,
                                  pDraw->id, XRC_DRAWABLE,
                                  client, DixReadAccess);
     }
@@ -1981,6 +2009,7 @@ CreateGLXPixmap(__GLXclientState * cl,
         }
         else {
             client->errorValue = (visual ? visual : fbconfigId);
+            free(pGlxPixmap->be_xids);
             free(pGlxPixmap);
             return BadValue;
         }
@@ -1989,6 +2018,7 @@ CreateGLXPixmap(__GLXclientState * cl,
     }
 
     if (!(AddResource(glxpixmapId, __glXPixmapRes, pGlxPixmap))) {
+        free(pGlxPixmap->be_xids);
         free(pGlxPixmap);
         return BadAlloc;
     }
@@ -2027,7 +2057,7 @@ __glXDestroyGLXPixmap(__GLXclientState * cl, GLbyte * pc)
     /*
      ** Check if it's a valid GLX pixmap.
      */
-    dixLookupResourceByType((pointer *) &pGlxPixmap, glxpixmap,
+    dixLookupResourceByType((void **) &pGlxPixmap, glxpixmap,
                             __glXPixmapRes, NullClient, DixUnknownAccess);
     if (!pGlxPixmap) {
         client->errorValue = glxpixmap;
@@ -2113,7 +2143,7 @@ __glXDoSwapBuffers(__GLXclientState * cl, XID drawId, GLXContextTag tag)
     }
 
     if (!pDraw) {
-        dixLookupResourceByType((pointer *) &pGlxPixmap, drawId,
+        dixLookupResourceByType((void **) &pGlxPixmap, drawId,
                                 __glXPixmapRes, NullClient, DixUnknownAccess);
         if (pGlxPixmap) {
             /*
@@ -2125,7 +2155,7 @@ __glXDoSwapBuffers(__GLXclientState * cl, XID drawId, GLXContextTag tag)
     }
 
     if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1, 3)) {
-        dixLookupResourceByType((pointer *) &pGlxWindow, drawId,
+        dixLookupResourceByType((void **) &pGlxWindow, drawId,
                                 __glXWindowRes, NullClient, DixUnknownAccess);
         if (pGlxWindow) {
             /*
@@ -2155,7 +2185,7 @@ __glXDoSwapBuffers(__GLXclientState * cl, XID drawId, GLXContextTag tag)
     if (!noPanoramiXExtension) {
         from_screen = 0;
         to_screen = screenInfo.numScreens - 1;
-        dixLookupResourceByClass((pointer *) &pXinDraw,
+        dixLookupResourceByClass((void **) &pXinDraw,
                                  pDraw->id, XRC_DRAWABLE,
                                  client, DixReadAccess);
     }
@@ -2177,7 +2207,7 @@ __glXDoSwapBuffers(__GLXclientState * cl, XID drawId, GLXContextTag tag)
             finishReq->glxCode = X_GLsop_Finish;
             finishReq->contextTag =
                 (tag ? GetCurrentBackEndTag(cl, tag, s) : 0);
-            (void) _XReply(dpy, (xReply *) & reply, 0, False);
+            (void) _XReply(dpy, (xReply *) &reply, 0, False);
             UnlockDisplay(dpy);
             SyncHandle();
         }
@@ -2263,7 +2293,7 @@ __glXSwapBuffers(__GLXclientState * cl, GLbyte * pc)
     }
 
     if (!pDraw) {
-        dixLookupResourceByType((pointer *) &pGlxPixmap, drawId,
+        dixLookupResourceByType((void **) &pGlxPixmap, drawId,
                                 __glXPixmapRes, NullClient, DixUnknownAccess);
         if (pGlxPixmap) {
             /*
@@ -2274,7 +2304,7 @@ __glXSwapBuffers(__GLXclientState * cl, GLbyte * pc)
     }
 
     if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1, 3)) {
-        dixLookupResourceByType((pointer *) &pGlxWindow, drawId,
+        dixLookupResourceByType((void **) &pGlxWindow, drawId,
                                 __glXWindowRes, NullClient, DixUnknownAccess);
         if (pGlxWindow) {
             /*
@@ -2582,7 +2612,6 @@ __glXQueryExtensionsString(__GLXclientState * cl, GLbyte * pc)
     xGLXQueryExtensionsStringReply be_reply;
     DMXScreenInfo *dmxScreen;
     Display *dpy;
-    int slop;
 #endif
 
     screen = req->screen;
@@ -2605,19 +2634,16 @@ __glXQueryExtensionsString(__GLXclientState * cl, GLbyte * pc)
     be_req->reqType = dmxScreen->glxMajorOpcode;
     be_req->glxCode = X_GLXQueryServerString;
     be_req->screen = DefaultScreen(dpy);
-    _XReply(dpy, (xReply *) & be_reply, 0, False);
+    _XReply(dpy, (xReply *) &be_reply, 0, False);
     len = (int) be_reply.length;
     numbytes = (int) be_reply.n;
-    slop = numbytes * __GLX_SIZE_INT8 & 3;
     be_buf = (char *) malloc(numbytes);
     if (!be_buf) {
         /* Throw data on the floor */
-        _XEatData(dpy, len);
+        _XEatDataWords(dpy, len);
     }
     else {
-        _XRead(dpy, (char *) be_buf, numbytes);
-        if (slop)
-            _XEatData(dpy, 4 - slop);
+        _XReadPad(dpy, (char *) be_buf, numbytes);
     }
     UnlockDisplay(dpy);
     SyncHandle();
@@ -2666,7 +2692,6 @@ __glXQueryServerString(__GLXclientState * cl, GLbyte * pc)
     xGLXQueryServerStringReply be_reply;
     DMXScreenInfo *dmxScreen;
     Display *dpy;
-    int slop;
 #endif
 
     name = req->name;
@@ -2690,19 +2715,16 @@ __glXQueryServerString(__GLXclientState * cl, GLbyte * pc)
     be_req->glxCode = X_GLXQueryServerString;
     be_req->screen = DefaultScreen(dpy);
     be_req->name = name;
-    _XReply(dpy, (xReply *) & be_reply, 0, False);
+    _XReply(dpy, (xReply *) &be_reply, 0, False);
     len = (int) be_reply.length;
     numbytes = (int) be_reply.n;
-    slop = numbytes * __GLX_SIZE_INT8 & 3;
     be_buf = (char *) malloc(numbytes);
     if (!be_buf) {
         /* Throw data on the floor */
-        _XEatData(dpy, len);
+        _XEatDataWords(dpy, len);
     }
     else {
-        _XRead(dpy, (char *) be_buf, numbytes);
-        if (slop)
-            _XEatData(dpy, 4 - slop);
+        _XReadPad(dpy, (char *) be_buf, numbytes);
     }
     UnlockDisplay(dpy);
     SyncHandle();
@@ -2742,8 +2764,6 @@ __glXClientInfo(__GLXclientState * cl, GLbyte * pc)
     int to_screen = 0;
     int s;
 
-    cl->GLClientmajorVersion = req->major;
-    cl->GLClientminorVersion = req->minor;
     free(cl->GLClientextensions);
     buf = (const char *) (req + 1);
     cl->GLClientextensions = strdup(buf);
@@ -2799,12 +2819,12 @@ __glXUseXFont(__GLXclientState * cl, GLbyte * pc)
      ** Font can actually be either the ID of a font or the ID of a GC
      ** containing a font.
      */
-    dixLookupResourceByType((pointer *) &pFont, req->font, RT_FONT,
+    dixLookupResourceByType((void **) &pFont, req->font, RT_FONT,
                             NullClient, DixUnknownAccess);
     if (!pFont) {
         GC *pGC;
 
-        dixLookupResourceByType((pointer *) &pGC, req->font,
+        dixLookupResourceByType((void **) &pGC, req->font,
                                 RT_GC, NullClient, DixUnknownAccess);
         if (!pGC) {
             client->errorValue = req->font;
@@ -3045,7 +3065,7 @@ __glXGetFBConfigsSGIX(__GLXclientState * cl, GLbyte * pc)
     new_req.length = req->length;
     new_req.screen = req->screen;
 
-    return (__glXGetFBConfigs(cl, (GLbyte *) & new_req));
+    return (__glXGetFBConfigs(cl, (GLbyte *) &new_req));
 }
 
 int
@@ -3064,7 +3084,7 @@ __glXCreateWindow(__GLXclientState * cl, GLbyte * pc)
     VisualPtr pVisual;
     VisualID visId;
     int i, rc;
-    pointer val;
+    void *val;
 
     /*
      ** Check if windowId is valid 
@@ -3166,7 +3186,7 @@ __glXDestroyWindow(__GLXclientState * cl, GLbyte * pc)
     ClientPtr client = cl->client;
     xGLXDestroyWindowReq *req = (xGLXDestroyWindowReq *) pc;
     XID glxwindow = req->glxwindow;
-    pointer val;
+    void *val;
 
     /*
      ** Check if it's a valid GLX window.
@@ -3198,7 +3218,7 @@ __glXQueryContext(__GLXclientState * cl, GLbyte * pc)
     int nReplyBytes;
 
     req = (xGLXQueryContextReq *) pc;
-    dixLookupResourceByType((pointer *) &ctx, req->context, __glXContextRes,
+    dixLookupResourceByType((void **) &ctx, req->context, __glXContextRes,
                             NullClient, DixUnknownAccess);
     if (!ctx) {
         client->errorValue = req->context;
@@ -3220,7 +3240,7 @@ __glXQueryContext(__GLXclientState * cl, GLbyte * pc)
     *pSendBuf++ = GLX_FBCONFIG_ID;
     *pSendBuf++ = (int) (ctx->pFBConfig->id);
     *pSendBuf++ = GLX_RENDER_TYPE;
-    *pSendBuf++ = (int) (ctx->pFBConfig->renderType);
+    *pSendBuf++ = renderTypeBitsToRenderTypeEnum(ctx->pFBConfig->renderType);
     *pSendBuf++ = GLX_SCREEN;
     *pSendBuf++ = (int) (ctx->pScreen->myNum);
 
@@ -3248,7 +3268,7 @@ __glXQueryContextInfoEXT(__GLXclientState * cl, GLbyte * pc)
     int nReplyBytes;
 
     req = (xGLXQueryContextInfoEXTReq *) pc;
-    dixLookupResourceByType((pointer *) &ctx,
+    dixLookupResourceByType((void **) &ctx,
                             req->context, __glXContextRes,
                             client, DixReadAccess);
 
@@ -3421,7 +3441,7 @@ __glXDestroyPbuffer(__GLXclientState * cl, GLbyte * pc)
     /*
      ** Check if it's a valid Pbuffer
      */
-    dixLookupResourceByType((pointer *) &pGlxPbuffer, pbuffer,
+    dixLookupResourceByType((void **) &pGlxPbuffer, pbuffer,
                             __glXPbufferRes, NullClient, DixUnknownAccess);
     if (!pGlxPbuffer) {
         client->errorValue = pbuffer;
@@ -3496,7 +3516,7 @@ __glXGetDrawableAttributes(__GLXclientState * cl, GLbyte * pc)
         if (!pDraw) {
             __GLXpixmap *pGlxPixmap;
 
-            dixLookupResourceByType((pointer *) &pGlxPixmap,
+            dixLookupResourceByType((void **) &pGlxPixmap,
                                     drawId, __glXPixmapRes,
                                     NullClient, DixUnknownAccess);
             if (pGlxPixmap) {
@@ -3509,7 +3529,7 @@ __glXGetDrawableAttributes(__GLXclientState * cl, GLbyte * pc)
         if (!pDraw) {
             __glXWindow *pGlxWindow;
 
-            dixLookupResourceByType((pointer *) &pGlxWindow,
+            dixLookupResourceByType((void **) &pGlxWindow,
                                     drawId, __glXWindowRes,
                                     NullClient, DixUnknownAccess);
             if (pGlxWindow) {
@@ -3522,7 +3542,7 @@ __glXGetDrawableAttributes(__GLXclientState * cl, GLbyte * pc)
         if (!pDraw) {
             __glXPbuffer *pGlxPbuffer;
 
-            dixLookupResourceByType((pointer *) &pGlxPbuffer,
+            dixLookupResourceByType((void **) &pGlxPbuffer,
                                     drawId, __glXPbufferRes,
                                     NullClient, DixUnknownAccess);
             if (pGlxPbuffer) {
@@ -3549,7 +3569,7 @@ __glXGetDrawableAttributes(__GLXclientState * cl, GLbyte * pc)
 
 #ifdef PANORAMIX
         if (!noPanoramiXExtension) {
-            if (Success != dixLookupResourceByClass((pointer *) &pXinDraw,
+            if (Success != dixLookupResourceByClass((void **) &pXinDraw,
                                                     pDraw->id, XRC_DRAWABLE,
                                                     client, DixReadAccess)) {
                 client->errorValue = drawId;
@@ -3591,7 +3611,7 @@ __glXGetDrawableAttributes(__GLXclientState * cl, GLbyte * pc)
     be_req->glxCode = X_GLXGetDrawableAttributes;
     be_req->drawable = be_drawable;
     be_req->length = req->length;
-    if (!_XReply(dpy, (xReply *) & reply, 0, False)) {
+    if (!_XReply(dpy, (xReply *) &reply, 0, False)) {
         UnlockDisplay(dpy);
         SyncHandle();
         return (BE_TO_CLIENT_ERROR(dmxLastErrorEvent.error_code));
@@ -3658,7 +3678,7 @@ __glXChangeDrawableAttributes(__GLXclientState * cl, GLbyte * pc)
         if (!pDraw) {
             __GLXpixmap *pGlxPixmap;
 
-            dixLookupResourceByType((pointer *) &pGlxPixmap,
+            dixLookupResourceByType((void **) &pGlxPixmap,
                                     drawId, __glXPixmapRes,
                                     NullClient, DixUnknownAccess);
             if (pGlxPixmap) {
@@ -3671,7 +3691,7 @@ __glXChangeDrawableAttributes(__GLXclientState * cl, GLbyte * pc)
         if (!pDraw) {
             __glXWindow *pGlxWindow;
 
-            dixLookupResourceByType((pointer *) &pGlxWindow,
+            dixLookupResourceByType((void **) &pGlxWindow,
                                     drawId, __glXWindowRes,
                                     NullClient, DixUnknownAccess);
             if (pGlxWindow) {
@@ -3684,7 +3704,7 @@ __glXChangeDrawableAttributes(__GLXclientState * cl, GLbyte * pc)
         if (!pDraw) {
             __glXPbuffer *pGlxPbuffer;
 
-            dixLookupResourceByType((pointer *) &pGlxPbuffer,
+            dixLookupResourceByType((void **) &pGlxPbuffer,
                                     drawId, __glXPbufferRes,
                                     NullClient, DixUnknownAccess);
             if (pGlxPbuffer) {
@@ -3713,7 +3733,7 @@ __glXChangeDrawableAttributes(__GLXclientState * cl, GLbyte * pc)
         if (!noPanoramiXExtension) {
             PanoramiXRes *pXinDraw;
 
-            if (Success != dixLookupResourceByClass((pointer *) &pXinDraw,
+            if (Success != dixLookupResourceByClass((void **) &pXinDraw,
                                                     pDraw->id, XRC_DRAWABLE,
                                                     client, DixReadAccess)) {
                 client->errorValue = drawId;
index ac79cda..ab3e7ed 100644 (file)
@@ -1051,7 +1051,7 @@ __glXSwapGetFBConfigsSGIX(__GLXclientState * cl, GLbyte * pc)
     new_req.length = req->length;
     new_req.screen = req->screen;
 
-    return (__glXSwapGetFBConfigs(cl, (GLbyte *) & new_req));
+    return (__glXSwapGetFBConfigs(cl, (GLbyte *) &new_req));
 }
 
 int
index e72a040..3c5a14b 100644 (file)
@@ -88,12 +88,6 @@ ResetClientState(int clientIndex)
     memset(cl, 0, sizeof(__GLXclientState));
     cl->be_displays = keep_be_displays;
 
-    /*
-     ** By default, assume that the client supports
-     ** GLX major version 1 minor version 0 protocol.
-     */
-    cl->GLClientmajorVersion = 1;
-    cl->GLClientminorVersion = 0;
     free(cl->GLClientextensions);
 
     memset(cl->be_displays, 0, screenInfo.numScreens * sizeof(Display *));
@@ -188,7 +182,7 @@ __glXFreeGLXWindow(__glXWindow * pGlxWindow)
         WindowPtr pWindow = (WindowPtr) pGlxWindow->pDraw;
         WindowPtr ret;
 
-        dixLookupResourceByType((pointer) &ret,
+        dixLookupResourceByType((void *) &ret,
                                 pWindow->drawable.id, RT_WINDOW,
                                 NullClient, DixUnknownAccess);
         if (ret == pWindow) {
@@ -420,7 +414,7 @@ __glXDispatch(ClientPtr client)
          */
         XID xid = FakeClientID(client->index);
 
-        if (!AddResource(xid, __glXClientRes, (pointer) (long) client->index)) {
+        if (!AddResource(xid, __glXClientRes, (void *) (long) client->index)) {
             return BadAlloc;
         }
         ResetClientState(client->index);
@@ -474,7 +468,7 @@ __glXSwapDispatch(ClientPtr client)
          */
         XID xid = FakeClientID(client->index);
 
-        if (!AddResource(xid, __glXClientRes, (pointer) (long) client->index)) {
+        if (!AddResource(xid, __glXClientRes, (void *) (long) client->index)) {
             return BadAlloc;
         }
         ResetClientState(client->index);
index f725bd1..138afed 100644 (file)
@@ -88,7 +88,7 @@ CalcServerVersionAndExtensions(void)
         req->glxCode = X_GLXQueryVersion;
         req->majorVersion = GLX_SERVER_MAJOR_VERSION;
         req->minorVersion = GLX_SERVER_MINOR_VERSION;
-        _XReply(dpy, (xReply *) & reply, 0, False);
+        _XReply(dpy, (xReply *) &reply, 0, False);
         UnlockDisplay(dpy);
         SyncHandle();
 
@@ -138,7 +138,7 @@ CalcServerVersionAndExtensions(void)
         Display *dpy = dmxScreen->beDisplay;
         xGLXQueryServerStringReq *req;
         xGLXQueryServerStringReply reply;
-        int length, numbytes, slop;
+        int length, numbytes;
 
         /* Send the glXQueryServerString request */
         LockDisplay(dpy);
@@ -147,20 +147,17 @@ CalcServerVersionAndExtensions(void)
         req->glxCode = X_GLXQueryServerString;
         req->screen = DefaultScreen(dpy);
         req->name = GLX_EXTENSIONS;
-        _XReply(dpy, (xReply *) & reply, 0, False);
+        _XReply(dpy, (xReply *) &reply, 0, False);
 
         length = (int) reply.length;
         numbytes = (int) reply.n;
-        slop = numbytes * __GLX_SIZE_INT8 & 3;
         be_extensions[s] = (char *) malloc(numbytes);
         if (!be_extensions[s]) {
             /* Throw data on the floor */
-            _XEatData(dpy, length);
+            _XEatDataWords(dpy, length);
         }
         else {
-            _XRead(dpy, (char *) be_extensions[s], numbytes);
-            if (slop)
-                _XEatData(dpy, 4 - slop);
+            _XReadPad(dpy, (char *) be_extensions[s], numbytes);
         }
         UnlockDisplay(dpy);
         SyncHandle();
index ad94966..754ad30 100644 (file)
@@ -119,8 +119,6 @@ struct __GLXclientStateRec {
     /* Back pointer to X client record */
     ClientPtr client;
 
-    int GLClientmajorVersion;
-    int GLClientminorVersion;
     char *GLClientextensions;
 
     GLXContextTag *be_currentCTag;
index 8784200..679a302 100644 (file)
@@ -249,7 +249,7 @@ __glXForwardPipe0WithReply(__GLXclientState * cl, GLbyte * pc)
     /*
      * get the reply from the back-end server
      */
-    _XReply(dpy, (xReply *) & be_reply, 0, False);
+    _XReply(dpy, (xReply *) &be_reply, 0, False);
     be_buf_size = be_reply.length << 2;
     if (be_buf_size > 0) {
         be_buf = (char *) malloc(be_buf_size);
@@ -258,7 +258,7 @@ __glXForwardPipe0WithReply(__GLXclientState * cl, GLbyte * pc)
         }
         else {
             /* Throw data on the floor */
-            _XEatData(dpy, be_buf_size);
+            _XEatDataWords(dpy, be_reply.length);
             return BadAlloc;
         }
     }
@@ -348,26 +348,30 @@ __glXForwardAllWithReply(__GLXclientState * cl, GLbyte * pc)
         /*
          * get the reply from the back-end server
          */
-        _XReply(dpy, (xReply *) & be_reply, 0, False);
-        be_buf_size = be_reply.length << 2;
-        if (be_buf_size > 0) {
-            be_buf = (char *) malloc(be_buf_size);
-            if (be_buf) {
-                _XRead(dpy, be_buf, be_buf_size);
-            }
-            else {
-                /* Throw data on the floor */
-                _XEatData(dpy, be_buf_size);
-                return BadAlloc;
+        _XReply(dpy, (xReply *) &be_reply, 0, False);
+        if (s == from_screen) {
+            /* Save data from last reply to send on to client */
+            be_buf_size = be_reply.length << 2;
+            if (be_buf_size > 0) {
+                be_buf = malloc(be_buf_size);
+                if (be_buf) {
+                    _XRead(dpy, be_buf, be_buf_size);
+                }
+                else {
+                    /* Throw data on the floor */
+                    _XEatDataWords(dpy, be_reply.length);
+                    return BadAlloc;
+                }
             }
         }
+        else {
+            /* Just discard data from all replies before the last one */
+            if (be_reply.length > 0)
+                _XEatDataWords(dpy, be_reply.length);
+        }
 
         UnlockDisplay(dpy);
         SyncHandle();
-
-        if (s > from_screen && be_buf_size > 0) {
-            free(be_buf);
-        }
     }
 
     /*
@@ -919,7 +923,7 @@ __glXDisp_ReadPixels(__GLXclientState * cl, GLbyte * pc)
                 *(GLboolean *) (be_pc + 24) = swapBytes;
                 *(GLboolean *) (be_pc + 25) = lsbFirst;
 
-                _XReply(dpy, (xReply *) & be_reply, 0, False);
+                _XReply(dpy, (xReply *) &be_reply, 0, False);
 
                 if (be_reply.length > 0) {
                     char *be_buf;
@@ -993,7 +997,7 @@ __glXDisp_ReadPixels(__GLXclientState * cl, GLbyte * pc)
                     }
                     else {
                         /* Throw data on the floor */
-                        _XEatData(dpy, be_buf_size);
+                        _XEatDataWords(dpy, be_reply.length);
                         free(buf);
                         return BadAlloc;
                     }
index 87a7486..5f56501 100644 (file)
@@ -110,7 +110,7 @@ SwapGroupIsReadyToSwap(SwapGroupPtr pSwap)
 }
 
 static Bool
-SGSwapCleanup(ClientPtr client, pointer closure)
+SGSwapCleanup(ClientPtr client, void *closure)
 {
     /* SwapGroupPtr  pSwap = (SwapGroupPtr)closure; */
 
@@ -154,7 +154,7 @@ SGSwapBuffers(__GLXclientState * cl, XID drawId, GLXContextTag tag,
     else {
         /* The swap group/barrier is not yet ready to swap, so put
          * client to sleep until the rest are ready to swap */
-        ClientSleep(cl->client, SGSwapCleanup, (pointer) pWin);
+        ClientSleep(cl->client, SGSwapCleanup, (void *) pWin);
         pCur->sleeping = TRUE;
     }
 
diff --git a/hw/dmx/glxProxy/glxutil.c b/hw/dmx/glxProxy/glxutil.c
deleted file mode 100644 (file)
index f90dbf1..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
- * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * 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 including the dates of first publication and
- * either this permission notice or a reference to
- * http://oss.sgi.com/projects/FreeB/
- * 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
- * SILICON GRAPHICS, INC. 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.
- *
- * Except as contained in this notice, the name of Silicon Graphics, Inc.
- * shall not be used in advertising or otherwise to promote the sale, use or
- * other dealings in this Software without prior written authorization from
- * Silicon Graphics, Inc.
- */
-
-#include "glxserver.h"
-#include "glxutil.h"
-
-void
-__glXNop(void)
-{
-}
index d3c7286..605c07b 100644 (file)
@@ -31,8 +31,6 @@
  * Silicon Graphics, Inc.
  */
 
-extern void __glXNop(void);
-
 /* context helper routines */
 extern __GLXcontext *__glXLookupContextByTag(__GLXclientState *, GLXContextTag);
 extern DrawablePtr __glXLookupDrawableByTag(__GLXclientState * cl,
index e5c8da1..b475daf 100644 (file)
@@ -237,7 +237,7 @@ __glXVForwardPipe0WithReply(__GLXclientState * cl, GLbyte * pc)
     /*
      * get the reply from the back-end server
      */
-    _XReply(dpy, (xReply *) & be_reply, 0, False);
+    _XReply(dpy, (xReply *) &be_reply, 0, False);
     be_buf_size = be_reply.length << 2;
     if (be_buf_size > 0) {
         be_buf = (char *) malloc(be_buf_size);
@@ -246,7 +246,7 @@ __glXVForwardPipe0WithReply(__GLXclientState * cl, GLbyte * pc)
         }
         else {
             /* Throw data on the floor */
-            _XEatData(dpy, be_buf_size);
+            _XEatDataWords(dpy, be_reply.length);
             return BadAlloc;
         }
     }
@@ -331,26 +331,30 @@ __glXVForwardAllWithReply(__GLXclientState * cl, GLbyte * pc)
         /*
          * get the reply from the back-end server
          */
-        _XReply(dpy, (xReply *) & be_reply, 0, False);
-        be_buf_size = be_reply.length << 2;
-        if (be_buf_size > 0) {
-            be_buf = (char *) malloc(be_buf_size);
-            if (be_buf) {
-                _XRead(dpy, be_buf, be_buf_size);
-            }
-            else {
-                /* Throw data on the floor */
-                _XEatData(dpy, be_buf_size);
-                return BadAlloc;
+        _XReply(dpy, (xReply *) &be_reply, 0, False);
+        if (s == from_screen) {
+            /* Save data from last reply to send on to client */
+            be_buf_size = be_reply.length << 2;
+            if (be_buf_size > 0) {
+                be_buf = malloc(be_buf_size);
+                if (be_buf) {
+                    _XRead(dpy, be_buf, be_buf_size);
+                }
+                else {
+                    /* Throw data on the floor */
+                    _XEatDataWords(dpy, be_reply.length);
+                    return BadAlloc;
+                }
             }
         }
+        else {
+            /* Just discard data from all replies before the last one */
+            if (be_reply.length > 0)
+                _XEatDataWords(dpy, be_reply.length);
+        }
 
         UnlockDisplay(dpy);
         SyncHandle();
-
-        if (s > from_screen && be_buf_size > 0) {
-            free(be_buf);
-        }
     }
 
     /*
index 3458e61..32df0d5 100644 (file)
@@ -39,10 +39,10 @@ __glXDispSwap_PolygonStipple(GLbyte * pc)
 
     __GLX_DECLARE_SWAP_VARIABLES;
 
-    __GLX_SWAP_INT((GLbyte *) & hdr->rowLength);
-    __GLX_SWAP_INT((GLbyte *) & hdr->skipRows);
-    __GLX_SWAP_INT((GLbyte *) & hdr->skipPixels);
-    __GLX_SWAP_INT((GLbyte *) & hdr->alignment);
+    __GLX_SWAP_INT((GLbyte *) &hdr->rowLength);
+    __GLX_SWAP_INT((GLbyte *) &hdr->skipRows);
+    __GLX_SWAP_INT((GLbyte *) &hdr->skipPixels);
+    __GLX_SWAP_INT((GLbyte *) &hdr->alignment);
 
     hdr->swapBytes = !hdr->swapBytes;
 }
@@ -54,17 +54,17 @@ __glXDispSwap_Bitmap(GLbyte * pc)
 
     __GLX_DECLARE_SWAP_VARIABLES;
 
-    __GLX_SWAP_INT((GLbyte *) & hdr->rowLength);
-    __GLX_SWAP_INT((GLbyte *) & hdr->skipRows);
-    __GLX_SWAP_INT((GLbyte *) & hdr->skipPixels);
-    __GLX_SWAP_INT((GLbyte *) & hdr->alignment);
+    __GLX_SWAP_INT((GLbyte *) &hdr->rowLength);
+    __GLX_SWAP_INT((GLbyte *) &hdr->skipRows);
+    __GLX_SWAP_INT((GLbyte *) &hdr->skipPixels);
+    __GLX_SWAP_INT((GLbyte *) &hdr->alignment);
 
-    __GLX_SWAP_INT((GLbyte *) & hdr->width);
-    __GLX_SWAP_INT((GLbyte *) & hdr->height);
-    __GLX_SWAP_FLOAT((GLbyte *) & hdr->xorig);
-    __GLX_SWAP_FLOAT((GLbyte *) & hdr->yorig);
-    __GLX_SWAP_FLOAT((GLbyte *) & hdr->xmove);
-    __GLX_SWAP_FLOAT((GLbyte *) & hdr->ymove);
+    __GLX_SWAP_INT((GLbyte *) &hdr->width);
+    __GLX_SWAP_INT((GLbyte *) &hdr->height);
+    __GLX_SWAP_FLOAT((GLbyte *) &hdr->xorig);
+    __GLX_SWAP_FLOAT((GLbyte *) &hdr->yorig);
+    __GLX_SWAP_FLOAT((GLbyte *) &hdr->xmove);
+    __GLX_SWAP_FLOAT((GLbyte *) &hdr->ymove);
 
     hdr->swapBytes = !hdr->swapBytes;
 
@@ -77,19 +77,19 @@ __glXDispSwap_TexImage1D(GLbyte * pc)
 
     __GLX_DECLARE_SWAP_VARIABLES;
 
-    __GLX_SWAP_INT((GLbyte *) & hdr->rowLength);
-    __GLX_SWAP_INT((GLbyte *) & hdr->skipRows);
-    __GLX_SWAP_INT((GLbyte *) & hdr->skipPixels);
-    __GLX_SWAP_INT((GLbyte *) & hdr->alignment);
+    __GLX_SWAP_INT((GLbyte *) &hdr->rowLength);
+    __GLX_SWAP_INT((GLbyte *) &hdr->skipRows);
+    __GLX_SWAP_INT((GLbyte *) &hdr->skipPixels);
+    __GLX_SWAP_INT((GLbyte *) &hdr->alignment);
 
-    __GLX_SWAP_INT((GLbyte *) & hdr->target);
-    __GLX_SWAP_INT((GLbyte *) & hdr->level);
-    __GLX_SWAP_INT((GLbyte *) & hdr->components);
-    __GLX_SWAP_INT((GLbyte *) & hdr->width);
-    __GLX_SWAP_INT((GLbyte *) & hdr->height);
-    __GLX_SWAP_INT((GLbyte *) & hdr->border);
-    __GLX_SWAP_INT((GLbyte *) & hdr->format);
-    __GLX_SWAP_INT((GLbyte *) & hdr->type);
+    __GLX_SWAP_INT((GLbyte *) &hdr->target);
+    __GLX_SWAP_INT((GLbyte *) &hdr->level);
+    __GLX_SWAP_INT((GLbyte *) &hdr->components);
+    __GLX_SWAP_INT((GLbyte *) &hdr->width);
+    __GLX_SWAP_INT((GLbyte *) &hdr->height);
+    __GLX_SWAP_INT((GLbyte *) &hdr->border);
+    __GLX_SWAP_INT((GLbyte *) &hdr->format);
+    __GLX_SWAP_INT((GLbyte *) &hdr->type);
 
     /*
      ** Just invert swapBytes flag; the GL will figure out if it needs to swap
@@ -105,19 +105,19 @@ __glXDispSwap_TexImage2D(GLbyte * pc)
 
     __GLX_DECLARE_SWAP_VARIABLES;
 
-    __GLX_SWAP_INT((GLbyte *) & hdr->rowLength);
-    __GLX_SWAP_INT((GLbyte *) & hdr->skipRows);
-    __GLX_SWAP_INT((GLbyte *) & hdr->skipPixels);
-    __GLX_SWAP_INT((GLbyte *) & hdr->alignment);
+    __GLX_SWAP_INT((GLbyte *) &hdr->rowLength);
+    __GLX_SWAP_INT((GLbyte *) &hdr->skipRows);
+    __GLX_SWAP_INT((GLbyte *) &hdr->skipPixels);
+    __GLX_SWAP_INT((GLbyte *) &hdr->alignment);
 
-    __GLX_SWAP_INT((GLbyte *) & hdr->target);
-    __GLX_SWAP_INT((GLbyte *) & hdr->level);
-    __GLX_SWAP_INT((GLbyte *) & hdr->components);
-    __GLX_SWAP_INT((GLbyte *) & hdr->width);
-    __GLX_SWAP_INT((GLbyte *) & hdr->height);
-    __GLX_SWAP_INT((GLbyte *) & hdr->border);
-    __GLX_SWAP_INT((GLbyte *) & hdr->format);
-    __GLX_SWAP_INT((GLbyte *) & hdr->type);
+    __GLX_SWAP_INT((GLbyte *) &hdr->target);
+    __GLX_SWAP_INT((GLbyte *) &hdr->level);
+    __GLX_SWAP_INT((GLbyte *) &hdr->components);
+    __GLX_SWAP_INT((GLbyte *) &hdr->width);
+    __GLX_SWAP_INT((GLbyte *) &hdr->height);
+    __GLX_SWAP_INT((GLbyte *) &hdr->border);
+    __GLX_SWAP_INT((GLbyte *) &hdr->format);
+    __GLX_SWAP_INT((GLbyte *) &hdr->type);
 
     /*
      ** Just invert swapBytes flag; the GL will figure out if it needs to swap
@@ -133,25 +133,25 @@ __glXDispSwap_TexImage3D(GLbyte * pc)
 
     __GLX_DECLARE_SWAP_VARIABLES;
 
-    __GLX_SWAP_INT((GLbyte *) & hdr->rowLength);
-    __GLX_SWAP_INT((GLbyte *) & hdr->imageHeight);
-    __GLX_SWAP_INT((GLbyte *) & hdr->imageDepth);
-    __GLX_SWAP_INT((GLbyte *) & hdr->skipRows);
-    __GLX_SWAP_INT((GLbyte *) & hdr->skipImages);
-    __GLX_SWAP_INT((GLbyte *) & hdr->skipVolumes);
-    __GLX_SWAP_INT((GLbyte *) & hdr->skipPixels);
-    __GLX_SWAP_INT((GLbyte *) & hdr->alignment);
-
-    __GLX_SWAP_INT((GLbyte *) & hdr->target);
-    __GLX_SWAP_INT((GLbyte *) & hdr->level);
-    __GLX_SWAP_INT((GLbyte *) & hdr->internalformat);
-    __GLX_SWAP_INT((GLbyte *) & hdr->width);
-    __GLX_SWAP_INT((GLbyte *) & hdr->height);
-    __GLX_SWAP_INT((GLbyte *) & hdr->depth);
-    __GLX_SWAP_INT((GLbyte *) & hdr->size4d);
-    __GLX_SWAP_INT((GLbyte *) & hdr->border);
-    __GLX_SWAP_INT((GLbyte *) & hdr->format);
-    __GLX_SWAP_INT((GLbyte *) & hdr->type);
+    __GLX_SWAP_INT((GLbyte *) &hdr->rowLength);
+    __GLX_SWAP_INT((GLbyte *) &hdr->imageHeight);
+    __GLX_SWAP_INT((GLbyte *) &hdr->imageDepth);
+    __GLX_SWAP_INT((GLbyte *) &hdr->skipRows);
+    __GLX_SWAP_INT((GLbyte *) &hdr->skipImages);
+    __GLX_SWAP_INT((GLbyte *) &hdr->skipVolumes);
+    __GLX_SWAP_INT((GLbyte *) &hdr->skipPixels);
+    __GLX_SWAP_INT((GLbyte *) &hdr->alignment);
+
+    __GLX_SWAP_INT((GLbyte *) &hdr->target);
+    __GLX_SWAP_INT((GLbyte *) &hdr->level);
+    __GLX_SWAP_INT((GLbyte *) &hdr->internalformat);
+    __GLX_SWAP_INT((GLbyte *) &hdr->width);
+    __GLX_SWAP_INT((GLbyte *) &hdr->height);
+    __GLX_SWAP_INT((GLbyte *) &hdr->depth);
+    __GLX_SWAP_INT((GLbyte *) &hdr->size4d);
+    __GLX_SWAP_INT((GLbyte *) &hdr->border);
+    __GLX_SWAP_INT((GLbyte *) &hdr->format);
+    __GLX_SWAP_INT((GLbyte *) &hdr->type);
 
     /*
      ** Just invert swapBytes flag; the GL will figure out if it needs to swap
@@ -167,15 +167,15 @@ __glXDispSwap_DrawPixels(GLbyte * pc)
 
     __GLX_DECLARE_SWAP_VARIABLES;
 
-    __GLX_SWAP_INT((GLbyte *) & hdr->rowLength);
-    __GLX_SWAP_INT((GLbyte *) & hdr->skipRows);
-    __GLX_SWAP_INT((GLbyte *) & hdr->skipPixels);
-    __GLX_SWAP_INT((GLbyte *) & hdr->alignment);
+    __GLX_SWAP_INT((GLbyte *) &hdr->rowLength);
+    __GLX_SWAP_INT((GLbyte *) &hdr->skipRows);
+    __GLX_SWAP_INT((GLbyte *) &hdr->skipPixels);
+    __GLX_SWAP_INT((GLbyte *) &hdr->alignment);
 
-    __GLX_SWAP_INT((GLbyte *) & hdr->width);
-    __GLX_SWAP_INT((GLbyte *) & hdr->height);
-    __GLX_SWAP_INT((GLbyte *) & hdr->format);
-    __GLX_SWAP_INT((GLbyte *) & hdr->type);
+    __GLX_SWAP_INT((GLbyte *) &hdr->width);
+    __GLX_SWAP_INT((GLbyte *) &hdr->height);
+    __GLX_SWAP_INT((GLbyte *) &hdr->format);
+    __GLX_SWAP_INT((GLbyte *) &hdr->type);
 
     /*
      ** Just invert swapBytes flag; the GL will figure out if it needs to swap
@@ -191,17 +191,17 @@ __glXDispSwap_TexSubImage1D(GLbyte * pc)
 
     __GLX_DECLARE_SWAP_VARIABLES;
 
-    __GLX_SWAP_INT((GLbyte *) & hdr->rowLength);
-    __GLX_SWAP_INT((GLbyte *) & hdr->skipRows);
-    __GLX_SWAP_INT((GLbyte *) & hdr->skipPixels);
-    __GLX_SWAP_INT((GLbyte *) & hdr->alignment);
+    __GLX_SWAP_INT((GLbyte *) &hdr->rowLength);
+    __GLX_SWAP_INT((GLbyte *) &hdr->skipRows);
+    __GLX_SWAP_INT((GLbyte *) &hdr->skipPixels);
+    __GLX_SWAP_INT((GLbyte *) &hdr->alignment);
 
-    __GLX_SWAP_INT((GLbyte *) & hdr->target);
-    __GLX_SWAP_INT((GLbyte *) & hdr->level);
-    __GLX_SWAP_INT((GLbyte *) & hdr->xoffset);
-    __GLX_SWAP_INT((GLbyte *) & hdr->width);
-    __GLX_SWAP_INT((GLbyte *) & hdr->format);
-    __GLX_SWAP_INT((GLbyte *) & hdr->type);
+    __GLX_SWAP_INT((GLbyte *) &hdr->target);
+    __GLX_SWAP_INT((GLbyte *) &hdr->level);
+    __GLX_SWAP_INT((GLbyte *) &hdr->xoffset);
+    __GLX_SWAP_INT((GLbyte *) &hdr->width);
+    __GLX_SWAP_INT((GLbyte *) &hdr->format);
+    __GLX_SWAP_INT((GLbyte *) &hdr->type);
 
     /*
      ** Just invert swapBytes flag; the GL will figure out if it needs to swap
@@ -217,19 +217,19 @@ __glXDispSwap_TexSubImage2D(GLbyte * pc)
 
     __GLX_DECLARE_SWAP_VARIABLES;
 
-    __GLX_SWAP_INT((GLbyte *) & hdr->rowLength);
-    __GLX_SWAP_INT((GLbyte *) & hdr->skipRows);
-    __GLX_SWAP_INT((GLbyte *) & hdr->skipPixels);
-    __GLX_SWAP_INT((GLbyte *) & hdr->alignment);
+    __GLX_SWAP_INT((GLbyte *) &hdr->rowLength);
+    __GLX_SWAP_INT((GLbyte *) &hdr->skipRows);
+    __GLX_SWAP_INT((GLbyte *) &hdr->skipPixels);
+    __GLX_SWAP_INT((GLbyte *) &hdr->alignment);
 
-    __GLX_SWAP_INT((GLbyte *) & hdr->target);
-    __GLX_SWAP_INT((GLbyte *) & hdr->level);
-    __GLX_SWAP_INT((GLbyte *) & hdr->xoffset);
-    __GLX_SWAP_INT((GLbyte *) & hdr->yoffset);
-    __GLX_SWAP_INT((GLbyte *) & hdr->width);
-    __GLX_SWAP_INT((GLbyte *) & hdr->height);
-    __GLX_SWAP_INT((GLbyte *) & hdr->format);
-    __GLX_SWAP_INT((GLbyte *) & hdr->type);
+    __GLX_SWAP_INT((GLbyte *) &hdr->target);
+    __GLX_SWAP_INT((GLbyte *) &hdr->level);
+    __GLX_SWAP_INT((GLbyte *) &hdr->xoffset);
+    __GLX_SWAP_INT((GLbyte *) &hdr->yoffset);
+    __GLX_SWAP_INT((GLbyte *) &hdr->width);
+    __GLX_SWAP_INT((GLbyte *) &hdr->height);
+    __GLX_SWAP_INT((GLbyte *) &hdr->format);
+    __GLX_SWAP_INT((GLbyte *) &hdr->type);
 
     /*
      ** Just invert swapBytes flag; the GL will figure out if it needs to swap
@@ -246,26 +246,26 @@ __glXDispSwap_TexSubImage3D(GLbyte * pc)
 
     __GLX_DECLARE_SWAP_VARIABLES;
 
-    __GLX_SWAP_INT((GLbyte *) & hdr->rowLength);
-    __GLX_SWAP_INT((GLbyte *) & hdr->imageHeight);
-    __GLX_SWAP_INT((GLbyte *) & hdr->imageDepth);
-    __GLX_SWAP_INT((GLbyte *) & hdr->skipRows);
-    __GLX_SWAP_INT((GLbyte *) & hdr->skipImages);
-    __GLX_SWAP_INT((GLbyte *) & hdr->skipVolumes);
-    __GLX_SWAP_INT((GLbyte *) & hdr->skipPixels);
-    __GLX_SWAP_INT((GLbyte *) & hdr->alignment);
-
-    __GLX_SWAP_INT((GLbyte *) & hdr->target);
-    __GLX_SWAP_INT((GLbyte *) & hdr->level);
-    __GLX_SWAP_INT((GLbyte *) & hdr->xoffset);
-    __GLX_SWAP_INT((GLbyte *) & hdr->yoffset);
-    __GLX_SWAP_INT((GLbyte *) & hdr->zoffset);
-    __GLX_SWAP_INT((GLbyte *) & hdr->width);
-    __GLX_SWAP_INT((GLbyte *) & hdr->height);
-    __GLX_SWAP_INT((GLbyte *) & hdr->depth);
-    __GLX_SWAP_INT((GLbyte *) & hdr->size4d);
-    __GLX_SWAP_INT((GLbyte *) & hdr->format);
-    __GLX_SWAP_INT((GLbyte *) & hdr->type);
+    __GLX_SWAP_INT((GLbyte *) &hdr->rowLength);
+    __GLX_SWAP_INT((GLbyte *) &hdr->imageHeight);
+    __GLX_SWAP_INT((GLbyte *) &hdr->imageDepth);
+    __GLX_SWAP_INT((GLbyte *) &hdr->skipRows);
+    __GLX_SWAP_INT((GLbyte *) &hdr->skipImages);
+    __GLX_SWAP_INT((GLbyte *) &hdr->skipVolumes);
+    __GLX_SWAP_INT((GLbyte *) &hdr->skipPixels);
+    __GLX_SWAP_INT((GLbyte *) &hdr->alignment);
+
+    __GLX_SWAP_INT((GLbyte *) &hdr->target);
+    __GLX_SWAP_INT((GLbyte *) &hdr->level);
+    __GLX_SWAP_INT((GLbyte *) &hdr->xoffset);
+    __GLX_SWAP_INT((GLbyte *) &hdr->yoffset);
+    __GLX_SWAP_INT((GLbyte *) &hdr->zoffset);
+    __GLX_SWAP_INT((GLbyte *) &hdr->width);
+    __GLX_SWAP_INT((GLbyte *) &hdr->height);
+    __GLX_SWAP_INT((GLbyte *) &hdr->depth);
+    __GLX_SWAP_INT((GLbyte *) &hdr->size4d);
+    __GLX_SWAP_INT((GLbyte *) &hdr->format);
+    __GLX_SWAP_INT((GLbyte *) &hdr->type);
 
     /*
      ** Just invert swapBytes flag; the GL will figure out if it needs to swap
@@ -281,16 +281,16 @@ __glXDispSwap_ColorTable(GLbyte * pc)
 
     __GLX_DECLARE_SWAP_VARIABLES;
 
-    __GLX_SWAP_INT((GLbyte *) & hdr->rowLength);
-    __GLX_SWAP_INT((GLbyte *) & hdr->skipRows);
-    __GLX_SWAP_INT((GLbyte *) & hdr->skipPixels);
-    __GLX_SWAP_INT((GLbyte *) & hdr->alignment);
+    __GLX_SWAP_INT((GLbyte *) &hdr->rowLength);
+    __GLX_SWAP_INT((GLbyte *) &hdr->skipRows);
+    __GLX_SWAP_INT((GLbyte *) &hdr->skipPixels);
+    __GLX_SWAP_INT((GLbyte *) &hdr->alignment);
 
-    __GLX_SWAP_INT((GLbyte *) & hdr->target);
-    __GLX_SWAP_INT((GLbyte *) & hdr->internalformat);
-    __GLX_SWAP_INT((GLbyte *) & hdr->width);
-    __GLX_SWAP_INT((GLbyte *) & hdr->format);
-    __GLX_SWAP_INT((GLbyte *) & hdr->type);
+    __GLX_SWAP_INT((GLbyte *) &hdr->target);
+    __GLX_SWAP_INT((GLbyte *) &hdr->internalformat);
+    __GLX_SWAP_INT((GLbyte *) &hdr->width);
+    __GLX_SWAP_INT((GLbyte *) &hdr->format);
+    __GLX_SWAP_INT((GLbyte *) &hdr->type);
 
     /*
      ** Just invert swapBytes flag; the GL will figure out if it needs to swap
@@ -306,16 +306,16 @@ __glXDispSwap_ColorSubTable(GLbyte * pc)
         (__GLXdispatchColorSubTableHeader *) pc;
     __GLX_DECLARE_SWAP_VARIABLES;
 
-    __GLX_SWAP_INT((GLbyte *) & hdr->rowLength);
-    __GLX_SWAP_INT((GLbyte *) & hdr->skipRows);
-    __GLX_SWAP_INT((GLbyte *) & hdr->skipPixels);
-    __GLX_SWAP_INT((GLbyte *) & hdr->alignment);
+    __GLX_SWAP_INT((GLbyte *) &hdr->rowLength);
+    __GLX_SWAP_INT((GLbyte *) &hdr->skipRows);
+    __GLX_SWAP_INT((GLbyte *) &hdr->skipPixels);
+    __GLX_SWAP_INT((GLbyte *) &hdr->alignment);
 
-    __GLX_SWAP_INT((GLbyte *) & hdr->target);
-    __GLX_SWAP_INT((GLbyte *) & hdr->start);
-    __GLX_SWAP_INT((GLbyte *) & hdr->count);
-    __GLX_SWAP_INT((GLbyte *) & hdr->format);
-    __GLX_SWAP_INT((GLbyte *) & hdr->type);
+    __GLX_SWAP_INT((GLbyte *) &hdr->target);
+    __GLX_SWAP_INT((GLbyte *) &hdr->start);
+    __GLX_SWAP_INT((GLbyte *) &hdr->count);
+    __GLX_SWAP_INT((GLbyte *) &hdr->format);
+    __GLX_SWAP_INT((GLbyte *) &hdr->type);
 
     /*
      ** Just invert swapBytes flag; the GL will figure out if it needs to swap
@@ -331,16 +331,16 @@ __glXDispSwap_ConvolutionFilter1D(GLbyte * pc)
         (__GLXdispatchConvolutionFilterHeader *) pc;
     __GLX_DECLARE_SWAP_VARIABLES;
 
-    __GLX_SWAP_INT((GLbyte *) & hdr->rowLength);
-    __GLX_SWAP_INT((GLbyte *) & hdr->skipRows);
-    __GLX_SWAP_INT((GLbyte *) & hdr->skipPixels);
-    __GLX_SWAP_INT((GLbyte *) & hdr->alignment);
+    __GLX_SWAP_INT((GLbyte *) &hdr->rowLength);
+    __GLX_SWAP_INT((GLbyte *) &hdr->skipRows);
+    __GLX_SWAP_INT((GLbyte *) &hdr->skipPixels);
+    __GLX_SWAP_INT((GLbyte *) &hdr->alignment);
 
-    __GLX_SWAP_INT((GLbyte *) & hdr->target);
-    __GLX_SWAP_INT((GLbyte *) & hdr->internalformat);
-    __GLX_SWAP_INT((GLbyte *) & hdr->width);
-    __GLX_SWAP_INT((GLbyte *) & hdr->format);
-    __GLX_SWAP_INT((GLbyte *) & hdr->type);
+    __GLX_SWAP_INT((GLbyte *) &hdr->target);
+    __GLX_SWAP_INT((GLbyte *) &hdr->internalformat);
+    __GLX_SWAP_INT((GLbyte *) &hdr->width);
+    __GLX_SWAP_INT((GLbyte *) &hdr->format);
+    __GLX_SWAP_INT((GLbyte *) &hdr->type);
 
     /*
      ** Just invert swapBytes flag; the GL will figure out if it needs to swap
@@ -356,17 +356,17 @@ __glXDispSwap_ConvolutionFilter2D(GLbyte * pc)
         (__GLXdispatchConvolutionFilterHeader *) pc;
     __GLX_DECLARE_SWAP_VARIABLES;
 
-    __GLX_SWAP_INT((GLbyte *) & hdr->rowLength);
-    __GLX_SWAP_INT((GLbyte *) & hdr->skipRows);
-    __GLX_SWAP_INT((GLbyte *) & hdr->skipPixels);
-    __GLX_SWAP_INT((GLbyte *) & hdr->alignment);
+    __GLX_SWAP_INT((GLbyte *) &hdr->rowLength);
+    __GLX_SWAP_INT((GLbyte *) &hdr->skipRows);
+    __GLX_SWAP_INT((GLbyte *) &hdr->skipPixels);
+    __GLX_SWAP_INT((GLbyte *) &hdr->alignment);
 
-    __GLX_SWAP_INT((GLbyte *) & hdr->target);
-    __GLX_SWAP_INT((GLbyte *) & hdr->internalformat);
-    __GLX_SWAP_INT((GLbyte *) & hdr->width);
-    __GLX_SWAP_INT((GLbyte *) & hdr->height);
-    __GLX_SWAP_INT((GLbyte *) & hdr->format);
-    __GLX_SWAP_INT((GLbyte *) & hdr->type);
+    __GLX_SWAP_INT((GLbyte *) &hdr->target);
+    __GLX_SWAP_INT((GLbyte *) &hdr->internalformat);
+    __GLX_SWAP_INT((GLbyte *) &hdr->width);
+    __GLX_SWAP_INT((GLbyte *) &hdr->height);
+    __GLX_SWAP_INT((GLbyte *) &hdr->format);
+    __GLX_SWAP_INT((GLbyte *) &hdr->type);
 
     /*
      ** Just invert swapBytes flag; the GL will figure out if it needs to swap
@@ -386,17 +386,17 @@ __glXDispSwap_SeparableFilter2D(GLbyte * pc)
 
     hdrlen = __GLX_PAD(__GLX_CONV_FILT_CMD_HDR_SIZE);
 
-    __GLX_SWAP_INT((GLbyte *) & hdr->rowLength);
-    __GLX_SWAP_INT((GLbyte *) & hdr->skipRows);
-    __GLX_SWAP_INT((GLbyte *) & hdr->skipPixels);
-    __GLX_SWAP_INT((GLbyte *) & hdr->alignment);
-
-    __GLX_SWAP_INT((GLbyte *) & hdr->target);
-    __GLX_SWAP_INT((GLbyte *) & hdr->internalformat);
-    __GLX_SWAP_INT((GLbyte *) & hdr->width);
-    __GLX_SWAP_INT((GLbyte *) & hdr->height);
-    __GLX_SWAP_INT((GLbyte *) & hdr->format);
-    __GLX_SWAP_INT((GLbyte *) & hdr->type);
+    __GLX_SWAP_INT((GLbyte *) &hdr->rowLength);
+    __GLX_SWAP_INT((GLbyte *) &hdr->skipRows);
+    __GLX_SWAP_INT((GLbyte *) &hdr->skipPixels);
+    __GLX_SWAP_INT((GLbyte *) &hdr->alignment);
+
+    __GLX_SWAP_INT((GLbyte *) &hdr->target);
+    __GLX_SWAP_INT((GLbyte *) &hdr->internalformat);
+    __GLX_SWAP_INT((GLbyte *) &hdr->width);
+    __GLX_SWAP_INT((GLbyte *) &hdr->height);
+    __GLX_SWAP_INT((GLbyte *) &hdr->format);
+    __GLX_SWAP_INT((GLbyte *) &hdr->type);
 
     /*
      ** Just invert swapBytes flag; the GL will figure out if it needs to swap
index 9463c87..56abe80 100644 (file)
@@ -101,7 +101,7 @@ typedef struct _myPrivate {
 #endif
 
 /** Create and return a private data structure. */
-pointer
+void *
 dmxBackendCreatePrivate(DeviceIntPtr pDevice)
 {
     GETDMXLOCALFROMPDEVICE;
@@ -115,7 +115,7 @@ dmxBackendCreatePrivate(DeviceIntPtr pDevice)
  * verify that the structure was actually created by
  * #dmxBackendCreatePrivate. */
 void
-dmxBackendDestroyPrivate(pointer private)
+dmxBackendDestroyPrivate(void *private)
 {
     free(private);
 }
@@ -262,7 +262,7 @@ dmxBackendOffscreen(int screen, int x, int y)
 /** This routine is called from #dmxCoreMotion for each motion
  * event. \a x and \a y are global coordinants. */
 void
-dmxBackendUpdatePosition(pointer private, int x, int y)
+dmxBackendUpdatePosition(void *private, int x, int y)
 {
     GETPRIVFROMPRIVATE;
     int screen = miPointerGetScreen(inputInfo.pointer)->myNum;
@@ -419,10 +419,9 @@ dmxBackendCollectEvents(DevicePtr pDev,
             }
             break;
         case MotionNotify:
-            DMXDBG9("dmxBackendCollectEvents: MotionNotify %d/%d (mi %d)"
+            DMXDBG8("dmxBackendCollectEvents: MotionNotify %d/%d"
                     " newscreen=%d: %d %d (e=%d; last=%d,%d)\n",
                     dmxScreen->index, priv->myScreen,
-                    miPointerCurrentScreen()->myNum,
                     priv->newscreen,
                     X.xmotion.x, X.xmotion.y,
                     entered, priv->lastX, priv->lastY);
@@ -501,7 +500,7 @@ dmxBackendCollectEvents(DevicePtr pDev,
  * event processing actually takes place here, but this is a convenient
  * place to update the pointer. */
 void
-dmxBackendProcessInput(pointer private)
+dmxBackendProcessInput(void *private)
 {
     GETPRIVFROMPRIVATE;
 
@@ -579,9 +578,6 @@ dmxBackendLateReInit(DevicePtr pDev)
     GETPRIVFROMPDEV;
     int x, y;
 
-    DMXDBG1("dmxBackendLateReInit miPointerCurrentScreen() = %p\n",
-            miPointerCurrentScreen());
-
     dmxBackendSameDisplay(NULL, 0);     /* Invalidate cache */
     dmxBackendInitPrivate(pDev);
     dmxBackendComputeCenter(priv);
@@ -654,7 +650,7 @@ dmxBackendKbdGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info)
 /** Process #DMXFunctionType functions.  The only function handled here
  * is to acknowledge a pending server shutdown. */
 int
-dmxBackendFunctions(pointer private, DMXFunctionType function)
+dmxBackendFunctions(void *private, DMXFunctionType function)
 {
     switch (function) {
     case DMX_FUNCTION_TERMINATE:
index 6a49a56..a608573 100644 (file)
@@ -38,8 +38,8 @@
 #ifndef _DMXBACKEND_H_
 #define _DMXBACKEND_H_
 
-extern pointer dmxBackendCreatePrivate(DeviceIntPtr pDevice);
-extern void dmxBackendDestroyPrivate(pointer private);
+extern void *dmxBackendCreatePrivate(DeviceIntPtr pDevice);
+extern void dmxBackendDestroyPrivate(void *private);
 extern void dmxBackendInit(DevicePtr pDev);
 extern void dmxBackendLateReInit(DevicePtr pDev);
 extern void dmxBackendMouGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info);
@@ -49,8 +49,8 @@ extern void dmxBackendCollectEvents(DevicePtr pDev,
                                     dmxEnqueueProcPtr enqueue,
                                     dmxCheckSpecialProcPtr checkspecial,
                                     DMXBlockType block);
-extern void dmxBackendProcessInput(pointer private);
-extern int dmxBackendFunctions(pointer private, DMXFunctionType function);
-extern void dmxBackendUpdatePosition(pointer private, int x, int y);
+extern void dmxBackendProcessInput(void *private);
+extern int dmxBackendFunctions(void *private, DMXFunctionType function);
+extern void dmxBackendUpdatePosition(void *private, int x, int y);
 
 #endif
index 5f25e88..90154ef 100644 (file)
@@ -339,7 +339,7 @@ dmxCommonOthOn(DevicePtr pDev)
     if (!(priv->xi = XOpenDevice(priv->display, dmxLocal->deviceId))) {
         dmxLog(dmxWarning, "Cannot open %s device (id=%d) on %s\n",
                dmxLocal->deviceName ? dmxLocal->deviceName : "(unknown)",
-               dmxLocal->deviceId, dmxInput->name);
+               (int) dmxLocal->deviceId, dmxInput->name);
         return -1;
     }
     ADD(DeviceKeyPress);
@@ -502,11 +502,6 @@ dmxCommonMouOn(DevicePtr pDev)
     GETDMXINPUTFROMPRIV;
 
     priv->eventMask |= DMX_POINTER_EVENT_MASK;
-    if (dmxShadowFB) {
-        XWarpPointer(priv->display, priv->window, priv->window,
-                     0, 0, 0, 0, priv->initPointerX, priv->initPointerY);
-        dmxSync(&dmxScreens[dmxInput->scrnIdx], TRUE);
-    }
     if (!priv->be) {
         XSelectInput(priv->display, priv->window, priv->eventMask);
         AddEnabledDevice(XConnectionNumber(priv->display));
@@ -563,7 +558,7 @@ dmxFindPointerScreen(int x, int y)
  * (e.g., when a keyboard and mouse form a pair that should share the
  * same private area).  If the requested private area cannot be located,
  * then NULL is returned. */
-pointer
+void *
 dmxCommonCopyPrivate(DeviceIntPtr pDevice)
 {
     GETDMXLOCALFROMPDEVICE;
@@ -588,7 +583,7 @@ dmxCommonCopyPrivate(DeviceIntPtr pDevice)
  * server startup and server shutdown).
  */
 void
-dmxCommonSaveState(pointer private)
+dmxCommonSaveState(void *private)
 {
     GETPRIVFROMPRIVATE;
     XKeyboardState ks;
@@ -646,7 +641,7 @@ dmxCommonSaveState(pointer private)
 
 /** This routine restores all the information saved by #dmxCommonSaveState. */
 void
-dmxCommonRestoreState(pointer private)
+dmxCommonRestoreState(void *private)
 {
     GETPRIVFROMPRIVATE;
     int retcode = -1;
index d4f8d3c..ed04287 100644 (file)
@@ -118,7 +118,7 @@ extern void dmxCommonOthOff(DevicePtr pDev);
 extern void dmxCommonOthGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info);
 
                                 /* helper functions */
-extern pointer dmxCommonCopyPrivate(DeviceIntPtr pDevice);
-extern void dmxCommonSaveState(pointer private);
-extern void dmxCommonRestoreState(pointer private);
+extern void *dmxCommonCopyPrivate(DeviceIntPtr pDevice);
+extern void dmxCommonSaveState(void *private);
+extern void dmxCommonRestoreState(void *private);
 #endif
index 600a705..f33a0eb 100644 (file)
@@ -141,7 +141,7 @@ unscaley(myPrivate * priv, int y)
 }
 
 /** Create the private area for \a pDevice. */
-pointer
+void *
 dmxConsoleCreatePrivate(DeviceIntPtr pDevice)
 {
     GETDMXLOCALFROMPDEVICE;
@@ -153,7 +153,7 @@ dmxConsoleCreatePrivate(DeviceIntPtr pDevice)
 
 /** If \a private is non-NULL, free its associated memory. */
 void
-dmxConsoleDestroyPrivate(pointer private)
+dmxConsoleDestroyPrivate(void *private)
 {
     free(private);
 }
@@ -193,7 +193,7 @@ dmxConsoleDrawFineCursor(myPrivate * priv, XRectangle * rect)
 }
 
 static void
-dmxConsoleDrawWindows(pointer private)
+dmxConsoleDrawWindows(void *private)
 {
     GETONLYPRIVFROMPRIVATE;
     Display *dpy = priv->display;
@@ -391,7 +391,7 @@ dmxConsoleUpdateFineCursor(myPrivate * priv)
  * fashion: the actual layout of the windows of the screen might not
  * have had any human-visible changes. */
 void
-dmxConsoleUpdateInfo(pointer private, DMXUpdateType type, WindowPtr pWindow)
+dmxConsoleUpdateInfo(void *private, DMXUpdateType type, WindowPtr pWindow)
 {
     GETONLYPRIVFROMPRIVATE;
     dmxConsoleDraw(priv, 1, 1);
@@ -436,7 +436,7 @@ dmxConsoleMoveRelative(myPrivate * priv, int x, int y,
  * allows the console's notion of the cursor postion to change when
  * another input device actually caused the change. */
 void
-dmxConsoleUpdatePosition(pointer private, int x, int y)
+dmxConsoleUpdatePosition(void *private, int x, int y)
 {
     GETONLYPRIVFROMPRIVATE;
     int tmpX, tmpY;
@@ -825,8 +825,8 @@ dmxConsoleInit(DevicePtr pDev)
 
     /* Set up properties */
     XStoreName(dpy, win, DMX_CONSOLE_NAME);
-    class_hints.res_name = DMX_RES_NAME;
-    class_hints.res_class = DMX_RES_CLASS;
+    class_hints.res_name = (char *) DMX_RES_NAME;
+    class_hints.res_class = (char *) DMX_RES_CLASS;
     XSetClassHint(dpy, win, &class_hints);
 
     /* Map the window */
@@ -941,7 +941,7 @@ dmxConsoleKbdGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info)
 
 /** Handle special console-only keys. */
 int
-dmxConsoleFunctions(pointer private, DMXFunctionType function)
+dmxConsoleFunctions(void *private, DMXFunctionType function)
 {
     GETONLYPRIVFROMPRIVATE;
     XRectangle rect;
index 1c52611..ea6033c 100644 (file)
@@ -37,8 +37,8 @@
 #ifndef _DMXCONSOLE_H_
 #define _DMXCONSOLE_H_
 
-extern pointer dmxConsoleCreatePrivate(DeviceIntPtr pDevice);
-extern void dmxConsoleDestroyPrivate(pointer private);
+extern void *dmxConsoleCreatePrivate(DeviceIntPtr pDevice);
+extern void dmxConsoleDestroyPrivate(void *private);
 extern void dmxConsoleInit(DevicePtr pDev);
 extern void dmxConsoleReInit(DevicePtr pDev);
 extern void dmxConsoleMouGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info);
@@ -48,12 +48,12 @@ extern void dmxConsoleCollectEvents(DevicePtr pDev,
                                     dmxEnqueueProcPtr enqueue,
                                     dmxCheckSpecialProcPtr checkspecial,
                                     DMXBlockType block);
-extern int dmxConsoleFunctions(pointer private, DMXFunctionType function);
-extern void dmxConsoleUpdatePosition(pointer private, int x, int y);
-extern void dmxConsoleKbdSetCtrl(pointer private, KeybdCtrl * ctrl);
+extern int dmxConsoleFunctions(void *private, DMXFunctionType function);
+extern void dmxConsoleUpdatePosition(void *private, int x, int y);
+extern void dmxConsoleKbdSetCtrl(void *private, KeybdCtrl * ctrl);
 extern void dmxConsoleCapture(DMXInputInfo * dmxInput);
 extern void dmxConsoleUncapture(DMXInputInfo * dmxInput);
-extern void dmxConsoleUpdateInfo(pointer private,
+extern void dmxConsoleUpdateInfo(void *private,
                                  DMXUpdateType, WindowPtr pWindow);
 
 #endif
index 2875620..14ac05f 100644 (file)
@@ -701,7 +701,6 @@ dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym,
            XEvent * e, DMXBlockType block)
 {
     GETDMXINPUTFROMPDEV;
-    xEvent xE;
     DeviceIntPtr p = dmxLocal->pDevice;
     int valuators[3];
     ValuatorMask mask;
@@ -716,7 +715,7 @@ dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym,
         if (dmxCheckFunctionKeys(dmxLocal, type, keySym))
             return;
         if (dmxLocal->sendsCore && dmxLocal != dmxLocalCoreKeyboard)
-            xE.u.u.detail = dmxFixup(pDev, detail, keySym);
+            detail = dmxFixup(pDev, detail, keySym);
 
         /*ErrorF("KEY %d  sym %d\n", detail, (int) keySym); */
         QueueKeyboardEvents(p, type, detail, NULL);
@@ -726,8 +725,7 @@ dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym,
     case ButtonRelease:
         detail = dmxGetButtonMapping(dmxLocal, detail);
         valuator_mask_zero(&mask);
-        QueuePointerEvents(p, type, detail,
-                           POINTER_ABSOLUTE | POINTER_SCREEN, &mask);
+        QueuePointerEvents(p, type, detail, 0, &mask);
         return;
 
     case MotionNotify:
index b22a41f..abb6a85 100644 (file)
@@ -225,7 +225,7 @@ dmxKbdCtrl(DeviceIntPtr pDevice, KeybdCtrl * ctrl)
 
 /* taken from kdrive/src/kinput.c: */
 static void
-dmxBell(int volume, DeviceIntPtr pDev, pointer arg, int something)
+dmxBell(int volume, DeviceIntPtr pDev, void *arg, int something)
 {
 #if 0
     KeybdCtrl *ctrl = arg;
@@ -336,7 +336,7 @@ _dmxKeyboardBellProc(DMXLocalInputInfoPtr dmxLocal, int percent)
  * sound the bell on all of the devices that send core events. */
 void
 dmxKeyboardBellProc(int percent, DeviceIntPtr pDevice,
-                    pointer ctrl, int unknown)
+                    void *ctrl, int unknown)
 {
     GETDMXLOCALFROMPDEVICE;
     int i, j;
@@ -633,7 +633,7 @@ dmxCollectAll(DMXInputInfo * dmxInput)
 }
 
 static void
-dmxBlockHandler(pointer blockData, OSTimePtr pTimeout, pointer pReadMask)
+dmxBlockHandler(void *blockData, OSTimePtr pTimeout, void *pReadMask)
 {
     DMXInputInfo *dmxInput = &dmxInputs[(uintptr_t) blockData];
     static unsigned long generation = 0;
@@ -645,7 +645,7 @@ dmxBlockHandler(pointer blockData, OSTimePtr pTimeout, pointer pReadMask)
 }
 
 static void
-dmxSwitchReturn(pointer p)
+dmxSwitchReturn(void *p)
 {
     DMXInputInfo *dmxInput = p;
     int i;
@@ -662,7 +662,7 @@ dmxSwitchReturn(pointer p)
 }
 
 static void
-dmxWakeupHandler(pointer blockData, int result, pointer pReadMask)
+dmxWakeupHandler(void *blockData, int result, void *pReadMask)
 {
     DMXInputInfo *dmxInput = &dmxInputs[(uintptr_t) blockData];
     int i;
@@ -921,7 +921,7 @@ dmxInputScanForExtensions(DMXInputInfo * dmxInput, int doXI)
                 break;
             }
             dmxLogInput(dmxInput, "  %2d %-10.10s %-16.16s\n",
-                        devices[i].id,
+                        (int) devices[i].id,
                         devices[i].name ? devices[i].name : "", use);
         }
 
@@ -993,7 +993,6 @@ dmxInputLateReInit(DMXInputInfo * dmxInput)
 void
 dmxInputInit(DMXInputInfo * dmxInput)
 {
-    DeviceIntPtr pPointer = NULL, pKeyboard = NULL;
     dmxArg a;
     const char *name;
     int i;
@@ -1108,12 +1107,6 @@ dmxInputInit(DMXInputInfo * dmxInput)
         DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[i];
 
         dmxLocal->pDevice = dmxAddDevice(dmxLocal);
-        if (dmxLocal->isCore) {
-            if (dmxLocal->type == DMX_LOCAL_MOUSE)
-                pPointer = dmxLocal->pDevice;
-            if (dmxLocal->type == DMX_LOCAL_KEYBOARD)
-                pKeyboard = dmxLocal->pDevice;
-        }
     }
 
     dmxInput->processInputEvents = dmxProcessInputEvents;
@@ -1136,7 +1129,7 @@ dmxInputFreeLocal(DMXLocalInputInfoRec * local)
         local->destroy_private(local->private);
     free(local->history);
     free(local->valuators);
-    free(local->deviceName);
+    free((void *) local->deviceName);
     local->private = NULL;
     local->history = NULL;
     local->deviceName = NULL;
@@ -1164,7 +1157,7 @@ dmxInputFree(DMXInputInfo * dmxInput)
     dmxInput->devs = NULL;
     dmxInput->numDevs = 0;
     if (dmxInput->freename)
-        free(dmxInput->name);
+        free((void *) dmxInput->name);
     dmxInput->name = NULL;
 }
 
@@ -1218,7 +1211,7 @@ dmxInputLogDevices(void)
                 dmxLogCont(dmxInfo, "\t[i%d/%*.*s",
                            dmxInput->inputIdx, len, len, dmxInput->name);
                 if (dmxInput->devs[i]->deviceId >= 0)
-                    dmxLogCont(dmxInfo, "/id%d", dmxInput->devs[i]->deviceId);
+                    dmxLogCont(dmxInfo, "/id%d", (int) dmxInput->devs[i]->deviceId);
                 if (dmxInput->devs[i]->deviceName)
                     dmxLogCont(dmxInfo, "=%s", dmxInput->devs[i]->deviceName);
                 dmxLogCont(dmxInfo, "] %s\n",
index 94ec101..11af2ca 100644 (file)
@@ -127,8 +127,8 @@ typedef struct _DMXLocalInitInfo {
     KeySym *symbols;                          /**< Key symbols */
 } DMXLocalInitInfo, *DMXLocalInitInfoPtr;
 
-typedef pointer (*dmxCreatePrivateProcPtr) (DeviceIntPtr);
-typedef void (*dmxDestroyPrivateProcPtr) (pointer);
+typedef void *(*dmxCreatePrivateProcPtr) (DeviceIntPtr);
+typedef void (*dmxDestroyPrivateProcPtr) (void *);
 
 typedef void (*dmxInitProcPtr) (DevicePtr);
 typedef void (*dmxReInitProcPtr) (DevicePtr);
@@ -136,13 +136,13 @@ typedef void (*dmxLateReInitProcPtr) (DevicePtr);
 typedef void (*dmxGetInfoProcPtr) (DevicePtr, DMXLocalInitInfoPtr);
 typedef int (*dmxOnProcPtr) (DevicePtr);
 typedef void (*dmxOffProcPtr) (DevicePtr);
-typedef void (*dmxUpdatePositionProcPtr) (pointer, int x, int y);
+typedef void (*dmxUpdatePositionProcPtr) (void *, int x, int y);
 
-typedef void (*dmxVTPreSwitchProcPtr) (pointer);        /* Turn I/O Off */
-typedef void (*dmxVTPostSwitchProcPtr) (pointer);       /* Turn I/O On */
-typedef void (*dmxVTSwitchReturnProcPtr) (pointer);
-typedef int (*dmxVTSwitchProcPtr) (pointer, int vt,
-                                   dmxVTSwitchReturnProcPtr, pointer);
+typedef void (*dmxVTPreSwitchProcPtr) (void *);        /* Turn I/O Off */
+typedef void (*dmxVTPostSwitchProcPtr) (void *);       /* Turn I/O On */
+typedef void (*dmxVTSwitchReturnProcPtr) (void *);
+typedef int (*dmxVTSwitchProcPtr) (void *, int vt,
+                                   dmxVTSwitchReturnProcPtr, void *);
 
 typedef void (*dmxMotionProcPtr) (DevicePtr,
                                   int *valuators,
@@ -157,9 +157,9 @@ typedef void (*dmxCollectEventsProcPtr) (DevicePtr,
                                          dmxMotionProcPtr,
                                          dmxEnqueueProcPtr,
                                          dmxCheckSpecialProcPtr, DMXBlockType);
-typedef void (*dmxProcessInputProcPtr) (pointer);
-typedef void (*dmxUpdateInfoProcPtr) (pointer, DMXUpdateType, WindowPtr);
-typedef int (*dmxFunctionsProcPtr) (pointer, DMXFunctionType);
+typedef void (*dmxProcessInputProcPtr) (void *);
+typedef void (*dmxUpdateInfoProcPtr) (void *, DMXUpdateType, WindowPtr);
+typedef int (*dmxFunctionsProcPtr) (void *, DMXFunctionType);
 
 typedef void (*dmxKBCtrlProcPtr) (DevicePtr, KeybdCtrl * ctrl);
 typedef void (*dmxMCtrlProcPtr) (DevicePtr, PtrCtrl * ctrl);
@@ -223,7 +223,7 @@ typedef struct _DMXLocalInputInfo {
     dmxKBCtrlProcPtr kCtrl;                   /**< Keyboard control */
     dmxKBBellProcPtr kBell;                   /**< Bell control */
 
-    pointer private;                          /**< Device-dependent private  */
+    void *private;                            /**< Device-dependent private  */
     int isCore;                               /**< Is a DMX core device  */
     int sendsCore;                            /**< Sends DMX core events */
     KeybdCtrl kctrl;                          /**< Keyboard control */
@@ -269,7 +269,7 @@ extern DMXLocalInputInfoPtr dmxInputCopyLocal(DMXInputInfo * dmxInput,
 extern void dmxChangePointerControl(DeviceIntPtr pDevice, PtrCtrl * ctrl);
 extern void dmxKeyboardKbdCtrlProc(DeviceIntPtr pDevice, KeybdCtrl * ctrl);
 extern void dmxKeyboardBellProc(int percent, DeviceIntPtr pDevice,
-                                pointer ctrl, int unknown);
+                                void *ctrl, int unknown);
 
 extern int dmxInputExtensionErrorHandler(Display * dsp, _Xconst char *name,
                                          _Xconst char *reason);
index ecf4f59..1a4d01f 100644 (file)
@@ -361,7 +361,7 @@ static unsigned char at2lnx[NUM_KEYCODES] = {
 };
 
 /** Create a private structure for use within this file. */
-pointer
+void *
 kbdLinuxCreatePrivate(DeviceIntPtr pKeyboard)
 {
     myPrivate *priv = calloc(1, sizeof(*priv));
@@ -373,7 +373,7 @@ kbdLinuxCreatePrivate(DeviceIntPtr pKeyboard)
 
 /** Destroy a private structure. */
 void
-kbdLinuxDestroyPrivate(pointer priv)
+kbdLinuxDestroyPrivate(void *priv)
 {
     free(priv);
 }
@@ -466,13 +466,13 @@ static int kbdLinuxActivate(int fd, int vtno, int setSig);
 
 /** Currently unused hook called prior to an VT switch. */
 void
-kbdLinuxVTPreSwitch(pointer p)
+kbdLinuxVTPreSwitch(void *p)
 {
 }
 
 /** Currently unused hook called after returning from a VT switch. */
 void
-kbdLinuxVTPostSwitch(pointer p)
+kbdLinuxVTPostSwitch(void *p)
 {
 }
 
@@ -481,8 +481,8 @@ kbdLinuxVTPostSwitch(pointer p)
  * switched back to the pre-switch VT (i.e., the user returns to the DMX
  * session). */
 int
-kbdLinuxVTSwitch(pointer p, int vt,
-                 void (*switch_return) (pointer), pointer switch_return_data)
+kbdLinuxVTSwitch(void *p, int vt,
+                 void (*switch_return) (void *), void *switch_return_data)
 {
     myPrivate *priv = p;
 
index 891c6a9..857ea11 100644 (file)
 #ifndef _LNX_KEYBOARD_H_
 #define _LNX_KEYBOARD_H_
 
-extern pointer kbdLinuxCreatePrivate(DeviceIntPtr pKeyboard);
-extern void kbdLinuxDestroyPrivate(pointer private);
+extern void *kbdLinuxCreatePrivate(DeviceIntPtr pKeyboard);
+extern void kbdLinuxDestroyPrivate(void *private);
 
 extern void kbdLinuxInit(DevicePtr pDev);
 extern void kbdLinuxGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info);
 extern int kbdLinuxOn(DevicePtr pDev);
 extern void kbdLinuxOff(DevicePtr pDev);
 
-extern void kbdLinuxVTPreSwitch(pointer p);
-extern void kbdLinuxVTPostSwitch(pointer p);
-extern int kbdLinuxVTSwitch(pointer p, int vt,
+extern void kbdLinuxVTPreSwitch(void *p);
+extern void kbdLinuxVTPostSwitch(void *p);
+extern int kbdLinuxVTSwitch(void *p, int vt,
                             dmxVTSwitchReturnProcPtr switch_return,
-                            pointer switch_return_data);
+                            void *switch_return_data);
 
 extern void kbdLinuxRead(DevicePtr pDev,
                          dmxMotionProcPtr motion,
index 7e1acf4..210f6de 100644 (file)
@@ -302,18 +302,18 @@ msLinuxGetMap(DevicePtr pDev, unsigned char *map, int *nButtons)
 
 /** Currently unused hook called prior to an VT switch. */
 void
-msLinuxVTPreSwitch(pointer p)
+msLinuxVTPreSwitch(void *p)
 {
 }
 
 /** Currently unused hook called after returning from a VT switch. */
 void
-msLinuxVTPostSwitch(pointer p)
+msLinuxVTPostSwitch(void *p)
 {
 }
 
 /** Create a private structure for use within this file. */
-pointer
+void *
 msLinuxCreatePrivate(DeviceIntPtr pMouse)
 {
     myPrivate *priv = calloc(1, sizeof(*priv));
@@ -325,7 +325,7 @@ msLinuxCreatePrivate(DeviceIntPtr pMouse)
 
 /** Destroy a private structure. */
 void
-msLinuxDestroyPrivate(pointer priv)
+msLinuxDestroyPrivate(void *priv)
 {
     free(priv);
 }
index 28ed095..7f3ba4e 100644 (file)
@@ -37,8 +37,8 @@
 #ifndef _LNX_MS_H_
 #define _LNX_MS_H_
 
-extern pointer msLinuxCreatePrivate(DeviceIntPtr pMouse);
-extern void msLinuxDestroyPrivate(pointer priv);
+extern void *msLinuxCreatePrivate(DeviceIntPtr pMouse);
+extern void msLinuxDestroyPrivate(void *priv);
 extern void msLinuxRead(DevicePtr pDev,
                         dmxMotionProcPtr motion,
                         dmxEnqueueProcPtr enqueue,
@@ -49,7 +49,7 @@ extern void msLinuxGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info);
 extern int msLinuxOn(DevicePtr pDev);
 extern void msLinuxOff(DevicePtr pDev);
 extern void msLinuxCtrl(DevicePtr pDev, PtrCtrl * ctrl);
-extern void msLinuxVTPreSwitch(pointer p);
-extern void msLinuxVTPostSwitch(pointer p);
+extern void msLinuxVTPreSwitch(void *p);
+extern void msLinuxVTPostSwitch(void *p);
 
 #endif
index 67c73a0..dd70cb8 100644 (file)
@@ -272,18 +272,18 @@ ps2LinuxGetMap(DevicePtr pDev, unsigned char *map, int *nButtons)
 
 /** Currently unused hook called prior to an VT switch. */
 void
-ps2LinuxVTPreSwitch(pointer p)
+ps2LinuxVTPreSwitch(void *p)
 {
 }
 
 /** Currently unused hook called after returning from a VT switch. */
 void
-ps2LinuxVTPostSwitch(pointer p)
+ps2LinuxVTPostSwitch(void *p)
 {
 }
 
 /** Create a private structure for use within this file. */
-pointer
+void *
 ps2LinuxCreatePrivate(DeviceIntPtr pMouse)
 {
     myPrivate *priv = calloc(1, sizeof(*priv));
@@ -295,7 +295,7 @@ ps2LinuxCreatePrivate(DeviceIntPtr pMouse)
 
 /** Destroy a private structure. */
 void
-ps2LinuxDestroyPrivate(pointer priv)
+ps2LinuxDestroyPrivate(void *priv)
 {
     free(priv);
 }
index 93f0f02..339f353 100644 (file)
@@ -37,8 +37,8 @@
 #ifndef _LNX_PS2_H_
 #define _LNX_PS2_H_
 
-extern pointer ps2LinuxCreatePrivate(DeviceIntPtr pMouse);
-extern void ps2LinuxDestroyPrivate(pointer priv);
+extern void *ps2LinuxCreatePrivate(DeviceIntPtr pMouse);
+extern void ps2LinuxDestroyPrivate(void *priv);
 extern void ps2LinuxRead(DevicePtr pDev,
                          dmxMotionProcPtr motion,
                          dmxEnqueueProcPtr enqueue,
@@ -49,7 +49,7 @@ extern void ps2LinuxGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info);
 extern int ps2LinuxOn(DevicePtr pDev);
 extern void ps2LinuxOff(DevicePtr pDev);
 extern void ps2LinuxCtrl(DevicePtr pDev, PtrCtrl * ctrl);
-extern void ps2LinuxVTPreSwitch(pointer p);
-extern void ps2LinuxVTPostSwitch(pointer p);
+extern void ps2LinuxVTPreSwitch(void *p);
+extern void ps2LinuxVTPostSwitch(void *p);
 
 #endif
index c7c166c..67aa07e 100644 (file)
@@ -474,7 +474,7 @@ usbOff(DevicePtr pDev)
 }
 
 /** Create a private structure for use within this file. */
-pointer
+void *
 usbCreatePrivate(DeviceIntPtr pDevice)
 {
     myPrivate *priv = calloc(1, sizeof(*priv));
@@ -486,7 +486,7 @@ usbCreatePrivate(DeviceIntPtr pDevice)
 
 /** Destroy a private structure. */
 void
-usbDestroyPrivate(pointer priv)
+usbDestroyPrivate(void *priv)
 {
     free(priv);
 }
index eea98af..7159376 100644 (file)
@@ -43,8 +43,8 @@ typedef enum {
     usbOther
 } usbType;
 
-extern pointer usbCreatePrivate(DeviceIntPtr pDevice);
-extern void usbDestroyPrivate(pointer priv);
+extern void *usbCreatePrivate(DeviceIntPtr pDevice);
+extern void usbDestroyPrivate(void *priv);
 extern void usbRead(DevicePtr pDev,
                     dmxMotionProcPtr motion,
                     dmxEnqueueProcPtr enqueue,
index 096607a..2ecfdf6 100644 (file)
@@ -102,8 +102,8 @@ typedef struct _myPrivate {
     int fd;                                 /**< File descriptor */
     unsigned char mask[EV_MAX / 8 + 1];     /**< Mask */
     int numRel, numAbs, numLeds;            /**< Counts */
-    int relmap[DMX_MAX_AXES];               /**< Relative axis map */
-    int absmap[DMX_MAX_AXES];               /**< Absolute axis map */
+    int relmap[REL_CNT];                    /**< Relative axis map */
+    int absmap[ABS_CNT];                    /**< Absolute axis map */
 
     CARD32 kbdState[NUM_STATE_ENTRIES];         /**< Keyboard state */
     DeviceIntPtr pKeyboard;                     /** Keyboard device */
index bbce856..6b3feb1 100644 (file)
@@ -179,16 +179,6 @@ will switch to another VC in local (raw) mode.
 .RE
 .sp
 .TP 8
-.BI "-shadowfb"
-This option turns on (legacy) support for the shadow frame buffer.
-.sp
-.TP 8
-.BI "-noshadowfb"
-This option turns off (legacy) support for the shadow frame buffer.
-Note that this option has been deprecated and will be removed in the
-next release.
-.sp
-.TP 8
 .BI "-nomulticursor"
 This option turns off support for displaying multiple cursors on
 overlapped back-end displays.  This option is available for testing and
index 2e0613a..00a53d0 100644 (file)
@@ -1,89 +1,92 @@
+# Copyright Â© 2013 Intel 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.
+
 SUBDIRS = man
 
-INCLUDES =                     \
+AM_CPPFLAGS =                  \
        @KDRIVE_INCS@           \
        @KDRIVE_CFLAGS@         \
        @XEPHYR_INCS@           \
        @XEPHYR_CFLAGS@         \
        -I$(top_srcdir)         \
+       -I$(top_srcdir)/glamor  \
        -I$(top_srcdir)/exa
 
 if XV
-LIBXEPHYR_HOSTXV=libxephyr-hostxv.la
+XV_SRCS = ephyrvideo.c
 endif
 
-if DRI
-LIBXEPHYR_HOSTDRI=libxephyr-hostdri.la
+if GLAMOR
+GLAMOR_SRCS = \
+       ephyr_glamor_glx.c \
+       ephyr_glamor_glx.h \
+       $()
 endif
 
-noinst_LTLIBRARIES = libxephyr-hostx.la $(LIBXEPHYR_HOSTXV) $(LIBXEPHYR_HOSTDRI) libxephyr.la
-
-bin_PROGRAMS = Xephyr
-
-HOSTX_SRCS =                   \
-       hostx.c                 \
-       hostx.h
-
-HOSTVIDEO_SRCS =               \
-       ephyrvideo.c            \
-       ephyrhostvideo.c        \
-       ephyrhostvideo.h
-
-HOSTDRI_SRCS =                 \
+if DRI
+DRI_SRCS =                     \
        ephyrdriext.c           \
        ephyrdriext.h           \
        ephyrdri.c              \
        ephyrdri.h              \
-       XF86dri.c               \
-       xf86dri.h               \
        ephyrglxext.c           \
        ephyrglxext.h           \
        ephyrhostglx.c          \
-       ephyrhostglx.h
-
-XEPHYR_SRCS =                  \
-       ephyr.c                 \
-       ephyr.h                 \
-       ephyrlog.h              \
-       ephyr_draw.c            \
-       os.c
-
-libxephyr_hostx_la_SOURCES = $(HOSTX_SRCS)
-
-if XV
-libxephyr_hostxv_la_SOURCES = $(HOSTVIDEO_SRCS)
+       ephyrhostglx.h          \
+       $()
 endif
 
-if DRI
-libxephyr_hostdri_la_SOURCES = $(HOSTDRI_SRCS)
-endif
-
-libxephyr_la_SOURCES = $(XEPHYR_SRCS)
+bin_PROGRAMS = Xephyr
 
 Xephyr_SOURCES = \
-       ephyrinit.c
+       ephyr.c \
+       ephyr.h \
+       ephyrlog.h \
+       ephyr_draw.c \
+       os.c \
+       ephyrinit.c \
+       hostx.c \
+       hostx.h \
+       $(XV_SRCS) \
+       $(DRI_SRCS) \
+       $(GLAMOR_SRCS) \
+       $()
+
+if GLAMOR
+AM_CPPFLAGS += $(XLIB_CFLAGS)
+XEPHYR_GLAMOR_LIB = \
+       $(top_builddir)/glamor/libglamor.la \
+       $(top_builddir)/glamor/libglamor_egl_stubs.la \
+       $()
+endif
 
 Xephyr_LDADD =                                                 \
-       libxephyr.la                                    \
-       libxephyr-hostx.la                              \
-       $(LIBXEPHYR_HOSTXV)                             \
-       $(LIBXEPHYR_HOSTDRI)                            \
        $(top_builddir)/exa/libexa.la                   \
+       $(XEPHYR_GLAMOR_LIB)                            \
        @KDRIVE_LIBS@                                   \
        @XEPHYR_LIBS@
 
-Xephyr_DEPENDENCIES =  \
-       libxephyr.la                                    \
-       libxephyr-hostx.la                              \
-       $(LIBXEPHYR_HOSTXV)                             \
-       $(LIBXEPHYR_HOSTDRI)                            \
-       @KDRIVE_LOCAL_LIBS@
+Xephyr_DEPENDENCIES = @KDRIVE_LOCAL_LIBS@ $(XEPHYR_GLAMOR_LIB)
 
 Xephyr_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
 
 relink:
        $(AM_V_at)rm -f $(bin_PROGRAMS) && $(MAKE) $(bin_PROGRAMS)
-
-EXTRA_DIST = \
-       $(HOSTVIDEO_SRCS) \
-       $(HOSTDRI_SRCS)
diff --git a/hw/kdrive/ephyr/XF86dri.c b/hw/kdrive/ephyr/XF86dri.c
deleted file mode 100644 (file)
index 74bf676..0000000
+++ /dev/null
@@ -1,647 +0,0 @@
-/* $XFree86: xc/lib/GL/dri/XF86dri.c,v 1.13 2002/10/30 12:51:25 alanh Exp $ */
-/**************************************************************************
-
-Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
-Copyright 2000 VA Linux Systems, Inc.
-All Rights Reserved.
-
-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, sub license, 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 NON-INFRINGEMENT.
-IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
-ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- *   Kevin E. Martin <martin@valinux.com>
- *   Jens Owen <jens@tungstengraphics.com>
- *   Rickard E. (Rik) Faith <faith@valinux.com>
- *
- */
-
-/*
- * This file has been copied from the mesa source tree and a little bit
- * modified by:
- *
- * Dodji Seketeli <dodji@openedhand.com>
- */
-
-#ifdef HAVE_CONFIG_H
-#include <kdrive-config.h>
-#endif
-/*
- * including some server headers (like kdrive-config.h)
- * might define the macro _XSERVER64
- * on 64 bits machines. That macro must _NOT_ be defined for Xlib
- * client code, otherwise bad things happen.
- * So let's undef that macro if necessary.
- */
-#ifdef _XSERVER64
-#undef _XSERVER64
-#endif
-
-/* THIS IS NOT AN X CONSORTIUM STANDARD */
-
-#include <X11/Xlibint.h>
-#include <X11/extensions/Xext.h>
-#include <X11/extensions/extutil.h>
-#include <GL/glx.h>
-#include "xf86dri.h"
-#include <X11/dri/xf86driproto.h>
-
-static XExtensionInfo _xf86dri_info_data;
-static XExtensionInfo *xf86dri_info = &_xf86dri_info_data;
-static char xf86dri_extension_name[] = XF86DRINAME;
-
-#define XF86DRICheckExtension(dpy,i,val) \
-  XextCheckExtension (dpy, i, xf86dri_extension_name, val)
-
-/*****************************************************************************
- *                                                                           *
- *                        private utility routines                          *
- *                                                                           *
- *****************************************************************************/
-
-static int close_display(Display * dpy, XExtCodes * extCodes);
-
-static /* const */ XExtensionHooks xf86dri_extension_hooks = {
-    NULL,                       /* create_gc */
-    NULL,                       /* copy_gc */
-    NULL,                       /* flush_gc */
-    NULL,                       /* free_gc */
-    NULL,                       /* create_font */
-    NULL,                       /* free_font */
-    close_display,              /* close_display */
-    NULL,                       /* wire_to_event */
-    NULL,                       /* event_to_wire */
-    NULL,                       /* error */
-    NULL,                       /* error_string */
-};
-
-static
-XEXT_GENERATE_FIND_DISPLAY(find_display, xf86dri_info,
-                           xf86dri_extension_name,
-                           &xf86dri_extension_hooks, 0, NULL)
-
-static
-XEXT_GENERATE_CLOSE_DISPLAY(close_display, xf86dri_info)
-
-/*****************************************************************************
- *                                                                           *
- *                 public XFree86-DRI Extension routines                    *
- *                                                                           *
- *****************************************************************************/
-#if 0
-#include <stdio.h>
-#define TRACE(msg)  fprintf(stderr,"XF86DRI%s\n", msg);
-#else
-#define TRACE(msg)
-#endif
-Bool
-XF86DRIOpenFullScreen(Display * dpy, int screen, Drawable drawable);
-Bool
-XF86DRICloseFullScreen(Display * dpy, int screen, Drawable drawable);
-
-Bool
-XF86DRIQueryExtension(Display * dpy, int *event_basep, int *error_basep)
-{
-    XExtDisplayInfo *info = find_display(dpy);
-
-    TRACE("QueryExtension...");
-    if (XextHasExtension(info)) {
-        *event_basep = info->codes->first_event;
-        *error_basep = info->codes->first_error;
-        TRACE("QueryExtension... return True");
-        return True;
-    }
-    else {
-        TRACE("QueryExtension... return False");
-        return False;
-    }
-}
-
-Bool
-XF86DRIQueryVersion(Display * dpy, int *majorVersion, int *minorVersion,
-                    int *patchVersion)
-{
-    XExtDisplayInfo *info = find_display(dpy);
-    xXF86DRIQueryVersionReply rep;
-    xXF86DRIQueryVersionReq *req;
-
-    TRACE("QueryVersion...");
-    XF86DRICheckExtension(dpy, info, False);
-
-    LockDisplay(dpy);
-    GetReq(XF86DRIQueryVersion, req);
-    req->reqType = info->codes->major_opcode;
-    req->driReqType = X_XF86DRIQueryVersion;
-    if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
-        UnlockDisplay(dpy);
-        SyncHandle();
-        TRACE("QueryVersion... return False");
-        return False;
-    }
-    *majorVersion = rep.majorVersion;
-    *minorVersion = rep.minorVersion;
-    *patchVersion = rep.patchVersion;
-    UnlockDisplay(dpy);
-    SyncHandle();
-    TRACE("QueryVersion... return True");
-    return True;
-}
-
-Bool
-XF86DRIQueryDirectRenderingCapable(Display * dpy, int screen, Bool *isCapable)
-{
-    XExtDisplayInfo *info = find_display(dpy);
-    xXF86DRIQueryDirectRenderingCapableReply rep;
-    xXF86DRIQueryDirectRenderingCapableReq *req;
-
-    TRACE("QueryDirectRenderingCapable...");
-    XF86DRICheckExtension(dpy, info, False);
-
-    LockDisplay(dpy);
-    GetReq(XF86DRIQueryDirectRenderingCapable, req);
-    req->reqType = info->codes->major_opcode;
-    req->driReqType = X_XF86DRIQueryDirectRenderingCapable;
-    req->screen = screen;
-    if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
-        UnlockDisplay(dpy);
-        SyncHandle();
-        TRACE("QueryDirectRenderingCapable... return False");
-        return False;
-    }
-    *isCapable = rep.isCapable;
-    UnlockDisplay(dpy);
-    SyncHandle();
-    TRACE("QueryDirectRenderingCapable... return True");
-    return True;
-}
-
-Bool
-XF86DRIOpenConnection(Display * dpy, int screen,
-                      drm_handle_t * hSAREA, char **busIdString)
-{
-    XExtDisplayInfo *info = find_display(dpy);
-    xXF86DRIOpenConnectionReply rep;
-    xXF86DRIOpenConnectionReq *req;
-
-    TRACE("OpenConnection...");
-    XF86DRICheckExtension(dpy, info, False);
-
-    LockDisplay(dpy);
-    GetReq(XF86DRIOpenConnection, req);
-    req->reqType = info->codes->major_opcode;
-    req->driReqType = X_XF86DRIOpenConnection;
-    req->screen = screen;
-    if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
-        UnlockDisplay(dpy);
-        SyncHandle();
-        TRACE("OpenConnection... return False");
-        return False;
-    }
-
-    *hSAREA = rep.hSAREALow;
-    if (sizeof(drm_handle_t) == 8) {
-        int shift = 32;         /* var to prevent warning on next line */
-
-        *hSAREA |= ((drm_handle_t) rep.hSAREAHigh) << shift;
-    }
-
-    if (rep.length) {
-        if (!(*busIdString = (char *) calloc(rep.busIdStringLength + 1, 1))) {
-            _XEatData(dpy, ((rep.busIdStringLength + 3) & ~3));
-            UnlockDisplay(dpy);
-            SyncHandle();
-            TRACE("OpenConnection... return False");
-            return False;
-        }
-        _XReadPad(dpy, *busIdString, rep.busIdStringLength);
-    }
-    else {
-        *busIdString = NULL;
-    }
-    UnlockDisplay(dpy);
-    SyncHandle();
-    TRACE("OpenConnection... return True");
-    return True;
-}
-
-Bool
-XF86DRIAuthConnection(Display * dpy, int screen, drm_magic_t magic)
-{
-    XExtDisplayInfo *info = find_display(dpy);
-    xXF86DRIAuthConnectionReq *req;
-    xXF86DRIAuthConnectionReply rep;
-
-    TRACE("AuthConnection...");
-    XF86DRICheckExtension(dpy, info, False);
-
-    LockDisplay(dpy);
-    GetReq(XF86DRIAuthConnection, req);
-    req->reqType = info->codes->major_opcode;
-    req->driReqType = X_XF86DRIAuthConnection;
-    req->screen = screen;
-    req->magic = magic;
-    rep.authenticated = 0;
-    if (!_XReply(dpy, (xReply *) & rep, 0, xFalse) || !rep.authenticated) {
-        UnlockDisplay(dpy);
-        SyncHandle();
-        TRACE("AuthConnection... return False");
-        return False;
-    }
-    UnlockDisplay(dpy);
-    SyncHandle();
-    TRACE("AuthConnection... return True");
-    return True;
-}
-
-Bool
-XF86DRICloseConnection(Display * dpy, int screen)
-{
-    XExtDisplayInfo *info = find_display(dpy);
-    xXF86DRICloseConnectionReq *req;
-
-    TRACE("CloseConnection...");
-
-    XF86DRICheckExtension(dpy, info, False);
-
-    LockDisplay(dpy);
-    GetReq(XF86DRICloseConnection, req);
-    req->reqType = info->codes->major_opcode;
-    req->driReqType = X_XF86DRICloseConnection;
-    req->screen = screen;
-    UnlockDisplay(dpy);
-    SyncHandle();
-    TRACE("CloseConnection... return True");
-    return True;
-}
-
-Bool
-XF86DRIGetClientDriverName(Display * dpy, int screen,
-                           int *ddxDriverMajorVersion,
-                           int *ddxDriverMinorVersion,
-                           int *ddxDriverPatchVersion, char **clientDriverName)
-{
-    XExtDisplayInfo *info = find_display(dpy);
-    xXF86DRIGetClientDriverNameReply rep;
-    xXF86DRIGetClientDriverNameReq *req;
-
-    TRACE("GetClientDriverName...");
-    XF86DRICheckExtension(dpy, info, False);
-
-    LockDisplay(dpy);
-    GetReq(XF86DRIGetClientDriverName, req);
-    req->reqType = info->codes->major_opcode;
-    req->driReqType = X_XF86DRIGetClientDriverName;
-    req->screen = screen;
-    if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
-        UnlockDisplay(dpy);
-        SyncHandle();
-        TRACE("GetClientDriverName... return False");
-        return False;
-    }
-
-    *ddxDriverMajorVersion = rep.ddxDriverMajorVersion;
-    *ddxDriverMinorVersion = rep.ddxDriverMinorVersion;
-    *ddxDriverPatchVersion = rep.ddxDriverPatchVersion;
-
-    if (rep.length) {
-        if (!
-            (*clientDriverName =
-             (char *) calloc(rep.clientDriverNameLength + 1, 1))) {
-            _XEatData(dpy, ((rep.clientDriverNameLength + 3) & ~3));
-            UnlockDisplay(dpy);
-            SyncHandle();
-            TRACE("GetClientDriverName... return False");
-            return False;
-        }
-        _XReadPad(dpy, *clientDriverName, rep.clientDriverNameLength);
-    }
-    else {
-        *clientDriverName = NULL;
-    }
-    UnlockDisplay(dpy);
-    SyncHandle();
-    TRACE("GetClientDriverName... return True");
-    return True;
-}
-
-Bool
-XF86DRICreateContextWithConfig(Display * dpy, int screen, int configID,
-                               XID *context, drm_context_t * hHWContext)
-{
-    XExtDisplayInfo *info = find_display(dpy);
-    xXF86DRICreateContextReply rep;
-    xXF86DRICreateContextReq *req;
-
-    TRACE("CreateContext...");
-    XF86DRICheckExtension(dpy, info, False);
-
-    LockDisplay(dpy);
-    GetReq(XF86DRICreateContext, req);
-    req->reqType = info->codes->major_opcode;
-    req->driReqType = X_XF86DRICreateContext;
-    req->visual = configID;
-    req->screen = screen;
-    *context = XAllocID(dpy);
-    req->context = *context;
-    if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
-        UnlockDisplay(dpy);
-        SyncHandle();
-        TRACE("CreateContext... return False");
-        return False;
-    }
-    *hHWContext = rep.hHWContext;
-    UnlockDisplay(dpy);
-    SyncHandle();
-    TRACE("CreateContext... return True");
-    return True;
-}
-
-Bool
-XF86DRICreateContext(Display * dpy, int screen, Visual * visual,
-                     XID *context, drm_context_t * hHWContext)
-{
-    return XF86DRICreateContextWithConfig(dpy, screen, visual->visualid,
-                                          context, hHWContext);
-}
-
-GLboolean
-XF86DRIDestroyContext(Display * dpy, int screen, XID context)
-{
-    XExtDisplayInfo *info = find_display(dpy);
-    xXF86DRIDestroyContextReq *req;
-
-    TRACE("DestroyContext...");
-    XF86DRICheckExtension(dpy, info, False);
-
-    LockDisplay(dpy);
-    GetReq(XF86DRIDestroyContext, req);
-    req->reqType = info->codes->major_opcode;
-    req->driReqType = X_XF86DRIDestroyContext;
-    req->screen = screen;
-    req->context = context;
-    UnlockDisplay(dpy);
-    SyncHandle();
-    TRACE("DestroyContext... return True");
-    return True;
-}
-
-GLboolean
-XF86DRICreateDrawable(Display * dpy, int screen,
-                      XID drawable, drm_drawable_t * hHWDrawable)
-{
-    XExtDisplayInfo *info = find_display(dpy);
-    xXF86DRICreateDrawableReply rep;
-    xXF86DRICreateDrawableReq *req;
-
-    TRACE("CreateDrawable...");
-    XF86DRICheckExtension(dpy, info, False);
-
-    LockDisplay(dpy);
-    GetReq(XF86DRICreateDrawable, req);
-    req->reqType = info->codes->major_opcode;
-    req->driReqType = X_XF86DRICreateDrawable;
-    req->screen = screen;
-    req->drawable = drawable;
-    if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
-        UnlockDisplay(dpy);
-        SyncHandle();
-        TRACE("CreateDrawable... return False");
-        return False;
-    }
-    *hHWDrawable = rep.hHWDrawable;
-    UnlockDisplay(dpy);
-    SyncHandle();
-    TRACE("CreateDrawable... return True");
-    return True;
-}
-
-static int
-noopErrorHandler(Display * dpy, XErrorEvent * xerr)
-{
-    return 0;
-}
-
-GLboolean
-XF86DRIDestroyDrawable(Display * dpy, int screen, XID drawable)
-{
-    XExtDisplayInfo *info = find_display(dpy);
-    xXF86DRIDestroyDrawableReq *req;
-    int (*oldXErrorHandler) (Display *, XErrorEvent *);
-
-    TRACE("DestroyDrawable...");
-    XF86DRICheckExtension(dpy, info, False);
-
-    /* This is called from the DRI driver, which used call it like this
-     *
-     *   if (windowExists(drawable))
-     *     destroyDrawable(drawable);
-     *
-     * which is a textbook race condition - the window may disappear
-     * from the server between checking for its existance and
-     * destroying it.  Instead we change the semantics of
-     * __DRIinterfaceMethodsRec::destroyDrawable() to succeed even if
-     * the windows is gone, by wrapping the destroy call in an error
-     * handler. */
-
-    XSync(dpy, GL_FALSE);
-    oldXErrorHandler = XSetErrorHandler(noopErrorHandler);
-
-    LockDisplay(dpy);
-    GetReq(XF86DRIDestroyDrawable, req);
-    req->reqType = info->codes->major_opcode;
-    req->driReqType = X_XF86DRIDestroyDrawable;
-    req->screen = screen;
-    req->drawable = drawable;
-    UnlockDisplay(dpy);
-    SyncHandle();
-
-    XSetErrorHandler(oldXErrorHandler);
-
-    TRACE("DestroyDrawable... return True");
-    return True;
-}
-
-Bool
-XF86DRIGetDrawableInfo(Display * dpy, int screen, Drawable drawable,
-                       unsigned int *index, unsigned int *stamp,
-                       int *X, int *Y, int *W, int *H,
-                       int *numClipRects, drm_clip_rect_t ** pClipRects,
-                       int *backX, int *backY,
-                       int *numBackClipRects, drm_clip_rect_t ** pBackClipRects)
-{
-    XExtDisplayInfo *info = find_display(dpy);
-    xXF86DRIGetDrawableInfoReply rep;
-    xXF86DRIGetDrawableInfoReq *req = NULL;
-    int total_rects;
-
-    TRACE("GetDrawableInfo...");
-    XF86DRICheckExtension(dpy, info, False);
-
-    LockDisplay(dpy);
-    GetReq(XF86DRIGetDrawableInfo, req);
-    req->reqType = info->codes->major_opcode;
-    req->driReqType = X_XF86DRIGetDrawableInfo;
-    req->screen = screen;
-    req->drawable = drawable;
-
-    if (!_XReply(dpy, (xReply *) & rep, 1, xFalse)) {
-        UnlockDisplay(dpy);
-        SyncHandle();
-        TRACE("GetDrawableInfo... return False");
-        return False;
-    }
-    *index = rep.drawableTableIndex;
-    *stamp = rep.drawableTableStamp;
-    *X = (int) rep.drawableX;
-    *Y = (int) rep.drawableY;
-    *W = (int) rep.drawableWidth;
-    *H = (int) rep.drawableHeight;
-    *numClipRects = rep.numClipRects;
-    total_rects = *numClipRects;
-
-    *backX = rep.backX;
-    *backY = rep.backY;
-    *numBackClipRects = rep.numBackClipRects;
-    total_rects += *numBackClipRects;
-
-#if 0
-    /* Because of the fix in Xserver/GL/dri/xf86dri.c, this check breaks
-     * backwards compatibility (Because of the >> 2 shift) but the fix
-     * enables multi-threaded apps to work.
-     */
-    if (rep.length != ((((SIZEOF(xXF86DRIGetDrawableInfoReply) -
-                          SIZEOF(xGenericReply) +
-                          total_rects * sizeof(drm_clip_rect_t)) +
-                         3) & ~3) >> 2)) {
-        _XEatData(dpy, rep.length);
-        UnlockDisplay(dpy);
-        SyncHandle();
-        TRACE("GetDrawableInfo... return False");
-        return False;
-    }
-#endif
-
-    if (*numClipRects) {
-        int len = sizeof(drm_clip_rect_t) * (*numClipRects);
-
-        *pClipRects = (drm_clip_rect_t *) calloc(len, 1);
-        if (*pClipRects)
-            _XRead(dpy, (char *) *pClipRects, len);
-    }
-    else {
-        *pClipRects = NULL;
-    }
-
-    if (*numBackClipRects) {
-        int len = sizeof(drm_clip_rect_t) * (*numBackClipRects);
-
-        *pBackClipRects = (drm_clip_rect_t *) calloc(len, 1);
-        if (*pBackClipRects)
-            _XRead(dpy, (char *) *pBackClipRects, len);
-    }
-    else {
-        *pBackClipRects = NULL;
-    }
-
-    UnlockDisplay(dpy);
-    SyncHandle();
-    TRACE("GetDrawableInfo... return True");
-    return True;
-}
-
-Bool
-XF86DRIGetDeviceInfo(Display * dpy, int screen, drm_handle_t * hFrameBuffer,
-                     int *fbOrigin, int *fbSize, int *fbStride,
-                     int *devPrivateSize, void **pDevPrivate)
-{
-    XExtDisplayInfo *info = find_display(dpy);
-    xXF86DRIGetDeviceInfoReply rep;
-    xXF86DRIGetDeviceInfoReq *req;
-
-    TRACE("GetDeviceInfo...");
-    XF86DRICheckExtension(dpy, info, False);
-
-    LockDisplay(dpy);
-    GetReq(XF86DRIGetDeviceInfo, req);
-    req->reqType = info->codes->major_opcode;
-    req->driReqType = X_XF86DRIGetDeviceInfo;
-    req->screen = screen;
-    if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
-        UnlockDisplay(dpy);
-        SyncHandle();
-        TRACE("GetDeviceInfo... return False");
-        return False;
-    }
-
-    *hFrameBuffer = rep.hFrameBufferLow;
-    if (sizeof(drm_handle_t) == 8) {
-        int shift = 32;         /* var to prevent warning on next line */
-
-        *hFrameBuffer |= ((drm_handle_t) rep.hFrameBufferHigh) << shift;
-    }
-
-    *fbOrigin = rep.framebufferOrigin;
-    *fbSize = rep.framebufferSize;
-    *fbStride = rep.framebufferStride;
-    *devPrivateSize = rep.devPrivateSize;
-
-    if (rep.length) {
-        if (!(*pDevPrivate = (void *) calloc(rep.devPrivateSize, 1))) {
-            _XEatData(dpy, ((rep.devPrivateSize + 3) & ~3));
-            UnlockDisplay(dpy);
-            SyncHandle();
-            TRACE("GetDeviceInfo... return False");
-            return False;
-        }
-        _XRead(dpy, (char *) *pDevPrivate, rep.devPrivateSize);
-    }
-    else {
-        *pDevPrivate = NULL;
-    }
-
-    UnlockDisplay(dpy);
-    SyncHandle();
-    TRACE("GetDeviceInfo... return True");
-    return True;
-}
-
-Bool
-XF86DRIOpenFullScreen(Display * dpy, int screen, Drawable drawable)
-{
-    /* This function and the underlying X protocol are deprecated.
-     */
-    (void) dpy;
-    (void) screen;
-    (void) drawable;
-    return False;
-}
-
-Bool
-XF86DRICloseFullScreen(Display * dpy, int screen, Drawable drawable)
-{
-    /* This function and the underlying X protocol are deprecated.
-     */
-    (void) dpy;
-    (void) screen;
-    (void) drawable;
-    return True;
-}
index e6520d0..def50d8 100644 (file)
 #ifdef HAVE_CONFIG_H
 #include <kdrive-config.h>
 #endif
+
+#include <xcb/xcb_keysyms.h>
+#include <X11/keysym.h>
+
 #include "ephyr.h"
 
 #include "inputstr.h"
 #include "ephyrlog.h"
 
 #ifdef XF86DRI
+#include <xcb/xf86dri.h>
 #include "ephyrdri.h"
 #include "ephyrdriext.h"
 #include "ephyrglxext.h"
 #endif                          /* XF86DRI */
 
+#ifdef GLAMOR
+#include "glamor.h"
+#endif
+#include "ephyr_glamor_glx.h"
+
 #include "xkbsrv.h"
 
 extern int KdTsPhyScreen;
+extern Bool ephyr_glamor;
 
 KdKeyboardInfo *ephyrKbd;
 KdPointerInfo *ephyrMouse;
@@ -56,6 +67,17 @@ typedef struct _EphyrInputPrivate {
 } EphyrKbdPrivate, EphyrPointerPrivate;
 
 Bool EphyrWantGrayScale = 0;
+Bool EphyrWantResize = 0;
+
+Bool
+host_has_extension(xcb_extension_t *extension)
+{
+    const xcb_query_extension_reply_t *rep;
+
+    rep = xcb_get_extension_data(hostx_get_xcbconn(), extension);
+
+    return rep && rep->present;
+}
 
 Bool
 ephyrInitialize(KdCardInfo * card, EphyrPriv * priv)
@@ -86,8 +108,9 @@ ephyrCardInit(KdCardInfo * card)
 }
 
 Bool
-ephyrScreenInitialize(KdScreenInfo * screen, EphyrScrPriv * scrpriv)
+ephyrScreenInitialize(KdScreenInfo *screen)
 {
+    EphyrScrPriv *scrpriv = screen->driver;
     int width = 640, height = 480;
     CARD32 redMask, greenMask, blueMask;
 
@@ -104,7 +127,7 @@ ephyrScreenInitialize(KdScreenInfo * screen, EphyrScrPriv * scrpriv)
         if (screen->fb.depth < hostx_get_depth()
             && (screen->fb.depth == 24 || screen->fb.depth == 16
                 || screen->fb.depth == 8)) {
-            hostx_set_server_depth(screen, screen->fb.depth);
+            scrpriv->server_depth = screen->fb.depth;
         }
         else
             ErrorF
@@ -167,27 +190,6 @@ ephyrScreenInitialize(KdScreenInfo * screen, EphyrScrPriv * scrpriv)
     return ephyrMapFramebuffer(screen);
 }
 
-Bool
-ephyrScreenInit(KdScreenInfo * screen)
-{
-    EphyrScrPriv *scrpriv;
-
-    scrpriv = calloc(1, sizeof(EphyrScrPriv));
-
-    if (!scrpriv)
-        return FALSE;
-
-    screen->driver = scrpriv;
-
-    if (!ephyrScreenInitialize(screen, scrpriv)) {
-        screen->driver = 0;
-        free(scrpriv);
-        return FALSE;
-    }
-
-    return TRUE;
-}
-
 void *
 ephyrWindowLinear(ScreenPtr pScreen,
                   CARD32 row,
@@ -237,13 +239,11 @@ ephyrMapFramebuffer(KdScreenInfo * screen)
     KdComputePointerMatrix(&m, ephyrRandr, screen->width, screen->height);
     KdSetPointerMatrix(&m);
 
-    priv->bytes_per_line =
-        ((screen->width * screen->fb.bitsPerPixel + 31) >> 5) << 2;
-
     buffer_height = ephyrBufferHeight(screen);
 
     priv->base =
-        hostx_screen_init(screen, screen->width, screen->height, buffer_height);
+        hostx_screen_init(screen, screen->width, screen->height, buffer_height,
+                          &priv->bytes_per_line, &screen->fb.bitsPerPixel);
 
     if ((scrpriv->randr & RR_Rotate_0) && !(scrpriv->randr & RR_Reflect_All)) {
         scrpriv->shadow = FALSE;
@@ -332,22 +332,26 @@ ephyrInternalDamageRedisplay(ScreenPtr pScreen)
         int nbox;
         BoxPtr pbox;
 
-        nbox = RegionNumRects(pRegion);
-        pbox = RegionRects(pRegion);
-
-        while (nbox--) {
-            hostx_paint_rect(screen,
-                             pbox->x1, pbox->y1,
-                             pbox->x1, pbox->y1,
-                             pbox->x2 - pbox->x1, pbox->y2 - pbox->y1);
-            pbox++;
+        if (ephyr_glamor) {
+            ephyr_glamor_damage_redisplay(scrpriv->glamor, pRegion);
+        } else {
+            nbox = RegionNumRects(pRegion);
+            pbox = RegionRects(pRegion);
+
+            while (nbox--) {
+                hostx_paint_rect(screen,
+                                 pbox->x1, pbox->y1,
+                                 pbox->x1, pbox->y1,
+                                 pbox->x2 - pbox->x1, pbox->y2 - pbox->y1);
+                pbox++;
+            }
         }
         DamageEmpty(scrpriv->pDamage);
     }
 }
 
 static void
-ephyrInternalDamageBlockHandler(pointer data, OSTimePtr pTimeout, pointer pRead)
+ephyrInternalDamageBlockHandler(void *data, OSTimePtr pTimeout, void *pRead)
 {
     ScreenPtr pScreen = (ScreenPtr) data;
 
@@ -355,7 +359,7 @@ ephyrInternalDamageBlockHandler(pointer data, OSTimePtr pTimeout, pointer pRead)
 }
 
 static void
-ephyrInternalDamageWakeupHandler(pointer data, int i, pointer LastSelectMask)
+ephyrInternalDamageWakeupHandler(void *data, int i, void *LastSelectMask)
 {
     /* FIXME: Not needed ? */
 }
@@ -374,7 +378,7 @@ ephyrSetInternalDamage(ScreenPtr pScreen)
 
     if (!RegisterBlockAndWakeupHandlers(ephyrInternalDamageBlockHandler,
                                         ephyrInternalDamageWakeupHandler,
-                                        (pointer) pScreen))
+                                        (void *) pScreen))
         return FALSE;
 
     pPixmap = (*pScreen->GetScreenPixmap) (pScreen);
@@ -390,15 +394,12 @@ ephyrUnsetInternalDamage(ScreenPtr pScreen)
     KdScreenPriv(pScreen);
     KdScreenInfo *screen = pScreenPriv->screen;
     EphyrScrPriv *scrpriv = screen->driver;
-    PixmapPtr pPixmap = NULL;
 
-    pPixmap = (*pScreen->GetScreenPixmap) (pScreen);
-    DamageUnregister(&pPixmap->drawable, scrpriv->pDamage);
     DamageDestroy(scrpriv->pDamage);
 
     RemoveBlockAndWakeupHandlers(ephyrInternalDamageBlockHandler,
                                  ephyrInternalDamageWakeupHandler,
-                                 (pointer) pScreen);
+                                 (void *) pScreen);
 }
 
 #ifdef RANDR
@@ -658,7 +659,7 @@ ephyrInitScreen(ScreenPtr pScreen)
     }
 #endif /*XV*/
 #ifdef XF86DRI
-    if (!ephyrNoDRI && !hostx_has_dri()) {
+    if (!ephyrNoDRI && !host_has_extension(&xcb_xf86dri_id)) {
         EPHYR_LOG("host x does not support DRI. Disabling DRI forwarding\n");
         ephyrNoDRI = TRUE;
     }
@@ -671,6 +672,7 @@ ephyrInitScreen(ScreenPtr pScreen)
     return TRUE;
 }
 
+
 Bool
 ephyrFinishInitScreen(ScreenPtr pScreen)
 {
@@ -688,6 +690,12 @@ ephyrFinishInitScreen(ScreenPtr pScreen)
     return TRUE;
 }
 
+/**
+ * Called by kdrive after calling down the
+ * pScreen->CreateScreenResources() chain, this gives us a chance to
+ * make any pixmaps after the screen and all extensions have been
+ * initialized.
+ */
 Bool
 ephyrCreateResources(ScreenPtr pScreen)
 {
@@ -702,8 +710,13 @@ ephyrCreateResources(ScreenPtr pScreen)
         return KdShadowSet(pScreen,
                            scrpriv->randr,
                            ephyrShadowUpdate, ephyrWindowLinear);
-    else
+    else {
+#ifdef GLAMOR
+        if (ephyr_glamor)
+            ephyr_glamor_create_screen_resources(pScreen);
+#endif
         return ephyrSetInternalDamage(pScreen);
+    }
 }
 
 void
@@ -741,8 +754,6 @@ ephyrScreenFini(KdScreenInfo * screen)
     if (scrpriv->shadow) {
         KdShadowFbFree(screen);
     }
-    free(screen->driver);
-    screen->driver = NULL;
 }
 
 /*  
@@ -808,13 +819,13 @@ ephyrCrossScreen(ScreenPtr pScreen, Bool entering)
 {
 }
 
-int ephyrCurScreen;             /*current event screen */
+ScreenPtr ephyrCursorScreen; /* screen containing the cursor */
 
 static void
 ephyrWarpCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
 {
     OsBlockSIGIO();
-    ephyrCurScreen = pScreen->myNum;
+    ephyrCursorScreen = pScreen;
     miPointerWarpCursor(inputInfo.pointer, pScreen, x, y);
 
     OsReleaseSIGIO();
@@ -824,8 +835,6 @@ miPointerScreenFuncRec ephyrPointerScreenFuncs = {
     ephyrCursorOffScreen,
     ephyrCrossScreen,
     ephyrWarpCursor,
-    NULL,
-    NULL
 };
 
 #ifdef XF86DRI
@@ -862,123 +871,362 @@ ephyrExposePairedWindow(int a_remote)
 }
 #endif                          /* XF86DRI */
 
-void
-ephyrPoll(void)
+static KdScreenInfo *
+screen_from_window(Window w)
 {
-    EphyrHostXEvent ev;
-
-    while (hostx_get_event(&ev)) {
-        switch (ev.type) {
-        case EPHYR_EV_MOUSE_MOTION:
-            if (!ephyrMouse ||
-                !((EphyrPointerPrivate *) ephyrMouse->driverPrivate)->enabled) {
-                EPHYR_LOG("skipping mouse motion:%d\n", ephyrCurScreen);
-                continue;
-            }
-            {
-                if (ev.data.mouse_motion.screen >= 0
-                    && (ephyrCurScreen != ev.data.mouse_motion.screen)) {
-                    EPHYR_LOG("warping mouse cursor. "
-                              "cur_screen%d, motion_screen:%d\n",
-                              ephyrCurScreen, ev.data.mouse_motion.screen);
-                    if (ev.data.mouse_motion.screen >= 0) {
-                        ephyrWarpCursor
-                            (inputInfo.pointer,
-                             screenInfo.screens[ev.data.mouse_motion.screen],
-                             ev.data.mouse_motion.x, ev.data.mouse_motion.y);
-                    }
-                }
-                else {
-                    int x = 0, y = 0;
+    int i = 0;
+
+    for (i = 0; i < screenInfo.numScreens; i++) {
+        ScreenPtr pScreen = screenInfo.screens[i];
+        KdPrivScreenPtr kdscrpriv = KdGetScreenPriv(pScreen);
+        KdScreenInfo *screen = kdscrpriv->screen;
+        EphyrScrPriv *scrpriv = screen->driver;
+
+        if (scrpriv->win == w
+            || scrpriv->peer_win == w
+            || scrpriv->win_pre_existing == w) {
+            return screen;
+        }
+    }
+
+    return NULL;
+}
+
+static void
+ephyrProcessErrorEvent(xcb_generic_event_t *xev)
+{
+    xcb_generic_error_t *e = (xcb_generic_error_t *)xev;
+
+    FatalError("X11 error\n"
+               "Error code: %hhu\n"
+               "Sequence number: %hu\n"
+               "Major code: %hhu\tMinor code: %hu\n"
+               "Error value: %u\n",
+               e->error_code,
+               e->sequence,
+               e->major_code, e->minor_code,
+               e->resource_id);
+}
+
+static void
+ephyrProcessExpose(xcb_generic_event_t *xev)
+{
+    xcb_expose_event_t *expose = (xcb_expose_event_t *)xev;
+    KdScreenInfo *screen = screen_from_window(expose->window);
+    EphyrScrPriv *scrpriv = screen->driver;
+
+    /* Wait for the last expose event in a series of cliprects
+     * to actually paint our screen.
+     */
+    if (expose->count != 0)
+        return;
 
+    if (scrpriv) {
+        hostx_paint_rect(scrpriv->screen, 0, 0, 0, 0,
+                         scrpriv->win_width,
+                         scrpriv->win_height);
+    } else {
+        EPHYR_LOG_ERROR("failed to get host screen\n");
 #ifdef XF86DRI
-                    EphyrWindowPair *pair = NULL;
+        /*
+         * We only receive expose events when the expose event
+         * have be generated for a drawable that is a host X
+         * window managed by Xephyr. Host X windows managed by
+         * Xephyr exists for instance when Xephyr is asked to
+         * create a GL drawable in a DRI environment.
+         */
+        ephyrExposePairedWindow(expose->window);
+#endif                          /* XF86DRI */
+    }
+}
+
+static void
+ephyrProcessMouseMotion(xcb_generic_event_t *xev)
+{
+    xcb_motion_notify_event_t *motion = (xcb_motion_notify_event_t *)xev;
+    KdScreenInfo *screen = screen_from_window(motion->event);
+
+    if (!ephyrMouse ||
+        !((EphyrPointerPrivate *) ephyrMouse->driverPrivate)->enabled) {
+        EPHYR_LOG("skipping mouse motion:%d\n", screen->pScreen->myNum);
+        return;
+    }
+
+    if (ephyrCursorScreen != screen->pScreen) {
+        EPHYR_LOG("warping mouse cursor. "
+                  "cur_screen%d, motion_screen:%d\n",
+                  ephyrCursorScreen, screen->pScreen->myNum);
+        ephyrWarpCursor(inputInfo.pointer, screen->pScreen,
+                        motion->event_x, motion->event_y);
+    }
+    else {
+        int x = 0, y = 0;
+
+#ifdef XF86DRI
+        EphyrWindowPair *pair = NULL;
 #endif
-                    EPHYR_LOG("enqueuing mouse motion:%d\n", ephyrCurScreen);
-                    x = ev.data.mouse_motion.x;
-                    y = ev.data.mouse_motion.y;
-                    EPHYR_LOG("initial (x,y):(%d,%d)\n", x, y);
+        EPHYR_LOG("enqueuing mouse motion:%d\n", screen->pScreen->myNum);
+        x = motion->event_x;
+        y = motion->event_y;
+        EPHYR_LOG("initial (x,y):(%d,%d)\n", x, y);
 #ifdef XF86DRI
-                    EPHYR_LOG("is this window peered by a gl drawable ?\n");
-                    if (findWindowPairFromRemote(ev.data.mouse_motion.window,
-                                                 &pair)) {
-                        EPHYR_LOG("yes, it is peered\n");
-                        x += pair->local->drawable.x;
-                        y += pair->local->drawable.y;
-                    }
-                    else {
-                        EPHYR_LOG("no, it is not peered\n");
-                    }
-                    EPHYR_LOG("final (x,y):(%d,%d)\n", x, y);
+        EPHYR_LOG("is this window peered by a gl drawable ?\n");
+        if (findWindowPairFromRemote(motion->event, &pair)) {
+            EPHYR_LOG("yes, it is peered\n");
+            x += pair->local->drawable.x;
+            y += pair->local->drawable.y;
+        }
+        else {
+            EPHYR_LOG("no, it is not peered\n");
+        }
+        EPHYR_LOG("final (x,y):(%d,%d)\n", x, y);
 #endif
-                    KdEnqueuePointerEvent(ephyrMouse, mouseState, x, y, 0);
+
+        /* convert coords into desktop-wide coordinates.
+         * fill_pointer_events will convert that back to
+         * per-screen coordinates where needed */
+        x += screen->pScreen->x;
+        y += screen->pScreen->y;
+
+        KdEnqueuePointerEvent(ephyrMouse, mouseState | KD_POINTER_DESKTOP, x, y, 0);
+    }
+}
+
+static void
+ephyrProcessButtonPress(xcb_generic_event_t *xev)
+{
+    xcb_button_press_event_t *button = (xcb_button_press_event_t *)xev;
+
+    if (!ephyrMouse ||
+        !((EphyrPointerPrivate *) ephyrMouse->driverPrivate)->enabled) {
+        EPHYR_LOG("skipping mouse press:%d\n", screen_from_window(button->event)->pScreen->myNum);
+        return;
+    }
+
+    ephyrUpdateModifierState(button->state);
+    /* This is a bit hacky. will break for button 5 ( defined as 0x10 )
+     * Check KD_BUTTON defines in kdrive.h
+     */
+    mouseState |= 1 << (button->detail - 1);
+
+    EPHYR_LOG("enqueuing mouse press:%d\n", screen_from_window(button->event)->pScreen->myNum);
+    KdEnqueuePointerEvent(ephyrMouse, mouseState | KD_MOUSE_DELTA, 0, 0, 0);
+}
+
+static void
+ephyrProcessButtonRelease(xcb_generic_event_t *xev)
+{
+    xcb_button_press_event_t *button = (xcb_button_press_event_t *)xev;
+
+    if (!ephyrMouse ||
+        !((EphyrPointerPrivate *) ephyrMouse->driverPrivate)->enabled) {
+        return;
+    }
+
+    ephyrUpdateModifierState(button->state);
+    mouseState &= ~(1 << (button->detail - 1));
+
+    EPHYR_LOG("enqueuing mouse release:%d\n", screen_from_window(button->event)->pScreen->myNum);
+    KdEnqueuePointerEvent(ephyrMouse, mouseState | KD_MOUSE_DELTA, 0, 0, 0);
+}
+
+/* Xephyr wants ctrl+shift to grab the window, but that conflicts with
+   ctrl+alt+shift key combos. Remember the modifier state on key presses and
+   releases, if mod1 is pressed, we need ctrl, shift and mod1 released
+   before we allow a shift-ctrl grab activation.
+
+   note: a key event contains the mask _before_ the current key takes
+   effect, so mod1_was_down will be reset on the first key press after all
+   three were released, not on the last release. That'd require some more
+   effort.
+ */
+static int
+ephyrUpdateGrabModifierState(int state)
+{
+    static int mod1_was_down = 0;
+
+    if ((state & (XCB_MOD_MASK_CONTROL|XCB_MOD_MASK_SHIFT|XCB_MOD_MASK_1)) == 0)
+        mod1_was_down = 0;
+    else if (state & XCB_MOD_MASK_1)
+        mod1_was_down = 1;
+
+    return mod1_was_down;
+}
+
+static void
+ephyrProcessKeyPress(xcb_generic_event_t *xev)
+{
+    xcb_key_press_event_t *key = (xcb_key_press_event_t *)xev;
+
+    if (!ephyrKbd ||
+        !((EphyrKbdPrivate *) ephyrKbd->driverPrivate)->enabled) {
+        return;
+    }
+
+    ephyrUpdateGrabModifierState(key->state);
+    ephyrUpdateModifierState(key->state);
+    KdEnqueueKeyboardEvent(ephyrKbd, key->detail, FALSE);
+}
+
+static void
+ephyrProcessKeyRelease(xcb_generic_event_t *xev)
+{
+    xcb_connection_t *conn = hostx_get_xcbconn();
+    xcb_key_release_event_t *key = (xcb_key_release_event_t *)xev;
+    static xcb_key_symbols_t *keysyms;
+    static int grabbed_screen = -1;
+    int mod1_down = ephyrUpdateGrabModifierState(key->state);
+
+    if (!keysyms)
+        keysyms = xcb_key_symbols_alloc(conn);
+
+    if (((xcb_key_symbols_get_keysym(keysyms, key->detail, 0) == XK_Shift_L
+          || xcb_key_symbols_get_keysym(keysyms, key->detail, 0) == XK_Shift_R)
+         && (key->state & XCB_MOD_MASK_CONTROL)) ||
+        ((xcb_key_symbols_get_keysym(keysyms, key->detail, 0) == XK_Control_L
+          || xcb_key_symbols_get_keysym(keysyms, key->detail, 0) == XK_Control_R)
+         && (key->state & XCB_MOD_MASK_SHIFT))) {
+        KdScreenInfo *screen = screen_from_window(key->event);
+        EphyrScrPriv *scrpriv = screen->driver;
+
+        if (grabbed_screen != -1) {
+            xcb_ungrab_keyboard(conn, XCB_TIME_CURRENT_TIME);
+            xcb_ungrab_pointer(conn, XCB_TIME_CURRENT_TIME);
+            grabbed_screen = -1;
+            hostx_set_win_title(screen,
+                                "(ctrl+shift grabs mouse and keyboard)");
+        }
+        else if (!mod1_down) {
+            /* Attempt grab */
+            xcb_grab_keyboard_cookie_t kbgrabc =
+                xcb_grab_keyboard(conn,
+                                  TRUE,
+                                  scrpriv->win,
+                                  XCB_TIME_CURRENT_TIME,
+                                  XCB_GRAB_MODE_ASYNC,
+                                  XCB_GRAB_MODE_ASYNC);
+            xcb_grab_keyboard_reply_t *kbgrabr;
+            xcb_grab_pointer_cookie_t pgrabc =
+                xcb_grab_pointer(conn,
+                                 TRUE,
+                                 scrpriv->win,
+                                 0,
+                                 XCB_GRAB_MODE_ASYNC,
+                                 XCB_GRAB_MODE_ASYNC,
+                                 scrpriv->win,
+                                 XCB_NONE,
+                                 XCB_TIME_CURRENT_TIME);
+            xcb_grab_pointer_reply_t *pgrabr;
+            kbgrabr = xcb_grab_keyboard_reply(conn, kbgrabc, NULL);
+            if (!kbgrabr || kbgrabr->status != XCB_GRAB_STATUS_SUCCESS) {
+                xcb_discard_reply(conn, pgrabc.sequence);
+                xcb_ungrab_pointer(conn, XCB_TIME_CURRENT_TIME);
+            } else {
+                pgrabr = xcb_grab_pointer_reply(conn, pgrabc, NULL);
+                if (!pgrabr || pgrabr->status != XCB_GRAB_STATUS_SUCCESS)
+                    {
+                        xcb_ungrab_keyboard(conn,
+                                            XCB_TIME_CURRENT_TIME);
+                    } else {
+                    grabbed_screen = scrpriv->mynum;
+                    hostx_set_win_title
+                        (screen,
+                         "(ctrl+shift releases mouse and keyboard)");
                 }
             }
-            break;
+        }
+    }
 
-        case EPHYR_EV_MOUSE_PRESS:
-            if (!ephyrMouse ||
-                !((EphyrPointerPrivate *) ephyrMouse->driverPrivate)->enabled) {
-                EPHYR_LOG("skipping mouse press:%d\n", ephyrCurScreen);
-                continue;
+    if (!ephyrKbd ||
+        !((EphyrKbdPrivate *) ephyrKbd->driverPrivate)->enabled) {
+        return;
+    }
+
+    /* Still send the release event even if above has happened server
+     * will get confused with just an up event.  Maybe it would be
+     * better to just block shift+ctrls getting to kdrive all
+     * together.
+     */
+    ephyrUpdateModifierState(key->state);
+    KdEnqueueKeyboardEvent(ephyrKbd, key->detail, TRUE);
+}
+
+static void
+ephyrProcessConfigureNotify(xcb_generic_event_t *xev)
+{
+    xcb_configure_notify_event_t *configure =
+        (xcb_configure_notify_event_t *)xev;
+    KdScreenInfo *screen = screen_from_window(configure->window);
+    EphyrScrPriv *scrpriv = screen->driver;
+
+    if (!scrpriv ||
+        (scrpriv->win_pre_existing == None && !EphyrWantResize)) {
+        return;
+    }
+
+#ifdef RANDR
+    ephyrResizeScreen(screen->pScreen, configure->width, configure->height);
+#endif /* RANDR */
+}
+
+void
+ephyrPoll(void)
+{
+    xcb_connection_t *conn = hostx_get_xcbconn();
+
+    while (TRUE) {
+        xcb_generic_event_t *xev = xcb_poll_for_event(conn);
+        if (!xev) {
+            /* If our XCB connection has died (for example, our window was
+             * closed), exit now.
+             */
+            if (xcb_connection_has_error(conn)) {
+                CloseWellKnownConnections();
+                OsCleanup(1);
+                exit(1);
             }
-            EPHYR_LOG("enqueuing mouse press:%d\n", ephyrCurScreen);
-            ephyrUpdateModifierState(ev.key_state);
-            mouseState |= ev.data.mouse_down.button_num;
-            KdEnqueuePointerEvent(ephyrMouse, mouseState | KD_MOUSE_DELTA, 0, 0,
-                                  0);
+
             break;
+        }
 
-        case EPHYR_EV_MOUSE_RELEASE:
-            if (!ephyrMouse ||
-                !((EphyrPointerPrivate *) ephyrMouse->driverPrivate)->enabled)
-                continue;
-            ephyrUpdateModifierState(ev.key_state);
-            mouseState &= ~ev.data.mouse_up.button_num;
-            EPHYR_LOG("enqueuing mouse release:%d\n", ephyrCurScreen);
-            KdEnqueuePointerEvent(ephyrMouse, mouseState | KD_MOUSE_DELTA, 0, 0,
-                                  0);
+        switch (xev->response_type & 0x7f) {
+        case 0:
+            ephyrProcessErrorEvent(xev);
             break;
 
-        case EPHYR_EV_KEY_PRESS:
-            if (!ephyrKbd ||
-                !((EphyrKbdPrivate *) ephyrKbd->driverPrivate)->enabled)
-                continue;
-            ephyrUpdateModifierState(ev.key_state);
-            KdEnqueueKeyboardEvent(ephyrKbd, ev.data.key_down.scancode, FALSE);
+        case XCB_EXPOSE:
+            ephyrProcessExpose(xev);
             break;
 
-        case EPHYR_EV_KEY_RELEASE:
-            if (!ephyrKbd ||
-                !((EphyrKbdPrivate *) ephyrKbd->driverPrivate)->enabled)
-                continue;
-            ephyrUpdateModifierState(ev.key_state);
-            KdEnqueueKeyboardEvent(ephyrKbd, ev.data.key_up.scancode, TRUE);
+        case XCB_MOTION_NOTIFY:
+            ephyrProcessMouseMotion(xev);
             break;
 
-#ifdef XF86DRI
-        case EPHYR_EV_EXPOSE:
-            /*
-             * We only receive expose events when the expose event have
-             * be generated for a drawable that is a host X window managed
-             * by Xephyr. Host X windows managed by Xephyr exists for instance
-             * when Xephyr is asked to create a GL drawable in a DRI environment.
-             */
-            ephyrExposePairedWindow(ev.data.expose.window);
+        case XCB_KEY_PRESS:
+            ephyrProcessKeyPress(xev);
             break;
-#endif                          /* XF86DRI */
 
-#ifdef RANDR
-        case EPHYR_EV_CONFIGURE:
-            ephyrResizeScreen(screenInfo.screens[ev.data.configure.screen],
-                              ev.data.configure.width,
-                              ev.data.configure.height);
+        case XCB_KEY_RELEASE:
+            ephyrProcessKeyRelease(xev);
             break;
-#endif /* RANDR */
 
-        default:
+        case XCB_BUTTON_PRESS:
+            ephyrProcessButtonPress(xev);
+            break;
+
+        case XCB_BUTTON_RELEASE:
+            ephyrProcessButtonRelease(xev);
+            break;
+
+        case XCB_CONFIGURE_NOTIFY:
+            ephyrProcessConfigureNotify(xev);
             break;
         }
+
+        if (ephyr_glamor)
+            ephyr_glamor_process_event(xev);
+
+        free(xev);
     }
 }
 
@@ -1009,6 +1257,9 @@ ephyrGetColors(ScreenPtr pScreen, int n, xColorItem * pdefs)
 void
 ephyrPutColors(ScreenPtr pScreen, int n, xColorItem * pdefs)
 {
+    KdScreenPriv(pScreen);
+    KdScreenInfo *screen = pScreenPriv->screen;
+    EphyrScrPriv *scrpriv = screen->driver;
     int min, max, p;
 
     /* XXX Not sure if this is right */
@@ -1028,6 +1279,18 @@ ephyrPutColors(ScreenPtr pScreen, int n, xColorItem * pdefs)
                              pdefs->green >> 8, pdefs->blue >> 8);
         pdefs++;
     }
+    if (scrpriv->pDamage) {
+        BoxRec box;
+        RegionRec region;
+
+        box.x1 = 0;
+        box.y1 = 0;
+        box.x2 = pScreen->width;
+        box.y2 = pScreen->height;
+        RegionInit(&region, &box, 1);
+        DamageReportDamage(scrpriv->pDamage, &region);
+        RegionUninit(&region);
+    }
 }
 
 /* Mouse calls */
@@ -1092,7 +1355,7 @@ EphyrKeyboardInit(KdKeyboardInfo * ki)
     ki->driverPrivate = (EphyrKbdPrivate *)
         calloc(sizeof(EphyrKbdPrivate), 1);
     hostx_load_keymap();
-    if (!ephyrKeySyms.map) {
+    if (!ephyrKeySyms.minKeyCode) {
         ErrorF("Couldn't load keymap from host\n");
         return BadAlloc;
     }
index be910c1..34ce460 100644 (file)
@@ -29,6 +29,7 @@
 #include <unistd.h>
 #include <signal.h>
 #include <libgen.h>
+#include <xcb/xcb_image.h>
 
 #include "os.h"                 /* for OsSignal() */
 #include "kdrive.h"
@@ -61,10 +62,30 @@ typedef struct _ephyrFakexaPriv {
 } EphyrFakexaPriv;
 
 typedef struct _ephyrScrPriv {
+    /* ephyr server info */
     Rotation randr;
     Bool shadow;
     DamagePtr pDamage;
     EphyrFakexaPriv *fakexa;
+
+    /* Host X window info */
+    xcb_window_t win;
+    xcb_window_t win_pre_existing;    /* Set via -parent option like xnest */
+    xcb_window_t peer_win;            /* Used for GL; should be at most one */
+    xcb_image_t *ximg;
+    int win_width, win_height;
+    int server_depth;
+    unsigned char *fb_data;     /* only used when host bpp != server bpp */
+    xcb_shm_segment_info_t shminfo;
+
+    KdScreenInfo *screen;
+    int mynum;                  /* Screen number */
+
+    /**
+     * Per-screen Xlib-using state for glamor (private to
+     * ephyr_glamor_glx.c)
+     */
+    struct ephyr_glamor *glamor;
 } EphyrScrPriv;
 
 extern KdCardFuncs ephyrFuncs;
@@ -80,10 +101,7 @@ Bool
  ephyrCardInit(KdCardInfo * card);
 
 Bool
- ephyrScreenInit(KdScreenInfo * screen);
-
-Bool
- ephyrScreenInitialize(KdScreenInfo * screen, EphyrScrPriv * scrpriv);
+ephyrScreenInitialize(KdScreenInfo *screen);
 
 Bool
  ephyrInitScreen(ScreenPtr pScreen);
@@ -191,6 +209,14 @@ void
 void
  ephyrDrawFini(ScreenPtr pScreen);
 
+/* hostx.c glamor support */
+Bool ephyr_glamor_init(ScreenPtr pScreen);
+Bool ephyr_glamor_create_screen_resources(ScreenPtr pScreen);
+void ephyr_glamor_enable(ScreenPtr pScreen);
+void ephyr_glamor_disable(ScreenPtr pScreen);
+void ephyr_glamor_fini(ScreenPtr pScreen);
+void ephyr_glamor_host_paint_rect(ScreenPtr pScreen);
+
 /*ephyvideo.c*/
 
 Bool ephyrInitVideo(ScreenPtr pScreen);
diff --git a/hw/kdrive/ephyr/ephyr_glamor_glx.c b/hw/kdrive/ephyr/ephyr_glamor_glx.c
new file mode 100644 (file)
index 0000000..eaf5654
--- /dev/null
@@ -0,0 +1,346 @@
+/*
+ * Copyright Â© 2013 Intel 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.
+ */
+
+/** @file ephyr_glamor_glx.c
+ *
+ * Separate file for hiding Xlib and GLX-using parts of xephyr from
+ * the rest of the server-struct-aware build.
+ */
+
+#include <stdlib.h>
+#include <X11/Xlib.h>
+#include <X11/Xlibint.h>
+#undef Xcalloc
+#undef Xrealloc
+#undef Xfree
+#include <X11/Xlib-xcb.h>
+#include <xcb/xcb_aux.h>
+#include <pixman.h>
+#include <epoxy/glx.h>
+#include "ephyr_glamor_glx.h"
+#include "os.h"
+#include <X11/Xproto.h>
+
+/** @{
+ *
+ * global state for Xephyr with glamor.
+ *
+ * Xephyr can render with multiple windows, but all the windows have
+ * to be on the same X connection and all have to have the same
+ * visual.
+ */
+static Display *dpy;
+static XVisualInfo *visual_info;
+static GLXFBConfig fb_config;
+/** @} */
+
+/**
+ * Per-screen state for Xephyr with glamor.
+ */
+struct ephyr_glamor {
+    GLXContext ctx;
+    Window win;
+    GLXWindow glx_win;
+
+    GLuint tex;
+
+    GLuint texture_shader;
+    GLuint texture_shader_position_loc;
+    GLuint texture_shader_texcoord_loc;
+
+    /* Size of the window that we're rendering to. */
+    unsigned width, height;
+};
+
+static GLint
+ephyr_glamor_compile_glsl_prog(GLenum type, const char *source)
+{
+    GLint ok;
+    GLint prog;
+
+    prog = glCreateShader(type);
+    glShaderSource(prog, 1, (const GLchar **) &source, NULL);
+    glCompileShader(prog);
+    glGetShaderiv(prog, GL_COMPILE_STATUS, &ok);
+    if (!ok) {
+        GLchar *info;
+        GLint size;
+
+        glGetShaderiv(prog, GL_INFO_LOG_LENGTH, &size);
+        info = malloc(size);
+        if (info) {
+            glGetShaderInfoLog(prog, size, NULL, info);
+            ErrorF("Failed to compile %s: %s\n",
+                   type == GL_FRAGMENT_SHADER ? "FS" : "VS", info);
+            ErrorF("Program source:\n%s", source);
+            free(info);
+        }
+        else
+            ErrorF("Failed to get shader compilation info.\n");
+        FatalError("GLSL compile failure\n");
+    }
+
+    return prog;
+}
+
+static GLuint
+ephyr_glamor_build_glsl_prog(GLuint vs, GLuint fs)
+{
+    GLint ok;
+    GLuint prog;
+
+    prog = glCreateProgram();
+    glAttachShader(prog, vs);
+    glAttachShader(prog, fs);
+
+    glLinkProgram(prog);
+    glGetProgramiv(prog, GL_LINK_STATUS, &ok);
+    if (!ok) {
+        GLchar *info;
+        GLint size;
+
+        glGetProgramiv(prog, GL_INFO_LOG_LENGTH, &size);
+        info = malloc(size);
+
+        glGetProgramInfoLog(prog, size, NULL, info);
+        ErrorF("Failed to link: %s\n", info);
+        FatalError("GLSL link failure\n");
+    }
+
+    return prog;
+}
+
+static void
+ephyr_glamor_setup_texturing_shader(struct ephyr_glamor *glamor)
+{
+    const char *vs_source =
+        "attribute vec2 texcoord;\n"
+        "attribute vec2 position;\n"
+        "varying vec2 t;\n"
+        "\n"
+        "void main()\n"
+        "{\n"
+        "    t = texcoord;\n"
+        "    gl_Position = vec4(position, 0, 1);\n"
+        "}\n";
+
+    const char *fs_source =
+        "varying vec2 t;\n"
+        "uniform sampler2D s; /* initially 0 */\n"
+        "\n"
+        "void main()\n"
+        "{\n"
+        "    gl_FragColor = texture2D(s, t);\n"
+        "}\n";
+
+    GLuint fs, vs, prog;
+
+    vs = ephyr_glamor_compile_glsl_prog(GL_VERTEX_SHADER, vs_source);
+    fs = ephyr_glamor_compile_glsl_prog(GL_FRAGMENT_SHADER, fs_source);
+    prog = ephyr_glamor_build_glsl_prog(vs, fs);
+
+    glamor->texture_shader = prog;
+    glamor->texture_shader_position_loc = glGetAttribLocation(prog, "position");
+    assert(glamor->texture_shader_position_loc != -1);
+    glamor->texture_shader_texcoord_loc = glGetAttribLocation(prog, "texcoord");
+    assert(glamor->texture_shader_texcoord_loc != -1);
+}
+
+xcb_connection_t *
+ephyr_glamor_connect(void)
+{
+    dpy = XOpenDisplay(NULL);
+    if (!dpy)
+        return NULL;
+
+    XSetEventQueueOwner(dpy, XCBOwnsEventQueue);
+
+    return XGetXCBConnection(dpy);
+}
+
+void
+ephyr_glamor_set_texture(struct ephyr_glamor *glamor, uint32_t tex)
+{
+    glamor->tex = tex;
+}
+
+void
+ephyr_glamor_damage_redisplay(struct ephyr_glamor *glamor,
+                              struct pixman_region16 *damage)
+{
+    /* Redraw the whole screen, since glXSwapBuffers leaves the back
+     * buffer undefined.
+     */
+    static const float position[] = {
+        -1, -1,
+         1, -1,
+         1,  1,
+        -1,  1,
+    };
+    static const float texcoords[] = {
+        0, 1,
+        1, 1,
+        1, 0,
+        0, 0,
+    };
+
+    glXMakeCurrent(dpy, glamor->glx_win, glamor->ctx);
+
+    glBindFramebuffer(GL_FRAMEBUFFER, 0);
+    glUseProgram(glamor->texture_shader);
+    glViewport(0, 0, glamor->width, glamor->height);
+
+    glVertexAttribPointer(glamor->texture_shader_position_loc,
+                          2, GL_FLOAT, FALSE, 0, position);
+    glVertexAttribPointer(glamor->texture_shader_texcoord_loc,
+                          2, GL_FLOAT, FALSE, 0, texcoords);
+    glEnableVertexAttribArray(glamor->texture_shader_position_loc);
+    glEnableVertexAttribArray(glamor->texture_shader_texcoord_loc);
+
+    glActiveTexture(GL_TEXTURE0);
+    glBindTexture(GL_TEXTURE_2D, glamor->tex);
+    glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
+
+    glDisableVertexAttribArray(glamor->texture_shader_position_loc);
+    glDisableVertexAttribArray(glamor->texture_shader_texcoord_loc);
+
+    glXSwapBuffers(dpy, glamor->glx_win);
+}
+
+/**
+ * Xlib-based handling of xcb events for glamor.
+ *
+ * We need to let the Xlib event filtering run on the event so that
+ * Mesa's dri2_glx.c userspace event mangling gets run, and we
+ * correctly get our invalidate events propagated into the driver.
+ */
+void
+ephyr_glamor_process_event(xcb_generic_event_t *xev)
+{
+
+    uint32_t response_type = xev->response_type & 0x7f;
+    /* Note the types on wire_to_event: there's an Xlib XEvent (with
+     * the broken types) that it returns, and a protocol xEvent that
+     * it inspects.
+     */
+    Bool (*wire_to_event)(Display *dpy, XEvent *ret, xEvent *event);
+
+    XLockDisplay(dpy);
+    /* Set the event handler to NULL to get access to the current one. */
+    wire_to_event = XESetWireToEvent(dpy, response_type, NULL);
+    if (wire_to_event) {
+        XEvent processed_event;
+
+        /* OK they had an event handler.  Plug it back in, and call
+         * through to it.
+         */
+        XESetWireToEvent(dpy, response_type, wire_to_event);
+        xev->sequence = LastKnownRequestProcessed(dpy);
+        wire_to_event(dpy, &processed_event, (xEvent *)xev);
+    }
+    XUnlockDisplay(dpy);
+}
+
+struct ephyr_glamor *
+ephyr_glamor_glx_screen_init(xcb_window_t win)
+{
+    GLXContext ctx;
+    struct ephyr_glamor *glamor;
+    GLXWindow glx_win;
+
+    glamor = calloc(1, sizeof(struct ephyr_glamor));
+    if (!glamor) {
+        FatalError("malloc");
+        return NULL;
+    }
+
+    glx_win = glXCreateWindow(dpy, fb_config, win, NULL);
+
+    ctx = glXCreateContext(dpy, visual_info, NULL, True);
+    if (ctx == NULL)
+        FatalError("glXCreateContext failed\n");
+
+    if (!glXMakeCurrent(dpy, glx_win, ctx))
+        FatalError("glXMakeCurrent failed\n");
+
+    glamor->ctx = ctx;
+    glamor->win = win;
+    glamor->glx_win = glx_win;
+    ephyr_glamor_setup_texturing_shader(glamor);
+
+    return glamor;
+}
+
+void
+ephyr_glamor_glx_screen_fini(struct ephyr_glamor *glamor)
+{
+    glXMakeCurrent(dpy, None, NULL);
+    glXDestroyContext(dpy, glamor->ctx);
+    glXDestroyWindow(dpy, glamor->glx_win);
+
+    free(glamor);
+}
+
+xcb_visualtype_t *
+ephyr_glamor_get_visual(void)
+{
+    xcb_screen_t *xscreen =
+        xcb_aux_get_screen(XGetXCBConnection(dpy), DefaultScreen(dpy));
+    int attribs[] = {
+        GLX_RENDER_TYPE, GLX_RGBA_BIT,
+        GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT,
+        GLX_RED_SIZE, 1,
+        GLX_GREEN_SIZE, 1,
+        GLX_BLUE_SIZE, 1,
+        GLX_DOUBLEBUFFER, 1,
+        None
+    };
+    int event_base = 0, error_base = 0, nelements;
+    GLXFBConfig *fbconfigs;
+
+    if (!glXQueryExtension (dpy, &error_base, &event_base))
+        FatalError("Couldn't find GLX extension\n");
+
+    fbconfigs = glXChooseFBConfig(dpy, DefaultScreen(dpy), attribs, &nelements);
+    if (!nelements)
+        FatalError("Couldn't choose an FBConfig\n");
+    fb_config = fbconfigs[0];
+    free(fbconfigs);
+
+    visual_info = glXGetVisualFromFBConfig(dpy, fb_config);
+    if (visual_info == NULL)
+        FatalError("Couldn't get RGB visual\n");
+
+    return xcb_aux_find_visual_by_id(xscreen, visual_info->visualid);
+}
+
+void
+ephyr_glamor_set_window_size(struct ephyr_glamor *glamor,
+                             unsigned width, unsigned height)
+{
+    if (!glamor)
+        return;
+
+    glamor->width = width;
+    glamor->height = height;
+}
diff --git a/hw/kdrive/ephyr/ephyr_glamor_glx.h b/hw/kdrive/ephyr/ephyr_glamor_glx.h
new file mode 100644 (file)
index 0000000..0c238cf
--- /dev/null
@@ -0,0 +1,83 @@
+/*
+ * Copyright Â© 2013 Intel 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.
+ */
+
+/**
+ * ephyr_glamor_glx.h
+ *
+ * Prototypes exposed by ephyr_glamor_glx.c, without including any
+ * server headers.
+ */
+
+#include <xcb/xcb.h>
+#include "dix-config.h"
+
+struct ephyr_glamor;
+struct pixman_region16;
+
+xcb_connection_t *
+ephyr_glamor_connect(void);
+
+void
+ephyr_glamor_set_texture(struct ephyr_glamor *ephyr_glamor, uint32_t tex);
+
+xcb_visualtype_t *
+ephyr_glamor_get_visual(void);
+
+struct ephyr_glamor *
+ephyr_glamor_glx_screen_init(xcb_window_t win);
+
+void
+ephyr_glamor_glx_screen_fini(struct ephyr_glamor *glamor);
+
+#ifdef GLAMOR
+void
+ephyr_glamor_set_window_size(struct ephyr_glamor *glamor,
+                             unsigned width, unsigned height);
+
+void
+ephyr_glamor_damage_redisplay(struct ephyr_glamor *glamor,
+                              struct pixman_region16 *damage);
+
+void
+ephyr_glamor_process_event(xcb_generic_event_t *xev);
+
+#else /* !GLAMOR */
+
+static inline void
+ephyr_glamor_set_window_size(struct ephyr_glamor *glamor,
+                             unsigned width, unsigned height)
+{
+}
+
+static inline void
+ephyr_glamor_damage_redisplay(struct ephyr_glamor *glamor,
+                              struct pixman_region16 *damage)
+{
+}
+
+static inline void
+ephyr_glamor_process_event(xcb_generic_event_t *xev)
+{
+}
+
+#endif /* !GLAMOR */
index 5055436..16678fc 100644 (file)
 #include <kdrive-config.h>
 #endif
 
-#include <X11/Xutil.h>
-#include <X11/Xlibint.h>
-#include <GL/glx.h>
-#include "xf86dri.h"
+#include <X11/Xdefs.h>
+#include <xcb/xf86dri.h>
 #include "hostx.h"
 #include "ephyrdri.h"
 #define _HAVE_XALLOC_DECLS
     Bool
 ephyrDRIQueryDirectRenderingCapable(int a_screen, Bool *a_is_capable)
 {
-    Display *dpy = hostx_get_display();
+    xcb_connection_t *conn = hostx_get_xcbconn();
     Bool is_ok = FALSE;
+    xcb_xf86dri_query_direct_rendering_capable_cookie_t cookie;
+    xcb_xf86dri_query_direct_rendering_capable_reply_t *reply;
 
     EPHYR_RETURN_VAL_IF_FAIL(a_is_capable, FALSE);
     EPHYR_LOG("enter\n");
-    is_ok = XF86DRIQueryDirectRenderingCapable(dpy, DefaultScreen(dpy),
-                                               a_is_capable);
+    cookie = xcb_xf86dri_query_direct_rendering_capable(conn,
+                                                        hostx_get_screen());
+    reply = xcb_xf86dri_query_direct_rendering_capable_reply(conn, cookie, NULL);
+    if (reply) {
+        is_ok = TRUE;
+        *a_is_capable = reply->is_capable;
+        free(reply);
+    }
     EPHYR_LOG("leave. is_capable:%d, is_ok=%d\n", *a_is_capable, is_ok);
 
     return is_ok;
@@ -65,31 +71,48 @@ Bool
 ephyrDRIOpenConnection(int a_screen,
                        drm_handle_t * a_sarea, char **a_bus_id_string)
 {
-    Display *dpy = hostx_get_display();
+    xcb_connection_t *conn = hostx_get_xcbconn();
     Bool is_ok = FALSE;
+    xcb_xf86dri_open_connection_cookie_t cookie;
+    xcb_xf86dri_open_connection_reply_t *reply;
 
     EPHYR_RETURN_VAL_IF_FAIL(a_bus_id_string, FALSE);
     EPHYR_LOG("enter. screen:%d\n", a_screen);
-    is_ok = XF86DRIOpenConnection(dpy, DefaultScreen(dpy),
-                                  a_sarea, a_bus_id_string);
-    if (*a_bus_id_string) {
-        EPHYR_LOG("leave. bus_id_string:%s, is_ok:%d\n",
-                  *a_bus_id_string, is_ok);
-    }
-    else {
-        EPHYR_LOG("leave. bus_id_string:null, is_ok:%d\n", is_ok);
+    cookie = xcb_xf86dri_open_connection(conn, hostx_get_screen());
+    reply = xcb_xf86dri_open_connection_reply(conn, cookie, NULL);
+    if (!reply)
+        goto out;
+    *a_sarea = reply->sarea_handle_low;
+    if (sizeof(drm_handle_t) == 8) {
+        int shift = 32;
+        *a_sarea |= ((drm_handle_t) reply->sarea_handle_high) << shift;
     }
+    *a_bus_id_string = malloc(reply->bus_id_len + 1);
+    if (!*a_bus_id_string)
+        goto out;
+    memcpy(*a_bus_id_string, xcb_xf86dri_open_connection_bus_id(reply), reply->bus_id_len);
+    *a_bus_id_string[reply->bus_id_len] = '\0';
+    is_ok = TRUE;
+out:
+    free(reply);
+    EPHYR_LOG("leave. bus_id_string:%s, is_ok:%d\n", *a_bus_id_string, is_ok);
     return is_ok;
 }
 
 Bool
 ephyrDRIAuthConnection(int a_screen, drm_magic_t a_magic)
 {
-    Display *dpy = hostx_get_display();
+    xcb_connection_t *conn = hostx_get_xcbconn();
+    int screen = hostx_get_screen();
+    xcb_xf86dri_auth_connection_cookie_t cookie;
+    xcb_xf86dri_auth_connection_reply_t *reply;
     Bool is_ok = FALSE;
 
     EPHYR_LOG("enter\n");
-    is_ok = XF86DRIAuthConnection(dpy, DefaultScreen(dpy), a_magic);
+    cookie = xcb_xf86dri_auth_connection(conn, screen, a_magic);
+    reply = xcb_xf86dri_auth_connection_reply(conn, cookie, NULL);
+    is_ok = reply->authenticated;
+    free(reply);
     EPHYR_LOG("leave. is_ok:%d\n", is_ok);
     return is_ok;
 }
@@ -97,13 +120,13 @@ ephyrDRIAuthConnection(int a_screen, drm_magic_t a_magic)
 Bool
 ephyrDRICloseConnection(int a_screen)
 {
-    Display *dpy = hostx_get_display();
-    Bool is_ok = FALSE;
+    xcb_connection_t *conn = hostx_get_xcbconn();
+    int screen = hostx_get_screen();
 
     EPHYR_LOG("enter\n");
-    is_ok = XF86DRICloseConnection(dpy, DefaultScreen(dpy));
+    xcb_xf86dri_close_connection(conn, screen);
     EPHYR_LOG("leave\n");
-    return is_ok;
+    return TRUE;
 }
 
 Bool
@@ -113,7 +136,10 @@ ephyrDRIGetClientDriverName(int a_screen,
                             int *a_ddx_driver_patch_version,
                             char **a_client_driver_name)
 {
-    Display *dpy = hostx_get_display();
+    xcb_connection_t *conn = hostx_get_xcbconn();
+    int screen = hostx_get_screen();
+    xcb_xf86dri_get_client_driver_name_cookie_t cookie;
+    xcb_xf86dri_get_client_driver_name_reply_t *reply;
     Bool is_ok = FALSE;
 
     EPHYR_RETURN_VAL_IF_FAIL(a_ddx_driver_major_version
@@ -121,15 +147,27 @@ ephyrDRIGetClientDriverName(int a_screen,
                              && a_ddx_driver_patch_version
                              && a_client_driver_name, FALSE);
     EPHYR_LOG("enter\n");
-    is_ok = XF86DRIGetClientDriverName(dpy, DefaultScreen(dpy),
-                                       a_ddx_driver_major_version,
-                                       a_ddx_driver_minor_version,
-                                       a_ddx_driver_patch_version,
-                                       a_client_driver_name);
+    cookie = xcb_xf86dri_get_client_driver_name(conn, screen);
+    reply = xcb_xf86dri_get_client_driver_name_reply(conn, cookie, NULL);
+    if (!reply)
+        goto out;
+    *a_ddx_driver_major_version = reply->client_driver_major_version;
+    *a_ddx_driver_minor_version = reply->client_driver_minor_version;
+    *a_ddx_driver_patch_version = reply->client_driver_patch_version;
+    *a_client_driver_name = malloc(reply->client_driver_name_len + 1);
+    if (!*a_client_driver_name)
+        goto out;
+    memcpy(*a_client_driver_name,
+           xcb_xf86dri_get_client_driver_name_client_driver_name(reply),
+           reply->client_driver_name_len);
+    (*a_client_driver_name)[reply->client_driver_name_len] = '\0';
+    is_ok = TRUE;
     EPHYR_LOG("major:%d, minor:%d, patch:%d, name:%s\n",
               *a_ddx_driver_major_version,
               *a_ddx_driver_minor_version,
               *a_ddx_driver_patch_version, *a_client_driver_name);
+ out:
+    free(reply);
     EPHYR_LOG("leave:%d\n", is_ok);
     return is_ok;
 }
@@ -137,18 +175,25 @@ ephyrDRIGetClientDriverName(int a_screen,
 Bool
 ephyrDRICreateContext(int a_screen,
                       int a_visual_id,
-                      XID *a_returned_ctxt_id, drm_context_t * a_hw_ctxt)
+                      CARD32 ctxt_id, drm_context_t * a_hw_ctxt)
 {
-    Display *dpy = hostx_get_display();
+    xcb_connection_t *conn = hostx_get_xcbconn();
+    int screen = hostx_get_screen();
     Bool is_ok = FALSE;
-    Visual v;
+    xcb_xf86dri_create_context_cookie_t cookie;
+    xcb_xf86dri_create_context_reply_t *reply;
+
+    ctxt_id = xcb_generate_id(conn);
 
     EPHYR_LOG("enter. screen:%d, visual:%d\n", a_screen, a_visual_id);
-    memset(&v, 0, sizeof(v));
-    v.visualid = a_visual_id;
-    is_ok = XF86DRICreateContext(dpy,
-                                 DefaultScreen(dpy),
-                                 &v, a_returned_ctxt_id, a_hw_ctxt);
+    cookie = xcb_xf86dri_create_context(conn, screen, a_visual_id, ctxt_id);
+    reply = xcb_xf86dri_create_context_reply(conn, cookie, NULL);
+    if (!reply)
+        goto out;
+    *a_hw_ctxt = reply->hw_context;
+    is_ok = TRUE;
+out:
+    free(reply);
     EPHYR_LOG("leave:%d\n", is_ok);
     return is_ok;
 }
@@ -156,13 +201,13 @@ ephyrDRICreateContext(int a_screen,
 Bool
 ephyrDRIDestroyContext(int a_screen, int a_context_id)
 {
-    Display *dpy = hostx_get_display();
-    Bool is_ok = FALSE;
+    xcb_connection_t *conn = hostx_get_xcbconn ();
+    int screen = hostx_get_screen();
 
     EPHYR_LOG("enter\n");
-    is_ok = XF86DRIDestroyContext(dpy, DefaultScreen(dpy), a_context_id);
-    EPHYR_LOG("leave:%d\n", is_ok);
-    return is_ok;
+    xcb_xf86dri_destroy_context(conn, screen, a_context_id);
+    EPHYR_LOG("leave\n");
+    return TRUE;
 }
 
 Bool
@@ -170,11 +215,20 @@ ephyrDRICreateDrawable(int a_screen,
                        int a_drawable, drm_drawable_t * a_hw_drawable)
 {
     Bool is_ok = FALSE;
-    Display *dpy = hostx_get_display();
+    xcb_connection_t *conn = hostx_get_xcbconn();
+    int screen = hostx_get_screen();
+    xcb_xf86dri_create_drawable_cookie_t cookie;
+    xcb_xf86dri_create_drawable_reply_t *reply;
 
     EPHYR_LOG("enter\n");
-    is_ok = XF86DRICreateDrawable(dpy, DefaultScreen(dpy),
-                                  a_drawable, a_hw_drawable);
+    cookie = xcb_xf86dri_create_drawable(conn, screen, a_drawable);
+    reply = xcb_xf86dri_create_drawable_reply(conn, cookie, NULL);
+    if (!reply)
+        goto out;
+    *a_hw_drawable = reply->hw_drawable_handle;
+    is_ok = TRUE;
+out:
+    free(reply);
     EPHYR_LOG("leave. is_ok:%d\n", is_ok);
     return is_ok;
 }
@@ -205,7 +259,10 @@ ephyrDRIGetDrawableInfo(int a_screen,
                         drm_clip_rect_t ** a_back_clip_rects)
 {
     Bool is_ok = FALSE;
-    Display *dpy = hostx_get_display();
+    xcb_connection_t *conn = hostx_get_xcbconn();
+    int screen = hostx_get_screen();
+    xcb_xf86dri_get_drawable_info_cookie_t cookie;
+    xcb_xf86dri_get_drawable_info_reply_t *reply = NULL;
     EphyrHostWindowAttributes attrs;
 
     EPHYR_RETURN_VAL_IF_FAIL(a_x && a_y && a_w && a_h
@@ -217,16 +274,22 @@ ephyrDRIGetDrawableInfo(int a_screen,
         EPHYR_LOG_ERROR("failed to query host window attributes\n");
         goto out;
     }
-    if (!XF86DRIGetDrawableInfo(dpy, DefaultScreen(dpy), a_drawable,
-                                a_index, a_stamp,
-                                a_x, a_y,
-                                a_w, a_h,
-                                a_num_clip_rects, a_clip_rects,
-                                a_back_x, a_back_y,
-                                a_num_back_clip_rects, a_back_clip_rects)) {
-        EPHYR_LOG_ERROR("XF86DRIGetDrawableInfo ()\n");
+    cookie = xcb_xf86dri_get_drawable_info(conn, screen, a_drawable);
+    reply =  xcb_xf86dri_get_drawable_info_reply(conn, cookie, NULL);
+    if (!reply) {
+        EPHYR_LOG_ERROR ("XF86DRIGetDrawableInfo ()\n");
         goto out;
     }
+    *a_index = reply->drawable_table_index;
+    *a_stamp = reply->drawable_table_stamp;
+    *a_x = reply->drawable_origin_X;
+    *a_y = reply->drawable_origin_Y;
+    *a_w = reply->drawable_size_W;
+    *a_h = reply->drawable_size_H;
+    *a_num_clip_rects = reply->num_clip_rects;
+    *a_clip_rects = calloc(*a_num_clip_rects, sizeof(drm_clip_rect_t));
+    memcpy(*a_clip_rects, xcb_xf86dri_get_drawable_info_clip_rects(reply),
+           *a_num_clip_rects * sizeof(drm_clip_rect_t));
     EPHYR_LOG("host x,y,w,h: (%d,%d,%d,%d)\n", *a_x, *a_y, *a_w, *a_h);
     if (*a_num_clip_rects) {
         free(*a_back_clip_rects);
@@ -246,6 +309,7 @@ ephyrDRIGetDrawableInfo(int a_screen,
  out:
     EPHYR_LOG("leave. index:%d, stamp:%d, x,y:(%d,%d), w,y:(%d,%d)\n",
               *a_index, *a_stamp, *a_x, *a_y, *a_w, *a_h);
+    free(reply);
     return is_ok;
 }
 
@@ -258,13 +322,35 @@ ephyrDRIGetDeviceInfo(int a_screen,
                       int *a_dev_private_size, void **a_dev_private)
 {
     Bool is_ok = FALSE;
-    Display *dpy = hostx_get_display();
+    xcb_connection_t *conn = hostx_get_xcbconn ();
+    int screen = hostx_get_screen();
+    xcb_xf86dri_get_device_info_cookie_t cookie;
+    xcb_xf86dri_get_device_info_reply_t *reply;
 
-    EPHYR_RETURN_VAL_IF_FAIL(dpy, FALSE);
+    EPHYR_RETURN_VAL_IF_FAIL(conn, FALSE);
     EPHYR_LOG("enter\n");
-    is_ok = XF86DRIGetDeviceInfo(dpy, DefaultScreen(dpy), a_frame_buffer,
-                                 a_fb_origin, a_fb_size, a_fb_stride,
-                                 a_dev_private_size, a_dev_private);
+    cookie = xcb_xf86dri_get_device_info(conn, screen);
+    reply = xcb_xf86dri_get_device_info_reply(conn, cookie, NULL);
+    if (!reply)
+        goto out;
+    *a_frame_buffer = reply->framebuffer_handle_low;
+    if (sizeof(drm_handle_t) == 8) {
+        int shift = 32;
+        *a_frame_buffer |= ((drm_handle_t)reply->framebuffer_handle_high) << shift;
+    }
+    *a_fb_origin = reply->framebuffer_origin_offset;
+    *a_fb_size = reply->framebuffer_size;
+    *a_fb_stride = reply->framebuffer_stride;
+    *a_dev_private_size = reply->device_private_size;
+    *a_dev_private = calloc(reply->device_private_size, 1);
+    if (!*a_dev_private)
+        goto out;
+    memcpy(*a_dev_private,
+           xcb_xf86dri_get_device_info_device_private(reply),
+           reply->device_private_size);
+    is_ok = TRUE;
+out:
+    free(reply);
     EPHYR_LOG("leave:%d\n", is_ok);
     return is_ok;
 }
index d28910f..8f2d302 100644 (file)
@@ -43,7 +43,7 @@ Bool ephyrDRIGetClientDriverName(int a_screen,
                                  char **a_client_driver_name);
 Bool ephyrDRICreateContext(int a_screen,
                            int a_visual_id,
-                           XID *a_returned_ctx_id, drm_context_t * a_hw_ctx);
+                           CARD32 ctx_id, drm_context_t * a_hw_ctx);
 Bool ephyrDRIDestroyContext(int a_screen, int a_context_id);
 Bool ephyrDRICreateDrawable(int a_screen,
                             int a_drawable, drm_drawable_t * a_hw_drawable);
index a42be07..8368d12 100644 (file)
@@ -39,6 +39,9 @@
 #define _XF86DRI_SERVER_
 #include <X11/dri/xf86dri.h>
 #include <X11/dri/xf86driproto.h>
+#include <xcb/xcb.h>
+#include <xcb/shape.h>
+#include <xcb/xf86dri.h>
 #include "misc.h"
 #include "privates.h"
 #include "dixstruct.h"
@@ -189,7 +192,6 @@ static void
 ephyrDRIMoveWindow(WindowPtr a_win,
                    int a_x, int a_y, WindowPtr a_siblings, VTKind a_kind)
 {
-    Bool is_ok = FALSE;
     ScreenPtr screen = NULL;
     EphyrDRIScreenPrivPtr screen_priv = NULL;
     EphyrDRIWindowPrivPtr win_priv = NULL;
@@ -214,18 +216,16 @@ ephyrDRIMoveWindow(WindowPtr a_win,
     EPHYR_LOG("window: %p\n", a_win);
     if (!a_win->parent) {
         EPHYR_LOG("cannot move root window\n");
-        is_ok = TRUE;
-        goto out;
+        return;
     }
     win_priv = GET_EPHYR_DRI_WINDOW_PRIV(a_win);
     if (!win_priv) {
         EPHYR_LOG("not a DRI peered window\n");
-        is_ok = TRUE;
-        goto out;
+        return;
     }
     if (!findWindowPairFromLocal(a_win, &pair) || !pair) {
         EPHYR_LOG_ERROR("failed to get window pair\n");
-        goto out;
+        return;
     }
     /*compute position relative to parent window */
     x = a_win->drawable.x - a_win->parent->drawable.x;
@@ -237,11 +237,6 @@ ephyrDRIMoveWindow(WindowPtr a_win,
     geo.width = a_win->drawable.width;
     geo.height = a_win->drawable.height;
     hostx_set_window_geometry(pair->remote, &geo);
-    is_ok = TRUE;
-
- out:
-    EPHYR_LOG("leave. is_ok:%d\n", is_ok);
-    /*do cleanup here */
 }
 
 static Bool
@@ -297,7 +292,6 @@ ephyrDRIPositionWindow(WindowPtr a_win, int a_x, int a_y)
 static void
 ephyrDRIClipNotify(WindowPtr a_win, int a_x, int a_y)
 {
-    Bool is_ok = FALSE;
     ScreenPtr screen = NULL;
     EphyrDRIScreenPrivPtr screen_priv = NULL;
     EphyrDRIWindowPrivPtr win_priv = NULL;
@@ -323,7 +317,6 @@ ephyrDRIClipNotify(WindowPtr a_win, int a_x, int a_y)
     win_priv = GET_EPHYR_DRI_WINDOW_PRIV(a_win);
     if (!win_priv) {
         EPHYR_LOG("not a DRI peered window\n");
-        is_ok = TRUE;
         goto out;
     }
     if (!findWindowPairFromLocal(a_win, &pair) || !pair) {
@@ -343,15 +336,14 @@ ephyrDRIClipNotify(WindowPtr a_win, int a_x, int a_y)
      * push the clipping region of this window
      * to the peer window in the host
      */
-    is_ok = hostx_set_window_bounding_rectangles
+    hostx_set_window_bounding_rectangles
         (pair->remote, rects, RegionNumRects(&a_win->clipList));
-    is_ok = TRUE;
 
  out:
     free(rects);
     rects = NULL;
 
-    EPHYR_LOG("leave. is_ok:%d\n", is_ok);
+    EPHYR_LOG("leave.\n");
     /*do cleanup here */
 }
 
@@ -561,7 +553,7 @@ ProcXF86DRIQueryDirectRenderingCapable(register ClientPtr client)
         return BadValue;
     }
 
-    if (!LocalClient(client) || client->swapped)
+    if (!client->local || client->swapped)
         isCapable = 0;
 
     rep = (xXF86DRIQueryDirectRenderingCapableReply) {
@@ -727,7 +719,6 @@ ProcXF86DRICreateContext(register ClientPtr client)
     ScreenPtr pScreen;
     VisualPtr visual;
     int i = 0;
-    unsigned long context_id = 0;
 
     REQUEST(xXF86DRICreateContextReq);
     REQUEST_SIZE_MATCH(xXF86DRICreateContextReq);
@@ -750,11 +741,10 @@ ProcXF86DRICreateContext(register ClientPtr client)
         return BadValue;
     }
 
-    context_id = stuff->context;
     if (!ephyrDRICreateContext(stuff->screen,
                                stuff->visual,
-                               &context_id,
-                               (drm_context_t *) & rep.hHWContext)) {
+                               stuff->context,
+                               (drm_context_t *) &rep.hHWContext)) {
         return BadValue;
     }
 
@@ -964,7 +954,7 @@ ProcXF86DRICreateDrawable(ClientPtr client)
 
     if (!ephyrDRICreateDrawable(stuff->screen,
                                 remote_win,
-                                (drm_drawable_t *) & rep.hHWDrawable)) {
+                                (drm_drawable_t *) &rep.hHWDrawable)) {
         EPHYR_LOG_ERROR("failed to create dri drawable\n");
         return BadValue;
     }
@@ -1108,7 +1098,6 @@ ProcXF86DRIGetDrawableInfo(register ClientPtr client)
     if (rep.numClipRects) {
         if (clipRects) {
             ScreenPtr pScreen = screenInfo.screens[stuff->screen];
-            int i = 0;
 
             EPHYR_LOG("clip list of host gl drawable:\n");
             for (i = 0; i < rep.numClipRects; i++) {
@@ -1229,7 +1218,7 @@ ProcXF86DRIDispatch(register ClientPtr client)
     }
     }
 
-    if (!LocalClient(client))
+    if (!client->local)
         return DRIErrorBase + XF86DRIClientNotLocal;
 
     switch (stuff->data) {
@@ -1332,12 +1321,12 @@ ephyrDRIExtensionInit(ScreenPtr a_screen)
     EphyrDRIScreenPrivPtr screen_priv = NULL;
 
     EPHYR_LOG("enter\n");
-    if (!hostx_has_dri()) {
+    if (!host_has_extension(&xcb_xf86dri_id)) {
         EPHYR_LOG("host does not have DRI extension\n");
         goto out;
     }
     EPHYR_LOG("host X does have DRI extension\n");
-    if (!hostx_has_xshape()) {
+    if (!host_has_extension(&xcb_shape_id)) {
         EPHYR_LOG("host does not have XShape extension\n");
         goto out;
     }
index df285cf..632a9c4 100644 (file)
@@ -29,6 +29,7 @@
 #include <kdrive-config.h>
 #endif
 
+#include <xcb/glx.h>
 #include "extnsionst.h"
 #include "ephyrglxext.h"
 #include "ephyrhostglx.h"
@@ -61,10 +62,16 @@ int ephyrGLXGetFBConfigsSGIX(__GLXclientState * a_cl, GLbyte * a_pc);
 int ephyrGLXGetFBConfigsSGIXSwap(__GLXclientState * a_cl, GLbyte * a_pc);
 int ephyrGLXCreateContext(__GLXclientState * a_cl, GLbyte * a_pc);
 int ephyrGLXCreateContextSwap(__GLXclientState * a_cl, GLbyte * a_pc);
+int ephyrGLXCreateNewContext(__GLXclientState * a_cl, GLbyte * a_pc);
+int ephyrGLXCreateNewContextSwap(__GLXclientState * a_cl, GLbyte * a_pc);
 int ephyrGLXDestroyContext(__GLXclientState * a_cl, GLbyte * a_pc);
 int ephyrGLXDestroyContextSwap(__GLXclientState * a_cl, GLbyte * a_pc);
 int ephyrGLXMakeCurrent(__GLXclientState * a_cl, GLbyte * a_pc);
 int ephyrGLXMakeCurrentSwap(__GLXclientState * a_cl, GLbyte * a_pc);
+int ephyrGLXMakeCurrentReadSGI(__GLXclientState * a_cl, GLbyte * a_pc);
+int ephyrGLXMakeCurrentReadSGISwap(__GLXclientState * a_cl, GLbyte * a_pc);
+int ephyrGLXMakeContextCurrent(__GLXclientState * a_cl, GLbyte * a_pc);
+int ephyrGLXMakeContextCurrentSwap(__GLXclientState * a_cl, GLbyte * a_pc);
 int ephyrGLXGetString(__GLXclientState * a_cl, GLbyte * a_pc);
 int ephyrGLXGetStringSwap(__GLXclientState * a_cl, GLbyte * a_pc);
 int ephyrGLXGetIntegerv(__GLXclientState * a_cl, GLbyte * a_pc);
@@ -77,7 +84,7 @@ ephyrHijackGLXExtension(void)
 {
     const void *(*dispatch_functions)[2];
 
-    if (!hostx_has_glx()) {
+    if (!host_has_extension(&xcb_glx_id)) {
         EPHYR_LOG("host X does not have GLX\n");
         return FALSE;
     }
@@ -108,6 +115,9 @@ ephyrHijackGLXExtension(void)
     dispatch_functions[X_GLXCreateContext][0] = ephyrGLXCreateContext;
     dispatch_functions[X_GLXCreateContext][1] = ephyrGLXCreateContextSwap;
 
+    dispatch_functions[X_GLXCreateNewContext][0] = ephyrGLXCreateNewContext;
+    dispatch_functions[X_GLXCreateNewContext][1] = ephyrGLXCreateNewContextSwap;
+
     dispatch_functions[X_GLXDestroyContext][0] = ephyrGLXDestroyContext;
     dispatch_functions[X_GLXDestroyContext][1] = ephyrGLXDestroyContextSwap;
 
@@ -123,14 +133,24 @@ ephyrHijackGLXExtension(void)
     dispatch_functions[61][0] = ephyrGLXGetIntegerv;
     dispatch_functions[61][1] = ephyrGLXGetIntegervSwap;
 
+    dispatch_functions[X_GLXMakeContextCurrent][0] =
+        ephyrGLXMakeContextCurrent;
+    dispatch_functions[X_GLXMakeContextCurrent][1] =
+        ephyrGLXMakeContextCurrentSwap;
+
     /*
      * hijack some vendor priv entry point dispatch functions
      */
     dispatch_functions = VendorPriv_dispatch_info.dispatch_functions;
     dispatch_functions[92][0] = ephyrGLXGetFBConfigsSGIX;
     dispatch_functions[92][1] = ephyrGLXGetFBConfigsSGIXSwap;
+
+    dispatch_functions[89][0] = ephyrGLXMakeCurrentReadSGI;
+    dispatch_functions[89][1] = ephyrGLXMakeCurrentReadSGISwap;
+
     EPHYR_LOG("hijacked glx entry points to forward requests to host X\n");
 
+
     return TRUE;
 }
 
@@ -361,10 +381,9 @@ ephyrGLXQueryServerString(__GLXclientState * a_cl, GLbyte * a_pc)
     int length = 0;
 
     EPHYR_LOG("enter\n");
-    if (!ephyrHostGLXGetStringFromServer(req->screen,
-                                         req->name,
-                                         EPHYR_HOST_GLX_QueryServerString,
-                                         &server_string)) {
+    if (!ephyrHostGLXQueryServerString(req->screen,
+                                       req->name,
+                                       &server_string)) {
         EPHYR_LOG_ERROR("failed to query string from host\n");
         goto out;
     }
@@ -445,7 +464,8 @@ ephyrGLXCreateContextReal(xGLXCreateContextReq * a_req, Bool a_do_swap)
     if (!ephyrHostGLXCreateContext(a_req->screen,
                                    host_w_attrs.visualid,
                                    a_req->context,
-                                   a_req->shareList, a_req->isDirect)) {
+                                   a_req->shareList, 0,
+                                   a_req->isDirect, X_GLXCreateContext)) {
         EPHYR_LOG_ERROR("ephyrHostGLXCreateContext() failed\n");
         goto out;
     }
@@ -455,6 +475,45 @@ ephyrGLXCreateContextReal(xGLXCreateContextReq * a_req, Bool a_do_swap)
     return res;
 }
 
+static int
+ephyrGLXCreateNewContextReal(xGLXCreateNewContextReq * a_req, Bool a_do_swap)
+{
+    int res = BadImplementation;
+
+    __GLX_DECLARE_SWAP_VARIABLES;
+
+    EPHYR_RETURN_VAL_IF_FAIL(a_req, BadValue);
+    EPHYR_LOG("enter\n");
+
+    if (a_do_swap) {
+        __GLX_SWAP_SHORT(&a_req->length);
+        __GLX_SWAP_INT(&a_req->context);
+        __GLX_SWAP_INT(&a_req->fbconfig);
+        __GLX_SWAP_INT(&a_req->screen);
+        __GLX_SWAP_INT(&a_req->renderType);
+        __GLX_SWAP_INT(&a_req->shareList);
+    }
+
+    EPHYR_LOG("context creation requested. localid:%d, "
+              "screen:%d, fbconfig:%d, renderType:%d, direct:%d\n",
+              (int) a_req->context, (int) a_req->screen,
+              (int) a_req->fbconfig, (int) a_req->renderType,
+              (int) a_req->isDirect);
+
+    if (!ephyrHostGLXCreateContext(a_req->screen,
+                                   a_req->fbconfig,
+                                   a_req->context,
+                                   a_req->shareList, a_req->renderType,
+                                   a_req->isDirect, X_GLXCreateNewContext)) {
+        EPHYR_LOG_ERROR("ephyrHostGLXCreateNewContext() failed\n");
+        goto out;
+    }
+    res = Success;
+ out:
+    EPHYR_LOG("leave\n");
+    return res;
+}
+
 int
 ephyrGLXCreateContext(__GLXclientState * cl, GLbyte * pc)
 {
@@ -471,6 +530,22 @@ ephyrGLXCreateContextSwap(__GLXclientState * cl, GLbyte * pc)
     return ephyrGLXCreateContextReal(req, TRUE);
 }
 
+int
+ephyrGLXCreateNewContext(__GLXclientState * cl, GLbyte * pc)
+{
+    xGLXCreateNewContextReq *req = (xGLXCreateNewContextReq *) pc;
+
+    return ephyrGLXCreateNewContextReal(req, FALSE);
+}
+
+int
+ephyrGLXCreateNewContextSwap(__GLXclientState * cl, GLbyte * pc)
+{
+    xGLXCreateNewContextReq *req = (xGLXCreateNewContextReq *) pc;
+
+    return ephyrGLXCreateNewContextReal(req, TRUE);
+}
+
 static int
 ephyrGLXDestroyContextReal(__GLXclientState * a_cl,
                            GLbyte * a_pc, Bool a_do_swap)
@@ -505,26 +580,34 @@ ephyrGLXDestroyContextSwap(__GLXclientState * a_cl, GLbyte * a_pc)
 }
 
 static int
-ephyrGLXMakeCurrentReal(__GLXclientState * a_cl, GLbyte * a_pc, Bool a_do_swap)
+ephyrGLXMakeCurrentReal(__GLXclientState * a_cl, GLXDrawable write,
+                        GLXDrawable read, GLXContextTag ctx,
+                        GLXContextTag old_ctx, Bool a_do_swap)
 {
     int res = BadImplementation;
-    xGLXMakeCurrentReq *req = (xGLXMakeCurrentReq *) a_pc;
     xGLXMakeCurrentReply reply;
-    DrawablePtr drawable = NULL;
-    GLXContextTag contextTag = 0;
-    int rc = 0;
+    DrawablePtr drawableR = NULL, drawableW = NULL;
+    GLXContextTag new_ctx = 0;
 
     EPHYR_LOG("enter\n");
-    rc = dixLookupDrawable(&drawable,
-                           req->drawable, a_cl->client, 0, DixReadAccess);
-    EPHYR_RETURN_VAL_IF_FAIL(drawable, BadValue);
-    EPHYR_RETURN_VAL_IF_FAIL(drawable->pScreen, BadValue);
-    EPHYR_LOG("screen nummber requested:%d\n", drawable->pScreen->myNum);
-
-    if (!ephyrHostGLXMakeCurrent(hostx_get_window(drawable->pScreen->myNum),
-                                 req->context,
-                                 req->oldContextTag,
-                                 (int *) &contextTag)) {
+    res = dixLookupDrawable(&drawableW, write, a_cl->client, 0, DixReadAccess);
+    EPHYR_RETURN_VAL_IF_FAIL(drawableW, BadValue);
+    EPHYR_RETURN_VAL_IF_FAIL(drawableW->pScreen, BadValue);
+    EPHYR_LOG("screen nummber requested:%d\n", drawableW->pScreen->myNum);
+
+    if (read != write) {
+        res = dixLookupDrawable(&drawableR, read, a_cl->client, 0,
+                                DixReadAccess);
+        EPHYR_RETURN_VAL_IF_FAIL(drawableR, BadValue);
+        EPHYR_RETURN_VAL_IF_FAIL(drawableR->pScreen, BadValue);
+    }
+    else {
+        drawableR = drawableW;
+    }
+
+    if (!ephyrHostGLXMakeCurrent(hostx_get_window(drawableW->pScreen->myNum),
+                                 hostx_get_window(drawableR->pScreen->myNum),
+                                 ctx, old_ctx, (int *) &new_ctx)) {
         EPHYR_LOG_ERROR("ephyrHostGLXMakeCurrent() failed\n");
         goto out;
     }
@@ -532,7 +615,7 @@ ephyrGLXMakeCurrentReal(__GLXclientState * a_cl, GLbyte * a_pc, Bool a_do_swap)
         .type = X_Reply,
         .sequenceNumber = a_cl->client->sequence,
         .length = 0,
-        .contextTag = contextTag
+        .contextTag = new_ctx
     };
     if (a_do_swap) {
         __GLX_DECLARE_SWAP_VARIABLES;
@@ -551,13 +634,71 @@ ephyrGLXMakeCurrentReal(__GLXclientState * a_cl, GLbyte * a_pc, Bool a_do_swap)
 int
 ephyrGLXMakeCurrent(__GLXclientState * a_cl, GLbyte * a_pc)
 {
-    return ephyrGLXMakeCurrentReal(a_cl, a_pc, FALSE);
+    xGLXMakeCurrentReq *req = (xGLXMakeCurrentReq *) a_pc;
+    return ephyrGLXMakeCurrentReal(a_cl, req->drawable, req->drawable,
+                                   req->context, req->oldContextTag, FALSE);
 }
 
 int
 ephyrGLXMakeCurrentSwap(__GLXclientState * a_cl, GLbyte * a_pc)
 {
-    return ephyrGLXMakeCurrentReal(a_cl, a_pc, TRUE);
+    xGLXMakeCurrentReq *req = (xGLXMakeCurrentReq *) a_pc;
+    __GLX_DECLARE_SWAP_VARIABLES;
+
+    __GLX_SWAP_INT(&req->drawable);
+    __GLX_SWAP_INT(&req->context);
+    __GLX_SWAP_INT(&req->oldContextTag);
+
+    return ephyrGLXMakeCurrentReal(a_cl, req->drawable, req->drawable,
+                                   req->context, req->oldContextTag, TRUE);
+}
+
+int
+ephyrGLXMakeCurrentReadSGI(__GLXclientState * a_cl, GLbyte * a_pc)
+{
+    xGLXMakeCurrentReadSGIReq *req = (xGLXMakeCurrentReadSGIReq *) a_pc;
+
+    return ephyrGLXMakeCurrentReal(a_cl, req->drawable, req->readable,
+                                   req->context, req->oldContextTag, FALSE);
+}
+
+int
+ephyrGLXMakeCurrentReadSGISwap(__GLXclientState * a_cl, GLbyte * a_pc)
+{
+    xGLXMakeCurrentReadSGIReq *req = (xGLXMakeCurrentReadSGIReq *) a_pc;
+    __GLX_DECLARE_SWAP_VARIABLES;
+
+    __GLX_SWAP_INT(&req->drawable);
+    __GLX_SWAP_INT(&req->readable);
+    __GLX_SWAP_INT(&req->context);
+    __GLX_SWAP_INT(&req->oldContextTag);
+
+    return ephyrGLXMakeCurrentReal(a_cl, req->drawable, req->readable,
+                                   req->context, req->oldContextTag, TRUE);
+}
+
+int
+ephyrGLXMakeContextCurrent(__GLXclientState * a_cl, GLbyte * a_pc)
+{
+    xGLXMakeContextCurrentReq *req = (xGLXMakeContextCurrentReq *) a_pc;
+
+    return ephyrGLXMakeCurrentReal(a_cl, req->drawable, req->readdrawable,
+                                   req->context, req->oldContextTag, FALSE);
+}
+
+int
+ephyrGLXMakeContextCurrentSwap(__GLXclientState * a_cl, GLbyte * a_pc)
+{
+    xGLXMakeContextCurrentReq *req = (xGLXMakeContextCurrentReq *) a_pc;
+    __GLX_DECLARE_SWAP_VARIABLES;
+
+    __GLX_SWAP_INT(&req->drawable);
+    __GLX_SWAP_INT(&req->readdrawable);
+    __GLX_SWAP_INT(&req->context);
+    __GLX_SWAP_INT(&req->oldContextTag);
+
+    return ephyrGLXMakeCurrentReal(a_cl, req->drawable, req->readdrawable,
+                                   req->context, req->oldContextTag, TRUE);
 }
 
 static int
@@ -583,9 +724,7 @@ ephyrGLXGetStringReal(__GLXclientState * a_cl, GLbyte * a_pc, Bool a_do_swap)
     a_pc += __GLX_SINGLE_HDR_SIZE;
     name = *(GLenum *) (a_pc + 0);
     EPHYR_LOG("context_tag:%d, name:%d\n", context_tag, name);
-    if (!ephyrHostGLXGetStringFromServer(context_tag,
-                                         name,
-                                         EPHYR_HOST_GLX_GetString, &string)) {
+    if (!ephyrHostGLXGetString(context_tag, name, &string)) {
         EPHYR_LOG_ERROR("failed to get string from server\n");
         goto out;
     }
index 6b9da6f..007524d 100644 (file)
 #include <kdrive-config.h>
 #endif
 
-/*
- * including some server headers (like kdrive-config.h)
- * might define the macro _XSERVER64
- * on 64 bits machines. That macro must _NOT_ be defined for Xlib
- * client code, otherwise bad things happen.
- * So let's undef that macro if necessary.
- */
-#ifdef _XSERVER64
-#undef _XSERVER64
-#endif
-
-#include <X11/Xlibint.h>
-#include <GL/glx.h>
-#include <GL/internal/glcore.h>
+#include <X11/Xdefs.h>
+#include <X11/Xmd.h>
 #include <GL/glxproto.h>
-#include <GL/glxint.h>
+#include <xcb/glx.h>
 #include "ephyrhostglx.h"
 #define _HAVE_XALLOC_DECLS
 #include "ephyrlog.h"
 #include "hostx.h"
 
+static int glx_major, glx_minor;
+
 enum VisualConfRequestType {
     EPHYR_GET_FB_CONFIG,
     EPHYR_VENDOR_PRIV_GET_FB_CONFIG_SGIX,
@@ -60,65 +50,38 @@ enum VisualConfRequestType {
 
 static Bool ephyrHostGLXGetVisualConfigsInternal
     (enum VisualConfRequestType a_type,
+     xcb_glx_get_visual_configs_reply_t *reply,
      int32_t a_screen,
-     int32_t * a_num_visuals,
-     int32_t * a_num_props, int32_t * a_props_buf_size, int32_t ** a_props_buf);
-Bool
-ephyrHostGLXGetMajorOpcode(int *a_opcode)
-{
-    Bool is_ok = FALSE;
-    Display *dpy = hostx_get_display();
-    static int opcode;
-    int first_event_return = 0, first_error_return = 0;
-
-    EPHYR_RETURN_VAL_IF_FAIL(dpy, FALSE);
-    EPHYR_LOG("enter\n");
-    if (!opcode) {
-        if (!XQueryExtension(dpy, GLX_EXTENSION_NAME, &opcode,
-                             &first_event_return, &first_error_return)) {
-            EPHYR_LOG_ERROR("XQueryExtension() failed\n");
-            goto out;
-        }
-    }
-    *a_opcode = opcode;
-    is_ok = TRUE;
- out:
-    EPHYR_LOG("release\n");
-    return is_ok;
-}
+     int32_t *a_num_visuals,
+     int32_t *a_num_props,
+     int32_t *a_props_buf_size,
+     int32_t **a_props_buf);
 
 Bool
 ephyrHostGLXQueryVersion(int *a_major, int *a_minor)
 {
     Bool is_ok = FALSE;
-    Display *dpy = hostx_get_display();
-    int major_opcode = 0;
-    xGLXQueryVersionReq *req = NULL;
-    xGLXQueryVersionReply reply;
+    xcb_connection_t *conn = hostx_get_xcbconn();
+    xcb_glx_query_version_cookie_t cookie;
+    xcb_glx_query_version_reply_t *reply;
 
     EPHYR_RETURN_VAL_IF_FAIL(a_major && a_minor, FALSE);
     EPHYR_LOG("enter\n");
 
-    if (!ephyrHostGLXGetMajorOpcode(&major_opcode)) {
-        EPHYR_LOG_ERROR("failed to get major opcode\n");
-        goto out;
+    if (glx_major) {
+        *a_major = glx_major;
+        *a_minor = glx_minor;
+        return TRUE;
     }
-    EPHYR_LOG("major opcode: %d\n", major_opcode);
 
     /* Send the glXQueryVersion request */
-    memset(&reply, 0, sizeof(reply));
-    LockDisplay(dpy);
-    GetReq(GLXQueryVersion, req);
-    req->reqType = major_opcode;
-    req->glxCode = X_GLXQueryVersion;
-    req->majorVersion = 2;
-    req->minorVersion = 1;
-    _XReply(dpy, (xReply *) & reply, 0, False);
-    UnlockDisplay(dpy);
-    SyncHandle();
-
-    *a_major = reply.majorVersion;
-    *a_minor = reply.minorVersion;
+    cookie = xcb_glx_query_version(conn, 2, 1);
+    reply = xcb_glx_query_version_reply(conn, cookie, NULL);
+    if (!reply)
+        goto out;
+    *a_major = reply->major_version;
+    *a_minor = reply->minor_version;
+    free(reply);
 
     EPHYR_LOG("major:%d, minor:%d\n", *a_major, *a_minor);
 
@@ -128,116 +91,63 @@ ephyrHostGLXQueryVersion(int *a_major, int *a_minor)
     return is_ok;
 }
 
-/**
- * GLX protocol structure for the ficticious "GXLGenericGetString" request.
- * 
- * This is a non-existant protocol packet.  It just so happens that all of
- * the real protocol packets used to request a string from the server have
- * an identical binary layout.  The only difference between them is the
- * meaning of the \c for_whom field and the value of the \c glxCode.
- * (this has been copied from the mesa source code)
- */
-typedef struct GLXGenericGetString {
-    CARD8 reqType;
-    CARD8 glxCode;
-    CARD16 length B16;
-    CARD32 for_whom B32;
-    CARD32 name B32;
-} xGLXGenericGetStringReq;
-
-/* These defines are only needed to make the GetReq macro happy.
- */
-#define sz_xGLXGenericGetStringReq 12
-#define X_GLXGenericGetString 0
-
 Bool
-ephyrHostGLXGetStringFromServer(int a_screen_number,
-                                int a_string_name,
-                                enum EphyrHostGLXGetStringOps a_op,
-                                char **a_string)
+ephyrHostGLXGetString(int a_context_tag,
+                      int a_string_name,
+                      char **a_string)
 {
     Bool is_ok = FALSE;
-    Display *dpy = hostx_get_display();
-    int default_screen = DefaultScreen(dpy);
-    xGLXGenericGetStringReq *req = NULL;
-    xGLXSingleReply reply;
-    int length = 0, numbytes = 0, major_opcode = 0, get_string_op = 0;
+    xcb_connection_t *conn = hostx_get_xcbconn();
+    xcb_glx_get_string_cookie_t cookie;
+    xcb_glx_get_string_reply_t *reply;
 
-    EPHYR_RETURN_VAL_IF_FAIL(dpy && a_string, FALSE);
+    EPHYR_RETURN_VAL_IF_FAIL(conn && a_string, FALSE);
 
     EPHYR_LOG("enter\n");
-    switch (a_op) {
-    case EPHYR_HOST_GLX_QueryServerString:
-        get_string_op = X_GLXQueryServerString;
-        break;
-    case EPHYR_HOST_GLX_GetString:
-        get_string_op = X_GLsop_GetString;
-        EPHYR_LOG("Going to glXGetString. strname:%#x, ctxttag:%d\n",
-                  a_string_name, a_screen_number);
-        break;
-    default:
-        EPHYR_LOG_ERROR("unknown EphyrHostGLXGetStringOp:%d\n", a_op);
+    cookie = xcb_glx_get_string(conn, a_context_tag, a_string_name);
+    reply = xcb_glx_get_string_reply(conn, cookie, NULL);
+    if (!reply)
         goto out;
-    }
+    *a_string = malloc(reply->n + 1);
+    memcpy(*a_string, xcb_glx_get_string_string(reply), reply->n);
+    (*a_string)[reply->n] = '\0';
+    free(reply);
+    is_ok = TRUE;
+out:
+    EPHYR_LOG("leave\n");
+    return is_ok;
+}
 
-    if (!ephyrHostGLXGetMajorOpcode(&major_opcode)) {
-        EPHYR_LOG_ERROR("failed to get major opcode\n");
-        goto out;
-    }
-    EPHYR_LOG("major opcode: %d\n", major_opcode);
-
-    LockDisplay(dpy);
-
-    /* All of the GLX protocol requests for getting a string from the server
-     * look the same.  The exact meaning of the a_for_whom field is usually
-     * either the screen number (for glXQueryServerString) or the context tag
-     * (for GLXSingle).
-     */
-    GetReq(GLXGenericGetString, req);
-    req->reqType = major_opcode;
-    req->glxCode = get_string_op;
-    req->for_whom = default_screen;
-    req->name = a_string_name;
-
-    _XReply(dpy, (xReply *) & reply, 0, False);
-
-    length = reply.length * 4;
-    if (!length) {
-        numbytes = 0;
-    }
-    else {
-        numbytes = reply.size;
-    }
-    EPHYR_LOG("going to get a string of size:%d\n", numbytes);
+Bool ephyrHostGLXQueryServerString(int a_screen_number,
+                                   int a_string_name,
+                                   char **a_string)
+{
+    Bool is_ok = FALSE;
+    xcb_connection_t *conn = hostx_get_xcbconn();
+    int default_screen = hostx_get_screen();
+    xcb_glx_query_server_string_cookie_t cookie;
+    xcb_glx_query_server_string_reply_t *reply;
 
-    *a_string = (char *) Xmalloc(numbytes + 1);
-    if (!a_string) {
-        EPHYR_LOG_ERROR("allocation failed\n");
-        goto out;
-    }
+    EPHYR_RETURN_VAL_IF_FAIL(conn && a_string, FALSE);
 
-    memset(*a_string, 0, numbytes + 1);
-    if (_XRead(dpy, *a_string, numbytes)) {
-        UnlockDisplay(dpy);
-        SyncHandle();
-        EPHYR_LOG_ERROR("read failed\n");
+    EPHYR_LOG("enter\n");
+    cookie = xcb_glx_query_server_string(conn, default_screen, a_string_name);
+    reply = xcb_glx_query_server_string_reply(conn, cookie, NULL);
+    if (!reply)
         goto out;
-    }
-    length -= numbytes;
-    _XEatData(dpy, length);
-    UnlockDisplay(dpy);
-    SyncHandle();
-    EPHYR_LOG("strname:%#x, strvalue:'%s', strlen:%d\n",
-              a_string_name, *a_string, numbytes);
-
+    *a_string = malloc(reply->str_len + 1);
+    memcpy(*a_string, xcb_glx_query_server_string_string(reply), reply->str_len);
+    (*a_string)[reply->str_len] = '\0';
+    free(reply);
     is_ok = TRUE;
- out:
+out:
     EPHYR_LOG("leave\n");
     return is_ok;
 }
 
 static Bool
 ephyrHostGLXGetVisualConfigsInternal(enum VisualConfRequestType a_type,
+                                     xcb_glx_get_visual_configs_reply_t *reply,
                                      int32_t a_screen,
                                      int32_t * a_num_visuals,
                                      int32_t * a_num_props,
@@ -245,112 +155,36 @@ ephyrHostGLXGetVisualConfigsInternal(enum VisualConfRequestType a_type,
                                      int32_t ** a_props_buf)
 {
     Bool is_ok = FALSE;
-    Display *dpy = hostx_get_display();
-    xGLXGetVisualConfigsReq *req;
-    xGLXGetFBConfigsReq *fb_req;
-    xGLXVendorPrivateWithReplyReq *vpreq;
-    xGLXGetFBConfigsSGIXReq *sgi_req;
-    xGLXGetVisualConfigsReply reply;
-    char *server_glx_version = NULL, *server_glx_extensions = NULL;
-    int j = 0,
-        screens = 0,
-        major_opcode = 0,
-        num_props = 0,
-        num_visuals = 0, props_buf_size = 0, props_per_visual_size = 0;
+    int num_props = 0, num_visuals = 0, props_buf_size = 0;
+    int props_per_visual_size = 0;
     int32_t *props_buf = NULL;
 
-    EPHYR_RETURN_VAL_IF_FAIL(dpy, FALSE);
-
-    screens = ScreenCount(dpy);
-    if (!ephyrHostGLXGetMajorOpcode(&major_opcode)) {
-        EPHYR_LOG_ERROR("failed to get opcode\n");
-        goto out;
-    }
-
-    LockDisplay(dpy);
-    switch (a_type) {
-    case EPHYR_GET_FB_CONFIG:
-        GetReq(GLXGetFBConfigs, fb_req);
-        fb_req->reqType = major_opcode;
-        fb_req->glxCode = X_GLXGetFBConfigs;
-        fb_req->screen = DefaultScreen(dpy);
-        break;
-
-    case EPHYR_VENDOR_PRIV_GET_FB_CONFIG_SGIX:
-        GetReqExtra(GLXVendorPrivateWithReply,
-                    sz_xGLXGetFBConfigsSGIXReq
-                    - sz_xGLXVendorPrivateWithReplyReq, vpreq);
-        sgi_req = (xGLXGetFBConfigsSGIXReq *) vpreq;
-        sgi_req->reqType = major_opcode;
-        sgi_req->glxCode = X_GLXVendorPrivateWithReply;
-        sgi_req->vendorCode = X_GLXvop_GetFBConfigsSGIX;
-        sgi_req->screen = DefaultScreen(dpy);
-        break;
-
-    case EPHYR_GET_VISUAL_CONFIGS:
-        GetReq(GLXGetVisualConfigs, req);
-        req->reqType = major_opcode;
-        req->glxCode = X_GLXGetVisualConfigs;
-        req->screen = DefaultScreen(dpy);
-        break;
-    }
-
-    if (!_XReply(dpy, (xReply *) & reply, 0, False)) {
-        EPHYR_LOG_ERROR("unknown error\n");
-        UnlockDisplay(dpy);
-        goto out;
-    }
-    if (!reply.numVisuals) {
+   if (!reply->num_visuals) {
         EPHYR_LOG_ERROR("screen does not support GL rendering\n");
-        UnlockDisplay(dpy);
-        goto out;
-    }
-    num_visuals = reply.numVisuals;
-
-    /* FIXME: Is the __GLX_MIN_CONFIG_PROPS test correct for
-     * FIXME: FBconfigs? 
-     */
-    /* Check number of properties */
-    num_props = reply.numProps;
-    if ((num_props < __GLX_MIN_CONFIG_PROPS) ||
-        (num_props > __GLX_MAX_CONFIG_PROPS)) {
-        /* Huh?  Not in protocol defined limits.  Punt */
-        EPHYR_LOG_ERROR("got a bad reply to request\n");
-        UnlockDisplay(dpy);
         goto out;
     }
+    num_visuals = reply->num_visuals;
+
+    num_props = reply->num_properties;
 
     if (a_type != EPHYR_GET_VISUAL_CONFIGS) {
         num_props *= 2;
     }
-    props_per_visual_size = num_props * __GLX_SIZE_INT32;
-    props_buf_size = props_per_visual_size * reply.numVisuals;
+    props_per_visual_size = num_props * sizeof(uint32_t);
+    props_buf_size = props_per_visual_size * reply->num_visuals;
     props_buf = malloc(props_buf_size);
-    for (j = 0; j < reply.numVisuals; j++) {
-        if (_XRead(dpy,
-                   &((char *) props_buf)[j * props_per_visual_size],
-                   props_per_visual_size) != Success) {
-            EPHYR_LOG_ERROR("read failed\n");
-        }
-    }
-    UnlockDisplay(dpy);
+    if (!props_buf)
+        goto out;
+    memcpy(props_buf, xcb_glx_get_visual_configs_property_list(reply),
+           props_buf_size);
 
     *a_num_visuals = num_visuals;
-    *a_num_props = reply.numProps;
+    *a_num_props = reply->num_properties;
     *a_props_buf_size = props_buf_size;
     *a_props_buf = props_buf;
     is_ok = TRUE;
 
- out:
-    if (server_glx_version) {
-        XFree(server_glx_version);
-        server_glx_version = NULL;
-    }
-    if (server_glx_extensions) {
-        XFree(server_glx_extensions);
-        server_glx_extensions = NULL;
-    }
-    SyncHandle();
+out:
     return is_ok;
 }
 
@@ -361,14 +195,27 @@ ephyrHostGLXGetVisualConfigs(int32_t a_screen,
                              int32_t * a_props_buf_size, int32_t ** a_props_buf)
 {
     Bool is_ok = FALSE;
+    xcb_glx_get_visual_configs_cookie_t cookie;
+    xcb_glx_get_visual_configs_reply_t *reply;
+    xcb_connection_t *conn = hostx_get_xcbconn();
+    int screen = hostx_get_screen();
 
     EPHYR_LOG("enter\n");
-    is_ok = ephyrHostGLXGetVisualConfigsInternal(EPHYR_GET_VISUAL_CONFIGS,
-                                                 a_screen,
-                                                 a_num_visuals,
-                                                 a_num_props,
-                                                 a_props_buf_size, a_props_buf);
-
+    cookie = xcb_glx_get_visual_configs(conn, screen);
+    reply = xcb_glx_get_visual_configs_reply(conn, cookie, NULL);
+    if (!reply)
+        goto out;
+    is_ok = ephyrHostGLXGetVisualConfigsInternal
+        (EPHYR_GET_VISUAL_CONFIGS,
+         reply,
+         a_screen,
+         a_num_visuals,
+         a_num_props,
+         a_props_buf_size,
+         a_props_buf);
+
+out:
+    free(reply);
     EPHYR_LOG("leave:%d\n", is_ok);
     return is_ok;
 }
@@ -380,12 +227,32 @@ ephyrHostGLXVendorPrivGetFBConfigsSGIX(int a_screen,
                                        int32_t * a_props_buf_size,
                                        int32_t ** a_props_buf)
 {
-    Bool is_ok = FALSE;
+    Bool is_ok=FALSE;
+    xcb_connection_t *conn = hostx_get_xcbconn();
+    int screen = hostx_get_screen();
+    xcb_glx_vendor_private_with_reply_cookie_t cookie;
+    union {
+        xcb_glx_vendor_private_with_reply_reply_t *vprep;
+        xcb_glx_get_visual_configs_reply_t *rep;
+    } reply;
 
     EPHYR_LOG("enter\n");
+    cookie = xcb_glx_vendor_private_with_reply(conn,
+                                               X_GLXvop_GetFBConfigsSGIX,
+                                               0, 4, (uint8_t *)&screen);
+    reply.vprep = xcb_glx_vendor_private_with_reply_reply(conn, cookie, NULL);
+    if (!reply.vprep)
+        goto out;
     is_ok = ephyrHostGLXGetVisualConfigsInternal
         (EPHYR_VENDOR_PRIV_GET_FB_CONFIG_SGIX,
-         a_screen, a_num_visuals, a_num_props, a_props_buf_size, a_props_buf);
+         reply.rep,
+         a_screen,
+         a_num_visuals,
+         a_num_props,
+         a_props_buf_size,
+         a_props_buf);
+out:
+    free(reply.vprep);
     EPHYR_LOG("leave\n");
     return is_ok;
 }
@@ -394,54 +261,33 @@ Bool
 ephyrHostGLXSendClientInfo(int32_t a_major, int32_t a_minor,
                            const char *a_extension_list)
 {
-    Bool is_ok = FALSE;
-    Display *dpy = hostx_get_display();
-    xGLXClientInfoReq *req;
+    xcb_connection_t *conn = hostx_get_xcbconn();
     int size;
-    int32_t major_opcode = 0;
-
-    EPHYR_RETURN_VAL_IF_FAIL(dpy && a_extension_list, FALSE);
-
-    if (!ephyrHostGLXGetMajorOpcode(&major_opcode)) {
-        EPHYR_LOG_ERROR("failed to get major opcode\n");
-        goto out;
-    }
-
-    LockDisplay(dpy);
-
-    GetReq(GLXClientInfo, req);
-    req->reqType = major_opcode;
-    req->glxCode = X_GLXClientInfo;
-    req->major = a_major;
-    req->minor = a_minor;
 
-    size = strlen(a_extension_list) + 1;
-    req->length += bytes_to_int32(size);
-    req->numbytes = size;
-    Data(dpy, a_extension_list, size);
+    EPHYR_RETURN_VAL_IF_FAIL(conn && a_extension_list, FALSE);
 
-    UnlockDisplay(dpy);
-    SyncHandle();
+    size = strlen (a_extension_list) + 1;
+    xcb_glx_client_info(conn, a_major, a_minor, size, a_extension_list);
 
-    is_ok = TRUE;
-
- out:
-    return is_ok;
+    return TRUE;
 }
 
 Bool
 ephyrHostGLXCreateContext(int a_screen,
-                          int a_visual_id,
+                          int a_generic_id,
                           int a_context_id,
-                          int a_share_list_ctxt_id, Bool a_direct)
+                          int a_share_list_ctxt_id,
+                          int a_render_type,
+                          Bool a_direct,
+                          int code)
 {
+    xcb_connection_t *conn = hostx_get_xcbconn();
     Bool is_ok = FALSE;
-    Display *dpy = hostx_get_display();
-    int major_opcode = 0, remote_context_id = 0;
-    xGLXCreateContextReq *req;
+    int remote_context_id = 0;
 
-    EPHYR_LOG("enter. screen:%d, visual:%d, contextid:%d, direct:%d\n",
-              a_screen, a_visual_id, a_context_id, a_direct);
+    EPHYR_LOG("enter. screen:%d, generic_id:%d, contextid:%d, rendertype:%d, "
+                 "direct:%d\n", a_screen, a_generic_id, a_context_id,
+                 a_render_type, a_direct);
 
     if (!hostx_allocate_resource_id_peer(a_context_id, &remote_context_id)) {
         EPHYR_LOG_ERROR("failed to peer the context id %d host X",
@@ -449,25 +295,30 @@ ephyrHostGLXCreateContext(int a_screen,
         goto out;
     }
 
-    if (!ephyrHostGLXGetMajorOpcode(&major_opcode)) {
-        EPHYR_LOG_ERROR("failed to get major opcode\n");
-        goto out;
+    switch (code) {
+    case X_GLXCreateContext: {
+        xcb_glx_create_context(conn,
+                               remote_context_id,
+                               a_generic_id,
+                               hostx_get_screen(),
+                               a_share_list_ctxt_id,
+                               a_direct);
+   }
+
+    case X_GLXCreateNewContext: {
+        xcb_glx_create_new_context(conn,
+                                   remote_context_id,
+                                   a_generic_id,
+                                   hostx_get_screen(),
+                                   a_render_type,
+                                   a_share_list_ctxt_id,
+                                   a_direct);
     }
 
-    LockDisplay(dpy);
-
-    /* Send the glXCreateContext request */
-    GetReq(GLXCreateContext, req);
-    req->reqType = major_opcode;
-    req->glxCode = X_GLXCreateContext;
-    req->context = remote_context_id;
-    req->visual = a_visual_id;
-    req->screen = DefaultScreen(dpy);
-    req->shareList = a_share_list_ctxt_id;
-    req->isDirect = a_direct;
-
-    UnlockDisplay(dpy);
-    SyncHandle();
+    default:
+        /* This should never be reached !*/
+        EPHYR_LOG("Internal error! Invalid CreateContext code!\n");
+    }
 
     is_ok = TRUE;
 
@@ -479,30 +330,19 @@ ephyrHostGLXCreateContext(int a_screen,
 Bool
 ephyrHostDestroyContext(int a_ctxt_id)
 {
+    xcb_connection_t *conn = hostx_get_xcbconn();
     Bool is_ok = FALSE;
-    Display *dpy = hostx_get_display();
-    int major_opcode = 0, remote_ctxt_id = 0;
-    xGLXDestroyContextReq *req = NULL;
+    int remote_ctxt_id = 0;
 
     EPHYR_LOG("enter:%d\n", a_ctxt_id);
 
-    if (!ephyrHostGLXGetMajorOpcode(&major_opcode)) {
-        EPHYR_LOG_ERROR("failed to get major opcode\n");
-        goto out;
-    }
     if (!hostx_get_resource_id_peer(a_ctxt_id, &remote_ctxt_id)) {
         EPHYR_LOG_ERROR("failed to get remote glx ctxt id\n");
         goto out;
     }
     EPHYR_LOG("host context id:%d\n", remote_ctxt_id);
 
-    LockDisplay(dpy);
-    GetReq(GLXDestroyContext, req);
-    req->reqType = major_opcode;
-    req->glxCode = X_GLXDestroyContext;
-    req->context = remote_ctxt_id;
-    UnlockDisplay(dpy);
-    SyncHandle();
+    xcb_glx_destroy_context(conn, remote_ctxt_id);
 
     is_ok = TRUE;
 
@@ -512,49 +352,74 @@ ephyrHostDestroyContext(int a_ctxt_id)
 }
 
 Bool
-ephyrHostGLXMakeCurrent(int a_drawable,
+ephyrHostGLXMakeCurrent(int a_drawable, int a_readable,
                         int a_glx_ctxt_id, int a_old_ctxt_tag, int *a_ctxt_tag)
 {
+    xcb_connection_t *conn = hostx_get_xcbconn();
     Bool is_ok = FALSE;
-    Display *dpy = hostx_get_display();
-    int32_t major_opcode = 0;
     int remote_glx_ctxt_id = 0;
-    xGLXMakeCurrentReq *req;
-    xGLXMakeCurrentReply reply;
 
     EPHYR_RETURN_VAL_IF_FAIL(a_ctxt_tag, FALSE);
 
-    EPHYR_LOG("enter. drawable:%d, context:%d, oldtag:%d\n",
-              a_drawable, a_glx_ctxt_id, a_old_ctxt_tag);
+    EPHYR_LOG("enter. drawable:%d, read:%d, context:%d, oldtag:%d\n",
+              a_drawable, a_readable, a_glx_ctxt_id, a_old_ctxt_tag);
 
-    if (!ephyrHostGLXGetMajorOpcode(&major_opcode)) {
-        EPHYR_LOG_ERROR("failed to get major opcode\n");
-        goto out;
-    }
     if (!hostx_get_resource_id_peer(a_glx_ctxt_id, &remote_glx_ctxt_id)) {
         EPHYR_LOG_ERROR("failed to get remote glx ctxt id\n");
         goto out;
     }
 
-    LockDisplay(dpy);
-
-    GetReq(GLXMakeCurrent, req);
-    req->reqType = major_opcode;
-    req->glxCode = X_GLXMakeCurrent;
-    req->drawable = a_drawable;
-    req->context = remote_glx_ctxt_id;
-    req->oldContextTag = a_old_ctxt_tag;
-
-    memset(&reply, 0, sizeof(reply));
-    if (!_XReply(dpy, (xReply *) & reply, 0, False)) {
-        EPHYR_LOG_ERROR("failed to get reply from host\n");
-        UnlockDisplay(dpy);
-        SyncHandle();
-        goto out;
+    /* If both drawables are the same, use the old MakeCurrent request.
+     * Otherwise, if we have GLX 1.3 or higher, use the MakeContextCurrent
+     * request which supports separate read and draw targets.  Failing that,
+     * try the SGI MakeCurrentRead extension.  Logic cribbed from Mesa. */
+    if (a_drawable == a_readable) {
+        xcb_glx_make_current_cookie_t cookie;
+        xcb_glx_make_current_reply_t *reply;
+        cookie = xcb_glx_make_current(conn,
+                                      a_drawable,
+                                      remote_glx_ctxt_id,
+                                      a_old_ctxt_tag);
+        reply = xcb_glx_make_current_reply(conn, cookie, NULL);
+        if (!reply)
+            goto out;
+        *a_ctxt_tag = reply->context_tag;
+        free(reply);
+    }
+    else if (glx_major > 1 || glx_minor >= 3) {
+        xcb_glx_make_context_current_cookie_t cookie;
+        xcb_glx_make_context_current_reply_t *reply;
+        cookie = xcb_glx_make_context_current(conn,
+                                              a_old_ctxt_tag,
+                                              a_drawable,
+                                              a_readable,
+                                              remote_glx_ctxt_id);
+        reply = xcb_glx_make_context_current_reply(conn, cookie, NULL);
+        if (!reply)
+            goto out;
+        *a_ctxt_tag = reply->context_tag;
+        free(reply);
+    }
+    else {
+        xcb_glx_vendor_private_with_reply_cookie_t cookie;
+        xcb_glx_vendor_private_with_reply_reply_t *reply;
+        uint32_t data[3] = {
+            a_drawable, a_readable, remote_glx_ctxt_id,
+        };
+
+        EPHYR_LOG("enter\n");
+        cookie = xcb_glx_vendor_private_with_reply(conn,
+                                                   X_GLXvop_MakeCurrentReadSGI,
+                                                   a_old_ctxt_tag,
+                                                   sizeof(data),
+                                                   (uint8_t *)data);
+        reply = xcb_glx_vendor_private_with_reply_reply(conn, cookie, NULL);
+
+        *a_ctxt_tag = reply->retval;
+
+        free(reply);
     }
-    UnlockDisplay(dpy);
-    SyncHandle();
-    *a_ctxt_tag = reply.contextTag;
+
     EPHYR_LOG("context tag:%d\n", *a_ctxt_tag);
     is_ok = TRUE;
 
@@ -563,79 +428,32 @@ ephyrHostGLXMakeCurrent(int a_drawable,
     return is_ok;
 }
 
-#define X_GLXSingle 0
-
-#define __EPHYR_GLX_SINGLE_PUT_CHAR(offset,a) \
-    *((INT8 *) (pc + offset)) = a
-
-#define EPHYR_GLX_SINGLE_PUT_SHORT(offset,a) \
-    *((INT16 *) (pc + offset)) = a
-
-#define EPHYR_GLX_SINGLE_PUT_LONG(offset,a) \
-    *((INT32 *) (pc + offset)) = a
-
-#define EPHYR_GLX_SINGLE_PUT_FLOAT(offset,a) \
-    *((FLOAT32 *) (pc + offset)) = a
-
-#define EPHYR_GLX_SINGLE_READ_XREPLY()       \
-    (void) _XReply(dpy, (xReply*) &reply, 0, False)
-
-#define EPHYR_GLX_SINGLE_GET_RETVAL(a,cast) \
-    a = (cast) reply.retval
-
-#define EPHYR_GLX_SINGLE_GET_SIZE(a) \
-    a = (GLint) reply.size
-
-#define EPHYR_GLX_SINGLE_GET_CHAR(p) \
-    *p = *(GLbyte *)&reply.pad3;
-
-#define EPHYR_GLX_SINGLE_GET_SHORT(p) \
-    *p = *(GLshort *)&reply.pad3;
-
-#define EPHYR_GLX_SINGLE_GET_LONG(p) \
-    *p = *(GLint *)&reply.pad3;
-
-#define EPHYR_GLX_SINGLE_GET_FLOAT(p) \
-    *p = *(GLfloat *)&reply.pad3;
-
 Bool
 ephyrHostGetIntegerValue(int a_current_context_tag, int a_int, int *a_val)
 {
+    xcb_connection_t *conn = hostx_get_xcbconn();
     Bool is_ok = FALSE;
-    Display *dpy = hostx_get_display();
-    int major_opcode = 0, size = 0;
-    xGLXSingleReq *req = NULL;
-    xGLXSingleReply reply;
-    unsigned char *pc = NULL;
+    int size = 0;
+    xcb_glx_get_integerv_cookie_t cookie;
+    xcb_glx_get_integerv_reply_t *reply;
 
     EPHYR_RETURN_VAL_IF_FAIL(a_val, FALSE);
 
     EPHYR_LOG("enter\n");
-    if (!ephyrHostGLXGetMajorOpcode(&major_opcode)) {
-        EPHYR_LOG_ERROR("failed to get major opcode\n");
+    cookie = xcb_glx_get_integerv(conn, a_current_context_tag, a_int);
+    reply = xcb_glx_get_integerv_reply(conn, cookie, NULL);
+    if (!reply)
         goto out;
-    }
-    LockDisplay(dpy);
-    GetReqExtra(GLXSingle, 4, req);
-    req->reqType = major_opcode;
-    req->glxCode = X_GLsop_GetIntegerv;
-    req->contextTag = a_current_context_tag;
-    pc = ((unsigned char *) (req) + sz_xGLXSingleReq);
-    EPHYR_GLX_SINGLE_PUT_LONG(0, a_int);
-    EPHYR_GLX_SINGLE_READ_XREPLY();
-    EPHYR_GLX_SINGLE_GET_SIZE(size);
+    size = reply->n;
     if (!size) {
-        UnlockDisplay(dpy);
-        SyncHandle();
         EPHYR_LOG_ERROR("X_GLsop_GetIngerv failed\n");
         goto out;
     }
-    EPHYR_GLX_SINGLE_GET_LONG(a_val);
-    UnlockDisplay(dpy);
-    SyncHandle();
+    *a_val = reply->datum;
     is_ok = TRUE;
 
- out:
+out:
+    free(reply);
     EPHYR_LOG("leave\n");
     return is_ok;
 }
@@ -644,40 +462,29 @@ Bool
 ephyrHostIsContextDirect(int a_ctxt_id, int *a_is_direct)
 {
     Bool is_ok = FALSE;
-    Display *dpy = hostx_get_display();
-    xGLXIsDirectReq *req = NULL;
-    xGLXIsDirectReply reply;
-    int major_opcode = 0, remote_glx_ctxt_id = 0;
+    xcb_connection_t *conn = hostx_get_xcbconn();
+    xcb_glx_is_direct_cookie_t cookie;
+    xcb_glx_is_direct_reply_t *reply = NULL;
+    int remote_glx_ctxt_id = 0;
 
     EPHYR_LOG("enter\n");
-    if (!ephyrHostGLXGetMajorOpcode(&major_opcode)) {
-        EPHYR_LOG_ERROR("failed to get major opcode\n");
-        goto out;
-    }
-    if (!hostx_get_resource_id_peer(a_ctxt_id, &remote_glx_ctxt_id)) {
-        EPHYR_LOG_ERROR("failed to get remote glx ctxt id\n");
+    if (!hostx_get_resource_id_peer (a_ctxt_id, &remote_glx_ctxt_id)) {
+        EPHYR_LOG_ERROR ("failed to get remote glx ctxt id\n");
         goto out;
     }
-    memset(&reply, 0, sizeof(reply));
 
     /* Send the glXIsDirect request */
-    LockDisplay(dpy);
-    GetReq(GLXIsDirect, req);
-    req->reqType = major_opcode;
-    req->glxCode = X_GLXIsDirect;
-    req->context = remote_glx_ctxt_id;
-    if (!_XReply(dpy, (xReply *) & reply, 0, False)) {
+    cookie = xcb_glx_is_direct(conn, remote_glx_ctxt_id);
+    reply = xcb_glx_is_direct_reply(conn, cookie, NULL);
+    if (!reply) {
         EPHYR_LOG_ERROR("fail in reading reply from host\n");
-        UnlockDisplay(dpy);
-        SyncHandle();
         goto out;
     }
-    UnlockDisplay(dpy);
-    SyncHandle();
-    *a_is_direct = reply.isDirect;
+    *a_is_direct = reply->is_direct;
     is_ok = TRUE;
 
- out:
+out:
+    free(reply);
     EPHYR_LOG("leave\n");
     return is_ok;
 }
index 9c60120..309d0f2 100644 (file)
@@ -35,10 +35,12 @@ enum EphyrHostGLXGetStringOps {
 };
 
 Bool ephyrHostGLXQueryVersion(int *a_maj, int *a_min);
-Bool ephyrHostGLXGetStringFromServer(int a_screen_number,
-                                     int a_string_name,
-                                     enum EphyrHostGLXGetStringOps a_op,
-                                     char **a_string);
+Bool ephyrHostGLXGetString(int a_context_tag,
+                           int a_string_name,
+                           char **a_string);
+Bool ephyrHostGLXQueryServerString(int a_screen_number,
+                                   int a_string_name,
+                                   char **a_string);
 Bool ephyrHostGLXGetVisualConfigs(int a_screen,
                                   int32_t * a_num_visuals,
                                   int32_t * a_num_props,
@@ -51,17 +53,19 @@ ephyrHostGLXVendorPrivGetFBConfigsSGIX(int a_screen,
                                        int32_t * a_num_props,
                                        int32_t * a_props_buf_size,
                                        int32_t ** a_props_buf);
-Bool ephyrHostGLXGetMajorOpcode(int32_t * a_opcode);
 Bool ephyrHostGLXSendClientInfo(int32_t a_major, int32_t a_minor,
                                 const char *a_extension_list);
 Bool ephyrHostGLXCreateContext(int a_screen,
-                               int a_visual_id,
+                               int a_generic_id,
                                int a_context_id,
-                               int a_shared_list_ctx_id, Bool a_direct);
+                               int a_share_list_ctxt_id,
+                               int a_render_type,
+                               Bool a_direct,
+                               int code);
 
 Bool ephyrHostDestroyContext(int a_ctxt_id);
 
-Bool ephyrHostGLXMakeCurrent(int a_drawable, int a_glx_ctxt_id,
+Bool ephyrHostGLXMakeCurrent(int a_drawable, int a_readable, int a_glx_ctxt_id,
                              int a_olg_ctxt_tag, int *a_ctxt_tag);
 
 Bool ephyrHostGetIntegerValue(int a_current_context_tag, int a_int, int *a_val);
diff --git a/hw/kdrive/ephyr/ephyrhostproxy.c b/hw/kdrive/ephyr/ephyrhostproxy.c
deleted file mode 100644 (file)
index 410e6b6..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Xephyr - A kdrive X server thats runs in a host X window.
- *          Authored by Matthew Allum <mallum@openedhand.com>
- * 
- * Copyright Â© 2007 OpenedHand Ltd 
- *
- * 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 OpenedHand Ltd not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. OpenedHand Ltd makes no
- * representations about the suitability of this software for any purpose.  It
- * is provided "as is" without express or implied warranty.
- *
- * OpenedHand Ltd DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL OpenedHand Ltd 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.
- *
- * Authors:
- *    Dodji Seketeli <dodji@openedhand.com>
- */
-
-#ifdef HAVE_CONFIG_H
-#include <kdrive-config.h>
-#endif
-
-#include <X11/Xlibint.h>
-#define _HAVE_XALLOC_DECLS
-#include "ephyrlog.h"
-#include "ephyrhostproxy.h"
-#include "hostx.h"
-
-/* byte swap a short */
-#define swaps(x, n) { \
-    n = ((char *) (x))[0];\
-    ((char *) (x))[0] = ((char *) (x))[1];\
-    ((char *) (x))[1] = n; }
-
-#define GetXReq(req) \
-    WORD64ALIGN ;\
-    if ((dpy->bufptr + SIZEOF(xReq)) > dpy->bufmax)\
-            _XFlush(dpy);\
-    req = (xReq *)(dpy->last_req = dpy->bufptr);\
-    dpy->bufptr += SIZEOF(xReq);\
-    dpy->request++
-
-Bool
-ephyrHostProxyDoForward(pointer a_request_buffer,
-                        struct XReply *a_reply, Bool a_do_swap)
-{
-    Bool is_ok = FALSE;
-    int n = 0;
-    Display *dpy = hostx_get_display();
-    xReq *in_req = (xReq *) a_request_buffer;
-    xReq *forward_req = NULL;
-    struct XReply reply;
-
-    EPHYR_RETURN_VAL_IF_FAIL(in_req && dpy, FALSE);
-
-    EPHYR_LOG("enter\n");
-
-    if (a_do_swap) {
-        swaps(&in_req->length);
-    }
-    EPHYR_LOG("Req {type:%d, data:%d, length:%d}\n",
-              in_req->reqType, in_req->data, in_req->length);
-    GetXReq(forward_req);
-    memmove(forward_req, in_req, 4);
-
-    if (!_XReply(dpy, (xReply *) & reply, 0, FALSE)) {
-        EPHYR_LOG_ERROR("failed to get reply\n");
-        goto out;
-    }
-    EPHYR_LOG("XReply{type:%d, foo:%d, seqnum:%d, length:%d}\n",
-              reply.type, reply.foo, reply.sequence_number, reply.length);
-
-    if (a_reply) {
-        memmove(a_reply, &reply, sizeof(reply));
-    }
-    is_ok = TRUE;
-
- out:
-    EPHYR_LOG("leave\n");
-    return is_ok;
-}
diff --git a/hw/kdrive/ephyr/ephyrhostproxy.h b/hw/kdrive/ephyr/ephyrhostproxy.h
deleted file mode 100644 (file)
index 1372160..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Xephyr - A kdrive X server thats runs in a host X window.
- *          Authored by Matthew Allum <mallum@openedhand.com>
- * 
- * Copyright Â© 2007 OpenedHand Ltd 
- *
- * 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 OpenedHand Ltd not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. OpenedHand Ltd makes no
- * representations about the suitability of this software for any purpose.  It
- * is provided "as is" without express or implied warranty.
- *
- * OpenedHand Ltd DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL OpenedHand Ltd 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.
- *
- * Authors:
- *    Dodji Seketeli <dodji@openedhand.com>
- */
-
-#ifndef __EPHYRHOSTPROXY_H__
-#define __EPHYRHOSTPROXY_H__
-
-struct XReply {
-    int8_t type;                /*X_Reply */
-    int8_t foo;
-    int16_t sequence_number;
-    int32_t length;
-    /*following is some data up to 32 bytes lenght */
-    int32_t pad0;
-    int32_t pad1;
-    int32_t pad2;
-    int32_t pad3;
-    int32_t pad4;
-    int32_t pad5;
-};
-
-Bool
-
-ephyrHostProxyDoForward(pointer a_request_buffer,
-                        struct XReply *a_reply, Bool a_do_swap);
-
-#endif /*__EPHYRHOSTPROXY_H__*/
diff --git a/hw/kdrive/ephyr/ephyrhostvideo.c b/hw/kdrive/ephyr/ephyrhostvideo.c
deleted file mode 100644 (file)
index 05a821b..0000000
+++ /dev/null
@@ -1,975 +0,0 @@
-/*
- * Xephyr - A kdrive X server thats runs in a host X window.
- *          Authored by Matthew Allum <mallum@openedhand.com>
- * 
- * Copyright Â© 2007 OpenedHand Ltd 
- *
- * 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 OpenedHand Ltd not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. OpenedHand Ltd makes no
- * representations about the suitability of this software for any purpose.  It
- * is provided "as is" without express or implied warranty.
- *
- * OpenedHand Ltd DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL OpenedHand Ltd 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.
- *
- * Authors:
- *    Dodji Seketeli <dodji@openedhand.com>
- */
-#ifdef HAVE_CONFIG_H
-#include <kdrive-config.h>
-#endif
-/*
- * including some server headers (like kdrive-config.h)
- * might define the macro _XSERVER64
- * on 64 bits machines. That macro must _NOT_ be defined for Xlib
- * client code, otherwise bad things happen.
- * So let's undef that macro if necessary.
- */
-#ifdef _XSERVER64
-#undef _XSERVER64
-#endif
-#include <X11/Xutil.h>
-#include <X11/Xlibint.h>
-#include <X11/extensions/Xvlib.h>
-#include <X11/extensions/Xvproto.h>
-#include <X11/extensions/Xext.h>
-#include <X11/extensions/extutil.h>
-#define _HAVE_XALLOC_DECLS
-
-#include "hostx.h"
-#include "ephyrhostvideo.h"
-#include "ephyrlog.h"
-
-#ifndef TRUE
-#define TRUE 1
-#endif /*TRUE*/
-#ifndef FALSE
-#define FALSE 0
-#endif /*FALSE*/
-static XExtensionInfo _xv_info_data;
-static XExtensionInfo *xv_info = &_xv_info_data;
-static char *xv_extension_name = XvName;
-static char *xv_error_string(Display * dpy, int code, XExtCodes * codes,
-                             char *buf, int n);
-static int xv_close_display(Display * dpy, XExtCodes * codes);
-static Bool xv_wire_to_event(Display * dpy, XEvent * host, xEvent *wire);
-
-static XExtensionHooks xv_extension_hooks = {
-    NULL,                       /* create_gc */
-    NULL,                       /* copy_gc */
-    NULL,                       /* flush_gc */
-    NULL,                       /* free_gc */
-    NULL,                       /* create_font */
-    NULL,                       /* free_font */
-    xv_close_display,           /* close_display */
-    xv_wire_to_event,           /* wire_to_event */
-    NULL,                       /* event_to_wire */
-    NULL,                       /* error */
-    xv_error_string             /* error_string */
-};
-
-static char *xv_error_list[] = {
-    "BadPort",                  /* XvBadPort     */
-    "BadEncoding",              /* XvBadEncoding */
-    "BadControl"                /* XvBadControl  */
-};
-
-#define XvCheckExtension(dpy, i, val) \
-  XextCheckExtension(dpy, i, xv_extension_name, val)
-#define XvGetReq(name, req) \
-        WORD64ALIGN\
-        if ((dpy->bufptr + SIZEOF(xv##name##Req)) > dpy->bufmax)\
-                _XFlush(dpy);\
-        req = (xv##name##Req *)(dpy->last_req = dpy->bufptr);\
-        req->reqType = info->codes->major_opcode;\
-        req->xvReqType = xv_##name; \
-        req->length = (SIZEOF(xv##name##Req))>>2;\
-        dpy->bufptr += SIZEOF(xv##name##Req);\
-        dpy->request++
-
-static
-XEXT_GENERATE_CLOSE_DISPLAY(xv_close_display, xv_info)
-
-static
-XEXT_GENERATE_FIND_DISPLAY(xv_find_display, xv_info,
-                           xv_extension_name,
-                           &xv_extension_hooks, XvNumEvents, NULL)
-
-static
-XEXT_GENERATE_ERROR_STRING(xv_error_string, xv_extension_name,
-                           XvNumErrors, xv_error_list)
-
-struct _EphyrHostXVAdaptorArray {
-    XvAdaptorInfo *adaptors;
-    unsigned int nb_adaptors;
-};
-
-/*heavily copied from libx11*/
-#define BUFSIZE 2048
-static void
-ephyrHostXVLogXErrorEvent(Display * a_display,
-                          XErrorEvent * a_err_event, FILE * a_fp)
-{
-    char buffer[BUFSIZ];
-    char mesg[BUFSIZ];
-    char number[32];
-    const char *mtype = "XlibMessage";
-    register _XExtension *ext = (_XExtension *) NULL;
-    _XExtension *bext = (_XExtension *) NULL;
-    Display *dpy = a_display;
-
-    XGetErrorText(dpy, a_err_event->error_code, buffer, BUFSIZ);
-    XGetErrorDatabaseText(dpy, mtype, "XError", "X Error", mesg, BUFSIZ);
-    (void) fprintf(a_fp, "%s:  %s\n  ", mesg, buffer);
-    XGetErrorDatabaseText(dpy, mtype, "MajorCode", "Request Major code %d",
-                          mesg, BUFSIZ);
-    (void) fprintf(a_fp, mesg, a_err_event->request_code);
-    if (a_err_event->request_code < 128) {
-        snprintf(number, sizeof(number), "%d", a_err_event->request_code);
-        XGetErrorDatabaseText(dpy, "XRequest", number, "", buffer, BUFSIZ);
-    }
-    else {
-        for (ext = dpy->ext_procs;
-             ext && (ext->codes.major_opcode != a_err_event->request_code);
-             ext = ext->next);
-        if (ext)
-            strcpy(buffer, ext->name);
-        else
-            buffer[0] = '\0';
-    }
-    (void) fprintf(a_fp, " (%s)\n", buffer);
-    if (a_err_event->request_code >= 128) {
-        XGetErrorDatabaseText(dpy, mtype, "MinorCode", "Request Minor code %d",
-                              mesg, BUFSIZ);
-        fputs("  ", a_fp);
-        (void) fprintf(a_fp, mesg, a_err_event->minor_code);
-        if (ext) {
-            snprintf(mesg, sizeof(mesg), "%s.%d",
-                     ext->name, a_err_event->minor_code);
-            XGetErrorDatabaseText(dpy, "XRequest", mesg, "", buffer, BUFSIZ);
-            (void) fprintf(a_fp, " (%s)", buffer);
-        }
-        fputs("\n", a_fp);
-    }
-    if (a_err_event->error_code >= 128) {
-        /* kludge, try to find the extension that caused it */
-        buffer[0] = '\0';
-        for (ext = dpy->ext_procs; ext; ext = ext->next) {
-            if (ext->error_string)
-                (*ext->error_string) (dpy, a_err_event->error_code, &ext->codes,
-                                      buffer, BUFSIZ);
-            if (buffer[0]) {
-                bext = ext;
-                break;
-            }
-            if (ext->codes.first_error &&
-                ext->codes.first_error < (int) a_err_event->error_code &&
-                (!bext || ext->codes.first_error > bext->codes.first_error))
-                bext = ext;
-        }
-        if (bext)
-            snprintf(buffer, sizeof(buffer), "%s.%d", bext->name,
-                     a_err_event->error_code - bext->codes.first_error);
-        else
-            strcpy(buffer, "Value");
-        XGetErrorDatabaseText(dpy, mtype, buffer, "", mesg, BUFSIZ);
-        if (mesg[0]) {
-            fputs("  ", a_fp);
-            (void) fprintf(a_fp, mesg, a_err_event->resourceid);
-            fputs("\n", a_fp);
-        }
-        /* let extensions try to print the values */
-        for (ext = dpy->ext_procs; ext; ext = ext->next) {
-            if (ext->error_values)
-                (*ext->error_values) (dpy, a_err_event, a_fp);
-        }
-    }
-    else if ((a_err_event->error_code == BadWindow) ||
-             (a_err_event->error_code == BadPixmap) ||
-             (a_err_event->error_code == BadCursor) ||
-             (a_err_event->error_code == BadFont) ||
-             (a_err_event->error_code == BadDrawable) ||
-             (a_err_event->error_code == BadColor) ||
-             (a_err_event->error_code == BadGC) ||
-             (a_err_event->error_code == BadIDChoice) ||
-             (a_err_event->error_code == BadValue) ||
-             (a_err_event->error_code == BadAtom)) {
-        if (a_err_event->error_code == BadValue)
-            XGetErrorDatabaseText(dpy, mtype, "Value", "Value 0x%x",
-                                  mesg, BUFSIZ);
-        else if (a_err_event->error_code == BadAtom)
-            XGetErrorDatabaseText(dpy, mtype, "AtomID", "AtomID 0x%x",
-                                  mesg, BUFSIZ);
-        else
-            XGetErrorDatabaseText(dpy, mtype, "ResourceID", "ResourceID 0x%x",
-                                  mesg, BUFSIZ);
-        fputs("  ", a_fp);
-        (void) fprintf(a_fp, mesg, a_err_event->resourceid);
-        fputs("\n", a_fp);
-    }
-    XGetErrorDatabaseText(dpy, mtype, "ErrorSerial", "Error Serial #%d",
-                          mesg, BUFSIZ);
-    fputs("  ", a_fp);
-    (void) fprintf(a_fp, mesg, a_err_event->serial);
-    XGetErrorDatabaseText(dpy, mtype, "CurrentSerial", "Current Serial #%d",
-                          mesg, BUFSIZ);
-    fputs("\n  ", a_fp);
-    (void) fprintf(a_fp, mesg, dpy->request);
-    fputs("\n", a_fp);
-}
-
-static int
-ephyrHostXVErrorHandler(Display * a_display, XErrorEvent * a_error_event)
-{
-    EPHYR_LOG_ERROR("got an error from the host xserver:\n");
-    ephyrHostXVLogXErrorEvent(a_display, a_error_event, stderr);
-    return Success;
-}
-
-void
-ephyrHostXVInit(void)
-{
-    static Bool s_initialized;
-
-    if (s_initialized)
-        return;
-    XSetErrorHandler(ephyrHostXVErrorHandler);
-    s_initialized = TRUE;
-}
-
-Bool
-ephyrHostXVQueryAdaptors(EphyrHostXVAdaptorArray ** a_adaptors)
-{
-    EphyrHostXVAdaptorArray *result = NULL;
-    int ret = 0;
-    Bool is_ok = FALSE;
-
-    EPHYR_RETURN_VAL_IF_FAIL(a_adaptors, FALSE);
-
-    EPHYR_LOG("enter\n");
-
-    result = calloc(1, sizeof(EphyrHostXVAdaptorArray));
-    if (!result)
-        goto out;
-
-    ret = XvQueryAdaptors(hostx_get_display(),
-                          DefaultRootWindow(hostx_get_display()),
-                          &result->nb_adaptors, &result->adaptors);
-    if (ret != Success) {
-        EPHYR_LOG_ERROR("failed to query host adaptors: %d\n", ret);
-        goto out;
-    }
-    *a_adaptors = result;
-    is_ok = TRUE;
-
- out:
-    EPHYR_LOG("leave\n");
-    return is_ok;
-}
-
-void
-ephyrHostXVAdaptorArrayDelete(EphyrHostXVAdaptorArray * a_adaptors)
-{
-    if (!a_adaptors)
-        return;
-    if (a_adaptors->adaptors) {
-        XvFreeAdaptorInfo(a_adaptors->adaptors);
-        a_adaptors->adaptors = NULL;
-        a_adaptors->nb_adaptors = 0;
-    }
-    XFree(a_adaptors);
-}
-
-int
-ephyrHostXVAdaptorArrayGetSize(const EphyrHostXVAdaptorArray * a_this)
-{
-    EPHYR_RETURN_VAL_IF_FAIL(a_this, -1);
-    return a_this->nb_adaptors;
-}
-
-EphyrHostXVAdaptor *
-ephyrHostXVAdaptorArrayAt(const EphyrHostXVAdaptorArray * a_this, int a_index)
-{
-    EPHYR_RETURN_VAL_IF_FAIL(a_this, NULL);
-
-    if (a_index >= a_this->nb_adaptors)
-        return NULL;
-    return (EphyrHostXVAdaptor *) & a_this->adaptors[a_index];
-}
-
-char
-ephyrHostXVAdaptorGetType(const EphyrHostXVAdaptor * a_this)
-{
-    EPHYR_RETURN_VAL_IF_FAIL(a_this, -1);
-    return ((XvAdaptorInfo *) a_this)->type;
-}
-
-const char *
-ephyrHostXVAdaptorGetName(const EphyrHostXVAdaptor * a_this)
-{
-    EPHYR_RETURN_VAL_IF_FAIL(a_this, NULL);
-
-    return ((XvAdaptorInfo *) a_this)->name;
-}
-
-EphyrHostVideoFormat *
-ephyrHostXVAdaptorGetVideoFormats(const EphyrHostXVAdaptor * a_this,
-                                  int *a_nb_formats)
-{
-    EphyrHostVideoFormat *formats = NULL;
-    int nb_formats = 0, i = 0;
-    XVisualInfo *visual_info, visual_info_template;
-    int nb_visual_info;
-
-    EPHYR_RETURN_VAL_IF_FAIL(a_this, NULL);
-
-    nb_formats = ((XvAdaptorInfo *) a_this)->num_formats;
-    formats = calloc(nb_formats, sizeof(EphyrHostVideoFormat));
-    for (i = 0; i < nb_formats; i++) {
-        memset(&visual_info_template, 0, sizeof(visual_info_template));
-        visual_info_template.visualid =
-            ((XvAdaptorInfo *) a_this)->formats[i].visual_id;
-        visual_info = XGetVisualInfo(hostx_get_display(),
-                                     VisualIDMask,
-                                     &visual_info_template, &nb_visual_info);
-        formats[i].depth = ((XvAdaptorInfo *) a_this)->formats[i].depth;
-        formats[i].visual_class = visual_info->class;
-        XFree(visual_info);
-    }
-    if (a_nb_formats)
-        *a_nb_formats = nb_formats;
-    return formats;
-}
-
-int
-ephyrHostXVAdaptorGetNbPorts(const EphyrHostXVAdaptor * a_this)
-{
-    EPHYR_RETURN_VAL_IF_FAIL(a_this, -1);
-
-    return ((XvAdaptorInfo *) a_this)->num_ports;
-}
-
-int
-ephyrHostXVAdaptorGetFirstPortID(const EphyrHostXVAdaptor * a_this)
-{
-    EPHYR_RETURN_VAL_IF_FAIL(a_this, -1);
-
-    return ((XvAdaptorInfo *) a_this)->base_id;
-}
-
-Bool
-ephyrHostXVAdaptorHasPutVideo(const EphyrHostXVAdaptor * a_this, Bool *a_result)
-{
-    EPHYR_RETURN_VAL_IF_FAIL(a_this && a_result, FALSE);
-
-    if ((((XvAdaptorInfo *) a_this)->type & (XvVideoMask | XvInputMask)) ==
-        (XvVideoMask | XvInputMask))
-        *a_result = TRUE;
-    else
-        *a_result = FALSE;
-    return TRUE;
-}
-
-Bool
-ephyrHostXVAdaptorHasGetVideo(const EphyrHostXVAdaptor * a_this, Bool *a_result)
-{
-    if ((((XvAdaptorInfo *) a_this)->type & (XvVideoMask | XvOutputMask)) ==
-        (XvVideoMask | XvOutputMask))
-        *a_result = TRUE;
-    else
-        *a_result = FALSE;
-    return TRUE;
-}
-
-Bool
-ephyrHostXVAdaptorHasPutStill(const EphyrHostXVAdaptor * a_this, Bool *a_result)
-{
-    EPHYR_RETURN_VAL_IF_FAIL(a_this && a_result, FALSE);
-
-    if ((((XvAdaptorInfo *) a_this)->type & (XvStillMask | XvInputMask)) ==
-        (XvStillMask | XvInputMask))
-        *a_result = TRUE;
-    else
-        *a_result = FALSE;
-    return TRUE;
-}
-
-Bool
-ephyrHostXVAdaptorHasGetStill(const EphyrHostXVAdaptor * a_this, Bool *a_result)
-{
-    EPHYR_RETURN_VAL_IF_FAIL(a_this && a_result, FALSE);
-
-    if ((((XvAdaptorInfo *) a_this)->type & (XvStillMask | XvOutputMask)) ==
-        (XvStillMask | XvOutputMask))
-        *a_result = TRUE;
-    else
-        *a_result = FALSE;
-    return TRUE;
-}
-
-Bool
-ephyrHostXVAdaptorHasPutImage(const EphyrHostXVAdaptor * a_this, Bool *a_result)
-{
-    EPHYR_RETURN_VAL_IF_FAIL(a_this && a_result, FALSE);
-
-    if ((((XvAdaptorInfo *) a_this)->type & (XvImageMask | XvInputMask)) ==
-        (XvImageMask | XvInputMask))
-        *a_result = TRUE;
-    else
-        *a_result = FALSE;
-    return TRUE;
-}
-
-Bool
-ephyrHostXVQueryEncodings(int a_port_id,
-                          EphyrHostEncoding ** a_encodings,
-                          unsigned int *a_num_encodings)
-{
-    EphyrHostEncoding *encodings = NULL;
-    XvEncodingInfo *encoding_info = NULL;
-    unsigned int num_encodings = 0, i;
-    int ret = 0;
-
-    EPHYR_RETURN_VAL_IF_FAIL(a_encodings && a_num_encodings, FALSE);
-
-    ret = XvQueryEncodings(hostx_get_display(),
-                           a_port_id, &num_encodings, &encoding_info);
-    if (num_encodings && encoding_info) {
-        encodings = calloc(num_encodings, sizeof(EphyrHostEncoding));
-        for (i = 0; i < num_encodings; i++) {
-            encodings[i].id = encoding_info[i].encoding_id;
-            encodings[i].name = strdup(encoding_info[i].name);
-            encodings[i].width = encoding_info[i].width;
-            encodings[i].height = encoding_info[i].height;
-            encodings[i].rate.numerator = encoding_info[i].rate.numerator;
-            encodings[i].rate.denominator = encoding_info[i].rate.denominator;
-        }
-    }
-    if (encoding_info) {
-        XvFreeEncodingInfo(encoding_info);
-        encoding_info = NULL;
-    }
-    *a_encodings = encodings;
-    *a_num_encodings = num_encodings;
-
-    if (ret != Success)
-        return FALSE;
-    return TRUE;
-}
-
-void
-ephyrHostEncodingsDelete(EphyrHostEncoding * a_encodings, int a_num_encodings)
-{
-    int i = 0;
-
-    if (!a_encodings)
-        return;
-    for (i = 0; i < a_num_encodings; i++) {
-        free(a_encodings[i].name);
-        a_encodings[i].name = NULL;
-    }
-    free(a_encodings);
-}
-
-void
-ephyrHostAttributesDelete(EphyrHostAttribute * a_attributes)
-{
-    if (!a_attributes)
-        return;
-    XFree(a_attributes);
-}
-
-Bool
-ephyrHostXVQueryPortAttributes(int a_port_id,
-                               EphyrHostAttribute ** a_attributes,
-                               int *a_num_attributes)
-{
-    EPHYR_RETURN_VAL_IF_FAIL(a_attributes && a_num_attributes, FALSE);
-
-    *a_attributes =
-        (EphyrHostAttribute *) XvQueryPortAttributes(hostx_get_display(),
-                                                     a_port_id,
-                                                     a_num_attributes);
-
-    return TRUE;
-}
-
-Bool
-ephyrHostXVQueryImageFormats(int a_port_id,
-                             EphyrHostImageFormat ** a_formats,
-                             int *a_num_format)
-{
-    XvImageFormatValues *result = NULL;
-
-    EPHYR_RETURN_VAL_IF_FAIL(a_formats && a_num_format, FALSE);
-
-    result = XvListImageFormats(hostx_get_display(), a_port_id, a_num_format);
-    *a_formats = (EphyrHostImageFormat *) result;
-    return TRUE;
-
-}
-
-Bool
-ephyrHostXVSetPortAttribute(int a_port_id, int a_atom, int a_attr_value)
-{
-    int res = Success;
-
-    EPHYR_LOG("atom,name,value: (%d,%s,%d)\n",
-              a_atom, XGetAtomName(hostx_get_display(), a_atom), a_attr_value);
-
-    res = XvSetPortAttribute(hostx_get_display(),
-                             a_port_id, a_atom, a_attr_value);
-    if (res != Success) {
-        EPHYR_LOG_ERROR("XvSetPortAttribute() failed: %d\n", res);
-        return FALSE;
-    }
-    XFlush(hostx_get_display());
-    EPHYR_LOG("leave\n");
-
-    return TRUE;
-}
-
-Bool
-ephyrHostXVGetPortAttribute(int a_port_id, int a_atom, int *a_attr_value)
-{
-    int res = Success;
-    Bool ret = FALSE;
-
-    EPHYR_RETURN_VAL_IF_FAIL(a_attr_value, FALSE);
-
-    EPHYR_LOG("enter, a_port_id: %d, a_atomid: %d, attr_name: %s\n",
-              a_port_id, a_atom, XGetAtomName(hostx_get_display(), a_atom));
-
-    res = XvGetPortAttribute(hostx_get_display(),
-                             a_port_id, a_atom, a_attr_value);
-    if (res != Success) {
-        EPHYR_LOG_ERROR("XvGetPortAttribute() failed: %d \n", res);
-        goto out;
-    }
-    EPHYR_LOG("atom,value: (%d, %d)\n", a_atom, *a_attr_value);
-
-    ret = TRUE;
-
- out:
-    EPHYR_LOG("leave\n");
-    return ret;
-}
-
-Bool
-ephyrHostXVQueryBestSize(int a_port_id,
-                         Bool a_motion,
-                         unsigned int a_frame_w,
-                         unsigned int a_frame_h,
-                         unsigned int a_drw_w,
-                         unsigned int a_drw_h,
-                         unsigned int *a_actual_w, unsigned int *a_actual_h)
-{
-    int res = 0;
-    Bool is_ok = FALSE;
-
-    EPHYR_RETURN_VAL_IF_FAIL(a_actual_w && a_actual_h, FALSE);
-
-    EPHYR_LOG("enter: frame (%dx%d), drw (%dx%d)\n",
-              a_frame_w, a_frame_h, a_drw_w, a_drw_h);
-
-    res = XvQueryBestSize(hostx_get_display(),
-                          a_port_id,
-                          a_motion,
-                          a_frame_w, a_frame_h,
-                          a_drw_w, a_drw_h, a_actual_w, a_actual_h);
-    if (res != Success) {
-        EPHYR_LOG_ERROR("XvQueryBestSize() failed: %d\n", res);
-        goto out;
-    }
-    XSync(hostx_get_display(), FALSE);
-
-    EPHYR_LOG("actual (%dx%d)\n", *a_actual_w, *a_actual_h);
-    is_ok = TRUE;
-
- out:
-    EPHYR_LOG("leave\n");
-    return is_ok;
-}
-
-static Bool
-xv_wire_to_event(Display * dpy, XEvent * host, xEvent *wire)
-{
-    XExtDisplayInfo *info = xv_find_display(dpy);
-    XvEvent *re = (XvEvent *) host;
-    xvEvent *event = (xvEvent *) wire;
-
-    XvCheckExtension(dpy, info, False);
-
-    switch ((event->u.u.type & 0x7F) - info->codes->first_event) {
-    case XvVideoNotify:
-        re->xvvideo.type = event->u.u.type & 0x7f;
-        re->xvvideo.serial = _XSetLastRequestRead(dpy, (xGenericReply *) event);
-        re->xvvideo.send_event = ((event->u.u.type & 0x80) != 0);
-        re->xvvideo.display = dpy;
-        re->xvvideo.time = event->u.videoNotify.time;
-        re->xvvideo.reason = event->u.videoNotify.reason;
-        re->xvvideo.drawable = event->u.videoNotify.drawable;
-        re->xvvideo.port_id = event->u.videoNotify.port;
-        break;
-    case XvPortNotify:
-        re->xvport.type = event->u.u.type & 0x7f;
-        re->xvport.serial = _XSetLastRequestRead(dpy, (xGenericReply *) event);
-        re->xvport.send_event = ((event->u.u.type & 0x80) != 0);
-        re->xvport.display = dpy;
-        re->xvport.time = event->u.portNotify.time;
-        re->xvport.port_id = event->u.portNotify.port;
-        re->xvport.attribute = event->u.portNotify.attribute;
-        re->xvport.value = event->u.portNotify.value;
-        break;
-    default:
-        return False;
-    }
-
-    return True;
-}
-
-Bool
-ephyrHostXVQueryImageAttributes(int a_port_id,
-                                int a_image_id /*image fourcc code */ ,
-                                unsigned short *a_width,
-                                unsigned short *a_height,
-                                int *a_image_size,
-                                int *a_pitches, int *a_offsets)
-{
-    Display *dpy = hostx_get_display();
-    Bool ret = FALSE;
-    XExtDisplayInfo *info = xv_find_display(dpy);
-    xvQueryImageAttributesReq *req = NULL;
-    xvQueryImageAttributesReply rep;
-
-    EPHYR_RETURN_VAL_IF_FAIL(a_width, FALSE);
-    EPHYR_RETURN_VAL_IF_FAIL(a_height, FALSE);
-    EPHYR_RETURN_VAL_IF_FAIL(a_image_size, FALSE);
-
-    XvCheckExtension(dpy, info, FALSE);
-
-    LockDisplay(dpy);
-
-    XvGetReq(QueryImageAttributes, req);
-    req->id = a_image_id;
-    req->port = a_port_id;
-    req->width = *a_width;
-    req->height = *a_height;
-    /*
-     * read the reply
-     */
-    if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
-        EPHYR_LOG_ERROR("QeryImageAttribute req failed\n");
-        goto out;
-    }
-    if (a_pitches && a_offsets) {
-        _XRead(dpy, (char *) a_pitches, rep.num_planes << 2);
-        _XRead(dpy, (char *) a_offsets, rep.num_planes << 2);
-    }
-    else {
-        _XEatData(dpy, rep.length << 2);
-    }
-    *a_width = rep.width;
-    *a_height = rep.height;
-    *a_image_size = rep.data_size;
-
-    ret = TRUE;
-
- out:
-    UnlockDisplay(dpy);
-    SyncHandle();
-    return ret;
-}
-
-Bool
-ephyrHostGetAtom(const char *a_name, Bool a_create_if_not_exists, int *a_atom)
-{
-    int atom = None;
-
-    EPHYR_RETURN_VAL_IF_FAIL(a_atom, FALSE);
-
-    atom = XInternAtom(hostx_get_display(), a_name, a_create_if_not_exists);
-    if (atom == None) {
-        return FALSE;
-    }
-    *a_atom = atom;
-    return TRUE;
-}
-
-char *
-ephyrHostGetAtomName(int a_atom)
-{
-    return XGetAtomName(hostx_get_display(), a_atom);
-}
-
-void
-ephyrHostFree(void *a_pointer)
-{
-    if (a_pointer)
-        XFree(a_pointer);
-}
-
-Bool
-ephyrHostXVPutImage(int a_screen_num,
-                    int a_port_id,
-                    int a_image_id,
-                    int a_drw_x,
-                    int a_drw_y,
-                    int a_drw_w,
-                    int a_drw_h,
-                    int a_src_x,
-                    int a_src_y,
-                    int a_src_w,
-                    int a_src_h,
-                    int a_image_width,
-                    int a_image_height,
-                    unsigned char *a_buf,
-                    EphyrHostBox * a_clip_rects, int a_clip_rect_nums)
-{
-    Bool is_ok = TRUE;
-    XvImage *xv_image = NULL;
-    GC gc = 0;
-    XGCValues gc_values;
-    Display *dpy = hostx_get_display();
-    XRectangle *rects = NULL;
-    int res = 0;
-
-    EPHYR_RETURN_VAL_IF_FAIL(a_buf, FALSE);
-
-    EPHYR_LOG("enter, num_clip_rects: %d\n", a_clip_rect_nums);
-
-    memset(&gc_values, 0, sizeof(gc_values));
-    gc = XCreateGC(dpy, hostx_get_window(a_screen_num), 0L, &gc_values);
-    if (!gc) {
-        EPHYR_LOG_ERROR("failed to create gc \n");
-        goto out;
-    }
-    xv_image = (XvImage *) XvCreateImage(hostx_get_display(),
-                                         a_port_id, a_image_id,
-                                         NULL, a_image_width, a_image_height);
-    if (!xv_image) {
-        EPHYR_LOG_ERROR("failed to create image\n");
-        goto out;
-    }
-    xv_image->data = (char *) a_buf;
-    if (a_clip_rect_nums) {
-        int i = 0;
-
-        rects = calloc(a_clip_rect_nums, sizeof(XRectangle));
-        for (i = 0; i < a_clip_rect_nums; i++) {
-            rects[i].x = a_clip_rects[i].x1;
-            rects[i].y = a_clip_rects[i].y1;
-            rects[i].width = a_clip_rects[i].x2 - a_clip_rects[i].x1;
-            rects[i].height = a_clip_rects[i].y2 - a_clip_rects[i].y1;
-            EPHYR_LOG("(x,y,w,h): (%d,%d,%d,%d)\n",
-                      rects[i].x, rects[i].y, rects[i].width, rects[i].height);
-        }
-        XSetClipRectangles(dpy, gc, 0, 0, rects, a_clip_rect_nums, YXBanded);
-        /*this always returns 1 */
-    }
-    res = XvPutImage(dpy, a_port_id,
-                     hostx_get_window(a_screen_num),
-                     gc, xv_image,
-                     a_src_x, a_src_y, a_src_w, a_src_h,
-                     a_drw_x, a_drw_y, a_drw_w, a_drw_h);
-    if (res != Success) {
-        EPHYR_LOG_ERROR("XvPutImage() failed: %d\n", res);
-        goto out;
-    }
-    is_ok = TRUE;
-
- out:
-    if (xv_image) {
-        XFree(xv_image);
-        xv_image = NULL;
-    }
-    if (gc) {
-        XFreeGC(dpy, gc);
-        gc = NULL;
-    }
-    free(rects);
-    rects = NULL;
-    EPHYR_LOG("leave\n");
-    return is_ok;
-}
-
-Bool
-ephyrHostXVPutVideo(int a_screen_num, int a_port_id,
-                    int a_vid_x, int a_vid_y, int a_vid_w, int a_vid_h,
-                    int a_drw_x, int a_drw_y, int a_drw_w, int a_drw_h)
-{
-    Bool is_ok = FALSE;
-    int res = FALSE;
-    GC gc = 0;
-    XGCValues gc_values;
-    Display *dpy = hostx_get_display();
-
-    EPHYR_RETURN_VAL_IF_FAIL(dpy, FALSE);
-
-    gc = XCreateGC(dpy, hostx_get_window(a_screen_num), 0L, &gc_values);
-    if (!gc) {
-        EPHYR_LOG_ERROR("failed to create gc \n");
-        goto out;
-    }
-    res = XvPutVideo(dpy, a_port_id, hostx_get_window(a_screen_num), gc,
-                     a_vid_x, a_vid_y, a_vid_w, a_vid_h,
-                     a_drw_x, a_drw_y, a_drw_w, a_drw_h);
-
-    if (res != Success) {
-        EPHYR_LOG_ERROR("XvPutVideo() failed: %d\n", res);
-        goto out;
-    }
-
-    is_ok = TRUE;
-
- out:
-    if (gc) {
-        XFreeGC(dpy, gc);
-        gc = NULL;
-    }
-    return is_ok;
-}
-
-Bool
-ephyrHostXVGetVideo(int a_screen_num, int a_port_id,
-                    int a_vid_x, int a_vid_y, int a_vid_w, int a_vid_h,
-                    int a_drw_x, int a_drw_y, int a_drw_w, int a_drw_h)
-{
-    Bool is_ok = FALSE;
-    int res = FALSE;
-    GC gc = 0;
-    XGCValues gc_values;
-    Display *dpy = hostx_get_display();
-
-    EPHYR_RETURN_VAL_IF_FAIL(dpy, FALSE);
-
-    gc = XCreateGC(dpy, hostx_get_window(a_screen_num), 0L, &gc_values);
-    if (!gc) {
-        EPHYR_LOG_ERROR("failed to create gc \n");
-        goto out;
-    }
-    res = XvGetVideo(dpy, a_port_id, hostx_get_window(a_screen_num), gc,
-                     a_vid_x, a_vid_y, a_vid_w, a_vid_h,
-                     a_drw_x, a_drw_y, a_drw_w, a_drw_h);
-
-    if (res != Success) {
-        EPHYR_LOG_ERROR("XvGetVideo() failed: %d\n", res);
-        goto out;
-    }
-
-    is_ok = TRUE;
-
- out:
-    if (gc) {
-        XFreeGC(dpy, gc);
-        gc = NULL;
-    }
-    return is_ok;
-}
-
-Bool
-ephyrHostXVPutStill(int a_screen_num, int a_port_id,
-                    int a_vid_x, int a_vid_y, int a_vid_w, int a_vid_h,
-                    int a_drw_x, int a_drw_y, int a_drw_w, int a_drw_h)
-{
-    Bool is_ok = FALSE;
-    int res = FALSE;
-    GC gc = 0;
-    XGCValues gc_values;
-    Display *dpy = hostx_get_display();
-
-    EPHYR_RETURN_VAL_IF_FAIL(dpy, FALSE);
-
-    gc = XCreateGC(dpy, hostx_get_window(a_screen_num), 0L, &gc_values);
-    if (!gc) {
-        EPHYR_LOG_ERROR("failed to create gc \n");
-        goto out;
-    }
-    res = XvPutStill(dpy, a_port_id, hostx_get_window(a_screen_num), gc,
-                     a_vid_x, a_vid_y, a_vid_w, a_vid_h,
-                     a_drw_x, a_drw_y, a_drw_w, a_drw_h);
-
-    if (res != Success) {
-        EPHYR_LOG_ERROR("XvPutStill() failed: %d\n", res);
-        goto out;
-    }
-
-    is_ok = TRUE;
-
- out:
-    if (gc) {
-        XFreeGC(dpy, gc);
-        gc = NULL;
-    }
-    return is_ok;
-}
-
-Bool
-ephyrHostXVGetStill(int a_screen_num, int a_port_id,
-                    int a_vid_x, int a_vid_y, int a_vid_w, int a_vid_h,
-                    int a_drw_x, int a_drw_y, int a_drw_w, int a_drw_h)
-{
-    Bool is_ok = FALSE;
-    int res = FALSE;
-    GC gc = 0;
-    XGCValues gc_values;
-    Display *dpy = hostx_get_display();
-
-    EPHYR_RETURN_VAL_IF_FAIL(dpy, FALSE);
-
-    gc = XCreateGC(dpy, hostx_get_window(a_screen_num), 0L, &gc_values);
-    if (!gc) {
-        EPHYR_LOG_ERROR("failed to create gc \n");
-        goto out;
-    }
-    res = XvGetStill(dpy, a_port_id, hostx_get_window(a_screen_num), gc,
-                     a_vid_x, a_vid_y, a_vid_w, a_vid_h,
-                     a_drw_x, a_drw_y, a_drw_w, a_drw_h);
-
-    if (res != Success) {
-        EPHYR_LOG_ERROR("XvGetStill() failed: %d\n", res);
-        goto out;
-    }
-
-    is_ok = TRUE;
-
- out:
-    if (gc) {
-        XFreeGC(dpy, gc);
-        gc = NULL;
-    }
-    return is_ok;
-}
-
-Bool
-ephyrHostXVStopVideo(int a_screen_num, int a_port_id)
-{
-    int ret = 0;
-    Bool is_ok = FALSE;
-    Display *dpy = hostx_get_display();
-
-    EPHYR_RETURN_VAL_IF_FAIL(dpy, FALSE);
-
-    EPHYR_LOG("enter\n");
-
-    ret = XvStopVideo(dpy, a_port_id, hostx_get_window(a_screen_num));
-    if (ret != Success) {
-        EPHYR_LOG_ERROR("XvStopVideo() failed: %d \n", ret);
-        goto out;
-    }
-    is_ok = TRUE;
-
- out:
-    EPHYR_LOG("leave\n");
-    return is_ok;
-}
diff --git a/hw/kdrive/ephyr/ephyrhostvideo.h b/hw/kdrive/ephyr/ephyrhostvideo.h
deleted file mode 100644 (file)
index 0d31772..0000000
+++ /dev/null
@@ -1,231 +0,0 @@
-/*
- * Xephyr - A kdrive X server thats runs in a host X window.
- *          Authored by Matthew Allum <mallum@openedhand.com>
- * 
- * Copyright Â© 2007 OpenedHand Ltd 
- *
- * 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 OpenedHand Ltd not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. OpenedHand Ltd makes no
- * representations about the suitability of this software for any purpose.  It
- * is provided "as is" without express or implied warranty.
- *
- * OpenedHand Ltd DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL OpenedHand Ltd 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.
- *
- * Authors:
- *    Dodji Seketeli <dodji@openedhand.com>
- */
-#ifndef __EPHYRHOSTVIDEO_H__
-#define __EPHYRHOSTVIDEO_H__
-
-typedef void *EphyrHostXVAdaptor;
-typedef struct _EphyrHostXVAdaptorArray EphyrHostXVAdaptorArray;
-
-typedef struct _EphyrHostVideoFormat {
-    char depth;
-    short visual_class;
-} EphyrHostVideoFormat;
-
-typedef struct _EphyrHostRational {
-    int numerator;
-    int denominator;
-} EphyrHostRational;
-
-typedef struct _EphyrHostEncoding {
-    int id;
-    char *name;
-    unsigned short width, height;
-    EphyrHostRational rate;
-} EphyrHostEncoding;
-
-typedef struct _EphyrHostAttribute {
-    int flags;
-    int min_value;
-    int max_value;
-    char *name;
-} EphyrHostAttribute;
-
-typedef struct _EphyrHostImageFormat {
-    int id;                     /* Unique descriptor for the format */
-    int type;                   /* XvRGB, XvYUV */
-    int byte_order;             /* LSBFirst, MSBFirst */
-    char guid[16];              /* Globally Unique IDentifier */
-    int bits_per_pixel;
-    int format;                 /* XvPacked, XvPlanar */
-    int num_planes;
-
-    /* for RGB formats only */
-    int depth;
-    unsigned int red_mask;
-    unsigned int green_mask;
-    unsigned int blue_mask;
-
-    /* for YUV formats only */
-    unsigned int y_sample_bits;
-    unsigned int u_sample_bits;
-    unsigned int v_sample_bits;
-    unsigned int horz_y_period;
-    unsigned int horz_u_period;
-    unsigned int horz_v_period;
-    unsigned int vert_y_period;
-    unsigned int vert_u_period;
-    unsigned int vert_v_period;
-    char component_order[32];   /* eg. UYVY */
-    int scanline_order;         /* XvTopToBottom, XvBottomToTop */
-} EphyrHostImageFormat;
-
-typedef struct {
-    unsigned short x1, y1, x2, y2;
-} EphyrHostBox;
-
-void ephyrHostXVInit(void);
-
-void ephyrHostFree(void *a_pointer);
-
-/*
- * host adaptor array
- */
-Bool ephyrHostXVQueryAdaptors(EphyrHostXVAdaptorArray ** a_adaptors);
-void ephyrHostXVAdaptorArrayDelete(EphyrHostXVAdaptorArray * a_adaptors);
-int ephyrHostXVAdaptorArrayGetSize(const EphyrHostXVAdaptorArray * a_this);
-EphyrHostXVAdaptor *ephyrHostXVAdaptorArrayAt(const EphyrHostXVAdaptorArray *
-                                              a_this, int a_index);
-
-/*
- * host adaptor
- */
-
-char ephyrHostXVAdaptorGetType(const EphyrHostXVAdaptor * a_this);
-const char *ephyrHostXVAdaptorGetName(const EphyrHostXVAdaptor * a_this);
-EphyrHostVideoFormat *ephyrHostXVAdaptorGetVideoFormats
-    (const EphyrHostXVAdaptor * a_this, int *a_nb_formats);
-int ephyrHostXVAdaptorGetNbPorts(const EphyrHostXVAdaptor * a_this);
-int ephyrHostXVAdaptorGetFirstPortID(const EphyrHostXVAdaptor * a_this);
-
-Bool ephyrHostXVAdaptorHasPutVideo(const EphyrHostXVAdaptor * a_this,
-                                   Bool *a_result);
-Bool ephyrHostXVAdaptorHasGetVideo(const EphyrHostXVAdaptor * a_this,
-                                   Bool *a_result);
-Bool ephyrHostXVAdaptorHasPutStill(const EphyrHostXVAdaptor * a_this,
-                                   Bool *a_result);
-Bool ephyrHostXVAdaptorHasGetStill(const EphyrHostXVAdaptor * a_this,
-                                   Bool *a_result);
-Bool ephyrHostXVAdaptorHasPutImage(const EphyrHostXVAdaptor * a_this,
-                                   Bool *a_result);
-
-/*
- * encoding
- */
-Bool ephyrHostXVQueryEncodings(int a_port_id,
-                               EphyrHostEncoding ** a_encodings,
-                               unsigned int *a_num_encodings);
-
-void ephyrHostEncodingsDelete(EphyrHostEncoding * a_encodings,
-                              int a_num_encodings);
-
-/*
- * attribute
- */
-Bool ephyrHostXVQueryPortAttributes(int a_port_id,
-                                    EphyrHostAttribute ** a_attributes,
-                                    int *a_num_attributes);
-
-void ephyrHostAttributesDelete(EphyrHostAttribute * a_attributes);
-
-/*
- * image format
- */
-
-Bool ephyrHostXVQueryImageFormats(int a_port_id,
-                                  EphyrHostImageFormat ** a_formats,
-                                  int *a_num_format);
-/*
- * Port Attribute Get/Set
- */
-Bool ephyrHostXVSetPortAttribute(int a_port_id, int a_atom, int a_attr_value);
-Bool ephyrHostXVGetPortAttribute(int a_port_id, int a_atom, int *a_attr_value);
-
-/*
- *size query
- */
-Bool ephyrHostXVQueryBestSize(int a_port_id,
-                              Bool a_motion,
-                              unsigned int a_frame_w,
-                              unsigned int a_frame_h,
-                              unsigned int a_drw_w,
-                              unsigned int a_drw_h,
-                              unsigned int *a_actual_w,
-                              unsigned int *a_actual_h);
-
-Bool ephyrHostXVQueryImageAttributes(int a_port_id,
-                                     int a_image_id /*image fourcc code */ ,
-                                     unsigned short *a_width,
-                                     unsigned short *a_height,
-                                     int *a_image_size,
-                                     int *a_pitches, int *a_offsets);
-/*
- * atom
- */
-Bool ephyrHostGetAtom(const char *a_name,
-                      Bool a_create_if_not_exists, int *a_atom);
-char *ephyrHostGetAtomName(int a_atom);
-
-/*
- *PutImage
- * (ignore clipping for now)
- */
-Bool ephyrHostXVPutImage(int a_screen_num,
-                         int a_port_id,
-                         int a_image_id,
-                         int a_drw_x,
-                         int a_drw_y,
-                         int a_drw_w,
-                         int a_drw_h,
-                         int a_src_x,
-                         int a_src_y,
-                         int a_src_w,
-                         int a_src_h,
-                         int a_image_width,
-                         int a_image_height,
-                         unsigned char *a_buf,
-                         EphyrHostBox * a_clip_rects, int a_clip_rect_nums);
-
-/*
- * Putvideo/PutStill/GetVideo
- */
-Bool ephyrHostXVPutVideo(int a_screen_num,
-                         int a_port_id,
-                         int a_vid_x, int a_vid_y, int a_vid_w, int a_vid_h,
-                         int a_drw_x, int a_drw_y, int a_drw_w, int a_drw_h);
-
-Bool ephyrHostXVGetVideo(int a_screen_num,
-                         int a_port_id,
-                         int a_vid_x, int a_vid_y, int a_vid_w, int a_vid_h,
-                         int a_drw_x, int a_drw_y, int a_drw_w, int a_drw_h);
-
-Bool ephyrHostXVPutStill(int a_screen_num,
-                         int a_port_id,
-                         int a_vid_x, int a_vid_y, int a_vid_w, int a_vid_h,
-                         int a_drw_x, int a_drw_y, int a_drw_w, int a_drw_h);
-
-Bool ephyrHostXVGetStill(int a_screen_num,
-                         int a_port_id,
-                         int a_vid_x, int a_vid_y, int a_vid_w, int a_vid_h,
-                         int a_drw_x, int a_drw_y, int a_drw_w, int a_drw_h);
-
-/*
- * StopVideo
- */
-Bool ephyrHostXVStopVideo(int a_screen_num, int a_port_id);
-
-#endif /*__EPHYRHOSTVIDEO_H__*/
index 5e2eb67..fac84cd 100644 (file)
 #endif
 #include "ephyr.h"
 #include "ephyrlog.h"
+#include "glx_extinit.h"
 
 extern Window EphyrPreExistingHostWin;
 extern Bool EphyrWantGrayScale;
+extern Bool EphyrWantResize;
 extern Bool kdHasPointer;
 extern Bool kdHasKbd;
+extern Bool ephyr_glamor;
 
 #ifdef GLXEXT
 extern Bool ephyrNoDRI;
@@ -44,7 +47,7 @@ extern KdPointerDriver LinuxEvdevMouseDriver;
 extern KdKeyboardDriver LinuxEvdevKeyboardDriver;
 #endif
 
-void processScreenArg(char *screen_size, char *parent_id);
+void processScreenArg(const char *screen_size, char *parent_id);
 
 void
 InitCard(char *name)
@@ -53,9 +56,25 @@ InitCard(char *name)
     KdCardInfoAdd(&ephyrFuncs, 0);
 }
 
+static const ExtensionModule ephyrExtensions[] = {
+#ifdef GLXEXT
+ { GlxExtensionInit, "GLX", &noGlxExtension },
+#endif
+};
+
+static
+void ephyrExtensionInit(void)
+{
+    LoadExtensionList(ephyrExtensions, ARRAY_SIZE(ephyrExtensions), TRUE);
+}
+
+
 void
 InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv)
 {
+    if (serverGeneration == 1)
+        ephyrExtensionInit();
+
     KdInitOutput(pScreenInfo, argc, argv);
 }
 
@@ -113,9 +132,13 @@ ddxUseMsg(void)
 
     ErrorF("\nXephyr Option Usage:\n");
     ErrorF("-parent <XID>        Use existing window as Xephyr root win\n");
-    ErrorF("-host-cursor         Re-use exisiting X host server cursor\n");
+    ErrorF("-sw-cursor           Render cursors in software in Xephyr\n");
     ErrorF("-fullscreen          Attempt to run Xephyr fullscreen\n");
     ErrorF("-grayscale           Simulate 8bit grayscale\n");
+    ErrorF("-resizeable          Make Xephyr windows resizeable\n");
+#ifdef GLAMOR
+    ErrorF("-glamor              Enable 2D acceleration using glamor\n");
+#endif
     ErrorF
         ("-fakexa              Simulate acceleration using software rendering\n");
     ErrorF("-verbosity <level>   Set log verbosity level\n");
@@ -127,12 +150,10 @@ ddxUseMsg(void)
     ErrorF
         ("-title [title]       set the window title in the WM_NAME property\n");
     ErrorF("\n");
-
-    exit(1);
 }
 
 void
-processScreenArg(char *screen_size, char *parent_id)
+processScreenArg(const char *screen_size, char *parent_id)
 {
     KdCardInfo *card;
 
@@ -145,6 +166,9 @@ processScreenArg(char *screen_size, char *parent_id)
 
         screen = KdScreenInfoAdd(card);
         KdParseScreen(screen, screen_size);
+        screen->driver = calloc(1, sizeof(EphyrScrPriv));
+        if (!screen->driver)
+            FatalError("Couldn't alloc screen private\n");
 
         if (parent_id) {
             p_id = strtol(parent_id, NULL, 0);
@@ -198,8 +222,12 @@ ddxProcessArgument(int argc, char **argv, int i)
         UseMsg();
         exit(1);
     }
+    else if (!strcmp(argv[i], "-sw-cursor")) {
+        hostx_use_sw_cursor();
+        return 1;
+    }
     else if (!strcmp(argv[i], "-host-cursor")) {
-        hostx_use_host_cursor();
+        /* Compatibility with the old command line argument, now the default. */
         return 1;
     }
     else if (!strcmp(argv[i], "-fullscreen")) {
@@ -210,6 +238,20 @@ ddxProcessArgument(int argc, char **argv, int i)
         EphyrWantGrayScale = 1;
         return 1;
     }
+    else if (!strcmp(argv[i], "-resizeable")) {
+        EphyrWantResize = 1;
+        return 1;
+    }
+#ifdef GLAMOR
+    else if (!strcmp (argv[i], "-glamor")) {
+        ephyr_glamor = TRUE;
+        ephyrFuncs.initAccel = ephyr_glamor_init;
+        ephyrFuncs.enableAccel = ephyr_glamor_enable;
+        ephyrFuncs.disableAccel = ephyr_glamor_disable;
+        ephyrFuncs.finiAccel = ephyr_glamor_fini;
+        return 1;
+    }
+#endif
     else if (!strcmp(argv[i], "-fakexa")) {
         ephyrFuncs.initAccel = ephyrDrawInit;
         ephyrFuncs.enableAccel = ephyrDrawEnable;
@@ -363,7 +405,7 @@ ephyrCursorEnable(ScreenPtr pScreen)
 
 KdCardFuncs ephyrFuncs = {
     ephyrCardInit,              /* cardinit */
-    ephyrScreenInit,            /* scrinit */
+    ephyrScreenInitialize,      /* scrinit */
     ephyrInitScreen,            /* initScreen */
     ephyrFinishInitScreen,      /* finishInitScreen */
     ephyrCreateResources,       /* createRes */
diff --git a/hw/kdrive/ephyr/ephyrproxyext.c b/hw/kdrive/ephyr/ephyrproxyext.c
deleted file mode 100644 (file)
index c24238c..0000000
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Xephyr - A kdrive X server thats runs in a host X window.
- *          Authored by Matthew Allum <mallum@openedhand.com>
- * 
- * Copyright Â© 2007 OpenedHand Ltd 
- *
- * 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 OpenedHand Ltd not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. OpenedHand Ltd makes no
- * representations about the suitability of this software for any purpose.  It
- * is provided "as is" without express or implied warranty.
- *
- * OpenedHand Ltd DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL OpenedHand Ltd 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.
- *
- * Authors:
- *    Dodji Seketeli <dodji@openedhand.com>
- */
-
-/*
- * \file
- * This file defines a proxy extension that forwards requests.
- * When a request to extension FOO is sent to Xephyr, that request is forwared
- * to the host X, without even trying to know what the request means.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <kdrive-config.h>
-#endif
-
-#include "misc.h"
-#include "dixstruct.h"
-#include "extnsionst.h"
-#include "ephyrproxyext.h"
-#define _HAVE_XALLOC_DECLS
-#include "ephyrlog.h"
-#include "ephyrhostproxy.h"
-#include "hostx.h"
-
-static Bool ephyrProxyGetHostExtensionInfo(const char *a_ext_name,
-                                           int *a_major_opcode,
-                                           int *a_first_event,
-                                           int *a_first_error);
-
-static int ephyrProxyProcDispatch(ClientPtr client);
-
-static Bool
-ephyrProxyGetHostExtensionInfo(const char *a_ext_name,
-                               int *a_major_opcode,
-                               int *a_first_event, int *a_first_error)
-{
-    return hostx_get_extension_info(a_ext_name, a_major_opcode,
-                                    a_first_event, a_first_error);
-}
-
-static int
-ephyrProxyProcDispatch(ClientPtr a_client)
-{
-    int res = BadImplementation;
-    struct XReply reply;
-
-    if (!ephyrHostProxyDoForward(a_client->requestBuffer, &reply, FALSE)) {
-        EPHYR_LOG_ERROR("forwarding failed\n");
-        goto out;
-    }
-    reply.sequence_number = a_client->sequence;
-    res = Success;
-
-    WriteToClient(a_client, 32, &reply);
-
- out:
-    return res;
-}
-
-static void
-ephyrProxyProcReset(ExtensionEntry * a_entry)
-{
-}
-
-Bool
-ephyrProxyExtensionInit(const char *a_extension_name)
-{
-    Bool is_ok = FALSE;
-    int major_opcode = 0, first_event = 0, first_error = 0;
-    ExtensionEntry *ext = NULL;
-
-    if (!ephyrProxyGetHostExtensionInfo(a_extension_name,
-                                        &major_opcode,
-                                        &first_event, &first_error)) {
-        EPHYR_LOG("failed to query extension %s from host\n", a_extension_name);
-        goto out;
-    }
-    ext = AddExtension((char *) a_extension_name, 0, 0,
-                       ephyrProxyProcDispatch,
-                       ephyrProxyProcDispatch,
-                       ephyrProxyProcReset, StandardMinorOpcode);
-    if (!ext) {
-        EPHYR_LOG_ERROR("failed to add the extension\n");
-        goto out;
-    }
-    is_ok = TRUE;
-
- out:
-    EPHYR_LOG("leave\n");
-    return is_ok;
-}
diff --git a/hw/kdrive/ephyr/ephyrproxyext.h b/hw/kdrive/ephyr/ephyrproxyext.h
deleted file mode 100644 (file)
index 018b69b..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Xephyr - A kdrive X server thats runs in a host X window.
- *          Authored by Matthew Allum <mallum@openedhand.com>
- * 
- * Copyright Â© 2007 OpenedHand Ltd 
- *
- * 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 OpenedHand Ltd not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. OpenedHand Ltd makes no
- * representations about the suitability of this software for any purpose.  It
- * is provided "as is" without express or implied warranty.
- *
- * OpenedHand Ltd DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL OpenedHand Ltd 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.
- *
- * Authors:
- *    Dodji Seketeli <dodji@openedhand.com>
- */
-#ifndef __EPHYRPROXYEXT_H__
-#define __EPHYRPROXYEXT_H__
-
-Bool ephyrProxyExtensionInit(const char *a_extension_name);
-
-#endif /*__EPHYRPROXYEXT_H__*/
index 67eadd1..c672835 100644 (file)
 #endif
 #include <string.h>
 #include <X11/extensions/Xv.h>
+#include <xcb/xcb.h>
+#include <xcb/xcb_aux.h>
+#include <xcb/xv.h>
 #include "ephyrlog.h"
 #include "kdrive.h"
 #include "kxv.h"
 #include "ephyr.h"
 #include "hostx.h"
-#include "ephyrhostvideo.h"
 
 struct _EphyrXVPriv {
-    EphyrHostXVAdaptorArray *host_adaptors;
+    xcb_xv_query_adaptors_reply_t *host_adaptors;
     KdVideoAdaptorPtr adaptors;
     int num_adaptors;
 };
@@ -58,14 +60,8 @@ struct _EphyrPortPriv {
 };
 typedef struct _EphyrPortPriv EphyrPortPriv;
 
-static Bool DoSimpleClip(BoxPtr a_dst_drw, BoxPtr a_clipper, BoxPtr a_result);
-
 static Bool ephyrLocalAtomToHost(int a_local_atom, int *a_host_atom);
 
-/*
-static Bool ephyrHostAtomToLocal (int a_host_atom, int *a_local_atom) ;
-*/
-
 static EphyrXVPriv *ephyrXVPrivNew(void);
 static void ephyrXVPrivDelete(EphyrXVPriv * a_this);
 static Bool ephyrXVPrivQueryHostAdaptors(EphyrXVPriv * a_this);
@@ -88,15 +84,15 @@ static Bool ephyrXVPrivSaveImageToPortPriv(EphyrPortPriv * a_port_priv,
                                            int a_image_len);
 
 static void ephyrStopVideo(KdScreenInfo * a_info,
-                           pointer a_xv_priv, Bool a_exit);
+                           void *a_xv_priv, Bool a_exit);
 
 static int ephyrSetPortAttribute(KdScreenInfo * a_info,
                                  Atom a_attr_name,
-                                 int a_attr_value, pointer a_port_priv);
+                                 int a_attr_value, void *a_port_priv);
 
 static int ephyrGetPortAttribute(KdScreenInfo * a_screen_info,
                                  Atom a_attr_name,
-                                 int *a_attr_value, pointer a_port_priv);
+                                 int *a_attr_value, void *a_port_priv);
 
 static void ephyrQueryBestSize(KdScreenInfo * a_info,
                                Bool a_motion,
@@ -105,7 +101,7 @@ static void ephyrQueryBestSize(KdScreenInfo * a_info,
                                short a_drw_w,
                                short a_drw_h,
                                unsigned int *a_prefered_w,
-                               unsigned int *a_prefered_h, pointer a_port_priv);
+                               unsigned int *a_prefered_h, void *a_port_priv);
 
 static int ephyrPutImage(KdScreenInfo * a_info,
                          DrawablePtr a_drawable,
@@ -122,13 +118,13 @@ static int ephyrPutImage(KdScreenInfo * a_info,
                          short a_width,
                          short a_height,
                          Bool a_sync,
-                         RegionPtr a_clipping_region, pointer a_port_priv);
+                         RegionPtr a_clipping_region, void *a_port_priv);
 
 static int ephyrReputImage(KdScreenInfo * a_info,
                            DrawablePtr a_drawable,
                            short a_drw_x,
                            short a_drw_y,
-                           RegionPtr a_clipping_region, pointer a_port_priv);
+                           RegionPtr a_clipping_region, void *a_port_priv);
 
 static int ephyrPutVideo(KdScreenInfo * a_info,
                          DrawablePtr a_drawable,
@@ -136,7 +132,7 @@ static int ephyrPutVideo(KdScreenInfo * a_info,
                          short a_drw_x, short a_drw_y,
                          short a_vid_w, short a_vid_h,
                          short a_drw_w, short a_drw_h,
-                         RegionPtr a_clip_region, pointer a_port_priv);
+                         RegionPtr a_clip_region, void *a_port_priv);
 
 static int ephyrGetVideo(KdScreenInfo * a_info,
                          DrawablePtr a_drawable,
@@ -144,7 +140,7 @@ static int ephyrGetVideo(KdScreenInfo * a_info,
                          short a_drw_x, short a_drw_y,
                          short a_vid_w, short a_vid_h,
                          short a_drw_w, short a_drw_h,
-                         RegionPtr a_clip_region, pointer a_port_priv);
+                         RegionPtr a_clip_region, void *a_port_priv);
 
 static int ephyrPutStill(KdScreenInfo * a_info,
                          DrawablePtr a_drawable,
@@ -152,7 +148,7 @@ static int ephyrPutStill(KdScreenInfo * a_info,
                          short a_drw_x, short a_drw_y,
                          short a_vid_w, short a_vid_h,
                          short a_drw_w, short a_drw_h,
-                         RegionPtr a_clip_region, pointer a_port_priv);
+                         RegionPtr a_clip_region, void *a_port_priv);
 
 static int ephyrGetStill(KdScreenInfo * a_info,
                          DrawablePtr a_drawable,
@@ -160,7 +156,7 @@ static int ephyrGetStill(KdScreenInfo * a_info,
                          short a_drw_x, short a_drw_y,
                          short a_vid_w, short a_vid_h,
                          short a_drw_w, short a_drw_h,
-                         RegionPtr a_clip_region, pointer a_port_priv);
+                         RegionPtr a_clip_region, void *a_port_priv);
 
 static int ephyrQueryImageAttributes(KdScreenInfo * a_info,
                                      int a_id,
@@ -174,53 +170,18 @@ static int s_base_port_id;
  * ************/
 
 static Bool
-DoSimpleClip(BoxPtr a_dst_box, BoxPtr a_clipper, BoxPtr a_result)
+adaptor_has_flags(const xcb_xv_adaptor_info_t *adaptor, uint32_t flags)
 {
-    BoxRec dstClippedBox;
-
-    EPHYR_RETURN_VAL_IF_FAIL(a_dst_box && a_clipper && a_result, FALSE);
-
-    /*
-     * setup the clipbox inside the destination.
-     */
-    dstClippedBox.x1 = a_dst_box->x1;
-    dstClippedBox.x2 = a_dst_box->x2;
-    dstClippedBox.y1 = a_dst_box->y1;
-    dstClippedBox.y2 = a_dst_box->y2;
-
-    /*
-     * if the cliper leftmost edge is inside
-     * the destination area then the leftmost edge of the resulting
-     * clipped box is the leftmost edge of the cliper.
-     */
-    if (a_clipper->x1 > dstClippedBox.x1)
-        dstClippedBox.x1 = a_clipper->x1;
-
-    /*
-     * if the cliper top edge is inside the destination area
-     * then the bottom horizontal edge of the resulting clipped box
-     * is the bottom edge of the cliper
-     */
-    if (a_clipper->y1 > dstClippedBox.y1)
-        dstClippedBox.y1 = a_clipper->y1;
-
-    /*ditto for right edge */
-    if (a_clipper->x2 < dstClippedBox.x2)
-        dstClippedBox.x2 = a_clipper->x2;
-
-    /*ditto for bottom edge */
-    if (a_clipper->y2 < dstClippedBox.y2)
-        dstClippedBox.y2 = a_clipper->y2;
-
-    memcpy(a_result, &dstClippedBox, sizeof(dstClippedBox));
-    return TRUE;
+    return (adaptor->type & flags) == flags;
 }
 
 static Bool
 ephyrLocalAtomToHost(int a_local_atom, int *a_host_atom)
 {
+    xcb_connection_t *conn = hostx_get_xcbconn();
+    xcb_intern_atom_cookie_t cookie;
+    xcb_intern_atom_reply_t *reply;
     const char *atom_name = NULL;
-    int host_atom = None;
 
     EPHYR_RETURN_VAL_IF_FAIL(a_host_atom, FALSE);
 
@@ -232,43 +193,18 @@ ephyrLocalAtomToHost(int a_local_atom, int *a_host_atom)
     if (!atom_name)
         return FALSE;
 
-    if (!ephyrHostGetAtom(atom_name, FALSE, &host_atom) || host_atom == None) {
+    cookie = xcb_intern_atom(conn, FALSE, strlen(atom_name), atom_name);
+    reply = xcb_intern_atom_reply(conn, cookie, NULL);
+    if (!reply || reply->atom == None) {
         EPHYR_LOG_ERROR("no atom for string %s defined in host X\n", atom_name);
         return FALSE;
     }
-    *a_host_atom = host_atom;
-    return TRUE;
-}
 
-/*
- Not used yed.
-static Bool
-ephyrHostAtomToLocal (int a_host_atom, int *a_local_atom)
-{
-    Bool is_ok=FALSE ;
-    char *atom_name=NULL ;
-    int atom=None ;
-
-    EPHYR_RETURN_VAL_IF_FAIL (a_local_atom, FALSE) ;
-
-    atom_name = ephyrHostGetAtomName (a_host_atom) ;
-    if (!atom_name)
-        goto out ;
-
-    atom = MakeAtom (atom_name, strlen (atom_name), TRUE) ;
-    if (atom == None)
-        goto out ;
+    *a_host_atom = reply->atom;
+    free(reply);
 
-    *a_local_atom = atom ;
-    is_ok = TRUE ;
-
-out:
-    if (atom_name) {
-        ephyrHostFree (atom_name) ;
-    }
-    return is_ok ;
+    return TRUE;
 }
-*/
 
 /**************
  *</helpers>
@@ -321,8 +257,6 @@ ephyrXVPrivNew(void)
         goto error;
     }
 
-    ephyrHostXVInit();
-
     if (!ephyrXVPrivQueryHostAdaptors(xv_priv)) {
         EPHYR_LOG_ERROR("failed to query the host x for xv properties\n");
         goto error;
@@ -351,7 +285,7 @@ ephyrXVPrivDelete(EphyrXVPriv * a_this)
     if (!a_this)
         return;
     if (a_this->host_adaptors) {
-        ephyrHostXVAdaptorArrayDelete(a_this->host_adaptors);
+        free(a_this->host_adaptors);
         a_this->host_adaptors = NULL;
     }
     free(a_this->adaptors);
@@ -360,72 +294,174 @@ ephyrXVPrivDelete(EphyrXVPriv * a_this)
     EPHYR_LOG("leave\n");
 }
 
-static KdVideoEncodingPtr
-videoEncodingDup(EphyrHostEncoding * a_encodings, int a_num_encodings)
+static Bool
+translate_video_encodings(KdVideoAdaptorPtr adaptor,
+                          xcb_xv_adaptor_info_t *host_adaptor)
 {
-    KdVideoEncodingPtr result = NULL;
-    int i = 0;
+    xcb_connection_t *conn = hostx_get_xcbconn();
+    int i;
+    xcb_xv_query_encodings_cookie_t cookie;
+    xcb_xv_query_encodings_reply_t *reply;
+    xcb_xv_encoding_info_iterator_t encoding_it;
+
+    cookie = xcb_xv_query_encodings(conn, host_adaptor->base_id);
+    reply = xcb_xv_query_encodings_reply(conn, cookie, NULL);
+    if (!reply)
+        return FALSE;
+
+    adaptor->nEncodings = reply->num_encodings;
+    adaptor->pEncodings = calloc(adaptor->nEncodings,
+                                  sizeof(*adaptor->pEncodings));
+    if (!adaptor->pEncodings) {
+        free(reply);
+        return FALSE;
+    }
+
+    encoding_it = xcb_xv_query_encodings_info_iterator(reply);
+    for (i = 0; i < adaptor->nEncodings; i++) {
+        xcb_xv_encoding_info_t *encoding_info = encoding_it.data;
+        KdVideoEncodingPtr encoding = &adaptor->pEncodings[i];
 
-    EPHYR_RETURN_VAL_IF_FAIL(a_encodings && a_num_encodings, NULL);
+        encoding->id = encoding_info->encoding;
+        encoding->name = strndup(xcb_xv_encoding_info_name(encoding_info),
+                                 encoding_info->name_size);
+        encoding->width = encoding_info->width;
+        encoding->height = encoding_info->height;
+        encoding->rate.numerator = encoding_info->rate.numerator;
+        encoding->rate.denominator = encoding_info->rate.denominator;
 
-    result = calloc(a_num_encodings, sizeof(KdVideoEncodingRec));
-    for (i = 0; i < a_num_encodings; i++) {
-        result[i].id = a_encodings[i].id;
-        result[i].name = strdup(a_encodings[i].name);
-        result[i].width = a_encodings[i].width;
-        result[i].height = a_encodings[i].height;
-        result[i].rate.numerator = a_encodings[i].rate.numerator;
-        result[i].rate.denominator = a_encodings[i].rate.denominator;
+        xcb_xv_encoding_info_next(&encoding_it);
     }
-    return result;
+
+    free(reply);
+    return TRUE;
 }
 
-static KdAttributePtr
-portAttributesDup(EphyrHostAttribute * a_encodings, int a_num_encodings)
+static Bool
+translate_xv_attributes(KdVideoAdaptorPtr adaptor,
+                        xcb_xv_adaptor_info_t *host_adaptor)
 {
+    xcb_connection_t *conn = hostx_get_xcbconn();
     int i = 0;
-    KdAttributePtr result = NULL;
+    xcb_xv_attribute_info_iterator_t it;
+    xcb_xv_query_port_attributes_cookie_t cookie =
+        xcb_xv_query_port_attributes(conn, host_adaptor->base_id);
+    xcb_xv_query_port_attributes_reply_t *reply =
+        xcb_xv_query_port_attributes_reply(conn, cookie, NULL);
 
-    EPHYR_RETURN_VAL_IF_FAIL(a_encodings && a_num_encodings, NULL);
+    if (!reply)
+        return FALSE;
 
-    result = calloc(a_num_encodings, sizeof(KdAttributeRec));
-    if (!result) {
+    adaptor->nAttributes = reply->num_attributes;
+    adaptor->pAttributes = calloc(reply->num_attributes,
+                                  sizeof(*adaptor->pAttributes));
+    if (!adaptor->pAttributes) {
         EPHYR_LOG_ERROR("failed to allocate attributes\n");
-        return NULL;
+        free(reply);
+        return FALSE;
     }
-    for (i = 0; i < a_num_encodings; i++) {
-        result[i].flags = a_encodings[i].flags;
-        result[i].min_value = a_encodings[i].min_value;
-        result[i].max_value = a_encodings[i].max_value;
-        result[i].name = strdup(a_encodings[i].name);
+
+    it = xcb_xv_query_port_attributes_attributes_iterator(reply);
+    for (i = 0; i < reply->num_attributes; i++) {
+        KdAttributePtr attribute = &adaptor->pAttributes[i];
+
+        attribute->flags = it.data->flags;
+        attribute->min_value = it.data->min;
+        attribute->max_value = it.data->max;
+        attribute->name = strndup(xcb_xv_attribute_info_name(it.data),
+                                  it.data->size);
+
+        /* make sure atoms of attrs names are created in xephyr */
+        MakeAtom(xcb_xv_attribute_info_name(it.data), it.data->size, TRUE);
+
+        xcb_xv_attribute_info_next(&it);
     }
-    return result;
+
+    free(reply);
+    return TRUE;
+}
+
+static Bool
+translate_xv_image_formats(KdVideoAdaptorPtr adaptor,
+                           xcb_xv_adaptor_info_t *host_adaptor)
+{
+    xcb_connection_t *conn = hostx_get_xcbconn();
+    int i = 0;
+    xcb_xv_list_image_formats_cookie_t cookie =
+        xcb_xv_list_image_formats(conn, host_adaptor->base_id);
+    xcb_xv_list_image_formats_reply_t *reply =
+        xcb_xv_list_image_formats_reply(conn, cookie, NULL);
+    xcb_xv_image_format_info_t *formats;
+
+    if (!reply)
+        return FALSE;
+
+    adaptor->nImages = reply->num_formats;
+    adaptor->pImages = calloc(reply->num_formats, sizeof(KdImageRec));
+    if (!adaptor->pImages) {
+        free(reply);
+        return FALSE;
+    }
+
+    formats = xcb_xv_list_image_formats_format(reply);
+    for (i = 0; i < reply->num_formats; i++) {
+        KdImagePtr image = &adaptor->pImages[i];
+
+        image->id = formats[i].id;
+        image->type = formats[i].type;
+        image->byte_order = formats[i].byte_order;
+        memcpy(image->guid, formats[i].guid, 16);
+        image->bits_per_pixel = formats[i].bpp;
+        image->format = formats[i].format;
+        image->num_planes = formats[i].num_planes;
+        image->depth = formats[i].depth;
+        image->red_mask = formats[i].red_mask;
+        image->green_mask = formats[i].green_mask;
+        image->blue_mask = formats[i].blue_mask;
+        image->y_sample_bits = formats[i].y_sample_bits;
+        image->u_sample_bits = formats[i].u_sample_bits;
+        image->v_sample_bits = formats[i].v_sample_bits;
+        image->horz_y_period = formats[i].vhorz_y_period;
+        image->horz_u_period = formats[i].vhorz_u_period;
+        image->horz_v_period = formats[i].vhorz_v_period;
+        image->vert_y_period = formats[i].vvert_y_period;
+        image->vert_u_period = formats[i].vvert_u_period;
+        image->vert_v_period = formats[i].vvert_v_period;
+        memcpy(image->component_order, formats[i].vcomp_order, 32);
+        image->scanline_order = formats[i].vscanline_order;
+    }
+
+    free(reply);
+    return TRUE;
 }
 
 static Bool
 ephyrXVPrivQueryHostAdaptors(EphyrXVPriv * a_this)
 {
-    EphyrHostXVAdaptor *cur_host_adaptor = NULL;
-    EphyrHostVideoFormat *video_formats = NULL;
-    EphyrHostEncoding *encodings = NULL;
-    EphyrHostAttribute *attributes = NULL;
-    EphyrHostImageFormat *image_formats = NULL;
-    int num_video_formats = 0, base_port_id = 0,
-        num_attributes = 0, num_formats = 0, i = 0, port_priv_offset = 0;
-    unsigned num_encodings = 0;
+    xcb_connection_t *conn = hostx_get_xcbconn();
+    xcb_screen_t *xscreen = xcb_aux_get_screen(conn, hostx_get_screen());
+    int base_port_id = 0, i = 0, port_priv_offset = 0;
     Bool is_ok = FALSE;
+    xcb_generic_error_t *e = NULL;
+    xcb_xv_adaptor_info_iterator_t it;
 
     EPHYR_RETURN_VAL_IF_FAIL(a_this, FALSE);
 
     EPHYR_LOG("enter\n");
 
-    if (!ephyrHostXVQueryAdaptors(&a_this->host_adaptors)) {
-        EPHYR_LOG_ERROR("failed to query host adaptors\n");
-        goto out;
+    {
+        xcb_xv_query_adaptors_cookie_t cookie =
+            xcb_xv_query_adaptors(conn, xscreen->root);
+        a_this->host_adaptors = xcb_xv_query_adaptors_reply(conn, cookie, &e);
+        if (e) {
+            free(e);
+            EPHYR_LOG_ERROR("failed to query host adaptors\n");
+            goto out;
+        }
     }
+
     if (a_this->host_adaptors)
-        a_this->num_adaptors =
-            ephyrHostXVAdaptorArrayGetSize(a_this->host_adaptors);
+        a_this->num_adaptors = a_this->host_adaptors->num_adaptors;
     if (a_this->num_adaptors < 0) {
         EPHYR_LOG_ERROR("failed to get number of host adaptors\n");
         goto out;
@@ -442,28 +478,28 @@ ephyrXVPrivQueryHostAdaptors(EphyrXVPriv * a_this)
             goto out;
         }
     }
+
+    it = xcb_xv_query_adaptors_info_iterator(a_this->host_adaptors);
     for (i = 0; i < a_this->num_adaptors; i++) {
+        xcb_xv_adaptor_info_t *cur_host_adaptor = it.data;
+        xcb_xv_format_t *format = xcb_xv_adaptor_info_formats(cur_host_adaptor);
         int j = 0;
 
-        cur_host_adaptor = ephyrHostXVAdaptorArrayAt(a_this->host_adaptors, i);
-        if (!cur_host_adaptor)
-            continue;
-        a_this->adaptors[i].nPorts =
-            ephyrHostXVAdaptorGetNbPorts(cur_host_adaptor);
+        a_this->adaptors[i].nPorts = cur_host_adaptor->num_ports;
         if (a_this->adaptors[i].nPorts <= 0) {
             EPHYR_LOG_ERROR("Could not find any port of adaptor %d\n", i);
             continue;
         }
-        a_this->adaptors[i].type = ephyrHostXVAdaptorGetType(cur_host_adaptor);
+        a_this->adaptors[i].type = cur_host_adaptor->type;
         a_this->adaptors[i].type |= XvWindowMask;
         a_this->adaptors[i].flags =
             VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT;
-        if (ephyrHostXVAdaptorGetName(cur_host_adaptor))
-            a_this->adaptors[i].name =
-                strdup(ephyrHostXVAdaptorGetName(cur_host_adaptor));
-        else
+        a_this->adaptors[i].name =
+            strndup(xcb_xv_adaptor_info_name(cur_host_adaptor),
+                    cur_host_adaptor->name_size);
+        if (!a_this->adaptors[i].name)
             a_this->adaptors[i].name = strdup("Xephyr Video Overlay");
-        base_port_id = ephyrHostXVAdaptorGetFirstPortID(cur_host_adaptor);
+        base_port_id = cur_host_adaptor->base_id;
         if (base_port_id < 0) {
             EPHYR_LOG_ERROR("failed to get port id for adaptor %d\n", i);
             continue;
@@ -471,31 +507,31 @@ ephyrXVPrivQueryHostAdaptors(EphyrXVPriv * a_this)
         if (!s_base_port_id)
             s_base_port_id = base_port_id;
 
-        if (!ephyrHostXVQueryEncodings(base_port_id,
-                                       &encodings, &num_encodings)) {
+        if (!translate_video_encodings(&a_this->adaptors[i],
+                                       cur_host_adaptor)) {
             EPHYR_LOG_ERROR("failed to get encodings for port port id %d,"
                             " adaptors %d\n", base_port_id, i);
             continue;
         }
-        a_this->adaptors[i].nEncodings = num_encodings;
-        a_this->adaptors[i].pEncodings =
-            videoEncodingDup(encodings, num_encodings);
-        video_formats = (EphyrHostVideoFormat *)
-            ephyrHostXVAdaptorGetVideoFormats(cur_host_adaptor,
-                                              &num_video_formats);
-        a_this->adaptors[i].pFormats = (KdVideoFormatPtr) video_formats;
-        a_this->adaptors[i].nFormats = num_video_formats;
-        /* got a_this->adaptors[i].nPorts already
-           a_this->adaptors[i].nPorts =
-           ephyrHostXVAdaptorGetNbPorts (cur_host_adaptor) ;
-         */
+
+        a_this->adaptors[i].nFormats = cur_host_adaptor->num_formats;
+        a_this->adaptors[i].pFormats =
+            calloc(cur_host_adaptor->num_formats,
+                   sizeof(*a_this->adaptors[i].pFormats));
+        for (j = 0; j < cur_host_adaptor->num_formats; j++) {
+            xcb_visualtype_t *visual =
+                xcb_aux_find_visual_by_id(xscreen, format[j].visual);
+            a_this->adaptors[i].pFormats[j].depth = format[j].depth;
+            a_this->adaptors[i].pFormats[j].class = visual->_class;
+        }
+
         a_this->adaptors[i].pPortPrivates =
             calloc(a_this->adaptors[i].nPorts,
                    sizeof(DevUnion) + sizeof(EphyrPortPriv));
         port_priv_offset = a_this->adaptors[i].nPorts;
         for (j = 0; j < a_this->adaptors[i].nPorts; j++) {
             EphyrPortPriv *port_privs_base =
-                (EphyrPortPriv *) & a_this->adaptors[i].
+                (EphyrPortPriv *) &a_this->adaptors[i].
                 pPortPrivates[port_priv_offset];
             EphyrPortPriv *port_priv = &port_privs_base[j];
 
@@ -504,41 +540,26 @@ ephyrXVPrivQueryHostAdaptors(EphyrXVPriv * a_this)
             port_priv->xv_priv = a_this;
             a_this->adaptors[i].pPortPrivates[j].ptr = port_priv;
         }
-        if (!ephyrHostXVQueryPortAttributes(base_port_id,
-                                            &attributes, &num_attributes)) {
+
+        if (!translate_xv_attributes(&a_this->adaptors[i], cur_host_adaptor)) {
+        {
             EPHYR_LOG_ERROR("failed to get port attribute "
                             "for adaptor %d\n", i);
             continue;
         }
-        a_this->adaptors[i].pAttributes =
-            portAttributesDup(attributes, num_attributes);
-        a_this->adaptors[i].nAttributes = num_attributes;
-        /*make sure atoms of attrs names are created in xephyr */
-        for (j = 0; j < a_this->adaptors[i].nAttributes; j++) {
-            if (a_this->adaptors[i].pAttributes[j].name)
-                MakeAtom(a_this->adaptors[i].pAttributes[j].name,
-                         strlen(a_this->adaptors[i].pAttributes[j].name), TRUE);
         }
-        if (!ephyrHostXVQueryImageFormats(base_port_id,
-                                          &image_formats, &num_formats)) {
+
+        if (!translate_xv_image_formats(&a_this->adaptors[i], cur_host_adaptor)) {
             EPHYR_LOG_ERROR("failed to get image formats "
                             "for adaptor %d\n", i);
             continue;
         }
-        a_this->adaptors[i].pImages = (KdImagePtr) image_formats;
-        a_this->adaptors[i].nImages = num_formats;
+
+        xcb_xv_adaptor_info_next(&it);
     }
     is_ok = TRUE;
 
  out:
-    if (encodings) {
-        ephyrHostEncodingsDelete(encodings, num_encodings);
-        encodings = NULL;
-    }
-    if (attributes) {
-        ephyrHostAttributesDelete(attributes);
-        attributes = NULL;
-    }
     EPHYR_LOG("leave\n");
     return is_ok;
 }
@@ -547,14 +568,16 @@ static Bool
 ephyrXVPrivSetAdaptorsHooks(EphyrXVPriv * a_this)
 {
     int i = 0;
-    Bool has_it = FALSE;
-    EphyrHostXVAdaptor *cur_host_adaptor = NULL;
+    xcb_xv_adaptor_info_iterator_t it;
 
     EPHYR_RETURN_VAL_IF_FAIL(a_this, FALSE);
 
     EPHYR_LOG("enter\n");
 
+    it = xcb_xv_query_adaptors_info_iterator(a_this->host_adaptors);
     for (i = 0; i < a_this->num_adaptors; i++) {
+        xcb_xv_adaptor_info_t *cur_host_adaptor = it.data;
+
         a_this->adaptors[i].ReputImage = ephyrReputImage;
         a_this->adaptors[i].StopVideo = ephyrStopVideo;
         a_this->adaptors[i].SetPortAttribute = ephyrSetPortAttribute;
@@ -562,50 +585,25 @@ ephyrXVPrivSetAdaptorsHooks(EphyrXVPriv * a_this)
         a_this->adaptors[i].QueryBestSize = ephyrQueryBestSize;
         a_this->adaptors[i].QueryImageAttributes = ephyrQueryImageAttributes;
 
-        cur_host_adaptor = ephyrHostXVAdaptorArrayAt(a_this->host_adaptors, i);
-        if (!cur_host_adaptor) {
-            EPHYR_LOG_ERROR("failed to get host adaptor at index %d\n", i);
-            continue;
-        }
-        has_it = FALSE;
-        if (!ephyrHostXVAdaptorHasPutImage(cur_host_adaptor, &has_it)) {
-            EPHYR_LOG_ERROR("error\n");
-        }
-        if (has_it) {
+        if (adaptor_has_flags(cur_host_adaptor,
+                              XCB_XV_TYPE_IMAGE_MASK | XCB_XV_TYPE_INPUT_MASK))
             a_this->adaptors[i].PutImage = ephyrPutImage;
-        }
 
-        has_it = FALSE;
-        if (!ephyrHostXVAdaptorHasPutVideo(cur_host_adaptor, &has_it)) {
-            EPHYR_LOG_ERROR("error\n");
-        }
-        if (has_it) {
+        if (adaptor_has_flags(cur_host_adaptor,
+                              XCB_XV_TYPE_VIDEO_MASK | XCB_XV_TYPE_INPUT_MASK))
             a_this->adaptors[i].PutVideo = ephyrPutVideo;
-        }
 
-        has_it = FALSE;
-        if (!ephyrHostXVAdaptorHasGetVideo(cur_host_adaptor, &has_it)) {
-            EPHYR_LOG_ERROR("error\n");
-        }
-        if (has_it) {
+        if (adaptor_has_flags(cur_host_adaptor,
+                              XCB_XV_TYPE_VIDEO_MASK | XCB_XV_TYPE_OUTPUT_MASK))
             a_this->adaptors[i].GetVideo = ephyrGetVideo;
-        }
 
-        has_it = FALSE;
-        if (!ephyrHostXVAdaptorHasPutStill(cur_host_adaptor, &has_it)) {
-            EPHYR_LOG_ERROR("error\n");
-        }
-        if (has_it) {
+        if (adaptor_has_flags(cur_host_adaptor,
+                              XCB_XV_TYPE_STILL_MASK | XCB_XV_TYPE_INPUT_MASK))
             a_this->adaptors[i].PutStill = ephyrPutStill;
-        }
 
-        has_it = FALSE;
-        if (!ephyrHostXVAdaptorHasGetStill(cur_host_adaptor, &has_it)) {
-            EPHYR_LOG_ERROR("error\n");
-        }
-        if (has_it) {
+        if (adaptor_has_flags(cur_host_adaptor,
+                              XCB_XV_TYPE_STILL_MASK | XCB_XV_TYPE_OUTPUT_MASK))
             a_this->adaptors[i].GetStill = ephyrGetStill;
-        }
     }
     EPHYR_LOG("leave\n");
     return TRUE;
@@ -691,20 +689,27 @@ ephyrXVPrivGetImageBufSize(int a_port_id,
                            unsigned short a_width,
                            unsigned short a_height, int *a_size)
 {
+    xcb_connection_t *conn = hostx_get_xcbconn();
+    xcb_xv_query_image_attributes_cookie_t cookie;
+    xcb_xv_query_image_attributes_reply_t *reply;
     Bool is_ok = FALSE;
-    unsigned short width = a_width, height = a_height;
 
     EPHYR_RETURN_VAL_IF_FAIL(a_size, FALSE);
 
     EPHYR_LOG("enter\n");
 
-    if (!ephyrHostXVQueryImageAttributes(a_port_id, a_image_id,
-                                         &width, &height, a_size, NULL, NULL)) {
-        EPHYR_LOG_ERROR("failed to get image attributes\n");
+    cookie = xcb_xv_query_image_attributes(conn,
+                                           a_port_id, a_image_id,
+                                           a_width, a_height);
+    reply = xcb_xv_query_image_attributes_reply(conn, cookie, NULL);
+    if (!reply)
         goto out;
-    }
+
+    *a_size = reply->data_size;
     is_ok = TRUE;
 
+    free(reply);
+
  out:
     EPHYR_LOG("leave\n");
     return is_ok;
@@ -739,24 +744,24 @@ ephyrXVPrivSaveImageToPortPriv(EphyrPortPriv * a_port_priv,
 }
 
 static void
-ephyrStopVideo(KdScreenInfo * a_info, pointer a_port_priv, Bool a_exit)
+ephyrStopVideo(KdScreenInfo * a_info, void *a_port_priv, Bool a_exit)
 {
+    xcb_connection_t *conn = hostx_get_xcbconn();
     EphyrPortPriv *port_priv = a_port_priv;
+    EphyrScrPriv *scrpriv = a_info->driver;
 
-    EPHYR_RETURN_IF_FAIL(a_info && a_info->pScreen);
     EPHYR_RETURN_IF_FAIL(port_priv);
 
     EPHYR_LOG("enter\n");
-    if (!ephyrHostXVStopVideo(a_info->pScreen->myNum, port_priv->port_number)) {
-        EPHYR_LOG_ERROR("XvStopVideo() failed\n");
-    }
+    xcb_xv_stop_video(conn, port_priv->port_number, scrpriv->win);
     EPHYR_LOG("leave\n");
 }
 
 static int
 ephyrSetPortAttribute(KdScreenInfo * a_info,
-                      Atom a_attr_name, int a_attr_value, pointer a_port_priv)
+                      Atom a_attr_name, int a_attr_value, void *a_port_priv)
 {
+    xcb_connection_t *conn = hostx_get_xcbconn();
     int res = Success, host_atom = 0;
     EphyrPortPriv *port_priv = a_port_priv;
     Bool is_attr_valid = FALSE;
@@ -797,12 +802,9 @@ ephyrSetPortAttribute(KdScreenInfo * a_info,
          */
     }
 
-    if (!ephyrHostXVSetPortAttribute(port_priv->port_number,
-                                     host_atom, a_attr_value)) {
-        EPHYR_LOG_ERROR("failed to set port attribute\n");
-        res = BadMatch;
-        goto out;
-    }
+    xcb_xv_set_port_attribute(conn, port_priv->port_number,
+                              host_atom, a_attr_value);
+    xcb_flush(conn);
 
     res = Success;
  out:
@@ -812,10 +814,14 @@ ephyrSetPortAttribute(KdScreenInfo * a_info,
 
 static int
 ephyrGetPortAttribute(KdScreenInfo * a_screen_info,
-                      Atom a_attr_name, int *a_attr_value, pointer a_port_priv)
+                      Atom a_attr_name, int *a_attr_value, void *a_port_priv)
 {
+    xcb_connection_t *conn = hostx_get_xcbconn();
     int res = Success, host_atom = 0;
     EphyrPortPriv *port_priv = a_port_priv;
+    xcb_generic_error_t *e;
+    xcb_xv_get_port_attribute_cookie_t cookie;
+    xcb_xv_get_port_attribute_reply_t *reply;
 
     EPHYR_RETURN_VAL_IF_FAIL(port_priv, BadMatch);
     EPHYR_RETURN_VAL_IF_FAIL(ValidAtom(a_attr_name), BadMatch);
@@ -830,12 +836,17 @@ ephyrGetPortAttribute(KdScreenInfo * a_screen_info,
         goto out;
     }
 
-    if (!ephyrHostXVGetPortAttribute(port_priv->port_number,
-                                     host_atom, a_attr_value)) {
-        EPHYR_LOG_ERROR("failed to get port attribute\n");
+    cookie = xcb_xv_get_port_attribute(conn, port_priv->port_number, host_atom);
+    reply = xcb_xv_get_port_attribute_reply(conn, cookie, &e);
+    if (e) {
+        EPHYR_LOG_ERROR ("XvGetPortAttribute() failed: %d \n", e->error_code);
+        free(e);
         res = BadMatch;
         goto out;
     }
+    *a_attr_value = reply->value;
+
+    free(reply);
 
     res = Success;
  out:
@@ -851,23 +862,119 @@ ephyrQueryBestSize(KdScreenInfo * a_info,
                    short a_drw_w,
                    short a_drw_h,
                    unsigned int *a_prefered_w,
-                   unsigned int *a_prefered_h, pointer a_port_priv)
+                   unsigned int *a_prefered_h, void *a_port_priv)
 {
-    int res = 0;
+    xcb_connection_t *conn = hostx_get_xcbconn();
     EphyrPortPriv *port_priv = a_port_priv;
+    xcb_xv_query_best_size_cookie_t cookie =
+        xcb_xv_query_best_size(conn,
+                               port_priv->port_number,
+                               a_src_w, a_src_h,
+                               a_drw_w, a_drw_h,
+                               a_motion);
+    xcb_xv_query_best_size_reply_t *reply =
+        xcb_xv_query_best_size_reply(conn, cookie, NULL);
+
+    EPHYR_LOG("enter: frame (%dx%d), drw (%dx%d)\n",
+              a_src_w, a_src_h, a_drw_w, a_drw_h);
+
+    if (!reply) {
+        EPHYR_LOG_ERROR ("XvQueryBestSize() failed\n");
+        return;
+    }
+    *a_prefered_w = reply->actual_width;
+    *a_prefered_h = reply->actual_height;
+    EPHYR_LOG("actual (%dx%d)\n", *a_prefered_w, *a_prefered_h);
+    free(reply);
 
-    EPHYR_RETURN_IF_FAIL(port_priv);
+    EPHYR_LOG("leave\n");
+}
 
-    EPHYR_LOG("enter\n");
-    res = ephyrHostXVQueryBestSize(port_priv->port_number,
-                                   a_motion,
-                                   a_src_w, a_src_h,
-                                   a_drw_w, a_drw_h,
-                                   a_prefered_w, a_prefered_h);
-    if (!res) {
-        EPHYR_LOG_ERROR("Failed to query best size\n");
+
+static Bool
+ephyrHostXVPutImage(KdScreenInfo * a_info,
+                    EphyrPortPriv *port_priv,
+                    int a_image_id,
+                    int a_drw_x,
+                    int a_drw_y,
+                    int a_drw_w,
+                    int a_drw_h,
+                    int a_src_x,
+                    int a_src_y,
+                    int a_src_w,
+                    int a_src_h,
+                    int a_image_width,
+                    int a_image_height,
+                    unsigned char *a_buf,
+                    BoxPtr a_clip_rects, int a_clip_rect_nums)
+{
+    EphyrScrPriv *scrpriv = a_info->driver;
+    xcb_connection_t *conn = hostx_get_xcbconn();
+    xcb_gcontext_t gc;
+    Bool is_ok = TRUE;
+    xcb_rectangle_t *rects = NULL;
+    int data_len, width, height;
+    xcb_xv_query_image_attributes_cookie_t image_attr_cookie;
+    xcb_xv_query_image_attributes_reply_t *image_attr_reply;
+
+    EPHYR_RETURN_VAL_IF_FAIL(a_buf, FALSE);
+
+    EPHYR_LOG("enter, num_clip_rects: %d\n", a_clip_rect_nums);
+
+    image_attr_cookie = xcb_xv_query_image_attributes(conn,
+                                                      port_priv->port_number,
+                                                      a_image_id,
+                                                      a_image_width,
+                                                      a_image_height);
+    image_attr_reply = xcb_xv_query_image_attributes_reply(conn,
+                                                           image_attr_cookie,
+                                                           NULL);
+    if (!image_attr_reply)
+        goto out;
+    data_len = image_attr_reply->data_size;
+    width = image_attr_reply->width;
+    height = image_attr_reply->height;
+    free(image_attr_reply);
+
+    gc = xcb_generate_id(conn);
+    xcb_create_gc(conn, gc, scrpriv->win, 0, NULL);
+
+    if (a_clip_rect_nums) {
+        int i = 0;
+        rects = calloc(a_clip_rect_nums, sizeof(xcb_rectangle_t));
+        for (i=0; i < a_clip_rect_nums; i++) {
+            rects[i].x = a_clip_rects[i].x1;
+            rects[i].y = a_clip_rects[i].y1;
+            rects[i].width = a_clip_rects[i].x2 - a_clip_rects[i].x1;
+            rects[i].height = a_clip_rects[i].y2 - a_clip_rects[i].y1;
+            EPHYR_LOG("(x,y,w,h): (%d,%d,%d,%d)\n",
+                      rects[i].x, rects[i].y, rects[i].width, rects[i].height);
+        }
+        xcb_set_clip_rectangles(conn,
+                                XCB_CLIP_ORDERING_YX_BANDED,
+                                gc,
+                                0,
+                                0,
+                                a_clip_rect_nums,
+                                rects);
+       free(rects);
     }
+    xcb_xv_put_image(conn,
+                     port_priv->port_number,
+                     scrpriv->win,
+                     gc,
+                     a_image_id,
+                     a_src_x, a_src_y, a_src_w, a_src_h,
+                     a_drw_x, a_drw_y, a_drw_w, a_drw_h,
+                     width, height,
+                     data_len, a_buf);
+    xcb_free_gc(conn, gc);
+
+    is_ok = TRUE;
+
+out:
     EPHYR_LOG("leave\n");
+    return is_ok;
 }
 
 static int
@@ -885,7 +992,7 @@ ephyrPutImage(KdScreenInfo * a_info,
               unsigned char *a_buf,
               short a_width,
               short a_height,
-              Bool a_sync, RegionPtr a_clipping_region, pointer a_port_priv)
+              Bool a_sync, RegionPtr a_clipping_region, void *a_port_priv)
 {
     EphyrPortPriv *port_priv = a_port_priv;
     Bool is_ok = FALSE;
@@ -896,13 +1003,12 @@ ephyrPutImage(KdScreenInfo * a_info,
 
     EPHYR_LOG("enter\n");
 
-    if (!ephyrHostXVPutImage(a_info->pScreen->myNum,
-                             port_priv->port_number,
+    if (!ephyrHostXVPutImage(a_info, port_priv,
                              a_id,
                              a_drw_x, a_drw_y, a_drw_w, a_drw_h,
                              a_src_x, a_src_y, a_src_w, a_src_h,
                              a_width, a_height, a_buf,
-                             (EphyrHostBox *) RegionRects(a_clipping_region),
+                             RegionRects(a_clipping_region),
                              RegionNumRects(a_clipping_region))) {
         EPHYR_LOG_ERROR("EphyrHostXVPutImage() failed\n");
         goto out;
@@ -958,7 +1064,7 @@ static int
 ephyrReputImage(KdScreenInfo * a_info,
                 DrawablePtr a_drawable,
                 short a_drw_x,
-                short a_drw_y, RegionPtr a_clipping_region, pointer a_port_priv)
+                short a_drw_y, RegionPtr a_clipping_region, void *a_port_priv)
 {
     EphyrPortPriv *port_priv = a_port_priv;
     int result = BadImplementation;
@@ -972,8 +1078,8 @@ ephyrReputImage(KdScreenInfo * a_info,
         EPHYR_LOG_ERROR("has null image buf in cache\n");
         goto out;
     }
-    if (!ephyrHostXVPutImage(a_info->pScreen->myNum,
-                             port_priv->port_number,
+    if (!ephyrHostXVPutImage(a_info,
+                             port_priv,
                              port_priv->image_id,
                              a_drw_x, a_drw_y,
                              port_priv->drw_w, port_priv->drw_h,
@@ -981,7 +1087,7 @@ ephyrReputImage(KdScreenInfo * a_info,
                              port_priv->src_w, port_priv->src_h,
                              port_priv->image_width, port_priv->image_height,
                              port_priv->image_buf,
-                             (EphyrHostBox *) RegionRects(a_clipping_region),
+                             RegionRects(a_clipping_region),
                              RegionNumRects(a_clipping_region))) {
         EPHYR_LOG_ERROR("ephyrHostXVPutImage() failed\n");
         goto out;
@@ -1001,46 +1107,28 @@ ephyrPutVideo(KdScreenInfo * a_info,
               short a_drw_x, short a_drw_y,
               short a_vid_w, short a_vid_h,
               short a_drw_w, short a_drw_h,
-              RegionPtr a_clipping_region, pointer a_port_priv)
+              RegionPtr a_clipping_region, void *a_port_priv)
 {
+    EphyrScrPriv *scrpriv = a_info->driver;
+    xcb_connection_t *conn = hostx_get_xcbconn();
+    xcb_gcontext_t gc;
     EphyrPortPriv *port_priv = a_port_priv;
-    BoxRec clipped_area, dst_box;
-    int result = BadImplementation;
-    int drw_x = 0, drw_y = 0, drw_w = 0, drw_h = 0;
 
     EPHYR_RETURN_VAL_IF_FAIL(a_info->pScreen, BadValue);
     EPHYR_RETURN_VAL_IF_FAIL(a_drawable && port_priv, BadValue);
 
     EPHYR_LOG("enter\n");
 
-    dst_box.x1 = a_drw_x;
-    dst_box.x2 = a_drw_x + a_drw_w;
-    dst_box.y1 = a_drw_y;
-    dst_box.y2 = a_drw_y + a_drw_h;
+    gc = xcb_generate_id(conn);
+    xcb_create_gc(conn, gc, scrpriv->win, 0, NULL);
+    xcb_xv_put_video(conn, port_priv->port_number,
+                     scrpriv->win, gc,
+                     a_vid_x, a_vid_y, a_vid_w, a_vid_h,
+                     a_drw_x, a_drw_y, a_drw_w, a_drw_h);
+    xcb_free_gc(conn, gc);
 
-    if (!DoSimpleClip(&dst_box,
-                      RegionExtents(a_clipping_region), &clipped_area)) {
-        EPHYR_LOG_ERROR("failed to simple clip\n");
-        goto out;
-    }
-
-    drw_x = clipped_area.x1;
-    drw_y = clipped_area.y1;
-    drw_w = clipped_area.x2 - clipped_area.x1;
-    drw_h = clipped_area.y2 - clipped_area.y1;
-
-    if (!ephyrHostXVPutVideo(a_info->pScreen->myNum,
-                             port_priv->port_number,
-                             a_vid_x, a_vid_y, a_vid_w, a_vid_h,
-                             a_drw_x, a_drw_y, a_drw_w, a_drw_h)) {
-        EPHYR_LOG_ERROR("ephyrHostXVPutVideo() failed\n");
-        goto out;
-    }
-    result = Success;
-
- out:
     EPHYR_LOG("leave\n");
-    return result;
+    return Success;
 }
 
 static int
@@ -1050,46 +1138,29 @@ ephyrGetVideo(KdScreenInfo * a_info,
               short a_drw_x, short a_drw_y,
               short a_vid_w, short a_vid_h,
               short a_drw_w, short a_drw_h,
-              RegionPtr a_clipping_region, pointer a_port_priv)
+              RegionPtr a_clipping_region, void *a_port_priv)
 {
+    EphyrScrPriv *scrpriv = a_info->driver;
+    xcb_connection_t *conn = hostx_get_xcbconn();
+    xcb_gcontext_t gc;
     EphyrPortPriv *port_priv = a_port_priv;
-    BoxRec clipped_area, dst_box;
-    int result = BadImplementation;
-    int drw_x = 0, drw_y = 0, drw_w = 0, drw_h = 0;
 
     EPHYR_RETURN_VAL_IF_FAIL(a_info && a_info->pScreen, BadValue);
     EPHYR_RETURN_VAL_IF_FAIL(a_drawable && port_priv, BadValue);
 
     EPHYR_LOG("enter\n");
 
-    dst_box.x1 = a_drw_x;
-    dst_box.x2 = a_drw_x + a_drw_w;
-    dst_box.y1 = a_drw_y;
-    dst_box.y2 = a_drw_y + a_drw_h;
-
-    if (!DoSimpleClip(&dst_box,
-                      RegionExtents(a_clipping_region), &clipped_area)) {
-        EPHYR_LOG_ERROR("failed to simple clip\n");
-        goto out;
-    }
-
-    drw_x = clipped_area.x1;
-    drw_y = clipped_area.y1;
-    drw_w = clipped_area.x2 - clipped_area.x1;
-    drw_h = clipped_area.y2 - clipped_area.y1;
+    gc = xcb_generate_id(conn);
+    xcb_create_gc(conn, gc, scrpriv->win, 0, NULL);
+    xcb_xv_get_video(conn, port_priv->port_number,
+                     scrpriv->win, gc,
+                     a_vid_x, a_vid_y, a_vid_w, a_vid_h,
+                     a_drw_x, a_drw_y, a_drw_w, a_drw_h);
 
-    if (!ephyrHostXVGetVideo(a_info->pScreen->myNum,
-                             port_priv->port_number,
-                             a_vid_x, a_vid_y, a_vid_w, a_vid_h,
-                             a_drw_x, a_drw_y, a_drw_w, a_drw_h)) {
-        EPHYR_LOG_ERROR("ephyrHostXVGetVideo() failed\n");
-        goto out;
-    }
-    result = Success;
+    xcb_free_gc(conn, gc);
 
- out:
     EPHYR_LOG("leave\n");
-    return result;
+    return Success;
 }
 
 static int
@@ -1099,46 +1170,28 @@ ephyrPutStill(KdScreenInfo * a_info,
               short a_drw_x, short a_drw_y,
               short a_vid_w, short a_vid_h,
               short a_drw_w, short a_drw_h,
-              RegionPtr a_clipping_region, pointer a_port_priv)
+              RegionPtr a_clipping_region, void *a_port_priv)
 {
+    EphyrScrPriv *scrpriv = a_info->driver;
+    xcb_connection_t *conn = hostx_get_xcbconn();
+    xcb_gcontext_t gc;
     EphyrPortPriv *port_priv = a_port_priv;
-    BoxRec clipped_area, dst_box;
-    int result = BadImplementation;
-    int drw_x = 0, drw_y = 0, drw_w = 0, drw_h = 0;
 
     EPHYR_RETURN_VAL_IF_FAIL(a_info && a_info->pScreen, BadValue);
     EPHYR_RETURN_VAL_IF_FAIL(a_drawable && port_priv, BadValue);
 
     EPHYR_LOG("enter\n");
 
-    dst_box.x1 = a_drw_x;
-    dst_box.x2 = a_drw_x + a_drw_w;
-    dst_box.y1 = a_drw_y;
-    dst_box.y2 = a_drw_y + a_drw_h;
-
-    if (!DoSimpleClip(&dst_box,
-                      RegionExtents(a_clipping_region), &clipped_area)) {
-        EPHYR_LOG_ERROR("failed to simple clip\n");
-        goto out;
-    }
-
-    drw_x = clipped_area.x1;
-    drw_y = clipped_area.y1;
-    drw_w = clipped_area.x2 - clipped_area.x1;
-    drw_h = clipped_area.y2 - clipped_area.y1;
+    gc = xcb_generate_id(conn);
+    xcb_create_gc(conn, gc, scrpriv->win, 0, NULL);
+    xcb_xv_put_still(conn, port_priv->port_number,
+                     scrpriv->win, gc,
+                     a_vid_x, a_vid_y, a_vid_w, a_vid_h,
+                     a_drw_x, a_drw_y, a_drw_w, a_drw_h);
+    xcb_free_gc(conn, gc);
 
-    if (!ephyrHostXVPutStill(a_info->pScreen->myNum,
-                             port_priv->port_number,
-                             a_vid_x, a_vid_y, a_vid_w, a_vid_h,
-                             a_drw_x, a_drw_y, a_drw_w, a_drw_h)) {
-        EPHYR_LOG_ERROR("ephyrHostXVPutStill() failed\n");
-        goto out;
-    }
-    result = Success;
-
- out:
     EPHYR_LOG("leave\n");
-    return result;
+    return Success;
 }
 
 static int
@@ -1148,46 +1201,28 @@ ephyrGetStill(KdScreenInfo * a_info,
               short a_drw_x, short a_drw_y,
               short a_vid_w, short a_vid_h,
               short a_drw_w, short a_drw_h,
-              RegionPtr a_clipping_region, pointer a_port_priv)
+              RegionPtr a_clipping_region, void *a_port_priv)
 {
+    EphyrScrPriv *scrpriv = a_info->driver;
+    xcb_connection_t *conn = hostx_get_xcbconn();
+    xcb_gcontext_t gc;
     EphyrPortPriv *port_priv = a_port_priv;
-    BoxRec clipped_area, dst_box;
-    int result = BadImplementation;
-    int drw_x = 0, drw_y = 0, drw_w = 0, drw_h = 0;
 
     EPHYR_RETURN_VAL_IF_FAIL(a_info && a_info->pScreen, BadValue);
     EPHYR_RETURN_VAL_IF_FAIL(a_drawable && port_priv, BadValue);
 
     EPHYR_LOG("enter\n");
 
-    dst_box.x1 = a_drw_x;
-    dst_box.x2 = a_drw_x + a_drw_w;
-    dst_box.y1 = a_drw_y;
-    dst_box.y2 = a_drw_y + a_drw_h;
-
-    if (!DoSimpleClip(&dst_box,
-                      RegionExtents(a_clipping_region), &clipped_area)) {
-        EPHYR_LOG_ERROR("failed to simple clip\n");
-        goto out;
-    }
-
-    drw_x = clipped_area.x1;
-    drw_y = clipped_area.y1;
-    drw_w = clipped_area.x2 - clipped_area.x1;
-    drw_h = clipped_area.y2 - clipped_area.y1;
-
-    if (!ephyrHostXVGetStill(a_info->pScreen->myNum,
-                             port_priv->port_number,
-                             a_vid_x, a_vid_y, a_vid_w, a_vid_h,
-                             a_drw_x, a_drw_y, a_drw_w, a_drw_h)) {
-        EPHYR_LOG_ERROR("ephyrHostXVGetStill() failed\n");
-        goto out;
-    }
-    result = Success;
+    gc = xcb_generate_id(conn);
+    xcb_create_gc(conn, gc, scrpriv->win, 0, NULL);
+    xcb_xv_get_still(conn, port_priv->port_number,
+                     scrpriv->win, gc,
+                     a_vid_x, a_vid_y, a_vid_w, a_vid_h,
+                     a_drw_x, a_drw_y, a_drw_w, a_drw_h);
+    xcb_free_gc(conn, gc);
 
- out:
     EPHYR_LOG("leave\n");
-    return result;
+    return Success;
 }
 
 static int
@@ -1196,6 +1231,9 @@ ephyrQueryImageAttributes(KdScreenInfo * a_info,
                           unsigned short *a_w,
                           unsigned short *a_h, int *a_pitches, int *a_offsets)
 {
+    xcb_connection_t *conn = hostx_get_xcbconn();
+    xcb_xv_query_image_attributes_cookie_t cookie;
+    xcb_xv_query_image_attributes_reply_t *reply;
     int image_size = 0;
 
     EPHYR_RETURN_VAL_IF_FAIL(a_w && a_h, FALSE);
@@ -1203,13 +1241,25 @@ ephyrQueryImageAttributes(KdScreenInfo * a_info,
     EPHYR_LOG("enter: dim (%dx%d), pitches: %p, offsets: %p\n",
               *a_w, *a_h, a_pitches, a_offsets);
 
-    if (!ephyrHostXVQueryImageAttributes(s_base_port_id,
-                                         a_id,
-                                         a_w, a_h,
-                                         &image_size, a_pitches, a_offsets)) {
-        EPHYR_LOG_ERROR("EphyrHostXVQueryImageAttributes() failed\n");
+    cookie = xcb_xv_query_image_attributes(conn,
+                                           s_base_port_id, a_id,
+                                           *a_w, *a_h);
+    reply = xcb_xv_query_image_attributes_reply(conn, cookie, NULL);
+    if (!reply)
         goto out;
+
+    *a_w = reply->width;
+    *a_h = reply->height;
+    if (a_pitches && a_offsets) {
+        memcpy(a_pitches, xcb_xv_query_image_attributes_pitches(reply),
+               reply->num_planes << 2);
+        memcpy(a_offsets, xcb_xv_query_image_attributes_offsets(reply),
+               reply->num_planes << 2);
     }
+    image_size = reply->data_size;
+
+    free(reply);
+
     EPHYR_LOG("image size: %d, dim (%dx%d)\n", image_size, *a_w, *a_h);
 
  out:
index 02729d6..435919e 100644 (file)
 #include <kdrive-config.h>
 #endif
 
-/*
- * including some server headers (like kdrive-config.h)
- * might define the macro _XSERVER64
- * on 64 bits machines. That macro must _NOT_ be defined for Xlib
- * client code, otherwise bad things happen.
- * So let's undef that macro if necessary.
- */
-#ifdef _XSERVER64
-#undef _XSERVER64
-#endif
-
 #include "hostx.h"
+#include "input.h"
 
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>             /* for memset */
 #include <errno.h>
 #include <time.h>
+#include <err.h>
 
 #include <sys/ipc.h>
 #include <sys/shm.h>
 #include <sys/time.h>
 
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#include <X11/Xatom.h>
 #include <X11/keysym.h>
-#include <X11/extensions/XShm.h>
-#include <X11/extensions/shape.h>
-#ifdef XF86DRI
-#include <GL/glx.h>
-#endif                          /* XF86DRI */
-#include "ephyrlog.h"
-
+#include <xcb/xcb.h>
+#include <xcb/xproto.h>
+#include <xcb/xcb_icccm.h>
+#include <xcb/xcb_aux.h>
+#include <xcb/shm.h>
+#include <xcb/xcb_image.h>
+#include <xcb/shape.h>
+#include <xcb/xcb_keysyms.h>
 #ifdef XF86DRI
-extern Bool XF86DRIQueryExtension(Display * dpy,
-                                  int *event_basep, int *error_basep);
+#include <xcb/xf86dri.h>
+#include <xcb/glx.h>
+#endif /* XF86DRI */
+#ifdef GLAMOR
+#include <epoxy/gl.h>
+#include "glamor.h"
+#include "ephyr_glamor_glx.h"
 #endif
-
-/*  
- * All xlib calls go here, which gets built as its own .a .
- * Mixing kdrive and xlib headers causes all sorts of types
- * to get clobbered. 
- */
-
-struct EphyrHostScreen {
-    Window win;
-    Window win_pre_existing;    /* Set via -parent option like xnest */
-    Window peer_win;            /* Used for GL; should be at most one */
-    XImage *ximg;
-    int win_width, win_height;
-    int server_depth;
-    unsigned char *fb_data;     /* only used when host bpp != server bpp */
-    XShmSegmentInfo shminfo;
-
-    void *info;                 /* Pointer to the screen this is associated with */
-    int mynum;                  /* Screen number */
-};
+#include "ephyrlog.h"
+#include "ephyr.h"
 
 struct EphyrHostXVars {
     char *server_dpy_name;
-    Display *dpy;
+    xcb_connection_t *conn;
     int screen;
-    Visual *visual;
+    xcb_visualtype_t *visual;
     Window winroot;
-    GC gc;
+    xcb_gcontext_t  gc;
     int depth;
-    Bool use_host_cursor;
+    Bool use_sw_cursor;
     Bool use_fullscreen;
     Bool have_shm;
 
     int n_screens;
-    struct EphyrHostScreen *screens;
+    KdScreenInfo **screens;
 
     long damage_debug_msec;
 
@@ -115,66 +91,27 @@ static int HostXWantDamageDebug = 0;
 
 extern EphyrKeySyms ephyrKeySyms;
 
-extern int monitorResolution;
+extern Bool EphyrWantResize;
 
 char *ephyrResName = NULL;
 int ephyrResNameFromCmd = 0;
 char *ephyrTitle = NULL;
+Bool ephyr_glamor = FALSE;
 
 static void
  hostx_set_fullscreen_hint(void);
 
-/* X Error traps */
-
-static int trapped_error_code = 0;
-static int (*old_error_handler) (Display * d, XErrorEvent * e);
-
 #define host_depth_matches_server(_vars) (HostX.depth == (_vars)->server_depth)
 
-static struct EphyrHostScreen *
-host_screen_from_screen_info(EphyrScreenInfo * screen)
-{
-    int i;
-
-    for (i = 0; i < HostX.n_screens; i++) {
-        if (HostX.screens[i].info == screen) {
-            return &HostX.screens[i];
-        }
-    }
-    return NULL;
-}
-
-static int
-error_handler(Display * display, XErrorEvent * error)
-{
-    trapped_error_code = error->error_code;
-    return 0;
-}
-
-static void
-hostx_errors_trap(void)
-{
-    trapped_error_code = 0;
-    old_error_handler = XSetErrorHandler(error_handler);
-}
-
-static int
-hostx_errors_untrap(void)
-{
-    XSetErrorHandler(old_error_handler);
-    return trapped_error_code;
-}
-
 int
-hostx_want_screen_size(EphyrScreenInfo screen, int *width, int *height)
+hostx_want_screen_size(KdScreenInfo *screen, int *width, int *height)
 {
-    struct EphyrHostScreen *host_screen = host_screen_from_screen_info(screen);
+    EphyrScrPriv *scrpriv = screen->driver;
 
-    if (host_screen &&
-        (host_screen->win_pre_existing != None ||
-         HostX.use_fullscreen == True)) {
-        *width = host_screen->win_width;
-        *height = host_screen->win_height;
+    if (scrpriv && (scrpriv->win_pre_existing != None ||
+                    HostX.use_fullscreen == TRUE)) {
+        *width = scrpriv->win_width;
+        *height = scrpriv->win_height;
         return 1;
     }
 
@@ -182,17 +119,18 @@ hostx_want_screen_size(EphyrScreenInfo screen, int *width, int *height)
 }
 
 void
-hostx_add_screen(EphyrScreenInfo screen, unsigned long win_id, int screen_num)
+hostx_add_screen(KdScreenInfo *screen, unsigned long win_id, int screen_num)
 {
+    EphyrScrPriv *scrpriv = screen->driver;
     int index = HostX.n_screens;
 
     HostX.n_screens += 1;
     HostX.screens = realloc(HostX.screens,
-                            HostX.n_screens * sizeof(struct EphyrHostScreen));
-    memset(&HostX.screens[index], 0, sizeof(struct EphyrHostScreen));
+                            HostX.n_screens * sizeof(HostX.screens[0]));
+    HostX.screens[index] = screen;
 
-    HostX.screens[index].info = screen;
-    HostX.screens[index].win_pre_existing = win_id;
+    scrpriv->screen = screen;
+    scrpriv->win_pre_existing = win_id;
 }
 
 void
@@ -202,58 +140,68 @@ hostx_set_display_name(char *name)
 }
 
 void
-hostx_set_screen_number(EphyrScreenInfo screen, int number)
+hostx_set_screen_number(KdScreenInfo *screen, int number)
 {
-    struct EphyrHostScreen *host_screen = host_screen_from_screen_info(screen);
+    EphyrScrPriv *scrpriv = screen->driver;
 
-    if (host_screen) {
-        host_screen->mynum = number;
-        hostx_set_win_title(host_screen->info, "");
+    if (scrpriv) {
+        scrpriv->mynum = number;
+        hostx_set_win_title(screen, "");
     }
 }
 
 void
-hostx_set_win_title(EphyrScreenInfo screen, char *extra_text)
+hostx_set_win_title(KdScreenInfo *screen, const char *extra_text)
 {
-    struct EphyrHostScreen *host_screen = host_screen_from_screen_info(screen);
+    EphyrScrPriv *scrpriv = screen->driver;
 
-    if (!host_screen)
+    if (!scrpriv)
         return;
 
     if (ephyrTitle) {
-        XStoreName(HostX.dpy, host_screen->win, ephyrTitle);
-    }
-    else {
+        xcb_icccm_set_wm_name(HostX.conn,
+                              scrpriv->win,
+                              XCB_ATOM_STRING,
+                              8,
+                              strlen(ephyrTitle),
+                              ephyrTitle);
+    } else {
 #define BUF_LEN 256
         char buf[BUF_LEN + 1];
 
         memset(buf, 0, BUF_LEN + 1);
         snprintf(buf, BUF_LEN, "Xephyr on %s.%d %s",
                  HostX.server_dpy_name,
-                 host_screen->mynum, (extra_text != NULL) ? extra_text : "");
-
-        XStoreName(HostX.dpy, host_screen->win, buf);
+                 scrpriv->mynum, (extra_text != NULL) ? extra_text : "");
+
+        xcb_icccm_set_wm_name(HostX.conn,
+                              scrpriv->win,
+                              XCB_ATOM_STRING,
+                              8,
+                              strlen(buf),
+                              buf);
+        xcb_flush(HostX.conn);
     }
 }
 
 int
 hostx_want_host_cursor(void)
 {
-    return HostX.use_host_cursor;
+    return !HostX.use_sw_cursor;
 }
 
 void
-hostx_use_host_cursor(void)
+hostx_use_sw_cursor(void)
 {
-    HostX.use_host_cursor = True;
+    HostX.use_sw_cursor = TRUE;
 }
 
 int
-hostx_want_preexisting_window(EphyrScreenInfo screen)
+hostx_want_preexisting_window(KdScreenInfo *screen)
 {
-    struct EphyrHostScreen *host_screen = host_screen_from_screen_info(screen);
+    EphyrScrPriv *scrpriv = screen->driver;
 
-    if (host_screen && host_screen->win_pre_existing) {
+    if (scrpriv && scrpriv->win_pre_existing) {
         return 1;
     }
     else {
@@ -264,7 +212,7 @@ hostx_want_preexisting_window(EphyrScreenInfo screen)
 void
 hostx_use_fullscreen(void)
 {
-    HostX.use_fullscreen = True;
+    HostX.use_fullscreen = TRUE;
 }
 
 int
@@ -273,21 +221,35 @@ hostx_want_fullscreen(void)
     return HostX.use_fullscreen;
 }
 
+static xcb_intern_atom_cookie_t cookie_WINDOW_STATE,
+                               cookie_WINDOW_STATE_FULLSCREEN;
+
 static void
 hostx_set_fullscreen_hint(void)
 {
-    Atom atom_WINDOW_STATE, atom_WINDOW_STATE_FULLSCREEN;
+    xcb_atom_t atom_WINDOW_STATE, atom_WINDOW_STATE_FULLSCREEN;
     int index;
+    xcb_intern_atom_reply_t *reply;
+
+    reply = xcb_intern_atom_reply(HostX.conn, cookie_WINDOW_STATE, NULL);
+    atom_WINDOW_STATE = reply->atom;
+    free(reply);
 
-    atom_WINDOW_STATE = XInternAtom(HostX.dpy, "_NET_WM_STATE", False);
-    atom_WINDOW_STATE_FULLSCREEN
-        = XInternAtom(HostX.dpy, "_NET_WM_STATE_FULLSCREEN", False);
+    reply = xcb_intern_atom_reply(HostX.conn, cookie_WINDOW_STATE_FULLSCREEN,
+                                  NULL);
+    atom_WINDOW_STATE_FULLSCREEN = reply->atom;
+    free(reply);
 
     for (index = 0; index < HostX.n_screens; index++) {
-        XChangeProperty(HostX.dpy, HostX.screens[index].win,
-                        atom_WINDOW_STATE, XA_ATOM, 32,
-                        PropModeReplace,
-                        (unsigned char *) &atom_WINDOW_STATE_FULLSCREEN, 1);
+        EphyrScrPriv *scrpriv = HostX.screens[index]->driver;
+        xcb_change_property(HostX.conn,
+                            PropModeReplace,
+                            scrpriv->win,
+                            atom_WINDOW_STATE,
+                            XCB_ATOM_ATOM,
+                            32,
+                            1,
+                            &atom_WINDOW_STATE_FULLSCREEN);
     }
 }
 
@@ -322,175 +284,231 @@ hostx_set_title(char *title)
 #pragma does_not_return(exit)
 #endif
 
-static int _X_NORETURN
-x_io_error_handler(Display * dpy)
-{
-    ErrorF("Lost connection to X server: %s\n", strerror(errno));
-    CloseWellKnownConnections();
-    OsCleanup(1);
-    exit(1);
-}
-
 int
 hostx_init(void)
 {
-    XSetWindowAttributes attr;
-    Cursor empty_cursor;
-    Pixmap cursor_pxm;
-    XColor col;
+    uint32_t attr;
+    xcb_cursor_t empty_cursor;
+    xcb_pixmap_t cursor_pxm;
+    uint16_t red, green, blue;
+    uint32_t pixel;
     int index;
     char *tmpstr;
-    XClassHint *class_hint;
-
-    attr.event_mask =
-        ButtonPressMask
-        | ButtonReleaseMask
-        | PointerMotionMask
-        | KeyPressMask
-        | KeyReleaseMask
-        | ExposureMask
-        | StructureNotifyMask;
+    char *class_hint;
+    size_t class_len;
+    const xcb_query_extension_reply_t *shm_rep;
+    xcb_screen_t *xscreen;
+
+    attr =
+        XCB_EVENT_MASK_BUTTON_PRESS
+        | XCB_EVENT_MASK_BUTTON_RELEASE
+        | XCB_EVENT_MASK_POINTER_MOTION
+        | XCB_EVENT_MASK_KEY_PRESS
+        | XCB_EVENT_MASK_KEY_RELEASE
+        | XCB_EVENT_MASK_EXPOSURE
+        | XCB_EVENT_MASK_STRUCTURE_NOTIFY;
 
     EPHYR_DBG("mark");
-
-    if ((HostX.dpy = XOpenDisplay(getenv("DISPLAY"))) == NULL) {
+#ifdef GLAMOR
+    if (ephyr_glamor)
+        HostX.conn = ephyr_glamor_connect();
+    else
+#endif
+        HostX.conn = xcb_connect(NULL, &HostX.screen);
+    if (xcb_connection_has_error(HostX.conn)) {
         fprintf(stderr, "\nXephyr cannot open host display. Is DISPLAY set?\n");
         exit(1);
     }
 
-    XSetIOErrorHandler(x_io_error_handler);
-
-    HostX.screen = DefaultScreen(HostX.dpy);
-    HostX.winroot = RootWindow(HostX.dpy, HostX.screen);
-    HostX.gc = XCreateGC(HostX.dpy, HostX.winroot, 0, NULL);
-    HostX.depth = DefaultDepth(HostX.dpy, HostX.screen);
-    HostX.visual = DefaultVisual(HostX.dpy, HostX.screen);
+    xscreen = xcb_aux_get_screen(HostX.conn, HostX.screen);
+    HostX.winroot = xscreen->root;
+    HostX.gc = xcb_generate_id(HostX.conn);
+    HostX.depth = xscreen->root_depth;
+#ifdef GLAMOR
+    if (ephyr_glamor)
+        HostX.visual = ephyr_glamor_get_visual();
+    else
+#endif
+        HostX.visual = xcb_aux_find_visual_by_id(xscreen,xscreen->root_visual);
 
-    class_hint = XAllocClassHint();
+    xcb_create_gc(HostX.conn, HostX.gc, HostX.winroot, 0, NULL);
+    cookie_WINDOW_STATE = xcb_intern_atom(HostX.conn, FALSE,
+                                          strlen("_NET_WM_STATE"),
+                                          "_NET_WM_STATE");
+    cookie_WINDOW_STATE_FULLSCREEN =
+        xcb_intern_atom(HostX.conn, FALSE,
+                        strlen("_NET_WM_STATE_FULLSCREEN"),
+                        "_NET_WM_STATE_FULLSCREEN");
 
     for (index = 0; index < HostX.n_screens; index++) {
-        struct EphyrHostScreen *host_screen = &HostX.screens[index];
-
-        host_screen->server_depth = HostX.depth;
-        if (host_screen->win_pre_existing != None) {
-            Status result;
-            XWindowAttributes prewin_attr;
+        KdScreenInfo *screen = HostX.screens[index];
+        EphyrScrPriv *scrpriv = screen->driver;
 
-            /* Get screen size from existing window */
-
-            hostx_errors_trap();
+        scrpriv->win = xcb_generate_id(HostX.conn);
+        scrpriv->server_depth = HostX.depth;
+        scrpriv->ximg = NULL;
 
-            result = XGetWindowAttributes(HostX.dpy,
-                                          host_screen->win_pre_existing,
-                                          &prewin_attr);
+        if (scrpriv->win_pre_existing != XCB_WINDOW_NONE) {
+            xcb_get_geometry_reply_t *prewin_geom;
+            xcb_get_geometry_cookie_t cookie;
+            xcb_generic_error_t *e = NULL;
 
-            if (hostx_errors_untrap() || !result) {
-                fprintf(stderr, "\nXephyr -parent window' does not exist!\n");
-                exit(1);
+            /* Get screen size from existing window */
+            cookie = xcb_get_geometry(HostX.conn,
+                                      scrpriv->win_pre_existing);
+            prewin_geom = xcb_get_geometry_reply(HostX.conn, cookie, &e);
+
+            if (e) {
+                free(e);
+                free(prewin_geom);
+                fprintf (stderr, "\nXephyr -parent window' does not exist!\n");
+                exit (1);
             }
 
-            host_screen->win_width = prewin_attr.width;
-            host_screen->win_height = prewin_attr.height;
-
-            host_screen->win = XCreateWindow(HostX.dpy,
-                                             host_screen->win_pre_existing,
-                                             0, 0,
-                                             host_screen->win_width,
-                                             host_screen->win_height,
-                                             0,
-                                             CopyFromParent,
-                                             CopyFromParent,
-                                             CopyFromParent,
-                                             CWEventMask, &attr);
+            scrpriv->win_width  = prewin_geom->width;
+            scrpriv->win_height = prewin_geom->height;
+
+            free(prewin_geom);
+
+            xcb_create_window(HostX.conn,
+                              XCB_COPY_FROM_PARENT,
+                              scrpriv->win,
+                              scrpriv->win_pre_existing,
+                              0,0,
+                              scrpriv->win_width,
+                              scrpriv->win_height,
+                              0,
+                              XCB_WINDOW_CLASS_COPY_FROM_PARENT,
+                              XCB_COPY_FROM_PARENT,
+                              XCB_CW_EVENT_MASK,
+                              &attr);
         }
         else {
-            host_screen->win = XCreateWindow(HostX.dpy, HostX.winroot, 0, 0, 100, 100,  /* will resize */
-                                             0,
-                                             CopyFromParent,
-                                             CopyFromParent,
-                                             CopyFromParent,
-                                             CWEventMask, &attr);
-
-            hostx_set_win_title(host_screen->info,
+            xcb_create_window(HostX.conn,
+                              XCB_COPY_FROM_PARENT,
+                              scrpriv->win,
+                              HostX.winroot,
+                              0,0,100,100, /* will resize */
+                              0,
+                              XCB_WINDOW_CLASS_COPY_FROM_PARENT,
+                              XCB_COPY_FROM_PARENT,
+                              XCB_CW_EVENT_MASK,
+                              &attr);
+
+            hostx_set_win_title(screen,
                                 "(ctrl+shift grabs mouse and keyboard)");
 
             if (HostX.use_fullscreen) {
-                host_screen->win_width = DisplayWidth(HostX.dpy, HostX.screen);
-                host_screen->win_height =
-                    DisplayHeight(HostX.dpy, HostX.screen);
+                scrpriv->win_width  = xscreen->width_in_pixels;
+                scrpriv->win_height = xscreen->height_in_pixels;
 
                 hostx_set_fullscreen_hint();
             }
 
+            tmpstr = getenv("RESOURCE_NAME");
+            if (tmpstr && (!ephyrResNameFromCmd))
+                ephyrResName = tmpstr;
+            class_len = strlen(ephyrResName) + 1 + strlen("Xephyr") + 1;
+            class_hint = malloc(class_len);
             if (class_hint) {
-                tmpstr = getenv("RESOURCE_NAME");
-                if (tmpstr && (!ephyrResNameFromCmd))
-                    ephyrResName = tmpstr;
-                class_hint->res_name = ephyrResName;
-                class_hint->res_class = "Xephyr";
-                XSetClassHint(hostx_get_display(), host_screen->win,
-                              class_hint);
-
+                strcpy(class_hint, ephyrResName);
+                strcpy(class_hint + strlen(ephyrResName) + 1, "Xephyr");
+                xcb_change_property(HostX.conn,
+                                    XCB_PROP_MODE_REPLACE,
+                                    scrpriv->win,
+                                    XCB_ATOM_WM_CLASS,
+                                    XCB_ATOM_STRING,
+                                    8,
+                                    class_len,
+                                    class_hint);
+                free(class_hint);
             }
-
         }
     }
 
-    if (class_hint)
-        XFree(class_hint);
+    if (!xcb_aux_parse_color("red", &red, &green, &blue)) {
+        xcb_lookup_color_cookie_t c =
+            xcb_lookup_color(HostX.conn, xscreen->default_colormap, 3, "red");
+        xcb_lookup_color_reply_t *reply =
+            xcb_lookup_color_reply(HostX.conn, c, NULL);
+        red = reply->exact_red;
+        green = reply->exact_green;
+        blue = reply->exact_blue;
+        free(reply);
+    }
 
-    XParseColor(HostX.dpy, DefaultColormap(HostX.dpy, HostX.screen),
-                "red", &col);
-    XAllocColor(HostX.dpy, DefaultColormap(HostX.dpy, HostX.screen), &col);
-    XSetForeground(HostX.dpy, HostX.gc, col.pixel);
+    {
+        xcb_alloc_color_cookie_t c = xcb_alloc_color(HostX.conn,
+                                                     xscreen->default_colormap,
+                                                     red, green, blue);
+        xcb_alloc_color_reply_t *r = xcb_alloc_color_reply(HostX.conn, c, NULL);
+        red = r->red;
+        green = r->green;
+        blue = r->blue;
+        pixel = r->pixel;
+        free(r);
+    }
 
-    if (!hostx_want_host_cursor()) {
+    xcb_change_gc(HostX.conn, HostX.gc, XCB_GC_FOREGROUND, &pixel);
+
+    if (!hostx_want_host_cursor ()) {
+        CursorVisible = TRUE;
         /* Ditch the cursor, we provide our 'own' */
-        cursor_pxm = XCreatePixmap(HostX.dpy, HostX.winroot, 1, 1, 1);
-        memset(&col, 0, sizeof(col));
-        empty_cursor = XCreatePixmapCursor(HostX.dpy,
-                                           cursor_pxm, cursor_pxm,
-                                           &col, &col, 1, 1);
+        cursor_pxm = xcb_generate_id(HostX.conn);
+        xcb_create_pixmap(HostX.conn, 1, cursor_pxm, HostX.winroot, 1, 1);
+        empty_cursor = xcb_generate_id(HostX.conn);
+        xcb_create_cursor(HostX.conn,
+                          empty_cursor,
+                          cursor_pxm, cursor_pxm,
+                          0,0,0,
+                          0,0,0,
+                          1,1);
         for (index = 0; index < HostX.n_screens; index++) {
-            XDefineCursor(HostX.dpy, HostX.screens[index].win, empty_cursor);
+            KdScreenInfo *screen = HostX.screens[index];
+            EphyrScrPriv *scrpriv = screen->driver;
+
+            xcb_change_window_attributes(HostX.conn,
+                                         scrpriv->win,
+                                         XCB_CW_CURSOR,
+                                         &empty_cursor);
         }
-        XFreePixmap(HostX.dpy, cursor_pxm);
+        xcb_free_pixmap(HostX.conn, cursor_pxm);
     }
 
-    for (index = 0; index < HostX.n_screens; index++) {
-        HostX.screens[index].ximg = NULL;
-    }
     /* Try to get share memory ximages for a little bit more speed */
-
-    if (!XShmQueryExtension(HostX.dpy) || getenv("XEPHYR_NO_SHM")) {
+    shm_rep = xcb_get_extension_data(HostX.conn, &xcb_shm_id);
+    if (!shm_rep || !shm_rep->present || getenv("XEPHYR_NO_SHM")) {
         fprintf(stderr, "\nXephyr unable to use SHM XImages\n");
-        HostX.have_shm = False;
+        HostX.have_shm = FALSE;
     }
     else {
-        /* Really really check we have shm - better way ? */
-        XShmSegmentInfo shminfo;
-
-        HostX.have_shm = True;
+        /* Really really check we have shm - better way ?*/
+        xcb_shm_segment_info_t shminfo;
+        xcb_generic_error_t *e;
+        xcb_void_cookie_t cookie;
+        xcb_shm_seg_t shmseg;
 
-        shminfo.shmid = shmget(IPC_PRIVATE, 1, IPC_CREAT | 0777);
-        shminfo.shmaddr = shmat(shminfo.shmid, 0, 0);
-        shminfo.readOnly = True;
+        HostX.have_shm = TRUE;
 
-        hostx_errors_trap();
+        shminfo.shmid = shmget(IPC_PRIVATE, 1, IPC_CREAT|0777);
+        shminfo.shmaddr = shmat(shminfo.shmid,0,0);
 
-        XShmAttach(HostX.dpy, &shminfo);
-        XSync(HostX.dpy, False);
+        shmseg = xcb_generate_id(HostX.conn);
+        cookie = xcb_shm_attach_checked(HostX.conn, shmseg, shminfo.shmid,
+                                        TRUE);
+        e = xcb_request_check(HostX.conn, cookie);
 
-        if (hostx_errors_untrap()) {
+        if (e) {
             fprintf(stderr, "\nXephyr unable to use SHM XImages\n");
-            HostX.have_shm = False;
+            HostX.have_shm = FALSE;
+            free(e);
         }
 
         shmdt(shminfo.shmaddr);
         shmctl(shminfo.shmid, IPC_RMID, 0);
     }
 
-    XFlush(HostX.dpy);
+    xcb_flush(HostX.conn);
 
     /* Setup the pause time between paints when debugging updates */
 
@@ -511,51 +529,42 @@ hostx_get_depth(void)
 }
 
 int
-hostx_get_server_depth(EphyrScreenInfo screen)
-{
-    struct EphyrHostScreen *host_screen = host_screen_from_screen_info(screen);
-
-    return host_screen ? host_screen->server_depth : 0;
-}
-
-void
-hostx_set_server_depth(EphyrScreenInfo screen, int depth)
+hostx_get_server_depth(KdScreenInfo *screen)
 {
-    struct EphyrHostScreen *host_screen = host_screen_from_screen_info(screen);
+    EphyrScrPriv *scrpriv = screen->driver;
 
-    if (host_screen)
-        host_screen->server_depth = depth;
+    return scrpriv ? scrpriv->server_depth : 0;
 }
 
 int
-hostx_get_bpp(EphyrScreenInfo screen)
+hostx_get_bpp(KdScreenInfo *screen)
 {
-    struct EphyrHostScreen *host_screen = host_screen_from_screen_info(screen);
+    EphyrScrPriv *scrpriv = screen->driver;
 
-    if (!host_screen)
+    if (!scrpriv)
         return 0;
 
-    if (host_depth_matches_server(host_screen))
-        return HostX.visual->bits_per_rgb;
+    if (host_depth_matches_server(scrpriv))
+        return HostX.visual->bits_per_rgb_value;
     else
-        return host_screen->server_depth;       /*XXX correct ? */
+        return scrpriv->server_depth; /*XXX correct ?*/
 }
 
 void
-hostx_get_visual_masks(EphyrScreenInfo screen,
+hostx_get_visual_masks(KdScreenInfo *screen,
                        CARD32 *rmsk, CARD32 *gmsk, CARD32 *bmsk)
 {
-    struct EphyrHostScreen *host_screen = host_screen_from_screen_info(screen);
+    EphyrScrPriv *scrpriv = screen->driver;
 
-    if (!host_screen)
+    if (!scrpriv)
         return;
 
-    if (host_depth_matches_server(host_screen)) {
+    if (host_depth_matches_server(scrpriv)) {
         *rmsk = HostX.visual->red_mask;
         *gmsk = HostX.visual->green_mask;
         *bmsk = HostX.visual->blue_mask;
     }
-    else if (host_screen->server_depth == 16) {
+    else if (scrpriv->server_depth == 16) {
         /* Assume 16bpp 565 */
         *rmsk = 0xf800;
         *gmsk = 0x07e0;
@@ -616,16 +625,14 @@ hostx_set_cmap_entry(unsigned char idx,
  * by fakexa for storing offscreen pixmap data.
  */
 void *
-hostx_screen_init(EphyrScreenInfo screen,
-                  int width, int height, int buffer_height)
+hostx_screen_init(KdScreenInfo *screen,
+                  int width, int height, int buffer_height,
+                  int *bytes_per_line, int *bits_per_pixel)
 {
-    int bitmap_pad;
-    Bool shm_success = False;
-    XSizeHints *size_hints;
+    EphyrScrPriv *scrpriv = screen->driver;
+    Bool shm_success = FALSE;
 
-    struct EphyrHostScreen *host_screen = host_screen_from_screen_info(screen);
-
-    if (!host_screen) {
+    if (!scrpriv) {
         fprintf(stderr, "%s: Error in accessing hostx data\n", __func__);
         exit(1);
     }
@@ -633,108 +640,156 @@ hostx_screen_init(EphyrScreenInfo screen,
     EPHYR_DBG("host_screen=%p wxh=%dx%d, buffer_height=%d",
               host_screen, width, height, buffer_height);
 
-    if (host_screen->ximg != NULL) {
+    if (scrpriv->ximg != NULL) {
         /* Free up the image data if previously used
          * i.ie called by server reset
          */
 
         if (HostX.have_shm) {
-            XShmDetach(HostX.dpy, &host_screen->shminfo);
-            XDestroyImage(host_screen->ximg);
-            shmdt(host_screen->shminfo.shmaddr);
-            shmctl(host_screen->shminfo.shmid, IPC_RMID, 0);
+            xcb_shm_detach(HostX.conn, scrpriv->shminfo.shmseg);
+            xcb_image_destroy(scrpriv->ximg);
+            shmdt(scrpriv->shminfo.shmaddr);
+            shmctl(scrpriv->shminfo.shmid, IPC_RMID, 0);
         }
         else {
-            free(host_screen->ximg->data);
-            host_screen->ximg->data = NULL;
+            free(scrpriv->ximg->data);
+            scrpriv->ximg->data = NULL;
 
-            XDestroyImage(host_screen->ximg);
+            xcb_image_destroy(scrpriv->ximg);
         }
     }
 
-    if (HostX.have_shm) {
-        host_screen->ximg =
-            XShmCreateImage(HostX.dpy, HostX.visual, HostX.depth, ZPixmap, NULL,
-                            &host_screen->shminfo, width, buffer_height);
-
-        host_screen->shminfo.shmid =
+    if (!ephyr_glamor && HostX.have_shm) {
+        scrpriv->ximg = xcb_image_create_native(HostX.conn,
+                                                width,
+                                                buffer_height,
+                                                XCB_IMAGE_FORMAT_Z_PIXMAP,
+                                                HostX.depth,
+                                                NULL,
+                                                ~0,
+                                                NULL);
+
+        scrpriv->shminfo.shmid =
             shmget(IPC_PRIVATE,
-                   host_screen->ximg->bytes_per_line * buffer_height,
+                   scrpriv->ximg->stride * buffer_height,
                    IPC_CREAT | 0777);
-        host_screen->ximg->data = shmat(host_screen->shminfo.shmid, 0, 0);
-        host_screen->shminfo.shmaddr = host_screen->ximg->data;
+        scrpriv->ximg->data = shmat(scrpriv->shminfo.shmid, 0, 0);
+        scrpriv->shminfo.shmaddr = scrpriv->ximg->data;
 
-        if (host_screen->ximg->data == (char *) -1) {
+        if (scrpriv->ximg->data == (uint8_t *) -1) {
             EPHYR_DBG
                 ("Can't attach SHM Segment, falling back to plain XImages");
-            HostX.have_shm = False;
-            XDestroyImage(host_screen->ximg);
-            shmctl(host_screen->shminfo.shmid, IPC_RMID, 0);
+            HostX.have_shm = FALSE;
+            xcb_image_destroy (scrpriv->ximg);
+            shmctl(scrpriv->shminfo.shmid, IPC_RMID, 0);
         }
         else {
-            EPHYR_DBG("SHM segment attached %p", host_screen->shminfo.shmaddr);
-            host_screen->shminfo.readOnly = False;
-            XShmAttach(HostX.dpy, &host_screen->shminfo);
-            shm_success = True;
+            EPHYR_DBG("SHM segment attached %p", scrpriv->shminfo.shmaddr);
+            scrpriv->shminfo.shmseg = xcb_generate_id(HostX.conn);
+            xcb_shm_attach(HostX.conn,
+                           scrpriv->shminfo.shmseg,
+                           scrpriv->shminfo.shmid,
+                           FALSE);
+            shm_success = TRUE;
         }
     }
 
-    if (!shm_success) {
-        bitmap_pad = (HostX.depth > 16) ? 32 : ((HostX.depth > 8) ? 16 : 8);
-
-        EPHYR_DBG("Creating image %dx%d for screen host_screen=%p\n",
-                  width, buffer_height, host_screen);
-        host_screen->ximg = XCreateImage(HostX.dpy,
-                                         HostX.visual,
-                                         HostX.depth,
-                                         ZPixmap, 0, 0,
-                                         width, buffer_height, bitmap_pad, 0);
-
-        host_screen->ximg->data =
-            malloc(host_screen->ximg->bytes_per_line * buffer_height);
+    if (!ephyr_glamor && !shm_success) {
+        EPHYR_DBG("Creating image %dx%d for screen scrpriv=%p\n",
+                  width, buffer_height, scrpriv);
+        scrpriv->ximg = xcb_image_create_native(HostX.conn,
+                                                    width,
+                                                    buffer_height,
+                                                    XCB_IMAGE_FORMAT_Z_PIXMAP,
+                                                    HostX.depth,
+                                                    NULL,
+                                                    ~0,
+                                                    NULL);
+
+        scrpriv->ximg->data =
+            malloc(scrpriv->ximg->stride * buffer_height);
     }
 
-    XResizeWindow(HostX.dpy, host_screen->win, width, height);
+    {
+        uint32_t mask = XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT;
+        uint32_t values[2] = {width, height};
+        xcb_configure_window(HostX.conn, scrpriv->win, mask, values);
+    }
 
-    /* Ask the WM to keep our size static */
-    if (host_screen->win_pre_existing == None) {
-        size_hints = XAllocSizeHints();
-        size_hints->max_width = size_hints->min_width = width;
-        size_hints->max_height = size_hints->min_height = height;
-        size_hints->flags = PMinSize | PMaxSize;
-        XSetWMNormalHints(HostX.dpy, host_screen->win, size_hints);
-        XFree(size_hints);
+    if (scrpriv->win_pre_existing == None && !EphyrWantResize) {
+        /* Ask the WM to keep our size static */
+        xcb_size_hints_t size_hints = {0};
+        size_hints.max_width = size_hints.min_width = width;
+        size_hints.max_height = size_hints.min_height = height;
+        size_hints.flags = (XCB_ICCCM_SIZE_HINT_P_MIN_SIZE |
+                            XCB_ICCCM_SIZE_HINT_P_MAX_SIZE);
+        xcb_icccm_set_wm_normal_hints(HostX.conn, scrpriv->win,
+                                      &size_hints);
     }
 
-    XMapWindow(HostX.dpy, host_screen->win);
+    xcb_map_window(HostX.conn, scrpriv->win);
+
+    xcb_aux_sync(HostX.conn);
 
-    XSync(HostX.dpy, False);
+    scrpriv->win_width = width;
+    scrpriv->win_height = height;
 
-    host_screen->win_width = width;
-    host_screen->win_height = height;
+#ifdef GLAMOR
+    if (ephyr_glamor) {
+        *bytes_per_line = 0;
+        *bits_per_pixel = 0;
+        ephyr_glamor_set_window_size(scrpriv->glamor,
+                                     scrpriv->win_width, scrpriv->win_height);
+        return NULL;
+    } else
+#endif
+    if (host_depth_matches_server(scrpriv)) {
+        *bytes_per_line = scrpriv->ximg->stride;
+        *bits_per_pixel = scrpriv->ximg->bpp;
 
-    if (host_depth_matches_server(host_screen)) {
         EPHYR_DBG("Host matches server");
-        return host_screen->ximg->data;
+        return scrpriv->ximg->data;
     }
     else {
-        EPHYR_DBG("server bpp %i", host_screen->server_depth >> 3);
-        host_screen->fb_data =
-            malloc(width * buffer_height * (host_screen->server_depth >> 3));
-        return host_screen->fb_data;
+        int bytes_per_pixel = scrpriv->server_depth >> 3;
+        int stride = (width * bytes_per_pixel + 0x3) & ~0x3;
+
+        *bytes_per_line = stride;
+        *bits_per_pixel = scrpriv->server_depth;
+
+        EPHYR_DBG("server bpp %i", bytes_per_pixel);
+        scrpriv->fb_data = malloc (stride * buffer_height);
+        return scrpriv->fb_data;
     }
 }
 
-static void hostx_paint_debug_rect(struct EphyrHostScreen *host_screen,
+static void hostx_paint_debug_rect(KdScreenInfo *screen,
                                    int x, int y, int width, int height);
 
 void
-hostx_paint_rect(EphyrScreenInfo screen,
+hostx_paint_rect(KdScreenInfo *screen,
                  int sx, int sy, int dx, int dy, int width, int height)
 {
-    struct EphyrHostScreen *host_screen = host_screen_from_screen_info(screen);
+    EphyrScrPriv *scrpriv = screen->driver;
+
+    EPHYR_DBG("painting in screen %d\n", scrpriv->mynum);
 
-    EPHYR_DBG("painting in screen %d\n", host_screen->mynum);
+#ifdef GLAMOR
+    if (ephyr_glamor) {
+        BoxRec box;
+        RegionRec region;
+
+        box.x1 = dx;
+        box.y1 = dy;
+        box.x2 = dx + width;
+        box.y2 = dy + height;
+
+        RegionInit(&region, &box, 1);
+        ephyr_glamor_damage_redisplay(scrpriv->glamor, &region);
+        RegionUninit(&region);
+        return;
+    }
+#endif
 
     /*
      *  Copy the image data updated by the shadow layer
@@ -742,7 +797,7 @@ hostx_paint_rect(EphyrScreenInfo screen,
      */
 
     if (HostXWantDamageDebug) {
-        hostx_paint_debug_rect(host_screen, dx, dy, width, height);
+        hostx_paint_debug_rect(screen, dx, dy, width, height);
     }
 
     /* 
@@ -757,23 +812,22 @@ hostx_paint_rect(EphyrScreenInfo screen,
      *       ... and it will be slower than the matching depth case.
      */
 
-    if (!host_depth_matches_server(host_screen)) {
-        int x, y, idx, bytes_per_pixel = (host_screen->server_depth >> 3);
+    if (!host_depth_matches_server(scrpriv)) {
+        int x, y, idx, bytes_per_pixel = (scrpriv->server_depth >> 3);
+        int stride = (scrpriv->win_width * bytes_per_pixel + 0x3) & ~0x3;
         unsigned char r, g, b;
         unsigned long host_pixel;
 
-        EPHYR_DBG("Unmatched host depth host_screen=%p\n", host_screen);
+        EPHYR_DBG("Unmatched host depth scrpriv=%p\n", scrpriv);
         for (y = sy; y < sy + height; y++)
             for (x = sx; x < sx + width; x++) {
-                idx =
-                    (host_screen->win_width * y * bytes_per_pixel) +
-                    (x * bytes_per_pixel);
+                idx = y * stride + x * bytes_per_pixel;
 
-                switch (host_screen->server_depth) {
+                switch (scrpriv->server_depth) {
                 case 16:
                 {
                     unsigned short pixel =
-                        *(unsigned short *) (host_screen->fb_data + idx);
+                        *(unsigned short *) (scrpriv->fb_data + idx);
 
                     r = ((pixel & 0xf800) >> 8);
                     g = ((pixel & 0x07e0) >> 3);
@@ -781,14 +835,15 @@ hostx_paint_rect(EphyrScreenInfo screen,
 
                     host_pixel = (r << 16) | (g << 8) | (b);
 
-                    XPutPixel(host_screen->ximg, x, y, host_pixel);
+                    xcb_image_put_pixel(scrpriv->ximg, x, y, host_pixel);
                     break;
                 }
                 case 8:
                 {
                     unsigned char pixel =
-                        *(unsigned char *) (host_screen->fb_data + idx);
-                    XPutPixel(host_screen->ximg, x, y, HostX.cmap[pixel]);
+                        *(unsigned char *) (scrpriv->fb_data + idx);
+                    xcb_image_put_pixel(scrpriv->ximg, x, y,
+                                        HostX.cmap[pixel]);
                     break;
                 }
                 default:
@@ -798,23 +853,28 @@ hostx_paint_rect(EphyrScreenInfo screen,
     }
 
     if (HostX.have_shm) {
-        XShmPutImage(HostX.dpy, host_screen->win,
-                     HostX.gc, host_screen->ximg,
-                     sx, sy, dx, dy, width, height, False);
+        xcb_image_shm_put(HostX.conn, scrpriv->win,
+                          HostX.gc, scrpriv->ximg,
+                          scrpriv->shminfo,
+                          sx, sy, dx, dy, width, height, FALSE);
     }
     else {
-        XPutImage(HostX.dpy, host_screen->win, HostX.gc, host_screen->ximg,
-                  sx, sy, dx, dy, width, height);
+        xcb_image_put(HostX.conn, scrpriv->win, HostX.gc, scrpriv->ximg,
+                      dx, dy, 0);
     }
 
-    XSync(HostX.dpy, False);
+    xcb_aux_sync(HostX.conn);
 }
 
 static void
-hostx_paint_debug_rect(struct EphyrHostScreen *host_screen,
+hostx_paint_debug_rect(KdScreenInfo *screen,
                        int x, int y, int width, int height)
 {
+    EphyrScrPriv *scrpriv = screen->driver;
     struct timespec tspec;
+    xcb_rectangle_t rect = { .x = x, .y = y, .width = width, .height = height };
+    xcb_void_cookie_t cookie;
+    xcb_generic_error_t *e;
 
     tspec.tv_sec = HostX.damage_debug_msec / (1000000);
     tspec.tv_nsec = (HostX.damage_debug_msec % 1000000) * 1000;
@@ -824,8 +884,10 @@ hostx_paint_debug_rect(struct EphyrHostScreen *host_screen,
 
     /* fprintf(stderr, "Xephyr updating: %i+%i %ix%i\n", x, y, width, height); */
 
-    XFillRectangle(HostX.dpy, host_screen->win, HostX.gc, x, y, width, height);
-    XSync(HostX.dpy, False);
+    cookie = xcb_poly_fill_rectangle_checked(HostX.conn, scrpriv->win,
+                                             HostX.gc, 1, &rect);
+    e = xcb_request_check(HostX.conn, cookie);
+    free(e);
 
     /* nanosleep seems to work better than usleep for me... */
     nanosleep(&tspec, NULL);
@@ -834,293 +896,112 @@ hostx_paint_debug_rect(struct EphyrHostScreen *host_screen,
 void
 hostx_load_keymap(void)
 {
-    XID *keymap;
-    int host_width, min_keycode, max_keycode, width;
-    int i, j;
+    int min_keycode, max_keycode;
 
-    XDisplayKeycodes(HostX.dpy, &min_keycode, &max_keycode);
+    min_keycode = xcb_get_setup(HostX.conn)->min_keycode;
+    max_keycode = xcb_get_setup(HostX.conn)->max_keycode;
 
     EPHYR_DBG("min: %d, max: %d", min_keycode, max_keycode);
 
-    keymap = XGetKeyboardMapping(HostX.dpy,
-                                 min_keycode,
-                                 max_keycode - min_keycode + 1, &host_width);
-
-    /* Try and copy the hosts keymap into our keymap to avoid loads
-     * of messing around.
-     *
-     * kdrive cannot can have more than 4 keysyms per keycode
-     * so we only copy at most the first 4 ( xorg has 6 per keycode, XVNC 2 )
-     */
-    width = (host_width > 4) ? 4 : host_width;
-
-    ephyrKeySyms.map = (CARD32 *) calloc(sizeof(CARD32),
-                                         (max_keycode - min_keycode + 1) *
-                                         width);
-    if (!ephyrKeySyms.map)
-        return;
-
-    for (i = 0; i < (max_keycode - min_keycode + 1); i++)
-        for (j = 0; j < width; j++)
-            ephyrKeySyms.map[(i * width) + j] =
-                (CARD32) keymap[(i * host_width) + j];
-
-    EPHYR_DBG("keymap width, host:%d kdrive:%d", host_width, width);
-
     ephyrKeySyms.minKeyCode = min_keycode;
     ephyrKeySyms.maxKeyCode = max_keycode;
-    ephyrKeySyms.mapWidth = width;
-
-    XFree(keymap);
 }
 
-static struct EphyrHostScreen *
-host_screen_from_window(Window w)
+xcb_connection_t *
+hostx_get_xcbconn(void)
 {
-    int index = 0;
-    struct EphyrHostScreen *result = NULL;
-
-    for (index = 0; index < HostX.n_screens; index++) {
-        if (HostX.screens[index].win == w || HostX.screens[index].peer_win == w) {
-            result = &HostX.screens[index];
-            goto out;
-        }
-    }
-
- out:
-    return result;
+    return HostX.conn;
 }
 
 int
-hostx_get_event(EphyrHostXEvent * ev)
-{
-    XEvent xev;
-    static int grabbed_screen = -1;
-
-    if (XPending(HostX.dpy)) {
-        XNextEvent(HostX.dpy, &xev);
-
-        switch (xev.type) {
-        case Expose:
-            /* Not so great event compression, but works ok */
-            while (XCheckTypedWindowEvent(HostX.dpy, xev.xexpose.window,
-                                          Expose, &xev));
-            {
-                struct EphyrHostScreen *host_screen =
-                    host_screen_from_window(xev.xexpose.window);
-                if (host_screen) {
-                    hostx_paint_rect(host_screen->info, 0, 0, 0, 0,
-                                     host_screen->win_width,
-                                     host_screen->win_height);
-                }
-                else {
-                    EPHYR_LOG_ERROR("failed to get host screen\n");
-                    ev->type = EPHYR_EV_EXPOSE;
-                    ev->data.expose.window = xev.xexpose.window;
-                    return 1;
-                }
-            }
-            return 0;
-
-        case MotionNotify:
-        {
-            struct EphyrHostScreen *host_screen =
-                host_screen_from_window(xev.xmotion.window);
-
-            ev->type = EPHYR_EV_MOUSE_MOTION;
-            ev->data.mouse_motion.x = xev.xmotion.x;
-            ev->data.mouse_motion.y = xev.xmotion.y;
-            ev->data.mouse_motion.window = xev.xmotion.window;
-            ev->data.mouse_motion.screen =
-                (host_screen ? host_screen->mynum : -1);
-        }
-            return 1;
-
-        case ButtonPress:
-            ev->type = EPHYR_EV_MOUSE_PRESS;
-            ev->key_state = xev.xkey.state;
-            /* 
-             * This is a bit hacky. will break for button 5 ( defined as 0x10 )
-             * Check KD_BUTTON defines in kdrive.h 
-             */
-            ev->data.mouse_down.button_num = 1 << (xev.xbutton.button - 1);
-            return 1;
-
-        case ButtonRelease:
-            ev->type = EPHYR_EV_MOUSE_RELEASE;
-            ev->key_state = xev.xkey.state;
-            ev->data.mouse_up.button_num = 1 << (xev.xbutton.button - 1);
-            return 1;
-
-        case KeyPress:
-        {
-            ev->type = EPHYR_EV_KEY_PRESS;
-            ev->key_state = xev.xkey.state;
-            ev->data.key_down.scancode = xev.xkey.keycode;
-            return 1;
-        }
-        case KeyRelease:
-
-            if ((XKeycodeToKeysym(HostX.dpy, xev.xkey.keycode, 0) == XK_Shift_L
-                 || XKeycodeToKeysym(HostX.dpy, xev.xkey.keycode,
-                                     0) == XK_Shift_R)
-                && (xev.xkey.state & ControlMask)) {
-                struct EphyrHostScreen *host_screen =
-                    host_screen_from_window(xev.xexpose.window);
-
-                if (grabbed_screen != -1) {
-                    XUngrabKeyboard(HostX.dpy, CurrentTime);
-                    XUngrabPointer(HostX.dpy, CurrentTime);
-                    grabbed_screen = -1;
-                    hostx_set_win_title(host_screen->info,
-                                        "(ctrl+shift grabs mouse and keyboard)");
-                }
-                else {
-                    /* Attempt grab */
-                    if (XGrabKeyboard(HostX.dpy, host_screen->win, True,
-                                      GrabModeAsync,
-                                      GrabModeAsync, CurrentTime) == 0) {
-                        if (XGrabPointer(HostX.dpy, host_screen->win, True,
-                                         NoEventMask,
-                                         GrabModeAsync,
-                                         GrabModeAsync,
-                                         host_screen->win, None,
-                                         CurrentTime) == 0) {
-                            grabbed_screen = host_screen->mynum;
-                            hostx_set_win_title
-                                (host_screen->info,
-                                 "(ctrl+shift releases mouse and keyboard)");
-                        }
-                        else    /* Failed pointer grabm  ungrab keyboard */
-                            XUngrabKeyboard(HostX.dpy, CurrentTime);
-                    }
-                }
-            }
-
-            /* Still send the release event even if above has happened
-             * server will get confused with just an up event. 
-             * Maybe it would be better to just block shift+ctrls getting to
-             * kdrive all togeather. 
-             */
-            ev->type = EPHYR_EV_KEY_RELEASE;
-            ev->key_state = xev.xkey.state;
-            ev->data.key_up.scancode = xev.xkey.keycode;
-            return 1;
-
-        case ConfigureNotify:
-        {
-            struct EphyrHostScreen *host_screen =
-                host_screen_from_window(xev.xconfigure.window);
-
-            if (host_screen && host_screen->win_pre_existing != None) {
-                ev->type = EPHYR_EV_CONFIGURE;
-                ev->data.configure.width = xev.xconfigure.width;
-                ev->data.configure.height = xev.xconfigure.height;
-                ev->data.configure.window = xev.xconfigure.window;
-                ev->data.configure.screen = host_screen->mynum;
-                return 1;
-            }
-
-            return 0;
-        }
-        default:
-            break;
-
-        }
-    }
-    return 0;
-}
-
-void *
-hostx_get_display(void)
+hostx_get_screen(void)
 {
-    return HostX.dpy;
+    return HostX.screen;
 }
 
 int
 hostx_get_window(int a_screen_number)
 {
+    EphyrScrPriv *scrpriv;
     if (a_screen_number < 0 || a_screen_number >= HostX.n_screens) {
         EPHYR_LOG_ERROR("bad screen number:%d\n", a_screen_number);
         return 0;
     }
-    return HostX.screens[a_screen_number].win;
+    scrpriv = HostX.screens[a_screen_number]->driver;
+    return scrpriv->win;
 }
 
 int
 hostx_get_window_attributes(int a_window, EphyrHostWindowAttributes * a_attrs)
 {
-    XWindowAttributes attrs;
-
-    memset(&attrs, 0, sizeof(attrs));
-
-    if (!XGetWindowAttributes(hostx_get_display(), a_window, &attrs)) {
-        return FALSE;
-    }
-    a_attrs->x = attrs.x;
-    a_attrs->y = attrs.y;
-    a_attrs->width = attrs.width;
-    a_attrs->height = attrs.height;
-    if (attrs.visual)
-        a_attrs->visualid = attrs.visual->visualid;
+    xcb_get_geometry_cookie_t geom_cookie;
+    xcb_get_window_attributes_cookie_t attr_cookie;
+    xcb_get_geometry_reply_t *geom_reply;
+    xcb_get_window_attributes_reply_t *attr_reply;
+
+    geom_cookie = xcb_get_geometry(HostX.conn, a_window);
+    attr_cookie = xcb_get_window_attributes(HostX.conn, a_window);
+    geom_reply = xcb_get_geometry_reply(HostX.conn, geom_cookie, NULL);
+    attr_reply = xcb_get_window_attributes_reply(HostX.conn, attr_cookie, NULL);
+
+    a_attrs->x = geom_reply->x;
+    a_attrs->y = geom_reply->y;
+    a_attrs->width = geom_reply->width;
+    a_attrs->height = geom_reply->height;
+    a_attrs->visualid = attr_reply->visual;
+
+    free(geom_reply);
+    free(attr_reply);
     return TRUE;
 }
 
 int
-hostx_get_extension_info(const char *a_ext_name,
-                         int *a_major_opcode,
-                         int *a_first_event, int *a_first_error)
-{
-    if (!a_ext_name || !a_major_opcode || !a_first_event || !a_first_error)
-        return 0;
-    if (!XQueryExtension(HostX.dpy,
-                         a_ext_name,
-                         a_major_opcode, a_first_event, a_first_error)) {
-        return 0;
-    }
-    return 1;
-}
-
-int
 hostx_get_visuals_info(EphyrHostVisualInfo ** a_visuals, int *a_num_entries)
 {
-    Display *dpy = hostx_get_display();
-    Bool is_ok = False;
-    XVisualInfo templ, *visuals = NULL;
+    Bool is_ok = FALSE;
     EphyrHostVisualInfo *host_visuals = NULL;
-    int nb_items = 0, i = 0;
+    int nb_items = 0, i = 0, screen_num;
+    xcb_screen_iterator_t screens;
+    xcb_depth_iterator_t depths;
 
-    EPHYR_RETURN_VAL_IF_FAIL(a_visuals && a_num_entries && dpy, False);
+    EPHYR_RETURN_VAL_IF_FAIL(a_visuals && a_num_entries, FALSE);
     EPHYR_LOG("enter\n");
-    memset(&templ, 0, sizeof(templ));
-    visuals = XGetVisualInfo(dpy, VisualNoMask, &templ, &nb_items);
-    if (!visuals) {
-        EPHYR_LOG_ERROR("host does not advertise any visual\n");
-        goto out;
+
+    screens = xcb_setup_roots_iterator(xcb_get_setup(HostX.conn));
+    for (screen_num = 0; screens.rem; screen_num++, xcb_screen_next(&screens)) {
+        depths = xcb_screen_allowed_depths_iterator(screens.data);
+        for (; depths.rem; xcb_depth_next(&depths)) {
+            xcb_visualtype_t *visuals = xcb_depth_visuals(depths.data);
+            EphyrHostVisualInfo *tmp_visuals =
+                realloc(host_visuals,
+                        (nb_items + depths.data->visuals_len)
+                        * sizeof(EphyrHostVisualInfo));
+            if (!tmp_visuals) {
+                goto out;
+            }
+            host_visuals = tmp_visuals;
+            for (i = 0; i < depths.data->visuals_len; i++) {
+                host_visuals[nb_items + i].visualid = visuals[i].visual_id;
+                host_visuals[nb_items + i].screen = screen_num;
+                host_visuals[nb_items + i].depth = depths.data->depth;
+                host_visuals[nb_items + i].class = visuals[i]._class;
+                host_visuals[nb_items + i].red_mask = visuals[i].red_mask;
+                host_visuals[nb_items + i].green_mask = visuals[i].green_mask;
+                host_visuals[nb_items + i].blue_mask = visuals[i].blue_mask;
+                host_visuals[nb_items + i].colormap_size = visuals[i].colormap_entries;
+                host_visuals[nb_items + i].bits_per_rgb = visuals[i].bits_per_rgb_value;
+            }
+            nb_items += depths.data->visuals_len;
+        }
     }
+
     EPHYR_LOG("host advertises %d visuals\n", nb_items);
-    host_visuals = calloc(nb_items, sizeof(EphyrHostVisualInfo));
-    for (i = 0; i < nb_items; i++) {
-        host_visuals[i].visualid = visuals[i].visualid;
-        host_visuals[i].screen = visuals[i].screen;
-        host_visuals[i].depth = visuals[i].depth;
-        host_visuals[i].class = visuals[i].class;
-        host_visuals[i].red_mask = visuals[i].red_mask;
-        host_visuals[i].green_mask = visuals[i].green_mask;
-        host_visuals[i].blue_mask = visuals[i].blue_mask;
-        host_visuals[i].colormap_size = visuals[i].colormap_size;
-        host_visuals[i].bits_per_rgb = visuals[i].bits_per_rgb;
-    }
     *a_visuals = host_visuals;
     *a_num_entries = nb_items;
     host_visuals = NULL;
 
     is_ok = TRUE;
- out:
-    if (visuals) {
-        XFree(visuals);
-        visuals = NULL;
-    }
+out:
     free(host_visuals);
     host_visuals = NULL;
     EPHYR_LOG("leave\n");
@@ -1134,54 +1015,58 @@ hostx_create_window(int a_screen_number,
                     int a_visual_id, int *a_host_peer /*out parameter */ )
 {
     Bool is_ok = FALSE;
-    Display *dpy = hostx_get_display();
-    XVisualInfo *visual_info = NULL, visual_info_templ;
-    int visual_mask = VisualIDMask;
-    Window win = None;
-    int nb_visuals = 0, winmask = 0;
-    XSetWindowAttributes attrs;
+    xcb_window_t win;
+    int winmask = 0;
+    uint32_t attrs[2];
+    xcb_screen_t *screen = xcb_aux_get_screen(HostX.conn, hostx_get_screen());
+    xcb_visualtype_t *visual;
+    int depth = 0;
+    EphyrScrPriv *scrpriv = HostX.screens[a_screen_number]->driver;
 
-    EPHYR_RETURN_VAL_IF_FAIL(dpy && a_geometry, FALSE);
+    EPHYR_RETURN_VAL_IF_FAIL(screen && a_geometry, FALSE);
 
     EPHYR_LOG("enter\n");
 
-    /*get visual */
-    memset(&visual_info, 0, sizeof(visual_info));
-    visual_info_templ.visualid = a_visual_id;
-    visual_info = XGetVisualInfo(dpy, visual_mask,
-                                 &visual_info_templ, &nb_visuals);
-    if (!visual_info) {
-        EPHYR_LOG_ERROR("argh, could not find a remote visual with id:%d\n",
-                        a_visual_id);
+    visual = xcb_aux_find_visual_by_id(screen, a_visual_id);
+    if (!visual) {
+        EPHYR_LOG_ERROR ("argh, could not find a remote visual with id:%d\n",
+                         a_visual_id);
         goto out;
     }
-    memset(&attrs, 0, sizeof(attrs));
-    attrs.colormap = XCreateColormap(dpy,
-                                     RootWindow(dpy,
-                                                visual_info->screen),
-                                     visual_info->visual, AllocNone);
-    attrs.event_mask = ButtonPressMask
-        | ButtonReleaseMask
-        | PointerMotionMask | KeyPressMask | KeyReleaseMask | ExposureMask;
-    winmask = CWColormap | CWEventMask;
-
-    win = XCreateWindow(dpy, hostx_get_window(a_screen_number),
-                        a_geometry->x, a_geometry->y,
-                        a_geometry->width, a_geometry->height, 0,
-                        visual_info->depth, CopyFromParent,
-                        visual_info->visual, winmask, &attrs);
-    if (win == None) {
-        EPHYR_LOG_ERROR("failed to create peer window\n");
-        goto out;
-    }
-    if (HostX.screens[a_screen_number].peer_win == None) {
-        HostX.screens[a_screen_number].peer_win = win;
+    depth = xcb_aux_get_depth_of_visual(screen, a_visual_id);
+
+    winmask = XCB_CW_EVENT_MASK | XCB_CW_COLORMAP;
+    attrs[0] = XCB_EVENT_MASK_BUTTON_PRESS
+              |XCB_EVENT_MASK_BUTTON_RELEASE
+              |XCB_EVENT_MASK_POINTER_MOTION
+              |XCB_EVENT_MASK_KEY_PRESS
+              |XCB_EVENT_MASK_KEY_RELEASE
+              |XCB_EVENT_MASK_EXPOSURE;
+    attrs[1] = xcb_generate_id(HostX.conn);
+    xcb_create_colormap(HostX.conn,
+                        XCB_COLORMAP_ALLOC_NONE,
+                        attrs[1],
+                        hostx_get_window(a_screen_number),
+                        a_visual_id);
+
+    win = xcb_generate_id(HostX.conn);
+    xcb_create_window(HostX.conn,
+                      depth,
+                      win,
+                      hostx_get_window (a_screen_number),
+                      a_geometry->x, a_geometry->y,
+                      a_geometry->width, a_geometry->height, 0,
+                      XCB_WINDOW_CLASS_COPY_FROM_PARENT,
+                      a_visual_id, winmask, attrs);
+
+    if (scrpriv->peer_win == XCB_NONE) {
+        scrpriv->peer_win = win;
     }
     else {
         EPHYR_LOG_ERROR("multiple peer windows created for same screen\n");
     }
-    XFlush(dpy);
-    XMapWindow(dpy, win);
+    xcb_flush(HostX.conn);
+    xcb_map_window(HostX.conn, win);
     *a_host_peer = win;
     is_ok = TRUE;
  out:
@@ -1192,26 +1077,31 @@ hostx_create_window(int a_screen_number,
 int
 hostx_destroy_window(int a_win)
 {
-    Display *dpy = hostx_get_display();
-
-    EPHYR_RETURN_VAL_IF_FAIL(dpy, FALSE);
-    XDestroyWindow(dpy, a_win);
-    XFlush(dpy);
+    xcb_destroy_window(HostX.conn, a_win);
+    xcb_flush(HostX.conn);
     return TRUE;
 }
 
 int
 hostx_set_window_geometry(int a_win, EphyrBox * a_geo)
 {
-    Display *dpy = hostx_get_display();
+    uint32_t mask = XCB_CONFIG_WINDOW_X
+                  | XCB_CONFIG_WINDOW_Y
+                  | XCB_CONFIG_WINDOW_WIDTH
+                  | XCB_CONFIG_WINDOW_HEIGHT;
+    uint32_t values[4];
 
-    EPHYR_RETURN_VAL_IF_FAIL(dpy && a_geo, FALSE);
+    EPHYR_RETURN_VAL_IF_FAIL(a_geo, FALSE);
 
     EPHYR_LOG("enter. x,y,w,h:(%d,%d,%d,%d)\n",
               a_geo->x, a_geo->y, a_geo->width, a_geo->height);
 
-    XMoveWindow(dpy, a_win, a_geo->x, a_geo->y);
-    XResizeWindow(dpy, a_win, a_geo->width, a_geo->height);
+    values[0] = a_geo->x;
+    values[1] = a_geo->y;
+    values[2] = a_geo->width;
+    values[3] = a_geo->height;
+    xcb_configure_window(HostX.conn, a_win, mask, values);
+
     EPHYR_LOG("leave\n");
     return TRUE;
 }
@@ -1221,15 +1111,16 @@ hostx_set_window_bounding_rectangles(int a_window,
                                      EphyrRect * a_rects, int a_num_rects)
 {
     Bool is_ok = FALSE;
-    Display *dpy = hostx_get_display();
     int i = 0;
-    XRectangle *rects = NULL;
+    xcb_rectangle_t *rects = NULL;
 
-    EPHYR_RETURN_VAL_IF_FAIL(dpy && a_rects, FALSE);
+    EPHYR_RETURN_VAL_IF_FAIL(a_rects, FALSE);
 
     EPHYR_LOG("enter. num rects:%d\n", a_num_rects);
 
-    rects = calloc(a_num_rects, sizeof(XRectangle));
+    rects = calloc(a_num_rects, sizeof (xcb_rectangle_t));
+    if (!rects)
+        goto out;
     for (i = 0; i < a_num_rects; i++) {
         rects[i].x = a_rects[i].x1;
         rects[i].y = a_rects[i].y1;
@@ -1238,62 +1129,23 @@ hostx_set_window_bounding_rectangles(int a_window,
         EPHYR_LOG("borders clipped to rect[x:%d,y:%d,w:%d,h:%d]\n",
                   rects[i].x, rects[i].y, rects[i].width, rects[i].height);
     }
-    /*this aways returns 1 */
-    XShapeCombineRectangles(dpy, a_window, ShapeBounding, 0, 0,
-                            rects, a_num_rects, ShapeSet, YXBanded);
+    xcb_shape_rectangles(HostX.conn,
+                         XCB_SHAPE_SO_SET,
+                         XCB_SHAPE_SK_BOUNDING,
+                         XCB_CLIP_ORDERING_YX_BANDED,
+                         a_window,
+                         0, 0,
+                         a_num_rects,
+                         rects);
     is_ok = TRUE;
 
+out:
     free(rects);
     rects = NULL;
     EPHYR_LOG("leave\n");
     return is_ok;
 }
 
-int
-hostx_set_window_clipping_rectangles(int a_window,
-                                     EphyrRect * a_rects, int a_num_rects)
-{
-    Bool is_ok = FALSE;
-    Display *dpy = hostx_get_display();
-    int i = 0;
-    XRectangle *rects = NULL;
-
-    EPHYR_RETURN_VAL_IF_FAIL(dpy && a_rects, FALSE);
-
-    EPHYR_LOG("enter. num rects:%d\n", a_num_rects);
-
-    rects = calloc(a_num_rects, sizeof(XRectangle));
-    for (i = 0; i < a_num_rects; i++) {
-        rects[i].x = a_rects[i].x1;
-        rects[i].y = a_rects[i].y1;
-        rects[i].width = abs(a_rects[i].x2 - a_rects[i].x1);
-        rects[i].height = abs(a_rects[i].y2 - a_rects[i].y1);
-        EPHYR_LOG("clipped to rect[x:%d,y:%d,w:%d,h:%d]\n",
-                  rects[i].x, rects[i].y, rects[i].width, rects[i].height);
-    }
-    /*this aways returns 1 */
-    XShapeCombineRectangles(dpy, a_window, ShapeClip, 0, 0,
-                            rects, a_num_rects, ShapeSet, YXBanded);
-    is_ok = TRUE;
-
-    free(rects);
-    rects = NULL;
-    EPHYR_LOG("leave\n");
-    return is_ok;
-}
-
-int
-hostx_has_xshape(void)
-{
-    int event_base = 0, error_base = 0;
-    Display *dpy = hostx_get_display();
-
-    if (!XShapeQueryExtension(dpy, &event_base, &error_base)) {
-        return FALSE;
-    }
-    return TRUE;
-}
-
 #ifdef XF86DRI
 typedef struct {
     int is_valid;
@@ -1310,7 +1162,6 @@ hostx_allocate_resource_id_peer(int a_local_resource_id,
 {
     int i = 0;
     ResourcePair *peer = NULL;
-    Display *dpy = hostx_get_display();
 
     /*
      * first make sure a resource peer
@@ -1335,7 +1186,7 @@ hostx_allocate_resource_id_peer(int a_local_resource_id,
             }
         }
         if (peer) {
-            peer->remote_id = XAllocID(dpy);
+            peer->remote_id = xcb_generate_id(HostX.conn);
             peer->local_id = a_local_resource_id;
             peer->is_valid = TRUE;
         }
@@ -1367,31 +1218,88 @@ hostx_get_resource_id_peer(int a_local_resource_id, int *a_remote_resource_id)
     return FALSE;
 }
 
-int
-hostx_has_dri(void)
+#endif                          /* XF86DRI */
+
+#ifdef GLAMOR
+Bool
+ephyr_glamor_init(ScreenPtr screen)
 {
-    int event_base = 0, error_base = 0;
-    Display *dpy = hostx_get_display();
+    KdScreenPriv(screen);
+    KdScreenInfo *kd_screen = pScreenPriv->screen;
+    EphyrScrPriv *scrpriv = kd_screen->driver;
 
-    if (!dpy)
-        return FALSE;
+    scrpriv->glamor = ephyr_glamor_glx_screen_init(scrpriv->win);
+    ephyr_glamor_set_window_size(scrpriv->glamor,
+                                 scrpriv->win_width, scrpriv->win_height);
+
+    glamor_init(screen,
+                GLAMOR_USE_SCREEN |
+                GLAMOR_USE_PICTURE_SCREEN |
+                GLAMOR_INVERTED_Y_AXIS);
 
-    if (!XF86DRIQueryExtension(dpy, &event_base, &error_base)) {
-        return FALSE;
-    }
     return TRUE;
 }
 
-int
-hostx_has_glx(void)
+Bool
+ephyr_glamor_create_screen_resources(ScreenPtr pScreen)
 {
-    Display *dpy = hostx_get_display();
-    int event_base = 0, error_base = 0;
+    KdScreenPriv(pScreen);
+    KdScreenInfo *kd_screen = pScreenPriv->screen;
+    EphyrScrPriv *scrpriv = kd_screen->driver;
+    PixmapPtr screen_pixmap;
+    uint32_t tex;
+
+    if (!ephyr_glamor)
+        return TRUE;
+
+    /* kdrive's fbSetupScreen() told mi to have
+     * miCreateScreenResources() (which is called before this) make a
+     * scratch pixmap wrapping ephyr-glamor's NULL
+     * KdScreenInfo->fb.framebuffer.
+     *
+     * We want a real (texture-based) screen pixmap at this point.
+     * This is what glamor will render into, and we'll then texture
+     * out of that into the host's window to present the results.
+     *
+     * Thus, delete the current screen pixmap, and put a fresh one in.
+     */
+    screen_pixmap = pScreen->GetScreenPixmap(pScreen);
+    pScreen->DestroyPixmap(screen_pixmap);
+
+    screen_pixmap = pScreen->CreatePixmap(pScreen,
+                                          pScreen->width,
+                                          pScreen->height,
+                                          pScreen->rootDepth,
+                                          GLAMOR_CREATE_NO_LARGE);
+
+    pScreen->SetScreenPixmap(screen_pixmap);
+
+    /* Tell the GLX code what to GL texture to read from. */
+    tex = glamor_get_pixmap_texture(screen_pixmap);
+    ephyr_glamor_set_texture(scrpriv->glamor, tex);
 
-    if (!glXQueryExtension(dpy, &event_base, &error_base)) {
-        return FALSE;
-    }
     return TRUE;
 }
 
-#endif                          /* XF86DRI */
+void
+ephyr_glamor_enable(ScreenPtr screen)
+{
+}
+
+void
+ephyr_glamor_disable(ScreenPtr screen)
+{
+}
+
+void
+ephyr_glamor_fini(ScreenPtr screen)
+{
+    KdScreenPriv(screen);
+    KdScreenInfo *kd_screen = pScreenPriv->screen;
+    EphyrScrPriv *scrpriv = kd_screen->driver;
+
+    glamor_fini(screen);
+    ephyr_glamor_glx_screen_fini(scrpriv->glamor);
+    scrpriv->glamor = NULL;
+}
+#endif
index 31c4053..e83323a 100644 (file)
@@ -28,6 +28,8 @@
 
 #include <X11/X.h>
 #include <X11/Xmd.h>
+#include <xcb/xcb.h>
+#include "ephyr.h"
 
 #define EPHYR_WANT_DEBUG 0
 
 #endif
 
 typedef struct EphyrHostXVars EphyrHostXVars;
-typedef struct EphyrHostXEvent EphyrHostXEvent;
-typedef void *EphyrScreenInfo;
-typedef enum EphyrHostXEventType {
-    EPHYR_EV_MOUSE_MOTION,
-    EPHYR_EV_MOUSE_PRESS,
-    EPHYR_EV_MOUSE_RELEASE,
-    EPHYR_EV_KEY_PRESS,
-    EPHYR_EV_KEY_RELEASE,
-    EPHYR_EV_EXPOSE,
-    EPHYR_EV_CONFIGURE,
-} EphyrHostXEventType;
-
-/* I can't believe it's not a KeySymsRec. */
+
 typedef struct {
     int minKeyCode;
     int maxKeyCode;
-    int mapWidth;
-    CARD32 *map;
 } EphyrKeySyms;
 
-struct EphyrHostXEvent {
-    EphyrHostXEventType type;
-
-    union {
-        struct mouse_motion {
-            int x;
-            int y;
-            int screen;
-            int window;
-        } mouse_motion;
-
-        struct mouse_down {
-            int button_num;
-        } mouse_down;
-
-        struct mouse_up {
-            int button_num;
-        } mouse_up;
-
-        struct key_up {
-            int scancode;
-        } key_up;
-
-        struct key_down {
-            int scancode;
-        } key_down;
-
-        struct expose {
-            int window;
-        } expose;
-
-        struct configure {
-            int width;
-            int height;
-            int screen;
-            int window;
-        } configure;
-
-    } data;
-
-    int key_state;
-};
-
 typedef struct {
     VisualID visualid;
     int screen;
@@ -129,13 +74,13 @@ typedef struct {
 } EphyrRect;
 
 int
- hostx_want_screen_size(EphyrScreenInfo screen, int *width, int *height);
+hostx_want_screen_size(KdScreenInfo *screen, int *width, int *height);
 
 int
  hostx_want_host_cursor(void);
 
 void
- hostx_use_host_cursor(void);
+ hostx_use_sw_cursor(void);
 
 void
  hostx_use_fullscreen(void);
@@ -144,7 +89,7 @@ int
  hostx_want_fullscreen(void);
 
 int
- hostx_want_preexisting_window(EphyrScreenInfo screen);
+hostx_want_preexisting_window(KdScreenInfo *screen);
 
 void
  hostx_use_preexisting_window(unsigned long win_id);
@@ -162,51 +107,50 @@ int
  hostx_init(void);
 
 void
- hostx_add_screen(EphyrScreenInfo screen, unsigned long win_id, int screen_num);
+hostx_add_screen(KdScreenInfo *screen, unsigned long win_id, int screen_num);
 
 void
  hostx_set_display_name(char *name);
 
 void
- hostx_set_screen_number(EphyrScreenInfo screen, int number);
+hostx_set_screen_number(KdScreenInfo *screen, int number);
 
 void
- hostx_set_win_title(EphyrScreenInfo screen, char *extra_text);
+hostx_set_win_title(KdScreenInfo *screen, const char *extra_text);
 
 int
  hostx_get_depth(void);
 
 int
- hostx_get_server_depth(EphyrScreenInfo screen);
-
-void
- hostx_set_server_depth(EphyrScreenInfo screen, int depth);
+hostx_get_server_depth(KdScreenInfo *screen);
 
 int
- hostx_get_bpp(void *info);
+hostx_get_bpp(KdScreenInfo *screen);
 
 void
- hostx_get_visual_masks(void *info, CARD32 *rmsk, CARD32 *gmsk, CARD32 *bmsk);
+hostx_get_visual_masks(KdScreenInfo *screen,
+                       CARD32 *rmsk, CARD32 *gmsk, CARD32 *bmsk);
 void
 
 hostx_set_cmap_entry(unsigned char idx,
                      unsigned char r, unsigned char g, unsigned char b);
 
-void *hostx_screen_init(EphyrScreenInfo screen,
-                        int width, int height, int buffer_height);
+void *hostx_screen_init(KdScreenInfo *screen,
+                        int width, int height, int buffer_height,
+                        int *bytes_per_line, int *bits_per_pixel);
 
 void
-
-hostx_paint_rect(EphyrScreenInfo screen,
+hostx_paint_rect(KdScreenInfo *screen,
                  int sx, int sy, int dx, int dy, int width, int height);
 
 void
  hostx_load_keymap(void);
 
-int
- hostx_get_event(EphyrHostXEvent * ev);
+xcb_connection_t *
+hostx_get_xcbconn(void);
 
-void *hostx_get_display(void);
+int
+hostx_get_screen(void);
 
 int
  hostx_get_window(int a_screen_number);
@@ -215,11 +159,6 @@ int
  hostx_get_window_attributes(int a_window, EphyrHostWindowAttributes * a_attr);
 
 int
-
-hostx_get_extension_info(const char *a_ext_name,
-                         int *a_major_opcode,
-                         int *a_first_even, int *a_first_error);
-int
  hostx_get_visuals_info(EphyrHostVisualInfo ** a_visuals, int *a_num_entries);
 
 int hostx_create_window(int a_screen_number,
@@ -233,9 +172,7 @@ int hostx_set_window_geometry(int a_win, EphyrBox * a_geo);
 int hostx_set_window_bounding_rectangles(int a_window,
                                          EphyrRect * a_rects, int a_num_rects);
 
-int hostx_set_window_clipping_rectangles(int a_window,
-                                         EphyrRect * a_rects, int a_num_rects);
-int hostx_has_xshape(void);
+int host_has_extension(xcb_extension_t *extension);
 
 #ifdef XF86DRI
 int hostx_lookup_peer_window(void *a_local_window,
index ca88ab2..f14f6c8 100644 (file)
@@ -46,7 +46,7 @@ and the following additional options:
 sets the screen size.
 .TP 8
 .BI -parent " id"
-uses exiting window
+uses existing window
 .I id .
 If a
 .BI -screen
@@ -59,6 +59,10 @@ set 'cursor acceleration':
 The host's cursor is reused. This is only really there to aid
 debugging by avoiding server paints for the cursor. Performance
 improvement is negligible.
+.TP 8
+.B -resizeable
+Allow the Xephyr window to be resized, even if not embedded into a parent
+window. By default, the Xephyr window has a fixed size.
 .SH "SIGNALS"
 Send a SIGUSR1 to the server (e.g. pkill -USR1 Xephyr) to
 toggle the debugging mode.
index a2a705d..56b52d1 100644 (file)
@@ -28,7 +28,7 @@
 #endif
 #include "ephyr.h"
 
-extern void processScreenArg(char *screen_size, char *parent_id);
+extern void processScreenArg(const char *screen_size, char *parent_id);
 
 static int
 EphyrInit(void)
diff --git a/hw/kdrive/ephyr/xf86dri.h b/hw/kdrive/ephyr/xf86dri.h
deleted file mode 100644 (file)
index 88d3f3b..0000000
+++ /dev/null
@@ -1,124 +0,0 @@
-/* $XFree86: xc/lib/GL/dri/xf86dri.h,v 1.8 2002/10/30 12:51:25 alanh Exp $ */
-/**************************************************************************
-
-Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
-Copyright 2000 VA Linux Systems, Inc.
-All Rights Reserved.
-
-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, sub license, 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 NON-INFRINGEMENT.
-IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS 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.
-
-**************************************************************************/
-
-/**
- * \file xf86dri.h
- * Protocol numbers and function prototypes for DRI X protocol.
- *
- * \author Kevin E. Martin <martin@valinux.com>
- * \author Jens Owen <jens@tungstengraphics.com>
- * \author Rickard E. (Rik) Faith <faith@valinux.com>
- */
-
-#ifndef _XF86DRI_H_
-#define _XF86DRI_H_
-
-#include <X11/Xfuncproto.h>
-#include <xf86drm.h>
-
-#define X_XF86DRIQueryVersion                  0
-#define X_XF86DRIQueryDirectRenderingCapable   1
-#define X_XF86DRIOpenConnection                        2
-#define X_XF86DRICloseConnection               3
-#define X_XF86DRIGetClientDriverName           4
-#define X_XF86DRICreateContext                 5
-#define X_XF86DRIDestroyContext                        6
-#define X_XF86DRICreateDrawable                        7
-#define X_XF86DRIDestroyDrawable               8
-#define X_XF86DRIGetDrawableInfo               9
-#define X_XF86DRIGetDeviceInfo                 10
-#define X_XF86DRIAuthConnection                 11
-#define X_XF86DRIOpenFullScreen                 12      /* Deprecated */
-#define X_XF86DRICloseFullScreen                13      /* Deprecated */
-
-#define XF86DRINumberEvents            0
-
-#define XF86DRIClientNotLocal          0
-#define XF86DRIOperationNotSupported   1
-#define XF86DRINumberErrors            (XF86DRIOperationNotSupported + 1)
-
-#ifndef _XF86DRI_SERVER_
-
-_XFUNCPROTOBEGIN
-
-Bool XF86DRIQueryExtension(Display * dpy, int *event_base, int *error_base);
-
-Bool XF86DRIQueryVersion(Display * dpy, int *majorVersion, int *minorVersion,
-                         int *patchVersion);
-
-Bool XF86DRIQueryDirectRenderingCapable(Display * dpy, int screen,
-                                        Bool *isCapable);
-
-Bool XF86DRIOpenConnection(Display * dpy, int screen, drm_handle_t * hSAREA,
-                           char **busIDString);
-
-Bool XF86DRIAuthConnection(Display * dpy, int screen, drm_magic_t magic);
-
-Bool XF86DRICloseConnection(Display * dpy, int screen);
-
-Bool XF86DRIGetClientDriverName(Display * dpy, int screen,
-                                int *ddxDriverMajorVersion,
-                                int *ddxDriverMinorVersion,
-                                int *ddxDriverPatchVersion,
-                                char **clientDriverName);
-
-Bool XF86DRICreateContext(Display * dpy, int screen, Visual * visual,
-                          XID *ptr_to_returned_context_id,
-                          drm_context_t * hHWContext);
-
-Bool XF86DRICreateContextWithConfig(Display * dpy, int screen, int configID,
-                                    XID *ptr_to_returned_context_id,
-                                    drm_context_t * hHWContext);
-
-extern GLboolean XF86DRIDestroyContext(Display * dpy, int screen,
-                                       XID context_id);
-
-extern GLboolean XF86DRICreateDrawable(Display * dpy, int screen,
-                                       XID drawable,
-                                       drm_drawable_t * hHWDrawable);
-
-extern GLboolean XF86DRIDestroyDrawable(Display * dpy, int screen,
-                                        XID drawable);
-
-Bool XF86DRIGetDrawableInfo(Display * dpy, int screen, Drawable drawable,
-                            unsigned int *index, unsigned int *stamp,
-                            int *X, int *Y, int *W, int *H,
-                            int *numClipRects, drm_clip_rect_t ** pClipRects,
-                            int *backX, int *backY,
-                            int *numBackClipRects,
-                            drm_clip_rect_t ** pBackClipRects);
-
-Bool XF86DRIGetDeviceInfo(Display * dpy, int screen,
-                          drm_handle_t * hFrameBuffer, int *fbOrigin,
-                          int *fbSize, int *fbStride, int *devPrivateSize,
-                          void **pDevPrivate);
-
-_XFUNCPROTOEND
-#endif                          /* _XF86DRI_SERVER_ */
-#endif                          /* _XF86DRI_H_ */
index 6d3ed05..14c99c3 100644 (file)
@@ -1,4 +1,4 @@
-INCLUDES =                                     \
+AM_CPPFLAGS =                                  \
        @KDRIVE_INCS@                           \
        @KDRIVE_CFLAGS@
 
index ec9df95..7e8ba02 100644 (file)
@@ -1,4 +1,4 @@
-INCLUDES =                                     \
+AM_CPPFLAGS =                                  \
        @KDRIVE_INCS@                           \
        @KDRIVE_CFLAGS@
 
index fd14afa..95f64cb 100644 (file)
@@ -30,7 +30,7 @@
 
 extern int KdTsPhyScreen;
 
-char *fbdevDevicePath = NULL;
+const char *fbdevDevicePath = NULL;
 
 static Bool
 fbdevInitialize(KdCardInfo * card, FbdevPriv * priv)
@@ -206,13 +206,23 @@ fbdevScreenInitialize(KdScreenInfo * screen, FbdevScrPriv * scrpriv)
     depth = priv->var.bits_per_pixel;
     gray = priv->var.grayscale;
 
+    /* Calculate fix.line_length if it's zero */
+    if (!priv->fix.line_length)
+        priv->fix.line_length = (priv->var.xres_virtual * depth + 7) / 8;
+
     switch (priv->fix.visual) {
+    case FB_VISUAL_MONO01:
+    case FB_VISUAL_MONO10:
+        screen->fb.visuals = (1 << StaticGray);
+        break;
     case FB_VISUAL_PSEUDOCOLOR:
-        if (gray) {
-            screen->fb.visuals = (1 << StaticGray);
+        screen->fb.visuals = (1 << StaticGray);
+        if (priv->var.bits_per_pixel == 1) {
+            /* Override to monochrome, to have preallocated black/white */
+            priv->fix.visual = FB_VISUAL_MONO01;
+        } else if (gray) {
             /* could also support GrayScale, but what's the point? */
-        }
-        else {
+        } else {
             screen->fb.visuals = ((1 << StaticGray) |
                                   (1 << GrayScale) |
                                   (1 << StaticColor) |
@@ -309,6 +319,21 @@ fbdevWindowLinear(ScreenPtr pScreen,
     return (CARD8 *) priv->fb + row * priv->fix.line_length + offset;
 }
 
+static void *
+fbdevWindowAfb(ScreenPtr pScreen,
+               CARD32 row,
+               CARD32 offset, int mode, CARD32 *size, void *closure)
+{
+    KdScreenPriv(pScreen);
+    FbdevPriv *priv = pScreenPriv->card->driver;
+
+    if (!pScreenPriv->enabled)
+        return 0;
+    /* offset to next plane */
+    *size = priv->var.yres_virtual * priv->fix.line_length;
+    return (CARD8 *) priv->fb + row * priv->fix.line_length + offset;
+}
+
 Bool
 fbdevMapFramebuffer(KdScreenInfo * screen)
 {
@@ -316,7 +341,8 @@ fbdevMapFramebuffer(KdScreenInfo * screen)
     KdPointerMatrix m;
     FbdevPriv *priv = screen->card->driver;
 
-    if (scrpriv->randr != RR_Rotate_0)
+    if (scrpriv->randr != RR_Rotate_0 ||
+        priv->fix.type != FB_TYPE_PACKED_PIXELS)
         scrpriv->shadow = TRUE;
     else
         scrpriv->shadow = FALSE;
@@ -392,33 +418,88 @@ fbdevSetShadow(ScreenPtr pScreen)
 
     window = fbdevWindowLinear;
     update = 0;
-    if (scrpriv->randr)
-        if (priv->var.bits_per_pixel == 16) {
-            switch (scrpriv->randr) {
-            case RR_Rotate_90:
-                if (useYX)
-                    update = shadowUpdateRotate16_90YX;
-                else
-                    update = shadowUpdateRotate16_90;
-                break;
-            case RR_Rotate_180:
-                update = shadowUpdateRotate16_180;
+    switch (priv->fix.type) {
+    case FB_TYPE_PACKED_PIXELS:
+        if (scrpriv->randr)
+            if (priv->var.bits_per_pixel == 16) {
+                switch (scrpriv->randr) {
+                case RR_Rotate_90:
+                    if (useYX)
+                        update = shadowUpdateRotate16_90YX;
+                    else
+                        update = shadowUpdateRotate16_90;
+                    break;
+                case RR_Rotate_180:
+                    update = shadowUpdateRotate16_180;
+                    break;
+                case RR_Rotate_270:
+                    if (useYX)
+                        update = shadowUpdateRotate16_270YX;
+                    else
+                        update = shadowUpdateRotate16_270;
+                    break;
+                default:
+                    update = shadowUpdateRotate16;
+                    break;
+                }
+            }
+            else
+                update = shadowUpdateRotatePacked;
+        else
+            update = shadowUpdatePacked;
+        break;
+
+    case FB_TYPE_PLANES:
+        window = fbdevWindowAfb;
+        switch (priv->var.bits_per_pixel) {
+        case 4:
+            update = shadowUpdateAfb4;
+            break;
+
+        case 8:
+            update = shadowUpdateAfb8;
+            break;
+
+        default:
+            FatalError("Bitplanes with bpp %u are not yet supported\n",
+                       priv->var.bits_per_pixel);
+        }
+        break;
+
+    case FB_TYPE_INTERLEAVED_PLANES:
+        if (priv->fix.type_aux == 2) {
+            switch (priv->var.bits_per_pixel) {
+            case 4:
+                update = shadowUpdateIplan2p4;
                 break;
-            case RR_Rotate_270:
-                if (useYX)
-                    update = shadowUpdateRotate16_270YX;
-                else
-                    update = shadowUpdateRotate16_270;
+
+            case 8:
+                update = shadowUpdateIplan2p8;
                 break;
+
             default:
-                update = shadowUpdateRotate16;
-                break;
+                FatalError("Atari interleaved bitplanes with bpp %u are not yet supported\n",
+                           priv->var.bits_per_pixel);
             }
+        } else {
+            FatalError("Interleaved bitplanes with interleave %u are not yet supported\n",
+                       priv->fix.type_aux);
         }
-        else
-            update = shadowUpdateRotatePacked;
-    else
-        update = shadowUpdatePacked;
+        break;
+
+    case FB_TYPE_TEXT:
+        FatalError("Text frame buffers are not yet supported\n");
+        break;
+
+    case FB_TYPE_VGA_PLANES:
+        FatalError("VGA planes are not yet supported\n");
+        break;
+
+    default:
+        FatalError("Unsupported frame buffer type %u\n", priv->fix.type);
+        break;
+    }
+
     return KdShadowSet(pScreen, scrpriv->randr, update, window);
 }
 
@@ -465,15 +546,19 @@ fbdevRandRSetConfig(ScreenPtr pScreen,
     int oldheight;
     int oldmmwidth;
     int oldmmheight;
-    int newwidth, newheight;
+    int newwidth, newheight, newmmwidth, newmmheight;
 
     if (screen->randr & (RR_Rotate_0 | RR_Rotate_180)) {
         newwidth = pSize->width;
         newheight = pSize->height;
+        newmmwidth = pSize->mmWidth;
+        newmmheight = pSize->mmHeight;
     }
     else {
         newwidth = pSize->height;
         newheight = pSize->width;
+        newmmwidth = pSize->mmHeight;
+        newmmheight = pSize->mmWidth;
     }
 
     if (wasEnabled)
@@ -491,6 +576,10 @@ fbdevRandRSetConfig(ScreenPtr pScreen,
      */
 
     scrpriv->randr = KdAddRotation(screen->randr, randr);
+    pScreen->width = newwidth;
+    pScreen->height = newheight;
+    pScreen->mmWidth = newmmwidth;
+    pScreen->mmHeight = newmmheight;
 
     fbdevUnmapFramebuffer(screen);
 
@@ -565,6 +654,26 @@ fbdevCreateColormap(ColormapPtr pmap)
     xColorItem *pdefs;
 
     switch (priv->fix.visual) {
+    case FB_VISUAL_MONO01:
+        pScreen->whitePixel = 0;
+        pScreen->blackPixel = 1;
+        pmap->red[0].co.local.red = 65535;
+        pmap->red[0].co.local.green = 65535;
+        pmap->red[0].co.local.blue = 65535;
+        pmap->red[1].co.local.red = 0;
+        pmap->red[1].co.local.green = 0;
+        pmap->red[1].co.local.blue = 0;
+        return TRUE;
+    case FB_VISUAL_MONO10:
+        pScreen->blackPixel = 0;
+        pScreen->whitePixel = 1;
+        pmap->red[0].co.local.red = 0;
+        pmap->red[0].co.local.green = 0;
+        pmap->red[0].co.local.blue = 0;
+        pmap->red[1].co.local.red = 65535;
+        pmap->red[1].co.local.green = 65535;
+        pmap->red[1].co.local.blue = 65535;
+        return TRUE;
     case FB_VISUAL_STATIC_PSEUDOCOLOR:
         pVisual = pmap->pVisual;
         nent = pVisual->ColormapEntries;
index 0706f4e..f3f7aec 100644 (file)
@@ -49,7 +49,7 @@ typedef struct _fbdevScrPriv {
 } FbdevScrPriv;
 
 extern KdCardFuncs fbdevFuncs;
-extern char *fbdevDevicePath;
+extern const char *fbdevDevicePath;
 
 Bool
  fbdevCardInit(KdCardInfo * card);
index 93e5d2f..1362cd9 100644 (file)
@@ -1,4 +1,4 @@
-INCLUDES =                                     \
+AM_CPPFLAGS =                                  \
        @KDRIVE_INCS@                           \
        @KDRIVE_CFLAGS@
 
index 9982fad..63e8409 100644 (file)
@@ -186,7 +186,7 @@ EvdevPtrRead(int evdevPort, void *closure)
     }
 }
 
-char *kdefaultEvdev[] = {
+const char *kdefaultEvdev[] = {
     "/dev/input/event0",
     "/dev/input/event1",
     "/dev/input/event2",
index 498c239..73a8169 100644 (file)
@@ -63,18 +63,21 @@ LinuxVTRequest(int sig)
 
 /* Check before chowning -- this avoids touching the file system */
 static void
-LinuxCheckChown(char *file)
+LinuxCheckChown(const char *file)
 {
     struct stat st;
     __uid_t u;
     __gid_t g;
+    int r;
 
     if (stat(file, &st) < 0)
         return;
     u = getuid();
     g = getgid();
-    if (st.st_uid != u || st.st_gid != g)
-        chown(file, u, g);
+    if (st.st_uid != u || st.st_gid != g) {
+        r = chown(file, u, g);
+        (void) r;
+    }
 }
 
 static int
@@ -167,14 +170,14 @@ LinuxSetSwitchMode(int mode)
 }
 
 static void
-LinuxApmBlock(pointer blockData, OSTimePtr pTimeout, pointer pReadmask)
+LinuxApmBlock(void *blockData, OSTimePtr pTimeout, void *pReadmask)
 {
 }
 
 static Bool LinuxApmRunning;
 
 static void
-LinuxApmWakeup(pointer blockData, int result, pointer pReadmask)
+LinuxApmWakeup(void *blockData, int result, void *pReadmask)
 {
     fd_set *readmask = (fd_set *) pReadmask;
 
index c875077..2bfe7f2 100644 (file)
@@ -193,7 +193,7 @@ MouseWriteBytes(int fd, unsigned char *c, int n, int timeout)
 #define MAX_VALID   4           /* number of valid packets before accepting */
 
 typedef struct _kmouseProt {
-    char *name;
+    const char *name;
     Bool (*Complete) (KdPointerInfo * pi, unsigned char *ev, int ne);
     int (*Valid) (KdPointerInfo * pi, unsigned char *ev, int ne);
     Bool (*Parse) (KdPointerInfo * pi, unsigned char *ev, int ne);
@@ -441,10 +441,8 @@ ps2SkipInit(KdPointerInfo * pi, int ninit, Bool ret_next)
 {
     Kmouse *km = pi->driverPrivate;
     int c = -1;
-    int skipping;
     Bool waiting;
 
-    skipping = 0;
     waiting = FALSE;
     while (ninit || ret_next) {
         c = MouseReadByte(&km->iob, MOUSE_TIMEOUT);
@@ -469,8 +467,6 @@ static Bool
 ps2Init(KdPointerInfo * pi)
 {
     Kmouse *km = pi->driverPrivate;
-    int skipping;
-    Bool waiting;
     int id;
     unsigned char *init;
     int ninit;
@@ -483,8 +479,6 @@ ps2Init(KdPointerInfo * pi)
      */
     if (!MouseWriteByte(km->iob.fd, PSMC_SEND_DEV_ID, 100))
         return FALSE;
-    skipping = 0;
-    waiting = FALSE;
     id = ps2SkipInit(pi, 0, TRUE);
     switch (id) {
     case 3:
@@ -744,7 +738,7 @@ MouseInitProtocol(Kmouse * km)
 }
 
 static void
-MouseFirstProtocol(Kmouse * km, char *prot)
+MouseFirstProtocol(Kmouse * km, const char *prot)
 {
     if (prot) {
         for (km->i_prot = 0; km->i_prot < NUM_PROT; km->i_prot++)
@@ -893,7 +887,7 @@ MouseRead(int mousePort, void *closure)
 
 int MouseInputType;
 
-char *kdefaultMouse[] = {
+const char *kdefaultMouse[] = {
     "/dev/input/mice",
     "/dev/mouse",
     "/dev/psaux",
index d1522a2..e5417a5 100644 (file)
@@ -58,7 +58,7 @@ Ps2ReadBytes(int fd, char *buf, int len, int min)
     return tot;
 }
 
-char *Ps2Names[] = {
+const char *Ps2Names[] = {
     "/dev/psaux",
 /*    "/dev/mouse", */
     "/dev/input/mice",
index 51375b9..d69f0dd 100644 (file)
@@ -1,10 +1,10 @@
-INCLUDES =                                     \
+AM_CPPFLAGS =                                  \
        @KDRIVE_INCS@                           \
        @KDRIVE_CFLAGS@
 
 AM_CFLAGS =    -DHAVE_DIX_CONFIG_H
 
-noinst_LTLIBRARIES = libkdrive.la libkdrivestubs.la
+noinst_LTLIBRARIES = libkdrive.la
 
 if XV
 KDRIVE_XV_SOURCES =    \
@@ -23,6 +23,3 @@ libkdrive_la_SOURCES =        \
        kshadow.c       \
        $(KDRIVE_XV_SOURCES) \
         $(top_srcdir)/mi/miinitext.c
-
-libkdrivestubs_la_SOURCES = \
-        $(top_srcdir)/fb/fbcmap_mi.c
index c93c2f4..0970064 100644 (file)
@@ -138,7 +138,7 @@ KdInstallColormap(ColormapPtr pCmap)
     /* Tell X clients that the installed colormap is going away. */
     if (pScreenPriv->pInstalledmap)
         WalkTree(pScreenPriv->pInstalledmap->pScreen, TellLostMap,
-                 (pointer) &(pScreenPriv->pInstalledmap->mid));
+                 (void *) &(pScreenPriv->pInstalledmap->mid));
 
     /* Take note of the new installed colorscreen-> */
     pScreenPriv->pInstalledmap = pCmap;
@@ -146,7 +146,7 @@ KdInstallColormap(ColormapPtr pCmap)
     KdSetColormap(pCmap->pScreen);
 
     /* Tell X clients of the new colormap */
-    WalkTree(pCmap->pScreen, TellGainedMap, (pointer) &(pCmap->mid));
+    WalkTree(pCmap->pScreen, TellGainedMap, (void *) &(pCmap->mid));
 }
 
 /*
@@ -173,13 +173,13 @@ KdUninstallColormap(ColormapPtr pCmap)
         return;
 
     /* install default */
-    dixLookupResourceByType((pointer *) &defMap, defMapID, RT_COLORMAP,
+    dixLookupResourceByType((void **) &defMap, defMapID, RT_COLORMAP,
                             serverClient, DixInstallAccess);
     if (defMap)
         (*pCmap->pScreen->InstallColormap) (defMap);
     else {
         /* uninstall and clear colormap pointer */
-        WalkTree(pCmap->pScreen, TellLostMap, (pointer) &(pCmap->mid));
+        WalkTree(pCmap->pScreen, TellLostMap, (void *) &(pCmap->mid));
         pScreenPriv->pInstalledmap = 0;
     }
 }
index 7d9bf9d..9814fc6 100644 (file)
@@ -118,10 +118,17 @@ KdDoSwitchCmd(const char *reason)
 {
     if (kdSwitchCmd) {
         char *command;
+        int ret;
 
         if (asprintf(&command, "%s %s", kdSwitchCmd, reason) == -1)
             return;
-        system(command);
+
+        /* Ignore the return value from system; I'm not sure
+         * there's anything more useful to be done when
+         * it fails
+         */
+        ret = system(command);
+        (void) ret;
         free(command);
     }
 }
@@ -246,8 +253,8 @@ ddxGiveUp(enum ExitCode error)
 Bool kdDumbDriver;
 Bool kdSoftCursor;
 
-char *
-KdParseFindNext(char *cur, const char *delim, char *save, char *last)
+const char *
+KdParseFindNext(const char *cur, const char *delim, char *save, char *last)
 {
     while (*cur && !strchr(delim, *cur)) {
         *save++ = *cur++;
@@ -282,7 +289,7 @@ KdSubRotation(Rotation a, Rotation b)
 }
 
 void
-KdParseScreen(KdScreenInfo * screen, char *arg)
+KdParseScreen(KdScreenInfo * screen, const char *arg)
 {
     char delim;
     char save[1024];
@@ -328,7 +335,8 @@ KdParseScreen(KdScreenInfo * screen, char *arg)
             screen->height = pixels;
             screen->height_mm = mm;
         }
-        if (delim != 'x' && delim != '@' && delim != 'X' && delim != 'Y')
+        if (delim != 'x' && delim != '@' && delim != 'X' && delim != 'Y' &&
+            (delim != '\0' || i == 0))
             return;
     }
 
@@ -664,7 +672,7 @@ KdCloseScreen(ScreenPtr pScreen)
 
     pScreenPriv->screen->pScreen = 0;
 
-    free((pointer) pScreenPriv);
+    free((void *) pScreenPriv);
     return ret;
 }
 
@@ -943,7 +951,8 @@ KdInitScreen(ScreenInfo * pScreenInfo,
 {
     KdCardInfo *card = screen->card;
 
-    (*card->cfuncs->scrinit) (screen);
+    if (!(*card->cfuncs->scrinit) (screen))
+        FatalError("Screen initialization failed!\n");
 
     if (!card->cfuncs->initAccel)
         screen->dumb = TRUE;
index b37041f..bec75cb 100644 (file)
@@ -32,7 +32,6 @@
 #include "pixmapstr.h"
 #include "windowstr.h"
 #include "servermd.h"
-#include "mibstore.h"
 #include "colormapst.h"
 #include "gcstruct.h"
 #include "input.h"
@@ -175,7 +174,7 @@ typedef enum _kdPointerState {
 typedef struct _KdPointerInfo KdPointerInfo;
 
 typedef struct _KdPointerDriver {
-    char *name;
+    const char *name;
      Status(*Init) (KdPointerInfo *);
      Status(*Enable) (KdPointerInfo *);
     void (*Disable) (KdPointerInfo *);
@@ -244,7 +243,7 @@ typedef struct {
 typedef struct _KdKeyboardInfo KdKeyboardInfo;
 
 typedef struct _KdKeyboardDriver {
-    char *name;
+    const char *name;
     Bool (*Init) (KdKeyboardInfo *);
     Bool (*Enable) (KdKeyboardInfo *);
     void (*Leds) (KdKeyboardInfo *, int);
@@ -412,13 +411,14 @@ Rotation KdAddRotation(Rotation a, Rotation b);
 Rotation KdSubRotation(Rotation a, Rotation b);
 
 void
- KdParseScreen(KdScreenInfo * screen, char *arg);
+ KdParseScreen(KdScreenInfo * screen, const char *arg);
 
-KdPointerInfo *KdParsePointer(char *arg);
+KdPointerInfo *KdParsePointer(const char *arg);
 
-KdKeyboardInfo *KdParseKeyboard(char *arg);
+KdKeyboardInfo *KdParseKeyboard(const char *arg);
 
-char *KdParseFindNext(char *cur, const char *delim, char *save, char *last);
+const char *
+KdParseFindNext(const char *cur, const char *delim, char *save, char *last);
 
 void
  KdParseRgba(char *rgba);
@@ -506,6 +506,7 @@ KdEnqueueKeyboardEvent(KdKeyboardInfo * ki, unsigned char scan_code,
 #define KD_BUTTON_4    0x08
 #define KD_BUTTON_5    0x10
 #define KD_BUTTON_8    0x80
+#define KD_POINTER_DESKTOP 0x40000000
 #define KD_MOUSE_DELTA 0x80000000
 
 void
@@ -525,11 +526,11 @@ void
  KdSetLed(KdKeyboardInfo * ki, int led, Bool on);
 
 void
- KdSetPointerMatrix(KdPointerMatrix * pointer);
+ KdSetPointerMatrix(KdPointerMatrix *pointer);
 
 void
 
-KdComputePointerMatrix(KdPointerMatrix * pointer, Rotation randr, int width,
+KdComputePointerMatrix(KdPointerMatrix *pointer, Rotation randr, int width,
                        int height);
 
 void
@@ -537,11 +538,11 @@ void
 
 void
 
-KdBlockHandler(ScreenPtr pScreen, pointer timeout, pointer readmask);
+KdBlockHandler(ScreenPtr pScreen, void *timeout, void *readmask);
 
 void
 
-KdWakeupHandler(ScreenPtr pScreen, unsigned long result, pointer readmask);
+KdWakeupHandler(ScreenPtr pScreen, unsigned long result, void *readmask);
 
 void
  KdDisableInput(void);
index d35dcf8..a539ca5 100644 (file)
@@ -221,7 +221,7 @@ KdUnregisterFd(void *closure, int fd, Bool do_close)
             if (do_close)
                 close(kdInputFds[i].fd);
             kdNumInputFds--;
-            for (j = i; j < kdNumInputFds; j++)
+            for (j = i; j < (kdNumInputFds - 1); j++)
                 kdInputFds[j] = kdInputFds[j + 1];
             break;
         }
@@ -308,21 +308,22 @@ KdEnableInput(void)
 
     kdInputEnabled = TRUE;
 
+    ev.any.time = GetTimeInMillis();
+
     for (ki = kdKeyboards; ki; ki = ki->next) {
         if (ki->driver && ki->driver->Enable)
             (*ki->driver->Enable) (ki);
+        /* reset screen saver */
+        NoticeEventTime (&ev, ki->dixdev);
     }
 
     for (pi = kdPointers; pi; pi = pi->next) {
         if (pi->driver && pi->driver->Enable)
             (*pi->driver->Enable) (pi);
+        /* reset screen saver */
+        NoticeEventTime (&ev, pi->dixdev);
     }
 
-    /* reset screen saver */
-    ev.any.time = GetTimeInMillis();
-    NoticeEventTime(&ev, pi->dixdev);
-    NoticeEventTime(&ev, ki->dixdev);
-
     OsReleaseSIGIO();
 }
 
@@ -532,7 +533,7 @@ LegalModifier(unsigned int key, DeviceIntPtr pDev)
 }
 
 static void
-KdBell(int volume, DeviceIntPtr pDev, pointer arg, int something)
+KdBell(int volume, DeviceIntPtr pDev, void *arg, int something)
 {
     KeybdCtrl *ctrl = arg;
     KdKeyboardInfo *ki = NULL;
@@ -1034,7 +1035,7 @@ KdGetOptions(InputOption **options, char *string)
 
     if (strchr(string, '=')) {
         tam_key = (strchr(string, '=') - string);
-        key = strndup(string, tam_key + 1);
+        key = strndup(string, tam_key);
         if (!key)
             goto out;
 
@@ -1086,7 +1087,7 @@ KdParseKbdOptions(KdKeyboardInfo * ki)
 }
 
 KdKeyboardInfo *
-KdParseKeyboard(char *arg)
+KdParseKeyboard(const char *arg)
 {
     char save[1024];
     char delim;
@@ -1178,7 +1179,7 @@ KdParsePointerOptions(KdPointerInfo * pi)
 }
 
 KdPointerInfo *
-KdParsePointer(char *arg)
+KdParsePointer(const char *arg)
 {
     char save[1024];
     char delim;
@@ -1675,13 +1676,6 @@ char *kdActionNames[] = {
 };
 #endif                          /* DEBUG */
 
-static void
-KdQueueEvent(DeviceIntPtr pDev, InternalEvent *ev)
-{
-    KdAssertSigioBlocked("KdQueueEvent");
-    mieqEnqueue(pDev, ev);
-}
-
 /* We return true if we're stealing the event. */
 static Bool
 KdRunMouseMachine(KdPointerInfo * pi, KdInputClass c, int type, int x, int y,
@@ -1821,16 +1815,11 @@ KdEnqueueKeyboardEvent(KdKeyboardInfo * ki,
                        unsigned char scan_code, unsigned char is_up)
 {
     unsigned char key_code;
-    KeyClassPtr keyc = NULL;
-    KeybdCtrl *ctrl = NULL;
     int type;
 
     if (!ki || !ki->dixdev || !ki->dixdev->kbdfeed || !ki->dixdev->key)
         return;
 
-    keyc = ki->dixdev->key;
-    ctrl = &ki->dixdev->kbdfeed->ctrl;
-
     if (scan_code >= ki->minScanCode && scan_code <= ki->maxScanCode) {
         key_code = scan_code + KD_MIN_KEYCODE - ki->minScanCode;
 
@@ -1864,7 +1853,6 @@ void
 KdEnqueuePointerEvent(KdPointerInfo * pi, unsigned long flags, int rx, int ry,
                       int rz)
 {
-    CARD32 ms;
     unsigned char buttons;
     int x, y, z;
     int (*matrix)[3] = kdPointerMatrix.matrix;
@@ -1875,8 +1863,6 @@ KdEnqueuePointerEvent(KdPointerInfo * pi, unsigned long flags, int rx, int ry,
     if (!pi)
         return;
 
-    ms = GetTimeInMillis();
-
     /* we don't need to transform z, so we don't. */
     if (flags & KD_MOUSE_DELTA) {
         if (pi->transformCoordinates) {
@@ -1909,6 +1895,8 @@ KdEnqueuePointerEvent(KdPointerInfo * pi, unsigned long flags, int rx, int ry,
     }
     else {
         dixflags = POINTER_ABSOLUTE;
+        if (flags & KD_POINTER_DESKTOP)
+            dixflags |= POINTER_DESKTOP;
         if (x != pi->dixdev->last.valuators[0] ||
             y != pi->dixdev->last.valuators[1])
             _KdEnqueuePointerEvent(pi, MotionNotify, x, y, z, 0, dixflags,
@@ -1952,7 +1940,7 @@ _KdEnqueuePointerEvent(KdPointerInfo * pi, int type, int x, int y, int z,
 }
 
 void
-KdBlockHandler(ScreenPtr pScreen, pointer timeout, pointer readmask)
+KdBlockHandler(ScreenPtr pScreen, void *timeo, void *readmask)
 {
     KdPointerInfo *pi;
     int myTimeout = 0;
@@ -1974,11 +1962,11 @@ KdBlockHandler(ScreenPtr pScreen, pointer timeout, pointer readmask)
         myTimeout = 20;
     }
     if (myTimeout > 0)
-        AdjustWaitForDelay(timeout, myTimeout);
+        AdjustWaitForDelay(timeo, myTimeout);
 }
 
 void
-KdWakeupHandler(ScreenPtr pScreen, unsigned long lresult, pointer readmask)
+KdWakeupHandler(ScreenPtr pScreen, unsigned long lresult, void *readmask)
 {
     int result = (int) lresult;
     fd_set *pReadmask = (fd_set *) readmask;
@@ -2042,25 +2030,25 @@ KdCursorOffScreen(ScreenPtr *ppScreen, int *x, int *y)
         dx = KdScreenOrigin(pNewScreen)->x - KdScreenOrigin(pScreen)->x;
         dy = KdScreenOrigin(pNewScreen)->y - KdScreenOrigin(pScreen)->y;
         if (*x < 0) {
-            if (dx <= 0 && -dx < best_x) {
+            if (dx < 0 && -dx < best_x) {
                 best_x = -dx;
                 n_best_x = n;
             }
         }
         else if (*x >= pScreen->width) {
-            if (dx >= 0 && dx < best_x) {
+            if (dx > 0 && dx < best_x) {
                 best_x = dx;
                 n_best_x = n;
             }
         }
         if (*y < 0) {
-            if (dy <= 0 && -dy < best_y) {
+            if (dy < 0 && -dy < best_y) {
                 best_y = -dy;
                 n_best_y = n;
             }
         }
         else if (*y >= pScreen->height) {
-            if (dy >= 0 && dy < best_y) {
+            if (dy > 0 && dy < best_y) {
                 best_y = dy;
                 n_best_y = n;
             }
index cf65636..9cc0edd 100644 (file)
@@ -208,7 +208,7 @@ KdXVScreenInit(ScreenPtr pScreen, KdVideoAdaptorPtr * adaptors, int num)
        sure that I appreciate that.  */
 
     ScreenPriv = malloc(sizeof(KdXVScreenRec));
-    pxvs->devPriv.ptr = (pointer) ScreenPriv;
+    pxvs->devPriv.ptr = (void *) ScreenPriv;
 
     if (!ScreenPriv)
         return FALSE;
@@ -385,28 +385,7 @@ KdXVInitAdaptors(ScreenPtr pScreen, KdVideoAdaptorPtr * infoPtr, int number)
 
             for (i = 0, pi = pImage, imagePtr = adaptorPtr->pImages;
                  i < adaptorPtr->nImages; i++, pi++, imagePtr++) {
-                pi->id = imagePtr->id;
-                pi->type = imagePtr->type;
-                pi->byte_order = imagePtr->byte_order;
-                memcpy(pi->guid, imagePtr->guid, 16);
-                pi->bits_per_pixel = imagePtr->bits_per_pixel;
-                pi->format = imagePtr->format;
-                pi->num_planes = imagePtr->num_planes;
-                pi->depth = imagePtr->depth;
-                pi->red_mask = imagePtr->red_mask;
-                pi->green_mask = imagePtr->green_mask;
-                pi->blue_mask = imagePtr->blue_mask;
-                pi->y_sample_bits = imagePtr->y_sample_bits;
-                pi->u_sample_bits = imagePtr->u_sample_bits;
-                pi->v_sample_bits = imagePtr->v_sample_bits;
-                pi->horz_y_period = imagePtr->horz_y_period;
-                pi->horz_u_period = imagePtr->horz_u_period;
-                pi->horz_v_period = imagePtr->horz_v_period;
-                pi->vert_y_period = imagePtr->vert_y_period;
-                pi->vert_u_period = imagePtr->vert_u_period;
-                pi->vert_v_period = imagePtr->vert_v_period;
-                memcpy(pi->component_order, imagePtr->component_order, 32);
-                pi->scanline_order = imagePtr->scanline_order;
+                memcpy(pi, imagePtr, sizeof(*pi));
             }
             pa->nImages = adaptorPtr->nImages;
             pa->pImages = pImage;
@@ -417,9 +396,7 @@ KdXVInitAdaptors(ScreenPtr pScreen, KdVideoAdaptorPtr * infoPtr, int number)
              calloc(adaptorPtr->nAttributes, sizeof(XvAttributeRec)))) {
             for (pat = pAttribute, attributePtr = adaptorPtr->pAttributes, i =
                  0; i < adaptorPtr->nAttributes; pat++, i++, attributePtr++) {
-                pat->flags = attributePtr->flags;
-                pat->min_value = attributePtr->min_value;
-                pat->max_value = attributePtr->max_value;
+                memcpy(pat, attributePtr, sizeof(*pat));
                 pat->name = strdup(attributePtr->name);
             }
             pa->nAttributes = adaptorPtr->nAttributes;
@@ -487,7 +464,7 @@ KdXVInitAdaptors(ScreenPtr pScreen, KdVideoAdaptorPtr * infoPtr, int number)
         adaptorPriv->PutImage = adaptorPtr->PutImage;
         adaptorPriv->ReputImage = adaptorPtr->ReputImage;
 
-        pa->devPriv.ptr = (pointer) adaptorPriv;
+        pa->devPriv.ptr = (void *) adaptorPriv;
 
         if (!(pPort = calloc(adaptorPtr->nPorts, sizeof(XvPortRec)))) {
             KdXVFreeAdaptor(pa);
@@ -874,7 +851,7 @@ KdXVReputImage(XvPortRecPrivatePtr portPriv)
 }
 
 static int
-KdXVReputAllVideo(WindowPtr pWin, pointer data)
+KdXVReputAllVideo(WindowPtr pWin, void *data)
 {
     KdXVWindowPtr WinPriv;
 
@@ -1174,7 +1151,6 @@ void
 KdXVDisable(ScreenPtr pScreen)
 {
     XvScreenPtr pxvs;
-    KdXVScreenPtr ScreenPriv;
     XvAdaptorPtr pAdaptor;
     XvPortPtr pPort;
     XvPortRecPrivatePtr pPriv;
@@ -1184,7 +1160,6 @@ KdXVDisable(ScreenPtr pScreen)
         return;
 
     pxvs = GET_XV_SCREEN(pScreen);
-    ScreenPriv = GET_KDXV_SCREEN(pScreen);
 
     for (i = 0; i < pxvs->nAdaptors; i++) {
         pAdaptor = &pxvs->pAdaptors[i];
@@ -1823,14 +1798,14 @@ KdXVCopyPlanarData(KdScreenInfo * screen, CARD8 *src, CARD8 *dst, int randr,
 
     w >>= 1;
     for (j = 0; j < h; j++) {
-        CARD32 *dst = (CARD32 *) dst1;
+        CARD32 *dst32 = (CARD32 *) dst1;
         CARD8 *s1l = src1;
         CARD8 *s1r = src1 + srcNext;
         CARD8 *s2 = src2;
         CARD8 *s3 = src3;
 
         for (i = 0; i < w; i++) {
-            *dst++ = *s1l | (*s1r << 16) | (*s3 << 8) | (*s2 << 24);
+            *dst32++ = *s1l | (*s1r << 16) | (*s3 << 8) | (*s2 << 24);
             s1l += srcRight;
             s1r += srcRight;
             s2 += srcRight2;
index 29118bc..85a030e 100644 (file)
@@ -56,34 +56,7 @@ of the copyright holder.
 #define VIDEO_OVERLAID_STILLS                  0x00000008
 #define VIDEO_CLIP_TO_VIEWPORT                 0x00000010
 
-typedef struct {
-    int id;
-    int type;
-    int byte_order;
-    unsigned char guid[16];
-    int bits_per_pixel;
-    int format;
-    int num_planes;
-
-    /* for RGB formats only */
-    int depth;
-    unsigned int red_mask;
-    unsigned int green_mask;
-    unsigned int blue_mask;
-
-    /* for YUV formats only */
-    unsigned int y_sample_bits;
-    unsigned int u_sample_bits;
-    unsigned int v_sample_bits;
-    unsigned int horz_y_period;
-    unsigned int horz_u_period;
-    unsigned int horz_v_period;
-    unsigned int vert_y_period;
-    unsigned int vert_u_period;
-    unsigned int vert_v_period;
-    char component_order[32];
-    int scanline_order;
-} KdImageRec, *KdImagePtr;
+typedef XvImageRec KdImageRec, *KdImagePtr;
 
 typedef struct {
     KdScreenInfo *screen;
@@ -98,41 +71,41 @@ typedef int (*PutVideoFuncPtr) (KdScreenInfo * screen, DrawablePtr pDraw,
                                 short vid_x, short vid_y, short drw_x,
                                 short drw_y, short vid_w, short vid_h,
                                 short drw_w, short drw_h, RegionPtr clipBoxes,
-                                pointer data);
+                                void *data);
 typedef int (*PutStillFuncPtr) (KdScreenInfo * screen, DrawablePtr pDraw,
                                 short vid_x, short vid_y, short drw_x,
                                 short drw_y, short vid_w, short vid_h,
                                 short drw_w, short drw_h, RegionPtr clipBoxes,
-                                pointer data);
+                                void *data);
 typedef int (*GetVideoFuncPtr) (KdScreenInfo * screen, DrawablePtr pDraw,
                                 short vid_x, short vid_y, short drw_x,
                                 short drw_y, short vid_w, short vid_h,
                                 short drw_w, short drw_h, RegionPtr clipBoxes,
-                                pointer data);
+                                void *data);
 typedef int (*GetStillFuncPtr) (KdScreenInfo * screen, DrawablePtr pDraw,
                                 short vid_x, short vid_y, short drw_x,
                                 short drw_y, short vid_w, short vid_h,
                                 short drw_w, short drw_h, RegionPtr clipBoxes,
-                                pointer data);
-typedef void (*StopVideoFuncPtr) (KdScreenInfo * screen, pointer data,
+                                void *data);
+typedef void (*StopVideoFuncPtr) (KdScreenInfo * screen, void *data,
                                   Bool Exit);
 typedef int (*SetPortAttributeFuncPtr) (KdScreenInfo * screen, Atom attribute,
-                                        int value, pointer data);
+                                        int value, void *data);
 typedef int (*GetPortAttributeFuncPtr) (KdScreenInfo * screen, Atom attribute,
-                                        int *value, pointer data);
+                                        int *value, void *data);
 typedef void (*QueryBestSizeFuncPtr) (KdScreenInfo * screen, Bool motion,
                                       short vid_w, short vid_h, short drw_w,
                                       short drw_h, unsigned int *p_w,
-                                      unsigned int *p_h, pointer data);
+                                      unsigned int *p_h, void *data);
 typedef int (*PutImageFuncPtr) (KdScreenInfo * screen, DrawablePtr pDraw,
                                 short src_x, short src_y, short drw_x,
                                 short drw_y, short src_w, short src_h,
                                 short drw_w, short drw_h, int image,
                                 unsigned char *buf, short width, short height,
-                                Bool Sync, RegionPtr clipBoxes, pointer data);
+                                Bool Sync, RegionPtr clipBoxes, void *data);
 typedef int (*ReputImageFuncPtr) (KdScreenInfo * screen, DrawablePtr pDraw,
                                   short drw_x, short drw_y, RegionPtr clipBoxes,
-                                  pointer data);
+                                  void *data);
 typedef int (*QueryImageAttributesFuncPtr) (KdScreenInfo * screen, int image,
                                             unsigned short *width,
                                             unsigned short *height,
@@ -158,12 +131,7 @@ typedef struct {
     short class;
 } KdVideoFormatRec, *KdVideoFormatPtr;
 
-typedef struct {
-    int flags;
-    int min_value;
-    int max_value;
-    char *name;
-} KdAttributeRec, *KdAttributePtr;
+typedef XvAttributeRec KdAttributeRec, *KdAttributePtr;
 
 typedef struct {
     unsigned int type;
index 9d0fd98..52cde72 100644 (file)
@@ -36,7 +36,6 @@ from The Open Group.
 #include "scrnintstr.h"
 #include "inputstr.h"
 #include <X11/Xos.h>
-#include "mibstore.h"
 #include "mipointer.h"
 #include "xkbsrv.h"
 #include <X11/keysym.h>
index 955624f..9c49264 100644 (file)
@@ -41,7 +41,6 @@ from The Open Group.
 #include "servermd.h"
 #define PSZ 8
 #include "fb.h"
-#include "mibstore.h"
 #include "colormapst.h"
 #include "gcstruct.h"
 #include "input.h"
@@ -66,6 +65,7 @@ from The Open Group.
 #endif                          /* HAS_SHM */
 #include "dix.h"
 #include "miline.h"
+#include "glx_extinit.h"
 
 #define VFB_DEFAULT_WIDTH      1280
 #define VFB_DEFAULT_HEIGHT     1024
@@ -404,7 +404,6 @@ vfbInstallColormap(ColormapPtr pmap)
     if (pmap != oldpmap) {
         int entries;
         XWDFileHeader *pXWDHeader;
-        XWDColor *pXWDCmap;
         VisualPtr pVisual;
         Pixel *ppix;
         xrgb *prgb;
@@ -419,7 +418,6 @@ vfbInstallColormap(ColormapPtr pmap)
 
         entries = pmap->pVisual->ColormapEntries;
         pXWDHeader = vfbScreens[pmap->pScreen->myNum].pXWDHeader;
-        pXWDCmap = vfbScreens[pmap->pScreen->myNum].pXWDCmap;
         pVisual = pmap->pVisual;
 
         swapcopy32(pXWDHeader->visual_class, pVisual->class);
@@ -460,7 +458,7 @@ vfbUninstallColormap(ColormapPtr pmap)
 
     if (pmap == curpmap) {
         if (pmap->mid != pmap->pScreen->defColormap) {
-            dixLookupResourceByType((pointer *) &curpmap,
+            dixLookupResourceByType((void **) &curpmap,
                                     pmap->pScreen->defColormap,
                                     RT_COLORMAP, serverClient,
                                     DixInstallAccess);
@@ -508,7 +506,7 @@ vfbSaveScreen(ScreenPtr pScreen, int on)
 
 /* this flushes any changes to the screens out to the mmapped file */
 static void
-vfbBlockHandler(pointer blockData, OSTimePtr pTimeout, pointer pReadmask)
+vfbBlockHandler(void *blockData, OSTimePtr pTimeout, void *pReadmask)
 {
     int i;
 
@@ -529,7 +527,7 @@ vfbBlockHandler(pointer blockData, OSTimePtr pTimeout, pointer pReadmask)
 }
 
 static void
-vfbWakeupHandler(pointer blockData, int result, pointer pReadmask)
+vfbWakeupHandler(void *blockData, int result, void *pReadmask)
 {
 }
 
@@ -885,12 +883,27 @@ vfbScreenInit(ScreenPtr pScreen, int argc, char **argv)
 
 }                               /* end vfbScreenInit */
 
+static const ExtensionModule vfbExtensions[] = {
+#ifdef GLXEXT
+    { GlxExtensionInit, "GLX", &noGlxExtension },
+#endif
+};
+
+static
+void vfbExtensionInit(void)
+{
+    LoadExtensionList(vfbExtensions, ARRAY_SIZE(vfbExtensions), TRUE);
+}
+
 void
-InitOutput(ScreenInfo * screenInfo, int argc, char **argv)
+InitOutput(ScreenInfo * screen_info, int argc, char **argv)
 {
     int i;
     int NumFormats = 0;
 
+    if (serverGeneration == 1)
+        vfbExtensionInit();
+
     /* initialize pixmap formats */
 
     /* must have a pixmap depth to match every screen depth */
@@ -919,18 +932,18 @@ InitOutput(ScreenInfo * screenInfo, int argc, char **argv)
         if (vfbPixmapDepths[i]) {
             if (NumFormats >= MAXFORMATS)
                 FatalError("MAXFORMATS is too small for this server\n");
-            screenInfo->formats[NumFormats].depth = i;
-            screenInfo->formats[NumFormats].bitsPerPixel = vfbBitsPerPixel(i);
-            screenInfo->formats[NumFormats].scanlinePad = BITMAP_SCANLINE_PAD;
+            screen_info->formats[NumFormats].depth = i;
+            screen_info->formats[NumFormats].bitsPerPixel = vfbBitsPerPixel(i);
+            screen_info->formats[NumFormats].scanlinePad = BITMAP_SCANLINE_PAD;
             NumFormats++;
         }
     }
 
-    screenInfo->imageByteOrder = IMAGE_BYTE_ORDER;
-    screenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT;
-    screenInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD;
-    screenInfo->bitmapBitOrder = BITMAP_BIT_ORDER;
-    screenInfo->numPixmapFormats = NumFormats;
+    screen_info->imageByteOrder = IMAGE_BYTE_ORDER;
+    screen_info->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT;
+    screen_info->bitmapScanlinePad = BITMAP_SCANLINE_PAD;
+    screen_info->bitmapBitOrder = BITMAP_BIT_ORDER;
+    screen_info->numPixmapFormats = NumFormats;
 
     /* initialize screens */
 
index 9f4992c..f0f9fee 100644 (file)
@@ -1,7 +1,6 @@
 SUBDIRS = man
 
 bin_PROGRAMS = Xvfb
-noinst_LIBRARIES = libfbcmap.a
 
 AM_CFLAGS = -DHAVE_DIX_CONFIG_H \
             $(XVFBMODULES_CFLAGS) \
@@ -9,20 +8,16 @@ AM_CFLAGS = -DHAVE_DIX_CONFIG_H \
 
 SRCS = InitInput.c \
        InitOutput.c \
-       $(top_srcdir)/Xext/dpmsstubs.c \
-       $(top_srcdir)/Xi/stubs.c \
        $(top_srcdir)/mi/miinitext.c
 
-libfbcmap_a_CFLAGS = $(AM_CFLAGS)
-libfbcmap_a_SOURCES = $(top_srcdir)/fb/fbcmap_mi.c
-
 Xvfb_SOURCES = $(SRCS)
 
 XVFB_LIBS = \
         @XVFB_LIBS@ \
-       libfbcmap.a \
        $(MAIN_LIB) \
-       $(XSERVER_LIBS)
+       $(XSERVER_LIBS) \
+       $(top_builddir)/Xext/libXextdpmsstubs.la \
+       $(top_builddir)/Xi/libXistubs.la
 
 Xvfb_LDADD = $(XVFB_LIBS) $(XVFB_SYS_LIBS) $(XSERVER_SYS_LIBS)
 Xvfb_DEPENDENCIES = $(XVFB_LIBS)
index 049e3f5..51a954d 100644 (file)
@@ -9,6 +9,15 @@ DRI2_SUBDIR = dri2
 DRI2_LIB = dri2/libdri2.la
 endif
 
+if DRI3
+DRI3_BUILDDIR = $(top_builddir)/dri3
+DRI3_LIB = $(DRI3_BUILDDIR)/libdri3.la
+endif
+
+if GLAMOR_EGL
+GLAMOR_EGL_SUBDIR = glamor_egl
+endif
+
 if XF86UTILS
 XF86UTILS_SUBDIR = utils
 endif
@@ -25,23 +34,33 @@ if INT10MODULE
 INT10_SUBDIR = int10
 endif
 
+if HWC
+HWC_LIB = $(top_builddir)/hwc/libhwc.la
+endif
+
+if HWA
+HWA_LIB = $(top_builddir)/hwa/libhwa.la
+endif
+
 SUBDIRS = common ddc x86emu $(INT10_SUBDIR) os-support parser \
          ramdac $(VGAHW_SUBDIR) loader modes $(DRI_SUBDIR) \
          $(DRI2_SUBDIR) . $(VBE_SUBDIR) i2c dixmods \
-         fbdevhw shadowfb exa $(XF86UTILS_SUBDIR) doc man
+         fbdevhw shadowfb exa $(XF86UTILS_SUBDIR) doc man \
+         $(GLAMOR_EGL_SUBDIR)
 
 DIST_SUBDIRS = common ddc i2c x86emu int10 fbdevhw os-support \
                parser ramdac shadowfb vbe vgahw \
                loader dixmods dri dri2 exa modes \
-              utils doc man
+              utils doc man glamor_egl
 
 bin_PROGRAMS = Xorg
 nodist_Xorg_SOURCES = sdksyms.c
 
-AM_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@ -fPIE
-INCLUDES = $(XORG_INCS) -I$(srcdir)/parser -I$(top_srcdir)/miext/cw \
+AM_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@ $(TTRACE_CFLAGS) -fPIE
+AM_CPPFLAGS = $(XORG_INCS) -I$(srcdir)/parser -I$(top_srcdir)/miext/cw \
        -I$(srcdir)/ddc -I$(srcdir)/i2c -I$(srcdir)/modes -I$(srcdir)/ramdac \
-       -I$(srcdir)/dri -I$(srcdir)/dri2
+       -I$(srcdir)/dri -I$(srcdir)/dri2 -I$(top_srcdir)/dri3 -I$(top_srcdir)/hwc \
+       -I$(top_srcdir)/hwa
 
 LOCAL_LIBS = \
             $(MAIN_LIB) \
@@ -59,47 +78,59 @@ LOCAL_LIBS = \
             dixmods/libxorgxkb.la \
             $(DRI_LIB) \
             $(DRI2_LIB) \
-            $(top_builddir)/hwc/libhwc.la \
+               $(DRI3_LIB) \
+               $(top_builddir)/miext/sync/libsync.la \
             $(top_builddir)/mi/libmi.la \
+                       $(HWC_LIB) \
+                       $(HWA_LIB) \
             $(top_builddir)/os/libos.la
 Xorg_LDADD = \
             $(LOCAL_LIBS) \
             $(XORG_SYS_LIBS) \
-            $(XSERVER_SYS_LIBS)
+            $(XSERVER_SYS_LIBS) \
+                       $(TTRACE_LIBS)
 Xorg_DEPENDENCIES = $(LOCAL_LIBS)
 
 Xorg_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG) -pie
 
+if SUID_WRAPPER
+wrapdir = $(SUID_WRAPPER_DIR)
+wrap_PROGRAMS = Xorg.wrap
+Xorg_wrap_SOURCES = xorg-wrapper.c
+endif
+
 BUILT_SOURCES = xorg.conf.example
 DISTCLEANFILES = xorg.conf.example
 EXTRA_DIST = xorgconf.cpp
 
-if SOLARIS_ASM_INLINE
-# Needs to be built before any files are compiled when using Sun compilers
-# so in*/out* inline definitions are properly processed.
-
-BUILT_SOURCES += os-support/solaris/solaris-@SOLARIS_INOUT_ARCH@.il
-
-os-support/solaris/solaris-@SOLARIS_INOUT_ARCH@.il:
-       cd os-support/solaris ; \
-        $(MAKE) $(AM_MAKEFLAGS) solaris-@SOLARIS_INOUT_ARCH@.il
-endif
-
-# do not use $(mkdir_p) if you want automake 1.7 to work
+# Without logdir, X will post an error on the terminal and will not start
 install-data-local:
-       mkdir -p $(DESTDIR)$(logdir)
-
+       $(AM_V_GEN)$(MKDIR_P) $(DESTDIR)$(logdir)
+if CYGWIN
+       $(INSTALL_DATA) libXorg.exe.a $(DESTDIR)$(libdir)/libXorg.exe.a
+endif
 
-install-exec-local: install-binPROGRAMS
-       (cd $(DESTDIR)$(bindir) && rm -f X && ln -s Xorg X)
+install-exec-hook:
+       (cd $(DESTDIR)$(bindir) && rm -f X && $(LN_S) Xorg$(EXEEXT) X)
 if INSTALL_SETUID
        chown root $(DESTDIR)$(bindir)/Xorg
        chmod u+s $(DESTDIR)$(bindir)/Xorg
 endif
+if SUID_WRAPPER
+       $(MKDIR_P) $(DESTDIR)$(SUID_WRAPPER_DIR)
+       mv $(DESTDIR)$(bindir)/Xorg $(DESTDIR)$(SUID_WRAPPER_DIR)/Xorg.bin
+       ${INSTALL} -m 755 Xorg.sh $(DESTDIR)$(bindir)/Xorg
+       -chown root $(DESTDIR)$(SUID_WRAPPER_DIR)/Xorg.wrap && chmod u+s $(DESTDIR)$(SUID_WRAPPER_DIR)/Xorg.wrap
+endif
+
+uninstall-local:
 if CYGWIN
-       $(INSTALL_DATA) libXorg.exe.a $(DESTDIR)$(libdir)/libXorg.exe.a
+       $(AM_V_at)rm -f $(DESTDIR)$(libdir)/libXorg.exe.a
 endif
 
+uninstall-hook:
+       $(AM_V_at)rm -f $(DESTDIR)$(bindir)/X
+
 # Use variables from XORG_MANPAGE_SECTIONS and X Server configuration
 # Do not include manpages.am as values are not appropriate for rc files
 CONF_SUBSTS =  -e 's|__filemansuffix__|$(FILE_MAN_SUFFIX)|g' \
@@ -112,14 +143,14 @@ xorg.conf.example: xorgconf.cpp
 relink:
        $(AM_V_at)rm -f Xorg$(EXEEXT) && $(MAKE) Xorg$(EXEEXT)
 
-CLEANFILES = sdksyms.c sdksyms.dep
+CLEANFILES = sdksyms.c sdksyms.dep Xorg.sh
 EXTRA_DIST += sdksyms.sh
 
 sdksyms.dep sdksyms.c: sdksyms.sh
-       $(AM_V_GEN)CPP='$(CPP)' AWK='$(AWK)' $(SHELL) $(srcdir)/sdksyms.sh $(top_srcdir) $(CFLAGS) $(AM_CFLAGS) $(INCLUDES)
+       $(AM_V_GEN)CPP='$(CPP)' AWK='$(AWK)' $(SHELL) $(srcdir)/sdksyms.sh $(top_srcdir) $(CFLAGS) $(AM_CFLAGS) $(AM_CPPFLAGS)
 
 SDKSYMS_DEP = sdksyms.dep
-include $(SDKSYMS_DEP)
+-include $(SDKSYMS_DEP)
 
 i2c/libi2c.la:
        $(AM_V_at)cd i2c && $(MAKE) libi2c.la
diff --git a/hw/xfree86/Xorg.sh.in b/hw/xfree86/Xorg.sh.in
new file mode 100644 (file)
index 0000000..cef4859
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/sh
+#
+# Execute Xorg.wrap if it exists otherwise execute Xorg.bin directly.
+# This allows distros to put the suid wrapper in a separate package.
+
+basedir=@SUID_WRAPPER_DIR@
+if [ -x "$basedir"/Xorg.wrap ]; then
+       exec "$basedir"/Xorg.wrap "$@"
+else
+       exec "$basedir"/Xorg.bin "$@"
+fi
index f8fcde9..7a2b4bc 100644 (file)
@@ -15,6 +15,7 @@ XVSDKINCS = xf86xv.h xf86xvmc.h xf86xvpriv.h
 endif
 
 if XF86VIDMODE
+XF86VMODESOURCES = xf86vmode.c
 XF86VMODE_SDK = vidmodeproc.h
 endif
 
@@ -47,12 +48,12 @@ libcommon_la_SOURCES = xf86Configure.c xf86Bus.c xf86Config.c \
                       xf86VidMode.c xf86fbman.c xf86cmap.c \
                       xf86Helper.c xf86PM.c xf86Xinput.c xisb.c \
                       xf86Mode.c xorgHelper.c xf86Extensions.h \
-                     xf86Extensions.c xf86vmode.c \
+                     xf86Extensions.c $(XF86VMODESOURCES) \
                       $(XVSOURCES) $(BUSSOURCES) $(RANDRSOURCES)
 nodist_libcommon_la_SOURCES = xf86DefModeSet.c xf86Build.h
 libcommon_la_LIBADD = $(top_builddir)/config/libconfig.la
 
-INCLUDES = $(XORG_INCS) -I$(srcdir)/../ddc -I$(srcdir)/../i2c \
+AM_CPPFLAGS = $(XORG_INCS) -I$(srcdir)/../ddc -I$(srcdir)/../i2c \
           -I$(srcdir)/../loader -I$(srcdir)/../parser \
            -I$(srcdir)/../vbe -I$(srcdir)/../int10 \
           -I$(srcdir)/../vgahw -I$(srcdir)/../dixmods/extmod \
index c980bee..1bd8def 100644 (file)
 #if !defined(__sparc__) && !defined(__sparc) && !defined(__arm32__) && !defined(__nds32__) \
       && !(defined(__alpha__) && defined(linux)) \
       && !(defined(__ia64__) && defined(linux)) \
+      && !(defined(__mips64) && defined(linux)) \
 
 extern _X_EXPORT void outb(unsigned short, unsigned char);
 extern _X_EXPORT void outw(unsigned short, unsigned short);
@@ -721,7 +722,7 @@ xf86WriteMmio32LeNB(__volatile__ void *base, const unsigned long offset,
 }
 
 #elif defined(__mips__) || (defined(__arm32__) && !defined(__linux__))
-#ifdef __arm32__
+#if defined(__arm32__) || defined(__mips64)
 #define PORT_SIZE long
 #else
 #define PORT_SIZE short
@@ -1351,7 +1352,10 @@ stl_u(unsigned long val, unsigned int *p)
 #else                           /* ix86 */
 
 #if !defined(__SUNPRO_C)
-#if !defined(FAKEIT) && !defined(__mc68000__) && !defined(__arm__) && !defined(__sh__) && !defined(__hppa__) && !defined(__s390__) && !defined(__m32r__)
+#if !defined(FAKEIT) && !defined(__mc68000__) && !defined(__arm__) && \
+    !defined(__sh__) && !defined(__hppa__) && !defined(__s390__) && \
+    !defined(__m32r__) && !defined(__aarch64__) && !defined(__arc__) && \
+    !defined(__xtensa__)
 #ifdef GCCUSESGAS
 
 /*
@@ -1453,7 +1457,7 @@ inl(unsigned short port)
 
 #endif                          /* GCCUSESGAS */
 
-#else                           /* !defined(FAKEIT) && !defined(__mc68000__)  && !defined(__arm__) && !defined(__sh__) && !defined(__hppa__) && !defined(__m32r__) */
+#else                           /* !defined(FAKEIT) && !defined(__mc68000__)  && !defined(__arm__) && !defined(__sh__) && !defined(__hppa__) && !defined(__m32r__) && !defined(__arc__) */
 
 static __inline__ void
 outb(unsigned short port, unsigned char val)
index e824d30..87e923f 100644 (file)
@@ -24,7 +24,7 @@
 
 typedef struct {
     int num;                    /* A unique identifier for the mode (num > 0) */
-    char *name;                 /* name of mode given in the XF86Config */
+    const char *name;           /* name of mode given in the XF86Config */
     int VSync_num;
     int VSync_den;
     int flags;                  /* DGA_CONCURRENT_ACCESS, etc... */
index 311d35c..cff340c 100644 (file)
@@ -34,7 +34,7 @@ typedef enum {
 } VidModeSelectMonitor;
 
 typedef union {
-    pointer ptr;
+    const void *ptr;
     int i;
     float f;
 } vidMonitorValue;
@@ -42,38 +42,38 @@ typedef union {
 extern Bool VidModeExtensionInit(ScreenPtr pScreen);
 
 extern _X_EXPORT Bool VidModeAvailable(int scrnIndex);
-extern _X_EXPORT Bool VidModeGetCurrentModeline(int scrnIndex, pointer *mode,
+extern _X_EXPORT Bool VidModeGetCurrentModeline(int scrnIndex, void **mode,
                                                 int *dotClock);
-extern _X_EXPORT Bool VidModeGetFirstModeline(int scrnIndex, pointer *mode,
+extern _X_EXPORT Bool VidModeGetFirstModeline(int scrnIndex, void **mode,
                                               int *dotClock);
-extern _X_EXPORT Bool VidModeGetNextModeline(int scrnIndex, pointer *mode,
+extern _X_EXPORT Bool VidModeGetNextModeline(int scrnIndex, void **mode,
                                              int *dotClock);
-extern _X_EXPORT Bool VidModeDeleteModeline(int scrnIndex, pointer mode);
+extern _X_EXPORT Bool VidModeDeleteModeline(int scrnIndex, void *mode);
 extern _X_EXPORT Bool VidModeZoomViewport(int scrnIndex, int zoom);
 extern _X_EXPORT Bool VidModeGetViewPort(int scrnIndex, int *x, int *y);
 extern _X_EXPORT Bool VidModeSetViewPort(int scrnIndex, int x, int y);
-extern _X_EXPORT Bool VidModeSwitchMode(int scrnIndex, pointer mode);
+extern _X_EXPORT Bool VidModeSwitchMode(int scrnIndex, void *mode);
 extern _X_EXPORT Bool VidModeLockZoom(int scrnIndex, Bool lock);
-extern _X_EXPORT Bool VidModeGetMonitor(int scrnIndex, pointer *monitor);
+extern _X_EXPORT Bool VidModeGetMonitor(int scrnIndex, void **monitor);
 extern _X_EXPORT int VidModeGetNumOfClocks(int scrnIndex, Bool *progClock);
 extern _X_EXPORT Bool VidModeGetClocks(int scrnIndex, int *Clocks);
 extern _X_EXPORT ModeStatus VidModeCheckModeForMonitor(int scrnIndex,
-                                                       pointer mode);
+                                                       void *mode);
 extern _X_EXPORT ModeStatus VidModeCheckModeForDriver(int scrnIndex,
-                                                      pointer mode);
-extern _X_EXPORT void VidModeSetCrtcForMode(int scrnIndex, pointer mode);
-extern _X_EXPORT Bool VidModeAddModeline(int scrnIndex, pointer mode);
+                                                      void *mode);
+extern _X_EXPORT void VidModeSetCrtcForMode(int scrnIndex, void *mode);
+extern _X_EXPORT Bool VidModeAddModeline(int scrnIndex, void *mode);
 extern _X_EXPORT int VidModeGetDotClock(int scrnIndex, int Clock);
 extern _X_EXPORT int VidModeGetNumOfModes(int scrnIndex);
 extern _X_EXPORT Bool VidModeSetGamma(int scrnIndex, float red, float green,
                                       float blue);
 extern _X_EXPORT Bool VidModeGetGamma(int scrnIndex, float *red, float *green,
                                       float *blue);
-extern _X_EXPORT pointer VidModeCreateMode(void);
-extern _X_EXPORT void VidModeCopyMode(pointer modefrom, pointer modeto);
-extern _X_EXPORT int VidModeGetModeValue(pointer mode, int valtyp);
-extern _X_EXPORT void VidModeSetModeValue(pointer mode, int valtyp, int val);
-extern _X_EXPORT vidMonitorValue VidModeGetMonitorValue(pointer monitor,
+extern _X_EXPORT void *VidModeCreateMode(void);
+extern _X_EXPORT void VidModeCopyMode(void *modefrom, void *modeto);
+extern _X_EXPORT int VidModeGetModeValue(void *mode, int valtyp);
+extern _X_EXPORT void VidModeSetModeValue(void *mode, int valtyp, int val);
+extern _X_EXPORT vidMonitorValue VidModeGetMonitorValue(void *monitor,
                                                         int valtyp, int indx);
 extern _X_EXPORT Bool VidModeSetGammaRamp(int, int, CARD16 *, CARD16 *,
                                           CARD16 *);
index bb2903d..cec3135 100644 (file)
@@ -55,6 +55,7 @@
 extern _X_EXPORT int xf86DoConfigure;
 extern _X_EXPORT int xf86DoShowOptions;
 extern _X_EXPORT Bool xf86DoConfigurePass1;
+extern _X_EXPORT Bool xorgHWAccess;
 
 extern _X_EXPORT DevPrivateKeyRec xf86ScreenKeyRec;
 
@@ -127,7 +128,7 @@ extern _X_EXPORT ScrnInfoPtr xf86ConfigPciEntity(ScrnInfoPtr pScrn,
                                                  void *dummy, EntityProc init,
                                                  EntityProc enter,
                                                  EntityProc leave,
-                                                 pointer private);
+                                                 void *private);
 /* Obsolete! don't use */
 extern _X_EXPORT Bool xf86ConfigActivePciEntity(ScrnInfoPtr pScrn,
                                                 int entityIndex,
@@ -135,7 +136,7 @@ extern _X_EXPORT Bool xf86ConfigActivePciEntity(ScrnInfoPtr pScrn,
                                                 void *dummy, EntityProc init,
                                                 EntityProc enter,
                                                 EntityProc leave,
-                                                pointer private);
+                                                void *private);
 #else
 #define xf86VGAarbiterInit() do {} while (0)
 #define xf86VGAarbiterFini() do {} while (0)
@@ -165,7 +166,7 @@ extern _X_EXPORT void xf86RemoveEntityFromScreen(ScrnInfoPtr pScrn,
 extern _X_EXPORT EntityInfoPtr xf86GetEntityInfo(int entityIndex);
 extern _X_EXPORT Bool xf86SetEntityFuncs(int entityIndex, EntityProc init,
                                          EntityProc enter, EntityProc leave,
-                                         pointer);
+                                         void *);
 extern _X_EXPORT Bool xf86IsEntityPrimary(int entityIndex);
 extern _X_EXPORT ScrnInfoPtr xf86FindScreenForEntity(int entityIndex);
 
@@ -197,21 +198,11 @@ extern _X_EXPORT void *xf86GetPointerScreenFuncs(void);
 extern _X_EXPORT void xf86InitOrigins(void);
 extern _X_EXPORT void xf86ReconfigureLayout(void);
 
-/* xf86cvt.c */
-extern _X_EXPORT DisplayModePtr xf86CVTMode(int HDisplay, int VDisplay,
-                                            float VRefresh, Bool Reduced,
-                                            Bool Interlaced);
-
 /* xf86DPMS.c */
 
 extern _X_EXPORT Bool xf86DPMSInit(ScreenPtr pScreen, DPMSSetProcPtr set,
                                    int flags);
 
-#ifdef DPMSExtension
-extern _X_EXPORT int DPMSSet(ClientPtr client, int level);
-extern _X_EXPORT Bool DPMSSupported(void);
-#endif
-
 /* xf86DGA.c */
 
 #ifdef XFreeXDGA
@@ -224,28 +215,35 @@ extern _X_EXPORT xf86SetDGAModeProc xf86SetDGAMode;
 
 /* xf86Events.c */
 
+typedef struct _InputInfoRec *InputInfoPtr;
+
 extern _X_EXPORT void SetTimeSinceLastInputEvent(void);
-extern _X_EXPORT pointer xf86AddInputHandler(int fd, InputHandlerProc proc,
-                                             pointer data);
-extern _X_EXPORT int xf86RemoveInputHandler(pointer handler);
-extern _X_EXPORT void xf86DisableInputHandler(pointer handler);
-extern _X_EXPORT void xf86EnableInputHandler(pointer handler);
-extern _X_EXPORT pointer xf86AddGeneralHandler(int fd, InputHandlerProc proc,
-                                               pointer data);
-extern _X_EXPORT int xf86RemoveGeneralHandler(pointer handler);
-extern _X_EXPORT void xf86DisableGeneralHandler(pointer handler);
-extern _X_EXPORT void xf86EnableGeneralHandler(pointer handler);
+extern _X_EXPORT void *xf86AddInputHandler(int fd, InputHandlerProc proc,
+                                             void *data);
+extern _X_EXPORT int xf86RemoveInputHandler(void *handler);
+extern _X_EXPORT void xf86DisableInputHandler(void *handler);
+extern _X_EXPORT void xf86EnableInputHandler(void *handler);
+extern _X_EXPORT void *xf86AddGeneralHandler(int fd, InputHandlerProc proc,
+                                               void *data);
+extern _X_EXPORT int xf86RemoveGeneralHandler(void *handler);
+extern _X_EXPORT void xf86DisableGeneralHandler(void *handler);
+extern _X_EXPORT void xf86EnableGeneralHandler(void *handler);
 extern _X_EXPORT InputHandlerProc xf86SetConsoleHandler(InputHandlerProc
-                                                        handler, pointer data);
+                                                        handler, void *data);
 extern _X_EXPORT void xf86InterceptSignals(int *signo);
 extern _X_EXPORT void xf86InterceptSigIll(void (*sigillhandler) (void));
 extern _X_EXPORT Bool xf86EnableVTSwitch(Bool new);
 extern _X_EXPORT void xf86ProcessActionEvent(ActionEvent action, void *arg);
 extern _X_EXPORT void xf86PrintBacktrace(void);
+extern _X_EXPORT Bool xf86VTOwner(void);
+extern _X_EXPORT void xf86VTLeave(void);
+extern _X_EXPORT void xf86VTEnter(void);
+extern _X_EXPORT void xf86EnableInputDeviceForVTSwitch(InputInfoPtr pInfo);
+extern _X_EXPORT void xf86DisableInputDeviceForVTSwitch(InputInfoPtr pInfo);
 
 /* xf86Helper.c */
 
-extern _X_EXPORT void xf86AddDriver(DriverPtr driver, pointer module,
+extern _X_EXPORT void xf86AddDriver(DriverPtr driver, void *module,
                                     int flags);
 extern _X_EXPORT void xf86DeleteDriver(int drvIndex);
 extern _X_EXPORT ScrnInfoPtr xf86AllocateScreen(DriverPtr drv, int flags);
@@ -336,36 +334,36 @@ xf86DisableRandR(void);
 extern _X_EXPORT CARD32
 xorgGetVersion(void);
 extern _X_EXPORT CARD32
-xf86GetModuleVersion(pointer module);
-extern _X_EXPORT pointer
+xf86GetModuleVersion(void *module);
+extern _X_EXPORT void *
 xf86LoadDrvSubModule(DriverPtr drv, const char *name);
-extern _X_EXPORT pointer
+extern _X_EXPORT void *
 xf86LoadSubModule(ScrnInfoPtr pScrn, const char *name);
-extern _X_EXPORT pointer
-xf86LoadOneModule(char *name, pointer optlist);
+extern _X_EXPORT void *
+xf86LoadOneModule(const char *name, void *optlist);
 extern _X_EXPORT void
-xf86UnloadSubModule(pointer mod);
+xf86UnloadSubModule(void *mod);
 extern _X_EXPORT Bool
 xf86LoaderCheckSymbol(const char *name);
 extern _X_EXPORT void
 xf86SetBackingStore(ScreenPtr pScreen);
 extern _X_EXPORT void
 xf86SetSilkenMouse(ScreenPtr pScreen);
-extern _X_EXPORT pointer
-xf86FindXvOptions(ScrnInfoPtr pScrn, int adapt_index, char *port_name,
-                  char **adaptor_name, pointer *adaptor_options);
+extern _X_EXPORT void *
+xf86FindXvOptions(ScrnInfoPtr pScrn, int adapt_index, const char *port_name,
+                  const char **adaptor_name, void **adaptor_options);
 extern _X_EXPORT void
 xf86GetOS(const char **name, int *major, int *minor, int *teeny);
 extern _X_EXPORT ScrnInfoPtr
 xf86ConfigFbEntity(ScrnInfoPtr pScrn, int scrnFlag,
                    int entityIndex, EntityProc init,
-                   EntityProc enter, EntityProc leave, pointer private);
+                   EntityProc enter, EntityProc leave, void *private);
 
 extern _X_EXPORT Bool
 xf86IsScreenPrimary(ScrnInfoPtr pScrn);
 extern _X_EXPORT int
 xf86RegisterRootWindowProperty(int ScrnIndex, Atom property, Atom type,
-                               int format, unsigned long len, pointer value);
+                               int format, unsigned long len, void *value);
 extern _X_EXPORT Bool
 xf86IsUnblank(int mode);
 
@@ -397,7 +395,7 @@ extern _X_EXPORT ModeStatus
 xf86CheckModeForDriver(ScrnInfoPtr scrp, DisplayModePtr mode, int flags);
 extern _X_EXPORT int
 xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes,
-                  char **modeNames, ClockRangePtr clockRanges,
+                  const char **modeNames, ClockRangePtr clockRanges,
                   int *linePitches, int minPitch, int maxPitch,
                   int minHeight, int maxHeight, int pitchInc,
                   int virtualX, int virtualY, int apertureSize,
@@ -412,26 +410,6 @@ extern _X_EXPORT void
 xf86PrintModes(ScrnInfoPtr scrp);
 extern _X_EXPORT void
 xf86ShowClockRanges(ScrnInfoPtr scrp, ClockRangePtr clockRanges);
-extern _X_EXPORT double
-xf86ModeHSync(const DisplayModeRec * mode);
-extern _X_EXPORT double
-xf86ModeVRefresh(const DisplayModeRec * mode);
-extern _X_EXPORT void
-xf86SetModeDefaultName(DisplayModePtr mode);
-extern _X_EXPORT void
-xf86SetModeCrtc(DisplayModePtr p, int adjustFlags);
-extern _X_EXPORT DisplayModePtr
-xf86DuplicateMode(const DisplayModeRec * pMode);
-extern _X_EXPORT void
-xf86SaveModeContents(DisplayModePtr intern, const DisplayModeRec * pMode);
-extern _X_EXPORT DisplayModePtr
-xf86DuplicateModes(ScrnInfoPtr pScrn, DisplayModePtr modeList);
-extern _X_EXPORT Bool
-xf86ModesEqual(const DisplayModeRec * pMode1, const DisplayModeRec * pMode2);
-extern _X_EXPORT void
-xf86PrintModeline(int scrnIndex, DisplayModePtr mode);
-extern _X_EXPORT DisplayModePtr
-xf86ModesAdd(DisplayModePtr modes, DisplayModePtr new);
 
 /* xf86Option.c */
 
@@ -468,4 +446,8 @@ extern _X_EXPORT ScreenPtr xf86ScrnToScreen(ScrnInfoPtr pScrn);
 /* flags passed to xf86 allocate screen */
 #define XF86_ALLOCATE_GPU_SCREEN 1
 
+/* Update the internal total dimensions of all ScreenRecs together */
+extern _X_EXPORT void
+xf86UpdateDesktopDimensions(void);
+
 #endif                          /* _XF86_H */
index 95d58fe..f76341e 100644 (file)
@@ -265,16 +265,14 @@ listPossibleVideoDrivers(char *matches[], int nmatches)
 #endif
 #ifdef XSERVER_LIBPCIACCESS
     if (i < (nmatches - 1))
-        i = xf86PciMatchDriver(matches, nmatches);
+        i += xf86PciMatchDriver(&matches[i], nmatches - i);
 #endif
-    /* Fallback to platform default hardware */
+
+#ifdef _F_EXYNOS_DRV_LOAD_
     if (i < (nmatches - 1)) {
-#if defined(__i386__) || defined(__amd64__) || defined(__hurd__)
-        matches[i++] = xnfstrdup("vesa");
-#elif defined(__sparc__) && !defined(sun)
-        matches[i++] = xnfstrdup("sunffb");
-#endif
+        matches[i++] = xnfstrdup("exynos");
     }
+#endif
 
 #if defined(__linux__)
     matches[i++] = xnfstrdup("modesetting");
@@ -290,6 +288,15 @@ listPossibleVideoDrivers(char *matches[], int nmatches)
 #endif
     }
 #endif                          /* !sun */
+
+    /* Fallback to platform default hardware */
+    if (i < (nmatches - 1)) {
+#if defined(__i386__) || defined(__amd64__) || defined(__hurd__)
+        matches[i++] = xnfstrdup("vesa");
+#elif defined(__sparc__) && !defined(sun)
+        matches[i++] = xnfstrdup("sunffb");
+#endif
+    }
 }
 
 /* copy a screen section and enter the desired driver
@@ -299,6 +306,7 @@ copyScreen(confScreenPtr oscreen, GDevPtr odev, int i, char *driver)
 {
     confScreenPtr nscreen;
     GDevPtr cptr = NULL;
+    char *identifier;
 
     nscreen = malloc(sizeof(confScreenRec));
     if (!nscreen)
@@ -312,13 +320,14 @@ copyScreen(confScreenPtr oscreen, GDevPtr odev, int i, char *driver)
     }
     memcpy(cptr, odev, sizeof(GDevRec));
 
-    if (asprintf(&cptr->identifier, "Autoconfigured Video Device %s", driver)
+    if (asprintf(&identifier, "Autoconfigured Video Device %s", driver)
         == -1) {
         free(cptr);
         free(nscreen);
         return FALSE;
     }
     cptr->driver = driver;
+    cptr->identifier = identifier;
 
     xf86ConfigLayout.screens[i].screen = nscreen;
 
index 6de8409..b3b3f8c 100644 (file)
@@ -81,6 +81,8 @@ xf86CallDriverProbe(DriverPtr drv, Bool detect_only)
     if (drv->platformProbe != NULL) {
         foundScreen = xf86platformProbeDev(drv);
     }
+    if (ServerIsNotSeat0() && foundScreen)
+        return foundScreen;
 #endif
 
 #ifdef XSERVER_LIBPCIACCESS
@@ -115,27 +117,12 @@ xf86BusConfig(void)
     screenLayoutPtr layout;
     int i, j;
 
-    /* Enable full I/O access */
-    if (xorgHWAccess)
-        xorgHWAccess = xf86EnableIO();
-
     /*
      * Now call each of the Probe functions.  Each successful probe will
      * result in an extra entry added to the xf86Screens[] list for each
      * instance of the hardware found.
      */
     for (i = 0; i < xf86NumDrivers; i++) {
-        xorgHWFlags flags;
-
-        if (!xorgHWAccess) {
-            if (!xf86DriverList[i]->driverFunc
-                || !xf86DriverList[i]->driverFunc(NULL,
-                                                  GET_REQUIRED_HW_INTERFACES,
-                                                  &flags)
-                || NEED_IO_ENABLED(flags))
-                continue;
-        }
-
         xf86CallDriverProbe(xf86DriverList[i], FALSE);
     }
 
@@ -214,6 +201,8 @@ xf86BusProbe(void)
 {
 #ifdef XSERVER_PLATFORM_BUS
     xf86platformProbe();
+    if (ServerIsNotSeat0() && xf86_num_platform_devices > 0)
+        return;
 #endif
 #ifdef XSERVER_LIBPCIACCESS
     xf86PciProbe();
@@ -277,6 +266,11 @@ xf86IsEntityPrimary(int entityIndex)
 {
     EntityPtr pEnt = xf86Entities[entityIndex];
 
+#ifdef XSERVER_LIBPCIACCESS
+    if (primaryBus.type == BUS_PLATFORM && pEnt->bus.type == BUS_PCI)
+       return MATCH_PCI_DEVICES(pEnt->bus.id.pci, primaryBus.id.plat->pdev);
+#endif
+
     if (primaryBus.type != pEnt->bus.type)
         return FALSE;
 
@@ -294,7 +288,7 @@ xf86IsEntityPrimary(int entityIndex)
 
 Bool
 xf86SetEntityFuncs(int entityIndex, EntityProc init, EntityProc enter,
-                   EntityProc leave, pointer private)
+                   EntityProc leave, void *private)
 {
     if (entityIndex >= xf86NumEntities)
         return FALSE;
index e83ba78..c59625d 100644 (file)
@@ -51,7 +51,7 @@ typedef struct {
     EntityProc entityInit;
     EntityProc entityEnter;
     EntityProc entityLeave;
-    pointer private;
+    void *private;
     Bool active;
     Bool inUse;
     BusRec bus;
index a754148..96a6640 100644 (file)
@@ -52,6 +52,7 @@
 #endif
 
 #include "xf86.h"
+#include "xf86Modes.h"
 #include "xf86Parser.h"
 #include "xf86tokens.h"
 #include "xf86Config.h"
                                        "/etc/X11/%X," "%C/X11/%X"
 #endif
 #ifndef SYS_CONFIGDIRPATH
-#define SYS_CONFIGDIRPATH      "/usr/share/X11/%X," "%D/X11/%X"
+#define SYS_CONFIGDIRPATH      "%D/X11/%X"
 #endif
 #ifndef PROJECTROOT
 #define PROJECTROOT    "/usr/X11R6"
@@ -170,7 +171,7 @@ xf86GetPathElem(char **pnt)
 static char *
 xf86ValidateFontPath(char *path)
 {
-    char *tmp_path, *out_pnt, *path_elem, *next, *p1, *dir_elem;
+    char *next, *tmp_path, *out_pnt, *path_elem, *p1, *dir_elem;
     struct stat stat_buf;
     int flag;
     int dirlen;
@@ -231,21 +232,33 @@ xf86ValidateFontPath(char *path)
     return tmp_path;
 }
 
+#define FIND_SUITABLE(pointertype, listhead, ptr)                                            \
+    do {                                                                                     \
+        pointertype _l, _p;                                                                  \
+                                                                                             \
+        for (_l = (listhead), _p = NULL; !_p && _l; _l = (pointertype)_l->list.next) {       \
+            if (!_l->match_seat || (SeatId && xf86nameCompare(_l->match_seat, SeatId) == 0)) \
+                _p = _l;                                                                     \
+        }                                                                                    \
+                                                                                             \
+        (ptr) = _p;                                                                          \
+    } while(0)
+
 /*
  * use the datastructure that the parser provides and pick out the parts
  * that we need at this point
  */
-char **
-xf86ModulelistFromConfig(pointer **optlist)
+const char **
+xf86ModulelistFromConfig(void ***optlist)
 {
     int count = 0, i = 0;
-    char **modulearray;
+    const char **modulearray;
 
     const char *ignore[] = { "GLcore", "speedo", "bitmap", "drm",
         "freetype", "type1",
         NULL
     };
-    pointer *optarray;
+    void **optarray;
     XF86LoadPtr modp;
     Bool found;
 
@@ -351,7 +364,7 @@ xf86ModulelistFromConfig(pointer **optlist)
      * allocate the memory and walk the list again to fill in the pointers
      */
     modulearray = xnfalloc((count + 1) * sizeof(char *));
-    optarray = xnfalloc((count + 1) * sizeof(pointer));
+    optarray = xnfalloc((count + 1) * sizeof(void *));
     count = 0;
     if (xf86configptr->conf_modules) {
         modp = xf86configptr->conf_modules->mod_load_lst;
@@ -373,12 +386,12 @@ xf86ModulelistFromConfig(pointer **optlist)
     return modulearray;
 }
 
-char **
+const char **
 xf86DriverlistFromConfig(void)
 {
     int count = 0;
     int j;
-    char **modulearray;
+    const char **modulearray;
     screenLayoutPtr slp;
 
     /*
@@ -445,11 +458,11 @@ xf86DriverlistFromConfig(void)
     return modulearray;
 }
 
-char **
+const char **
 xf86InputDriverlistFromConfig(void)
 {
     int count = 0;
-    char **modulearray;
+    const char **modulearray;
     InputInfoPtr *idp;
 
     /*
@@ -504,11 +517,11 @@ xf86InputDriverlistFromConfig(void)
 }
 
 static void
-fixup_video_driver_list(char **drivers)
+fixup_video_driver_list(const char **drivers)
 {
-    static const char *fallback[4] = { "vesa", "fbdev", "wsfb", NULL };
-    char **end, **drv;
-    char *x;
+    static const char *fallback[5] = { "modesetting", "fbdev", "vesa", "wsfb", NULL };
+    const char **end, **drv;
+    const char *x;
     int i;
 
     /* walk to the end of the list */
@@ -532,10 +545,10 @@ fixup_video_driver_list(char **drivers)
     }
 }
 
-static char **
+static const char **
 GenerateDriverlist(const char *dirname)
 {
-    char **ret;
+    const char **ret;
     const char *subdirs[] = { dirname, NULL };
     static const char *patlist[] = { "(.*)_drv\\.so", NULL };
     ret = LoaderListDirs(subdirs, patlist);
@@ -547,10 +560,10 @@ GenerateDriverlist(const char *dirname)
     return ret;
 }
 
-char **
+const char **
 xf86DriverlistFromCompile(void)
 {
-    static char **driverlist = NULL;
+    static const char **driverlist = NULL;
 
     if (!driverlist)
         driverlist = GenerateDriverlist("drivers");
@@ -588,33 +601,35 @@ configFiles(XF86ConfFilesPtr fileconf)
     /* FontPath */
     must_copy = TRUE;
 
-    temp_path = defaultFontPath ? defaultFontPath : "";
+    temp_path = defaultFontPath ? (char *) defaultFontPath : (char *) "";
     if (xf86fpFlag)
         pathFrom = X_CMDLINE;
     else if (fileconf && fileconf->file_fontpath) {
         pathFrom = X_CONFIG;
         if (xf86Info.useDefaultFontPath) {
-            if (asprintf(&defaultFontPath, "%s%s%s", fileconf->file_fontpath,
+            char *new_font_path;
+            if (asprintf(&new_font_path, "%s%s%s", fileconf->file_fontpath,
                          *temp_path ? "," : "", temp_path) == -1)
-                defaultFontPath = NULL;
+                new_font_path = NULL;
             else
                 must_copy = FALSE;
+            defaultFontPath = new_font_path;
         }
         else
             defaultFontPath = fileconf->file_fontpath;
     }
     else
         pathFrom = X_DEFAULT;
-    temp_path = defaultFontPath ? defaultFontPath : "";
+    temp_path = defaultFontPath ? (char *) defaultFontPath : (char *) "";
 
     /* xf86ValidateFontPath modifies its argument, but returns a copy of it. */
-    temp_path = must_copy ? xnfstrdup(defaultFontPath) : defaultFontPath;
+    temp_path = must_copy ? xnfstrdup(defaultFontPath) : (char *) defaultFontPath;
     defaultFontPath = xf86ValidateFontPath(temp_path);
     free(temp_path);
 
     /* make fontpath more readable in the logfiles */
     countDirs = 1;
-    temp_path = defaultFontPath;
+    temp_path = (char *) defaultFontPath;
     while ((temp_path = index(temp_path, ',')) != NULL) {
         countDirs++;
         temp_path++;
@@ -622,7 +637,7 @@ configFiles(XF86ConfFilesPtr fileconf)
 
     log_buf = xnfalloc(strlen(defaultFontPath) + (2 * countDirs) + 1);
     temp_path = log_buf;
-    start = defaultFontPath;
+    start = (char *) defaultFontPath;
     while ((end = index(start, ',')) != NULL) {
         size = (end - start) + 1;
         *(temp_path++) = '\t';
@@ -774,6 +789,7 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
     MessageType from;
     const char *s;
     XkbRMLVOSet set;
+    const char *rules;
 
     /* Default options. */
 #ifndef _F_SET_XKB_DEFAULT_OPTIONS_FROM_CONFIGURE_
@@ -968,9 +984,15 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
      * evdev rules set. */
 #if defined(linux)
     if (!xf86Info.forceInputDevices)
-        set.rules = "evdev";
+        rules = "evdev";
+    else
 #endif
+        rules = "base";
+
+    /* Xkb default options. */
+    XkbInitRules(&set, rules, "pc105", "us", NULL, NULL);
     XkbSetRulesDflts(&set);
+    XkbFreeRMLVOSet(&set, FALSE);
 
     xf86Info.useDefaultFontPath = TRUE;
     xf86Info.useDefaultFontPathFrom = X_DEFAULT;
@@ -1585,8 +1607,11 @@ configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout,
      * config file, or - if it is NULL - configScreen autogenerates one for
      * us */
     if (!count) {
+        XF86ConfScreenPtr screen;
+
+        FIND_SUITABLE (XF86ConfScreenPtr, xf86configptr->conf_screen_lst, screen);
         slp[0].screen = xnfcalloc(1, sizeof(confScreenRec));
-        if (!configScreen(slp[0].screen, xf86configptr->conf_screen_lst,
+        if (!configScreen(slp[0].screen, screen,
                           0, X_CONFIG)) {
             free(slp[0].screen);
             free(slp);
@@ -1682,7 +1707,7 @@ configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout,
  */
 static Bool
 configImpliedLayout(serverLayoutPtr servlayoutp, XF86ConfScreenPtr conf_screen,
-                    XF86ConfigPtr xf86configptr)
+                    XF86ConfigPtr conf_ptr)
 {
     MessageType from;
     XF86ConfScreenPtr s;
@@ -1727,7 +1752,7 @@ configImpliedLayout(serverLayoutPtr servlayoutp, XF86ConfScreenPtr conf_screen,
 
     memset(&layout, 0, sizeof(layout));
     layout.lay_identifier = servlayoutp->id;
-    if (xf86layoutAddInputDevices(xf86configptr, &layout) > 0) {
+    if (xf86layoutAddInputDevices(conf_ptr, &layout) > 0) {
         if (!configInputDevices(&layout, servlayoutp))
             return FALSE;
         from = X_DEFAULT;
@@ -1826,7 +1851,7 @@ configScreen(confScreenPtr screenp, XF86ConfScreenPtr conf_screen, int scrnum,
      * set it to NULL so that the section can be autoconfigured later */
     screenp->device = xnfcalloc(1, sizeof(GDevRec));
     if ((!conf_screen->scrn_device) && (xf86configptr->conf_device_lst)) {
-        conf_screen->scrn_device = xf86configptr->conf_device_lst;
+        FIND_SUITABLE (XF86ConfDevicePtr, xf86configptr->conf_device_lst, conf_screen->scrn_device);
         xf86Msg(X_DEFAULT, "No device specified for screen \"%s\".\n"
                 "\tUsing the first device section listed.\n", screenp->id);
     }
@@ -2356,9 +2381,10 @@ checkInput(serverLayoutPtr layout, Bool implicit_layout)
 ConfigStatus
 xf86HandleConfigFile(Bool autoconfig)
 {
-    char *scanptr;
+    const char *scanptr;
     Bool singlecard = 0;
     Bool implicit_layout = FALSE;
+    XF86ConfLayoutPtr layout;
 
     if (!autoconfig) {
         char *filename, *dirname, *sysdirname;
@@ -2434,14 +2460,17 @@ xf86HandleConfigFile(Bool autoconfig)
      */
 
     /* First check if a layout section is present, and if it is valid. */
+    FIND_SUITABLE(XF86ConfLayoutPtr, xf86configptr->conf_layout_lst, layout);
+    if (layout == NULL || xf86ScreenName != NULL) {
+        XF86ConfScreenPtr screen;
 
-    if (xf86configptr->conf_layout_lst == NULL || xf86ScreenName != NULL) {
         if (xf86ScreenName == NULL) {
             xf86Msg(X_DEFAULT,
                     "No Layout section.  Using the first Screen section.\n");
         }
+        FIND_SUITABLE (XF86ConfScreenPtr, xf86configptr->conf_screen_lst, screen);
         if (!configImpliedLayout(&xf86ConfigLayout,
-                                 xf86configptr->conf_screen_lst,
+                                 screen,
                                  xf86configptr)) {
             xf86Msg(X_ERROR, "Unable to determine the screen layout\n");
             return CONFIG_PARSE_ERROR;
@@ -2451,21 +2480,18 @@ xf86HandleConfigFile(Bool autoconfig)
     else {
         if (xf86configptr->conf_flags != NULL) {
             char *dfltlayout = NULL;
-            pointer optlist = xf86configptr->conf_flags->flg_option_lst;
+            void *optlist = xf86configptr->conf_flags->flg_option_lst;
 
             if (optlist && xf86FindOption(optlist, "defaultserverlayout"))
                 dfltlayout =
                     xf86SetStrOption(optlist, "defaultserverlayout", NULL);
-            if (!configLayout
-                (&xf86ConfigLayout, xf86configptr->conf_layout_lst,
-                 dfltlayout)) {
+            if (!configLayout(&xf86ConfigLayout, layout, dfltlayout)) {
                 xf86Msg(X_ERROR, "Unable to determine the screen layout\n");
                 return CONFIG_PARSE_ERROR;
             }
         }
         else {
-            if (!configLayout(&xf86ConfigLayout, xf86configptr->conf_layout_lst,
-                              NULL)) {
+            if (!configLayout(&xf86ConfigLayout, layout, NULL)) {
                 xf86Msg(X_ERROR, "Unable to determine the screen layout\n");
                 return CONFIG_PARSE_ERROR;
             }
index de06677..23fb383 100644 (file)
@@ -59,10 +59,10 @@ typedef struct _ModuleDefault {
 /*
  * prototypes
  */
-char **xf86ModulelistFromConfig(pointer **);
-char **xf86DriverlistFromConfig(void);
-char **xf86DriverlistFromCompile(void);
-char **xf86InputDriverlistFromConfig(void);
+const char **xf86ModulelistFromConfig(void ***);
+const char **xf86DriverlistFromConfig(void);
+const char **xf86DriverlistFromCompile(void);
+const char **xf86InputDriverlistFromConfig(void);
 Bool xf86BuiltinInputDriver(const char *);
 ConfigStatus xf86HandleConfigFile(Bool);
 
index 6f69117..967bfbc 100644 (file)
@@ -81,6 +81,7 @@ xf86AddBusDeviceToConfigure(const char *driver, BusType bus, void *busData,
                             int chipset)
 {
     int ret, i, j;
+    char *lower_driver;
 
     if (!xf86DoConfigure || !xf86DoConfigurePass1)
         return NULL;
@@ -117,18 +118,21 @@ xf86AddBusDeviceToConfigure(const char *driver, BusType bus, void *busData,
     DevToConfig[i].iDriver = CurrentDriver;
 
     /* Fill in what we know, converting the driver name to lower case */
-    DevToConfig[i].GDev.driver = xnfalloc(strlen(driver) + 1);
-    for (j = 0; (DevToConfig[i].GDev.driver[j] = tolower(driver[j])); j++);
+    lower_driver = xnfalloc(strlen(driver) + 1);
+    for (j = 0; (lower_driver[j] = tolower(driver[j])); j++);
+    DevToConfig[i].GDev.driver = lower_driver;
 
     switch (bus) {
 #ifdef XSERVER_LIBPCIACCESS
     case BUS_PCI:
+       DevToConfig[i].pVideo = busData;
         xf86PciConfigureNewDev(busData, DevToConfig[i].pVideo,
                                &DevToConfig[i].GDev, &chipset);
         break;
 #endif
 #if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__)
     case BUS_SBUS:
+       DevToConfig[i].sVideo = busData;
         xf86SbusConfigureNewDev(busData, DevToConfig[i].sVideo,
                                 &DevToConfig[i].GDev);
         break;
@@ -155,8 +159,8 @@ configureInputSection(void)
 
     parsePrologue(XF86ConfInputPtr, XF86ConfInputRec)
 
-        ptr->inp_identifier = "Keyboard0";
-    ptr->inp_driver = "kbd";
+    ptr->inp_identifier = xnfstrdup("Keyboard0");
+    ptr->inp_driver = xnfstrdup("kbd");
     ptr->list.next = NULL;
 
     /* Crude mechanism to auto-detect mouse (os dependent) */
@@ -171,17 +175,17 @@ configureInputSection(void)
     }
 
     mouse = calloc(1, sizeof(XF86ConfInputRec));
-    mouse->inp_identifier = "Mouse0";
-    mouse->inp_driver = "mouse";
+    mouse->inp_identifier = xnfstrdup("Mouse0");
+    mouse->inp_driver = xnfstrdup("mouse");
     mouse->inp_option_lst =
-        xf86addNewOption(mouse->inp_option_lst, strdup("Protocol"),
-                         strdup(DFLT_MOUSE_PROTO));
+        xf86addNewOption(mouse->inp_option_lst, xnfstrdup("Protocol"),
+                         xnfstrdup(DFLT_MOUSE_PROTO));
     mouse->inp_option_lst =
-        xf86addNewOption(mouse->inp_option_lst, strdup("Device"),
-                         strdup(DFLT_MOUSE_DEV));
+        xf86addNewOption(mouse->inp_option_lst, xnfstrdup("Device"),
+                         xnfstrdup(DFLT_MOUSE_DEV));
     mouse->inp_option_lst =
-        xf86addNewOption(mouse->inp_option_lst, strdup("ZAxisMapping"),
-                         strdup("4 5 6 7"));
+        xf86addNewOption(mouse->inp_option_lst, xnfstrdup("ZAxisMapping"),
+                         xnfstrdup("4 5 6 7"));
     ptr = (XF86ConfInputPtr) xf86addListItem((glp) ptr, (glp) mouse);
     return ptr;
 }
@@ -191,24 +195,28 @@ configureScreenSection(int screennum)
 {
     int i;
     int depths[] = { 1, 4, 8, 15, 16, 24 /*, 32 */  };
+    char *tmp;
     parsePrologue(XF86ConfScreenPtr, XF86ConfScreenRec)
 
-        XNFasprintf(&ptr->scrn_identifier, "Screen%d", screennum);
-    XNFasprintf(&ptr->scrn_monitor_str, "Monitor%d", screennum);
-    XNFasprintf(&ptr->scrn_device_str, "Card%d", screennum);
+    XNFasprintf(&tmp, "Screen%d", screennum);
+    ptr->scrn_identifier = tmp;
+    XNFasprintf(&tmp, "Monitor%d", screennum);
+    ptr->scrn_monitor_str = tmp;
+    XNFasprintf(&tmp, "Card%d", screennum);
+    ptr->scrn_device_str = tmp;
 
     for (i = 0; i < sizeof(depths) / sizeof(depths[0]); i++) {
-        XF86ConfDisplayPtr display;
+        XF86ConfDisplayPtr conf_display;
 
-        display = calloc(1, sizeof(XF86ConfDisplayRec));
-        display->disp_depth = depths[i];
-        display->disp_black.red = display->disp_white.red = -1;
-        display->disp_black.green = display->disp_white.green = -1;
-        display->disp_black.blue = display->disp_white.blue = -1;
+        conf_display = calloc(1, sizeof(XF86ConfDisplayRec));
+        conf_display->disp_depth = depths[i];
+        conf_display->disp_black.red = conf_display->disp_white.red = -1;
+        conf_display->disp_black.green = conf_display->disp_white.green = -1;
+        conf_display->disp_black.blue = conf_display->disp_white.blue = -1;
         ptr->scrn_display_lst = (XF86ConfDisplayPtr) xf86addListItem((glp) ptr->
                                                                      scrn_display_lst,
                                                                      (glp)
-                                                                     display);
+                                                                     conf_display);
     }
 
     return ptr;
@@ -244,12 +252,14 @@ configureDeviceSection(int screennum)
 {
     OptionInfoPtr p;
     int i = 0;
+    char *identifier;
 
     parsePrologue(XF86ConfDevicePtr, XF86ConfDeviceRec)
 
         /* Move device info to parser structure */
-        if (asprintf(&ptr->dev_identifier, "Card%d", screennum) == -1)
-        ptr->dev_identifier = NULL;
+   if (asprintf(&identifier, "Card%d", screennum) == -1)
+        identifier = NULL;
+    ptr->dev_identifier = identifier;
     ptr->dev_chipset = DevToConfig[screennum].GDev.chipset;
     ptr->dev_busid = DevToConfig[screennum].GDev.busID;
     ptr->dev_driver = DevToConfig[screennum].GDev.driver;
@@ -280,7 +290,7 @@ configureDeviceSection(int screennum)
             "        ### <string>: \"String\", <freq>: \"<f> Hz/kHz/MHz\",\n"
             "        ### <percent>: \"<f>%\"\n"
             "        ### [arg]: arg optional\n";
-        ptr->dev_comment = strdup(descrip);
+        ptr->dev_comment = xnfstrdup(descrip);
         if (ptr->dev_comment) {
             for (p = DevToConfig[screennum].GDev.options; p->name != NULL; p++) {
                 char *p_e;
@@ -327,9 +337,9 @@ configureLayoutSection(void)
         iptr = malloc(sizeof(XF86ConfInputrefRec));
         iptr->list.next = NULL;
         iptr->iref_option_lst = NULL;
-        iptr->iref_inputdev_str = "Mouse0";
+        iptr->iref_inputdev_str = xnfstrdup("Mouse0");
         iptr->iref_option_lst =
-            xf86addNewOption(iptr->iref_option_lst, strdup("CorePointer"),
+            xf86addNewOption(iptr->iref_option_lst, xnfstrdup("CorePointer"),
                              NULL);
         ptr->lay_input_lst = (XF86ConfInputrefPtr)
             xf86addListItem((glp) ptr->lay_input_lst, (glp) iptr);
@@ -341,9 +351,9 @@ configureLayoutSection(void)
         iptr = malloc(sizeof(XF86ConfInputrefRec));
         iptr->list.next = NULL;
         iptr->iref_option_lst = NULL;
-        iptr->iref_inputdev_str = "Keyboard0";
+        iptr->iref_inputdev_str = xnfstrdup("Keyboard0");
         iptr->iref_option_lst =
-            xf86addNewOption(iptr->iref_option_lst, strdup("CoreKeyboard"),
+            xf86addNewOption(iptr->iref_option_lst, xnfstrdup("CoreKeyboard"),
                              NULL);
         ptr->lay_input_lst = (XF86ConfInputrefPtr)
             xf86addListItem((glp) ptr->lay_input_lst, (glp) iptr);
@@ -351,20 +361,23 @@ configureLayoutSection(void)
 
     for (scrnum = 0; scrnum < nDevToConfig; scrnum++) {
         XF86ConfAdjacencyPtr aptr;
+        char *tmp;
 
         aptr = malloc(sizeof(XF86ConfAdjacencyRec));
         aptr->list.next = NULL;
         aptr->adj_x = 0;
         aptr->adj_y = 0;
         aptr->adj_scrnum = scrnum;
-        XNFasprintf(&aptr->adj_screen_str, "Screen%d", scrnum);
+        XNFasprintf(&tmp, "Screen%d", scrnum);
+        aptr->adj_screen_str = tmp;
         if (scrnum == 0) {
             aptr->adj_where = CONF_ADJ_ABSOLUTE;
             aptr->adj_refscreen = NULL;
         }
         else {
             aptr->adj_where = CONF_ADJ_RIGHTOF;
-            XNFasprintf(&aptr->adj_refscreen, "Screen%d", scrnum - 1);
+            XNFasprintf(&tmp, "Screen%d", scrnum - 1);
+            aptr->adj_refscreen = tmp;
         }
         ptr->lay_adjacency_lst =
             (XF86ConfAdjacencyPtr) xf86addListItem((glp) ptr->lay_adjacency_lst,
@@ -385,7 +398,7 @@ configureFlagsSection(void)
 static XF86ConfModulePtr
 configureModuleSection(void)
 {
-    char **elist, **el;
+    const char **elist, **el;
 
     /* Find the list of extension & font modules. */
     const char *esubdirs[] = {
@@ -418,9 +431,9 @@ configureFilesSection(void)
     parsePrologue(XF86ConfFilesPtr, XF86ConfFilesRec)
 
         if (xf86ModulePath)
-        ptr->file_modulepath = strdup(xf86ModulePath);
+        ptr->file_modulepath = xnfstrdup(xf86ModulePath);
     if (defaultFontPath)
-        ptr->file_fontpath = strdup(defaultFontPath);
+        ptr->file_fontpath = xnfstrdup(defaultFontPath);
 
     return ptr;
 }
@@ -428,11 +441,13 @@ configureFilesSection(void)
 static XF86ConfMonitorPtr
 configureMonitorSection(int screennum)
 {
+    char *tmp;
     parsePrologue(XF86ConfMonitorPtr, XF86ConfMonitorRec)
 
-        XNFasprintf(&ptr->mon_identifier, "Monitor%d", screennum);
-    ptr->mon_vendor = strdup("Monitor Vendor");
-    ptr->mon_modelname = strdup("Monitor Model");
+    XNFasprintf(&tmp, "Monitor%d", screennum);
+    ptr->mon_identifier = tmp;
+    ptr->mon_vendor = xnfstrdup("Monitor Vendor");
+    ptr->mon_modelname = xnfstrdup("Monitor Model");
 
     return ptr;
 }
@@ -470,11 +485,13 @@ configureDDCMonitorSection(int screennum)
 #define displaySizeMaxLen 80
     char displaySize_string[displaySizeMaxLen];
     int displaySizeLen;
+    char *tmp;
 
     parsePrologue(XF86ConfMonitorPtr, XF86ConfMonitorRec)
 
-        XNFasprintf(&ptr->mon_identifier, "Monitor%d", screennum);
-    ptr->mon_vendor = strdup(ConfiguredMonitor->vendor.name);
+    XNFasprintf(&tmp, "Monitor%d", screennum);
+    ptr->mon_identifier = tmp;
+    ptr->mon_vendor = xnfstrdup(ConfiguredMonitor->vendor.name);
     XNFasprintf(&ptr->mon_modelname, "%x", ConfiguredMonitor->vendor.prod_id);
 
     /* features in centimetres, we want millimetres */
@@ -512,7 +529,7 @@ configureDDCMonitorSection(int screennum)
 
     if (ConfiguredMonitor->features.dpms) {
         ptr->mon_option_lst =
-            xf86addNewOption(ptr->mon_option_lst, strdup("DPMS"), NULL);
+            xf86addNewOption(ptr->mon_option_lst, xnfstrdup("DPMS"), NULL);
     }
 
     return ptr;
@@ -526,7 +543,7 @@ DoConfigure(void)
     char filename[PATH_MAX];
     const char *addslash = "";
     XF86ConfigPtr xf86config = NULL;
-    char **vlist, **vl;
+    const char **vlist, **vl;
     int *dev2screen;
 
     vlist = xf86DriverlistFromCompile();
@@ -545,41 +562,16 @@ DoConfigure(void)
 
     free(vlist);
 
-    for (i = 0; i < xf86NumDrivers; i++) {
-        xorgHWFlags flags;
-
-        if (!xf86DriverList[i]->driverFunc
-            || !xf86DriverList[i]->driverFunc(NULL,
-                                              GET_REQUIRED_HW_INTERFACES,
-                                              &flags)
-            || NEED_IO_ENABLED(flags)) {
-            xorgHWAccess = TRUE;
-            break;
-        }
-    }
-    /* Enable full I/O access */
-    if (xorgHWAccess) {
-        if (!xf86EnableIO())
-            /* oops, we have failed */
-            xorgHWAccess = FALSE;
-    }
+    xorgHWAccess = xf86EnableIO();
 
     /* Create XF86Config file structure */
     xf86config = calloc(1, sizeof(XF86ConfigRec));
 
     /* Call all of the probe functions, reporting the results. */
     for (CurrentDriver = 0; CurrentDriver < xf86NumDrivers; CurrentDriver++) {
-        xorgHWFlags flags;
         Bool found_screen;
         DriverRec *const drv = xf86DriverList[CurrentDriver];
 
-        if (!xorgHWAccess) {
-            if (!drv->driverFunc
-                || !drv->driverFunc(NULL, GET_REQUIRED_HW_INTERFACES, &flags)
-                || NEED_IO_ENABLED(flags))
-                continue;
-        }
-
         found_screen = xf86CallDriverProbe(drv, TRUE);
         if (found_screen && drv->Identify) {
             (*drv->Identify) (0);
@@ -593,24 +585,24 @@ DoConfigure(void)
 
     /* Add device, monitor and screen sections for detected devices */
     for (screennum = 0; screennum < nDevToConfig; screennum++) {
-        XF86ConfDevicePtr DevicePtr;
-        XF86ConfMonitorPtr MonitorPtr;
-        XF86ConfScreenPtr ScreenPtr;
+        XF86ConfDevicePtr device_ptr;
+        XF86ConfMonitorPtr monitor_ptr;
+        XF86ConfScreenPtr screen_ptr;
 
-        DevicePtr = configureDeviceSection(screennum);
+        device_ptr = configureDeviceSection(screennum);
         xf86config->conf_device_lst = (XF86ConfDevicePtr) xf86addListItem((glp)
                                                                           xf86config->
                                                                           conf_device_lst,
                                                                           (glp)
-                                                                          DevicePtr);
-        MonitorPtr = configureMonitorSection(screennum);
-        xf86config->conf_monitor_lst = (XF86ConfMonitorPtr) xf86addListItem((glp) xf86config->conf_monitor_lst, (glp) MonitorPtr);
-        ScreenPtr = configureScreenSection(screennum);
+                                                                          device_ptr);
+        monitor_ptr = configureMonitorSection(screennum);
+        xf86config->conf_monitor_lst = (XF86ConfMonitorPtr) xf86addListItem((glp) xf86config->conf_monitor_lst, (glp) monitor_ptr);
+        screen_ptr = configureScreenSection(screennum);
         xf86config->conf_screen_lst = (XF86ConfScreenPtr) xf86addListItem((glp)
                                                                           xf86config->
                                                                           conf_screen_lst,
                                                                           (glp)
-                                                                          ScreenPtr);
+                                                                          screen_ptr);
     }
 
     xf86config->conf_files = configureFilesSection();
@@ -721,27 +713,27 @@ DoConfigure(void)
     xf86freeScreenList(xf86config->conf_screen_lst);
     xf86config->conf_screen_lst = NULL;
     for (j = 0; j < xf86NumScreens; j++) {
-        XF86ConfMonitorPtr MonitorPtr;
-        XF86ConfScreenPtr ScreenPtr;
+        XF86ConfMonitorPtr monitor_ptr;
+        XF86ConfScreenPtr screen_ptr;
 
         ConfiguredMonitor = NULL;
 
         if ((*xf86Screens[dev2screen[j]]->PreInit) (xf86Screens[dev2screen[j]],
                                                     PROBE_DETECT) &&
             ConfiguredMonitor) {
-            MonitorPtr = configureDDCMonitorSection(j);
+            monitor_ptr = configureDDCMonitorSection(j);
         }
         else {
-            MonitorPtr = configureMonitorSection(j);
+            monitor_ptr = configureMonitorSection(j);
         }
-        ScreenPtr = configureScreenSection(j);
+        screen_ptr = configureScreenSection(j);
 
-        xf86config->conf_monitor_lst = (XF86ConfMonitorPtr) xf86addListItem((glp) xf86config->conf_monitor_lst, (glp) MonitorPtr);
+        xf86config->conf_monitor_lst = (XF86ConfMonitorPtr) xf86addListItem((glp) xf86config->conf_monitor_lst, (glp) monitor_ptr);
         xf86config->conf_screen_lst = (XF86ConfScreenPtr) xf86addListItem((glp)
                                                                           xf86config->
                                                                           conf_screen_lst,
                                                                           (glp)
-                                                                          ScreenPtr);
+                                                                          screen_ptr);
     }
 
     if (xf86writeConfigFile(filename, xf86config) == 0) {
@@ -789,7 +781,7 @@ void
 DoShowOptions(void)
 {
     int i = 0;
-    char **vlist = 0;
+    const char **vlist = NULL;
     char *pSymbol = 0;
     XF86ModuleData *initData = 0;
 
index 65a9e82..7d0776e 100644 (file)
@@ -72,9 +72,6 @@ static miPointerScreenFuncRec xf86PointerScreenFuncs = {
     xf86CursorOffScreen,
     xf86CrossScreen,
     xf86WarpCursor,
-    /* let miPointerInitialize take care of these */
-    NULL,
-    NULL
 };
 
 static xf86ScreenLayoutRec xf86ScreenLayout[MAXSCREENS];
index a441dee..b9e1e3f 100644 (file)
@@ -450,7 +450,7 @@ xf86SetDGAMode(ScrnInfoPtr pScrn, int num, DGADevicePtr devRet)
                                             pMode->pixmapHeight, pMode->depth,
                                             pMode->bitsPerPixel,
                                             pMode->bytesPerScanline,
-                                            (pointer) (pMode->address));
+                                            (void *) (pMode->address));
         }
     }
 
@@ -1033,6 +1033,9 @@ DGAProcessKeyboardEvent(ScreenPtr pScreen, DGAEvent * event, DeviceIntPtr keybd)
 
     UpdateDeviceState(keybd, &ev);
 
+    if (!IsMaster(keybd))
+        return;
+
     /*
      * Deliver the DGA event
      */
@@ -1074,6 +1077,7 @@ DGAProcessPointerEvent(ScreenPtr pScreen, DGAEvent * event, DeviceIntPtr mouse)
     DeviceEvent ev = {
         .header = ET_Internal,
         .length = sizeof(ev),
+        .detail.key = event->detail,
         .type = event->subtype,
         .corestate = butc ? butc->state : 0
     };
@@ -1083,6 +1087,9 @@ DGAProcessPointerEvent(ScreenPtr pScreen, DGAEvent * event, DeviceIntPtr mouse)
 
     UpdateDeviceState(mouse, &ev);
 
+    if (!IsMaster(mouse))
+        return;
+
     /*
      * Deliver the DGA event
      */
@@ -1190,9 +1197,6 @@ DGAHandleEvent(int screen_num, InternalEvent *ev, DeviceIntPtr device)
     if (!pScreenPriv)
         return;
 
-    if (!IsMaster(device))
-        return;
-
     switch (event->subtype) {
     case KeyPress:
     case KeyRelease:
@@ -1210,7 +1214,7 @@ DGAHandleEvent(int screen_num, InternalEvent *ev, DeviceIntPtr device)
 
 static void XDGAResetProc(ExtensionEntry * extEntry);
 
-static void DGAClientStateChange(CallbackListPtr *, pointer, pointer);
+static void DGAClientStateChange(CallbackListPtr *, void *, void *);
 
 static DevPrivateKeyRec DGAScreenPrivateKeyRec;
 
@@ -1400,7 +1404,7 @@ ProcXDGAQueryModes(ClientPtr client)
 }
 
 static void
-DGAClientStateChange(CallbackListPtr *pcbl, pointer nulldata, pointer calldata)
+DGAClientStateChange(CallbackListPtr *pcbl, void *nulldata, void *calldata)
 {
     NewClientInfoRec *pci = (NewClientInfoRec *) calldata;
     ClientPtr client = NULL;
@@ -1480,7 +1484,7 @@ ProcXDGASetMode(ClientPtr client)
     DGA_SETCLIENT(stuff->screen, client);
 
     if (pPix) {
-        if (AddResource(stuff->pid, RT_PIXMAP, (pointer) (pPix))) {
+        if (AddResource(stuff->pid, RT_PIXMAP, (void *) (pPix))) {
             pPix->drawable.id = (int) stuff->pid;
             rep.flags = DGA_PIXMAP_AVAILABLE;
         }
@@ -1558,7 +1562,7 @@ ProcXDGAInstallColormap(ClientPtr client)
 
     REQUEST_SIZE_MATCH(xXDGAInstallColormapReq);
 
-    rc = dixLookupResourceByType((pointer *) &cmap, stuff->cmap, RT_COLORMAP,
+    rc = dixLookupResourceByType((void **) &cmap, stuff->cmap, RT_COLORMAP,
                                  client, DixInstallAccess);
     if (rc != Success)
         return rc;
@@ -1987,7 +1991,7 @@ ProcXF86DGAInstallColormap(ClientPtr client)
     if (!DGAActive(stuff->screen))
         return DGAErrorBase + XF86DGADirectNotActivated;
 
-    rc = dixLookupResourceByType((pointer *) &pcmp, stuff->id, RT_COLORMAP,
+    rc = dixLookupResourceByType((void **) &pcmp, stuff->id, RT_COLORMAP,
                                  client, DixInstallAccess);
     if (rc == Success) {
         DGAInstallCmap(pcmp);
@@ -2095,7 +2099,7 @@ ProcXDGADispatch(ClientPtr client)
 {
     REQUEST(xReq);
 
-    if (!LocalClient(client))
+    if (!client->local)
         return DGAErrorBase + XF86DGAClientNotLocal;
 
 #ifdef DGA_REQ_DEBUG
old mode 100644 (file)
new mode 100755 (executable)
index d6550db..a7410ed
@@ -36,6 +36,7 @@
 #include <X11/X.h>
 #include "os.h"
 #include "globals.h"
+#include "windowstr.h"
 #include "xf86.h"
 #include "xf86Priv.h"
 #ifdef DPMSExtension
@@ -60,7 +61,7 @@ xf86DPMSInit(ScreenPtr pScreen, DPMSSetProcPtr set, int flags)
 #ifdef DPMSExtension
     ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
     DPMSPtr pDPMS;
-    pointer DPMSOpt;
+    void *DPMSOpt;
     MessageType enabled_from;
 
     DPMSKey = &DPMSKeyRec;
@@ -131,6 +132,19 @@ DPMSClose(ScreenPtr pScreen)
     return pScreen->CloseScreen(pScreen);
 }
 
+static void
+DPMSSetScreen(ScrnInfoPtr pScrn, int level)
+{
+    ScreenPtr pScreen = xf86ScrnToScreen(pScrn);
+    DPMSPtr pDPMS = dixLookupPrivate(&pScreen->devPrivates, DPMSKey);
+
+    if (pDPMS && pScrn->DPMSSet && pDPMS->Enabled && pScrn->vtSema) {
+        xf86VGAarbiterLock(pScrn);
+        pScrn->DPMSSet(pScrn, level, 0);
+        xf86VGAarbiterUnlock(pScrn);
+    }
+}
+
 /*
  * DPMSSet --
  *     Device dependent DPMS mode setting hook.  This is called whenever
@@ -140,8 +154,6 @@ int
 DPMSSet(ClientPtr client, int level)
 {
     int rc, i;
-    DPMSPtr pDPMS;
-    ScrnInfoPtr pScrn;
 
     DPMSPowerLevel = level;
 
@@ -149,27 +161,40 @@ DPMSSet(ClientPtr client, int level)
         return Success;
 
     if (level != DPMSModeOn) {
-        rc = dixSaveScreens(client, SCREEN_SAVER_FORCER, ScreenSaverActive);
+        if (xf86IsUnblank(screenIsSaved)) {
+            rc = dixSaveScreens(client, SCREEN_SAVER_FORCER, ScreenSaverActive);
+            if (rc != Success)
+                return rc;
+        }
+    } else if (!xf86IsUnblank(screenIsSaved)) {
+        rc = dixSaveScreens(client, SCREEN_SAVER_OFF, ScreenSaverReset);
         if (rc != Success)
             return rc;
     }
 
     /* For each screen, set the DPMS level */
     for (i = 0; i < xf86NumScreens; i++) {
-        pScrn = xf86Screens[i];
-        pDPMS = dixLookupPrivate(&screenInfo.screens[i]->devPrivates, DPMSKey);
-        if (pDPMS && pScrn->DPMSSet && pDPMS->Enabled && pScrn->vtSema) {
-            xf86VGAarbiterLock(pScrn);
-            pScrn->DPMSSet(pScrn, level, 0);
-            xf86VGAarbiterUnlock(pScrn);
-        }
+        DPMSSetScreen(xf86Screens[i], level);
+    }
+    for (i = 0; i < xf86NumGPUScreens; i++) {
+        DPMSSetScreen(xf86GPUScreens[i], level);
     }
-if (DPMSCallback) {
+
+    if (DPMSCallback) {
         CallCallbacks(&DPMSCallback, (void *)&level);
     }
     return Success;
 }
 
+static Bool
+DPMSSupportedOnScreen(ScrnInfoPtr pScrn)
+{
+    ScreenPtr pScreen = xf86ScrnToScreen(pScrn);
+    DPMSPtr pDPMS = dixLookupPrivate(&pScreen->devPrivates, DPMSKey);
+
+    return pDPMS && pScrn->DPMSSet;
+}
+
 /*
  * DPMSSupported --
  *     Return TRUE if any screen supports DPMS.
@@ -178,8 +203,6 @@ Bool
 DPMSSupported(void)
 {
     int i;
-    DPMSPtr pDPMS;
-    ScrnInfoPtr pScrn;
 
     if (DPMSKey == NULL) {
         return FALSE;
@@ -187,9 +210,11 @@ DPMSSupported(void)
 
     /* For each screen, check if DPMS is supported */
     for (i = 0; i < xf86NumScreens; i++) {
-        pScrn = xf86Screens[i];
-        pDPMS = dixLookupPrivate(&screenInfo.screens[i]->devPrivates, DPMSKey);
-        if (pDPMS && pScrn->DPMSSet)
+        if (DPMSSupportedOnScreen(xf86Screens[i]))
+            return TRUE;
+    }
+    for (i = 0; i < xf86NumGPUScreens; i++) {
+        if (DPMSSupportedOnScreen(xf86GPUScreens[i]))
             return TRUE;
     }
     return FALSE;
index 6601756..7117edf 100644 (file)
@@ -56,6 +56,7 @@
 #include <X11/X.h>
 #include <X11/Xpoll.h>
 #include <X11/Xproto.h>
+#include <X11/Xatom.h>
 #include "misc.h"
 #include "compiler.h"
 #include "xf86.h"
@@ -84,6 +85,9 @@
 #include "dpmsproc.h"
 #endif
 
+#include "xf86platformBus.h"
+#include "systemd-logind.h"
+
 /*
  * This is a toggling variable:
  *  FALSE = No VT switching keys have been pressed last time around
@@ -113,8 +117,9 @@ static void xf86VTSwitch(void);
 typedef struct x_IHRec {
     int fd;
     InputHandlerProc ihproc;
-    pointer data;
+    void *data;
     Bool enabled;
+    Bool is_input;
     struct x_IHRec *next;
 } IHRec, *IHPtr;
 
@@ -161,12 +166,15 @@ ProcessInputEvents(void)
 {
     int x, y;
 
+    TTRACE_INPUT_BEGIN("XORG:SERVER:ProcessInputEvents");
+
     mieqProcessInputEvents();
 
     /* FIXME: This is a problem if we have multiple pointers */
     miPointerGetPosition(inputInfo.pointer, &x, &y);
 
     xf86SetViewport(xf86Info.currentScreen, x, y);
+    TTRACE_INPUT_END();
 }
 
 /*
@@ -180,6 +188,7 @@ xf86ProcessActionEvent(ActionEvent action, void *arg)
     switch (action) {
     case ACTION_TERMINATE:
         if (!xf86Info.dontZap) {
+            xf86Msg(X_INFO, "Server zapped. Shutting down.\n");
 #ifdef XFreeXDGA
             DGAShutdown();
 #endif
@@ -240,7 +249,7 @@ xf86ProcessActionEvent(ActionEvent action, void *arg)
 
 /* ARGSUSED */
 void
-xf86Wakeup(pointer blockData, int err, pointer pReadmask)
+xf86Wakeup(void *blockData, int err, void *pReadmask)
 {
     fd_set *LastSelectMask = (fd_set *) pReadmask;
     fd_set devicesWithInput;
@@ -271,9 +280,9 @@ xf86Wakeup(pointer blockData, int err, pointer pReadmask)
     }
 
     if (err >= 0) {             /* we don't want the handlers called if select() */
-        IHPtr ih;               /* returned with an error condition, do we?      */
+        IHPtr ih, ih_tmp;       /* returned with an error condition, do we?      */
 
-        for (ih = InputHandlers; ih; ih = ih->next) {
+        nt_list_for_each_entry_safe(ih, ih_tmp, InputHandlers, next) {
             if (ih->enabled && ih->fd >= 0 && ih->ihproc &&
                 (FD_ISSET(ih->fd, ((fd_set *) pReadmask)) != 0)) {
                 ih->ihproc(ih->fd, ih->data);
@@ -376,7 +385,7 @@ static void
 xf86ReleaseKeys(DeviceIntPtr pDev)
 {
     KeyClassPtr keyc;
-    int i, sigstate;
+    int i;
 
     if (!pDev || !pDev->key)
         return;
@@ -404,176 +413,239 @@ xf86ReleaseKeys(DeviceIntPtr pDev)
     }
 }
 
+void
+xf86DisableInputDeviceForVTSwitch(InputInfoPtr pInfo)
+{
+    if (!pInfo->dev)
+        return;
+
+    if (!pInfo->dev->enabled)
+        pInfo->flags |= XI86_DEVICE_DISABLED;
+
+    xf86ReleaseKeys(pInfo->dev);
+    ProcessInputEvents();
+    DisableDevice(pInfo->dev, TRUE);
+}
+
+void
+xf86EnableInputDeviceForVTSwitch(InputInfoPtr pInfo)
+{
+    if (pInfo->dev && (pInfo->flags & XI86_DEVICE_DISABLED) == 0)
+        EnableDevice(pInfo->dev, TRUE);
+    pInfo->flags &= ~XI86_DEVICE_DISABLED;
+}
+
 /*
- * xf86VTSwitch --
- *      Handle requests for switching the vt.
+ * xf86UpdateHasVTProperty --
+ *    Update a flag property on the root window to say whether the server VT
+ *    is currently the active one as some clients need to know this.
  */
 static void
-xf86VTSwitch(void)
+xf86UpdateHasVTProperty(Bool hasVT)
 {
+    Atom property_name;
+    int32_t value = hasVT ? 1 : 0;
     int i;
-    static int prevSIGIO;
-    InputInfoPtr pInfo;
-    IHPtr ih;
-
-    DebugF("xf86VTSwitch()\n");
 
-#ifdef XFreeXDGA
-    if (!DGAVTSwitch())
-        return;
-#endif
+    property_name = MakeAtom(HAS_VT_ATOM_NAME, sizeof(HAS_VT_ATOM_NAME) - 1,
+                             FALSE);
+    if (property_name == BAD_RESOURCE)
+        FatalError("Failed to retrieve \"HAS_VT\" atom\n");
+    for (i = 0; i < xf86NumScreens; i++) {
+        ChangeWindowProperty(xf86ScrnToScreen(xf86Screens[i])->root,
+                             property_name, XA_INTEGER, 32,
+                             PropModeReplace, 1, &value, TRUE);
+    }
+}
 
-    /*
-     * Since all screens are currently all in the same state it is sufficient
-     * check the first.  This might change in future.
-     */
-    if (xf86Screens[0]->vtSema) {
+void
+xf86VTLeave(void)
+{
+    int i;
+    InputInfoPtr pInfo;
+    IHPtr ih;
 
-        DebugF("xf86VTSwitch: Leaving, xf86Exiting is %s\n",
-               BOOLTOSTRING((dispatchException & DE_TERMINATE) ? TRUE : FALSE));
+    DebugF("xf86VTSwitch: Leaving, xf86Exiting is %s\n",
+           BOOLTOSTRING((dispatchException & DE_TERMINATE) ? TRUE : FALSE));
 #ifdef DPMSExtension
 #ifdef _F_DPMS_PHONE_CTRL_
-        if (!DPMSPhoneCrtl)
-            if (DPMSPowerLevel != DPMSModeOn)
-                DPMSSet(serverClient, DPMSModeOn);
-#else
+     if (!DPMSPhoneCrtl)
         if (DPMSPowerLevel != DPMSModeOn)
             DPMSSet(serverClient, DPMSModeOn);
+#else
+    if (DPMSPowerLevel != DPMSModeOn)
+        DPMSSet(serverClient, DPMSModeOn);
 #endif
 #endif
-        for (i = 0; i < xf86NumScreens; i++) {
-            if (!(dispatchException & DE_TERMINATE))
-                if (xf86Screens[i]->EnableDisableFBAccess)
-                    (*xf86Screens[i]->EnableDisableFBAccess) (xf86Screens[i], FALSE);
-        }
+    for (i = 0; i < xf86NumScreens; i++) {
+        if (!(dispatchException & DE_TERMINATE))
+            if (xf86Screens[i]->EnableDisableFBAccess)
+                (*xf86Screens[i]->EnableDisableFBAccess) (xf86Screens[i], FALSE);
+    }
 
-        /*
-         * Keep the order: Disable Device > LeaveVT
-         *                        EnterVT > EnableDevice
-         */
-        for (ih = InputHandlers; ih; ih = ih->next)
+    /*
+     * Keep the order: Disable Device > LeaveVT
+     *                        EnterVT > EnableDevice
+     */
+    for (ih = InputHandlers; ih; ih = ih->next) {
+        if (ih->is_input)
             xf86DisableInputHandler(ih);
-        for (pInfo = xf86InputDevs; pInfo; pInfo = pInfo->next) {
-            if (pInfo->dev) {
-                if (!pInfo->dev->enabled)
-                    pInfo->flags |= XI86_DEVICE_DISABLED;
-                xf86ReleaseKeys(pInfo->dev);
-                ProcessInputEvents();
-                DisableDevice(pInfo->dev, TRUE);
-            }
-        }
-
-        OsBlockSIGIO();
-        for (i = 0; i < xf86NumScreens; i++)
-            xf86Screens[i]->LeaveVT(xf86Screens[i]);
-        for (i = 0; i < xf86NumGPUScreens; i++)
-            xf86GPUScreens[i]->LeaveVT(xf86GPUScreens[i]);
-
-        xf86AccessLeave();      /* We need this here, otherwise */
-
-        if (!xf86VTSwitchAway()) {
-            /*
-             * switch failed
-             */
+        else
+            xf86DisableGeneralHandler(ih);
+    }
+    for (pInfo = xf86InputDevs; pInfo; pInfo = pInfo->next)
+        xf86DisableInputDeviceForVTSwitch(pInfo);
 
-            DebugF("xf86VTSwitch: Leave failed\n");
-            xf86AccessEnter();
-            for (i = 0; i < xf86NumScreens; i++) {
-                if (!xf86Screens[i]->EnterVT(xf86Screens[i]))
-                    FatalError("EnterVT failed for screen %d\n", i);
-            }
-            for (i = 0; i < xf86NumGPUScreens; i++) {
-                if (!xf86GPUScreens[i]->EnterVT(xf86GPUScreens[i]))
-                    FatalError("EnterVT failed for gpu screen %d\n", i);
-            }
-            if (!(dispatchException & DE_TERMINATE)) {
-                for (i = 0; i < xf86NumScreens; i++) {
-                    if (xf86Screens[i]->EnableDisableFBAccess)
-                        (*xf86Screens[i]->EnableDisableFBAccess) (xf86Screens[i], TRUE);
-                }
-            }
-            dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset);
+    OsBlockSIGIO();
+    for (i = 0; i < xf86NumScreens; i++)
+        xf86Screens[i]->LeaveVT(xf86Screens[i]);
+    for (i = 0; i < xf86NumGPUScreens; i++)
+        xf86GPUScreens[i]->LeaveVT(xf86GPUScreens[i]);
 
-            pInfo = xf86InputDevs;
-            while (pInfo) {
-                if (pInfo->dev && (pInfo->flags & XI86_DEVICE_DISABLED) == 0)
-                    EnableDevice(pInfo->dev, TRUE);
-                pInfo->flags &= ~XI86_DEVICE_DISABLED;
-                pInfo = pInfo->next;
-            }
-            for (ih = InputHandlers; ih; ih = ih->next)
-                xf86EnableInputHandler(ih);
+    xf86AccessLeave();      /* We need this here, otherwise */
 
-            OsReleaseSIGIO();
+    if (!xf86VTSwitchAway())
+        goto switch_failed;
 
-        }
-        else {
 #ifdef XF86PM
-            if (xf86OSPMClose)
-                xf86OSPMClose();
-            xf86OSPMClose = NULL;
+    if (xf86OSPMClose)
+        xf86OSPMClose();
+    xf86OSPMClose = NULL;
 #endif
 
-            for (i = 0; i < xf86NumScreens; i++) {
-                /*
-                 * zero all access functions to
-                 * trap calls when switched away.
-                 */
-                xf86Screens[i]->vtSema = FALSE;
-            }
-            if (xorgHWAccess)
-                xf86DisableIO();
-        }
+    for (i = 0; i < xf86NumScreens; i++) {
+        /*
+         * zero all access functions to
+         * trap calls when switched away.
+         */
+        xf86Screens[i]->vtSema = FALSE;
     }
-    else {
-        DebugF("xf86VTSwitch: Entering\n");
-        if (!xf86VTSwitchTo())
-            return;
+    if (xorgHWAccess)
+        xf86DisableIO();
 
-#ifdef XF86PM
-        xf86OSPMClose = xf86OSPMOpen();
-#endif
+    xf86UpdateHasVTProperty(FALSE);
 
-        if (xorgHWAccess)
-            xf86EnableIO();
-        xf86AccessEnter();
-        for (i = 0; i < xf86NumScreens; i++) {
-            xf86Screens[i]->vtSema = TRUE;
-            if (!xf86Screens[i]->EnterVT(xf86Screens[i]))
-                FatalError("EnterVT failed for screen %d\n", i);
-        }
-        for (i = 0; i < xf86NumGPUScreens; i++) {
-            xf86GPUScreens[i]->vtSema = TRUE;
-            if (!xf86GPUScreens[i]->EnterVT(xf86GPUScreens[i]))
-                FatalError("EnterVT failed for gpu screen %d\n", i);
-        }
+    return;
+
+switch_failed:
+    DebugF("xf86VTSwitch: Leave failed\n");
+    xf86AccessEnter();
+    for (i = 0; i < xf86NumScreens; i++) {
+        if (!xf86Screens[i]->EnterVT(xf86Screens[i]))
+            FatalError("EnterVT failed for screen %d\n", i);
+    }
+    for (i = 0; i < xf86NumGPUScreens; i++) {
+        if (!xf86GPUScreens[i]->EnterVT(xf86GPUScreens[i]))
+            FatalError("EnterVT failed for gpu screen %d\n", i);
+    }
+    if (!(dispatchException & DE_TERMINATE)) {
         for (i = 0; i < xf86NumScreens; i++) {
             if (xf86Screens[i]->EnableDisableFBAccess)
                 (*xf86Screens[i]->EnableDisableFBAccess) (xf86Screens[i], TRUE);
         }
+    }
+    dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset);
+
+    for (pInfo = xf86InputDevs; pInfo; pInfo = pInfo->next)
+        xf86EnableInputDeviceForVTSwitch(pInfo);
+    for (ih = InputHandlers; ih; ih = ih->next) {
+        if (ih->is_input)
+            xf86EnableInputHandler(ih);
+        else
+            xf86EnableGeneralHandler(ih);
+    }
+    OsReleaseSIGIO();
+}
 
-        /* Turn screen saver off when switching back */
-        dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset);
+void
+xf86VTEnter(void)
+{
+    int i;
+    InputInfoPtr pInfo;
+    IHPtr ih;
 
-        pInfo = xf86InputDevs;
-        while (pInfo) {
-            if (pInfo->dev && (pInfo->flags & XI86_DEVICE_DISABLED) == 0)
-                EnableDevice(pInfo->dev, TRUE);
-            pInfo->flags &= ~XI86_DEVICE_DISABLED;
-            pInfo = pInfo->next;
-        }
+    DebugF("xf86VTSwitch: Entering\n");
+    if (!xf86VTSwitchTo())
+        return;
 
-        for (ih = InputHandlers; ih; ih = ih->next)
-            xf86EnableInputHandler(ih);
+#ifdef XF86PM
+    xf86OSPMClose = xf86OSPMOpen();
+#endif
+
+    if (xorgHWAccess)
+        xf86EnableIO();
+    xf86AccessEnter();
+    for (i = 0; i < xf86NumScreens; i++) {
+        xf86Screens[i]->vtSema = TRUE;
+        if (!xf86Screens[i]->EnterVT(xf86Screens[i]))
+            FatalError("EnterVT failed for screen %d\n", i);
+    }
+    for (i = 0; i < xf86NumGPUScreens; i++) {
+        xf86GPUScreens[i]->vtSema = TRUE;
+        if (!xf86GPUScreens[i]->EnterVT(xf86GPUScreens[i]))
+            FatalError("EnterVT failed for gpu screen %d\n", i);
+    }
+    for (i = 0; i < xf86NumScreens; i++) {
+        if (xf86Screens[i]->EnableDisableFBAccess)
+            (*xf86Screens[i]->EnableDisableFBAccess) (xf86Screens[i], TRUE);
+    }
+
+    /* Turn screen saver off when switching back */
+    dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset);
 
-        OsReleaseSIGIO();
+    /* If we use systemd-logind it will enable input devices for us */
+    if (!systemd_logind_controls_session())
+        for (pInfo = xf86InputDevs; pInfo; pInfo = pInfo->next)
+            xf86EnableInputDeviceForVTSwitch(pInfo);
+
+    for (ih = InputHandlers; ih; ih = ih->next) {
+        if (ih->is_input)
+            xf86EnableInputHandler(ih);
+        else
+            xf86EnableGeneralHandler(ih);
     }
+#ifdef XSERVER_PLATFORM_BUS
+    /* check for any new output devices */
+    xf86platformVTProbe();
+#endif
+
+    xf86UpdateHasVTProperty(TRUE);
+
+    OsReleaseSIGIO();
+}
+
+/*
+ * xf86VTSwitch --
+ *      Handle requests for switching the vt.
+ */
+static void
+xf86VTSwitch(void)
+{
+    DebugF("xf86VTSwitch()\n");
+
+#ifdef XFreeXDGA
+    if (!DGAVTSwitch())
+        return;
+#endif
+
+    /*
+     * Since all screens are currently all in the same state it is sufficient
+     * check the first.  This might change in future.
+     *
+     * VTLeave is always handled here (VT_PROCESS guarantees this is safe),
+     * if we use systemd_logind xf86VTEnter() gets called by systemd-logind.c
+     * once it has resumed all drm nodes.
+     */
+    if (xf86VTOwner())
+        xf86VTLeave();
+    else if (!systemd_logind_controls_session())
+        xf86VTEnter();
 }
 
 /* Input handler registration */
 
-static pointer
-addInputHandler(int fd, InputHandlerProc proc, pointer data)
+static void *
+addInputHandler(int fd, InputHandlerProc proc, void *data)
 {
     IHPtr ih;
 
@@ -595,18 +667,20 @@ addInputHandler(int fd, InputHandlerProc proc, pointer data)
     return ih;
 }
 
-pointer
-xf86AddInputHandler(int fd, InputHandlerProc proc, pointer data)
+void *
+xf86AddInputHandler(int fd, InputHandlerProc proc, void *data)
 {
     IHPtr ih = addInputHandler(fd, proc, data);
 
-    if (ih)
+    if (ih) {
         AddEnabledDevice(fd);
+        ih->is_input = TRUE;
+    }
     return ih;
 }
 
-pointer
-xf86AddGeneralHandler(int fd, InputHandlerProc proc, pointer data)
+void *
+xf86AddGeneralHandler(int fd, InputHandlerProc proc, void *data)
 {
     IHPtr ih = addInputHandler(fd, proc, data);
 
@@ -621,17 +695,19 @@ xf86AddGeneralHandler(int fd, InputHandlerProc proc, pointer data)
  * proc may be NULL if the server should not handle events on the console.
  */
 InputHandlerProc
-xf86SetConsoleHandler(InputHandlerProc proc, pointer data)
+xf86SetConsoleHandler(InputHandlerProc proc, void *data)
 {
     static IHPtr handler = NULL;
-    IHPtr old_handler = handler;
+    InputHandlerProc old_proc = NULL;
 
-    if (old_handler)
-        xf86RemoveGeneralHandler(old_handler);
+    if (handler) {
+        old_proc = handler->ihproc;
+        xf86RemoveGeneralHandler(handler);
+    }
 
     handler = xf86AddGeneralHandler(xf86Info.consoleFd, proc, data);
 
-    return (old_handler) ? old_handler->ihproc : NULL;
+    return old_proc;
 }
 
 static void
@@ -652,7 +728,7 @@ removeInputHandler(IHPtr ih)
 }
 
 int
-xf86RemoveInputHandler(pointer handler)
+xf86RemoveInputHandler(void *handler)
 {
     IHPtr ih;
     int fd;
@@ -671,7 +747,7 @@ xf86RemoveInputHandler(pointer handler)
 }
 
 int
-xf86RemoveGeneralHandler(pointer handler)
+xf86RemoveGeneralHandler(void *handler)
 {
     IHPtr ih;
     int fd;
@@ -690,7 +766,7 @@ xf86RemoveGeneralHandler(pointer handler)
 }
 
 void
-xf86DisableInputHandler(pointer handler)
+xf86DisableInputHandler(void *handler)
 {
     IHPtr ih;
 
@@ -704,7 +780,7 @@ xf86DisableInputHandler(pointer handler)
 }
 
 void
-xf86DisableGeneralHandler(pointer handler)
+xf86DisableGeneralHandler(void *handler)
 {
     IHPtr ih;
 
@@ -718,7 +794,7 @@ xf86DisableGeneralHandler(pointer handler)
 }
 
 void
-xf86EnableInputHandler(pointer handler)
+xf86EnableInputHandler(void *handler)
 {
     IHPtr ih;
 
@@ -732,7 +808,7 @@ xf86EnableInputHandler(pointer handler)
 }
 
 void
-xf86EnableGeneralHandler(pointer handler)
+xf86EnableGeneralHandler(void *handler)
 {
     IHPtr ih;
 
@@ -772,3 +848,12 @@ DDXRingBell(int volume, int pitch, int duration)
 {
     xf86OSRingBell(volume, pitch, duration);
 }
+
+Bool
+xf86VTOwner(void)
+{
+    /* at system startup xf86Screens[0] won't be set - but we will own the VT */
+    if (xf86NumScreens == 0)
+       return TRUE;
+    return xf86Screens[0]->vtSema;
+}
index d5309d5..25b2bc3 100644 (file)
@@ -53,7 +53,7 @@
 /*
  * DDX-specific extensions.
  */
-static ExtensionModule extensionModules[] = {
+static const ExtensionModule extensionModules[] = {
 #ifdef XF86VIDMODE
     {
        XFree86VidModeExtensionInit,
@@ -89,7 +89,6 @@ load_extension_config(void)
 {
     XF86ConfModulePtr mod_con = xf86configptr->conf_modules;
     XF86LoadPtr modp;
-    int i;
 
     /* Only the best. */
     if (!mod_con)
@@ -133,10 +132,7 @@ load_extension_config(void)
 void
 xf86ExtensionInit(void)
 {
-    int i;
-
     load_extension_config();
 
-    for (i = 0; i < ARRAY_SIZE(extensionModules); i++)
-       LoadExtension(&extensionModules[i], TRUE);
+    LoadExtensionList(extensionModules, ARRAY_SIZE(extensionModules), TRUE);
 }
index 7df7a80..984c39b 100644 (file)
@@ -143,7 +143,7 @@ const char *xf86ConfigFile = NULL;
 const char *xf86ConfigDir = NULL;
 const char *xf86ModulePath = DEFAULT_MODULE_PATH;
 MessageType xf86ModPathFrom = X_DEFAULT;
-const char *xf86LogFile = DEFAULT_LOGPREFIX;
+const char *xf86LogFile = DEFAULT_LOGDIR "/" DEFAULT_LOGPREFIX;
 MessageType xf86LogFileFrom = X_DEFAULT;
 Bool xf86LogFileWasOpened = FALSE;
 serverLayoutRec xf86ConfigLayout = { NULL, };
index f681a85..e2b32a0 100644 (file)
@@ -67,7 +67,7 @@ static int xf86ScrnInfoPrivateCount = 0;
 /* Add a pointer to a new DriverRec to xf86DriverList */
 
 void
-xf86AddDriver(DriverPtr driver, pointer module, int flags)
+xf86AddDriver(DriverPtr driver, void *module, int flags)
 {
     /* Don't add null entries */
     if (!driver)
@@ -107,7 +107,7 @@ xf86DeleteDriver(int drvIndex)
 /* Add a pointer to a new InputDriverRec to xf86InputDriverList */
 
 void
-xf86AddInputDriver(InputDriverPtr driver, pointer module, int flags)
+xf86AddInputDriver(InputDriverPtr driver, void *module, int flags)
 {
     /* Don't add null entries */
     if (!driver)
@@ -217,6 +217,10 @@ xf86DeleteScreen(ScrnInfoPtr pScrn)
     int i;
     int scrnIndex;
     Bool is_gpu = FALSE;
+
+    if (!pScrn)
+        return;
+
     if (pScrn->is_gpu) {
         /* First check if the screen is valid */
         if (xf86NumGPUScreens == 0 || xf86GPUScreens == NULL)
@@ -228,9 +232,6 @@ xf86DeleteScreen(ScrnInfoPtr pScrn)
             return;
     }
 
-    if (!pScrn)
-        return;
-
     scrnIndex = pScrn->scrnIndex;
     /* If a FreeScreen function is defined, call it here */
     if (pScrn->FreeScreen != NULL)
@@ -421,7 +422,6 @@ xf86SetDepthBpp(ScrnInfoPtr scrp, int depth, int dummy, int fbbpp,
              * Check for DefaultDepth and DefaultFbBpp options in the
              * Device sections.
              */
-            int i;
             GDevPtr device;
             Bool found = FALSE;
 
@@ -1068,9 +1068,7 @@ void
 xf86EnableDisableFBAccess(ScrnInfoPtr pScrnInfo, Bool enable)
 {
     ScreenPtr pScreen = pScrnInfo->pScreen;
-    PixmapPtr pspix;
 
-    pspix = (*pScreen->GetScreenPixmap) (pScreen);
     if (enable) {
         /*
          * Restore all of the clip lists on the screen
@@ -1219,16 +1217,45 @@ xf86ErrorF(const char *format, ...)
     va_end(ap);
 }
 
+/* Note temporarily modifies the passed in buffer! */
+static void xf86_mkdir_p(char *path)
+{
+    char *sep = path;
+
+    while ((sep = strchr(sep + 1, '/'))) {
+        *sep = 0;
+        (void)mkdir(path, 0777);
+        *sep = '/';
+    }
+    (void)mkdir(path, 0777);
+}
+
 void
 xf86LogInit(void)
 {
-    char *lf = NULL;
+    char *env, *lf = NULL;
+    char buf[PATH_MAX];
 
 #define LOGSUFFIX ".log"
 #define LOGOLDSUFFIX ".old"
 
     /* Get the log file name */
     if (xf86LogFileFrom == X_DEFAULT) {
+        /* When not running as root, we won't be able to write to /var/log */
+        if (geteuid() != 0) {
+            if ((env = getenv("XDG_DATA_HOME")))
+                snprintf(buf, sizeof(buf), "%s/%s", env,
+                         DEFAULT_XDG_DATA_HOME_LOGDIR);
+            else if ((env = getenv("HOME")))
+                snprintf(buf, sizeof(buf), "%s/%s/%s", env,
+                         DEFAULT_XDG_DATA_HOME, DEFAULT_XDG_DATA_HOME_LOGDIR);
+
+            if (env) {
+                xf86_mkdir_p(buf);
+                strlcat(buf, "/" DEFAULT_LOGPREFIX, sizeof(buf));
+                xf86LogFile = buf;
+            }
+        }
         /* Append the display number and ".log" */
         if (asprintf(&lf, "%s%%s" LOGSUFFIX, xf86LogFile) == -1)
             FatalError("Cannot allocate space for the log file name\n");
@@ -1531,15 +1558,15 @@ xf86DisableRandR(void)
 }
 
 CARD32
-xf86GetModuleVersion(pointer module)
+xf86GetModuleVersion(void *module)
 {
     return (CARD32) LoaderGetModuleVersion(module);
 }
 
-pointer
+void *
 xf86LoadDrvSubModule(DriverPtr drv, const char *name)
 {
-    pointer ret;
+    void *ret;
     int errmaj = 0, errmin = 0;
 
     ret = LoadSubModule(drv->module, name, NULL, NULL, NULL, NULL,
@@ -1549,10 +1576,10 @@ xf86LoadDrvSubModule(DriverPtr drv, const char *name)
     return ret;
 }
 
-pointer
+void *
 xf86LoadSubModule(ScrnInfoPtr pScrn, const char *name)
 {
-    pointer ret;
+    void *ret;
     int errmaj = 0, errmin = 0;
 
     ret = LoadSubModule(pScrn->module, name, NULL, NULL, NULL, NULL,
@@ -1565,12 +1592,12 @@ xf86LoadSubModule(ScrnInfoPtr pScrn, const char *name)
 /*
  * xf86LoadOneModule loads a single module.
  */
-pointer
-xf86LoadOneModule(char *name, pointer opt)
+void *
+xf86LoadOneModule(const char *name, void *opt)
 {
     int errmaj, errmin;
     char *Name;
-    pointer mod;
+    void *mod;
 
     if (!name)
         return NULL;
@@ -1594,7 +1621,7 @@ xf86LoadOneModule(char *name, pointer opt)
 }
 
 void
-xf86UnloadSubModule(pointer mod)
+xf86UnloadSubModule(void *mod)
 {
     UnloadSubModule(mod);
 }
@@ -1638,9 +1665,14 @@ xf86SetBackingStore(ScreenPtr pScreen)
     else {
         if (xf86GetOptValBool(options, OPTION_BACKING_STORE, &useBS))
             from = X_CONFIG;
+#ifdef COMPOSITE
+        if (from != X_CONFIG)
+            useBS = xf86ReturnOptValBool(options, OPTION_BACKING_STORE,
+                                         !noCompositeExtension);
+#endif
     }
     free(options);
-    pScreen->backingStoreSupport = useBS ? Always : NotUseful;
+    pScreen->backingStoreSupport = useBS ? WhenMapped : NotUseful;
     if (serverGeneration == 1)
         xf86DrvMsg(pScreen->myNum, from, "Backing store %s\n",
                    useBS ? "enabled" : "disabled");
@@ -1692,9 +1724,9 @@ xf86SetSilkenMouse(ScreenPtr pScreen)
 
 /* Wrote this function for the PM2 Xv driver, preliminary. */
 
-pointer
-xf86FindXvOptions(ScrnInfoPtr pScrn, int adaptor_index, char *port_name,
-                  char **adaptor_name, pointer *adaptor_options)
+void *
+xf86FindXvOptions(ScrnInfoPtr pScrn, int adaptor_index, const char *port_name,
+                  const char **adaptor_name, void **adaptor_options)
 {
     confXvAdaptorPtr adaptor;
     int i;
@@ -1726,7 +1758,7 @@ xf86FindXvOptions(ScrnInfoPtr pScrn, int adaptor_index, char *port_name,
 
 static void
 xf86ConfigFbEntityInactive(EntityInfoPtr pEnt, EntityProc init,
-                           EntityProc enter, EntityProc leave, pointer private)
+                           EntityProc enter, EntityProc leave, void *private)
 {
     ScrnInfoPtr pScrn;
 
@@ -1738,7 +1770,7 @@ xf86ConfigFbEntityInactive(EntityInfoPtr pEnt, EntityProc init,
 ScrnInfoPtr
 xf86ConfigFbEntity(ScrnInfoPtr pScrn, int scrnFlag, int entityIndex,
                    EntityProc init, EntityProc enter, EntityProc leave,
-                   pointer private)
+                   void *private)
 {
     EntityInfoPtr pEnt = xf86GetEntityInfo(entityIndex);
 
@@ -1780,7 +1812,7 @@ xf86IsScreenPrimary(ScrnInfoPtr pScrn)
 
 int
 xf86RegisterRootWindowProperty(int ScrnIndex, Atom property, Atom type,
-                               int format, unsigned long len, pointer value)
+                               int format, unsigned long len, void *value)
 {
     RootWinPropPtr pNewProp = NULL, pRegProp;
     Bool existing = FALSE;
@@ -1812,7 +1844,7 @@ xf86RegisterRootWindowProperty(int ScrnIndex, Atom property, Atom type,
         pNewProp->next = NULL;
     }
     else {
-        free(pNewProp->name);
+        free((void *) pNewProp->name);
         existing = TRUE;
     }
 
@@ -1898,3 +1930,9 @@ xf86ScrnToScreen(ScrnInfoPtr pScrn)
         return screenInfo.screens[pScrn->scrnIndex];
     }
 }
+
+void
+xf86UpdateDesktopDimensions(void)
+{
+    update_desktop_dimensions();
+}
index 5826ac3..b8229d2 100644 (file)
@@ -37,7 +37,4 @@
 extern InputDriverPtr *xf86InputDriverList;
 extern int xf86NumInputDrivers;
 
-/* xf86Helper.c */
-InputDriverPtr xf86LookupInputDriver(const char *name);
-
 #endif                          /* _xf86InPriv_h */
index e4a6b86..5a45004 100644 (file)
@@ -53,6 +53,8 @@
 #include "scrnintstr.h"
 #include "site.h"
 #include "mi.h"
+#include "dbus-core.h"
+#include "systemd-logind.h"
 
 #include "compiler.h"
 
@@ -309,7 +311,7 @@ xf86CreateRootWindow(WindowPtr pWin)
     int err = Success;
     ScreenPtr pScreen = pWin->drawable.pScreen;
     RootWinPropPtr pProp;
-    CreateWindowProcPtr CreateWindow = (CreateWindowProcPtr)
+    CreateWindowProcPtr create_window = (CreateWindowProcPtr)
         dixLookupPrivate(&pScreen->devPrivates, xf86CreateRootWindowKey);
 
     DebugF("xf86CreateRootWindow(%p)\n", pWin);
@@ -323,7 +325,7 @@ xf86CreateRootWindow(WindowPtr pWin)
     }
 
     /* Unhook this function ... */
-    pScreen->CreateWindow = CreateWindow;
+    pScreen->CreateWindow = create_window;
     dixSetPrivate(&pScreen->devPrivates, xf86CreateRootWindowKey, NULL);
 
     /* ... and call the previous CreateWindow fuction, if any */
@@ -385,6 +387,11 @@ InstallSignalHandlers(void)
     }
 }
 
+/* The memory storing the initial value of the XFree86_has_VT root window
+ * property.  This has to remain available until server start-up, so we just
+ * use a global. */
+static CARD32 HasVTValue = 1;
+
 /*
  * InitOutput --
  *     Initialize screenInfo for all actually accessible framebuffers.
@@ -395,13 +402,14 @@ void
 InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv)
 {
     int i, j, k, scr_index;
-    char **modulelist;
-    pointer *optionlist;
+    const char **modulelist;
+    void **optionlist;
     Pix24Flags screenpix24, pix24;
     MessageType pix24From = X_DEFAULT;
     Bool pix24Fail = FALSE;
     Bool autoconfig = FALSE;
     Bool sigio_blocked = FALSE;
+    Bool want_hw_access = FALSE;
     GDevPtr configured_device;
 
     xf86Initialising = TRUE;
@@ -455,6 +463,9 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv)
         if (xf86DoShowOptions)
             DoShowOptions();
 
+        dbus_core_init();
+        systemd_logind_init();
+
         /* Do a general bus probe.  This will be a PCI probe for x86 platforms */
         xf86BusProbe();
 
@@ -530,23 +541,22 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv)
          */
 
         for (i = 0; i < xf86NumDrivers; i++) {
+            xorgHWFlags flags = HW_IO;
+
             if (xf86DriverList[i]->Identify != NULL)
                 xf86DriverList[i]->Identify(0);
 
-            if (!xorgHWAccess || !xorgHWOpenConsole) {
-                xorgHWFlags flags;
+            if (xf86DriverList[i]->driverFunc)
+                xf86DriverList[i]->driverFunc(NULL,
+                                              GET_REQUIRED_HW_INTERFACES,
+                                              &flags);
 
-                if (!xf86DriverList[i]->driverFunc
-                    || !xf86DriverList[i]->driverFunc(NULL,
-                                                      GET_REQUIRED_HW_INTERFACES,
-                                                      &flags))
-                    flags = HW_IO;
+            if (NEED_IO_ENABLED(flags))
+                want_hw_access = TRUE;
 
-                if (NEED_IO_ENABLED(flags))
-                    xorgHWAccess = TRUE;
-                if (!(flags & HW_SKIP_CONSOLE))
-                    xorgHWOpenConsole = TRUE;
-            }
+            /* Non-seat0 X servers should not open console */
+            if (!(flags & HW_SKIP_CONSOLE) && !ServerIsNotSeat0())
+                xorgHWOpenConsole = TRUE;
         }
 
         if (xorgHWOpenConsole)
@@ -554,6 +564,10 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv)
         else
             xf86Info.dontVTSwitch = TRUE;
 
+       /* Enable full I/O access */
+       if (want_hw_access)
+           xorgHWAccess = xf86EnableIO();
+
         if (xf86BusConfig() == FALSE)
             return;
 
@@ -620,7 +634,9 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv)
 
         for (i = 0; i < xf86NumScreens; i++) {
             if (xf86Screens[i]->name == NULL) {
-                XNFasprintf(&xf86Screens[i]->name, "screen%d", i);
+                char *tmp;
+                XNFasprintf(&tmp, "screen%d", i);
+                xf86Screens[i]->name = tmp;
                 xf86MsgVerb(X_WARNING, 0,
                             "Screen driver %d has no name set, using `%s'.\n",
                             i, xf86Screens[i]->name);
@@ -720,7 +736,9 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv)
         if (xf86Info.vtno >= 0) {
 #define VT_ATOM_NAME         "XFree86_VT"
             Atom VTAtom = -1;
+            Atom HasVTAtom = -1;
             CARD32 *VT = NULL;
+            CARD32 *HasVT = &HasVTValue;
             int ret;
 
             /* This memory needs to stay available until the screen has been
@@ -733,6 +751,8 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv)
             *VT = xf86Info.vtno;
 
             VTAtom = MakeAtom(VT_ATOM_NAME, sizeof(VT_ATOM_NAME) - 1, TRUE);
+            HasVTAtom = MakeAtom(HAS_VT_ATOM_NAME,
+                                 sizeof(HAS_VT_ATOM_NAME) - 1, TRUE);
 
             for (i = 0, ret = Success; i < xf86NumScreens && ret == Success;
                  i++) {
@@ -740,9 +760,14 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv)
                     xf86RegisterRootWindowProperty(xf86Screens[i]->scrnIndex,
                                                    VTAtom, XA_INTEGER, 32, 1,
                                                    VT);
+                if (ret == Success)
+                    ret = xf86RegisterRootWindowProperty(xf86Screens[i]
+                                                             ->scrnIndex,
+                                                         HasVTAtom, XA_INTEGER,
+                                                         32, 1, HasVT);
                 if (ret != Success)
                     xf86DrvMsg(xf86Screens[i]->scrnIndex, X_WARNING,
-                               "Failed to register VT property\n");
+                               "Failed to register VT properties\n");
             }
         }
 
@@ -816,7 +841,7 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv)
     if (serverGeneration != 1) {
         xf86Resetting = TRUE;
         /* All screens are in the same state, so just check the first */
-        if (!xf86Screens[0]->vtSema) {
+        if (!xf86VTOwner()) {
 #ifdef HAS_USL_VTS
             ioctl(xf86Info.consoleFd, VT_RELDISP, VT_ACKACQ);
 #endif
@@ -1053,6 +1078,9 @@ ddxGiveUp(enum ExitCode error)
     if (xorgHWOpenConsole)
         xf86CloseConsole();
 
+    systemd_logind_fini();
+    dbus_core_fini();
+
     xf86CloseLog(error);
 
     /* If an unexpected signal was caught, dump a core for debugging */
@@ -1533,10 +1561,10 @@ ddxUseMsg(void)
  * xf86LoadModules iterates over a list that is being passed in.
  */
 Bool
-xf86LoadModules(char **list, pointer *optlist)
+xf86LoadModules(const char **list, void **optlist)
 {
     int errmaj, errmin;
-    pointer opt;
+    void *opt;
     int i;
     char *name;
     Bool failed = FALSE;
index d80dec8..44bc559 100644 (file)
@@ -1354,7 +1354,7 @@ scanLineWidth(unsigned int xsize,       /* pixels */
 
 int
 xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes,
-                  char **modeNames, ClockRangePtr clockRanges,
+                  const char **modeNames, ClockRangePtr clockRanges,
                   int *linePitches, int minPitch, int maxPitch, int pitchInc,
                   int minHeight, int maxHeight, int virtualX, int virtualY,
                   int apertureSize, LookupModeFlags strategy)
@@ -1370,7 +1370,6 @@ xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes,
     int saveType;
     PixmapFormatRec *BankFormat;
     ClockRangePtr cp;
-    ClockRangePtr storeClockRanges;
     int numTimings = 0;
     range hsync[MAX_HSYNC];
     range vrefresh[MAX_VREFRESH];
@@ -1492,16 +1491,14 @@ xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes,
     /*
      * Store the clockRanges for later use by the VidMode extension.
      */
-    storeClockRanges = scrp->clockRanges;
-    while (storeClockRanges != NULL) {
-        storeClockRanges = storeClockRanges->next;
-    }
-    for (cp = clockRanges; cp != NULL; cp = cp->next,
-         storeClockRanges = storeClockRanges->next) {
-        storeClockRanges = xnfalloc(sizeof(ClockRange));
+    nt_list_for_each_entry(cp, clockRanges, next) {
+        ClockRangePtr newCR = xnfalloc(sizeof(ClockRange));
+        memcpy(newCR, cp, sizeof(ClockRange));
+        newCR->next = NULL;
         if (scrp->clockRanges == NULL)
-            scrp->clockRanges = storeClockRanges;
-        memcpy(storeClockRanges, cp, sizeof(ClockRange));
+            scrp->clockRanges = newCR;
+        else
+            nt_list_append(newCR, scrp->clockRanges, ClockRange, next);
     }
 
     /* Determine which pixmap format to pass to scanLineWidth() */
@@ -2001,7 +1998,7 @@ xf86DeleteMode(DisplayModePtr * modeList, DisplayModePtr mode)
             mode->next->prev = mode->prev;
     }
 
-    free(mode->name);
+    free((void *) mode->name);
     free(mode);
 }
 
index 83f9790..b848f53 100644 (file)
@@ -80,9 +80,9 @@ typedef enum {
  * mask is 0xFFFF0000.
  */
 #define ABI_ANSIC_VERSION      SET_ABI_VERSION(0, 4)
-#define ABI_VIDEODRV_VERSION   SET_ABI_VERSION(13, 0)
-#define ABI_XINPUT_VERSION     SET_ABI_VERSION(18, 0)
-#define ABI_EXTENSION_VERSION  SET_ABI_VERSION(7, 0)
+#define ABI_VIDEODRV_VERSION   SET_ABI_VERSION(18, 0)
+#define ABI_XINPUT_VERSION     SET_ABI_VERSION(21, 0)
+#define ABI_EXTENSION_VERSION  SET_ABI_VERSION(8, 0)
 #define ABI_FONT_VERSION       SET_ABI_VERSION(0, 6)
 
 #define MODINFOSTRING1 0xef23fdc5
@@ -170,13 +170,13 @@ typedef struct {
 #define INITARGS void
 
 /* Prototypes for Loader functions that are exported to modules */
-extern _X_EXPORT pointer LoadSubModule(pointer, const char *, const char **,
-                                       const char **, pointer,
+extern _X_EXPORT void *LoadSubModule(void *, const char *, const char **,
+                                       const char **, void *,
                                        const XF86ModReqInfo *, int *, int *);
-extern _X_EXPORT void UnloadSubModule(pointer);
-extern _X_EXPORT void UnloadModule(pointer);
-extern _X_EXPORT pointer LoaderSymbol(const char *);
-extern _X_EXPORT char **LoaderListDirs(const char **, const char **);
+extern _X_EXPORT void UnloadSubModule(void *);
+extern _X_EXPORT void UnloadModule(void *);
+extern _X_EXPORT void *LoaderSymbol(const char *);
+extern _X_EXPORT const char **LoaderListDirs(const char **, const char **);
 extern _X_EXPORT void LoaderFreeDirList(char **);
 extern _X_EXPORT void LoaderErrorMsg(const char *, const char *, int, int);
 extern _X_EXPORT void LoaderGetOS(const char **name, int *major, int *minor,
@@ -184,11 +184,11 @@ extern _X_EXPORT void LoaderGetOS(const char **name, int *major, int *minor,
 extern _X_EXPORT Bool LoaderShouldIgnoreABI(void);
 extern _X_EXPORT int LoaderGetABIVersion(const char *abiclass);
 
-typedef pointer (*ModuleSetupProc) (pointer, pointer, int *, int *);
-typedef void (*ModuleTearDownProc) (pointer);
+typedef void *(*ModuleSetupProc) (void *, void *, int *, int *);
+typedef void (*ModuleTearDownProc) (void *);
 
-#define MODULESETUPPROTO(func) pointer func(pointer, pointer, int*, int*)
-#define MODULETEARDOWNPROTO(func) void func(pointer)
+#define MODULESETUPPROTO(func) void *func(void *, void *, int*, int*)
+#define MODULETEARDOWNPROTO(func) void func(void *)
 
 typedef struct {
     XF86ModuleVersionInfo *vers;
index 0d808de..3be2a0f 100644 (file)
@@ -39,7 +39,7 @@ typedef struct {
 
 typedef union {
     unsigned long num;
-    char *str;
+    const char *str;
     double realnum;
     Bool bool;
     OptFrequency freq;
@@ -85,7 +85,7 @@ extern _X_EXPORT int xf86CheckIntOption(XF86OptionPtr optlist, const char *name,
 extern _X_EXPORT double xf86CheckRealOption(XF86OptionPtr optlist,
                                             const char *name, double deflt);
 extern _X_EXPORT char *xf86CheckStrOption(XF86OptionPtr optlist,
-                                          const char *name, char *deflt);
+                                          const char *name, const char *deflt);
 extern _X_EXPORT int xf86CheckBoolOption(XF86OptionPtr list, const char *name,
                                          int deflt);
 extern _X_EXPORT double xf86CheckPercentOption(XF86OptionPtr list,
@@ -123,7 +123,7 @@ extern _X_EXPORT OptionInfoPtr xf86TokenToOptinfo(const OptionInfoRec * table,
 extern _X_EXPORT const char *xf86TokenToOptName(const OptionInfoRec * table,
                                                 int token);
 extern _X_EXPORT Bool xf86IsOptionSet(const OptionInfoRec * table, int token);
-extern _X_EXPORT char *xf86GetOptValString(const OptionInfoRec * table,
+extern _X_EXPORT const char *xf86GetOptValString(const OptionInfoRec * table,
                                            int token);
 extern _X_EXPORT Bool xf86GetOptValInteger(const OptionInfoRec * table,
                                            int token, int *value);
index 7cc7440..0e8bc1f 100644 (file)
@@ -276,7 +276,7 @@ xf86CheckRealOption(XF86OptionPtr optlist, const char *name, double deflt)
 }
 
 char *
-xf86CheckStrOption(XF86OptionPtr optlist, const char *name, char *deflt)
+xf86CheckStrOption(XF86OptionPtr optlist, const char *name, const char *deflt)
 {
     return LookupStrOption(optlist, name, deflt, FALSE);
 }
@@ -478,7 +478,8 @@ static Bool
 ParseOptionValue(int scrnIndex, XF86OptionPtr options, OptionInfoPtr p,
                  Bool markUsed)
 {
-    char *s, *end;
+    const char *s;
+    char *end;
     Bool wasUsed = FALSE;
 
     if ((s = xf86findOptionValue(options, p->name)) != NULL) {
@@ -515,7 +516,7 @@ ParseOptionValue(int scrnIndex, XF86OptionPtr options, OptionInfoPtr p,
             if (*s == '\0') {
                 if (markUsed) {
                     xf86DrvMsg(scrnIndex, X_WARNING,
-                               "Option \"%s\" requires an string value\n",
+                               "Option \"%s\" requires a string value\n",
                                p->name);
                 }
                 p->found = FALSE;
@@ -743,7 +744,7 @@ xf86TokenToOptName(const OptionInfoRec * table, int token)
     const OptionInfoRec *p;
 
     p = xf86TokenToOptinfo(table, token);
-    return p->name;
+    return p ? p->name : NULL;
 }
 
 Bool
@@ -755,7 +756,7 @@ xf86IsOptionSet(const OptionInfoRec * table, int token)
     return p && p->found;
 }
 
-char *
+const char *
 xf86GetOptValString(const OptionInfoRec * table, int token)
 {
     OptionInfoPtr p;
index c38499c..4ef917d 100644 (file)
  */
 typedef struct _XF86OptionRec {
     GenericListRec list;
-    char *opt_name;
-    char *opt_val;
+    const char *opt_name;
+    const char *opt_val;
     int opt_used;
-    char *opt_comment;
+    const char *opt_comment;
 } XF86OptionRec;
 
 typedef struct _InputOption *XF86OptionPtr;
index 15257cb..9e49e8e 100644 (file)
@@ -196,7 +196,7 @@ DoApmEvent(pmEvent event, Bool undo)
 #define MAX_NO_EVENTS 8
 
 void
-xf86HandlePMEvents(int fd, pointer data)
+xf86HandlePMEvents(int fd, void *data)
 {
     pmEvent events[MAX_NO_EVENTS];
     int i, n;
index c9f2e7e..6e374eb 100644 (file)
@@ -91,7 +91,6 @@ extern _X_EXPORT int xf86NumScreens;
 extern _X_EXPORT const char *xf86VisualNames[];
 extern _X_EXPORT int xf86Verbose;       /* verbosity level */
 extern _X_EXPORT int xf86LogVerbose;    /* log file verbosity level */
-extern _X_EXPORT Bool xorgHWAccess;
 
 extern _X_EXPORT RootWinPropPtr *xf86RegisteredPropertiesTable;
 
@@ -140,11 +139,11 @@ DoShowOptions(void)
 /* xf86Events.c */
 
 extern _X_EXPORT void
-xf86Wakeup(pointer blockData, int err, pointer pReadmask);
+xf86Wakeup(void *blockData, int err, void *pReadmask);
 extern _X_HIDDEN int
 xf86SigWrapper(int signo);
 extern _X_EXPORT void
-xf86HandlePMEvents(int fd, pointer data);
+xf86HandlePMEvents(int fd, void *data);
 extern _X_EXPORT int (*xf86PMGetEventFromOs) (int fd, pmEvent * events,
                                               int num);
 extern _X_EXPORT pmWait (*xf86PMConfirmEventToOs) (int fd, pmEvent event);
@@ -157,7 +156,7 @@ xf86CloseLog(enum ExitCode error);
 
 /* xf86Init.c */
 extern _X_EXPORT Bool
-xf86LoadModules(char **list, pointer *optlist);
+xf86LoadModules(const char **list, void **optlist);
 extern _X_EXPORT int
 xf86SetVerbosity(int verb);
 extern _X_EXPORT int
index e20be03..410ef17 100644 (file)
@@ -136,11 +136,11 @@ typedef struct {
 /* Information for root window properties. */
 typedef struct _RootWinProp {
     struct _RootWinProp *next;
-    char *name;
+    const char *name;
     Atom type;
     short format;
     long size;
-    pointer data;
+    void *data;
 } RootWinProp, *RootWinPropPtr;
 
 /* ISC's cc can't handle ~ of UL constants, so explicitly type cast them. */
@@ -163,4 +163,8 @@ typedef struct _RootWinProp {
 #define WSCONS           32
 #endif
 
+/* Root window property to tell clients whether our VT is currently active.
+ * Name chosen to match the "XFree86_VT" property. */
+#define HAS_VT_ATOM_NAME "XFree86_has_VT"
+
 #endif                          /* _XF86PRIVSTR_H */
index 5606bee..2418731 100644 (file)
@@ -214,13 +214,15 @@ xf86RandRSetMode(ScreenPtr pScreen,
      */
     xf86ReconfigureLayout();
 
-    /*
-     * Make sure the whole screen is visible
-     */
-    xf86SetViewport(pScreen, pScreen->width, pScreen->height);
-    xf86SetViewport(pScreen, 0, 0);
-    if (pRoot && scrp->vtSema)
-        (*scrp->EnableDisableFBAccess) (scrp, TRUE);
+    if (scrp->vtSema) {
+        /*
+         * Make sure the whole screen is visible
+         */
+        xf86SetViewport (pScreen, pScreen->width, pScreen->height);
+        xf86SetViewport (pScreen, 0, 0);
+        if (pRoot)
+            (*scrp->EnableDisableFBAccess) (scrp, TRUE);
+    }
     return ret;
 }
 
index 225fff0..5cc2429 100644 (file)
@@ -257,7 +257,7 @@ VGAarbiterCloseScreen(ScreenPtr pScreen)
     UNWRAP_SCREEN_INFO(FreeScreen);
     UNWRAP_SPRITE;
 
-    free((pointer) pScreenPriv);
+    free((void *) pScreenPriv);
     xf86VGAarbiterLock(xf86ScreenToScrn(pScreen));
     val = (*pScreen->CloseScreen) (pScreen);
     xf86VGAarbiterUnlock(xf86ScreenToScrn(pScreen));
@@ -266,7 +266,7 @@ VGAarbiterCloseScreen(ScreenPtr pScreen)
 
 static void
 VGAarbiterBlockHandler(ScreenPtr pScreen,
-                       pointer pTimeout, pointer pReadmask)
+                       void *pTimeout, void *pReadmask)
 {
     SCREEN_PROLOG(BlockHandler);
     VGAGet(pScreen);
@@ -277,7 +277,7 @@ VGAarbiterBlockHandler(ScreenPtr pScreen,
 
 static void
 VGAarbiterWakeupHandler(ScreenPtr pScreen, unsigned long result,
-                        pointer pReadmask)
+                        void *pReadmask)
 {
     SCREEN_PROLOG(WakeupHandler);
     VGAGet(pScreen);
@@ -586,7 +586,7 @@ VGAarbiterCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst)
 }
 
 static void
-VGAarbiterChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects)
+VGAarbiterChangeClip(GCPtr pGC, int type, void *pvalue, int nrects)
 {
     GC_UNWRAP(pGC);
     (*pGC->funcs->ChangeClip) (pGC, type, pvalue, nrects);
@@ -860,7 +860,7 @@ VGAarbiterImageGlyphBlt(DrawablePtr pDraw,
                         GCPtr pGC,
                         int xInit, int yInit,
                         unsigned int nglyph,
-                        CharInfoPtr * ppci, pointer pglyphBase)
+                        CharInfoPtr * ppci, void *pglyphBase)
 {
     ScreenPtr pScreen = pGC->pScreen;
 
@@ -877,7 +877,7 @@ VGAarbiterPolyGlyphBlt(DrawablePtr pDraw,
                        GCPtr pGC,
                        int xInit, int yInit,
                        unsigned int nglyph,
-                       CharInfoPtr * ppci, pointer pglyphBase)
+                       CharInfoPtr * ppci, void *pglyphBase)
 {
     ScreenPtr pScreen = pGC->pScreen;
 
index ba6edfc..ec21bc2 100644 (file)
@@ -137,15 +137,15 @@ typedef struct _VGAarbiterScreen {
 } VGAarbiterScreenRec, *VGAarbiterScreenPtr;
 
 typedef struct _VGAarbiterGC {
-    GCOps *wrapOps;
-    GCFuncs *wrapFuncs;
+    const GCOps *wrapOps;
+    const GCFuncs *wrapFuncs;
 } VGAarbiterGCRec, *VGAarbiterGCPtr;
 
 /* Screen funcs */
-static void VGAarbiterBlockHandler(ScreenPtr pScreen, pointer pTimeout,
-                                   pointer pReadmask);
+static void VGAarbiterBlockHandler(ScreenPtr pScreen, void *pTimeout,
+                                   void *pReadmask);
 static void VGAarbiterWakeupHandler(ScreenPtr pScreen,
-                                    unsigned long result, pointer pReadmask);
+                                    unsigned long result, void *pReadmask);
 static Bool VGAarbiterCloseScreen(ScreenPtr pScreen);
 static void VGAarbiterGetImage(DrawablePtr pDrawable, int sx, int sy, int w,
                                int h, unsigned int format,
@@ -188,7 +188,7 @@ static void VGAarbiterValidateGC(GCPtr pGC, unsigned long changes,
 static void VGAarbiterChangeGC(GCPtr pGC, unsigned long mask);
 static void VGAarbiterCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst);
 static void VGAarbiterDestroyGC(GCPtr pGC);
-static void VGAarbiterChangeClip(GCPtr pGC, int type, pointer pvalue,
+static void VGAarbiterChangeClip(GCPtr pGC, int type, void *pvalue,
                                  int nrects);
 static void VGAarbiterDestroyClip(GCPtr pGC);
 static void VGAarbiterCopyClip(GCPtr pgcDst, GCPtr pgcSrc);
@@ -236,10 +236,10 @@ static void VGAarbiterImageText16(DrawablePtr pDraw, GCPtr pGC, int x, int y,
                                   int count, unsigned short *chars);
 static void VGAarbiterImageGlyphBlt(DrawablePtr pDraw, GCPtr pGC, int xInit,
                                     int yInit, unsigned int nglyph,
-                                    CharInfoPtr * ppci, pointer pglyphBase);
+                                    CharInfoPtr * ppci, void *pglyphBase);
 static void VGAarbiterPolyGlyphBlt(DrawablePtr pDraw, GCPtr pGC, int xInit,
                                    int yInit, unsigned int nglyph,
-                                   CharInfoPtr * ppci, pointer pglyphBase);
+                                   CharInfoPtr * ppci, void *pglyphBase);
 static void VGAarbiterPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr
                                  pDraw, int dx, int dy, int xOrg, int yOrg);
 
index a7d1c25..e708b27 100644 (file)
@@ -138,7 +138,7 @@ VidModeAvailable(int scrnIndex)
 }
 
 Bool
-VidModeGetCurrentModeline(int scrnIndex, pointer *mode, int *dotClock)
+VidModeGetCurrentModeline(int scrnIndex, void **mode, int *dotClock)
 {
     ScrnInfoPtr pScrn;
 
@@ -148,7 +148,7 @@ VidModeGetCurrentModeline(int scrnIndex, pointer *mode, int *dotClock)
     pScrn = xf86Screens[scrnIndex];
 
     if (pScrn->currentMode) {
-        *mode = (pointer) (pScrn->currentMode);
+        *mode = (void *) (pScrn->currentMode);
         *dotClock = pScrn->currentMode->Clock;
 
         return TRUE;
@@ -211,7 +211,7 @@ VidModeGetClocks(int scrnIndex, int *Clocks)
 }
 
 Bool
-VidModeGetFirstModeline(int scrnIndex, pointer *mode, int *dotClock)
+VidModeGetFirstModeline(int scrnIndex, void **mode, int *dotClock)
 {
     ScrnInfoPtr pScrn;
     VidModePtr pVidMode;
@@ -228,7 +228,7 @@ VidModeGetFirstModeline(int scrnIndex, pointer *mode, int *dotClock)
     pVidMode->Next = pVidMode->First->next;
 
     if (pVidMode->First->status == MODE_OK) {
-        *mode = (pointer) (pVidMode->First);
+        *mode = (void *) (pVidMode->First);
         *dotClock = VidModeGetDotClock(scrnIndex, pVidMode->First->Clock);
         return TRUE;
     }
@@ -237,7 +237,7 @@ VidModeGetFirstModeline(int scrnIndex, pointer *mode, int *dotClock)
 }
 
 Bool
-VidModeGetNextModeline(int scrnIndex, pointer *mode, int *dotClock)
+VidModeGetNextModeline(int scrnIndex, void **mode, int *dotClock)
 {
     ScrnInfoPtr pScrn;
     VidModePtr pVidMode;
@@ -252,7 +252,7 @@ VidModeGetNextModeline(int scrnIndex, pointer *mode, int *dotClock)
     for (p = pVidMode->Next; p != NULL && p != pVidMode->First; p = p->next) {
         if (p->status == MODE_OK) {
             pVidMode->Next = p->next;
-            *mode = (pointer) p;
+            *mode = (void *) p;
             *dotClock = VidModeGetDotClock(scrnIndex, p->Clock);
             return TRUE;
         }
@@ -262,7 +262,7 @@ VidModeGetNextModeline(int scrnIndex, pointer *mode, int *dotClock)
 }
 
 Bool
-VidModeDeleteModeline(int scrnIndex, pointer mode)
+VidModeDeleteModeline(int scrnIndex, void *mode)
 {
     ScrnInfoPtr pScrn;
 
@@ -323,7 +323,7 @@ VidModeGetViewPort(int scrnIndex, int *x, int *y)
 }
 
 Bool
-VidModeSwitchMode(int scrnIndex, pointer mode)
+VidModeSwitchMode(int scrnIndex, void *mode)
 {
     ScrnInfoPtr pScrn;
     DisplayModePtr pTmpMode;
@@ -362,7 +362,7 @@ VidModeLockZoom(int scrnIndex, Bool lock)
 }
 
 Bool
-VidModeGetMonitor(int scrnIndex, pointer *monitor)
+VidModeGetMonitor(int scrnIndex, void **monitor)
 {
     ScrnInfoPtr pScrn;
 
@@ -370,13 +370,13 @@ VidModeGetMonitor(int scrnIndex, pointer *monitor)
         return FALSE;
 
     pScrn = xf86Screens[scrnIndex];
-    *monitor = (pointer) (pScrn->monitor);
+    *monitor = (void *) (pScrn->monitor);
 
     return TRUE;
 }
 
 ModeStatus
-VidModeCheckModeForMonitor(int scrnIndex, pointer mode)
+VidModeCheckModeForMonitor(int scrnIndex, void *mode)
 {
     ScrnInfoPtr pScrn;
 
@@ -389,7 +389,7 @@ VidModeCheckModeForMonitor(int scrnIndex, pointer mode)
 }
 
 ModeStatus
-VidModeCheckModeForDriver(int scrnIndex, pointer mode)
+VidModeCheckModeForDriver(int scrnIndex, void *mode)
 {
     ScrnInfoPtr pScrn;
 
@@ -402,7 +402,7 @@ VidModeCheckModeForDriver(int scrnIndex, pointer mode)
 }
 
 void
-VidModeSetCrtcForMode(int scrnIndex, pointer mode)
+VidModeSetCrtcForMode(int scrnIndex, void *mode)
 {
     ScrnInfoPtr pScrn;
     DisplayModePtr ScreenModes;
@@ -421,7 +421,7 @@ VidModeSetCrtcForMode(int scrnIndex, pointer mode)
 }
 
 Bool
-VidModeAddModeline(int scrnIndex, pointer mode)
+VidModeAddModeline(int scrnIndex, void *mode)
 {
     ScrnInfoPtr pScrn;
 
@@ -444,7 +444,7 @@ VidModeAddModeline(int scrnIndex, pointer mode)
 int
 VidModeGetNumOfModes(int scrnIndex)
 {
-    pointer mode = NULL;
+    void *mode = NULL;
     int dotClock = 0, nummodes = 0;
 
     if (!VidModeGetFirstModeline(scrnIndex, &mode, &dotClock))
@@ -526,7 +526,7 @@ VidModeGetGammaRampSize(int scrnIndex)
     return xf86GetGammaRampSize(xf86Screens[scrnIndex]->pScreen);
 }
 
-pointer
+void *
 VidModeCreateMode(void)
 {
     DisplayModePtr mode;
@@ -543,13 +543,13 @@ VidModeCreateMode(void)
 }
 
 void
-VidModeCopyMode(pointer modefrom, pointer modeto)
+VidModeCopyMode(void *modefrom, void *modeto)
 {
     memcpy(modeto, modefrom, sizeof(DisplayModeRec));
 }
 
 int
-VidModeGetModeValue(pointer mode, int valtyp)
+VidModeGetModeValue(void *mode, int valtyp)
 {
     int ret = 0;
 
@@ -592,7 +592,7 @@ VidModeGetModeValue(pointer mode, int valtyp)
 }
 
 void
-VidModeSetModeValue(pointer mode, int valtyp, int val)
+VidModeSetModeValue(void *mode, int valtyp, int val)
 {
     switch (valtyp) {
     case VIDMODE_H_DISPLAY:
@@ -633,7 +633,7 @@ VidModeSetModeValue(pointer mode, int valtyp, int val)
 }
 
 vidMonitorValue
-VidModeGetMonitorValue(pointer monitor, int valtyp, int indx)
+VidModeGetMonitorValue(void *monitor, int valtyp, int indx)
 {
     vidMonitorValue ret = { NULL, };
 
old mode 100644 (file)
new mode 100755 (executable)
index bee407b..7e9fa37
@@ -63,6 +63,7 @@
 #include "mipointer.h"
 #include "extinit.h"
 #include "loaderProcs.h"
+#include "systemd-logind.h"
 
 #include "exevents.h"           /* AddInputDevice */
 #include "exglobals.h"
 
 #include <stdarg.h>
 #include <stdint.h>             /* for int64_t */
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#ifdef HAVE_SYS_MKDEV_H
+#include <sys/mkdev.h>          /* for major() & minor() on Solaris */
+#endif
 
 #include "mi.h"
 
 static int
  xf86InputDevicePostInit(DeviceIntPtr dev);
 
+static InputInfoPtr *new_input_devices;
+static int new_input_devices_count;
+
 /**
  * Eval config and modify DeviceVelocityRec accordingly
  */
+
+#ifdef _F_GLOBAL_CURSOR_STATE_
+/* Defined to block/unblock core  devices  */
+extern int global_device_state;
+#endif //_F_GLOBAL_CURSOR_STATE_
+
 static void
-ProcessVelocityConfiguration(DeviceIntPtr pDev, char *devname, pointer list,
+ProcessVelocityConfiguration(DeviceIntPtr pDev, const char *devname, void *list,
                              DeviceVelocityPtr s)
 {
     int tempi;
@@ -661,7 +677,7 @@ MergeInputClasses(const InputInfoPtr idev, const InputAttributes * attrs)
         /* Collect class options and driver settings */
         classopts = xf86optionListDup(cl->option_lst);
         if (cl->driver) {
-            free(idev->driver);
+            free((void *) idev->driver);
             idev->driver = xstrdup(cl->driver);
             if (!idev->driver) {
                 xf86Msg(X_ERROR, "Failed to allocate memory while merging "
@@ -753,13 +769,11 @@ xf86DeleteInput(InputInfoPtr pInp, int flags)
     if (pInp->module)
         UnloadModule(pInp->module);
 
-    /* This should *really* be handled in drv->UnInit(dev) call instead, but
-     * if the driver forgets about it make sure we free it or at least crash
-     * with flying colors */
-    free(pInp->private);
-
     FreeInputAttributes(pInp->attrs);
 
+    if (pInp->flags & XI86_SERVER_FD)
+        systemd_logind_release_fd(pInp->major, pInp->minor, pInp->fd);
+
     /* Remove the entry from the list. */
     if (pInp == xf86InputDevs)
         xf86InputDevs = pInp->next;
@@ -773,8 +787,8 @@ xf86DeleteInput(InputInfoPtr pInp, int flags)
         /* Else the entry wasn't in the xf86InputDevs list (ignore this). */
     }
 
-    free(pInp->driver);
-    free(pInp->name);
+    free((void *) pInp->driver);
+    free((void *) pInp->name);
     xf86optionListFree(pInp->options);
     free(pInp);
 }
@@ -794,6 +808,18 @@ xf86InputDevicePostInit(DeviceIntPtr dev)
     return Success;
 }
 
+static void
+xf86stat(const char *path, int *maj, int *min)
+{
+    struct stat st;
+
+    if (stat(path, &st) == -1)
+        return;
+
+    *maj = major(st.st_rdev);
+    *min = minor(st.st_rdev);
+}
+
 /**
  * Create a new input device, activate and enable it.
  *
@@ -816,7 +842,9 @@ xf86NewInputDevice(InputInfoPtr pInfo, DeviceIntPtr *pdev, BOOL enable)
 {
     InputDriverPtr drv = NULL;
     DeviceIntPtr dev = NULL;
+    Bool paused;
     int rval;
+    const char *path;
 
     /* Memory leak for every attached device if we don't
      * test if the module is already loaded first */
@@ -830,6 +858,29 @@ xf86NewInputDevice(InputInfoPtr pInfo, DeviceIntPtr *pdev, BOOL enable)
         goto unwind;
     }
 
+    path = xf86CheckStrOption(pInfo->options, "Device", NULL);
+    if (path && pInfo->major == 0 && pInfo->minor == 0)
+        xf86stat(path, &pInfo->major, &pInfo->minor);
+
+    if (path && (drv->capabilities & XI86_DRV_CAP_SERVER_FD)){
+        int fd = systemd_logind_take_fd(pInfo->major, pInfo->minor,
+                                        path, &paused);
+        if (fd != -1) {
+            if (paused) {
+                /* Put on new_input_devices list for delayed probe */
+                new_input_devices = xnfrealloc(new_input_devices,
+                            sizeof(pInfo) * (new_input_devices_count + 1));
+                new_input_devices[new_input_devices_count] = pInfo;
+                new_input_devices_count++;
+                systemd_logind_release_fd(pInfo->major, pInfo->minor, fd);
+                return BadMatch;
+            }
+            pInfo->fd = fd;
+            pInfo->flags |= XI86_SERVER_FD;
+            pInfo->options = xf86ReplaceIntOption(pInfo->options, "fd", fd);
+        }
+    }
+
     xf86Msg(X_INFO, "Using input driver '%s' for '%s'\n", drv->driverName,
             pInfo->name);
 
@@ -870,7 +921,7 @@ xf86NewInputDevice(InputInfoPtr pInfo, DeviceIntPtr *pdev, BOOL enable)
     }
 
     /* Enable it if it's properly initialised and we're currently in the VT */
-    if (enable && dev->inited && dev->startup && xf86Screens[0]->vtSema) {
+    if (enable && dev->inited && dev->startup && xf86VTOwner()) {
         OsBlockSignals();
         EnableDevice(dev, TRUE);
         if (!dev->enabled) {
@@ -949,6 +1000,12 @@ NewInputDeviceRequest(InputOption *options, InputAttributes * attrs,
                 goto unwind;
             }
         }
+
+        if (strcmp(key, "major") == 0)
+            pInfo->major = atoi(value);
+
+        if (strcmp(key, "minor") == 0)
+            pInfo->minor = atoi(value);
     }
 
     nt_list_for_each_entry(option, options, list.next) {
@@ -1067,7 +1124,7 @@ xf86CheckMotionEvent4DGA(DeviceIntPtr device, int is_absolute,
 
 #if XFreeXDGA
     ScreenPtr scr = NULL;
-    int idx, i;
+    int idx = 0, i;
 
     /* The evdev driver may not always send all axes across. */
     if (valuator_mask_isset(mask, 0) || valuator_mask_isset(mask, 1)) {
@@ -1157,6 +1214,12 @@ xf86PostMotionEventM(DeviceIntPtr device,
         else
             flags = POINTER_RELATIVE | POINTER_ACCELERATE;
     }
+#ifdef _F_GLOBAL_CURSOR_STATE_
+    if(global_device_state){
+       if(strstr(device->name,"USB Optical Mouse") !=NULL)
+         return ;
+    }
+#endif //_F_GLOBAL_CURSOR_STATE_
 
     QueuePointerEvents(device, MotionNotify, 0, flags, mask);
 }
@@ -1208,6 +1271,12 @@ xf86PostButtonEvent(DeviceIntPtr device,
                     int button,
                     int is_down, int first_valuator, int num_valuators, ...)
 {
+#ifdef _F_GLOBAL_CURSOR_STATE_
+    if(global_device_state){
+        if(strstr(device->name,"USB Optical Mouse") !=NULL)
+           return ;
+       }
+#endif //_F_GLOBAL_CURSOR_STATE_
     va_list var;
     ValuatorMask mask;
     int i = 0;
@@ -1333,6 +1402,13 @@ xf86PostKeyEventM(DeviceIntPtr device,
 void
 xf86PostKeyboardEvent(DeviceIntPtr device, unsigned int key_code, int is_down)
 {
+#ifdef _F_GLOBAL_CURSOR_STATE_
+   if(global_device_state) {
+        if(strstr(device->name,"USB Keyboard") !=NULL)
+               return ;
+    }
+#endif //_F_GLOBAL_CURSOR_STATE_
+
     ValuatorMask mask;
 
     valuator_mask_zero(&mask);
@@ -1469,4 +1545,32 @@ xf86PostTouchEvent(DeviceIntPtr dev, uint32_t touchid, uint16_t type,
     QueueTouchEvents(dev, type, touchid, flags, mask);
 }
 
+void
+xf86InputEnableVTProbe(void)
+{
+    int i, is_auto = 0;
+    InputOption *option = NULL;
+    DeviceIntPtr pdev;
+
+    for (i = 0; i < new_input_devices_count; i++) {
+        InputInfoPtr pInfo = new_input_devices[i];
+
+        is_auto = 0;
+        nt_list_for_each_entry(option, pInfo->options, list.next) {
+            const char *key = input_option_get_key(option);
+            const char *value = input_option_get_value(option);
+
+            if (strcmp(key, "_source") == 0 &&
+                (strcmp(value, "server/hal") == 0 ||
+                 strcmp(value, "server/udev") == 0 ||
+                 strcmp(value, "server/wscons") == 0))
+                is_auto = 1;
+        }
+        xf86NewInputDevice(pInfo, &pdev,
+                                  (!is_auto ||
+                                   (is_auto && xf86Info.autoEnableDevices)));
+    }
+    new_input_devices_count = 0;
+}
+
 /* end of xf86Xinput.c */
old mode 100644 (file)
new mode 100755 (executable)
index 35c38a5..9fe8c87
 /* 0x08 is reserved for legacy XI86_SEND_DRAG_EVENTS, do not use for now */
 /* server-internal only */
 #define XI86_DEVICE_DISABLED    0x10    /* device was disabled before vt switch */
+#define XI86_SERVER_FD         0x20    /* fd is managed by xserver */
+
+/* Input device driver capabilities */
+#define XI86_DRV_CAP_SERVER_FD 0x01
 
 /* This holds the input driver entry and module information. */
 typedef struct _InputDriverRec {
@@ -74,8 +78,9 @@ typedef struct _InputDriverRec {
                     struct _InputInfoRec * pInfo, int flags);
     void (*UnInit) (struct _InputDriverRec * drv,
                     struct _InputInfoRec * pInfo, int flags);
-    pointer module;
+    void *module;
     const char **default_options;
+    int capabilities;
 } InputDriverRec, *InputDriverPtr;
 
 /* This is to input devices what the ScrnInfoRec is to screens. */
@@ -96,11 +101,13 @@ typedef struct _InputInfoRec {
       int *valuators, int first_valuator, int num_valuators);
 
     int fd;
+    int major;
+    int minor;
     DeviceIntPtr dev;
-    pointer private;
+    void *private;
     const char *type_name;
     InputDriverPtr drv;
-    pointer module;
+    void *module;
     XF86OptionPtr options;
     InputAttributes *attrs;
 } *InputInfoPtr;
@@ -172,13 +179,14 @@ extern _X_EXPORT void xf86AddEnabledDevice(InputInfoPtr pInfo);
 extern _X_EXPORT void xf86RemoveEnabledDevice(InputInfoPtr pInfo);
 extern _X_EXPORT void xf86DisableDevice(DeviceIntPtr dev, Bool panic);
 extern _X_EXPORT void xf86EnableDevice(DeviceIntPtr dev);
+extern _X_EXPORT void xf86InputEnableVTProbe(void);
 
 /* not exported */
 int xf86NewInputDevice(InputInfoPtr pInfo, DeviceIntPtr *pdev, BOOL is_auto);
 InputInfoPtr xf86AllocateInput(void);
 
 /* xf86Helper.c */
-extern _X_EXPORT void xf86AddInputDriver(InputDriverPtr driver, pointer module,
+extern _X_EXPORT void xf86AddInputDriver(InputDriverPtr driver, void *module,
                                          int flags);
 extern _X_EXPORT void xf86DeleteInputDriver(int drvIndex);
 extern _X_EXPORT InputDriverPtr xf86LookupInputDriver(const char *name);
index 25f84e5..3f9c880 100644 (file)
@@ -224,7 +224,7 @@ xf86HandleColormaps(ScreenPtr pScreen,
     ComputeGamma(pScreenPriv);
 
     /* get the default map */
-    dixLookupResourceByType((pointer *) &pDefMap, pScreen->defColormap,
+    dixLookupResourceByType((void **) &pDefMap, pScreen->defColormap,
                             RT_COLORMAP, serverClient, DixInstallAccess);
 
     if (!CMapAllocateColormapPrivate(pDefMap)) {
@@ -608,7 +608,7 @@ CMapRefreshColors(ColormapPtr pmap, int defs, int *indices)
     case GrayScale:
         for (i = 0; i < defs; i++) {
             index = indices[i];
-            entry = (EntryPtr) & pmap->red[index];
+            entry = (EntryPtr) &pmap->red[index];
 
             if (entry->fShared) {
                 colors[index].red =
index c2e7bab..db715bd 100644 (file)
@@ -74,7 +74,7 @@ xf86FBManagerRunning(ScreenPtr pScreen)
 Bool
 xf86RegisterFreeBoxCallback(ScreenPtr pScreen,
                             FreeBoxCallbackProcPtr FreeBoxCallback,
-                            pointer devPriv)
+                            void *devPriv)
 {
     FBManagerFuncsPtr funcs;
 
@@ -93,7 +93,7 @@ xf86AllocateOffscreenArea(ScreenPtr pScreen,
                           int w, int h,
                           int gran,
                           MoveAreaCallbackProcPtr moveCB,
-                          RemoveAreaCallbackProcPtr removeCB, pointer privData)
+                          RemoveAreaCallbackProcPtr removeCB, void *privData)
 {
     FBManagerFuncsPtr funcs;
 
@@ -113,7 +113,7 @@ xf86AllocateOffscreenLinear(ScreenPtr pScreen,
                             int gran,
                             MoveLinearCallbackProcPtr moveCB,
                             RemoveLinearCallbackProcPtr removeCB,
-                            pointer privData)
+                            void *privData)
 {
     FBManagerFuncsPtr funcs;
 
@@ -309,7 +309,7 @@ SendCallFreeBoxCallbacks(FBManagerPtr offman)
 static Bool
 localRegisterFreeBoxCallback(ScreenPtr pScreen,
                              FreeBoxCallbackProcPtr FreeBoxCallback,
-                             pointer devPriv)
+                             void *devPriv)
 {
     FBManagerPtr offman;
     FreeBoxCallbackProcPtr *newCallbacks;
@@ -320,15 +320,17 @@ localRegisterFreeBoxCallback(ScreenPtr pScreen,
     newCallbacks = realloc(offman->FreeBoxesUpdateCallback,
                            sizeof(FreeBoxCallbackProcPtr) *
                            (offman->NumCallbacks + 1));
+    if (!newCallbacks)
+        return FALSE;
+    else
+        offman->FreeBoxesUpdateCallback = newCallbacks;
 
     newPrivates = realloc(offman->devPrivates,
                           sizeof(DevUnion) * (offman->NumCallbacks + 1));
-
-    if (!newCallbacks || !newPrivates)
+    if (!newPrivates)
         return FALSE;
-
-    offman->FreeBoxesUpdateCallback = newCallbacks;
-    offman->devPrivates = newPrivates;
+    else
+        offman->devPrivates = newPrivates;
 
     offman->FreeBoxesUpdateCallback[offman->NumCallbacks] = FreeBoxCallback;
     offman->devPrivates[offman->NumCallbacks].ptr = devPriv;
@@ -344,7 +346,7 @@ AllocateArea(FBManagerPtr offman,
              int w, int h,
              int granularity,
              MoveAreaCallbackProcPtr moveCB,
-             RemoveAreaCallbackProcPtr removeCB, pointer privData)
+             RemoveAreaCallbackProcPtr removeCB, void *privData)
 {
     ScreenPtr pScreen = offman->pScreen;
     FBLinkPtr link = NULL;
@@ -434,7 +436,7 @@ localAllocateOffscreenArea(ScreenPtr pScreen,
                            int w, int h,
                            int gran,
                            MoveAreaCallbackProcPtr moveCB,
-                           RemoveAreaCallbackProcPtr removeCB, pointer privData)
+                           RemoveAreaCallbackProcPtr removeCB, void *privData)
 {
     FBManagerPtr offman;
     FBAreaPtr area = NULL;
@@ -822,7 +824,7 @@ DumpDebug(FBLinearLinkPtr pLink)
 }
 
 static FBLinearPtr
-AllocateLinear(FBManagerPtr offman, int size, int granularity, pointer privData)
+AllocateLinear(FBManagerPtr offman, int size, int granularity, void *privData)
 {
     ScreenPtr pScreen = offman->pScreen;
     FBLinearLinkPtr linear = NULL;
@@ -901,7 +903,7 @@ localAllocateOffscreenLinear(ScreenPtr pScreen,
                              int gran,
                              MoveLinearCallbackProcPtr moveCB,
                              RemoveLinearCallbackProcPtr removeCB,
-                             pointer privData)
+                             void *privData)
 {
     FBManagerPtr offman;
     FBLinearLinkPtr link;
@@ -1120,11 +1122,8 @@ localQueryLargestOffscreenLinear(ScreenPtr pScreen,
 
         if (localQueryLargestOffscreenArea(pScreen, &w, &h, gran,
                                            FAVOR_WIDTH_THEN_AREA, priority)) {
-            FBManagerPtr offman;
             BoxPtr extents;
 
-            offman = (FBManagerPtr) dixLookupPrivate(&pScreen->devPrivates,
-                                                     xf86FBScreenKey);
             extents = RegionExtents(offman->InitialBoxes);
             if ((extents->x2 - extents->x1) == w)
                 *size = w * h;
@@ -1392,7 +1391,7 @@ xf86AllocateLinearOffscreenArea(ScreenPtr pScreen,
                                 int gran,
                                 MoveAreaCallbackProcPtr moveCB,
                                 RemoveAreaCallbackProcPtr removeCB,
-                                pointer privData)
+                                void *privData)
 {
     FBManagerFuncsPtr funcs;
     FBManagerPtr offman;
index 99bf991..092c2e2 100644 (file)
@@ -60,7 +60,7 @@ typedef struct _FBLinear {
     DevUnion devPrivate;
 } FBLinear, *FBLinearPtr;
 
-typedef void (*FreeBoxCallbackProcPtr) (ScreenPtr, RegionPtr, pointer);
+typedef void (*FreeBoxCallbackProcPtr) (ScreenPtr, RegionPtr, void *);
 typedef void (*MoveAreaCallbackProcPtr) (FBAreaPtr, FBAreaPtr);
 typedef void (*RemoveAreaCallbackProcPtr) (FBAreaPtr);
 
@@ -73,7 +73,7 @@ typedef struct {
                                        int granularity,
                                        MoveAreaCallbackProcPtr moveCB,
                                        RemoveAreaCallbackProcPtr removeCB,
-                                       pointer privData);
+                                       void *privData);
     void (*FreeOffscreenArea) (FBAreaPtr area);
     Bool (*ResizeOffscreenArea) (FBAreaPtr area, int w, int h);
     Bool (*QueryLargestOffscreenArea) (ScreenPtr pScreen,
@@ -82,14 +82,14 @@ typedef struct {
                                        int preferences, int priority);
     Bool (*RegisterFreeBoxCallback) (ScreenPtr pScreen,
                                      FreeBoxCallbackProcPtr FreeBoxCallback,
-                                     pointer devPriv);
+                                     void *devPriv);
 /* linear functions */
      FBLinearPtr(*AllocateOffscreenLinear) (ScreenPtr pScreen,
                                             int size,
                                             int granularity,
                                             MoveLinearCallbackProcPtr moveCB,
                                             RemoveLinearCallbackProcPtr
-                                            removeCB, pointer privData);
+                                            removeCB, void *privData);
     void (*FreeOffscreenLinear) (FBLinearPtr area);
     Bool (*ResizeOffscreenLinear) (FBLinearPtr area, int size);
     Bool (*QueryLargestOffscreenLinear) (ScreenPtr pScreen,
@@ -121,7 +121,7 @@ xf86AllocateOffscreenArea(ScreenPtr pScreen,
                           int w, int h,
                           int granularity,
                           MoveAreaCallbackProcPtr moveCB,
-                          RemoveAreaCallbackProcPtr removeCB, pointer privData);
+                          RemoveAreaCallbackProcPtr removeCB, void *privData);
 
 extern _X_EXPORT FBAreaPtr
 xf86AllocateLinearOffscreenArea(ScreenPtr pScreen,
@@ -129,7 +129,7 @@ xf86AllocateLinearOffscreenArea(ScreenPtr pScreen,
                                 int granularity,
                                 MoveAreaCallbackProcPtr moveCB,
                                 RemoveAreaCallbackProcPtr removeCB,
-                                pointer privData);
+                                void *privData);
 
 extern _X_EXPORT FBLinearPtr
 xf86AllocateOffscreenLinear(ScreenPtr pScreen,
@@ -137,7 +137,7 @@ xf86AllocateOffscreenLinear(ScreenPtr pScreen,
                             int granularity,
                             MoveLinearCallbackProcPtr moveCB,
                             RemoveLinearCallbackProcPtr removeCB,
-                            pointer privData);
+                            void *privData);
 
 extern _X_EXPORT void xf86FreeOffscreenArea(FBAreaPtr area);
 extern _X_EXPORT void xf86FreeOffscreenLinear(FBLinearPtr area);
@@ -152,7 +152,7 @@ extern _X_EXPORT Bool
 
 xf86RegisterFreeBoxCallback(ScreenPtr pScreen,
                             FreeBoxCallbackProcPtr FreeBoxCallback,
-                            pointer devPriv);
+                            void *devPriv);
 
 extern _X_EXPORT Bool
  xf86PurgeUnlockedOffscreenAreas(ScreenPtr pScreen);
index a2c18eb..c06b040 100644 (file)
@@ -575,7 +575,7 @@ xf86PciProbeDev(DriverPtr drvp)
 }
 
 void
-xf86PciIsolateDevice(char *argument)
+xf86PciIsolateDevice(const char *argument)
 {
     int bus, device, func;
 
@@ -1013,7 +1013,7 @@ xf86MatchPciInstances(const char *driverName, int vendorID,
 static void
 xf86ConfigPciEntityInactive(EntityInfoPtr pEnt, PciChipsets * p_chip,
                             EntityProc init, EntityProc enter,
-                            EntityProc leave, pointer private)
+                            EntityProc leave, void *private)
 {
     ScrnInfoPtr pScrn;
 
@@ -1027,7 +1027,7 @@ xf86ConfigPciEntityInactive(EntityInfoPtr pEnt, PciChipsets * p_chip,
 ScrnInfoPtr
 xf86ConfigPciEntity(ScrnInfoPtr pScrn, int scrnFlag, int entityIndex,
                     PciChipsets * p_chip, void *dummy, EntityProc init,
-                    EntityProc enter, EntityProc leave, pointer private)
+                    EntityProc enter, EntityProc leave, void *private)
 {
     EntityInfoPtr pEnt = xf86GetEntityInfo(entityIndex);
 
@@ -1068,7 +1068,7 @@ xf86ConfigPciEntity(ScrnInfoPtr pScrn, int scrnFlag, int entityIndex,
 Bool
 xf86ConfigActivePciEntity(ScrnInfoPtr pScrn, int entityIndex,
                           PciChipsets * p_chip, void *dummy, EntityProc init,
-                          EntityProc enter, EntityProc leave, pointer private)
+                          EntityProc enter, EntityProc leave, void *private)
 {
     EntityInfoPtr pEnt = xf86GetEntityInfo(entityIndex);
 
@@ -1147,14 +1147,62 @@ xf86VideoPtrToDriverList(struct pci_device *dev,
         driverList[0] = "i128";
         break;
     case 0x8086:
-        if ((dev->device_id == 0x00d1) || (dev->device_id == 0x7800)) {
-            driverList[0] = "i740";
-        }
-        else if (dev->device_id == 0x8108) {
-            break;              /* "hooray" for poulsbo */
-        }
-        else {
-            driverList[0] = "intel";
+       switch (dev->device_id)
+       {
+               /* Intel i740 */
+               case 0x00d1:
+               case 0x7800:
+                       driverList[0] = "i740";
+                       break;
+               /* GMA500/Poulsbo */
+               case 0x8108:
+               case 0x8109:
+                       /* Try psb driver on Poulsbo - if available */
+                       driverList[0] = "psb";
+                       driverList[1] = "psb_drv";
+                       break;
+               /* GMA600/Oaktrail */
+               case 0x4100:
+               case 0x4101:
+               case 0x4102:
+               case 0x4103:
+               case 0x4104:
+               case 0x4105:
+               case 0x4106:
+               case 0x4107:
+               /* Atom E620/Oaktrail */
+               case 0x4108:
+               /* Medfield */
+               case 0x0130:
+               case 0x0131:
+               case 0x0132:
+               case 0x0133:
+               case 0x0134:
+               case 0x0135:
+               case 0x0136:
+               case 0x0137:
+               /* GMA 3600/CDV */
+               case 0x0be0:
+               case 0x0be1:
+               case 0x0be2:
+               case 0x0be3:
+               case 0x0be4:
+               case 0x0be5:
+               case 0x0be6:
+               case 0x0be7:
+               case 0x0be8:
+               case 0x0be9:
+               case 0x0bea:
+               case 0x0beb:
+               case 0x0bec:
+               case 0x0bed:
+               case 0x0bee:
+               case 0x0bef:
+                       /* Use fbdev/vesa driver on Oaktrail, Medfield, CDV */
+                       break;
+               default:
+                       driverList[0] = "intel";
+                       break;
         }
         break;
     case 0x102b:
@@ -1272,8 +1320,9 @@ xchomp(char *line)
  * don't export their PCI ID's properly. If distros don't end up using this
  * feature it can and should be removed because the symbol-based resolution
  * scheme should be the primary one */
-void
-xf86MatchDriverFromFiles(char **matches, uint16_t match_vendor, uint16_t match_chip)
+int
+xf86MatchDriverFromFiles(uint16_t match_vendor, uint16_t match_chip,
+                         char *matches[], int nmatches)
 {
     DIR *idsdir;
     FILE *fp;
@@ -1283,11 +1332,11 @@ xf86MatchDriverFromFiles(char **matches, uint16_t match_vendor, uint16_t match_c
     ssize_t read;
     char path_name[256], vendor_str[5], chip_str[5];
     uint16_t vendor, chip;
-    int i, j;
+    int i = 0, j;
 
     idsdir = opendir(PCI_TXT_IDS_PATH);
     if (!idsdir)
-        return;
+        return 0;
 
     xf86Msg(X_INFO,
             "Scanning %s directory for additional PCI ID's supported by the drivers\n",
@@ -1338,10 +1387,6 @@ xf86MatchDriverFromFiles(char **matches, uint16_t match_vendor, uint16_t match_c
                         }
                     }
                     if (vendor == match_vendor && chip == match_chip) {
-                        i = 0;
-                        while (matches[i]) {
-                            i++;
-                        }
                         matches[i] =
                             (char *) malloc(sizeof(char) *
                                             strlen(direntry->d_name) - 3);
@@ -1364,6 +1409,7 @@ xf86MatchDriverFromFiles(char **matches, uint16_t match_vendor, uint16_t match_c
                         }
                         xf86Msg(X_INFO, "Matched %s from file name %s\n",
                                 matches[i], direntry->d_name);
+                        i++;
                     }
                 }
                 else {
@@ -1377,6 +1423,7 @@ xf86MatchDriverFromFiles(char **matches, uint16_t match_vendor, uint16_t match_c
  end:
     free(line);
     closedir(idsdir);
+    return i;
 }
 #endif                          /* __linux__ */
 
@@ -1387,7 +1434,7 @@ xf86MatchDriverFromFiles(char **matches, uint16_t match_vendor, uint16_t match_c
 int
 xf86PciMatchDriver(char *matches[], int nmatches)
 {
-    int i;
+    int i = 0;
     struct pci_device *info = NULL;
     struct pci_device_iterator *iter;
 
@@ -1402,13 +1449,10 @@ xf86PciMatchDriver(char *matches[], int nmatches)
     pci_iterator_destroy(iter);
 #ifdef __linux__
     if (info)
-        xf86MatchDriverFromFiles(matches, info->vendor_id, info->device_id);
+        i += xf86MatchDriverFromFiles(info->vendor_id, info->device_id,
+                                      matches, nmatches);
 #endif
 
-    for (i = 0; (i < nmatches) && (matches[i]); i++) {
-        /* find end of matches list */
-    }
-
     if ((info != NULL) && (i < nmatches)) {
         i += xf86VideoPtrToDriverList(info, &(matches[i]), nmatches - i);
     }
@@ -1436,6 +1480,7 @@ xf86PciConfigureNewDev(void *busData, struct pci_device *pVideo,
                        GDevRec * GDev, int *chipset)
 {
     char busnum[8];
+    char *tmp;
 
     pVideo = (struct pci_device *) busData;
 
@@ -1445,8 +1490,9 @@ xf86PciConfigureNewDev(void *busData, struct pci_device *pVideo,
         snprintf(busnum, sizeof(busnum), "%d@%d",
                  pVideo->bus & 0x00ff, pVideo->bus >> 8);
 
-    XNFasprintf(&GDev->busID, "PCI:%s:%d:%d",
+    XNFasprintf(&tmp, "PCI:%s:%d:%d",
                 busnum, pVideo->dev, pVideo->func);
+    GDev->busID = tmp;
 
     GDev->chipID = pVideo->device_id;
     GDev->chipRev = pVideo->revision;
index 4972c36..45b5a0f 100644 (file)
@@ -36,7 +36,7 @@
 void xf86PciProbe(void);
 Bool xf86PciAddMatchingDev(DriverPtr drvp);
 Bool xf86PciProbeDev(DriverPtr drvp);
-void xf86PciIsolateDevice(char *argument);
+void xf86PciIsolateDevice(const char *argument);
 int xf86PciMatchDriver(char *matches[], int nmatches);
 Bool xf86PciConfigure(void *busData, struct pci_device *pDev);
 void xf86PciConfigureNewDev(void *busData, struct pci_device *pVideo,
@@ -47,8 +47,9 @@ void xf86PciConfigureNewDev(void *busData, struct pci_device *pVideo,
                                  ((x)->func == (y)->func) &&            \
                                  ((x)->dev == (y)->dev))
 
-void
-xf86MatchDriverFromFiles(char **matches, uint16_t match_vendor, uint16_t match_chip);
+int
+xf86MatchDriverFromFiles(uint16_t match_vendor, uint16_t match_chip,
+                         char *matches[], int nmatches);
 int
 xf86VideoPtrToDriverList(struct pci_device *dev,
                          char *returnList[], int returnListMax);
index 24b9473..67cc356 100644 (file)
@@ -38,6 +38,7 @@
 #include <unistd.h>
 #include "os.h"
 #include "hotplug.h"
+#include "systemd-logind.h"
 
 #include "xf86.h"
 #include "xf86_OSproc.h"
 #include "xf86Bus.h"
 #include "Pci.h"
 #include "xf86platformBus.h"
+#include "xf86Config.h"
 
+#include "randrstr.h"
 int platformSlotClaimed;
 
 int xf86_num_platform_devices;
 
-static struct xf86_platform_device *xf86_platform_devices;
+struct xf86_platform_device *xf86_platform_devices;
 
 int
-xf86_add_platform_device(struct OdevAttributes *attribs)
+xf86_add_platform_device(struct OdevAttributes *attribs, Bool unowned)
 {
     xf86_platform_devices = xnfrealloc(xf86_platform_devices,
                                    (sizeof(struct xf86_platform_device)
@@ -62,6 +65,8 @@ xf86_add_platform_device(struct OdevAttributes *attribs)
 
     xf86_platform_devices[xf86_num_platform_devices].attribs = attribs;
     xf86_platform_devices[xf86_num_platform_devices].pdev = NULL;
+    xf86_platform_devices[xf86_num_platform_devices].flags =
+        unowned ? XF86_PDEV_UNOWNED : 0;
 
     xf86_num_platform_devices++;
     return 0;
@@ -88,32 +93,57 @@ xf86_add_platform_device_attrib(int index, int attrib_id, char *attrib_name)
     return config_odev_add_attribute(device->attribs, attrib_id, attrib_name);
 }
 
+Bool
+xf86_add_platform_device_int_attrib(int index, int attrib_id, int attrib_value)
+{
+    return config_odev_add_int_attribute(xf86_platform_devices[index].attribs, attrib_id, attrib_value);
+}
+
 char *
 xf86_get_platform_attrib(int index, int attrib_id)
 {
-    struct xf86_platform_device *device = &xf86_platform_devices[index];
-    struct OdevAttribute *oa;
-
-    xorg_list_for_each_entry(oa, &device->attribs->list, member) {
-        if (oa->attrib_id == attrib_id)
-            return oa->attrib_name;
-    }
-    return NULL;
+    return config_odev_get_attribute(xf86_platform_devices[index].attribs, attrib_id);
 }
 
 char *
 xf86_get_platform_device_attrib(struct xf86_platform_device *device, int attrib_id)
 {
-    struct OdevAttribute *oa;
+    return config_odev_get_attribute(device->attribs, attrib_id);
+}
+
+int
+xf86_get_platform_int_attrib(int index, int attrib_id, int def)
+{
+    return config_odev_get_int_attribute(xf86_platform_devices[index].attribs, attrib_id, def);
+}
+
+int
+xf86_get_platform_device_int_attrib(struct xf86_platform_device *device, int attrib_id, int def)
+{
+    return config_odev_get_int_attribute(device->attribs, attrib_id, def);
+}
+
+Bool
+xf86_get_platform_device_unowned(int index)
+{
+    return (xf86_platform_devices[index].flags & XF86_PDEV_UNOWNED) ?
+        TRUE : FALSE;
+}
+
+struct xf86_platform_device *
+xf86_find_platform_device_by_devnum(int major, int minor)
+{
+    int i, attr_major, attr_minor;
 
-    xorg_list_for_each_entry(oa, &device->attribs->list, member) {
-        if (oa->attrib_id == attrib_id)
-            return oa->attrib_name;
+    for (i = 0; i < xf86_num_platform_devices; i++) {
+        attr_major = xf86_get_platform_int_attrib(i, ODEV_ATTRIB_MAJOR, 0);
+        attr_minor = xf86_get_platform_int_attrib(i, ODEV_ATTRIB_MINOR, 0);
+        if (attr_major == major && attr_minor == minor)
+            return &xf86_platform_devices[i];
     }
     return NULL;
 }
 
-
 /*
  * xf86IsPrimaryPlatform() -- return TRUE if primary device
  * is a platform device and it matches this one.
@@ -170,6 +200,84 @@ xf86_check_platform_slot(const struct xf86_platform_device *pd)
     return TRUE;
 }
 
+static Bool
+MatchToken(const char *value, struct xorg_list *patterns,
+           int (*compare)(const char *, const char *))
+{
+    const xf86MatchGroup *group;
+
+    /* If there are no patterns, accept the match */
+    if (xorg_list_is_empty(patterns))
+        return TRUE;
+
+    /* If there are patterns but no attribute, reject the match */
+    if (!value)
+        return FALSE;
+
+    /*
+     * Otherwise, iterate the list of patterns ensuring each entry has a
+     * match. Each list entry is a separate Match line of the same type.
+     */
+    xorg_list_for_each_entry(group, patterns, entry) {
+        Bool match = FALSE;
+        char *const *cur;
+
+        for (cur = group->values; *cur; cur++) {
+            if ((*compare)(value, *cur) == 0) {
+                match = TRUE;
+                break;
+            }
+        }
+
+        if (!match)
+            return FALSE;
+    }
+
+    /* All the entries in the list matched the attribute */
+    return TRUE;
+}
+
+static Bool
+OutputClassMatches(const XF86ConfOutputClassPtr oclass, int index)
+{
+    char *driver = xf86_get_platform_attrib(index, ODEV_ATTRIB_DRIVER);
+
+    if (!MatchToken(driver, &oclass->match_driver, strcmp))
+        return FALSE;
+
+    return TRUE;
+}
+
+static int
+xf86OutputClassDriverList(int index, char *matches[], int nmatches)
+{
+    XF86ConfOutputClassPtr cl;
+    int i = 0;
+
+    if (nmatches == 0)
+        return 0;
+#ifdef _F_EXYNOS_DRV_LOAD_
+    if (!xf86configptr)
+        return 0;
+#endif
+    for (cl = xf86configptr->conf_outputclass_lst; cl; cl = cl->list.next) {
+        if (OutputClassMatches(cl, index)) {
+            char *path = xf86_get_platform_attrib(index, ODEV_ATTRIB_PATH);
+
+            xf86Msg(X_INFO, "Applying OutputClass \"%s\" to %s\n",
+                    cl->identifier, path);
+            xf86Msg(X_NONE, "\tloading driver: %s\n", cl->driver);
+
+            matches[i++] = xstrdup(cl->driver);
+        }
+
+        if (i >= nmatches)
+            break;
+    }
+
+    return i;
+}
+
 /**
  *  @return The numbers of found devices that match with the current system
  *  drivers.
@@ -189,16 +297,15 @@ xf86PlatformMatchDriver(char *matches[], int nmatches)
             else if (!xf86IsPrimaryPlatform(&xf86_platform_devices[i]) && (pass == 0))
                 continue;
 
+            j += xf86OutputClassDriverList(i, &matches[j], nmatches - j);
+
             info = xf86_platform_devices[i].pdev;
 #ifdef __linux__
             if (info)
-                xf86MatchDriverFromFiles(matches, info->vendor_id, info->device_id);
+                j += xf86MatchDriverFromFiles(info->vendor_id, info->device_id,
+                                              &matches[j], nmatches - j);
 #endif
 
-            for (j = 0; (j < nmatches) && (matches[j]); j++) {
-                /* find end of matches list */
-            }
-
             if ((info != NULL) && (j < nmatches)) {
                 j += xf86VideoPtrToDriverList(info, &(matches[j]), nmatches - j);
             }
@@ -213,11 +320,12 @@ xf86platformProbe(void)
     int i;
     Bool pci = TRUE;
 
+    config_odev_probe(xf86PlatformDeviceProbe);
+
     if (!xf86scanpci()) {
         pci = FALSE;
     }
 
-    config_odev_probe(&xf86PlatformDeviceProbe);
     for (i = 0; i < xf86_num_platform_devices; i++) {
         char *busid = xf86_get_platform_attrib(i, ODEV_ATTRIB_BUSID);
 
@@ -281,15 +389,15 @@ static Bool doPlatformProbe(struct xf86_platform_device *dev, DriverPtr drvp,
                             GDevPtr gdev, int flags, intptr_t match_data)
 {
     Bool foundScreen = FALSE;
-    int entity;
+    int entity, fd, major, minor;
 
-    if (gdev->screen == 0 && !xf86_check_platform_slot(dev))
+    if (gdev && gdev->screen == 0 && !xf86_check_platform_slot(dev))
         return FALSE;
 
     entity = xf86ClaimPlatformSlot(dev, drvp, 0,
-                                   gdev, gdev->active);
+                                   gdev, gdev ? gdev->active : 0);
 
-    if ((entity == -1) && (gdev->screen > 0)) {
+    if ((entity == -1) && gdev && (gdev->screen > 0)) {
         unsigned nent;
 
         for (nent = 0; nent < xf86NumEntities; nent++) {
@@ -305,6 +413,16 @@ static Bool doPlatformProbe(struct xf86_platform_device *dev, DriverPtr drvp,
         }
     }
     if (entity != -1) {
+        if ((dev->flags & XF86_PDEV_SERVER_FD) && (!drvp->driverFunc ||
+                !drvp->driverFunc(NULL, SUPPORTS_SERVER_FDS, NULL))) {
+            fd = xf86_get_platform_device_int_attrib(dev, ODEV_ATTRIB_FD, -1);
+            major = xf86_get_platform_device_int_attrib(dev, ODEV_ATTRIB_MAJOR, 0);
+            minor = xf86_get_platform_device_int_attrib(dev, ODEV_ATTRIB_MINOR, 0);
+            systemd_logind_release_fd(major, minor, fd);
+            config_odev_add_int_attribute(dev->attribs, ODEV_ATTRIB_FD, -1);
+            dev->flags &= ~XF86_PDEV_SERVER_FD;
+        }
+
         if (drvp->platformProbe(drvp, entity, flags, dev, match_data))
             foundScreen = TRUE;
         else
@@ -358,6 +476,9 @@ xf86platformProbeDev(DriverPtr drvp)
                     break;
             }
             else {
+                /* for non-seat0 servers assume first device is the master */
+                if (ServerIsNotSeat0())
+                    break;
                 if (xf86_platform_devices[j].pdev) {
                     if (xf86IsPrimaryPlatform(&xf86_platform_devices[j]))
                         break;
@@ -388,9 +509,8 @@ xf86platformAddDevice(int index)
 {
     int i, old_screens, scr_index;
     DriverPtr drvp = NULL;
-    int entity;
     screenLayoutPtr layout;
-    static char *hotplug_driver_name = "modesetting";
+    static const char *hotplug_driver_name = "modesetting";
 
     /* force load the driver for now */
     xf86LoadOneModule(hotplug_driver_name, NULL);
@@ -408,11 +528,8 @@ xf86platformAddDevice(int index)
         return -1;
 
     old_screens = xf86NumGPUScreens;
-    entity = xf86ClaimPlatformSlot(&xf86_platform_devices[index],
-                                   drvp, 0, 0, 0);
-    if (!drvp->platformProbe(drvp, entity, PLATFORM_PROBE_GPU_SCREEN, &xf86_platform_devices[index], 0)) {
-        xf86UnclaimPlatformSlot(&xf86_platform_devices[index], NULL);
-    }
+    doPlatformProbe(&xf86_platform_devices[index], drvp, NULL,
+                    PLATFORM_PROBE_GPU_SCREEN, 0);
     if (old_screens == xf86NumGPUScreens)
         return -1;
     i = old_screens;
@@ -434,15 +551,31 @@ xf86platformAddDevice(int index)
     }
 
    scr_index = AddGPUScreen(xf86GPUScreens[i]->ScreenInit, 0, NULL);
-
+   if (scr_index == -1) {
+       xf86DeleteScreen(xf86GPUScreens[i]);
+       xf86UnclaimPlatformSlot(&xf86_platform_devices[index], NULL);
+       xf86NumGPUScreens = old_screens;
+       return -1;
+   }
    dixSetPrivate(&xf86GPUScreens[i]->pScreen->devPrivates,
                  xf86ScreenKey, xf86GPUScreens[i]);
 
    CreateScratchPixmapsForScreen(xf86GPUScreens[i]->pScreen);
 
+   if (xf86GPUScreens[i]->pScreen->CreateScreenResources &&
+       !(*xf86GPUScreens[i]->pScreen->CreateScreenResources) (xf86GPUScreens[i]->pScreen)) {
+       RemoveGPUScreen(xf86GPUScreens[i]->pScreen);
+       xf86DeleteScreen(xf86GPUScreens[i]);
+       xf86UnclaimPlatformSlot(&xf86_platform_devices[index], NULL);
+       xf86NumGPUScreens = old_screens;
+       return -1;
+   }
    /* attach unbound to 0 protocol screen */
    AttachUnboundGPU(xf86Screens[0]->pScreen, xf86GPUScreens[i]->pScreen);
 
+   RRResourcesChanged(xf86Screens[0]->pScreen);
+   RRTellChanged(xf86Screens[0]->pScreen);
+
    return 0;
 }
 
@@ -486,7 +619,23 @@ xf86platformRemoveDevice(int index)
 
     xf86_remove_platform_device(index);
 
+    RRResourcesChanged(xf86Screens[0]->pScreen);
+    RRTellChanged(xf86Screens[0]->pScreen);
  out:
     return;
 }
+
+/* called on return from VT switch to find any new devices */
+void xf86platformVTProbe(void)
+{
+    int i;
+
+    for (i = 0; i < xf86_num_platform_devices; i++) {
+        if (!(xf86_platform_devices[i].flags & XF86_PDEV_UNOWNED))
+            continue;
+
+        xf86_platform_devices[i].flags &= ~XF86_PDEV_UNOWNED;
+        xf86PlatformReprobeDevice(i, xf86_platform_devices[i].attribs);
+    }
+}
 #endif
index 49afc24..5dee4e0 100644 (file)
@@ -30,22 +30,36 @@ struct xf86_platform_device {
     struct OdevAttributes *attribs;
     /* for PCI devices */
     struct pci_device *pdev;
+    int flags;
 };
 
+/* xf86_platform_device flags */
+#define XF86_PDEV_UNOWNED       0x01
+#define XF86_PDEV_SERVER_FD     0x02
+#define XF86_PDEV_PAUSED        0x04
+
 #ifdef XSERVER_PLATFORM_BUS
 int xf86platformProbe(void);
 int xf86platformProbeDev(DriverPtr drvp);
 
 extern int xf86_num_platform_devices;
+extern struct xf86_platform_device *xf86_platform_devices;
 
 extern char *
 xf86_get_platform_attrib(int index, int attrib_id);
 extern int
-xf86_add_platform_device(struct OdevAttributes *attribs);
+xf86_get_platform_int_attrib(int index, int attrib_id, int def);
+extern int
+xf86_add_platform_device(struct OdevAttributes *attribs, Bool unowned);
 extern int
 xf86_remove_platform_device(int dev_index);
 extern Bool
+xf86_get_platform_device_unowned(int index);
+/* Note starting with xserver 1.16 these 2 functions never fail */
+extern Bool
 xf86_add_platform_device_attrib(int index, int attrib_id, char *attrib_str);
+extern Bool
+xf86_add_platform_device_int_attrib(int index, int attrib_id, int attrib_value);
 
 extern int
 xf86platformAddDevice(int index);
@@ -54,11 +68,15 @@ xf86platformRemoveDevice(int index);
 
 extern _X_EXPORT char *
 xf86_get_platform_device_attrib(struct xf86_platform_device *device, int attrib_id);
+extern _X_EXPORT int
+xf86_get_platform_device_int_attrib(struct xf86_platform_device *device, int attrib_id, int def);
 extern _X_EXPORT Bool
 xf86PlatformDeviceCheckBusID(struct xf86_platform_device *device, const char *busid);
 
 extern _X_EXPORT int
 xf86PlatformMatchDriver(char *matches[], int nmatches);
+
+extern void xf86platformVTProbe(void);
 #endif
 
 #endif
index b6a6b94..07eb71e 100644 (file)
@@ -641,14 +641,16 @@ xf86SbusCmapLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices,
     int i, index;
     sbusCmapPtr cmap;
     struct fbcmap fbcmap;
-    unsigned char *data = malloc(numColors * 3);
+    unsigned char *data;
 
     cmap = SBUSCMAPPTR(pScrn->pScreen);
     if (!cmap)
         return;
     fbcmap.count = 0;
     fbcmap.index = indices[0];
-    fbcmap.red = data;
+    fbcmap.red = data = malloc(numColors * 3);
+    if (!data)
+        return;
     fbcmap.green = data + numColors;
     fbcmap.blue = fbcmap.green + numColors;
     for (i = 0; i < numColors; i++) {
index a4d9c6c..9cfcbc5 100644 (file)
@@ -52,16 +52,16 @@ typedef struct sbus_device {
     int fd;
     int width, height;
     sbusPromNode node;
-    char *descr;
-    char *device;
+    const char *descr;
+    const char *device;
 } sbusDevice, *sbusDevicePtr;
 
 struct sbus_devtable {
     int devId;
     int fbType;
-    char *promName;
-    char *driverName;
-    char *descr;
+    const char *promName;
+    const char *driverName;
+    const char *descr;
 };
 
 extern _X_EXPORT void xf86SbusProbe(void);
@@ -76,10 +76,10 @@ extern _X_EXPORT sbusDevicePtr xf86GetSbusInfoForEntity(int entityIndex);
 extern _X_EXPORT int xf86GetEntityForSbusInfo(sbusDevicePtr psdp);
 extern _X_EXPORT void xf86SbusUseBuiltinMode(ScrnInfoPtr pScrn,
                                              sbusDevicePtr psdp);
-extern _X_EXPORT pointer xf86MapSbusMem(sbusDevicePtr psdp,
+extern _X_EXPORT void *xf86MapSbusMem(sbusDevicePtr psdp,
                                         unsigned long offset,
                                         unsigned long size);
-extern _X_EXPORT void xf86UnmapSbusMem(sbusDevicePtr psdp, pointer addr,
+extern _X_EXPORT void xf86UnmapSbusMem(sbusDevicePtr psdp, void *addr,
                                        unsigned long size);
 extern _X_EXPORT void xf86SbusHideOsHwCursor(sbusDevicePtr psdp);
 extern _X_EXPORT void xf86SbusSetOsHwCursorCmap(sbusDevicePtr psdp, int bg,
index 0590262..a81e886 100644 (file)
@@ -145,7 +145,7 @@ typedef enum {
 typedef struct _DisplayModeRec {
     struct _DisplayModeRec *prev;
     struct _DisplayModeRec *next;
-    char *name;                 /* identifier for the mode */
+    const char *name;           /* identifier for the mode */
     ModeStatus status;
     int type;
 
@@ -212,9 +212,9 @@ typedef struct {
 #define GAMMA_ZERO     (GAMMA_MIN / 100.0)
 
 typedef struct {
-    char *id;
-    char *vendor;
-    char *model;
+    const char *id;
+    const char *vendor;
+    const char *model;
     int nHsync;
     range hsync[MAX_HSYNC];
     int nVrefresh;
@@ -224,8 +224,8 @@ typedef struct {
     Gamma gamma;                /* Gamma of the monitor */
     int widthmm;
     int heightmm;
-    pointer options;
-    pointer DDC;
+    void *options;
+    void *DDC;
     Bool reducedblanking;       /* Allow CVT reduced blanking modes? */
     int maxPixClock;            /* in kHz, like mode->Clock */
 } MonRec, *MonPtr;
@@ -256,10 +256,11 @@ typedef enum {
     RR_GET_INFO,
     RR_SET_CONFIG,
     RR_GET_MODE_MM,
-    GET_REQUIRED_HW_INTERFACES = 10
+    GET_REQUIRED_HW_INTERFACES = 10,
+    SUPPORTS_SERVER_FDS = 11,
 } xorgDriverFuncOp;
 
-typedef Bool xorgDriverFuncProc(ScrnInfoPtr, xorgDriverFuncOp, pointer);
+typedef Bool xorgDriverFuncProc(ScrnInfoPtr, xorgDriverFuncOp, void *);
 
 /* RR_GET_INFO, RR_SET_CONFIG */
 typedef struct {
@@ -299,11 +300,11 @@ struct _DriverRec;
 
 typedef struct {
     int driverVersion;
-    char *driverName;
+    const char *driverName;
     void (*Identify) (int flags);
     Bool (*Probe) (struct _DriverRec * drv, int flags);
     const OptionInfoRec *(*AvailableOptions) (int chipid, int bustype);
-    pointer module;
+    void *module;
     int refCount;
 } DriverRec1;
 
@@ -315,11 +316,11 @@ struct xf86_platform_device;
 
 typedef struct _DriverRec {
     int driverVersion;
-    char *driverName;
+    const char *driverName;
     void (*Identify) (int flags);
     Bool (*Probe) (struct _DriverRec * drv, int flags);
     const OptionInfoRec *(*AvailableOptions) (int chipid, int bustype);
-    pointer module;
+    void *module;
     int refCount;
     xorgDriverFuncProc *driverFunc;
 
@@ -347,7 +348,7 @@ typedef struct _DriverRec {
  */
 
 /* Tolerate prior #include <linux/input.h> */
-#if defined(linux) && defined(_INPUT_H)
+#if defined(linux)
 #undef BUS_NONE
 #undef BUS_PCI
 #undef BUS_SBUS
@@ -386,19 +387,19 @@ typedef enum {
 } DacSpeedIndex;
 
 typedef struct {
-    char *identifier;
-    char *vendor;
-    char *board;
-    char *chipset;
-    char *ramdac;
-    char *driver;
+    const char *identifier;
+    const char *vendor;
+    const char *board;
+    const char *chipset;
+    const char *ramdac;
+    const char *driver;
     struct _confscreenrec *myScreenSection;
     Bool claimed;
     int dacSpeeds[MAXDACSPEEDS];
     int numclocks;
     int clock[MAXCLOCKS];
-    char *clockchip;
-    char *busID;
+    const char *clockchip;
+    const char *busID;
     Bool active;
     Bool inUse;
     int videoRam;
@@ -408,7 +409,7 @@ typedef struct {
     unsigned long IOBase;
     int chipID;
     int chipRev;
-    pointer options;
+    void *options;
     int irq;
     int screen;                 /* For multi-CRTC cards */
 } GDevRec, *GDevPtr;
@@ -424,24 +425,24 @@ typedef struct {
     rgb blackColour;
     rgb whiteColour;
     int defaultVisual;
-    char **modes;
-    pointer options;
+    const char **modes;
+    void *options;
 } DispRec, *DispPtr;
 
 typedef struct _confxvportrec {
-    char *identifier;
-    pointer options;
+    const char *identifier;
+    void *options;
 } confXvPortRec, *confXvPortPtr;
 
 typedef struct _confxvadaptrec {
-    char *identifier;
+    const char *identifier;
     int numports;
     confXvPortPtr ports;
-    pointer options;
+    void *options;
 } confXvAdaptorRec, *confXvAdaptorPtr;
 
 typedef struct _confscreenrec {
-    char *id;
+    const char *id;
     int screennum;
     int defaultdepth;
     int defaultbpp;
@@ -452,7 +453,7 @@ typedef struct _confscreenrec {
     DispPtr displays;
     int numxvadaptors;
     confXvAdaptorPtr xvadaptors;
-    pointer options;
+    void *options;
 } confScreenRec, *confScreenPtr;
 
 typedef enum {
@@ -467,29 +468,29 @@ typedef enum {
 
 typedef struct _screenlayoutrec {
     confScreenPtr screen;
-    char *topname;
+    const char *topname;
     confScreenPtr top;
-    char *bottomname;
+    const char *bottomname;
     confScreenPtr bottom;
-    char *leftname;
+    const char *leftname;
     confScreenPtr left;
-    char *rightname;
+    const char *rightname;
     confScreenPtr right;
     PositionType where;
     int x;
     int y;
-    char *refname;
+    const char *refname;
     confScreenPtr refscreen;
 } screenLayoutRec, *screenLayoutPtr;
 
 typedef struct _InputInfoRec InputInfoRec;
 
 typedef struct _serverlayoutrec {
-    char *id;
+    const char *id;
     screenLayoutPtr screens;
     GDevPtr inactives;
     InputInfoRec **inputs;      /* NULL terminated */
-    pointer options;
+    void *options;
 } serverLayoutRec, *serverLayoutPtr;
 
 typedef struct _confdribufferrec {
@@ -512,7 +513,7 @@ typedef struct _confdrirec {
 #define NUM_RESERVED_POINTERS          14
 #define NUM_RESERVED_FUNCS             10
 
-typedef pointer (*funcPointer) (void);
+typedef void *(*funcPointer) (void);
 
 /* flags for depth 24 pixmap options */
 typedef enum {
@@ -581,7 +582,7 @@ typedef struct _PciChipsets {
 } PciChipsets;
 
 /* Entity properties */
-typedef void (*EntityProc) (int entityIndex, pointer private);
+typedef void (*EntityProc) (int entityIndex, void *private);
 
 typedef struct _entityInfo {
     int index;
@@ -671,7 +672,7 @@ typedef void xf86ModeSetProc(ScrnInfoPtr);
 
 typedef struct _ScrnInfoRec {
     int driverVersion;
-    char *driverName;           /* canonical name used in */
+    const char *driverName;     /* canonical name used in */
     /* the config file */
     ScreenPtr pScreen;          /* Pointer to the ScreenRec */
     int scrnIndex;              /* Number of this screen */
@@ -730,20 +731,20 @@ typedef struct _ScrnInfoRec {
     int heightmm;
     int xDpi;                   /* width DPI */
     int yDpi;                   /* height DPI */
-    char *name;                 /* Name to prefix messages */
-    pointer driverPrivate;      /* Driver private area */
+    const char *name;           /* Name to prefix messages */
+    void *driverPrivate;        /* Driver private area */
     DevUnion *privates;         /* Other privates can hook in
                                  * here */
     DriverPtr drv;              /* xf86DriverList[] entry */
-    pointer module;             /* Pointer to module head */
+    void *module;               /* Pointer to module head */
     int colorKey;
     int overlayFlags;
 
     /* Some of these may be moved out of here into the driver private area */
 
-    char *chipset;              /* chipset name */
-    char *ramdac;               /* ramdac name */
-    char *clockchip;            /* clock name */
+    const char *chipset;        /* chipset name */
+    const char *ramdac;         /* ramdac name */
+    const char *clockchip;      /* clock name */
     Bool progClock;             /* clock is programmable */
     int numClocks;              /* number of clocks */
     int clock[MAXCLOCKS];       /* list of clock frequencies */
@@ -754,7 +755,7 @@ typedef struct _ScrnInfoRec {
     int memClk;                 /* memory clock */
     int textClockFreq;          /* clock of text mode */
     Bool flipPixels;            /* swap default black/white */
-    pointer options;
+    void *options;
 
     int chipID;
     int chipRev;
@@ -779,7 +780,7 @@ typedef struct _ScrnInfoRec {
     int *entityInstanceList;
     struct pci_device *vgaDev;
 
-    pointer reservedPtr[NUM_RESERVED_POINTERS];
+    void *reservedPtr[NUM_RESERVED_POINTERS];
 
     /*
      * Driver entry points.
@@ -864,7 +865,7 @@ typedef enum {
 typedef void (*DPMSSetProcPtr) (ScrnInfoPtr, int, int);
 
 /* Input handler proc */
-typedef void (*InputHandlerProc) (int fd, pointer data);
+typedef void (*InputHandlerProc) (int fd, void *data);
 
 /* These are used by xf86GetClocks */
 #define CLK_REG_SAVE           -1
index 7cd2eed..2b07833 100644 (file)
@@ -216,7 +216,7 @@ setEventMask(ScreenPtr pScreen, ClientPtr client, unsigned long mask)
 }
 
 static int
-XF86VidModeFreeEvents(pointer value, XID id)
+XF86VidModeFreeEvents(void *value, XID id)
 {
     XF86VidModeEventPtr pOld = (XF86VidModeEventPtr) value;
     ScreenPtr pScreen = pOld->screen;
@@ -314,7 +314,7 @@ ProcXF86VidModeGetModeLine(ClientPtr client)
         .type = X_Reply,
         .sequenceNumber = client->sequence
     };
-    pointer mode;
+    void *mode;
     int dotClock;
     int ver;
 
@@ -413,7 +413,7 @@ ProcXF86VidModeGetAllModeLines(ClientPtr client)
 {
     REQUEST(xXF86VidModeGetAllModeLinesReq);
     xXF86VidModeGetAllModeLinesReply rep;
-    pointer mode;
+    void *mode;
     int modecount, dotClock;
     int ver;
 
@@ -524,7 +524,7 @@ ProcXF86VidModeAddModeLine(ClientPtr client)
     xXF86OldVidModeAddModeLineReq *oldstuff =
         (xXF86OldVidModeAddModeLineReq *) client->requestBuffer;
     xXF86VidModeAddModeLineReq newstuff;
-    pointer mode;
+    void *mode;
     int len;
     int dotClock;
     int ver;
@@ -688,7 +688,7 @@ ProcXF86VidModeDeleteModeLine(ClientPtr client)
     xXF86OldVidModeDeleteModeLineReq *oldstuff =
         (xXF86OldVidModeDeleteModeLineReq *) client->requestBuffer;
     xXF86VidModeDeleteModeLineReq newstuff;
-    pointer mode;
+    void *mode;
     int len, dotClock;
     int ver;
 
@@ -813,7 +813,7 @@ ProcXF86VidModeModModeLine(ClientPtr client)
     xXF86OldVidModeModModeLineReq *oldstuff =
         (xXF86OldVidModeModModeLineReq *) client->requestBuffer;
     xXF86VidModeModModeLineReq newstuff;
-    pointer mode, modetmp;
+    void *mode, *modetmp;
     int len, dotClock;
     int ver;
 
@@ -942,7 +942,7 @@ ProcXF86VidModeValidateModeLine(ClientPtr client)
         (xXF86OldVidModeValidateModeLineReq *) client->requestBuffer;
     xXF86VidModeValidateModeLineReq newstuff;
     xXF86VidModeValidateModeLineReply rep;
-    pointer mode, modetmp = NULL;
+    void *mode, *modetmp = NULL;
     int len, status, dotClock;
     int ver;
 
@@ -1080,7 +1080,7 @@ ProcXF86VidModeSwitchToMode(ClientPtr client)
     xXF86OldVidModeSwitchToModeReq *oldstuff =
         (xXF86OldVidModeSwitchToModeReq *) client->requestBuffer;
     xXF86VidModeSwitchToModeReq newstuff;
-    pointer mode;
+    void *mode;
     int len, dotClock;
     int ver;
 
@@ -1205,7 +1205,7 @@ ProcXF86VidModeGetMonitor(ClientPtr client)
     };
     CARD32 *hsyncdata, *vsyncdata;
     int i, nHsync, nVrefresh;
-    pointer monitor;
+    void *monitor;
 
     DEBUG_P("XF86VidModeGetMonitor");
 
@@ -1590,7 +1590,7 @@ ProcXF86VidModeGetPermissions(ClientPtr client)
         return BadValue;
 
     if (xf86GetVidModeEnabled() &&
-        (xf86GetVidModeAllowNonLocal() || LocalClient(client))) {
+        (xf86GetVidModeAllowNonLocal() || client->local)) {
         rep.permissions |= XF86VM_WRITE_PERMISSION;
     }
     if (client->swapped) {
@@ -1659,7 +1659,7 @@ ProcXF86VidModeDispatch(ClientPtr client)
     default:
         if (!xf86GetVidModeEnabled())
             return VidModeErrorBase + XF86VidModeExtensionDisabled;
-        if (xf86GetVidModeAllowNonLocal() || LocalClient(client)) {
+        if (xf86GetVidModeAllowNonLocal() || client->local) {
             switch (stuff->data) {
             case X_XF86VidModeAddModeLine:
                 return ProcXF86VidModeAddModeLine(client);
@@ -2083,7 +2083,7 @@ SProcXF86VidModeDispatch(ClientPtr client)
     default:
         if (!xf86GetVidModeEnabled())
             return VidModeErrorBase + XF86VidModeExtensionDisabled;
-        if (xf86GetVidModeAllowNonLocal() || LocalClient(client)) {
+        if (xf86GetVidModeAllowNonLocal() || client->local) {
             switch (stuff->data) {
             case X_XF86VidModeAddModeLine:
                 return SProcXF86VidModeAddModeLine(client);
old mode 100644 (file)
new mode 100755 (executable)
index 7077c10..df1accb
@@ -261,7 +261,7 @@ xf86XVScreenInit(ScreenPtr pScreen, XF86VideoAdaptorPtr * adaptors, int num)
        sure that I appreciate that.  */
 
     ScreenPriv = malloc(sizeof(XF86XVScreenRec));
-    pxvs->devPriv.ptr = (pointer) ScreenPriv;
+    pxvs->devPriv.ptr = (void *) ScreenPriv;
 
     if (!ScreenPriv)
         return FALSE;
@@ -551,7 +551,7 @@ xf86XVInitAdaptors(ScreenPtr pScreen, XF86VideoAdaptorPtr * infoPtr, int number)
         adaptorPriv->PutImage = adaptorPtr->PutImage;
         adaptorPriv->ReputImage = adaptorPtr->ReputImage;       /* image/still */
 
-        pa->devPriv.ptr = (pointer) adaptorPriv;
+        pa->devPriv.ptr = (void *) adaptorPriv;
 
         if (!(pPort = calloc(adaptorPtr->nPorts, sizeof(XvPortRec)))) {
             xf86XVFreeAdaptor(pa);
@@ -811,11 +811,13 @@ xf86XVReputVideo(XvPortRecPrivatePtr portPriv)
         RegionUninit(&VPReg);
     }
 
+#ifndef _F_XV_DO_NOT_CHECK_OBSCURED_
     /* that's all if it's totally obscured */
     if (!RegionNotEmpty(&ClipRegion)) {
         clippedAway = TRUE;
         goto CLIP_VIDEO_BAILOUT;
     }
+#endif
 
     /* bailout if we have to clip but the hardware doesn't support it */
     if (portPriv->AdaptorRec->flags & VIDEO_NO_CLIPPING) {
@@ -957,7 +959,7 @@ xf86XVReputImage(XvPortRecPrivatePtr portPriv)
 }
 
 static int
-xf86XVReputAllVideo(WindowPtr pWin, pointer data)
+xf86XVReputAllVideo(WindowPtr pWin, void *data)
 {
     XF86XVWindowPtr WinPriv = GET_XF86XV_WINDOW(pWin);
 
@@ -1037,12 +1039,13 @@ static void
 xf86XVReputOrStopPort(XvPortRecPrivatePtr pPriv, WindowPtr pWin, Bool visible)
 {
     if (!visible) {
+#ifndef _F_XV_DO_NOT_CHECK_OBSCURED_
         if (pPriv->isOn == XV_ON) {
             (*pPriv->AdaptorRec->StopVideo) (pPriv->pScrn, pPriv->DevPriv.ptr,
                                              FALSE);
             pPriv->isOn = XV_PENDING;
         }
-
+#endif
         if (!pPriv->type)       /* overlaid still/image */
             xf86XVRemovePortFromWindow(pWin, pPriv);
 
@@ -1051,6 +1054,12 @@ xf86XVReputOrStopPort(XvPortRecPrivatePtr pPriv, WindowPtr pWin, Bool visible)
 
     switch (pPriv->type) {
     case XvInputMask:
+#ifdef _XV_REPUTORSTOP_CHECK_XV_OFF_
+        if (pPriv->isOn == XV_OFF || !(pPriv->pDraw)) {
+            xf86Msg(X_INFO, "xf86XVReputVideo called for an invalid scenario. Xv state:%d\n", pPriv->isOn);
+            return;
+        }
+#endif
         xf86XVReputVideo(pPriv);
         break;
     case XvOutputMask:
@@ -1707,7 +1716,13 @@ xf86XVStopVideo(ClientPtr client, XvPortPtr pPort, DrawablePtr pDraw)
         return BadAlloc;
 #endif
 
+#ifdef _F_XV_DRAW_CHECK_NULL_
+    if(pDraw != NULL){
+        xf86XVRemovePortFromWindow((WindowPtr) pDraw, portPriv);
+    }
+#else
     xf86XVRemovePortFromWindow((WindowPtr) pDraw, portPriv);
+#endif
 
     if (!portPriv->pScrn->vtSema)
         return Success;         /* Success ? */
@@ -1949,7 +1964,7 @@ xf86XVFillKeyHelper(ScreenPtr pScreen, CARD32 key, RegionPtr fillboxes)
 }
 
 void
-xf86XVFillKeyHelperPort(DrawablePtr pDraw, pointer data, CARD32 key,
+xf86XVFillKeyHelperPort(DrawablePtr pDraw, void *data, CARD32 key,
                         RegionPtr clipboxes, Bool fillEverything)
 {
     WindowPtr pWin = (WindowPtr) pDraw;
index 091efca..8986e2e 100644 (file)
@@ -84,47 +84,47 @@ typedef int (*PutVideoFuncPtr) (ScrnInfoPtr pScrn,
                                 short vid_x, short vid_y, short drw_x,
                                 short drw_y, short vid_w, short vid_h,
                                 short drw_w, short drw_h, RegionPtr clipBoxes,
-                                pointer data, DrawablePtr pDraw);
+                                void *data, DrawablePtr pDraw);
 typedef int (*PutStillFuncPtr) (ScrnInfoPtr pScrn, short vid_x, short vid_y,
                                 short drw_x, short drw_y, short vid_w,
                                 short vid_h, short drw_w, short drw_h,
-                                RegionPtr clipBoxes, pointer data,
+                                RegionPtr clipBoxes, void *data,
                                 DrawablePtr pDraw);
 typedef int (*GetVideoFuncPtr) (ScrnInfoPtr pScrn, short vid_x, short vid_y,
                                 short drw_x, short drw_y, short vid_w,
                                 short vid_h, short drw_w, short drw_h,
-                                RegionPtr clipBoxes, pointer data,
+                                RegionPtr clipBoxes, void *data,
                                 DrawablePtr pDraw);
 typedef int (*GetStillFuncPtr) (ScrnInfoPtr pScrn, short vid_x, short vid_y,
                                 short drw_x, short drw_y, short vid_w,
                                 short vid_h, short drw_w, short drw_h,
-                                RegionPtr clipBoxes, pointer data,
+                                RegionPtr clipBoxes, void *data,
                                 DrawablePtr pDraw);
-typedef void (*StopVideoFuncPtr) (ScrnInfoPtr pScrn, pointer data, Bool Exit);
+typedef void (*StopVideoFuncPtr) (ScrnInfoPtr pScrn, void *data, Bool Exit);
 typedef int (*SetPortAttributeFuncPtr) (ScrnInfoPtr pScrn, Atom attribute,
-                                        INT32 value, pointer data);
+                                        INT32 value, void *data);
 typedef int (*GetPortAttributeFuncPtr) (ScrnInfoPtr pScrn, Atom attribute,
-                                        INT32 *value, pointer data);
+                                        INT32 *value, void *data);
 typedef void (*QueryBestSizeFuncPtr) (ScrnInfoPtr pScrn, Bool motion,
                                       short vid_w, short vid_h, short drw_w,
                                       short drw_h, unsigned int *p_w,
-                                      unsigned int *p_h, pointer data);
+                                      unsigned int *p_h, void *data);
 typedef int (*PutImageFuncPtr) (ScrnInfoPtr pScrn, short src_x, short src_y,
                                 short drw_x, short drw_y, short src_w,
                                 short src_h, short drw_w, short drw_h,
                                 int image, unsigned char *buf, short width,
                                 short height, Bool Sync, RegionPtr clipBoxes,
-                                pointer data, DrawablePtr pDraw);
+                                void *data, DrawablePtr pDraw);
 typedef int (*ReputImageFuncPtr) (ScrnInfoPtr pScrn, short src_x, short src_y,
                                   short drw_x, short drw_y, short src_w,
                                   short src_h, short drw_w, short drw_h,
-                                  RegionPtr clipBoxes, pointer data,
+                                  RegionPtr clipBoxes, void *data,
                                   DrawablePtr pDraw);
 typedef int (*QueryImageAttributesFuncPtr) (ScrnInfoPtr pScrn, int image,
                                             unsigned short *width,
                                             unsigned short *height,
                                             int *pitches, int *offsets);
-typedef void (*ClipNotifyFuncPtr) (ScrnInfoPtr pScrn, pointer data,
+typedef void (*ClipNotifyFuncPtr) (ScrnInfoPtr pScrn, void *data,
                                    WindowPtr window, int dx, int dy);
 
 typedef enum {
@@ -137,7 +137,7 @@ typedef enum {
 
 typedef struct {
     int id;
-    char *name;
+    const char *name;
     unsigned short width, height;
     XvRationalRec rate;
 } XF86VideoEncodingRec, *XF86VideoEncodingPtr;
@@ -151,13 +151,13 @@ typedef struct {
     int flags;
     int min_value;
     int max_value;
-    char *name;
+    const char *name;
 } XF86AttributeRec, *XF86AttributePtr;
 
 typedef struct {
     unsigned int type;
     int flags;
-    char *name;
+    const char *name;
     int nEncodings;
     XF86VideoEncodingPtr pEncodings;
     int nFormats;
@@ -238,7 +238,7 @@ xf86XVFillKeyHelperDrawable(DrawablePtr pDraw, CARD32 key, RegionPtr clipboxes);
 
 extern _X_EXPORT void
 
-xf86XVFillKeyHelperPort(DrawablePtr pDraw, pointer data, CARD32 key,
+xf86XVFillKeyHelperPort(DrawablePtr pDraw, void *data, CARD32 key,
                         RegionPtr clipboxes, Bool fillEverything);
 
 extern _X_EXPORT Bool
index 78a32bf..3169c05 100644 (file)
@@ -158,8 +158,10 @@ xf86XvMCScreenInit(ScreenPtr pScreen,
     if (!(pAdapt = malloc(sizeof(XvMCAdaptorRec) * num_adaptors)))
         return FALSE;
 
-    if (!dixRegisterPrivateKey(&XF86XvMCScreenKeyRec, PRIVATE_SCREEN, 0))
+    if (!dixRegisterPrivateKey(&XF86XvMCScreenKeyRec, PRIVATE_SCREEN, 0)) {
+        free(pAdapt);
         return FALSE;
+    }
 
     if (!(pScreenPriv = malloc(sizeof(xf86XvMCScreenRec)))) {
         free(pAdapt);
index 2478fe3..aaa4e65 100644 (file)
@@ -109,7 +109,7 @@ typedef void (*xf86XvMCDestroySubpictureProcPtr) (ScrnInfoPtr pScrn,
                                                   XvMCSubpicturePtr subpicture);
 
 typedef struct {
-    char *name;
+    const char *name;
     int num_surfaces;
     XF86MCSurfaceInfoPtr *surfaces;
     int num_subpictures;
index 93ea4a2..a7b84ad 100644 (file)
@@ -4,7 +4,7 @@ noinst_LTLIBRARIES = libddc.la
 
 libddc_la_SOURCES = ddc.c interpret_edid.c print_edid.c ddcProperty.c
 
-INCLUDES = $(XORG_INCS) -I$(srcdir)/../i2c
+AM_CPPFLAGS = $(XORG_INCS) -I$(srcdir)/../i2c
 
 AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
 
index 28c9696..04d1a09 100644 (file)
@@ -91,15 +91,16 @@ resort(unsigned char *s_block)
     unsigned char *d_new, *d_ptr, *d_end, *s_ptr, *s_end;
     unsigned char tmp;
 
+    s_ptr = find_header(s_block);
+    if (!s_ptr)
+        return NULL;
     s_end = s_block + EDID1_LEN;
+
     d_new = malloc(EDID1_LEN);
     if (!d_new)
         return NULL;
     d_end = d_new + EDID1_LEN;
 
-    s_ptr = find_header(s_block);
-    if (!s_ptr)
-        return NULL;
     for (d_ptr = d_new; d_ptr < d_end; d_ptr++) {
         tmp = *(s_ptr++);
         *d_ptr = tmp;
@@ -298,7 +299,7 @@ xf86DoEDID_DDC1(ScrnInfoPtr pScrn, DDC1SetSpeedProc DDC1SetSpeed,
 /* DDC2 */
 
 static I2CDevPtr
-DDC2MakeDevice(I2CBusPtr pBus, int address, char *name)
+DDC2MakeDevice(I2CBusPtr pBus, int address, const char *name)
 {
     I2CDevPtr dev = NULL;
 
index 882a6b2..17a8f81 100644 (file)
@@ -332,6 +332,97 @@ xf86ForEachVideoBlock(xf86MonPtr mon, handle_video_fn fn, void *data)
     }
 }
 
+static Bool
+cea_db_offsets(Uchar *cea, int *start, int *end)
+{
+    /* Data block offset in CEA extension block */
+    *start = CEA_EXT_MIN_DATA_OFFSET;
+    *end = cea[2];
+    if (*end == 0)
+        *end = CEA_EXT_MAX_DATA_OFFSET;
+    if (*end < CEA_EXT_MIN_DATA_OFFSET || *end > CEA_EXT_MAX_DATA_OFFSET)
+        return FALSE;
+    return TRUE;
+}
+
+static int
+cea_db_len(Uchar *db)
+{
+    return db[0] & 0x1f;
+}
+
+static int
+cea_db_tag(Uchar *db)
+{
+    return db[0] >> 5;
+}
+
+typedef void (*handle_cea_db_fn) (Uchar *, void *);
+
+static void
+cea_for_each_db(xf86MonPtr mon, handle_cea_db_fn fn, void *data)
+{
+    int i;
+
+    if (!mon)
+        return;
+
+    if (!(mon->flags & EDID_COMPLETE_RAWDATA))
+        return;
+
+    if (!mon->no_sections)
+        return;
+
+    if (!mon->rawData)
+        return;
+
+    for (i = 0; i < mon->no_sections; i++) {
+        int start, end, offset;
+        Uchar *ext;
+
+        ext = mon->rawData + EDID1_LEN * (i + 1);
+        if (ext[EXT_TAG] != CEA_EXT)
+            continue;
+
+        if (!cea_db_offsets(ext, &start, &end))
+            continue;
+
+        for (offset = start;
+             offset < end && offset + cea_db_len(&ext[offset]) < end;
+             offset += cea_db_len(&ext[offset]) + 1)
+                fn(&ext[offset], data);
+    }
+}
+
+struct find_hdmi_block_data {
+    struct cea_data_block *hdmi;
+};
+
+static void find_hdmi_block(Uchar *db, void *data)
+{
+    struct find_hdmi_block_data *result = data;
+    int oui;
+
+    if (cea_db_tag(db) != CEA_VENDOR_BLK)
+        return;
+
+    if (cea_db_len(db) < 5)
+        return;
+
+    oui = (db[3] << 16) | (db[2] << 8) | db[1];
+    if (oui == IEEE_ID_HDMI)
+        result->hdmi = (struct cea_data_block *)db;
+}
+
+struct cea_data_block *xf86MonitorFindHDMIBlock(xf86MonPtr mon)
+{
+    struct find_hdmi_block_data result = { NULL };
+
+    cea_for_each_db(mon, find_hdmi_block, &result);
+
+    return result.hdmi;
+}
+
 xf86MonPtr
 xf86InterpretEEDID(int scrnIndex, Uchar * block)
 {
@@ -666,49 +757,5 @@ validate_version(int scrnIndex, struct edid_version *r)
 Bool
 xf86MonitorIsHDMI(xf86MonPtr mon)
 {
-    int i = 0, version, offset;
-    char *edid = NULL;
-
-    if (!mon)
-        return FALSE;
-
-    if (!(mon->flags & EDID_COMPLETE_RAWDATA))
-        return FALSE;
-
-    if (!mon->no_sections)
-        return FALSE;
-
-    edid = (char *) mon->rawData;
-    if (!edid)
-        return FALSE;
-
-    /* find the CEA extension block */
-    for (i = 1; i <= mon->no_sections; i++)
-        if (edid[i * 128] == 0x02)
-            break;
-    if (i == mon->no_sections + 1)
-        return FALSE;
-    edid += (i * 128);
-
-    version = edid[1];
-    offset = edid[2];
-    if (version < 3 || offset < 4)
-        return FALSE;
-
-    /* walk the cea data blocks */
-    for (i = 4; i < offset; i += (edid[i] & 0x1f) + 1) {
-        char *x = edid + i;
-
-        /* find a vendor specific block */
-        if ((x[0] & 0xe0) >> 5 == 0x03) {
-            int oui = (x[3] << 16) + (x[2] << 8) + x[1];
-
-            /* find the HDMI vendor OUI */
-            if (oui == 0x000c03)
-                return TRUE;
-        }
-    }
-
-    /* guess it's not HDMI after all */
-    return FALSE;
+    return xf86MonitorFindHDMIBlock(mon) != NULL;
 }
index c63da8b..de8e718 100644 (file)
@@ -45,8 +45,6 @@ extern _X_EXPORT void
 
 extern _X_EXPORT Bool xf86SetDDCproperties(ScrnInfoPtr pScreen, xf86MonPtr DDC);
 
-extern _X_EXPORT DisplayModePtr xf86DDCGetModes(int scrnIndex, xf86MonPtr DDC);
-
 extern _X_EXPORT Bool
  xf86MonitorIsHDMI(xf86MonPtr mon);
 
@@ -100,4 +98,6 @@ typedef void (*handle_video_fn) (struct cea_video_block *, void *);
 
 void xf86ForEachVideoBlock(xf86MonPtr, handle_video_fn, void *);
 
+struct cea_data_block *xf86MonitorFindHDMIBlock(xf86MonPtr mon);
+
 #endif
index f161db6..dd076e4 100644 (file)
@@ -12,19 +12,19 @@ extsmoduledir = $(moduledir)/extensions
 extsmodule_LTLIBRARIES = $(GLXMODS)
 
 AM_CFLAGS = @XORG_CFLAGS@ @DIX_CFLAGS@
-INCLUDES = @XORG_INCS@ \
+AM_CPPFLAGS = @XORG_INCS@ \
            -I$(top_srcdir)/hw/xfree86/loader \
            -I$(top_srcdir)/miext/shadow \
            -I$(top_srcdir)/glx
 
 libfb_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG)
 libfb_la_LIBADD = $(top_builddir)/fb/libfb.la
-libfb_la_SOURCES = $(top_builddir)/fb/fbcmap_mi.c fbmodule.c
+libfb_la_SOURCES = fbmodule.c
 libfb_la_CFLAGS = $(AM_CFLAGS)
 
 libwfb_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG)
 libwfb_la_LIBADD = $(top_builddir)/fb/libwfb.la
-libwfb_la_SOURCES = $(top_builddir)/fb/fbcmap_mi.c fbmodule.c
+libwfb_la_SOURCES = fbmodule.c
 libwfb_la_CFLAGS = $(AM_CFLAGS) -DFB_ACCESS_WRAPPER
 
 libglx_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG)
@@ -32,7 +32,7 @@ libglx_la_LIBADD = $(top_builddir)/glx/libglx.la $(GLX_SYS_LIBS)
 if AIGLX_DRI_LOADER
 libglx_la_LIBADD += $(top_builddir)/glx/libglxdri.la
 if NO_UNDEFINED
-libglx_la_LIBADD += ../dri/libdri.la ../dri2/libdri2.la
+libglx_la_LIBADD += $(LIBDRM_LIBS) $(PIXMAN_LIBS)
 endif
 endif
 libglx_la_SOURCES = glxmodule.c
old mode 100644 (file)
new mode 100755 (executable)
index aa5fe3d..3147ff8
@@ -68,6 +68,11 @@ extern void SmackExtensionInit(INITARGS);
 #include "xsmack.h"
 #endif
 
+#ifdef CONTAINER
+extern void ContainerExtensionInit(void);
+#include "container.h"
+#endif // _F_CONTAINER_EXTENSION_
+
 #ifdef XEVIE
 extern void XevieExtensionInit(void);
 #endif
index c0c6114..d53c665 100644 (file)
@@ -47,10 +47,8 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 static MODULESETUPPROTO(glxSetup);
 
-static ExtensionModule GLXExt = {
-    GlxExtensionInit,
-    "GLX",
-    &noGlxExtension
+static const ExtensionModule GLXExt[] = {
+    { GlxExtensionInit, "GLX", &noGlxExtension },
 };
 
 static XF86ModuleVersionInfo VersRec = {
@@ -68,8 +66,8 @@ static XF86ModuleVersionInfo VersRec = {
 
 _X_EXPORT XF86ModuleData glxModuleData = { &VersRec, glxSetup, NULL };
 
-static pointer
-glxSetup(pointer module, pointer opts, int *errmaj, int *errmin)
+static void *
+glxSetup(void *module, void *opts, int *errmaj, int *errmin)
 {
     static Bool setupDone = FALSE;
     __GLXprovider *provider;
@@ -85,15 +83,12 @@ glxSetup(pointer module, pointer opts, int *errmaj, int *errmin)
     xf86Msg(xf86Info.aiglxFrom, "AIGLX %s\n",
             xf86Info.aiglx ? "enabled" : "disabled");
     if (xf86Info.aiglx) {
-        provider = LoaderSymbol("__glXDRIProvider");
-        if (provider)
-            GlxPushProvider(provider);
         provider = LoaderSymbol("__glXDRI2Provider");
         if (provider)
             GlxPushProvider(provider);
     }
 
-    LoadExtension(&GLXExt, FALSE);
+    LoadExtensionList(GLXExt, ARRAY_SIZE(GLXExt), FALSE);
 
     return module;
 }
index 4c2ca47..d1fd9af 100644 (file)
@@ -3561,13 +3561,6 @@ The following include files are typically required by video drivers:
          </para>
 
          <para>
-  All drivers implementing backing store need this:
-           <literallayout><filename>
-    "mibstore.h"
-             </filename></literallayout>
-         </para>
-
-         <para>
   All drivers using the mi colourmap code need this:
            <literallayout><filename>
     "micmap.h"
@@ -5927,10 +5920,10 @@ These may be moved out of the loader at some point.
 
       <blockquote><para>
          <programlisting>
-    void LoadExtension(ExtensionModule *ext);
+    void LoadExtensionList(const ExtensionModule ext[]);
          </programlisting>
          <blockquote><para>
-    This registers the entry points for the extension identified by
+    This registers the entry points for the extension array identified by
     <parameter>ext</parameter>.  The <structname>ExtensionModule</structname> struct is
     defined as:
 
@@ -8092,13 +8085,6 @@ visible symbols.
       </para>
 
       <para>
-  All drivers implementing backing store need this:
-       <literallayout><filename>
-    "mibstore.h"
-         </filename></literallayout>
-      </para>
-
-      <para>
   All drivers using the mi colourmap code need this:
        <literallayout><filename>
     "micmap.h"
@@ -9103,12 +9089,6 @@ ZZZScreenInit(ScreenPtr pScreen, int argc, char **argv)
         return FALSE;
 
     /*
-     * If backing store is to be supported (as is usually the case),
-     * initialise it.
-     */
-    miInitializeBackingStore(pScreen);
-
-    /*
      * Set initial black &amp; white colourmap indices.
      */
     xf86SetBlackWhitePixels(pScreen);
index 398178e..95828bb 100644 (file)
@@ -100,6 +100,11 @@ drmServerInfo DRIDRMServerInfo;
  * easily changed here.
  */
 #define DRI_MSG_VERBOSITY 1
+
+static void
+DRIDrvMsg(int scrnIndex, MessageType type, const char *format, ...)
+    _X_ATTRIBUTE_PRINTF(3,4);
+
 static void
 DRIDrvMsg(int scrnIndex, MessageType type, const char *format, ...)
 {
@@ -172,19 +177,15 @@ DRIOpenDRMMaster(ScrnInfoPtr pScrn,
     memset(&tmp, 0, sizeof(tmp));
 
     /* Check the DRM lib version.
-     * drmGetLibVersion was not supported in version 1.0, so check for
-     * symbol first to avoid possible crash or hang.
      */
 
     drmlibmajor = 1;
     drmlibminor = 0;
-    if (xf86LoaderCheckSymbol("drmGetLibVersion")) {
-        drmlibv = drmGetLibVersion(-1);
-        if (drmlibv != NULL) {
-            drmlibmajor = drmlibv->version_major;
-            drmlibminor = drmlibv->version_minor;
-            drmFreeVersion(drmlibv);
-        }
+    drmlibv = drmGetLibVersion(-1);
+    if (drmlibv != NULL) {
+        drmlibmajor = drmlibv->version_major;
+        drmlibminor = drmlibv->version_minor;
+        drmFreeVersion(drmlibv);
     }
 
     /* Check if the libdrm can handle falling back to loading based on name
@@ -320,6 +321,7 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD)
     ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
     DRIContextFlags flags = 0;
     DRIContextPrivPtr pDRIContextPriv;
+    static Bool drm_server_inited;
 
     /* If the DRI extension is disabled, do not initialize the DRI */
     if (noXFree86DRIExtension) {
@@ -345,6 +347,10 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD)
         return FALSE;
     }
 #endif
+    if (drm_server_inited == FALSE) {
+        drmSetServerInfo(&DRIDRMServerInfo);
+        drm_server_inited = TRUE;
+    }
 
     if (!DRIOpenDRMMaster(pScrn, pDRIInfo->SAREASize,
                           pDRIInfo->busIdString, pDRIInfo->drmDriverName))
@@ -395,7 +401,7 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD)
         }
         DRIDrvMsg(pScreen->myNum, X_INFO,
                   "[drm] added %d byte SAREA at %p\n",
-                  pDRIPriv->pDriverInfo->SAREASize, pDRIPriv->hSAREA);
+                  (int) pDRIPriv->pDriverInfo->SAREASize, (void *) (uintptr_t) pDRIPriv->hSAREA);
 
         /* Backwards compat. */
         if (drmMap(pDRIPriv->drmFD,
@@ -409,7 +415,7 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD)
             return FALSE;
         }
         DRIDrvMsg(pScreen->myNum, X_INFO, "[drm] mapped SAREA %p to %p\n",
-                  pDRIPriv->hSAREA, pDRIPriv->pSAREA);
+                  (void *) (uintptr_t) pDRIPriv->hSAREA, pDRIPriv->pSAREA);
         memset(pDRIPriv->pSAREA, 0, pDRIPriv->pDriverInfo->SAREASize);
     }
     else {
@@ -437,7 +443,7 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD)
             return FALSE;
         }
         DRIDrvMsg(pScreen->myNum, X_INFO, "[drm] framebuffer handle = %p\n",
-                  pDRIPriv->pDriverInfo->hFrameBuffer);
+                  (void *) (uintptr_t) pDRIPriv->pDriverInfo->hFrameBuffer);
     }
     else {
         DRIDrvMsg(pScreen->myNum, X_INFO,
@@ -450,14 +456,14 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD)
         /* Add tags for reserved contexts */
         if ((reserved = drmGetReservedContextList(pDRIPriv->drmFD,
                                                   &reserved_count))) {
-            int i;
+            int r;
             void *tag;
 
-            for (i = 0; i < reserved_count; i++) {
+            for (r = 0; r < reserved_count; r++) {
                 tag = DRICreateContextPrivFromHandle(pScreen,
-                                                     reserved[i],
+                                                     reserved[r],
                                                      DRI_CONTEXT_RESERVED);
-                drmAddContextTag(pDRIPriv->drmFD, reserved[i], tag);
+                drmAddContextTag(pDRIPriv->drmFD, reserved[r], tag);
             }
             drmFreeReservedContextList(reserved);
             DRIDrvMsg(pScreen->myNum, X_INFO,
@@ -508,7 +514,7 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD)
     pDRIPriv->myContextPriv = pDRIContextPriv;
 
     DRIDrvMsg(pScreen->myNum, X_INFO,
-              "X context handle = %p\n", pDRIPriv->myContext);
+              "X context handle = %p\n", (void *) (uintptr_t) pDRIPriv->myContext);
 
     /* Now that we have created the X server's context, we can grab the
      * hardware lock for the X server.
@@ -674,9 +680,9 @@ DRICloseScreen(ScreenPtr pScreen)
                 pDRIPriv->wrap.ClipNotify = NULL;
             }
             if (pDRIInfo->wrap.AdjustFrame) {
-                ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
+                ScrnInfoPtr scrn = xf86ScreenToScrn(pScreen);
 
-                pScrn->AdjustFrame = pDRIPriv->wrap.AdjustFrame;
+                scrn->AdjustFrame = pDRIPriv->wrap.AdjustFrame;
                 pDRIPriv->wrap.AdjustFrame = NULL;
             }
 
@@ -726,13 +732,13 @@ DRICloseScreen(ScreenPtr pScreen)
         if (closeMaster || pDRIPriv->hSAREA != pDRIEntPriv->hLSAREA) {
             DRIDrvMsg(pScreen->myNum, X_INFO,
                       "[drm] unmapping %d bytes of SAREA %p at %p\n",
-                      pDRIInfo->SAREASize, pDRIPriv->hSAREA, pDRIPriv->pSAREA);
+                      (int) pDRIInfo->SAREASize, (void *) (uintptr_t) pDRIPriv->hSAREA, pDRIPriv->pSAREA);
             if (drmUnmap(pDRIPriv->pSAREA, pDRIInfo->SAREASize)) {
                 DRIDrvMsg(pScreen->myNum, X_ERROR,
                           "[drm] unable to unmap %d bytes"
                           " of SAREA %p at %p\n",
-                          pDRIInfo->SAREASize,
-                          pDRIPriv->hSAREA, pDRIPriv->pSAREA);
+                          (int) pDRIInfo->SAREASize,
+                          (void *) (uintptr_t) pDRIPriv->hSAREA, pDRIPriv->pSAREA);
             }
         }
         else {
@@ -756,6 +762,10 @@ DRICloseScreen(ScreenPtr pScreen)
 
 static int
 dri_drm_debug_print(const char *format, va_list ap)
+    _X_ATTRIBUTE_PRINTF(1,0);
+
+static int
+dri_drm_debug_print(const char *format, va_list ap)
 {
     xf86VDrvMsgVerb(-1, X_NONE, DRM_MSG_VERBOSITY, format, ap);
     return 0;
@@ -791,8 +801,6 @@ DRIExtensionInit(void)
 
     RegisterBlockAndWakeupHandlers(DRIBlockHandler, DRIWakeupHandler, NULL);
 
-    drmSetServerInfo(&DRIDRMServerInfo);
-
     return TRUE;
 }
 
@@ -1040,7 +1048,7 @@ DRICreateContext(ScreenPtr pScreen, VisualPtr visual,
     }
 
     /* track this in case the client dies before cleanup */
-    AddResource(context, DRIContextPrivResType, (pointer) pDRIContextPriv);
+    AddResource(context, DRIContextPrivResType, (void *) pDRIContextPriv);
 
     return TRUE;
 }
@@ -1055,7 +1063,7 @@ DRIDestroyContext(ScreenPtr pScreen, XID context)
 
 /* DRIContextPrivDelete is called by the resource manager. */
 Bool
-DRIContextPrivDelete(pointer pResource, XID id)
+DRIContextPrivDelete(void *pResource, XID id)
 {
     DRIContextPrivPtr pDRIContextPriv = (DRIContextPrivPtr) pResource;
     DRIScreenPrivPtr pDRIPriv;
@@ -1138,7 +1146,7 @@ DRITransitionTo2d(ScreenPtr pScreen)
 }
 
 static int
-DRIDCNTreeTraversal(WindowPtr pWin, pointer data)
+DRIDCNTreeTraversal(WindowPtr pWin, void *data)
 {
     DRIDrawablePrivPtr pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin);
 
@@ -1177,7 +1185,7 @@ DRIDriverClipNotify(ScreenPtr pScreen)
         if (pDRIPriv->nrWindows > 0) {
             pDRIPriv->nrWalked = 0;
             TraverseTree(pScreen->root, DRIDCNTreeTraversal,
-                         (pointer) pDRIWindows);
+                         (void *) pDRIWindows);
         }
 
         pDRIInfo->ClipNotify(pScreen, pDRIWindows, pDRIPriv->nrWindows);
@@ -1272,7 +1280,7 @@ DRICreateDrawable(ScreenPtr pScreen, ClientPtr client, DrawablePtr pDrawable,
 
         /* track this in case the client dies */
         AddResource(FakeClientID(client->index), DRIDrawablePrivResType,
-                    (pointer) (intptr_t) pDrawable->id);
+                    (void *) (intptr_t) pDrawable->id);
 
         if (pDRIDrawablePriv->hwDrawable) {
             drmUpdateDrawableInfo(pDRIPriv->drmFD,
@@ -1325,7 +1333,7 @@ DRIDrawablePrivDestroy(WindowPtr pWin)
 }
 
 static Bool
-DRIDestroyDrawableCB(pointer value, XID id, pointer data)
+DRIDestroyDrawableCB(void *value, XID id, void *data)
 {
     if (value == data) {
         /* This calls back DRIDrawablePrivDelete which frees private area */
@@ -1343,7 +1351,7 @@ DRIDestroyDrawable(ScreenPtr pScreen, ClientPtr client, DrawablePtr pDrawable)
     if (pDrawable->type == DRAWABLE_WINDOW) {
         LookupClientResourceComplex(client, DRIDrawablePrivResType,
                                     DRIDestroyDrawableCB,
-                                    (pointer) (intptr_t) pDrawable->id);
+                                    (void *) (intptr_t) pDrawable->id);
     }
     else {                      /* pixmap (or for GLX 1.3, a PBuffer) */
         /* NOT_DONE */
@@ -1354,7 +1362,7 @@ DRIDestroyDrawable(ScreenPtr pScreen, ClientPtr client, DrawablePtr pDrawable)
 }
 
 Bool
-DRIDrawablePrivDelete(pointer pResource, XID id)
+DRIDrawablePrivDelete(void *pResource, XID id)
 {
     WindowPtr pWin;
     int rc;
@@ -1613,7 +1621,7 @@ DRIDestroyInfoRec(DRIInfoPtr DRIInfo)
 }
 
 void
-DRIWakeupHandler(pointer wakeupData, int result, pointer pReadmask)
+DRIWakeupHandler(void *wakeupData, int result, void *pReadmask)
 {
     int i;
 
@@ -1628,7 +1636,7 @@ DRIWakeupHandler(pointer wakeupData, int result, pointer pReadmask)
 }
 
 void
-DRIBlockHandler(pointer blockData, OSTimePtr pTimeout, pointer pReadmask)
+DRIBlockHandler(void *blockData, OSTimePtr pTimeout, void *pReadmask)
 {
     int i;
 
@@ -1644,7 +1652,7 @@ DRIBlockHandler(pointer blockData, OSTimePtr pTimeout, pointer pReadmask)
 
 void
 DRIDoWakeupHandler(ScreenPtr pScreen,
-                   unsigned long result, pointer pReadmask)
+                   unsigned long result, void *pReadmask)
 {
     DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
 
@@ -1662,7 +1670,7 @@ DRIDoWakeupHandler(ScreenPtr pScreen,
 
 void
 DRIDoBlockHandler(ScreenPtr pScreen,
-                  pointer pTimeout, pointer pReadmask)
+                  void *pTimeout, void *pReadmask)
 {
     DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
 
@@ -1865,7 +1873,7 @@ DRIWindowExposures(WindowPtr pWin, RegionPtr prgn, RegionPtr bsreg)
 }
 
 static int
-DRITreeTraversal(WindowPtr pWin, pointer data)
+DRITreeTraversal(WindowPtr pWin, void *data)
 {
     DRIDrawablePrivPtr pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin);
 
@@ -1925,7 +1933,7 @@ DRICopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
 
         RegionNull(&reg);
         pDRIPriv->nrWalked = 0;
-        TraverseTree(pWin, DRITreeTraversal, (pointer) (&reg));
+        TraverseTree(pWin, DRITreeTraversal, (void *) (&reg));
 
         if (RegionNotEmpty(&reg)) {
             RegionTranslate(&reg, ptOldOrg.x - pWin->drawable.x,
@@ -2211,9 +2219,9 @@ DRILock(ScreenPtr pScreen, int flags)
     else if (*pDRIPriv->pLockingContext != pDRIPriv->myContext) {
         DRIDrvMsg(pScreen->myNum, X_ERROR,
                   "[DRI] Locking deadlock.\n"
-                  "\tAlready locked with context %d,\n"
-                  "\ttrying to lock with context %d.\n",
-                  pDRIPriv->pLockingContext, pDRIPriv->myContext);
+                  "\tAlready locked with context %p,\n"
+                  "\ttrying to lock with context %p.\n",
+                  pDRIPriv->pLockingContext, (void *) (uintptr_t) pDRIPriv->myContext);
     }
     (*pDRIPriv->pLockRefCount)++;
 }
@@ -2230,8 +2238,8 @@ DRIUnlock(ScreenPtr pScreen)
         if (pDRIPriv->myContext != *pDRIPriv->pLockingContext) {
             DRIDrvMsg(pScreen->myNum, X_ERROR,
                       "[DRI] Unlocking inconsistency:\n"
-                      "\tContext %d trying to unlock lock held by context %d\n",
-                      pDRIPriv->pLockingContext, pDRIPriv->myContext);
+                      "\tContext %p trying to unlock lock held by context %p\n",
+                      pDRIPriv->pLockingContext, (void *) (uintptr_t) pDRIPriv->myContext);
         }
         (*pDRIPriv->pLockRefCount)--;
     }
index 4bfaf16..64cd7c9 100644 (file)
@@ -151,7 +151,7 @@ typedef struct {
     int ddxDriverMajorVersion;
     int ddxDriverMinorVersion;
     int ddxDriverPatchVersion;
-    pointer frameBufferPhysicalAddress;
+    void *frameBufferPhysicalAddress;
     long frameBufferSize;
     long frameBufferStride;
     long SAREASize;
@@ -224,7 +224,7 @@ extern _X_EXPORT Bool DRICreateContext(ScreenPtr pScreen,
 
 extern _X_EXPORT Bool DRIDestroyContext(ScreenPtr pScreen, XID context);
 
-extern _X_EXPORT Bool DRIContextPrivDelete(pointer pResource, XID id);
+extern _X_EXPORT Bool DRIContextPrivDelete(void *pResource, XID id);
 
 extern _X_EXPORT Bool DRICreateDrawable(ScreenPtr pScreen,
                                         ClientPtr client,
@@ -235,7 +235,7 @@ extern _X_EXPORT Bool DRIDestroyDrawable(ScreenPtr pScreen,
                                          ClientPtr client,
                                          DrawablePtr pDrawable);
 
-extern _X_EXPORT Bool DRIDrawablePrivDelete(pointer pResource, XID id);
+extern _X_EXPORT Bool DRIDrawablePrivDelete(void *pResource, XID id);
 
 extern _X_EXPORT Bool DRIGetDrawableInfo(ScreenPtr pScreen,
                                          DrawablePtr pDrawable,
@@ -265,18 +265,18 @@ extern _X_EXPORT void DRIDestroyInfoRec(DRIInfoPtr DRIInfo);
 
 extern _X_EXPORT Bool DRIFinishScreenInit(ScreenPtr pScreen);
 
-extern _X_EXPORT void DRIWakeupHandler(pointer wakeupData,
-                                       int result, pointer pReadmask);
+extern _X_EXPORT void DRIWakeupHandler(void *wakeupData,
+                                       int result, void *pReadmask);
 
-extern _X_EXPORT void DRIBlockHandler(pointer blockData,
-                                      OSTimePtr pTimeout, pointer pReadmask);
+extern _X_EXPORT void DRIBlockHandler(void *blockData,
+                                      OSTimePtr pTimeout, void *pReadmask);
 
 extern _X_EXPORT void DRIDoWakeupHandler(ScreenPtr pScreen,
                                          unsigned long result,
-                                         pointer pReadmask);
+                                         void *pReadmask);
 
 extern _X_EXPORT void DRIDoBlockHandler(ScreenPtr pScreen,
-                                        pointer pTimeout, pointer pReadmask);
+                                        void *pTimeout, void *pReadmask);
 
 extern _X_EXPORT void DRISwapContext(int drmFD, void *oldctx, void *newctx);
 
index ba74bb0..086e833 100644 (file)
@@ -118,7 +118,7 @@ ProcXF86DRIQueryDirectRenderingCapable(register ClientPtr client)
         return BadValue;
     }
 
-    if (!LocalClient(client) || client->swapped)
+    if (!client->local || client->swapped)
         isCapable = 0;
 
     rep = (xXF86DRIQueryDirectRenderingCapableReply) {
@@ -280,7 +280,7 @@ ProcXF86DRICreateContext(register ClientPtr client)
 
     if (!DRICreateContext(pScreen,
                           NULL,
-                          stuff->context, (drm_context_t *) & rep.hHWContext)) {
+                          stuff->context, (drm_context_t *) &rep.hHWContext)) {
         return BadValue;
     }
 
@@ -329,7 +329,7 @@ ProcXF86DRICreateDrawable(ClientPtr client)
         return rc;
 
     if (!DRICreateDrawable(screenInfo.screens[stuff->screen], client,
-                           pDrawable, (drm_drawable_t *) & rep.hHWDrawable)) {
+                           pDrawable, (drm_drawable_t *) &rep.hHWDrawable)) {
         return BadValue;
     }
 
@@ -528,7 +528,7 @@ ProcXF86DRIDispatch(register ClientPtr client)
         return ProcXF86DRIQueryDirectRenderingCapable(client);
     }
 
-    if (!LocalClient(client))
+    if (!client->local)
         return DRIErrorBase + XF86DRIClientNotLocal;
 
     switch (stuff->data) {
index 2f90fed..368d75a 100755 (executable)
@@ -48,6 +48,7 @@
 #include "xf86VGAarbiter.h"
 #include "damage.h"
 #include "xf86.h"
+#include "compint.h"
 
 CARD8 dri2_major;               /* version of DRI2 supported by DDX */
 CARD8 dri2_minor;
@@ -72,6 +73,10 @@ static DevPrivateKeyRec dri2ClientPrivateKeyRec;
 
 #define dri2ClientPrivate(_pClient) (dixLookupPrivate(&(_pClient)->devPrivates, \
                                                       dri2ClientPrivateKey))
+#ifdef _F_DRI2_SKIP_FRAME_NOT_VIEWABLE_
+#define IS_VIEWABLE(pDraw) \
+    ((pDraw->type == DRAWABLE_PIXMAP)?TRUE:(Bool)(((WindowPtr) pDraw)->viewable))
+#endif
 
 typedef struct _DRI2Client {
     int prime_id;
@@ -99,11 +104,16 @@ typedef struct _DRI2Drawable {
     CARD64 last_swap_msc;       /* msc at completion of most recent swap */
     CARD64 last_swap_ust;       /* ust at completion of most recent swap */
     int swap_limit;             /* for N-buffering */
+#ifdef _F_DRI2_CHECK_SERIALNUMBER_
     unsigned long serialNumber;
+#endif
     Bool needInvalidate;
     int prime_id;
     PixmapPtr prime_slave_pixmap;
     PixmapPtr redirectpixmap;
+#ifdef _F_DRI2_SKIP_FRAME_WINDOW_SIZE_CHANGED_
+    int is_new_back_buffer; /* -1: unknown, 0:false, 1:true*/
+#endif
 } DRI2DrawableRec, *DRI2DrawablePtr;
 
 typedef struct _DRI2Screen {
@@ -131,6 +141,7 @@ typedef struct _DRI2Screen {
     HandleExposuresProcPtr HandleExposures;
 
     ConfigNotifyProcPtr ConfigNotify;
+    SetWindowPixmapProcPtr SetWindowPixmap;
     DRI2CreateBuffer2ProcPtr CreateBuffer2;
     DRI2DestroyBuffer2ProcPtr DestroyBuffer2;
     DRI2CopyRegion2ProcPtr CopyRegion2;
@@ -162,11 +173,9 @@ GetScreenPrime(ScreenPtr master, int prime_id)
 
         ds = DRI2GetScreen(slave);
         if (ds->prime_id == prime_id)
-            break;
+            return slave;
     }
-    if (!slave)
-        return master;
-    return slave;
+    return master;
 }
 
 static DRI2ScreenPtr
@@ -194,6 +203,7 @@ DRI2GetDrawable(DrawablePtr pDraw)
     }
 }
 
+#ifdef _F_DRI2_CHECK_SERIALNUMBER_
 static unsigned long
 DRI2DrawableSerial(DrawablePtr pDraw)
 {
@@ -206,6 +216,7 @@ DRI2DrawableSerial(DrawablePtr pDraw)
     pPix = pScreen->GetWindowPixmap((WindowPtr) pDraw);
     return pPix->drawable.serialNumber;
 }
+#endif
 
 static DRI2DrawablePtr
 DRI2AllocateDrawable(DrawablePtr pDraw)
@@ -240,7 +251,9 @@ DRI2AllocateDrawable(DrawablePtr pDraw)
     pPriv->last_swap_msc = 0;
     pPriv->last_swap_ust = 0;
     xorg_list_init(&pPriv->reference_list);
+#ifdef _F_DRI2_CHECK_SERIALNUMBER_
     pPriv->serialNumber = DRI2DrawableSerial(pDraw);
+#endif
     pPriv->needInvalidate = FALSE;
     pPriv->redirectpixmap = NULL;
     pPriv->prime_slave_pixmap = NULL;
@@ -372,6 +385,9 @@ DRI2CreateDrawable2(ClientPtr client, DrawablePtr pDraw, XID id,
         return Success;
 #endif
 
+#ifdef _F_DRI2_SKIP_FRAME_WINDOW_SIZE_CHANGED_
+    pPriv->is_new_back_buffer = -1;
+#endif
     pPriv->prime_id = dri2_client->prime_id;
 
     dri2_id = FakeClientID(client->index);
@@ -393,7 +409,7 @@ DRI2CreateDrawable(ClientPtr client, DrawablePtr pDraw, XID id,
 }
 
 static int
-DRI2DrawableGone(pointer p, XID id)
+DRI2DrawableGone(void *p, XID id)
 {
     DRI2DrawablePtr pPriv = p;
     DRI2DrawableRefPtr ref, next;
@@ -456,18 +472,14 @@ DRI2DrawableGone(pointer p, XID id)
 }
 
 static DRI2BufferPtr
-create_buffer(DrawablePtr pDraw,
+create_buffer(DRI2ScreenPtr ds, DrawablePtr pDraw,
               unsigned int attachment, unsigned int format)
 {
-    ScreenPtr primeScreen;
-    DRI2DrawablePtr pPriv;
-    DRI2ScreenPtr ds;
     DRI2BufferPtr buffer;
-    pPriv = DRI2GetDrawable(pDraw);
-    primeScreen = GetScreenPrime(pDraw->pScreen, pPriv->prime_id);
-    ds = DRI2GetScreenPrime(pDraw->pScreen, pPriv->prime_id);
     if (ds->CreateBuffer2)
-        buffer = (*ds->CreateBuffer2)(primeScreen, pDraw, attachment, format);
+        buffer = (*ds->CreateBuffer2)(GetScreenPrime(pDraw->pScreen,
+                                                     DRI2GetDrawable(pDraw)->prime_id),
+                                      pDraw, attachment, format);
     else
         buffer = (*ds->CreateBuffer)(pDraw, attachment, format);
     return buffer;
@@ -514,12 +526,14 @@ allocate_or_reuse_buffer(DrawablePtr pDraw, DRI2ScreenPtr ds,
     int old_buf = find_attachment(pPriv, attachment);
 
     if ((old_buf < 0)
-#ifndef _F_NOT_ALWAYS_CREATE_FRONTBUFFER_
+#ifndef _F_DRI2_NOT_ALWAYS_CREATE_FRONTBUFFER_
         || attachment == DRI2BufferFrontLeft
 #endif
         || !dimensions_match || (pPriv->buffers[old_buf]->format != format)) {
-        *buffer = create_buffer (pDraw, attachment, format);
+        *buffer = create_buffer(ds, pDraw, attachment, format);
+#ifdef _F_DRI2_CHECK_SERIALNUMBER_
         pPriv->serialNumber = DRI2DrawableSerial(pDraw);
+#endif
         return TRUE;
 
     }
@@ -582,11 +596,16 @@ do_get_buffers(DrawablePtr pDraw, int *width, int *height,
         return NULL;
     }
 
-    ds = DRI2GetScreen(pDraw->pScreen);
+    ds = DRI2GetScreenPrime(pDraw->pScreen, pPriv->prime_id);
 
+#ifdef _F_DRI2_CHECK_SERIALNUMBER_
     dimensions_match = (pDraw->width == pPriv->width)
         && (pDraw->height == pPriv->height)
         && (pPriv->serialNumber == DRI2DrawableSerial(pDraw));
+#else
+    dimensions_match = (pDraw->width == pPriv->width)
+        && (pDraw->height == pPriv->height);
+#endif
 
     buffers = calloc((count + 1), sizeof(buffers[0]));
     if (!buffers)
@@ -678,7 +697,19 @@ do_get_buffers(DrawablePtr pDraw, int *width, int *height,
     }
 
     pPriv->needInvalidate = TRUE;
-
+#ifdef _F_DRI2_SKIP_FRAME_WINDOW_SIZE_CHANGED_
+    if (buffers_changed)
+    {
+        pPriv->is_new_back_buffer = 1;
+    }
+    else
+    {
+        if (pPriv->is_new_back_buffer == -1)
+        {
+            pPriv->is_new_back_buffer = 0;
+        }
+    }
+#endif
     return pPriv->buffers;
 
  err_out:
@@ -792,6 +823,44 @@ static inline PixmapPtr GetDrawablePixmap(DrawablePtr drawable)
     }
 }
 
+/*
+ * A TraverseTree callback to invalidate all windows using the same
+ * pixmap
+ */
+static int
+DRI2InvalidateWalk(WindowPtr pWin, void *data)
+{
+    if (pWin->drawable.pScreen->GetWindowPixmap(pWin) != data)
+        return WT_DONTWALKCHILDREN;
+    DRI2InvalidateDrawable(&pWin->drawable);
+    return WT_WALKCHILDREN;
+}
+
+static void
+DRI2InvalidateDrawableAll(DrawablePtr pDraw)
+{
+    if (pDraw->type == DRAWABLE_WINDOW) {
+        WindowPtr pWin = (WindowPtr) pDraw;
+        PixmapPtr pPixmap = pDraw->pScreen->GetWindowPixmap(pWin);
+
+        /*
+         * Find the top-most window using this pixmap
+         */
+        while (pWin->parent &&
+               pDraw->pScreen->GetWindowPixmap(pWin->parent) == pPixmap)
+            pWin = pWin->parent;
+
+        /*
+         * Walk the sub-tree to invalidate all of the
+         * windows using the same pixmap
+         */
+        TraverseTree(pWin, DRI2InvalidateWalk, pPixmap);
+        DRI2InvalidateDrawable(&pPixmap->drawable);
+    }
+    else
+        DRI2InvalidateDrawable(pDraw);
+}
+
 DrawablePtr DRI2UpdatePrime(DrawablePtr pDraw, DRI2BufferPtr pDest)
 {
     DRI2DrawablePtr pPriv = DRI2GetDrawable(pDraw);
@@ -857,6 +926,8 @@ DrawablePtr DRI2UpdatePrime(DrawablePtr pDraw, DRI2BufferPtr pDest)
     spix->screen_x = mpix->screen_x;
     spix->screen_y = mpix->screen_y;
 #endif
+
+    DRI2InvalidateDrawableAll(pDraw);
     return &spix->drawable;
 }
 
@@ -956,7 +1027,59 @@ DRI2CanFlip(DrawablePtr pDraw)
 Bool
 DRI2CanExchange(DrawablePtr pDraw)
 {
+#ifdef _F_DRI2_SKIP_FRAME_WINDOW_SIZE_CHANGED_
+    ScreenPtr pScreen = pDraw->pScreen;
+    WindowPtr pWin;
+    PixmapPtr pWinPixmap;
+    DRI2DrawablePtr pPriv;
+    CompScreenPtr pCompScreen = GetCompScreen (pScreen);
+
+    if (pDraw->type == DRAWABLE_PIXMAP)
+        return TRUE;
+
+    pPriv = DRI2GetDrawable(pDraw);
+    if (pPriv == NULL)
+        return FALSE;
+
+    pWin = (WindowPtr) pDraw;
+    pWinPixmap = pScreen->GetWindowPixmap(pWin);
+
+    /* HACK : if drawable is the child of the overlay window or drawable is non-compredirected,
+       we do not check the size of the drawable, not compare the window pixmap */
+    if (pWin->parent && pWin->parent == pCompScreen->pOverlayWin ||
+        pWin->redirectDraw == RedirectDrawNone) {
+        if (pDraw->width != pPriv->width || pDraw->height != pPriv->height) {
+            ErrorF("[DRI2] %s: The Child of Overlay window %p draw(%dx%d+%d+%d), dri2(%d,%d)\n", __func__,
+                            pDraw->id,
+                            pDraw->width, pDraw->height, pDraw->x, pDraw->y, pPriv->width, pPriv->height);
+            return FALSE;
+        }
+
+        return TRUE;
+    }
+
+    /* Does the window match the pixmap exactly? */
+    if (
+#ifdef COMPOSITE
+        pDraw->x != pWinPixmap->screen_x || pDraw->y != pWinPixmap->screen_y ||
+#endif
+        pDraw->width != pWinPixmap->drawable.width ||
+        pDraw->height != pWinPixmap->drawable.height ||
+        pDraw->width != pPriv->width ||
+        pDraw->height != pPriv->height)
+    {
+        ErrorF("[DRI2] %s: %p draw(%dx%d+%d+%d), winpix(%dx%d+%d+%d), dri2(%d,%d)\n", __func__,
+                        pDraw->id,
+                        pDraw->width, pDraw->height, pDraw->x, pDraw->y,
+                        pWinPixmap->drawable.width, pWinPixmap->drawable.height, pWinPixmap->screen_x, pWinPixmap->screen_y,
+                        pPriv->width, pPriv->height);
+        return FALSE;
+    }
+
+    return TRUE;
+#else
     return FALSE;
+#endif
 }
 
 void
@@ -1074,19 +1197,67 @@ DRI2WaitSwap(ClientPtr client, DrawablePtr pDrawable)
     return FALSE;
 }
 
-/*
- * A TraverseTree callback to invalidate all windows using the same
- * pixmap
- */
-static int
-DRI2InvalidateWalk(WindowPtr pWin, pointer data)
+#ifdef _F_DRI2_COMMIT_FRAME_DONE_
+static XID
+_FindTopLevelWindow (ScreenPtr screen, DrawablePtr pDraw)
 {
-    if (pWin->drawable.pScreen->GetWindowPixmap(pWin) != data)
-        return WT_DONTWALKCHILDREN;
-    DRI2InvalidateDrawable(&pWin->drawable);
-    return WT_WALKCHILDREN;
+    WindowPtr pWin = (WindowPtr)pDraw;
+    WindowPtr pRoot = screen->root;
+    CompScreenPtr pCompScreen = GetCompScreen (screen);
+
+    /* find the border window */
+    while (pWin->parent && pWin->parent->drawable.id != pRoot->drawable.id)
+        pWin = pWin->parent;
+
+    /* if the toplevel window is overlay window,
+       return id of the child of the overlay window ( drawable id itself ).
+       e17 compositor want to get the syncdraw done message of the
+       child window of the overlay window */
+    if (pCompScreen) {
+        if (pWin == pCompScreen->pOverlayWin) {
+            pWin = (WindowPtr) pDraw;
+        }
+    }
+
+    return pWin->drawable.id;
 }
 
+static void
+_SendSyncDrawDoneMessage(ScreenPtr screen, ClientPtr client, DrawablePtr pDraw)
+{
+    static Atom sync_draw_done = None;
+    xEvent event;
+    DeviceIntPtr dev = PickPointer(client);
+    XID ret;
+
+    if (!dev)
+    {
+        xf86DrvMsg(screen->myNum, X_WARNING, "[DRI2] %s:Fail to get DeviceIntPtr", __func__);
+        return;
+    }
+
+    if (sync_draw_done == None)
+        sync_draw_done = MakeAtom ("_E_COMP_SYNC_DRAW_DONE", strlen ("_E_COMP_SYNC_DRAW_DONE"), TRUE);
+
+    if (pDraw->type == DRAWABLE_WINDOW)
+        ret = _FindTopLevelWindow (screen, pDraw);
+    else
+        ret = pDraw->id;
+
+    memset (&event, 0, sizeof (xEvent));
+    event.u.u.type = ClientMessage;
+    event.u.u.detail = 32;
+    event.u.clientMessage.window = ret;
+    event.u.clientMessage.u.l.type = sync_draw_done;
+    event.u.clientMessage.u.l.longs0 = ret; // window id
+    event.u.clientMessage.u.l.longs1 = 1; // version
+    event.u.clientMessage.u.l.longs2 = pDraw->width; // window's width
+    event.u.clientMessage.u.l.longs3 = pDraw->height; // window's height
+
+    DeliverEventsToWindow(dev, screen->root, &event, 1, SubstructureRedirectMask | SubstructureNotifyMask, NullGrab);
+}
+#endif
+
 #ifdef _F_DRI2_SWAP_REGION_
 int
 DRI2SwapBuffersWithRegion(ClientPtr client, DrawablePtr pDraw, CARD64 target_msc,
@@ -1107,6 +1278,14 @@ DRI2SwapBuffersWithRegion(ClientPtr client, DrawablePtr pDraw, CARD64 target_msc
         return BadDrawable;
     }
 
+    /* According to spec, return expected swapbuffers count SBC after this swap
+     * will complete. This is ignored unless we return Success, but it must be
+     * initialized on every path where we return Success or the caller will send
+     * an uninitialized value off the stack to the client. So let's initialize
+     * it as early as possible, just to be sure.
+     */
+    *swap_target = pPriv->swap_count + pPriv->swapsPending + 1;
+
     for (i = 0; i < pPriv->bufferCount; i++) {
         if (pPriv->buffers[i]->attachment == DRI2BufferFrontLeft)
             pDestBuffer = (DRI2BufferPtr) pPriv->buffers[i];
@@ -1119,6 +1298,42 @@ DRI2SwapBuffersWithRegion(ClientPtr client, DrawablePtr pDraw, CARD64 target_msc
         return BadDrawable;
     }
 
+#ifdef _F_DRI2_SKIP_FRAME_WINDOW_SIZE_CHANGED_
+    /* Skip this frame if window size is change after GetBuffer */
+    if (!DRI2CanExchange(pDraw)) {
+        return Success;
+    }
+
+    if (pPriv->is_new_back_buffer == 1 && pRegion)
+    {
+        BoxPtr pBox;
+        pBox = RegionExtents(pRegion);
+
+        if((pBox->x2 - pBox->x1) != pDraw->width ||
+           (pBox->y2 - pBox->y1) != pDraw->height)
+        {
+            pPriv->is_new_back_buffer = -1; /*reset value*/
+            xf86DrvMsg(pScreen->myNum, X_WARNING,
+                       "[DRI2] %s: Skip Frame(0x%x) draw(%dx%d), region(%dx%d)\n",
+                       __func__,
+                       pDraw->id,
+                       pDraw->width, pDraw->height,
+                       (pBox->x2 - pBox->x1), (pBox->y2 - pBox->y1));
+            return Success;
+        }
+    }
+    pPriv->is_new_back_buffer = -1; /*reset value*/
+#endif
+
+#ifdef _F_DRI2_SKIP_FRAME_NOT_VIEWABLE_
+    if (!IS_VIEWABLE(pDraw)) {
+        ErrorF("[DRI2] %s: Skip frame not viewable 0x%x draw(%dx%d+%d+%d)\n", __func__,
+                        pDraw->id,
+                        pDraw->width, pDraw->height, pDraw->x, pDraw->y);
+        return Success;
+    }
+#endif
+
     /* Old DDX or no swap interval, just blit */
     if ((!ds->ScheduleSwap && !ds->ScheduleSwapWithRegion) ||
         !pPriv->swap_interval ||
@@ -1143,6 +1358,10 @@ DRI2SwapBuffersWithRegion(ClientPtr client, DrawablePtr pDraw, CARD64 target_msc
         DRI2SwapComplete(client, pDraw, target_msc, 0, 0, DRI2_BLIT_COMPLETE,
                          func, data);
 
+#ifdef _F_DRI2_COMMIT_FRAME_DONE_
+        _SendSyncDrawDoneMessage(pScreen, client, pDraw);
+#endif
+
         return Success;
     }
 
@@ -1242,6 +1461,9 @@ DRI2SwapBuffersWithRegion(ClientPtr client, DrawablePtr pDraw, CARD64 target_msc
     else
         DRI2InvalidateDrawable(pDraw);
 
+#ifdef _F_DRI2_COMMIT_FRAME_DONE_
+    _SendSyncDrawDoneMessage(pScreen, client, pDraw);
+#endif
     return Success;
 }
 #endif
@@ -1492,6 +1714,51 @@ DRI2ConfigNotify(WindowPtr pWin, int x, int y, int w, int h, int bw,
     return Success;
 }
 
+static void
+DRI2SetWindowPixmap(WindowPtr pWin, PixmapPtr pPix)
+{
+    DrawablePtr pDraw = (DrawablePtr) pWin;
+    ScreenPtr pScreen = pDraw->pScreen;
+    DRI2ScreenPtr ds = DRI2GetScreen(pScreen);
+#ifdef _F_DRI2_RESET_FRONT_
+    DRI2DrawablePtr dd = DRI2GetDrawable(pDraw);
+    int ret;
+
+    if (ds->SetWindowPixmap) {
+        pScreen->SetWindowPixmap = ds->SetWindowPixmap;
+
+        (*pScreen->SetWindowPixmap) (pWin, pPix);
+
+        ds->SetWindowPixmap = pScreen->SetWindowPixmap;
+        pScreen->SetWindowPixmap = DRI2SetWindowPixmap;
+
+        DRI2InvalidateDrawableAll(pDraw);
+    }
+
+    /* Reset front buffer */
+    if (dd)
+    {
+       int old_buf = find_attachment(dd, DRI2BufferFrontLeft);
+       if (old_buf >= 0)
+       {
+           DRI2BufferPtr buffer;
+           buffer = dd->buffers[old_buf];
+
+           if (ds->ReuseBufferNotify)
+               (*ds->ReuseBufferNotify) (pDraw, buffer);
+       }
+    }
+
+#else
+    pScreen->SetWindowPixmap = ds->SetWindowPixmap;
+    (*pScreen->SetWindowPixmap) (pWin, pPix);
+    ds->SetWindowPixmap = pScreen->SetWindowPixmap;
+    pScreen->SetWindowPixmap = DRI2SetWindowPixmap;
+
+    DRI2InvalidateDrawableAll(pDraw);
+#endif
+}
+
 #define MAX_PRIME DRI2DriverPrimeMask
 static int
 get_prime_id(void)
@@ -1644,6 +1911,9 @@ DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info)
     ds->ConfigNotify = pScreen->ConfigNotify;
     pScreen->ConfigNotify = DRI2ConfigNotify;
 
+    ds->SetWindowPixmap = pScreen->SetWindowPixmap;
+    pScreen->SetWindowPixmap = DRI2SetWindowPixmap;
+
     xf86DrvMsg(pScreen->myNum, X_INFO, "[DRI2] Setup complete\n");
     for (i = 0; i < sizeof(driverTypeNames) / sizeof(driverTypeNames[0]); i++) {
         if (i < ds->numDrivers && ds->driverNames[i]) {
@@ -1668,6 +1938,7 @@ DRI2CloseScreen(ScreenPtr pScreen)
     DRI2ScreenPtr ds = DRI2GetScreen(pScreen);
 
     pScreen->ConfigNotify = ds->ConfigNotify;
+    pScreen->SetWindowPixmap = ds->SetWindowPixmap;
 
     if (ds->prime_id)
         prime_id_allocate_bitmask &= ~(1 << ds->prime_id);
@@ -1676,8 +1947,6 @@ DRI2CloseScreen(ScreenPtr pScreen)
     dixSetPrivate(&pScreen->devPrivates, dri2ScreenPrivateKey, NULL);
 }
 
-extern Bool DRI2ModuleSetup(void);
-
 /* Called by InitExtensions() */
 Bool
 DRI2ModuleSetup(void)
index 4b93f19..55bc37d 100755 (executable)
@@ -630,7 +630,7 @@ ProcDRI2Dispatch(ClientPtr client)
         return ProcDRI2QueryVersion(client);
     }
 
-    if (!LocalClient(client))
+    if (!client->local)
         return BadRequest;
 
     switch (stuff->data) {
@@ -718,6 +718,11 @@ DRI2ExtensionInit(void)
 {
     ExtensionEntry *dri2Extension;
 
+#ifdef PANORAMIX
+    if (!noPanoramiXExtension)
+        return;
+#endif
+
     dri2Extension = AddExtension(DRI2_NAME,
                                  DRI2NumberEvents,
                                  DRI2NumberErrors,
index 4339084..1e42cda 100644 (file)
@@ -4,7 +4,7 @@ module_LTLIBRARIES = libexa.la
 
 libexa_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG)
 
-INCLUDES = \
+AM_CPPFLAGS = \
        $(XORG_INCS) \
        -I$(srcdir)/../../../exa \
        -I$(srcdir)/../../../miext/cw
index 4e809ea..76f780a 100644 (file)
@@ -128,7 +128,7 @@ exaDDXDriverInit(ScreenPtr pScreen)
     if (pExaScr->info->flags & EXA_OFFSCREEN_PIXMAPS) {
         if (!(pExaScr->info->flags & EXA_HANDLES_PIXMAPS) &&
             pExaScr->info->offScreenBase < pExaScr->info->memorySize) {
-            char *heuristicName;
+            const char *heuristicName;
 
             heuristicName = xf86GetOptValString(pScreenPriv->options,
                                                 EXAOPT_MIGRATION_HEURISTIC);
index 1fa9321..37cd88c 100644 (file)
@@ -10,7 +10,7 @@ else
 libfbdevhw_la_SOURCES = fbdevhwstub.c
 endif
 
-INCLUDES = $(XORG_INCS) -I$(srcdir)/../i2c
+AM_CPPFLAGS = $(XORG_INCS) -I$(srcdir)/../i2c -I$(srcdir)/../modes -I$(srcdir)/../ddc -I$(srcdir)/../parser
 
 AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
 
index d4b5558..0450822 100644 (file)
@@ -6,6 +6,7 @@
 #include <string.h>
 
 #include "xf86.h"
+#include "xf86Modes.h"
 #include "xf86_OSproc.h"
 
 /* pci stuff */
@@ -80,15 +81,13 @@ typedef struct {
 Bool
 fbdevHWGetRec(ScrnInfoPtr pScrn)
 {
-    fbdevHWPtr fPtr;
-
     if (fbdevHWPrivateIndex < 0)
         fbdevHWPrivateIndex = xf86AllocateScrnInfoPrivateIndex();
 
     if (FBDEVHWPTR(pScrn) != NULL)
         return TRUE;
 
-    fPtr = FBDEVHWPTRLVAL(pScrn) = xnfcalloc(sizeof(fbdevHWRec), 1);
+    FBDEVHWPTRLVAL(pScrn) = xnfcalloc(sizeof(fbdevHWRec), 1);
     return TRUE;
 }
 
@@ -300,7 +299,7 @@ fbdev_open_pci(struct pci_device *pPci, char **namep)
 }
 
 static int
-fbdev_open(int scrnIndex, char *dev, char **namep)
+fbdev_open(int scrnIndex, const char *dev, char **namep)
 {
     struct fb_fix_screeninfo fix;
     int fd;
@@ -496,7 +495,7 @@ fbdevHWSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode, Bool check)
 void
 fbdevHWSetVideoModes(ScrnInfoPtr pScrn)
 {
-    char **modename;
+    const char **modename;
     DisplayModePtr mode, this, last = pScrn->modes;
 
     if (NULL == pScrn->display->modes)
diff --git a/hw/xfree86/glamor_egl/Makefile.am b/hw/xfree86/glamor_egl/Makefile.am
new file mode 100644 (file)
index 0000000..85e1c0c
--- /dev/null
@@ -0,0 +1,43 @@
+# Copyright Â© 2013 Intel 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.
+
+module_LTLIBRARIES = libglamoregl.la
+
+libglamoregl_la_SOURCES = \
+       $(top_srcdir)/glamor/glamor_egl.c \
+       $(top_srcdir)/glamor/glamor_eglmodule.c \
+       $(top_srcdir)/glamor/glamor_xv.c \
+       $()
+
+libglamoregl_la_LDFLAGS = \
+       -avoid-version \
+       $(GBM_LIBS) \
+       $()
+
+libglamoregl_la_LIBADD = \
+       $(top_builddir)/glamor/libglamor.la \
+       $()
+
+AM_CPPFLAGS = $(XORG_INCS) \
+       -I$(top_srcdir)/dri3 \
+       $()
+
+AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) $(GLAMOR_CFLAGS) $(GBM_CFLAGS)
index cb18db1..c311591 100644 (file)
@@ -12,7 +12,7 @@ multimedia_LTLIBRARIES =      \
 
 libi2c_la_SOURCES = xf86i2c.c
 
-INCLUDES = $(XORG_INCS)
+AM_CPPFLAGS = $(XORG_INCS)
 
 AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
 
index 070cb20..991c26e 100644 (file)
@@ -500,6 +500,7 @@ bt829_Detect(I2CBusPtr b, I2CSlaveAddr addr)
 {
     BT829Ptr bt;
     I2CByte a;
+    char *devname;
 
     bt = calloc(1, sizeof(BT829Rec));
     if (bt == NULL)
@@ -520,31 +521,31 @@ bt829_Detect(I2CBusPtr b, I2CSlaveAddr addr)
 
     bt->id = btread(bt, IDCODE);
 
-    free(bt->d.DevName);
-    bt->d.DevName = calloc(200, sizeof(char));
+    free((void *) bt->d.DevName);
+    bt->d.DevName = devname = calloc(200, sizeof(char));
     switch (BTVERSION) {
     case BT815:
-        sprintf(bt->d.DevName, "bt815a video decoder, revision %d",
+        sprintf(devname, "bt815a video decoder, revision %d",
                 bt->id & 0xf);
         break;
     case BT817:
-        sprintf(bt->d.DevName, "bt817a video decoder, revision %d",
+        sprintf(devname, "bt817a video decoder, revision %d",
                 bt->id & 0xf);
         break;
     case BT819:
-        sprintf(bt->d.DevName, "bt819a video decoder, revision %d",
+        sprintf(devname, "bt819a video decoder, revision %d",
                 bt->id & 0xf);
         break;
     case BT827:
-        sprintf(bt->d.DevName, "bt827a/b video decoder, revision %d",
+        sprintf(devname, "bt827a/b video decoder, revision %d",
                 bt->id & 0xf);
         break;
     case BT829:
-        sprintf(bt->d.DevName, "bt829a/b video decoder, revision %d",
+        sprintf(devname, "bt829a/b video decoder, revision %d",
                 bt->id & 0xf);
         break;
     default:
-        sprintf(bt->d.DevName,
+        sprintf(devname,
                 "bt8xx/unknown video decoder version %d, revision %d",
                 bt->id >> 4, bt->id & 0xf);
         break;
index 282fe7e..ebd1454 100644 (file)
@@ -91,7 +91,7 @@ MT2032_getid(FI1236Ptr f)
     CARD8 in;
 
     in = 0x11;
-    I2C_WriteRead(&(f->d), (I2CByte *) & in, 1, out, 4);
+    I2C_WriteRead(&(f->d), (I2CByte *) &in, 1, out, 4);
     xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO,
                "MT2032: Company code 0x%02x%02x, part code 0x%02x, revision code 0x%02x\n",
                out[0], out[1], out[2], out[3]);
@@ -432,7 +432,7 @@ MT2032_get_afc_hint(FI1236Ptr f)
     CARD8 AFC;
 
     in = 0x0e;
-    I2C_WriteRead(&(f->d), (I2CByte *) & in, 1, out, 2);
+    I2C_WriteRead(&(f->d), (I2CByte *) &in, 1, out, 2);
     AFC = (out[0] >> 4) & 0x7;
 #if 0
     xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "AFC=%d TAD1=%d TAD2=%d\n",
@@ -467,7 +467,7 @@ MT2032_dump_status(FI1236Ptr f)
     CARD8 TAD2, TAD1;
 
     in = 0x0e;
-    I2C_WriteRead(&(f->d), (I2CByte *) & in, 1, out, 2);
+    I2C_WriteRead(&(f->d), (I2CByte *) &in, 1, out, 2);
     XOK = out[0] & 1;
     LO1LK = (out[0] >> 2) & 1;
     LO2LK = (out[0] >> 1) & 1;
@@ -545,7 +545,7 @@ FI1236_set_tuner_type(FI1236Ptr f, int type)
 }
 
 static CARD32
-AFC_TimerCallback(OsTimerPtr timer, CARD32 time, pointer data)
+AFC_TimerCallback(OsTimerPtr timer, CARD32 time, void *data)
 {
     FI1236Ptr f = (FI1236Ptr) data;
 
@@ -589,12 +589,12 @@ FI1236_tune(FI1236Ptr f, CARD32 frequency)
 
     if ((f->type == TUNER_TYPE_FM1216ME) || (f->type == TUNER_TYPE_FI1236W)) {
         f->tuner_data.aux = 0x20;
-        I2C_WriteRead(&(f->d), (I2CByte *) & (f->tuner_data), 5, NULL, 0);
+        I2C_WriteRead(&(f->d), (I2CByte *) &(f->tuner_data), 5, NULL, 0);
         I2C_WriteRead(&(f->d), NULL, 0, &data, 1);
         xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "Tuner status %x\n", data);
     }
     else
-        I2C_WriteRead(&(f->d), (I2CByte *) & (f->tuner_data), 4, NULL, 0);
+        I2C_WriteRead(&(f->d), (I2CByte *) &(f->tuner_data), 4, NULL, 0);
 }
 
 void
index 312a2d1..a501489 100644 (file)
@@ -163,7 +163,7 @@ DetectMSP3430(I2CBusPtr b, I2CSlaveAddr addr)
     m->d.ByteTimeout = b->ByteTimeout;
 
     if (!I2C_WriteRead(&(m->d), NULL, 0, &a, 1)) {
-        free(m->d.DevName);
+        free((void *) m->d.DevName);
         free(m);
         return NULL;
     }
@@ -250,12 +250,12 @@ DetectMSP3430(I2CBusPtr b, I2CSlaveAddr addr)
                supported ? "" : " (unsupported)", rom_version, m->chip_id);
 
     if (!supported) {
-        free(m->d.DevName);
+        free((void *) m->d.DevName);
         free(m);
         return NULL;
     }
     if (!I2CDevInit(&(m->d))) {
-        free(m->d.DevName);
+        free((void *) m->d.DevName);
         free(m);
         return NULL;
     }
index c2ce697..d258bda 100644 (file)
@@ -131,6 +131,6 @@ tda9850_getstatus(TDA9850Ptr t)
 {
     CARD16 status;
 
-    I2C_WriteRead(&(t->d), NULL, 0, (I2CByte *) & status, 2);
+    I2C_WriteRead(&(t->d), NULL, 0, (I2CByte *) &status, 2);
     return status;
 }
index e296d7d..26303ff 100644 (file)
@@ -66,7 +66,7 @@ extern _X_EXPORT int xf86I2CGetScreenBuses(int scrnIndex,
 /* I2C slave devices */
 
 typedef struct _I2CDevRec {
-    char *DevName;
+    const char *DevName;
 
     int BitTimeout;             /* usec */
     int ByteTimeout;            /* usec */
index f5ece69..66cb14d 100644 (file)
@@ -17,9 +17,10 @@ if I386_VIDEO
 I386_VIDEO_CFLAGS = -D_PC
 endif
 
+AM_CPPFLAGS = $(XORG_INCS)
+
 if INT10_VM86
 AM_CFLAGS = $(I386_VIDEO_CFLAGS) -D_VM86_LINUX $(DIX_CFLAGS) $(XORG_CFLAGS) $(EXTRA_CFLAGS)
-INCLUDES = $(XORG_INCS)
 libint10_la_SOURCES = \
        $(COMMON_SOURCES) \
        $(srcdir)/../os-support/linux/int10/vm86/linux_vm86.c \
@@ -29,7 +30,7 @@ endif
 if INT10_X86EMU
 AM_CFLAGS = $(I386_VIDEO_CFLAGS) -D_X86EMU -DNO_SYS_HEADERS \
            $(XORG_CFLAGS) $(EXTRA_CFLAGS) $(DIX_CFLAGS)
-INCLUDES = $(XORG_INCS) -I$(srcdir)/../x86emu
+AM_CPPFLAGS += -I$(srcdir)/../x86emu
 libint10_la_SOURCES = \
        $(COMMON_SOURCES) \
        xf86x86emu.c \
@@ -39,7 +40,6 @@ endif
 
 if INT10_STUB
 AM_CFLAGS = $(I386_VIDEO_CFLAGS) -D_VM86_LINUX $(DIX_CFLAGS) $(XORG_CFLAGS) $(EXTRA_CFLAGS)
-INCLUDES = $(XORG_INCS)
 libint10_la_SOURCES = stub.c xf86int10module.c
 endif
 
index 4633120..abbd36f 100644 (file)
 
 #define ALLOC_ENTRIES(x) ((V_RAM / x) - 1)
 
-static CARD8 read_b(xf86Int10InfoPtr pInt, int addr);
-static CARD16 read_w(xf86Int10InfoPtr pInt, int addr);
-static CARD32 read_l(xf86Int10InfoPtr pInt, int addr);
-static void write_b(xf86Int10InfoPtr pInt, int addr, CARD8 val);
-static void write_w(xf86Int10InfoPtr pInt, int addr, CARD16 val);
-static void write_l(xf86Int10InfoPtr pInt, int addr, CARD32 val);
+static uint8_t read_b(xf86Int10InfoPtr pInt, int addr);
+static uint16_t read_w(xf86Int10InfoPtr pInt, int addr);
+static uint32_t read_l(xf86Int10InfoPtr pInt, int addr);
+static void write_b(xf86Int10InfoPtr pInt, int addr, uint8_t val);
+static void write_w(xf86Int10InfoPtr pInt, int addr, uint16_t val);
+static void write_l(xf86Int10InfoPtr pInt, int addr, uint32_t val);
 
 /*
  * the emulator cannot pass a pointer to the current xf86Int10InfoRec
@@ -87,8 +87,8 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
     if (!xf86Int10ExecSetup(pInt))
         goto error0;
     pInt->mem = &genericMem;
-    pInt->private = (pointer) xnfcalloc(1, sizeof(genericInt10Priv));
-    INTPriv(pInt)->alloc = (pointer) xnfcalloc(1, ALLOC_ENTRIES(getpagesize()));
+    pInt->private = (void *) xnfcalloc(1, sizeof(genericInt10Priv));
+    INTPriv(pInt)->alloc = (void *) xnfcalloc(1, ALLOC_ENTRIES(getpagesize()));
     pInt->pScrn = pScrn;
     base = INTPriv(pInt)->base = xnfalloc(SYS_BIOS);
 
@@ -178,7 +178,8 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
      */
     vbiosMem = (char *) base + V_BIOS;
     memset(vbiosMem, 0, 2 * V_BIOS_SIZE);
-    if (pci_device_read_rom(pInt->dev, vbiosMem) < V_BIOS_SIZE) {
+    if (pci_device_read_rom(pInt->dev, vbiosMem) != 0
+        || pInt->dev->rom_size < V_BIOS_SIZE) {
         xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
                    "Unable to retrieve all of segment 0x0C0000.\n");
     }
@@ -338,39 +339,39 @@ xf86Int10FreePages(xf86Int10InfoPtr pInt, void *pbase, int num)
 
 #define VRAM(addr) ((addr >= V_RAM) && (addr < (V_RAM + VRAM_SIZE)))
 #define V_ADDR_RB(addr) \
-       (VRAM(addr)) ? MMIO_IN8((CARD8*)VRAM_BASE,VRAM_ADDR(addr)) \
-          : *(CARD8*) V_ADDR(addr)
+       (VRAM(addr)) ? MMIO_IN8((uint8_t*)VRAM_BASE,VRAM_ADDR(addr)) \
+          : *(uint8_t*) V_ADDR(addr)
 #define V_ADDR_RW(addr) \
-       (VRAM(addr)) ? MMIO_IN16((CARD16*)VRAM_BASE,VRAM_ADDR(addr)) \
-          : ldw_u((pointer)V_ADDR(addr))
+       (VRAM(addr)) ? MMIO_IN16((uint16_t*)VRAM_BASE,VRAM_ADDR(addr)) \
+          : ldw_u((void *)V_ADDR(addr))
 #define V_ADDR_RL(addr) \
-       (VRAM(addr)) ? MMIO_IN32((CARD32*)VRAM_BASE,VRAM_ADDR(addr)) \
-          : ldl_u((pointer)V_ADDR(addr))
+       (VRAM(addr)) ? MMIO_IN32((uint32_t*)VRAM_BASE,VRAM_ADDR(addr)) \
+          : ldl_u((void *)V_ADDR(addr))
 
 #define V_ADDR_WB(addr,val) \
        if(VRAM(addr)) \
-           MMIO_OUT8((CARD8*)VRAM_BASE,VRAM_ADDR(addr),val); \
+           MMIO_OUT8((uint8_t*)VRAM_BASE,VRAM_ADDR(addr),val); \
        else \
-           *(CARD8*) V_ADDR(addr) = val;
+           *(uint8_t*) V_ADDR(addr) = val;
 #define V_ADDR_WW(addr,val) \
        if(VRAM(addr)) \
-           MMIO_OUT16((CARD16*)VRAM_BASE,VRAM_ADDR(addr),val); \
+           MMIO_OUT16((uint16_t*)VRAM_BASE,VRAM_ADDR(addr),val); \
        else \
-           stw_u((val),(pointer)(V_ADDR(addr)));
+           stw_u((val),(void *)(V_ADDR(addr)));
 
 #define V_ADDR_WL(addr,val) \
        if (VRAM(addr)) \
-           MMIO_OUT32((CARD32*)VRAM_BASE,VRAM_ADDR(addr),val); \
+           MMIO_OUT32((uint32_t*)VRAM_BASE,VRAM_ADDR(addr),val); \
        else \
-           stl_u(val,(pointer)(V_ADDR(addr)));
+           stl_u(val,(void *)(V_ADDR(addr)));
 
-static CARD8
+static uint8_t
 read_b(xf86Int10InfoPtr pInt, int addr)
 {
     return V_ADDR_RB(addr);
 }
 
-static CARD16
+static uint16_t
 read_w(xf86Int10InfoPtr pInt, int addr)
 {
 #if X_BYTE_ORDER == X_LITTLE_ENDIAN
@@ -380,7 +381,7 @@ read_w(xf86Int10InfoPtr pInt, int addr)
     return V_ADDR_RB(addr) | (V_ADDR_RB(addr + 1) << 8);
 }
 
-static CARD32
+static uint32_t
 read_l(xf86Int10InfoPtr pInt, int addr)
 {
 #if X_BYTE_ORDER == X_LITTLE_ENDIAN
@@ -393,7 +394,7 @@ read_l(xf86Int10InfoPtr pInt, int addr)
 }
 
 static void
-write_b(xf86Int10InfoPtr pInt, int addr, CARD8 val)
+write_b(xf86Int10InfoPtr pInt, int addr, uint8_t val)
 {
     V_ADDR_WB(addr, val);
 }
@@ -411,7 +412,7 @@ write_w(xf86Int10InfoPtr pInt, int addr, CARD16 val)
 }
 
 static void
-write_l(xf86Int10InfoPtr pInt, int addr, CARD32 val)
+write_l(xf86Int10InfoPtr pInt, int addr, uint32_t val)
 {
 #if X_BYTE_ORDER == X_LITTLE_ENDIAN
     if (OFF(addr + 3) > 2) {
@@ -424,8 +425,8 @@ write_l(xf86Int10InfoPtr pInt, int addr, CARD32 val)
     V_ADDR_WB(addr + 3, val >> 24);
 }
 
-pointer
-xf86int10Addr(xf86Int10InfoPtr pInt, CARD32 addr)
+void *
+xf86int10Addr(xf86Int10InfoPtr pInt, uint32_t addr)
 {
     return V_ADDR(addr);
 }
index 1c58cf7..6a83f42 100644 (file)
 #endif
 #include <pciaccess.h>
 
-static int pciCfg1in(CARD16 addr, CARD32 *val);
-static int pciCfg1out(CARD16 addr, CARD32 val);
-static int pciCfg1inw(CARD16 addr, CARD16 *val);
-static int pciCfg1outw(CARD16 addr, CARD16 val);
-static int pciCfg1inb(CARD16 addr, CARD8 *val);
-static int pciCfg1outb(CARD16 addr, CARD8 val);
+static int pciCfg1in(uint16_t addr, uint32_t *val);
+static int pciCfg1out(uint16_t addr, uint32_t val);
+static int pciCfg1inw(uint16_t addr, uint16_t *val);
+static int pciCfg1outw(uint16_t addr, uint16_t val);
+static int pciCfg1inb(uint16_t addr, uint8_t *val);
+static int pciCfg1outb(uint16_t addr, uint8_t val);
 
 #if defined (_PC)
 static void SetResetBIOSVars(xf86Int10InfoPtr pInt, Bool set);
@@ -58,13 +58,13 @@ setup_int(xf86Int10InfoPtr pInt)
             return -1;
         Int10Current = pInt;
     }
-    X86_EAX = (CARD32) pInt->ax;
-    X86_EBX = (CARD32) pInt->bx;
-    X86_ECX = (CARD32) pInt->cx;
-    X86_EDX = (CARD32) pInt->dx;
-    X86_ESI = (CARD32) pInt->si;
-    X86_EDI = (CARD32) pInt->di;
-    X86_EBP = (CARD32) pInt->bp;
+    X86_EAX = (uint32_t) pInt->ax;
+    X86_EBX = (uint32_t) pInt->bx;
+    X86_ECX = (uint32_t) pInt->cx;
+    X86_EDX = (uint32_t) pInt->dx;
+    X86_ESI = (uint32_t) pInt->si;
+    X86_EDI = (uint32_t) pInt->di;
+    X86_EBP = (uint32_t) pInt->bp;
     X86_ESP = 0x1000;
     X86_SS = pInt->stackseg >> 4;
     X86_EIP = 0x0600;
@@ -86,15 +86,15 @@ void
 finish_int(xf86Int10InfoPtr pInt, int sig)
 {
     OsReleaseSignals();
-    pInt->ax = (CARD32) X86_EAX;
-    pInt->bx = (CARD32) X86_EBX;
-    pInt->cx = (CARD32) X86_ECX;
-    pInt->dx = (CARD32) X86_EDX;
-    pInt->si = (CARD32) X86_ESI;
-    pInt->di = (CARD32) X86_EDI;
-    pInt->es = (CARD16) X86_ES;
-    pInt->bp = (CARD32) X86_EBP;
-    pInt->flags = (CARD32) X86_FLAGS;
+    pInt->ax = (uint32_t) X86_EAX;
+    pInt->bx = (uint32_t) X86_EBX;
+    pInt->cx = (uint32_t) X86_ECX;
+    pInt->dx = (uint32_t) X86_EDX;
+    pInt->si = (uint32_t) X86_ESI;
+    pInt->di = (uint32_t) X86_EDI;
+    pInt->es = (uint16_t) X86_ES;
+    pInt->bp = (uint32_t) X86_EBP;
+    pInt->flags = (uint32_t) X86_FLAGS;
 #if defined (_PC)
     if (pInt->Flags & RESTORE_BIOS_SCRATCH)
         SetResetBIOSVars(pInt, FALSE);
@@ -102,23 +102,23 @@ finish_int(xf86Int10InfoPtr pInt, int sig)
 }
 
 /* general software interrupt handler */
-CARD32
+uint32_t
 getIntVect(xf86Int10InfoPtr pInt, int num)
 {
     return MEM_RW(pInt, num << 2) + (MEM_RW(pInt, (num << 2) + 2) << 4);
 }
 
 void
-pushw(xf86Int10InfoPtr pInt, CARD16 val)
+pushw(xf86Int10InfoPtr pInt, uint16_t val)
 {
     X86_ESP -= 2;
-    MEM_WW(pInt, ((CARD32) X86_SS << 4) + X86_SP, val);
+    MEM_WW(pInt, ((uint32_t) X86_SS << 4) + X86_SP, val);
 }
 
 int
 run_bios_int(int num, xf86Int10InfoPtr pInt)
 {
-    CARD32 eflags;
+    uint32_t eflags;
 
 #ifndef _PC
     /* check if bios vector is initialized */
@@ -167,10 +167,10 @@ void
 dump_code(xf86Int10InfoPtr pInt)
 {
     int i;
-    CARD32 lina = SEG_ADR((CARD32), X86_CS, IP);
+    uint32_t lina = SEG_ADR((uint32_t), X86_CS, IP);
 
     xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_INFO, 3, "code at 0x%8.8" PRIx32 ":\n",
-                   lina);
+                   (unsigned) lina);
     for (i = 0; i < 0x10; i++)
         xf86ErrorFVerb(3, " %2.2x", MEM_RB(pInt, lina + i));
     xf86ErrorFVerb(3, "\n");
@@ -203,8 +203,8 @@ void
 stack_trace(xf86Int10InfoPtr pInt)
 {
     int i = 0;
-    unsigned long stack = SEG_ADR((CARD32), X86_SS, SP);
-    unsigned long tail = (CARD32) ((X86_SS << 4) + 0x1000);
+    unsigned long stack = SEG_ADR((uint32_t), X86_SS, SP);
+    unsigned long tail = (uint32_t) ((X86_SS << 4) + 0x1000);
 
     if (stack >= tail)
         return;
@@ -222,14 +222,14 @@ stack_trace(xf86Int10InfoPtr pInt)
 
 int
 port_rep_inb(xf86Int10InfoPtr pInt,
-             CARD16 port, CARD32 base, int d_f, CARD32 count)
+             uint16_t port, uint32_t base, int d_f, uint32_t count)
 {
     register int inc = d_f ? -1 : 1;
-    CARD32 dst = base;
+    uint32_t dst = base;
 
     if (PRINT_PORT && DEBUG_IO_TRACE())
         ErrorF(" rep_insb(%#x) %" PRIu32 " bytes at %8.8" PRIx32 " %s\n",
-               port, count, base, d_f ? "up" : "down");
+               port, (unsigned) count, (unsigned) base, d_f ? "up" : "down");
     while (count--) {
         MEM_WB(pInt, dst, x_inb(port));
         dst += inc;
@@ -239,14 +239,14 @@ port_rep_inb(xf86Int10InfoPtr pInt,
 
 int
 port_rep_inw(xf86Int10InfoPtr pInt,
-             CARD16 port, CARD32 base, int d_f, CARD32 count)
+             uint16_t port, uint32_t base, int d_f, uint32_t count)
 {
     register int inc = d_f ? -2 : 2;
-    CARD32 dst = base;
+    uint32_t dst = base;
 
     if (PRINT_PORT && DEBUG_IO_TRACE())
         ErrorF(" rep_insw(%#x) %" PRIu32 " bytes at %8.8" PRIx32 " %s\n",
-               port, count, base, d_f ? "up" : "down");
+               port, (unsigned) count, (unsigned) base, d_f ? "up" : "down");
     while (count--) {
         MEM_WW(pInt, dst, x_inw(port));
         dst += inc;
@@ -256,14 +256,14 @@ port_rep_inw(xf86Int10InfoPtr pInt,
 
 int
 port_rep_inl(xf86Int10InfoPtr pInt,
-             CARD16 port, CARD32 base, int d_f, CARD32 count)
+             uint16_t port, uint32_t base, int d_f, uint32_t count)
 {
     register int inc = d_f ? -4 : 4;
-    CARD32 dst = base;
+    uint32_t dst = base;
 
     if (PRINT_PORT && DEBUG_IO_TRACE())
         ErrorF(" rep_insl(%#x) %" PRIu32 " bytes at %8.8" PRIx32 " %s\n",
-               port, count, base, d_f ? "up" : "down");
+               port, (unsigned) count, (unsigned) base, d_f ? "up" : "down");
     while (count--) {
         MEM_WL(pInt, dst, x_inl(port));
         dst += inc;
@@ -273,14 +273,14 @@ port_rep_inl(xf86Int10InfoPtr pInt,
 
 int
 port_rep_outb(xf86Int10InfoPtr pInt,
-              CARD16 port, CARD32 base, int d_f, CARD32 count)
+              uint16_t port, uint32_t base, int d_f, uint32_t count)
 {
     register int inc = d_f ? -1 : 1;
-    CARD32 dst = base;
+    uint32_t dst = base;
 
     if (PRINT_PORT && DEBUG_IO_TRACE())
         ErrorF(" rep_outb(%#x) %" PRIu32 " bytes at %8.8" PRIx32 " %s\n",
-               port, count, base, d_f ? "up" : "down");
+               port, (unsigned) count, (unsigned) base, d_f ? "up" : "down");
     while (count--) {
         x_outb(port, MEM_RB(pInt, dst));
         dst += inc;
@@ -290,14 +290,14 @@ port_rep_outb(xf86Int10InfoPtr pInt,
 
 int
 port_rep_outw(xf86Int10InfoPtr pInt,
-              CARD16 port, CARD32 base, int d_f, CARD32 count)
+              uint16_t port, uint32_t base, int d_f, uint32_t count)
 {
     register int inc = d_f ? -2 : 2;
-    CARD32 dst = base;
+    uint32_t dst = base;
 
     if (PRINT_PORT && DEBUG_IO_TRACE())
         ErrorF(" rep_outw(%#x) %" PRIu32 " bytes at %8.8" PRIx32 " %s\n",
-               port, count, base, d_f ? "up" : "down");
+               port, (unsigned) count, (unsigned) base, d_f ? "up" : "down");
     while (count--) {
         x_outw(port, MEM_RW(pInt, dst));
         dst += inc;
@@ -307,14 +307,14 @@ port_rep_outw(xf86Int10InfoPtr pInt,
 
 int
 port_rep_outl(xf86Int10InfoPtr pInt,
-              CARD16 port, CARD32 base, int d_f, CARD32 count)
+              uint16_t port, uint32_t base, int d_f, uint32_t count)
 {
     register int inc = d_f ? -4 : 4;
-    CARD32 dst = base;
+    uint32_t dst = base;
 
     if (PRINT_PORT && DEBUG_IO_TRACE())
         ErrorF(" rep_outl(%#x) %" PRIu32 " bytes at %8.8" PRIx32 " %s\n",
-               port, count, base, d_f ? "up" : "down");
+               port, (unsigned) count, (unsigned) base, d_f ? "up" : "down");
     while (count--) {
         x_outl(port, MEM_RL(pInt, dst));
         dst += inc;
@@ -322,14 +322,14 @@ port_rep_outl(xf86Int10InfoPtr pInt,
     return dst - base;
 }
 
-CARD8
-x_inb(CARD16 port)
+uint8_t
+x_inb(uint16_t port)
 {
-    CARD8 val;
+    uint8_t val;
 
     if (port == 0x40) {
         Int10Current->inb40time++;
-        val = (CARD8) (Int10Current->inb40time >>
+        val = (uint8_t) (Int10Current->inb40time >>
                        ((Int10Current->inb40time & 1) << 3));
         if (PRINT_PORT && DEBUG_IO_TRACE())
             ErrorF(" inb(%#x) = %2.2x\n", port, val);
@@ -353,10 +353,10 @@ x_inb(CARD16 port)
     return val;
 }
 
-CARD16
-x_inw(CARD16 port)
+uint16_t
+x_inw(uint16_t port)
 {
-    CARD16 val;
+    uint16_t val;
 
     if (port == 0x5c) {
         struct timeval tv;
@@ -366,7 +366,7 @@ x_inw(CARD16 port)
          * Approximate this by dividing by 3.
          */
         X_GETTIMEOFDAY(&tv);
-        val = (CARD16) (tv.tv_usec / 3);
+        val = (uint16_t) (tv.tv_usec / 3);
     }
     else if (!pciCfg1inw(port, &val)) {
         val = pci_io_read16(Int10Current->io, port);
@@ -377,7 +377,7 @@ x_inw(CARD16 port)
 }
 
 void
-x_outb(CARD16 port, CARD8 val)
+x_outb(uint16_t port, uint8_t val)
 {
     if ((port == 0x43) && (val == 0)) {
         struct timeval tv;
@@ -389,7 +389,7 @@ x_outb(CARD16 port, CARD8 val)
          * the bottom bit as a byte select.  See inb(0x40) above.
          */
         X_GETTIMEOFDAY(&tv);
-        Int10Current->inb40time = (CARD16) (tv.tv_usec | 1);
+        Int10Current->inb40time = (uint16_t) (tv.tv_usec | 1);
         if (PRINT_PORT && DEBUG_IO_TRACE())
             ErrorF(" outb(%#x, %2.2x)\n", port, val);
 #ifdef __NOT_YET__
@@ -411,7 +411,7 @@ x_outb(CARD16 port, CARD8 val)
 }
 
 void
-x_outw(CARD16 port, CARD16 val)
+x_outw(uint16_t port, uint16_t val)
 {
 
     if (!pciCfg1outw(port, val)) {
@@ -421,66 +421,66 @@ x_outw(CARD16 port, CARD16 val)
     }
 }
 
-CARD32
-x_inl(CARD16 port)
+uint32_t
+x_inl(uint16_t port)
 {
-    CARD32 val;
+    uint32_t val;
 
     if (!pciCfg1in(port, &val)) {
         val = pci_io_read32(Int10Current->io, port);
         if (PRINT_PORT && DEBUG_IO_TRACE())
-            ErrorF(" inl(%#x) = %8.8" PRIx32 "\n", port, val);
+            ErrorF(" inl(%#x) = %8.8" PRIx32 "\n", port, (unsigned) val);
     }
     return val;
 }
 
 void
-x_outl(CARD16 port, CARD32 val)
+x_outl(uint16_t port, uint32_t val)
 {
     if (!pciCfg1out(port, val)) {
         if (PRINT_PORT && DEBUG_IO_TRACE())
-            ErrorF(" outl(%#x, %8.8" PRIx32 ")\n", port, val);
+            ErrorF(" outl(%#x, %8.8" PRIx32 ")\n", port, (unsigned) val);
         pci_io_write32(Int10Current->io, port, val);
     }
 }
 
-CARD8
-Mem_rb(CARD32 addr)
+uint8_t
+Mem_rb(uint32_t addr)
 {
     return (*Int10Current->mem->rb) (Int10Current, addr);
 }
 
-CARD16
-Mem_rw(CARD32 addr)
+uint16_t
+Mem_rw(uint32_t addr)
 {
     return (*Int10Current->mem->rw) (Int10Current, addr);
 }
 
-CARD32
-Mem_rl(CARD32 addr)
+uint32_t
+Mem_rl(uint32_t addr)
 {
     return (*Int10Current->mem->rl) (Int10Current, addr);
 }
 
 void
-Mem_wb(CARD32 addr, CARD8 val)
+Mem_wb(uint32_t addr, uint8_t val)
 {
     (*Int10Current->mem->wb) (Int10Current, addr, val);
 }
 
 void
-Mem_ww(CARD32 addr, CARD16 val)
+Mem_ww(uint32_t addr, uint16_t val)
 {
     (*Int10Current->mem->ww) (Int10Current, addr, val);
 }
 
 void
-Mem_wl(CARD32 addr, CARD32 val)
+Mem_wl(uint32_t addr, uint32_t val)
 {
     (*Int10Current->mem->wl) (Int10Current, addr, val);
 }
 
-static CARD32 PciCfg1Addr = 0;
+static uint32_t PciCfg1Addr = 0;
 
 #define PCI_DOM_FROM_TAG(tag)  (((tag) >> 24) & (PCI_DOM_MASK))
 #define PCI_BUS_FROM_TAG(tag)  (((tag) >> 16) & (PCI_DOMBUS_MASK))
@@ -491,10 +491,10 @@ static CARD32 PciCfg1Addr = 0;
 #define PCI_TAG(x)    ((x) & 0x7fffff00)
 
 static struct pci_device *
-pci_device_for_cfg_address(CARD32 addr)
+pci_device_for_cfg_address(uint32_t addr)
 {
     struct pci_device *dev = NULL;
-    CARD32 tag = PCI_TAG(addr);
+    uint32_t tag = PCI_TAG(addr);
 
     struct pci_slot_match slot_match = {
         .domain = PCI_DOM_FROM_TAG(tag),
@@ -516,7 +516,7 @@ pci_device_for_cfg_address(CARD32 addr)
 }
 
 static int
-pciCfg1in(CARD16 addr, CARD32 *val)
+pciCfg1in(uint16_t addr, uint32_t *val)
 {
     if (addr == 0xCF8) {
         *val = PciCfg1Addr;
@@ -526,15 +526,15 @@ pciCfg1in(CARD16 addr, CARD32 *val)
         pci_device_cfg_read_u32(pci_device_for_cfg_address(PciCfg1Addr),
                                 (uint32_t *) val, PCI_OFFSET(PciCfg1Addr));
         if (PRINT_PORT && DEBUG_IO_TRACE())
-            ErrorF(" cfg_inl(%#" PRIx32 ") = %8.8" PRIx32 "\n", PciCfg1Addr,
-                   *val);
+            ErrorF(" cfg_inl(%#" PRIx32 ") = %8.8" PRIx32 "\n", (unsigned) PciCfg1Addr,
+                   (unsigned) *val);
         return 1;
     }
     return 0;
 }
 
 static int
-pciCfg1out(CARD16 addr, CARD32 val)
+pciCfg1out(uint16_t addr, uint32_t val)
 {
     if (addr == 0xCF8) {
         PciCfg1Addr = val;
@@ -542,8 +542,8 @@ pciCfg1out(CARD16 addr, CARD32 val)
     }
     if (addr == 0xCFC) {
         if (PRINT_PORT && DEBUG_IO_TRACE())
-            ErrorF(" cfg_outl(%#" PRIx32 ", %8.8" PRIx32 ")\n", PciCfg1Addr,
-                   val);
+            ErrorF(" cfg_outl(%#" PRIx32 ", %8.8" PRIx32 ")\n", (unsigned) PciCfg1Addr,
+                   (unsigned) val);
         pci_device_cfg_write_u32(pci_device_for_cfg_address(PciCfg1Addr), val,
                                  PCI_OFFSET(PciCfg1Addr));
         return 1;
@@ -552,7 +552,7 @@ pciCfg1out(CARD16 addr, CARD32 val)
 }
 
 static int
-pciCfg1inw(CARD16 addr, CARD16 *val)
+pciCfg1inw(uint16_t addr, uint16_t *val)
 {
     int shift;
 
@@ -567,30 +567,30 @@ pciCfg1inw(CARD16 addr, CARD16 *val)
         pci_device_cfg_read_u16(pci_device_for_cfg_address(PciCfg1Addr),
                                 val, PCI_OFFSET(PciCfg1Addr) + offset);
         if (PRINT_PORT && DEBUG_IO_TRACE())
-            ErrorF(" cfg_inw(%#" PRIx32 ") = %4.4x\n", PciCfg1Addr + offset,
-                   *val);
+            ErrorF(" cfg_inw(%#" PRIx32 ") = %4.4x\n", (unsigned) (PciCfg1Addr + offset),
+                   (unsigned) *val);
         return 1;
     }
     return 0;
 }
 
 static int
-pciCfg1outw(CARD16 addr, CARD16 val)
+pciCfg1outw(uint16_t addr, uint16_t val)
 {
     int shift;
 
     if ((addr >= 0xCF8) && (addr <= 0xCFB)) {
         shift = (addr - 0xCF8) * 8;
         PciCfg1Addr &= ~(0xffff << shift);
-        PciCfg1Addr |= ((CARD32) val) << shift;
+        PciCfg1Addr |= ((uint32_t) val) << shift;
         return 1;
     }
     if ((addr >= 0xCFC) && (addr <= 0xCFF)) {
         const unsigned offset = addr - 0xCFC;
 
         if (PRINT_PORT && DEBUG_IO_TRACE())
-            ErrorF(" cfg_outw(%#" PRIx32 ", %4.4x)\n", PciCfg1Addr + offset,
-                   val);
+            ErrorF(" cfg_outw(%#" PRIx32 ", %4.4x)\n", (unsigned) (PciCfg1Addr + offset),
+                   (unsigned) val);
         pci_device_cfg_write_u16(pci_device_for_cfg_address(PciCfg1Addr), val,
                                  PCI_OFFSET(PciCfg1Addr) + offset);
         return 1;
@@ -599,7 +599,7 @@ pciCfg1outw(CARD16 addr, CARD16 val)
 }
 
 static int
-pciCfg1inb(CARD16 addr, CARD8 *val)
+pciCfg1inb(uint16_t addr, uint8_t *val)
 {
     int shift;
 
@@ -614,30 +614,30 @@ pciCfg1inb(CARD16 addr, CARD8 *val)
         pci_device_cfg_read_u8(pci_device_for_cfg_address(PciCfg1Addr),
                                val, PCI_OFFSET(PciCfg1Addr) + offset);
         if (PRINT_PORT && DEBUG_IO_TRACE())
-            ErrorF(" cfg_inb(%#" PRIx32 ") = %2.2x\n", PciCfg1Addr + offset,
-                   *val);
+            ErrorF(" cfg_inb(%#" PRIx32 ") = %2.2x\n", (unsigned) (PciCfg1Addr + offset),
+                   (unsigned) *val);
         return 1;
     }
     return 0;
 }
 
 static int
-pciCfg1outb(CARD16 addr, CARD8 val)
+pciCfg1outb(uint16_t addr, uint8_t val)
 {
     int shift;
 
     if ((addr >= 0xCF8) && (addr <= 0xCFB)) {
         shift = (addr - 0xCF8) * 8;
         PciCfg1Addr &= ~(0xff << shift);
-        PciCfg1Addr |= ((CARD32) val) << shift;
+        PciCfg1Addr |= ((uint32_t) val) << shift;
         return 1;
     }
     if ((addr >= 0xCFC) && (addr <= 0xCFF)) {
         const unsigned offset = addr - 0xCFC;
 
         if (PRINT_PORT && DEBUG_IO_TRACE())
-            ErrorF(" cfg_outb(%#" PRIx32 ", %2.2x)\n", PciCfg1Addr + offset,
-                   val);
+            ErrorF(" cfg_outb(%#" PRIx32 ", %2.2x)\n", (unsigned) (PciCfg1Addr + offset),
+                   (unsigned) val);
         pci_device_cfg_write_u8(pci_device_for_cfg_address(PciCfg1Addr), val,
                                 PCI_OFFSET(PciCfg1Addr) + offset);
         return 1;
@@ -645,10 +645,10 @@ pciCfg1outb(CARD16 addr, CARD8 val)
     return 0;
 }
 
-CARD8
-bios_checksum(const CARD8 *start, int size)
+uint8_t
+bios_checksum(const uint8_t *start, int size)
 {
-    CARD8 sum = 0;
+    uint8_t sum = 0;
 
     while (size-- > 0)
         sum += *start++;
@@ -682,12 +682,12 @@ LockLegacyVGA(xf86Int10InfoPtr pInt, legacyVGAPtr vga)
     vga->save_46e8 = pci_io_read8(pInt->io, 0x46E8);
 #endif
     vga->save_pos102 = pci_io_read8(pInt->io, 0x0102);
-    pci_io_write8(pInt->io, 0x03C2, ~(CARD8) 0x03 & vga->save_msr);
-    pci_io_write8(pInt->io, 0x03C3, ~(CARD8) 0x01 & vga->save_vse);
+    pci_io_write8(pInt->io, 0x03C2, ~(uint8_t) 0x03 & vga->save_msr);
+    pci_io_write8(pInt->io, 0x03C3, ~(uint8_t) 0x01 & vga->save_vse);
 #ifndef __ia64__
-    pci_io_write8(pInt->io, 0x46E8, ~(CARD8) 0x08 & vga->save_46e8);
+    pci_io_write8(pInt->io, 0x46E8, ~(uint8_t) 0x08 & vga->save_46e8);
 #endif
-    pci_io_write8(pInt->io, 0x0102, ~(CARD8) 0x01 & vga->save_pos102);
+    pci_io_write8(pInt->io, 0x0102, ~(uint8_t) 0x01 & vga->save_pos102);
 }
 
 void
index 160c5ae..1b5960e 100644 (file)
@@ -199,7 +199,7 @@ xf86HandleInt10Options(ScrnInfoPtr pScrn, int entityIndex)
     OptionInfoPtr options = NULL;
 
     if (pEnt->device) {
-        pointer configOptions = NULL;
+        void *configOptions = NULL;
 
         /* Check if xf86CollectOptions() has already been called */
         if (((pEnt->index < 0) ||
index 8fd0790..4bbcdde 100644 (file)
@@ -62,8 +62,8 @@ xf86ExecX86int10(xf86Int10InfoPtr pInt)
     return;
 }
 
-pointer
-xf86int10Addr(xf86Int10InfoPtr pInt, CARD32 addr)
+void *
+xf86int10Addr(xf86Int10InfoPtr pInt, uint32_t addr)
 {
     return 0;
 }
index 6d564fc..83bab7e 100644 (file)
 /* int10 info structure */
 typedef struct {
     int entityIndex;
-    CARD16 BIOSseg;
-    CARD16 inb40time;
+    uint16_t BIOSseg;
+    uint16_t inb40time;
     ScrnInfoPtr pScrn;
-    pointer cpuRegs;
+    void *cpuRegs;
     char *BIOSScratch;
     int Flags;
-    pointer private;
+    void *private;
     struct _int10Mem *mem;
     int num;
     int ax;
@@ -45,19 +45,19 @@ typedef struct {
 } xf86Int10InfoRec, *xf86Int10InfoPtr;
 
 typedef struct _int10Mem {
-    CARD8 (*rb) (xf86Int10InfoPtr, int);
-    CARD16 (*rw) (xf86Int10InfoPtr, int);
-    CARD32 (*rl) (xf86Int10InfoPtr, int);
-    void (*wb) (xf86Int10InfoPtr, int, CARD8);
-    void (*ww) (xf86Int10InfoPtr, int, CARD16);
-    void (*wl) (xf86Int10InfoPtr, int, CARD32);
+    uint8_t (*rb) (xf86Int10InfoPtr, int);
+    uint16_t (*rw) (xf86Int10InfoPtr, int);
+    uint32_t (*rl) (xf86Int10InfoPtr, int);
+    void (*wb) (xf86Int10InfoPtr, int, uint8_t);
+    void (*ww) (xf86Int10InfoPtr, int, uint16_t);
+    void (*wl) (xf86Int10InfoPtr, int, uint32_t);
 } int10MemRec, *int10MemPtr;
 
 typedef struct {
-    CARD8 save_msr;
-    CARD8 save_pos102;
-    CARD8 save_vse;
-    CARD8 save_46e8;
+    uint8_t save_msr;
+    uint8_t save_pos102;
+    uint8_t save_vse;
+    uint8_t save_46e8;
 } legacyVGARec, *legacyVGAPtr;
 
 /* OS dependent functions */
@@ -69,7 +69,7 @@ extern _X_EXPORT void *xf86Int10AllocPages(xf86Int10InfoPtr pInt, int num,
                                            int *off);
 extern _X_EXPORT void xf86Int10FreePages(xf86Int10InfoPtr pInt, void *pbase,
                                          int num);
-extern _X_EXPORT pointer xf86int10Addr(xf86Int10InfoPtr pInt, CARD32 addr);
+extern _X_EXPORT void *xf86int10Addr(xf86Int10InfoPtr pInt, uint32_t addr);
 
 /* x86 executor related functions */
 extern _X_EXPORT void xf86ExecX86int10(xf86Int10InfoPtr pInt);
@@ -127,13 +127,13 @@ int int_handler(xf86Int10InfoPtr pInt);
 /* helper_exec.c */
 int setup_int(xf86Int10InfoPtr pInt);
 void finish_int(xf86Int10InfoPtr, int sig);
-CARD32 getIntVect(xf86Int10InfoPtr pInt, int num);
-void pushw(xf86Int10InfoPtr pInt, CARD16 val);
+uint32_t getIntVect(xf86Int10InfoPtr pInt, int num);
+void pushw(xf86Int10InfoPtr pInt, uint16_t val);
 int run_bios_int(int num, xf86Int10InfoPtr pInt);
 void dump_code(xf86Int10InfoPtr pInt);
 void dump_registers(xf86Int10InfoPtr pInt);
 void stack_trace(xf86Int10InfoPtr pInt);
-CARD8 bios_checksum(const CARD8 *start, int size);
+uint8_t bios_checksum(const uint8_t *start, int size);
 void LockLegacyVGA(xf86Int10InfoPtr pInt, legacyVGAPtr vga);
 void UnlockLegacyVGA(xf86Int10InfoPtr pInt, legacyVGAPtr vga);
 
@@ -142,31 +142,31 @@ extern _X_EXPORT void xf86Int10SaveRestoreBIOSVars(xf86Int10InfoPtr pInt,
                                                    Bool save);
 #endif
 int port_rep_inb(xf86Int10InfoPtr pInt,
-                 CARD16 port, CARD32 base, int d_f, CARD32 count);
+                 uint16_t port, uint32_t base, int d_f, uint32_t count);
 int port_rep_inw(xf86Int10InfoPtr pInt,
-                 CARD16 port, CARD32 base, int d_f, CARD32 count);
+                 uint16_t port, uint32_t base, int d_f, uint32_t count);
 int port_rep_inl(xf86Int10InfoPtr pInt,
-                 CARD16 port, CARD32 base, int d_f, CARD32 count);
+                 uint16_t port, uint32_t base, int d_f, uint32_t count);
 int port_rep_outb(xf86Int10InfoPtr pInt,
-                  CARD16 port, CARD32 base, int d_f, CARD32 count);
+                  uint16_t port, uint32_t base, int d_f, uint32_t count);
 int port_rep_outw(xf86Int10InfoPtr pInt,
-                  CARD16 port, CARD32 base, int d_f, CARD32 count);
+                  uint16_t port, uint32_t base, int d_f, uint32_t count);
 int port_rep_outl(xf86Int10InfoPtr pInt,
-                  CARD16 port, CARD32 base, int d_f, CARD32 count);
-
-CARD8 x_inb(CARD16 port);
-CARD16 x_inw(CARD16 port);
-void x_outb(CARD16 port, CARD8 val);
-void x_outw(CARD16 port, CARD16 val);
-CARD32 x_inl(CARD16 port);
-void x_outl(CARD16 port, CARD32 val);
-
-CARD8 Mem_rb(CARD32 addr);
-CARD16 Mem_rw(CARD32 addr);
-CARD32 Mem_rl(CARD32 addr);
-void Mem_wb(CARD32 addr, CARD8 val);
-void Mem_ww(CARD32 addr, CARD16 val);
-void Mem_wl(CARD32 addr, CARD32 val);
+                  uint16_t port, uint32_t base, int d_f, uint32_t count);
+
+uint8_t x_inb(uint16_t port);
+uint16_t x_inw(uint16_t port);
+void x_outb(uint16_t port, uint8_t val);
+void x_outw(uint16_t port, uint16_t val);
+uint32_t x_inl(uint16_t port);
+void x_outl(uint16_t port, uint32_t val);
+
+uint8_t Mem_rb(uint32_t addr);
+uint16_t Mem_rw(uint32_t addr);
+uint32_t Mem_rl(uint32_t addr);
+void Mem_wb(uint32_t addr, uint8_t val);
+void Mem_ww(uint32_t addr, uint16_t val);
+void Mem_wl(uint32_t addr, uint32_t val);
 
 /* helper_mem.c */
 void setup_int_vect(xf86Int10InfoPtr pInt);
index 0f8737b..4b0a130 100644 (file)
@@ -9,7 +9,6 @@
 
 #include <x86emu.h>
 #include "xf86.h"
-#include "compiler.h"
 #include "xf86_OSproc.h"
 #include "xf86Pci.h"
 #define _INT10_PRIVATE
@@ -50,12 +49,12 @@ xf86Int10ExecSetup(xf86Int10InfoPtr pInt)
     X86EMU_intrFuncs intFuncs[256];
 
     X86EMU_pioFuncs pioFuncs = {
-        (&x_inb),
-        (&x_inw),
-        (&x_inl),
-        (&x_outb),
-        (&x_outw),
-        (&x_outl)
+        .inb = x_inb,
+        .inw = x_inw,
+        .inl = x_inl,
+        .outb = x_outb,
+        .outw = x_outw,
+        .outl = x_outl
     };
 
     X86EMU_memFuncs memFuncs = {
index bd47a63..a658ca5 100644 (file)
@@ -1,6 +1,6 @@
 noinst_LTLIBRARIES = libloader.la
 
-INCLUDES = $(XORG_INCS) -I$(srcdir)/../parser -I$(top_srcdir)/miext/cw \
+AM_CPPFLAGS = $(XORG_INCS) -I$(srcdir)/../parser -I$(top_srcdir)/miext/cw \
           -I$(srcdir)/../ddc -I$(srcdir)/../i2c -I$(srcdir)/../modes \
           -I$(srcdir)/../ramdac -I$(srcdir)/../dri -I$(srcdir)/../dri2
 
index 8b4b53f..cfc4d80 100644 (file)
@@ -72,10 +72,10 @@ typedef struct module_desc {
 
 void LoaderInit(void);
 
-ModuleDescPtr LoadDriver(const char *, const char *, int, pointer, int *,
+ModuleDescPtr LoadDriver(const char *, const char *, int, void *, int *,
                          int *);
 ModuleDescPtr LoadModule(const char *, const char *, const char **,
-                         const char **, pointer, const XF86ModReqInfo *,
+                         const char **, void *, const XF86ModReqInfo *,
                          int *, int *);
 ModuleDescPtr DuplicateModule(ModuleDescPtr mod, ModuleDescPtr parent);
 void UnloadDriver(ModuleDescPtr);
index 2347b8e..e1f649a 100644 (file)
@@ -81,7 +81,7 @@ static void UnloadModuleOrDriver(ModuleDescPtr mod);
 static char *LoaderGetCanonicalName(const char *, PatternPtr);
 static void RemoveChild(ModuleDescPtr);
 static ModuleDescPtr doLoadModule(const char *, const char *, const char **,
-                                  const char **, pointer,
+                                  const char **, void *,
                                   const XF86ModReqInfo *, int *, int *);
 
 const ModuleVersions LoaderVersionInfo = {
@@ -482,7 +482,7 @@ FindModule(const char *module, const char *dirname, const char **subdirlist,
     return name;
 }
 
-char **
+const char **
 LoaderListDirs(const char **subdirlist, const char **patternlist)
 {
     char buf[PATH_MAX + 1];
@@ -490,7 +490,7 @@ LoaderListDirs(const char **subdirlist, const char **patternlist)
     char **elem;
     const char **subdirs;
     const char **s;
-    PatternPtr patterns;
+    PatternPtr patterns = NULL;
     PatternPtr p;
     DIR *d;
     struct dirent *dp;
@@ -571,7 +571,7 @@ LoaderListDirs(const char **subdirlist, const char **patternlist)
     FreePatterns(patterns);
     FreeSubdirs(subdirs);
     FreePathList(pathlist);
-    return ret;
+    return (const char **) ret;
 }
 
 void
@@ -761,10 +761,10 @@ AddSibling(ModuleDescPtr head, ModuleDescPtr new)
     return new;
 }
 
-pointer
-LoadSubModule(pointer _parent, const char *module,
+void *
+LoadSubModule(void *_parent, const char *module,
               const char **subdirlist, const char **patternlist,
-              pointer options, const XF86ModReqInfo * modreq,
+              void *options, const XF86ModReqInfo * modreq,
               int *errmaj, int *errmin)
 {
     ModuleDescPtr submod;
@@ -838,12 +838,18 @@ static const char *compiled_in_modules[] = {
     "extmod",
     "dri",
     "dri2",
+#if DRI3
+    "dri3",
+#endif
+#if PRESENT
+    "present",
+#endif
     NULL
 };
 
 static ModuleDescPtr
 doLoadModule(const char *module, const char *path, const char **subdirlist,
-             const char **patternlist, pointer options,
+             const char **patternlist, void *options,
              const XF86ModReqInfo * modreq, int *errmaj, int *errmin)
 {
     XF86ModuleData *initdata = NULL;
@@ -1071,7 +1077,7 @@ doLoadModule(const char *module, const char *path, const char **subdirlist,
  */
 ModuleDescPtr
 LoadModule(const char *module, const char *path, const char **subdirlist,
-           const char **patternlist, pointer options,
+           const char **patternlist, void *options,
            const XF86ModReqInfo * modreq, int *errmaj, int *errmin)
 {
     return doLoadModule(module, path, subdirlist, patternlist, options,
@@ -1079,7 +1085,7 @@ LoadModule(const char *module, const char *path, const char **subdirlist,
 }
 
 void
-UnloadModule(pointer mod)
+UnloadModule(void *mod)
 {
     UnloadModuleOrDriver((ModuleDescPtr) mod);
 }
@@ -1115,7 +1121,7 @@ UnloadModuleOrDriver(ModuleDescPtr mod)
 }
 
 void
-UnloadSubModule(pointer _mod)
+UnloadSubModule(void *_mod)
 {
     ModuleDescPtr mod = (ModuleDescPtr) _mod;
 
index 80e22cb..5da404c 100644 (file)
@@ -1,3 +1,10 @@
 include $(top_srcdir)/manpages.am
 appman_PRE = Xorg.man
 fileman_PRE = xorg.conf.man xorg.conf.d.man
+
+if SUID_WRAPPER
+appman_PRE += Xorg.wrap.man
+fileman_PRE += Xwrapper.config.man
+else
+EXTRA_DIST += Xorg.wrap.man Xwrapper.config.man
+endif
index 0cd5a10..3ff6aef 100644 (file)
@@ -301,9 +301,11 @@ Use the file called
 .I filename
 as the
 .B Xorg
-server log file.  The default log file is
+server log file.  The default log file when running as root is
 .BI __logdir__/Xorg. n .log
-on most platforms, where
+and for non root it is
+.BI $XDG_DATA_HOME/xorg/Xorg. n .log
+where
 .I n
 is the display number of the
 .B Xorg
diff --git a/hw/xfree86/man/Xorg.wrap.man b/hw/xfree86/man/Xorg.wrap.man
new file mode 100644 (file)
index 0000000..58937c7
--- /dev/null
@@ -0,0 +1,67 @@
+.\" Xwrapper.wrap.__appmansuffix__
+.\"
+.\" Copyright 2014 Red Hat, Inc.
+.\"
+.\" 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.
+.\"
+.\" The above copyright notice and this permission notice 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 OPEN GROUP 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.
+.\"
+.\" Except as contained in this notice, the name of The Open Group shall
+.\" not be used in advertising or otherwise to promote the sale, use or
+.\" other dealings in this Software without prior written authorization
+.\" from The Open Group.
+.\"
+.\" shorthand for double quote that works everywhere.
+.ds q \N'34'
+.TH Xorg.wrap __appmansuffix__ __xorgversion__
+.SH NAME
+Xorg.wrap \- Xorg X server binary wrapper
+.SH DESCRIPTION
+The Xorg X server may need root rights to function properly. To start the
+Xorg X server with these rights your system is using a suid root wrapper
+installed as __suid_wrapper_dir__/Xorg.wrap which will execute the real
+X server which is installed as __suid_wrapper_dir__/Xorg.bin .
+.PP
+By default Xorg.wrap will autodetect if root rights are necessary, and
+if not it will drop its elevated rights before starting the real X server.
+By default Xorg.wrap will only allow executing the real X server from login
+sessions on a physical console.
+
+.SH CONFIG FILE
+Xorg.wrap's default behavior can be overridden from the
+\fI__sysconfdir__/X11/Xwrapper.config\fP config file. Lines starting with a
+\fB#\fP in Xwrapper.config are considered comments and will be ignored. Any
+other non empty lines must take the form of \fBkey\fP = \fIvalue\fP.
+.TP 8
+\fBallowed_users\fP = \fIrootonly\fP|\fIconsole\fP|\fIanybody\fP
+Specify which users may start the X server through the wrapper. Use
+\fIrootonly\fP to only allow root, use \fIconsole\fP to only allow users
+logged into a physical console, and use \fIanybody\fP to allow anybody.
+The default is \fIconsole\fP.
+.TP 8
+\fBneeds_root_rights\fP = \fIyes\fP|\fIno\fP|\fIauto\fP
+Configure if the wrapper should drop its elevated (root) rights before starting
+the X server. Use \fIyes\fP to force execution as root, \fIno\fP to force
+execution with all suid rights dropped, and \fIauto\fP to letter the wrapper
+auto-detect. The default is \fIauto\fP.
+.PP
+When auto-detecting the wrapper will drop rights if kms graphics are available
+and not drop them if no kms graphics are detected. If a system has multiple
+graphics cards and some are not kms capable auto-detection may fail,
+in this case manual configuration should be used.
+
+.SH "SEE ALSO"
+Xorg X server information: \fIXorg\fP(1)
diff --git a/hw/xfree86/man/Xwrapper.config.man b/hw/xfree86/man/Xwrapper.config.man
new file mode 100644 (file)
index 0000000..5c777c9
--- /dev/null
@@ -0,0 +1 @@
+.so man__appmansuffix__/Xorg.wrap.__appmansuffix__
index 5d92bbe..bc33df1 100644 (file)
@@ -171,6 +171,7 @@ The section names are:
 .BR "Extensions     " "Extension enabling"
 .BR "InputDevice    " "Input device description"
 .BR "InputClass     " "Input class description"
+.BR "OutputClass    " "Output class description"
 .BR "Device         " "Graphics device description"
 .BR "VideoAdaptor   " "Xv video adaptor description"
 .BR "Monitor        " "Monitor description"
@@ -442,11 +443,15 @@ __modulepath__
 .TP 7
 .BI "LogFile \*q" path \*q
 sets the name of the Xorg server log file.
-The default log file name is
+The default log file name when running as root is
 .PP
 .RS 11
 .RI __logdir__/Xorg. <n> .log
 .RE
+and for non root it is
+.RS 11
+.RI $XDG_DATA_HOME/xorg/Xorg. <n> .log
+.RE
 .PP
 .RS 7
 where
@@ -668,6 +673,10 @@ DevicePresenceNotify event sent), but not enabled, thus leaving policy up
 to the client.
 Enabled by default.
 .TP 7
+.BI "Option \*qAutoAddGPU\*q \*q" boolean \*q
+If this option is disabled, then no GPU devices will be added from the udev
+backend. Enabled by default. (May need to be disabled to setup Xinerama).
+.TP 7
 .BI "Option \*qLog\*q \*q" string \*q
 This option controls whether the log is flushed and/or synced to disk after
 each message.
@@ -972,7 +981,8 @@ is constructed. This is mainly a matter of personal preference.
 .BI "Option \*qConstantDeceleration\*q  \*q" real \*q
 Makes the pointer go
 .B deceleration
-times slower than normal. Most useful for high-resolution devices.
+times slower than normal. Most useful for high-resolution devices. A value
+between 0 and 1 will speed up the pointer.
 .TP 7
 .BI "Option \*qAdaptiveDeceleration\*q  \*q" real \*q
 Allows to actually decelerate the pointer when going slow. At most, it will be
@@ -1181,6 +1191,82 @@ entries.
 This optional entry specifies that the device should be ignored entirely,
 and not added to the server. This can be useful when the device is handled
 by another program and no X events should be generated.
+.SH "OUTPUTCLASS SECTION"
+The config file may have multiple
+.B OutputClass
+sections.
+These sections are optional and are used to provide configuration for a
+class of output devices as they are automatically added.
+An output device can match more than one
+.B OutputClass
+section.
+Each class can override settings from a previous class, so it is best to
+arrange the sections with the most generic matches first.
+.PP
+.B OutputClass
+sections have the following format:
+.PP
+.RS 4
+.nf
+.B  "Section \*qOutputClass\*q"
+.BI "    Identifier  \*q" name \*q
+.I  "    entries"
+.I  "    ..."
+.B  "EndSection"
+.fi
+.RE
+.PP
+The
+.B Identifier
+entry is required in all
+.B OutputClass
+sections.
+All other entries are optional.
+.PP
+The
+.B Identifier
+entry specifies the unique name for this output class.
+The
+.B Driver
+entry specifies the name of the driver to use for this output device.
+After all classes have been examined, the
+.RI \*q outputdriver \*q
+module from the first
+.B Driver
+entry will be enabled when using the loadable server.
+.PP
+When an output device is automatically added, its characteristics are
+checked against all
+.B OutputClass
+sections.
+Each section can contain optional entries to narrow the match of the class.
+If none of the optional entries appear, the
+.B OutputClass
+section is generic and will match any output device.
+If more than one of these entries appear, they all must match for the
+configuration to apply.
+.PP
+The following list of tokens can be matched against attributes of the device.
+An entry can be constructed to match attributes from different devices by
+separating arguments with a '|' character.
+.PP
+For example:
+.PP
+.RS 4
+.nf
+.B  "Section \*qOutputClass\*q"
+.B  "    Identifier   \*qMy Class\*q"
+.B  "    # kernel driver must be either foo or bar
+.B  "    MatchDriver \*qfoo|bar\*q
+.I  "    ..."
+.B  "EndSection"
+.fi
+.RE
+.TP 7
+.BI "MatchDriver \*q" matchdriver \*q
+Check the case-sensitive string
+.RI \*q matchdriver \*q
+against the kernel driver of the device.
 .SH "DEVICE SECTION"
 The config file may have multiple
 .B Device
@@ -1369,6 +1455,14 @@ for the regular text mode.
 The frequency is specified in MHz.
 This is rarely used.
 .TP 7
+.BI "MatchSeat  " "seat\-id"
+Only apply this
+.B Device
+section if X server was started with
+.B -seat
+.I seat\-id
+option.
+.TP 7
 .BI "Option \*qModeDebug\*q \*q" boolean \*q
 Enable printing of additional debugging information about modesetting to
 the server log.
@@ -1676,6 +1770,17 @@ This optional entry specifies a mode to be marked as the preferred initial mode
 of the monitor.
 (RandR 1.2-supporting drivers only)
 .TP 7
+.BI "Option \*qZoomModes\*q \*q" name " " name " " ... \*q
+This optional entry specifies modes to be marked as zoom modes.
+It is possible to switch to the next and previous mode via
+.BR Ctrl+Alt+Keypad\-Plus " and " Ctrl+Alt+Keypad\-Minus .
+All these keypad available modes are selected from the screen mode list.
+This list is a copy of the compatibility output monitor mode list.
+Since this output is the output connected to the lowest
+dot-area monitor, as determined from its largest size mode, that
+monitor defines the available zoom modes.
+(RandR 1.2-supporting drivers only)
+.TP 7
 .BI "Option \*qPosition\*q \*q" x " " y \*q
 This optional entry specifies the position of the monitor within the X
 screen.
@@ -1821,9 +1926,7 @@ sections have the following format:
 .PP
 The
 .B Identifier
-and
-.B Device
-entries are mandatory.
+entry is mandatory.
 All others are optional.
 .PP
 The
@@ -1841,11 +1944,10 @@ The entries available
 for this section are:
 .TP 7
 .BI "Device  \*q" device\-id \*q
-This mandatory entry specifies the
+This entry specifies the
 .B Device
-section to be used for this screen.
-This is what ties a specific graphics card to a screen.
-The
+section to be used for this screen.  When multiple graphics cards are
+present, this is what ties a specific card to a screen.  The
 .I device\-id
 must match the
 .B Identifier
@@ -1883,6 +1985,14 @@ The only case where there is even a choice in this value is for depth 24,
 where some hardware supports both a packed 24 bit framebuffer layout and a
 sparse 32 bit framebuffer layout.
 .TP 7
+.BI "MatchSeat  " "seat\-id"
+Only apply this
+.B Screen
+section if X server was started with
+.B -seat
+.I seat\-id
+option.
+.TP 7
 .B Options
 Various
 .B Option
@@ -2278,6 +2388,14 @@ and the first two should normally be used to indicate the core pointer
 and core keyboard devices respectively.
 .RE
 .TP 7
+.BI "MatchSeat  " "seat\-id"
+Only apply this
+.B ServerLayout
+section if X server was started with
+.B -seat
+.I seat\-id
+option.
+.TP 7
 .B Options
 In addition to the following, any option permitted in the
 .B ServerFlags
index 9236426..220643f 100644 (file)
@@ -16,11 +16,10 @@ libxf86modes_la_SOURCES = \
        xf86Modes.h \
        xf86RandR12.c \
        xf86RandR12.h \
-       xf86Rename.h \
        xf86Rotate.c \
         $(DGA_SRCS)
 
-INCLUDES = $(XORG_INCS) -I$(srcdir)/../ddc -I$(srcdir)/../i2c \
+AM_CPPFLAGS = $(XORG_INCS) -I$(srcdir)/../ddc -I$(srcdir)/../i2c \
           -I$(srcdir)/../loader -I$(srcdir)/../rac -I$(srcdir)/../parser \
           -I$(srcdir)/../vbe -I$(srcdir)/../int10 \
           -I$(srcdir)/../vgahw -I$(srcdir)/../ramdac \
@@ -29,7 +28,6 @@ INCLUDES = $(XORG_INCS) -I$(srcdir)/../ddc -I$(srcdir)/../i2c \
 sdk_HEADERS = \
        xf86Crtc.h \
        xf86Modes.h \
-       xf86RandR12.h \
-       xf86Rename.h
+       xf86RandR12.h
 
 AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
old mode 100644 (file)
new mode 100755 (executable)
index 940e0f5..51f0b61
 #include "X11/Xatom.h"
 #include "picturestr.h"
 
+#ifdef _F_TTV_SUPPORT_
+#include "system_info.h"
+#endif
+
 #ifdef XV
 #include "xf86xv.h"
 #endif
@@ -66,6 +70,7 @@ xf86CrtcConfigInit(ScrnInfoPtr scrn, const xf86CrtcConfigFuncsRec * funcs)
     config = xnfcalloc(1, sizeof(xf86CrtcConfigRec));
 
     config->funcs = funcs;
+    config->compat_output = -1;
 
     scrn->privates[xf86CrtcConfigPrivateIndex].ptr = config;
 }
@@ -184,10 +189,10 @@ xf86CrtcSetScreenSubpixelOrder(ScreenPtr pScreen)
     Bool has_none = FALSE;
     ScrnInfoPtr scrn = xf86ScreenToScrn(pScreen);
     xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
-    int c, o;
+    int icrtc, o;
 
-    for (c = 0; c < xf86_config->num_crtc; c++) {
-        xf86CrtcPtr crtc = xf86_config->crtc[c];
+    for (icrtc = 0; icrtc < xf86_config->num_crtc; icrtc++) {
+        xf86CrtcPtr crtc = xf86_config->crtc[icrtc];
 
         for (o = 0; o < xf86_config->num_output; o++) {
             xf86OutputPtr output = xf86_config->output[o];
@@ -215,20 +220,20 @@ xf86CrtcSetScreenSubpixelOrder(ScreenPtr pScreen)
                 SubPixelVerticalBGR,
             };
             int rotate;
-            int c;
+            int sc;
 
             for (rotate = 0; rotate < 4; rotate++)
                 if (crtc->rotation & (1 << rotate))
                     break;
-            for (c = 0; c < 4; c++)
-                if (circle[c] == subpixel_order)
+            for (sc = 0; sc < 4; sc++)
+                if (circle[sc] == subpixel_order)
                     break;
-            c = (c + rotate) & 0x3;
-            if ((crtc->rotation & RR_Reflect_X) && !(c & 1))
-                c ^= 2;
-            if ((crtc->rotation & RR_Reflect_Y) && (c & 1))
-                c ^= 2;
-            subpixel_order = circle[c];
+            sc = (sc + rotate) & 0x3;
+            if ((crtc->rotation & RR_Reflect_X) && !(sc & 1))
+                sc ^= 2;
+            if ((crtc->rotation & RR_Reflect_Y) && (sc & 1))
+                sc ^= 2;
+            subpixel_order = circle[sc];
             break;
         }
     }
@@ -262,7 +267,12 @@ xf86CrtcSetModeTransform(xf86CrtcPtr crtc, DisplayModePtr mode,
     /* We only hit this if someone explicitly sends a "disabled" modeset. */
     if (!crtc->enabled) {
         /* Check everything for stuff that should be off. */
+#ifdef _F_XF86_DISABLE_UNUSED_FUNC_RESCHANGE_
+        xf86DisableUnusedFunctionsResChange(scrn, FALSE);
+#else
         xf86DisableUnusedFunctions(scrn);
+#endif
+
         return TRUE;
     }
 
@@ -378,7 +388,7 @@ xf86CrtcSetModeTransform(xf86CrtcPtr crtc, DisplayModePtr mode,
         crtc->transformPresent = saved_transform_present;
     }
 
-    free(adjusted_mode->name);
+    free((void *) adjusted_mode->name);
     free(adjusted_mode);
 
     if (didLock)
@@ -427,6 +437,7 @@ extern XF86ConfigPtr xf86configptr;
 
 typedef enum {
     OPTION_PREFERRED_MODE,
+    OPTION_ZOOM_MODES,
     OPTION_POSITION,
     OPTION_BELOW,
     OPTION_RIGHT_OF,
@@ -445,6 +456,7 @@ typedef enum {
 
 static OptionInfoRec xf86OutputOptions[] = {
     {OPTION_PREFERRED_MODE, "PreferredMode", OPTV_STRING, {0}, FALSE},
+    {OPTION_ZOOM_MODES, "ZoomModes", OPTV_STRING, {0}, FALSE },
     {OPTION_POSITION, "Position", OPTV_STRING, {0}, FALSE},
     {OPTION_BELOW, "Below", OPTV_STRING, {0}, FALSE},
     {OPTION_RIGHT_OF, "RightOf", OPTV_STRING, {0}, FALSE},
@@ -561,8 +573,8 @@ static const char *direction[4] = {
 static Rotation
 xf86OutputInitialRotation(xf86OutputPtr output)
 {
-    char *rotate_name = xf86GetOptValString(output->options,
-                                            OPTION_ROTATE);
+    const char *rotate_name = xf86GetOptValString(output->options,
+                                                  OPTION_ROTATE);
     int i;
 
     if (!rotate_name) {
@@ -742,16 +754,8 @@ xf86CrtcCloseScreen(ScreenPtr screen)
     }
     /* detach any providers */
     if (config->randr_provider) {
-        if (config->randr_provider->offload_sink) {
-            DetachOffloadGPU(screen);
-            config->randr_provider->offload_sink = NULL;
-        }
-        else if (config->randr_provider->output_source) {
-            DetachOutputGPU(screen);
-            config->randr_provider->output_source = NULL;
-        }
-        else if (screen->current_master)
-            DetachUnboundGPU(screen);
+        RRProviderDestroy(config->randr_provider);
+        config->randr_provider = NULL;
     }
     return TRUE;
 }
@@ -931,7 +935,6 @@ xf86PickCrtcs(ScrnInfoPtr scrn,
     xf86OutputPtr output;
     xf86CrtcPtr crtc;
     xf86CrtcPtr *crtcs;
-    xf86CrtcPtr best_crtc;
     int best_score;
     int score;
     int my_score;
@@ -944,7 +947,6 @@ xf86PickCrtcs(ScrnInfoPtr scrn,
      * Compute score with this output disabled
      */
     best_crtcs[n] = NULL;
-    best_crtc = NULL;
     best_score = xf86PickCrtcs(scrn, best_crtcs, modes, n + 1, width, height);
     if (modes[n] == NULL)
         return best_score;
@@ -998,7 +1000,6 @@ xf86PickCrtcs(ScrnInfoPtr scrn,
         score =
             my_score + xf86PickCrtcs(scrn, crtcs, modes, n + 1, width, height);
         if (score > best_score) {
-            best_crtc = crtc;
             best_score = score;
             memcpy(best_crtcs, crtcs, config->num_output * sizeof(xf86CrtcPtr));
         }
@@ -1080,7 +1081,7 @@ xf86DefaultScreenLimits(ScrnInfoPtr scrn, int *widthp, int *heightp,
 #define POSITION_UNSET -100000
 
 /*
- * check if the user configured any outputs at all 
+ * check if the user configured any outputs at all
  * with either a position or a relative setting or a mode.
  */
 static Bool
@@ -1092,8 +1093,8 @@ xf86UserConfiguredOutputs(ScrnInfoPtr scrn, DisplayModePtr * modes)
 
     for (o = 0; o < config->num_output; o++) {
         xf86OutputPtr output = config->output[o];
-        char *position;
-        char *relative_name;
+        const char *position;
+        const char *relative_name;
         OutputOpts relation;
         int r;
 
@@ -1150,8 +1151,8 @@ xf86InitialOutputPositions(ScrnInfoPtr scrn, DisplayModePtr * modes)
             };
             xf86OutputPtr output = config->output[o];
             xf86OutputPtr relative;
-            char *relative_name;
-            char *position;
+            const char *relative_name;
+            const char *position;
             OutputOpts relation;
             int r;
 
@@ -1311,7 +1312,7 @@ xf86InitialPanning(ScrnInfoPtr scrn)
 
     for (o = 0; o < config->num_output; o++) {
         xf86OutputPtr output = config->output[o];
-        char *panning = xf86GetOptValString(output->options, OPTION_PANNING);
+        const char *panning = xf86GetOptValString(output->options, OPTION_PANNING);
         int width, height, left, top;
         int track_width, track_height, track_left, track_top;
         int brdr[4];
@@ -1394,7 +1395,7 @@ xf86SortModes(DisplayModePtr input)
     for (o = output; o && (n = o->next); o = n) {
         if (!strcmp(o->name, n->name) && xf86ModesEqual(o, n)) {
             o->next = n->next;
-            free(n->name);
+            free((void *) n->name);
             free(n);
             n = o;
         }
@@ -1408,14 +1409,32 @@ xf86SortModes(DisplayModePtr input)
     return output;
 }
 
-static char *
+static const char *
 preferredMode(ScrnInfoPtr pScrn, xf86OutputPtr output)
 {
-    char *preferred_mode = NULL;
+    const char *preferred_mode = NULL;
 
     /* Check for a configured preference for a particular mode */
     preferred_mode = xf86GetOptValString(output->options,
                                          OPTION_PREFERRED_MODE);
+
+#ifdef _F_TTV_SUPPORT_
+    //for 21:9 resolution support in booting time
+    ErrorF("default preferred_mode = %s\n", preferred_mode);
+    Bool support = false;
+    int tv_year = 15;
+    system_info_get_value_bool(SYSTEM_INFO_KEY_TTV_SUPPORTED, &support);
+    system_info_get_value_int(SYSTEM_INFO_KEY_TV_YEAR, &tv_year);
+    ErrorF("check support value = %d support_2014 tv_year : %d \n", support, tv_year);
+
+    if (support && tv_year != 14)
+    {
+        static char* _21x9res = "2560x1080@60";
+        preferred_mode = _21x9res;
+        ErrorF("changed preferred_mode = %s\n", preferred_mode);
+    }
+#endif
+
     if (preferred_mode)
         return preferred_mode;
 
@@ -1425,6 +1444,90 @@ preferredMode(ScrnInfoPtr pScrn, xf86OutputPtr output)
     return preferred_mode;
 }
 
+/** identify a token
+ * args
+ *   *src     a string with zero or more tokens, e.g. "tok0 tok1",
+ *   **token  stores a pointer to the first token character,
+ *   *len     stores the token length.
+ * return
+ *   a pointer into src[] at the token terminating character, or
+ *   NULL if no token is found.
+ */
+static const char *
+gettoken(const char *src, const char **token, int *len)
+{
+    const char *delim = " \t";
+    int skip;
+
+    if (!src)
+        return NULL;
+
+    skip = strspn(src, delim);
+    *token = &src[skip];
+
+    *len = strcspn(*token, delim);
+    /* Support for backslash escaped delimiters could be implemented
+     * here.
+     */
+
+    /* (*token)[0] != '\0'  <==>  *len > 0 */
+    if (*len > 0)
+        return &(*token)[*len];
+    else
+        return NULL;
+}
+
+/** Check for a user configured zoom mode list, Option "ZoomModes":
+ *
+ * Section "Monitor"
+ *   Identifier "a21inch"
+ *   Option "ZoomModes" "1600x1200 1280x1024 1280x1024 640x480"
+ * EndSection
+ *
+ * Each user mode name is searched for independently so the list
+ * specification order is free.  An output mode is matched at most
+ * once, a mode with an already set M_T_USERDEF type bit is skipped.
+ * Thus a repeat mode name specification matches the next output mode
+ * with the same name.
+ *
+ * Ctrl+Alt+Keypad-{Plus,Minus} zooms {in,out} by selecting the
+ * {next,previous} M_T_USERDEF mode in the screen modes list, itself
+ * sorted toward lower dot area or lower dot clock frequency, see
+ *   modes/xf86Crtc.c: xf86SortModes() xf86SetScrnInfoModes(), and
+ *   common/xf86Cursor.c: xf86ZoomViewport().
+ */
+static int
+processZoomModes(xf86OutputPtr output)
+{
+    const char *zoom_modes;
+    int count = 0;
+
+    zoom_modes = xf86GetOptValString(output->options, OPTION_ZOOM_MODES);
+
+    if (zoom_modes) {
+        const char *token, *next;
+        int len;
+
+        next = gettoken(zoom_modes, &token, &len);
+        while (next) {
+            DisplayModePtr mode;
+
+            for (mode = output->probed_modes; mode; mode = mode->next)
+                if (!strncmp(token, mode->name, len)  /* prefix match */
+                    && mode->name[len] == '\0'        /* equal length */
+                    && !(mode->type & M_T_USERDEF)) { /* no rematch */
+                    mode->type |= M_T_USERDEF;
+                    break;
+                }
+
+            count++;
+            next = gettoken(next, &token, &len);
+        }
+    }
+
+    return count;
+}
+
 static void
 GuessRangeFromModes(MonPtr mon, DisplayModePtr mode)
 {
@@ -1531,7 +1634,7 @@ xf86ProbeOutputModes(ScrnInfoPtr scrn, int maxX, int maxY)
         xf86OutputPtr output = config->output[o];
         DisplayModePtr mode;
         DisplayModePtr config_modes = NULL, output_modes, default_modes = NULL;
-        char *preferred_mode;
+        const char *preferred_mode;
         xf86MonPtr edid_monitor;
         XF86ConfMonitorPtr conf_monitor;
         MonRec mon_rec;
@@ -1597,6 +1700,7 @@ xf86ProbeOutputModes(ScrnInfoPtr scrn, int maxX, int maxY)
         if (edid_monitor) {
             struct det_monrec_parameter p;
             struct disp_features *features = &edid_monitor->features;
+            struct cea_data_block *hdmi_db;
 
             /* if display is not continuous-frequency, don't add default modes */
             if (!GTF_SUPPORTED(features->msc))
@@ -1609,6 +1713,16 @@ xf86ProbeOutputModes(ScrnInfoPtr scrn, int maxX, int maxY)
             p.sync_source = &sync_source;
 
             xf86ForEachDetailedBlock(edid_monitor, handle_detailed_monrec, &p);
+
+            /* Look at the CEA HDMI vendor block for the max TMDS freq */
+            hdmi_db = xf86MonitorFindHDMIBlock(edid_monitor);
+            if (hdmi_db && hdmi_db->len >= 7) {
+                int tmds_freq = hdmi_db->u.vendor.hdmi.max_tmds_clock * 5000;
+                xf86DrvMsg(scrn->scrnIndex, X_PROBED,
+                           "HDMI max TMDS frequency %dKHz\n", tmds_freq);
+                if (tmds_freq > max_clock)
+                    max_clock = tmds_freq;
+            }
         }
 
         if (xf86GetOptValFreq(output->options, OPTION_MIN_CLOCK,
@@ -1649,7 +1763,7 @@ xf86ProbeOutputModes(ScrnInfoPtr scrn, int maxX, int maxY)
             xf86ValidateModesReducedBlanking(scrn, default_modes);
 
         if (sync_source == sync_config) {
-            /* 
+            /*
              * Check output and config modes against sync range from config file
              */
             xf86ValidateModesSync(scrn, output_modes, &mon_rec);
@@ -1720,6 +1834,9 @@ xf86ProbeOutputModes(ScrnInfoPtr scrn, int maxX, int maxY)
             }
         }
 
+        /* Ctrl+Alt+Keypad-{Plus,Minus} zoom mode: M_T_USERDEF mode type */
+        processZoomModes(output);
+
         output->initial_rotation = xf86OutputInitialRotation(output);
 
         if (debug_modes) {
@@ -1751,10 +1868,6 @@ xf86ProbeOutputModes(ScrnInfoPtr scrn, int maxX, int maxY)
  * Copy one of the output mode lists to the ScrnInfo record
  */
 
-/* XXX where does this function belong? Here? */
-void
- xf86RandR12GetOriginalVirtualSize(ScrnInfoPtr scrn, int *x, int *y);
-
 static DisplayModePtr
 biggestMode(DisplayModePtr a, DisplayModePtr b)
 {
@@ -1781,6 +1894,9 @@ SetCompatOutput(xf86CrtcConfigPtr config)
     DisplayModePtr maxmode = NULL, testmode, mode;
     int o, compat = -1, count, mincount = 0;
 
+    if (config->num_output == 0)
+        return NULL;
+
     /* Look for one that's definitely connected */
     for (o = 0; o < config->num_output; o++) {
         test = config->output[o];
@@ -1841,11 +1957,17 @@ SetCompatOutput(xf86CrtcConfigPtr config)
     if (compat >= 0) {
         config->compat_output = compat;
     }
-    else {
+    else if (config->compat_output >= 0 && config->compat_output < config->num_output) {
         /* Don't change the compat output when no valid outputs found */
         output = config->output[config->compat_output];
     }
 
+    /* All outputs are disconnected, select one to fake */
+    if (!output && config->num_output) {
+        config->compat_output = 0;
+        output = config->output[config->compat_output];
+    }
+
     return output;
 }
 
@@ -1909,6 +2031,14 @@ xf86CollectEnabledOutputs(ScrnInfoPtr scrn, xf86CrtcConfigPtr config,
     Bool any_enabled = FALSE;
     int o;
 
+    /*
+     * Don't bother enabling outputs on GPU screens: a client needs to attach
+     * it to a source provider before setting a mode that scans out a shared
+     * pixmap.
+     */
+    if (scrn->is_gpu)
+        return FALSE;
+
     for (o = 0; o < config->num_output; o++)
         any_enabled |= enabled[o] = xf86OutputEnabled(config->output[o], TRUE);
 
@@ -2045,10 +2175,10 @@ xf86TargetPreferred(ScrnInfoPtr scrn, xf86CrtcConfigPtr config,
                 }
                 else {
                     for (mode = output->probed_modes; mode; mode = mode->next) {
-                        Rotation r = output->initial_rotation;
+                        Rotation ir = output->initial_rotation;
 
-                        if (xf86ModeWidth(mode, r) == pref_width &&
-                            xf86ModeHeight(mode, r) == pref_height) {
+                        if (xf86ModeWidth(mode, ir) == pref_width &&
+                            xf86ModeHeight(mode, ir) == pref_height) {
                             preferred[o] = mode;
                             match = TRUE;
                         }
@@ -2361,11 +2491,11 @@ xf86InitialConfiguration(ScrnInfoPtr scrn, Bool canGrow)
     config->debug_modes = xf86ReturnOptValBool(config->options,
                                                OPTION_MODEDEBUG, FALSE);
 
-    if (scrn->display->virtualX)
+    if (scrn->display->virtualX && !scrn->is_gpu)
         width = scrn->display->virtualX;
     else
         width = config->maxWidth;
-    if (scrn->display->virtualY)
+    if (scrn->display->virtualY && !scrn->is_gpu)
         height = scrn->display->virtualY;
     else
         height = config->maxHeight;
@@ -2378,9 +2508,11 @@ xf86InitialConfiguration(ScrnInfoPtr scrn, Bool canGrow)
 
     ret = xf86CollectEnabledOutputs(scrn, config, enabled);
     if (ret == FALSE && canGrow) {
-        xf86DrvMsg(i, X_WARNING,
-                   "Unable to find connected outputs - setting %dx%d initial framebuffer\n",
-                   NO_OUTPUT_DEFAULT_WIDTH, NO_OUTPUT_DEFAULT_HEIGHT);
+        if (!scrn->is_gpu)
+            xf86DrvMsg(i, X_WARNING,
+                      "Unable to find connected outputs - setting %dx%d "
+                       "initial framebuffer\n",
+                       NO_OUTPUT_DEFAULT_WIDTH, NO_OUTPUT_DEFAULT_HEIGHT);
         have_outputs = FALSE;
     }
     else {
@@ -2429,8 +2561,10 @@ xf86InitialConfiguration(ScrnInfoPtr scrn, Bool canGrow)
 
     /* XXX override xf86 common frame computation code */
 
-    scrn->display->frameX0 = 0;
-    scrn->display->frameY0 = 0;
+    if (!scrn->is_gpu) {
+        scrn->display->frameX0 = 0;
+        scrn->display->frameY0 = 0;
+    }
 
     for (c = 0; c < config->num_crtc; c++) {
         xf86CrtcPtr crtc = config->crtc[c];
@@ -2478,7 +2612,7 @@ xf86InitialConfiguration(ScrnInfoPtr scrn, Bool canGrow)
         }
     }
 
-    if (scrn->display->virtualX == 0) {
+    if (scrn->display->virtualX == 0 || scrn->is_gpu) {
         /*
          * Expand virtual size to cover the current config and potential mode
          * switches, if the driver can't enlarge the screen later.
@@ -2493,8 +2627,10 @@ xf86InitialConfiguration(ScrnInfoPtr scrn, Bool canGrow)
             }
         }
 
-        scrn->display->virtualX = width;
-        scrn->display->virtualY = height;
+       if (!scrn->is_gpu) {
+            scrn->display->virtualX = width;
+            scrn->display->virtualY = height;
+       }
     }
 
     if (width > scrn->virtualX)
@@ -2599,6 +2735,7 @@ xf86SetDesiredModes(ScrnInfoPtr scrn)
 {
     xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
     xf86CrtcPtr crtc = config->crtc[0];
+    int enabled = 0, failed = 0;
     int c;
 
     /* A driver with this hook will take care of this */
@@ -2650,14 +2787,25 @@ xf86SetDesiredModes(ScrnInfoPtr scrn)
             transform = &crtc->desiredTransform;
         else
             transform = NULL;
-        if (!xf86CrtcSetModeTransform
+        if (xf86CrtcSetModeTransform
             (crtc, &crtc->desiredMode, crtc->desiredRotation, transform,
-             crtc->desiredX, crtc->desiredY))
-            return FALSE;
+             crtc->desiredX, crtc->desiredY)) {
+            ++enabled;
+        } else {
+            for (o = 0; o < config->num_output; o++)
+                if (config->output[o]->crtc == crtc)
+                    config->output[o]->crtc = NULL;
+            crtc->enabled = FALSE;
+            ++failed;
+       }
     }
 
+#ifdef _F_XF86_DISABLE_UNUSED_FUNC_RESCHANGE_
+    xf86DisableUnusedFunctionsResChange(scrn, FALSE);
+#else
     xf86DisableUnusedFunctions(scrn);
-    return TRUE;
+#endif
+    return enabled != 0 || failed == 0;
 }
 
 /**
@@ -2785,7 +2933,11 @@ xf86SetSingleMode(ScrnInfoPtr pScrn, DisplayModePtr desired, Rotation rotation)
             crtc->desiredY = 0;
         }
     }
-    xf86DisableUnusedFunctions(pScrn);
+#ifdef _F_XF86_DISABLE_UNUSED_FUNC_RESCHANGE_
+        xf86DisableUnusedFunctionsResChange(pScrn, FALSE);
+#else
+        xf86DisableUnusedFunctions(pScrn);
+#endif
 #ifdef RANDR_12_INTERFACE
     xf86RandR12TellChanged(pScrn->pScreen);
 #endif
@@ -2861,6 +3013,42 @@ xf86SaveScreen(ScreenPtr pScreen, int mode)
     return TRUE;
 }
 
+
+//#ifdef _F_XF86_DISABLE_UNUSED_FUNC_RESCHANGE_
+/**
+ * Disable all inactive crtcs and outputs
+ */
+void
+xf86DisableUnusedFunctionsResChange(ScrnInfoPtr pScrn, Bool is_res_change)
+{
+    xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+    int o, c;
+
+    for (o = 0; o < xf86_config->num_output; o++) {
+        xf86OutputPtr output = xf86_config->output[o];
+
+        if (!output->crtc && !is_res_change)
+            (*output->funcs->dpms) (output, DPMSModeOff);
+    }
+
+    for (c = 0; c < xf86_config->num_crtc; c++) {
+        xf86CrtcPtr crtc = xf86_config->crtc[c];
+
+        if (!crtc->enabled) {
+            if (!is_res_change)
+                crtc->funcs->dpms(crtc, DPMSModeOff);
+            memset(&crtc->mode, 0, sizeof(crtc->mode));
+            xf86RotateDestroy(crtc);
+            crtc->active = FALSE;
+        }
+    }
+    if (pScrn->pScreen)
+        xf86_crtc_notify(pScrn->pScreen);
+    if (pScrn->ModeSet)
+        pScrn->ModeSet(pScrn);
+}
+//#endif
+
 /**
  * Disable all inactive crtcs and outputs
  */
@@ -2944,10 +3132,22 @@ handle_detailed_physical_size(struct detailed_monitor_section
     if (det_mon->type == DT &&
         det_mon->section.d_timings.h_size != 0 &&
         det_mon->section.d_timings.v_size != 0) {
-
-        p->output->mm_width = det_mon->section.d_timings.h_size;
-        p->output->mm_height = det_mon->section.d_timings.v_size;
-        p->ret = TRUE;
+        /* some sanity checking for aspect ratio:
+           assume any h / v (or v / h) > 2.4 to be bogus.
+           This would even include cinemascope */
+        if (((det_mon->section.d_timings.h_size * 5) <
+             (det_mon->section.d_timings.v_size * 12)) &&
+            ((det_mon->section.d_timings.v_size * 5) <
+             (det_mon->section.d_timings.h_size * 12))) {
+            p->output->mm_width = det_mon->section.d_timings.h_size;
+            p->output->mm_height = det_mon->section.d_timings.v_size;
+            p->ret = TRUE;
+        } else
+            xf86DrvMsg(p->output->scrn->scrnIndex, X_WARNING,
+                       "Output %s: Strange aspect ratio (%i/%i), "
+                       "consider adding a quirk\n", p->output->name,
+                       det_mon->section.d_timings.h_size,
+                       det_mon->section.d_timings.v_size);
     }
 }
 
old mode 100644 (file)
new mode 100755 (executable)
index 802303f..3b1e7e9
@@ -25,9 +25,6 @@
 
 #include <edid.h>
 #include "randrstr.h"
-#if XF86_MODES_RENAME
-#include "xf86Rename.h"
-#endif
 #include "xf86Modes.h"
 #include "xf86Cursor.h"
 #include "xf86i2c.h"
@@ -191,12 +188,16 @@ typedef struct _xf86CrtcFuncs {
      */
     void
      (*load_cursor_image) (xf86CrtcPtr crtc, CARD8 *image);
+    Bool
+     (*load_cursor_image_check) (xf86CrtcPtr crtc, CARD8 *image);
 
     /**
      * Load ARGB image
      */
     void
      (*load_cursor_argb) (xf86CrtcPtr crtc, CARD32 *image);
+    Bool
+     (*load_cursor_argb_check) (xf86CrtcPtr crtc, CARD32 *image);
 
     /**
      * Clean up driver-specific bits of the crtc
@@ -241,7 +242,7 @@ struct _xf86Crtc {
     /**
      * Desired state of this CRTC
      *
-     * Set when this CRTC should be driving one or more outputs 
+     * Set when this CRTC should be driving one or more outputs
      */
     Bool enabled;
 
@@ -303,7 +304,7 @@ struct _xf86Crtc {
      */
     Bool cursor_argb;
     /**
-     * Track whether cursor is within CRTC range 
+     * Track whether cursor is within CRTC range
      */
     Bool cursor_in_range;
     /**
@@ -497,6 +498,21 @@ typedef struct _xf86OutputFuncs {
      */
     void
      (*destroy) (xf86OutputPtr output);
+
+//#ifdef _F_STEREOSCOPIC_SEND_FBSIZE_TO_WM_
+
+    /**
+    * Gets the expected width & height of framebuffer after stereo mode setting
+    **/
+     void (*get_stereo_buffer_size)(xf86OutputPtr output, int planeID,
+          short* width, short* height);
+
+    /**
+    * Gets the geometry of drawing rectangle after stereo mode setting
+    **/
+     void (*get_drawing_rect)(xf86OutputPtr output, int planeID,
+           DrawRect* rect[RECT_MAX]);
+//#endif
 } xf86OutputFuncsRec, *xf86OutputFuncsPtr;
 
 #define XF86_OUTPUT_VERSION 2
@@ -607,7 +623,7 @@ struct _xf86Output {
 #else
     void *randr_output;
 #endif
-    /** 
+    /**
      * Desired initial panning
      * Added in ABI version 2
      */
@@ -863,6 +879,11 @@ extern _X_EXPORT void
 extern _X_EXPORT Bool
  xf86SaveScreen(ScreenPtr pScreen, int mode);
 
+//#ifdef _F_XF86_DISABLE_UNUSED_FUNC_RESCHANGE_
+extern _X_EXPORT void
+xf86DisableUnusedFunctionsResChange(ScrnInfoPtr pScrn, Bool is_res_change);
+//#endif
+
 extern _X_EXPORT void
  xf86DisableUnusedFunctions(ScrnInfoPtr pScrn);
 
@@ -921,7 +942,7 @@ extern _X_EXPORT void
  xf86CrtcSetScreenSubpixelOrder(ScreenPtr pScreen);
 
 /*
- * Get a standard string name for a connector type 
+ * Get a standard string name for a connector type
  */
 extern _X_EXPORT const char *xf86ConnectorGetName(xf86ConnectorType connector);
 
@@ -946,7 +967,7 @@ extern _X_EXPORT Bool
  * Called when anything on the screen is reconfigured.
  *
  * Reloads cursor images as needed, then adjusts cursor positions.
- * 
+ *
  * Driver should call this from crtc commit function.
  */
 extern _X_EXPORT void
old mode 100644 (file)
new mode 100755 (executable)
index 634ee3f..82c667b
 #include "cursorstr.h"
 #include "inputstr.h"
 
+
+#ifdef _F_GLOBAL_CURSOR_STATE_
+/* Defined to manage global cursor state show/hide */
+extern int global_cursor_state;
+extern int is_enable_cursor;
+#endif
+
 /*
  * Returns the rotation being performed by the server.  If the driver indicates
  * that it's handling the screen transform, then this returns RR_Rotate_0.
@@ -209,9 +216,43 @@ set_bit(CARD8 *image, xf86CursorInfoPtr cursor_info, int x, int y, Bool mask)
 }
 
 /*
+ * Wrappers to deal with API compatibility with drivers that don't expose
+ * load_cursor_*_check
+ */
+static inline Bool
+xf86_driver_has_load_cursor_image(xf86CrtcPtr crtc)
+{
+    return crtc->funcs->load_cursor_image_check || crtc->funcs->load_cursor_image;
+}
+
+static inline Bool
+xf86_driver_has_load_cursor_argb(xf86CrtcPtr crtc)
+{
+    return crtc->funcs->load_cursor_argb_check || crtc->funcs->load_cursor_argb;
+}
+
+static inline Bool
+xf86_driver_load_cursor_image(xf86CrtcPtr crtc, CARD8 *cursor_image)
+{
+    if (crtc->funcs->load_cursor_image_check)
+        return crtc->funcs->load_cursor_image_check(crtc, cursor_image);
+    crtc->funcs->load_cursor_image(crtc, cursor_image);
+    return TRUE;
+}
+
+static inline Bool
+xf86_driver_load_cursor_argb(xf86CrtcPtr crtc, CARD32 *cursor_argb)
+{
+    if (crtc->funcs->load_cursor_argb_check)
+        return crtc->funcs->load_cursor_argb_check(crtc, cursor_argb);
+    crtc->funcs->load_cursor_argb(crtc, cursor_argb);
+    return TRUE;
+}
+
+/*
  * Load a two color cursor into a driver that supports only ARGB cursors
  */
-static void
+static Bool
 xf86_crtc_convert_cursor_to_argb(xf86CrtcPtr crtc, unsigned char *src)
 {
     ScrnInfoPtr scrn = crtc->scrn;
@@ -244,7 +285,7 @@ xf86_crtc_convert_cursor_to_argb(xf86CrtcPtr crtc, unsigned char *src)
                 bits = 0;
             cursor_image[y * cursor_info->MaxWidth + x] = bits;
         }
-    crtc->funcs->load_cursor_argb(crtc, cursor_image);
+    return xf86_driver_load_cursor_argb(crtc, cursor_image);
 }
 
 /*
@@ -269,7 +310,7 @@ xf86_set_cursor_colors(ScrnInfoPtr scrn, int bg, int fg)
         xf86CrtcPtr crtc = xf86_config->crtc[c];
 
         if (crtc->enabled && !crtc->cursor_argb) {
-            if (crtc->funcs->load_cursor_image)
+            if (xf86_driver_has_load_cursor_image(crtc))
                 crtc->funcs->set_cursor_colors(crtc, bg, fg);
             else if (bits)
                 xf86_crtc_convert_cursor_to_argb(crtc, bits);
@@ -304,10 +345,21 @@ xf86_hide_cursors(ScrnInfoPtr scrn)
 static void
 xf86_crtc_show_cursor(xf86CrtcPtr crtc)
 {
+#ifdef _F_GLOBAL_CURSOR_STATE_
+    if (!global_cursor_state) {
+        crtc->funcs->hide_cursor(crtc);
+        crtc->cursor_shown = FALSE;
+    }
+    else if (!crtc->cursor_shown && crtc->cursor_in_range && is_enable_cursor != 0) {
+        crtc->funcs->show_cursor(crtc);
+        crtc->cursor_shown = TRUE;
+    }
+#else
     if (!crtc->cursor_shown && crtc->cursor_in_range) {
         crtc->funcs->show_cursor(crtc);
         crtc->cursor_shown = TRUE;
     }
+#endif
 }
 
 void
@@ -378,6 +430,7 @@ xf86_crtc_set_cursor_position(xf86CrtcPtr crtc, int x, int y)
      * Disable the cursor when it is outside the viewport
      */
     in_range = TRUE;
+
     if (x >= mode->HDisplay || y >= mode->VDisplay ||
         x <= -cursor_info->MaxWidth || y <= -cursor_info->MaxHeight) {
         in_range = FALSE;
@@ -415,7 +468,7 @@ xf86_set_cursor_position(ScrnInfoPtr scrn, int x, int y)
 /*
  * Load a two-color cursor into a crtc, performing rotation as needed
  */
-static void
+static Bool
 xf86_crtc_load_cursor_image(xf86CrtcPtr crtc, CARD8 *src)
 {
     ScrnInfoPtr scrn = crtc->scrn;
@@ -450,13 +503,13 @@ xf86_crtc_load_cursor_image(xf86CrtcPtr crtc, CARD8 *src)
                     set_bit(cursor_image, cursor_info, x, y, TRUE);
             }
     }
-    crtc->funcs->load_cursor_image(crtc, cursor_image);
+    return xf86_driver_load_cursor_image(crtc, cursor_image);
 }
 
 /*
  * Load a cursor image into all active CRTCs
  */
-static void
+static Bool
 xf86_load_cursor_image(ScrnInfoPtr scrn, unsigned char *src)
 {
     xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
@@ -466,12 +519,17 @@ xf86_load_cursor_image(ScrnInfoPtr scrn, unsigned char *src)
         xf86CrtcPtr crtc = xf86_config->crtc[c];
 
         if (crtc->enabled) {
-            if (crtc->funcs->load_cursor_image)
-                xf86_crtc_load_cursor_image(crtc, src);
-            else if (crtc->funcs->load_cursor_argb)
-                xf86_crtc_convert_cursor_to_argb(crtc, src);
+            if (xf86_driver_has_load_cursor_image(crtc)) {
+                if (!xf86_crtc_load_cursor_image(crtc, src))
+                    return FALSE;
+            } else if (xf86_driver_has_load_cursor_argb(crtc)) {
+                if (!xf86_crtc_convert_cursor_to_argb(crtc, src))
+                    return FALSE;
+            } else
+                return FALSE;
         }
     }
+    return TRUE;
 }
 
 static Bool
@@ -481,7 +539,7 @@ xf86_use_hw_cursor(ScreenPtr screen, CursorPtr cursor)
     xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
     xf86CursorInfoPtr cursor_info = xf86_config->cursor_info;
 
-    ++cursor->refcnt;
+    cursor = RefCursor(cursor);
     if (xf86_config->cursor)
         FreeCursor(xf86_config->cursor, None);
     xf86_config->cursor = cursor;
@@ -500,7 +558,7 @@ xf86_use_hw_cursor_argb(ScreenPtr screen, CursorPtr cursor)
     xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
     xf86CursorInfoPtr cursor_info = xf86_config->cursor_info;
 
-    ++cursor->refcnt;
+    cursor = RefCursor(cursor);
     if (xf86_config->cursor)
         FreeCursor(xf86_config->cursor, None);
     xf86_config->cursor = cursor;
@@ -516,7 +574,7 @@ xf86_use_hw_cursor_argb(ScreenPtr screen, CursorPtr cursor)
     return TRUE;
 }
 
-static void
+static Bool
 xf86_crtc_load_cursor_argb(xf86CrtcPtr crtc, CursorPtr cursor)
 {
     ScrnInfoPtr scrn = crtc->scrn;
@@ -544,10 +602,10 @@ xf86_crtc_load_cursor_argb(xf86CrtcPtr crtc, CursorPtr cursor)
             cursor_image[y * image_width + x] = bits;
         }
 
-    crtc->funcs->load_cursor_argb(crtc, cursor_image);
+    return xf86_driver_load_cursor_argb(crtc, cursor_image);
 }
 
-static void
+static Bool
 xf86_load_cursor_argb(ScrnInfoPtr scrn, CursorPtr cursor)
 {
     xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
@@ -557,8 +615,10 @@ xf86_load_cursor_argb(ScrnInfoPtr scrn, CursorPtr cursor)
         xf86CrtcPtr crtc = xf86_config->crtc[c];
 
         if (crtc->enabled)
-            xf86_crtc_load_cursor_argb(crtc, cursor);
+            if (!xf86_crtc_load_cursor_argb(crtc, cursor))
+                return FALSE;
     }
+    return TRUE;
 }
 
 Bool
@@ -584,17 +644,20 @@ xf86_cursors_init(ScreenPtr screen, int max_width, int max_height, int flags)
     cursor_info->MaxWidth = max_width;
     cursor_info->MaxHeight = max_height;
     cursor_info->Flags = flags;
+#ifdef _F_GLOBAL_CURSOR_STATE_
+    global_cursor_state = TRUE;
+#endif
 
     cursor_info->SetCursorColors = xf86_set_cursor_colors;
     cursor_info->SetCursorPosition = xf86_set_cursor_position;
-    cursor_info->LoadCursorImage = xf86_load_cursor_image;
+    cursor_info->LoadCursorImageCheck = xf86_load_cursor_image;
     cursor_info->HideCursor = xf86_hide_cursors;
     cursor_info->ShowCursor = xf86_show_cursors;
     cursor_info->UseHWCursor = xf86_use_hw_cursor;
 #ifdef ARGB_CURSOR
     if (flags & HARDWARE_CURSOR_ARGB) {
         cursor_info->UseHWCursorARGB = xf86_use_hw_cursor_argb;
-        cursor_info->LoadCursorARGB = xf86_load_cursor_argb;
+        cursor_info->LoadCursorARGBCheck = xf86_load_cursor_argb;
     }
 #endif
 
@@ -608,6 +671,8 @@ xf86_cursors_init(ScreenPtr screen, int max_width, int max_height, int flags)
  * Called when anything on the screen is reconfigured.
  *
  * Reloads cursor images as needed, then adjusts cursor positions
+ * @note We assume that all hardware cursors to be loaded have already been
+ *       found to be usable by the hardware.
  */
 
 void
@@ -649,11 +714,11 @@ xf86_reload_cursors(ScreenPtr screen)
             dixLookupScreenPrivate(&cursor->devPrivates, CursorScreenKey,
                                    screen);
 #ifdef ARGB_CURSOR
-        if (cursor->bits->argb && cursor_info->LoadCursorARGB)
-            (*cursor_info->LoadCursorARGB) (scrn, cursor);
+        if (cursor->bits->argb && xf86DriverHasLoadCursorARGB(cursor_info))
+            xf86DriverLoadCursorARGB(cursor_info, cursor);
         else if (src)
 #endif
-            (*cursor_info->LoadCursorImage) (scrn, src);
+            xf86DriverLoadCursorImage(cursor_info, src);
 
         x += scrn->frameX0 + cursor_screen_priv->HotX;
         y += scrn->frameY0 + cursor_screen_priv->HotY;
index bead126..c2e7718 100644 (file)
@@ -25,6 +25,7 @@
 
 #include "xorg-config.h"
 #include "xf86.h"
+#include "xf86Modes.h"
 #include "xf86str.h"
 #include "edid.h"
 #include "xf86DDC.h"
index 4ee862d..6fb0f9b 100644 (file)
@@ -162,6 +162,11 @@ quirk_detailed_use_maximum_size(int scrnIndex, xf86MonPtr DDC)
         DDC->vendor.prod_id == 0x7f01)
         return TRUE;
 
+    /* Sony Vaio Pro 13 */
+    if (memcmp(DDC->vendor.name, "MEI", 4) == 0 &&
+        DDC->vendor.prod_id == 0x96a2)
+        return TRUE;
+
     return FALSE;
 }
 
@@ -973,11 +978,11 @@ handle_cea_svd(struct cea_video_block *video, void *data)
 }
 
 static DisplayModePtr
-DDCModesFromCEAExtension(int scrnIndex, xf86MonPtr MonPtr)
+DDCModesFromCEAExtension(int scrnIndex, xf86MonPtr mon_ptr)
 {
     DisplayModePtr Modes = NULL;
 
-    xf86ForEachVideoBlock(MonPtr, handle_cea_svd, &Modes);
+    xf86ForEachVideoBlock(mon_ptr, handle_cea_svd, &Modes);
 
     return Modes;
 }
index c4a3eb0..43b2233 100644 (file)
@@ -129,11 +129,13 @@ void
 xf86SetModeDefaultName(DisplayModePtr mode)
 {
     Bool interlaced = ! !(mode->Flags & V_INTERLACE);
+    char *tmp;
 
-    free(mode->name);
+    free((void *) mode->name);
 
-    XNFasprintf(&mode->name, "%dx%d%s", mode->HDisplay, mode->VDisplay,
+    XNFasprintf(&tmp, "%dx%d%s", mode->HDisplay, mode->VDisplay,
                 interlaced ? "i" : "");
+    mode->name = tmp;
 }
 
 /*
index aec7688..5458918 100644 (file)
@@ -36,9 +36,6 @@
 #include "xorgVersion.h"
 #include "edid.h"
 #include "xf86Parser.h"
-#if XF86_MODES_RENAME
-#include "xf86Rename.h"
-#endif
 
 extern _X_EXPORT double xf86ModeHSync(const DisplayModeRec * mode);
 extern _X_EXPORT double xf86ModeVRefresh(const DisplayModeRec * mode);
@@ -112,6 +109,9 @@ xf86GetMonitorModes(ScrnInfoPtr pScrn, XF86ConfMonitorPtr conf_monitor);
 extern _X_EXPORT DisplayModePtr xf86GetDefaultModes(void);
 
 extern _X_EXPORT void
+xf86SaveModeContents(DisplayModePtr intern, const DisplayModeRec *mode);
+
+extern _X_EXPORT void
  xf86DDCApplyQuirks(int scrnIndex, xf86MonPtr DDC);
 
 #endif                          /* _XF86MODES_H_ */
old mode 100644 (file)
new mode 100755 (executable)
index 3530abf..48f5ec0
@@ -31,6 +31,7 @@
 #include "xf86.h"
 #include "os.h"
 #include "globals.h"
+#include "xf86Modes.h"
 #include "xf86Priv.h"
 #include "xf86DDC.h"
 #include "mipointer.h"
@@ -453,7 +454,6 @@ xf86RandR12GetInfo(ScreenPtr pScreen, Rotation * rotations)
     ScrnInfoPtr scrp = xf86ScreenToScrn(pScreen);
     XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
     DisplayModePtr mode;
-    int refresh0 = 60;
     int maxX = 0, maxY = 0;
 
     *rotations = randrp->supported_rotations;
@@ -478,8 +478,6 @@ xf86RandR12GetInfo(ScreenPtr pScreen, Rotation * rotations)
             if (maxY < mode->VDisplay)
                 maxY = mode->VDisplay;
         }
-        if (mode == scrp->modes)
-            refresh0 = refresh;
         pSize = RRRegisterSize(pScreen,
                                mode->HDisplay, mode->VDisplay,
                                randrp->mmWidth, randrp->mmHeight);
@@ -683,7 +681,6 @@ xf86RandR12ScreenSetSize(ScreenPtr pScreen,
     WindowPtr pRoot = pScreen->root;
     PixmapPtr pScrnPix;
     Bool ret = FALSE;
-    Bool panning = FALSE;
     int c;
 
     if (xf86RandR12Key) {
@@ -715,7 +712,6 @@ xf86RandR12ScreenSetSize(ScreenPtr pScreen,
                 crtc->panningTrackingArea.y2 += height - pScreen->height;
             xf86RandR13VerifyPanningArea(crtc, width, height);
             xf86RandR13Pan(crtc, randrp->pointerX, randrp->pointerY);
-           panning = TRUE;
         }
     }
 
@@ -945,8 +941,6 @@ xf86RandR12SetRotations(ScreenPtr pScreen, Rotation rotations)
 void
 xf86RandR12SetTransformSupport(ScreenPtr pScreen, Bool transforms)
 {
-    XF86RandRInfoPtr randrp;
-
 #if RANDR_13_INTERFACE
     ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
     int c;
@@ -956,7 +950,6 @@ xf86RandR12SetTransformSupport(ScreenPtr pScreen, Bool transforms)
     if (xf86RandR12Key == NULL)
         return;
 
-    randrp = XF86RANDRINFO(pScreen);
 #if RANDR_13_INTERFACE
     for (c = 0; c < config->num_crtc; c++) {
         xf86CrtcPtr crtc = config->crtc[c];
@@ -1079,7 +1072,7 @@ xf86RandR12CrtcNotify(RRCrtcPtr randr_crtc)
             randr_output = output->randr_output;
             randr_outputs[numOutputs++] = randr_output;
             /*
-             * We make copies of modes, so pointer equality 
+             * We make copies of modes, so pointer equality
              * isn't sufficient
              */
             for (j = 0; j < randr_output->numModes + randr_output->numUserModes;
@@ -1209,7 +1202,6 @@ xf86RandR12CrtcSet(ScreenPtr pScreen,
 
         if (randr_mode) {
             DisplayModeRec mode;
-            RRTransformPtr transform = RRCrtcGetTransform(randr_crtc);
 
             xf86RandRModeConvert(pScrn, randr_mode, &mode);
             if (!xf86CrtcSetModeTransform
@@ -1264,12 +1256,13 @@ xf86RandR12CrtcSetGamma(ScreenPtr pScreen, RRCrtcPtr randr_crtc)
         CARD16 *tmp_ptr;
 
         tmp_ptr =
-            realloc(crtc->gamma_red, 3 * crtc->gamma_size * sizeof(CARD16));
+            realloc(crtc->gamma_red,
+                    3 * randr_crtc->gammaSize * sizeof(CARD16));
         if (!tmp_ptr)
             return FALSE;
         crtc->gamma_red = tmp_ptr;
-        crtc->gamma_green = crtc->gamma_red + crtc->gamma_size;
-        crtc->gamma_blue = crtc->gamma_green + crtc->gamma_size;
+        crtc->gamma_green = crtc->gamma_red + randr_crtc->gammaSize;
+        crtc->gamma_blue = crtc->gamma_green + randr_crtc->gammaSize;
     }
 
     crtc->gamma_size = randr_crtc->gammaSize;
@@ -1325,6 +1318,34 @@ xf86RandR12CrtcGetGamma(ScreenPtr pScreen, RRCrtcPtr randr_crtc)
     return TRUE;
 }
 
+#ifdef _F_STEREOSCOPIC_SEND_FBSIZE_TO_WM_
+/* added for stereoscopic mode support */
+static void xf86GetStereoBufferSize(RROutputPtr randr_output, int planeID,
+           short* width, short* height)
+{
+    xf86OutputPtr output = randr_output->devPrivate;
+    if (NULL == output->funcs->get_stereo_buffer_size)
+    {
+        return ;
+    }
+
+    output->funcs->get_stereo_buffer_size(output, planeID, width, height) ;
+}
+
+/* added for stereoscopic mode support */
+static void xf86GetDrawingRectangle(RROutputPtr randr_output, int planeID,
+           DrawRect* rect[RECT_MAX])
+{
+    xf86OutputPtr output = randr_output->devPrivate;
+    if (NULL == output->funcs->get_drawing_rect)
+    {
+        return ;
+    }
+
+    output->funcs->get_drawing_rect(output, planeID, rect) ;
+}
+#endif
+
 static Bool
 xf86RandR12OutputSetProperty(ScreenPtr pScreen,
                              RROutputPtr randr_output,
@@ -1454,7 +1475,6 @@ xf86RandR12SetInfo12(ScreenPtr pScreen)
     RRCrtcPtr *crtcs;
     int ncrtc;
     int o, c, l;
-    RRCrtcPtr randr_crtc;
     int nclone;
 
     clones = malloc(config->num_output * sizeof(RROutputPtr));
@@ -1467,11 +1487,6 @@ xf86RandR12SetInfo12(ScreenPtr pScreen)
             if (output->possible_crtcs & (1 << c))
                 crtcs[ncrtc++] = config->crtc[c]->randr_crtc;
 
-        if (output->crtc)
-            randr_crtc = output->crtc->randr_crtc;
-        else
-            randr_crtc = NULL;
-
         if (!RROutputSetCrtcs(output->randr_output, crtcs, ncrtc)) {
             free(crtcs);
             free(clones);
@@ -1770,6 +1785,19 @@ xf86RandR12EnterVT(ScrnInfoPtr pScrn)
     return RRGetInfo(pScreen, TRUE);    /* force a re-probe of outputs and notify clients about changes */
 }
 
+static void
+xf86DetachOutputGPU(ScreenPtr pScreen)
+{
+    rrScrPrivPtr rp = rrGetScrPriv(pScreen);
+    int i;
+
+    /* make sure there are no attached shared scanout pixmaps first */
+    for (i = 0; i < rp->numCrtcs; i++)
+        RRCrtcDetachScanoutPixmap(rp->crtcs[i]);
+
+    DetachOutputGPU(pScreen);
+}
+
 static Bool
 xf86RandR14ProviderSetOutputSource(ScreenPtr pScreen,
                                    RRProviderPtr provider,
@@ -1779,7 +1807,7 @@ xf86RandR14ProviderSetOutputSource(ScreenPtr pScreen,
         if (provider->output_source) {
             ScreenPtr cmScreen = pScreen->current_master;
 
-            DetachOutputGPU(pScreen);
+            xf86DetachOutputGPU(pScreen);
             AttachUnboundGPU(cmScreen, pScreen);
         }
         provider->output_source = NULL;
@@ -1807,7 +1835,7 @@ xf86RandR14ProviderSetOffloadSink(ScreenPtr pScreen,
     if (!sink_provider) {
         if (provider->offload_sink) {
             ScreenPtr cmScreen = pScreen->current_master;
-            DetachOutputGPU(pScreen);
+            xf86DetachOutputGPU(pScreen);
             AttachUnboundGPU(cmScreen, pScreen);
         }
 
@@ -1885,6 +1913,29 @@ xf86RandR13ConstrainCursorHarder(DeviceIntPtr dev, ScreenPtr screen, int mode, i
     }
 }
 
+static void
+xf86RandR14ProviderDestroy(ScreenPtr screen, RRProviderPtr provider)
+{
+    ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
+    xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+
+    if (config->randr_provider == provider) {
+        if (config->randr_provider->offload_sink) {
+            DetachOffloadGPU(screen);
+            config->randr_provider->offload_sink = NULL;
+            RRSetChanged(screen);
+        }
+        else if (config->randr_provider->output_source) {
+            xf86DetachOutputGPU(screen);
+            config->randr_provider->output_source = NULL;
+            RRSetChanged(screen);
+        }
+        else if (screen->current_master)
+            DetachUnboundGPU(screen);
+    }
+    config->randr_provider = NULL;
+}
+
 static Bool
 xf86RandR12Init12(ScreenPtr pScreen)
 {
@@ -1914,6 +1965,13 @@ xf86RandR12Init12(ScreenPtr pScreen)
     rp->rrProviderSetProperty = xf86RandR14ProviderSetProperty;
     rp->rrProviderGetProperty = xf86RandR14ProviderGetProperty;
     rp->rrCrtcSetScanoutPixmap = xf86CrtcSetScanoutPixmap;
+    rp->rrProviderDestroy = xf86RandR14ProviderDestroy;
+
+#ifdef _F_STEREOSCOPIC_SEND_FBSIZE_TO_WM_
+    /* added for stereoscopic mode support */
+    rp->getStereoBufferSize   = xf86GetStereoBufferSize ;
+    rp->getDrawingRect   = xf86GetDrawingRectangle ;
+#endif
 
     pScrn->PointerMoved = xf86RandR12PointerMoved;
     pScrn->ChangeGamma = xf86RandR12ChangeGamma;
index 9ad695c..e603799 100644 (file)
@@ -24,9 +24,6 @@
 #define _XF86_RANDR_H_
 #include <randrstr.h>
 #include <X11/extensions/render.h>
-#if XF86_MODES_RENAME
-#include "xf86Rename.h"
-#endif
 
 extern _X_EXPORT Bool xf86RandR12CreateScreenResources(ScreenPtr pScreen);
 extern _X_EXPORT Bool xf86RandR12Init(ScreenPtr pScreen);
diff --git a/hw/xfree86/modes/xf86Rename.h b/hw/xfree86/modes/xf86Rename.h
deleted file mode 100644 (file)
index 46690a8..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright Â© 2006 Keith Packard
- *
- * 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 the copyright holders not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission.  The copyright holders make no representations
- * about the suitability of this software for any purpose.  It is provided "as
- * is" without express or implied warranty.
- *
- * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THE COPYRIGHT HOLDERS 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.
- */
-
-#ifndef _XF86RENAME_H_
-#define _XF86RENAME_H_
-
-#include "local_xf86Rename.h"
-
-#define xf86_cursors_fini XF86NAME(xf86_cursors_fini)
-#define xf86_cursors_init XF86NAME(xf86_cursors_init)
-#define xf86_hide_cursors XF86NAME(xf86_hide_cursors)
-#define xf86_reload_cursors XF86NAME(xf86_reload_cursors)
-#define xf86_show_cursors XF86NAME(xf86_show_cursors)
-#define xf86ConnectorGetName XF86NAME(xf86ConnectorGetName)
-#define xf86CrtcConfigInit XF86NAME(xf86CrtcConfigInit)
-#define xf86CrtcConfigPrivateIndex XF86NAME(xf86CrtcConfigPrivateIndex)
-#define xf86CrtcCreate XF86NAME(xf86CrtcCreate)
-#define xf86CrtcDestroy XF86NAME(xf86CrtcDestroy)
-#define xf86CrtcInUse XF86NAME(xf86CrtcInUse)
-#define xf86CrtcRotate XF86NAME(xf86CrtcRotate)
-#define xf86CrtcScreenInit XF86NAME(xf86CrtcScreenInit)
-#define xf86CrtcSetModeTransform XF86NAME(xf86CrtcSetModeTransform)
-#define xf86CrtcSetMode XF86NAME(xf86CrtcSetMode)
-#define xf86CrtcSetSizeRange XF86NAME(xf86CrtcSetSizeRange)
-#define xf86CVTMode XF86NAME(xf86CVTMode)
-#define xf86DDCMonitorSet XF86NAME(xf86DDCMonitorSet)
-#define xf86DisableUnusedFunctions XF86NAME(xf86DisableUnusedFunctions)
-#define xf86DPMSSet XF86NAME(xf86DPMSSet)
-#define xf86DuplicateMode XF86NAME(xf86DuplicateMode)
-#define xf86DuplicateModes XF86NAME(xf86DuplicateModes)
-#define xf86GetDefaultModes XF86NAME(xf86GetDefaultModes)
-#define xf86GetMonitorModes XF86NAME(xf86GetMonitorModes)
-#define xf86InitialConfiguration XF86NAME(xf86InitialConfiguration)
-#define xf86ModeHSync XF86NAME(xf86ModeHSync)
-#define xf86ModesAdd XF86NAME(xf86ModesAdd)
-#define xf86ModesEqual XF86NAME(xf86ModesEqual)
-#define xf86ModeVRefresh XF86NAME(xf86ModeVRefresh)
-#define xf86OutputCreate XF86NAME(xf86OutputCreate)
-#define xf86OutputDestroy XF86NAME(xf86OutputDestroy)
-#define xf86OutputGetEDID XF86NAME(xf86OutputGetEDID)
-#define xf86OutputGetEDIDModes XF86NAME(xf86OutputGetEDIDModes)
-#define xf86OutputRename XF86NAME(xf86OutputRename)
-#define xf86OutputSetEDID XF86NAME(xf86OutputSetEDID)
-#define xf86OutputUseScreenMonitor XF86NAME(xf86OutputUseScreenMonitor)
-#define xf86PrintModeline XF86NAME(xf86PrintModeline)
-#define xf86ProbeOutputModes XF86NAME(xf86ProbeOutputModes)
-#define xf86PruneInvalidModes XF86NAME(xf86PruneInvalidModes)
-#define xf86RotateCloseScreen XF86NAME(xf86RotateCloseScreen)
-#define xf86SetModeCrtc XF86NAME(xf86SetModeCrtc)
-#define xf86SetModeDefaultName XF86NAME(xf86SetModeDefaultName)
-#define xf86SetScrnInfoModes XF86NAME(xf86SetScrnInfoModes)
-#define xf86ValidateModesClocks XF86NAME(xf86ValidateModesClocks)
-#define xf86ValidateModesFlags XF86NAME(xf86ValidateModesFlags)
-#define xf86ValidateModesSize XF86NAME(xf86ValidateModesSize)
-#define xf86ValidateModesSync XF86NAME(xf86ValidateModesSync)
-#define xf86ValidateModesUserConfig XF86NAME(xf86ValidateModesUserConfig)
-#define xf86DiDGAInit XF86NAME(xf86DiDGAInit)
-#define xf86DiDGAReInit XF86NAME(xf86DiDGAReInit)
-#define xf86DDCGetModes XF86NAME(xf86DDCGetModes)
-#define xf86RandR12CreateScreenResources XF86NAME(xf86RandR12CreateScreenResources)
-#define xf86RandR12GetOriginalVirtualSize XF86NAME(xf86RandR12GetOriginalVirtualSize)
-#define xf86RandR12GetRotation XF86NAME(xf86RandR12GetRotation)
-#define xf86RandR12Init XF86NAME(xf86RandR12Init)
-#define xf86RandR12PreInit XF86NAME(xf86RandR12PreInit)
-#define xf86RandR12SetConfig XF86NAME(xf86RandR12SetConfig)
-#define xf86RandR12SetRotations XF86NAME(xf86RandR12SetRotations)
-#define xf86SaveScreen XF86NAME(xf86SaveScreen)
-#define xf86CrtcSetScreenSubpixelOrder XF86NAME(xf86CrtcSetScreenSubpixelOrder)
-#define xf86ModeWidth XF86NAME(xf86ModeWidth)
-#define xf86ModeHeight XF86NAME(xf86ModeHeight)
-#define xf86OutputFindClosestMode XF86NAME(xf86OutputFindClosestMode)
-#define xf86SetSingleMode XF86NAME(xf86SetSingleMode)
-#define xf86SetDesiredModes XF86NAME(xf86SetDesiredModes)
-
-#endif                          /* _XF86RENAME_H_ */
index a393747..0ddd840 100644 (file)
@@ -229,13 +229,12 @@ xf86RotateRedisplay(ScreenPtr pScreen)
 
 static void
 xf86RotateBlockHandler(ScreenPtr pScreen,
-                       pointer pTimeout, pointer pReadmask)
+                       void *pTimeout, void *pReadmask)
 {
     ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
     xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
-    Bool rotation_active;
 
-    rotation_active = xf86RotateRedisplay(pScreen);
+    xf86RotateRedisplay(pScreen);
     pScreen->BlockHandler = xf86_config->BlockHandler;
     (*pScreen->BlockHandler) (pScreen, pTimeout, pReadmask);
     /* cannot avoid re-wrapping until all wrapping is audited */
@@ -247,7 +246,6 @@ void
 xf86RotateDestroy(xf86CrtcPtr crtc)
 {
     ScrnInfoPtr pScrn = crtc->scrn;
-    ScreenPtr pScreen = xf86ScrnToScreen(pScrn);
     xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
     int c;
 
@@ -267,19 +265,12 @@ xf86RotateDestroy(xf86CrtcPtr crtc)
      * Clean up damage structures when no crtcs are rotated
      */
     if (xf86_config->rotation_damage) {
-        DrawablePtr screenDrawable = NULL;
-        if (pScreen && pScreen->root)
-            screenDrawable = &pScreen->root->drawable;
         /* Free damage structure */
         if (xf86_config->rotation_damage_registered) {
-            if (screenDrawable)
-                DamageUnregister(screenDrawable,
-                        xf86_config->rotation_damage);
             xf86_config->rotation_damage_registered = FALSE;
             DisableLimitedSchedulingLatency();
         }
-        if (screenDrawable)
-            DamageDestroy(xf86_config->rotation_damage);
+        DamageDestroy(xf86_config->rotation_damage);
         xf86_config->rotation_damage = NULL;
     }
 }
index de07844..8b7bb8b 100644 (file)
@@ -89,6 +89,7 @@ xf86CVTMode(int HDisplay, int VDisplay, float VRefresh, Bool Reduced,
     int HDisplayRnd, HMargin;
     int VDisplayRnd, VMargin, VSync;
     float Interlace;            /* Please rename this */
+    char *tmp;
 
     /* CVT default is 60.0Hz */
     if (!VRefresh)
@@ -177,6 +178,7 @@ xf86CVTMode(int HDisplay, int VDisplay, float VRefresh, Bool Reduced,
 
         /* 10. Find number of lines in back porch */
         VBackPorch = VSyncAndBackPorch - VSync;
+        (void) VBackPorch;
 
         /* 11. Find total number of lines in vertical field */
         Mode->VTotal = VDisplayRnd + 2 * VMargin + VSyncAndBackPorch + Interlace
@@ -282,7 +284,8 @@ xf86CVTMode(int HDisplay, int VDisplay, float VRefresh, Bool Reduced,
     if (Interlaced)
         Mode->VTotal *= 2;
 
-    XNFasprintf(&Mode->name, "%dx%d", HDisplay, VDisplay);
+    XNFasprintf(&tmp, "%dx%d", HDisplay, VDisplay);
+    Mode->name = tmp;
 
     if (Reduced)
         Mode->Flags |= V_PHSYNC | V_NVSYNC;
index 23707b4..0a80784 100644 (file)
@@ -215,6 +215,7 @@ xf86GTFMode(int h_pixels, int v_lines, float freq, int interlaced, int margins)
      */
 
     v_back_porch = vsync_plus_bp - V_SYNC_RQD;
+    (void) v_back_porch;
 
     /*  10. Find the total number of lines in Vertical field period:
      *
@@ -253,6 +254,7 @@ xf86GTFMode(int h_pixels, int v_lines, float freq, int interlaced, int margins)
      */
 
     v_frame_rate = interlaced ? v_field_rate / 2.0 : v_field_rate;
+    (void) v_frame_rate;
 
     /*  15. Find number of pixels in left margin:
      *
index b6ecdf1..7133c0f 100644 (file)
@@ -54,7 +54,7 @@ endif
 # FIXME: NetBSD Aperture defines (configure.ac)
 AM_CFLAGS = -DUSESTDRES $(XORG_CFLAGS) $(DIX_CFLAGS)
 
-INCLUDES = $(XORG_INCS)
+AM_CPPFLAGS = $(XORG_INCS)
 
 libbsd_la_SOURCES = \
        $(srcdir)/../shared/posix_tty.c \
index 91f9fc8..95bd059 100644 (file)
@@ -189,10 +189,10 @@ static int devMemFd = -1;
 #define DEV_APERTURE "/dev/xf86"
 #endif
 
-static pointer mapVidMem(int, unsigned long, unsigned long, int);
-static void unmapVidMem(int, pointer, unsigned long);
-static pointer mapVidMemSparse(int, unsigned long, unsigned long, int);
-static void unmapVidMemSparse(int, pointer, unsigned long);
+static void *mapVidMem(int, unsigned long, unsigned long, int);
+static void unmapVidMem(int, void *, unsigned long);
+static void *mapVidMemSparse(int, unsigned long, unsigned long, int);
+static void unmapVidMemSparse(int, void *, unsigned long);
 
 /*
  * Check if /dev/mem can be mmap'd.  If it can't print a warning when
@@ -203,7 +203,7 @@ checkDevMem(Bool warn)
 {
     static Bool devMemChecked = FALSE;
     int fd;
-    pointer base;
+    void *base;
 
     if (devMemChecked)
         return;
@@ -295,10 +295,10 @@ xf86OSInitVidMem(VidMemInfoPtr pVidMem)
     pVidMem->initialised = TRUE;
 }
 
-static pointer
+static void *
 mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
 {
-    pointer base;
+    void *base;
 
     checkDevMem(FALSE);
     Base = Base & ((1L << 32) - 1);
@@ -336,7 +336,7 @@ mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
 }
 
 static void
-unmapVidMem(int ScreenNum, pointer Base, unsigned long Size)
+unmapVidMem(int ScreenNum, void *Base, unsigned long Size)
 {
     munmap((caddr_t) Base, Size);
 }
@@ -424,40 +424,40 @@ xf86DisableIO()
 
 #define vuip    volatile unsigned int *
 
-static pointer memSBase = 0;
-static pointer memBase = 0;
+static void *memSBase = 0;
+static void *memBase = 0;
 
-extern int readDense8(pointer Base, register unsigned long Offset);
-extern int readDense16(pointer Base, register unsigned long Offset);
-extern int readDense32(pointer Base, register unsigned long Offset);
+extern int readDense8(void *Base, register unsigned long Offset);
+extern int readDense16(void *Base, register unsigned long Offset);
+extern int readDense32(void *Base, register unsigned long Offset);
 extern void
- writeDenseNB8(int Value, pointer Base, register unsigned long Offset);
+ writeDenseNB8(int Value, void *Base, register unsigned long Offset);
 extern void
- writeDenseNB16(int Value, pointer Base, register unsigned long Offset);
+ writeDenseNB16(int Value, void *Base, register unsigned long Offset);
 extern void
- writeDenseNB32(int Value, pointer Base, register unsigned long Offset);
+ writeDenseNB32(int Value, void *Base, register unsigned long Offset);
 extern void
- writeDense8(int Value, pointer Base, register unsigned long Offset);
+ writeDense8(int Value, void *Base, register unsigned long Offset);
 extern void
- writeDense16(int Value, pointer Base, register unsigned long Offset);
+ writeDense16(int Value, void *Base, register unsigned long Offset);
 extern void
- writeDense32(int Value, pointer Base, register unsigned long Offset);
+ writeDense32(int Value, void *Base, register unsigned long Offset);
 
-static int readSparse8(pointer Base, register unsigned long Offset);
-static int readSparse16(pointer Base, register unsigned long Offset);
-static int readSparse32(pointer Base, register unsigned long Offset);
+static int readSparse8(void *Base, register unsigned long Offset);
+static int readSparse16(void *Base, register unsigned long Offset);
+static int readSparse32(void *Base, register unsigned long Offset);
 static void
- writeSparseNB8(int Value, pointer Base, register unsigned long Offset);
+ writeSparseNB8(int Value, void *Base, register unsigned long Offset);
 static void
- writeSparseNB16(int Value, pointer Base, register unsigned long Offset);
+ writeSparseNB16(int Value, void *Base, register unsigned long Offset);
 static void
- writeSparseNB32(int Value, pointer Base, register unsigned long Offset);
+ writeSparseNB32(int Value, void *Base, register unsigned long Offset);
 static void
- writeSparse8(int Value, pointer Base, register unsigned long Offset);
+ writeSparse8(int Value, void *Base, register unsigned long Offset);
 static void
- writeSparse16(int Value, pointer Base, register unsigned long Offset);
+ writeSparse16(int Value, void *Base, register unsigned long Offset);
 static void
- writeSparse32(int Value, pointer Base, register unsigned long Offset);
+ writeSparse32(int Value, void *Base, register unsigned long Offset);
 
 #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
 extern int sysarch(int, void *);
@@ -481,7 +481,7 @@ sethae(u_int64_t hae)
 }
 #endif
 
-static pointer
+static void *
 mapVidMemSparse(int ScreenNum, unsigned long Base, unsigned long Size,
                 int flags)
 {
@@ -514,16 +514,16 @@ mapVidMemSparse(int ScreenNum, unsigned long Base, unsigned long Size,
                        strerror(errno));
         }
     }
-    return (pointer) ((unsigned long) memBase + Base);
+    return (void *) ((unsigned long) memBase + Base);
 }
 
 static void
-unmapVidMemSparse(int ScreenNum, pointer Base, unsigned long Size)
+unmapVidMemSparse(int ScreenNum, void *Base, unsigned long Size)
 {
 }
 
 static int
-readSparse8(pointer Base, register unsigned long Offset)
+readSparse8(void *Base, register unsigned long Offset)
 {
     register unsigned long result, shift;
     register unsigned long msb;
@@ -544,7 +544,7 @@ readSparse8(pointer Base, register unsigned long Offset)
 }
 
 static int
-readSparse16(pointer Base, register unsigned long Offset)
+readSparse16(void *Base, register unsigned long Offset)
 {
     register unsigned long result, shift;
     register unsigned long msb;
@@ -566,14 +566,14 @@ readSparse16(pointer Base, register unsigned long Offset)
 }
 
 static int
-readSparse32(pointer Base, register unsigned long Offset)
+readSparse32(void *Base, register unsigned long Offset)
 {
     mem_barrier();
     return *(vuip) ((unsigned long) Base + (Offset));
 }
 
 static void
-writeSparse8(int Value, pointer Base, register unsigned long Offset)
+writeSparse8(int Value, void *Base, register unsigned long Offset)
 {
     register unsigned long msb;
     register unsigned int b = Value & 0xffU;
@@ -591,7 +591,7 @@ writeSparse8(int Value, pointer Base, register unsigned long Offset)
 }
 
 static void
-writeSparse16(int Value, pointer Base, register unsigned long Offset)
+writeSparse16(int Value, void *Base, register unsigned long Offset)
 {
     register unsigned long msb;
     register unsigned int w = Value & 0xffffU;
@@ -611,7 +611,7 @@ writeSparse16(int Value, pointer Base, register unsigned long Offset)
 }
 
 static void
-writeSparse32(int Value, pointer Base, register unsigned long Offset)
+writeSparse32(int Value, void *Base, register unsigned long Offset)
 {
     write_mem_barrier();
     *(vuip) ((unsigned long) Base + (Offset)) = Value;
@@ -619,7 +619,7 @@ writeSparse32(int Value, pointer Base, register unsigned long Offset)
 }
 
 static void
-writeSparseNB8(int Value, pointer Base, register unsigned long Offset)
+writeSparseNB8(int Value, void *Base, register unsigned long Offset)
 {
     register unsigned long msb;
     register unsigned int b = Value & 0xffU;
@@ -636,7 +636,7 @@ writeSparseNB8(int Value, pointer Base, register unsigned long Offset)
 }
 
 static void
-writeSparseNB16(int Value, pointer Base, register unsigned long Offset)
+writeSparseNB16(int Value, void *Base, register unsigned long Offset)
 {
     register unsigned long msb;
     register unsigned int w = Value & 0xffffU;
@@ -654,27 +654,27 @@ writeSparseNB16(int Value, pointer Base, register unsigned long Offset)
 }
 
 static void
-writeSparseNB32(int Value, pointer Base, register unsigned long Offset)
+writeSparseNB32(int Value, void *Base, register unsigned long Offset)
 {
     *(vuip) ((unsigned long) Base + (Offset)) = Value;
     return;
 }
 
-void (*xf86WriteMmio8) (int Value, pointer Base, unsigned long Offset)
+void (*xf86WriteMmio8) (int Value, void *Base, unsigned long Offset)
     = writeDense8;
-void (*xf86WriteMmio16) (int Value, pointer Base, unsigned long Offset)
+void (*xf86WriteMmio16) (int Value, void *Base, unsigned long Offset)
     = writeDense16;
-void (*xf86WriteMmio32) (int Value, pointer Base, unsigned long Offset)
+void (*xf86WriteMmio32) (int Value, void *Base, unsigned long Offset)
     = writeDense32;
-void (*xf86WriteMmioNB8) (int Value, pointer Base, unsigned long Offset)
+void (*xf86WriteMmioNB8) (int Value, void *Base, unsigned long Offset)
     = writeDenseNB8;
-void (*xf86WriteMmioNB16) (int Value, pointer Base, unsigned long Offset)
+void (*xf86WriteMmioNB16) (int Value, void *Base, unsigned long Offset)
     = writeDenseNB16;
-void (*xf86WriteMmioNB32) (int Value, pointer Base, unsigned long Offset)
+void (*xf86WriteMmioNB32) (int Value, void *Base, unsigned long Offset)
     = writeDenseNB32;
-int (*xf86ReadMmio8) (pointer Base, unsigned long Offset)
+int (*xf86ReadMmio8) (void *Base, unsigned long Offset)
     = readDense8;
-int (*xf86ReadMmio16) (pointer Base, unsigned long Offset)
+int (*xf86ReadMmio16) (void *Base, unsigned long Offset)
     = readDense16;
-int (*xf86ReadMmio32) (pointer Base, unsigned long Offset)
+int (*xf86ReadMmio32) (void *Base, unsigned long Offset)
     = readDense32;
index 71064af..6a977c2 100644 (file)
 struct memAccess {
     int ioctl;
     struct map_info memInfo;
-    pointer regionVirtBase;
+    void *regionVirtBase;
     Bool Checked;
     Bool OK;
 };
 
-static pointer xf86MapInfoMap();
+static void *xf86MapInfoMap();
 static void xf86MapInfoUnmap();
 static struct memAccess *checkMapInfo();
 extern int vgaPhysLinearBase;
@@ -111,8 +111,8 @@ struct memAccess ioMemInfo = { CONSOLE_GET_IO_INFO, NULL, NULL,
 static Bool useDevMem = FALSE;
 static int devMemFd = -1;
 
-static pointer mapVidMem(int, unsigned long, unsigned long, int);
-static void unmapVidMem(int, pointer, unsigned long);
+static void *mapVidMem(int, unsigned long, unsigned long, int);
+static void unmapVidMem(int, void *, unsigned long);
 
 /*
  * Check if /dev/mem can be mmap'd.  If it can't print a warning when
@@ -123,7 +123,7 @@ checkDevMem(Bool warn)
 {
     static Bool devMemChecked = FALSE;
     int fd;
-    pointer base;
+    void *base;
 
     if (devMemChecked)
         return;
@@ -170,10 +170,10 @@ xf86OSInitVidMem(VidMemInfoPtr pVidMem)
     pVidMem->initialised = TRUE;
 }
 
-static pointer
+static void *
 mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
 {
-    pointer base;
+    void *base;
 
     checkDevMem(FALSE);
 
@@ -210,7 +210,7 @@ mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
 }
 
 static void
-unmapVidMem(int ScreenNum, pointer Base, unsigned long Size)
+unmapVidMem(int ScreenNum, void *Base, unsigned long Size)
 {
     munmap((caddr_t) Base, Size);
 }
@@ -310,8 +310,8 @@ checkMapInfo(Bool warn, int Region)
     }
 }
 
-static pointer
-xf86MapInfoMap(struct memAccess *memInfoP, pointer Base, unsigned long Size)
+static void *
+xf86MapInfoMap(struct memAccess *memInfoP, void *Base, unsigned long Size)
 {
     struct map_info *mapInfoP = &(memInfoP->memInfo);
 
@@ -335,7 +335,7 @@ xf86MapInfoMap(struct memAccess *memInfoP, pointer Base, unsigned long Size)
                       MAP_SHARED,
                       xf86Info.consoleFd,
                       (unsigned long) mapInfoP->u.map_info_mmap.map_offset))
-                == (pointer) -1) {
+                == (void *) -1) {
                 FatalError
                     ("xf86MapInfoMap: Failed to map memory at 0x%x\n\t%s\n",
                      mapInfoP->u.map_info_mmap.map_offset, strerror(errno));
@@ -351,7 +351,7 @@ xf86MapInfoMap(struct memAccess *memInfoP, pointer Base, unsigned long Size)
         break;
     }
 
-    return (pointer) ((int) memInfoP->regionVirtBase + (int) Base);
+    return (void *) ((int) memInfoP->regionVirtBase + (int) Base);
 }
 
 static void
@@ -374,7 +374,7 @@ xf86MapInfoUnmap(struct memAccess *memInfoP, unsigned long Size)
     }
 }
 
-static pointer
+static void *
 armMapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
 {
     struct memAccess *memInfoP;
@@ -404,7 +404,7 @@ armMapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
 }
 
 static void
-armUnmapVidMem(int ScreenNum, pointer Base, unsigned long Size)
+armUnmapVidMem(int ScreenNum, void *Base, unsigned long Size)
 {
     struct memAccess *memInfoP;
 
@@ -450,17 +450,17 @@ Bool
 xf86EnableIO()
 {
     int fd;
-    pointer base;
+    void *base;
 
     if (ExtendedEnabled)
         return TRUE;
 
     if ((fd = open("/dev/ttyC0", O_RDWR)) >= 0) {
         /* Try to map a page at the pccons I/O space */
-        base = (pointer) mmap((caddr_t) 0, 65536, PROT_READ | PROT_WRITE,
-                              MAP_FLAGS, fd, (off_t) 0x0000);
+        base = (void *) mmap((caddr_t) 0, 65536, PROT_READ | PROT_WRITE,
+                             MAP_FLAGS, fd, (off_t) 0x0000);
 
-        if (base != (pointer) -1) {
+        if (base != (void *) -1) {
             IOPortBase = base;
         }
         else {
@@ -509,7 +509,7 @@ int ScreenNum;
 {
     int i;
     int fd;
-    pointer base;
+    void *base;
 
 #ifdef __arm32__
     struct memAccess *memInfoP;
@@ -524,10 +524,10 @@ int ScreenNum;
 #ifdef USE_ARC_MMAP
     if ((fd = open("/dev/ttyC0", O_RDWR)) >= 0) {
         /* Try to map a page at the pccons I/O space */
-        base = (pointer) mmap((caddr_t) 0, 65536, PROT_READ | PROT_WRITE,
-                              MAP_FLAGS, fd, (off_t) 0x0000);
+        base = (void *) mmap((caddr_t) 0, 65536, PROT_READ | PROT_WRITE,
+                             MAP_FLAGS, fd, (off_t) 0x0000);
 
-        if (base != (pointer) -1) {
+        if (base != (void *) -1) {
             IOPortBase = base;
         }
         else {
@@ -563,10 +563,10 @@ int ScreenNum;
     checkDevMem(TRUE);
 
     if (devMemFd >= 0 && useDevMem) {
-        base = (pointer) mmap((caddr_t) 0, 0x400, PROT_READ | PROT_WRITE,
+        base = (void *) mmap((caddr_t) 0, 0x400, PROT_READ | PROT_WRITE,
                               MAP_FLAGS, devMemFd, (off_t) DEV_MEM_IOBASE);
 
-        if (base != (pointer) -1)
+        if (base != (void *) -1)
             IOPortBase = (unsigned int) base;
     }
 
index b1938cf..1b92962 100644 (file)
@@ -14,7 +14,7 @@
 
 #define APM_DEVICE "/dev/apm"
 
-static pointer APMihPtr = NULL;
+static void *APMihPtr = NULL;
 static void bsdCloseAPM(void);
 
 static struct {
index 645377e..320bb23 100644 (file)
  */
 __asm(".arch ev56");
 
-int readDense8(pointer Base, register unsigned long Offset);
-int readDense16(pointer Base, register unsigned long Offset);
-int readDense32(pointer Base, register unsigned long Offset);
+int readDense8(void *Base, register unsigned long Offset);
+int readDense16(void *Base, register unsigned long Offset);
+int readDense32(void *Base, register unsigned long Offset);
 void
- writeDenseNB8(int Value, pointer Base, register unsigned long Offset);
+ writeDenseNB8(int Value, void *Base, register unsigned long Offset);
 void
- writeDenseNB16(int Value, pointer Base, register unsigned long Offset);
+ writeDenseNB16(int Value, void *Base, register unsigned long Offset);
 void
- writeDenseNB32(int Value, pointer Base, register unsigned long Offset);
+ writeDenseNB32(int Value, void *Base, register unsigned long Offset);
 void
- writeDense8(int Value, pointer Base, register unsigned long Offset);
+ writeDense8(int Value, void *Base, register unsigned long Offset);
 void
- writeDense16(int Value, pointer Base, register unsigned long Offset);
+ writeDense16(int Value, void *Base, register unsigned long Offset);
 void
- writeDense32(int Value, pointer Base, register unsigned long Offset);
+ writeDense32(int Value, void *Base, register unsigned long Offset);
 
 int
-readDense8(pointer Base, register unsigned long Offset)
+readDense8(void *Base, register unsigned long Offset)
 {
     mem_barrier();
-    return (alpha_ldbu((pointer) ((unsigned long) Base + (Offset))));
+    return (alpha_ldbu((void *) ((unsigned long) Base + (Offset))));
 }
 
 int
-readDense16(pointer Base, register unsigned long Offset)
+readDense16(void *Base, register unsigned long Offset)
 {
     mem_barrier();
-    return (alpha_ldwu((pointer) ((unsigned long) Base + (Offset))));
+    return (alpha_ldwu((void *) ((unsigned long) Base + (Offset))));
 }
 
 int
-readDense32(pointer Base, register unsigned long Offset)
+readDense32(void *Base, register unsigned long Offset)
 {
     mem_barrier();
     return *(volatile CARD32 *) ((unsigned long) Base + (Offset));
 }
 
 void
-writeDenseNB8(int Value, pointer Base, register unsigned long Offset)
+writeDenseNB8(int Value, void *Base, register unsigned long Offset)
 {
-    alpha_stb((pointer) ((unsigned long) Base + (Offset)), Value);
+    alpha_stb((void *) ((unsigned long) Base + (Offset)), Value);
 }
 
 void
-writeDenseNB16(int Value, pointer Base, register unsigned long Offset)
+writeDenseNB16(int Value, void *Base, register unsigned long Offset)
 {
-    alpha_stw((pointer) ((unsigned long) Base + (Offset)), Value);
+    alpha_stw((void *) ((unsigned long) Base + (Offset)), Value);
 }
 
 void
-writeDenseNB32(int Value, pointer Base, register unsigned long Offset)
+writeDenseNB32(int Value, void *Base, register unsigned long Offset)
 {
     *(volatile CARD32 *) ((unsigned long) Base + (Offset)) = Value;
 }
 
 void
-writeDense8(int Value, pointer Base, register unsigned long Offset)
+writeDense8(int Value, void *Base, register unsigned long Offset)
 {
     write_mem_barrier();
-    alpha_stb((pointer) ((unsigned long) Base + (Offset)), Value);
+    alpha_stb((void *) ((unsigned long) Base + (Offset)), Value);
 }
 
 void
-writeDense16(int Value, pointer Base, register unsigned long Offset)
+writeDense16(int Value, void *Base, register unsigned long Offset)
 {
     write_mem_barrier();
-    alpha_stw((pointer) ((unsigned long) Base + (Offset)), Value);
+    alpha_stw((void *) ((unsigned long) Base + (Offset)), Value);
 }
 
 void
-writeDense32(int Value, pointer Base, register unsigned long Offset)
+writeDense32(int Value, void *Base, register unsigned long Offset)
 {
     write_mem_barrier();
     *(volatile CARD32 *) ((unsigned long) Base + (Offset)) = Value;
index 2294385..32ea489 100644 (file)
@@ -45,7 +45,7 @@
 #define _PATH_APM_DEV          "/dev/apm"
 #define _PATH_APM_CTLDEV       "/dev/apmctl"
 
-static pointer APMihPtr = NULL;
+static void *APMihPtr = NULL;
 static int devFd = -1;
 static int ctlFd = -1;
 static void bsdCloseAPM(void);
index 569a4ec..7453190 100644 (file)
@@ -85,18 +85,18 @@ static int devMemFd = -1;
 #define DEV_APERTURE "/dev/xf86"
 #endif
 
-static pointer mapVidMem(int, unsigned long, unsigned long, int);
-static void unmapVidMem(int, pointer, unsigned long);
+static void *mapVidMem(int, unsigned long, unsigned long, int);
+static void unmapVidMem(int, void *, unsigned long);
 
 #ifdef HAS_MTRR_SUPPORT
-static pointer setWC(int, unsigned long, unsigned long, Bool, MessageType);
-static void undoWC(int, pointer);
+static void *setWC(int, unsigned long, unsigned long, Bool, MessageType);
+static void undoWC(int, void *);
 static Bool cleanMTRR(void);
 #endif
 #if defined(HAS_MTRR_BUILTIN) && defined(__NetBSD__)
-static pointer NetBSDsetWC(int, unsigned long, unsigned long, Bool,
+static void *NetBSDsetWC(int, unsigned long, unsigned long, Bool,
                            MessageType);
-static void NetBSDundoWC(int, pointer);
+static void NetBSDundoWC(int, void *);
 #endif
 
 /*
@@ -108,7 +108,7 @@ checkDevMem(Bool warn)
 {
     static Bool devMemChecked = FALSE;
     int fd;
-    pointer base;
+    void *base;
 
     if (devMemChecked)
         return;
@@ -210,10 +210,10 @@ xf86OSInitVidMem(VidMemInfoPtr pVidMem)
     pVidMem->initialised = TRUE;
 }
 
-static pointer
+static void *
 mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
 {
-    pointer base;
+    void *base;
 
     checkDevMem(FALSE);
 
@@ -250,7 +250,7 @@ mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
 }
 
 static void
-unmapVidMem(int ScreenNum, pointer Base, unsigned long Size)
+unmapVidMem(int ScreenNum, void *Base, unsigned long Size)
 {
     munmap((caddr_t) Base, Size);
 }
@@ -690,7 +690,7 @@ fullCoverage(unsigned long base, unsigned long size, RangePtr overlap)
     return FALSE;
 }
 
-static pointer
+static void *
 addWC(int screenNum, unsigned long base, unsigned long size, MessageType from)
 {
     RangePtr uc = NULL, wc = NULL, retlist = NULL;
@@ -731,7 +731,7 @@ addWC(int screenNum, unsigned long base, unsigned long size, MessageType from)
     }
 }
 
-static pointer
+static void *
 delWC(int screenNum, unsigned long base, unsigned long size, MessageType from)
 {
     RangePtr uc = NULL, wc = NULL, retlist = NULL;
@@ -776,7 +776,7 @@ delWC(int screenNum, unsigned long base, unsigned long size, MessageType from)
     }
 }
 
-static pointer
+static void *
 setWC(int screenNum, unsigned long base, unsigned long size, Bool enable,
       MessageType from)
 {
@@ -787,7 +787,7 @@ setWC(int screenNum, unsigned long base, unsigned long size, Bool enable,
 }
 
 static void
-undoWC(int screenNum, pointer list)
+undoWC(int screenNum, void *list)
 {
     RangePtr rp;
     struct mem_range_op mro;
@@ -835,7 +835,7 @@ undoWC(int screenNum, pointer list)
 #endif                          /* HAS_MTRR_SUPPORT */
 
 #if defined(HAS_MTRR_BUILTIN) && defined(__NetBSD__)
-static pointer
+static void *
 NetBSDsetWC(int screenNum, unsigned long base, unsigned long size, Bool enable,
             MessageType from)
 {
@@ -871,7 +871,7 @@ NetBSDsetWC(int screenNum, unsigned long base, unsigned long size, Bool enable,
 }
 
 static void
-NetBSDundoWC(int screenNum, pointer list)
+NetBSDundoWC(int screenNum, void *list)
 {
     struct mtrr *mtrrp = (struct mtrr *) list;
     int n;
index 417adbf..947a686 100644 (file)
@@ -44,8 +44,8 @@
 #define DEV_MEM "/dev/xf86"
 #endif
 
-static pointer ppcMapVidMem(int, unsigned long, unsigned long, int flags);
-static void ppcUnmapVidMem(int, pointer, unsigned long);
+static void *ppcMapVidMem(int, unsigned long, unsigned long, int flags);
+static void ppcUnmapVidMem(int, void *, unsigned long);
 
 Bool xf86EnableIO(void);
 void xf86DisableIO(void);
@@ -62,11 +62,11 @@ xf86OSInitVidMem(VidMemInfoPtr pVidMem)
 
 volatile unsigned char *ioBase = MAP_FAILED;
 
-static pointer
+static void *
 ppcMapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
 {
     int fd = xf86Info.consoleFd;
-    pointer base;
+    void *base;
 
 #ifdef DEBUG
     xf86MsgVerb(X_INFO, 3, "mapVidMem %lx, %lx, fd = %d", Base, Size, fd);
@@ -83,7 +83,7 @@ ppcMapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
 }
 
 static void
-ppcUnmapVidMem(int ScreenNum, pointer Base, unsigned long Size)
+ppcUnmapVidMem(int ScreenNum, void *Base, unsigned long Size)
 {
     munmap(Base, Size);
 }
index 21c1661..02951d6 100644 (file)
@@ -38,8 +38,8 @@
 /* Video Memory Mapping section                                            */
 /***************************************************************************/
 
-static pointer sparc64MapVidMem(int, unsigned long, unsigned long, int);
-static void sparc64UnmapVidMem(int, pointer, unsigned long);
+static void *sparc64MapVidMem(int, unsigned long, unsigned long, int);
+static void sparc64UnmapVidMem(int, void *, unsigned long);
 
 void
 xf86OSInitVidMem(VidMemInfoPtr pVidMem)
@@ -50,12 +50,12 @@ xf86OSInitVidMem(VidMemInfoPtr pVidMem)
     pVidMem->initialised = TRUE;
 }
 
-static pointer
+static void *
 sparc64MapVidMem(int ScreenNum, unsigned long Base, unsigned long Size,
                  int flags)
 {
     int fd = xf86Info.consoleFd;
-    pointer base;
+    void *base;
 
 #ifdef DEBUG
     xf86MsgVerb(X_INFO, 3, "mapVidMem %lx, %lx, fd = %d", Base, Size, fd);
@@ -71,7 +71,7 @@ sparc64MapVidMem(int ScreenNum, unsigned long Base, unsigned long Size,
 }
 
 static void
-sparc64UnmapVidMem(int ScreenNum, pointer Base, unsigned long Size)
+sparc64UnmapVidMem(int ScreenNum, void *Base, unsigned long Size)
 {
     munmap(Base, Size);
 }
index e09d4d2..eebb3ae 100644 (file)
@@ -17,7 +17,7 @@ endif
 
 libbus_la_SOURCES = $(PCI_SOURCES) $(PLATFORM_SOURCES) nobus.c
 
-INCLUDES = $(XORG_INCS)
+AM_CPPFLAGS = $(XORG_INCS)
 
 AM_CFLAGS = $(XORG_CFLAGS) $(DIX_CFLAGS)
 
index 8260007..16ce5b5 100644 (file)
@@ -617,8 +617,10 @@ sparcPromPathname2Node(const char *pathName)
         return 0;
     strcpy(name, pathName);
     name[i + 1] = 0;
-    if (name[0] != '/')
+    if (name[0] != '/') {
+        free(name);
         return 0;
+    }
     p = strchr(name + 1, '/');
     if (p)
         *p = 0;
@@ -629,18 +631,20 @@ sparcPromPathname2Node(const char *pathName)
         *regstr++ = 0;
     else
         regstr = p;
-    if (name + 1 == regstr)
+    if (name + 1 == regstr) {
+        free(name);
         return 0;
+    }
     promGetSibling(0);
     i = promWalkPathname2Node(name + 1, regstr, promRootNode, 0);
     free(name);
     return i;
 }
 
-pointer
+void *
 xf86MapSbusMem(sbusDevicePtr psdp, unsigned long offset, unsigned long size)
 {
-    pointer ret;
+    void *ret;
     unsigned long pagemask = getpagesize() - 1;
     unsigned long off = offset & ~pagemask;
     unsigned long len = ((offset + size + pagemask) & ~pagemask) - off;
@@ -653,26 +657,26 @@ xf86MapSbusMem(sbusDevicePtr psdp, unsigned long offset, unsigned long size)
     else if (psdp->fd < 0)
         return NULL;
 
-    ret = (pointer) mmap(NULL, len, PROT_READ | PROT_WRITE, MAP_PRIVATE,
+    ret = (void *) mmap(NULL, len, PROT_READ | PROT_WRITE, MAP_PRIVATE,
                          psdp->fd, off);
-    if (ret == (pointer) -1) {
-        ret = (pointer) mmap(NULL, len, PROT_READ | PROT_WRITE, MAP_SHARED,
+    if (ret == (void *) -1) {
+        ret = (void *) mmap(NULL, len, PROT_READ | PROT_WRITE, MAP_SHARED,
                              psdp->fd, off);
     }
-    if (ret == (pointer) -1)
+    if (ret == (void *) -1)
         return NULL;
 
     return (char *) ret + (offset - off);
 }
 
 void
-xf86UnmapSbusMem(sbusDevicePtr psdp, pointer addr, unsigned long size)
+xf86UnmapSbusMem(sbusDevicePtr psdp, void *addr, unsigned long size)
 {
     unsigned long mask = getpagesize() - 1;
     unsigned long base = (unsigned long) addr & ~mask;
     unsigned long len = (((unsigned long) addr + size + mask) & ~mask) - base;
 
-    munmap((pointer) base, len);
+    munmap((void *) base, len);
 }
 
 /* Tell OS that we are driving the HW cursor ourselves. */
index dca58fe..4872c5b 100644 (file)
@@ -1,5 +1,8 @@
-static void
-__noop_to_appease_ar__()
+void
+__noop_to_appease_ar__(void);
+
+void
+__noop_to_appease_ar__(void)
 {
     return;
 }
index 3e82247..f228c1c 100644 (file)
@@ -12,4 +12,4 @@ libhurd_la_SOURCES = hurd_bell.c hurd_init.c hurd_mmap.c \
 
 AM_CFLAGS = -DUSESTDRES -DHAVE_SYSV_IPC $(XORG_CFLAGS) $(DIX_CFLAGS)
 
-INCLUDES = $(XORG_INCS)
+AM_CPPFLAGS = $(XORG_INCS)
index 185b2b9..fe1a764 100644 (file)
@@ -42,6 +42,7 @@
 #include <sys/file.h>
 #include <assert.h>
 #include <mach.h>
+#include <hurd.h>
 
 int
 xf86ProcessArgument(int argc, char **argv, int i)
index 6ac9efd..8e089ca 100644 (file)
@@ -27,6 +27,7 @@
 #include<mach.h>
 #include<device/device.h>
 #include<mach/machine/mach_i386.h>
+#include <hurd.h>
 
 #include <X11/X.h>
 
index 72474ba..dc1a8e6 100644 (file)
@@ -28,6 +28,7 @@
 #include <mach.h>
 #include <device/device.h>
 #include <mach/machine/mach_i386.h>
+#include <hurd.h>
 
 #include <X11/X.h>
 #include "input.h"
@@ -41,7 +42,7 @@
 /**************************************************************************
  * Video Memory Mapping section                                            
  ***************************************************************************/
-static pointer
+static void *
 mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int Flags)
 {
     mach_port_t device, mem_dev;
@@ -88,11 +89,11 @@ mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int Flags)
             ("xf86MapVidMem() can't mach_port_deallocate.(mem_dev) (%s)\n",
              strerror(errno));
     }
-    return (pointer) addr;
+    return (void *) addr;
 }
 
 static void
-unmapVidMem(int ScreenNum, pointer Base, unsigned long Size)
+unmapVidMem(int ScreenNum, void *Base, unsigned long Size)
 {
     kern_return_t err = vm_deallocate(mach_task_self(), (int) Base, Size);
 
index 61175b3..1686dc2 100644 (file)
@@ -21,6 +21,11 @@ APM_SRCS = lnx_apm.c
 XORG_CFLAGS += -DHAVE_APM
 endif
 
+if SYSTEMD_LOGIND
+LOGIND_SRCS = systemd-logind.c
+XORG_CFLAGS += $(DBUS_CFLAGS)
+endif
+
 liblinux_la_SOURCES = lnx_init.c lnx_video.c \
                      lnx_agp.c lnx_kmod.c lnx_bell.c lnx_platform.c \
                      $(srcdir)/../shared/bios_mmap.c \
@@ -30,11 +35,12 @@ liblinux_la_SOURCES = lnx_init.c lnx_video.c \
                     $(srcdir)/../shared/sigio.c \
                      $(ACPI_SRCS) \
                      $(APM_SRCS) \
+                     $(LOGIND_SRCS) \
                      $(PLATFORM_PCI_SUPPORT)
 
 AM_CFLAGS = -DUSESTDRES -DHAVE_SYSV_IPC $(DIX_CFLAGS) $(XORG_CFLAGS) $(PLATFORM_DEFINES)
 
-INCLUDES = $(XORG_INCS) $(PLATFORM_INCLUDES) $(LIBDRM_CFLAGS)
+AM_CPPFLAGS = $(XORG_INCS) $(PLATFORM_INCLUDES) $(LIBDRM_CFLAGS)
 
 EXTRA_DIST = \
        $(srcdir)/../shared/xf86Axp.h
index 8bca375..6181eb9 100644 (file)
@@ -18,7 +18,7 @@
 #define DEV_MEM "/dev/mem"
 #endif
 #define ALLOC_ENTRIES(x) ((V_RAM / x) - 1)
-#define SHMERRORPTR (pointer)(-1)
+#define SHMERRORPTR (void *)(-1)
 
 #include <fcntl.h>
 #include <errno.h>
@@ -153,9 +153,9 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
         goto error0;
     pInt->mem = &linuxMem;
     pagesize = getpagesize();
-    pInt->private = (pointer) xnfcalloc(1, sizeof(linuxInt10Priv));
+    pInt->private = (void *) xnfcalloc(1, sizeof(linuxInt10Priv));
     ((linuxInt10Priv *) pInt->private)->alloc =
-        (pointer) xnfcalloc(1, ALLOC_ENTRIES(pagesize));
+        (void *) xnfcalloc(1, ALLOC_ENTRIES(pagesize));
 
     if (!xf86IsEntityPrimary(entityIndex)) {
         DebugF("Mapping high memory area\n");
@@ -233,10 +233,10 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
      * 64K bytes at a time.
      */
     if (!videoBiosMapped) {
-        memset((pointer) V_BIOS, 0, SYS_BIOS - V_BIOS);
+        memset((void *) V_BIOS, 0, SYS_BIOS - V_BIOS);
         DebugF("Reading BIOS\n");
         for (cs = V_BIOS; cs < SYS_BIOS; cs += V_BIOS_SIZE)
-            if (xf86ReadBIOS(cs, 0, (pointer) cs, V_BIOS_SIZE) < V_BIOS_SIZE)
+            if (xf86ReadBIOS(cs, 0, (void *) cs, V_BIOS_SIZE) < V_BIOS_SIZE)
                 xf86DrvMsg(screen, X_WARNING,
                            "Unable to retrieve all of segment 0x%06lX.\n",
                            (long) cs);
@@ -319,7 +319,7 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
 Bool
 MapCurrentInt10(xf86Int10InfoPtr pInt)
 {
-    pointer addr;
+    void *addr;
     int fd = -1;
 
     if (Int10Current) {
@@ -327,7 +327,7 @@ MapCurrentInt10(xf86Int10InfoPtr pInt)
         if (((linuxInt10Priv *) Int10Current->private)->highMem >= 0)
             shmdt((char *) HIGH_MEM);
         else
-            munmap((pointer) V_BIOS, (SYS_BIOS - V_BIOS));
+            munmap((void *) V_BIOS, (SYS_BIOS - V_BIOS));
     }
     addr =
         shmat(((linuxInt10Priv *) pInt->private)->lowMem, (char *) 1, SHM_RND);
@@ -392,7 +392,7 @@ xf86FreeInt10(xf86Int10InfoPtr pInt)
         if (((linuxInt10Priv *) pInt->private)->highMem >= 0)
             shmdt((char *) HIGH_MEM);
         else
-            munmap((pointer) V_BIOS, (SYS_BIOS - V_BIOS));
+            munmap((void *) V_BIOS, (SYS_BIOS - V_BIOS));
         Int10Current = NULL;
     }
 
@@ -486,22 +486,22 @@ write_l(xf86Int10InfoPtr pInt, int addr, CARD32 val)
     *((CARD32 *) (memType) addr) = val;
 }
 
-pointer
+void *
 xf86int10Addr(xf86Int10InfoPtr pInt, CARD32 addr)
 {
     if (addr < V_RAM)
         return ((linuxInt10Priv *) pInt->private)->base + addr;
     else if (addr < V_BIOS)
-        return (pointer) (memType) addr;
+        return (void *) (memType) addr;
     else if (addr < SYS_BIOS) {
         if (((linuxInt10Priv *) pInt->private)->base_high)
-            return (pointer) (((linuxInt10Priv *) pInt->private)->base_high
+            return (void *) (((linuxInt10Priv *) pInt->private)->base_high
                               - V_BIOS + addr);
         else
-            return (pointer) (memType) addr;
+            return (void *) (memType) addr;
     }
     else
-        return (pointer) (memType) addr;
+        return (void *) (memType) addr;
 }
 
 #if defined DoSubModules
index d98efa2..dbd5afe 100644 (file)
 #define ACPI_VIDEO_HEAD_END            (~0u)
 
 static void lnxCloseACPI(void);
-static pointer ACPIihPtr = NULL;
+static void *ACPIihPtr = NULL;
 PMClose lnxACPIOpen(void);
 
 /* in milliseconds */
 #define ACPI_REOPEN_DELAY 1000
 
 static CARD32
-lnxACPIReopen(OsTimerPtr timer, CARD32 time, pointer arg)
+lnxACPIReopen(OsTimerPtr timer, CARD32 time, void *arg)
 {
     if (lnxACPIOpen()) {
         TimerFree(timer);
@@ -74,28 +74,30 @@ lnxACPIGetEventFromOs(int fd, pmEvent * events, int num)
 
     /* Check that we have a video event */
     if (!strncmp(ev, "video", 5)) {
-        char *video = NULL;
         char *GFX = NULL;
         char *notify = NULL;
         char *data = NULL;      /* doesn't appear to be used in the kernel */
-        unsigned long int notify_l, data_l;
+        unsigned long int notify_l;
 
-        video = strtok(ev, " ");
+        strtok(ev, " ");
 
-        GFX = strtok(NULL, " ");
+        if (!(GFX = strtok(NULL, " ")))
+            return 0;
 #if 0
         ErrorF("GFX: %s\n", GFX);
 #endif
 
-        notify = strtok(NULL, " ");
+        if (!(notify = strtok(NULL, " ")))
+            return 0;
         notify_l = strtoul(notify, NULL, 16);
 #if 0
         ErrorF("notify: 0x%lx\n", notify_l);
 #endif
 
-        data = strtok(NULL, " ");
-        data_l = strtoul(data, NULL, 16);
+        if (!(data = strtok(NULL, " ")))
+            return 0;
 #if 0
+        data_l = strtoul(data, NULL, 16);
         ErrorF("data: 0x%lx\n", data_l);
 #endif
 
index 3879340..6216919 100644 (file)
@@ -36,7 +36,7 @@ extern PMClose lnxACPIOpen(void);
 
 static PMClose lnxAPMOpen(void);
 static void lnxCloseAPM(void);
-static pointer APMihPtr = NULL;
+static void *APMihPtr = NULL;
 
 static struct {
     apm_event_t apmLinux;
index 4995070..b695000 100644 (file)
@@ -6,77 +6,77 @@
 #include "xf86.h"
 #include "compiler.h"
 
-int readDense8(pointer Base, register unsigned long Offset);
-int readDense16(pointer Base, register unsigned long Offset);
-int readDense32(pointer Base, register unsigned long Offset);
+int readDense8(void *Base, register unsigned long Offset);
+int readDense16(void *Base, register unsigned long Offset);
+int readDense32(void *Base, register unsigned long Offset);
 void
- writeDenseNB8(int Value, pointer Base, register unsigned long Offset);
+ writeDenseNB8(int Value, void *Base, register unsigned long Offset);
 void
- writeDenseNB16(int Value, pointer Base, register unsigned long Offset);
+ writeDenseNB16(int Value, void *Base, register unsigned long Offset);
 void
- writeDenseNB32(int Value, pointer Base, register unsigned long Offset);
+ writeDenseNB32(int Value, void *Base, register unsigned long Offset);
 void
- writeDense8(int Value, pointer Base, register unsigned long Offset);
+ writeDense8(int Value, void *Base, register unsigned long Offset);
 void
- writeDense16(int Value, pointer Base, register unsigned long Offset);
+ writeDense16(int Value, void *Base, register unsigned long Offset);
 void
- writeDense32(int Value, pointer Base, register unsigned long Offset);
+ writeDense32(int Value, void *Base, register unsigned long Offset);
 
 int
-readDense8(pointer Base, register unsigned long Offset)
+readDense8(void *Base, register unsigned long Offset)
 {
     mem_barrier();
     return *(volatile CARD8 *) ((unsigned long) Base + (Offset));
 }
 
 int
-readDense16(pointer Base, register unsigned long Offset)
+readDense16(void *Base, register unsigned long Offset)
 {
     mem_barrier();
     return *(volatile CARD16 *) ((unsigned long) Base + (Offset));
 }
 
 int
-readDense32(pointer Base, register unsigned long Offset)
+readDense32(void *Base, register unsigned long Offset)
 {
     mem_barrier();
     return *(volatile CARD32 *) ((unsigned long) Base + (Offset));
 }
 
 void
-writeDenseNB8(int Value, pointer Base, register unsigned long Offset)
+writeDenseNB8(int Value, void *Base, register unsigned long Offset)
 {
     *(volatile CARD8 *) ((unsigned long) Base + (Offset)) = Value;
 }
 
 void
-writeDenseNB16(int Value, pointer Base, register unsigned long Offset)
+writeDenseNB16(int Value, void *Base, register unsigned long Offset)
 {
     *(volatile CARD16 *) ((unsigned long) Base + (Offset)) = Value;
 }
 
 void
-writeDenseNB32(int Value, pointer Base, register unsigned long Offset)
+writeDenseNB32(int Value, void *Base, register unsigned long Offset)
 {
     *(volatile CARD32 *) ((unsigned long) Base + (Offset)) = Value;
 }
 
 void
-writeDense8(int Value, pointer Base, register unsigned long Offset)
+writeDense8(int Value, void *Base, register unsigned long Offset)
 {
     write_mem_barrier();
     *(volatile CARD8 *) ((unsigned long) Base + (Offset)) = Value;
 }
 
 void
-writeDense16(int Value, pointer Base, register unsigned long Offset)
+writeDense16(int Value, void *Base, register unsigned long Offset)
 {
     write_mem_barrier();
     *(volatile CARD16 *) ((unsigned long) Base + (Offset)) = Value;
 }
 
 void
-writeDense32(int Value, pointer Base, register unsigned long Offset)
+writeDense32(int Value, void *Base, register unsigned long Offset)
 {
     write_mem_barrier();
     *(volatile CARD32 *) ((unsigned long) Base + (Offset)) = Value;
index 68c296b..85709c6 100644 (file)
 
 #include <sys/stat.h>
 
+#ifndef K_OFF
+#define K_OFF 0x4
+#endif
+
+#ifndef KDSKBMUTE
+#define KDSKBMUTE 0x4B51
+#endif
+
 static Bool KeepTty = FALSE;
 static int activeVT = -1;
 
@@ -71,20 +79,15 @@ switch_to(int vt, const char *from)
 void
 xf86OpenConsole(void)
 {
-    int i, fd = -1, ret;
+    int i, fd = -1, ret, current_vt = -1;
     struct vt_mode VT;
     struct vt_stat vts;
+    struct stat st;
     MessageType from = X_PROBED;
-    char *tty0[] = { "/dev/tty0", "/dev/vc/0", NULL };
-    char *vcs[] = { "/dev/vc/%d", "/dev/tty%d", NULL };
+    const char *tty0[] = { "/dev/tty0", "/dev/vc/0", NULL };
+    const char *vcs[] = { "/dev/vc/%d", "/dev/tty%d", NULL };
 
     if (serverGeneration == 1) {
-
-        /* when KeepTty check if we're run with euid==0 */
-        if (KeepTty && geteuid() != 0)
-            FatalError("xf86OpenConsole:"
-                       " Server must be suid root for option \"KeepTTY\"\n");
-
         /*
          * setup the virtual terminal manager
          */
@@ -124,6 +127,22 @@ xf86OpenConsole(void)
 
         xf86Msg(from, "using VT number %d\n\n", xf86Info.vtno);
 
+        /* Some of stdin / stdout / stderr maybe redirected to a file */
+        for (i = STDIN_FILENO; i <= STDERR_FILENO; i++) {
+            ret = fstat(i, &st);
+            if (ret == 0 && S_ISCHR(st.st_mode) && major(st.st_rdev) == 4) {
+                current_vt = minor(st.st_rdev);
+                break;
+            }
+        }
+
+        if (!KeepTty && current_vt == xf86Info.vtno) {
+            xf86Msg(X_PROBED,
+                    "controlling tty is VT number %d, auto-enabling KeepTty\n",
+                    current_vt);
+            KeepTty = TRUE;
+        }
+
         if (!KeepTty) {
             pid_t ppid = getppid();
             pid_t ppgid;
@@ -147,6 +166,7 @@ xf86OpenConsole(void)
 
         i = 0;
         while (vcs[i] != NULL) {
+#pragma GCC diagnostic ignored "-Wformat-nonliteral"
             snprintf(vtname, sizeof(vtname), vcs[i], xf86Info.vtno);    /* /dev/tty1-64 */
             if ((xf86Info.consoleFd = open(vtname, O_RDWR | O_NDELAY, 0)) >= 0)
                 break;
@@ -213,19 +233,23 @@ xf86OpenConsole(void)
             tcgetattr(xf86Info.consoleFd, &tty_attr);
             SYSCALL(ioctl(xf86Info.consoleFd, KDGKBMODE, &tty_mode));
 
-#ifdef K_OFF
-            /* disable kernel special keys and buffering */
-            SYSCALL(ret = ioctl(xf86Info.consoleFd, KDSKBMODE, K_OFF));
+            /* disable kernel special keys and buffering, new style */
+            SYSCALL(ret = ioctl(xf86Info.consoleFd, KDSKBMUTE, 1));
             if (ret < 0)
-#endif
             {
-                SYSCALL(ret = ioctl(xf86Info.consoleFd, KDSKBMODE, K_RAW));
+                /* disable kernel special keys and buffering, old style */
+                SYSCALL(ret = ioctl(xf86Info.consoleFd, KDSKBMODE, K_OFF));
                 if (ret < 0)
-                    FatalError("xf86OpenConsole: KDSKBMODE K_RAW failed %s\n",
-                               strerror(errno));
-
-                /* need to keep the buffer clean, else the kernel gets angry */
-                xf86SetConsoleHandler(drain_console, NULL);
+                {
+                    /* fine, just disable special keys */
+                    SYSCALL(ret = ioctl(xf86Info.consoleFd, KDSKBMODE, K_RAW));
+                    if (ret < 0)
+                        FatalError("xf86OpenConsole: KDSKBMODE K_RAW failed %s\n",
+                                   strerror(errno));
+
+                    /* ... and drain events, else the kernel gets angry */
+                    xf86SetConsoleHandler(drain_console, NULL);
+                }
             }
 
             nTty = tty_attr;
@@ -271,6 +295,7 @@ xf86CloseConsole(void)
         xf86Msg(X_WARNING, "xf86CloseConsole: KDSETMODE failed: %s\n",
                 strerror(errno));
 
+    SYSCALL(ioctl(xf86Info.consoleFd, KDSKBMUTE, 0));
     SYSCALL(ioctl(xf86Info.consoleFd, KDSKBMODE, tty_mode));
     tcsetattr(xf86Info.consoleFd, TCSANOW, &tty_attr);
 
index 0a17c2a..f5917ee 100644 (file)
@@ -37,7 +37,7 @@ int
 xf86LoadKernelModule(const char *modName)
 {
     char mpPath[MAX_PATH] = "";
-    int fd = -1, status, n;
+    int fd = -1, status;
     pid_t pid;
 
     /* get the path to the modprobe program */
@@ -76,7 +76,7 @@ xf86LoadKernelModule(const char *modName)
                     "Setting of real/effective user Id to 0/0 failed");
         }
         setenv("PATH", "/sbin", 1);
-        n = execl(mpPath, "modprobe", modName, NULL);
+        execl(mpPath, "modprobe", modName, NULL);
         xf86Msg(X_WARNING, "LoadKernelModule %s\n", strerror(errno));
         exit(EXIT_FAILURE);     /* if we get here the child's exec failed */
         break;
index 76f5583..d660761 100644 (file)
@@ -7,6 +7,8 @@
 #include <xf86drm.h>
 #include <fcntl.h>
 #include <unistd.h>
+#include <errno.h>
+#include <string.h>
 
 /* Linux platform device support */
 #include "xf86_OSproc.h"
 #include "xf86Bus.h"
 
 #include "hotplug.h"
+#include "systemd-logind.h"
 
 static Bool
-get_drm_info(struct OdevAttributes *attribs, char *path)
+get_drm_info(struct OdevAttributes *attribs, char *path, int delayed_index)
 {
     drmSetVersion sv;
+    drmVersionPtr v;
     char *buf;
-    int fd;
+    int major, minor, fd;
+    int err = 0;
+    Bool paused, server_fd = FALSE;
+
+    major = config_odev_get_int_attribute(attribs, ODEV_ATTRIB_MAJOR, 0);
+    minor = config_odev_get_int_attribute(attribs, ODEV_ATTRIB_MINOR, 0);
+
+    fd = systemd_logind_take_fd(major, minor, path, &paused);
+    if (fd != -1) {
+        if (paused) {
+            LogMessage(X_ERROR,
+                    "Error systemd-logind returned paused fd for drm node\n");
+            systemd_logind_release_fd(major, minor, -1);
+            return FALSE;
+        }
+        config_odev_add_int_attribute(attribs, ODEV_ATTRIB_FD, fd);
+        server_fd = TRUE;
+    }
+
+    if (fd == -1)
+        fd = open(path, O_RDWR, O_CLOEXEC);
 
-    fd = open(path, O_RDWR, O_CLOEXEC);
     if (fd == -1)
         return FALSE;
 
@@ -32,19 +55,42 @@ get_drm_info(struct OdevAttributes *attribs, char *path)
     sv.drm_di_minor = 4;
     sv.drm_dd_major = -1;       /* Don't care */
     sv.drm_dd_minor = -1;       /* Don't care */
-    if (drmSetInterfaceVersion(fd, &sv)) {
-        ErrorF("setversion 1.4 failed\n");
-        return FALSE;
+
+    err = drmSetInterfaceVersion(fd, &sv);
+    if (err) {
+        xf86Msg(X_ERROR, "%s: failed to set DRM interface version 1.4: %s\n",
+                path, strerror(-err));
+        goto out;
     }
 
-    xf86_add_platform_device(attribs);
+    /* for a delayed probe we've already added the device */
+    if (delayed_index == -1) {
+            xf86_add_platform_device(attribs, FALSE);
+            delayed_index = xf86_num_platform_devices - 1;
+    }
+
+    if (server_fd)
+        xf86_platform_devices[delayed_index].flags |= XF86_PDEV_SERVER_FD;
 
     buf = drmGetBusid(fd);
-    xf86_add_platform_device_attrib(xf86_num_platform_devices - 1,
+    xf86_add_platform_device_attrib(delayed_index,
                                     ODEV_ATTRIB_BUSID, buf);
     drmFreeBusid(buf);
-    close(fd);
-    return TRUE;
+
+    v = drmGetVersion(fd);
+    if (!v) {
+        xf86Msg(X_ERROR, "%s: failed to query DRM version\n", path);
+        goto out;
+    }
+
+    xf86_add_platform_device_attrib(delayed_index, ODEV_ATTRIB_DRIVER,
+                                    v->name);
+    drmFreeVersion(v);
+
+out:
+    if (!server_fd)
+        close(fd);
+    return (err == 0);
 }
 
 Bool
@@ -89,19 +135,30 @@ xf86PlatformDeviceCheckBusID(struct xf86_platform_device *device, const char *bu
 }
 
 void
+xf86PlatformReprobeDevice(int index, struct OdevAttributes *attribs)
+{
+    Bool ret;
+    char *dpath;
+    dpath = xf86_get_platform_attrib(index, ODEV_ATTRIB_PATH);
+
+    ret = get_drm_info(attribs, dpath, index);
+    if (ret == FALSE) {
+        xf86_remove_platform_device(index);
+        return;
+    }
+    ret = xf86platformAddDevice(index);
+    if (ret == -1)
+        xf86_remove_platform_device(index);
+}
+
+void
 xf86PlatformDeviceProbe(struct OdevAttributes *attribs)
 {
-    struct OdevAttribute *attrib;
     int i;
     char *path = NULL;
     Bool ret;
 
-    xorg_list_for_each_entry(attrib, &attribs->list, member) {
-        if (attrib->attrib_id == ODEV_ATTRIB_PATH) {
-            path = attrib->attrib_name;
-            break;
-        }
-    }
+    path = config_odev_get_attribute(attribs, ODEV_ATTRIB_PATH);
     if (!path)
         goto out_free;
 
@@ -116,10 +173,16 @@ xf86PlatformDeviceProbe(struct OdevAttributes *attribs)
     if (i != xf86_num_platform_devices)
         goto out_free;
 
-    LogMessage(X_INFO, "config/udev: Adding drm device (%s)\n",
-               path);
+    LogMessage(X_INFO, "xfree86: Adding drm device (%s)\n", path);
 
-    ret = get_drm_info(attribs, path);
+    if (!xf86VTOwner()) {
+            /* if we don't currently own the VT then don't probe the device,
+               just mark it as unowned for later use */
+            xf86_add_platform_device(attribs, TRUE);
+            return;
+    }
+
+    ret = get_drm_info(attribs, path, -1);
     if (ret == FALSE)
         goto out_free;
 
@@ -138,6 +201,9 @@ void NewGPUDeviceRequest(struct OdevAttributes *attribs)
     if (old_num == xf86_num_platform_devices)
         return;
 
+    if (xf86_get_platform_device_unowned(xf86_num_platform_devices - 1) == TRUE)
+        return;
+
     ret = xf86platformAddDevice(xf86_num_platform_devices-1);
     if (ret == -1)
         xf86_remove_platform_device(xf86_num_platform_devices-1);
@@ -171,7 +237,10 @@ void DeleteGPUDeviceRequest(struct OdevAttributes *attribs)
 
     ErrorF("xf86: remove device %d %s\n", index, syspath);
 
-    xf86platformRemoveDevice(index);
+    if (xf86_get_platform_device_unowned(index) == TRUE)
+            xf86_remove_platform_device(index);
+    else
+            xf86platformRemoveDevice(index);
 out:
     config_odev_free_attribute_list(attribs);
 }
index 3526a21..652f963 100644 (file)
@@ -58,7 +58,10 @@ static Bool ExtendedEnabled = FALSE;
       !defined(__sparc__) && \
       !defined(__mips__) && \
       !defined(__nds32__) && \
-      !defined(__arm__)
+      !defined(__arm__) && \
+      !defined(__aarch64__) && \
+      !defined(__arc__) && \
+      !defined(__xtensa__)
 
 /*
  * Due to conflicts with "compiler.h", don't rely on <sys/io.h> to declare
@@ -79,17 +82,17 @@ extern int iopl(int __level);
 /* Video Memory Mapping section                                            */
 /***************************************************************************/
 
-static pointer mapVidMem(int, unsigned long, unsigned long, int);
-static void unmapVidMem(int, pointer, unsigned long);
+static void *mapVidMem(int, unsigned long, unsigned long, int);
+static void unmapVidMem(int, void *, unsigned long);
 
 #if defined (__alpha__)
 extern void sethae(unsigned long hae);
 extern unsigned long _bus_base __P((void)) __attribute__ ((const));
 extern unsigned long _bus_base_sparse __P((void)) __attribute__ ((const));
 
-static pointer mapVidMemSparse(int, unsigned long, unsigned long, int);
+static void *mapVidMemSparse(int, unsigned long, unsigned long, int);
 extern axpDevice lnxGetAXP(void);
-static void unmapVidMemSparse(int, pointer, unsigned long);
+static void unmapVidMemSparse(int, void *, unsigned long);
 static axpDevice axpSystem = -1;
 static Bool needSparse;
 static unsigned long hae_thresh;
@@ -101,8 +104,8 @@ static unsigned long bus_base;
 
 #define SPLIT_WC_REGIONS 1
 
-static pointer setWC(int, unsigned long, unsigned long, Bool, MessageType);
-static void undoWC(int, pointer);
+static void *setWC(int, unsigned long, unsigned long, Bool, MessageType);
+static void undoWC(int, void *);
 
 /* The file desc for /proc/mtrr. Once opened, left opened, and the mtrr
    driver will clean up when we exit. */
@@ -203,7 +206,7 @@ mtrr_cull_wc_region(int screenNum, unsigned long base, unsigned long size,
             xf86DrvMsgVerb(screenNum, X_WARNING, 0,
                            "Failed to remove MMIO "
                            "write-combining range (0x%lx,0x%lx)\n",
-                           gent.base, (unsigned long) gent.size);
+                           (unsigned long)gent.base, (unsigned long) gent.size);
         }
     }
     return wcreturn;
@@ -338,7 +341,7 @@ mtrr_undo_wc_region(int screenNum, struct mtrr_wc_region *wcr)
     }
 }
 
-static pointer
+static void *
 setWC(int screenNum, unsigned long base, unsigned long size, Bool enable,
       MessageType from)
 {
@@ -349,7 +352,7 @@ setWC(int screenNum, unsigned long base, unsigned long size, Bool enable,
 }
 
 static void
-undoWC(int screenNum, pointer regioninfo)
+undoWC(int screenNum, void *regioninfo)
 {
     mtrr_undo_wc_region(screenNum, regioninfo);
 }
@@ -395,16 +398,16 @@ xf86OSInitVidMem(VidMemInfoPtr pVidMem)
 /* Basically, you simply cannot do this on Sparc.  You have to do something portable
  * like use /dev/fb* or mmap() on /proc/bus/pci/X/Y nodes. -DaveM
  */
-static pointer
+static void *
 mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
 {
     return NULL;
 }
 #else
-static pointer
+static void *
 mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
 {
-    pointer base;
+    void *base;
     int fd;
     int mapflags = MAP_SHARED;
     int prot;
@@ -459,7 +462,7 @@ mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
 #endif                          /* !(__sparc__) */
 
 static void
-unmapVidMem(int ScreenNum, pointer Base, unsigned long Size)
+unmapVidMem(int ScreenNum, void *Base, unsigned long Size)
 {
     uintptr_t alignOff = (uintptr_t) Base
         - ((uintptr_t) Base & ~(getpagesize() - 1));
@@ -479,45 +482,39 @@ volatile unsigned char *ioBase = NULL;
 #define __NR_pciconfig_iobase  200
 #endif
 
-#endif
-
-Bool
-xf86EnableIO(void)
+static Bool
+hwEnableIO(void)
 {
-#if defined(__powerpc__)
     int fd;
-    unsigned int ioBase_phys;
-#endif
-
-    if (ExtendedEnabled)
-        return TRUE;
-
-#if defined(__powerpc__)
-    ioBase_phys = syscall(__NR_pciconfig_iobase, 2, 0, 0);
+    unsigned int ioBase_phys = syscall(__NR_pciconfig_iobase, 2, 0, 0);
 
     fd = open("/dev/mem", O_RDWR);
     if (ioBase == NULL) {
         ioBase = (volatile unsigned char *) mmap(0, 0x20000,
                                                  PROT_READ | PROT_WRITE,
                                                  MAP_SHARED, fd, ioBase_phys);
-/* Should this be fatal or just a warning? */
-#if 0
-        if (ioBase == MAP_FAILED) {
-            xf86Msg(X_WARNING,
-                    "xf86EnableIOPorts: Failed to map iobase (%s)\n",
-                    strerror(errno));
-            return FALSE;
-        }
-#endif
     }
     close(fd);
-#elif !defined(__mc68000__) && !defined(__sparc__) && !defined(__mips__) && !defined(__sh__) && !defined(__hppa__) && !defined(__s390__) && !defined(__arm__) && !defined(__m32r__) && !defined(__nds32__)
+
+    return ioBase != MAP_FAILED;
+}
+
+static void
+hwDisableIO(void)
+{
+    munmap(ioBase, 0x20000);
+    ioBase = NULL;
+}
+
+#elif defined(__i386__) || defined(__x86_64__) || defined(__ia64__) || \
+      defined(__alpha__)
+
+static Bool
+hwEnableIO(void)
+{
     if (ioperm(0, 1024, 1) || iopl(3)) {
-        if (errno == ENODEV)
-            ErrorF("xf86EnableIOPorts: no I/O ports found\n");
-        else
-            FatalError("xf86EnableIOPorts: failed to set IOPL"
-                       " for I/O (%s)\n", strerror(errno));
+        ErrorF("xf86EnableIOPorts: failed to set IOPL for I/O (%s)\n",
+               strerror(errno));
         return FALSE;
     }
 #if !defined(__alpha__)
@@ -526,71 +523,88 @@ xf86EnableIO(void)
     ioperm(0x40, 4, 0);         /* trap access to the timer chip */
     ioperm(0x60, 4, 0);         /* trap access to the keyboard controller */
 #endif
-#endif
-    ExtendedEnabled = TRUE;
 
     return TRUE;
 }
 
+static void
+hwDisableIO(void)
+{
+    iopl(0);
+    ioperm(0, 1024, 0);
+}
+
+#else /* non-IO architectures */
+
+#define hwEnableIO() TRUE
+#define hwDisableIO() do {} while (0)
+
+#endif
+
+Bool
+xf86EnableIO(void)
+{
+    if (ExtendedEnabled)
+        return TRUE;
+
+    ExtendedEnabled = hwEnableIO();
+
+    return ExtendedEnabled;
+}
+
 void
 xf86DisableIO(void)
 {
     if (!ExtendedEnabled)
         return;
-#if defined(__powerpc__)
-    munmap(ioBase, 0x20000);
-    ioBase = NULL;
-#elif !defined(__mc68000__) && !defined(__sparc__) && !defined(__mips__) && !defined(__sh__) && !defined(__hppa__) && !defined(__arm__) && !defined(__s390__) && !defined(__m32r__) && !defined(__nds32__)
-    iopl(0);
-    ioperm(0, 1024, 0);
-#endif
-    ExtendedEnabled = FALSE;
 
-    return;
+    hwDisableIO();
+
+    ExtendedEnabled = FALSE;
 }
 
 #if defined (__alpha__)
 
 #define vuip    volatile unsigned int *
 
-extern int readDense8(pointer Base, register unsigned long Offset);
-extern int readDense16(pointer Base, register unsigned long Offset);
-extern int readDense32(pointer Base, register unsigned long Offset);
+extern int readDense8(void *Base, register unsigned long Offset);
+extern int readDense16(void *Base, register unsigned long Offset);
+extern int readDense32(void *Base, register unsigned long Offset);
 extern void
- writeDenseNB8(int Value, pointer Base, register unsigned long Offset);
+ writeDenseNB8(int Value, void *Base, register unsigned long Offset);
 extern void
- writeDenseNB16(int Value, pointer Base, register unsigned long Offset);
+ writeDenseNB16(int Value, void *Base, register unsigned long Offset);
 extern void
- writeDenseNB32(int Value, pointer Base, register unsigned long Offset);
+ writeDenseNB32(int Value, void *Base, register unsigned long Offset);
 extern void
- writeDense8(int Value, pointer Base, register unsigned long Offset);
+ writeDense8(int Value, void *Base, register unsigned long Offset);
 extern void
- writeDense16(int Value, pointer Base, register unsigned long Offset);
+ writeDense16(int Value, void *Base, register unsigned long Offset);
 extern void
- writeDense32(int Value, pointer Base, register unsigned long Offset);
+ writeDense32(int Value, void *Base, register unsigned long Offset);
 
-static int readSparse8(pointer Base, register unsigned long Offset);
-static int readSparse16(pointer Base, register unsigned long Offset);
-static int readSparse32(pointer Base, register unsigned long Offset);
+static int readSparse8(void *Base, register unsigned long Offset);
+static int readSparse16(void *Base, register unsigned long Offset);
+static int readSparse32(void *Base, register unsigned long Offset);
 static void
- writeSparseNB8(int Value, pointer Base, register unsigned long Offset);
+ writeSparseNB8(int Value, void *Base, register unsigned long Offset);
 static void
- writeSparseNB16(int Value, pointer Base, register unsigned long Offset);
+ writeSparseNB16(int Value, void *Base, register unsigned long Offset);
 static void
- writeSparseNB32(int Value, pointer Base, register unsigned long Offset);
+ writeSparseNB32(int Value, void *Base, register unsigned long Offset);
 static void
- writeSparse8(int Value, pointer Base, register unsigned long Offset);
+ writeSparse8(int Value, void *Base, register unsigned long Offset);
 static void
- writeSparse16(int Value, pointer Base, register unsigned long Offset);
+ writeSparse16(int Value, void *Base, register unsigned long Offset);
 static void
- writeSparse32(int Value, pointer Base, register unsigned long Offset);
+ writeSparse32(int Value, void *Base, register unsigned long Offset);
 
 #define DENSE_BASE     0x2ff00000000UL
 #define SPARSE_BASE    0x30000000000UL
 
 static unsigned long msb_set = 0;
 
-static pointer
+static void *
 mapVidMemSparse(int ScreenNum, unsigned long Base, unsigned long Size,
                 int flags)
 {
@@ -677,11 +691,11 @@ mapVidMemSparse(int ScreenNum, unsigned long Base, unsigned long Size,
                 " to DENSE only at 0x%lx\n", Base, Size, ret);
 
 #endif
-    return (pointer) ret;
+    return (void *) ret;
 }
 
 static void
-unmapVidMemSparse(int ScreenNum, pointer Base, unsigned long Size)
+unmapVidMemSparse(int ScreenNum, void *Base, unsigned long Size)
 {
     unsigned long Offset = (unsigned long) Base - DENSE_BASE;
 
@@ -697,7 +711,7 @@ unmapVidMemSparse(int ScreenNum, pointer Base, unsigned long Size)
 }
 
 static int
-readSparse8(pointer Base, register unsigned long Offset)
+readSparse8(void *Base, register unsigned long Offset)
 {
     register unsigned long result, shift;
     register unsigned long msb;
@@ -721,7 +735,7 @@ readSparse8(pointer Base, register unsigned long Offset)
 }
 
 static int
-readSparse16(pointer Base, register unsigned long Offset)
+readSparse16(void *Base, register unsigned long Offset)
 {
     register unsigned long result, shift;
     register unsigned long msb;
@@ -745,7 +759,7 @@ readSparse16(pointer Base, register unsigned long Offset)
 }
 
 static int
-readSparse32(pointer Base, register unsigned long Offset)
+readSparse32(void *Base, register unsigned long Offset)
 {
     /* NOTE: this is really using DENSE. */
     mem_barrier();
@@ -753,7 +767,7 @@ readSparse32(pointer Base, register unsigned long Offset)
 }
 
 static void
-writeSparse8(int Value, pointer Base, register unsigned long Offset)
+writeSparse8(int Value, void *Base, register unsigned long Offset)
 {
     register unsigned long msb;
     register unsigned int b = Value & 0xffU;
@@ -774,7 +788,7 @@ writeSparse8(int Value, pointer Base, register unsigned long Offset)
 }
 
 static void
-writeSparse16(int Value, pointer Base, register unsigned long Offset)
+writeSparse16(int Value, void *Base, register unsigned long Offset)
 {
     register unsigned long msb;
     register unsigned int w = Value & 0xffffU;
@@ -795,7 +809,7 @@ writeSparse16(int Value, pointer Base, register unsigned long Offset)
 }
 
 static void
-writeSparse32(int Value, pointer Base, register unsigned long Offset)
+writeSparse32(int Value, void *Base, register unsigned long Offset)
 {
     /* NOTE: this is really using DENSE. */
     write_mem_barrier();
@@ -804,7 +818,7 @@ writeSparse32(int Value, pointer Base, register unsigned long Offset)
 }
 
 static void
-writeSparseNB8(int Value, pointer Base, register unsigned long Offset)
+writeSparseNB8(int Value, void *Base, register unsigned long Offset)
 {
     register unsigned long msb;
     register unsigned int b = Value & 0xffU;
@@ -822,7 +836,7 @@ writeSparseNB8(int Value, pointer Base, register unsigned long Offset)
 }
 
 static void
-writeSparseNB16(int Value, pointer Base, register unsigned long Offset)
+writeSparseNB16(int Value, void *Base, register unsigned long Offset)
 {
     register unsigned long msb;
     register unsigned int w = Value & 0xffffU;
@@ -840,30 +854,30 @@ writeSparseNB16(int Value, pointer Base, register unsigned long Offset)
 }
 
 static void
-writeSparseNB32(int Value, pointer Base, register unsigned long Offset)
+writeSparseNB32(int Value, void *Base, register unsigned long Offset)
 {
     /* NOTE: this is really using DENSE. */
     *(vuip) ((unsigned long) Base + (Offset)) = Value;
     return;
 }
 
-void (*xf86WriteMmio8) (int Value, pointer Base, unsigned long Offset)
+void (*xf86WriteMmio8) (int Value, void *Base, unsigned long Offset)
     = writeDense8;
-void (*xf86WriteMmio16) (int Value, pointer Base, unsigned long Offset)
+void (*xf86WriteMmio16) (int Value, void *Base, unsigned long Offset)
     = writeDense16;
-void (*xf86WriteMmio32) (int Value, pointer Base, unsigned long Offset)
+void (*xf86WriteMmio32) (int Value, void *Base, unsigned long Offset)
     = writeDense32;
-void (*xf86WriteMmioNB8) (int Value, pointer Base, unsigned long Offset)
+void (*xf86WriteMmioNB8) (int Value, void *Base, unsigned long Offset)
     = writeDenseNB8;
-void (*xf86WriteMmioNB16) (int Value, pointer Base, unsigned long Offset)
+void (*xf86WriteMmioNB16) (int Value, void *Base, unsigned long Offset)
     = writeDenseNB16;
-void (*xf86WriteMmioNB32) (int Value, pointer Base, unsigned long Offset)
+void (*xf86WriteMmioNB32) (int Value, void *Base, unsigned long Offset)
     = writeDenseNB32;
-int (*xf86ReadMmio8) (pointer Base, unsigned long Offset)
+int (*xf86ReadMmio8) (void *Base, unsigned long Offset)
     = readDense8;
-int (*xf86ReadMmio16) (pointer Base, unsigned long Offset)
+int (*xf86ReadMmio16) (void *Base, unsigned long Offset)
     = readDense16;
-int (*xf86ReadMmio32) (pointer Base, unsigned long Offset)
+int (*xf86ReadMmio32) (void *Base, unsigned long Offset)
     = readDense32;
 
 #endif                          /* __alpha__ */
diff --git a/hw/xfree86/os-support/linux/systemd-logind.c b/hw/xfree86/os-support/linux/systemd-logind.c
new file mode 100644 (file)
index 0000000..73a8d55
--- /dev/null
@@ -0,0 +1,608 @@
+/*
+ * Copyright Â© 2013 Red Hat Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * 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.
+ *
+ * Author: Hans de Goede <hdegoede@redhat.com>
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <dbus/dbus.h>
+#include <string.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#include "os.h"
+#include "dbus-core.h"
+#include "xf86.h"
+#include "xf86platformBus.h"
+#include "xf86Xinput.h"
+
+#include "systemd-logind.h"
+
+#define DBUS_TIMEOUT 500 /* Wait max 0.5 seconds */
+
+struct systemd_logind_info {
+    DBusConnection *conn;
+    char *session;
+    Bool active;
+    Bool vt_active;
+};
+
+static struct systemd_logind_info logind_info;
+
+static InputInfoPtr
+systemd_logind_find_info_ptr_by_devnum(InputInfoPtr start,
+                                       int major, int minor)
+{
+    InputInfoPtr pInfo;
+
+    for (pInfo = start; pInfo; pInfo = pInfo->next)
+        if (pInfo->major == major && pInfo->minor == minor &&
+                (pInfo->flags & XI86_SERVER_FD))
+            return pInfo;
+
+    return NULL;
+}
+
+static void
+systemd_logind_set_input_fd_for_all_devs(int major, int minor, int fd,
+                                         Bool enable)
+{
+    InputInfoPtr pInfo;
+
+    pInfo = systemd_logind_find_info_ptr_by_devnum(xf86InputDevs, major, minor);
+    while (pInfo) {
+        pInfo->fd = fd;
+        pInfo->options = xf86ReplaceIntOption(pInfo->options, "fd", fd);
+        if (enable)
+            xf86EnableInputDeviceForVTSwitch(pInfo);
+
+        pInfo = systemd_logind_find_info_ptr_by_devnum(pInfo->next, major, minor);
+    }
+}
+
+int
+systemd_logind_take_fd(int _major, int _minor, const char *path,
+                       Bool *paused_ret)
+{
+    struct systemd_logind_info *info = &logind_info;
+    InputInfoPtr pInfo;
+    DBusError error;
+    DBusMessage *msg = NULL;
+    DBusMessage *reply = NULL;
+    dbus_int32_t major = _major;
+    dbus_int32_t minor = _minor;
+    dbus_bool_t paused;
+    int fd = -1;
+
+    if (!info->session || major == 0)
+        return -1;
+
+    /* logind does not support mouse devs (with evdev we don't need them) */
+    if (strstr(path, "mouse"))
+        return -1;
+
+    /* Check if we already have an InputInfo entry with this major, minor
+     * (shared device-nodes happen ie with Wacom tablets). */
+    pInfo = systemd_logind_find_info_ptr_by_devnum(xf86InputDevs, major, minor);
+    if (pInfo) {
+        LogMessage(X_INFO, "systemd-logind: returning pre-existing fd for %s %u:%u\n",
+               path, major, minor);
+        *paused_ret = FALSE;
+        return pInfo->fd;
+    }
+
+    dbus_error_init(&error);
+
+    msg = dbus_message_new_method_call("org.freedesktop.login1", info->session,
+            "org.freedesktop.login1.Session", "TakeDevice");
+    if (!msg) {
+        LogMessage(X_ERROR, "systemd-logind: out of memory\n");
+        goto cleanup;
+    }
+
+    if (!dbus_message_append_args(msg, DBUS_TYPE_UINT32, &major,
+                                       DBUS_TYPE_UINT32, &minor,
+                                       DBUS_TYPE_INVALID)) {
+        LogMessage(X_ERROR, "systemd-logind: out of memory\n");
+        goto cleanup;
+    }
+
+    reply = dbus_connection_send_with_reply_and_block(info->conn, msg,
+                                                      DBUS_TIMEOUT, &error);
+    if (!reply) {
+        LogMessage(X_ERROR, "systemd-logind: failed to take device %s: %s\n",
+                   path, error.message);
+        goto cleanup;
+    }
+
+    if (!dbus_message_get_args(reply, &error,
+                               DBUS_TYPE_UNIX_FD, &fd,
+                               DBUS_TYPE_BOOLEAN, &paused,
+                               DBUS_TYPE_INVALID)) {
+        LogMessage(X_ERROR, "systemd-logind: TakeDevice %s: %s\n",
+                   path, error.message);
+        goto cleanup;
+    }
+
+    *paused_ret = paused;
+
+    LogMessage(X_INFO, "systemd-logind: got fd for %s %u:%u fd %d paused %d\n",
+               path, major, minor, fd, paused);
+
+cleanup:
+    if (msg)
+        dbus_message_unref(msg);
+    if (reply)
+        dbus_message_unref(reply);
+    dbus_error_free(&error);
+
+    return fd;
+}
+
+void
+systemd_logind_release_fd(int _major, int _minor, int fd)
+{
+    struct systemd_logind_info *info = &logind_info;
+    InputInfoPtr pInfo;
+    DBusError error;
+    DBusMessage *msg = NULL;
+    DBusMessage *reply = NULL;
+    dbus_int32_t major = _major;
+    dbus_int32_t minor = _minor;
+    int matches = 0;
+
+    if (!info->session || major == 0)
+        goto close;
+
+    /* Only release the fd if there is only 1 InputInfo left for this major
+     * and minor, otherwise other InputInfo's are still referencing the fd. */
+    pInfo = systemd_logind_find_info_ptr_by_devnum(xf86InputDevs, major, minor);
+    while (pInfo) {
+        matches++;
+        pInfo = systemd_logind_find_info_ptr_by_devnum(pInfo->next, major, minor);
+    }
+    if (matches > 1) {
+        LogMessage(X_INFO, "systemd-logind: not releasing fd for %u:%u, still in use\n", major, minor);
+        return;
+    }
+
+    LogMessage(X_INFO, "systemd-logind: releasing fd for %u:%u\n", major, minor);
+
+    dbus_error_init(&error);
+
+    msg = dbus_message_new_method_call("org.freedesktop.login1", info->session,
+            "org.freedesktop.login1.Session", "ReleaseDevice");
+    if (!msg) {
+        LogMessage(X_ERROR, "systemd-logind: out of memory\n");
+        goto cleanup;
+    }
+
+    if (!dbus_message_append_args(msg, DBUS_TYPE_UINT32, &major,
+                                       DBUS_TYPE_UINT32, &minor,
+                                       DBUS_TYPE_INVALID)) {
+        LogMessage(X_ERROR, "systemd-logind: out of memory\n");
+        goto cleanup;
+    }
+
+    reply = dbus_connection_send_with_reply_and_block(info->conn, msg,
+                                                      DBUS_TIMEOUT, &error);
+    if (!reply)
+        LogMessage(X_ERROR, "systemd-logind: failed to release device: %s\n",
+                   error.message);
+
+cleanup:
+    if (msg)
+        dbus_message_unref(msg);
+    if (reply)
+        dbus_message_unref(reply);
+    dbus_error_free(&error);
+close:
+    if (fd != -1)
+        close(fd);
+}
+
+int
+systemd_logind_controls_session(void)
+{
+    return logind_info.session ? 1 : 0;
+}
+
+void
+systemd_logind_vtenter(void)
+{
+    struct systemd_logind_info *info = &logind_info;
+    InputInfoPtr pInfo;
+    int i;
+
+    if (!info->session)
+        return; /* Not using systemd-logind */
+
+    if (!info->active)
+        return; /* Session not active */
+
+    if (info->vt_active)
+        return; /* Already did vtenter */
+
+    for (i = 0; i < xf86_num_platform_devices; i++) {
+        if (xf86_platform_devices[i].flags & XF86_PDEV_PAUSED)
+            break;
+    }
+    if (i != xf86_num_platform_devices)
+        return; /* Some drm nodes are still paused wait for resume */
+
+    xf86VTEnter();
+    info->vt_active = TRUE;
+
+    /* Activate any input devices which were resumed before the drm nodes */
+    for (pInfo = xf86InputDevs; pInfo; pInfo = pInfo->next)
+        if ((pInfo->flags & XI86_SERVER_FD) && pInfo->fd != -1)
+            xf86EnableInputDeviceForVTSwitch(pInfo);
+
+    /* Do delayed input probing, this must be done after the above enabling */
+    xf86InputEnableVTProbe();
+}
+
+static void
+systemd_logind_ack_pause(struct systemd_logind_info *info,
+                         dbus_int32_t minor, dbus_int32_t major)
+{
+    DBusError error;
+    DBusMessage *msg = NULL;
+    DBusMessage *reply = NULL;
+
+    dbus_error_init(&error);
+
+    msg = dbus_message_new_method_call("org.freedesktop.login1", info->session,
+            "org.freedesktop.login1.Session", "PauseDeviceComplete");
+    if (!msg) {
+        LogMessage(X_ERROR, "systemd-logind: out of memory\n");
+        goto cleanup;
+    }
+
+    if (!dbus_message_append_args(msg, DBUS_TYPE_UINT32, &major,
+                                       DBUS_TYPE_UINT32, &minor,
+                                       DBUS_TYPE_INVALID)) {
+        LogMessage(X_ERROR, "systemd-logind: out of memory\n");
+        goto cleanup;
+    }
+
+    reply = dbus_connection_send_with_reply_and_block(info->conn, msg,
+                                                      DBUS_TIMEOUT, &error);
+    if (!reply)
+        LogMessage(X_ERROR, "systemd-logind: failed to ack pause: %s\n",
+                   error.message);
+
+cleanup:
+    if (msg)
+        dbus_message_unref(msg);
+    if (reply)
+        dbus_message_unref(reply);
+    dbus_error_free(&error);
+}
+
+static DBusHandlerResult
+message_filter(DBusConnection * connection, DBusMessage * message, void *data)
+{
+    struct systemd_logind_info *info = data;
+    struct xf86_platform_device *pdev = NULL;
+    InputInfoPtr pInfo = NULL;
+    int ack = 0, pause = 0, fd = -1;
+    DBusError error;
+    dbus_int32_t major, minor;
+    char *pause_str;
+
+    dbus_error_init(&error);
+
+    if (dbus_message_is_signal(message,
+                               "org.freedesktop.DBus", "NameOwnerChanged")) {
+        char *name, *old_owner, *new_owner;
+
+        dbus_message_get_args(message, &error,
+                              DBUS_TYPE_STRING, &name,
+                              DBUS_TYPE_STRING, &old_owner,
+                              DBUS_TYPE_STRING, &new_owner, DBUS_TYPE_INVALID);
+        if (dbus_error_is_set(&error)) {
+            LogMessage(X_ERROR, "systemd-logind: NameOwnerChanged: %s\n",
+                       error.message);
+            dbus_error_free(&error);
+            return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+        }
+
+        if (name && strcmp(name, "org.freedesktop.login1") == 0)
+            FatalError("systemd-logind disappeared (stopped/restarted?)\n");
+
+        return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+    }
+
+    if (strcmp(dbus_message_get_path(message), info->session) != 0)
+        return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+    if (dbus_message_is_signal(message, "org.freedesktop.login1.Session",
+                               "PauseDevice")) {
+        if (!dbus_message_get_args(message, &error,
+                               DBUS_TYPE_UINT32, &major,
+                               DBUS_TYPE_UINT32, &minor,
+                               DBUS_TYPE_STRING, &pause_str,
+                               DBUS_TYPE_INVALID)) {
+            LogMessage(X_ERROR, "systemd-logind: PauseDevice: %s\n",
+                       error.message);
+            dbus_error_free(&error);
+            return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+        }
+
+        if (strcmp(pause_str, "pause") == 0) {
+            pause = 1;
+            ack = 1;
+        }
+        else if (strcmp(pause_str, "force") == 0) {
+            pause = 1;
+        }
+        else if (strcmp(pause_str, "gone") == 0) {
+            /* Device removal is handled through udev */
+            return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+        }
+        else {
+            LogMessage(X_WARNING, "systemd-logind: unknown pause type: %s\n",
+                       pause_str);
+            return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+        }
+    }
+    else if (dbus_message_is_signal(message, "org.freedesktop.login1.Session",
+                                    "ResumeDevice")) {
+        if (!dbus_message_get_args(message, &error,
+                                   DBUS_TYPE_UINT32, &major,
+                                   DBUS_TYPE_UINT32, &minor,
+                                   DBUS_TYPE_UNIX_FD, &fd,
+                                   DBUS_TYPE_INVALID)) {
+            LogMessage(X_ERROR, "systemd-logind: ResumeDevice: %s\n",
+                       error.message);
+            dbus_error_free(&error);
+            return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+        }
+    } else
+        return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+    LogMessage(X_INFO, "systemd-logind: got %s for %u:%u\n",
+               pause ? "pause" : "resume", major, minor);
+
+    pdev = xf86_find_platform_device_by_devnum(major, minor);        
+    if (!pdev)
+        pInfo = systemd_logind_find_info_ptr_by_devnum(xf86InputDevs,
+                                                       major, minor);
+    if (!pdev && !pInfo) {
+        LogMessage(X_WARNING, "systemd-logind: could not find dev %u:%u\n",
+                   major, minor);
+        return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+    }
+
+    if (pause) {
+        /* Our VT_PROCESS usage guarantees we've already given up the vt */
+        info->active = info->vt_active = FALSE;
+        /* Note the actual vtleave has already been handled by xf86Events.c */
+        if (pdev)
+            pdev->flags |= XF86_PDEV_PAUSED;
+        else {
+            close(pInfo->fd);
+            systemd_logind_set_input_fd_for_all_devs(major, minor, -1, FALSE);
+        }
+        if (ack)
+            systemd_logind_ack_pause(info, major, minor);
+    }
+    else {
+        /* info->vt_active gets set by systemd_logind_vtenter() */
+        info->active = TRUE;
+
+        if (pdev)
+            pdev->flags &= ~XF86_PDEV_PAUSED;
+        else
+            systemd_logind_set_input_fd_for_all_devs(major, minor, fd,
+                                                     info->vt_active);
+
+        /* Always call vtenter(), in case there are only legacy video devs */
+        systemd_logind_vtenter();
+    }
+    return DBUS_HANDLER_RESULT_HANDLED;
+}
+
+static void
+connect_hook(DBusConnection *connection, void *data)
+{
+    struct systemd_logind_info *info = data;
+    DBusError error;
+    DBusMessage *msg = NULL;
+    DBusMessage *reply = NULL;
+    dbus_int32_t arg;
+    char *session = NULL;
+
+    dbus_error_init(&error);
+
+    msg = dbus_message_new_method_call("org.freedesktop.login1",
+            "/org/freedesktop/login1", "org.freedesktop.login1.Manager",
+            "GetSessionByPID");
+    if (!msg) {
+        LogMessage(X_ERROR, "systemd-logind: out of memory\n");
+        goto cleanup;
+    }
+
+    arg = getpid();
+    if (!dbus_message_append_args(msg, DBUS_TYPE_UINT32, &arg,
+                                  DBUS_TYPE_INVALID)) {
+        LogMessage(X_ERROR, "systemd-logind: out of memory\n");
+        goto cleanup;
+    }
+
+    reply = dbus_connection_send_with_reply_and_block(connection, msg,
+                                                      DBUS_TIMEOUT, &error);
+    if (!reply) {
+        LogMessage(X_ERROR, "systemd-logind: failed to get session: %s\n",
+                   error.message);
+        goto cleanup;
+    }
+    dbus_message_unref(msg);
+
+    if (!dbus_message_get_args(reply, &error, DBUS_TYPE_OBJECT_PATH, &session,
+                               DBUS_TYPE_INVALID)) {
+        LogMessage(X_ERROR, "systemd-logind: GetSessionByPID: %s\n",
+                   error.message);
+        goto cleanup;
+    }
+    session = XNFstrdup(session);
+
+    dbus_message_unref(reply);
+    reply = NULL;
+
+
+    msg = dbus_message_new_method_call("org.freedesktop.login1",
+            session, "org.freedesktop.login1.Session", "TakeControl");
+    if (!msg) {
+        LogMessage(X_ERROR, "systemd-logind: out of memory\n");
+        goto cleanup;
+    }
+
+    arg = FALSE; /* Don't forcibly take over over the session */
+    if (!dbus_message_append_args(msg, DBUS_TYPE_BOOLEAN, &arg,
+                                  DBUS_TYPE_INVALID)) {
+        LogMessage(X_ERROR, "systemd-logind: out of memory\n");
+        goto cleanup;
+    }
+
+    reply = dbus_connection_send_with_reply_and_block(connection, msg,
+                                                      DBUS_TIMEOUT, &error);
+    if (!reply) {
+        LogMessage(X_ERROR, "systemd-logind: TakeControl failed: %s\n",
+                   error.message);
+        goto cleanup;
+    }
+
+    dbus_bus_add_match(connection,
+        "type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',path='/org/freedesktop/DBus'",
+        &error);
+    if (dbus_error_is_set(&error)) {
+        LogMessage(X_ERROR, "systemd-logind: could not add match: %s\n",
+                   error.message);
+        goto cleanup;
+    }
+
+    /*
+     * HdG: This is not useful with systemd <= 208 since the signal only
+     * contains invalidated property names there, rather than property, val
+     * pairs as it should.  Instead we just use the first resume / pause now.
+     */
+#if 0
+    snprintf(match, sizeof(match),
+        "type='signal',sender='org.freedesktop.login1',interface='org.freedesktop.DBus.Properties',member='PropertiesChanged',path='%s'",
+        session);
+    dbus_bus_add_match(connection, match, &error);
+    if (dbus_error_is_set(&error)) {
+        LogMessage(X_ERROR, "systemd-logind: could not add match: %s\n",
+                   error.message);
+        goto cleanup;
+    }
+#endif
+
+    if (!dbus_connection_add_filter(connection, message_filter, info, NULL)) {
+        LogMessage(X_ERROR, "systemd-logind: could not add filter: %s\n",
+                   error.message);
+        goto cleanup;
+    }
+
+    LogMessage(X_INFO, "systemd-logind: took control of session %s\n",
+               session);
+    info->conn = connection;
+    info->session = session;
+    info->vt_active = info->active = TRUE; /* The server owns the vt during init */
+    session = NULL;
+
+cleanup:
+    free(session);
+    if (msg)
+        dbus_message_unref(msg);
+    if (reply)
+        dbus_message_unref(reply);
+    dbus_error_free(&error);
+}
+
+static void
+systemd_logind_release_control(struct systemd_logind_info *info)
+{
+    DBusError error;
+    DBusMessage *msg = NULL;
+    DBusMessage *reply = NULL;
+
+    dbus_error_init(&error);
+
+    msg = dbus_message_new_method_call("org.freedesktop.login1",
+            info->session, "org.freedesktop.login1.Session", "ReleaseControl");
+    if (!msg) {
+        LogMessage(X_ERROR, "systemd-logind: out of memory\n");
+        goto cleanup;
+    }
+
+    reply = dbus_connection_send_with_reply_and_block(info->conn, msg,
+                                                      DBUS_TIMEOUT, &error);
+    if (!reply) {
+        LogMessage(X_ERROR, "systemd-logind: ReleaseControl failed: %s\n",
+                   error.message);
+        goto cleanup;
+    }
+
+cleanup:
+    if (msg)
+        dbus_message_unref(msg);
+    if (reply)
+        dbus_message_unref(reply);
+    dbus_error_free(&error);
+}
+
+static void
+disconnect_hook(void *data)
+{
+    struct systemd_logind_info *info = data;
+
+    free(info->session);
+    info->session = NULL;
+    info->conn = NULL;
+}
+
+static struct dbus_core_hook core_hook = {
+    .connect = connect_hook,
+    .disconnect = disconnect_hook,
+    .data = &logind_info,
+};
+
+int
+systemd_logind_init(void)
+{
+    return dbus_core_add_hook(&core_hook);
+}
+
+void
+systemd_logind_fini(void)
+{
+    if (logind_info.session)
+        systemd_logind_release_control(&logind_info);
+
+    dbus_core_remove_hook(&core_hook);
+}
index 4bd3fc3..0265aec 100644 (file)
@@ -5,7 +5,7 @@ libmisc_la_SOURCES = SlowBcopy.c
 
 #AM_LDFLAGS = -r
 
-INCLUDES = $(XORG_INCS)
+AM_CPPFLAGS = $(XORG_INCS)
 
 AM_CFLAGS = $(XORG_CFLAGS) $(DIX_CFLAGS)
 
index 9c6ed4b..da486c0 100644 (file)
@@ -47,7 +47,7 @@ xf86GARTCloseScreen(int screenNum)
 }
 
 Bool
-xf86AgpGARTSupported()
+xf86AgpGARTSupported(void)
 {
     return FALSE;
 }
index 30688c0..eeacee9 100644 (file)
 #include "xf86_OSlib.h"
 
 Bool
-xf86EnableIO()
+xf86EnableIO(void)
 {
     return TRUE;
 }
 
 void
-xf86DisableIO()
+xf86DisableIO(void)
 {
     return;
 }
index 4d08c1e..6e2af00 100644 (file)
@@ -124,7 +124,11 @@ xf86OpenSerial(XF86OptionPtr options)
         return -1;
     }
 
-    SYSCALL(fd = open(dev, O_RDWR | O_NONBLOCK));
+    fd = xf86CheckIntOption(options, "fd", -1);
+
+    if (fd == -1)
+        SYSCALL(fd = open(dev, O_RDWR | O_NONBLOCK));
+
     if (fd == -1) {
         xf86Msg(X_ERROR,
                 "xf86OpenSerial: Cannot open device %s\n\t%s.\n",
index 514fc2f..f473293 100644 (file)
@@ -51,8 +51,8 @@
 
 typedef struct {
     unsigned long size;
-    pointer virtBase;
-    pointer mtrrInfo;
+    void *virtBase;
+    void *mtrrInfo;
 } MappingRec, *MappingPtr;
 
 typedef struct {
@@ -104,7 +104,7 @@ newMapping(VidMapPtr vp)
 }
 
 static MappingPtr
-findMapping(VidMapPtr vp, pointer vbase, unsigned long size)
+findMapping(VidMapPtr vp, void *vbase, unsigned long size)
 {
     int i;
 
@@ -165,10 +165,10 @@ xf86InitVidMem(void)
     }
 }
 
-pointer
+void *
 xf86MapVidMem(int ScreenNum, int Flags, unsigned long Base, unsigned long Size)
 {
-    pointer vbase = NULL;
+    void *vbase = NULL;
     VidMapPtr vp;
     MappingPtr mp;
 
@@ -182,7 +182,7 @@ xf86MapVidMem(int ScreenNum, int Flags, unsigned long Base, unsigned long Size)
 
     vbase = vidMemInfo.mapMem(ScreenNum, Base, Size, Flags);
 
-    if (!vbase || vbase == (pointer) -1)
+    if (!vbase || vbase == (void *) -1)
         return NULL;
 
     vp = getVidMapRec(ScreenNum);
@@ -208,7 +208,7 @@ xf86MapVidMem(int ScreenNum, int Flags, unsigned long Base, unsigned long Size)
 }
 
 void
-xf86UnMapVidMem(int ScreenNum, pointer Base, unsigned long Size)
+xf86UnMapVidMem(int ScreenNum, void *Base, unsigned long Size)
 {
     VidMapPtr vp;
     MappingPtr mp;
@@ -257,16 +257,3 @@ xf86LinearVidMem(void)
     xf86InitVidMem();
     return vidMemInfo.linearSupported;
 }
-
-void
-xf86MapReadSideEffects(int ScreenNum, int Flags, pointer base,
-                       unsigned long Size)
-{
-    if (!(Flags & VIDMEM_READSIDEEFFECT))
-        return;
-
-    if (!vidMemInfo.initialised || !vidMemInfo.readSideEffects)
-        return;
-
-    vidMemInfo.readSideEffects(ScreenNum, base, Size);
-}
index 5163f44..6cda4b3 100644 (file)
@@ -31,7 +31,7 @@ nodist_sdk_HEADERS = solaris-@SOLARIS_INOUT_ARCH@.il
 
 AM_CFLAGS = -DUSESTDRES -DHAVE_SYSV_IPC $(XORG_CFLAGS) $(DIX_CFLAGS)
 
-INCLUDES = $(XORG_INCS) 
+AM_CPPFLAGS = $(XORG_INCS) 
 
 EXTRA_DIST = solaris-amd64.S solaris-ia32.S solaris-sparcv8plus.S \
        apSolaris.shar sun_inout.s
index b6a1432..38fa5ec 100644 (file)
@@ -90,7 +90,7 @@ typedef struct apm_event_info {
 #define APM_DEVICE "/dev/srn"
 #define APM_DEVICE1 "/dev/apm"
 
-static pointer APMihPtr = NULL;
+static void *APMihPtr = NULL;
 static void sunCloseAPM(void);
 
 static struct {
index 4b75a98..16fc1b7 100644 (file)
@@ -274,7 +274,7 @@ xf86OpenConsole(void)
              * this is to make sure we don't continue until the activate
              * signal is received.
              */
-            if (!xf86Screens[0]->vtSema)
+            if (!xf86VTOwner())
                 sleep(5);
         }
 #endif                          /* HAS_USL_VTS */
@@ -316,7 +316,7 @@ xf86CloseConsole(void)
                         " attributes (%s)\n", strerror(errno));
             }
             else {
-                pointer fbdata;
+                void *fbdata;
 
                 fbdata = mmap(NULL, fbattr.fbtype.fb_size,
                               PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
index 67ef176..fc46487 100644 (file)
@@ -107,10 +107,10 @@ solOpenAperture(void)
     return TRUE;
 }
 
-static pointer
+static void *
 solMapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int Flags)
 {
-    pointer base;
+    void *base;
     int fd;
     int prot;
 
@@ -144,7 +144,7 @@ solMapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int Flags)
 
 /* ARGSUSED */
 static void
-solUnMapVidMem(int ScreenNum, pointer Base, unsigned long Size)
+solUnMapVidMem(int ScreenNum, void *Base, unsigned long Size)
 {
     if (munmap(Base, Size) != 0) {
         xf86DrvMsgVerb(ScreenNum, X_WARNING, 0,
index a1156ef..a39e17d 100644 (file)
@@ -2,7 +2,7 @@ noinst_LTLIBRARIES = libstub.la
 
 AM_CFLAGS = $(XORG_CFLAGS) $(DIX_CFLAGS)
 
-INCLUDES = $(XORG_INCS)
+AM_CPPFLAGS = $(XORG_INCS)
 
 libstub_la_SOURCES = \
        $(srcdir)/../shared/VTsw_noop.c \
index 629675d..d3e0c3f 100644 (file)
@@ -5,12 +5,12 @@
 #include "xf86_OSlib.h"
 
 void
-xf86OpenConsole()
+xf86OpenConsole(void)
 {
 }
 
 void
-xf86CloseConsole()
+xf86CloseConsole(void)
 {
 }
 
@@ -21,6 +21,6 @@ xf86ProcessArgument(int argc, char *argv[], int i)
 }
 
 void
-xf86UseMsg()
+xf86UseMsg(void)
 {
 }
index 65769c1..7f003e8 100644 (file)
 #ifndef _XF86OSPRIV_H
 #define _XF86OSPRIV_H
 
-typedef pointer (*MapMemProcPtr) (int, unsigned long, unsigned long, int);
-typedef void (*UnmapMemProcPtr) (int, pointer, unsigned long);
-typedef pointer (*SetWCProcPtr) (int, unsigned long, unsigned long, Bool,
+typedef void *(*MapMemProcPtr) (int, unsigned long, unsigned long, int);
+typedef void (*UnmapMemProcPtr) (int, void *, unsigned long);
+typedef void *(*SetWCProcPtr) (int, unsigned long, unsigned long, Bool,
                                  MessageType);
-typedef void (*ProtectMemProcPtr) (int, pointer, unsigned long, Bool);
-typedef void (*UndoWCProcPtr) (int, pointer);
-typedef void (*ReadSideEffectsProcPtr) (int, pointer, unsigned long);
+typedef void (*ProtectMemProcPtr) (int, void *, unsigned long, Bool);
+typedef void (*UndoWCProcPtr) (int, void *);
 
 typedef struct {
     Bool initialised;
@@ -47,7 +46,6 @@ typedef struct {
     ProtectMemProcPtr protectMem;
     SetWCProcPtr setWC;
     UndoWCProcPtr undoWC;
-    ReadSideEffectsProcPtr readSideEffects;
     Bool linearSupported;
 } VidMemInfo, *VidMemInfoPtr;
 
index e931b09..eb0a338 100644 (file)
@@ -277,12 +277,7 @@ struct pcvtid {
 #include <dev/wscons/wsdisplay_usl_io.h>
 #endif                          /* WSCONS_SUPPORT */
 #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
-#if defined(__FreeBSD_kernel_version) && (__FreeBSD_kernel_version >= 500013)
 #include <sys/mouse.h>
-#else
-#undef MOUSE_GETINFO
-#include <machine/mouse.h>
-#endif
 #endif
     /* Include these definitions in case ioctl_pc.h didn't get included */
 #ifndef CONSOLE_X_MODE_ON
index ea2b16e..8d27e8b 100644 (file)
@@ -132,12 +132,10 @@ _XFUNCPROTOBEGIN
 /* public functions */
 extern _X_EXPORT Bool xf86LinearVidMem(void);
 extern _X_EXPORT _X_DEPRECATED Bool xf86CheckMTRR(int);
-extern _X_EXPORT _X_DEPRECATED pointer xf86MapVidMem(int, int, unsigned long,
+extern _X_EXPORT _X_DEPRECATED void *xf86MapVidMem(int, int, unsigned long,
                                                      unsigned long);
-extern _X_EXPORT _X_DEPRECATED void xf86UnMapVidMem(int, pointer,
+extern _X_EXPORT _X_DEPRECATED void xf86UnMapVidMem(int, void *,
                                                     unsigned long);
-extern _X_EXPORT _X_DEPRECATED void xf86MapReadSideEffects(int, int, pointer,
-                                                           unsigned long);
 extern _X_EXPORT int xf86ReadBIOS(unsigned long, unsigned long, unsigned char *,
                                   int);
 extern _X_EXPORT Bool xf86EnableIO(void);
@@ -223,6 +221,9 @@ extern _X_EXPORT void xf86InitVidMem(void);
 #include "hotplug.h"
 void
 xf86PlatformDeviceProbe(struct OdevAttributes *attribs);
+
+void
+xf86PlatformReprobeDevice(int index, struct OdevAttributes *attribs);
 #endif
 
 _XFUNCPROTOEND
index 81cc1fc..e853220 100644 (file)
@@ -79,6 +79,8 @@ typedef struct {
     ParserNumType numType;      /* used to enforce correct number formatting */
 } LexRec, *LexPtr;
 
+extern LexRec xf86_lex_val;
+
 #ifndef TRUE
 #define TRUE 1
 #endif
@@ -90,7 +92,7 @@ typedef struct {
 #include "configProcs.h"
 #include <stdlib.h>
 
-#define TestFree(a) if (a) { free (a); a = NULL; }
+#define TestFree(a) if (a) { free ((void *) a); a = NULL; }
 
 #define parsePrologue(typeptr,typerec) typeptr ptr; \
 if( (ptr=calloc(1,sizeof(typerec))) == NULL ) { return NULL; }
index e8d2625..6be32d7 100644 (file)
 #include <xorg-config.h>
 #endif
 
+#include "os.h"
 #include "xf86Parser.h"
 #include "xf86tokens.h"
 #include "Configint.h"
 
-extern LexRec val;
 
 static xf86ConfigSymTabRec DRITab[] = {
     {ENDSECTION, "endsection"},
@@ -59,24 +59,24 @@ xf86parseDRISection(void)
         switch (token) {
         case GROUP:
             if ((token = xf86getSubToken(&(ptr->dri_comment))) == STRING)
-                ptr->dri_group_name = val.str;
+                ptr->dri_group_name = xf86_lex_val.str;
             else if (token == NUMBER)
-                ptr->dri_group = val.num;
+                ptr->dri_group = xf86_lex_val.num;
             else
                 Error(GROUP_MSG);
             break;
         case MODE:
             if (xf86getSubToken(&(ptr->dri_comment)) != NUMBER)
                 Error(NUMBER_MSG, "Mode");
-            if (val.numType != PARSE_OCTAL)
-                Error(MUST_BE_OCTAL_MSG, val.num);
-            ptr->dri_mode = val.num;
+            if (xf86_lex_val.numType != PARSE_OCTAL)
+                Error(MUST_BE_OCTAL_MSG, xf86_lex_val.num);
+            ptr->dri_mode = xf86_lex_val.num;
             break;
         case EOF_TOKEN:
             Error(UNEXPECTED_EOF_MSG);
             break;
         case COMMENT:
-            ptr->dri_comment = xf86addComment(ptr->dri_comment, val.str);
+            ptr->dri_comment = xf86addComment(ptr->dri_comment, xf86_lex_val.str);
             break;
         default:
             Error(INVALID_KEYWORD_MSG, xf86tokenString());
index bb1ba88..d3ac293 100644 (file)
@@ -60,7 +60,6 @@
 #include "xf86tokens.h"
 #include "Configint.h"
 
-extern LexRec val;
 
 static
 xf86ConfigSymTabRec DeviceTab[] = {
@@ -72,6 +71,7 @@ xf86ConfigSymTabRec DeviceTab[] = {
     {RAMDAC, "ramdac"},
     {DACSPEED, "dacspeed"},
     {CLOCKS, "clocks"},
+    {MATCHSEAT, "matchseat"},
     {OPTION, "option"},
     {VIDEORAM, "videoram"},
     {BIOSBASE, "biosbase"},
@@ -107,45 +107,45 @@ xf86parseDeviceSection(void)
     while ((token = xf86getToken(DeviceTab)) != ENDSECTION) {
         switch (token) {
         case COMMENT:
-            ptr->dev_comment = xf86addComment(ptr->dev_comment, val.str);
+            ptr->dev_comment = xf86addComment(ptr->dev_comment, xf86_lex_val.str);
             break;
         case IDENTIFIER:
             if (xf86getSubToken(&(ptr->dev_comment)) != STRING)
                 Error(QUOTE_MSG, "Identifier");
             if (has_ident == TRUE)
                 Error(MULTIPLE_MSG, "Identifier");
-            ptr->dev_identifier = val.str;
+            ptr->dev_identifier = xf86_lex_val.str;
             has_ident = TRUE;
             break;
         case VENDOR:
             if (xf86getSubToken(&(ptr->dev_comment)) != STRING)
                 Error(QUOTE_MSG, "Vendor");
-            ptr->dev_vendor = val.str;
+            ptr->dev_vendor = xf86_lex_val.str;
             break;
         case BOARD:
             if (xf86getSubToken(&(ptr->dev_comment)) != STRING)
                 Error(QUOTE_MSG, "Board");
-            ptr->dev_board = val.str;
+            ptr->dev_board = xf86_lex_val.str;
             break;
         case CHIPSET:
             if (xf86getSubToken(&(ptr->dev_comment)) != STRING)
                 Error(QUOTE_MSG, "Chipset");
-            ptr->dev_chipset = val.str;
+            ptr->dev_chipset = xf86_lex_val.str;
             break;
         case CARD:
             if (xf86getSubToken(&(ptr->dev_comment)) != STRING)
                 Error(QUOTE_MSG, "Card");
-            ptr->dev_card = val.str;
+            ptr->dev_card = xf86_lex_val.str;
             break;
         case DRIVER:
             if (xf86getSubToken(&(ptr->dev_comment)) != STRING)
                 Error(QUOTE_MSG, "Driver");
-            ptr->dev_driver = val.str;
+            ptr->dev_driver = xf86_lex_val.str;
             break;
         case RAMDAC:
             if (xf86getSubToken(&(ptr->dev_comment)) != STRING)
                 Error(QUOTE_MSG, "Ramdac");
-            ptr->dev_ramdac = val.str;
+            ptr->dev_ramdac = xf86_lex_val.str;
             break;
         case DACSPEED:
             for (i = 0; i < CONF_MAXDACSPEEDS; i++)
@@ -154,11 +154,11 @@ xf86parseDeviceSection(void)
                 Error(DACSPEED_MSG, CONF_MAXDACSPEEDS);
             }
             else {
-                ptr->dev_dacSpeeds[0] = (int) (val.realnum * 1000.0 + 0.5);
+                ptr->dev_dacSpeeds[0] = (int) (xf86_lex_val.realnum * 1000.0 + 0.5);
                 for (i = 1; i < CONF_MAXDACSPEEDS; i++) {
                     if (xf86getSubToken(&(ptr->dev_comment)) == NUMBER)
                         ptr->dev_dacSpeeds[i] = (int)
-                            (val.realnum * 1000.0 + 0.5);
+                            (xf86_lex_val.realnum * 1000.0 + 0.5);
                     else {
                         xf86unGetToken(token);
                         break;
@@ -169,44 +169,44 @@ xf86parseDeviceSection(void)
         case VIDEORAM:
             if (xf86getSubToken(&(ptr->dev_comment)) != NUMBER)
                 Error(NUMBER_MSG, "VideoRam");
-            ptr->dev_videoram = val.num;
+            ptr->dev_videoram = xf86_lex_val.num;
             break;
         case BIOSBASE:
             if (xf86getSubToken(&(ptr->dev_comment)) != NUMBER)
                 Error(NUMBER_MSG, "BIOSBase");
-            ptr->dev_bios_base = val.num;
+            ptr->dev_bios_base = xf86_lex_val.num;
             break;
         case MEMBASE:
             if (xf86getSubToken(&(ptr->dev_comment)) != NUMBER)
                 Error(NUMBER_MSG, "MemBase");
-            ptr->dev_mem_base = val.num;
+            ptr->dev_mem_base = xf86_lex_val.num;
             break;
         case IOBASE:
             if (xf86getSubToken(&(ptr->dev_comment)) != NUMBER)
                 Error(NUMBER_MSG, "IOBase");
-            ptr->dev_io_base = val.num;
+            ptr->dev_io_base = xf86_lex_val.num;
             break;
         case CLOCKCHIP:
             if (xf86getSubToken(&(ptr->dev_comment)) != STRING)
                 Error(QUOTE_MSG, "ClockChip");
-            ptr->dev_clockchip = val.str;
+            ptr->dev_clockchip = xf86_lex_val.str;
             break;
         case CHIPID:
             if (xf86getSubToken(&(ptr->dev_comment)) != NUMBER)
                 Error(NUMBER_MSG, "ChipID");
-            ptr->dev_chipid = val.num;
+            ptr->dev_chipid = xf86_lex_val.num;
             break;
         case CHIPREV:
             if (xf86getSubToken(&(ptr->dev_comment)) != NUMBER)
                 Error(NUMBER_MSG, "ChipRev");
-            ptr->dev_chiprev = val.num;
+            ptr->dev_chiprev = xf86_lex_val.num;
             break;
 
         case CLOCKS:
             token = xf86getSubToken(&(ptr->dev_comment));
             for (i = ptr->dev_clocks;
                  token == NUMBER && i < CONF_MAXCLOCKS; i++) {
-                ptr->dev_clock[i] = (int) (val.realnum * 1000.0 + 0.5);
+                ptr->dev_clock[i] = (int) (xf86_lex_val.realnum * 1000.0 + 0.5);
                 token = xf86getSubToken(&(ptr->dev_comment));
             }
             ptr->dev_clocks = i;
@@ -215,7 +215,12 @@ xf86parseDeviceSection(void)
         case TEXTCLOCKFRQ:
             if ((token = xf86getSubToken(&(ptr->dev_comment))) != NUMBER)
                 Error(NUMBER_MSG, "TextClockFreq");
-            ptr->dev_textclockfreq = (int) (val.realnum * 1000.0 + 0.5);
+            ptr->dev_textclockfreq = (int) (xf86_lex_val.realnum * 1000.0 + 0.5);
+            break;
+        case MATCHSEAT:
+            if (xf86getSubToken(&(ptr->dev_comment)) != STRING)
+                Error(QUOTE_MSG, "MatchSeat");
+            ptr->match_seat = xf86_lex_val.str;
             break;
         case OPTION:
             ptr->dev_option_lst = xf86parseOption(ptr->dev_option_lst);
@@ -223,17 +228,17 @@ xf86parseDeviceSection(void)
         case BUSID:
             if (xf86getSubToken(&(ptr->dev_comment)) != STRING)
                 Error(QUOTE_MSG, "BusID");
-            ptr->dev_busid = val.str;
+            ptr->dev_busid = xf86_lex_val.str;
             break;
         case IRQ:
             if (xf86getSubToken(&(ptr->dev_comment)) != NUMBER)
                 Error(QUOTE_MSG, "IRQ");
-            ptr->dev_irq = val.num;
+            ptr->dev_irq = xf86_lex_val.num;
             break;
         case SCREEN:
             if (xf86getSubToken(&(ptr->dev_comment)) != NUMBER)
                 Error(NUMBER_MSG, "Screen");
-            ptr->dev_screen = val.num;
+            ptr->dev_screen = xf86_lex_val.num;
             break;
         case EOF_TOKEN:
             Error(UNEXPECTED_EOF_MSG);
index ec0bda4..a6fcb56 100644 (file)
 #include <xorg-config.h>
 #endif
 
+#include "os.h"
 #include "xf86Parser.h"
 #include "xf86tokens.h"
 #include "Configint.h"
 
-extern LexRec val;
 
 static xf86ConfigSymTabRec ExtensionsTab[] = {
     {ENDSECTION, "endsection"},
@@ -66,7 +66,7 @@ xf86parseExtensionsSection(void)
             break;
         case COMMENT:
             ptr->extensions_comment =
-                xf86addComment(ptr->extensions_comment, val.str);
+                xf86addComment(ptr->extensions_comment, xf86_lex_val.str);
             break;
         default:
             Error(INVALID_KEYWORD_MSG, xf86tokenString());
index 0d3e47a..24940a9 100644 (file)
@@ -60,7 +60,6 @@
 #include "xf86tokens.h"
 #include "Configint.h"
 
-extern LexRec val;
 
 static xf86ConfigSymTabRec FilesTab[] = {
     {ENDSECTION, "endsection"},
@@ -89,16 +88,15 @@ xf86parseFilesSection(void)
         while ((token = xf86getToken(FilesTab)) != ENDSECTION) {
         switch (token) {
         case COMMENT:
-            ptr->file_comment = xf86addComment(ptr->file_comment, val.str);
+            ptr->file_comment = xf86addComment(ptr->file_comment, xf86_lex_val.str);
             break;
         case FONTPATH:
             if (xf86getSubToken(&(ptr->file_comment)) != STRING)
                 Error(QUOTE_MSG, "FontPath");
             j = FALSE;
-            str = val.str;
+            str = xf86_lex_val.str;
             if (ptr->file_fontpath == NULL) {
-                ptr->file_fontpath = malloc(1);
-                ptr->file_fontpath[0] = '\0';
+                ptr->file_fontpath = calloc(1, 1);
                 i = strlen(str) + 1;
             }
             else {
@@ -113,13 +111,13 @@ xf86parseFilesSection(void)
                 strcat(ptr->file_fontpath, ",");
 
             strcat(ptr->file_fontpath, str);
-            free(val.str);
+            free(xf86_lex_val.str);
             break;
         case MODULEPATH:
             if (xf86getSubToken(&(ptr->file_comment)) != STRING)
                 Error(QUOTE_MSG, "ModulePath");
             l = FALSE;
-            str = val.str;
+            str = xf86_lex_val.str;
             if (ptr->file_modulepath == NULL) {
                 ptr->file_modulepath = malloc(1);
                 ptr->file_modulepath[0] = '\0';
@@ -138,17 +136,17 @@ xf86parseFilesSection(void)
                 strcat(ptr->file_modulepath, ",");
 
             strcat(ptr->file_modulepath, str);
-            free(val.str);
+            free(xf86_lex_val.str);
             break;
         case LOGFILEPATH:
             if (xf86getSubToken(&(ptr->file_comment)) != STRING)
                 Error(QUOTE_MSG, "LogFile");
-            ptr->file_logfile = val.str;
+            ptr->file_logfile = xf86_lex_val.str;
             break;
         case XKBDIR:
             if (xf86getSubToken(&(ptr->file_xkbdir)) != STRING)
                 Error(QUOTE_MSG, "XkbDir");
-            ptr->file_xkbdir = val.str;
+            ptr->file_xkbdir = xf86_lex_val.str;
             break;
         case EOF_TOKEN:
             Error(UNEXPECTED_EOF_MSG);
index 2461476..71b50ac 100644 (file)
@@ -62,7 +62,6 @@
 #include "Xprintf.h"
 #include "optionstr.h"
 
-extern LexRec val;
 
 static xf86ConfigSymTabRec ServerFlagsTab[] = {
     {ENDSECTION, "endsection"},
@@ -99,7 +98,7 @@ xf86parseFlagsSection(void)
 
         switch (token) {
         case COMMENT:
-            ptr->flg_comment = xf86addComment(ptr->flg_comment, val.str);
+            ptr->flg_comment = xf86addComment(ptr->flg_comment, xf86_lex_val.str);
             break;
             /* 
              * these old keywords are turned into standard generic options.
@@ -135,12 +134,12 @@ xf86parseFlagsSection(void)
                         if (strvalue) {
                             if (tokentype != STRING)
                                 Error(QUOTE_MSG, tmp);
-                            valstr = val.str;
+                            valstr = xf86_lex_val.str;
                         }
                         else {
                             if (tokentype != NUMBER)
                                 Error(NUMBER_MSG, tmp);
-                            if (asprintf(&valstr, "%d", val.num) == -1)
+                            if (asprintf(&valstr, "%d", xf86_lex_val.num) == -1)
                                 valstr = NULL;
                         }
                     }
@@ -189,7 +188,7 @@ xf86printServerFlagsSection(FILE * f, XF86ConfFlagsPtr flags)
 }
 
 static XF86OptionPtr
-addNewOption2(XF86OptionPtr head, char *name, char *val, int used)
+addNewOption2(XF86OptionPtr head, char *name, char *_val, int used)
 {
     XF86OptionPtr new, old = NULL;
 
@@ -202,7 +201,7 @@ addNewOption2(XF86OptionPtr head, char *name, char *val, int used)
     else
         new = calloc(1, sizeof(*new));
     new->opt_name = name;
-    new->opt_val = val;
+    new->opt_val = _val;
     new->opt_used = used;
 
     if (old)
@@ -211,9 +210,9 @@ addNewOption2(XF86OptionPtr head, char *name, char *val, int used)
 }
 
 XF86OptionPtr
-xf86addNewOption(XF86OptionPtr head, char *name, char *val)
+xf86addNewOption(XF86OptionPtr head, char *name, char *_val)
 {
-    return addNewOption2(head, name, val, 0);
+    return addNewOption2(head, name, _val, 0);
 }
 
 void
@@ -230,11 +229,11 @@ XF86OptionPtr
 xf86optionListDup(XF86OptionPtr opt)
 {
     XF86OptionPtr newopt = NULL;
-    char *val;
+    char *_val;
 
     while (opt) {
-        val = opt->opt_val ? strdup(opt->opt_val) : NULL;
-        newopt = xf86addNewOption(newopt, strdup(opt->opt_name), val);
+        _val = opt->opt_val ? strdup(opt->opt_val) : NULL;
+        newopt = xf86addNewOption(newopt, strdup(opt->opt_name), _val);
         newopt->opt_used = opt->opt_used;
         if (opt->opt_comment)
             newopt->opt_comment = strdup(opt->opt_comment);
@@ -435,12 +434,12 @@ xf86parseOption(XF86OptionPtr head)
         return head;
     }
 
-    name = val.str;
+    name = xf86_lex_val.str;
     if ((token = xf86getSubToken(&comment)) == STRING) {
-        option = xf86newOption(name, val.str);
+        option = xf86newOption(name, xf86_lex_val.str);
         option->opt_comment = comment;
         if ((token = xf86getToken(NULL)) == COMMENT)
-            option->opt_comment = xf86addComment(option->opt_comment, val.str);
+            option->opt_comment = xf86addComment(option->opt_comment, xf86_lex_val.str);
         else
             xf86unGetToken(token);
     }
@@ -448,7 +447,7 @@ xf86parseOption(XF86OptionPtr head)
         option = xf86newOption(name, NULL);
         option->opt_comment = comment;
         if (token == COMMENT)
-            option->opt_comment = xf86addComment(option->opt_comment, val.str);
+            option->opt_comment = xf86addComment(option->opt_comment, xf86_lex_val.str);
         else
             xf86unGetToken(token);
     }
index ff2b9ac..1bfe5c1 100644 (file)
@@ -61,7 +61,6 @@
 #include "xf86tokens.h"
 #include "Configint.h"
 
-extern LexRec val;
 
 static
 xf86ConfigSymTabRec InputTab[] = {
@@ -85,25 +84,25 @@ xf86parseInputSection(void)
         while ((token = xf86getToken(InputTab)) != ENDSECTION) {
         switch (token) {
         case COMMENT:
-            ptr->inp_comment = xf86addComment(ptr->inp_comment, val.str);
+            ptr->inp_comment = xf86addComment(ptr->inp_comment, xf86_lex_val.str);
             break;
         case IDENTIFIER:
             if (xf86getSubToken(&(ptr->inp_comment)) != STRING)
                 Error(QUOTE_MSG, "Identifier");
             if (has_ident == TRUE)
                 Error(MULTIPLE_MSG, "Identifier");
-            ptr->inp_identifier = val.str;
+            ptr->inp_identifier = xf86_lex_val.str;
             has_ident = TRUE;
             break;
         case DRIVER:
             if (xf86getSubToken(&(ptr->inp_comment)) != STRING)
                 Error(QUOTE_MSG, "Driver");
-            if (strcmp(val.str, "keyboard") == 0) {
+            if (strcmp(xf86_lex_val.str, "keyboard") == 0) {
                 ptr->inp_driver = strdup("kbd");
-                free(val.str);
+                free(xf86_lex_val.str);
             }
             else
-                ptr->inp_driver = val.str;
+                ptr->inp_driver = xf86_lex_val.str;
             break;
         case OPTION:
             ptr->inp_option_lst = xf86parseOption(ptr->inp_option_lst);
index de6a816..c2fbd22 100644 (file)
@@ -33,7 +33,6 @@
 #include "xf86tokens.h"
 #include "Configint.h"
 
-extern LexRec val;
 
 static
 xf86ConfigSymTabRec InputClassTab[] = {
@@ -97,25 +96,25 @@ xf86parseInputClassSection(void)
     while ((token = xf86getToken(InputClassTab)) != ENDSECTION) {
         switch (token) {
         case COMMENT:
-            ptr->comment = xf86addComment(ptr->comment, val.str);
+            ptr->comment = xf86addComment(ptr->comment, xf86_lex_val.str);
             break;
         case IDENTIFIER:
             if (xf86getSubToken(&(ptr->comment)) != STRING)
                 Error(QUOTE_MSG, "Identifier");
             if (has_ident == TRUE)
                 Error(MULTIPLE_MSG, "Identifier");
-            ptr->identifier = val.str;
+            ptr->identifier = xf86_lex_val.str;
             has_ident = TRUE;
             break;
         case DRIVER:
             if (xf86getSubToken(&(ptr->comment)) != STRING)
                 Error(QUOTE_MSG, "Driver");
-            if (strcmp(val.str, "keyboard") == 0) {
+            if (strcmp(xf86_lex_val.str, "keyboard") == 0) {
                 ptr->driver = strdup("kbd");
-                free(val.str);
+                free(xf86_lex_val.str);
             }
             else
-                ptr->driver = val.str;
+                ptr->driver = xf86_lex_val.str;
             break;
         case OPTION:
             ptr->option_lst = xf86parseOption(ptr->option_lst);
@@ -124,69 +123,69 @@ xf86parseInputClassSection(void)
             if (xf86getSubToken(&(ptr->comment)) != STRING)
                 Error(QUOTE_MSG, "MatchProduct");
             add_group_entry(&ptr->match_product,
-                            xstrtokenize(val.str, TOKEN_SEP));
-            free(val.str);
+                            xstrtokenize(xf86_lex_val.str, TOKEN_SEP));
+            free(xf86_lex_val.str);
             break;
         case MATCH_VENDOR:
             if (xf86getSubToken(&(ptr->comment)) != STRING)
                 Error(QUOTE_MSG, "MatchVendor");
             add_group_entry(&ptr->match_vendor,
-                            xstrtokenize(val.str, TOKEN_SEP));
-            free(val.str);
+                            xstrtokenize(xf86_lex_val.str, TOKEN_SEP));
+            free(xf86_lex_val.str);
             break;
         case MATCH_DEVICE_PATH:
             if (xf86getSubToken(&(ptr->comment)) != STRING)
                 Error(QUOTE_MSG, "MatchDevicePath");
             add_group_entry(&ptr->match_device,
-                            xstrtokenize(val.str, TOKEN_SEP));
-            free(val.str);
+                            xstrtokenize(xf86_lex_val.str, TOKEN_SEP));
+            free(xf86_lex_val.str);
             break;
         case MATCH_OS:
             if (xf86getSubToken(&(ptr->comment)) != STRING)
                 Error(QUOTE_MSG, "MatchOS");
-            add_group_entry(&ptr->match_os, xstrtokenize(val.str, TOKEN_SEP));
-            free(val.str);
+            add_group_entry(&ptr->match_os, xstrtokenize(xf86_lex_val.str, TOKEN_SEP));
+            free(xf86_lex_val.str);
             break;
         case MATCH_PNPID:
             if (xf86getSubToken(&(ptr->comment)) != STRING)
                 Error(QUOTE_MSG, "MatchPnPID");
             add_group_entry(&ptr->match_pnpid,
-                            xstrtokenize(val.str, TOKEN_SEP));
-            free(val.str);
+                            xstrtokenize(xf86_lex_val.str, TOKEN_SEP));
+            free(xf86_lex_val.str);
             break;
         case MATCH_USBID:
             if (xf86getSubToken(&(ptr->comment)) != STRING)
                 Error(QUOTE_MSG, "MatchUSBID");
             add_group_entry(&ptr->match_usbid,
-                            xstrtokenize(val.str, TOKEN_SEP));
-            free(val.str);
+                            xstrtokenize(xf86_lex_val.str, TOKEN_SEP));
+            free(xf86_lex_val.str);
             break;
         case MATCH_DRIVER:
             if (xf86getSubToken(&(ptr->comment)) != STRING)
                 Error(QUOTE_MSG, "MatchDriver");
             add_group_entry(&ptr->match_driver,
-                            xstrtokenize(val.str, TOKEN_SEP));
-            free(val.str);
+                            xstrtokenize(xf86_lex_val.str, TOKEN_SEP));
+            free(xf86_lex_val.str);
             break;
         case MATCH_TAG:
             if (xf86getSubToken(&(ptr->comment)) != STRING)
                 Error(QUOTE_MSG, "MatchTag");
-            add_group_entry(&ptr->match_tag, xstrtokenize(val.str, TOKEN_SEP));
-            free(val.str);
+            add_group_entry(&ptr->match_tag, xstrtokenize(xf86_lex_val.str, TOKEN_SEP));
+            free(xf86_lex_val.str);
             break;
         case MATCH_LAYOUT:
             if (xf86getSubToken(&(ptr->comment)) != STRING)
                 Error(QUOTE_MSG, "MatchLayout");
             add_group_entry(&ptr->match_layout,
-                            xstrtokenize(val.str, TOKEN_SEP));
-            free(val.str);
+                            xstrtokenize(xf86_lex_val.str, TOKEN_SEP));
+            free(xf86_lex_val.str);
             break;
         case MATCH_IS_KEYBOARD:
             if (xf86getSubToken(&(ptr->comment)) != STRING)
                 Error(QUOTE_MSG, "MatchIsKeyboard");
             ptr->is_keyboard.set = xf86getBoolValue(&ptr->is_keyboard.val,
-                                                    val.str);
-            free(val.str);
+                                                    xf86_lex_val.str);
+            free(xf86_lex_val.str);
             if (!ptr->is_keyboard.set)
                 Error(BOOL_MSG, "MatchIsKeyboard");
             break;
@@ -194,8 +193,8 @@ xf86parseInputClassSection(void)
             if (xf86getSubToken(&(ptr->comment)) != STRING)
                 Error(QUOTE_MSG, "MatchIsPointer");
             ptr->is_pointer.set = xf86getBoolValue(&ptr->is_pointer.val,
-                                                   val.str);
-            free(val.str);
+                                                   xf86_lex_val.str);
+            free(xf86_lex_val.str);
             if (!ptr->is_pointer.set)
                 Error(BOOL_MSG, "MatchIsPointer");
             break;
@@ -203,16 +202,16 @@ xf86parseInputClassSection(void)
             if (xf86getSubToken(&(ptr->comment)) != STRING)
                 Error(QUOTE_MSG, "MatchIsJoystick");
             ptr->is_joystick.set = xf86getBoolValue(&ptr->is_joystick.val,
-                                                    val.str);
-            free(val.str);
+                                                    xf86_lex_val.str);
+            free(xf86_lex_val.str);
             if (!ptr->is_joystick.set)
                 Error(BOOL_MSG, "MatchIsJoystick");
             break;
         case MATCH_IS_TABLET:
             if (xf86getSubToken(&(ptr->comment)) != STRING)
                 Error(QUOTE_MSG, "MatchIsTablet");
-            ptr->is_tablet.set = xf86getBoolValue(&ptr->is_tablet.val, val.str);
-            free(val.str);
+            ptr->is_tablet.set = xf86getBoolValue(&ptr->is_tablet.val, xf86_lex_val.str);
+            free(xf86_lex_val.str);
             if (!ptr->is_tablet.set)
                 Error(BOOL_MSG, "MatchIsTablet");
             break;
@@ -220,8 +219,8 @@ xf86parseInputClassSection(void)
             if (xf86getSubToken(&(ptr->comment)) != STRING)
                 Error(QUOTE_MSG, "MatchIsTouchpad");
             ptr->is_touchpad.set = xf86getBoolValue(&ptr->is_touchpad.val,
-                                                    val.str);
-            free(val.str);
+                                                    xf86_lex_val.str);
+            free(xf86_lex_val.str);
             if (!ptr->is_touchpad.set)
                 Error(BOOL_MSG, "MatchIsTouchpad");
             break;
@@ -229,8 +228,8 @@ xf86parseInputClassSection(void)
             if (xf86getSubToken(&(ptr->comment)) != STRING)
                 Error(QUOTE_MSG, "MatchIsTouchscreen");
             ptr->is_touchscreen.set = xf86getBoolValue(&ptr->is_touchscreen.val,
-                                                       val.str);
-            free(val.str);
+                                                       xf86_lex_val.str);
+            free(xf86_lex_val.str);
             if (!ptr->is_touchscreen.set)
                 Error(BOOL_MSG, "MatchIsTouchscreen");
             break;
index cbd8d24..994b31a 100644 (file)
 /* Needed for auto server layout */
 extern int xf86CheckBoolOption(void *optlist, const char *name, int deflt);
 
-extern LexRec val;
 
 static xf86ConfigSymTabRec LayoutTab[] = {
     {ENDSECTION, "endsection"},
     {SCREEN, "screen"},
     {IDENTIFIER, "identifier"},
+    {MATCHSEAT, "matchseat"},
     {INACTIVE, "inactive"},
     {INPUTDEVICE, "inputdevice"},
     {OPTION, "option"},
@@ -100,16 +100,21 @@ xf86parseLayoutSection(void)
         while ((token = xf86getToken(LayoutTab)) != ENDSECTION) {
         switch (token) {
         case COMMENT:
-            ptr->lay_comment = xf86addComment(ptr->lay_comment, val.str);
+            ptr->lay_comment = xf86addComment(ptr->lay_comment, xf86_lex_val.str);
             break;
         case IDENTIFIER:
             if (xf86getSubToken(&(ptr->lay_comment)) != STRING)
                 Error(QUOTE_MSG, "Identifier");
             if (has_ident == TRUE)
                 Error(MULTIPLE_MSG, "Identifier");
-            ptr->lay_identifier = val.str;
+            ptr->lay_identifier = xf86_lex_val.str;
             has_ident = TRUE;
             break;
+        case MATCHSEAT:
+            if (xf86getSubToken(&(ptr->lay_comment)) != STRING)
+                Error(QUOTE_MSG, "MatchSeat");
+            ptr->match_seat = xf86_lex_val.str;
+            break;
         case INACTIVE:
         {
             XF86ConfInactivePtr iptr;
@@ -120,7 +125,7 @@ xf86parseLayoutSection(void)
                 free(iptr);
                 Error(INACTIVE_MSG);
             }
-            iptr->inactive_device_str = val.str;
+            iptr->inactive_device_str = xf86_lex_val.str;
             ptr->lay_inactive_lst = (XF86ConfInactivePtr)
                 xf86addListItem((glp) ptr->lay_inactive_lst, (glp) iptr);
         }
@@ -138,7 +143,7 @@ xf86parseLayoutSection(void)
             aptr->adj_y = 0;
             aptr->adj_refscreen = NULL;
             if ((token = xf86getSubToken(&(ptr->lay_comment))) == NUMBER)
-                aptr->adj_scrnum = val.num;
+                aptr->adj_scrnum = xf86_lex_val.num;
             else
                 xf86unGetToken(token);
             token = xf86getSubToken(&(ptr->lay_comment));
@@ -146,7 +151,7 @@ xf86parseLayoutSection(void)
                 free(aptr);
                 Error(SCREEN_MSG);
             }
-            aptr->adj_screen_str = val.str;
+            aptr->adj_screen_str = xf86_lex_val.str;
 
             token = xf86getSubTokenWithTab(&(ptr->lay_comment), AdjTab);
             switch (token) {
@@ -186,13 +191,13 @@ xf86parseLayoutSection(void)
                 if (absKeyword)
                     token = xf86getSubToken(&(ptr->lay_comment));
                 if (token == NUMBER) {
-                    aptr->adj_x = val.num;
+                    aptr->adj_x = xf86_lex_val.num;
                     token = xf86getSubToken(&(ptr->lay_comment));
                     if (token != NUMBER) {
                         free(aptr);
                         Error(INVALID_SCR_MSG);
                     }
-                    aptr->adj_y = val.num;
+                    aptr->adj_y = xf86_lex_val.num;
                 }
                 else {
                     if (absKeyword) {
@@ -213,46 +218,46 @@ xf86parseLayoutSection(void)
                     free(aptr);
                     Error(INVALID_SCR_MSG);
                 }
-                aptr->adj_refscreen = val.str;
+                aptr->adj_refscreen = xf86_lex_val.str;
                 if (aptr->adj_where == CONF_ADJ_RELATIVE) {
                     token = xf86getSubToken(&(ptr->lay_comment));
                     if (token != NUMBER) {
                         free(aptr);
                         Error(INVALID_SCR_MSG);
                     }
-                    aptr->adj_x = val.num;
+                    aptr->adj_x = xf86_lex_val.num;
                     token = xf86getSubToken(&(ptr->lay_comment));
                     if (token != NUMBER) {
                         free(aptr);
                         Error(INVALID_SCR_MSG);
                     }
-                    aptr->adj_y = val.num;
+                    aptr->adj_y = xf86_lex_val.num;
                 }
                 break;
             case CONF_ADJ_OBSOLETE:
                 /* top */
-                aptr->adj_top_str = val.str;
+                aptr->adj_top_str = xf86_lex_val.str;
 
                 /* bottom */
                 if (xf86getSubToken(&(ptr->lay_comment)) != STRING) {
                     free(aptr);
                     Error(SCREEN_MSG);
                 }
-                aptr->adj_bottom_str = val.str;
+                aptr->adj_bottom_str = xf86_lex_val.str;
 
                 /* left */
                 if (xf86getSubToken(&(ptr->lay_comment)) != STRING) {
                     free(aptr);
                     Error(SCREEN_MSG);
                 }
-                aptr->adj_left_str = val.str;
+                aptr->adj_left_str = xf86_lex_val.str;
 
                 /* right */
                 if (xf86getSubToken(&(ptr->lay_comment)) != STRING) {
                     free(aptr);
                     Error(SCREEN_MSG);
                 }
-                aptr->adj_right_str = val.str;
+                aptr->adj_right_str = xf86_lex_val.str;
 
             }
             ptr->lay_adjacency_lst = (XF86ConfAdjacencyPtr)
@@ -270,10 +275,10 @@ xf86parseLayoutSection(void)
                 free(iptr);
                 Error(INPUTDEV_MSG);
             }
-            iptr->iref_inputdev_str = val.str;
+            iptr->iref_inputdev_str = xf86_lex_val.str;
             while ((token = xf86getSubToken(&(ptr->lay_comment))) == STRING) {
                 iptr->iref_option_lst =
-                    xf86addNewOption(iptr->iref_option_lst, val.str, NULL);
+                    xf86addNewOption(iptr->iref_option_lst, xf86_lex_val.str, NULL);
             }
             xf86unGetToken(token);
             ptr->lay_input_lst = (XF86ConfInputrefPtr)
index 002cfbf..4d0bb4f 100644 (file)
@@ -14,6 +14,7 @@ INTERNAL_SOURCES= \
        Flags.c \
        Input.c \
        InputClass.c \
+       OutputClass.c \
        Layout.c \
        Module.c \
        Video.c \
@@ -51,4 +52,4 @@ sdk_HEADERS = \
        xf86Parser.h \
        xf86Optrec.h
 
-INCLUDES = -I$(srcdir)/../common
+AM_CPPFLAGS = -I$(srcdir)/../common
index 87ddfc6..e2d9120 100644 (file)
@@ -60,7 +60,6 @@
 #include "xf86tokens.h"
 #include "Configint.h"
 
-extern LexRec val;
 
 static xf86ConfigSymTabRec SubModuleTab[] = {
     {ENDSUBSECTION, "endsubsection"},
@@ -95,7 +94,7 @@ xf86parseModuleSubSection(XF86LoadPtr head, char *name)
     while ((token = xf86getToken(SubModuleTab)) != ENDSUBSECTION) {
         switch (token) {
         case COMMENT:
-            ptr->load_comment = xf86addComment(ptr->load_comment, val.str);
+            ptr->load_comment = xf86addComment(ptr->load_comment, xf86_lex_val.str);
             break;
         case OPTION:
             ptr->load_opt = xf86parseOption(ptr->load_opt);
@@ -126,34 +125,34 @@ xf86parseModuleSection(void)
         while ((token = xf86getToken(ModuleTab)) != ENDSECTION) {
         switch (token) {
         case COMMENT:
-            ptr->mod_comment = xf86addComment(ptr->mod_comment, val.str);
+            ptr->mod_comment = xf86addComment(ptr->mod_comment, xf86_lex_val.str);
             break;
         case LOAD:
             if (xf86getSubToken(&(ptr->mod_comment)) != STRING)
                 Error(QUOTE_MSG, "Load");
             ptr->mod_load_lst =
-                xf86addNewLoadDirective(ptr->mod_load_lst, val.str,
+                xf86addNewLoadDirective(ptr->mod_load_lst, xf86_lex_val.str,
                                         XF86_LOAD_MODULE, NULL);
             break;
         case DISABLE:
             if (xf86getSubToken(&(ptr->mod_comment)) != STRING)
                 Error(QUOTE_MSG, "Disable");
             ptr->mod_disable_lst =
-                xf86addNewLoadDirective(ptr->mod_disable_lst, val.str,
+                xf86addNewLoadDirective(ptr->mod_disable_lst, xf86_lex_val.str,
                                         XF86_DISABLE_MODULE, NULL);
             break;
         case LOAD_DRIVER:
             if (xf86getSubToken(&(ptr->mod_comment)) != STRING)
                 Error(QUOTE_MSG, "LoadDriver");
             ptr->mod_load_lst =
-                xf86addNewLoadDirective(ptr->mod_load_lst, val.str,
+                xf86addNewLoadDirective(ptr->mod_load_lst, xf86_lex_val.str,
                                         XF86_LOAD_DRIVER, NULL);
             break;
         case SUBSECTION:
             if (xf86getSubToken(&(ptr->mod_comment)) != STRING)
                 Error(QUOTE_MSG, "SubSection");
             ptr->mod_load_lst =
-                xf86parseModuleSubSection(ptr->mod_load_lst, val.str);
+                xf86parseModuleSubSection(ptr->mod_load_lst, xf86_lex_val.str);
             break;
         case EOF_TOKEN:
             Error(UNEXPECTED_EOF_MSG);
@@ -218,7 +217,7 @@ xf86printModuleSection(FILE * cf, XF86ConfModulePtr ptr)
 }
 
 XF86LoadPtr
-xf86addNewLoadDirective(XF86LoadPtr head, char *name, int type,
+xf86addNewLoadDirective(XF86LoadPtr head, const char *name, int type,
                         XF86OptionPtr opts)
 {
     XF86LoadPtr new;
@@ -232,7 +231,7 @@ xf86addNewLoadDirective(XF86LoadPtr head, char *name, int type,
     new->list.next = NULL;
 
     if ((token = xf86getToken(NULL)) == COMMENT)
-        new->load_comment = xf86addComment(new->load_comment, val.str);
+        new->load_comment = xf86addComment(new->load_comment, xf86_lex_val.str);
     else
         xf86unGetToken(token);
 
index 36b4ebe..8aebce0 100644 (file)
@@ -60,7 +60,6 @@
 #include "xf86tokens.h"
 #include "Configint.h"
 
-extern LexRec val;
 
 static xf86ConfigSymTabRec MonitorTab[] = {
     {ENDSECTION, "endsection"},
@@ -140,52 +139,52 @@ xf86parseModeLine(void)
         /* Identifier */
         if (xf86getSubToken(&(ptr->ml_comment)) != STRING)
         Error("ModeLine identifier expected");
-    ptr->ml_identifier = val.str;
+    ptr->ml_identifier = xf86_lex_val.str;
 
     /* DotClock */
     if (xf86getSubToken(&(ptr->ml_comment)) != NUMBER)
         Error("ModeLine dotclock expected");
-    ptr->ml_clock = (int) (val.realnum * 1000.0 + 0.5);
+    ptr->ml_clock = (int) (xf86_lex_val.realnum * 1000.0 + 0.5);
 
     /* HDisplay */
     if (xf86getSubToken(&(ptr->ml_comment)) != NUMBER)
         Error("ModeLine Hdisplay expected");
-    ptr->ml_hdisplay = val.num;
+    ptr->ml_hdisplay = xf86_lex_val.num;
 
     /* HSyncStart */
     if (xf86getSubToken(&(ptr->ml_comment)) != NUMBER)
         Error("ModeLine HSyncStart expected");
-    ptr->ml_hsyncstart = val.num;
+    ptr->ml_hsyncstart = xf86_lex_val.num;
 
     /* HSyncEnd */
     if (xf86getSubToken(&(ptr->ml_comment)) != NUMBER)
         Error("ModeLine HSyncEnd expected");
-    ptr->ml_hsyncend = val.num;
+    ptr->ml_hsyncend = xf86_lex_val.num;
 
     /* HTotal */
     if (xf86getSubToken(&(ptr->ml_comment)) != NUMBER)
         Error("ModeLine HTotal expected");
-    ptr->ml_htotal = val.num;
+    ptr->ml_htotal = xf86_lex_val.num;
 
     /* VDisplay */
     if (xf86getSubToken(&(ptr->ml_comment)) != NUMBER)
         Error("ModeLine Vdisplay expected");
-    ptr->ml_vdisplay = val.num;
+    ptr->ml_vdisplay = xf86_lex_val.num;
 
     /* VSyncStart */
     if (xf86getSubToken(&(ptr->ml_comment)) != NUMBER)
         Error("ModeLine VSyncStart expected");
-    ptr->ml_vsyncstart = val.num;
+    ptr->ml_vsyncstart = xf86_lex_val.num;
 
     /* VSyncEnd */
     if (xf86getSubToken(&(ptr->ml_comment)) != NUMBER)
         Error("ModeLine VSyncEnd expected");
-    ptr->ml_vsyncend = val.num;
+    ptr->ml_vsyncend = xf86_lex_val.num;
 
     /* VTotal */
     if (xf86getSubToken(&(ptr->ml_comment)) != NUMBER)
         Error("ModeLine VTotal expected");
-    ptr->ml_vtotal = val.num;
+    ptr->ml_vtotal = xf86_lex_val.num;
 
     token = xf86getSubTokenWithTab(&(ptr->ml_comment), TimingTab);
     while ((token == TT_INTERLACE) || (token == TT_PHSYNC) ||
@@ -226,7 +225,7 @@ xf86parseModeLine(void)
         case TT_HSKEW:
             if (xf86getSubToken(&(ptr->ml_comment)) != NUMBER)
                 Error(NUMBER_MSG, "Hskew");
-            ptr->ml_hskew = val.num;
+            ptr->ml_hskew = xf86_lex_val.num;
             ptr->ml_flags |= XF86CONF_HSKEW;
             break;
         case TT_BCAST:
@@ -235,7 +234,7 @@ xf86parseModeLine(void)
         case TT_VSCAN:
             if (xf86getSubToken(&(ptr->ml_comment)) != NUMBER)
                 Error(NUMBER_MSG, "Vscan");
-            ptr->ml_vscan = val.num;
+            ptr->ml_vscan = xf86_lex_val.num;
             ptr->ml_flags |= XF86CONF_VSCAN;
             break;
         case EOF_TOKEN:
@@ -265,58 +264,58 @@ xf86parseVerboseMode(void)
 
         if (xf86getSubToken(&(ptr->ml_comment)) != STRING)
         Error("Mode name expected");
-    ptr->ml_identifier = val.str;
+    ptr->ml_identifier = xf86_lex_val.str;
     while ((token = xf86getToken(ModeTab)) != ENDMODE) {
         switch (token) {
         case COMMENT:
-            ptr->ml_comment = xf86addComment(ptr->ml_comment, val.str);
+            ptr->ml_comment = xf86addComment(ptr->ml_comment, xf86_lex_val.str);
             break;
         case DOTCLOCK:
             if ((token = xf86getSubToken(&(ptr->ml_comment))) != NUMBER)
                 Error(NUMBER_MSG, "DotClock");
-            ptr->ml_clock = (int) (val.realnum * 1000.0 + 0.5);
+            ptr->ml_clock = (int) (xf86_lex_val.realnum * 1000.0 + 0.5);
             had_dotclock = 1;
             break;
         case HTIMINGS:
             if (xf86getSubToken(&(ptr->ml_comment)) == NUMBER)
-                ptr->ml_hdisplay = val.num;
+                ptr->ml_hdisplay = xf86_lex_val.num;
             else
                 Error("Horizontal display expected");
 
             if (xf86getSubToken(&(ptr->ml_comment)) == NUMBER)
-                ptr->ml_hsyncstart = val.num;
+                ptr->ml_hsyncstart = xf86_lex_val.num;
             else
                 Error("Horizontal sync start expected");
 
             if (xf86getSubToken(&(ptr->ml_comment)) == NUMBER)
-                ptr->ml_hsyncend = val.num;
+                ptr->ml_hsyncend = xf86_lex_val.num;
             else
                 Error("Horizontal sync end expected");
 
             if (xf86getSubToken(&(ptr->ml_comment)) == NUMBER)
-                ptr->ml_htotal = val.num;
+                ptr->ml_htotal = xf86_lex_val.num;
             else
                 Error("Horizontal total expected");
             had_htimings = 1;
             break;
         case VTIMINGS:
             if (xf86getSubToken(&(ptr->ml_comment)) == NUMBER)
-                ptr->ml_vdisplay = val.num;
+                ptr->ml_vdisplay = xf86_lex_val.num;
             else
                 Error("Vertical display expected");
 
             if (xf86getSubToken(&(ptr->ml_comment)) == NUMBER)
-                ptr->ml_vsyncstart = val.num;
+                ptr->ml_vsyncstart = xf86_lex_val.num;
             else
                 Error("Vertical sync start expected");
 
             if (xf86getSubToken(&(ptr->ml_comment)) == NUMBER)
-                ptr->ml_vsyncend = val.num;
+                ptr->ml_vsyncend = xf86_lex_val.num;
             else
                 Error("Vertical sync end expected");
 
             if (xf86getSubToken(&(ptr->ml_comment)) == NUMBER)
-                ptr->ml_vtotal = val.num;
+                ptr->ml_vtotal = xf86_lex_val.num;
             else
                 Error("Vertical total expected");
             had_vtimings = 1;
@@ -370,13 +369,13 @@ xf86parseVerboseMode(void)
             if (xf86getSubToken(&(ptr->ml_comment)) != NUMBER)
                 Error("Horizontal skew expected");
             ptr->ml_flags |= XF86CONF_HSKEW;
-            ptr->ml_hskew = val.num;
+            ptr->ml_hskew = xf86_lex_val.num;
             break;
         case VSCAN:
             if (xf86getSubToken(&(ptr->ml_comment)) != NUMBER)
                 Error("Vertical scan count expected");
             ptr->ml_flags |= XF86CONF_VSCAN;
-            ptr->ml_vscan = val.num;
+            ptr->ml_vscan = xf86_lex_val.num;
             break;
         case EOF_TOKEN:
             Error(UNEXPECTED_EOF_MSG);
@@ -413,25 +412,25 @@ xf86parseMonitorSection(void)
         while ((token = xf86getToken(MonitorTab)) != ENDSECTION) {
         switch (token) {
         case COMMENT:
-            ptr->mon_comment = xf86addComment(ptr->mon_comment, val.str);
+            ptr->mon_comment = xf86addComment(ptr->mon_comment, xf86_lex_val.str);
             break;
         case IDENTIFIER:
             if (xf86getSubToken(&(ptr->mon_comment)) != STRING)
                 Error(QUOTE_MSG, "Identifier");
             if (has_ident == TRUE)
                 Error(MULTIPLE_MSG, "Identifier");
-            ptr->mon_identifier = val.str;
+            ptr->mon_identifier = xf86_lex_val.str;
             has_ident = TRUE;
             break;
         case VENDOR:
             if (xf86getSubToken(&(ptr->mon_comment)) != STRING)
                 Error(QUOTE_MSG, "Vendor");
-            ptr->mon_vendor = val.str;
+            ptr->mon_vendor = xf86_lex_val.str;
             break;
         case MODEL:
             if (xf86getSubToken(&(ptr->mon_comment)) != STRING)
                 Error(QUOTE_MSG, "ModelName");
-            ptr->mon_modelname = val.str;
+            ptr->mon_modelname = xf86_lex_val.str;
             break;
         case MODE:
             HANDLE_LIST(mon_modeline_lst, xf86parseVerboseMode,
@@ -444,10 +443,10 @@ xf86parseMonitorSection(void)
         case DISPLAYSIZE:
             if (xf86getSubToken(&(ptr->mon_comment)) != NUMBER)
                 Error(DISPLAYSIZE_MSG);
-            ptr->mon_width = val.realnum;
+            ptr->mon_width = xf86_lex_val.realnum;
             if (xf86getSubToken(&(ptr->mon_comment)) != NUMBER)
                 Error(DISPLAYSIZE_MSG);
-            ptr->mon_height = val.realnum;
+            ptr->mon_height = xf86_lex_val.realnum;
             break;
 
         case HORIZSYNC:
@@ -456,7 +455,7 @@ xf86parseMonitorSection(void)
             do {
                 if (ptr->mon_n_hsync >= CONF_MAX_HSYNC)
                     Error("Sorry. Too many horizontal sync intervals.");
-                ptr->mon_hsync[ptr->mon_n_hsync].lo = val.realnum;
+                ptr->mon_hsync[ptr->mon_n_hsync].lo = xf86_lex_val.realnum;
                 switch (token = xf86getSubToken(&(ptr->mon_comment))) {
                 case COMMA:
                     ptr->mon_hsync[ptr->mon_n_hsync].hi =
@@ -464,10 +463,10 @@ xf86parseMonitorSection(void)
                     break;
                 case DASH:
                     if (xf86getSubToken(&(ptr->mon_comment)) != NUMBER ||
-                        (float) val.realnum <
+                        (float) xf86_lex_val.realnum <
                         ptr->mon_hsync[ptr->mon_n_hsync].lo)
                         Error(HORIZSYNC_MSG);
-                    ptr->mon_hsync[ptr->mon_n_hsync].hi = val.realnum;
+                    ptr->mon_hsync[ptr->mon_n_hsync].hi = xf86_lex_val.realnum;
                     if ((token = xf86getSubToken(&(ptr->mon_comment))) == COMMA)
                         break;
                     ptr->mon_n_hsync++;
@@ -491,7 +490,7 @@ xf86parseMonitorSection(void)
             if (xf86getSubToken(&(ptr->mon_comment)) != NUMBER)
                 Error(VERTREFRESH_MSG);
             do {
-                ptr->mon_vrefresh[ptr->mon_n_vrefresh].lo = val.realnum;
+                ptr->mon_vrefresh[ptr->mon_n_vrefresh].lo = xf86_lex_val.realnum;
                 switch (token = xf86getSubToken(&(ptr->mon_comment))) {
                 case COMMA:
                     ptr->mon_vrefresh[ptr->mon_n_vrefresh].hi =
@@ -499,10 +498,10 @@ xf86parseMonitorSection(void)
                     break;
                 case DASH:
                     if (xf86getSubToken(&(ptr->mon_comment)) != NUMBER ||
-                        (float) val.realnum <
+                        (float) xf86_lex_val.realnum <
                         ptr->mon_vrefresh[ptr->mon_n_vrefresh].lo)
                         Error(VERTREFRESH_MSG);
-                    ptr->mon_vrefresh[ptr->mon_n_vrefresh].hi = val.realnum;
+                    ptr->mon_vrefresh[ptr->mon_n_vrefresh].hi = xf86_lex_val.realnum;
                     if ((token = xf86getSubToken(&(ptr->mon_comment))) == COMMA)
                         break;
                     ptr->mon_n_vrefresh++;
@@ -530,11 +529,11 @@ xf86parseMonitorSection(void)
             }
             else {
                 ptr->mon_gamma_red = ptr->mon_gamma_green =
-                    ptr->mon_gamma_blue = val.realnum;
+                    ptr->mon_gamma_blue = xf86_lex_val.realnum;
                 if (xf86getSubToken(&(ptr->mon_comment)) == NUMBER) {
-                    ptr->mon_gamma_green = val.realnum;
+                    ptr->mon_gamma_green = xf86_lex_val.realnum;
                     if (xf86getSubToken(&(ptr->mon_comment)) == NUMBER) {
-                        ptr->mon_gamma_blue = val.realnum;
+                        ptr->mon_gamma_blue = xf86_lex_val.realnum;
                     }
                     else {
                         Error(INVALID_GAMMA_MSG);
@@ -558,7 +557,7 @@ xf86parseMonitorSection(void)
                referenced here */
             mptr = calloc(1, sizeof(XF86ConfModesLinkRec));
             mptr->list.next = NULL;
-            mptr->ml_modes_str = val.str;
+            mptr->ml_modes_str = xf86_lex_val.str;
             mptr->ml_modes = NULL;
             ptr->mon_modes_sect_lst = (XF86ConfModesLinkPtr)
                 xf86addListItem((GenericListPtr) ptr->mon_modes_sect_lst,
@@ -599,14 +598,14 @@ xf86parseModesSection(void)
         while ((token = xf86getToken(ModesTab)) != ENDSECTION) {
         switch (token) {
         case COMMENT:
-            ptr->modes_comment = xf86addComment(ptr->modes_comment, val.str);
+            ptr->modes_comment = xf86addComment(ptr->modes_comment, xf86_lex_val.str);
             break;
         case IDENTIFIER:
             if (xf86getSubToken(&(ptr->modes_comment)) != STRING)
                 Error(QUOTE_MSG, "Identifier");
             if (has_ident == TRUE)
                 Error(MULTIPLE_MSG, "Identifier");
-            ptr->modes_identifier = val.str;
+            ptr->modes_identifier = xf86_lex_val.str;
             has_ident = TRUE;
             break;
         case MODE:
diff --git a/hw/xfree86/parser/OutputClass.c b/hw/xfree86/parser/OutputClass.c
new file mode 100644 (file)
index 0000000..7e9a8ac
--- /dev/null
@@ -0,0 +1,167 @@
+/*
+ * Copyright (c) 2014 NVIDIA Corporation. All rights reserved.
+ *
+ * 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 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.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "os.h"
+#include "xf86Parser.h"
+#include "xf86tokens.h"
+#include "Configint.h"
+
+static
+xf86ConfigSymTabRec OutputClassTab[] = {
+    {ENDSECTION, "endsection"},
+    {IDENTIFIER, "identifier"},
+    {DRIVER, "driver"},
+    {MATCH_DRIVER, "matchdriver"},
+    {-1, ""},
+};
+
+#define CLEANUP xf86freeOutputClassList
+
+#define TOKEN_SEP "|"
+
+static void
+add_group_entry(struct xorg_list *head, char **values)
+{
+    xf86MatchGroup *group;
+
+    group = malloc(sizeof(*group));
+    if (group) {
+        group->values = values;
+        xorg_list_add(&group->entry, head);
+    }
+}
+
+XF86ConfOutputClassPtr
+xf86parseOutputClassSection(void)
+{
+    int has_ident = FALSE;
+    int token;
+
+    parsePrologue(XF86ConfOutputClassPtr, XF86ConfOutputClassRec)
+
+    /* Initialize MatchGroup lists */
+    xorg_list_init(&ptr->match_driver);
+
+    while ((token = xf86getToken(OutputClassTab)) != ENDSECTION) {
+        switch (token) {
+        case COMMENT:
+            ptr->comment = xf86addComment(ptr->comment, xf86_lex_val.str);
+            break;
+        case IDENTIFIER:
+            if (xf86getSubToken(&(ptr->comment)) != STRING)
+                Error(QUOTE_MSG, "Identifier");
+            if (has_ident == TRUE)
+                Error(MULTIPLE_MSG, "Identifier");
+            ptr->identifier = xf86_lex_val.str;
+            has_ident = TRUE;
+            break;
+        case DRIVER:
+            if (xf86getSubToken(&(ptr->comment)) != STRING)
+                Error(QUOTE_MSG, "Driver");
+            else
+                ptr->driver = xf86_lex_val.str;
+            break;
+        case MATCH_DRIVER:
+            if (xf86getSubToken(&(ptr->comment)) != STRING)
+                Error(QUOTE_MSG, "MatchDriver");
+            add_group_entry(&ptr->match_driver,
+                            xstrtokenize(xf86_lex_val.str, TOKEN_SEP));
+            free(xf86_lex_val.str);
+            break;
+        case EOF_TOKEN:
+            Error(UNEXPECTED_EOF_MSG);
+            break;
+        default:
+            Error(INVALID_KEYWORD_MSG, xf86tokenString());
+            break;
+        }
+    }
+
+    if (!has_ident)
+        Error(NO_IDENT_MSG);
+
+#ifdef DEBUG
+    printf("OutputClass section parsed\n");
+#endif
+
+    return ptr;
+}
+void
+xf86printOutputClassSection(FILE * cf, XF86ConfOutputClassPtr ptr)
+{
+    const xf86MatchGroup *group;
+    char *const *cur;
+
+    while (ptr) {
+        fprintf(cf, "Section \"OutputClass\"\n");
+        if (ptr->comment)
+            fprintf(cf, "%s", ptr->comment);
+        if (ptr->identifier)
+            fprintf(cf, "\tIdentifier      \"%s\"\n", ptr->identifier);
+        if (ptr->driver)
+            fprintf(cf, "\tDriver          \"%s\"\n", ptr->driver);
+
+        xorg_list_for_each_entry(group, &ptr->match_driver, entry) {
+            fprintf(cf, "\tMatchDriver     \"");
+            for (cur = group->values; *cur; cur++)
+                fprintf(cf, "%s%s", cur == group->values ? "" : TOKEN_SEP,
+                        *cur);
+            fprintf(cf, "\"\n");
+        }
+
+        fprintf(cf, "EndSection\n\n");
+        ptr = ptr->list.next;
+    }
+}
+
+void
+xf86freeOutputClassList(XF86ConfOutputClassPtr ptr)
+{
+    XF86ConfOutputClassPtr prev;
+
+    while (ptr) {
+        xf86MatchGroup *group, *next;
+        char **list;
+
+        TestFree(ptr->identifier);
+        TestFree(ptr->comment);
+        TestFree(ptr->driver);
+
+        xorg_list_for_each_entry_safe(group, next, &ptr->match_driver, entry) {
+            xorg_list_del(&group->entry);
+            for (list = group->values; *list; list++)
+                free(*list);
+            free(group);
+        }
+
+        prev = ptr;
+        ptr = ptr->list.next;
+        free(prev);
+    }
+}
index ff748d9..fe60d95 100644 (file)
@@ -61,7 +61,6 @@
 #include "Configint.h"
 #include "Xprintf.h"
 
-extern LexRec val;
 
 static xf86ConfigSymTabRec PointerTab[] = {
     {PROTOCOL, "protocol"},
@@ -104,19 +103,19 @@ xf86parsePointerSection(void)
         while ((token = xf86getToken(PointerTab)) != ENDSECTION) {
         switch (token) {
         case COMMENT:
-            ptr->inp_comment = xf86addComment(ptr->inp_comment, val.str);
+            ptr->inp_comment = xf86addComment(ptr->inp_comment, xf86_lex_val.str);
             break;
         case PROTOCOL:
             if (xf86getSubToken(&(ptr->inp_comment)) != STRING)
                 Error(QUOTE_MSG, "Protocol");
             ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
-                                                   strdup("Protocol"), val.str);
+                                                   strdup("Protocol"), xf86_lex_val.str);
             break;
         case PDEVICE:
             if (xf86getSubToken(&(ptr->inp_comment)) != STRING)
                 Error(QUOTE_MSG, "Device");
             ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
-                                                   strdup("Device"), val.str);
+                                                   strdup("Device"), xf86_lex_val.str);
             break;
         case EMULATE3:
             ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
@@ -124,9 +123,9 @@ xf86parsePointerSection(void)
                                                    NULL);
             break;
         case EM3TIMEOUT:
-            if (xf86getSubToken(&(ptr->inp_comment)) != NUMBER || val.num < 0)
+            if (xf86getSubToken(&(ptr->inp_comment)) != NUMBER || xf86_lex_val.num < 0)
                 Error(POSITIVE_INT_MSG, "Emulate3Timeout");
-            s = xf86uLongToString(val.num);
+            s = xf86uLongToString(xf86_lex_val.num);
             ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
                                                    strdup("Emulate3Timeout"),
                                                    s);
@@ -136,30 +135,30 @@ xf86parsePointerSection(void)
                                                    strdup("ChordMiddle"), NULL);
             break;
         case PBUTTONS:
-            if (xf86getSubToken(&(ptr->inp_comment)) != NUMBER || val.num < 0)
+            if (xf86getSubToken(&(ptr->inp_comment)) != NUMBER || xf86_lex_val.num < 0)
                 Error(POSITIVE_INT_MSG, "Buttons");
-            s = xf86uLongToString(val.num);
+            s = xf86uLongToString(xf86_lex_val.num);
             ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
                                                    strdup("Buttons"), s);
             break;
         case BAUDRATE:
-            if (xf86getSubToken(&(ptr->inp_comment)) != NUMBER || val.num < 0)
+            if (xf86getSubToken(&(ptr->inp_comment)) != NUMBER || xf86_lex_val.num < 0)
                 Error(POSITIVE_INT_MSG, "BaudRate");
-            s = xf86uLongToString(val.num);
+            s = xf86uLongToString(xf86_lex_val.num);
             ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
                                                    strdup("BaudRate"), s);
             break;
         case SAMPLERATE:
-            if (xf86getSubToken(&(ptr->inp_comment)) != NUMBER || val.num < 0)
+            if (xf86getSubToken(&(ptr->inp_comment)) != NUMBER || xf86_lex_val.num < 0)
                 Error(POSITIVE_INT_MSG, "SampleRate");
-            s = xf86uLongToString(val.num);
+            s = xf86uLongToString(xf86_lex_val.num);
             ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
                                                    strdup("SampleRate"), s);
             break;
         case PRESOLUTION:
-            if (xf86getSubToken(&(ptr->inp_comment)) != NUMBER || val.num < 0)
+            if (xf86getSubToken(&(ptr->inp_comment)) != NUMBER || xf86_lex_val.num < 0)
                 Error(POSITIVE_INT_MSG, "Resolution");
-            s = xf86uLongToString(val.num);
+            s = xf86uLongToString(xf86_lex_val.num);
             ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
                                                    strdup("Resolution"), s);
             break;
@@ -174,14 +173,14 @@ xf86parsePointerSection(void)
         case ZAXISMAPPING:
             switch (xf86getToken(ZMapTab)) {
             case NUMBER:
-                if (val.num < 0)
+                if (xf86_lex_val.num < 0)
                     Error(ZAXISMAPPING_MSG);
-                val1 = val.num;
+                val1 = xf86_lex_val.num;
                 if (xf86getSubToken(&(ptr->inp_comment)) != NUMBER ||
-                    val.num < 0) {
+                    xf86_lex_val.num < 0) {
                     Error(ZAXISMAPPING_MSG);
                 }
-                if (asprintf(&s, "%lu %u", val1, val.num) == -1)
+                if (asprintf(&s, "%lu %u", val1, xf86_lex_val.num) == -1)
                     s = NULL;
                 break;
             case XAXIS:
index f294ec4..0e9746a 100644 (file)
@@ -60,7 +60,6 @@
 #include "xf86tokens.h"
 #include "Configint.h"
 
-extern LexRec val;
 
 static xf86ConfigSymTabRec DisplayTab[] = {
     {ENDSUBSECTION, "endsubsection"},
@@ -92,71 +91,71 @@ xf86parseDisplaySubSection(void)
     while ((token = xf86getToken(DisplayTab)) != ENDSUBSECTION) {
         switch (token) {
         case COMMENT:
-            ptr->disp_comment = xf86addComment(ptr->disp_comment, val.str);
+            ptr->disp_comment = xf86addComment(ptr->disp_comment, xf86_lex_val.str);
             break;
         case VIEWPORT:
             if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER)
                 Error(VIEWPORT_MSG);
-            ptr->disp_frameX0 = val.num;
+            ptr->disp_frameX0 = xf86_lex_val.num;
             if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER)
                 Error(VIEWPORT_MSG);
-            ptr->disp_frameY0 = val.num;
+            ptr->disp_frameY0 = xf86_lex_val.num;
             break;
         case VIRTUAL:
             if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER)
                 Error(VIRTUAL_MSG);
-            ptr->disp_virtualX = val.num;
+            ptr->disp_virtualX = xf86_lex_val.num;
             if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER)
                 Error(VIRTUAL_MSG);
-            ptr->disp_virtualY = val.num;
+            ptr->disp_virtualY = xf86_lex_val.num;
             break;
         case DEPTH:
             if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER)
                 Error(NUMBER_MSG, "Display");
-            ptr->disp_depth = val.num;
+            ptr->disp_depth = xf86_lex_val.num;
             break;
         case BPP:
             if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER)
                 Error(NUMBER_MSG, "Display");
-            ptr->disp_bpp = val.num;
+            ptr->disp_bpp = xf86_lex_val.num;
             break;
         case VISUAL:
             if (xf86getSubToken(&(ptr->disp_comment)) != STRING)
                 Error(QUOTE_MSG, "Display");
-            ptr->disp_visual = val.str;
+            ptr->disp_visual = xf86_lex_val.str;
             break;
         case WEIGHT:
             if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER)
                 Error(WEIGHT_MSG);
-            ptr->disp_weight.red = val.num;
+            ptr->disp_weight.red = xf86_lex_val.num;
             if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER)
                 Error(WEIGHT_MSG);
-            ptr->disp_weight.green = val.num;
+            ptr->disp_weight.green = xf86_lex_val.num;
             if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER)
                 Error(WEIGHT_MSG);
-            ptr->disp_weight.blue = val.num;
+            ptr->disp_weight.blue = xf86_lex_val.num;
             break;
         case BLACK_TOK:
             if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER)
                 Error(BLACK_MSG);
-            ptr->disp_black.red = val.num;
+            ptr->disp_black.red = xf86_lex_val.num;
             if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER)
                 Error(BLACK_MSG);
-            ptr->disp_black.green = val.num;
+            ptr->disp_black.green = xf86_lex_val.num;
             if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER)
                 Error(BLACK_MSG);
-            ptr->disp_black.blue = val.num;
+            ptr->disp_black.blue = xf86_lex_val.num;
             break;
         case WHITE_TOK:
             if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER)
                 Error(WHITE_MSG);
-            ptr->disp_white.red = val.num;
+            ptr->disp_white.red = xf86_lex_val.num;
             if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER)
                 Error(WHITE_MSG);
-            ptr->disp_white.green = val.num;
+            ptr->disp_white.green = xf86_lex_val.num;
             if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER)
                 Error(WHITE_MSG);
-            ptr->disp_white.blue = val.num;
+            ptr->disp_white.blue = xf86_lex_val.num;
             break;
         case MODES:
         {
@@ -166,7 +165,7 @@ xf86parseDisplaySubSection(void)
                     xf86getSubTokenWithTab(&(ptr->disp_comment),
                                            DisplayTab)) == STRING) {
                 mptr = calloc(1, sizeof(XF86ModeRec));
-                mptr->mode_name = val.str;
+                mptr->mode_name = xf86_lex_val.str;
                 mptr->list.next = NULL;
                 ptr->disp_mode_lst = (XF86ModePtr)
                     xf86addListItem((glp) ptr->disp_mode_lst, (glp) mptr);
@@ -199,6 +198,7 @@ xf86parseDisplaySubSection(void)
 static xf86ConfigSymTabRec ScreenTab[] = {
     {ENDSECTION, "endsection"},
     {IDENTIFIER, "identifier"},
+    {MATCHSEAT, "matchseat"},
     {OBSDRIVER, "driver"},
     {MDEVICE, "device"},
     {MONITOR, "monitor"},
@@ -227,20 +227,25 @@ xf86parseScreenSection(void)
         while ((token = xf86getToken(ScreenTab)) != ENDSECTION) {
         switch (token) {
         case COMMENT:
-            ptr->scrn_comment = xf86addComment(ptr->scrn_comment, val.str);
+            ptr->scrn_comment = xf86addComment(ptr->scrn_comment, xf86_lex_val.str);
             break;
         case IDENTIFIER:
             if (xf86getSubToken(&(ptr->scrn_comment)) != STRING)
                 Error(QUOTE_MSG, "Identifier");
-            ptr->scrn_identifier = val.str;
+            ptr->scrn_identifier = xf86_lex_val.str;
             if (has_ident || has_driver)
                 Error(ONLY_ONE_MSG, "Identifier or Driver");
             has_ident = TRUE;
             break;
+        case MATCHSEAT:
+            if (xf86getSubToken(&(ptr->scrn_comment)) != STRING)
+                Error(QUOTE_MSG, "MatchSeat");
+            ptr->match_seat = xf86_lex_val.str;
+            break;
         case OBSDRIVER:
             if (xf86getSubToken(&(ptr->scrn_comment)) != STRING)
                 Error(QUOTE_MSG, "Driver");
-            ptr->scrn_obso_driver = val.str;
+            ptr->scrn_obso_driver = xf86_lex_val.str;
             if (has_ident || has_driver)
                 Error(ONLY_ONE_MSG, "Identifier or Driver");
             has_driver = TRUE;
@@ -248,27 +253,27 @@ xf86parseScreenSection(void)
         case DEFAULTDEPTH:
             if (xf86getSubToken(&(ptr->scrn_comment)) != NUMBER)
                 Error(NUMBER_MSG, "DefaultDepth");
-            ptr->scrn_defaultdepth = val.num;
+            ptr->scrn_defaultdepth = xf86_lex_val.num;
             break;
         case DEFAULTBPP:
             if (xf86getSubToken(&(ptr->scrn_comment)) != NUMBER)
                 Error(NUMBER_MSG, "DefaultBPP");
-            ptr->scrn_defaultbpp = val.num;
+            ptr->scrn_defaultbpp = xf86_lex_val.num;
             break;
         case DEFAULTFBBPP:
             if (xf86getSubToken(&(ptr->scrn_comment)) != NUMBER)
                 Error(NUMBER_MSG, "DefaultFbBPP");
-            ptr->scrn_defaultfbbpp = val.num;
+            ptr->scrn_defaultfbbpp = xf86_lex_val.num;
             break;
         case MDEVICE:
             if (xf86getSubToken(&(ptr->scrn_comment)) != STRING)
                 Error(QUOTE_MSG, "Device");
-            ptr->scrn_device_str = val.str;
+            ptr->scrn_device_str = xf86_lex_val.str;
             break;
         case MONITOR:
             if (xf86getSubToken(&(ptr->scrn_comment)) != STRING)
                 Error(QUOTE_MSG, "Monitor");
-            ptr->scrn_monitor_str = val.str;
+            ptr->scrn_monitor_str = xf86_lex_val.str;
             break;
         case VIDEOADAPTOR:
         {
@@ -280,13 +285,13 @@ xf86parseScreenSection(void)
             /* Don't allow duplicates */
             for (aptr = ptr->scrn_adaptor_lst; aptr;
                  aptr = (XF86ConfAdaptorLinkPtr) aptr->list.next)
-                if (xf86nameCompare(val.str, aptr->al_adaptor_str) == 0)
+                if (xf86nameCompare(xf86_lex_val.str, aptr->al_adaptor_str) == 0)
                     break;
 
             if (aptr == NULL) {
                 aptr = calloc(1, sizeof(XF86ConfAdaptorLinkRec));
                 aptr->list.next = NULL;
-                aptr->al_adaptor_str = val.str;
+                aptr->al_adaptor_str = xf86_lex_val.str;
                 ptr->scrn_adaptor_lst = (XF86ConfAdaptorLinkPtr)
                     xf86addListItem((glp) ptr->scrn_adaptor_lst, (glp) aptr);
             }
@@ -295,10 +300,10 @@ xf86parseScreenSection(void)
         case VIRTUAL:
             if (xf86getSubToken(&(ptr->scrn_comment)) != NUMBER)
                 Error(VIRTUAL_MSG);
-            ptr->scrn_virtualX = val.num;
+            ptr->scrn_virtualX = xf86_lex_val.num;
             if (xf86getSubToken(&(ptr->scrn_comment)) != NUMBER)
                 Error(VIRTUAL_MSG);
-            ptr->scrn_virtualY = val.num;
+            ptr->scrn_virtualY = xf86_lex_val.num;
             break;
         case OPTION:
             ptr->scrn_option_lst = xf86parseOption(ptr->scrn_option_lst);
@@ -307,7 +312,7 @@ xf86parseScreenSection(void)
             if (xf86getSubToken(&(ptr->scrn_comment)) != STRING)
                 Error(QUOTE_MSG, "SubSection");
             {
-                free(val.str);
+                free(xf86_lex_val.str);
                 HANDLE_LIST(scrn_display_lst, xf86parseDisplaySubSection,
                             XF86ConfDisplayPtr);
             }
index 9b7695c..2c870ae 100644 (file)
@@ -60,7 +60,6 @@
 #include "xf86tokens.h"
 #include "Configint.h"
 
-extern LexRec val;
 
 static xf86ConfigSymTabRec VendorSubTab[] = {
     {ENDSUBSECTION, "endsubsection"},
@@ -82,14 +81,14 @@ xf86parseVendorSubSection(void)
         while ((token = xf86getToken(VendorSubTab)) != ENDSUBSECTION) {
         switch (token) {
         case COMMENT:
-            ptr->vs_comment = xf86addComment(ptr->vs_comment, val.str);
+            ptr->vs_comment = xf86addComment(ptr->vs_comment, xf86_lex_val.str);
             break;
         case IDENTIFIER:
             if (xf86getSubToken(&(ptr->vs_comment)))
                 Error(QUOTE_MSG, "Identifier");
             if (has_ident == TRUE)
                 Error(MULTIPLE_MSG, "Identifier");
-            ptr->vs_identifier = val.str;
+            ptr->vs_identifier = xf86_lex_val.str;
             has_ident = TRUE;
             break;
         case OPTION:
@@ -135,14 +134,14 @@ xf86parseVendorSection(void)
         while ((token = xf86getToken(VendorTab)) != ENDSECTION) {
         switch (token) {
         case COMMENT:
-            ptr->vnd_comment = xf86addComment(ptr->vnd_comment, val.str);
+            ptr->vnd_comment = xf86addComment(ptr->vnd_comment, xf86_lex_val.str);
             break;
         case IDENTIFIER:
             if (xf86getSubToken(&(ptr->vnd_comment)) != STRING)
                 Error(QUOTE_MSG, "Identifier");
             if (has_ident == TRUE)
                 Error(MULTIPLE_MSG, "Identifier");
-            ptr->vnd_identifier = val.str;
+            ptr->vnd_identifier = xf86_lex_val.str;
             has_ident = TRUE;
             break;
         case OPTION:
index 68d611a..93209c4 100644 (file)
@@ -60,7 +60,6 @@
 #include "xf86tokens.h"
 #include "Configint.h"
 
-extern LexRec val;
 
 static xf86ConfigSymTabRec VideoPortTab[] = {
     {ENDSUBSECTION, "endsubsection"},
@@ -97,14 +96,14 @@ xf86parseVideoPortSubSection(void)
         while ((token = xf86getToken(VideoPortTab)) != ENDSUBSECTION) {
         switch (token) {
         case COMMENT:
-            ptr->vp_comment = xf86addComment(ptr->vp_comment, val.str);
+            ptr->vp_comment = xf86addComment(ptr->vp_comment, xf86_lex_val.str);
             break;
         case IDENTIFIER:
             if (xf86getSubToken(&(ptr->vp_comment)) != STRING)
                 Error(QUOTE_MSG, "Identifier");
             if (has_ident == TRUE)
                 Error(MULTIPLE_MSG, "Identifier");
-            ptr->vp_identifier = val.str;
+            ptr->vp_identifier = xf86_lex_val.str;
             has_ident = TRUE;
             break;
         case OPTION:
@@ -154,12 +153,12 @@ xf86parseVideoAdaptorSection(void)
         while ((token = xf86getToken(VideoAdaptorTab)) != ENDSECTION) {
         switch (token) {
         case COMMENT:
-            ptr->va_comment = xf86addComment(ptr->va_comment, val.str);
+            ptr->va_comment = xf86addComment(ptr->va_comment, xf86_lex_val.str);
             break;
         case IDENTIFIER:
             if (xf86getSubToken(&(ptr->va_comment)) != STRING)
                 Error(QUOTE_MSG, "Identifier");
-            ptr->va_identifier = val.str;
+            ptr->va_identifier = xf86_lex_val.str;
             if (has_ident == TRUE)
                 Error(MULTIPLE_MSG, "Identifier");
             has_ident = TRUE;
@@ -167,22 +166,22 @@ xf86parseVideoAdaptorSection(void)
         case VENDOR:
             if (xf86getSubToken(&(ptr->va_comment)) != STRING)
                 Error(QUOTE_MSG, "Vendor");
-            ptr->va_vendor = val.str;
+            ptr->va_vendor = xf86_lex_val.str;
             break;
         case BOARD:
             if (xf86getSubToken(&(ptr->va_comment)) != STRING)
                 Error(QUOTE_MSG, "Board");
-            ptr->va_board = val.str;
+            ptr->va_board = xf86_lex_val.str;
             break;
         case BUSID:
             if (xf86getSubToken(&(ptr->va_comment)) != STRING)
                 Error(QUOTE_MSG, "BusID");
-            ptr->va_busid = val.str;
+            ptr->va_busid = xf86_lex_val.str;
             break;
         case DRIVER:
             if (xf86getSubToken(&(ptr->va_comment)) != STRING)
                 Error(QUOTE_MSG, "Driver");
-            ptr->va_driver = val.str;
+            ptr->va_driver = xf86_lex_val.str;
             break;
         case OPTION:
             ptr->va_option_lst = xf86parseOption(ptr->va_option_lst);
index 1250f39..774e2a2 100644 (file)
@@ -57,6 +57,11 @@ XF86ConfInputClassPtr xf86parseInputClassSection(void);
 void xf86printInputClassSection(FILE * f, XF86ConfInputClassPtr ptr);
 void xf86freeInputClassList(XF86ConfInputClassPtr ptr);
 
+/* OutputClass.c */
+XF86ConfOutputClassPtr xf86parseOutputClassSection(void);
+void xf86printOutputClassSection(FILE * f, XF86ConfOutputClassPtr ptr);
+void xf86freeOutputClassList(XF86ConfOutputClassPtr ptr);
+
 /* Layout.c */
 XF86ConfLayoutPtr xf86parseLayoutSection(void);
 void xf86printLayoutSection(FILE * cf, XF86ConfLayoutPtr ptr);
@@ -67,7 +72,7 @@ int xf86validateLayout(XF86ConfigPtr p);
 XF86ConfModulePtr xf86parseModuleSection(void);
 void xf86printModuleSection(FILE * cf, XF86ConfModulePtr ptr);
 extern _X_EXPORT XF86LoadPtr xf86addNewLoadDirective(XF86LoadPtr head,
-                                                     char *name, int type,
+                                                     const char *name, int type,
                                                      XF86OptionPtr opts);
 void xf86freeModules(XF86ConfModulePtr ptr);
 
@@ -141,7 +146,7 @@ xf86freeExtensions(XF86ConfExtensionsPtr ptr);
 #include <xorg-config.h>
 #endif
 
-#ifndef IN_XSERVER
+#ifndef HAVE_XORG_CONFIG_H
 /* Externally provided functions */
 void
 ErrorF(const char *f, ...);
index 6545bcd..22f6e6a 100644 (file)
@@ -60,7 +60,6 @@
 #include "xf86tokens.h"
 #include "Configint.h"
 
-extern LexRec val;
 
 static xf86ConfigSymTabRec TopLevelTab[] = {
     {SECTION, "section"},
@@ -99,7 +98,7 @@ xf86readConfigFile(void)
     while ((token = xf86getToken(TopLevelTab)) != EOF_TOKEN) {
         switch (token) {
         case COMMENT:
-            ptr->conf_comment = xf86addComment(ptr->conf_comment, val.str);
+            ptr->conf_comment = xf86addComment(ptr->conf_comment, xf86_lex_val.str);
             break;
         case SECTION:
             if (xf86getSubToken(&(ptr->conf_comment)) != STRING) {
@@ -107,101 +106,107 @@ xf86readConfigFile(void)
                 CLEANUP(ptr);
                 return NULL;
             }
-            xf86setSection(val.str);
-            if (xf86nameCompare(val.str, "files") == 0) {
-                free(val.str);
-                val.str = NULL;
+            xf86setSection(xf86_lex_val.str);
+            if (xf86nameCompare(xf86_lex_val.str, "files") == 0) {
+                free(xf86_lex_val.str);
+                xf86_lex_val.str = NULL;
                 HANDLE_RETURN(conf_files, xf86parseFilesSection());
             }
-            else if (xf86nameCompare(val.str, "serverflags") == 0) {
-                free(val.str);
-                val.str = NULL;
+            else if (xf86nameCompare(xf86_lex_val.str, "serverflags") == 0) {
+                free(xf86_lex_val.str);
+                xf86_lex_val.str = NULL;
                 HANDLE_RETURN(conf_flags, xf86parseFlagsSection());
             }
-            else if (xf86nameCompare(val.str, "pointer") == 0) {
-                free(val.str);
-                val.str = NULL;
+            else if (xf86nameCompare(xf86_lex_val.str, "pointer") == 0) {
+                free(xf86_lex_val.str);
+                xf86_lex_val.str = NULL;
                 HANDLE_LIST(conf_input_lst, xf86parsePointerSection,
                             XF86ConfInputPtr);
             }
-            else if (xf86nameCompare(val.str, "videoadaptor") == 0) {
-                free(val.str);
-                val.str = NULL;
+            else if (xf86nameCompare(xf86_lex_val.str, "videoadaptor") == 0) {
+                free(xf86_lex_val.str);
+                xf86_lex_val.str = NULL;
                 HANDLE_LIST(conf_videoadaptor_lst, xf86parseVideoAdaptorSection,
                             XF86ConfVideoAdaptorPtr);
             }
-            else if (xf86nameCompare(val.str, "device") == 0) {
-                free(val.str);
-                val.str = NULL;
+            else if (xf86nameCompare(xf86_lex_val.str, "device") == 0) {
+                free(xf86_lex_val.str);
+                xf86_lex_val.str = NULL;
                 HANDLE_LIST(conf_device_lst, xf86parseDeviceSection,
                             XF86ConfDevicePtr);
             }
-            else if (xf86nameCompare(val.str, "monitor") == 0) {
-                free(val.str);
-                val.str = NULL;
+            else if (xf86nameCompare(xf86_lex_val.str, "monitor") == 0) {
+                free(xf86_lex_val.str);
+                xf86_lex_val.str = NULL;
                 HANDLE_LIST(conf_monitor_lst, xf86parseMonitorSection,
                             XF86ConfMonitorPtr);
             }
-            else if (xf86nameCompare(val.str, "modes") == 0) {
-                free(val.str);
-                val.str = NULL;
+            else if (xf86nameCompare(xf86_lex_val.str, "modes") == 0) {
+                free(xf86_lex_val.str);
+                xf86_lex_val.str = NULL;
                 HANDLE_LIST(conf_modes_lst, xf86parseModesSection,
                             XF86ConfModesPtr);
             }
-            else if (xf86nameCompare(val.str, "screen") == 0) {
-                free(val.str);
-                val.str = NULL;
+            else if (xf86nameCompare(xf86_lex_val.str, "screen") == 0) {
+                free(xf86_lex_val.str);
+                xf86_lex_val.str = NULL;
                 HANDLE_LIST(conf_screen_lst, xf86parseScreenSection,
                             XF86ConfScreenPtr);
             }
-            else if (xf86nameCompare(val.str, "inputdevice") == 0) {
-                free(val.str);
-                val.str = NULL;
+            else if (xf86nameCompare(xf86_lex_val.str, "inputdevice") == 0) {
+                free(xf86_lex_val.str);
+                xf86_lex_val.str = NULL;
                 HANDLE_LIST(conf_input_lst, xf86parseInputSection,
                             XF86ConfInputPtr);
             }
-            else if (xf86nameCompare(val.str, "inputclass") == 0) {
-                free(val.str);
-                val.str = NULL;
+            else if (xf86nameCompare(xf86_lex_val.str, "inputclass") == 0) {
+                free(xf86_lex_val.str);
+                xf86_lex_val.str = NULL;
                 HANDLE_LIST(conf_inputclass_lst,
                             xf86parseInputClassSection, XF86ConfInputClassPtr);
             }
-            else if (xf86nameCompare(val.str, "module") == 0) {
-                free(val.str);
-                val.str = NULL;
+            else if (xf86nameCompare(xf86_lex_val.str, "outputclass") == 0) {
+                free(xf86_lex_val.str);
+                xf86_lex_val.str = NULL;
+                HANDLE_LIST(conf_outputclass_lst, xf86parseOutputClassSection,
+                            XF86ConfOutputClassPtr);
+            }
+            else if (xf86nameCompare(xf86_lex_val.str, "module") == 0) {
+                free(xf86_lex_val.str);
+                xf86_lex_val.str = NULL;
                 HANDLE_RETURN(conf_modules, xf86parseModuleSection());
             }
-            else if (xf86nameCompare(val.str, "serverlayout") == 0) {
-                free(val.str);
-                val.str = NULL;
+            else if (xf86nameCompare(xf86_lex_val.str, "serverlayout") == 0) {
+                free(xf86_lex_val.str);
+                xf86_lex_val.str = NULL;
                 HANDLE_LIST(conf_layout_lst, xf86parseLayoutSection,
                             XF86ConfLayoutPtr);
             }
-            else if (xf86nameCompare(val.str, "vendor") == 0) {
-                free(val.str);
-                val.str = NULL;
+            else if (xf86nameCompare(xf86_lex_val.str, "vendor") == 0) {
+                free(xf86_lex_val.str);
+                xf86_lex_val.str = NULL;
                 HANDLE_LIST(conf_vendor_lst, xf86parseVendorSection,
                             XF86ConfVendorPtr);
             }
-            else if (xf86nameCompare(val.str, "dri") == 0) {
-                free(val.str);
-                val.str = NULL;
+            else if (xf86nameCompare(xf86_lex_val.str, "dri") == 0) {
+                free(xf86_lex_val.str);
+                xf86_lex_val.str = NULL;
                 HANDLE_RETURN(conf_dri, xf86parseDRISection());
             }
-            else if (xf86nameCompare(val.str, "extensions") == 0) {
-                free(val.str);
-                val.str = NULL;
+            else if (xf86nameCompare(xf86_lex_val.str, "extensions") == 0) {
+                free(xf86_lex_val.str);
+                xf86_lex_val.str = NULL;
                 HANDLE_RETURN(conf_extensions, xf86parseExtensionsSection());
             }
             else {
-                free(val.str);
-                val.str = NULL;
+                free(xf86_lex_val.str);
+                xf86_lex_val.str = NULL;
                 Error(INVALID_SECTION_MSG, xf86tokenString());
             }
             break;
         default:
-            free(val.str);
-            val.str = NULL;
+            free(xf86_lex_val.str);
+            xf86_lex_val.str = NULL;
             Error(INVALID_KEYWORD_MSG, xf86tokenString());
         }
     }
index f852b83..a6c1295 100644 (file)
@@ -103,7 +103,7 @@ static int numFiles = 0;        /* number of config files */
 static int curFileIndex = 0;    /* index of current config file */
 static int pushToken = LOCK_TOKEN;
 static int eol_seen = 0;        /* private state to handle comments */
-LexRec val;
+LexRec xf86_lex_val;
 
 /*
  * xf86getNextLine --
@@ -332,7 +332,7 @@ xf86getToken(xf86ConfigSymTabRec * tab)
             /* XXX no private copy.
              * Use xf86addComment when setting a comment.
              */
-            val.str = configRBuf;
+            xf86_lex_val.str = configRBuf;
             return COMMENT;
         }
 
@@ -354,15 +354,15 @@ xf86getToken(xf86ConfigSymTabRec * tab)
                 if ((configBuf[configPos] == 'x') ||
                     (configBuf[configPos] == 'X')) {
                     base = 16;
-                    val.numType = PARSE_HEX;
+                    xf86_lex_val.numType = PARSE_HEX;
                 }
                 else {
                     base = 8;
-                    val.numType = PARSE_OCTAL;
+                    xf86_lex_val.numType = PARSE_OCTAL;
                 }
             else {
                 base = 10;
-                val.numType = PARSE_DECIMAL;
+                xf86_lex_val.numType = PARSE_DECIMAL;
             }
 
             configRBuf[0] = c;
@@ -374,8 +374,8 @@ xf86getToken(xf86ConfigSymTabRec * tab)
                 configRBuf[i++] = c;
             configPos--;        /* GJA -- one too far */
             configRBuf[i] = '\0';
-            val.num = strtoul(configRBuf, NULL, 0);
-            val.realnum = atof(configRBuf);
+            xf86_lex_val.num = strtoul(configRBuf, NULL, 0);
+            xf86_lex_val.realnum = atof(configRBuf);
             return NUMBER;
         }
 
@@ -389,8 +389,8 @@ xf86getToken(xf86ConfigSymTabRec * tab)
             }
             while ((c != '\"') && (c != '\n') && (c != '\r') && (c != '\0'));
             configRBuf[i] = '\0';
-            val.str = malloc(strlen(configRBuf) + 1);
-            strcpy(val.str, configRBuf);        /* private copy ! */
+            xf86_lex_val.str = malloc(strlen(configRBuf) + 1);
+            strcpy(xf86_lex_val.str, configRBuf);        /* private copy ! */
             return STRING;
         }
 
@@ -452,7 +452,7 @@ xf86getSubToken(char **comment)
         token = xf86getToken(NULL);
         if (token == COMMENT) {
             if (comment)
-                *comment = xf86addComment(*comment, val.str);
+                *comment = xf86addComment(*comment, xf86_lex_val.str);
         }
         else
             return token;
@@ -468,7 +468,7 @@ xf86getSubTokenWithTab(char **comment, xf86ConfigSymTabRec * tab)
         token = xf86getToken(tab);
         if (token == COMMENT) {
             if (comment)
-                *comment = xf86addComment(*comment, val.str);
+                *comment = xf86addComment(*comment, xf86_lex_val.str);
         }
         else
             return token;
@@ -820,7 +820,7 @@ static char *
 OpenConfigDir(const char *path, const char *cmdline, const char *projroot,
               const char *confname)
 {
-    char *dirpath, *pathcopy;
+    char *dirpath = NULL, *pathcopy;
     const char *template;
     Bool found = FALSE;
     int cmdlineUsed = 0;
@@ -1025,7 +1025,7 @@ xf86setSection(const char *section)
 int
 xf86getStringToken(xf86ConfigSymTabRec * tab)
 {
-    return StringToToken(val.str, tab);
+    return StringToToken(xf86_lex_val.str, tab);
 }
 
 static int
@@ -1078,9 +1078,10 @@ xf86nameCompare(const char *s1, const char *s2)
 }
 
 char *
-xf86addComment(char *cur, char *add)
+xf86addComment(char *cur, const char *add)
 {
     char *str;
+    const char *cstr;
     int len, curlen, iscomment, hasnewline = 0, insnewline, endnewline;
 
     if (add == NULL || add[0] == '\0')
@@ -1095,14 +1096,14 @@ xf86addComment(char *cur, char *add)
     else
         curlen = 0;
 
-    str = add;
+    cstr = add;
     iscomment = 0;
-    while (*str) {
-        if (*str != ' ' && *str != '\t')
+    while (*cstr) {
+        if (*cstr != ' ' && *cstr != '\t')
             break;
-        ++str;
+        ++cstr;
     }
-    iscomment = (*str == '#');
+    iscomment = (*cstr == '#');
 
     len = strlen(add);
     endnewline = add[len - 1] == '\n';
index 9c706a0..472b27b 100644 (file)
@@ -55,6 +55,7 @@
 #include <xorg-config.h>
 #endif
 
+#include "os.h"
 #include "xf86Parser.h"
 #include "xf86tokens.h"
 #include "Configint.h"
@@ -65,7 +66,7 @@
 #include <signal.h>
 #include <errno.h>
 
-#if defined(SVR4) || defined(__linux__) || defined(CSRG_BASED)
+#if defined(HAVE_SETEUID) && defined(_POSIX_SAVED_IDS) && _POSIX_SAVED_IDS > 0
 #define HAS_SAVED_IDS_AND_SETEUID
 #endif
 #if defined(WIN32)
@@ -113,6 +114,8 @@ doWriteConfigFile(const char *filename, XF86ConfigPtr cptr)
 
     xf86printInputClassSection(cf, cptr->conf_inputclass_lst);
 
+    xf86printOutputClassSection(cf, cptr->conf_outputclass_lst);
+
     xf86printVideoAdaptorSection(cf, cptr->conf_videoadaptor_lst);
 
     xf86printModesSection(cf, cptr->conf_modes_lst);
index e7210e8..3fa5b71 100644 (file)
@@ -85,7 +85,7 @@ typedef struct {
 typedef struct {
     GenericListRec list;
     int load_type;
-    char *load_name;
+    const char *load_name;
     XF86OptionPtr load_opt;
     char *load_comment;
     int ignore;
@@ -116,7 +116,7 @@ typedef struct {
 
 typedef struct {
     GenericListRec list;
-    char *ml_identifier;
+    const char *ml_identifier;
     int ml_clock;
     int ml_hdisplay;
     int ml_hsyncstart;
@@ -134,21 +134,21 @@ typedef struct {
 
 typedef struct {
     GenericListRec list;
-    char *vp_identifier;
+    const char *vp_identifier;
     XF86OptionPtr vp_option_lst;
     char *vp_comment;
 } XF86ConfVideoPortRec, *XF86ConfVideoPortPtr;
 
 typedef struct {
     GenericListRec list;
-    char *va_identifier;
-    char *va_vendor;
-    char *va_board;
-    char *va_busid;
-    char *va_driver;
+    const char *va_identifier;
+    const char *va_vendor;
+    const char *va_board;
+    const char *va_busid;
+    const char *va_driver;
     XF86OptionPtr va_option_lst;
     XF86ConfVideoPortPtr va_port_lst;
-    char *va_fwdref;
+    const char *va_fwdref;
     char *va_comment;
 } XF86ConfVideoAdaptorRec, *XF86ConfVideoAdaptorPtr;
 
@@ -165,21 +165,21 @@ typedef struct {
 
 typedef struct {
     GenericListRec list;
-    char *modes_identifier;
+    const char *modes_identifier;
     XF86ConfModeLinePtr mon_modeline_lst;
     char *modes_comment;
 } XF86ConfModesRec, *XF86ConfModesPtr;
 
 typedef struct {
     GenericListRec list;
-    char *ml_modes_str;
+    const char *ml_modes_str;
     XF86ConfModesPtr ml_modes;
 } XF86ConfModesLinkRec, *XF86ConfModesLinkPtr;
 
 typedef struct {
     GenericListRec list;
-    char *mon_identifier;
-    char *mon_vendor;
+    const char *mon_identifier;
+    const char *mon_vendor;
     char *mon_modelname;
     int mon_width;              /* in mm */
     int mon_height;             /* in mm */
@@ -201,21 +201,21 @@ typedef struct {
 
 typedef struct {
     GenericListRec list;
-    char *dev_identifier;
-    char *dev_vendor;
-    char *dev_board;
-    char *dev_chipset;
-    char *dev_busid;
-    char *dev_card;
-    char *dev_driver;
-    char *dev_ramdac;
+    const char *dev_identifier;
+    const char *dev_vendor;
+    const char *dev_board;
+    const char *dev_chipset;
+    const char *dev_busid;
+    const char *dev_card;
+    const char *dev_driver;
+    const char *dev_ramdac;
     int dev_dacSpeeds[CONF_MAXDACSPEEDS];
     int dev_videoram;
     int dev_textclockfreq;
     unsigned long dev_bios_base;
     unsigned long dev_mem_base;
     unsigned long dev_io_base;
-    char *dev_clockchip;
+    const char *dev_clockchip;
     int dev_clocks;
     int dev_clock[CONF_MAXCLOCKS];
     int dev_chipid;
@@ -224,11 +224,12 @@ typedef struct {
     int dev_screen;
     XF86OptionPtr dev_option_lst;
     char *dev_comment;
+    char *match_seat;
 } XF86ConfDeviceRec, *XF86ConfDevicePtr;
 
 typedef struct {
     GenericListRec list;
-    char *mode_name;
+    const char *mode_name;
 } XF86ModeRec, *XF86ModePtr;
 
 typedef struct {
@@ -239,7 +240,7 @@ typedef struct {
     int disp_virtualY;
     int disp_depth;
     int disp_bpp;
-    char *disp_visual;
+    const char *disp_visual;
     parser_rgb disp_weight;
     parser_rgb disp_black;
     parser_rgb disp_white;
@@ -255,26 +256,27 @@ typedef struct {
 
 typedef struct {
     GenericListRec list;
-    char *al_adaptor_str;
+    const char *al_adaptor_str;
     XF86ConfVideoAdaptorPtr al_adaptor;
 } XF86ConfAdaptorLinkRec, *XF86ConfAdaptorLinkPtr;
 
 typedef struct {
     GenericListRec list;
-    char *scrn_identifier;
-    char *scrn_obso_driver;
+    const char *scrn_identifier;
+    const char *scrn_obso_driver;
     int scrn_defaultdepth;
     int scrn_defaultbpp;
     int scrn_defaultfbbpp;
-    char *scrn_monitor_str;
+    const char *scrn_monitor_str;
     XF86ConfMonitorPtr scrn_monitor;
-    char *scrn_device_str;
+    const char *scrn_device_str;
     XF86ConfDevicePtr scrn_device;
     XF86ConfAdaptorLinkPtr scrn_adaptor_lst;
     XF86ConfDisplayPtr scrn_display_lst;
     XF86OptionPtr scrn_option_lst;
     char *scrn_comment;
     int scrn_virtualX, scrn_virtualY;
+    char *match_seat;
 } XF86ConfScreenRec, *XF86ConfScreenPtr;
 
 typedef struct {
@@ -325,6 +327,14 @@ typedef struct {
     char *comment;
 } XF86ConfInputClassRec, *XF86ConfInputClassPtr;
 
+typedef struct {
+    GenericListRec list;
+    char *identifier;
+    char *driver;
+    struct xorg_list match_driver;
+    char *comment;
+} XF86ConfOutputClassRec, *XF86ConfOutputClassPtr;
+
 /* Values for adj_where */
 #define CONF_ADJ_OBSOLETE      -1
 #define CONF_ADJ_ABSOLUTE      0
@@ -338,55 +348,56 @@ typedef struct {
     GenericListRec list;
     int adj_scrnum;
     XF86ConfScreenPtr adj_screen;
-    char *adj_screen_str;
+    const char *adj_screen_str;
     XF86ConfScreenPtr adj_top;
-    char *adj_top_str;
+    const char *adj_top_str;
     XF86ConfScreenPtr adj_bottom;
-    char *adj_bottom_str;
+    const char *adj_bottom_str;
     XF86ConfScreenPtr adj_left;
-    char *adj_left_str;
+    const char *adj_left_str;
     XF86ConfScreenPtr adj_right;
-    char *adj_right_str;
+    const char *adj_right_str;
     int adj_where;
     int adj_x;
     int adj_y;
-    char *adj_refscreen;
+    const char *adj_refscreen;
 } XF86ConfAdjacencyRec, *XF86ConfAdjacencyPtr;
 
 typedef struct {
     GenericListRec list;
-    char *inactive_device_str;
+    const char *inactive_device_str;
     XF86ConfDevicePtr inactive_device;
 } XF86ConfInactiveRec, *XF86ConfInactivePtr;
 
 typedef struct {
     GenericListRec list;
-    char *lay_identifier;
+    const char *lay_identifier;
     XF86ConfAdjacencyPtr lay_adjacency_lst;
     XF86ConfInactivePtr lay_inactive_lst;
     XF86ConfInputrefPtr lay_input_lst;
     XF86OptionPtr lay_option_lst;
+    char *match_seat;
     char *lay_comment;
 } XF86ConfLayoutRec, *XF86ConfLayoutPtr;
 
 typedef struct {
     GenericListRec list;
-    char *vs_name;
-    char *vs_identifier;
+    const char *vs_name;
+    const char *vs_identifier;
     XF86OptionPtr vs_option_lst;
     char *vs_comment;
 } XF86ConfVendSubRec, *XF86ConfVendSubPtr;
 
 typedef struct {
     GenericListRec list;
-    char *vnd_identifier;
+    const char *vnd_identifier;
     XF86OptionPtr vnd_option_lst;
     XF86ConfVendSubPtr vnd_sub_lst;
     char *vnd_comment;
 } XF86ConfVendorRec, *XF86ConfVendorPtr;
 
 typedef struct {
-    char *dri_group_name;
+    const char *dri_group_name;
     int dri_group;
     int dri_mode;
     char *dri_comment;
@@ -408,6 +419,7 @@ typedef struct {
     XF86ConfScreenPtr conf_screen_lst;
     XF86ConfInputPtr conf_input_lst;
     XF86ConfInputClassPtr conf_inputclass_lst;
+    XF86ConfOutputClassPtr conf_outputclass_lst;
     XF86ConfLayoutPtr conf_layout_lst;
     XF86ConfVendorPtr conf_vendor_lst;
     XF86ConfDRIPtr conf_dri;
@@ -462,7 +474,7 @@ extern _X_EXPORT int xf86itemNotSublist(GenericListPtr list_1,
 
 extern _X_EXPORT int xf86pathIsAbsolute(const char *path);
 extern _X_EXPORT int xf86pathIsSafe(const char *path);
-extern _X_EXPORT char *xf86addComment(char *cur, char *add);
+extern _X_EXPORT char *xf86addComment(char *cur, const char *add);
 extern _X_EXPORT Bool xf86getBoolValue(Bool *val, const char *str);
 
 #endif                          /* _xf86Parser_h_ */
index f751b7b..5c01ce7 100644 (file)
@@ -87,6 +87,7 @@ typedef enum {
     VENDOR,
     DASH,
     COMMA,
+    MATCHSEAT,
     OPTION,
     COMMENT,
 
index bc71623..45876cf 100644 (file)
@@ -570,7 +570,7 @@ IBMramdac640SetCursorColors(ScrnInfoPtr pScrn, int bg, int fg)
     (*ramdacPtr->WriteData) (pScrn, bg);
 }
 
-static void
+static Bool
 IBMramdac526LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src)
 {
     RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn);
@@ -582,9 +582,10 @@ IBMramdac526LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src)
      */
     for (i = 0; i < 1024; i++)
         (*ramdacPtr->WriteDAC) (pScrn, IBMRGB_curs_array + i, 0x00, (*src++));
+    return TRUE;
 }
 
-static void
+static Bool
 IBMramdac640LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src)
 {
     RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn);
@@ -596,6 +597,7 @@ IBMramdac640LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src)
      */
     for (i = 0; i < 1024; i++)
         (*ramdacPtr->WriteDAC) (pScrn, RGB640_CURS_WRITE + i, 0x00, (*src++));
+    return TRUE;
 }
 
 static Bool
@@ -620,7 +622,7 @@ IBMramdac526HWCursorInit(xf86CursorInfoPtr infoPtr)
         HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_1;
     infoPtr->SetCursorColors = IBMramdac526SetCursorColors;
     infoPtr->SetCursorPosition = IBMramdac526SetCursorPosition;
-    infoPtr->LoadCursorImage = IBMramdac526LoadCursorImage;
+    infoPtr->LoadCursorImageCheck = IBMramdac526LoadCursorImage;
     infoPtr->HideCursor = IBMramdac526HideCursor;
     infoPtr->ShowCursor = IBMramdac526ShowCursor;
     infoPtr->UseHWCursor = IBMramdac526UseHWCursor;
@@ -636,7 +638,7 @@ IBMramdac640HWCursorInit(xf86CursorInfoPtr infoPtr)
         HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_1;
     infoPtr->SetCursorColors = IBMramdac640SetCursorColors;
     infoPtr->SetCursorPosition = IBMramdac640SetCursorPosition;
-    infoPtr->LoadCursorImage = IBMramdac640LoadCursorImage;
+    infoPtr->LoadCursorImageCheck = IBMramdac640LoadCursorImage;
     infoPtr->HideCursor = IBMramdac640HideCursor;
     infoPtr->ShowCursor = IBMramdac640ShowCursor;
     infoPtr->UseHWCursor = IBMramdac640UseHWCursor;
index 346af4c..a3d7762 100644 (file)
@@ -9,4 +9,4 @@ EXTRA_DIST = BTPriv.h IBMPriv.h TIPriv.h xf86CursorPriv.h xf86RamDacPriv.h \
        CURSOR.NOTES
 
 AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
-INCLUDES = $(XORG_INCS)
+AM_CPPFLAGS = $(XORG_INCS)
index 393b774..2492bb5 100644 (file)
@@ -642,7 +642,7 @@ TIramdacSetCursorColors(ScrnInfoPtr pScrn, int bg, int fg)
     (*ramdacPtr->WriteDAC) (pScrn, TIDAC_CURS_COLOR, 0, (fg & 0x000000ff));
 }
 
-static void
+static Bool
 TIramdacLoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src)
 {
     RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn);
@@ -657,6 +657,7 @@ TIramdacLoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src)
         /* NOT_DONE: might need a delay here */
         (*ramdacPtr->WriteDAC) (pScrn, TIDAC_CURS_RAM_DATA, 0, *(src++));
     }
+    return TRUE;
 }
 
 static Bool
@@ -675,7 +676,7 @@ TIramdacHWCursorInit(xf86CursorInfoPtr infoPtr)
         HARDWARE_CURSOR_SOURCE_MASK_NOT_INTERLEAVED;
     infoPtr->SetCursorColors = TIramdacSetCursorColors;
     infoPtr->SetCursorPosition = TIramdacSetCursorPosition;
-    infoPtr->LoadCursorImage = TIramdacLoadCursorImage;
+    infoPtr->LoadCursorImageCheck = TIramdacLoadCursorImage;
     infoPtr->HideCursor = TIramdacHideCursor;
     infoPtr->ShowCursor = TIramdacShowCursor;
     infoPtr->UseHWCursor = TIramdacUseHWCursor;
index 8d48a75..fac6822 100644 (file)
@@ -16,7 +16,6 @@
  * Externing inputInfo is not the nice way to do it but it works.
  */
 #include "inputstr.h"
-extern InputInfo inputInfo;
 
 DevPrivateKeyRec xf86CursorScreenKeyRec;
 
@@ -272,7 +271,7 @@ xf86CursorRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCurs)
         (xf86CursorScreenPtr) dixLookupPrivate(&pScreen->devPrivates,
                                                xf86CursorScreenKey);
 
-    if (pCurs->refcnt <= 1)
+    if (CursorRefCount(pCurs) <= 1)
         dixSetScreenPrivate(&pCurs->devPrivates, CursorScreenKey, pScreen,
                             NULL);
 
@@ -286,7 +285,7 @@ xf86CursorUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCurs)
         (xf86CursorScreenPtr) dixLookupPrivate(&pScreen->devPrivates,
                                                xf86CursorScreenKey);
 
-    if (pCurs->refcnt <= 1) {
+    if (CursorRefCount(pCurs) <= 1) {
         free(dixLookupScreenPrivate
              (&pCurs->devPrivates, CursorScreenKey, pScreen));
         dixSetScreenPrivate(&pCurs->devPrivates, CursorScreenKey, pScreen,
@@ -323,42 +322,43 @@ xf86CursorSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCurs,
     /* only update for VCP, otherwise we get cursor jumps when removing a
        sprite. The second cursor is never HW rendered anyway. */
     if (GetMaster(pDev, MASTER_POINTER) == inputInfo.pointer) {
-        pCurs->refcnt++;
+        CursorPtr cursor = RefCursor(pCurs);
         if (ScreenPriv->CurrentCursor)
             FreeCursor(ScreenPriv->CurrentCursor, None);
-        ScreenPriv->CurrentCursor = pCurs;
+        ScreenPriv->CurrentCursor = cursor;
         ScreenPriv->x = x;
         ScreenPriv->y = y;
         ScreenPriv->CursorToRestore = NULL;
-        ScreenPriv->HotX = pCurs->bits->xhot;
-        ScreenPriv->HotY = pCurs->bits->yhot;
+        ScreenPriv->HotX = cursor->bits->xhot;
+        ScreenPriv->HotY = cursor->bits->yhot;
 
         if (!infoPtr->pScrn->vtSema)
-            ScreenPriv->SavedCursor = pCurs;
+            ScreenPriv->SavedCursor = cursor;
 
         if (infoPtr->pScrn->vtSema && xorg_list_is_empty(&pScreen->pixmap_dirty_list) &&
             (ScreenPriv->ForceHWCursorCount ||
              ((
 #ifdef ARGB_CURSOR
-               pCurs->bits->argb &&
+               cursor->bits->argb &&
                infoPtr->UseHWCursorARGB &&
-               (*infoPtr->UseHWCursorARGB)(pScreen, pCurs)) ||
-              (pCurs->bits->argb == 0 &&
+               (*infoPtr->UseHWCursorARGB)(pScreen, cursor)) ||
+              (cursor->bits->argb == 0 &&
 #endif
-               (pCurs->bits->height <= infoPtr->MaxHeight) &&
-               (pCurs->bits->width <= infoPtr->MaxWidth) &&
-               (!infoPtr->UseHWCursor || (*infoPtr->UseHWCursor) (pScreen, pCurs)))))) {
+               (cursor->bits->height <= infoPtr->MaxHeight) &&
+               (cursor->bits->width <= infoPtr->MaxWidth) &&
+               (!infoPtr->UseHWCursor || (*infoPtr->UseHWCursor) (pScreen, cursor)))))) {
             
             if (ScreenPriv->SWCursor)   /* remove the SW cursor */
                 (*ScreenPriv->spriteFuncs->SetCursor) (pDev, pScreen,
                                                        NullCursor, x, y);
 
-            xf86SetCursor(pScreen, pCurs, x, y);
-            ScreenPriv->SWCursor = FALSE;
-            ScreenPriv->isUp = TRUE;
+            if (xf86SetCursor(pScreen, cursor, x, y)) {
+                ScreenPriv->SWCursor = FALSE;
+                ScreenPriv->isUp = TRUE;
 
-            miPointerSetWaitForUpdate(pScreen, !infoPtr->pScrn->silkenMouse);
-            return;
+                miPointerSetWaitForUpdate(pScreen, !infoPtr->pScrn->silkenMouse);
+                return;
+            }
         }
 
         miPointerSetWaitForUpdate(pScreen, TRUE);
index 5658e7b..a389a99 100644 (file)
@@ -13,6 +13,7 @@ typedef struct _xf86CursorInfoRec {
     void (*SetCursorColors) (ScrnInfoPtr pScrn, int bg, int fg);
     void (*SetCursorPosition) (ScrnInfoPtr pScrn, int x, int y);
     void (*LoadCursorImage) (ScrnInfoPtr pScrn, unsigned char *bits);
+    Bool (*LoadCursorImageCheck) (ScrnInfoPtr pScrn, unsigned char *bits);
     void (*HideCursor) (ScrnInfoPtr pScrn);
     void (*ShowCursor) (ScrnInfoPtr pScrn);
     unsigned char *(*RealizeCursor) (struct _xf86CursorInfoRec *, CursorPtr);
@@ -21,10 +22,41 @@ typedef struct _xf86CursorInfoRec {
 #ifdef ARGB_CURSOR
     Bool (*UseHWCursorARGB) (ScreenPtr, CursorPtr);
     void (*LoadCursorARGB) (ScrnInfoPtr, CursorPtr);
+    Bool (*LoadCursorARGBCheck) (ScrnInfoPtr, CursorPtr);
 #endif
 
 } xf86CursorInfoRec, *xf86CursorInfoPtr;
 
+static inline Bool
+xf86DriverHasLoadCursorImage(xf86CursorInfoPtr infoPtr)
+{
+    return infoPtr->LoadCursorImageCheck || infoPtr->LoadCursorImage;
+}
+
+static inline Bool
+xf86DriverLoadCursorImage(xf86CursorInfoPtr infoPtr, unsigned char *bits)
+{
+    if(infoPtr->LoadCursorImageCheck)
+        return infoPtr->LoadCursorImageCheck(infoPtr->pScrn, bits);
+    infoPtr->LoadCursorImage(infoPtr->pScrn, bits);
+    return TRUE;
+}
+
+static inline Bool
+xf86DriverHasLoadCursorARGB(xf86CursorInfoPtr infoPtr)
+{
+    return infoPtr->LoadCursorARGBCheck || infoPtr->LoadCursorARGB;
+}
+
+static inline Bool
+xf86DriverLoadCursorARGB(xf86CursorInfoPtr infoPtr, CursorPtr pCursor)
+{
+    if(infoPtr->LoadCursorARGBCheck)
+        return infoPtr->LoadCursorARGBCheck(infoPtr->pScrn, pCursor);
+    infoPtr->LoadCursorARGB(infoPtr->pScrn, pCursor);
+    return TRUE;
+}
+
 extern _X_EXPORT Bool xf86InitCursor(ScreenPtr pScreen,
                                      xf86CursorInfoPtr infoPtr);
 extern _X_EXPORT xf86CursorInfoPtr xf86CreateCursorInfoRec(void);
index 04be141..f34c1c7 100644 (file)
@@ -34,10 +34,10 @@ typedef struct {
     int ForceHWCursorCount;
     Bool HWCursorForced;
 
-    pointer transparentData;
+    void *transparentData;
 } xf86CursorScreenRec, *xf86CursorScreenPtr;
 
-void xf86SetCursor(ScreenPtr pScreen, CursorPtr pCurs, int x, int y);
+Bool xf86SetCursor(ScreenPtr pScreen, CursorPtr pCurs, int x, int y);
 void xf86SetTransparentCursor(ScreenPtr pScreen);
 void xf86MoveCursor(ScreenPtr pScreen, int x, int y);
 void xf86RecolorCursor(ScreenPtr pScreen, CursorPtr pCurs, Bool displayed);
index 197abff..953c86a 100644 (file)
@@ -87,7 +87,7 @@ xf86InitHardwareCursor(ScreenPtr pScreen, xf86CursorInfoPtr infoPtr)
 
     /* These are required for now */
     if (!infoPtr->SetCursorPosition ||
-        !infoPtr->LoadCursorImage ||
+        !xf86DriverHasLoadCursorImage(infoPtr) ||
         !infoPtr->HideCursor ||
         !infoPtr->ShowCursor || !infoPtr->SetCursorColors)
         return FALSE;
@@ -119,7 +119,7 @@ xf86InitHardwareCursor(ScreenPtr pScreen, xf86CursorInfoPtr infoPtr)
     return TRUE;
 }
 
-void
+Bool
 xf86SetCursor(ScreenPtr pScreen, CursorPtr pCurs, int x, int y)
 {
     xf86CursorScreenPtr ScreenPriv =
@@ -130,7 +130,7 @@ xf86SetCursor(ScreenPtr pScreen, CursorPtr pCurs, int x, int y)
 
     if (pCurs == NullCursor) {
         (*infoPtr->HideCursor) (infoPtr->pScrn);
-        return;
+        return TRUE;
     }
 
     bits =
@@ -140,7 +140,7 @@ xf86SetCursor(ScreenPtr pScreen, CursorPtr pCurs, int x, int y)
     y -= infoPtr->pScrn->frameY0 + ScreenPriv->HotY;
 
 #ifdef ARGB_CURSOR
-    if (!pCurs->bits->argb || !infoPtr->LoadCursorARGB)
+    if (!pCurs->bits->argb || !xf86DriverHasLoadCursorARGB(infoPtr))
 #endif
         if (!bits) {
             bits = (*infoPtr->RealizeCursor) (infoPtr, pCurs);
@@ -152,18 +152,21 @@ xf86SetCursor(ScreenPtr pScreen, CursorPtr pCurs, int x, int y)
         (*infoPtr->HideCursor) (infoPtr->pScrn);
 
 #ifdef ARGB_CURSOR
-    if (pCurs->bits->argb && infoPtr->LoadCursorARGB)
-        (*infoPtr->LoadCursorARGB) (infoPtr->pScrn, pCurs);
-    else
+    if (pCurs->bits->argb && xf86DriverHasLoadCursorARGB(infoPtr)) {
+        if (!xf86DriverLoadCursorARGB (infoPtr, pCurs))
+            return FALSE;
+    } else
 #endif
     if (bits)
-        (*infoPtr->LoadCursorImage) (infoPtr->pScrn, bits);
+        if (!xf86DriverLoadCursorImage (infoPtr, bits))
+            return FALSE;
 
     xf86RecolorCursor(pScreen, pCurs, 1);
 
     (*infoPtr->SetCursorPosition) (infoPtr->pScrn, x, y);
 
     (*infoPtr->ShowCursor) (infoPtr->pScrn);
+    return TRUE;
 }
 
 void
@@ -182,8 +185,8 @@ xf86SetTransparentCursor(ScreenPtr pScreen)
         (*infoPtr->HideCursor) (infoPtr->pScrn);
 
     if (ScreenPriv->transparentData)
-        (*infoPtr->LoadCursorImage) (infoPtr->pScrn,
-                                     ScreenPriv->transparentData);
+        xf86DriverLoadCursorImage (infoPtr,
+                                   ScreenPriv->transparentData);
 
     (*infoPtr->ShowCursor) (infoPtr->pScrn);
 }
@@ -462,9 +465,9 @@ RealizeCursorInterleave16(xf86CursorInfoPtr infoPtr, CursorPtr pCurs)
     }
 
     /* 16 bit interleave */
-    DstS = (pointer) mem2;
+    DstS = (void *) mem2;
     DstM = DstS + (size >> 2);
-    pntr = (pointer) mem;
+    pntr = (void *) mem;
     count = (size >> 1);
     while (count) {
         *pntr++ = *DstS++;
@@ -497,9 +500,9 @@ RealizeCursorInterleave32(xf86CursorInfoPtr infoPtr, CursorPtr pCurs)
     }
 
     /* 32 bit interleave */
-    DstS = (pointer) mem2;
+    DstS = (void *) mem2;
     DstM = DstS + (size >> 3);
-    pntr = (pointer) mem;
+    pntr = (void *) mem;
     count = (size >> 2);
     while (count) {
         *pntr++ = *DstS++;
@@ -532,9 +535,9 @@ RealizeCursorInterleave64(xf86CursorInfoPtr infoPtr, CursorPtr pCurs)
     }
 
     /* 64 bit interleave */
-    DstS = (pointer) mem2;
+    DstS = (void *) mem2;
     DstM = DstS + (size >> 3);
-    pntr = (pointer) mem;
+    pntr = (void *) mem;
     count = (size >> 2);
     while (count) {
         *pntr++ = *DstS++;
index 1bbd820..70cdaca 100755 (executable)
@@ -44,6 +44,9 @@ cat > sdksyms.c << EOF
 /* miext/sync/Makefile.am */
 #include "misync.h"
 #include "misyncstr.h"
+#if HAVE_XSHMFENCE
+#include "misyncshm.h"
+#endif
 
 /* Xext/Makefile.am -- half is module, half is builtin */
 #ifdef XV
@@ -99,9 +102,7 @@ cat > sdksyms.c << EOF
 # include "dri2.h"
 #endif
 
-#if HWC
-#include "hwc.h"
-#endif
+# include "dri3.h"
 
 /* hw/xfree86/vgahw/Makefile.am -- module */
 /*
@@ -210,7 +211,6 @@ cat > sdksyms.c << EOF
 #include "miline.h"
 #include "mipointer.h"
 #include "mi.h"
-#include "mibstore.h"
 #include "migc.h"
 #include "mipointrst.h"
 #include "mizerarc.h"
@@ -247,6 +247,15 @@ cat > sdksyms.c << EOF
 #include "xfixes.h"
 
 
+#if HWC
+#include "hwc.h"
+#endif
+
+#if HWA
+#include "hwa.h"
+#endif
+
+
 /* include/Makefile.am */
 #include "XIstubs.h"
 #include "Xprintf.h"
@@ -261,8 +270,10 @@ cat > sdksyms.c << EOF
 #include "dix.h"
 #include "dixaccess.h"
 #include "dixevents.h"
+#define _FONTPROTO_H
 #include "dixfont.h"
 #include "dixfontstr.h"
+#include "dixfontstubs.h"
 #include "dixgrabs.h"
 #include "dixstruct.h"
 #include "exevents.h"
index 5756fca..22f7ada 100644 (file)
@@ -5,6 +5,6 @@ libshadowfb_la_LIBADD = $(PIXMAN_LIBS)
 
 sdk_HEADERS = shadowfb.h
 
-INCLUDES = $(XORG_INCS)
+AM_CPPFLAGS = $(XORG_INCS)
 
 AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
index 6145017..d2481ed 100644 (file)
@@ -1,8 +1,8 @@
 /*
    Copyright (C) 1999.  The XFree86 Project Inc.
+   Copyright 2014 Red Hat, Inc.
 
    Written by Mark Vojkovich (mvojkovi@ucsd.edu)
-
    Pre-fb-write callbacks and RENDER support - Nolan Leake (nolan@vmware.com)
 */
 
 #include "picturestr.h"
 
 static Bool ShadowCloseScreen(ScreenPtr pScreen);
-static void ShadowCopyWindow(WindowPtr pWin,
-                             DDXPointRec ptOldOrg, RegionPtr prgn);
-static Bool ShadowCreateGC(GCPtr pGC);
-
-static Bool ShadowEnterVT(ScrnInfoPtr pScrn);
-static void ShadowLeaveVT(ScrnInfoPtr pScrn);
-
-static void ShadowComposite(CARD8 op,
-                            PicturePtr pSrc,
-                            PicturePtr pMask,
-                            PicturePtr pDst,
-                            INT16 xSrc,
-                            INT16 ySrc,
-                            INT16 xMask,
-                            INT16 yMask,
-                            INT16 xDst,
-                            INT16 yDst, CARD16 width, CARD16 height);
+static Bool ShadowCreateRootWindow(WindowPtr pWin);
 
 typedef struct {
     ScrnInfoPtr pScrn;
     RefreshAreaFuncPtr preRefresh;
     RefreshAreaFuncPtr postRefresh;
     CloseScreenProcPtr CloseScreen;
-    CopyWindowProcPtr CopyWindow;
-    CreateGCProcPtr CreateGC;
-    ModifyPixmapHeaderProcPtr ModifyPixmapHeader;
-    CompositeProcPtr Composite;
-    Bool (*EnterVT) (ScrnInfoPtr);
-    void (*LeaveVT) (ScrnInfoPtr);
-    Bool vtSema;
+    CreateWindowProcPtr CreateWindow;
 } ShadowScreenRec, *ShadowScreenPtr;
 
-typedef struct {
-    GCOps *ops;
-    GCFuncs *funcs;
-} ShadowGCRec, *ShadowGCPtr;
-
 static DevPrivateKeyRec ShadowScreenKeyRec;
 
-#define ShadowScreenKey (&ShadowScreenKeyRec)
-
-static DevPrivateKeyRec ShadowGCKeyRec;
-
-#define ShadowGCKey (&ShadowGCKeyRec)
-
-#define GET_SCREEN_PRIVATE(pScreen) \
-    (ShadowScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, ShadowScreenKey)
-#define GET_GC_PRIVATE(pGC) \
-    (ShadowGCPtr)dixLookupPrivate(&(pGC)->devPrivates, ShadowGCKey)
-
-#define SHADOW_GC_FUNC_PROLOGUE(pGC)\
-    ShadowGCPtr pGCPriv = GET_GC_PRIVATE(pGC);\
-    (pGC)->funcs = pGCPriv->funcs;\
-    if(pGCPriv->ops)\
-        (pGC)->ops = pGCPriv->ops
-
-#define SHADOW_GC_FUNC_EPILOGUE(pGC)\
-    pGCPriv->funcs = (pGC)->funcs;\
-    (pGC)->funcs = &ShadowGCFuncs;\
-    if(pGCPriv->ops) {\
-        pGCPriv->ops = (pGC)->ops;\
-        (pGC)->ops = &ShadowGCOps;\
-    }
-
-#define SHADOW_GC_OP_PROLOGUE(pGC)\
-    ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(pGC->pScreen); \
-    ShadowGCPtr pGCPriv = GET_GC_PRIVATE(pGC);\
-    GCFuncs *oldFuncs = pGC->funcs;\
-    pGC->funcs = pGCPriv->funcs;\
-    pGC->ops = pGCPriv->ops
-
-#define SHADOW_GC_OP_EPILOGUE(pGC)\
-    pGCPriv->ops = pGC->ops;\
-    pGC->funcs = oldFuncs;\
-    pGC->ops   = &ShadowGCOps
-
-#define IS_VISIBLE(pWin) (pPriv->vtSema && \
-    (((WindowPtr)pWin)->visibility != VisibilityFullyObscured))
-
-#define TRIM_BOX(box, pGC) { \
-    BoxPtr extents = &pGC->pCompositeClip->extents;\
-    if(box.x1 < extents->x1) box.x1 = extents->x1; \
-    if(box.x2 > extents->x2) box.x2 = extents->x2; \
-    if(box.y1 < extents->y1) box.y1 = extents->y1; \
-    if(box.y2 > extents->y2) box.y2 = extents->y2; \
-    }
-
-#define TRANSLATE_BOX(box, pDraw) { \
-    box.x1 += pDraw->x; \
-    box.x2 += pDraw->x; \
-    box.y1 += pDraw->y; \
-    box.y2 += pDraw->y; \
-    }
-
-#define TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC) { \
-    TRANSLATE_BOX(box, pDraw); \
-    TRIM_BOX(box, pGC); \
-    }
-
-#define BOX_NOT_EMPTY(box) \
-    (((box.x2 - box.x1) > 0) && ((box.y2 - box.y1) > 0))
+static ShadowScreenPtr
+shadowfbGetScreenPrivate(ScreenPtr pScreen)
+{
+    return dixLookupPrivate(&(pScreen)->devPrivates, &ShadowScreenKeyRec);
+}
 
 Bool
 ShadowFBInit2(ScreenPtr pScreen,
@@ -138,7 +54,6 @@ ShadowFBInit2(ScreenPtr pScreen,
 {
     ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
     ShadowScreenPtr pPriv;
-    PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
 
     if (!preRefreshArea && !postRefreshArea)
         return FALSE;
@@ -146,39 +61,20 @@ ShadowFBInit2(ScreenPtr pScreen,
     if (!dixRegisterPrivateKey(&ShadowScreenKeyRec, PRIVATE_SCREEN, 0))
         return FALSE;
 
-    if (!dixRegisterPrivateKey
-        (&ShadowGCKeyRec, PRIVATE_GC, sizeof(ShadowGCRec)))
-        return FALSE;
-
     if (!(pPriv = (ShadowScreenPtr) malloc(sizeof(ShadowScreenRec))))
         return FALSE;
 
-    dixSetPrivate(&pScreen->devPrivates, ShadowScreenKey, pPriv);
+    dixSetPrivate(&pScreen->devPrivates, &ShadowScreenKeyRec, pPriv);
 
     pPriv->pScrn = pScrn;
     pPriv->preRefresh = preRefreshArea;
     pPriv->postRefresh = postRefreshArea;
-    pPriv->vtSema = TRUE;
 
     pPriv->CloseScreen = pScreen->CloseScreen;
-    pPriv->CopyWindow = pScreen->CopyWindow;
-    pPriv->CreateGC = pScreen->CreateGC;
-    pPriv->ModifyPixmapHeader = pScreen->ModifyPixmapHeader;
-
-    pPriv->EnterVT = pScrn->EnterVT;
-    pPriv->LeaveVT = pScrn->LeaveVT;
+    pPriv->CreateWindow = pScreen->CreateWindow;
 
     pScreen->CloseScreen = ShadowCloseScreen;
-    pScreen->CopyWindow = ShadowCopyWindow;
-    pScreen->CreateGC = ShadowCreateGC;
-
-    pScrn->EnterVT = ShadowEnterVT;
-    pScrn->LeaveVT = ShadowLeaveVT;
-
-    if (ps) {
-        pPriv->Composite = ps->Composite;
-        ps->Composite = ShadowComposite;
-    }
+    pScreen->CreateWindow = ShadowCreateRootWindow;
 
     return TRUE;
 }
@@ -189,1451 +85,87 @@ ShadowFBInit(ScreenPtr pScreen, RefreshAreaFuncPtr refreshArea)
     return ShadowFBInit2(pScreen, NULL, refreshArea);
 }
 
-/**********************************************************/
-
-static Bool
-ShadowEnterVT(ScrnInfoPtr pScrn)
-{
-    Bool ret;
-    ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(pScrn->pScreen);
-
-    pScrn->EnterVT = pPriv->EnterVT;
-    ret = (*pPriv->EnterVT) (pScrn);
-    pPriv->EnterVT = pScrn->EnterVT;
-    pScrn->EnterVT = ShadowEnterVT;
-    if (ret) {
-        pPriv->vtSema = TRUE;
-        return TRUE;
-    }
-
-    return FALSE;
-}
-
-static void
-ShadowLeaveVT(ScrnInfoPtr pScrn)
-{
-    ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(pScrn->pScreen);
-
-    pPriv->vtSema = FALSE;
-
-    pScrn->LeaveVT = pPriv->LeaveVT;
-    (*pPriv->LeaveVT) (pScrn);
-    pPriv->LeaveVT = pScrn->LeaveVT;
-    pScrn->LeaveVT = ShadowLeaveVT;
-}
-
-/**********************************************************/
-
-static Bool
-ShadowCloseScreen(ScreenPtr pScreen)
-{
-    ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
-    ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(pScreen);
-    PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
-
-    pScreen->CloseScreen = pPriv->CloseScreen;
-    pScreen->CopyWindow = pPriv->CopyWindow;
-    pScreen->CreateGC = pPriv->CreateGC;
-    pScreen->ModifyPixmapHeader = pPriv->ModifyPixmapHeader;
-
-    pScrn->EnterVT = pPriv->EnterVT;
-    pScrn->LeaveVT = pPriv->LeaveVT;
-
-    if (ps) {
-        ps->Composite = pPriv->Composite;
-    }
-
-    free((pointer) pPriv);
-
-    return (*pScreen->CloseScreen) (pScreen);
-}
+/*
+ * Note that we don't do DamageEmpty, or indeed look at the region inside the
+ * DamagePtr at all.  This is an optimization, believe it or not.  The
+ * incoming RegionPtr is the new damage, and if we were to empty the region
+ * miext/damage would just have to waste time reallocating and re-unioning
+ * it every time, whereas if we leave it around the union gets fast-pathed
+ * away.
+ */
 
 static void
-ShadowCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgn)
+shadowfbReportPre(DamagePtr damage, RegionPtr reg, void *closure)
 {
-    ScreenPtr pScreen = pWin->drawable.pScreen;
-    ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(pScreen);
-    int num = 0;
-    RegionRec rgnDst;
-
-    if (pPriv->vtSema) {
-        RegionNull(&rgnDst);
-        RegionCopy(&rgnDst, prgn);
-
-        RegionTranslate(&rgnDst,
-                        pWin->drawable.x - ptOldOrg.x,
-                        pWin->drawable.y - ptOldOrg.y);
-        RegionIntersect(&rgnDst, &pWin->borderClip, &rgnDst);
-        if ((num = RegionNumRects(&rgnDst))) {
-            if (pPriv->preRefresh)
-                (*pPriv->preRefresh) (pPriv->pScrn, num, RegionRects(&rgnDst));
-        }
-        else {
-            RegionUninit(&rgnDst);
-        }
-    }
+    ShadowScreenPtr pPriv = closure;
 
-    pScreen->CopyWindow = pPriv->CopyWindow;
-    (*pScreen->CopyWindow) (pWin, ptOldOrg, prgn);
-    pScreen->CopyWindow = ShadowCopyWindow;
+    if (!pPriv->pScrn->vtSema)
+        return;
 
-    if (num) {
-        if (pPriv->postRefresh)
-            (*pPriv->postRefresh) (pPriv->pScrn, num, RegionRects(&rgnDst));
-        RegionUninit(&rgnDst);
-    }
+    pPriv->preRefresh(pPriv->pScrn, RegionNumRects(reg), RegionRects(reg));
 }
 
 static void
-ShadowComposite(CARD8 op,
-                PicturePtr pSrc,
-                PicturePtr pMask,
-                PicturePtr pDst,
-                INT16 xSrc,
-                INT16 ySrc,
-                INT16 xMask,
-                INT16 yMask,
-                INT16 xDst, INT16 yDst, CARD16 width, CARD16 height)
+shadowfbReportPost(DamagePtr damage, RegionPtr reg, void *closure)
 {
-    ScreenPtr pScreen = pDst->pDrawable->pScreen;
-    ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(pScreen);
-    PictureScreenPtr ps = GetPictureScreen(pScreen);
-    BoxRec box;
-    BoxPtr extents;
-    Bool boxNotEmpty = FALSE;
-
-    if (pPriv->vtSema && pDst->pDrawable->type == DRAWABLE_WINDOW) {
-
-        box.x1 = pDst->pDrawable->x + xDst;
-        box.y1 = pDst->pDrawable->y + yDst;
-        box.x2 = box.x1 + width;
-        box.y2 = box.y1 + height;
-
-        extents = &pDst->pCompositeClip->extents;
-        if (box.x1 < extents->x1)
-            box.x1 = extents->x1;
-        if (box.x2 > extents->x2)
-            box.x2 = extents->x2;
-        if (box.y1 < extents->y1)
-            box.y1 = extents->y1;
-        if (box.y2 > extents->y2)
-            box.y2 = extents->y2;
-
-        if (BOX_NOT_EMPTY(box)) {
-            if (pPriv->preRefresh)
-                (*pPriv->preRefresh) (pPriv->pScrn, 1, &box);
-            boxNotEmpty = TRUE;
-        }
-    }
+    ShadowScreenPtr pPriv = closure;
 
-    ps->Composite = pPriv->Composite;
-    (*ps->Composite) (op, pSrc, pMask, pDst, xSrc, ySrc,
-                      xMask, yMask, xDst, yDst, width, height);
-    ps->Composite = ShadowComposite;
+    if (!pPriv->pScrn->vtSema)
+        return;
 
-    if (pPriv->postRefresh && boxNotEmpty) {
-        (*pPriv->postRefresh) (pPriv->pScrn, 1, &box);
-    }
+    pPriv->postRefresh(pPriv->pScrn, RegionNumRects(reg), RegionRects(reg));
 }
 
-/**********************************************************/
-
-static void ShadowValidateGC(GCPtr, unsigned long, DrawablePtr);
-static void ShadowChangeGC(GCPtr, unsigned long);
-static void ShadowCopyGC(GCPtr, unsigned long, GCPtr);
-static void ShadowDestroyGC(GCPtr);
-static void ShadowChangeClip(GCPtr, int, pointer, int);
-static void ShadowDestroyClip(GCPtr);
-static void ShadowCopyClip(GCPtr, GCPtr);
-
-GCFuncs ShadowGCFuncs = {
-    ShadowValidateGC, ShadowChangeGC, ShadowCopyGC, ShadowDestroyGC,
-    ShadowChangeClip, ShadowDestroyClip, ShadowCopyClip
-};
-
-extern GCOps ShadowGCOps;
-
 static Bool
-ShadowCreateGC(GCPtr pGC)
+ShadowCreateRootWindow(WindowPtr pWin)
 {
-    ScreenPtr pScreen = pGC->pScreen;
-    ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(pScreen);
-    ShadowGCPtr pGCPriv = GET_GC_PRIVATE(pGC);
     Bool ret;
+    ScreenPtr pScreen = pWin->drawable.pScreen;
+    ShadowScreenPtr pPriv = shadowfbGetScreenPrivate(pScreen);
 
-    pScreen->CreateGC = pPriv->CreateGC;
-    if ((ret = (*pScreen->CreateGC) (pGC))) {
-        pGCPriv->ops = NULL;
-        pGCPriv->funcs = pGC->funcs;
-        pGC->funcs = &ShadowGCFuncs;
-    }
-    pScreen->CreateGC = ShadowCreateGC;
-
-    return ret;
-}
-
-static void
-ShadowValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDraw)
-{
-    SHADOW_GC_FUNC_PROLOGUE(pGC);
-    (*pGC->funcs->ValidateGC) (pGC, changes, pDraw);
-    if (pDraw->type == DRAWABLE_WINDOW)
-        pGCPriv->ops = pGC->ops;        /* just so it's not NULL */
-    else
-        pGCPriv->ops = NULL;
-    SHADOW_GC_FUNC_EPILOGUE(pGC);
-}
-
-static void
-ShadowDestroyGC(GCPtr pGC)
-{
-    SHADOW_GC_FUNC_PROLOGUE(pGC);
-    (*pGC->funcs->DestroyGC) (pGC);
-    SHADOW_GC_FUNC_EPILOGUE(pGC);
-}
-
-static void
-ShadowChangeGC(GCPtr pGC, unsigned long mask)
-{
-    SHADOW_GC_FUNC_PROLOGUE(pGC);
-    (*pGC->funcs->ChangeGC) (pGC, mask);
-    SHADOW_GC_FUNC_EPILOGUE(pGC);
-}
-
-static void
-ShadowCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst)
-{
-    SHADOW_GC_FUNC_PROLOGUE(pGCDst);
-    (*pGCDst->funcs->CopyGC) (pGCSrc, mask, pGCDst);
-    SHADOW_GC_FUNC_EPILOGUE(pGCDst);
-}
-
-static void
-ShadowChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects)
-{
-    SHADOW_GC_FUNC_PROLOGUE(pGC);
-    (*pGC->funcs->ChangeClip) (pGC, type, pvalue, nrects);
-    SHADOW_GC_FUNC_EPILOGUE(pGC);
-}
-
-static void
-ShadowCopyClip(GCPtr pgcDst, GCPtr pgcSrc)
-{
-    SHADOW_GC_FUNC_PROLOGUE(pgcDst);
-    (*pgcDst->funcs->CopyClip) (pgcDst, pgcSrc);
-    SHADOW_GC_FUNC_EPILOGUE(pgcDst);
-}
-
-static void
-ShadowDestroyClip(GCPtr pGC)
-{
-    SHADOW_GC_FUNC_PROLOGUE(pGC);
-    (*pGC->funcs->DestroyClip) (pGC);
-    SHADOW_GC_FUNC_EPILOGUE(pGC);
-}
-
-/**********************************************************/
-
-static void
-ShadowFillSpans(DrawablePtr pDraw,
-                GC * pGC,
-                int nInit, DDXPointPtr pptInit, int *pwidthInit, int fSorted)
-{
-    SHADOW_GC_OP_PROLOGUE(pGC);
-
-    if (IS_VISIBLE(pDraw) && nInit) {
-        DDXPointPtr ppt = pptInit;
-        int *pwidth = pwidthInit;
-        int i = nInit;
-        BoxRec box;
-        Bool boxNotEmpty = FALSE;
-
-        box.x1 = ppt->x;
-        box.x2 = box.x1 + *pwidth;
-        box.y2 = box.y1 = ppt->y;
-
-        while (--i) {
-            ppt++;
-            pwidth++;
-            if (box.x1 > ppt->x)
-                box.x1 = ppt->x;
-            if (box.x2 < (ppt->x + *pwidth))
-                box.x2 = ppt->x + *pwidth;
-            if (box.y1 > ppt->y)
-                box.y1 = ppt->y;
-            else if (box.y2 < ppt->y)
-                box.y2 = ppt->y;
-        }
-
-        box.y2++;
-
-        if (!pGC->miTranslate) {
-            TRANSLATE_BOX(box, pDraw);
-        }
-        TRIM_BOX(box, pGC);
-
-        if (BOX_NOT_EMPTY(box)) {
-            if (pPriv->preRefresh)
-                (*pPriv->preRefresh) (pPriv->pScrn, 1, &box);
-            boxNotEmpty = TRUE;
-        }
-
-        (*pGC->ops->FillSpans) (pDraw, pGC, nInit, pptInit, pwidthInit,
-                                fSorted);
-
-        if (boxNotEmpty && pPriv->postRefresh)
-            (*pPriv->postRefresh) (pPriv->pScrn, 1, &box);
-    }
-    else
-        (*pGC->ops->FillSpans) (pDraw, pGC, nInit, pptInit, pwidthInit,
-                                fSorted);
-
-    SHADOW_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-ShadowSetSpans(DrawablePtr pDraw,
-               GCPtr pGC,
-               char *pcharsrc,
-               DDXPointPtr pptInit, int *pwidthInit, int nspans, int fSorted)
-{
-    SHADOW_GC_OP_PROLOGUE(pGC);
-
-    if (IS_VISIBLE(pDraw) && nspans) {
-        DDXPointPtr ppt = pptInit;
-        int *pwidth = pwidthInit;
-        int i = nspans;
-        BoxRec box;
-        Bool boxNotEmpty = FALSE;
-
-        box.x1 = ppt->x;
-        box.x2 = box.x1 + *pwidth;
-        box.y2 = box.y1 = ppt->y;
-
-        while (--i) {
-            ppt++;
-            pwidth++;
-            if (box.x1 > ppt->x)
-                box.x1 = ppt->x;
-            if (box.x2 < (ppt->x + *pwidth))
-                box.x2 = ppt->x + *pwidth;
-            if (box.y1 > ppt->y)
-                box.y1 = ppt->y;
-            else if (box.y2 < ppt->y)
-                box.y2 = ppt->y;
-        }
-
-        box.y2++;
-
-        if (!pGC->miTranslate) {
-            TRANSLATE_BOX(box, pDraw);
-        }
-        TRIM_BOX(box, pGC);
-
-        if (BOX_NOT_EMPTY(box)) {
-            if (pPriv->preRefresh)
-                (*pPriv->preRefresh) (pPriv->pScrn, 1, &box);
-            boxNotEmpty = TRUE;
-        }
-
-        (*pGC->ops->SetSpans) (pDraw, pGC, pcharsrc, pptInit,
-                               pwidthInit, nspans, fSorted);
-
-        if (boxNotEmpty && pPriv->postRefresh)
-            (*pPriv->postRefresh) (pPriv->pScrn, 1, &box);
-    }
-    else
-        (*pGC->ops->SetSpans) (pDraw, pGC, pcharsrc, pptInit,
-                               pwidthInit, nspans, fSorted);
-
-    SHADOW_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-ShadowPutImage(DrawablePtr pDraw,
-               GCPtr pGC,
-               int depth,
-               int x, int y, int w, int h,
-               int leftPad, int format, char *pImage)
-{
-    BoxRec box;
-    Bool boxNotEmpty = FALSE;
+    /* paranoia */
+    if (pWin != pScreen->root)
+        ErrorF("ShadowCreateRootWindow called unexpectedly\n");
 
-    SHADOW_GC_OP_PROLOGUE(pGC);
+    /* call down, but don't hook ourselves back in; we know the first time
+     * we're called it's for the root window.
+     */
+    pScreen->CreateWindow = pPriv->CreateWindow;
+    ret = pScreen->CreateWindow(pWin);
 
-    if (IS_VISIBLE(pDraw)) {
-        box.x1 = x + pDraw->x;
-        box.x2 = box.x1 + w;
-        box.y1 = y + pDraw->y;
-        box.y2 = box.y1 + h;
+    /* this might look like it leaks, but the damage code reaps listeners
+     * when their drawable disappears.
+     */
+    if (ret) {
+        DamagePtr damage;
 
-        TRIM_BOX(box, pGC);
-        if (BOX_NOT_EMPTY(box)) {
-            if (pPriv->preRefresh)
-                (*pPriv->preRefresh) (pPriv->pScrn, 1, &box);
-            boxNotEmpty = TRUE;
+        if (pPriv->preRefresh) {
+            damage = DamageCreate(shadowfbReportPre, NULL,
+                                  DamageReportRawRegion,
+                                  TRUE, pScreen, pPriv);
+            DamageRegister(&pWin->drawable, damage);
         }
-    }
-
-    (*pGC->ops->PutImage) (pDraw, pGC, depth, x, y, w, h,
-                           leftPad, format, pImage);
-
-    if (boxNotEmpty && pPriv->postRefresh)
-        (*pPriv->postRefresh) (pPriv->pScrn, 1, &box);
-
-    SHADOW_GC_OP_EPILOGUE(pGC);
-
-}
-
-static RegionPtr
-ShadowCopyArea(DrawablePtr pSrc,
-               DrawablePtr pDst,
-               GC * pGC,
-               int srcx, int srcy, int width, int height, int dstx, int dsty)
-{
-    RegionPtr ret;
-    BoxRec box;
-    Bool boxNotEmpty = FALSE;
-
-    SHADOW_GC_OP_PROLOGUE(pGC);
-
-    if (IS_VISIBLE(pDst)) {
-        box.x1 = dstx + pDst->x;
-        box.x2 = box.x1 + width;
-        box.y1 = dsty + pDst->y;
-        box.y2 = box.y1 + height;
 
-        TRIM_BOX(box, pGC);
-        if (BOX_NOT_EMPTY(box)) {
-            if (pPriv->preRefresh)
-                (*pPriv->preRefresh) (pPriv->pScrn, 1, &box);
-            boxNotEmpty = TRUE;
+        if (pPriv->postRefresh) {
+            damage = DamageCreate(shadowfbReportPost, NULL,
+                                  DamageReportRawRegion,
+                                  TRUE, pScreen, pPriv);
+            DamageSetReportAfterOp(damage, TRUE);
+            DamageRegister(&pWin->drawable, damage);
         }
     }
 
-    ret = (*pGC->ops->CopyArea) (pSrc, pDst,
-                                 pGC, srcx, srcy, width, height, dstx, dsty);
-
-    if (boxNotEmpty && pPriv->postRefresh)
-        (*pPriv->postRefresh) (pPriv->pScrn, 1, &box);
-
-    SHADOW_GC_OP_EPILOGUE(pGC);
-
     return ret;
 }
 
-static RegionPtr
-ShadowCopyPlane(DrawablePtr pSrc,
-                DrawablePtr pDst,
-                GCPtr pGC,
-                int srcx, int srcy,
-                int width, int height,
-                int dstx, int dsty, unsigned long bitPlane)
-{
-    RegionPtr ret;
-    BoxRec box;
-    Bool boxNotEmpty = FALSE;
-
-    SHADOW_GC_OP_PROLOGUE(pGC);
-
-    if (IS_VISIBLE(pDst)) {
-        box.x1 = dstx + pDst->x;
-        box.x2 = box.x1 + width;
-        box.y1 = dsty + pDst->y;
-        box.y2 = box.y1 + height;
-
-        TRIM_BOX(box, pGC);
-        if (BOX_NOT_EMPTY(box)) {
-            if (pPriv->preRefresh)
-                (*pPriv->preRefresh) (pPriv->pScrn, 1, &box);
-            boxNotEmpty = TRUE;
-        }
-    }
-
-    ret = (*pGC->ops->CopyPlane) (pSrc, pDst,
-                                  pGC, srcx, srcy, width, height, dstx, dsty,
-                                  bitPlane);
-
-    if (boxNotEmpty && pPriv->postRefresh)
-        (*pPriv->postRefresh) (pPriv->pScrn, 1, &box);
-
-    SHADOW_GC_OP_EPILOGUE(pGC);
-
-    return ret;
-}
-
-static void
-ShadowPolyPoint(DrawablePtr pDraw,
-                GCPtr pGC, int mode, int nptInit, xPoint * pptInit)
-{
-    BoxRec box;
-    Bool boxNotEmpty = FALSE;
-
-    SHADOW_GC_OP_PROLOGUE(pGC);
-
-    if (IS_VISIBLE(pDraw) && nptInit) {
-        xPoint *ppt = pptInit;
-        int npt = nptInit;
-
-        box.x2 = box.x1 = pptInit->x;
-        box.y2 = box.y1 = pptInit->y;
-
-        /* this could be slow if the points were spread out */
-
-        while (--npt) {
-            ppt++;
-            if (box.x1 > ppt->x)
-                box.x1 = ppt->x;
-            else if (box.x2 < ppt->x)
-                box.x2 = ppt->x;
-            if (box.y1 > ppt->y)
-                box.y1 = ppt->y;
-            else if (box.y2 < ppt->y)
-                box.y2 = ppt->y;
-        }
-
-        box.x2++;
-        box.y2++;
-
-        TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC);
-        if (BOX_NOT_EMPTY(box)) {
-            if (pPriv->preRefresh)
-                (*pPriv->preRefresh) (pPriv->pScrn, 1, &box);
-            boxNotEmpty = TRUE;
-        }
-    }
-
-    (*pGC->ops->PolyPoint) (pDraw, pGC, mode, nptInit, pptInit);
-
-    if (boxNotEmpty && pPriv->postRefresh)
-        (*pPriv->postRefresh) (pPriv->pScrn, 1, &box);
-
-    SHADOW_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-ShadowPolylines(DrawablePtr pDraw,
-                GCPtr pGC, int mode, int nptInit, DDXPointPtr pptInit)
-{
-    BoxRec box;
-    Bool boxNotEmpty = FALSE;
-
-    SHADOW_GC_OP_PROLOGUE(pGC);
-
-    if (IS_VISIBLE(pDraw) && nptInit) {
-        DDXPointPtr ppt = pptInit;
-        int npt = nptInit;
-        int extra = pGC->lineWidth >> 1;
-
-        box.x2 = box.x1 = pptInit->x;
-        box.y2 = box.y1 = pptInit->y;
-
-        if (npt > 1) {
-            if (pGC->joinStyle == JoinMiter)
-                extra = 6 * pGC->lineWidth;
-            else if (pGC->capStyle == CapProjecting)
-                extra = pGC->lineWidth;
-        }
-
-        if (mode == CoordModePrevious) {
-            int x = box.x1;
-            int y = box.y1;
-
-            while (--npt) {
-                ppt++;
-                x += ppt->x;
-                y += ppt->y;
-                if (box.x1 > x)
-                    box.x1 = x;
-                else if (box.x2 < x)
-                    box.x2 = x;
-                if (box.y1 > y)
-                    box.y1 = y;
-                else if (box.y2 < y)
-                    box.y2 = y;
-            }
-        }
-        else {
-            while (--npt) {
-                ppt++;
-                if (box.x1 > ppt->x)
-                    box.x1 = ppt->x;
-                else if (box.x2 < ppt->x)
-                    box.x2 = ppt->x;
-                if (box.y1 > ppt->y)
-                    box.y1 = ppt->y;
-                else if (box.y2 < ppt->y)
-                    box.y2 = ppt->y;
-            }
-        }
-
-        box.x2++;
-        box.y2++;
-
-        if (extra) {
-            box.x1 -= extra;
-            box.x2 += extra;
-            box.y1 -= extra;
-            box.y2 += extra;
-        }
-
-        TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC);
-        if (BOX_NOT_EMPTY(box)) {
-            if (pPriv->preRefresh)
-                (*pPriv->preRefresh) (pPriv->pScrn, 1, &box);
-            boxNotEmpty = TRUE;
-        }
-    }
-
-    (*pGC->ops->Polylines) (pDraw, pGC, mode, nptInit, pptInit);
-
-    if (boxNotEmpty && pPriv->postRefresh)
-        (*pPriv->postRefresh) (pPriv->pScrn, 1, &box);
-
-    SHADOW_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-ShadowPolySegment(DrawablePtr pDraw,
-                  GCPtr pGC, int nsegInit, xSegment * pSegInit)
-{
-    BoxRec box;
-    Bool boxNotEmpty = FALSE;
-
-    SHADOW_GC_OP_PROLOGUE(pGC);
-
-    if (IS_VISIBLE(pDraw) && nsegInit) {
-        int extra = pGC->lineWidth;
-        xSegment *pSeg = pSegInit;
-        int nseg = nsegInit;
-
-        if (pGC->capStyle != CapProjecting)
-            extra >>= 1;
-
-        if (pSeg->x2 > pSeg->x1) {
-            box.x1 = pSeg->x1;
-            box.x2 = pSeg->x2;
-        }
-        else {
-            box.x2 = pSeg->x1;
-            box.x1 = pSeg->x2;
-        }
-
-        if (pSeg->y2 > pSeg->y1) {
-            box.y1 = pSeg->y1;
-            box.y2 = pSeg->y2;
-        }
-        else {
-            box.y2 = pSeg->y1;
-            box.y1 = pSeg->y2;
-        }
-
-        while (--nseg) {
-            pSeg++;
-            if (pSeg->x2 > pSeg->x1) {
-                if (pSeg->x1 < box.x1)
-                    box.x1 = pSeg->x1;
-                if (pSeg->x2 > box.x2)
-                    box.x2 = pSeg->x2;
-            }
-            else {
-                if (pSeg->x2 < box.x1)
-                    box.x1 = pSeg->x2;
-                if (pSeg->x1 > box.x2)
-                    box.x2 = pSeg->x1;
-            }
-            if (pSeg->y2 > pSeg->y1) {
-                if (pSeg->y1 < box.y1)
-                    box.y1 = pSeg->y1;
-                if (pSeg->y2 > box.y2)
-                    box.y2 = pSeg->y2;
-            }
-            else {
-                if (pSeg->y2 < box.y1)
-                    box.y1 = pSeg->y2;
-                if (pSeg->y1 > box.y2)
-                    box.y2 = pSeg->y1;
-            }
-        }
-
-        box.x2++;
-        box.y2++;
-
-        if (extra) {
-            box.x1 -= extra;
-            box.x2 += extra;
-            box.y1 -= extra;
-            box.y2 += extra;
-        }
-
-        TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC);
-        if (BOX_NOT_EMPTY(box)) {
-            if (pPriv->preRefresh)
-                (*pPriv->preRefresh) (pPriv->pScrn, 1, &box);
-            boxNotEmpty = TRUE;
-        }
-    }
-
-    (*pGC->ops->PolySegment) (pDraw, pGC, nsegInit, pSegInit);
-
-    if (boxNotEmpty && pPriv->postRefresh)
-        (*pPriv->postRefresh) (pPriv->pScrn, 1, &box);
-
-    SHADOW_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-ShadowPolyRectangle(DrawablePtr pDraw,
-                    GCPtr pGC, int nRectsInit, xRectangle *pRectsInit)
-{
-    BoxRec box;
-    BoxPtr pBoxInit = NULL;
-    Bool boxNotEmpty = FALSE;
-    int num = 0;
-
-    SHADOW_GC_OP_PROLOGUE(pGC);
-
-    if (IS_VISIBLE(pDraw) && nRectsInit) {
-        xRectangle *pRects = pRectsInit;
-        int nRects = nRectsInit;
-
-        if (nRects >= 32) {
-            int extra = pGC->lineWidth >> 1;
-
-            box.x1 = pRects->x;
-            box.x2 = box.x1 + pRects->width;
-            box.y1 = pRects->y;
-            box.y2 = box.y1 + pRects->height;
-
-            while (--nRects) {
-                pRects++;
-                if (box.x1 > pRects->x)
-                    box.x1 = pRects->x;
-                if (box.x2 < (pRects->x + pRects->width))
-                    box.x2 = pRects->x + pRects->width;
-                if (box.y1 > pRects->y)
-                    box.y1 = pRects->y;
-                if (box.y2 < (pRects->y + pRects->height))
-                    box.y2 = pRects->y + pRects->height;
-            }
-
-            if (extra) {
-                box.x1 -= extra;
-                box.x2 += extra;
-                box.y1 -= extra;
-                box.y2 += extra;
-            }
-
-            box.x2++;
-            box.y2++;
-
-            TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC);
-            if (BOX_NOT_EMPTY(box)) {
-                if (pPriv->preRefresh)
-                    (*pPriv->preRefresh) (pPriv->pScrn, 1, &box);
-                boxNotEmpty = TRUE;
-            }
-        }
-        else {
-            BoxPtr pbox;
-            int offset1, offset2, offset3;
-
-            offset2 = pGC->lineWidth;
-            if (!offset2)
-                offset2 = 1;
-            offset1 = offset2 >> 1;
-            offset3 = offset2 - offset1;
-
-            pBoxInit = (BoxPtr) malloc(nRects * 4 * sizeof(BoxRec));
-            pbox = pBoxInit;
-
-            while (nRects--) {
-                pbox->x1 = pRects->x - offset1;
-                pbox->y1 = pRects->y - offset1;
-                pbox->x2 = pbox->x1 + pRects->width + offset2;
-                pbox->y2 = pbox->y1 + offset2;
-                TRIM_AND_TRANSLATE_BOX((*pbox), pDraw, pGC);
-                if (BOX_NOT_EMPTY((*pbox))) {
-                    num++;
-                    pbox++;
-                }
-
-                pbox->x1 = pRects->x - offset1;
-                pbox->y1 = pRects->y + offset3;
-                pbox->x2 = pbox->x1 + offset2;
-                pbox->y2 = pbox->y1 + pRects->height - offset2;
-                TRIM_AND_TRANSLATE_BOX((*pbox), pDraw, pGC);
-                if (BOX_NOT_EMPTY((*pbox))) {
-                    num++;
-                    pbox++;
-                }
-
-                pbox->x1 = pRects->x + pRects->width - offset1;
-                pbox->y1 = pRects->y + offset3;
-                pbox->x2 = pbox->x1 + offset2;
-                pbox->y2 = pbox->y1 + pRects->height - offset2;
-                TRIM_AND_TRANSLATE_BOX((*pbox), pDraw, pGC);
-                if (BOX_NOT_EMPTY((*pbox))) {
-                    num++;
-                    pbox++;
-                }
-
-                pbox->x1 = pRects->x - offset1;
-                pbox->y1 = pRects->y + pRects->height - offset1;
-                pbox->x2 = pbox->x1 + pRects->width + offset2;
-                pbox->y2 = pbox->y1 + offset2;
-                TRIM_AND_TRANSLATE_BOX((*pbox), pDraw, pGC);
-                if (BOX_NOT_EMPTY((*pbox))) {
-                    num++;
-                    pbox++;
-                }
-
-                pRects++;
-            }
-
-            if (num) {
-                if (pPriv->preRefresh)
-                    (*pPriv->preRefresh) (pPriv->pScrn, num, pBoxInit);
-            }
-            else {
-                free(pBoxInit);
-            }
-        }
-    }
-
-    (*pGC->ops->PolyRectangle) (pDraw, pGC, nRectsInit, pRectsInit);
-
-    if (boxNotEmpty && pPriv->postRefresh) {
-        (*pPriv->postRefresh) (pPriv->pScrn, 1, &box);
-    }
-    else if (num) {
-        if (pPriv->postRefresh)
-            (*pPriv->postRefresh) (pPriv->pScrn, num, pBoxInit);
-        free(pBoxInit);
-    }
-
-    SHADOW_GC_OP_EPILOGUE(pGC);
-
-}
-
-static void
-ShadowPolyArc(DrawablePtr pDraw, GCPtr pGC, int narcsInit, xArc * parcsInit)
-{
-    BoxRec box;
-    Bool boxNotEmpty = FALSE;
-
-    SHADOW_GC_OP_PROLOGUE(pGC);
-
-    if (IS_VISIBLE(pDraw) && narcsInit) {
-        int narcs = narcsInit;
-        xArc *parcs = parcsInit;
-        int extra = pGC->lineWidth >> 1;
-
-        box.x1 = parcs->x;
-        box.x2 = box.x1 + parcs->width;
-        box.y1 = parcs->y;
-        box.y2 = box.y1 + parcs->height;
-
-        /* should I break these up instead ? */
-
-        while (--narcs) {
-            parcs++;
-            if (box.x1 > parcs->x)
-                box.x1 = parcs->x;
-            if (box.x2 < (parcs->x + parcs->width))
-                box.x2 = parcs->x + parcs->width;
-            if (box.y1 > parcs->y)
-                box.y1 = parcs->y;
-            if (box.y2 < (parcs->y + parcs->height))
-                box.y2 = parcs->y + parcs->height;
-        }
-
-        if (extra) {
-            box.x1 -= extra;
-            box.x2 += extra;
-            box.y1 -= extra;
-            box.y2 += extra;
-        }
-
-        box.x2++;
-        box.y2++;
-
-        TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC);
-        if (BOX_NOT_EMPTY(box)) {
-            if (pPriv->preRefresh)
-                (*pPriv->preRefresh) (pPriv->pScrn, 1, &box);
-            boxNotEmpty = TRUE;
-        }
-    }
-
-    (*pGC->ops->PolyArc) (pDraw, pGC, narcsInit, parcsInit);
-
-    if (boxNotEmpty && pPriv->postRefresh)
-        (*pPriv->postRefresh) (pPriv->pScrn, 1, &box);
-
-    SHADOW_GC_OP_EPILOGUE(pGC);
-
-}
-
-static void
-ShadowFillPolygon(DrawablePtr pDraw,
-                  GCPtr pGC,
-                  int shape, int mode, int count, DDXPointPtr pptInit)
-{
-    SHADOW_GC_OP_PROLOGUE(pGC);
-
-    if (IS_VISIBLE(pDraw) && (count > 2)) {
-        DDXPointPtr ppt = pptInit;
-        int i = count;
-        BoxRec box;
-        Bool boxNotEmpty = FALSE;
-
-        box.x2 = box.x1 = ppt->x;
-        box.y2 = box.y1 = ppt->y;
-
-        if (mode != CoordModeOrigin) {
-            int x = box.x1;
-            int y = box.y1;
-
-            while (--i) {
-                ppt++;
-                x += ppt->x;
-                y += ppt->y;
-                if (box.x1 > x)
-                    box.x1 = x;
-                else if (box.x2 < x)
-                    box.x2 = x;
-                if (box.y1 > y)
-                    box.y1 = y;
-                else if (box.y2 < y)
-                    box.y2 = y;
-            }
-        }
-        else {
-            while (--i) {
-                ppt++;
-                if (box.x1 > ppt->x)
-                    box.x1 = ppt->x;
-                else if (box.x2 < ppt->x)
-                    box.x2 = ppt->x;
-                if (box.y1 > ppt->y)
-                    box.y1 = ppt->y;
-                else if (box.y2 < ppt->y)
-                    box.y2 = ppt->y;
-            }
-        }
-
-        box.x2++;
-        box.y2++;
-
-        TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC);
-        if (BOX_NOT_EMPTY(box)) {
-            if (pPriv->preRefresh)
-                (*pPriv->preRefresh) (pPriv->pScrn, 1, &box);
-            boxNotEmpty = TRUE;
-        }
-
-        (*pGC->ops->FillPolygon) (pDraw, pGC, shape, mode, count, pptInit);
-
-        if (boxNotEmpty && pPriv->postRefresh)
-            (*pPriv->postRefresh) (pPriv->pScrn, 1, &box);
-    }
-    else
-        (*pGC->ops->FillPolygon) (pDraw, pGC, shape, mode, count, pptInit);
-
-    SHADOW_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-ShadowPolyFillRect(DrawablePtr pDraw,
-                   GCPtr pGC, int nRectsInit, xRectangle *pRectsInit)
-{
-    SHADOW_GC_OP_PROLOGUE(pGC);
-
-    if (IS_VISIBLE(pDraw) && nRectsInit) {
-        BoxRec box;
-        Bool boxNotEmpty = FALSE;
-        xRectangle *pRects = pRectsInit;
-        int nRects = nRectsInit;
-
-        box.x1 = pRects->x;
-        box.x2 = box.x1 + pRects->width;
-        box.y1 = pRects->y;
-        box.y2 = box.y1 + pRects->height;
-
-        while (--nRects) {
-            pRects++;
-            if (box.x1 > pRects->x)
-                box.x1 = pRects->x;
-            if (box.x2 < (pRects->x + pRects->width))
-                box.x2 = pRects->x + pRects->width;
-            if (box.y1 > pRects->y)
-                box.y1 = pRects->y;
-            if (box.y2 < (pRects->y + pRects->height))
-                box.y2 = pRects->y + pRects->height;
-        }
-
-        /* cfb messes with the pRectsInit so we have to do our
-           calculations first */
-
-        TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC);
-        if (BOX_NOT_EMPTY(box)) {
-            if (pPriv->preRefresh)
-                (*pPriv->preRefresh) (pPriv->pScrn, 1, &box);
-            boxNotEmpty = TRUE;
-        }
-
-        (*pGC->ops->PolyFillRect) (pDraw, pGC, nRectsInit, pRectsInit);
-
-        if (boxNotEmpty && pPriv->postRefresh)
-            (*pPriv->postRefresh) (pPriv->pScrn, 1, &box);
-    }
-    else
-        (*pGC->ops->PolyFillRect) (pDraw, pGC, nRectsInit, pRectsInit);
-
-    SHADOW_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-ShadowPolyFillArc(DrawablePtr pDraw, GCPtr pGC, int narcsInit, xArc * parcsInit)
-{
-    BoxRec box;
-    Bool boxNotEmpty = FALSE;
-
-    SHADOW_GC_OP_PROLOGUE(pGC);
-
-    if (IS_VISIBLE(pDraw) && narcsInit) {
-        xArc *parcs = parcsInit;
-        int narcs = narcsInit;
-
-        box.x1 = parcs->x;
-        box.x2 = box.x1 + parcs->width;
-        box.y1 = parcs->y;
-        box.y2 = box.y1 + parcs->height;
-
-        /* should I break these up instead ? */
-
-        while (--narcs) {
-            parcs++;
-            if (box.x1 > parcs->x)
-                box.x1 = parcs->x;
-            if (box.x2 < (parcs->x + parcs->width))
-                box.x2 = parcs->x + parcs->width;
-            if (box.y1 > parcs->y)
-                box.y1 = parcs->y;
-            if (box.y2 < (parcs->y + parcs->height))
-                box.y2 = parcs->y + parcs->height;
-        }
-
-        TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC);
-        if (BOX_NOT_EMPTY(box)) {
-            if (pPriv->preRefresh)
-                (*pPriv->preRefresh) (pPriv->pScrn, 1, &box);
-            boxNotEmpty = TRUE;
-        }
-    }
-
-    (*pGC->ops->PolyFillArc) (pDraw, pGC, narcsInit, parcsInit);
-
-    if (boxNotEmpty && pPriv->postRefresh)
-        (*pPriv->postRefresh) (pPriv->pScrn, 1, &box);
-
-    SHADOW_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-ShadowTextExtent(FontPtr pFont, int count, char *chars,
-                 FontEncoding fontEncoding, BoxPtr box)
-{
-    unsigned long n, i;
-    int w;
-    CharInfoPtr charinfo[255];  /* encoding only has 1 byte for count */
-
-    GetGlyphs(pFont, (unsigned long) count, (unsigned char *) chars,
-              fontEncoding, &n, charinfo);
-    w = 0;
-    for (i = 0; i < n; i++) {
-        w += charinfo[i]->metrics.characterWidth;
-    }
-    if (i) {
-        w += charinfo[i - 1]->metrics.rightSideBearing;
-    }
-
-    box->x1 = 0;
-    if (n) {
-        if (charinfo[0]->metrics.leftSideBearing < 0) {
-            box->x1 = charinfo[0]->metrics.leftSideBearing;
-        }
-    }
-    box->x2 = w;
-    box->y1 = -FONTMAXBOUNDS(pFont, ascent);
-    box->y2 = FONTMAXBOUNDS(pFont, descent);
-}
-
-static void
-ShadowFontToBox(BoxPtr BB, DrawablePtr pDrawable, GCPtr pGC, int x, int y,
-                int count, char *chars, int wide)
-{
-    FontPtr pFont;
-
-    pFont = pGC->font;
-    if (pFont->info.constantWidth) {
-        int ascent, descent, left, right = 0;
-
-        ascent = max(pFont->info.fontAscent, pFont->info.maxbounds.ascent);
-        descent = max(pFont->info.fontDescent, pFont->info.maxbounds.descent);
-        left = pFont->info.maxbounds.leftSideBearing;
-        if (count > 0) {
-            right = (count - 1) * pFont->info.maxbounds.characterWidth;
-        }
-        right += pFont->info.maxbounds.rightSideBearing;
-        BB->x1 =
-            max(pDrawable->x + x - left,
-                RegionExtents(&((WindowPtr) pDrawable)->winSize)->x1);
-        BB->y1 =
-            max(pDrawable->y + y - ascent,
-                RegionExtents(&((WindowPtr) pDrawable)->winSize)->y1);
-        BB->x2 =
-            min(pDrawable->x + x + right,
-                RegionExtents(&((WindowPtr) pDrawable)->winSize)->x2);
-        BB->y2 =
-            min(pDrawable->y + y + descent,
-                RegionExtents(&((WindowPtr) pDrawable)->winSize)->y2);
-    }
-    else {
-        ShadowTextExtent(pFont, count, chars, wide ? (FONTLASTROW(pFont) == 0)
-                         ? Linear16Bit : TwoD16Bit : Linear8Bit, BB);
-        BB->x1 =
-            max(pDrawable->x + x + BB->x1,
-                RegionExtents(&((WindowPtr) pDrawable)->winSize)->x1);
-        BB->y1 =
-            max(pDrawable->y + y + BB->y1,
-                RegionExtents(&((WindowPtr) pDrawable)->winSize)->y1);
-        BB->x2 =
-            min(pDrawable->x + x + BB->x2,
-                RegionExtents(&((WindowPtr) pDrawable)->winSize)->x2);
-        BB->y2 =
-            min(pDrawable->y + y + BB->y2,
-                RegionExtents(&((WindowPtr) pDrawable)->winSize)->y2);
-    }
-}
-
-static int
-ShadowPolyText8(DrawablePtr pDraw,
-                GCPtr pGC, int x, int y, int count, char *chars)
-{
-    int width;
-    BoxRec box;
-    Bool boxNotEmpty = FALSE;
-
-    SHADOW_GC_OP_PROLOGUE(pGC);
-
-    if (IS_VISIBLE(pDraw)) {
-        ShadowFontToBox(&box, pDraw, pGC, x, y, count, chars, 0);
-
-        TRIM_BOX(box, pGC);
-        if (BOX_NOT_EMPTY(box)) {
-            if (pPriv->preRefresh)
-                (*pPriv->preRefresh) (pPriv->pScrn, 1, &box);
-            boxNotEmpty = TRUE;
-        }
-    }
-
-    width = (*pGC->ops->PolyText8) (pDraw, pGC, x, y, count, chars);
-
-    if (boxNotEmpty && pPriv->postRefresh)
-        (*pPriv->postRefresh) (pPriv->pScrn, 1, &box);
-
-    SHADOW_GC_OP_EPILOGUE(pGC);
-
-    return width;
-}
-
-static int
-ShadowPolyText16(DrawablePtr pDraw,
-                 GCPtr pGC, int x, int y, int count, unsigned short *chars)
-{
-    int width;
-    BoxRec box;
-    Bool boxNotEmpty = FALSE;
-
-    SHADOW_GC_OP_PROLOGUE(pGC);
-
-    if (IS_VISIBLE(pDraw)) {
-        ShadowFontToBox(&box, pDraw, pGC, x, y, count, (char *) chars, 1);
-
-        TRIM_BOX(box, pGC);
-        if (BOX_NOT_EMPTY(box)) {
-            if (pPriv->preRefresh)
-                (*pPriv->preRefresh) (pPriv->pScrn, 1, &box);
-            boxNotEmpty = TRUE;
-        }
-    }
-
-    width = (*pGC->ops->PolyText16) (pDraw, pGC, x, y, count, chars);
-
-    if (boxNotEmpty && pPriv->postRefresh)
-        (*pPriv->postRefresh) (pPriv->pScrn, 1, &box);
-
-    SHADOW_GC_OP_EPILOGUE(pGC);
-
-    return width;
-}
-
-static void
-ShadowImageText8(DrawablePtr pDraw,
-                 GCPtr pGC, int x, int y, int count, char *chars)
-{
-    BoxRec box;
-    Bool boxNotEmpty = FALSE;
-
-    SHADOW_GC_OP_PROLOGUE(pGC);
-
-    if (IS_VISIBLE(pDraw) && count) {
-        int top, bot, Min, Max;
-
-        top = max(FONTMAXBOUNDS(pGC->font, ascent), FONTASCENT(pGC->font));
-        bot = max(FONTMAXBOUNDS(pGC->font, descent), FONTDESCENT(pGC->font));
-
-        Min = count * FONTMINBOUNDS(pGC->font, characterWidth);
-        if (Min > 0)
-            Min = 0;
-        Max = count * FONTMAXBOUNDS(pGC->font, characterWidth);
-        if (Max < 0)
-            Max = 0;
-
-        /* ugh */
-        box.x1 = pDraw->x + x + Min + FONTMINBOUNDS(pGC->font, leftSideBearing);
-        box.x2 = pDraw->x + x + Max +
-            FONTMAXBOUNDS(pGC->font, rightSideBearing);
-
-        box.y1 = pDraw->y + y - top;
-        box.y2 = pDraw->y + y + bot;
-
-        TRIM_BOX(box, pGC);
-        if (BOX_NOT_EMPTY(box)) {
-            if (pPriv->preRefresh)
-                (*pPriv->preRefresh) (pPriv->pScrn, 1, &box);
-            boxNotEmpty = TRUE;
-        }
-    }
-
-    (*pGC->ops->ImageText8) (pDraw, pGC, x, y, count, chars);
-
-    if (boxNotEmpty && pPriv->postRefresh)
-        (*pPriv->postRefresh) (pPriv->pScrn, 1, &box);
-
-    SHADOW_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-ShadowImageText16(DrawablePtr pDraw,
-                  GCPtr pGC, int x, int y, int count, unsigned short *chars)
-{
-    BoxRec box;
-    Bool boxNotEmpty = FALSE;
-
-    SHADOW_GC_OP_PROLOGUE(pGC);
-
-    if (IS_VISIBLE(pDraw) && count) {
-        int top, bot, Min, Max;
-
-        top = max(FONTMAXBOUNDS(pGC->font, ascent), FONTASCENT(pGC->font));
-        bot = max(FONTMAXBOUNDS(pGC->font, descent), FONTDESCENT(pGC->font));
-
-        Min = count * FONTMINBOUNDS(pGC->font, characterWidth);
-        if (Min > 0)
-            Min = 0;
-        Max = count * FONTMAXBOUNDS(pGC->font, characterWidth);
-        if (Max < 0)
-            Max = 0;
-
-        /* ugh */
-        box.x1 = pDraw->x + x + Min + FONTMINBOUNDS(pGC->font, leftSideBearing);
-        box.x2 = pDraw->x + x + Max +
-            FONTMAXBOUNDS(pGC->font, rightSideBearing);
-
-        box.y1 = pDraw->y + y - top;
-        box.y2 = pDraw->y + y + bot;
-
-        TRIM_BOX(box, pGC);
-        if (BOX_NOT_EMPTY(box)) {
-            if (pPriv->preRefresh)
-                (*pPriv->preRefresh) (pPriv->pScrn, 1, &box);
-            boxNotEmpty = TRUE;
-        }
-    }
-
-    (*pGC->ops->ImageText16) (pDraw, pGC, x, y, count, chars);
-
-    if (boxNotEmpty && pPriv->postRefresh)
-        (*pPriv->postRefresh) (pPriv->pScrn, 1, &box);
-
-    SHADOW_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-ShadowImageGlyphBlt(DrawablePtr pDraw,
-                    GCPtr pGC,
-                    int x, int y,
-                    unsigned int nglyphInit,
-                    CharInfoPtr * ppciInit, pointer pglyphBase)
-{
-    BoxRec box;
-    Bool boxNotEmpty = FALSE;
-
-    SHADOW_GC_OP_PROLOGUE(pGC);
-
-    if (IS_VISIBLE(pDraw) && nglyphInit) {
-        CharInfoPtr *ppci = ppciInit;
-        unsigned int nglyph = nglyphInit;
-        int top, bot, width = 0;
-
-        top = max(FONTMAXBOUNDS(pGC->font, ascent), FONTASCENT(pGC->font));
-        bot = max(FONTMAXBOUNDS(pGC->font, descent), FONTDESCENT(pGC->font));
-
-        box.x1 = ppci[0]->metrics.leftSideBearing;
-        if (box.x1 > 0)
-            box.x1 = 0;
-        box.x2 = ppci[nglyph - 1]->metrics.rightSideBearing -
-            ppci[nglyph - 1]->metrics.characterWidth;
-        if (box.x2 < 0)
-            box.x2 = 0;
-
-        box.x2 += pDraw->x + x;
-        box.x1 += pDraw->x + x;
-
-        while (nglyph--) {
-            width += (*ppci)->metrics.characterWidth;
-            ppci++;
-        }
-
-        if (width > 0)
-            box.x2 += width;
-        else
-            box.x1 += width;
-
-        box.y1 = pDraw->y + y - top;
-        box.y2 = pDraw->y + y + bot;
-
-        TRIM_BOX(box, pGC);
-        if (BOX_NOT_EMPTY(box)) {
-            if (pPriv->preRefresh)
-                (*pPriv->preRefresh) (pPriv->pScrn, 1, &box);
-            boxNotEmpty = TRUE;
-        }
-    }
-
-    (*pGC->ops->ImageGlyphBlt) (pDraw, pGC, x, y, nglyphInit,
-                                ppciInit, pglyphBase);
-
-    if (boxNotEmpty && pPriv->postRefresh)
-        (*pPriv->postRefresh) (pPriv->pScrn, 1, &box);
-
-    SHADOW_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-ShadowPolyGlyphBlt(DrawablePtr pDraw,
-                   GCPtr pGC,
-                   int x, int y,
-                   unsigned int nglyphInit,
-                   CharInfoPtr * ppciInit, pointer pglyphBase)
-{
-    BoxRec box;
-    Bool boxNotEmpty = FALSE;
-
-    SHADOW_GC_OP_PROLOGUE(pGC);
-
-    if (IS_VISIBLE(pDraw) && nglyphInit) {
-        CharInfoPtr *ppci = ppciInit;
-        unsigned int nglyph = nglyphInit;
-
-        /* ugh */
-        box.x1 = pDraw->x + x + ppci[0]->metrics.leftSideBearing;
-        box.x2 = pDraw->x + x + ppci[nglyph - 1]->metrics.rightSideBearing;
-
-        if (nglyph > 1) {
-            int width = 0;
-
-            while (--nglyph) {
-                width += (*ppci)->metrics.characterWidth;
-                ppci++;
-            }
-
-            if (width > 0)
-                box.x2 += width;
-            else
-                box.x1 += width;
-        }
-
-        box.y1 = pDraw->y + y - FONTMAXBOUNDS(pGC->font, ascent);
-        box.y2 = pDraw->y + y + FONTMAXBOUNDS(pGC->font, descent);
-
-        TRIM_BOX(box, pGC);
-        if (BOX_NOT_EMPTY(box)) {
-            if (pPriv->preRefresh)
-                (*pPriv->preRefresh) (pPriv->pScrn, 1, &box);
-            boxNotEmpty = TRUE;
-        }
-    }
-
-    (*pGC->ops->PolyGlyphBlt) (pDraw, pGC, x, y, nglyphInit,
-                               ppciInit, pglyphBase);
-
-    if (boxNotEmpty && pPriv->postRefresh)
-        (*pPriv->postRefresh) (pPriv->pScrn, 1, &box);
-
-    SHADOW_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-ShadowPushPixels(GCPtr pGC,
-                 PixmapPtr pBitMap,
-                 DrawablePtr pDraw, int dx, int dy, int xOrg, int yOrg)
+static Bool
+ShadowCloseScreen(ScreenPtr pScreen)
 {
-    BoxRec box;
-    Bool boxNotEmpty = FALSE;
-
-    SHADOW_GC_OP_PROLOGUE(pGC);
-
-    if (IS_VISIBLE(pDraw)) {
-        box.x1 = xOrg;
-        box.y1 = yOrg;
-
-        if (!pGC->miTranslate) {
-            box.x1 += pDraw->x;
-            box.y1 += pDraw->y;
-        }
+    ShadowScreenPtr pPriv = shadowfbGetScreenPrivate(pScreen);
 
-        box.x2 = box.x1 + dx;
-        box.y2 = box.y1 + dy;
-
-        TRIM_BOX(box, pGC);
-        if (BOX_NOT_EMPTY(box)) {
-            if (pPriv->preRefresh)
-                (*pPriv->preRefresh) (pPriv->pScrn, 1, &box);
-            boxNotEmpty = TRUE;
-        }
-    }
-
-    (*pGC->ops->PushPixels) (pGC, pBitMap, pDraw, dx, dy, xOrg, yOrg);
+    pScreen->CloseScreen = pPriv->CloseScreen;
 
-    if (boxNotEmpty && pPriv->postRefresh)
-        (*pPriv->postRefresh) (pPriv->pScrn, 1, &box);
+    free(pPriv);
 
-    SHADOW_GC_OP_EPILOGUE(pGC);
+    return (*pScreen->CloseScreen) (pScreen);
 }
-
-GCOps ShadowGCOps = {
-    ShadowFillSpans, ShadowSetSpans,
-    ShadowPutImage, ShadowCopyArea,
-    ShadowCopyPlane, ShadowPolyPoint,
-    ShadowPolylines, ShadowPolySegment,
-    ShadowPolyRectangle, ShadowPolyArc,
-    ShadowFillPolygon, ShadowPolyFillRect,
-    ShadowPolyFillArc, ShadowPolyText8,
-    ShadowPolyText16, ShadowImageText8,
-    ShadowImageText16, ShadowImageGlyphBlt,
-    ShadowPolyGlyphBlt, ShadowPushPixels,
-};
old mode 100755 (executable)
new mode 100644 (file)
index 457d455..df8999f
@@ -22,8 +22,9 @@
 
 bin_PROGRAMS = cvt
 
-INCLUDES = $(XORG_INCS) \
+AM_CPPFLAGS = $(XORG_INCS) \
           -I$(top_srcdir)/hw/xfree86/ddc \
+          -I$(top_srcdir)/hw/xfree86/modes \
           -I$(top_srcdir)/hw/xfree86/parser
 
 # gah
index 9483964..d5df17f 100644 (file)
@@ -24,6 +24,7 @@
 /* Standalone VESA CVT standard timing modelines generator. */
 
 #include "xf86.h"
+#include "xf86Modes.h"
 
 /* FatalError implementation used by the server code we built in */
 void
@@ -38,10 +39,10 @@ FatalError(const char *f, ...)
 }
 
 /* xnfalloc implementation used by the server code we built in */
-pointer
+void *
 XNFalloc(unsigned long n)
 {
-    pointer r;
+    void *r;
 
     r = malloc(n);
     if (!r) {
@@ -52,10 +53,10 @@ XNFalloc(unsigned long n)
 }
 
 /* xnfcalloc implementation used by the server code we built in */
-pointer
+void *
 XNFcalloc(unsigned long n)
 {
-    pointer r;
+    void *r;
 
     r = calloc(1, n);
     if (!r) {
old mode 100755 (executable)
new mode 100644 (file)
index 0b24faf..041b47a 100644 (file)
@@ -9,5 +9,6 @@ sdk_HEADERS = vbe.h vbeModes.h
 
 AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
 
-INCLUDES = $(XORG_INCS) -I$(srcdir)/../ddc -I$(srcdir)/../i2c \
+AM_CPPFLAGS = $(XORG_INCS) -I$(srcdir)/../ddc -I$(srcdir)/../i2c \
+           -I$(srcdir)/../modes -I$(srcdir)/../parser \
            -I$(srcdir)/../int10
index 97a9bcf..d41e61b 100644 (file)
@@ -16,6 +16,7 @@
 #include <string.h>
 
 #include "xf86.h"
+#include "xf86Modes.h"
 #include "vbe.h"
 #include <X11/extensions/dpmsconst.h>
 
@@ -49,7 +50,7 @@ vbeInfoPtr
 VBEExtendedInit(xf86Int10InfoPtr pInt, int entityIndex, int Flags)
 {
     int RealOff;
-    pointer page = NULL;
+    void *page = NULL;
     ScrnInfoPtr pScrn = xf86FindScreenForEntity(entityIndex);
     vbeControllerInfoPtr vbe = NULL;
     Bool init_int10 = FALSE;
@@ -258,7 +259,7 @@ static unsigned char *
 vbeReadEDID(vbeInfoPtr pVbe)
 {
     int RealOff = pVbe->real_mode_base;
-    pointer page = pVbe->memory;
+    void *page = pVbe->memory;
     unsigned char *tmp = NULL;
     Bool novbe = FALSE;
     Bool noddc = FALSE;
@@ -318,10 +319,8 @@ vbeReadEDID(vbeInfoPtr pVbe)
 }
 
 xf86MonPtr
-vbeDoEDID(vbeInfoPtr pVbe, pointer pDDCModule)
+vbeDoEDID(vbeInfoPtr pVbe, void *unused)
 {
-    xf86MonPtr pMonitor;
-    pointer pModule;
     unsigned char *DDC_data = NULL;
 
     if (!pVbe)
@@ -329,23 +328,12 @@ vbeDoEDID(vbeInfoPtr pVbe, pointer pDDCModule)
     if (pVbe->version < 0x200)
         return NULL;
 
-    if (!(pModule = pDDCModule)) {
-        pModule =
-            xf86LoadSubModule(pVbe->pInt10->pScrn, "ddc");
-        if (!pModule)
-            return NULL;
-    }
-
     DDC_data = vbeReadEDID(pVbe);
 
     if (!DDC_data)
         return NULL;
 
-    pMonitor = xf86InterpretEDID(pVbe->pInt10->pScrn->scrnIndex, DDC_data);
-
-    if (!pDDCModule)
-        xf86UnloadSubModule(pModule);
-    return pMonitor;
+    return xf86InterpretEDID(pVbe->pInt10->pScrn->scrnIndex, DDC_data);
 }
 
 #define GET_UNALIGNED2(x) \
@@ -557,7 +545,7 @@ VBEFreeModeInfo(VbeModeInfoBlock * block)
 
 Bool
 VBESaveRestore(vbeInfoPtr pVbe, vbeSaveRestoreFunction function,
-               pointer *memory, int *size, int *real_mode_pages)
+               void **memory, int *size, int *real_mode_pages)
 {
     /*
        Input:
@@ -941,7 +929,7 @@ VBEVesaSaveRestore(vbeInfoPtr pVbe, vbeSaveRestorePtr vbe_sr,
             memcpy(vbe_sr->state, vbe_sr->pstate, vbe_sr->stateSize);
         ErrorF("VBESaveRestore\n");
         if ((VBESaveRestore(pVbe, function,
-                            (pointer) &vbe_sr->state,
+                            (void *) &vbe_sr->state,
                             &vbe_sr->stateSize, &vbe_sr->statePage))) {
             if (function == MODE_SAVE) {
                 SaveSucc = TRUE;
@@ -1067,7 +1055,7 @@ struct vbePanelID *
 VBEReadPanelID(vbeInfoPtr pVbe)
 {
     int RealOff = pVbe->real_mode_base;
-    pointer page = pVbe->memory;
+    void *page = pVbe->memory;
     void *tmp = NULL;
     int screen = pVbe->pInt10->pScrn->scrnIndex;
 
index 3907c53..bc36533 100644 (file)
@@ -25,7 +25,7 @@ typedef enum {
 typedef struct {
     xf86Int10InfoPtr pInt10;
     int version;
-    pointer memory;
+    void *memory;
     int real_mode_base;
     int num_pages;
     Bool init_int10;
@@ -40,7 +40,7 @@ extern _X_EXPORT vbeInfoPtr VBEInit(xf86Int10InfoPtr pInt, int entityIndex);
 extern _X_EXPORT vbeInfoPtr VBEExtendedInit(xf86Int10InfoPtr pInt,
                                             int entityIndex, int Flags);
 extern _X_EXPORT void vbeFree(vbeInfoPtr pVbe);
-extern _X_EXPORT xf86MonPtr vbeDoEDID(vbeInfoPtr pVbe, pointer pDDCModule);
+extern _X_EXPORT xf86MonPtr vbeDoEDID(vbeInfoPtr pVbe, void *pDDCModule);
 
 #pragma pack(1)
 
@@ -227,7 +227,7 @@ typedef enum {
 extern _X_EXPORT Bool
 
 VBESaveRestore(vbeInfoPtr pVbe, vbeSaveRestoreFunction fuction,
-               pointer *memory, int *size, int *real_mode_pages);
+               void **memory, int *size, int *real_mode_pages);
 
 /*
  * INT 5
index 415167d..50ac50d 100644 (file)
@@ -356,8 +356,10 @@ VBESetModeNames(DisplayModePtr pMode)
                 pMode->name = strdup("BADMODE");
             }
             else {
-                XNFasprintf(&pMode->name, "%dx%d",
+                char *tmp;
+                XNFasprintf(&tmp, "%dx%d",
                             pMode->HDisplay, pMode->VDisplay);
+                pMode->name = tmp;
             }
         }
         pMode = pMode->next;
@@ -433,7 +435,7 @@ VBESetModeParameters(ScrnInfoPtr pScrn, vbeInfoPtr pVbe)
  */
 int
 VBEValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes,
-                 char **modeNames, ClockRangePtr clockRanges,
+                 const char **modeNames, ClockRangePtr clockRanges,
                  int *linePitches, int minPitch, int maxPitch, int pitchInc,
                  int minHeight, int maxHeight, int virtualX, int virtualY,
                  int apertureSize, LookupModeFlags strategy)
index affd5b6..ee0257c 100644 (file)
@@ -82,7 +82,7 @@ extern _X_EXPORT void VBESetModeParameters(ScrnInfoPtr pScrn, vbeInfoPtr pVbe);
  */
 extern _X_EXPORT int VBEValidateModes(ScrnInfoPtr scrp,
                                       DisplayModePtr availModes,
-                                      char **modeNames,
+                                      const char **modeNames,
                                       ClockRangePtr clockRanges,
                                       int *linePitches, int minPitch,
                                       int maxPitch, int pitchInc, int minHeight,
index f48e46a..4b718b4 100644 (file)
@@ -1,7 +1,8 @@
 module_LTLIBRARIES = libvgahw.la
 libvgahw_la_LDFLAGS = -avoid-version
+libvgahw_la_LIBADD = $(PCIACCESS_LIBS)
 libvgahw_la_SOURCES = vgaHW.c vgaHWmodule.c
-INCLUDES = $(XORG_INCS) -I$(srcdir)/../ddc -I$(srcdir)/../i2c
+AM_CPPFLAGS = $(XORG_INCS) -I$(srcdir)/../ddc -I$(srcdir)/../i2c
 AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
 
 sdk_HEADERS = vgaHW.h
index e7a0d02..6e028a7 100644 (file)
@@ -252,7 +252,7 @@ ColormapPtr pmap;
     if (pmap != GetInstalledmiColormap(pmap->pScreen))
         return;
 
-    dixLookupResourceByType((pointer *) &defColormap,
+    dixLookupResourceByType((void **) &defColormap,
                             pmap->pScreen->defColormap, RT_COLORMAP,
                             serverClient, DixInstallAccess);
 
index 937a8a5..63a10f4 100644 (file)
@@ -107,18 +107,18 @@ typedef void (*vgaHWMiscProcPtr) (vgaHWPtr hwp);
  * via the first 17 attribute registers and not the main 8-bit palette.
  */
 typedef struct _vgaHWRec {
-    pointer Base;               /* Address of "VGA" memory */
+    void *Base;               /* Address of "VGA" memory */
     int MapSize;                /* Size of "VGA" memory */
     unsigned long MapPhys;      /* phys location of VGA mem */
     int IOBase;                 /* I/O Base address */
     CARD8 *MMIOBase;            /* Pointer to MMIO start */
     int MMIOOffset;             /* base + offset + vgareg
                                    = mmioreg */
-    pointer FontInfo1;          /* save area for fonts in
+    void *FontInfo1;          /* save area for fonts in
                                    plane 2 */
-    pointer FontInfo2;          /* save area for fonts in       
+    void *FontInfo2;          /* save area for fonts in       
                                    plane 3 */
-    pointer TextInfo;           /* save area for text */
+    void *TextInfo;           /* save area for text */
     vgaRegRec SavedReg;         /* saved registers */
     vgaRegRec ModeReg;          /* register settings for
                                    current mode */
@@ -148,7 +148,7 @@ typedef struct _vgaHWRec {
     vgaHWWriteProcPtr writeDacReadAddr;
     vgaHWWriteProcPtr writeDacData;
     vgaHWReadProcPtr readDacData;
-    pointer ddc;
+    void *ddc;
     struct pci_io_handle *io;
     vgaHWReadProcPtr readEnable;
     vgaHWWriteProcPtr writeEnable;
index df96977..2a55d63 100644 (file)
@@ -11,7 +11,7 @@ libx86emu_la_SOURCES = debug.c \
                       sys.c \
                       x86emu.h
 
-INCLUDES = 
+AM_CPPFLAGS = 
 
 AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
 
index 12f8fb8..08a07b1 100644 (file)
 ****************************************************************************/
 
 #include <stdlib.h>
+
+#if defined(__sun) && defined(CS) /* avoid conflicts with Solaris sys/regset.h */
+# undef CS
+# undef DS
+# undef SS
+# undef ES
+# undef FS
+# undef GS
+#endif
+
 #include "x86emu/x86emui.h"
 
 /*----------------------------- Implementation ----------------------------*/
index 76b8358..b50badb 100644 (file)
@@ -10189,8 +10189,8 @@ Handles opcode 0xe8
 static void
 x86emuOp_call_near_IMM(u8 X86EMU_UNUSED(op1))
 {
-    s16 ip16;
-    s32 ip32;
+    s16 ip16 = 0;
+    s32 ip32 = 0;
 
     START_OF_INSTR();
     DECODE_PRINTF("CALL\t");
@@ -11705,38 +11705,38 @@ x86emuOp_opcFF_word_RM(u8 X86EMU_UNUSED(op1))
         switch (rh) {
         case 0:                /* inc word ptr ... */
             if (M.x86.mode & SYSMODE_PREFIX_DATA) {
-                u32 destval;
+                u32 destval32;
 
-                destval = fetch_data_long(destoffset);
+                destval32 = fetch_data_long(destoffset);
                 TRACE_AND_STEP();
-                destval = inc_long(destval);
-                store_data_long(destoffset, destval);
+                destval32 = inc_long(destval32);
+                store_data_long(destoffset, destval32);
             }
             else {
-                u16 destval;
+                u16 destval16;
 
-                destval = fetch_data_word(destoffset);
+                destval16 = fetch_data_word(destoffset);
                 TRACE_AND_STEP();
-                destval = inc_word(destval);
-                store_data_word(destoffset, destval);
+                destval16 = inc_word(destval16);
+                store_data_word(destoffset, destval16);
             }
             break;
         case 1:                /* dec word ptr ... */
             if (M.x86.mode & SYSMODE_PREFIX_DATA) {
-                u32 destval;
+                u32 destval32;
 
-                destval = fetch_data_long(destoffset);
+                destval32 = fetch_data_long(destoffset);
                 TRACE_AND_STEP();
-                destval = dec_long(destval);
-                store_data_long(destoffset, destval);
+                destval32 = dec_long(destval32);
+                store_data_long(destoffset, destval32);
             }
             else {
-                u16 destval;
+                u16 destval16;
 
-                destval = fetch_data_word(destoffset);
+                destval16 = fetch_data_word(destoffset);
                 TRACE_AND_STEP();
-                destval = dec_word(destval);
-                store_data_word(destoffset, destval);
+                destval16 = dec_word(destval16);
+                store_data_word(destoffset, destval16);
             }
             break;
         case 2:                /* call word ptr ... */
@@ -11768,18 +11768,18 @@ x86emuOp_opcFF_word_RM(u8 X86EMU_UNUSED(op1))
             break;
         case 6:                /*  push word ptr ... */
             if (M.x86.mode & SYSMODE_PREFIX_DATA) {
-                u32 destval;
+                u32 destval32;
 
-                destval = fetch_data_long(destoffset);
+                destval32 = fetch_data_long(destoffset);
                 TRACE_AND_STEP();
-                push_long(destval);
+                push_long(destval32);
             }
             else {
-                u16 destval;
+                u16 destval16;
 
-                destval = fetch_data_word(destoffset);
+                destval16 = fetch_data_word(destoffset);
                 TRACE_AND_STEP();
-                push_word(destval);
+                push_word(destval16);
             }
             break;
         }
@@ -11790,38 +11790,38 @@ x86emuOp_opcFF_word_RM(u8 X86EMU_UNUSED(op1))
         switch (rh) {
         case 0:
             if (M.x86.mode & SYSMODE_PREFIX_DATA) {
-                u32 destval;
+                u32 destval32;
 
-                destval = fetch_data_long(destoffset);
+                destval32 = fetch_data_long(destoffset);
                 TRACE_AND_STEP();
-                destval = inc_long(destval);
-                store_data_long(destoffset, destval);
+                destval32 = inc_long(destval32);
+                store_data_long(destoffset, destval32);
             }
             else {
-                u16 destval;
+                u16 destval16;
 
-                destval = fetch_data_word(destoffset);
+                destval16 = fetch_data_word(destoffset);
                 TRACE_AND_STEP();
-                destval = inc_word(destval);
-                store_data_word(destoffset, destval);
+                destval16 = inc_word(destval16);
+                store_data_word(destoffset, destval16);
             }
             break;
         case 1:
             if (M.x86.mode & SYSMODE_PREFIX_DATA) {
-                u32 destval;
+                u32 destval32;
 
-                destval = fetch_data_long(destoffset);
+                destval32 = fetch_data_long(destoffset);
                 TRACE_AND_STEP();
-                destval = dec_long(destval);
-                store_data_long(destoffset, destval);
+                destval32 = dec_long(destval32);
+                store_data_long(destoffset, destval32);
             }
             else {
-                u16 destval;
+                u16 destval16;
 
-                destval = fetch_data_word(destoffset);
+                destval16 = fetch_data_word(destoffset);
                 TRACE_AND_STEP();
-                destval = dec_word(destval);
-                store_data_word(destoffset, destval);
+                destval16 = dec_word(destval16);
+                store_data_word(destoffset, destval16);
             }
             break;
         case 2:                /* call word ptr ... */
@@ -11853,18 +11853,18 @@ x86emuOp_opcFF_word_RM(u8 X86EMU_UNUSED(op1))
             break;
         case 6:                /*  push word ptr ... */
             if (M.x86.mode & SYSMODE_PREFIX_DATA) {
-                u32 destval;
+                u32 destval32;
 
-                destval = fetch_data_long(destoffset);
+                destval32 = fetch_data_long(destoffset);
                 TRACE_AND_STEP();
-                push_long(destval);
+                push_long(destval32);
             }
             else {
-                u16 destval;
+                u16 destval16;
 
-                destval = fetch_data_word(destoffset);
+                destval16 = fetch_data_word(destoffset);
                 TRACE_AND_STEP();
-                push_word(destval);
+                push_word(destval16);
             }
             break;
         }
@@ -11875,38 +11875,38 @@ x86emuOp_opcFF_word_RM(u8 X86EMU_UNUSED(op1))
         switch (rh) {
         case 0:
             if (M.x86.mode & SYSMODE_PREFIX_DATA) {
-                u32 destval;
+                u32 destval32;
 
-                destval = fetch_data_long(destoffset);
+                destval32 = fetch_data_long(destoffset);
                 TRACE_AND_STEP();
-                destval = inc_long(destval);
-                store_data_long(destoffset, destval);
+                destval32 = inc_long(destval32);
+                store_data_long(destoffset, destval32);
             }
             else {
-                u16 destval;
+                u16 destval16;
 
-                destval = fetch_data_word(destoffset);
+                destval16 = fetch_data_word(destoffset);
                 TRACE_AND_STEP();
-                destval = inc_word(destval);
-                store_data_word(destoffset, destval);
+                destval16 = inc_word(destval16);
+                store_data_word(destoffset, destval16);
             }
             break;
         case 1:
             if (M.x86.mode & SYSMODE_PREFIX_DATA) {
-                u32 destval;
+                u32 destval32;
 
-                destval = fetch_data_long(destoffset);
+                destval32 = fetch_data_long(destoffset);
                 TRACE_AND_STEP();
-                destval = dec_long(destval);
-                store_data_long(destoffset, destval);
+                destval32 = dec_long(destval32);
+                store_data_long(destoffset, destval32);
             }
             else {
-                u16 destval;
+                u16 destval16;
 
-                destval = fetch_data_word(destoffset);
+                destval16 = fetch_data_word(destoffset);
                 TRACE_AND_STEP();
-                destval = dec_word(destval);
-                store_data_word(destoffset, destval);
+                destval16 = dec_word(destval16);
+                store_data_word(destoffset, destval16);
             }
             break;
         case 2:                /* call word ptr ... */
@@ -11938,18 +11938,18 @@ x86emuOp_opcFF_word_RM(u8 X86EMU_UNUSED(op1))
             break;
         case 6:                /*  push word ptr ... */
             if (M.x86.mode & SYSMODE_PREFIX_DATA) {
-                u32 destval;
+                u32 destval32;
 
-                destval = fetch_data_long(destoffset);
+                destval32 = fetch_data_long(destoffset);
                 TRACE_AND_STEP();
-                push_long(destval);
+                push_long(destval32);
             }
             else {
-                u16 destval;
+                u16 destval16;
 
-                destval = fetch_data_word(destoffset);
+                destval16 = fetch_data_word(destoffset);
                 TRACE_AND_STEP();
-                push_word(destval);
+                push_word(destval16);
             }
             break;
         }
@@ -11958,38 +11958,38 @@ x86emuOp_opcFF_word_RM(u8 X86EMU_UNUSED(op1))
         switch (rh) {
         case 0:
             if (M.x86.mode & SYSMODE_PREFIX_DATA) {
-                u32 *destreg;
+                u32 *destreg32;
 
-                destreg = DECODE_RM_LONG_REGISTER(rl);
+                destreg32 = DECODE_RM_LONG_REGISTER(rl);
                 DECODE_PRINTF("\n");
                 TRACE_AND_STEP();
-                *destreg = inc_long(*destreg);
+                *destreg32 = inc_long(*destreg32);
             }
             else {
-                u16 *destreg;
+                u16 *destreg16;
 
-                destreg = DECODE_RM_WORD_REGISTER(rl);
+                destreg16 = DECODE_RM_WORD_REGISTER(rl);
                 DECODE_PRINTF("\n");
                 TRACE_AND_STEP();
-                *destreg = inc_word(*destreg);
+                *destreg16 = inc_word(*destreg16);
             }
             break;
         case 1:
             if (M.x86.mode & SYSMODE_PREFIX_DATA) {
-                u32 *destreg;
+                u32 *destreg32;
 
-                destreg = DECODE_RM_LONG_REGISTER(rl);
+                destreg32 = DECODE_RM_LONG_REGISTER(rl);
                 DECODE_PRINTF("\n");
                 TRACE_AND_STEP();
-                *destreg = dec_long(*destreg);
+                *destreg32 = dec_long(*destreg32);
             }
             else {
-                u16 *destreg;
+                u16 *destreg16;
 
-                destreg = DECODE_RM_WORD_REGISTER(rl);
+                destreg16 = DECODE_RM_WORD_REGISTER(rl);
                 DECODE_PRINTF("\n");
                 TRACE_AND_STEP();
-                *destreg = dec_word(*destreg);
+                *destreg16 = dec_word(*destreg16);
             }
             break;
         case 2:                /* call word ptr ... */
@@ -12018,20 +12018,20 @@ x86emuOp_opcFF_word_RM(u8 X86EMU_UNUSED(op1))
             break;
         case 6:
             if (M.x86.mode & SYSMODE_PREFIX_DATA) {
-                u32 *destreg;
+                u32 *destreg32;
 
-                destreg = DECODE_RM_LONG_REGISTER(rl);
+                destreg32 = DECODE_RM_LONG_REGISTER(rl);
                 DECODE_PRINTF("\n");
                 TRACE_AND_STEP();
-                push_long(*destreg);
+                push_long(*destreg32);
             }
             else {
-                u16 *destreg;
+                u16 *destreg16;
 
-                destreg = DECODE_RM_WORD_REGISTER(rl);
+                destreg16 = DECODE_RM_WORD_REGISTER(rl);
                 DECODE_PRINTF("\n");
                 TRACE_AND_STEP();
-                push_word(*destreg);
+                push_word(*destreg16);
             }
             break;
         }
index 6bd0611..3a7456e 100644 (file)
@@ -39,6 +39,8 @@
 #ifndef __X86EMU_REGS_H
 #define __X86EMU_REGS_H
 
+#include <X11/Xfuncproto.h>
+
 /*---------------------- Macros and type definitions ----------------------*/
 
 #ifdef PACK
@@ -112,6 +114,15 @@ struct i386_special_regs {
  * CS, DS, ES, SS.
  */
 
+#if defined(__sun) && defined(CS) /* avoid conflicts with Solaris sys/regset.h */
+# undef CS
+# undef DS
+# undef SS
+# undef ES
+# undef FS
+# undef GS
+#endif
+
 struct i386_segment_regs {
     u16 CS, DS, SS, ES, FS, GS;
 };
@@ -328,7 +339,8 @@ extern "C" {                    /* Use "C" linkage when in C++ mode */
 
 /* Function to log information at runtime */
 
-    void printk(const char *fmt, ...);
+    void printk(const char *fmt, ...)
+        _X_ATTRIBUTE_PRINTF(1, 2);
 
 #ifdef  __cplusplus
 }                               /* End of "C" linkage for C++           */
index f11dc10..5e20d97 100644 (file)
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#endif
+/* avoid conflicts with Solaris sys/regset.h */
+# if defined(__sun) && defined(CS)
+#  undef CS
+#  undef DS
+#  undef SS
+#  undef ES
+#  undef FS
+#  undef GS
+# endif
+#endif /* NO_SYS_HEADERS */
+
 /*--------------------------- Inline Functions ----------------------------*/
 
 #ifdef  __cplusplus
diff --git a/hw/xfree86/xorg-wrapper.c b/hw/xfree86/xorg-wrapper.c
new file mode 100644 (file)
index 0000000..4ea4733
--- /dev/null
@@ -0,0 +1,272 @@
+/*
+ * Copyright Â© 2014 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * 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.
+ *
+ * Author: Hans de Goede <hdegoede@redhat.com>
+ */
+
+#include "dix-config.h"
+
+#include <errno.h>
+#include <fcntl.h>
+#include <limits.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/ioctl.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+#include <sys/consio.h>
+#endif
+#include <unistd.h>
+#include <drm.h>
+#include <xf86drm.h> /* For DRM_DEV_NAME */
+
+#define CONFIG_FILE SYSCONFDIR "/X11/Xwrapper.config"
+
+static const char *progname;
+
+enum { ROOT_ONLY, CONSOLE_ONLY, ANYBODY };
+
+/* KISS non locale / LANG parsing isspace version */
+static int is_space(char c)
+{
+    return c == ' ' || c == '\t' || c == '\n';
+}
+
+static char *strip(char *s)
+{
+    int i;
+
+    /* Strip leading whitespace */
+    while (s[0] && is_space(s[0]))
+        s++;
+
+    /* Strip trailing whitespace */
+    i = strlen(s) - 1;
+    while (i >= 0 && is_space(s[i])) {
+        s[i] = 0;
+        i--;
+    }
+
+    return s;
+}
+
+static void parse_config(int *allowed, int *needs_root_rights)
+{
+    FILE *f;
+    char buf[1024];
+    char *stripped, *equals, *key, *value;
+    int line = 0;
+
+    f = fopen(CONFIG_FILE, "r");
+    if (!f)
+        return;
+
+    while (fgets(buf, sizeof(buf), f)) {
+        line++;
+
+        /* Skip comments and empty lines */
+        stripped = strip(buf);
+        if (stripped[0] == '#' || stripped[0] == 0)
+            continue;
+
+        /* Split in a key + value pair */
+        equals = strchr(stripped, '=');
+        if (!equals) {
+            fprintf(stderr, "%s: Syntax error at %s line %d\n", progname,
+                CONFIG_FILE, line);
+            exit(1);
+        }
+        *equals = 0;
+        key   = strip(stripped);   /* To remove trailing whitespace from key */
+        value = strip(equals + 1); /* To remove leading whitespace from val */
+        if (!key[0]) {
+            fprintf(stderr, "%s: Missing key at %s line %d\n", progname,
+                CONFIG_FILE, line);
+            exit(1);
+        }
+        if (!value[0]) {
+            fprintf(stderr, "%s: Missing value at %s line %d\n", progname,
+                CONFIG_FILE, line);
+            exit(1);
+        }
+
+        /* And finally process */
+        if (strcmp(key, "allowed_users") == 0) {
+            if (strcmp(value, "rootonly") == 0)
+                *allowed = ROOT_ONLY;
+            else if (strcmp(value, "console") == 0)
+                *allowed = CONSOLE_ONLY;
+            else if (strcmp(value, "anybody") == 0)
+                *allowed = ANYBODY;
+            else {
+                fprintf(stderr,
+                    "%s: Invalid value '%s' for 'allowed_users' at %s line %d\n",
+                    progname, value, CONFIG_FILE, line);
+                exit(1);
+            }
+        }
+        else if (strcmp(key, "needs_root_rights") == 0) {
+            if (strcmp(value, "yes") == 0)
+                *needs_root_rights = 1;
+            else if (strcmp(value, "no") == 0)
+                *needs_root_rights = 0;
+            else if (strcmp(value, "auto") == 0)
+                *needs_root_rights = -1;
+            else {
+                fprintf(stderr,
+                    "%s: Invalid value '%s' for 'needs_root_rights' at %s line %d\n",
+                    progname, value, CONFIG_FILE, line);
+                exit(1);
+            }
+        }
+        else if (strcmp(key, "nice_value") == 0) {
+            /* Backward compatibility with older Debian Xwrapper, ignore */
+        }
+        else {
+            fprintf(stderr, "%s: Invalid key '%s' at %s line %d\n", key,
+                progname, CONFIG_FILE, line);
+            exit(1);
+        }
+    }
+    fclose(f);
+}
+
+static int on_console(int fd)
+{
+#if defined(__linux__)
+    struct stat st;
+    int r;
+
+    r = fstat(fd, &st);
+    if (r == 0 && S_ISCHR(st.st_mode) && major(st.st_rdev) == 4)
+      return 1;
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+    int idx;
+
+    if (ioctl(fd, VT_GETINDEX, &idx) != -1)
+        return 1;
+#else
+#warning This program needs porting to your kernel.
+    static int seen;
+
+    if (!seen) {
+        fprintf(stderr, "%s: Unable to determine if running on a console\n",
+            progname);
+        seen = 1;
+    }
+#endif
+
+    return 0;
+}
+
+int main(int argc, char *argv[])
+{
+    struct drm_mode_card_res res;
+    char buf[PATH_MAX];
+    int i, r, fd;
+    int kms_cards = 0;
+    int total_cards = 0;
+    int allowed = CONSOLE_ONLY;
+    int needs_root_rights = -1;
+
+    progname = argv[0];
+
+    parse_config(&allowed, &needs_root_rights);
+
+    /* For non root users check if they are allowed to run the X server */
+    if (getuid() != 0) {
+        switch (allowed) {
+        case ROOT_ONLY:
+            /* Already checked above */
+            fprintf(stderr, "%s: Only root is allowed to run the X server\n", argv[0]);
+            exit(1);
+            break;
+        case CONSOLE_ONLY:
+            /* Some of stdin / stdout / stderr maybe redirected to a file */
+            for (i = STDIN_FILENO; i <= STDERR_FILENO; i++) {
+                if (on_console(i))
+                    break;
+            }
+            if (i > STDERR_FILENO) {
+                fprintf(stderr, "%s: Only console users are allowed to run the X server\n", argv[0]);
+                exit(1);
+            }
+            break;
+        case ANYBODY:
+            break;
+        }
+    }
+
+    /* Detect if we need root rights, except when overriden by the config */
+    if (needs_root_rights == -1) {
+        for (i = 0; i < 16; i++) {
+            snprintf(buf, sizeof(buf), DRM_DEV_NAME, DRM_DIR_NAME, i);
+            fd = open(buf, O_RDWR);
+            if (fd == -1)
+                continue;
+
+            total_cards++;
+
+            memset(&res, 0, sizeof(struct drm_mode_card_res));
+            r = ioctl(fd, DRM_IOCTL_MODE_GETRESOURCES, &res);
+            if (r == 0 && res.count_connectors > 0)
+                kms_cards++;
+
+            close(fd);
+        }
+    }
+
+    /* If we've found cards, and all cards support kms, drop root rights */
+    if (needs_root_rights == 0 || (total_cards && kms_cards == total_cards)) {
+        gid_t realgid = getgid();
+        uid_t realuid = getuid();
+
+        if (setresgid(-1, realgid, realgid) != 0) {
+            fprintf(stderr, "%s: Could not drop setgid privileges: %s\n",
+                progname, strerror(errno));
+            exit(1);
+        }
+        if (setresuid(-1, realuid, realuid) != 0) {
+            fprintf(stderr, "%s: Could not drop setuid privileges: %s\n",
+                progname, strerror(errno));
+            exit(1);
+        }
+    }
+
+    snprintf(buf, sizeof(buf), "%s/Xorg.bin", SUID_WRAPPER_DIR);
+
+    /* Check if the server is executable by our real uid */
+    if (access(buf, X_OK) != 0) {
+        fprintf(stderr, "%s: Missing execute permissions for %s/Xorg.bin: %s\n",
+            progname, SUID_WRAPPER_DIR, strerror(errno));
+        exit(1);
+    }
+
+    argv[0] = buf;
+    (void) execv(argv[0], argv);
+    fprintf(stderr, "%s: Failed to execute %s/Xorg.bin: %s\n",
+        progname, SUID_WRAPPER_DIR, strerror(errno));
+    exit(1);
+}
index cd6d4a9..a903438 100644 (file)
@@ -97,7 +97,7 @@ Section "ServerFlags"
 # Uncomment this to disable the <Ctrl><Alt><BS> server abort sequence
 # This allows clients to receive this key event.
 
-#    Option    "DontZap"       "false"
+#    Option    "DontZap"       "true"
 
 # Uncomment this to disable the <Ctrl><Alt><KP_+>/<KP_-> mode switching
 # sequences.  This allows clients to receive these key events.
index 514a395..225418d 100644 (file)
@@ -12,7 +12,7 @@ is" without express or implied warranty.
 
 */
 
-#ifndef XNESTARGC_H
+#ifndef XNESTARGS_H
 #define XNESTARGS_H
 
 extern char *xnestDisplayName;
index 7ef137d..95c3343 100644 (file)
@@ -137,7 +137,7 @@ xnestDestroyColormap(ColormapPtr pCmap)
   (xnestWindow(pWin) != None && wColormap(pWin) == icws->cmapIDs[i])
 
 static int
-xnestCountInstalledColormapWindows(WindowPtr pWin, pointer ptr)
+xnestCountInstalledColormapWindows(WindowPtr pWin, void *ptr)
 {
     xnestInstalledColormapWindows *icws = (xnestInstalledColormapWindows *) ptr;
     int i;
@@ -152,7 +152,7 @@ xnestCountInstalledColormapWindows(WindowPtr pWin, pointer ptr)
 }
 
 static int
-xnestGetInstalledColormapWindows(WindowPtr pWin, pointer ptr)
+xnestGetInstalledColormapWindows(WindowPtr pWin, void *ptr)
 {
     xnestInstalledColormapWindows *icws = (xnestInstalledColormapWindows *) ptr;
     int i;
@@ -198,12 +198,12 @@ xnestSetInstalledColormapWindows(ScreenPtr pScreen)
                                        sizeof(Colormap));
     icws.numCmapIDs = xnestListInstalledColormaps(pScreen, icws.cmapIDs);
     icws.numWindows = 0;
-    WalkTree(pScreen, xnestCountInstalledColormapWindows, (pointer) &icws);
+    WalkTree(pScreen, xnestCountInstalledColormapWindows, (void *) &icws);
     if (icws.numWindows) {
         icws.windows =
             (Window *) malloc((icws.numWindows + 1) * sizeof(Window));
         icws.index = 0;
-        WalkTree(pScreen, xnestGetInstalledColormapWindows, (pointer) &icws);
+        WalkTree(pScreen, xnestGetInstalledColormapWindows, (void *) &icws);
         icws.windows[icws.numWindows] = xnestDefaultWindows[pScreen->myNum];
         numWindows = icws.numWindows + 1;
     }
@@ -252,11 +252,11 @@ xnestSetInstalledColormapWindows(ScreenPtr pScreen)
             visual = xnestVisualFromID(pScreen, wVisual(pWin));
 
             if (visual == xnestDefaultVisual(pScreen))
-                dixLookupResourceByType((pointer *) &pCmap, wColormap(pWin),
+                dixLookupResourceByType((void **) &pCmap, wColormap(pWin),
                                         RT_COLORMAP, serverClient,
                                         DixUseAccess);
             else
-                dixLookupResourceByType((pointer *) &pCmap,
+                dixLookupResourceByType((void **) &pCmap,
                                         pScreen->defColormap, RT_COLORMAP,
                                         serverClient, DixUseAccess);
 
@@ -309,7 +309,7 @@ xnestDirectInstallColormaps(ScreenPtr pScreen)
     for (i = 0; i < n; i++) {
         ColormapPtr pCmap;
 
-        dixLookupResourceByType((pointer *) &pCmap, pCmapIDs[i], RT_COLORMAP,
+        dixLookupResourceByType((void **) &pCmap, pCmapIDs[i], RT_COLORMAP,
                                 serverClient, DixInstallAccess);
         if (pCmap)
             XInstallColormap(xnestDisplay, xnestColormap(pCmap));
@@ -330,7 +330,7 @@ xnestDirectUninstallColormaps(ScreenPtr pScreen)
     for (i = 0; i < n; i++) {
         ColormapPtr pCmap;
 
-        dixLookupResourceByType((pointer *) &pCmap, pCmapIDs[i], RT_COLORMAP,
+        dixLookupResourceByType((void **) &pCmap, pCmapIDs[i], RT_COLORMAP,
                                 serverClient, DixUninstallAccess);
         if (pCmap)
             XUninstallColormap(xnestDisplay, xnestColormap(pCmap));
@@ -347,10 +347,10 @@ xnestInstallColormap(ColormapPtr pCmap)
 
         /* Uninstall pInstalledMap. Notify all interested parties. */
         if (pOldCmap != (ColormapPtr) None)
-            WalkTree(pCmap->pScreen, TellLostMap, (pointer) &pOldCmap->mid);
+            WalkTree(pCmap->pScreen, TellLostMap, (void *) &pOldCmap->mid);
 
         SetInstalledColormap(pCmap->pScreen, pCmap);
-        WalkTree(pCmap->pScreen, TellGainedMap, (pointer) &pCmap->mid);
+        WalkTree(pCmap->pScreen, TellGainedMap, (void *) &pCmap->mid);
 
         xnestSetInstalledColormapWindows(pCmap->pScreen);
         xnestDirectInstallColormaps(pCmap->pScreen);
@@ -364,7 +364,7 @@ xnestUninstallColormap(ColormapPtr pCmap)
 
     if (pCmap == pCurCmap) {
         if (pCmap->mid != pCmap->pScreen->defColormap) {
-            dixLookupResourceByType((pointer *) &pCurCmap,
+            dixLookupResourceByType((void **) &pCurCmap,
                                     pCmap->pScreen->defColormap,
                                     RT_COLORMAP,
                                     serverClient, DixInstallAccess);
index 447d5a7..3ff095b 100644 (file)
@@ -64,15 +64,15 @@ SetTimeSinceLastInputEvent(void)
 }
 
 static Bool
-xnestExposurePredicate(Display * display, XEvent * event, char *args)
+xnestExposurePredicate(Display * dpy, XEvent * event, char *args)
 {
     return event->type == Expose || event->type == ProcessedExpose;
 }
 
 static Bool
-xnestNotExposurePredicate(Display * display, XEvent * event, char *args)
+xnestNotExposurePredicate(Display * dpy, XEvent * event, char *args)
 {
-    return !xnestExposurePredicate(display, event, args);
+    return !xnestExposurePredicate(dpy, event, args);
 }
 
 void
index 1e95588..ffdfd24 100644 (file)
@@ -35,7 +35,7 @@ int xnestFontPrivateIndex;
 Bool
 xnestRealizeFont(ScreenPtr pScreen, FontPtr pFont)
 {
-    pointer priv;
+    void *priv;
     Atom name_atom, value_atom;
     int nprops;
     FontPropPtr props;
@@ -64,7 +64,7 @@ xnestRealizeFont(ScreenPtr pScreen, FontPtr pFont)
     if (!name)
         return False;
 
-    priv = (pointer) malloc(sizeof(xnestPrivFont));
+    priv = (void *) malloc(sizeof(xnestPrivFont));
     FontSetPrivate(pFont, xnestFontPrivateIndex, priv);
 
     xnestFontPriv(pFont)->font_struct = XLoadQueryFont(xnestDisplay, name);
index cfaf714..0ec60fc 100644 (file)
@@ -188,7 +188,7 @@ xnestDestroyGC(GCPtr pGC)
 }
 
 void
-xnestChangeClip(GCPtr pGC, int type, pointer pValue, int nRects)
+xnestChangeClip(GCPtr pGC, int type, void *pValue, int nRects)
 {
     int i, size;
     BoxPtr pBox;
@@ -225,7 +225,7 @@ xnestChangeClip(GCPtr pGC, int type, pointer pValue, int nRects)
          * current pixmap contents.
          */
         pGC->clientClip =
-            (pointer) (*pGC->pScreen->BitmapToRegion) ((PixmapPtr) pValue);
+            (void *) (*pGC->pScreen->BitmapToRegion) ((PixmapPtr) pValue);
         (*pGC->pScreen->DestroyPixmap) ((PixmapPtr) pValue);
         pValue = pGC->clientClip;
         type = CT_REGION;
@@ -269,7 +269,7 @@ xnestChangeClip(GCPtr pGC, int type, pointer pValue, int nRects)
          * other parts of server can only deal with CT_NONE,
          * CT_PIXMAP and CT_REGION client clips.
          */
-        pGC->clientClip = (pointer) RegionFromRects(nRects,
+        pGC->clientClip = (void *) RegionFromRects(nRects,
                                                     (xRectangle *) pValue,
                                                     type);
         free(pValue);
index e26a136..e1cf9d6 100644 (file)
@@ -94,15 +94,28 @@ xnestPutImage(DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
     }
 }
 
+static int
+xnestIgnoreErrorHandler (Display     *dpy,
+                         XErrorEvent *event)
+{
+    return False; /* return value is ignored */
+}
+
 void
 xnestGetImage(DrawablePtr pDrawable, int x, int y, int w, int h,
               unsigned int format, unsigned long planeMask, char *pImage)
 {
     XImage *ximage;
     int length;
+    int (*old_handler)(Display*, XErrorEvent*);
+
+    /* we may get BadMatch error when xnest window is minimized */
+    XSync(xnestDisplay, False);
+    old_handler = XSetErrorHandler (xnestIgnoreErrorHandler);
 
     ximage = XGetImage(xnestDisplay, xnestDrawable(pDrawable),
                        x, y, w, h, planeMask, format);
+    XSetErrorHandler(old_handler);
 
     if (ximage) {
         length = ximage->bytes_per_line * ximage->height;
@@ -114,7 +127,7 @@ xnestGetImage(DrawablePtr pDrawable, int x, int y, int w, int h,
 }
 
 static Bool
-xnestBitBlitPredicate(Display * display, XEvent * event, char *args)
+xnestBitBlitPredicate(Display * dpy, XEvent * event, char *args)
 {
     return event->type == GraphicsExpose || event->type == NoExpose;
 }
@@ -295,7 +308,7 @@ xnestImageText16(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count,
 void
 xnestImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y,
                    unsigned int nGlyphs, CharInfoPtr * pCharInfo,
-                   pointer pGlyphBase)
+                   void *pGlyphBase)
 {
     ErrorF("xnest warning: function xnestImageGlyphBlt not implemented\n");
 }
@@ -303,7 +316,7 @@ xnestImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y,
 void
 xnestPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y,
                   unsigned int nGlyphs, CharInfoPtr * pCharInfo,
-                  pointer pGlyphBase)
+                  void *pGlyphBase)
 {
     ErrorF("xnest warning: function xnestPolyGlyphBlt not implemented\n");
 }
index b1cad11..fd1f6bf 100644 (file)
@@ -58,10 +58,10 @@ void xnestImageText16(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count,
                       unsigned short *string);
 void xnestImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y,
                         unsigned int nGlyphs, CharInfoPtr * pCharInfo,
-                        pointer pGlyphBase);
+                        void *pGlyphBase);
 void xnestPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y,
                        unsigned int nGlyphs, CharInfoPtr * pCharInfo,
-                       pointer pGlyphBase);
+                       void *pGlyphBase);
 void xnestPushPixels(GCPtr pGC, PixmapPtr pBitmap, DrawablePtr pDrawable,
                      int width, int height, int x, int y);
 
index 4605b90..05d559d 100644 (file)
@@ -32,14 +32,14 @@ is" without express or implied warranty.
 #include "Handlers.h"
 
 void
-xnestBlockHandler(pointer blockData, OSTimePtr pTimeout, pointer pReadMask)
+xnestBlockHandler(void *blockData, OSTimePtr pTimeout, void *pReadMask)
 {
     xnestCollectExposures();
     XFlush(xnestDisplay);
 }
 
 void
-xnestWakeupHandler(pointer blockData, int result, pointer pReadMask)
+xnestWakeupHandler(void *blockData, int result, void *pReadMask)
 {
     xnestCollectEvents();
 }
index 7160bdd..d4ad6d2 100644 (file)
@@ -15,8 +15,8 @@ is" without express or implied warranty.
 #ifndef XNESTHANDLERS_H
 #define XNESTHANDLERS_H
 
-void xnestBlockHandler(pointer blockData, OSTimePtr pTimeout,
-                       pointer pReadMask);
-void xnestWakeupHandler(pointer blockData, int result, pointer pReadMask);
+void xnestBlockHandler(void *blockData, OSTimePtr pTimeout,
+                       void *pReadMask);
+void xnestWakeupHandler(void *blockData, int result, void *pReadMask);
 
 #endif                          /* XNESTHANDLERS_H */
index 330b8ca..d9f490b 100644 (file)
@@ -46,29 +46,29 @@ is" without express or implied warranty.
 Bool xnestDoFullGeneration = True;
 
 void
-InitOutput(ScreenInfo * screenInfo, int argc, char *argv[])
+InitOutput(ScreenInfo * screen_info, int argc, char *argv[])
 {
     int i, j;
 
     xnestOpenDisplay(argc, argv);
 
-    screenInfo->imageByteOrder = ImageByteOrder(xnestDisplay);
-    screenInfo->bitmapScanlineUnit = BitmapUnit(xnestDisplay);
-    screenInfo->bitmapScanlinePad = BitmapPad(xnestDisplay);
-    screenInfo->bitmapBitOrder = BitmapBitOrder(xnestDisplay);
+    screen_info->imageByteOrder = ImageByteOrder(xnestDisplay);
+    screen_info->bitmapScanlineUnit = BitmapUnit(xnestDisplay);
+    screen_info->bitmapScanlinePad = BitmapPad(xnestDisplay);
+    screen_info->bitmapBitOrder = BitmapBitOrder(xnestDisplay);
 
-    screenInfo->numPixmapFormats = 0;
+    screen_info->numPixmapFormats = 0;
     for (i = 0; i < xnestNumPixmapFormats; i++)
         for (j = 0; j < xnestNumDepths; j++)
             if ((xnestPixmapFormats[i].depth == 1) ||
                 (xnestPixmapFormats[i].depth == xnestDepths[j])) {
-                screenInfo->formats[screenInfo->numPixmapFormats].depth =
+                screen_info->formats[screen_info->numPixmapFormats].depth =
                     xnestPixmapFormats[i].depth;
-                screenInfo->formats[screenInfo->numPixmapFormats].bitsPerPixel =
+                screen_info->formats[screen_info->numPixmapFormats].bitsPerPixel =
                     xnestPixmapFormats[i].bits_per_pixel;
-                screenInfo->formats[screenInfo->numPixmapFormats].scanlinePad =
+                screen_info->formats[screen_info->numPixmapFormats].scanlinePad =
                     xnestPixmapFormats[i].scanline_pad;
-                screenInfo->numPixmapFormats++;
+                screen_info->numPixmapFormats++;
                 break;
             }
 
@@ -80,7 +80,7 @@ InitOutput(ScreenInfo * screenInfo, int argc, char *argv[])
     for (i = 0; i < xnestNumScreens; i++)
         AddScreen(xnestOpenScreen, argc, argv);
 
-    xnestNumScreens = screenInfo->numScreens;
+    xnestNumScreens = screen_info->numScreens;
 
     xnestDoFullGeneration = xnestFullGeneration;
 }
index d013dc9..2cf1624 100644 (file)
@@ -59,7 +59,7 @@ extern Status XkbGetControls(Display * /* dpy */ ,
 DeviceIntPtr xnestKeyboardDevice = NULL;
 
 void
-xnestBell(int volume, DeviceIntPtr pDev, pointer ctrl, int cls)
+xnestBell(int volume, DeviceIntPtr pDev, void *ctrl, int cls)
 {
     XBell(xnestDisplay, volume);
 }
index 45d56bc..dc5eaa2 100644 (file)
@@ -20,7 +20,7 @@ is" without express or implied warranty.
 
 extern DeviceIntPtr xnestKeyboardDevice;
 
-void xnestBell(int volume, DeviceIntPtr pDev, pointer ctrl, int cls);
+void xnestBell(int volume, DeviceIntPtr pDev, void *ctrl, int cls);
 void xnestChangeKeyboardControl(DeviceIntPtr pDev, KeybdCtrl * ctrl);
 int xnestKeyboardProc(DeviceIntPtr pDev, int onoff);
 void xnestUpdateModifierState(unsigned int state);
index 3c099cd..eb550c0 100644 (file)
@@ -1,7 +1,6 @@
 SUBDIRS = man
 
 bin_PROGRAMS = Xnest
-noinst_LIBRARIES = libfbcmap.a
 
 AM_CFLAGS = -DHAVE_XNEST_CONFIG_H \
             $(DIX_CFLAGS) \
@@ -42,16 +41,12 @@ SRCS =      Args.c \
        XNPixmap.h \
        XNWindow.h \
        xnest-config.h \
-       $(top_srcdir)/Xext/dpmsstubs.c \
-       $(top_srcdir)/Xi/stubs.c \
        $(top_srcdir)/mi/miinitext.c
 
-libfbcmap_a_SOURCES = $(top_srcdir)/fb/fbcmap_mi.c
-libfbcmap_a_CFLAGS = $(AM_CFLAGS)
-
 XNEST_LIBS = \
         @XNEST_LIBS@ \
-       libfbcmap.a
+       $(top_builddir)/Xext/libXextdpmsstubs.la \
+       $(top_builddir)/Xi/libXistubs.la
 
 Xnest_SOURCES = $(SRCS)
 
index 13e1610..6514f3b 100644 (file)
@@ -78,6 +78,21 @@ xnestDestroyPixmap(PixmapPtr pPixmap)
     return TRUE;
 }
 
+Bool
+xnestModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, int depth,
+                        int bitsPerPixel, int devKind, void *pPixData)
+{
+  if(!xnestPixmapPriv(pPixmap)->pixmap && width > 0 && height > 0) {
+    xnestPixmapPriv(pPixmap)->pixmap =
+        XCreatePixmap(xnestDisplay,
+                      xnestDefaultWindows[pPixmap->drawable.pScreen->myNum],
+                      width, height, depth);
+  }
+
+  return miModifyPixmapHeader(pPixmap, width, height, depth,
+                              bitsPerPixel, devKind, pPixData);
+}
+
 RegionPtr
 xnestPixmapToRegion(PixmapPtr pPixmap)
 {
index 7b3c1b3..abb4d37 100644 (file)
@@ -21,7 +21,6 @@ is" without express or implied warranty.
 #include "scrnintstr.h"
 #include "dix.h"
 #include "mi.h"
-#include "mibstore.h"
 #include "micmap.h"
 #include "colormapst.h"
 #include "resource.h"
@@ -283,6 +282,7 @@ xnestOpenScreen(ScreenPtr pScreen, int argc, char *argv[])
 
     pScreen->CreatePixmap = xnestCreatePixmap;
     pScreen->DestroyPixmap = xnestDestroyPixmap;
+    pScreen->ModifyPixmapHeader = xnestModifyPixmapHeader;
 
     /* Font procedures */
 
index 63198ba..11673c4 100644 (file)
@@ -21,7 +21,6 @@ is" without express or implied warranty.
 #include "scrnintstr.h"
 #include "dix.h"
 #include "mi.h"
-#include "mibstore.h"
 #include "Xnest.h"
 
 #include "Display.h"
index e2b21b5..fc87e82 100644 (file)
@@ -42,7 +42,7 @@ is" without express or implied warranty.
 DevPrivateKeyRec xnestWindowPrivateKeyRec;
 
 static int
-xnestFindWindowMatch(WindowPtr pWin, pointer ptr)
+xnestFindWindowMatch(WindowPtr pWin, void *ptr)
 {
     xnestWindowMatch *wm = (xnestWindowMatch *) ptr;
 
@@ -64,7 +64,7 @@ xnestWindowPtr(Window window)
     wm.window = window;
 
     for (i = 0; i < xnestNumScreens; i++) {
-        WalkTree(screenInfo.screens[i], xnestFindWindowMatch, (pointer) &wm);
+        WalkTree(screenInfo.screens[i], xnestFindWindowMatch, (void *) &wm);
         if (wm.pWin)
             break;
     }
@@ -96,7 +96,7 @@ xnestCreateWindow(WindowPtr pWin)
                     xnestVisualFromID(pWin->drawable.pScreen, wVisual(pWin));
                 mask |= CWColormap;
                 if (pWin->optional->colormap) {
-                    dixLookupResourceByType((pointer *) &pCmap, wColormap(pWin),
+                    dixLookupResourceByType((void **) &pCmap, wColormap(pWin),
                                             RT_COLORMAP, serverClient,
                                             DixUseAccess);
                     attributes.colormap = xnestColormap(pCmap);
@@ -109,7 +109,7 @@ xnestCreateWindow(WindowPtr pWin)
         }
         else {                  /* root windows have their own colormaps at creation time */
             visual = xnestVisualFromID(pWin->drawable.pScreen, wVisual(pWin));
-            dixLookupResourceByType((pointer *) &pCmap, wColormap(pWin),
+            dixLookupResourceByType((void **) &pCmap, wColormap(pWin),
                                     RT_COLORMAP, serverClient, DixUseAccess);
             mask |= CWColormap;
             attributes.colormap = xnestColormap(pCmap);
@@ -331,7 +331,7 @@ xnestChangeWindowAttributes(WindowPtr pWin, unsigned long mask)
     if (mask & CWColormap) {
         ColormapPtr pCmap;
 
-        dixLookupResourceByType((pointer *) &pCmap, wColormap(pWin),
+        dixLookupResourceByType((void **) &pCmap, wColormap(pWin),
                                 RT_COLORMAP, serverClient, DixUseAccess);
 
         attributes.colormap = xnestColormap(pCmap);
@@ -380,7 +380,7 @@ xnestClipNotify(WindowPtr pWin, int dx, int dy)
 }
 
 static Bool
-xnestWindowExposurePredicate(Display * display, XEvent * event, XPointer ptr)
+xnestWindowExposurePredicate(Display * dpy, XEvent * event, XPointer ptr)
 {
     return (event->type == Expose && event->xexpose.window == *(Window *) ptr);
 }
index c7c25e4..e2f10fb 100644 (file)
@@ -35,7 +35,7 @@ void xnestValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable);
 void xnestChangeGC(GCPtr pGC, unsigned long mask);
 void xnestCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst);
 void xnestDestroyGC(GCPtr pGC);
-void xnestChangeClip(GCPtr pGC, int type, pointer pValue, int nRects);
+void xnestChangeClip(GCPtr pGC, int type, void *pValue, int nRects);
 void xnestDestroyClip(GCPtr pGC);
 void xnestDestroyClipHelper(GCPtr pGC);
 void xnestCopyClip(GCPtr pGCDst, GCPtr pGCSrc);
index 268ba1e..b7b10e9 100644 (file)
@@ -33,6 +33,8 @@ typedef struct {
 PixmapPtr xnestCreatePixmap(ScreenPtr pScreen, int width, int height,
                             int depth, unsigned usage_hint);
 Bool xnestDestroyPixmap(PixmapPtr pPixmap);
+Bool xnestModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, int depth,
+                             int bitsPerPixel, int devKind, void *pPixData);
 RegionPtr xnestPixmapToRegion(PixmapPtr pPixmap);
 
 #endif                          /* XNESTPIXMAP_H */
index 4702595..5573629 100644 (file)
  * DEALINGS IN THE SOFTWARE.
  */
 
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <assert.h>
index dc97f89..1ce3570 100644 (file)
@@ -555,7 +555,6 @@ _gl_context_modes_are_same(const __GLcontextModes * a,
             (a->stencilBits == b->stencilBits) &&
             (a->numAuxBuffers == b->numAuxBuffers) &&
             (a->level == b->level) &&
-            (a->pixmapMode == b->pixmapMode) &&
             (a->visualRating == b->visualRating) &&
 
             (a->transparentPixel == b->transparentPixel) &&
index c4999b5..19b7d86 100644 (file)
@@ -48,8 +48,6 @@
 #include <glxserver.h>
 #include <glxutil.h>
 
-#include <glapi.h>
-
 #include "x-hash.h"
 
 #include "visualConfigs.h"
@@ -643,15 +641,20 @@ __glFloorLog2(GLuint val)
     "/System/Library/Frameworks/OpenGL.framework/OpenGL"
 #endif
 
+static void *opengl_framework_handle;
+
+static glx_func_ptr
+get_proc_address(const char *sym)
+{
+    return (glx_func_ptr) dlsym(opengl_framework_handle, sym);
+}
+
 static void
 setup_dispatch_table(void)
 {
-    static struct _glapi_table *disp = NULL;
-    static void *handle;
     const char *opengl_framework_path;
 
-    if (disp) {
-        _glapi_set_dispatch(disp);
+    if (opengl_framework_handle) {
         return;
     }
 
@@ -661,16 +664,13 @@ setup_dispatch_table(void)
     }
 
     (void)dlerror();             /*drain dlerror */
-    handle = dlopen(opengl_framework_path, RTLD_LOCAL);
+    opengl_framework_handle = dlopen(opengl_framework_path, RTLD_LOCAL);
 
-    if (!handle) {
+    if (!opengl_framework_handle) {
         ErrorF("unable to dlopen %s : %s, using RTLD_DEFAULT\n",
                opengl_framework_path, dlerror());
-        handle = RTLD_DEFAULT;
+        opengl_framework_handle = RTLD_DEFAULT;
     }
 
-    disp = _glapi_create_table_from_handle(handle, "gl");
-    assert(disp);
-
-    _glapi_set_dispatch(disp);
+    __glXsetGetProcAddress(get_proc_address);
 }
index e37eefb..687bf80 100644 (file)
 #include "darwinfb.h"
 
 /* Based originally on code from indirect.c which was based on code from i830_dri.c. */
-__GLXconfig *
-__glXAquaCreateVisualConfigs(int *numConfigsPtr, int screenNumber)
-{
+__GLXconfig *__glXAquaCreateVisualConfigs(int *numConfigsPtr, int screenNumber) {
     int numConfigs = 0;
     __GLXconfig *visualConfigs, *c;
     struct glCapabilities caps;
     struct glCapabilitiesConfig *conf;
     int stereo, depth, aux, buffers, stencil, accum, color, msample;
 
-    if (getGlCapabilities(&caps)) {
+    if(getGlCapabilities(&caps)) {
         ErrorF("error from getGlCapabilities()!\n");
         return NULL;
     }
 
     /*
-       conf->stereo is 0 or 1, but we need at least 1 iteration of the loop,
-       so we treat a true conf->stereo as 2.
+     conf->stereo is 0 or 1, but we need at least 1 iteration of the loop,
+     so we treat a true conf->stereo as 2.
 
-       The depth size is 0 or 24.  Thus we do 2 iterations for that.
+     The depth size is 0 or 24.  Thus we do 2 iterations for that.
 
-       conf->aux_buffers (when available/non-zero) result in 2 iterations instead of 1.
+     conf->aux_buffers (when available/non-zero) result in 2 iterations instead of 1.
 
-       conf->buffers indicates whether we have single or double buffering.
+     conf->buffers indicates whether we have single or double buffering.
 
-       conf->total_stencil_bit_depths
+     conf->total_stencil_bit_depths
 
-       conf->total_color_buffers indicates the RGB/RGBA color depths.
+     conf->total_color_buffers indicates the RGB/RGBA color depths.
 
-       conf->total_accum_buffers iterations for accum (with at least 1 if equal to 0)
+     conf->total_accum_buffers iterations for accum (with at least 1 if equal to 0)
 
-       conf->total_depth_buffer_depths
+     conf->total_depth_buffer_depths
 
-       conf->multisample_buffers iterations (with at least 1 if equal to 0).  We add 1
-       for the 0 multisampling config.
+     conf->multisample_buffers iterations (with at least 1 if equal to 0).  We add 1
+     for the 0 multisampling config.
 
      */
 
@@ -99,75 +97,56 @@ __glXAquaCreateVisualConfigs(int *numConfigsPtr, int screenNumber)
 
     numConfigs = 0;
 
-    for (conf = caps.configurations; conf; conf = conf->next) {
-        if (conf->total_color_buffers <= 0)
+    for(conf = caps.configurations; conf; conf = conf->next) {
+        if(conf->total_color_buffers <= 0)
             continue;
 
         numConfigs += (conf->stereo ? 2 : 1)
-                      * (conf->aux_buffers ? 2 : 1)
-                      * conf->buffers
-                      * ((conf->total_stencil_bit_depths >
-                          0) ? conf->total_stencil_bit_depths : 1)
-                      * conf->total_color_buffers
-                      * ((conf->total_accum_buffers >
-                          0) ? conf->total_accum_buffers : 1)
-                      * conf->total_depth_buffer_depths
-                      * (conf->multisample_buffers + 1);
+           * (conf->aux_buffers ? 2 : 1)
+           * conf->buffers
+           * ((conf->total_stencil_bit_depths > 0) ? conf->total_stencil_bit_depths : 1)
+           * conf->total_color_buffers
+           * ((conf->total_accum_buffers > 0) ? conf->total_accum_buffers : 1)
+           * conf->total_depth_buffer_depths
+           * (conf->multisample_buffers + 1);
     }
 
-    if (numConfigsPtr)
+    if(numConfigsPtr)
         *numConfigsPtr = numConfigs;
 
     visualConfigs = calloc(sizeof(*visualConfigs), numConfigs);
 
-    if (NULL == visualConfigs) {
+    if(NULL == visualConfigs) {
         ErrorF("xcalloc failure when allocating visualConfigs\n");
         freeGlCapabilities(&caps);
         return NULL;
     }
 
     c = visualConfigs; /* current buffer */
-    for (conf = caps.configurations; conf; conf = conf->next) {
-        for (stereo = 0; stereo < (conf->stereo ? 2 : 1); ++stereo) {
-            for (aux = 0; aux < (conf->aux_buffers ? 2 : 1); ++aux) {
-                for (buffers = 0; buffers < conf->buffers; ++buffers) {
-                    for (stencil = 0;
-                         stencil < ((conf->total_stencil_bit_depths > 0) ?
-                                    conf->
-                                    total_stencil_bit_depths : 1);
-                         ++stencil) {
-                        for (color = 0; color < conf->total_color_buffers;
-                             ++color) {
-                            for (accum = 0;
-                                 accum < ((conf->total_accum_buffers > 0) ?
-                                          conf->
-                                          total_accum_buffers : 1);
-                                 ++accum) {
-                                for (depth = 0;
-                                     depth < conf->total_depth_buffer_depths;
-                                     ++depth) {
-                                    for (msample = 0;
-                                         msample <
-                                         (conf->multisample_buffers + 1);
-                                         ++msample) {
+    for(conf = caps.configurations; conf; conf = conf->next) {
+        for(stereo = 0; stereo < (conf->stereo ? 2 : 1); ++stereo) {
+            for(aux = 0; aux < (conf->aux_buffers ? 2 : 1); ++aux) {
+                for(buffers = 0; buffers < conf->buffers; ++buffers) {
+                    for(stencil = 0; stencil < ((conf->total_stencil_bit_depths > 0) ?
+                                                conf->total_stencil_bit_depths : 1); ++stencil) {
+                        for(color = 0; color < conf->total_color_buffers; ++color) {
+                            for(accum = 0; accum < ((conf->total_accum_buffers > 0) ?
+                                                    conf->total_accum_buffers : 1); ++accum) {
+                                for(depth = 0; depth < conf->total_depth_buffer_depths; ++depth) {
+                                    for(msample = 0; msample < (conf->multisample_buffers + 1); ++msample) {
 
                                         // Global
                                         c->visualID = -1;
                                         c->visualType = GLX_TRUE_COLOR;
                                         c->next = c + 1;
 
-                                        c->screen = screenNumber;
-
                                         c->level = 0;
                                         c->indexBits = 0;
-                                        c->pixmapMode = 0; // TODO: What should this be?
 
-                                        if (conf->accelerated) {
+                                        if(conf->accelerated) {
                                             c->visualRating = GLX_NONE;
-                                        }
-                                        else {
-                                            c->visualRating =
-                                                GLX_SLOW_VISUAL_EXT;
+                                        } else {
+                                            c->visualRating = GLX_SLOW_VISUAL_EXT;
                                         }
 
                                         c->transparentPixel = GLX_NONE;
@@ -179,91 +158,52 @@ __glXAquaCreateVisualConfigs(int *numConfigsPtr, int screenNumber)
 
                                         c->visualSelectGroup = 0;
 
-                                        c->swapMethod =
-                                            GLX_SWAP_UNDEFINED_OML;
+                                        c->swapMethod = GLX_SWAP_UNDEFINED_OML;
 
                                         // Stereo
                                         c->stereoMode = stereo ? TRUE : FALSE;
 
                                         // Aux buffers
-                                        c->numAuxBuffers =
-                                            aux ? conf->aux_buffers : 0;
+                                        c->numAuxBuffers = aux ? conf->aux_buffers : 0;
 
                                         // Double Buffered
-                                        c->doubleBufferMode =
-                                            buffers ? TRUE : FALSE;
+                                        c->doubleBufferMode = buffers ? TRUE : FALSE;
 
                                         // Stencil Buffer
-                                        if (conf->total_stencil_bit_depths >
-                                            0) {
-                                            c->stencilBits =
-                                                conf->stencil_bit_depths[
-                                                    stencil];
-                                        }
-                                        else {
+                                        if(conf->total_stencil_bit_depths > 0) {
+                                            c->stencilBits = conf->stencil_bit_depths[stencil];
+                                        } else {
                                             c->stencilBits = 0;
                                         }
 
                                         // Color
-                                        if (GLCAPS_COLOR_BUF_INVALID_VALUE !=
-                                            conf->color_buffers[color].a) {
-                                            c->alphaBits =
-                                                conf->color_buffers[color].a;
-                                        }
-                                        else {
+                                        if(GLCAPS_COLOR_BUF_INVALID_VALUE != conf->color_buffers[color].a) {
+                                            c->alphaBits = conf->color_buffers[color].a;
+                                        } else {
                                             c->alphaBits = 0;
                                         }
-                                        c->redBits =
-                                            conf->color_buffers[color].r;
-                                        c->greenBits =
-                                            conf->color_buffers[color].g;
-                                        c->blueBits =
-                                            conf->color_buffers[color].b;
-
-                                        c->rgbBits = c->alphaBits +
-                                                     c->redBits +
-                                                     c->greenBits +
-                                                     c->blueBits;
-
-                                        c->alphaMask =
-                                            AM_ARGB(c->alphaBits, c->redBits,
-                                                    c->greenBits,
-                                                    c->blueBits);
-                                        c->redMask =
-                                            RM_ARGB(c->alphaBits, c->redBits,
-                                                    c->greenBits,
-                                                    c->blueBits);
-                                        c->greenMask =
-                                            GM_ARGB(c->alphaBits, c->redBits,
-                                                    c->greenBits,
-                                                    c->blueBits);
-                                        c->blueMask =
-                                            BM_ARGB(c->alphaBits, c->redBits,
-                                                    c->greenBits,
-                                                    c->blueBits);
+                                        c->redBits   = conf->color_buffers[color].r;
+                                        c->greenBits = conf->color_buffers[color].g;
+                                        c->blueBits  = conf->color_buffers[color].b;
+
+                                        c->rgbBits = c->alphaBits + c->redBits + c->greenBits + c->blueBits;
+
+                                        c->alphaMask = AM_ARGB(c->alphaBits, c->redBits, c->greenBits, c->blueBits);
+                                        c->redMask   = RM_ARGB(c->alphaBits, c->redBits, c->greenBits, c->blueBits);
+                                        c->greenMask = GM_ARGB(c->alphaBits, c->redBits, c->greenBits, c->blueBits);
+                                        c->blueMask  = BM_ARGB(c->alphaBits, c->redBits, c->greenBits, c->blueBits);
 
                                         // Accumulation Buffers
-                                        if (conf->total_accum_buffers > 0) {
-                                            c->accumRedBits =
-                                                conf->accum_buffers[accum].r;
-                                            c->accumGreenBits =
-                                                conf->accum_buffers[accum].g;
-                                            c->accumBlueBits =
-                                                conf->accum_buffers[accum].b;
-                                            if (
-                                                GLCAPS_COLOR_BUF_INVALID_VALUE
-                                                !=
-                                                conf->accum_buffers[accum].a)
-                                            {
-                                                c->accumAlphaBits =
-                                                    conf->accum_buffers[accum
-                                                    ].a;
-                                            }
-                                            else {
+                                        if(conf->total_accum_buffers > 0) {
+                                            c->accumRedBits = conf->accum_buffers[accum].r;
+                                            c->accumGreenBits = conf->accum_buffers[accum].g;
+                                            c->accumBlueBits = conf->accum_buffers[accum].b;
+                                            if(GLCAPS_COLOR_BUF_INVALID_VALUE != conf->accum_buffers[accum].a) {
+                                                c->accumAlphaBits = conf->accum_buffers[accum].a;
+                                            } else {
                                                 c->accumAlphaBits = 0;
                                             }
-                                        }
-                                        else {
+                                        } else {
                                             c->accumRedBits = 0;
                                             c->accumGreenBits = 0;
                                             c->accumBlueBits = 0;
@@ -271,17 +211,13 @@ __glXAquaCreateVisualConfigs(int *numConfigsPtr, int screenNumber)
                                         }
 
                                         // Depth
-                                        c->depthBits =
-                                            conf->depth_buffers[depth];
+                                        c->depthBits = conf->depth_buffers[depth];
 
                                         // MultiSample
-                                        if (msample > 0) {
-                                            c->samples =
-                                                conf->multisample_samples;
-                                            c->sampleBuffers =
-                                                conf->multisample_buffers;
-                                        }
-                                        else {
+                                        if(msample > 0) {
+                                            c->samples = conf->multisample_samples;
+                                            c->sampleBuffers = conf->multisample_buffers;
+                                        } else {
                                             c->samples = 0;
                                             c->sampleBuffers = 0;
                                         }
@@ -291,9 +227,7 @@ __glXAquaCreateVisualConfigs(int *numConfigsPtr, int screenNumber)
                                          * GLXPbuffers in direct mode.
                                          */
                                         /* SGIX_fbconfig / GLX 1.3 */
-                                        c->drawableType = GLX_WINDOW_BIT |
-                                                          GLX_PIXMAP_BIT |
-                                                          GLX_PBUFFER_BIT;
+                                        c->drawableType = GLX_WINDOW_BIT | GLX_PIXMAP_BIT | GLX_PBUFFER_BIT;
                                         c->renderType = GLX_RGBA_BIT;
                                         c->xRenderable = GL_TRUE;
                                         c->fbconfigID = -1;
@@ -310,8 +244,7 @@ __glXAquaCreateVisualConfigs(int *numConfigsPtr, int screenNumber)
                                          */
                                         c->maxPbufferWidth = 8192;
                                         c->maxPbufferHeight = 8192;
-                                        c->maxPbufferPixels =
-                                            /*Do we need this?*/ 0;
+                                        c->maxPbufferPixels = /*Do we need this?*/ 0;
                                         /*
                                          * There is no introspection for this sort of thing
                                          * with CGL.  What should we do realistically?
@@ -326,6 +259,9 @@ __glXAquaCreateVisualConfigs(int *numConfigsPtr, int screenNumber)
                                         c->bindToTextureTargets = 0;
                                         c->yInverted = 0;
 
+                                        /* EXT_framebuffer_sRGB */
+                                        c->sRGBCapable = GL_FALSE;
+
                                         c = c->next;
                                     }
                                 }
@@ -337,12 +273,10 @@ __glXAquaCreateVisualConfigs(int *numConfigsPtr, int screenNumber)
         }
     }
 
-    (c - 1)->next = NULL;
+    (c-1)->next = NULL;
 
     if (c - visualConfigs != numConfigs) {
-        FatalError(
-            "numConfigs calculation error in setVisualConfigs!  numConfigs is %d  i is %d\n",
-            numConfigs, (int)(c - visualConfigs));
+        FatalError("numConfigs calculation error in setVisualConfigs!  numConfigs is %d  i is %d\n", numConfigs, (int)(c - visualConfigs));
     }
 
     freeGlCapabilities(&caps);
index a7cc012..4da896d 100644 (file)
@@ -8,6 +8,7 @@ AM_CPPFLAGS = \
        -DUSE_NEW_CLUT \
        -DXFree86Server \
        -I$(top_srcdir)/miext/rootless \
+       -I$(top_builddir)/pseudoramiX \
        -DX11LIBDIR=\"$(libdir)\"
 
 if GLX
@@ -19,7 +20,6 @@ SUBDIRS = bundle . $(GL_DIR) xpr pbproxy mach-startup man
 DIST_SUBDIRS = bundle . GL xpr pbproxy mach-startup man
 
 libXquartz_la_SOURCES = \
-       $(top_srcdir)/fb/fbcmap_mi.c \
        $(top_srcdir)/mi/miinitext.c \
        X11Application.m \
        X11Controller.m \
@@ -28,7 +28,6 @@ libXquartz_la_SOURCES = \
        darwinEvents.c \
        darwinXinput.c \
        keysym2ucs.c \
-       pseudoramiX.c \
        quartz.c \
        quartzCocoa.m \
        quartzKeyboard.c \
@@ -36,6 +35,8 @@ libXquartz_la_SOURCES = \
        quartzRandR.c \
        console_redirect.c
 
+libXquartz_la_LIBADD = $(top_builddir)/pseudoramiX/libPseudoramiX.la
+
 EXTRA_DIST = \
        X11Application.h \
        X11Controller.h \
@@ -44,7 +45,6 @@ EXTRA_DIST = \
        darwinfb.h \
        darwinEvents.h \
        keysym2ucs.h \
-       pseudoramiX.h \
        quartz.h \
        quartzCommon.h \
        quartzKeyboard.h \
index 1f9b05d..2efbd65 100644 (file)
@@ -70,6 +70,18 @@ xpbproxy_run(void);
 static dispatch_queue_t eventTranslationQueue;
 #endif
 
+#ifndef __has_feature
+#define __has_feature(x) 0
+#endif
+
+#ifndef CF_RETURNS_RETAINED
+#if __has_feature(attribute_cf_returns_retained)
+#define CF_RETURNS_RETAINED __attribute__((cf_returns_retained))
+#else
+#define CF_RETURNS_RETAINED
+#endif
+#endif
+
 extern Bool noTestExtensions;
 extern Bool noRenderExtension;
 extern BOOL serverRunning;
@@ -526,6 +538,7 @@ cfrelease(CFAllocatorRef a, const void *b)
     CFRelease(b);
 }
 
+CF_RETURNS_RETAINED
 static CFMutableArrayRef
 nsarray_to_cfarray(NSArray *in)
 {
index 737db42..022e832 100644 (file)
@@ -347,7 +347,7 @@ extern char *bundle_id_prefix;
     const char *newargv[4];
     char buf[128];
     char *s;
-#if 0 && MAC_OS_X_VERSION_MAX_ALLOWED >= 1080
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1080
     int stdout_pipe[2];
     int stderr_pipe[2];
 #endif
@@ -363,7 +363,7 @@ extern char *bundle_id_prefix;
         setenv("DISPLAY", buf, TRUE);
     }
 
-#if 0 && MAC_OS_X_VERSION_MAX_ALLOWED >= 1080
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1080
     if (asl_log_descriptor) {
         char *asl_sender;
         aslmsg amsg = asl_new(ASL_TYPE_MSG);
@@ -413,7 +413,7 @@ extern char *bundle_id_prefix;
             _exit(1);
 
         case 0:                                     /* child2 */
-#if 0 && MAC_OS_X_VERSION_MAX_ALLOWED >= 1080
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1080
             if (asl_log_descriptor) {
                 /* Replace our stdout/stderr */
                 dup2(stdout_pipe[1], STDOUT_FILENO);
@@ -442,7 +442,7 @@ extern char *bundle_id_prefix;
         waitpid(child1, &status, 0);
     }
 
-#if 0 && MAC_OS_X_VERSION_MAX_ALLOWED >= 1080
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1080
     if (asl_log_descriptor) {
         /* Close the write ends of the pipe */
         close(stdout_pipe[1]);
@@ -934,17 +934,16 @@ extern char *bundle_id_prefix;
             == NSAlertDefaultReturn) ? NSTerminateNow : NSTerminateCancel;
 }
 
-- (void) applicationWillTerminate:(NSNotification *)aNotification
+- (void) applicationWillTerminate:(NSNotification *)aNotification _X_NORETURN
 {
-    unsigned remain;
+    int remain;
     [X11App prefs_synchronize];
 
     /* shutdown the X server, it will exit () for us. */
     DarwinSendDDXEvent(kXquartzQuit, 0);
 
-    /* In case it doesn't, exit anyway after a while. */
-    remain = 10000000;
-    while ((remain = usleep(remain)) > 0) ;
+    /* In case it doesn't, exit anyway after 5s. */
+    [NSThread sleepForTimeInterval:5.0];
 
     exit(1);
 }
index d41a81d..cc91c96 100644 (file)
@@ -83,9 +83,9 @@ static XID eventResource;
 static unsigned int eventMask = 0;
 
 static int
-WMFreeClient(pointer data, XID id);
+WMFreeClient(void *data, XID id);
 static int
-WMFreeEvents(pointer data, XID id);
+WMFreeEvents(void *data, XID id);
 static void
 SNotifyEvent(xAppleWMNotifyEvent *from, xAppleWMNotifyEvent *to);
 
@@ -175,7 +175,7 @@ updateEventMask(WMEventPtr *pHead)
 
 /*ARGSUSED*/
 static int
-WMFreeClient(pointer data, XID id)
+WMFreeClient(void *data, XID id)
 {
     WMEventPtr pEvent;
     WMEventPtr   *pHead, pCur, pPrev;
@@ -183,7 +183,7 @@ WMFreeClient(pointer data, XID id)
 
     pEvent = (WMEventPtr)data;
     i = dixLookupResourceByType(
-        (pointer *)&pHead, eventResource, EventType, serverClient,
+        (void **)&pHead, eventResource, EventType, serverClient,
         DixReadAccess |
         DixWriteAccess | DixDestroyAccess);
     if (i == Success && pHead) {
@@ -198,13 +198,13 @@ WMFreeClient(pointer data, XID id)
         }
         updateEventMask(pHead);
     }
-    free((pointer)pEvent);
+    free((void *)pEvent);
     return 1;
 }
 
 /*ARGSUSED*/
 static int
-WMFreeEvents(pointer data, XID id)
+WMFreeEvents(void *data, XID id)
 {
     WMEventPtr   *pHead, pCur, pNext;
 
@@ -212,9 +212,9 @@ WMFreeEvents(pointer data, XID id)
     for (pCur = *pHead; pCur; pCur = pNext) {
         pNext = pCur->next;
         FreeResource(pCur->clientResource, ClientType);
-        free((pointer)pCur);
+        free((void *)pCur);
     }
-    free((pointer)pHead);
+    free((void *)pHead);
     eventMask = 0;
     return 1;
 }
@@ -229,7 +229,7 @@ ProcAppleWMSelectInput(register ClientPtr client)
 
     REQUEST_SIZE_MATCH(xAppleWMSelectInputReq);
     i =
-        dixLookupResourceByType((pointer *)&pHead, eventResource, EventType,
+        dixLookupResourceByType((void **)&pHead, eventResource, EventType,
                                 client,
                                 DixWriteAccess);
     if (stuff->mask != 0) {
@@ -257,7 +257,7 @@ ProcAppleWMSelectInput(register ClientPtr client)
          */
         clientResource = FakeClientID(client->index);
         pNewEvent->clientResource = clientResource;
-        if (!AddResource(clientResource, ClientType, (pointer)pNewEvent))
+        if (!AddResource(clientResource, ClientType, (void *)pNewEvent))
             return BadAlloc;
         /*
          * create a resource to contain a pointer to the list
@@ -268,7 +268,7 @@ ProcAppleWMSelectInput(register ClientPtr client)
         if (i != Success || !pHead) {
             pHead = (WMEventPtr *)malloc(sizeof(WMEventPtr));
             if (!pHead ||
-                !AddResource(eventResource, EventType, (pointer)pHead)) {
+                !AddResource(eventResource, EventType, (void *)pHead)) {
                 FreeResource(clientResource, RT_NONE);
                 return BadAlloc;
             }
@@ -317,7 +317,7 @@ AppleWMSendEvent(int type, unsigned int mask, int which, int arg)
     int i;
 
     i =
-        dixLookupResourceByType((pointer *)&pHead, eventResource, EventType,
+        dixLookupResourceByType((void **)&pHead, eventResource, EventType,
                                 serverClient,
                                 DixReadAccess);
     if (i != Success || !pHead)
@@ -378,6 +378,13 @@ ProcAppleWMSetWindowMenu(register ClientPtr client)
     items = malloc(sizeof(char *) * nitems);
     shortcuts = malloc(sizeof(char) * nitems);
 
+    if (!items || !shortcuts) {
+        free(items);
+        free(shortcuts);
+
+        return BadAlloc;
+    }
+
     max_len = (stuff->length << 2) - sizeof(xAppleWMSetWindowMenuReq);
     bytes = (char *)&stuff[1];
 
@@ -391,6 +398,15 @@ ProcAppleWMSetWindowMenu(register ClientPtr client)
                 break;
         }
     }
+
+    /* Check if we bailed out of the above loop due to a request that was too long */
+    if (j < nitems) {
+        free(items);
+        free(shortcuts);
+
+        return BadRequest;
+    }
+
     X11ApplicationSetWindowMenu(nitems, items, shortcuts);
     free(items);
     free(shortcuts);
@@ -612,7 +628,7 @@ ProcAppleWMDispatch(register ClientPtr client)
         return ProcAppleWMQueryVersion(client);
     }
 
-    if (!LocalClient(client))
+    if (!client->local)
         return WMErrorBase + AppleWMClientNotLocal;
 
     switch (stuff->data) {
@@ -684,7 +700,7 @@ SProcAppleWMDispatch(register ClientPtr client)
     REQUEST(xReq);
 
     /* It is bound to be non-local when there is byte swapping */
-    if (!LocalClient(client))
+    if (!client->local)
         return WMErrorBase + AppleWMClientNotLocal;
 
     /* only local clients are allowed WM access */
index f76c5fc..a0d9050 100644 (file)
        <key>CFBundlePackageType</key>
                <string>APPL</string>
        <key>CFBundleShortVersionString</key>
-               <string>2.7.4</string>
+               <string>2.7.7</string>
        <key>CFBundleVersion</key>
-               <string>2.7.4</string>
+               <string>2.7.7</string>
        <key>CFBundleSignature</key>
                <string>x11a</string>
        <key>CSResourcesFileMapped</key>
                <true/>
+       <key>NSSupportsAutomaticGraphicsSwitching</key>
+               <true/>
 #ifdef XQUARTZ_SPARKLE
        <key>SUEnableAutomaticChecks</key>
                <true/>
@@ -37,9 +39,9 @@
        <key>LSApplicationCategoryType</key>
                <string>public.app-category.utilities</string>
        <key>NSHumanReadableCopyright</key>
-               <string>© 2003-2012 Apple Inc.
+               <string>© 2003-2013 Apple Inc.
 Â© 2003 XFree86 Project, Inc.
-© 2003-2012 X.org Foundation, Inc.
+© 2003-2013 X.org Foundation, Inc.
 </string>
        <key>NSMainNibFile</key>
                <string>main</string>
index d26f18a..29c6438 100644 (file)
@@ -38,7 +38,6 @@
 #include "servermd.h"
 #include "inputstr.h"
 #include "scrnintstr.h"
-#include "mibstore.h"           // mi backing store implementation
 #include "mipointer.h"          // mi software cursor
 #include "micmap.h"             // mi colormap code
 #include "fb.h"                 // fb framebuffer code
@@ -231,13 +230,15 @@ DarwinScreenInit(ScreenPtr pScreen, int argc, char **argv)
     }
 
     // TODO: Make PseudoColor visuals not suck in TrueColor mode
-    //    if(dfb->depth > 8)
-    //        miSetVisualTypesAndMasks(8, PseudoColorMask, 8, PseudoColor, 0, 0, 0);
-    if (dfb->depth > 15)
-        miSetVisualTypesAndMasks(15, TrueColorMask, 5, TrueColor,
-                                 RM_ARGB(0, 5, 5, 5), GM_ARGB(0, 5, 5,
-                                                              5),
-                                 BM_ARGB(0, 5, 5, 5));
+    // if(dfb->depth > 8)
+    //    miSetVisualTypesAndMasks(8, PseudoColorMask, 8, PseudoColor, 0, 0, 0);
+    //
+    // TODO: Re-add support for 15bit
+    // if (dfb->depth > 15)
+    //    miSetVisualTypesAndMasks(15, TrueColorMask, 5, TrueColor,
+    //                             RM_ARGB(0, 5, 5, 5), GM_ARGB(0, 5, 5,
+    //                                                          5),
+    //                             BM_ARGB(0, 5, 5, 5));
     if (dfb->depth > 24)
         miSetVisualTypesAndMasks(24, TrueColorMask, 8, TrueColor,
                                  RM_ARGB(0, 8, 8, 8), GM_ARGB(0, 8, 8,
@@ -703,22 +704,6 @@ OsVendorInit(void)
         free(lf);
 
         DarwinPrintBanner();
-#ifdef ENABLE_DEBUG_LOG
-        {
-            char *home_dir = NULL, *log_file_path = NULL;
-            home_dir = getenv("HOME");
-            if (home_dir) asprintf(&log_file_path, "%s/%s", home_dir,
-                                   DEBUG_LOG_NAME);
-            if (log_file_path) {
-                if (!access(log_file_path, F_OK)) {
-                    debug_log_fp = fopen(log_file_path, "a");
-                    if (debug_log_fp) ErrorF("Debug logging enabled to %s\n",
-                                             log_file_path);
-                }
-                free(log_file_path);
-            }
-        }
-#endif
     }
 }
 
index 5de360d..541128b 100644 (file)
@@ -26,7 +26,7 @@
  */
 
 #ifndef _DARWIN_FB_H
-#define _DARWIN_DB_H
+#define _DARWIN_FB_H
 
 #include "scrnintstr.h"
 
index b5a3168..756e4ef 100644 (file)
@@ -353,6 +353,10 @@ main(int argc, char **argv, char **envp)
     newenvp = (string_array_t)calloc((1 + envpc), sizeof(string_t));
 
     if (!newargv || !newenvp) {
+        /* Silence the clang static analyzer */
+        free(newargv);
+        free(newenvp);
+
         asl_log(aslc, NULL, ASL_LEVEL_ERR,
                 "Xquartz: Memory allocation failure");
         return EXIT_FAILURE;
index 57ddb74..f4f4de8 100644 (file)
@@ -85,8 +85,7 @@ static struct propdata null_propdata = {
 static void
 dump_prefs()
 {
-    ErrorF(fp,
-           "pbproxy preferences:\n"
+    ErrorF("pbproxy preferences:\n"
            "\tactive %u\n"
            "\tprimary_on_grab %u\n"
            "\tclipboard_to_pasteboard %u\n"
index 31b0e61..d7229ce 100644 (file)
@@ -109,11 +109,14 @@ Bool
 QuartzAddScreen(int index,
                 ScreenPtr pScreen)
 {
+    // The clang static analyzer thinks we leak displayInfo here
+#ifndef __clang_analyzer__
     // allocate space for private per screen Quartz specific storage
     QuartzScreenPtr displayInfo = calloc(sizeof(QuartzScreenRec), 1);
 
     // QUARTZ_PRIV(pScreen) = displayInfo;
     dixSetPrivate(&pScreen->devPrivates, quartzScreenKey, displayInfo);
+#endif /* __clang_analyzer__ */
 
     // do Quartz mode specific initialization
     return quartzProcs->AddScreen(index, pScreen);
@@ -145,7 +148,7 @@ QuartzSetupScreen(int index,
     return TRUE;
 }
 
-static ExtensionModule quartzExtensions[] = {
+static const ExtensionModule quartzExtensions[] = {
     /* PseudoramiX needs to be done before RandR, so
      * it is in miinitext.c until it can be reordered.
      * { PseudoramiXExtensionInit, "PseudoramiX", &noPseudoramiXExtension },
@@ -161,10 +164,7 @@ static ExtensionModule quartzExtensions[] = {
  */
 static void QuartzExtensionInit(void)
 {
-    int i;
-
-    for (i = 0; i < ARRAY_SIZE(quartzExtensions); i++)
-        LoadExtension(&quartzExtensions[i], TRUE);
+    LoadExtensionList(quartzExtensions, ARRAY_SIZE(quartzExtensions), TRUE);
 }
 
 /*
index db2b3cf..d21fb7d 100644 (file)
@@ -48,9 +48,9 @@
  *  Clean out any autoreleased objects.
  */
 void
-QuartzBlockHandler(pointer blockData,
+QuartzBlockHandler(void *blockData,
                    OSTimePtr pTimeout,
-                   pointer pReadmask)
+                   void *pReadmask)
 {
     static NSAutoreleasePool *aPool = nil;
 
@@ -62,9 +62,9 @@ QuartzBlockHandler(pointer blockData,
  * QuartzWakeupHandler
  */
 void
-QuartzWakeupHandler(pointer blockData,
+QuartzWakeupHandler(void *blockData,
                     int result,
-                    pointer pReadmask)
+                    void *pReadmask)
 {
     // nothing here
 }
index 813bc77..308a3f1 100644 (file)
@@ -47,8 +47,8 @@ extern int aquaMenuBarHeight;
 extern const char      *quartzOpenGLBundle;
 
 void
-QuartzBlockHandler(pointer blockData, OSTimePtr pTimeout, pointer pReadmask);
+QuartzBlockHandler(void *blockData, OSTimePtr pTimeout, void *pReadmask);
 void
-QuartzWakeupHandler(pointer blockData, int result, pointer pReadmask);
+QuartzWakeupHandler(void *blockData, int result, void *pReadmask);
 
 #endif  /* _QUARTZCOMMON_H */
index 763a7cd..c654ee5 100644 (file)
@@ -3,6 +3,7 @@ noinst_LTLIBRARIES = libXquartzXpr.la
 AM_CFLAGS =  $(DIX_CFLAGS)
 AM_CPPFLAGS = \
        -I$(srcdir) -I$(srcdir)/.. \
+       -I$(top_builddir)/pseudoramiX \
        -I$(top_srcdir)/miext \
        -I$(top_srcdir)/miext/rootless
 
index f77848f..7757465 100644 (file)
@@ -123,13 +123,17 @@ ProcAppleDRIQueryDirectRenderingCapable(register ClientPtr client)
     rep.length = 0;
     rep.sequenceNumber = client->sequence;
 
+    if (stuff->screen >= screenInfo.numScreens) {
+        return BadValue;
+    }
+
     if (!DRIQueryDirectRenderingCapable(screenInfo.screens[stuff->screen],
                                         &isCapable)) {
         return BadValue;
     }
     rep.isCapable = isCapable;
 
-    if (!LocalClient(client))
+    if (!client->local)
         rep.isCapable = 0;
 
     if (client->swapped) {
@@ -354,7 +358,7 @@ ProcAppleDRIDispatch(register ClientPtr client)
         return ProcAppleDRIQueryDirectRenderingCapable(client);
     }
 
-    if (!LocalClient(client))
+    if (!client->local)
         return DRIErrorBase + AppleDRIClientNotLocal;
 
     switch (stuff->data) {
@@ -402,6 +406,7 @@ SProcAppleDRIQueryDirectRenderingCapable(register ClientPtr client)
 {
     REQUEST(xAppleDRIQueryDirectRenderingCapableReq);
     swaps(&stuff->length);
+    REQUEST_SIZE_MATCH(xAppleDRIQueryDirectRenderingCapableReq);
     swapl(&stuff->screen);
     return ProcAppleDRIQueryDirectRenderingCapable(client);
 }
@@ -411,6 +416,7 @@ SProcAppleDRIAuthConnection(register ClientPtr client)
 {
     REQUEST(xAppleDRIAuthConnectionReq);
     swaps(&stuff->length);
+    REQUEST_SIZE_MATCH(xAppleDRIAuthConnectionReq);
     swapl(&stuff->screen);
     swapl(&stuff->magic);
     return ProcAppleDRIAuthConnection(client);
@@ -421,6 +427,7 @@ SProcAppleDRICreateSurface(register ClientPtr client)
 {
     REQUEST(xAppleDRICreateSurfaceReq);
     swaps(&stuff->length);
+    REQUEST_SIZE_MATCH(xAppleDRICreateSurfaceReq);
     swapl(&stuff->screen);
     swapl(&stuff->drawable);
     swapl(&stuff->client_id);
@@ -432,6 +439,7 @@ SProcAppleDRIDestroySurface(register ClientPtr client)
 {
     REQUEST(xAppleDRIDestroySurfaceReq);
     swaps(&stuff->length);
+    REQUEST_SIZE_MATCH(xAppleDRIDestroySurfaceReq);
     swapl(&stuff->screen);
     swapl(&stuff->drawable);
     return ProcAppleDRIDestroySurface(client);
@@ -442,6 +450,7 @@ SProcAppleDRICreatePixmap(register ClientPtr client)
 {
     REQUEST(xAppleDRICreatePixmapReq);
     swaps(&stuff->length);
+    REQUEST_SIZE_MATCH(xAppleDRICreatePixmapReq);
     swapl(&stuff->screen);
     swapl(&stuff->drawable);
     return ProcAppleDRICreatePixmap(client);
@@ -452,6 +461,7 @@ SProcAppleDRIDestroyPixmap(register ClientPtr client)
 {
     REQUEST(xAppleDRIDestroyPixmapReq);
     swaps(&stuff->length);
+    REQUEST_SIZE_MATCH(xAppleDRIDestroyPixmapReq);
     swapl(&stuff->drawable);
     return ProcAppleDRIDestroyPixmap(client);
 }
@@ -469,7 +479,7 @@ SProcAppleDRIDispatch(register ClientPtr client)
         return SProcAppleDRIQueryDirectRenderingCapable(client);
     }
 
-    if (!LocalClient(client))
+    if (!client->local)
         return DRIErrorBase + AppleDRIClientNotLocal;
 
     switch (stuff->data) {
index 03af163..014709b 100644 (file)
@@ -64,6 +64,7 @@
 #include "mi.h"
 #include "mipointer.h"
 #include "rootless.h"
+#include "rootlessCommon.h"
 #include "x-hash.h"
 #include "x-hook.h"
 #include "driWrap.h"
@@ -380,6 +381,11 @@ DRICreateSurface(ScreenPtr pScreen, Drawable id,
     DRIDrawablePrivPtr pDRIDrawablePriv;
 
     if (pDrawable->type == DRAWABLE_WINDOW) {
+        /* <rdar://problem/12338921>
+         * http://bugs.winehq.org/show_bug.cgi?id=31751
+         */
+        RootlessStopDrawing((WindowPtr)pDrawable, FALSE);
+
         pDRIDrawablePriv = CreateSurfaceForWindow(pScreen,
                                                   (WindowPtr)pDrawable, &wid);
 
@@ -449,7 +455,7 @@ DRICreateSurface(ScreenPtr pScreen, Drawable id,
                                 pDRIDrawablePriv->sid), pDRIDrawablePriv);
 
         /* track this in case this window is destroyed */
-        AddResource(id, DRIDrawablePrivResType, (pointer)pDrawable);
+        AddResource(id, DRIDrawablePrivResType, (void *)pDrawable);
 
         /* Initialize shape */
         DRIUpdateSurface(pDRIDrawablePriv, pDrawable);
@@ -523,7 +529,7 @@ DRIDestroySurface(ScreenPtr pScreen, Drawable id, DrawablePtr pDrawable,
  * drops to <= 0, or the window/pixmap is destroyed.
  */
 Bool
-DRIDrawablePrivDelete(pointer pResource, XID id)
+DRIDrawablePrivDelete(void *pResource, XID id)
 {
     DrawablePtr pDrawable = (DrawablePtr)pResource;
     DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pDrawable->pScreen);
@@ -823,7 +829,7 @@ DRICreatePixmap(ScreenPtr pScreen, Drawable id,
 
     dixSetPrivate(&pPix->devPrivates, DRIPixmapBufferPrivKey, shared);
 
-    AddResource(id, DRIDrawablePrivResType, (pointer)pDrawable);
+    AddResource(id, DRIDrawablePrivResType, (void *)pDrawable);
 
     return TRUE;
 }
@@ -878,7 +884,7 @@ DRIFreePixmapImp(DrawablePtr pDrawable)
     shm_unlink(shared->shmPath);
     free(shared);
 
-    dixSetPrivate(&pPix->devPrivates, DRIPixmapBufferPrivKey, (pointer)NULL);
+    dixSetPrivate(&pPix->devPrivates, DRIPixmapBufferPrivKey, (void *)NULL);
 
     return TRUE;
 }
index 8717a51..70cb8b6 100644 (file)
@@ -99,7 +99,7 @@ DRIDestroySurface(ScreenPtr pScreen, Drawable id, DrawablePtr pDrawable,
                                  void *data), void *notify_data);
 
 extern Bool
-DRIDrawablePrivDelete(pointer pResource, XID id);
+DRIDrawablePrivDelete(void *pResource, XID id);
 
 extern DRIWrappedFuncsRec *
 DRIGetWrappedFuncs(ScreenPtr pScreen);
index 5f9f3ab..42282d5 100644 (file)
@@ -447,7 +447,7 @@ DRIImageText16(DrawablePtr dst, GCPtr pGC,
 static void
 DRIImageGlyphBlt(DrawablePtr dst, GCPtr pGC,
                  int x, int y, unsigned int nglyphInit,
-                 CharInfoPtr *ppciInit, pointer unused)
+                 CharInfoPtr *ppciInit, void *unused)
 {
     DRISavedDrawableState saved;
 
@@ -465,7 +465,7 @@ DRIImageGlyphBlt(DrawablePtr dst, GCPtr pGC,
 static void
 DRIPolyGlyphBlt(DrawablePtr dst, GCPtr pGC,
                 int x, int y, unsigned int nglyph,
-                CharInfoPtr *ppci, pointer pglyphBase)
+                CharInfoPtr *ppci, void *pglyphBase)
 {
     DRISavedDrawableState saved;
 
index b5d8ab9..3922bb8 100644 (file)
@@ -70,34 +70,19 @@ X_PFX(hook_remove) (x_list * lst, x_hook_function * fun, void *data) {
 
 X_EXTERN void
 X_PFX(hook_run) (x_list * lst, void *arg) {
-    x_list *node, *cell;
-    x_hook_function **fun;
-    void **data;
-    int length, i;
+    x_list *node;
 
     if (!lst)
         return;
 
-    length = X_PFX(list_length) (lst);
-    fun = malloc(sizeof(x_hook_function *) * length);
-    data = malloc(sizeof(void *) * length);
-
-    if (!fun || !data) {
-        FatalError("Failed to allocate memory in %s\n", __func__);
-    }
+    for (node = lst; node != NULL; node = node->next) {
+        x_list *cell = node->data;
 
-    for (i = 0, node = lst; node != NULL; node = node->next, i++) {
-        cell = node->data;
-        fun[i] = CELL_FUN(cell);
-        data[i] = CELL_DATA(cell);
-    }
+        x_hook_function *fun = CELL_FUN(cell);
+        void *data = CELL_DATA(cell);
 
-    for (i = 0; i < length; i++) {
-        (*fun[i])(arg, data[i]);
+        (*fun)(arg, data);
     }
-
-    free(fun);
-    free(data);
 }
 
 X_EXTERN void
index 0392a46..4168f7c 100644 (file)
@@ -305,8 +305,6 @@ static miPointerScreenFuncRec quartzScreenFuncsRec = {
     QuartzCursorOffScreen,
     QuartzCrossScreen,
     QuartzWarpCursor,
-    NULL,
-    NULL
 };
 
 /*
index 01f1def..aad375b 100644 (file)
 #include <pthread.h>
 #endif
 
+#ifdef DEBUG_XP_LOCK_WINDOW
+#include <execinfo.h>
+#endif
+
 #define DEFINE_ATOM_HELPER(func, atom_name)                      \
     static Atom func(void) {                                       \
         static int generation;                                      \
@@ -376,6 +380,18 @@ xprStartDrawing(RootlessFrameID wid, char **pixelData, int *bytesPerRow)
     unsigned int rowbytes[2];
     xp_error err;
 
+#ifdef DEBUG_XP_LOCK_WINDOW
+    void* callstack[128];
+    int i, frames = backtrace(callstack, 128);
+    char** strs = backtrace_symbols(callstack, frames);
+
+    ErrorF("=== LOCK %d ===\n", (int)x_cvt_vptr_to_uint(wid));
+    for (i = 0; i < frames; ++i) {
+        ErrorF("    %s\n", strs[i]);
+    }
+    free(strs);
+#endif
+
     err = xp_lock_window(x_cvt_vptr_to_uint(
                              wid), NULL, NULL, data, rowbytes, NULL);
     if (err != Success)
@@ -395,6 +411,18 @@ xprStopDrawing(RootlessFrameID wid, Bool flush)
 {
     xp_error err;
 
+#ifdef DEBUG_XP_LOCK_WINDOW
+    void* callstack[128];
+    int i, frames = backtrace(callstack, 128);
+    char** strs = backtrace_symbols(callstack, frames);
+
+    ErrorF("=== UNLOCK %d ===\n", (int)x_cvt_vptr_to_uint(wid));
+    for (i = 0; i < frames; ++i) {
+        ErrorF("    %s\n", strs[i]);
+    }
+    free(strs);
+#endif
+
     err = xp_unlock_window(x_cvt_vptr_to_uint(wid), flush);
     /* This should be a FatalError, but we started tripping over it.  Make it a
      * FatalError after http://xquartz.macosforge.org/trac/ticket/482 is fixed.
index efe2aa8..7aa1ae1 100644 (file)
 #include "damage.h"
 #endif
 
+#if MAC_OS_X_VERSION_MIN_REQUIRED < 1090
+// From NSApplication.h
+extern const double NSAppKitVersionNumber;
+#endif
+
 /* 10.4's deferred update makes X slower.. have to live with the tearing
  * for now.. */
 #define XP_NO_DEFERRED_UPDATES 8
@@ -164,9 +169,14 @@ displayScreenBounds(CGDirectDisplayID id)
               (int)frame.size.width, (int)frame.size.height,
               (int)frame.origin.x, (int)frame.origin.y);
 
-    /* Remove menubar to help standard X11 window managers. */
-    if (XQuartzIsRootless &&
-        frame.origin.x == 0 && frame.origin.y == 0) {
+    /* Remove menubar to help standard X11 window managers.
+     * On Mavericks and later, the menu bar is on all displays.
+     */
+    if (XQuartzIsRootless
+#if MAC_OS_X_VERSION_MIN_REQUIRED < 1090
+        && (NSAppKitVersionNumber >= 1265 || (frame.origin.x == 0 && frame.origin.y == 0))
+#endif
+        ) {
         frame.origin.y += aquaMenuBarHeight;
         frame.size.height -= aquaMenuBarHeight;
     }
@@ -359,6 +369,10 @@ have_depth:
         dfb->blueMask = 0;
         break;
 
+#if 0
+    // Removed because Mountain Lion removed support for
+    // 15bit backing stores.  We can possibly re-add
+    // this once libXplugin is updated to work around it.
     case 15:
         dfb->visuals = TrueColorMask;     //LARGE_VISUALS;
         dfb->preferredCVC = TrueColor;
@@ -369,6 +383,7 @@ have_depth:
         dfb->greenMask = GM_ARGB(0, 5, 5, 5);
         dfb->blueMask = BM_ARGB(0, 5, 5, 5);
         break;
+#endif
 
     //        case 24:
     default:
diff --git a/hw/xwayland/.gitignore b/hw/xwayland/.gitignore
new file mode 100644 (file)
index 0000000..c54ba2d
--- /dev/null
@@ -0,0 +1,3 @@
+Xwayland
+drm-client-protocol.h
+drm-protocol.c
diff --git a/hw/xwayland/Makefile.am b/hw/xwayland/Makefile.am
new file mode 100644 (file)
index 0000000..dc16b8b
--- /dev/null
@@ -0,0 +1,59 @@
+bin_PROGRAMS = Xwayland
+
+Xwayland_CFLAGS =                              \
+       -I$(top_srcdir)/glamor                  \
+       -I$(top_srcdir)/dri3                    \
+       -DHAVE_DIX_CONFIG_H                     \
+       $(XWAYLANDMODULES_CFLAGS)               \
+       $(DIX_CFLAGS)                           \
+       $(GLAMOR_CFLAGS)                        \
+       $(GBM_CFLAGS)
+
+Xwayland_SOURCES =                             \
+       xwayland.c                              \
+       xwayland-input.c                        \
+       xwayland-cursor.c                       \
+       xwayland-shm.c                          \
+       xwayland-output.c                       \
+       xwayland-cvt.c                          \
+       xwayland.h                              \
+       $(top_srcdir)/Xext/dpmsstubs.c          \
+       $(top_srcdir)/Xi/stubs.c                \
+       $(top_srcdir)/mi/miinitext.c
+
+Xwayland_LDADD =                               \
+       $(glamor_lib)                           \
+       $(XWAYLAND_LIBS)                        \
+       $(XWAYLAND_SYS_LIBS)                    \
+       $(XSERVER_SYS_LIBS)
+Xwayland_DEPENDENCIES = $(XWAYLAND_LIBS)
+Xwayland_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
+
+
+if GLAMOR_EGL
+Xwayland_SOURCES += xwayland-glamor.c
+
+nodist_Xwayland_SOURCES =                      \
+       drm-client-protocol.h                   \
+       drm-protocol.c
+
+CLEANFILES = $(nodist_Xwayland_SOURCES)
+
+EXTRA_DIST = drm.xml
+
+xwayland-glamor.c : $(nodist_Xwayland_SOURCES)
+
+glamor_lib = $(top_builddir)/glamor/libglamor.la
+
+Xwayland_LDADD += $(GLAMOR_LIBS) $(GBM_LIBS) -lEGL -lGL
+endif
+
+
+relink:
+       $(AM_V_at)rm -f Xwayland$(EXEEXT) && $(MAKE) Xwayland$(EXEEXT)
+
+%-protocol.c : %.xml
+       $(AM_V_GEN)$(WAYLAND_SCANNER) code < $< > $@
+
+%-client-protocol.h : %.xml
+       $(AM_V_GEN)$(WAYLAND_SCANNER) client-header < $< > $@
diff --git a/hw/xwayland/drm.xml b/hw/xwayland/drm.xml
new file mode 100644 (file)
index 0000000..8a3ad69
--- /dev/null
@@ -0,0 +1,182 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<protocol name="drm">
+
+  <copyright>
+    Copyright Â© 2008-2011 Kristian Høgsberg
+    Copyright Â© 2010-2011 Intel Corporation
+
+    Permission to use, copy, modify, distribute, and sell this
+    software and its documentation for any purpose is hereby granted
+    without fee, provided that\n 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
+    the copyright holders not be used in advertising or publicity
+    pertaining to distribution of the software without specific,
+    written prior permission.  The copyright holders make no
+    representations about the suitability of this software for any
+    purpose.  It is provided "as is" without express or implied
+    warranty.
+
+    THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+    SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+    FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS 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.
+  </copyright>
+
+  <!-- drm support. This object is created by the server and published
+       using the display's global event. -->
+  <interface name="wl_drm" version="2">
+    <enum name="error">
+      <entry name="authenticate_fail" value="0"/>
+      <entry name="invalid_format" value="1"/>
+      <entry name="invalid_name" value="2"/>
+    </enum>
+
+    <enum name="format">
+      <!-- The drm format codes match the #defines in drm_fourcc.h.
+           The formats actually supported by the compositor will be
+           reported by the format event. -->
+      <entry name="c8" value="0x20203843"/>
+      <entry name="rgb332" value="0x38424752"/>
+      <entry name="bgr233" value="0x38524742"/>
+      <entry name="xrgb4444" value="0x32315258"/>
+      <entry name="xbgr4444" value="0x32314258"/>
+      <entry name="rgbx4444" value="0x32315852"/>
+      <entry name="bgrx4444" value="0x32315842"/>
+      <entry name="argb4444" value="0x32315241"/>
+      <entry name="abgr4444" value="0x32314241"/>
+      <entry name="rgba4444" value="0x32314152"/>
+      <entry name="bgra4444" value="0x32314142"/>
+      <entry name="xrgb1555" value="0x35315258"/>
+      <entry name="xbgr1555" value="0x35314258"/>
+      <entry name="rgbx5551" value="0x35315852"/>
+      <entry name="bgrx5551" value="0x35315842"/>
+      <entry name="argb1555" value="0x35315241"/>
+      <entry name="abgr1555" value="0x35314241"/>
+      <entry name="rgba5551" value="0x35314152"/>
+      <entry name="bgra5551" value="0x35314142"/>
+      <entry name="rgb565" value="0x36314752"/>
+      <entry name="bgr565" value="0x36314742"/>
+      <entry name="rgb888" value="0x34324752"/>
+      <entry name="bgr888" value="0x34324742"/>
+      <entry name="xrgb8888" value="0x34325258"/>
+      <entry name="xbgr8888" value="0x34324258"/>
+      <entry name="rgbx8888" value="0x34325852"/>
+      <entry name="bgrx8888" value="0x34325842"/>
+      <entry name="argb8888" value="0x34325241"/>
+      <entry name="abgr8888" value="0x34324241"/>
+      <entry name="rgba8888" value="0x34324152"/>
+      <entry name="bgra8888" value="0x34324142"/>
+      <entry name="xrgb2101010" value="0x30335258"/>
+      <entry name="xbgr2101010" value="0x30334258"/>
+      <entry name="rgbx1010102" value="0x30335852"/>
+      <entry name="bgrx1010102" value="0x30335842"/>
+      <entry name="argb2101010" value="0x30335241"/>
+      <entry name="abgr2101010" value="0x30334241"/>
+      <entry name="rgba1010102" value="0x30334152"/>
+      <entry name="bgra1010102" value="0x30334142"/>
+      <entry name="yuyv" value="0x56595559"/>
+      <entry name="yvyu" value="0x55595659"/>
+      <entry name="uyvy" value="0x59565955"/>
+      <entry name="vyuy" value="0x59555956"/>
+      <entry name="ayuv" value="0x56555941"/>
+      <entry name="nv12" value="0x3231564e"/>
+      <entry name="nv21" value="0x3132564e"/>
+      <entry name="nv16" value="0x3631564e"/>
+      <entry name="nv61" value="0x3136564e"/>
+      <entry name="yuv410" value="0x39565559"/>
+      <entry name="yvu410" value="0x39555659"/>
+      <entry name="yuv411" value="0x31315559"/>
+      <entry name="yvu411" value="0x31315659"/>
+      <entry name="yuv420" value="0x32315559"/>
+      <entry name="yvu420" value="0x32315659"/>
+      <entry name="yuv422" value="0x36315559"/>
+      <entry name="yvu422" value="0x36315659"/>
+      <entry name="yuv444" value="0x34325559"/>
+      <entry name="yvu444" value="0x34325659"/>
+    </enum>
+
+    <!-- Call this request with the magic received from drmGetMagic().
+         It will be passed on to the drmAuthMagic() or
+         DRIAuthConnection() call.  This authentication must be
+         completed before create_buffer could be used. -->
+    <request name="authenticate">
+      <arg name="id" type="uint"/>
+    </request>
+
+    <!-- Create a wayland buffer for the named DRM buffer.  The DRM
+         surface must have a name using the flink ioctl -->
+    <request name="create_buffer">
+      <arg name="id" type="new_id" interface="wl_buffer"/>
+      <arg name="name" type="uint"/>
+      <arg name="width" type="int"/>
+      <arg name="height" type="int"/>
+      <arg name="stride" type="uint"/>
+      <arg name="format" type="uint"/>
+    </request>
+
+    <!-- Create a wayland buffer for the named DRM buffer.  The DRM
+         surface must have a name using the flink ioctl -->
+    <request name="create_planar_buffer">
+      <arg name="id" type="new_id" interface="wl_buffer"/>
+      <arg name="name" type="uint"/>
+      <arg name="width" type="int"/>
+      <arg name="height" type="int"/>
+      <arg name="format" type="uint"/>
+      <arg name="offset0" type="int"/>
+      <arg name="stride0" type="int"/>
+      <arg name="offset1" type="int"/>
+      <arg name="stride1" type="int"/>
+      <arg name="offset2" type="int"/>
+      <arg name="stride2" type="int"/>
+    </request>
+
+    <!-- Create a wayland buffer for the prime fd.  Use for regular and planar
+         buffers.  Pass 0 for offset and stride for unused planes. -->
+    <request name="create_prime_buffer" since="2">
+      <arg name="id" type="new_id" interface="wl_buffer"/>
+      <arg name="name" type="fd"/>
+      <arg name="width" type="int"/>
+      <arg name="height" type="int"/>
+      <arg name="format" type="uint"/>
+      <arg name="offset0" type="int"/>
+      <arg name="stride0" type="int"/>
+      <arg name="offset1" type="int"/>
+      <arg name="stride1" type="int"/>
+      <arg name="offset2" type="int"/>
+      <arg name="stride2" type="int"/>
+    </request>
+
+    <!-- Notification of the path of the drm device which is used by
+         the server.  The client should use this device for creating
+         local buffers.  Only buffers created from this device should
+         be be passed to the server using this drm object's
+         create_buffer request. -->
+    <event name="device">
+      <arg name="name" type="string"/>
+    </event>
+
+    <event name="format">
+      <arg name="format" type="uint"/>
+    </event>
+
+    <!-- Raised if the authenticate request succeeded -->
+    <event name="authenticated"/>
+
+    <enum name="capability" since="2">
+      <description summary="wl_drm capability bitmask">
+        Bitmask of capabilities.
+      </description>
+      <entry name="prime" value="1" summary="wl_drm prime available"/>
+    </enum>
+
+    <event name="capabilities">
+      <arg name="value" type="uint"/>
+    </event>
+  </interface>
+
+</protocol>
diff --git a/hw/xwayland/xwayland-cursor.c b/hw/xwayland/xwayland-cursor.c
new file mode 100644 (file)
index 0000000..5a9d1fe
--- /dev/null
@@ -0,0 +1,193 @@
+/*
+ * Copyright Â© 2014 Intel Corporation
+ * Copyright Â© 2011 Kristian Høgsberg
+ *
+ * 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 the
+ * copyright holders not be used in advertising or publicity
+ * pertaining to distribution of the software without specific,
+ * written prior permission.  The copyright holders make no
+ * representations about the suitability of this software for any
+ * purpose.  It is provided "as is" without express or implied
+ * warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS 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.
+ */
+
+#include "xwayland.h"
+
+#include <mipointer.h>
+
+static DevPrivateKeyRec xwl_cursor_private_key;
+
+static void
+expand_source_and_mask(CursorPtr cursor, CARD32 *data)
+{
+    CARD32 *p, d, fg, bg;
+    CursorBitsPtr bits = cursor->bits;
+    int x, y, stride, i, bit;
+
+    p = data;
+    fg = ((cursor->foreRed & 0xff00) << 8) |
+        (cursor->foreGreen & 0xff00) | (cursor->foreGreen >> 8);
+    bg = ((cursor->backRed & 0xff00) << 8) |
+        (cursor->backGreen & 0xff00) | (cursor->backGreen >> 8);
+    stride = (bits->width / 8 + 3) & ~3;
+    for (y = 0; y < bits->height; y++)
+        for (x = 0; x < bits->width; x++) {
+            i = y * stride + x / 8;
+            bit = 1 << (x & 7);
+            if (bits->source[i] & bit)
+                d = fg;
+            else
+                d = bg;
+            if (bits->mask[i] & bit)
+                d |= 0xff000000;
+            else
+                d = 0x00000000;
+
+            *p++ = d;
+        }
+}
+
+static Bool
+xwl_realize_cursor(DeviceIntPtr device, ScreenPtr screen, CursorPtr cursor)
+{
+    PixmapPtr pixmap;
+
+    pixmap = xwl_shm_create_pixmap(screen, cursor->bits->width,
+                                   cursor->bits->height, 32, 0);
+    dixSetPrivate(&cursor->devPrivates, &xwl_cursor_private_key, pixmap);
+
+    return TRUE;
+}
+
+static Bool
+xwl_unrealize_cursor(DeviceIntPtr device, ScreenPtr screen, CursorPtr cursor)
+{
+    PixmapPtr pixmap;
+
+    pixmap = dixGetPrivate(&cursor->devPrivates, &xwl_cursor_private_key);
+
+    return xwl_shm_destroy_pixmap(pixmap);
+}
+
+void
+xwl_seat_set_cursor(struct xwl_seat *xwl_seat)
+{
+    PixmapPtr pixmap;
+    CursorPtr cursor;
+    int stride;
+
+    if (!xwl_seat->wl_pointer)
+        return;
+
+    if (!xwl_seat->x_cursor) {
+        wl_pointer_set_cursor(xwl_seat->wl_pointer,
+                              xwl_seat->pointer_enter_serial, NULL, 0, 0);
+        return;
+    }
+
+    cursor = xwl_seat->x_cursor;
+    pixmap = dixGetPrivate(&cursor->devPrivates, &xwl_cursor_private_key);
+    stride = cursor->bits->width * 4;
+    if (cursor->bits->argb)
+        memcpy(pixmap->devPrivate.ptr,
+               cursor->bits->argb, cursor->bits->height * stride);
+    else
+        expand_source_and_mask(cursor, pixmap->devPrivate.ptr);
+
+    wl_pointer_set_cursor(xwl_seat->wl_pointer,
+                          xwl_seat->pointer_enter_serial,
+                          xwl_seat->cursor,
+                          xwl_seat->x_cursor->bits->xhot,
+                          xwl_seat->x_cursor->bits->yhot);
+    wl_surface_attach(xwl_seat->cursor,
+                      xwl_shm_pixmap_get_wl_buffer(pixmap), 0, 0);
+    wl_surface_damage(xwl_seat->cursor, 0, 0,
+                      xwl_seat->x_cursor->bits->width,
+                      xwl_seat->x_cursor->bits->height);
+    wl_surface_commit(xwl_seat->cursor);
+}
+
+static void
+xwl_set_cursor(DeviceIntPtr device,
+               ScreenPtr screen, CursorPtr cursor, int x, int y)
+{
+    struct xwl_seat *xwl_seat;
+
+    xwl_seat = device->public.devicePrivate;
+    if (xwl_seat == NULL)
+        return;
+
+    xwl_seat->x_cursor = cursor;
+    xwl_seat_set_cursor(xwl_seat);
+}
+
+static void
+xwl_move_cursor(DeviceIntPtr device, ScreenPtr screen, int x, int y)
+{
+}
+
+static Bool
+xwl_device_cursor_initialize(DeviceIntPtr device, ScreenPtr screen)
+{
+    return TRUE;
+}
+
+static void
+xwl_device_cursor_cleanup(DeviceIntPtr device, ScreenPtr screen)
+{
+}
+
+static miPointerSpriteFuncRec xwl_pointer_sprite_funcs = {
+    xwl_realize_cursor,
+    xwl_unrealize_cursor,
+    xwl_set_cursor,
+    xwl_move_cursor,
+    xwl_device_cursor_initialize,
+    xwl_device_cursor_cleanup
+};
+
+static Bool
+xwl_cursor_off_screen(ScreenPtr *ppScreen, int *x, int *y)
+{
+    return FALSE;
+}
+
+static void
+xwl_cross_screen(ScreenPtr pScreen, Bool entering)
+{
+}
+
+static void
+xwl_pointer_warp_cursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
+{
+}
+
+static miPointerScreenFuncRec xwl_pointer_screen_funcs = {
+    xwl_cursor_off_screen,
+    xwl_cross_screen,
+    xwl_pointer_warp_cursor
+};
+
+Bool
+xwl_screen_init_cursor(struct xwl_screen *xwl_screen)
+{
+    if (!dixRegisterPrivateKey(&xwl_cursor_private_key, PRIVATE_CURSOR_BITS, 0))
+        return FALSE;
+
+    return miPointerInitialize(xwl_screen->screen,
+                               &xwl_pointer_sprite_funcs,
+                               &xwl_pointer_screen_funcs, TRUE);
+}
diff --git a/hw/xwayland/xwayland-cvt.c b/hw/xwayland/xwayland-cvt.c
new file mode 100644 (file)
index 0000000..3566559
--- /dev/null
@@ -0,0 +1,304 @@
+/* Copied from hw/xfree86/modes/xf86cvt.c into xwayland DDX and
+ * changed to generate an RRMode */
+
+/*
+ * Copyright 2005-2006 Luc Verhaegen.
+ *
+ * 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 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) 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.
+ */
+
+/*
+ * The reason for having this function in a file of its own is
+ * so that ../utils/cvt/cvt can link to it, and that xf86CVTMode
+ * code is shared directly.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <string.h>
+#include <randrstr.h>
+#include "xwayland.h"
+
+/*
+ * Generate a CVT standard mode from HDisplay, VDisplay and VRefresh.
+ *
+ * These calculations are stolen from the CVT calculation spreadsheet written
+ * by Graham Loveridge. He seems to be claiming no copyright and there seems to
+ * be no license attached to this. He apparently just wants to see his name
+ * mentioned.
+ *
+ * This file can be found at http://www.vesa.org/Public/CVT/CVTd6r1.xls
+ *
+ * Comments and structure corresponds to the comments and structure of the xls.
+ * This should ease importing of future changes to the standard (not very
+ * likely though).
+ *
+ * About margins; i'm sure that they are to be the bit between HDisplay and
+ * HBlankStart, HBlankEnd and HTotal, VDisplay and VBlankStart, VBlankEnd and
+ * VTotal, where the overscan colour is shown. FB seems to call _all_ blanking
+ * outside sync "margin" for some reason. Since we prefer seeing proper
+ * blanking instead of the overscan colour, and since the Crtc* values will
+ * probably get altered after us, we will disable margins altogether. With
+ * these calculations, Margins will plainly expand H/VDisplay, and we don't
+ * want that. -- libv
+ *
+ */
+RRModePtr
+xwayland_cvt(int HDisplay, int VDisplay, float VRefresh, Bool Reduced,
+             Bool Interlaced)
+{
+    /* 1) top/bottom margin size (% of height) - default: 1.8 */
+#define CVT_MARGIN_PERCENTAGE 1.8
+
+    /* 2) character cell horizontal granularity (pixels) - default 8 */
+#define CVT_H_GRANULARITY 8
+
+    /* 4) Minimum vertical porch (lines) - default 3 */
+#define CVT_MIN_V_PORCH 3
+
+    /* 4) Minimum number of vertical back porch lines - default 6 */
+#define CVT_MIN_V_BPORCH 6
+
+    /* Pixel Clock step (kHz) */
+#define CVT_CLOCK_STEP 250
+
+    Bool Margins = FALSE;
+    float VFieldRate, HPeriod;
+    int HDisplayRnd, HMargin;
+    int VDisplayRnd, VMargin, VSync;
+    float Interlace;            /* Please rename this */
+    char name[128];
+    xRRModeInfo modeinfo;
+
+    memset(&modeinfo, 0, sizeof modeinfo);
+
+    /* CVT default is 60.0Hz */
+    if (!VRefresh)
+        VRefresh = 60.0;
+
+    /* 1. Required field rate */
+    if (Interlaced)
+        VFieldRate = VRefresh * 2;
+    else
+        VFieldRate = VRefresh;
+
+    /* 2. Horizontal pixels */
+    HDisplayRnd = HDisplay - (HDisplay % CVT_H_GRANULARITY);
+
+    /* 3. Determine left and right borders */
+    if (Margins) {
+        /* right margin is actually exactly the same as left */
+        HMargin = (((float) HDisplayRnd) * CVT_MARGIN_PERCENTAGE / 100.0);
+        HMargin -= HMargin % CVT_H_GRANULARITY;
+    }
+    else
+        HMargin = 0;
+
+    /* 4. Find total active pixels */
+    modeinfo.width = HDisplayRnd + 2 * HMargin;
+
+    /* 5. Find number of lines per field */
+    if (Interlaced)
+        VDisplayRnd = VDisplay / 2;
+    else
+        VDisplayRnd = VDisplay;
+
+    /* 6. Find top and bottom margins */
+    /* nope. */
+    if (Margins)
+        /* top and bottom margins are equal again. */
+        VMargin = (((float) VDisplayRnd) * CVT_MARGIN_PERCENTAGE / 100.0);
+    else
+        VMargin = 0;
+
+    modeinfo.height = VDisplay + 2 * VMargin;
+
+    /* 7. Interlace */
+    if (Interlaced)
+        Interlace = 0.5;
+    else
+        Interlace = 0.0;
+
+    /* Determine VSync Width from aspect ratio */
+    if (!(VDisplay % 3) && ((VDisplay * 4 / 3) == HDisplay))
+        VSync = 4;
+    else if (!(VDisplay % 9) && ((VDisplay * 16 / 9) == HDisplay))
+        VSync = 5;
+    else if (!(VDisplay % 10) && ((VDisplay * 16 / 10) == HDisplay))
+        VSync = 6;
+    else if (!(VDisplay % 4) && ((VDisplay * 5 / 4) == HDisplay))
+        VSync = 7;
+    else if (!(VDisplay % 9) && ((VDisplay * 15 / 9) == HDisplay))
+        VSync = 7;
+    else                        /* Custom */
+        VSync = 10;
+
+    if (!Reduced) {             /* simplified GTF calculation */
+
+        /* 4) Minimum time of vertical sync + back porch interval (µs)
+         * default 550.0 */
+#define CVT_MIN_VSYNC_BP 550.0
+
+        /* 3) Nominal HSync width (% of line period) - default 8 */
+#define CVT_HSYNC_PERCENTAGE 8
+
+        float HBlankPercentage;
+        int VSyncAndBackPorch, VBackPorch;
+        int HBlank;
+
+        /* 8. Estimated Horizontal period */
+        HPeriod = ((float) (1000000.0 / VFieldRate - CVT_MIN_VSYNC_BP)) /
+            (VDisplayRnd + 2 * VMargin + CVT_MIN_V_PORCH + Interlace);
+
+        /* 9. Find number of lines in sync + backporch */
+        if (((int) (CVT_MIN_VSYNC_BP / HPeriod) + 1) <
+            (VSync + CVT_MIN_V_PORCH))
+            VSyncAndBackPorch = VSync + CVT_MIN_V_PORCH;
+        else
+            VSyncAndBackPorch = (int) (CVT_MIN_VSYNC_BP / HPeriod) + 1;
+
+        /* 10. Find number of lines in back porch */
+        VBackPorch = VSyncAndBackPorch - VSync;
+        (void) VBackPorch;
+
+        /* 11. Find total number of lines in vertical field */
+        modeinfo.vTotal =
+            VDisplayRnd + 2 * VMargin + VSyncAndBackPorch + Interlace +
+            CVT_MIN_V_PORCH;
+
+        /* 5) Definition of Horizontal blanking time limitation */
+        /* Gradient (%/kHz) - default 600 */
+#define CVT_M_FACTOR 600
+
+        /* Offset (%) - default 40 */
+#define CVT_C_FACTOR 40
+
+        /* Blanking time scaling factor - default 128 */
+#define CVT_K_FACTOR 128
+
+        /* Scaling factor weighting - default 20 */
+#define CVT_J_FACTOR 20
+
+#define CVT_M_PRIME CVT_M_FACTOR * CVT_K_FACTOR / 256
+#define CVT_C_PRIME (CVT_C_FACTOR - CVT_J_FACTOR) * CVT_K_FACTOR / 256 + \
+        CVT_J_FACTOR
+
+        /* 12. Find ideal blanking duty cycle from formula */
+        HBlankPercentage = CVT_C_PRIME - CVT_M_PRIME * HPeriod / 1000.0;
+
+        /* 13. Blanking time */
+        if (HBlankPercentage < 20)
+            HBlankPercentage = 20;
+
+        HBlank = modeinfo.width * HBlankPercentage / (100.0 - HBlankPercentage);
+        HBlank -= HBlank % (2 * CVT_H_GRANULARITY);
+
+        /* 14. Find total number of pixels in a line. */
+        modeinfo.hTotal = modeinfo.width + HBlank;
+
+        /* Fill in HSync values */
+        modeinfo.hSyncEnd = modeinfo.width + HBlank / 2;
+
+        modeinfo.hSyncStart = modeinfo.hSyncEnd -
+            (modeinfo.hTotal * CVT_HSYNC_PERCENTAGE) / 100;
+        modeinfo.hSyncStart += CVT_H_GRANULARITY -
+            modeinfo.hSyncStart % CVT_H_GRANULARITY;
+
+        /* Fill in VSync values */
+        modeinfo.vSyncStart = modeinfo.height + CVT_MIN_V_PORCH;
+        modeinfo.vSyncEnd = modeinfo.vSyncStart + VSync;
+
+    }
+    else {                      /* Reduced blanking */
+        /* Minimum vertical blanking interval time (µs) - default 460 */
+#define CVT_RB_MIN_VBLANK 460.0
+
+        /* Fixed number of clocks for horizontal sync */
+#define CVT_RB_H_SYNC 32.0
+
+        /* Fixed number of clocks for horizontal blanking */
+#define CVT_RB_H_BLANK 160.0
+
+        /* Fixed number of lines for vertical front porch - default 3 */
+#define CVT_RB_VFPORCH 3
+
+        int VBILines;
+
+        /* 8. Estimate Horizontal period. */
+        HPeriod = ((float) (1000000.0 / VFieldRate - CVT_RB_MIN_VBLANK)) /
+            (VDisplayRnd + 2 * VMargin);
+
+        /* 9. Find number of lines in vertical blanking */
+        VBILines = ((float) CVT_RB_MIN_VBLANK) / HPeriod + 1;
+
+        /* 10. Check if vertical blanking is sufficient */
+        if (VBILines < (CVT_RB_VFPORCH + VSync + CVT_MIN_V_BPORCH))
+            VBILines = CVT_RB_VFPORCH + VSync + CVT_MIN_V_BPORCH;
+
+        /* 11. Find total number of lines in vertical field */
+        modeinfo.vTotal = VDisplayRnd + 2 * VMargin + Interlace + VBILines;
+
+        /* 12. Find total number of pixels in a line */
+        modeinfo.hTotal = modeinfo.width + CVT_RB_H_BLANK;
+
+        /* Fill in HSync values */
+        modeinfo.hSyncEnd = modeinfo.width + CVT_RB_H_BLANK / 2;
+        modeinfo.hSyncStart = modeinfo.hSyncEnd - CVT_RB_H_SYNC;
+
+        /* Fill in VSync values */
+        modeinfo.vSyncStart = modeinfo.height + CVT_RB_VFPORCH;
+        modeinfo.vSyncEnd = modeinfo.vSyncStart + VSync;
+    }
+
+    /* 15/13. Find pixel clock frequency (kHz for xf86) */
+    modeinfo.dotClock = modeinfo.hTotal * 1000.0 / HPeriod;
+    modeinfo.dotClock -= modeinfo.dotClock % CVT_CLOCK_STEP;
+    modeinfo.dotClock *= 1000.0;
+#if 0
+    /* 16/14. Find actual Horizontal Frequency (kHz) */
+    modeinfo.hSync = ((float) modeinfo.dotClock) / ((float) modeinfo.hTotal);
+#endif
+
+#if 0
+    /* 17/15. Find actual Field rate */
+    modeinfo.vRefresh = (1000.0 * ((float) modeinfo.dotClock)) /
+        ((float) (modeinfo.hTotal * modeinfo.vTotal));
+#endif
+
+    /* 18/16. Find actual vertical frame frequency */
+    /* ignore - just set the mode flag for interlaced */
+    if (Interlaced)
+        modeinfo.vTotal *= 2;
+
+    if (Reduced)
+        modeinfo.modeFlags |= RR_HSyncPositive | RR_VSyncNegative;
+    else
+        modeinfo.modeFlags |= RR_HSyncNegative | RR_VSyncPositive;
+
+    if (Interlaced)
+        modeinfo.modeFlags |= RR_Interlace;
+
+    snprintf(name, sizeof name, "%dx%d@%.1fHz",
+             modeinfo.width, modeinfo.height, VRefresh);
+    modeinfo.nameLength = strlen(name);
+
+    return RRModeGet(&modeinfo, name);
+}
diff --git a/hw/xwayland/xwayland-glamor.c b/hw/xwayland/xwayland-glamor.c
new file mode 100644 (file)
index 0000000..4be883f
--- /dev/null
@@ -0,0 +1,570 @@
+/*
+ * Copyright Â© 2011-2014 Intel Corporation
+ *
+ * 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 the
+ * copyright holders not be used in advertising or publicity
+ * pertaining to distribution of the software without specific,
+ * written prior permission.  The copyright holders make no
+ * representations about the suitability of this software for any
+ * purpose.  It is provided "as is" without express or implied
+ * warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS 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.
+ */
+
+#include "xwayland.h"
+
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <xf86drm.h>
+
+#define MESA_EGL_NO_X11_HEADERS
+#include <gbm.h>
+#include <epoxy/egl.h>
+#include <epoxy/gl.h>
+
+#include <glamor.h>
+#include <glamor_context.h>
+#include <dri3.h>
+#include "drm-client-protocol.h"
+
+struct xwl_pixmap {
+    struct wl_buffer *buffer;
+    struct gbm_bo *bo;
+    void *image;
+    unsigned int texture;
+};
+
+static void
+xwl_glamor_egl_make_current(struct glamor_context *glamor_ctx)
+{
+    eglMakeCurrent(glamor_ctx->display, EGL_NO_SURFACE,
+                   EGL_NO_SURFACE, EGL_NO_CONTEXT);
+    if (!eglMakeCurrent(glamor_ctx->display,
+                        EGL_NO_SURFACE, EGL_NO_SURFACE,
+                        glamor_ctx->ctx))
+        FatalError("Failed to make EGL context current\n");
+}
+
+static uint32_t
+drm_format_for_depth(int depth)
+{
+    switch (depth) {
+    case 15:
+        return WL_DRM_FORMAT_XRGB1555;
+    case 16:
+        return WL_DRM_FORMAT_RGB565;
+    case 24:
+        return WL_DRM_FORMAT_XRGB8888;
+    default:
+        ErrorF("unexpected depth: %d\n", depth);
+    case 32:
+        return WL_DRM_FORMAT_ARGB8888;
+    }
+}
+
+static uint32_t
+gbm_format_for_depth(int depth)
+{
+    switch (depth) {
+    case 16:
+        return GBM_FORMAT_RGB565;
+    case 24:
+        return GBM_FORMAT_XRGB8888;
+    default:
+        ErrorF("unexpected depth: %d\n", depth);
+    case 32:
+        return GBM_FORMAT_ARGB8888;
+    }
+}
+
+void
+glamor_egl_screen_init(ScreenPtr screen, struct glamor_context *glamor_ctx)
+{
+    struct xwl_screen *xwl_screen = xwl_screen_get(screen);
+
+    glamor_ctx->ctx = xwl_screen->egl_context;
+    glamor_ctx->display = xwl_screen->egl_display;
+
+    glamor_ctx->make_current = xwl_glamor_egl_make_current;
+
+    xwl_screen->glamor_ctx = glamor_ctx;
+}
+
+static PixmapPtr
+xwl_glamor_create_pixmap_for_bo(ScreenPtr screen, struct gbm_bo *bo, int depth)
+{
+    PixmapPtr pixmap;
+    struct xwl_pixmap *xwl_pixmap;
+    struct xwl_screen *xwl_screen = xwl_screen_get(screen);
+
+    xwl_pixmap = malloc(sizeof *xwl_pixmap);
+    if (xwl_pixmap == NULL)
+        return NULL;
+
+    pixmap = glamor_create_pixmap(screen,
+                                  gbm_bo_get_width(bo),
+                                  gbm_bo_get_height(bo),
+                                  depth,
+                                  GLAMOR_CREATE_PIXMAP_NO_TEXTURE);
+    if (pixmap == NULL) {
+        free(xwl_pixmap);
+        return NULL;
+    }
+
+    if (lastGLContext != xwl_screen->glamor_ctx) {
+        lastGLContext = xwl_screen->glamor_ctx;
+        xwl_glamor_egl_make_current(xwl_screen->glamor_ctx);
+    }
+
+    xwl_pixmap->bo = bo;
+    xwl_pixmap->buffer = NULL;
+    xwl_pixmap->image = eglCreateImageKHR(xwl_screen->egl_display,
+                                          xwl_screen->egl_context,
+                                          EGL_NATIVE_PIXMAP_KHR,
+                                          xwl_pixmap->bo, NULL);
+
+    glGenTextures(1, &xwl_pixmap->texture);
+    glBindTexture(GL_TEXTURE_2D, xwl_pixmap->texture);
+    glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, xwl_pixmap->image);
+    glBindTexture(GL_TEXTURE_2D, 0);
+
+    xwl_pixmap_set_private(pixmap, xwl_pixmap);
+
+    glamor_set_pixmap_texture(pixmap, xwl_pixmap->texture);
+    glamor_set_pixmap_type(pixmap, GLAMOR_TEXTURE_DRM);
+
+    return pixmap;
+}
+
+struct wl_buffer *
+xwl_glamor_pixmap_get_wl_buffer(PixmapPtr pixmap)
+{
+    struct xwl_screen *xwl_screen = xwl_screen_get(pixmap->drawable.pScreen);
+    struct xwl_pixmap *xwl_pixmap = xwl_pixmap_get(pixmap);
+    int prime_fd;
+
+    if (xwl_pixmap->buffer)
+        return xwl_pixmap->buffer;
+
+    prime_fd = gbm_bo_get_fd(xwl_pixmap->bo);
+    if (prime_fd == -1)
+        return NULL;
+
+    xwl_pixmap->buffer =
+        wl_drm_create_prime_buffer(xwl_screen->drm, prime_fd,
+                                   pixmap->drawable.width,
+                                   pixmap->drawable.height,
+                                   drm_format_for_depth(pixmap->drawable.depth),
+                                   0, gbm_bo_get_stride(xwl_pixmap->bo),
+                                   0, 0,
+                                   0, 0);
+
+    close(prime_fd);
+
+    return xwl_pixmap->buffer;
+}
+
+static PixmapPtr
+xwl_glamor_create_pixmap(ScreenPtr screen,
+                         int width, int height, int depth, unsigned int hint)
+{
+    struct xwl_screen *xwl_screen = xwl_screen_get(screen);
+    struct gbm_bo *bo;
+
+    if (width > 0 && height > 0 && depth >= 15 &&
+        (hint == 0 ||
+         hint == CREATE_PIXMAP_USAGE_BACKING_PIXMAP ||
+         hint == CREATE_PIXMAP_USAGE_SHARED)) {
+        bo = gbm_bo_create(xwl_screen->gbm, width, height,
+                           gbm_format_for_depth(depth),
+                           GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING);
+
+        if (bo)
+            return xwl_glamor_create_pixmap_for_bo(screen, bo, depth);
+    }
+
+    return glamor_create_pixmap(screen, width, height, depth, hint);
+}
+
+static Bool
+xwl_glamor_destroy_pixmap(PixmapPtr pixmap)
+{
+    struct xwl_screen *xwl_screen = xwl_screen_get(pixmap->drawable.pScreen);
+    struct xwl_pixmap *xwl_pixmap = xwl_pixmap_get(pixmap);
+
+    if (xwl_pixmap && pixmap->refcnt == 1) {
+        if (xwl_pixmap->buffer)
+            wl_buffer_destroy(xwl_pixmap->buffer);
+
+        eglDestroyImageKHR(xwl_screen->egl_display, xwl_pixmap->image);
+        gbm_bo_destroy(xwl_pixmap->bo);
+        free(xwl_pixmap);
+    }
+
+    return glamor_destroy_pixmap(pixmap);
+}
+
+static Bool
+xwl_glamor_create_screen_resources(ScreenPtr screen)
+{
+    struct xwl_screen *xwl_screen = xwl_screen_get(screen);
+    int ret;
+
+    screen->CreateScreenResources = xwl_screen->CreateScreenResources;
+    ret = (*screen->CreateScreenResources) (screen);
+    xwl_screen->CreateScreenResources = screen->CreateScreenResources;
+    screen->CreateScreenResources = xwl_glamor_create_screen_resources;
+
+    if (!ret)
+        return ret;
+
+    if (xwl_screen->rootless)
+        screen->devPrivate =
+            fbCreatePixmap(screen, 0, 0, screen->rootDepth, 0);
+    else {
+        screen->devPrivate =
+            xwl_glamor_create_pixmap(screen, screen->width, screen->height,
+                                     screen->rootDepth,
+                                     CREATE_PIXMAP_USAGE_BACKING_PIXMAP);
+        if (screen->devPrivate)
+            glamor_set_screen_pixmap(screen->devPrivate, NULL);
+    }
+
+    return screen->devPrivate != NULL;
+}
+
+static char
+is_fd_render_node(int fd)
+{
+    struct stat render;
+
+    if (fstat(fd, &render))
+        return 0;
+    if (!S_ISCHR(render.st_mode))
+        return 0;
+    if (render.st_rdev & 0x80)
+        return 1;
+
+    return 0;
+}
+
+static void
+xwl_drm_init_egl(struct xwl_screen *xwl_screen)
+{
+    EGLint major, minor;
+    const char *version;
+
+    if (xwl_screen->egl_display)
+        return;
+
+    xwl_screen->expecting_event--;
+
+    xwl_screen->gbm = gbm_create_device(xwl_screen->drm_fd);
+    if (xwl_screen->gbm == NULL) {
+        ErrorF("couldn't get display device\n");
+        return;
+    }
+
+    xwl_screen->egl_display = eglGetDisplay(xwl_screen->gbm);
+    if (xwl_screen->egl_display == EGL_NO_DISPLAY) {
+        ErrorF("eglGetDisplay() failed\n");
+        return;
+    }
+
+    eglBindAPI(EGL_OPENGL_API);
+    if (!eglInitialize(xwl_screen->egl_display, &major, &minor)) {
+        ErrorF("eglInitialize() failed\n");
+        return;
+    }
+
+    version = eglQueryString(xwl_screen->egl_display, EGL_VERSION);
+    ErrorF("glamor: EGL version %s:\n", version);
+
+    xwl_screen->egl_context = eglCreateContext(xwl_screen->egl_display,
+                                               NULL, EGL_NO_CONTEXT, NULL);
+    if (xwl_screen->egl_context == EGL_NO_CONTEXT) {
+        ErrorF("Failed to create EGL context\n");
+        return;
+    }
+
+    if (!eglMakeCurrent(xwl_screen->egl_display,
+                        EGL_NO_SURFACE, EGL_NO_SURFACE,
+                        xwl_screen->egl_context)) {
+        ErrorF("Failed to make EGL context current\n");
+        return;
+    }
+
+    if (!epoxy_has_gl_extension("GL_OES_EGL_image")) {
+        ErrorF("GL_OES_EGL_image no available");
+        return;
+    }
+
+    return;
+}
+
+static void
+xwl_drm_handle_device(void *data, struct wl_drm *drm, const char *device)
+{
+   struct xwl_screen *xwl_screen = data;
+   drm_magic_t magic;
+
+   xwl_screen->device_name = strdup(device);
+   if (!xwl_screen->device_name)
+      return;
+
+   xwl_screen->drm_fd = open(xwl_screen->device_name, O_RDWR | O_CLOEXEC);
+   if (xwl_screen->drm_fd == -1) {
+       ErrorF("wayland-egl: could not open %s (%s)",
+             xwl_screen->device_name, strerror(errno));
+       return;
+   }
+
+   if (is_fd_render_node(xwl_screen->drm_fd)) {
+       xwl_screen->fd_render_node = 1;
+       xwl_drm_init_egl(xwl_screen);
+   } else {
+       drmGetMagic(xwl_screen->drm_fd, &magic);
+       wl_drm_authenticate(xwl_screen->drm, magic);
+   }
+}
+
+static void
+xwl_drm_handle_format(void *data, struct wl_drm *drm, uint32_t format)
+{
+   struct xwl_screen *xwl_screen = data;
+
+   switch (format) {
+   case WL_DRM_FORMAT_ARGB8888:
+      xwl_screen->formats |= XWL_FORMAT_ARGB8888;
+      break;
+   case WL_DRM_FORMAT_XRGB8888:
+      xwl_screen->formats |= XWL_FORMAT_XRGB8888;
+      break;
+   case WL_DRM_FORMAT_RGB565:
+      xwl_screen->formats |= XWL_FORMAT_RGB565;
+      break;
+   }
+}
+
+static void
+xwl_drm_handle_authenticated(void *data, struct wl_drm *drm)
+{
+    struct xwl_screen *xwl_screen = data;
+
+    if (!xwl_screen->egl_display)
+        xwl_drm_init_egl(xwl_screen);
+}
+
+static void
+xwl_drm_handle_capabilities(void *data, struct wl_drm *drm, uint32_t value)
+{
+   struct xwl_screen *xwl_screen = data;
+
+   xwl_screen->capabilities = value;
+}
+
+static const struct wl_drm_listener xwl_drm_listener = {
+    xwl_drm_handle_device,
+    xwl_drm_handle_format,
+    xwl_drm_handle_authenticated,
+    xwl_drm_handle_capabilities
+};
+
+Bool
+xwl_screen_init_glamor(struct xwl_screen *xwl_screen,
+                       uint32_t id, uint32_t version)
+{
+    if (version < 2)
+        return FALSE;
+
+    xwl_screen->drm =
+        wl_registry_bind(xwl_screen->registry, id, &wl_drm_interface, 2);
+    wl_drm_add_listener(xwl_screen->drm, &xwl_drm_listener, xwl_screen);
+    xwl_screen->expecting_event++;
+
+    return TRUE;
+}
+
+void
+glamor_egl_destroy_textured_pixmap(PixmapPtr pixmap)
+{
+    glamor_destroy_textured_pixmap(pixmap);
+}
+
+int
+glamor_egl_dri3_fd_name_from_tex(ScreenPtr screen,
+                                 PixmapPtr pixmap,
+                                 unsigned int tex,
+                                 Bool want_name, CARD16 *stride, CARD32 *size)
+{
+    return 0;
+}
+
+unsigned int
+glamor_egl_create_argb8888_based_texture(ScreenPtr screen, int w, int h)
+{
+    return 0;
+}
+
+struct xwl_auth_state {
+    int fd;
+    ClientPtr client;
+};
+
+static void
+sync_callback(void *data, struct wl_callback *callback, uint32_t serial)
+{
+    struct xwl_auth_state *state = data;
+
+    dri3_send_open_reply(state->client, state->fd);
+    AttendClient(state->client);
+    free(state);
+    wl_callback_destroy(callback);
+}
+
+static const struct wl_callback_listener sync_listener = {
+   sync_callback
+};
+
+static int
+xwl_dri3_open_client(ClientPtr client,
+                     ScreenPtr screen,
+                     RRProviderPtr provider,
+                     int *pfd)
+{
+    struct xwl_screen *xwl_screen = xwl_screen_get(screen);
+    struct xwl_auth_state *state;
+    struct wl_callback *callback;
+    drm_magic_t magic;
+    int fd;
+
+    fd = open(xwl_screen->device_name, O_RDWR | O_CLOEXEC);
+    if (fd < 0)
+        return BadAlloc;
+    if (xwl_screen->fd_render_node) {
+        *pfd = fd;
+        return Success;
+    }
+
+    state = malloc(sizeof *state);
+    if (state == NULL) {
+        close(fd);
+        return BadAlloc;
+    }
+
+    state->client = client;
+    state->fd = fd;
+
+    if (drmGetMagic(state->fd, &magic) < 0) {
+        close(state->fd);
+        free(state);
+        return BadMatch;
+    }
+
+    wl_drm_authenticate(xwl_screen->drm, magic);
+    callback = wl_display_sync(xwl_screen->display);
+    wl_callback_add_listener(callback, &sync_listener, state);
+
+    IgnoreClient(client);
+
+    return Success;
+}
+
+static PixmapPtr
+xwl_dri3_pixmap_from_fd(ScreenPtr screen, int fd,
+                        CARD16 width, CARD16 height, CARD16 stride,
+                        CARD8 depth, CARD8 bpp)
+{
+    struct xwl_screen *xwl_screen = xwl_screen_get(screen);
+    struct gbm_import_fd_data data;
+    struct gbm_bo *bo;
+    PixmapPtr pixmap;
+
+    if (width == 0 || height == 0 ||
+        depth < 15 || bpp != BitsPerPixel(depth) || stride < width * bpp / 8)
+        return NULL;
+
+    data.fd = fd;
+    data.width = width;
+    data.height = height;
+    data.stride = stride;
+    data.format = gbm_format_for_depth(depth);
+    bo = gbm_bo_import(xwl_screen->gbm, GBM_BO_IMPORT_FD, &data,
+                       GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING);
+    if (bo == NULL)
+        return NULL;
+
+    pixmap = xwl_glamor_create_pixmap_for_bo(screen, bo, depth);
+    if (pixmap == NULL) {
+        gbm_bo_destroy(bo);
+        return NULL;
+    }
+
+    return pixmap;
+}
+
+static int
+xwl_dri3_fd_from_pixmap(ScreenPtr screen, PixmapPtr pixmap,
+                        CARD16 *stride, CARD32 *size)
+{
+    struct xwl_pixmap *xwl_pixmap;
+
+    xwl_pixmap = xwl_pixmap_get(pixmap);
+
+    *stride = gbm_bo_get_stride(xwl_pixmap->bo);
+    *size = pixmap->drawable.width * *stride;
+
+    return gbm_bo_get_fd(xwl_pixmap->bo);
+}
+
+static dri3_screen_info_rec xwl_dri3_info = {
+    .version = 1,
+    .open = NULL,
+    .pixmap_from_fd = xwl_dri3_pixmap_from_fd,
+    .fd_from_pixmap = xwl_dri3_fd_from_pixmap,
+    .open_client = xwl_dri3_open_client,
+};
+
+Bool
+xwl_glamor_init(struct xwl_screen *xwl_screen)
+{
+    ScreenPtr screen = xwl_screen->screen;
+
+    if (xwl_screen->egl_context == EGL_NO_CONTEXT) {
+        ErrorF("Disabling glamor and dri3, EGL setup failed\n");
+        return FALSE;
+    }
+
+    if (!glamor_init(xwl_screen->screen,
+                     GLAMOR_INVERTED_Y_AXIS |
+                     GLAMOR_USE_EGL_SCREEN |
+                     GLAMOR_USE_SCREEN |
+                     GLAMOR_USE_PICTURE_SCREEN)) {
+        ErrorF("Failed to initialize glamor\n");
+        return FALSE;
+    }
+
+    if (!dri3_screen_init(xwl_screen->screen, &xwl_dri3_info)) {
+        ErrorF("Failed to initialize dri3\n");
+        return FALSE;
+    }
+
+    xwl_screen->CreateScreenResources = screen->CreateScreenResources;
+    screen->CreateScreenResources = xwl_glamor_create_screen_resources;
+    screen->CreatePixmap = xwl_glamor_create_pixmap;
+    screen->DestroyPixmap = xwl_glamor_destroy_pixmap;
+
+    return TRUE;
+}
diff --git a/hw/xwayland/xwayland-input.c b/hw/xwayland/xwayland-input.c
new file mode 100644 (file)
index 0000000..990cb82
--- /dev/null
@@ -0,0 +1,666 @@
+/*
+ * Copyright Â© 2014 Intel Corporation
+ * Copyright Â© 2008 Kristian Høgsberg
+ *
+ * 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 the
+ * copyright holders not be used in advertising or publicity
+ * pertaining to distribution of the software without specific,
+ * written prior permission.  The copyright holders make no
+ * representations about the suitability of this software for any
+ * purpose.  It is provided "as is" without express or implied
+ * warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS 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.
+ */
+
+#include "xwayland.h"
+
+#include <linux/input.h>
+
+#include <sys/mman.h>
+#include <xkbsrv.h>
+#include <xserver-properties.h>
+#include <inpututils.h>
+
+static void
+xwl_pointer_control(DeviceIntPtr device, PtrCtrl *ctrl)
+{
+    /* Nothing to do, dix handles all settings */
+}
+
+static int
+xwl_pointer_proc(DeviceIntPtr device, int what)
+{
+#define NBUTTONS 10
+#define NAXES 2
+    BYTE map[NBUTTONS + 1];
+    int i = 0;
+    Atom btn_labels[NBUTTONS] = { 0 };
+    Atom axes_labels[NAXES] = { 0 };
+
+    switch (what) {
+    case DEVICE_INIT:
+        device->public.on = FALSE;
+
+        for (i = 1; i <= NBUTTONS; i++)
+            map[i] = i;
+
+        btn_labels[0] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_LEFT);
+        btn_labels[1] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_MIDDLE);
+        btn_labels[2] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_RIGHT);
+        btn_labels[3] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_UP);
+        btn_labels[4] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_DOWN);
+        btn_labels[5] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_HWHEEL_LEFT);
+        btn_labels[6] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_HWHEEL_RIGHT);
+        /* don't know about the rest */
+
+        axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_X);
+        axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_Y);
+
+        if (!InitValuatorClassDeviceStruct(device, 2, btn_labels,
+                                           GetMotionHistorySize(), Absolute))
+            return BadValue;
+
+        /* Valuators */
+        InitValuatorAxisStruct(device, 0, axes_labels[0],
+                               0, 0xFFFF, 10000, 0, 10000, Absolute);
+        InitValuatorAxisStruct(device, 1, axes_labels[1],
+                               0, 0xFFFF, 10000, 0, 10000, Absolute);
+
+        if (!InitPtrFeedbackClassDeviceStruct(device, xwl_pointer_control))
+            return BadValue;
+
+        if (!InitButtonClassDeviceStruct(device, 3, btn_labels, map))
+            return BadValue;
+
+        return Success;
+
+    case DEVICE_ON:
+        device->public.on = TRUE;
+        return Success;
+
+    case DEVICE_OFF:
+    case DEVICE_CLOSE:
+        device->public.on = FALSE;
+        return Success;
+    }
+
+    return BadMatch;
+
+#undef NBUTTONS
+#undef NAXES
+}
+
+static void
+xwl_keyboard_control(DeviceIntPtr device, KeybdCtrl *ctrl)
+{
+}
+
+static int
+xwl_keyboard_proc(DeviceIntPtr device, int what)
+{
+    struct xwl_seat *xwl_seat = device->public.devicePrivate;
+    int len;
+
+    switch (what) {
+    case DEVICE_INIT:
+        device->public.on = FALSE;
+        if (xwl_seat->keymap)
+            len = strnlen(xwl_seat->keymap, xwl_seat->keymap_size);
+        else
+            len = 0;
+        if (!InitKeyboardDeviceStructFromString(device, xwl_seat->keymap,
+                                                len,
+                                                NULL, xwl_keyboard_control))
+            return BadValue;
+
+        return Success;
+    case DEVICE_ON:
+        device->public.on = TRUE;
+        return Success;
+
+    case DEVICE_OFF:
+    case DEVICE_CLOSE:
+        device->public.on = FALSE;
+        return Success;
+    }
+
+    return BadMatch;
+}
+
+static void
+pointer_handle_enter(void *data, struct wl_pointer *pointer,
+                     uint32_t serial, struct wl_surface *surface,
+                     wl_fixed_t sx_w, wl_fixed_t sy_w)
+{
+    struct xwl_seat *xwl_seat = data;
+    DeviceIntPtr dev = xwl_seat->pointer;
+    int i;
+    int sx = wl_fixed_to_int(sx_w);
+    int sy = wl_fixed_to_int(sy_w);
+    ScreenPtr pScreen = xwl_seat->xwl_screen->screen;
+    ValuatorMask mask;
+
+    xwl_seat->xwl_screen->serial = serial;
+    xwl_seat->pointer_enter_serial = serial;
+
+    xwl_seat->focus_window = wl_surface_get_user_data(surface);
+
+    (*pScreen->SetCursorPosition) (dev, pScreen, sx, sy, TRUE);
+    CheckMotion(NULL, GetMaster(dev, MASTER_POINTER));
+
+    /* Ideally, X clients shouldn't see these button releases.  When
+     * the pointer leaves a window with buttons down, it means that
+     * the wayland compositor has grabbed the pointer.  The button
+     * release event is consumed by whatever grab in the compositor
+     * and won't be sent to clients (the X server is a client).
+     * However, we need to reset X's idea of which buttons are up and
+     * down, and they're all up (by definition) when the pointer
+     * enters a window.  We should figure out a way to swallow these
+     * events, perhaps using an X grab whenever the pointer is not in
+     * any X window, but for now just send the events. */
+    valuator_mask_zero(&mask);
+    for (i = 0; i < dev->button->numButtons; i++)
+        if (BitIsOn(dev->button->down, i))
+            QueuePointerEvents(xwl_seat->pointer, ButtonRelease, i, 0, &mask);
+}
+
+static void
+pointer_handle_leave(void *data, struct wl_pointer *pointer,
+                     uint32_t serial, struct wl_surface *surface)
+{
+    struct xwl_seat *xwl_seat = data;
+    DeviceIntPtr dev = xwl_seat->pointer;
+
+    xwl_seat->xwl_screen->serial = serial;
+
+    xwl_seat->focus_window = NULL;
+    CheckMotion(NULL, GetMaster(dev, MASTER_POINTER));
+}
+
+static void
+pointer_handle_motion(void *data, struct wl_pointer *pointer,
+                      uint32_t time, wl_fixed_t sx_w, wl_fixed_t sy_w)
+{
+    struct xwl_seat *xwl_seat = data;
+    int32_t dx, dy;
+    int sx = wl_fixed_to_int(sx_w);
+    int sy = wl_fixed_to_int(sy_w);
+    ValuatorMask mask;
+
+    if (!xwl_seat->focus_window)
+        return;
+
+    dx = xwl_seat->focus_window->window->drawable.x;
+    dy = xwl_seat->focus_window->window->drawable.y;
+
+    valuator_mask_zero(&mask);
+    valuator_mask_set(&mask, 0, dx + sx);
+    valuator_mask_set(&mask, 1, dy + sy);
+
+    QueuePointerEvents(xwl_seat->pointer, MotionNotify, 0,
+                       POINTER_ABSOLUTE | POINTER_SCREEN, &mask);
+}
+
+static void
+pointer_handle_button(void *data, struct wl_pointer *pointer, uint32_t serial,
+                      uint32_t time, uint32_t button, uint32_t state)
+{
+    struct xwl_seat *xwl_seat = data;
+    int index;
+    ValuatorMask mask;
+
+    xwl_seat->xwl_screen->serial = serial;
+
+    switch (button) {
+    case BTN_MIDDLE:
+        index = 2;
+        break;
+    case BTN_RIGHT:
+        index = 3;
+        break;
+    default:
+        index = button - BTN_LEFT + 1;
+        break;
+    }
+
+    valuator_mask_zero(&mask);
+    QueuePointerEvents(xwl_seat->pointer,
+                       state ? ButtonPress : ButtonRelease, index, 0, &mask);
+}
+
+static void
+pointer_handle_axis(void *data, struct wl_pointer *pointer,
+                    uint32_t time, uint32_t axis, wl_fixed_t value)
+{
+    struct xwl_seat *xwl_seat = data;
+    int index, count;
+    int i, val;
+    const int divisor = 10;
+    ValuatorMask mask;
+
+    if (time - xwl_seat->scroll_time > 2000) {
+        xwl_seat->vertical_scroll = 0;
+        xwl_seat->horizontal_scroll = 0;
+    }
+    xwl_seat->scroll_time = time;
+
+    /* FIXME: Need to do proper smooth scrolling here! */
+    switch (axis) {
+    case WL_POINTER_AXIS_VERTICAL_SCROLL:
+        xwl_seat->vertical_scroll += value / divisor;
+        val = wl_fixed_to_int(xwl_seat->vertical_scroll);
+        xwl_seat->vertical_scroll -= wl_fixed_from_int(val);
+
+        if (val <= -1)
+            index = 4;
+        else if (val >= 1)
+            index = 5;
+        else
+            return;
+        break;
+    case WL_POINTER_AXIS_HORIZONTAL_SCROLL:
+        xwl_seat->horizontal_scroll += value / divisor;
+        val = wl_fixed_to_int(xwl_seat->horizontal_scroll);
+        xwl_seat->horizontal_scroll -= wl_fixed_from_int(val);
+
+        if (val <= -1)
+            index = 6;
+        else if (val >= 1)
+            index = 7;
+        else
+            return;
+        break;
+    default:
+        return;
+    }
+
+    valuator_mask_zero(&mask);
+
+    count = abs(val);
+    for (i = 0; i < count; i++) {
+        QueuePointerEvents(xwl_seat->pointer, ButtonPress, index, 0, &mask);
+        QueuePointerEvents(xwl_seat->pointer, ButtonRelease, index, 0, &mask);
+    }
+}
+
+static const struct wl_pointer_listener pointer_listener = {
+    pointer_handle_enter,
+    pointer_handle_leave,
+    pointer_handle_motion,
+    pointer_handle_button,
+    pointer_handle_axis,
+};
+
+static void
+keyboard_handle_key(void *data, struct wl_keyboard *keyboard, uint32_t serial,
+                    uint32_t time, uint32_t key, uint32_t state)
+{
+    struct xwl_seat *xwl_seat = data;
+    uint32_t *k, *end;
+    ValuatorMask mask;
+
+    xwl_seat->xwl_screen->serial = serial;
+
+    end = (uint32_t *) ((char *) xwl_seat->keys.data + xwl_seat->keys.size);
+    for (k = xwl_seat->keys.data; k < end; k++) {
+        if (*k == key)
+            *k = *--end;
+    }
+    xwl_seat->keys.size = (char *) end - (char *) xwl_seat->keys.data;
+    if (state) {
+        k = wl_array_add(&xwl_seat->keys, sizeof *k);
+        *k = key;
+    }
+
+    valuator_mask_zero(&mask);
+    QueueKeyboardEvents(xwl_seat->keyboard,
+                        state ? KeyPress : KeyRelease, key + 8, &mask);
+}
+
+static void
+keyboard_handle_keymap(void *data, struct wl_keyboard *keyboard,
+                       uint32_t format, int fd, uint32_t size)
+{
+    struct xwl_seat *xwl_seat = data;
+    DeviceIntPtr master;
+    XkbDescPtr xkb;
+    XkbChangesRec changes = { 0 };
+
+    if (xwl_seat->keymap)
+        munmap(xwl_seat->keymap, xwl_seat->keymap_size);
+
+    xwl_seat->keymap_size = size;
+    xwl_seat->keymap = mmap(NULL, size, PROT_READ, MAP_SHARED, fd, 0);
+    if (xwl_seat->keymap == MAP_FAILED) {
+        xwl_seat->keymap_size = 0;
+        xwl_seat->keymap = NULL;
+        goto out;
+    }
+
+    xkb = XkbCompileKeymapFromString(xwl_seat->keyboard, xwl_seat->keymap,
+                                     strnlen(xwl_seat->keymap,
+                                             xwl_seat->keymap_size));
+    if (!xkb)
+        goto out;
+
+    XkbUpdateDescActions(xkb, xkb->min_key_code, XkbNumKeys(xkb), &changes);
+
+    if (xwl_seat->keyboard->key)
+        /* Keep the current controls */
+        XkbCopyControls(xkb, xwl_seat->keyboard->key->xkbInfo->desc);
+
+    XkbDeviceApplyKeymap(xwl_seat->keyboard, xkb);
+
+    master = GetMaster(xwl_seat->keyboard, MASTER_KEYBOARD);
+    if (master && master->lastSlave == xwl_seat->keyboard)
+        XkbDeviceApplyKeymap(master, xkb);
+
+    XkbFreeKeyboard(xkb, XkbAllComponentsMask, TRUE);
+
+ out:
+    close(fd);
+}
+
+static void
+keyboard_handle_enter(void *data, struct wl_keyboard *keyboard,
+                      uint32_t serial,
+                      struct wl_surface *surface, struct wl_array *keys)
+{
+    struct xwl_seat *xwl_seat = data;
+    ValuatorMask mask;
+    uint32_t *k;
+
+    xwl_seat->xwl_screen->serial = serial;
+    xwl_seat->keyboard_focus = surface;
+
+    wl_array_copy(&xwl_seat->keys, keys);
+    valuator_mask_zero(&mask);
+    wl_array_for_each(k, &xwl_seat->keys)
+        QueueKeyboardEvents(xwl_seat->keyboard, KeyPress, *k + 8, &mask);
+}
+
+static void
+keyboard_handle_leave(void *data, struct wl_keyboard *keyboard,
+                      uint32_t serial, struct wl_surface *surface)
+{
+    struct xwl_seat *xwl_seat = data;
+    ValuatorMask mask;
+    uint32_t *k;
+
+    xwl_seat->xwl_screen->serial = serial;
+
+    valuator_mask_zero(&mask);
+    wl_array_for_each(k, &xwl_seat->keys)
+        QueueKeyboardEvents(xwl_seat->keyboard, KeyRelease, *k + 8, &mask);
+
+    xwl_seat->keyboard_focus = NULL;
+}
+
+static void
+keyboard_handle_modifiers(void *data, struct wl_keyboard *keyboard,
+                          uint32_t serial, uint32_t mods_depressed,
+                          uint32_t mods_latched, uint32_t mods_locked,
+                          uint32_t group)
+{
+    struct xwl_seat *xwl_seat = data;
+    DeviceIntPtr dev;
+    XkbStateRec old_state, *new_state;
+    xkbStateNotify sn;
+    CARD16 changed;
+
+    /* We don't need any of this while we have keyboard focus since
+       the regular key event processing already takes care of setting
+       our internal state correctly. */
+    if (xwl_seat->keyboard_focus)
+        return;
+
+    for (dev = inputInfo.devices; dev; dev = dev->next) {
+        if (dev != xwl_seat->keyboard &&
+            dev != GetMaster(xwl_seat->keyboard, MASTER_KEYBOARD))
+            continue;
+
+        old_state = dev->key->xkbInfo->state;
+        new_state = &dev->key->xkbInfo->state;
+
+        new_state->locked_group = group & XkbAllGroupsMask;
+        new_state->locked_mods = mods_locked & XkbAllModifiersMask;
+        XkbLatchModifiers(dev, XkbAllModifiersMask,
+                          mods_latched & XkbAllModifiersMask);
+
+        XkbComputeDerivedState(dev->key->xkbInfo);
+
+        changed = XkbStateChangedFlags(&old_state, new_state);
+        if (!changed)
+            continue;
+
+        sn.keycode = 0;
+        sn.eventType = 0;
+        sn.requestMajor = XkbReqCode;
+        sn.requestMinor = X_kbLatchLockState;   /* close enough */
+        sn.changed = changed;
+        XkbSendStateNotify(dev, &sn);
+    }
+}
+
+static const struct wl_keyboard_listener keyboard_listener = {
+    keyboard_handle_keymap,
+    keyboard_handle_enter,
+    keyboard_handle_leave,
+    keyboard_handle_key,
+    keyboard_handle_modifiers,
+};
+
+static DeviceIntPtr
+add_device(struct xwl_seat *xwl_seat,
+           const char *driver, DeviceProc device_proc)
+{
+    DeviceIntPtr dev = NULL;
+    static Atom type_atom;
+    char name[32];
+
+    dev = AddInputDevice(serverClient, device_proc, TRUE);
+    if (dev == NULL)
+        return NULL;
+
+    if (type_atom == None)
+        type_atom = MakeAtom(driver, strlen(driver), TRUE);
+    snprintf(name, sizeof name, "%s:%d", driver, xwl_seat->id);
+    AssignTypeAndName(dev, type_atom, name);
+    dev->public.devicePrivate = xwl_seat;
+    dev->type = SLAVE;
+    dev->spriteInfo->spriteOwner = FALSE;
+
+    return dev;
+}
+
+static void
+seat_handle_capabilities(void *data, struct wl_seat *seat,
+                         enum wl_seat_capability caps)
+{
+    struct xwl_seat *xwl_seat = data;
+
+    if (caps & WL_SEAT_CAPABILITY_POINTER && xwl_seat->pointer == NULL) {
+        xwl_seat->wl_pointer = wl_seat_get_pointer(seat);
+        wl_pointer_add_listener(xwl_seat->wl_pointer,
+                                &pointer_listener, xwl_seat);
+        xwl_seat_set_cursor(xwl_seat);
+        xwl_seat->pointer =
+            add_device(xwl_seat, "xwayland-pointer", xwl_pointer_proc);
+    }
+    else if (!(caps & WL_SEAT_CAPABILITY_POINTER) && xwl_seat->pointer) {
+        wl_pointer_release(xwl_seat->wl_pointer);
+        RemoveDevice(xwl_seat->pointer, FALSE);
+        xwl_seat->pointer = NULL;
+    }
+
+    if (caps & WL_SEAT_CAPABILITY_KEYBOARD && xwl_seat->keyboard == NULL) {
+        xwl_seat->wl_keyboard = wl_seat_get_keyboard(seat);
+        wl_keyboard_add_listener(xwl_seat->wl_keyboard,
+                                 &keyboard_listener, xwl_seat);
+        xwl_seat->keyboard =
+            add_device(xwl_seat, "xwayland-keyboard", xwl_keyboard_proc);
+    }
+    else if (!(caps & WL_SEAT_CAPABILITY_KEYBOARD) && xwl_seat->keyboard) {
+        wl_keyboard_release(xwl_seat->wl_keyboard);
+        RemoveDevice(xwl_seat->keyboard, FALSE);
+        xwl_seat->keyboard = NULL;
+    }
+
+    xwl_seat->xwl_screen->expecting_event--;
+    /* FIXME: Touch ... */
+}
+
+static void
+seat_handle_name(void *data, struct wl_seat *seat,
+                const char *name)
+{
+
+}
+
+static const struct wl_seat_listener seat_listener = {
+    seat_handle_capabilities,
+    seat_handle_name
+};
+
+static void
+create_input_device(struct xwl_screen *xwl_screen, uint32_t id)
+{
+    struct xwl_seat *xwl_seat;
+
+    xwl_seat = calloc(sizeof *xwl_seat, 1);
+    if (xwl_seat == NULL) {
+        ErrorF("create_input ENOMEM");
+        return;
+    }
+
+    xwl_seat->xwl_screen = xwl_screen;
+    xorg_list_add(&xwl_seat->link, &xwl_screen->seat_list);
+
+    xwl_seat->seat =
+        wl_registry_bind(xwl_screen->registry, id, &wl_seat_interface, 3);
+    xwl_seat->id = id;
+
+    xwl_seat->cursor = wl_compositor_create_surface(xwl_screen->compositor);
+    wl_seat_add_listener(xwl_seat->seat, &seat_listener, xwl_seat);
+    wl_array_init(&xwl_seat->keys);
+}
+
+void
+xwl_seat_destroy(struct xwl_seat *xwl_seat)
+{
+    RemoveDevice(xwl_seat->pointer, FALSE);
+    RemoveDevice(xwl_seat->keyboard, FALSE);
+    wl_seat_destroy(xwl_seat->seat);
+    wl_surface_destroy(xwl_seat->cursor);
+    wl_array_release(&xwl_seat->keys);
+    free(xwl_seat);
+}
+
+static void
+input_handler(void *data, struct wl_registry *registry, uint32_t id,
+              const char *interface, uint32_t version)
+{
+    struct xwl_screen *xwl_screen = data;
+
+    if (strcmp(interface, "wl_seat") == 0 && version >= 3) {
+        create_input_device(xwl_screen, id);
+        xwl_screen->expecting_event++;
+    }
+}
+
+static void
+global_remove(void *data, struct wl_registry *registry, uint32_t name)
+{
+}
+
+static const struct wl_registry_listener input_listener = {
+    input_handler,
+    global_remove,
+};
+
+Bool
+LegalModifier(unsigned int key, DeviceIntPtr pDev)
+{
+    return TRUE;
+}
+
+void
+ProcessInputEvents(void)
+{
+    mieqProcessInputEvents();
+}
+
+void
+DDXRingBell(int volume, int pitch, int duration)
+{
+}
+
+static WindowPtr
+xwl_xy_to_window(ScreenPtr screen, SpritePtr sprite, int x, int y)
+{
+    struct xwl_seat *xwl_seat = NULL;
+    DeviceIntPtr device;
+
+    for (device = inputInfo.devices; device; device = device->next) {
+        if (device->deviceProc == xwl_pointer_proc &&
+            device->spriteInfo->sprite == sprite) {
+            xwl_seat = device->public.devicePrivate;
+            break;
+        }
+    }
+
+    if (xwl_seat == NULL) {
+        /* XTEST device */
+        sprite->spriteTraceGood = 1;
+        return sprite->spriteTrace[0];
+    }
+
+    if (xwl_seat->focus_window) {
+        sprite->spriteTraceGood = 2;
+        sprite->spriteTrace[1] = xwl_seat->focus_window->window;
+        return miSpriteTrace(sprite, x, y);
+    }
+    else {
+        sprite->spriteTraceGood = 1;
+        return sprite->spriteTrace[0];
+    }
+}
+
+void
+InitInput(int argc, char *argv[])
+{
+    ScreenPtr pScreen = screenInfo.screens[0];
+    struct xwl_screen *xwl_screen = xwl_screen_get(pScreen);
+
+    mieqInit();
+
+    xwl_screen->input_registry = wl_display_get_registry(xwl_screen->display);
+    wl_registry_add_listener(xwl_screen->input_registry, &input_listener,
+                             xwl_screen);
+
+    xwl_screen->XYToWindow = pScreen->XYToWindow;
+    pScreen->XYToWindow = xwl_xy_to_window;
+
+    xwl_screen->expecting_event = 0;
+    wl_display_roundtrip(xwl_screen->display);
+    while (xwl_screen->expecting_event)
+        wl_display_roundtrip(xwl_screen->display);
+}
+
+void
+CloseInput(void)
+{
+    mieqFini();
+}
diff --git a/hw/xwayland/xwayland-output.c b/hw/xwayland/xwayland-output.c
new file mode 100644 (file)
index 0000000..778914c
--- /dev/null
@@ -0,0 +1,226 @@
+/*
+ * Copyright Â© 2011-2014 Intel Corporation
+ *
+ * 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 the
+ * copyright holders not be used in advertising or publicity
+ * pertaining to distribution of the software without specific,
+ * written prior permission.  The copyright holders make no
+ * representations about the suitability of this software for any
+ * purpose.  It is provided "as is" without express or implied
+ * warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS 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_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "xwayland.h"
+#include <randrstr.h>
+
+static Rotation
+wl_transform_to_xrandr(enum wl_output_transform transform)
+{
+    switch (transform) {
+    default:
+    case WL_OUTPUT_TRANSFORM_NORMAL:
+        return RR_Rotate_0;
+    case WL_OUTPUT_TRANSFORM_90:
+        return RR_Rotate_90;
+    case WL_OUTPUT_TRANSFORM_180:
+        return RR_Rotate_180;
+    case WL_OUTPUT_TRANSFORM_270:
+        return RR_Rotate_270;
+    case WL_OUTPUT_TRANSFORM_FLIPPED:
+        return RR_Reflect_X | RR_Rotate_0;
+    case WL_OUTPUT_TRANSFORM_FLIPPED_90:
+        return RR_Reflect_X | RR_Rotate_90;
+    case WL_OUTPUT_TRANSFORM_FLIPPED_180:
+        return RR_Reflect_X | RR_Rotate_180;
+    case WL_OUTPUT_TRANSFORM_FLIPPED_270:
+        return RR_Reflect_X | RR_Rotate_270;
+    }
+}
+
+static int
+wl_subpixel_to_xrandr(int subpixel)
+{
+    switch (subpixel) {
+    default:
+    case WL_OUTPUT_SUBPIXEL_UNKNOWN:
+        return SubPixelUnknown;
+    case WL_OUTPUT_SUBPIXEL_NONE:
+        return SubPixelNone;
+    case WL_OUTPUT_SUBPIXEL_HORIZONTAL_RGB:
+        return SubPixelHorizontalRGB;
+    case WL_OUTPUT_SUBPIXEL_HORIZONTAL_BGR:
+        return SubPixelHorizontalBGR;
+    case WL_OUTPUT_SUBPIXEL_VERTICAL_RGB:
+        return SubPixelVerticalRGB;
+    case WL_OUTPUT_SUBPIXEL_VERTICAL_BGR:
+        return SubPixelVerticalBGR;
+    }
+}
+
+static void
+output_handle_geometry(void *data, struct wl_output *wl_output, int x, int y,
+                       int physical_width, int physical_height, int subpixel,
+                       const char *make, const char *model, int transform)
+{
+    struct xwl_output *xwl_output = data;
+
+    RROutputSetPhysicalSize(xwl_output->randr_output,
+                            physical_width, physical_height);
+    RROutputSetSubpixelOrder(xwl_output->randr_output,
+                             wl_subpixel_to_xrandr(subpixel));
+    xwl_output->x = x;
+    xwl_output->y = y;
+
+    xwl_output->rotation = wl_transform_to_xrandr(transform);
+}
+
+static void
+output_handle_mode(void *data, struct wl_output *wl_output, uint32_t flags,
+                   int width, int height, int refresh)
+{
+    struct xwl_output *xwl_output = data;
+    RRModePtr randr_mode;
+
+    if (!(flags & WL_OUTPUT_MODE_CURRENT))
+        return;
+
+    xwl_output->width = width;
+    xwl_output->height = height;
+
+    randr_mode = xwayland_cvt(width, height, refresh / 1000.0, 0, 0);
+
+    RROutputSetModes(xwl_output->randr_output, &randr_mode, 1, 1);
+
+    RRCrtcNotify(xwl_output->randr_crtc, randr_mode,
+                 xwl_output->x, xwl_output->y,
+                 xwl_output->rotation, NULL, 1, &xwl_output->randr_output);
+}
+
+static void
+output_handle_done(void *data, struct wl_output *wl_output)
+{
+    struct xwl_output *xwl_output = data;
+    struct xwl_screen *xwl_screen = xwl_output->xwl_screen;
+    int width, height;
+
+    xorg_list_append(&xwl_output->link, &xwl_screen->output_list);
+
+    width = 0;
+    height = 0;
+    xorg_list_for_each_entry(xwl_output, &xwl_screen->output_list, link) {
+        if (width < xwl_output->x + xwl_output->width)
+            width = xwl_output->x + xwl_output->width;
+        if (height < xwl_output->y + xwl_output->height)
+            height = xwl_output->y + xwl_output->height;
+    }
+
+    xwl_screen->width = width;
+    xwl_screen->height = height;
+    RRScreenSizeNotify(xwl_screen->screen);
+
+    xwl_screen->expecting_event--;
+}
+
+static void
+output_handle_scale(void *data, struct wl_output *wl_output, int32_t factor)
+{
+}
+
+static const struct wl_output_listener output_listener = {
+    output_handle_geometry,
+    output_handle_mode,
+    output_handle_done,
+    output_handle_scale
+};
+
+struct xwl_output *
+xwl_output_create(struct xwl_screen *xwl_screen, uint32_t id)
+{
+    struct xwl_output *xwl_output;
+    static int serial;
+    char name[256];
+
+    xwl_output = calloc(sizeof *xwl_output, 1);
+    if (xwl_output == NULL) {
+        ErrorF("create_output ENOMEM");
+        return NULL;
+    }
+
+    xwl_output->output = wl_registry_bind(xwl_screen->registry, id,
+                                          &wl_output_interface, 2);
+    wl_output_add_listener(xwl_output->output, &output_listener, xwl_output);
+
+    if (snprintf(name, sizeof name, "XWAYLAND%d", serial++) < 0) {
+        ErrorF("create_output ENOMEM");
+        free(xwl_output);
+        return NULL;
+    }
+
+    xwl_output->xwl_screen = xwl_screen;
+    xwl_output->randr_crtc = RRCrtcCreate(xwl_screen->screen, xwl_output);
+    xwl_output->randr_output = RROutputCreate(xwl_screen->screen, name,
+                                              strlen(name), xwl_output);
+    RRCrtcGammaSetSize(xwl_output->randr_crtc, 256);
+    RROutputSetCrtcs(xwl_output->randr_output, &xwl_output->randr_crtc, 1);
+    RROutputSetConnection(xwl_output->randr_output, RR_Connected);
+
+    return xwl_output;
+}
+
+void
+xwl_output_destroy(struct xwl_output *xwl_output)
+{
+    wl_output_destroy(xwl_output->output);
+    RRCrtcDestroy(xwl_output->randr_crtc);
+    RROutputDestroy(xwl_output->randr_output);
+    free(xwl_output);
+}
+
+static Bool
+xwl_randr_get_info(ScreenPtr pScreen, Rotation * rotations)
+{
+    *rotations = 0;
+
+    return TRUE;
+}
+
+static Bool
+xwl_randr_set_config(ScreenPtr pScreen,
+                     Rotation rotation, int rate, RRScreenSizePtr pSize)
+{
+    return FALSE;
+}
+
+Bool
+xwl_screen_init_output(struct xwl_screen *xwl_screen)
+{
+    rrScrPrivPtr rp;
+
+    if (!RRScreenInit(xwl_screen->screen))
+        return FALSE;
+
+    RRScreenSetSizeRange(xwl_screen->screen, 320, 200, 8192, 8192);
+
+    rp = rrGetScrPriv(xwl_screen->screen);
+    rp->rrGetInfo = xwl_randr_get_info;
+    rp->rrSetConfig = xwl_randr_set_config;
+
+    return TRUE;
+}
diff --git a/hw/xwayland/xwayland-shm.c b/hw/xwayland/xwayland-shm.c
new file mode 100644 (file)
index 0000000..2d0ce3e
--- /dev/null
@@ -0,0 +1,292 @@
+/*
+ * Copyright Â© 2014 Intel Corporation
+ * Copyright Â© 2012 Collabora, Ltd.
+ *
+ * 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 the
+ * copyright holders not be used in advertising or publicity
+ * pertaining to distribution of the software without specific,
+ * written prior permission.  The copyright holders make no
+ * representations about the suitability of this software for any
+ * purpose.  It is provided "as is" without express or implied
+ * warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS 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.
+ */
+
+#include "xwayland.h"
+
+#include <sys/mman.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <string.h>
+#include <stdlib.h>
+
+struct xwl_pixmap {
+    struct wl_buffer *buffer;
+    int fd;
+    void *data;
+    size_t size;
+};
+
+#ifndef HAVE_MKOSTEMP
+static int
+set_cloexec_or_close(int fd)
+{
+    long flags;
+
+    if (fd == -1)
+        return -1;
+
+    flags = fcntl(fd, F_GETFD);
+    if (flags == -1)
+        goto err;
+
+    if (fcntl(fd, F_SETFD, flags | FD_CLOEXEC) == -1)
+        goto err;
+
+    return fd;
+
+ err:
+    close(fd);
+    return -1;
+}
+#endif
+
+static int
+create_tmpfile_cloexec(char *tmpname)
+{
+    int fd;
+
+#ifdef HAVE_MKOSTEMP
+    fd = mkostemp(tmpname, O_CLOEXEC);
+    if (fd >= 0)
+        unlink(tmpname);
+#else
+    fd = mkstemp(tmpname);
+    if (fd >= 0) {
+        fd = set_cloexec_or_close(fd);
+        unlink(tmpname);
+    }
+#endif
+
+    return fd;
+}
+
+/*
+ * Create a new, unique, anonymous file of the given size, and
+ * return the file descriptor for it. The file descriptor is set
+ * CLOEXEC. The file is immediately suitable for mmap()'ing
+ * the given size at offset zero.
+ *
+ * The file should not have a permanent backing store like a disk,
+ * but may have if XDG_RUNTIME_DIR is not properly implemented in OS.
+ *
+ * The file name is deleted from the file system.
+ *
+ * The file is suitable for buffer sharing between processes by
+ * transmitting the file descriptor over Unix sockets using the
+ * SCM_RIGHTS methods.
+ *
+ * If the C library implements posix_fallocate(), it is used to
+ * guarantee that disk space is available for the file at the
+ * given size. If disk space is insufficent, errno is set to ENOSPC.
+ * If posix_fallocate() is not supported, program may receive
+ * SIGBUS on accessing mmap()'ed file contents instead.
+ */
+static int
+os_create_anonymous_file(off_t size)
+{
+    static const char template[] = "/weston-shared-XXXXXX";
+    const char *path;
+    char *name;
+    int fd;
+    int ret;
+
+    path = getenv("XDG_RUNTIME_DIR");
+    if (!path) {
+        errno = ENOENT;
+        return -1;
+    }
+
+    name = malloc(strlen(path) + sizeof(template));
+    if (!name)
+        return -1;
+
+    strcpy(name, path);
+    strcat(name, template);
+
+    fd = create_tmpfile_cloexec(name);
+
+    free(name);
+
+    if (fd < 0)
+        return -1;
+
+#ifdef HAVE_POSIX_FALLOCATE
+    ret = posix_fallocate(fd, 0, size);
+    if (ret != 0) {
+        close(fd);
+        errno = ret;
+        return -1;
+    }
+#else
+    ret = ftruncate(fd, size);
+    if (ret < 0) {
+        close(fd);
+        return -1;
+    }
+#endif
+
+    return fd;
+}
+
+static uint32_t
+shm_format_for_depth(int depth)
+{
+    switch (depth) {
+    case 32:
+        return WL_SHM_FORMAT_ARGB8888;
+    case 24:
+    default:
+        return WL_SHM_FORMAT_XRGB8888;
+#ifdef WL_SHM_FORMAT_RGB565
+    case 16:
+        /* XXX: Check run-time protocol version too */
+        return WL_SHM_FORMAT_RGB565;
+#endif
+    }
+}
+
+PixmapPtr
+xwl_shm_create_pixmap(ScreenPtr screen,
+                      int width, int height, int depth, unsigned int hint)
+{
+    PixmapPtr pixmap;
+    struct xwl_pixmap *xwl_pixmap;
+    size_t size, stride;
+
+    if (hint == CREATE_PIXMAP_USAGE_GLYPH_PICTURE ||
+        (width == 0 && height == 0) || depth < 15)
+        return fbCreatePixmap(screen, width, height, depth, hint);
+
+    pixmap = fbCreatePixmap(screen, 0, 0, depth, hint);
+    if (!pixmap)
+        return NULL;
+
+    xwl_pixmap = malloc(sizeof *xwl_pixmap);
+    if (xwl_pixmap == NULL)
+        goto err_destroy_pixmap;
+
+    stride = PixmapBytePad(width, depth);
+    size = stride * height;
+    xwl_pixmap->buffer = NULL;
+    xwl_pixmap->size = size;
+    xwl_pixmap->fd = os_create_anonymous_file(size);
+    if (xwl_pixmap->fd < 0)
+        goto err_free_xwl_pixmap;
+
+    xwl_pixmap->data = mmap(NULL, size, PROT_READ | PROT_WRITE,
+                                  MAP_SHARED, xwl_pixmap->fd, 0);
+    if (xwl_pixmap->data == MAP_FAILED)
+        goto err_close_fd;
+
+    if (!(*screen->ModifyPixmapHeader) (pixmap, width, height, depth,
+                                        BitsPerPixel(depth),
+                                        stride, xwl_pixmap->data))
+        goto err_munmap;
+
+    xwl_pixmap_set_private(pixmap, xwl_pixmap);
+
+    return pixmap;
+
+ err_munmap:
+    munmap(xwl_pixmap->data, size);
+ err_close_fd:
+    close(xwl_pixmap->fd);
+ err_free_xwl_pixmap:
+    free(xwl_pixmap);
+ err_destroy_pixmap:
+    fbDestroyPixmap(pixmap);
+
+    return NULL;
+}
+
+Bool
+xwl_shm_destroy_pixmap(PixmapPtr pixmap)
+{
+    struct xwl_pixmap *xwl_pixmap = xwl_pixmap_get(pixmap);
+
+    if (xwl_pixmap && pixmap->refcnt == 1) {
+        if (xwl_pixmap->buffer)
+            wl_buffer_destroy(xwl_pixmap->buffer);
+        munmap(xwl_pixmap->data, xwl_pixmap->size);
+        close(xwl_pixmap->fd);
+        free(xwl_pixmap);
+    }
+
+    return fbDestroyPixmap(pixmap);
+}
+
+struct wl_buffer *
+xwl_shm_pixmap_get_wl_buffer(PixmapPtr pixmap)
+{
+    struct xwl_screen *xwl_screen = xwl_screen_get(pixmap->drawable.pScreen);
+    struct xwl_pixmap *xwl_pixmap = xwl_pixmap_get(pixmap);
+    struct wl_shm_pool *pool;
+    uint32_t format;
+
+    if (xwl_pixmap->buffer)
+        return xwl_pixmap->buffer;
+
+    pool = wl_shm_create_pool(xwl_screen->shm,
+                              xwl_pixmap->fd, xwl_pixmap->size);
+
+    format = shm_format_for_depth(pixmap->drawable.depth);
+    xwl_pixmap->buffer = wl_shm_pool_create_buffer(pool, 0,
+                                                   pixmap->drawable.width,
+                                                   pixmap->drawable.height,
+                                                   pixmap->devKind, format);
+
+    wl_shm_pool_destroy(pool);
+
+    return xwl_pixmap->buffer;
+}
+
+Bool
+xwl_shm_create_screen_resources(ScreenPtr screen)
+{
+    struct xwl_screen *xwl_screen = xwl_screen_get(screen);
+    int ret;
+
+    screen->CreateScreenResources = xwl_screen->CreateScreenResources;
+    ret = (*screen->CreateScreenResources) (screen);
+    xwl_screen->CreateScreenResources = screen->CreateScreenResources;
+    screen->CreateScreenResources = xwl_shm_create_screen_resources;
+
+    if (!ret)
+        return ret;
+
+    if (xwl_screen->rootless)
+        screen->devPrivate =
+            fbCreatePixmap(screen, 0, 0, screen->rootDepth, 0);
+    else
+        screen->devPrivate =
+            xwl_shm_create_pixmap(screen, screen->width, screen->height,
+                                  screen->rootDepth,
+                                  CREATE_PIXMAP_USAGE_BACKING_PIXMAP);
+
+    return screen->devPrivate != NULL;
+}
diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c
new file mode 100644 (file)
index 0000000..17b7bf7
--- /dev/null
@@ -0,0 +1,684 @@
+/*
+ * Copyright Â© 2011-2014 Intel Corporation
+ *
+ * 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 the
+ * copyright holders not be used in advertising or publicity
+ * pertaining to distribution of the software without specific,
+ * written prior permission.  The copyright holders make no
+ * representations about the suitability of this software for any
+ * purpose.  It is provided "as is" without express or implied
+ * warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS 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.
+ */
+
+#include "xwayland.h"
+
+#include <stdio.h>
+
+#include <selection.h>
+#include <micmap.h>
+#include <misyncshm.h>
+#include <compositeext.h>
+#include <glx_extinit.h>
+
+void
+ddxGiveUp(enum ExitCode error)
+{
+}
+
+void
+AbortDDX(enum ExitCode error)
+{
+    ddxGiveUp(error);
+}
+
+void
+OsVendorInit(void)
+{
+}
+
+void
+OsVendorFatalError(const char *f, va_list args)
+{
+}
+
+#if defined(DDXBEFORERESET)
+void
+ddxBeforeReset(void)
+{
+    return;
+}
+#endif
+
+void
+ddxUseMsg(void)
+{
+    ErrorF("-rootless              run rootless, requires wm support\n");
+    ErrorF("-wm fd                 create X client for wm on given fd\n");
+    ErrorF("-listen fd             add give fd as a listen socket\n");
+}
+
+int
+ddxProcessArgument(int argc, char *argv[], int i)
+{
+    if (strcmp(argv[i], "-rootless") == 0) {
+        return 1;
+    }
+    else if (strcmp(argv[i], "-listen") == 0) {
+        NoListenAll = TRUE;
+        return 2;
+    }
+    else if (strcmp(argv[i], "-wm") == 0) {
+        return 2;
+    }
+    else if (strcmp(argv[i], "-shm") == 0) {
+        return 1;
+    }
+
+    return 0;
+}
+
+static DevPrivateKeyRec xwl_window_private_key;
+static DevPrivateKeyRec xwl_screen_private_key;
+static DevPrivateKeyRec xwl_pixmap_private_key;
+
+struct xwl_screen *
+xwl_screen_get(ScreenPtr screen)
+{
+    return dixLookupPrivate(&screen->devPrivates, &xwl_screen_private_key);
+}
+
+static Bool
+xwl_close_screen(ScreenPtr screen)
+{
+    struct xwl_screen *xwl_screen = xwl_screen_get(screen);
+    struct xwl_output *xwl_output, *next_xwl_output;
+    struct xwl_seat *xwl_seat, *next_xwl_seat;
+
+    xorg_list_for_each_entry_safe(xwl_output, next_xwl_output,
+                                  &xwl_screen->output_list, link)
+        xwl_output_destroy(xwl_output);
+
+    xorg_list_for_each_entry_safe(xwl_seat, next_xwl_seat,
+                                  &xwl_screen->seat_list, link)
+        xwl_seat_destroy(xwl_seat);
+
+    wl_display_disconnect(xwl_screen->display);
+
+    screen->CloseScreen = xwl_screen->CloseScreen;
+    free(xwl_screen);
+
+    return screen->CloseScreen(screen);
+}
+
+static void
+damage_report(DamagePtr pDamage, RegionPtr pRegion, void *data)
+{
+    struct xwl_window *xwl_window = data;
+    struct xwl_screen *xwl_screen = xwl_window->xwl_screen;
+
+    xorg_list_add(&xwl_window->link_damage, &xwl_screen->damage_window_list);
+}
+
+static void
+damage_destroy(DamagePtr pDamage, void *data)
+{
+}
+
+static void
+shell_surface_ping(void *data,
+                   struct wl_shell_surface *shell_surface, uint32_t serial)
+{
+    wl_shell_surface_pong(shell_surface, serial);
+}
+
+static void
+shell_surface_configure(void *data,
+                        struct wl_shell_surface *wl_shell_surface,
+                        uint32_t edges, int32_t width, int32_t height)
+{
+}
+
+static void
+shell_surface_popup_done(void *data, struct wl_shell_surface *wl_shell_surface)
+{
+}
+
+static const struct wl_shell_surface_listener shell_surface_listener = {
+    shell_surface_ping,
+    shell_surface_configure,
+    shell_surface_popup_done
+};
+
+void
+xwl_pixmap_set_private(PixmapPtr pixmap, struct xwl_pixmap *xwl_pixmap)
+{
+    dixSetPrivate(&pixmap->devPrivates, &xwl_pixmap_private_key, xwl_pixmap);
+}
+
+struct xwl_pixmap *
+xwl_pixmap_get(PixmapPtr pixmap)
+{
+    return dixLookupPrivate(&pixmap->devPrivates, &xwl_pixmap_private_key);
+}
+
+static void
+send_surface_id_event(struct xwl_window *xwl_window)
+{
+    static const char atom_name[] = "WL_SURFACE_ID";
+    static Atom type_atom;
+    DeviceIntPtr dev;
+    xEvent e;
+
+    if (type_atom == None)
+        type_atom = MakeAtom(atom_name, strlen(atom_name), TRUE);
+
+    e.u.u.type = ClientMessage;
+    e.u.u.detail = 32;
+    e.u.clientMessage.window = xwl_window->window->drawable.id;
+    e.u.clientMessage.u.l.type = type_atom;
+    e.u.clientMessage.u.l.longs0 =
+        wl_proxy_get_id((struct wl_proxy *) xwl_window->surface);
+    e.u.clientMessage.u.l.longs1 = 0;
+    e.u.clientMessage.u.l.longs2 = 0;
+    e.u.clientMessage.u.l.longs3 = 0;
+    e.u.clientMessage.u.l.longs4 = 0;
+
+    dev = PickPointer(serverClient);
+    DeliverEventsToWindow(dev, xwl_window->xwl_screen->screen->root,
+                          &e, 1, SubstructureRedirectMask, NullGrab);
+}
+
+static Bool
+xwl_realize_window(WindowPtr window)
+{
+    ScreenPtr screen = window->drawable.pScreen;
+    struct xwl_screen *xwl_screen;
+    struct xwl_window *xwl_window;
+    struct wl_region *region;
+    Bool ret;
+
+    xwl_screen = xwl_screen_get(screen);
+
+    screen->RealizeWindow = xwl_screen->RealizeWindow;
+    ret = (*screen->RealizeWindow) (window);
+    xwl_screen->RealizeWindow = screen->RealizeWindow;
+    screen->RealizeWindow = xwl_realize_window;
+
+    if (xwl_screen->rootless && !window->parent) {
+        RegionNull(&window->clipList);
+        RegionNull(&window->borderClip);
+        RegionNull(&window->winSize);
+    }
+
+    if (xwl_screen->rootless) {
+        if (window->redirectDraw != RedirectDrawManual)
+            return ret;
+    }
+    else {
+        if (window->parent)
+            return ret;
+    }
+
+    xwl_window = calloc(sizeof *xwl_window, 1);
+    xwl_window->xwl_screen = xwl_screen;
+    xwl_window->window = window;
+    xwl_window->surface = wl_compositor_create_surface(xwl_screen->compositor);
+    if (xwl_window->surface == NULL) {
+        ErrorF("wl_display_create_surface failed\n");
+        return FALSE;
+    }
+
+    if (!xwl_screen->rootless) {
+        xwl_window->shell_surface =
+            wl_shell_get_shell_surface(xwl_screen->shell, xwl_window->surface);
+        wl_shell_surface_add_listener(xwl_window->shell_surface,
+                                      &shell_surface_listener, xwl_window);
+
+        wl_shell_surface_set_toplevel(xwl_window->shell_surface);
+
+        region = wl_compositor_create_region(xwl_screen->compositor);
+        wl_region_add(region, 0, 0,
+                      window->drawable.width, window->drawable.height);
+        wl_surface_set_opaque_region(xwl_window->surface, region);
+        wl_region_destroy(region);
+    }
+
+    wl_display_flush(xwl_screen->display);
+
+    send_surface_id_event(xwl_window);
+
+    wl_surface_set_user_data(xwl_window->surface, xwl_window);
+
+    dixSetPrivate(&window->devPrivates, &xwl_window_private_key, xwl_window);
+
+    xwl_window->damage =
+        DamageCreate(damage_report, damage_destroy, DamageReportNonEmpty,
+                     FALSE, screen, xwl_window);
+    DamageRegister(&window->drawable, xwl_window->damage);
+    DamageSetReportAfterOp(xwl_window->damage, TRUE);
+
+    xorg_list_init(&xwl_window->link_damage);
+
+    return ret;
+}
+
+static Bool
+xwl_unrealize_window(WindowPtr window)
+{
+    ScreenPtr screen = window->drawable.pScreen;
+    struct xwl_screen *xwl_screen;
+    struct xwl_window *xwl_window;
+    struct xwl_seat *xwl_seat;
+    Bool ret;
+
+    xwl_screen = xwl_screen_get(screen);
+
+    xorg_list_for_each_entry(xwl_seat, &xwl_screen->seat_list, link) {
+        if (!xwl_seat->focus_window)
+            continue;
+        if (xwl_seat->focus_window->window == window)
+            xwl_seat->focus_window = NULL;
+    }
+
+    screen->UnrealizeWindow = xwl_screen->UnrealizeWindow;
+    ret = (*screen->UnrealizeWindow) (window);
+    xwl_screen->UnrealizeWindow = screen->UnrealizeWindow;
+    screen->UnrealizeWindow = xwl_unrealize_window;
+
+    xwl_window =
+        dixLookupPrivate(&window->devPrivates, &xwl_window_private_key);
+    if (!xwl_window)
+        return ret;
+
+    wl_surface_destroy(xwl_window->surface);
+    if (RegionNotEmpty(DamageRegion(xwl_window->damage)))
+        xorg_list_del(&xwl_window->link_damage);
+    DamageUnregister(xwl_window->damage);
+    DamageDestroy(xwl_window->damage);
+    free(xwl_window);
+    dixSetPrivate(&window->devPrivates, &xwl_window_private_key, NULL);
+
+    return ret;
+}
+
+static Bool
+xwl_save_screen(ScreenPtr pScreen, int on)
+{
+    return TRUE;
+}
+
+static void
+xwl_screen_post_damage(struct xwl_screen *xwl_screen)
+{
+    struct xwl_window *xwl_window;
+    RegionPtr region;
+    BoxPtr box;
+    int count, i;
+    struct wl_buffer *buffer;
+    PixmapPtr pixmap;
+
+    xorg_list_for_each_entry(xwl_window, &xwl_screen->damage_window_list,
+                             link_damage) {
+        region = DamageRegion(xwl_window->damage);
+        count = RegionNumRects(region);
+
+        pixmap = (*xwl_screen->screen->GetWindowPixmap) (xwl_window->window);
+
+#if GLAMOR_HAS_GBM
+        if (xwl_screen->glamor)
+            buffer = xwl_glamor_pixmap_get_wl_buffer(pixmap);
+#endif
+        if (!xwl_screen->glamor)
+            buffer = xwl_shm_pixmap_get_wl_buffer(pixmap);
+
+        wl_surface_attach(xwl_window->surface, buffer, 0, 0);
+        for (i = 0; i < count; i++) {
+            box = &RegionRects(region)[i];
+            wl_surface_damage(xwl_window->surface,
+                              box->x1, box->y1,
+                              box->x2 - box->x1, box->y2 - box->y1);
+        }
+        wl_surface_commit(xwl_window->surface);
+        DamageEmpty(xwl_window->damage);
+    }
+
+    xorg_list_init(&xwl_screen->damage_window_list);
+}
+
+static void
+registry_global(void *data, struct wl_registry *registry, uint32_t id,
+                const char *interface, uint32_t version)
+{
+    struct xwl_screen *xwl_screen = data;
+
+    if (strcmp(interface, "wl_compositor") == 0) {
+        xwl_screen->compositor =
+            wl_registry_bind(registry, id, &wl_compositor_interface, 1);
+    }
+    else if (strcmp(interface, "wl_shm") == 0) {
+        xwl_screen->shm = wl_registry_bind(registry, id, &wl_shm_interface, 1);
+    }
+    else if (strcmp(interface, "wl_shell") == 0) {
+        xwl_screen->shell =
+            wl_registry_bind(registry, id, &wl_shell_interface, 1);
+    }
+    else if (strcmp(interface, "wl_output") == 0 && version >= 2) {
+        xwl_output_create(xwl_screen, id);
+        xwl_screen->expecting_event++;
+    }
+#ifdef GLAMOR_HAS_GBM
+    else if (xwl_screen->glamor &&
+             strcmp(interface, "wl_drm") == 0 && version >= 2) {
+        xwl_screen_init_glamor(xwl_screen, id, version);
+    }
+#endif
+}
+
+static void
+global_remove(void *data, struct wl_registry *registry, uint32_t name)
+{
+    /* Nothing to do here, wl_compositor and wl_shm should not be removed */
+}
+
+static const struct wl_registry_listener registry_listener = {
+    registry_global,
+    global_remove
+};
+
+static void
+wakeup_handler(void *data, int err, void *read_mask)
+{
+    struct xwl_screen *xwl_screen = data;
+    int ret;
+
+    if (err < 0)
+        return;
+
+    if (!FD_ISSET(xwl_screen->wayland_fd, (fd_set *) read_mask))
+        return;
+
+    ret = wl_display_read_events(xwl_screen->display);
+    if (ret == -1)
+        FatalError("failed to dispatch Wayland events: %s\n", strerror(errno));
+
+    xwl_screen->prepare_read = 0;
+
+    ret = wl_display_dispatch_pending(xwl_screen->display);
+    if (ret == -1)
+        FatalError("failed to dispatch Wayland events: %s\n", strerror(errno));
+}
+
+static void
+block_handler(void *data, struct timeval **tv, void *read_mask)
+{
+    struct xwl_screen *xwl_screen = data;
+    int ret;
+
+    xwl_screen_post_damage(xwl_screen);
+
+    while (xwl_screen->prepare_read == 0 &&
+           wl_display_prepare_read(xwl_screen->display) == -1) {
+        ret = wl_display_dispatch_pending(xwl_screen->display);
+        if (ret == -1)
+            FatalError("failed to dispatch Wayland events: %s\n",
+                       strerror(errno));
+    }
+
+    xwl_screen->prepare_read = 1;
+
+    ret = wl_display_flush(xwl_screen->display);
+    if (ret == -1)
+        FatalError("failed to write to XWayland fd: %s\n", strerror(errno));
+}
+
+static CARD32
+add_client_fd(OsTimerPtr timer, CARD32 time, void *arg)
+{
+    struct xwl_screen *xwl_screen = arg;
+
+    if (!AddClientOnOpenFD(xwl_screen->wm_fd))
+        FatalError("Failed to add wm client\n");
+
+    TimerFree(timer);
+
+    return 0;
+}
+
+static void
+listen_on_fds(struct xwl_screen *xwl_screen)
+{
+    int i;
+
+    for (i = 0; i < xwl_screen->listen_fd_count; i++)
+        ListenOnOpenFD(xwl_screen->listen_fds[i], TRUE);
+}
+
+static void
+wm_selection_callback(CallbackListPtr *p, void *data, void *arg)
+{
+    SelectionInfoRec *info = arg;
+    struct xwl_screen *xwl_screen = data;
+    static const char atom_name[] = "WM_S0";
+    static Atom atom_wm_s0;
+
+    if (atom_wm_s0 == None)
+        atom_wm_s0 = MakeAtom(atom_name, strlen(atom_name), TRUE);
+    if (info->selection->selection != atom_wm_s0 ||
+        info->kind != SelectionSetOwner)
+        return;
+
+    listen_on_fds(xwl_screen);
+
+    DeleteCallback(&SelectionCallback, wm_selection_callback, xwl_screen);
+}
+
+static Bool
+xwl_screen_init(ScreenPtr pScreen, int argc, char **argv)
+{
+    struct xwl_screen *xwl_screen;
+    Pixel red_mask, blue_mask, green_mask;
+    int ret, bpc, green_bpc, i;
+
+    xwl_screen = calloc(sizeof *xwl_screen, 1);
+    xwl_screen->wm_fd = -1;
+    if (xwl_screen == NULL)
+        return FALSE;
+
+    if (!dixRegisterPrivateKey(&xwl_screen_private_key, PRIVATE_SCREEN, 0))
+        return FALSE;
+    if (!dixRegisterPrivateKey(&xwl_window_private_key, PRIVATE_WINDOW, 0))
+        return FALSE;
+    if (!dixRegisterPrivateKey(&xwl_pixmap_private_key, PRIVATE_PIXMAP, 0))
+        return FALSE;
+
+    dixSetPrivate(&pScreen->devPrivates, &xwl_screen_private_key, xwl_screen);
+    xwl_screen->screen = pScreen;
+
+#ifdef GLAMOR_HAS_GBM
+    xwl_screen->glamor = 1;
+#endif
+
+    for (i = 1; i < argc; i++) {
+        if (strcmp(argv[i], "-rootless") == 0) {
+            xwl_screen->rootless = 1;
+        }
+        else if (strcmp(argv[i], "-wm") == 0) {
+            xwl_screen->wm_fd = atoi(argv[i + 1]);
+            i++;
+            TimerSet(NULL, 0, 1, add_client_fd, xwl_screen);
+        }
+        else if (strcmp(argv[i], "-listen") == 0) {
+            if (xwl_screen->listen_fd_count ==
+                ARRAY_SIZE(xwl_screen->listen_fds))
+                FatalError("Too many -listen arguments given, max is %ld\n",
+                           ARRAY_SIZE(xwl_screen->listen_fds));
+
+            xwl_screen->listen_fds[xwl_screen->listen_fd_count++] =
+                atoi(argv[i + 1]);
+            i++;
+        }
+        else if (strcmp(argv[i], "-shm") == 0) {
+            xwl_screen->glamor = 0;
+        }
+    }
+
+    if (xwl_screen->listen_fd_count > 0) {
+        if (xwl_screen->wm_fd >= 0)
+            AddCallback(&SelectionCallback, wm_selection_callback, xwl_screen);
+        else
+            listen_on_fds(xwl_screen);
+    }
+
+    xorg_list_init(&xwl_screen->output_list);
+    xorg_list_init(&xwl_screen->seat_list);
+    xorg_list_init(&xwl_screen->damage_window_list);
+    xwl_screen->depth = 24;
+
+    xwl_screen->display = wl_display_connect(NULL);
+    if (xwl_screen->display == NULL) {
+        ErrorF("could not connect to wayland server\n");
+        return FALSE;
+    }
+
+    if (!xwl_screen_init_output(xwl_screen))
+        return FALSE;
+
+    xwl_screen->expecting_event = 0;
+    xwl_screen->registry = wl_display_get_registry(xwl_screen->display);
+    wl_registry_add_listener(xwl_screen->registry,
+                             &registry_listener, xwl_screen);
+    ret = wl_display_roundtrip(xwl_screen->display);
+    if (ret == -1) {
+        ErrorF("could not connect to wayland server\n");
+        return FALSE;
+    }
+
+    while (xwl_screen->expecting_event > 0)
+        wl_display_roundtrip(xwl_screen->display);
+
+    bpc = xwl_screen->depth / 3;
+    green_bpc = xwl_screen->depth - 2 * bpc;
+    blue_mask = (1 << bpc) - 1;
+    green_mask = ((1 << green_bpc) - 1) << bpc;
+    red_mask = blue_mask << (green_bpc + bpc);
+
+    miSetVisualTypesAndMasks(xwl_screen->depth,
+                             ((1 << TrueColor) | (1 << DirectColor)),
+                             green_bpc, TrueColor,
+                             red_mask, green_mask, blue_mask);
+
+    miSetPixmapDepths();
+
+    ret = fbScreenInit(pScreen, NULL,
+                       xwl_screen->width, xwl_screen->height,
+                       96, 96, 0,
+                       BitsPerPixel(xwl_screen->depth));
+    if (!ret)
+        return FALSE;
+
+    fbPictureInit(pScreen, 0, 0);
+
+#ifdef HAVE_XSHMFENCE
+    if (!miSyncShmScreenInit(pScreen))
+        return FALSE;
+#endif
+
+    xwl_screen->wayland_fd = wl_display_get_fd(xwl_screen->display);
+    AddGeneralSocket(xwl_screen->wayland_fd);
+    RegisterBlockAndWakeupHandlers(block_handler, wakeup_handler, xwl_screen);
+
+    pScreen->SaveScreen = xwl_save_screen;
+
+    pScreen->blackPixel = 0;
+    pScreen->whitePixel = 1;
+
+    ret = fbCreateDefColormap(pScreen);
+
+    if (!xwl_screen_init_cursor(xwl_screen))
+        return FALSE;
+
+#ifdef GLAMOR_HAS_GBM
+    if (xwl_screen->glamor && !xwl_glamor_init(xwl_screen)) {
+        ErrorF("Failed to initialize glamor, falling back to sw\n");
+        xwl_screen->glamor = 0;
+    }
+#endif
+
+    if (!xwl_screen->glamor) {
+        xwl_screen->CreateScreenResources = pScreen->CreateScreenResources;
+        pScreen->CreateScreenResources = xwl_shm_create_screen_resources;
+        pScreen->CreatePixmap = xwl_shm_create_pixmap;
+        pScreen->DestroyPixmap = xwl_shm_destroy_pixmap;
+    }
+
+    xwl_screen->RealizeWindow = pScreen->RealizeWindow;
+    pScreen->RealizeWindow = xwl_realize_window;
+
+    xwl_screen->UnrealizeWindow = pScreen->UnrealizeWindow;
+    pScreen->UnrealizeWindow = xwl_unrealize_window;
+
+    xwl_screen->CloseScreen = pScreen->CloseScreen;
+    pScreen->CloseScreen = xwl_close_screen;
+
+    return ret;
+}
+
+static void _X_ATTRIBUTE_PRINTF(1, 0)
+xwl_log_handler(const char *format, va_list args)
+{
+    char msg[256];
+
+    vsnprintf(msg, sizeof msg, format, args);
+    FatalError("%s", msg);
+}
+
+static const ExtensionModule xwayland_extensions[] = {
+#ifdef GLXEXT
+    { GlxExtensionInit, "GLX", &noGlxExtension },
+#endif
+};
+
+void
+InitOutput(ScreenInfo * screen_info, int argc, char **argv)
+{
+    int depths[] = { 1, 4, 8, 15, 16, 24, 32 };
+    int bpp[] =    { 1, 8, 8, 16, 16, 32, 32 };
+    int i;
+
+    for (i = 0; i < ARRAY_SIZE(depths); i++) {
+        screen_info->formats[i].depth = depths[i];
+        screen_info->formats[i].bitsPerPixel = bpp[i];
+        screen_info->formats[i].scanlinePad = BITMAP_SCANLINE_PAD;
+    }
+
+    screen_info->imageByteOrder = IMAGE_BYTE_ORDER;
+    screen_info->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT;
+    screen_info->bitmapScanlinePad = BITMAP_SCANLINE_PAD;
+    screen_info->bitmapBitOrder = BITMAP_BIT_ORDER;
+    screen_info->numPixmapFormats = ARRAY_SIZE(depths);
+
+    LoadExtensionList(xwayland_extensions,
+                      ARRAY_SIZE(xwayland_extensions), FALSE);
+
+    /* Cast away warning from missing printf annotation for
+     * wl_log_func_t.  Wayland 1.5 will have the annotation, so we can
+     * remove the cast and require that when it's released. */
+    wl_log_set_handler_client((void *) xwl_log_handler);
+
+    if (AddScreen(xwl_screen_init, argc, argv) == -1) {
+        FatalError("Couldn't add screen\n");
+    }
+}
diff --git a/hw/xwayland/xwayland.h b/hw/xwayland/xwayland.h
new file mode 100644 (file)
index 0000000..fc68550
--- /dev/null
@@ -0,0 +1,181 @@
+/*
+ * Copyright Â© 2014 Intel Corporation
+ *
+ * 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 the
+ * copyright holders not be used in advertising or publicity
+ * pertaining to distribution of the software without specific,
+ * written prior permission.  The copyright holders make no
+ * representations about the suitability of this software for any
+ * purpose.  It is provided "as is" without express or implied
+ * warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS 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.
+ */
+
+#ifndef XWAYLAND_H
+#define XWAYLAND_H
+
+#include <dix-config.h>
+#include <xorg-server.h>
+
+#include <stdio.h>
+#include <unistd.h>
+#include <errno.h>
+
+#include <wayland-client.h>
+
+#include <X11/X.h>
+
+#include <fb.h>
+#include <input.h>
+#include <dix.h>
+#include <randrstr.h>
+#include <exevents.h>
+
+struct xwl_screen {
+    int width;
+    int height;
+    int depth;
+    ScreenPtr screen;
+    WindowPtr pointer_limbo_window;
+    int expecting_event;
+
+    int wm_fd;
+    int listen_fds[5];
+    int listen_fd_count;
+    int rootless;
+    int glamor;
+
+    CreateScreenResourcesProcPtr CreateScreenResources;
+    CloseScreenProcPtr CloseScreen;
+    CreateWindowProcPtr CreateWindow;
+    DestroyWindowProcPtr DestroyWindow;
+    RealizeWindowProcPtr RealizeWindow;
+    UnrealizeWindowProcPtr UnrealizeWindow;
+    XYToWindowProcPtr XYToWindow;
+
+    struct xorg_list output_list;
+    struct xorg_list seat_list;
+    struct xorg_list damage_window_list;
+
+    int wayland_fd;
+    struct wl_display *display;
+    struct wl_registry *registry;
+    struct wl_registry *input_registry;
+    struct wl_compositor *compositor;
+    struct wl_shm *shm;
+    struct wl_shell *shell;
+
+    uint32_t serial;
+
+#define XWL_FORMAT_ARGB8888 (1 << 0)
+#define XWL_FORMAT_XRGB8888 (1 << 1)
+#define XWL_FORMAT_RGB565   (1 << 2)
+
+    int prepare_read;
+
+    char *device_name;
+    int drm_fd;
+    int fd_render_node;
+    struct wl_drm *drm;
+    uint32_t formats;
+    uint32_t capabilities;
+    void *egl_display, *egl_context;
+    struct gbm_device *gbm;
+    struct glamor_context *glamor_ctx;
+};
+
+struct xwl_window {
+    struct xwl_screen *xwl_screen;
+    struct wl_surface *surface;
+    struct wl_shell_surface *shell_surface;
+    WindowPtr window;
+    DamagePtr damage;
+    struct xorg_list link_damage;
+};
+
+#define MODIFIER_META 0x01
+
+struct xwl_seat {
+    DeviceIntPtr pointer;
+    DeviceIntPtr keyboard;
+    struct xwl_screen *xwl_screen;
+    struct wl_seat *seat;
+    struct wl_pointer *wl_pointer;
+    struct wl_keyboard *wl_keyboard;
+    struct wl_array keys;
+    struct wl_surface *cursor;
+    struct xwl_window *focus_window;
+    uint32_t id;
+    uint32_t pointer_enter_serial;
+    struct xorg_list link;
+    CursorPtr x_cursor;
+
+    wl_fixed_t horizontal_scroll;
+    wl_fixed_t vertical_scroll;
+    uint32_t scroll_time;
+
+    size_t keymap_size;
+    char *keymap;
+    struct wl_surface *keyboard_focus;
+};
+
+struct xwl_output {
+    struct xorg_list link;
+    struct wl_output *output;
+    struct xwl_screen *xwl_screen;
+    RROutputPtr randr_output;
+    RRCrtcPtr randr_crtc;
+    int32_t x, y, width, height;
+    Rotation rotation;
+};
+
+struct xwl_pixmap;
+
+Bool xwl_screen_init_cursor(struct xwl_screen *xwl_screen);
+
+struct xwl_screen *xwl_screen_get(ScreenPtr screen);
+
+void xwl_seat_set_cursor(struct xwl_seat *xwl_seat);
+
+void xwl_seat_destroy(struct xwl_seat *xwl_seat);
+
+Bool xwl_screen_init_output(struct xwl_screen *xwl_screen);
+
+struct xwl_output *xwl_output_create(struct xwl_screen *xwl_screen,
+                                     uint32_t id);
+
+void xwl_output_destroy(struct xwl_output *xwl_output);
+
+RRModePtr xwayland_cvt(int HDisplay, int VDisplay,
+                       float VRefresh, Bool Reduced, Bool Interlaced);
+
+void xwl_pixmap_set_private(PixmapPtr pixmap, struct xwl_pixmap *xwl_pixmap);
+struct xwl_pixmap *xwl_pixmap_get(PixmapPtr pixmap);
+
+
+Bool xwl_shm_create_screen_resources(ScreenPtr screen);
+PixmapPtr xwl_shm_create_pixmap(ScreenPtr screen, int width, int height,
+                                int depth, unsigned int hint);
+Bool xwl_shm_destroy_pixmap(PixmapPtr pixmap);
+struct wl_buffer *xwl_shm_pixmap_get_wl_buffer(PixmapPtr pixmap);
+
+
+Bool xwl_glamor_init(struct xwl_screen *xwl_screen);
+
+Bool xwl_screen_init_glamor(struct xwl_screen *xwl_screen,
+                         uint32_t id, uint32_t version);
+struct wl_buffer *xwl_glamor_pixmap_get_wl_buffer(PixmapPtr pixmap);
+
+#endif
index 395b533..38203c9 100644 (file)
@@ -39,7 +39,6 @@
 
 #ifdef XWIN_CLIPBOARD
 int winProcEstablishConnection(ClientPtr /* client */ );
-int winProcQueryTree(ClientPtr /* client */ );
 int winProcSetSelectionOwner(ClientPtr /* client */ );
 #endif
 
@@ -109,10 +108,11 @@ InitInput(int argc, char *argv[])
     }
 #endif
 
-    g_pwinPointer = AddInputDevice(serverClient, winMouseProc, TRUE);
-    g_pwinKeyboard = AddInputDevice(serverClient, winKeybdProc, TRUE);
-    g_pwinPointer->name = strdup("Windows mouse");
-    g_pwinKeyboard->name = strdup("Windows keyboard");
+    if (AllocDevicePair(serverClient, "Windows",
+                        &g_pwinPointer, &g_pwinKeyboard,
+                        winMouseProc, winKeybdProc,
+                        FALSE) != Success)
+        FatalError("InitInput - Failed to allocate slave devices.\n");
 
     mieqInit();
 
index 37cd8b3..6b5c38d 100644 (file)
@@ -48,14 +48,21 @@ from The Open Group.
 #include "xkbsrv.h"
 #endif
 #ifdef RELOCATE_PROJECTROOT
+#pragma push_macro("Status")
+#undef Status
+#define Status wStatus
 #include <shlobj.h>
+#pragma pop_macro("Status")
 typedef WINAPI HRESULT(*SHGETFOLDERPATHPROC) (HWND hwndOwner,
                                               int nFolder,
                                               HANDLE hToken,
                                               DWORD dwFlags, LPTSTR pszPath);
 #endif
-
 #include "glx_extinit.h"
+#ifdef XWIN_GLX_WINDOWS
+#include "glx/glwindows.h"
+#endif
+
 /*
  * References to external symbols
  */
@@ -77,11 +84,6 @@ static void
  winClipboardShutdown(void);
 #endif
 
-#if defined(DDXOSVERRORF)
-void
- OsVendorVErrorF(const char *pszFormat, va_list va_args);
-#endif
-
 static Bool
  winCheckDisplayNumber(void);
 
@@ -161,17 +163,14 @@ static const ExtensionModule xwinExtensions[] = {
 static
 void XwinExtensionInit(void)
 {
-    int i;
-
 #ifdef XWIN_GLX_WINDOWS
-    if ((g_fNativeGl) && (serverGeneration == 1)) {
+    if (g_fNativeGl) {
         /* install the native GL provider */
         glxWinPushNativeProvider();
     }
 #endif
 
-    for (i = 0; i < ARRAY_SIZE(xwinExtensions); i++)
-        LoadExtension(&xwinExtensions[i], TRUE);
+    LoadExtensionList(xwinExtensions, ARRAY_SIZE(xwinExtensions), TRUE);
 }
 
 #if defined(DDXBEFORERESET)
@@ -191,6 +190,25 @@ ddxBeforeReset(void)
 }
 #endif
 
+int
+main(int argc, char *argv[], char *envp[])
+{
+    int iReturn;
+
+    /* Create & acquire the termination mutex */
+    iReturn = pthread_mutex_init(&g_pmTerminating, NULL);
+    if (iReturn != 0) {
+        ErrorF("ddxMain - pthread_mutex_init () failed: %d\n", iReturn);
+    }
+
+    iReturn = pthread_mutex_lock(&g_pmTerminating);
+    if (iReturn != 0) {
+        ErrorF("ddxMain - pthread_mutex_lock () failed: %d\n", iReturn);
+    }
+
+    return dix_main(argc, argv, envp);
+}
+
 /* See Porting Layer Definition - p. 57 */
 void
 ddxGiveUp(enum ExitCode error)
@@ -209,6 +227,9 @@ ddxGiveUp(enum ExitCode error)
     }
 
 #ifdef XWIN_MULTIWINDOW
+    /* Unload libraries for taskbar grouping */
+    winPropertyStoreDestroy();
+
     /* Notify the worker threads we're exiting */
     winDeinitMultiWindowWM();
 #endif
@@ -245,6 +266,19 @@ ddxGiveUp(enum ExitCode error)
 
     /* Tell Windows that we want to end the app */
     PostQuitMessage(0);
+
+    {
+        int iReturn = pthread_mutex_unlock(&g_pmTerminating);
+
+        winDebug("ddxGiveUp - Releasing termination mutex\n");
+
+        if (iReturn != 0) {
+            ErrorF("winMsgWindowProc - pthread_mutex_unlock () failed: %d\n",
+                   iReturn);
+        }
+    }
+
+    winDebug("ddxGiveUp - End\n");
 }
 
 /* See Porting Layer Definition - p. 57 */
@@ -299,11 +333,11 @@ winCheckMount(void)
     }
 
     while ((ent = getmntent(mnt)) != NULL) {
-        BOOL system = (winCheckMntOpt(ent, "user") != NULL);
+        BOOL sys = (winCheckMntOpt(ent, "user") != NULL);
         BOOL root = (strcmp(ent->mnt_dir, "/") == 0);
         BOOL tmp = (strcmp(ent->mnt_dir, "/tmp") == 0);
 
-        if (system) {
+        if (sys) {
             if (root)
                 curlevel = sys_root;
             else if (tmp)
@@ -749,6 +783,9 @@ winUseMsg(void)
 
     ErrorF("-fullscreen\n" "\tRun the server in fullscreen mode.\n");
 
+    ErrorF("-hostintitle\n"
+           "\tIn multiwindow mode, add remote host names to window titles.\n");
+
     ErrorF("-ignoreinput\n" "\tIgnore keyboard and mouse input.\n");
 
 #ifdef XWIN_MULTIWINDOWEXTWM
@@ -809,7 +846,7 @@ winUseMsg(void)
     ErrorF("-resize=none|scrollbars|randr"
            "\tIn windowed mode, [don't] allow resizing of the window. 'scrollbars'\n"
            "\tmode gives the window scrollbars as needed, 'randr' mode uses the RANR\n"
-           "\textension to resize the X screen.\n");
+           "\textension to resize the X screen.  'randr' is the default.\n");
 
     ErrorF("-rootless\n" "\tRun the server in rootless mode.\n");
 
@@ -842,7 +879,7 @@ winUseMsg(void)
 
 #ifdef XWIN_GLX_WINDOWS
     ErrorF("-[no]wgl\n"
-           "\tEnable the GLX extension to use the native Windows WGL interface for accelerated OpenGL\n");
+           "\tEnable the GLX extension to use the native Windows WGL interface for hardware-accelerated OpenGL\n");
 #endif
 
     ErrorF("-[no]winkill\n" "\tAlt+F4 exits the X Server.\n");
@@ -897,11 +934,12 @@ ddxUseMsg(void)
  */
 
 void
-InitOutput(ScreenInfo * screenInfo, int argc, char *argv[])
+InitOutput(ScreenInfo * pScreenInfo, int argc, char *argv[])
 {
     int i;
 
-    XwinExtensionInit();
+    if (serverGeneration == 1)
+        XwinExtensionInit();
 
     /* Log the command line */
     winLogCommandLine(argc, argv);
@@ -939,15 +977,15 @@ InitOutput(ScreenInfo * screenInfo, int argc, char *argv[])
     LoadPreferences();
 
     /* Setup global screen info parameters */
-    screenInfo->imageByteOrder = IMAGE_BYTE_ORDER;
-    screenInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD;
-    screenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT;
-    screenInfo->bitmapBitOrder = BITMAP_BIT_ORDER;
-    screenInfo->numPixmapFormats = NUMFORMATS;
+    pScreenInfo->imageByteOrder = IMAGE_BYTE_ORDER;
+    pScreenInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD;
+    pScreenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT;
+    pScreenInfo->bitmapBitOrder = BITMAP_BIT_ORDER;
+    pScreenInfo->numPixmapFormats = NUMFORMATS;
 
     /* Describe how we want common pixmap formats padded */
     for (i = 0; i < NUMFORMATS; i++) {
-        screenInfo->formats[i] = g_PixmapFormats[i];
+        pScreenInfo->formats[i] = g_PixmapFormats[i];
     }
 
     /* Load pointers to DirectDraw functions */
@@ -955,10 +993,18 @@ InitOutput(ScreenInfo * screenInfo, int argc, char *argv[])
 
     /* Detect supported engines */
     winDetectSupportedEngines();
+#ifdef XWIN_MULTIWINDOW
+    /* Load libraries for taskbar grouping */
+    winPropertyStoreInit();
+#endif
 
     /* Store the instance handle */
     g_hInstance = GetModuleHandle(NULL);
 
+    /* Create the messaging window */
+    if (serverGeneration == 1)
+        winCreateMsgWindowThread();
+
     /* Initialize each screen */
     for (i = 0; i < g_iNumScreens; ++i) {
         /* Initialize the screen */
@@ -1039,7 +1085,7 @@ winCheckDisplayNumber(void)
                       NULL,
                       GetLastError(),
                       MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
-                      (LPTSTR) & lpMsgBuf, 0, NULL);
+                      (LPTSTR) &lpMsgBuf, 0, NULL);
         ErrorF("winCheckDisplayNumber - CreateMutex failed: %s\n",
                (LPSTR) lpMsgBuf);
         LocalFree(lpMsgBuf);
index 4c2f04e..4ee9632 100644 (file)
@@ -23,8 +23,11 @@ SRCS_MULTIWINDOW = \
        winmultiwindowshape.c \
        winmultiwindowwindow.c \
        winmultiwindowwm.c \
-       winmultiwindowwndproc.c
+       winmultiwindowwndproc.c \
+       propertystore.h \
+       winSetAppUserModelID.c
 DEFS_MULTIWINDOW = -DXWIN_MULTIWINDOW
+MULTIWINDOW_LIBS = -lshlwapi -lole32
 endif
 
 if XWIN_MULTIWINDOWEXTWM
@@ -89,17 +92,18 @@ SRCS =      InitInput.c \
        winmonitors.c \
        winmouse.c \
        winmsg.c \
+       winmsgwindow.c \
        winmultiwindowclass.c \
        winmultiwindowicons.c \
        winprefs.c \
        winprefsyacc.y \
        winprefslex.l \
        winprocarg.c \
-       winregistry.c \
        winscrinit.c \
        winshaddd.c \
        winshadddnl.c \
        winshadgdi.c \
+       wintaskbar.c \
        wintrayicon.c \
        winvalargs.c \
        winwakeup.c \
@@ -109,21 +113,21 @@ SRCS =    InitInput.c \
        winclipboard.h \
        winconfig.h \
        win.h \
+       winglobals.h \
        winkeybd.h \
        winkeynames.h \
        winlayouts.h \
        winmessages.h \
+       winmonitors.h \
        winmsg.h \
        winms.h \
        winmultiwindowclass.h \
+       winmultiwindowicons.h \
        winprefs.h \
        winresource.h \
        winwindow.h \
        XWin.rc \
-       $(top_srcdir)/Xext/dpmsstubs.c \
-       $(top_srcdir)/Xi/stubs.c \
        $(top_srcdir)/mi/miinitext.c \
-       $(top_srcdir)/fb/fbcmap_mi.c \
        $(SRCS_CLIPBOARD) \
        $(SRCS_MULTIWINDOW) \
        $(SRCS_MULTIWINDOWEXTWM) \
@@ -143,15 +147,22 @@ SRCS =    InitInput.c \
 
 XWin_SOURCES = $(SRCS)
 
-INCLUDES = -I$(top_srcdir)/miext/rootless
+AM_CPPFLAGS = -I$(top_srcdir)/miext/rootless
+
+XWIN_SYS_LIBS += -ldxguid
+XWIN_LIBS +=   $(top_builddir)/pseudoramiX/libPseudoramiX.la \
+                $(top_builddir)/Xext/libXextdpmsstubs.la \
+                $(top_builddir)/Xi/libXistubs.la
+XWin_DEPENDENCIES = $(MULTIWINDOWEXTWM_LIBS) $(XWIN_GLX_LIBS) $(XWIN_LIBS) $(XSERVER_LIBS)
+XWin_LDADD = $(MULTIWINDOW_LIBS) $(MULTIWINDOWEXTWM_LIBS) $(XWIN_GLX_LIBS) $(XWIN_GLX_LINK_FLAGS) $(XWIN_LIBS) $(MAIN_LIB) $(XSERVER_LIBS) $(XSERVER_SYS_LIBS) $(XWIN_SYS_LIBS)
+XWin_LDFLAGS = -mwindows -Wl,--disable-stdcall-fixup $(LD_EXPORT_SYMBOLS_FLAG)
 
-XWin_DEPENDENCIES = $(MULTIWINDOWEXTWM_LIBS) $(XWIN_GLX_LIBS) $(XWIN_LIBS) $(MAIN_LIB) $(XSERVER_LIBS)
-XWin_LDADD = $(MULTIWINDOWEXTWM_LIBS) $(XWIN_GLX_LIBS) $(XWIN_GLX_LINK_FLAGS) $(XWIN_LIBS) $(MAIN_LIB) $(XSERVER_LIBS) $(XSERVER_SYS_LIBS) $(XWIN_SYS_LIBS)
-XWin_LDFLAGS = -mwindows -static
 
 .rc.o:
        $(AM_V_GEN)$(WINDRES) --use-temp-file -i $< --input-format=rc -o $@ -O coff -I $(top_builddir)/include
 
+XWin.o: XWin.rc XWin.exe.manifest X.ico
+
 winprefsyacc.h: winprefsyacc.c
 winprefslex.c: winprefslex.l winprefsyacc.c winprefsyacc.h
 
index a0d4d7d..477334f 100755 (executable)
@@ -7,7 +7,7 @@
               type="win32"
               name="Microsoft.Windows.Common-Controls"
               version="6.0.0.0"
-              processorArchitecture="X86"
+              processorArchitecture="*"
               publicKeyToken="6595b64144ccf1df"
               language="*"
             />
index 9463049..1871d95 100644 (file)
@@ -1,3 +1,7 @@
+#ifdef __MINGW64_VERSION_MAJOR
+#include_next <ddraw.h>
+#define __XWIN_DDRAW_H
+#endif
 #ifndef __XWIN_DDRAW_H
 #define __XWIN_DDRAW_H
 
index 7222a9f..f2dffbf 100644 (file)
@@ -1,12 +1,17 @@
 noinst_LTLIBRARIES = libXwinGLX.la
+lib_LTLIBRARIES = libnativeGLthunk.la
 
 libXwinGLX_la_SOURCES = \
        winpriv.c \
        winpriv.h \
        glwindows.h \
-       glwrap.c \
+       glshim.c \
        indirect.c \
-       wgl_ext_api.c
+       wgl_ext_api.c \
+       wgl_ext_api.h
+
+libnativeGLthunk_la_SOURCES = \
+       glthunk.c
 
 if XWIN_MULTIWINDOW
 DEFS_MULTIWINDOW = -DXWIN_MULTIWINDOW
@@ -22,23 +27,39 @@ endif
 
 DEFS =  $(DEFS_MULTIWINDOW) $(DEFS_MULTIWINDOWEXTWM) $(DEFS_GLX_WINDOWS)
 
-INCLUDES = -I$(top_srcdir)/miext/rootless
+AM_CPPFLAGS = -I$(top_srcdir)/miext/rootless
 
 AM_CFLAGS = -DHAVE_XWIN_CONFIG_H $(DIX_CFLAGS) \
             $(XWINMODULES_CFLAGS) \
             -I$(top_srcdir) \
             -I$(top_srcdir)/hw/xwin/
 
+libnativeGLthunk_la_CFLAGS = $(AM_CFLAGS) -Wno-unused-function -Wno-missing-prototypes -Wno-missing-declarations
+libnativeGLthunk_la_LDFLAGS = -shared -no-undefined -avoid-version -lopengl32 -export-symbols generated_gl_thunks.def
+EXTRA_libnativeGLthunk_la_DEPENDENCIES = generated_gl_thunks.def
+
 if XWIN_GLX_WINDOWS
 
-generated_gl_wrappers.c: gen_gl_wrappers.py $(KHRONOS_SPEC_DIR)/gl.spec $(KHRONOS_SPEC_DIR)/gl.tm
-       $(AM_V_GEN)$(srcdir)/gen_gl_wrappers.py --spec=$(KHRONOS_SPEC_DIR)/gl.spec --typemap=$(KHRONOS_SPEC_DIR)/gl.tm --dispatch-header=$(top_srcdir)/glx/dispatch.h --staticwrappers >generated_gl_wrappers.c
+if DEBUG
+GENGLWRAPPERSOPTS=""
+else
+GENGLWRAPPERSOPTS="-nodebug"
+endif
+
+generated_wgl_wrappers.c: $(srcdir)/gen_gl_wrappers.py $(KHRONOS_SPEC_DIR)/wgl.xml $(KHRONOS_SPEC_DIR)/reg.py
+       $(AM_V_GEN)PYTHONPATH=$(KHRONOS_SPEC_DIR) $(PYTHON3) $(srcdir)/gen_gl_wrappers.py -registry $(KHRONOS_SPEC_DIR)/wgl.xml -prefix wgl -wrapper -preresolve $(GENGLWRAPPERSOPTS) -outfile $@
+
+generated_gl_shim.c: $(srcdir)/gen_gl_wrappers.py $(KHRONOS_SPEC_DIR)/gl.xml $(KHRONOS_SPEC_DIR)/reg.py
+       $(AM_V_GEN)PYTHONPATH=$(KHRONOS_SPEC_DIR) $(PYTHON3) $(srcdir)/gen_gl_wrappers.py -registry $(KHRONOS_SPEC_DIR)/gl.xml -shim $(GENGLWRAPPERSOPTS) -outfile $@
+
+generated_gl_thunks.c: $(srcdir)/gen_gl_wrappers.py $(KHRONOS_SPEC_DIR)/gl.xml $(KHRONOS_SPEC_DIR)/reg.py
+       $(AM_V_GEN)PYTHONPATH=$(KHRONOS_SPEC_DIR) $(PYTHON3) $(srcdir)/gen_gl_wrappers.py -registry $(KHRONOS_SPEC_DIR)/gl.xml -thunk $(GENGLWRAPPERSOPTS) -outfile $@
 
-generated_wgl_wrappers.c: gen_gl_wrappers.py $(KHRONOS_SPEC_DIR)/wglext.spec $(KHRONOS_SPEC_DIR)/wgl.tm
-       $(AM_V_GEN)$(srcdir)/gen_gl_wrappers.py --spec=$(KHRONOS_SPEC_DIR)/wglext.spec --typemap=$(KHRONOS_SPEC_DIR)/wgl.tm --prefix=wgl --preresolve >generated_wgl_wrappers.c
+generated_gl_thunks.def: $(srcdir)/gen_gl_wrappers.py $(KHRONOS_SPEC_DIR)/gl.xml $(KHRONOS_SPEC_DIR)/reg.py
+       $(AM_V_GEN)PYTHONPATH=$(KHRONOS_SPEC_DIR) $(PYTHON3) $(srcdir)/gen_gl_wrappers.py -registry $(KHRONOS_SPEC_DIR)/gl.xml -thunkdefs $(GENGLWRAPPERSOPTS) -outfile $@
 endif
 
-BUILT_SOURCES = generated_gl_wrappers.c generated_wgl_wrappers.c
+BUILT_SOURCES = generated_gl_shim.c generated_gl_thunks.c generated_gl_thunks.def generated_wgl_wrappers.c
 CLEANFILES = $(BUILT_SOURCES)
 
 EXTRA_DIST = gen_gl_wrappers.py
index 15f7ef8..cdbba63 100755 (executable)
-#!/usr/bin/python
+#!/usr/bin/python3
 #
-# Comedy python script to generate cdecl to stdcall wrappers for GL functions
+# python script to generate cdecl to stdcall wrappers for GL functions
+# adapted from genheaders.py
 #
-# This is designed to operate on OpenGL spec files from
-# http://www.opengl.org/registry/api/
-#
-#
-# Copyright (c) Jon TURNEY 2009
+# Copyright (c) 2013 The Khronos Group Inc.
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
-# copy of this software and associated documentation files (the "Software"),
-# to deal in the Software without restriction, including without limitation
-# 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 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 ABOVE LISTED COPYRIGHT HOLDER(S) 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.
-#
-# Except as contained in this notice, the name(s) of the above copyright
-# holders shall not be used in advertising or otherwise to promote the sale,
-# use or other dealings in this Software without prior written authorization.
-#
-
-import sys
-import re
-import getopt
-
-dispatchheader = ''
-prefix = 'gl'
-preresolve = False
-staticwrappers = False
-
-opts, args = getopt.getopt(sys.argv[1:], "", ['spec=', 'typemap=', 'dispatch-header=', 'prefix=', 'preresolve', 'staticwrappers' ])
-
-for o,a in opts:
-        if o == '--typemap' :
-                typemapfile = a
-        elif o == '--dispatch-header' :
-                dispatchheader = a
-        elif o == '--spec' :
-                specfile = a
-        elif o == '--prefix' :
-                prefix = a
-        elif o == '--preresolve' :
-                preresolve = True
-        elif o == '--staticwrappers' :
-                staticwrappers = True
-
-#
-# look for all the SET_ macros in dispatch.h, this is the set of functions
-# we need to generate
-#
-
-dispatch = {}
-
-if dispatchheader :
-        fh = open(dispatchheader)
-        dispatchh = fh.readlines()
-
-        dispatch_regex = re.compile(r'^SET_(\S*)\(')
-
-        for line in dispatchh :
-                line = line.strip()
-                m1 = dispatch_regex.search(line)
-
-                if m1 :
-                        dispatch[m1.group(1)] = 1
-
-        del dispatch['by_offset']
-
+# copy of this software and/or associated documentation files (the
+# "Materials"), to deal in the Materials without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Materials, and to
+# permit persons to whom the Materials are furnished to do so, subject to
+# the following conditions:
 #
-# read the typemap .tm file
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Materials.
 #
+# THE MATERIALS ARE 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
+# MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+
+import sys, time, pdb, string, cProfile
+from reg import *
+
+# Default input / log files
+errFilename = None
+diagFilename = 'diag.txt'
+regFilename = 'gl.xml'
+outFilename = 'gen_gl_wrappers.c'
+
+protect=True
+prefix="gl"
+preresolve=False
+wrapper=False
+shim=False
+thunk=False
+thunkdefs=False
+staticwrappers=False
+nodebug=False
+
+# list of WGL extension functions we use
+used_wgl_ext_fns = {key: 1 for key in [
+    "wglSwapIntervalEXT",
+    "wglGetExtensionsStringARB",
+    "wglDestroyPbufferARB",
+    "wglGetPbufferDCARB",
+    "wglReleasePbufferDCARB",
+    "wglCreatePbufferARB",
+    "wglMakeContextCurrentARB",
+    "wglChoosePixelFormatARB",
+    "wglGetPixelFormatAttribivARB",
+    "wglGetPixelFormatAttribivARB"
+]}
+
+if __name__ == '__main__':
+    i = 1
+    while (i < len(sys.argv)):
+        arg = sys.argv[i]
+        i = i + 1
+        if (arg == '-noprotect'):
+            print('Disabling inclusion protection in output headers', file=sys.stderr)
+            protect = False
+        elif (arg == '-registry'):
+            regFilename = sys.argv[i]
+            i = i+1
+            print('Using registry', regFilename, file=sys.stderr)
+        elif (arg == '-outfile'):
+            outFilename = sys.argv[i]
+            i = i+1
+        elif (arg == '-preresolve'):
+            preresolve=True
+        elif (arg == '-wrapper'):
+            wrapper=True
+        elif (arg == '-shim'):
+            shim=True
+        elif (arg == '-thunk'):
+            thunk=True
+        elif (arg == '-thunkdefs'):
+            thunkdefs=True
+        elif (arg == '-staticwrappers'):
+            staticwrappers=True
+        elif (arg == '-prefix'):
+            prefix = sys.argv[i]
+            i = i+1
+        elif (arg == '-nodebug'):
+            nodebug = True
+        elif (arg[0:1] == '-'):
+            print('Unrecognized argument:', arg, file=sys.stderr)
+            exit(1)
+
+print('Generating', outFilename, file=sys.stderr)
+
+# Load & parse registry
+reg = Registry()
+tree = etree.parse(regFilename)
+reg.loadElementTree(tree)
+
+allVersions = '.*'
+
+genOpts = CGeneratorOptions(
+        apiname           = prefix,
+        profile           = 'compatibility',
+        versions          = allVersions,
+        emitversions      = allVersions,
+        defaultExtensions = prefix,                   # Default extensions for GL
+        protectFile       = protect,
+        protectFeature    = protect,
+        protectProto      = protect,
+        )
+
+# create error/warning & diagnostic files
+if (errFilename):
+    errWarn = open(errFilename,'w')
+else:
+    errWarn = sys.stderr
+diag = open(diagFilename, 'w')
+
+class PreResolveOutputGenerator(OutputGenerator):
+    def __init__(self,
+                 errFile = sys.stderr,
+                 warnFile = sys.stderr,
+                 diagFile = sys.stdout):
+        OutputGenerator.__init__(self, errFile, warnFile, diagFile)
+        self.wrappers={}
+    def beginFile(self, genOpts):
+        self.outFile.write('/* Automatically generated from %s - DO NOT EDIT */\n\n'%regFilename)
+    def endFile(self):
+        self.outFile.write('\nvoid ' + prefix + 'ResolveExtensionProcs(void)\n{\n')
+        for funcname in self.wrappers.keys():
+            self.outFile.write( '  PRERESOLVE(PFN' + funcname.upper() + 'PROC, "' + funcname + '");\n')
+        self.outFile.write('}\n\n')
+    def beginFeature(self, interface, emit):
+        OutputGenerator.beginFeature(self, interface, emit)
+    def endFeature(self):
+        OutputGenerator.endFeature(self)
+    def genType(self, typeinfo, name):
+        OutputGenerator.genType(self, typeinfo, name)
+    def genEnum(self, enuminfo, name):
+        OutputGenerator.genEnum(self, enuminfo, name)
+    def genCmd(self, cmd, name):
+        OutputGenerator.genCmd(self, cmd, name)
+
+        if prefix == 'wgl' and not name in used_wgl_ext_fns:
+            return
+
+        self.outFile.write('RESOLVE_DECL(PFN' + name.upper() + 'PROC);\n')
+        self.wrappers[name]=1
+
+class WrapperOutputGenerator(OutputGenerator):
+    def __init__(self,
+                 errFile = sys.stderr,
+                 warnFile = sys.stderr,
+                 diagFile = sys.stdout):
+        OutputGenerator.__init__(self, errFile, warnFile, diagFile)
+    def beginFile(self, genOpts):
+        self.outFile.write('/* Automatically generated from %s - DO NOT EDIT */\n\n'%regFilename)
+    def endFile(self):
+        pass
+    def beginFeature(self, interface, emit):
+        OutputGenerator.beginFeature(self, interface, emit)
+        self.OldVersion = self.featureName.startswith('GL_VERSION_1_0') or self.featureName.startswith('GL_VERSION_1_1')
+    def endFeature(self):
+        OutputGenerator.endFeature(self)
+    def genType(self, typeinfo, name):
+        OutputGenerator.genType(self, typeinfo, name)
+    def genEnum(self, enuminfo, name):
+        OutputGenerator.genEnum(self, enuminfo, name)
+    def genCmd(self, cmd, name):
+        OutputGenerator.genCmd(self, cmd, name)
+
+        if prefix == 'wgl' and not name in used_wgl_ext_fns:
+            return
+
+        proto=noneStr(cmd.elem.find('proto'))
+        rettype=noneStr(proto.text)
+        if rettype.lower()!="void ":
+            plist = ([t for t in proto.itertext()])
+            rettype = ''.join(plist[:-1])
+        rettype=rettype.strip()
+        if staticwrappers: self.outFile.write("static ")
+        self.outFile.write("%s %sWrapper("%(rettype, name))
+        params = cmd.elem.findall('param')
+        plist=[]
+        for param in params:
+            paramlist = ([t for t in param.itertext()])
+            paramtype = ''.join(paramlist[:-1])
+            paramname = paramlist[-1]
+            plist.append((paramtype, paramname))
+        Comma=""
+        if len(plist):
+            for ptype, pname in plist:
+                self.outFile.write("%s%s%s_"%(Comma, ptype, pname))
+                Comma=", "
+        else:
+            self.outFile.write("void")
 
-typemap = {}
-
-fh = open(typemapfile)
-tm = fh.readlines()
-
-typemap_regex = re.compile(r'#define\sSET_(\S*)\(')
-
-for line in tm :
-        # ignore everything after a '#' as a comment
-        hash = line.find('#')
-        if hash != -1 :
-                line = line[:hash-1]
-
-        # ignore blank lines
-        if line.startswith('#') or len(line) == 0 :
-                continue
-
-        l = line.split(',')
-        typemap[l[0]] = l[3].strip()
-
-# interestingly, * is not a C type
-if typemap['void'] == '*' :
-        typemap['void'] = 'void'
-
-#
-# crudely parse the .spec file
-#
-
-r1 = re.compile(r'\t(\S*)\s+(\S*.*)')
-r2 = re.compile(r'(.*)\((.*)\)')
-r3 = re.compile(r'glWindowPos.*MESA')
-r4 = re.compile(r'gl.*Program(s|)NV')
-r5 = re.compile(r'glGetVertexAttribfvNV')
-
-wrappers = {}
-
-fh = open(specfile)
-glspec = fh.readlines()
-param_count = 0
-
-for line in glspec :
-        line = line.rstrip()
-
-        # ignore everything after a '#' as a comment
-        hash = line.find('#')
-        if hash != -1 :
-                line = line[:hash-1]
-
-        # ignore blank lines
-        if line.startswith('#') or len(line) == 0 :
-                continue
-
-        # lines containing ':' aren't intersting to us
-        if line.count(':') != 0 :
-                continue
-
-        # attributes of each function follow the name, indented by a tab
-        if not line.startswith('\t') :
-                m1 = r2.search(line)
-                if m1 :
-                        function = m1.group(1)
-                        arglist_use = m1.group(2)
-                        wrappers[function] = {}
-
-                        # near and far might be reserved words or macros so can't be used as formal parameter names
-                        arglist_use = arglist_use.replace('near','zNear')
-                        arglist_use = arglist_use.replace('far','zFar')
-
-                        wrappers[function]['arglist_use'] = arglist_use
-                        param_count = 0
-        else :
-                m1 = r1.search(line)
-                if m1 :
-                        attribute = m1.group(1)
-                        value = m1.group(2)
-
-                        # make param attributes unique and ordered
-                        if attribute == 'param' :
-                                attribute = 'param' + '%02d' % param_count
-                                param_count += 1
-
-                        wrappers[function][attribute] = value
-
-#
-# now emit code
-#
+        self.outFile.write(")\n{\n")
 
-print '/* Automatically generated by ' + sys.argv[0] + ' DO NOT EDIT */'
-print '/* from ' + specfile + ' and typemap ' + typemapfile + ' */'
-print ''
+        # for GL 1.0 and 1.1 functions, generate stdcall wrappers which call the function directly
+        if self.OldVersion:
+            if not nodebug:
+                self.outFile.write('  if (glxWinDebugSettings.enable%scallTrace) ErrorF("%s\\n");\n'%(prefix.upper(), name))
+                self.outFile.write("  glWinDirectProcCalls++;\n")
+                self.outFile.write("\n")
 
-#
-# if required, emit code for non-lazy function resolving
-#
+            if rettype.lower()=="void":
+                self.outFile.write("  %s( "%(name))
+            else:
+                self.outFile.write("  return %s( "%(name))
 
-if preresolve :
-        for w in sorted(wrappers.keys()) :
-                funcname = prefix + w
-                print 'RESOLVE_DECL(PFN' + funcname.upper() + 'PROC);'
+            Comma=""
+            for ptype, pname in plist:
+                self.outFile.write("%s%s_"%(Comma, pname))
+                Comma=", "
 
-        print ''
-        print 'void ' + prefix + 'ResolveExtensionProcs(void)'
-        print '{'
+        # for GL 1.2+ functions, generate stdcall wrappers which use wglGetProcAddress()
+        else:
+            if rettype.lower()=="void":
+                self.outFile.write('  RESOLVE(PFN%sPROC, "%s");\n'%(name.upper(), name))
+
+                if not nodebug:
+                    self.outFile.write("\n")
+                    self.outFile.write('  if (glxWinDebugSettings.enable%scallTrace) ErrorF("%s\\n");\n'%(prefix.upper(), name))
+                    self.outFile.write("\n")
+
+                self.outFile.write("  RESOLVED_PROC(PFN%sPROC)( """%(name.upper()))
+            else:
+                self.outFile.write('  RESOLVE_RET(PFN%sPROC, "%s", FALSE);\n'%(name.upper(), name))
+
+                if not nodebug:
+                    self.outFile.write("\n")
+                    self.outFile.write('  if (glxWinDebugSettings.enable%scallTrace) ErrorF("%s\\n");\n'%(prefix.upper(), name))
+                    self.outFile.write("\n")
+
+                self.outFile.write("  return RESOLVED_PROC(PFN%sPROC)("%(name.upper()))
+
+            Comma=""
+            for ptype, pname in plist:
+                self.outFile.write("%s%s_"%(Comma, pname))
+                Comma=", "
+        self.outFile.write(" );\n}\n\n")
+
+class ThunkOutputGenerator(OutputGenerator):
+    def __init__(self,
+                 errFile = sys.stderr,
+                 warnFile = sys.stderr,
+                 diagFile = sys.stdout):
+        OutputGenerator.__init__(self, errFile, warnFile, diagFile)
+    def beginFile(self, genOpts):
+        self.outFile.write('/* Automatically generated from %s - DO NOT EDIT */\n\n'%regFilename)
+    def endFile(self):
+        pass
+    def beginFeature(self, interface, emit):
+        OutputGenerator.beginFeature(self, interface, emit)
+        self.OldVersion = self.featureName.startswith('GL_VERSION_1_0') or self.featureName.startswith('GL_VERSION_1_1')
+    def endFeature(self):
+        OutputGenerator.endFeature(self)
+    def genType(self, typeinfo, name):
+        OutputGenerator.genType(self, typeinfo, name)
+    def genEnum(self, enuminfo, name):
+        OutputGenerator.genEnum(self, enuminfo, name)
+    def genCmd(self, cmd, name):
+        OutputGenerator.genCmd(self, cmd, name)
+
+        proto=noneStr(cmd.elem.find('proto'))
+        rettype=noneStr(proto.text)
+        if rettype.lower()!="void ":
+            plist = ([t for t in proto.itertext()])
+            rettype = ''.join(plist[:-1])
+        rettype=rettype.strip()
+        self.outFile.write("%s %sWrapper("%(rettype, name))
+        params = cmd.elem.findall('param')
+        plist=[]
+        for param in params:
+            paramlist = ([t for t in param.itertext()])
+            paramtype = ''.join(paramlist[:-1])
+            paramname = paramlist[-1]
+            plist.append((paramtype, paramname))
+        Comma=""
+        if len(plist):
+            for ptype, pname in plist:
+                self.outFile.write("%s%s%s_"%(Comma, ptype, pname))
+                Comma=", "
+        else:
+            self.outFile.write("void")
 
-        for w in sorted(wrappers.keys()) :
-                funcname = prefix + w
-                print '  PRERESOLVE(PFN' + funcname.upper() + 'PROC, "' + funcname + '");'
+        self.outFile.write(")\n{\n")
 
-        print '}\n'
+        # for GL 1.0 and 1.1 functions, generate stdcall thunk wrappers which call the function directly
+        if self.OldVersion:
+            if rettype.lower()=="void":
+                self.outFile.write("  %s( "%(name))
+            else:
+                self.outFile.write("  return %s( "%(name))
 
-#
-# now emit the wrappers
-# for GL 1.0 and 1.1 functions, generate stdcall wrappers which call the function directly
-# for GL 1.2+ functions, generate wrappers which use wglGetProcAddress()
-#
+            Comma=""
+            for ptype, pname in plist:
+                self.outFile.write("%s%s_"%(Comma, pname))
+                Comma=", "
 
-for w in sorted(wrappers.keys()) :
-
-        funcname = prefix + w
-        returntype = wrappers[w]['return']
-        if returntype != 'void' :
-                returntype = typemap[returntype]
-
-        # Avoid generating wrappers which aren't referenced by the dispatch table
-        if dispatchheader and not dispatch.has_key(w) :
-                print '/* No wrapper for ' + funcname + ', not in dispatch table */'
-                continue
-
-        # manufacture arglist
-        # if no param attributes were found, it should be 'void'
-        al = []
-        for k in sorted(wrappers[w].keys()) :
-                if k.startswith('param') :
-                        l = wrappers[w][k].split()
-
-                        # near and far might be reserved words or macros so can't be used as formal parameter names
-                        l[0] = l[0].replace('near','zNear')
-                        l[0] = l[0].replace('far','zFar')
-
-                        if l[2] == 'in' :
-                                if l[3] == 'array' :
-                                        arg = 'const ' + typemap[l[1]] + ' *' + l[0]
-                                else :
-                                        arg = typemap[l[1]] + ' ' + l[0]
-                        elif l[2] == 'out' :
-                                arg = typemap[l[1]] + ' *' + l[0]
-
-                        al.append(arg)
-
-        if len(al) == 0 :
-                arglist = 'void'
+        # for GL 1.2+ functions, generate wrappers which use wglGetProcAddress()
         else:
-                arglist  = ', '.join(al)
-
-        if wrappers[w]['category'].startswith('VERSION_1_0') or wrappers[w]['category'].startswith('VERSION_1_1') :
-                if staticwrappers :
-                        print 'static',
-                print returntype + ' ' + funcname + 'Wrapper(' + arglist + ')'
-                print '{'
-                print '  if (glxWinDebugSettings.enable' + prefix.upper() + 'callTrace) ErrorF("'+ funcname + '\\n");'
-                print '  glWinDirectProcCalls++;'
-                if returntype.lower() == 'void' :
-                        print '  ' +  funcname + '(',
-                else :
-                        print ' /* returntype was ' + returntype.lower() + '*/'
-                        print '  return ' +  funcname + '(',
-
-                if arglist != 'void' :
-                        print wrappers[w]['arglist_use'],
-
-                print ');'
-                print "}\n"
+            if rettype.lower()=="void":
+                self.outFile.write('  RESOLVE(PFN%sPROC, "%s");\n'%(name.upper(), name))
+                self.outFile.write("  RESOLVED_PROC(PFN%sPROC)( """%(name.upper()))
+            else:
+                self.outFile.write('  RESOLVE_RET(PFN%sPROC, "%s", FALSE);\n'%(name.upper(), name))
+                self.outFile.write("  return RESOLVED_PROC(PFN%sPROC)("%(name.upper()))
+
+            Comma=""
+            for ptype, pname in plist:
+                self.outFile.write("%s%s_"%(Comma, pname))
+                Comma=", "
+        self.outFile.write(" );\n}\n\n")
+
+class ThunkDefsOutputGenerator(OutputGenerator):
+    def __init__(self,
+                 errFile = sys.stderr,
+                 warnFile = sys.stderr,
+                 diagFile = sys.stdout):
+        OutputGenerator.__init__(self, errFile, warnFile, diagFile)
+    def beginFile(self, genOpts):
+        self.outFile.write("EXPORTS\n"); # this must be the first line for libtool to realize this is a .def file
+        self.outFile.write('; Automatically generated from %s - DO NOT EDIT\n\n'%regFilename)
+    def endFile(self):
+        pass
+    def beginFeature(self, interface, emit):
+        OutputGenerator.beginFeature(self, interface, emit)
+    def endFeature(self):
+        OutputGenerator.endFeature(self)
+    def genType(self, typeinfo, name):
+        OutputGenerator.genType(self, typeinfo, name)
+    def genEnum(self, enuminfo, name):
+        OutputGenerator.genEnum(self, enuminfo, name)
+    def genCmd(self, cmd, name):
+        OutputGenerator.genCmd(self, cmd, name)
+
+        # export the wrapper function with the name of the function it wraps
+        self.outFile.write("%s = %sWrapper\n"%(name, name))
+
+class ShimOutputGenerator(OutputGenerator):
+    def __init__(self,
+                 errFile = sys.stderr,
+                 warnFile = sys.stderr,
+                 diagFile = sys.stdout):
+        OutputGenerator.__init__(self, errFile, warnFile, diagFile)
+    def beginFile(self, genOpts):
+        self.outFile.write('/* Automatically generated from %s - DO NOT EDIT */\n\n'%regFilename)
+    def endFile(self):
+        pass
+    def beginFeature(self, interface, emit):
+        OutputGenerator.beginFeature(self, interface, emit)
+        self.OldVersion = self.featureName.startswith('GL_VERSION_1_0') or self.featureName.startswith('GL_VERSION_1_1') or self.featureName.startswith('GL_VERSION_1_2') or self.featureName.startswith('GL_ARB_imaging') or self.featureName.startswith('GL_ARB_multitexture') or self.featureName.startswith('GL_ARB_texture_compression')
+    def endFeature(self):
+        OutputGenerator.endFeature(self)
+    def genType(self, typeinfo, name):
+        OutputGenerator.genType(self, typeinfo, name)
+    def genEnum(self, enuminfo, name):
+        OutputGenerator.genEnum(self, enuminfo, name)
+    def genCmd(self, cmd, name):
+        OutputGenerator.genCmd(self, cmd, name)
+
+        if not self.OldVersion:
+            return
+
+        # for GL functions which are in the ABI, generate a shim which calls the function via GetProcAddress
+        proto=noneStr(cmd.elem.find('proto'))
+        rettype=noneStr(proto.text)
+        if rettype.lower()!="void ":
+            plist = ([t for t in proto.itertext()])
+            rettype = ''.join(plist[:-1])
+        rettype=rettype.strip()
+        self.outFile.write("%s %s("%(rettype, name))
+        params = cmd.elem.findall('param')
+        plist=[]
+        for param in params:
+            paramlist = ([t for t in param.itertext()])
+            paramtype = ''.join(paramlist[:-1])
+            paramname = paramlist[-1]
+            plist.append((paramtype, paramname))
+        Comma=""
+        if len(plist):
+            for ptype, pname in plist:
+                self.outFile.write("%s%s%s_"%(Comma, ptype, pname))
+                Comma=", "
         else:
-                if staticwrappers :
-                        print 'static',
-                print returntype + ' ' + funcname + 'Wrapper(' + arglist + ')'
-                print '{'
+            self.outFile.write("void")
 
-                stringname = funcname
+        self.outFile.write(")\n{\n")
 
-#
-# special case: Windows OpenGL implementations are far more likely to have GL_ARB_window_pos than GL_MESA_window_pos,
-# so arrange for the wrapper to use the ARB strings to find functions...
-#
+        self.outFile.write('  typedef %s (* PFN%sPROC)(' % (rettype, name.upper()))
 
-                m2 = r3.search(funcname)
-                if m2 :
-                        stringname = stringname.replace('MESA','ARB')
+        if len(plist):
+            Comma=""
+            for ptype, pname in plist:
+                self.outFile.write("%s %s %s_"%(Comma, ptype, pname))
+                Comma=", "
+        else:
+            self.outFile.write("void")
 
-#
-# special case: likewise, implementations are more likely to have GL_ARB_vertex_program than GL_NV_vertex_program,
-# especially if they are not NV implementations, so arrange for the wrapper to use ARB strings to find functions
-#
+        self.outFile.write(');\n')
 
-                m3 = r4.search(funcname)
-                if m3 :
-                        stringname = stringname.replace('NV','ARB')
-                m4 = r5.search(funcname)
-                if m4 :
-                        stringname = stringname.replace('NV','ARB')
-
-                pfntypename = 'PFN' + funcname.upper() + 'PROC'
-
-                if returntype.lower() == 'void' :
-                        print '  RESOLVE(' + pfntypename + ', "' + stringname + '");'
-                        print '  if (glxWinDebugSettings.enable' + prefix.upper() + 'callTrace) ErrorF("'+ funcname + '\\n");'
-                        print '  RESOLVED_PROC(' + pfntypename + ')(',
-                else :
-                        print '  RESOLVE_RET(' + pfntypename + ', "' + stringname + '", FALSE);'
-                        print '  if (glxWinDebugSettings.enable' + prefix.upper() + 'callTrace) ErrorF("'+ funcname + '\\n");'
-                        print '  return RESOLVED_PROC(' + pfntypename + ')(',
-
-                if arglist != 'void' :
-                        print wrappers[w]['arglist_use'],
-
-                print ');'
-                print "}\n"
-
-
-# generate function to setup the dispatch table, which sets each
-# dispatch table entry to point to it's wrapper function
-# (assuming we were able to make one)
-
-if dispatchheader :
-        print 'void glWinSetupDispatchTable(void)'
-        print '{'
-        print '  static struct _glapi_table *disp = NULL;'
-        print ''
-        print '  if (!disp)'
-        print '    {'
-        print '      disp = calloc(sizeof(void *), _glapi_get_dispatch_table_size());'
-        print '      assert(disp);'
-
-        for d in sorted(dispatch.keys()) :
-                if wrappers.has_key(d) :
-                        print '      SET_'+ d + '(disp, (void *)' + prefix + d + 'Wrapper);'
-                else :
-                        print '#warning  No wrapper for ' + prefix + d + ' !'
-
-        print '    }'
-        print ''
-        print '  _glapi_set_dispatch(disp);'
-        print '}'
+        if rettype.lower()=="void":
+            self.outFile.write('  RESOLVE(PFN%sPROC, "%s");\n'%(name.upper(), name))
+            self.outFile.write('  RESOLVED_PROC(')
+        else:
+            self.outFile.write('  RESOLVE_RET(PFN%sPROC, "%s", 0);\n'%(name.upper(), name))
+            self.outFile.write('  return RESOLVED_PROC(')
+
+        Comma=""
+        for ptype, pname in plist:
+            self.outFile.write("%s%s_"%(Comma, pname))
+            Comma=", "
+
+        self.outFile.write(" );\n}\n\n")
+
+def genHeaders():
+    outFile = open(outFilename,"w")
+
+    if preresolve:
+        gen = PreResolveOutputGenerator(errFile=errWarn,
+                                        warnFile=errWarn,
+                                        diagFile=diag)
+        gen.outFile=outFile
+        reg.setGenerator(gen)
+        reg.apiGen(genOpts)
+
+    if wrapper:
+        gen = WrapperOutputGenerator(errFile=errWarn,
+                                     warnFile=errWarn,
+                                     diagFile=diag)
+        gen.outFile=outFile
+        reg.setGenerator(gen)
+        reg.apiGen(genOpts)
+
+    if shim:
+        gen = ShimOutputGenerator(errFile=errWarn,
+                                  warnFile=errWarn,
+                                  diagFile=diag)
+        gen.outFile=outFile
+        reg.setGenerator(gen)
+        reg.apiGen(genOpts)
+
+    if thunk:
+        gen = ThunkOutputGenerator(errFile=errWarn,
+                                   warnFile=errWarn,
+                                   diagFile=diag)
+        gen.outFile=outFile
+        reg.setGenerator(gen)
+        reg.apiGen(genOpts)
+
+
+    if thunkdefs:
+        gen = ThunkDefsOutputGenerator(errFile=errWarn,
+                                       warnFile=errWarn,
+                                       diagFile=diag)
+        gen.outFile=outFile
+        reg.setGenerator(gen)
+        reg.apiGen(genOpts)
+
+    outFile.close()
+
+genHeaders()
diff --git a/hw/xwin/glx/glshim.c b/hw/xwin/glx/glshim.c
new file mode 100644 (file)
index 0000000..7109196
--- /dev/null
@@ -0,0 +1,124 @@
+/*
+ * File: glshim.c
+ * Purpose: GL shim which redirects to a specified DLL
+ *
+ * Copyright (c) Jon TURNEY 2013
+ *
+ * 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 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 ABOVE LISTED COPYRIGHT HOLDER(S) 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.
+ */
+
+/*
+   A GL shim which redirects to a specified DLL
+
+   XWin is statically linked with this, rather than the system libGL, so that
+   GL calls can be directed to mesa cygGL-1.dll, or cygnativeGLthunk.dll
+   (which contains cdecl-to-stdcall thunks to the native openGL32.dll)
+*/
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+
+#define GL_GLEXT_LEGACY
+#include <GL/gl.h>
+#undef GL_ARB_imaging
+#undef GL_VERSION_1_3
+#include <GL/glext.h>
+
+#include <X11/Xwindows.h>
+#include <os.h>
+#include "glwindows.h"
+#include <glx/glxserver.h>
+
+static HMODULE hMod = NULL;
+
+/*
+  Implement the __glGetProcAddress function by just using GetProcAddress() on the selected DLL
+*/
+void *glXGetProcAddressARB(const char *symbol)
+{
+    void *proc;
+
+    /* Default to the mesa GL implementation if one hasn't been selected yet */
+    if (!hMod)
+        glWinSelectImplementation(0);
+
+    proc = GetProcAddress(hMod, symbol);
+
+    if (glxWinDebugSettings.enableGLcallTrace)
+        ErrorF("glXGetProcAddressARB: Resolved '%s' in %p to %p\n", symbol, hMod, proc);
+
+    return proc;
+}
+
+/*
+  Select a GL implementation DLL
+*/
+int glWinSelectImplementation(int native)
+{
+    const char *dllname;
+
+    if (native) {
+        dllname = "cygnativeGLthunk.dll";
+    }
+    else {
+        dllname = "cygGL-1.dll";
+    }
+
+    hMod = LoadLibraryEx(dllname, NULL, 0);
+    if (hMod == NULL) {
+        ErrorF("glWinSelectGLimplementation: Could not load '%s'\n", dllname);
+        return -1;
+    }
+
+    ErrorF("glWinSelectGLimplementation: Loaded '%s'\n", dllname);
+
+    /* Connect __glGetProcAddress() to our implementation of glXGetProcAddressARB() above */
+    __glXsetGetProcAddress((glx_gpa_proc)glXGetProcAddressARB);
+
+    return 0;
+}
+
+#define RESOLVE_RET(proctype, symbol, retval) \
+    proctype proc = (proctype)glXGetProcAddressARB(symbol);   \
+    if (proc == NULL) return retval;
+
+#define RESOLVE(proctype, symbol) RESOLVE_RET(proctype, symbol,)
+#define RESOLVED_PROC proc
+
+/* Include generated shims for direct linkage to GL functions which are in the ABI */
+#include "generated_gl_shim.c"
+
+/*
+  Special wrapper for glAddSwapHintRectWIN for copySubBuffers
+
+  Only used with native GL if the GL_WIN_swap_hint extension is present, so we enable
+  GLX_MESA_copy_sub_buffer
+*/
+typedef void (__stdcall * PFNGLADDSWAPHINTRECTWIN) (GLint x, GLint y,
+                                                    GLsizei width,
+                                                    GLsizei height);
+
+void
+glAddSwapHintRectWINWrapper(GLint x, GLint y, GLsizei width,
+                            GLsizei height)
+{
+    RESOLVE(PFNGLADDSWAPHINTRECTWIN, "glAddSwapHintRectWIN");
+    RESOLVED_PROC(x, y, width, height);
+}
similarity index 54%
rename from hw/xwin/glx/glwrap.c
rename to hw/xwin/glx/glthunk.c
index 690b829..d49fe48 100644 (file)
@@ -1,13 +1,8 @@
 /*
- * File: glwrap.c
- * Purpose: Wrapper functions for Win32 OpenGL functions
- *
- * Authors: Alexander Gottwald
- *          Jon TURNEY
- *
- * Copyright (c) Jon TURNEY 2009
- * Copyright (c) Alexander Gottwald 2004
+ * File: glthunk.c
+ * Purpose: cdecl thunk wrapper library for Win32 stdcall OpenGL library
  *
+ * Copyright (c) Jon TURNEY 2009,2013
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
 #endif
 
 #include <X11/Xwindows.h>
+
+#define GL_GLEXT_LEGACY
 #include <GL/gl.h>
+#undef GL_ARB_imaging
+#undef GL_VERSION_1_3
 #include <GL/glext.h>
-#include <glx/glxserver.h>
-#include <glx/glxext.h>
-#include <glx/glapi.h>
-#include <glx/dispatch.h>
-#include <glwindows.h>
-
-static unsigned int glWinIndirectProcCalls = 0;
-static unsigned int glWinDirectProcCalls = 0;
-
-void
-glWinCallDelta(void)
-{
-    static unsigned int glWinIndirectProcCallsLast = 0;
-    static unsigned int glWinDirectProcCallsLast = 0;
-
-    if ((glWinIndirectProcCalls != glWinIndirectProcCallsLast) ||
-        (glWinDirectProcCalls != glWinDirectProcCallsLast)) {
-        if (glxWinDebugSettings.enableTrace) {
-            ErrorF("after %d direct and %d indirect GL calls\n",
-                   glWinDirectProcCalls - glWinDirectProcCallsLast,
-                   glWinIndirectProcCalls - glWinIndirectProcCallsLast);
-        }
-        glWinDirectProcCallsLast = glWinDirectProcCalls;
-        glWinIndirectProcCallsLast = glWinIndirectProcCalls;
-    }
-}
 
 static PROC
-glWinResolveHelper(PROC * cache, char *symbol)
+glWinResolveHelper(PROC * cache, const char *symbol)
 {
     PROC proc = NULL;
 
@@ -75,11 +48,9 @@ glWinResolveHelper(PROC * cache, char *symbol)
     if ((*cache) == NULL) {
         proc = wglGetProcAddress(symbol);
         if (proc == NULL) {
-            ErrorF("glwrap: Can't resolve \"%s\"\n", symbol);
             (*cache) = (PROC) - 1;
         }
         else {
-            ErrorF("glwrap: Resolved \"%s\"\n", symbol);
             (*cache) = proc;
         }
     }
@@ -99,10 +70,8 @@ glWinResolveHelper(PROC * cache, char *symbol)
     static PROC cache = NULL; \
     __stdcall proctype proc = (proctype)glWinResolveHelper(&cache, symbol); \
     if (proc == NULL) { \
-        __glXErrorCallBack(0); \
         return retval; \
-    } \
-    glWinIndirectProcCalls++;
+    }
 
 #define RESOLVE(proctype, symbol) RESOLVE_RET(proctype, symbol,)
 
@@ -113,34 +82,6 @@ glWinResolveHelper(PROC * cache, char *symbol)
 
   OpenGL 1.2 and upward is treated as extensions, function address must
   found using wglGetProcAddress(), but also stdcall so still need wrappers...
-
-  Include generated dispatch table setup function
 */
 
-#include "generated_gl_wrappers.c"
-
-/*
-  Special non-static wrapper for glGetString for debug output
-*/
-
-const GLubyte *
-glGetStringWrapperNonstatic(GLenum name)
-{
-    return glGetString(name);
-}
-
-/*
-  Special non-static wrapper for glAddSwapHintRectWIN for copySubBuffers
-*/
-
-typedef void (__stdcall * PFNGLADDSWAPHINTRECTWIN) (GLint x, GLint y,
-                                                    GLsizei width,
-                                                    GLsizei height);
-
-void
-glAddSwapHintRectWINWrapperNonstatic(GLint x, GLint y, GLsizei width,
-                                     GLsizei height)
-{
-    RESOLVE(PFNGLADDSWAPHINTRECTWIN, "glAddSwapHintRectWIN");
-    proc(x, y, width, height);
-}
+#include "generated_gl_thunks.c"
index ec1d1f5..4f859b4 100644 (file)
@@ -42,12 +42,9 @@ typedef struct {
 
 extern glxWinDebugSettingsRec glxWinDebugSettings;
 
-void glWinCallDelta(void);
 void glxWinPushNativeProvider(void);
-const GLubyte *glGetStringWrapperNonstatic(GLenum name);
-void glAddSwapHintRectWINWrapperNonstatic(GLint x, GLint y, GLsizei width,
-                                          GLsizei height);
-void glWinSetupDispatchTable(void);
+void glAddSwapHintRectWINWrapper(GLint x, GLint y, GLsizei width, GLsizei height);
+int glWinSelectImplementation(int native);
 
 #if 1
 #define GLWIN_TRACE_MSG(msg, args...) if (glxWinDebugSettings.enableTrace) ErrorF(msg " [%s:%d]\n" , ##args , __FUNCTION__, __LINE__ )
index 97b6045..9bfaac0 100644 (file)
@@ -86,6 +86,7 @@
 
 #include <winpriv.h>
 #include <wgl_ext_api.h>
+#include <winglobals.h>
 
 #define NUM_ELEMENTS(x) (sizeof(x)/ sizeof(x[1]))
 
@@ -223,7 +224,7 @@ glxWinErrorMessage(void)
     if (!FormatMessage
         (FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS |
          FORMAT_MESSAGE_MAX_WIDTH_MASK, NULL, last_error, 0,
-         (LPTSTR) & errorbuffer, sizeof(errorbuffer), NULL)) {
+         (LPTSTR) &errorbuffer, sizeof(errorbuffer), NULL)) {
         snprintf(errorbuffer, sizeof(errorbuffer), "Unknown error");
     }
 
@@ -341,6 +342,10 @@ swap_method_name(int mthd)
 static void
 fbConfigsDump(unsigned int n, __GLXconfig * c)
 {
+    LogMessage(X_INFO, "%d fbConfigs\n", n);
+
+    if (g_iLogVerbose < 3)
+        return;
     ErrorF("%d fbConfigs\n", n);
     ErrorF
         ("pxf vis  fb                      render         Ste                     aux    accum        MS    drawable             Group/\n");
@@ -381,7 +386,9 @@ fbConfigsDump(unsigned int n, __GLXconfig * c)
                c->accumAlphaBits, c->sampleBuffers, c->samples,
                (c->drawableType & GLX_WINDOW_BIT) ? "y" : ".",
                (c->drawableType & GLX_PIXMAP_BIT) ? "y" : ".",
-               (c->drawableType & GLX_PBUFFER_BIT) ? "y" : ".", ".",
+               (c->drawableType & GLX_PBUFFER_BIT) ? "y" : ".",
+               (c->renderType & (GLX_RGBA_FLOAT_BIT_ARB |
+                   GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT)) ? "y" : ".",
                (c->transparentPixel != GLX_NONE_EXT) ? "y" : ".",
                c->visualSelectGroup,
                (c->visualRating == GLX_SLOW_VISUAL_EXT) ? "*" : " ");
@@ -543,7 +550,9 @@ glxWinScreenProbe(ScreenPtr pScreen)
     if (NULL == screen)
         return NULL;
 
-    /* Dump out some useful information about the native renderer */
+    // Select the native GL implementation (WGL)
+    if (glWinSelectImplementation(1))
+        return NULL;
 
     // create window class
 #define WIN_GL_TEST_WINDOW_CLASS "XWinGLTest"
@@ -590,22 +599,26 @@ glxWinScreenProbe(ScreenPtr pScreen)
     // (but we need to have a current context for them to be resolvable)
     wglResolveExtensionProcs();
 
-    ErrorF("GL_VERSION:     %s\n", glGetStringWrapperNonstatic(GL_VERSION));
-    ErrorF("GL_VENDOR:      %s\n", glGetStringWrapperNonstatic(GL_VENDOR));
-    gl_renderer = (const char *) glGetStringWrapperNonstatic(GL_RENDERER);
+    /* Dump out some useful information about the native renderer */
+    ErrorF("GL_VERSION:     %s\n", glGetString(GL_VERSION));
+    ErrorF("GL_VENDOR:      %s\n", glGetString(GL_VENDOR));
+    gl_renderer = (const char *) glGetString(GL_RENDERER);
     ErrorF("GL_RENDERER:    %s\n", gl_renderer);
-    gl_extensions = (const char *) glGetStringWrapperNonstatic(GL_EXTENSIONS);
-    glxLogExtensions("GL_EXTENSIONS:  ", gl_extensions);
+    gl_extensions = (const char *) glGetString(GL_EXTENSIONS);
     wgl_extensions = wglGetExtensionsStringARBWrapper(hdc);
     if (!wgl_extensions)
         wgl_extensions = "";
-    glxLogExtensions("WGL_EXTENSIONS: ", wgl_extensions);
+
+    if (g_iLogVerbose >= 3) {
+        glxLogExtensions("GL_EXTENSIONS:  ", gl_extensions);
+        glxLogExtensions("WGL_EXTENSIONS: ", wgl_extensions);
+    }
 
     if (strcasecmp(gl_renderer, "GDI Generic") == 0) {
         free(screen);
         LogMessage(X_ERROR,
                    "AIGLX: Won't use generic native renderer as it is not accelerated\n");
-        return NULL;
+        goto error;
     }
 
     // Can you see the problem here?  The extensions string is DC specific
@@ -716,7 +729,7 @@ glxWinScreenProbe(ScreenPtr pScreen)
             free(screen);
             LogMessage(X_ERROR,
                        "AIGLX: No fbConfigs could be made from native OpenGL pixel formats\n");
-            return NULL;
+            goto error;
         }
 
         /* These will be set by __glXScreenInit */
@@ -779,6 +792,13 @@ glxWinScreenProbe(ScreenPtr pScreen)
     pScreen->CopyWindow = glxWinCopyWindow;
 
     return &screen->base;
+
+ error:
+    // Something went wrong and we can't use the native GL implementation
+    // so make sure the mesa GL implementation is selected instead
+    glWinSelectImplementation(0);
+
+    return NULL;
 }
 
 /* ---------------------------------------------------------------------- */
@@ -812,7 +832,7 @@ glxWinCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
 
     GLWIN_TRACE_MSG("glxWinCopyWindow pWindow %p", pWindow);
 
-    dixLookupResourceByType((pointer) &pGlxDraw, pWindow->drawable.id,
+    dixLookupResourceByType((void *) &pGlxDraw, pWindow->drawable.id,
                             __glXDrawableRes, NullClient, DixUnknownAccess);
 
     /*
@@ -900,7 +920,7 @@ static void
 glxWinDrawableCopySubBuffer(__GLXdrawable * drawable,
                             int x, int y, int w, int h)
 {
-    glAddSwapHintRectWINWrapperNonstatic(x, y, w, h);
+    glAddSwapHintRectWINWrapper(x, y, w, h);
     glxWinDrawableSwapBuffers(NULL, drawable);
 }
 
@@ -909,17 +929,6 @@ glxWinDrawableDestroy(__GLXdrawable * base)
 {
     __GLXWinDrawable *glxPriv = (__GLXWinDrawable *) base;
 
-    if (glxPriv->drawContext &&
-        (__glXLastContext == &((glxPriv->drawContext)->base))) {
-        // if this context is current and has unflushed commands, say we have flushed them
-        // (don't actually flush them, the window is going away anyhow, and an implict flush occurs
-        // on the next context change)
-        // (GLX core considers it an error when we try to select a new current context if the old one
-        // has unflushed commands, but the window has disappeared..)
-        __glXLastContext->hasUnflushedCommands = FALSE;
-        __glXLastContext = NULL;
-    }
-
     if (glxPriv->hPbuffer)
         if (!wglDestroyPbufferARBWrapper(glxPriv->hPbuffer)) {
             ErrorF("wglDestroyPbufferARB failed: %s\n", glxWinErrorMessage());
@@ -1362,7 +1371,7 @@ glxWinDeferredCreateContext(__GLXWinContext * gc, __GLXWinDrawable * draw)
             }
 
             draw->hDIB =
-                CreateDIBSection(draw->dibDC, (BITMAPINFO *) & bmpHeader,
+                CreateDIBSection(draw->dibDC, (BITMAPINFO *) &bmpHeader,
                                  DIB_RGB_COLORS, &pBits, 0, 0);
             if (draw->dibDC == NULL) {
                 ErrorF("CreateDIBSection error: %s\n", glxWinErrorMessage());
@@ -1448,7 +1457,6 @@ glxWinContextMakeCurrent(__GLXcontext * base)
 
     GLWIN_TRACE_MSG("glxWinContextMakeCurrent context %p (native ctx %p)", gc,
                     gc->ctx);
-    glWinCallDelta();
 
     /* Keep a note of the last active context in the drawable */
     drawPriv = gc->base.drawPriv;
@@ -1518,13 +1526,12 @@ glxWinContextLoseCurrent(__GLXcontext * base)
 
     GLWIN_TRACE_MSG("glxWinContextLoseCurrent context %p (native ctx %p)", gc,
                     gc->ctx);
-    glWinCallDelta();
 
     /*
        An error seems to be reported if we try to make no context current
        if there is already no current context, so avoid doing that...
      */
-    if (__glXLastContext != NULL) {
+    if (wglGetCurrentContext() != NULL) {
         ret = wglMakeCurrent(NULL, NULL);       /* We don't need a DC when setting no current context */
         if (!ret)
             ErrorF("glxWinContextLoseCurrent error: %s\n",
@@ -1595,7 +1602,7 @@ glxWinCreateContext(__GLXscreen * screen,
         glxWinReleaseTexImage
     };
 
-    context = (__GLXWinContext *) calloc(1, sizeof(__GLXWinContext));
+    context = calloc(1, sizeof(__GLXWinContext));
 
     if (!context)
         return NULL;
@@ -1613,8 +1620,6 @@ glxWinCreateContext(__GLXscreen * screen,
     context->ctx = NULL;
     context->shareContext = shareContext;
 
-    glWinSetupDispatchTable();
-
     GLWIN_DEBUG_MSG("GLXcontext %p created", context);
 
     return &(context->base);
@@ -1626,15 +1631,15 @@ glxWinCreateContext(__GLXscreen * screen,
  */
 
 static int
-GetShift(int Mask)
+GetShift(int mask)
 {
-    int Shift = 0;
+    int shift = 0;
 
-    while ((Mask &1) == 0) {
-        Shift++;
-        Mask >>=1;
+    while ((mask &1) == 0) {
+        shift++;
+        mask >>=1;
     }
-    return Shift;
+    return shift;
 }
 
 static int
@@ -1707,7 +1712,6 @@ fbConfigToPixelFormat(__GLXconfig * mode, PIXELFORMATDESCRIPTOR * pfdret,
     pfd.cAuxBuffers = mode->numAuxBuffers;
 
     /* mode->level ? */
-    /* mode->pixmapMode ? */
 
     *pfdret = pfd;
 
@@ -1835,8 +1839,8 @@ glxWinCreateConfigs(HDC hdc, glxWinScreen * screen)
     // get the number of pixelformats
     numConfigs =
         DescribePixelFormat(hdc, 1, sizeof(PIXELFORMATDESCRIPTOR), NULL);
-    GLWIN_DEBUG_MSG("DescribePixelFormat says %d possible pixel formats",
-                    numConfigs);
+    LogMessage(X_INFO, "%d pixel formats reported by DescribePixelFormat\n",
+               numConfigs);
 
     /* alloc */
     result = malloc(sizeof(GLXWinConfig) * numConfigs);
@@ -1917,7 +1921,6 @@ glxWinCreateConfigs(HDC hdc, glxWinScreen * screen)
         // pfd.dwLayerMask; // ignored
         // pfd.dwDamageMask;  // ignored
 
-        c->base.pixmapMode = 0;
         c->base.visualID = -1;  // will be set by __glXScreenInit()
 
         /* EXT_visual_rating / GLX 1.2 */
@@ -2008,15 +2011,13 @@ glxWinCreateConfigs(HDC hdc, glxWinScreen * screen)
         else
             c->base.swapMethod = GLX_SWAP_UNDEFINED_OML;
 
-        /* EXT_import_context */
-        c->base.screen = screen->base.pScreen->myNum;
-
         /* EXT_texture_from_pixmap */
         c->base.bindToTextureRgb = -1;
         c->base.bindToTextureRgba = -1;
         c->base.bindToMipmapTexture = -1;
         c->base.bindToTextureTargets = -1;
         c->base.yInverted = -1;
+        c->base.sRGBCapable = 0;
 
         n++;
 
@@ -2083,9 +2084,9 @@ glxWinCreateConfigsExt(HDC hdc, glxWinScreen * screen)
         return;
     }
 
-    GLWIN_DEBUG_MSG
-        ("wglGetPixelFormatAttribivARB says %d possible pixel formats",
-         numConfigs);
+    LogMessage(X_INFO,
+               "%d pixel formats reported by wglGetPixelFormatAttribivARB\n",
+               numConfigs);
 
     /* alloc */
     result = malloc(sizeof(GLXWinConfig) * numConfigs);
@@ -2254,7 +2255,6 @@ glxWinCreateConfigsExt(HDC hdc, glxWinScreen * screen)
         }
         c->base.level = 0;
 
-        c->base.pixmapMode = 0; // ???
         c->base.visualID = -1;  // will be set by __glXScreenInit()
 
         /* EXT_visual_rating / GLX 1.2 */
@@ -2387,9 +2387,6 @@ glxWinCreateConfigsExt(HDC hdc, glxWinScreen * screen)
             c->base.swapMethod = GLX_SWAP_UNDEFINED_OML;
         }
 
-        /* EXT_import_context */
-        c->base.screen = screen->base.pScreen->myNum;
-
         /* EXT_texture_from_pixmap */
         /*
            Mesa's DRI configs always have bindToTextureRgb/Rgba TRUE (see driCreateConfigs(), so setting
@@ -2411,6 +2408,7 @@ glxWinCreateConfigsExt(HDC hdc, glxWinScreen * screen)
             GLX_TEXTURE_1D_BIT_EXT | GLX_TEXTURE_2D_BIT_EXT |
             GLX_TEXTURE_RECTANGLE_BIT_EXT;
         c->base.yInverted = -1;
+        c->base.sRGBCapable = 0;
 
         n++;
 
index dbadad6..c71f6a1 100644 (file)
@@ -121,14 +121,16 @@ Alternative name for \fB\-resize=scrollbars\fP.
 .SH OPTIONS CONTROLLING RESIZE BEHAVIOUR
 .TP 8
 .B \-resize[=none|scrollbars|randr]
-Select the resize mode of an X screen.
+Select the resize mode of an X screen. The default is randr.
 
 .RS
 .IP \fB\-resize=none\fP 8
-(default). The screen is not resizable.
+The screen is not resizable.
 
 In windowed mode, if the window has decorations, a fixed frame is used.
 
+Alternative name is \fB\-noresize\fP.
+
 .IP \fB\-resize=scrollbars\fP 8
 The screen window is resizeable, but the screen is not resizable.
 
@@ -159,10 +161,16 @@ of the X screen using the RANDR extension is not permitted.
 
 The maximum dimensions of the screen are the dimensions of the \fIWindows\fP virtual desktop.
 
-.IP \fB\--resize\fP 8
-on its own is equivalent to \fB\--resize=randr\fP
+.IP \fB\-resize\fP 8
+on its own is equivalent to \fB\-resize=randr\fP
 .RE
 
+.SH OPTIONS FOR MULTIWINDOW MODE
+.TP 8
+.B \-hostintitle
+Add the host name to the window title for X applications which are running
+on remote hosts, when that information is available and it's useful to do so.
+
 .SH OPTIONS CONTROLLING WINDOWS INTEGRATION
 .TP 8
 .B \-[no]clipboard
@@ -211,7 +219,7 @@ is disabled by default.
 .TP 8
 .B \-[no]wgl
 Enable [disable] the GLX extension to use the native Windows WGL interface
-for hardware accelerated OpenGL (AIGLX). (Experimental)
+for hardware accelerated OpenGL (AIGLX). The default is enabled.
 .TP 8
 .B \-[no]winkill
 Enable or disable the \fIAlt-F4\fP key combination as a signal to exit the
diff --git a/hw/xwin/propertystore.h b/hw/xwin/propertystore.h
new file mode 100644 (file)
index 0000000..6afc6c9
--- /dev/null
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) 2011 Tobias Häußler
+ *
+ * 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 PROPERTYSTORE_H
+#define PROPERTYSTORE_H
+
+#include <windows.h>
+
+#ifdef __MINGW64_VERSION_MAJOR
+/* If we are using headers from mingw-w64 project, it provides the PSDK headers this needs ... */
+#include <propkey.h>
+#include <propsys.h>
+#else /*  !__MINGW64_VERSION_MAJOR */
+/* ... otherwise, we need to define all this stuff ourselves */
+
+typedef struct _tagpropertykey {
+    GUID fmtid;
+    DWORD pid;
+} PROPERTYKEY;
+
+#define REFPROPERTYKEY const PROPERTYKEY *
+#define REFPROPVARIANT const PROPVARIANT *
+
+WINOLEAPI PropVariantClear(PROPVARIANT *pvar);
+
+#ifdef INTERFACE
+#undef INTERFACE
+#endif
+
+#define INTERFACE IPropertyStore
+DECLARE_INTERFACE_(IPropertyStore, IUnknown)
+{
+    STDMETHOD(QueryInterface) (THIS_ REFIID, PVOID *) PURE;
+    STDMETHOD_(ULONG, AddRef) (THIS) PURE;
+    STDMETHOD_(ULONG, Release) (THIS) PURE;
+    STDMETHOD(GetCount) (THIS_ DWORD) PURE;
+    STDMETHOD(GetAt) (THIS_ DWORD, PROPERTYKEY) PURE;
+    STDMETHOD(GetValue) (THIS_ REFPROPERTYKEY, PROPVARIANT) PURE;
+    STDMETHOD(SetValue) (THIS_ REFPROPERTYKEY, REFPROPVARIANT) PURE;
+    STDMETHOD(Commit) (THIS) PURE;
+};
+
+#undef INTERFACE
+typedef IPropertyStore *LPPROPERTYSTORE;
+
+DEFINE_GUID(IID_IPropertyStore, 0x886d8eeb, 0x8cf2, 0x4446, 0x8d, 0x02, 0xcd,
+            0xba, 0x1d, 0xbd, 0xcf, 0x99);
+
+#ifdef INITGUID
+#define DEFINE_PROPERTYKEY(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8, pid) GUID_EXT const PROPERTYKEY DECLSPEC_SELECTANY name = { { l, w1, w2, { b1, b2,  b3,  b4,  b5,  b6,  b7,  b8 } }, pid }
+#else
+#define DEFINE_PROPERTYKEY(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8, pid) GUID_EXT const PROPERTYKEY name
+#endif
+
+DEFINE_PROPERTYKEY(PKEY_AppUserModel_ID, 0x9F4C2855, 0x9F79, 0x4B39, 0xA8, 0xD0,
+                   0xE1, 0xD4, 0x2D, 0xE1, 0xD5, 0xF3, 5);
+
+#endif /* !__MINGW64_VERSION_MAJOR */
+
+typedef HRESULT(__stdcall * SHGETPROPERTYSTOREFORWINDOWPROC) (HWND, REFIID,
+                                                              void **);
+
+#endif
index 89e2a38..a738a59 100644 (file)
 #define YES                                    1
 #endif
 
+/* We can handle WM_MOUSEHWHEEL even though _WIN32_WINNT < 0x0600 */
+#ifndef WM_MOUSEHWHEEL
+#define WM_MOUSEHWHEEL 0x020E
+#endif
+
 /* Turn debug messages on or off */
 #ifndef CYGDEBUG
 #define CYGDEBUG                               NO
 #endif
 
-/* WM_XBUTTON Messages. They should go into w32api. */
-#ifndef WM_XBUTTONDOWN
-#define WM_XBUTTONDOWN 523
-#endif
-#ifndef WM_XBUTTONUP
-#define WM_XBUTTONUP 524
-#endif
-#ifndef WM_XBUTTONDBLCLK
-#define WM_XBUTTONDBLCLK 525
-#endif
-
 #define WIN_DEFAULT_BPP                                0
 #define WIN_DEFAULT_WHITEPIXEL                 255
 #define WIN_DEFAULT_BLACKPIXEL                 0
 
 #define WIN_MAX_KEYS_PER_KEY   4
 
+#define NONAMELESSUNION
+
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <stdio.h>
 #include "micmap.h"
 #include "mifillarc.h"
 #include "mifpoly.h"
-#include "mibstore.h"
 #include "input.h"
 #include "mipointer.h"
 #include "X11/keysym.h"
@@ -249,9 +244,6 @@ if (++PROFPT##point % thresh == 0)\
 ErrorF (#point ": PROFILEPOINT hit %u times\n", PROFPT##point);\
 }
 
-/* We use xor this macro for detecting toggle key state changes */
-#define WIN_XOR(a,b) ((!(a) && (b)) || ((a) && !(b)))
-
 #define DEFINE_ATOM_HELPER(func,atom_name)                     \
 static Atom func (void) {                                      \
     static int generation;                                     \
@@ -462,6 +454,7 @@ typedef struct _winPrivScreenRec {
     Bool fBadDepth;
 
     int iDeltaZ;
+    int iDeltaV;
 
     int iConnectedClients;
 
@@ -616,7 +609,7 @@ typedef struct {
 #endif
 
 typedef struct {
-    pointer value;
+    void *value;
     XID id;
 } WindowIDPairRec, *WindowIDPairPtr;
 
@@ -758,7 +751,7 @@ Bool
  winAllocatePrivates(ScreenPtr pScreen);
 
 Bool
- winInitCmapPrivates(ColormapPtr pCmap, int index);
+ winInitCmapPrivates(ColormapPtr pCmap, int i);
 
 Bool
  winAllocateCmapPrivates(ColormapPtr pCmap);
@@ -780,7 +773,7 @@ void winSetAuthorization(void);
 void
 
 winBlockHandler(ScreenPtr pScreen,
-                pointer pTimeout, pointer pReadMask);
+                void *pTimeout, void *pReadMask);
 
 #ifdef XWIN_NATIVEGDI
 /*
@@ -858,11 +851,13 @@ void
 
 #ifdef DDXOSVERRORF
 void
- OSVenderVErrorF(const char *pszFormat, va_list va_args);
+OsVendorVErrorF(const char *pszFormat, va_list va_args)
+_X_ATTRIBUTE_PRINTF(1, 0);
 #endif
 
 void
- winMessageBoxF(const char *pszError, UINT uType, ...);
+winMessageBoxF(const char *pszError, UINT uType, ...)
+_X_ATTRIBUTE_PRINTF(1, 3);
 
 #ifdef XWIN_NATIVEGDI
 /*
@@ -921,8 +916,8 @@ void
  * winkeybd.c
  */
 
-void
- winTranslateKey(WPARAM wParam, LPARAM lParam, int *piScanCode);
+int
+ winTranslateKey(WPARAM wParam, LPARAM lParam);
 
 int
  winKeybdProc(DeviceIntPtr pDeviceInt, int iState);
@@ -986,7 +981,7 @@ int
  winMouseProc(DeviceIntPtr pDeviceInt, int iState);
 
 int
- winMouseWheel(ScreenPtr pScreen, int iDeltaZ);
+ winMouseWheel(int *iTotalDeltaZ, int iDeltaZ, int iButtonUp, int iButtonDown);
 
 void
  winMouseButtonsSendEvent(int iEventType, int iButton);
@@ -1040,7 +1035,7 @@ winModifyPixmapHeaderNativeGDI(PixmapPtr pPixmap,
                                int iWidth, int iHeight,
                                int iDepth,
                                int iBitsPerPixel,
-                               int devKind, pointer pPixData);
+                               int devKind, void *pPixData);
 #endif
 
 #ifdef XWIN_NATIVEGDI
@@ -1053,18 +1048,6 @@ void
 winPolyLineNativeGDI(DrawablePtr pDrawable,
                      GCPtr pGC, int mode, int npt, DDXPointPtr ppt);
 #endif
-
-#ifdef XWIN_NATIVEGDI
-/*
- * winpushpxl.c
- */
-
-void
-
-winPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDrawable,
-              int dx, int dy, int xOrg, int yOrg);
-#endif
-
 /*
  * winscrinit.c
  */
@@ -1073,12 +1056,12 @@ Bool
  winScreenInit(ScreenPtr pScreen, int argc, char **argv);
 
 Bool
- winFinishScreenInitFB(int index, ScreenPtr pScreen, int argc, char **argv);
+ winFinishScreenInitFB(int i, ScreenPtr pScreen, int argc, char **argv);
 
 #if defined(XWIN_NATIVEGDI)
 Bool
 
-winFinishScreenInitNativeGDI(int index,
+winFinishScreenInitNativeGDI(int i,
                              ScreenPtr pScreen, int argc, char **argv);
 #endif
 
@@ -1123,7 +1106,7 @@ Bool
 void
 
 winWakeupHandler(ScreenPtr pScreen,
-                 unsigned long ulResult, pointer pReadmask);
+                 unsigned long ulResult, void *pReadmask);
 
 /*
  * winwindow.c
@@ -1353,9 +1336,6 @@ void
  winMWExtWMMoveResizeXWindow(WindowPtr pWin, int x, int y, int w, int h);
 
 void
- winMWExtWMUpdateIcon(Window id);
-
-void
 
 winMWExtWMUpdateWindowDecoration(win32RootlessWindowPtr pRLWinPriv,
                                  winScreenInfoPtr pScreenInfo);
@@ -1415,6 +1395,12 @@ winDoRandRScreenSetSize(ScreenPtr pScreen,
                         CARD16 height, CARD32 mmWidth, CARD32 mmHeight);
 
 /*
+ * winmsgwindow.c
+ */
+Bool
+winCreateMsgWindowThread(void);
+
+/*
  * END DDX and DIX Function Prototypes
  */
 
diff --git a/hw/xwin/winSetAppUserModelID.c b/hw/xwin/winSetAppUserModelID.c
new file mode 100644 (file)
index 0000000..41615e1
--- /dev/null
@@ -0,0 +1,110 @@
+/*
+ * Copyright (C) 2011 Tobias Häußler
+ *
+ * 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.
+ */
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+
+#include <X11/Xlib.h>
+#include <X11/Xproto.h>
+#include <X11/Xwindows.h>
+#include <pthread.h>
+#include "winwindow.h"
+#include "os.h"
+#include "winmsg.h"
+
+#include <shlwapi.h>
+
+#define INITGUID
+#include "initguid.h"
+#include "propertystore.h"
+#undef INITGUID
+
+static HMODULE g_hmodShell32Dll = NULL;
+static SHGETPROPERTYSTOREFORWINDOWPROC g_pSHGetPropertyStoreForWindow = NULL;
+
+void
+winPropertyStoreInit(void)
+{
+    /*
+       Load library and get function pointer to SHGetPropertyStoreForWindow()
+
+       SHGetPropertyStoreForWindow is only supported since Windows 7. On previous
+       versions the pointer will be NULL and taskbar grouping is not supported.
+       winSetAppUserModelID() will do nothing in this case.
+     */
+    g_hmodShell32Dll = LoadLibrary("shell32.dll");
+    if (g_hmodShell32Dll == NULL) {
+        ErrorF("winPropertyStoreInit - Could not load shell32.dll\n");
+        return;
+    }
+
+    g_pSHGetPropertyStoreForWindow =
+        (SHGETPROPERTYSTOREFORWINDOWPROC) GetProcAddress(g_hmodShell32Dll,
+                                                         "SHGetPropertyStoreForWindow");
+    if (g_pSHGetPropertyStoreForWindow == NULL) {
+        ErrorF
+            ("winPropertyStoreInit - Could not get SHGetPropertyStoreForWindow address\n");
+        return;
+    }
+}
+
+void
+winPropertyStoreDestroy(void)
+{
+    if (g_hmodShell32Dll != NULL) {
+        FreeLibrary(g_hmodShell32Dll);
+        g_hmodShell32Dll = NULL;
+        g_pSHGetPropertyStoreForWindow = NULL;
+    }
+}
+
+void
+winSetAppUserModelID(HWND hWnd, const char *AppID)
+{
+    PROPVARIANT pv;
+    IPropertyStore *pps = NULL;
+    HRESULT hr;
+
+    if (g_pSHGetPropertyStoreForWindow == NULL) {
+        return;
+    }
+
+    winDebug("winSetAppUserMOdelID - hwnd 0x%08x appid '%s'\n", hWnd, AppID);
+
+    hr = g_pSHGetPropertyStoreForWindow(hWnd, &IID_IPropertyStore,
+                                        (void **) &pps);
+    if (SUCCEEDED(hr) && pps) {
+        memset(&pv, 0, sizeof(PROPVARIANT));
+        if (AppID) {
+            pv.vt = VT_LPWSTR;
+            hr = SHStrDupA(AppID, &pv.pwszVal);
+        }
+
+        if (SUCCEEDED(hr)) {
+            pps->lpVtbl->SetValue(pps, &PKEY_AppUserModel_ID, &pv);
+            PropVariantClear(&pv);
+        }
+        pps->lpVtbl->Release(pps);
+    }
+}
index ea3126f..629af92 100644 (file)
@@ -58,7 +58,7 @@ winAllocatePrivates(ScreenPtr pScreen)
     }
 
     /* Allocate memory for the screen private structure */
-    pScreenPriv = (winPrivScreenPtr) malloc(sizeof(winPrivScreenRec));
+    pScreenPriv = malloc(sizeof(winPrivScreenRec));
     if (!pScreenPriv) {
         ErrorF("winAllocateScreenPrivates - malloc () failed\n");
         return FALSE;
@@ -110,7 +110,7 @@ winAllocatePrivates(ScreenPtr pScreen)
  */
 
 Bool
-winInitCmapPrivates(ColormapPtr pcmap, int index)
+winInitCmapPrivates(ColormapPtr pcmap, int i)
 {
 #if CYGDEBUG
     winDebug("winInitCmapPrivates\n");
@@ -150,7 +150,7 @@ winAllocateCmapPrivates(ColormapPtr pCmap)
     }
 
     /* Allocate memory for our private structure */
-    pCmapPriv = (winPrivCmapPtr) malloc(sizeof(winPrivCmapRec));
+    pCmapPriv = malloc(sizeof(winPrivCmapRec));
     if (!pCmapPriv) {
         ErrorF("winAllocateCmapPrivates - malloc () failed\n");
         return FALSE;
index 25d1fbd..7efa1c0 100644 (file)
@@ -36,6 +36,7 @@
 
 /* Includes for authorization */
 #include "securitysrv.h"
+#include "os/osdep.h"
 
 /*
  * Constants
@@ -56,8 +57,7 @@ static char *g_pAuthData = NULL;
  */
 
 #ifndef XCSECURITY
-static
-    void
+void
 GenerateRandomData(int len, char *buf)
 {
     int fd;
@@ -70,9 +70,8 @@ GenerateRandomData(int len, char *buf)
 static char cookie[16];         /* 128 bits */
 
 XID
-    static
 MitGenerateCookie(unsigned data_length,
-                  char *data,
+                  const char *data,
                   XID id, unsigned *data_length_return, char **data_return)
 {
     int i = 0;
@@ -98,9 +97,9 @@ MitGenerateCookie(unsigned data_length,
 static
     XID
 GenerateAuthorization(unsigned name_length,
-                      char *name,
+                      const char *name,
                       unsigned data_length,
-                      char *data,
+                      const char *data,
                       unsigned *data_length_return, char **data_return)
 {
     return MitGenerateCookie(data_length, data,
index 480e3bd..07e9078 100644 (file)
 /* See Porting Layer Definition - p. 6 */
 void
 winBlockHandler(ScreenPtr pScreen,
-                pointer pTimeout, pointer pReadMask)
+                void *pTimeout, void *pReadMask)
 {
 #if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW)
     winScreenPriv(pScreen);
 #endif
-    MSG msg;
 
 #ifndef HAS_DEVWINDOWS
     struct timeval **tvp = pTimeout;
 
     if (*tvp != NULL) {
+      if (GetQueueStatus(QS_ALLINPUT | QS_ALLPOSTMESSAGE) != 0) {
+        /* If there are still messages to process on the Windows message
+           queue, make sure select() just polls rather than blocking.
+        */
+        (*tvp)->tv_sec = 0;
+        (*tvp)->tv_usec = 0;
+      }
+      else {
+        /* Otherwise, lacking /dev/windows, we must wake up again in
+           a reasonable time to check the Windows message queue. without
+           noticeable delay.
+         */
         (*tvp)->tv_sec = 0;
         (*tvp)->tv_usec = 100;
+      }
     }
 #endif
 
@@ -68,22 +80,19 @@ winBlockHandler(ScreenPtr pScreen,
         if (iReturn != 0) {
             ErrorF("winBlockHandler - pthread_mutex_unlock () failed: %d\n",
                    iReturn);
-            goto winBlockHandler_ProcessMessages;
         }
-
-        winDebug("winBlockHandler - pthread_mutex_unlock () returned\n");
+        else {
+            winDebug("winBlockHandler - pthread_mutex_unlock () returned\n");
+        }
     }
-
- winBlockHandler_ProcessMessages:
 #endif
 
-    /* Process all messages on our queue */
-    while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
-        if ((g_hDlgDepthChange == 0
-             || !IsDialogMessage(g_hDlgDepthChange, &msg))
-            && (g_hDlgExit == 0 || !IsDialogMessage(g_hDlgExit, &msg))
-            && (g_hDlgAbout == 0 || !IsDialogMessage(g_hDlgAbout, &msg))) {
-            DispatchMessage(&msg);
-        }
-    }
+  /*
+    At least one X client has asked to suspend the screensaver, so
+    reset Windows' display idle timer
+  */
+#ifdef SCREENSAVER
+  if (screenSaverSuspended)
+    SetThreadExecutionState(ES_DISPLAY_REQUIRED);
+#endif
 }
index 27eb2f9..cb77695 100644 (file)
@@ -66,7 +66,6 @@
 #define WIN_JMP_ERROR_IO                       2
 #define WIN_LOCAL_PROPERTY                     "CYGX_CUT_BUFFER"
 #define WIN_XEVENTS_SUCCESS                    0
-#define WIN_XEVENTS_SHUTDOWN                   1
 #define WIN_XEVENTS_CONVERT                    2
 #define WIN_XEVENTS_NOTIFY                     3
 #define WIN_CLIPBOARD_RETRIES                  40
@@ -79,7 +78,6 @@
  */
 
 extern char *display;
-extern void ErrorF(const char * /*f */ , ...);
 extern void winDebug(const char *format, ...);
 extern void winErrorFVerb(int verb, const char *format, ...);
 
@@ -100,7 +98,7 @@ void
  winClipboardDOStoUNIX(char *pszData, int iLength);
 
 void
- winClipboardUNIXtoDOS(unsigned char **ppszData, int iLength);
+ winClipboardUNIXtoDOS(char **ppszData, int iLength);
 
 /*
  * winclipboardthread.c
@@ -108,9 +106,6 @@ void
 
 void *winClipboardProc(void *);
 
-void
- winDeinitClipboard(void);
-
 /*
  * winclipboardwndproc.c
  */
index 304e6df..157006d 100644 (file)
@@ -77,7 +77,7 @@ winInitClipboard(void)
 }
 
 /*
- * Create the Windows window that we use to recieve Windows messages
+ * Create the Windows window that we use to receive Windows messages
  */
 
 HWND
index 74a351b..fd405a0 100644 (file)
@@ -38,7 +38,7 @@
 void
  winClipboardDOStoUNIX(char *pszSrc, int iLength);
 void
- winClipboardUNIXtoDOS(unsigned char **ppszData, int iLength);
+ winClipboardUNIXtoDOS(char **ppszData, int iLength);
 
 /*
  * Convert \r\n to \n
@@ -75,12 +75,12 @@ winClipboardDOStoUNIX(char *pszSrc, int iLength)
  */
 
 void
-winClipboardUNIXtoDOS(unsigned char **ppszData, int iLength)
+winClipboardUNIXtoDOS(char **ppszData, int iLength)
 {
     int iNewlineCount = 0;
-    unsigned char *pszSrc = *ppszData;
-    unsigned char *pszEnd = pszSrc + iLength;
-    unsigned char *pszDest = NULL, *pszDestBegin = NULL;
+    char *pszSrc = *ppszData;
+    char *pszEnd = pszSrc + iLength;
+    char *pszDest = NULL, *pszDestBegin = NULL;
 
     winDebug("UNIXtoDOS () - Original data:'%s'\n", *ppszData);
 
index f2e8e6d..33595be 100644 (file)
@@ -36,6 +36,7 @@
 #define HAS_WINSOCK 1
 #endif
 #include <sys/types.h>
+#include <signal.h>
 #include "winclipboard.h"
 #ifdef __CYGWIN__
 #include <errno.h>
@@ -47,7 +48,6 @@
  */
 
 extern Bool g_fUnicodeClipboard;
-extern unsigned long serverGeneration;
 extern Bool g_fClipboardStarted;
 extern Bool g_fClipboardLaunched;
 extern Bool g_fClipboard;
@@ -83,7 +83,7 @@ static int
 void *
 winClipboardProc(void *pvNotUsed)
 {
-    Atom atomClipboard, atomClipboardManager;
+    Atom atomClipboard;
     int iReturn;
     HWND hwnd = NULL;
     int iConnectionNumber = 0;
@@ -206,9 +206,8 @@ winClipboardProc(void *pvNotUsed)
     iMaxDescriptor = iConnectionNumber + 1;
 #endif
 
-    /* Create atoms */
+    /* Create atom */
     atomClipboard = XInternAtom(pDisplay, "CLIPBOARD", False);
-    atomClipboardManager = XInternAtom(pDisplay, "CLIPBOARD_MANAGER", False);
 
     /* Create a messaging window */
     iWindow = XCreateSimpleWindow(pDisplay,
@@ -326,14 +325,7 @@ winClipboardProc(void *pvNotUsed)
         /* Branch on which descriptor became active */
         if (FD_ISSET(iConnectionNumber, &fdsRead)) {
             /* Process X events */
-            /* Exit when we see that server is shutting down */
-            iReturn = winClipboardFlushXEvents(hwnd,
-                                               iWindow, pDisplay, fUseUnicode);
-            if (WIN_XEVENTS_SHUTDOWN == iReturn) {
-                ErrorF("winClipboardProc - winClipboardFlushXEvents "
-                       "trapped shutdown event, exiting main loop.\n");
-                break;
-            }
+            winClipboardFlushXEvents(hwnd, iWindow, pDisplay, fUseUnicode);
         }
 
 #ifdef HAS_DEVWINDOWS
@@ -413,7 +405,7 @@ winClipboardProc(void *pvNotUsed)
             ("winClipboardProc - the clipboard thread has restarted %d times and seems to be unstable, disabling clipboard integration\n",
              clipboardRestarts);
         g_fClipboard = FALSE;
-        return;
+        return NULL;
     }
 
     if (g_fClipboard) {
@@ -422,7 +414,7 @@ winClipboardProc(void *pvNotUsed)
         /* Create the clipboard client thread */
         if (!winInitClipboard()) {
             ErrorF("winClipboardProc - winClipboardInit failed.\n");
-            return;
+            return NULL;
         }
 
         winDebug("winClipboardProc - winInitClipboard returned.\n");
@@ -432,7 +424,7 @@ winClipboardProc(void *pvNotUsed)
     else {
         ErrorF("winClipboardProc - Clipboard disabled  - Exit from server \n");
         /* clipboard thread has exited, stop server as well */
-        kill(getpid(), SIGTERM);
+        raise(SIGTERM);
     }
 
     return NULL;
@@ -461,7 +453,7 @@ winClipboardErrorHandler(Display * pDisplay, XErrorEvent * pErr)
 static int
 winClipboardIOErrorHandler(Display * pDisplay)
 {
-    ErrorF("winClipboardIOErrorHandler!\n\n");
+    ErrorF("winClipboardIOErrorHandler!\n");
 
     if (pthread_equal(pthread_self(), g_winClipboardProcThread)) {
         /* Restart at the main entry point */
index e19f678..90dc9e0 100644 (file)
  * References to external symbols
  */
 
-extern Bool g_fUseUnicode;
 extern void *g_pClipboardDisplay;
 extern Window g_iClipboardWindow;
 extern Atom g_atomLastOwnedSelection;
 
-/* 
- * Local function prototypes
- */
-
-static int
-
-
-winProcessXEventsTimeout(HWND hwnd, int iWindow, Display * pDisplay,
-                         Bool fUseUnicode, int iTimeoutSec);
-
 /*
  * Process X events up to specified timeout
  */
index 1118f4f..bfd6bff 100644 (file)
  * Local function prototypes
  */
 
-int winProcEstablishConnection(ClientPtr /* client */ );
-int winProcQueryTree(ClientPtr /* client */ );
-int winProcSetSelectionOwner(ClientPtr /* client */ );
-
 DISPATCH_PROC(winProcEstablishConnection);
 DISPATCH_PROC(winProcSetSelectionOwner);
 
@@ -60,10 +56,6 @@ DISPATCH_PROC(winProcSetSelectionOwner);
  * References to external symbols
  */
 
-extern int g_iNumScreens;
-extern unsigned int g_uiAuthDataLen;
-extern char *g_pAuthData;
-extern Bool g_fXdmcpEnabled;
 extern Bool g_fClipboardLaunched;
 extern Bool g_fClipboardStarted;
 extern Bool g_fClipboard;
@@ -71,9 +63,6 @@ extern Window g_iClipboardWindow;
 extern Atom g_atomLastOwnedSelection;
 extern HWND g_hwndClipboard;
 
-extern winDispatchProcPtr winProcEstablishConnectionOrig;
-extern winDispatchProcPtr winProcQueryTreeOrig;
-extern winDispatchProcPtr winProcSetSelectionOwnerOrig;
 
 /*
  * Wrapper for internal EstablishConnection function.
index ce533c5..7d3c30e 100644 (file)
@@ -157,7 +157,7 @@ winClipboardFlushXEvents(HWND hwnd,
                  */
                 iReturn = XSendEvent(pDisplay,
                                      eventSelection.requestor,
-                                     False, 0L, (XEvent *) & eventSelection);
+                                     False, 0L, (XEvent *) &eventSelection);
                 if (iReturn == BadValue || iReturn == BadWindow) {
                     ErrorF("winClipboardFlushXEvents - SelectionRequest - "
                            "XSendEvent () failed\n");
@@ -165,6 +165,24 @@ winClipboardFlushXEvents(HWND hwnd,
                 break;
             }
 
+            /* Close clipboard if we have it open already */
+            if (GetOpenClipboardWindow() == hwnd) {
+                CloseClipboard();
+            }
+
+            /* Access the clipboard */
+            if (!OpenClipboard(hwnd)) {
+                ErrorF("winClipboardFlushXEvents - SelectionRequest - "
+                       "OpenClipboard () failed: %08lx\n", GetLastError());
+
+                /* Abort */
+                fAbort = TRUE;
+                goto winClipboardFlushXEvents_SelectionRequest_Done;
+            }
+
+            /* Indicate that clipboard was opened */
+            fCloseClipboard = TRUE;
+
             /* Check that clipboard format is available */
             if (fUseUnicode && !IsClipboardFormatAvailable(CF_UNICODETEXT)) {
                 static int count;       /* Hack to stop acroread spamming the log */
@@ -192,24 +210,6 @@ winClipboardFlushXEvents(HWND hwnd,
                 goto winClipboardFlushXEvents_SelectionRequest_Done;
             }
 
-            /* Close clipboard if we have it open already */
-            if (GetOpenClipboardWindow() == hwnd) {
-                CloseClipboard();
-            }
-
-            /* Access the clipboard */
-            if (!OpenClipboard(hwnd)) {
-                ErrorF("winClipboardFlushXEvents - SelectionRequest - "
-                       "OpenClipboard () failed: %08lx\n", GetLastError());
-
-                /* Abort */
-                fAbort = TRUE;
-                goto winClipboardFlushXEvents_SelectionRequest_Done;
-            }
-
-            /* Indicate that clipboard was opened */
-            fCloseClipboard = TRUE;
-
             /* Setup the string style */
             if (event.xselectionrequest.target == XA_STRING)
                 xiccesStyle = XStringStyle;
@@ -248,7 +248,7 @@ winClipboardFlushXEvents(HWND hwnd,
                                                       (LPCWSTR) pszGlobalData,
                                                       -1, NULL, 0, NULL, NULL);
                 /* NOTE: iConvertDataLen includes space for null terminator */
-                pszConvertData = (char *) malloc(iConvertDataLen);
+                pszConvertData = malloc(iConvertDataLen);
                 WideCharToMultiByte(CP_UTF8,
                                     0,
                                     (LPCWSTR) pszGlobalData,
@@ -341,7 +341,7 @@ winClipboardFlushXEvents(HWND hwnd,
             /* Notify the requesting window that the operation has completed */
             iReturn = XSendEvent(pDisplay,
                                  eventSelection.requestor,
-                                 False, 0L, (XEvent *) & eventSelection);
+                                 False, 0L, (XEvent *) &eventSelection);
             if (iReturn == BadValue || iReturn == BadWindow) {
                 ErrorF("winClipboardFlushXEvents - SelectionRequest - "
                        "XSendEvent () failed\n");
@@ -380,7 +380,7 @@ winClipboardFlushXEvents(HWND hwnd,
                 /* Notify the requesting window that the operation is complete */
                 iReturn = XSendEvent(pDisplay,
                                      eventSelection.requestor,
-                                     False, 0L, (XEvent *) & eventSelection);
+                                     False, 0L, (XEvent *) &eventSelection);
                 if (iReturn == BadValue || iReturn == BadWindow) {
                     /*
                      * Should not be a problem if XSendEvent fails because
@@ -581,8 +581,7 @@ winClipboardFlushXEvents(HWND hwnd,
                                                   pszReturnData, -1, NULL, 0);
 
                 /* Allocate memory for the Unicode string */
-                pwszUnicodeStr
-                    = (wchar_t *) malloc(sizeof(wchar_t) * (iUnicodeLen + 1));
+                pwszUnicodeStr = malloc(sizeof(wchar_t) * (iUnicodeLen + 1));
                 if (!pwszUnicodeStr) {
                     ErrorF("winClipboardFlushXEvents - SelectionNotify "
                            "malloc failed for pwszUnicodeStr, aborting.\n");
index 610437a..5dcc8bc 100644 (file)
@@ -177,7 +177,7 @@ winUninstallColormap(ColormapPtr pmap)
 
     /* Install the default cmap in place of the cmap to be uninstalled */
     if (pmap->mid != pmap->pScreen->defColormap) {
-        dixLookupResourceByType((pointer) &curpmap, pmap->pScreen->defColormap,
+        dixLookupResourceByType((void *) &curpmap, pmap->pScreen->defColormap,
                                 RT_COLORMAP, NullClient, DixUnknownAccess);
         (*pmap->pScreen->InstallColormap) (curpmap);
     }
index 313320f..a6d3c0a 100644 (file)
@@ -106,7 +106,7 @@ winInfoRec g_winInfo = {
 #ifdef XWIN_XF86CONFIG
 serverLayoutRec g_winConfigLayout;
 
-static Bool ParseOptionValue(int scrnIndex, pointer options, OptionInfoPtr p);
+static Bool ParseOptionValue(int scrnIndex, void *options, OptionInfoPtr p);
 static Bool configLayout(serverLayoutPtr, XF86ConfLayoutPtr, char *);
 static Bool configImpliedLayout(serverLayoutPtr, XF86ConfScreenPtr);
 static Bool GetBoolValue(OptionInfoPtr p, const char *s);
@@ -188,7 +188,7 @@ winReadConfigfile()
         /* Check if layout is given in the config file */
         if (g_xf86configptr->conf_flags != NULL) {
             char *dfltlayout = NULL;
-            pointer optlist = g_xf86configptr->conf_flags->flg_option_lst;
+            void *optlist = g_xf86configptr->conf_flags->flg_option_lst;
 
             if (optlist && winFindOption(optlist, "defaultserverlayout"))
                 dfltlayout =
@@ -588,7 +588,7 @@ winConfigScreens(void)
 
 #ifdef XWIN_XF86CONFIG
 char *
-winSetStrOption(pointer optlist, const char *name, char *deflt)
+winSetStrOption(void *optlist, const char *name, char *deflt)
 {
     OptionInfoRec o;
 
@@ -603,7 +603,7 @@ winSetStrOption(pointer optlist, const char *name, char *deflt)
 }
 
 int
-winSetBoolOption(pointer optlist, const char *name, int deflt)
+winSetBoolOption(void *optlist, const char *name, int deflt)
 {
     OptionInfoRec o;
 
@@ -615,7 +615,7 @@ winSetBoolOption(pointer optlist, const char *name, int deflt)
 }
 
 int
-winSetIntOption(pointer optlist, const char *name, int deflt)
+winSetIntOption(void *optlist, const char *name, int deflt)
 {
     OptionInfoRec o;
 
@@ -627,7 +627,7 @@ winSetIntOption(pointer optlist, const char *name, int deflt)
 }
 
 double
-winSetRealOption(pointer optlist, const char *name, double deflt)
+winSetRealOption(void *optlist, const char *name, double deflt)
 {
     OptionInfoRec o;
 
@@ -639,7 +639,7 @@ winSetRealOption(pointer optlist, const char *name, double deflt)
 }
 
 double
-winSetPercentOption(pointer optlist, const char *name, double deflt)
+winSetPercentOption(void *optlist, const char *name, double deflt)
 {
     OptionInfoRec o;
 
@@ -734,7 +734,7 @@ winFindOptionValue(XF86OptionPtr list, const char *name)
  */
 
 static Bool
-ParseOptionValue(int scrnIndex, pointer options, OptionInfoPtr p)
+ParseOptionValue(int scrnIndex, void *options, OptionInfoPtr p)
 {
     char *s, *end;
 
@@ -762,7 +762,7 @@ ParseOptionValue(int scrnIndex, pointer options, OptionInfoPtr p)
         case OPTV_STRING:
             if (*s == '\0') {
                 winDrvMsg(scrnIndex, X_WARNING,
-                          "Option \"%s\" requires an string value\n", p->name);
+                          "Option \"%s\" requires a string value\n", p->name);
                 p->found = FALSE;
             }
             else {
index 94571ff..798c779 100644 (file)
@@ -58,15 +58,15 @@ typedef struct {
     Bool inUse;
     int videoRam;
     int textClockFreq;
-    pointer options;
+    void *options;
     int screen;                 /* For multi-CRTC cards */
 } GDevRec, *GDevPtr;
 
 typedef struct {
     char *identifier;
     char *driver;
-    pointer commonOptions;
-    pointer extraOptions;
+    void *commonOptions;
+    void *extraOptions;
 } IDevRec, *IDevPtr;
 
 typedef struct {
@@ -81,19 +81,19 @@ typedef struct {
     rgb whiteColour;
     int defaultVisual;
     char **modes;
-    pointer options;
+    void *options;
 } DispRec, *DispPtr;
 
 typedef struct _confxvportrec {
     char *identifier;
-    pointer options;
+    void *options;
 } confXvPortRec, *confXvPortPtr;
 
 typedef struct _confxvadaptrec {
     char *identifier;
     int numports;
     confXvPortPtr ports;
-    pointer options;
+    void *options;
 } confXvAdaptorRec, *confXvAdaptorPtr;
 
 typedef struct _confscreenrec {
@@ -107,7 +107,7 @@ typedef struct _confscreenrec {
     DispPtr displays;
     int numxvadaptors;
     confXvAdaptorPtr xvadaptors;
-    pointer options;
+    void *options;
 } confScreenRec, *confScreenPtr;
 
 typedef enum {
@@ -142,7 +142,7 @@ typedef struct _serverlayoutrec {
     screenLayoutPtr screens;
     GDevPtr inactives;
     IDevPtr inputs;
-    pointer options;
+    void *options;
 } serverLayoutRec, *serverLayoutPtr;
 
 /*
@@ -233,11 +233,11 @@ typedef struct {
  * Function prototypes
  */
 
-char *winSetStrOption(pointer optlist, const char *name, char *deflt);
-int winSetBoolOption(pointer optlist, const char *name, int deflt);
-int winSetIntOption(pointer optlist, const char *name, int deflt);
-double winSetRealOption(pointer optlist, const char *name, double deflt);
-double winSetPercentOption(pointer optlist, const char *name, double deflt);
+char *winSetStrOption(void *optlist, const char *name, char *deflt);
+int winSetBoolOption(void *optlist, const char *name, int deflt);
+int winSetIntOption(void *optlist, const char *name, int deflt);
+double winSetRealOption(void *optlist, const char *name, double deflt);
+double winSetPercentOption(void *optlist, const char *name, double deflt);
 
 #ifdef XWIN_XF86CONFIG
 XF86OptionPtr winFindOption(XF86OptionPtr list, const char *name);
index b56104f..f3ac0f7 100644 (file)
@@ -104,7 +104,7 @@ winPointerWarpCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
 
         /* Translate the client area coords to screen coords */
         MapWindowPoints(pScreenPriv->hwndScreen,
-                        HWND_DESKTOP, (LPPOINT) & rcClient, 2);
+                        HWND_DESKTOP, (LPPOINT) &rcClient, 2);
 
         /* 
          * Update the Windows cursor position so that we don't
@@ -158,12 +158,11 @@ winLoadCursor(ScreenPtr pScreen, CursorPtr pCursor, int screen)
     HBITMAP hAnd, hXor;
     ICONINFO ii;
     unsigned char *pCur;
-    int x, y;
     unsigned char bit;
     HDC hDC;
     BITMAPV4HEADER bi;
     BITMAPINFO *pbmi;
-    unsigned long *lpBits;
+    uint32_t *lpBits;
 
     WIN_DEBUG_MSG("winLoadCursor: Win32: %dx%d X11: %dx%d hotspot: %d,%d\n",
                   pScreenPriv->cursor.sm_cx, pScreenPriv->cursor.sm_cy,
@@ -256,15 +255,13 @@ winLoadCursor(ScreenPtr pScreen, CursorPtr pCursor, int screen)
         bi.bV4BlueMask = 0x000000FF;
         bi.bV4AlphaMask = 0xFF000000;
 
-        lpBits =
-            (unsigned long *) calloc(pScreenPriv->cursor.sm_cx *
-                                     pScreenPriv->cursor.sm_cy,
-                                     sizeof(unsigned long));
+        lpBits = calloc(pScreenPriv->cursor.sm_cx * pScreenPriv->cursor.sm_cy,
+                        sizeof(uint32_t));
 
         if (lpBits) {
+            int y;
             for (y = 0; y < nCY; y++) {
-                unsigned long *src, *dst;
-
+                void *src, *dst;
                 src = &(pCursor->bits->argb[y * pCursor->bits->width]);
                 dst = &(lpBits[y * pScreenPriv->cursor.sm_cx]);
                 memcpy(dst, src, 4 * nCX);
@@ -273,9 +270,12 @@ winLoadCursor(ScreenPtr pScreen, CursorPtr pCursor, int screen)
     }                           /* End if-truecolor-icon */
 
     if (!lpBits) {
+        RGBQUAD *pbmiColors;
         /* Bicolor, use a palettized DIB */
         WIN_DEBUG_MSG("winLoadCursor: Trying two color cursor\n");
-        pbmi = (BITMAPINFO *) & bi;
+        pbmi = (BITMAPINFO *) &bi;
+        pbmiColors = &(pbmi->bmiColors[0]);
+
         memset(pbmi, 0, sizeof(BITMAPINFOHEADER));
         pbmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
         pbmi->bmiHeader.biWidth = pScreenPriv->cursor.sm_cx;
@@ -286,25 +286,25 @@ winLoadCursor(ScreenPtr pScreen, CursorPtr pCursor, int screen)
         pbmi->bmiHeader.biSizeImage = 0;
         pbmi->bmiHeader.biClrUsed = 3;
         pbmi->bmiHeader.biClrImportant = 3;
-        pbmi->bmiColors[0].rgbRed = 0;  /* Empty */
-        pbmi->bmiColors[0].rgbGreen = 0;
-        pbmi->bmiColors[0].rgbBlue = 0;
-        pbmi->bmiColors[0].rgbReserved = 0;
-        pbmi->bmiColors[1].rgbRed = pCursor->backRed >> 8;      /* Background */
-        pbmi->bmiColors[1].rgbGreen = pCursor->backGreen >> 8;
-        pbmi->bmiColors[1].rgbBlue = pCursor->backBlue >> 8;
-        pbmi->bmiColors[1].rgbReserved = 0;
-        pbmi->bmiColors[2].rgbRed = pCursor->foreRed >> 8;      /* Foreground */
-        pbmi->bmiColors[2].rgbGreen = pCursor->foreGreen >> 8;
-        pbmi->bmiColors[2].rgbBlue = pCursor->foreBlue >> 8;
-        pbmi->bmiColors[2].rgbReserved = 0;
-
-        lpBits =
-            (unsigned long *) calloc(pScreenPriv->cursor.sm_cx *
-                                     pScreenPriv->cursor.sm_cy, sizeof(char));
+
+        pbmiColors[0].rgbRed = 0;  /* Empty */
+        pbmiColors[0].rgbGreen = 0;
+        pbmiColors[0].rgbBlue = 0;
+        pbmiColors[0].rgbReserved = 0;
+        pbmiColors[1].rgbRed = pCursor->backRed >> 8;      /* Background */
+        pbmiColors[1].rgbGreen = pCursor->backGreen >> 8;
+        pbmiColors[1].rgbBlue = pCursor->backBlue >> 8;
+        pbmiColors[1].rgbReserved = 0;
+        pbmiColors[2].rgbRed = pCursor->foreRed >> 8;      /* Foreground */
+        pbmiColors[2].rgbGreen = pCursor->foreGreen >> 8;
+        pbmiColors[2].rgbBlue = pCursor->foreBlue >> 8;
+        pbmiColors[2].rgbReserved = 0;
+
+        lpBits = calloc(pScreenPriv->cursor.sm_cx * pScreenPriv->cursor.sm_cy, 1);
 
         pCur = (unsigned char *) lpBits;
         if (lpBits) {
+           int x, y;
             for (y = 0; y < pScreenPriv->cursor.sm_cy; y++) {
                 for (x = 0; x < pScreenPriv->cursor.sm_cx; x++) {
                     if (x >= nCX || y >= nCY)   /* Outside of X11 icon bounds */
@@ -357,7 +357,7 @@ winLoadCursor(ScreenPtr pScreen, CursorPtr pCursor, int screen)
                 CreateCompatibleBitmap(hDC, pScreenPriv->cursor.sm_cx,
                                        pScreenPriv->cursor.sm_cy);
             SetDIBits(hDC, hXor, 0, pScreenPriv->cursor.sm_cy, lpBits,
-                      (BITMAPINFO *) & bi, DIB_RGB_COLORS);
+                      (BITMAPINFO *) &bi, DIB_RGB_COLORS);
             ReleaseDC(NULL, hDC);
         }
         free(lpBits);
index a02146e..c9af0e2 100644 (file)
@@ -33,9 +33,6 @@
 #include <xwin-config.h>
 #endif
 #include "win.h"
-#ifdef __CYGWIN__
-#include <sys/cygwin.h>
-#endif
 #include <shellapi.h>
 #include "winprefs.h"
 
@@ -50,13 +47,13 @@ extern Bool g_fClipboardStarted;
  * Local function prototypes
  */
 
-static wBOOL CALLBACK
+static INT_PTR CALLBACK
 winExitDlgProc(HWND hDialog, UINT message, WPARAM wParam, LPARAM lParam);
 
-static wBOOL CALLBACK
+static INT_PTR CALLBACK
 winChangeDepthDlgProc(HWND hDialog, UINT message, WPARAM wParam, LPARAM lParam);
 
-static wBOOL CALLBACK
+static INT_PTR CALLBACK
 winAboutDlgProc(HWND hDialog, UINT message, WPARAM wParam, LPARAM lParam);
 
 static void
@@ -288,7 +285,7 @@ winDisplayExitDialog(winPrivScreenPtr pScreenPriv)
     g_hDlgExit = CreateDialogParam(g_hInstance,
                                    "EXIT_DIALOG",
                                    pScreenPriv->hwndScreen,
-                                   winExitDlgProc, (int) pScreenPriv);
+                                   winExitDlgProc, (LPARAM) pScreenPriv);
 
     /* Show the dialog box */
     ShowWindow(g_hDlgExit, SW_SHOW);
@@ -307,7 +304,7 @@ winDisplayExitDialog(winPrivScreenPtr pScreenPriv)
  * Exit dialog window procedure
  */
 
-static wBOOL CALLBACK
+static INT_PTR CALLBACK
 winExitDlgProc(HWND hDialog, UINT message, WPARAM wParam, LPARAM lParam)
 {
     static winPrivScreenPtr s_pScreenPriv = NULL;
@@ -407,14 +404,13 @@ winDisplayDepthChangeDialog(winPrivScreenPtr pScreenPriv)
                                           "DEPTH_CHANGE_BOX",
                                           pScreenPriv->hwndScreen,
                                           winChangeDepthDlgProc,
-                                          (int) pScreenPriv);
+                                          (LPARAM) pScreenPriv);
     /* Show the dialog box */
     ShowWindow(g_hDlgDepthChange, SW_SHOW);
 
-    ErrorF("winDisplayDepthChangeDialog - DialogBox returned: %d\n",
-           (int) g_hDlgDepthChange);
-    ErrorF("winDisplayDepthChangeDialog - GetLastError: %d\n",
-           (int) GetLastError());
+    if (!g_hDlgDepthChange)
+        ErrorF("winDisplayDepthChangeDialog - GetLastError: %d\n",
+                (int) GetLastError());
 
     /* Minimize the display window */
     ShowWindow(pScreenPriv->hwndScreen, SW_MINIMIZE);
@@ -425,13 +421,12 @@ winDisplayDepthChangeDialog(winPrivScreenPtr pScreenPriv)
  * disruptive screen depth changes. 
  */
 
-static wBOOL CALLBACK
+static INT_PTR CALLBACK
 winChangeDepthDlgProc(HWND hwndDialog, UINT message,
                       WPARAM wParam, LPARAM lParam)
 {
     static winPrivScreenPtr s_pScreenPriv = NULL;
     static winScreenInfo *s_pScreenInfo = NULL;
-    static ScreenPtr s_pScreen = NULL;
 
 #if CYGDEBUG
     winDebug("winChangeDepthDlgProc\n");
@@ -447,12 +442,11 @@ winChangeDepthDlgProc(HWND hwndDialog, UINT message,
         /* Store pointers to private structures for future use */
         s_pScreenPriv = (winPrivScreenPtr) lParam;
         s_pScreenInfo = s_pScreenPriv->pScreenInfo;
-        s_pScreen = s_pScreenInfo->pScreen;
 
 #if CYGDEBUG
         winDebug("winChangeDepthDlgProc - WM_INITDIALOG - s_pScreenPriv: %08x, "
-                 "s_pScreenInfo: %08x, s_pScreen: %08x\n",
-                 s_pScreenPriv, s_pScreenInfo, s_pScreen);
+                 "s_pScreenInfo: %08x\n",
+                 s_pScreenPriv, s_pScreenInfo);
 #endif
 
 #if CYGDEBUG
@@ -541,7 +535,7 @@ winDisplayAboutDialog(winPrivScreenPtr pScreenPriv)
     g_hDlgAbout = CreateDialogParam(g_hInstance,
                                     "ABOUT_BOX",
                                     pScreenPriv->hwndScreen,
-                                    winAboutDlgProc, (int) pScreenPriv);
+                                    winAboutDlgProc, (LPARAM) pScreenPriv);
 
     /* Show the dialog box */
     ShowWindow(g_hDlgAbout, SW_SHOW);
@@ -558,12 +552,10 @@ winDisplayAboutDialog(winPrivScreenPtr pScreenPriv)
  * Process messages for the about dialog.
  */
 
-static wBOOL CALLBACK
+static INT_PTR CALLBACK
 winAboutDlgProc(HWND hwndDialog, UINT message, WPARAM wParam, LPARAM lParam)
 {
     static winPrivScreenPtr s_pScreenPriv = NULL;
-    static winScreenInfo *s_pScreenInfo = NULL;
-    static ScreenPtr s_pScreen = NULL;
 
 #if CYGDEBUG
     winDebug("winAboutDlgProc\n");
@@ -576,18 +568,13 @@ winAboutDlgProc(HWND hwndDialog, UINT message, WPARAM wParam, LPARAM lParam)
         winDebug("winAboutDlgProc - WM_INITDIALOG\n");
 #endif
 
-        /* Store pointers to private structures for future use */
+        /* Store pointer to private structure for future use */
         s_pScreenPriv = (winPrivScreenPtr) lParam;
-        s_pScreenInfo = s_pScreenPriv->pScreenInfo;
-        s_pScreen = s_pScreenInfo->pScreen;
 
         winInitDialog(hwndDialog);
 
         /* Override the URL buttons */
-        winOverrideURLButton(hwndDialog, ID_ABOUT_CHANGELOG);
         winOverrideURLButton(hwndDialog, ID_ABOUT_WEBSITE);
-        winOverrideURLButton(hwndDialog, ID_ABOUT_UG);
-        winOverrideURLButton(hwndDialog, ID_ABOUT_FAQ);
 
         return TRUE;
 
@@ -618,80 +605,22 @@ winAboutDlgProc(HWND hwndDialog, UINT message, WPARAM wParam, LPARAM lParam)
             PostMessage(s_pScreenPriv->hwndScreen, WM_NULL, 0, 0);
 
             /* Restore window procedures for URL buttons */
-            winUnoverrideURLButton(hwndDialog, ID_ABOUT_CHANGELOG);
             winUnoverrideURLButton(hwndDialog, ID_ABOUT_WEBSITE);
-            winUnoverrideURLButton(hwndDialog, ID_ABOUT_UG);
-            winUnoverrideURLButton(hwndDialog, ID_ABOUT_FAQ);
 
             return TRUE;
 
-        case ID_ABOUT_CHANGELOG:
-        {
-            int iReturn;
-
-#ifdef __CYGWIN__
-            const char *pszCygPath = "/usr/X11R6/share/doc/"
-                "xorg-x11-xwin/changelog.html";
-            char pszWinPath[MAX_PATH + 1];
-
-            /* Convert the POSIX path to a Win32 path */
-            cygwin_conv_to_win32_path(pszCygPath, pszWinPath);
-#else
-            const char *pszWinPath = "http://x.cygwin.com/"
-                "devel/server/changelog.html";
-#endif
-
-            iReturn = (int) ShellExecute(NULL,
-                                         "open",
-                                         pszWinPath, NULL, NULL, SW_MAXIMIZE);
-            if (iReturn < 32) {
-                ErrorF("winAboutDlgProc - WM_COMMAND - ID_ABOUT_CHANGELOG - "
-                       "ShellExecute failed: %d\n", iReturn);
-            }
-        }
-            return TRUE;
-
         case ID_ABOUT_WEBSITE:
         {
             const char *pszPath = __VENDORDWEBSUPPORT__;
-            int iReturn;
+            INT_PTR iReturn;
 
-            iReturn = (int) ShellExecute(NULL,
+            iReturn = (INT_PTR) ShellExecute(NULL,
                                          "open",
                                          pszPath, NULL, NULL, SW_MAXIMIZE);
             if (iReturn < 32) {
                 ErrorF("winAboutDlgProc - WM_COMMAND - ID_ABOUT_WEBSITE - "
-                       "ShellExecute failed: %d\n", iReturn);
-            }
-        }
-            return TRUE;
-
-        case ID_ABOUT_UG:
-        {
-            const char *pszPath = "http://x.cygwin.com/docs/ug/";
-            int iReturn;
+                       "ShellExecute failed: %d\n", (int)iReturn);
 
-            iReturn = (int) ShellExecute(NULL,
-                                         "open",
-                                         pszPath, NULL, NULL, SW_MAXIMIZE);
-            if (iReturn < 32) {
-                ErrorF("winAboutDlgProc - WM_COMMAND - ID_ABOUT_UG - "
-                       "ShellExecute failed: %d\n", iReturn);
-            }
-        }
-            return TRUE;
-
-        case ID_ABOUT_FAQ:
-        {
-            const char *pszPath = "http://x.cygwin.com/docs/faq/";
-            int iReturn;
-
-            iReturn = (int) ShellExecute(NULL,
-                                         "open",
-                                         pszPath, NULL, NULL, SW_MAXIMIZE);
-            if (iReturn < 32) {
-                ErrorF("winAboutDlgProc - WM_COMMAND - ID_ABOUT_FAQ - "
-                       "ShellExecute failed: %d\n", iReturn);
             }
         }
             return TRUE;
@@ -708,10 +637,7 @@ winAboutDlgProc(HWND hwndDialog, UINT message, WPARAM wParam, LPARAM lParam)
         PostMessage(s_pScreenPriv->hwndScreen, WM_NULL, 0, 0);
 
         /* Restore window procedures for URL buttons */
-        winUnoverrideURLButton(hwndDialog, ID_ABOUT_CHANGELOG);
         winUnoverrideURLButton(hwndDialog, ID_ABOUT_WEBSITE);
-        winUnoverrideURLButton(hwndDialog, ID_ABOUT_UG);
-        winUnoverrideURLButton(hwndDialog, ID_ABOUT_FAQ);
 
         return TRUE;
     }
index 6748959..1f55ada 100644 (file)
@@ -92,7 +92,7 @@ winDetectSupportedEngines(void)
         else {
             /* We have DirectDraw */
             winErrorFVerb(2,
-                          "winDetectSupportedEngines - DirectDraw installed\n");
+                          "winDetectSupportedEngines - DirectDraw installed, allowing ShadowDD\n");
             g_dwEnginesSupported |= WIN_SERVER_SHADOW_DD;
 
 #ifdef XWIN_PRIMARYFB
@@ -100,7 +100,7 @@ winDetectSupportedEngines(void)
             if (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT) {
                 g_dwEnginesSupported |= WIN_SERVER_PRIMARY_DD;
                 winErrorFVerb(2,
-                              "winDetectSupportedEngines - Allowing PrimaryDD\n");
+                              "winDetectSupportedEngines - Windows NT, allowing PrimaryDD\n");
             }
 #endif
         }
@@ -108,11 +108,11 @@ winDetectSupportedEngines(void)
         /* Try to query for DirectDraw4 interface */
         ddrval = IDirectDraw_QueryInterface(lpdd,
                                             &IID_IDirectDraw4,
-                                            (LPVOID *) & lpdd4);
+                                            (LPVOID *) &lpdd4);
         if (SUCCEEDED(ddrval)) {
             /* We have DirectDraw4 */
             winErrorFVerb(2,
-                          "winDetectSupportedEngines - DirectDraw4 installed\n");
+                          "winDetectSupportedEngines - DirectDraw4 installed, allowing ShadowDDNL\n");
             g_dwEnginesSupported |= WIN_SERVER_SHADOW_DDNL;
         }
 
index 56c1e34..1318b0f 100644 (file)
 #include "win.h"
 
 #ifdef DDXOSVERRORF
-/* Prototype */
-void
- OsVendorVErrorF(const char *pszFormat, va_list va_args);
-
 void
 OsVendorVErrorF(const char *pszFormat, va_list va_args)
 {
@@ -63,15 +59,16 @@ OsVendorVErrorF(const char *pszFormat, va_list va_args)
 #endif
 
 /*
- * os/util.c/FatalError () calls our vendor ErrorF, so the message
- * from a FatalError will be logged.  Thus, the message for the
- * fatal error is not passed to this function.
+ * os/log.c:FatalError () calls our vendor ErrorF, so the message
+ * from a FatalError will be logged.
  *
  * Attempt to do last-ditch, safe, important cleanup here.
  */
 void
 OsVendorFatalError(const char *f, va_list args)
 {
+    char errormsg[1024] = "";
+
     /* Don't give duplicate warning if UseMsg was called */
     if (g_fSilentFatalError)
         return;
@@ -82,9 +79,28 @@ OsVendorFatalError(const char *f, va_list args)
     }
     LogClose(EXIT_ERR_ABORT);
 
-    winMessageBoxF("A fatal error has occurred and " PROJECT_NAME
-                   " will now exit.\n" "Please open %s for more information.\n",
-                   MB_ICONERROR, (g_pszLogFile ? g_pszLogFile : "the logfile"));
+    /* Format the error message */
+    vsnprintf(errormsg, sizeof(errormsg), f, args);
+
+    /*
+       Sometimes the error message needs a bit of cosmetic cleaning
+       up for use in a dialog box...
+     */
+    {
+        char *s;
+
+        while ((s = strstr(errormsg, "\n\t")) != NULL) {
+            s[0] = ' ';
+            s[1] = '\n';
+        }
+    }
+
+    winMessageBoxF("A fatal error has occurred and " PROJECT_NAME " will now exit.\n\n"
+                   "%s\n\n"
+                   "Please open %s for more information.\n",
+                   MB_ICONERROR,
+                   errormsg,
+                   (g_pszLogFile ? g_pszLogFile : "the logfile"));
 }
 
 /*
index f2432ed..bd0a15e 100644 (file)
@@ -118,7 +118,7 @@ winFillSpansNativeGDI(DrawablePtr pDrawable,
         if (hbmpOrig == NULL)
             FatalError("winFillSpans - DRAWABLE_PIXMAP - "
                        "SelectObject () failed on\n\tpPixmapPriv->hBitmap: "
-                       "%08x\n", (unsigned int) pPixmapPriv->hBitmap);
+                       "%p\n", pPixmapPriv->hBitmap);
 
         /* Branch on the fill type */
         switch (pGC->fillStyle) {
index 8b7c704..5986e0a 100644 (file)
 #endif
 #include "win.h"
 
-void
-
-winPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDrawable, int dx,
-              int dy, int xOrg, int yOrg);
-
 /*
  * Local prototypes
  */
@@ -61,7 +56,7 @@ static void
 
 #if 0
 static void
- winChangeClipNativeGDI(GCPtr pGC, int nType, pointer pValue, int nRects);
+ winChangeClipNativeGDI(GCPtr pGC, int nType, void *pValue, int nRects);
 
 static void
  winDestroyClipNativeGDI(GCPtr pGC);
@@ -135,8 +130,8 @@ winCreateGCNativeGDI(GCPtr pGC)
     ErrorF("winCreateGCNativeGDI - depth: %d\n", pGC->depth);
 #endif
 
-    pGC->ops = (GCOps *) & winGCOps;
-    pGC->funcs = (GCFuncs *) & winGCFuncs;
+    pGC->ops = (GCOps *) &winGCOps;
+    pGC->funcs = (GCFuncs *) &winGCFuncs;
 
     /* We want all coordinates passed to spans functions to be screen relative */
     pGC->miTranslate = TRUE;
@@ -219,7 +214,7 @@ winDestroyGCNativeGDI(GCPtr pGC)
 #if 0
 /* See Porting Layer Definition - p. 46 */
 static void
-winChangeClipNativeGDI(GCPtr pGC, int nType, pointer pValue, int nRects)
+winChangeClipNativeGDI(GCPtr pGC, int nType, void *pValue, int nRects)
 {
 
 }
index 4953bd0..b9ad294 100644 (file)
@@ -77,14 +77,15 @@ Bool g_fKeyboardHookLL = FALSE;
 Bool g_fNoHelpMessageBox = FALSE;
 Bool g_fSoftwareCursor = FALSE;
 Bool g_fSilentDupError = FALSE;
-Bool g_fNativeGl = FALSE;
+Bool g_fNativeGl = TRUE;
+Bool g_fHostInTitle = FALSE;
+pthread_mutex_t g_pmTerminating = PTHREAD_MUTEX_INITIALIZER;
 
 #ifdef XWIN_CLIPBOARD
 /*
  * Wrapped DIX functions
  */
 winDispatchProcPtr winProcEstablishConnectionOrig = NULL;
-winDispatchProcPtr winProcQueryTreeOrig = NULL;
 winDispatchProcPtr winProcSetSelectionOwnerOrig = NULL;
 
 /*
index 2edf957..60c00da 100644 (file)
 #ifndef WINGLOBALS_H
 #define WINGLOBALS_H
 
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+
+#include <pthread.h>
+
 /*
  * References to external symbols
  */
@@ -48,6 +54,7 @@ extern Bool g_fXdmcpEnabled;
 extern Bool g_fNoHelpMessageBox;
 extern Bool g_fSilentDupError;
 extern Bool g_fNativeGl;
+extern Bool g_fHostInTitle;
 
 extern HWND g_hDlgDepthChange;
 extern HWND g_hDlgExit;
@@ -65,7 +72,6 @@ typedef int (*winDispatchProcPtr) (ClientPtr);
  * Wrapped DIX functions
  */
 extern winDispatchProcPtr winProcEstablishConnectionOrig;
-extern winDispatchProcPtr winProcQueryTreeOrig;
 extern winDispatchProcPtr winProcSetSelectionOwnerOrig;
 #endif
 
@@ -86,4 +92,6 @@ extern Bool g_fButton[3];
 extern Bool g_fNoConfigureWindow;
 #endif
 
+extern pthread_mutex_t g_pmTerminating;
+
 #endif                          /* WINGLOBALS_H */
index 2ffb9a9..3a75ab2 100644 (file)
@@ -41,6 +41,9 @@
 
 #include "xkbsrv.h"
 
+/* C does not have a logical XOR operator, so we use a macro instead */
+#define LOGICAL_XOR(a,b) ((!(a) && (b)) || ((a) && !(b)))
+
 static Bool g_winKeyState[NUM_KEYCODES];
 
 /*
@@ -48,12 +51,12 @@ static Bool g_winKeyState[NUM_KEYCODES];
  */
 
 static void
- winKeybdBell(int iPercent, DeviceIntPtr pDeviceInt, pointer pCtrl, int iClass);
+ winKeybdBell(int iPercent, DeviceIntPtr pDeviceInt, void *pCtrl, int iClass);
 
 static void
  winKeybdCtrl(DeviceIntPtr pDevice, KeybdCtrl * pCtrl);
 
-/* 
+/*
  * Translate a Windows WM_[SYS]KEY(UP/DOWN) message
  * into an ASCII scan code.
  *
@@ -62,13 +65,14 @@ static void
  * like AltGr on European keyboards.
  */
 
-void
-winTranslateKey(WPARAM wParam, LPARAM lParam, int *piScanCode)
+int
+winTranslateKey(WPARAM wParam, LPARAM lParam)
 {
     int iKeyFixup = g_iKeyMap[wParam * WIN_KEYMAP_COLS + 1];
     int iKeyFixupEx = g_iKeyMap[wParam * WIN_KEYMAP_COLS + 2];
     int iParam = HIWORD(lParam);
     int iParamScanCode = LOBYTE(iParam);
+    int iScanCode;
 
     winDebug("winTranslateKey: wParam %08x lParam %08x\n", wParam, lParam);
 
@@ -93,28 +97,30 @@ winTranslateKey(WPARAM wParam, LPARAM lParam, int *piScanCode)
 
     /* Branch on special extended, special non-extended, or normal key */
     if ((iParam & KF_EXTENDED) && iKeyFixupEx)
-        *piScanCode = iKeyFixupEx;
+        iScanCode = iKeyFixupEx;
     else if (iKeyFixup)
-        *piScanCode = iKeyFixup;
+        iScanCode = iKeyFixup;
     else if (wParam == 0 && iParamScanCode == 0x70)
-        *piScanCode = KEY_HKTG;
+        iScanCode = KEY_HKTG;
     else
         switch (iParamScanCode) {
         case 0x70:
-            *piScanCode = KEY_HKTG;
+            iScanCode = KEY_HKTG;
             break;
         case 0x73:
-            *piScanCode = KEY_BSlash2;
+            iScanCode = KEY_BSlash2;
             break;
         default:
-            *piScanCode = iParamScanCode;
+            iScanCode = iParamScanCode;
             break;
         }
+
+    return iScanCode;
 }
 
 /* Ring the keyboard bell (system speaker on PCs) */
 static void
-winKeybdBell(int iPercent, DeviceIntPtr pDeviceInt, pointer pCtrl, int iClass)
+winKeybdBell(int iPercent, DeviceIntPtr pDeviceInt, void *pCtrl, int iClass)
 {
     /*
      * We can't use Beep () here because it uses the PC speaker
@@ -122,7 +128,7 @@ winKeybdBell(int iPercent, DeviceIntPtr pDeviceInt, pointer pCtrl, int iClass)
      * sound on systems with a sound card or it will beep the PC speaker
      * on systems that do not have a sound card.
      */
-    MessageBeep(MB_OK);
+    if (iPercent > 0) MessageBeep(MB_OK);
 }
 
 /* Change some keyboard configuration parameters */
@@ -131,7 +137,7 @@ winKeybdCtrl(DeviceIntPtr pDevice, KeybdCtrl * pCtrl)
 {
 }
 
-/* 
+/*
  * See Porting Layer Definition - p. 18
  * winKeybdProc is known as a DeviceProc.
  */
@@ -259,39 +265,76 @@ winRestoreModeKeyStates(void)
         XkbStateFieldFromRec(&inputInfo.keyboard->key->xkbInfo->state);
     winDebug("winRestoreModeKeyStates: state %d\n", internalKeyStates);
 
-    /* 
-     * NOTE: The C XOR operator, ^, will not work here because it is
-     * a bitwise operator, not a logical operator.  C does not
-     * have a logical XOR operator, so we use a macro instead.
-     */
+    /* Check if modifier keys are pressed, and if so, fake a press */
+    {
+
+        BOOL lctrl = (GetAsyncKeyState(VK_LCONTROL) < 0);
+        BOOL rctrl = (GetAsyncKeyState(VK_RCONTROL) < 0);
+        BOOL lshift = (GetAsyncKeyState(VK_LSHIFT) < 0);
+        BOOL rshift = (GetAsyncKeyState(VK_RSHIFT) < 0);
+        BOOL alt = (GetAsyncKeyState(VK_LMENU) < 0);
+        BOOL altgr = (GetAsyncKeyState(VK_RMENU) < 0);
+
+        /*
+           If AltGr and CtrlL appear to be pressed, assume the
+           CtrL is a fake one
+         */
+        if (lctrl && altgr)
+            lctrl = FALSE;
+
+        if (lctrl)
+            winSendKeyEvent(KEY_LCtrl, TRUE);
 
-    /* Has the key state changed? */
+        if (rctrl)
+            winSendKeyEvent(KEY_RCtrl, TRUE);
+
+        if (lshift)
+            winSendKeyEvent(KEY_ShiftL, TRUE);
+
+        if (rshift)
+            winSendKeyEvent(KEY_ShiftL, TRUE);
+
+        if (alt)
+            winSendKeyEvent(KEY_Alt, TRUE);
+
+        if (altgr)
+            winSendKeyEvent(KEY_AltLang, TRUE);
+    }
+
+    /*
+       Check if latching modifier key states have changed, and if so,
+       fake a press and a release to toggle the modifier to the correct
+       state
+    */
     dwKeyState = GetKeyState(VK_NUMLOCK) & 0x0001;
-    if (WIN_XOR(internalKeyStates & NumLockMask, dwKeyState)) {
+    if (LOGICAL_XOR(internalKeyStates & NumLockMask, dwKeyState)) {
         winSendKeyEvent(KEY_NumLock, TRUE);
         winSendKeyEvent(KEY_NumLock, FALSE);
     }
 
-    /* Has the key state changed? */
     dwKeyState = GetKeyState(VK_CAPITAL) & 0x0001;
-    if (WIN_XOR(internalKeyStates & LockMask, dwKeyState)) {
+    if (LOGICAL_XOR(internalKeyStates & LockMask, dwKeyState)) {
         winSendKeyEvent(KEY_CapsLock, TRUE);
         winSendKeyEvent(KEY_CapsLock, FALSE);
     }
 
-    /* Has the key state changed? */
     dwKeyState = GetKeyState(VK_SCROLL) & 0x0001;
-    if (WIN_XOR(internalKeyStates & ScrollLockMask, dwKeyState)) {
+    if (LOGICAL_XOR(internalKeyStates & ScrollLockMask, dwKeyState)) {
         winSendKeyEvent(KEY_ScrollLock, TRUE);
         winSendKeyEvent(KEY_ScrollLock, FALSE);
     }
 
-    /* Has the key state changed? */
     dwKeyState = GetKeyState(VK_KANA) & 0x0001;
-    if (WIN_XOR(internalKeyStates & KanaMask, dwKeyState)) {
+    if (LOGICAL_XOR(internalKeyStates & KanaMask, dwKeyState)) {
         winSendKeyEvent(KEY_HKTG, TRUE);
         winSendKeyEvent(KEY_HKTG, FALSE);
     }
+
+    /*
+       For strict correctness, we should also press any non-modifier keys
+       which are already down when we gain focus, but nobody has complained
+       yet :-)
+     */
 }
 
 /*
@@ -307,7 +350,6 @@ winIsFakeCtrl_L(UINT message, WPARAM wParam, LPARAM lParam)
     Bool fReturn;
 
     static Bool lastWasControlL = FALSE;
-    static UINT lastMessage;
     static LONG lastTime;
 
     /*
@@ -331,7 +373,6 @@ winIsFakeCtrl_L(UINT message, WPARAM wParam, LPARAM lParam)
 
         if (!fReturn) {
             lastWasControlL = TRUE;
-            lastMessage = message;
             lastTime = lTime;
         }
         else {
@@ -488,8 +529,8 @@ winCheckKeyPressed(WPARAM wParam, LPARAM lParam)
     return FALSE;
 }
 
-/* Only on shift release message is sent even if both are pressed.
- * Fix this here 
+/* Only one shift release message is sent even if both are pressed.
+ * Fix this here
  */
 void
 winFixShiftKeys(int iScanCode)
index d8875ce..8b6b984 100644 (file)
 typedef struct {
     unsigned int winlayout;
     int winkbtype;
-    char *xkbmodel;
-    char *xkblayout;
-    char *xkbvariant;
-    char *xkboptions;
-    char *layoutname;
+    const char *xkbmodel;
+    const char *xkblayout;
+    const char *xkbvariant;
+    const char *xkboptions;
+    const char *layoutname;
 } WinKBLayoutRec, *WinKBLayoutPtr;
 
 /*
index 3d3fab2..8282f8b 100644 (file)
@@ -529,7 +529,7 @@ static const char *MESSAGE_NAMES[1024] = {
     "WM_XBUTTONDOWN",
     "WM_XBUTTONUP",
     "WM_XBUTTONDBLCLK",
-    "526",
+    "WM_MOUSEHWHEEL",
     "527",
     "WM_PARENTNOTIFY",
     "WM_ENTERMENULOOP",
index 07532f6..955fb92 100644 (file)
@@ -27,6 +27,10 @@ from The Open Group.
 
 */
 
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+
 #include "win.h"
 #include "winmonitors.h"
 
@@ -55,13 +59,13 @@ getMonitorInfo(HMONITOR hMonitor, HDC hdc, LPRECT rect, LPARAM _data)
 }
 
 Bool
-QueryMonitor(int index, struct GetMonitorInfoData *data)
+QueryMonitor(int i, struct GetMonitorInfoData *data)
 {
     /* prepare data */
     if (data == NULL)
         return FALSE;
     memset(data, 0, sizeof(*data));
-    data->requestedMonitor = index;
+    data->requestedMonitor = i;
 
     /* query information */
     EnumDisplayMonitors(NULL, NULL, getMonitorInfo, (LPARAM) data);
index 8201e47..5fe3ecd 100644 (file)
@@ -40,4 +40,4 @@ struct GetMonitorInfoData {
     HMONITOR monitorHandle;
 };
 
-Bool QueryMonitor(int index, struct GetMonitorInfoData *data);
+Bool QueryMonitor(int i, struct GetMonitorInfoData *data);
index 9d896c9..bbe21cb 100644 (file)
@@ -65,10 +65,10 @@ int
 winMouseProc(DeviceIntPtr pDeviceInt, int iState)
 {
     int lngMouseButtons, i;
-    int lngWheelEvents = 2;
+    int lngWheelEvents = 4;
     CARD8 *map;
     DevicePtr pDevice = (DevicePtr) pDeviceInt;
-    Atom *btn_labels;
+    Atom btn_labels[9];
     Atom axes_labels[2];
 
     switch (iState) {
@@ -80,15 +80,23 @@ winMouseProc(DeviceIntPtr pDeviceInt, int iState)
         /* Mapping of windows events to X events:
          * LEFT:1 MIDDLE:2 RIGHT:3
          * SCROLL_UP:4 SCROLL_DOWN:5
-         * XBUTTON 1:6 XBUTTON 2:7 ...
+         * TILT_LEFT:6 TILT_RIGHT:7
+         * XBUTTON 1:8 XBUTTON 2:9 (most commonly 'back' and 'forward')
+         * ...
          *
+         * The current Windows API only defines 2 extra buttons, so we don't
+         * expect more than 5 buttons to be reported, but more than that
+         * should be handled correctly
+         */
+
+        /*
          * To map scroll wheel correctly we need at least the 3 normal buttons
          */
         if (lngMouseButtons < 3)
             lngMouseButtons = 3;
 
-        /* allocate memory: 
-         * number of buttons + 2x mouse wheel event + 1 extra (offset for map) 
+        /* allocate memory:
+         * number of buttons + 4 x mouse wheel event + 1 extra (offset for map)
          */
         map = malloc(sizeof(CARD8) * (lngMouseButtons + lngWheelEvents + 1));
 
@@ -97,12 +105,15 @@ winMouseProc(DeviceIntPtr pDeviceInt, int iState)
         for (i = 1; i <= lngMouseButtons + lngWheelEvents; i++)
             map[i] = i;
 
-        btn_labels = calloc((lngMouseButtons + lngWheelEvents), sizeof(Atom));
         btn_labels[0] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_LEFT);
         btn_labels[1] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_MIDDLE);
         btn_labels[2] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_RIGHT);
         btn_labels[3] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_UP);
         btn_labels[4] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_DOWN);
+        btn_labels[5] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_HWHEEL_LEFT);
+        btn_labels[6] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_HWHEEL_RIGHT);
+        btn_labels[7] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_BACK);
+        btn_labels[8] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_FORWARD);
 
         axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_X);
         axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_Y);
@@ -114,7 +125,6 @@ winMouseProc(DeviceIntPtr pDeviceInt, int iState)
                                 winMouseCtrl,
                                 GetMotionHistorySize(), 2, axes_labels);
         free(map);
-        free(btn_labels);
 
         g_winMouseButtonMap = pDeviceInt->button->map;
         break;
@@ -135,20 +145,16 @@ winMouseProc(DeviceIntPtr pDeviceInt, int iState)
 
 /* Handle the mouse wheel */
 int
-winMouseWheel(ScreenPtr pScreen, int iDeltaZ)
+winMouseWheel(int *iTotalDeltaZ, int iDeltaZ, int iButtonUp, int iButtonDown)
 {
-    winScreenPriv(pScreen);
-    int button;                 /* Button4 or Button5 */
-
-    /* Button4 = WheelUp */
-    /* Button5 = WheelDown */
+    int button;
 
     /* Do we have any previous delta stored? */
-    if ((pScreenPriv->iDeltaZ > 0 && iDeltaZ > 0)
-        || (pScreenPriv->iDeltaZ < 0 && iDeltaZ < 0)) {
+    if ((*iTotalDeltaZ > 0 && iDeltaZ > 0)
+        || (*iTotalDeltaZ < 0 && iDeltaZ < 0)) {
         /* Previous delta and of same sign as current delta */
-        iDeltaZ += pScreenPriv->iDeltaZ;
-        pScreenPriv->iDeltaZ = 0;
+        iDeltaZ += *iTotalDeltaZ;
+        *iTotalDeltaZ = 0;
     }
     else {
         /*
@@ -157,7 +163,7 @@ winMouseWheel(ScreenPtr pScreen, int iDeltaZ)
          * as blindly setting takes just as much time
          * as checking, then setting if necessary :)
          */
-        pScreenPriv->iDeltaZ = 0;
+        *iTotalDeltaZ = 0;
     }
 
     /*
@@ -165,7 +171,7 @@ winMouseWheel(ScreenPtr pScreen, int iDeltaZ)
      * WHEEL_DELTA
      */
     if (iDeltaZ >= WHEEL_DELTA || (-1 * iDeltaZ) >= WHEEL_DELTA) {
-        pScreenPriv->iDeltaZ = 0;
+        *iTotalDeltaZ = 0;
 
         /* Figure out how many whole deltas of the wheel we have */
         iDeltaZ /= WHEEL_DELTA;
@@ -176,16 +182,16 @@ winMouseWheel(ScreenPtr pScreen, int iDeltaZ)
          * we will store the wheel delta until the threshold
          * has been reached.
          */
-        pScreenPriv->iDeltaZ = iDeltaZ;
+        *iTotalDeltaZ = iDeltaZ;
         return 0;
     }
 
     /* Set the button to indicate up or down wheel delta */
     if (iDeltaZ > 0) {
-        button = Button4;
+        button = iButtonUp;
     }
     else {
-        button = Button5;
+        button = iButtonDown;
     }
 
     /*
index 4355bae..32923e5 100644 (file)
@@ -30,7 +30,6 @@
  * Authors:    Harold L Hunt II
  */
 
-#define NONAMELESSUNION
 #define DIRECTDRAW_VERSION     0x0300
 #ifndef WIN32_LEAN_AND_MEAN
 #define WIN32_LEAN_AND_MEAN
 #include <X11/Xwindows.h>
 #include <windowsx.h>
 
+#pragma push_macro("Status")
+#undef Status
+#define Status wStatus
 #include "ddraw.h"
+#pragma pop_macro("Status")
 
 #undef CreateWindow
 
index 07c2f30..56e7a09 100644 (file)
@@ -38,7 +38,9 @@
 #endif
 #include <stdarg.h>
 
-void winVMsg(int, MessageType, int verb, const char *, va_list);
+void
+winVMsg(int, MessageType, int verb, const char *, va_list)
+_X_ATTRIBUTE_PRINTF(4, 0);
 
 void
 winVMsg(int scrnIndex, MessageType type, int verb, const char *format,
@@ -135,7 +137,7 @@ winW32ErrorEx(int verb, const char *msg, DWORD errorcode)
                        NULL,
                        errorcode,
                        MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
-                       (LPTSTR) & buffer, 0, NULL)) {
+                       (LPTSTR) &buffer, 0, NULL)) {
         winErrorFVerb(verb, "Unknown error in FormatMessage!\n");
     }
     else {
index ec285ba..b638f2c 100644 (file)
  * Function prototypes
  */
 
-void winDrvMsgVerb(int scrnIndex,
-                   MessageType type, int verb, const char *format, ...);
-void winDrvMsg(int scrnIndex, MessageType type, const char *format, ...);
-void winMsgVerb(MessageType type, int verb, const char *format, ...);
-void winMsg(MessageType type, const char *format, ...);
-void winDebug(const char *format, ...);
-void winTrace(const char *format, ...);
+void
+winDrvMsgVerb(int scrnIndex,
+              MessageType type, int verb, const char *format, ...)
+_X_ATTRIBUTE_PRINTF(4, 5);
+void
+winDrvMsg(int scrnIndex, MessageType type, const char *format, ...)
+_X_ATTRIBUTE_PRINTF(3, 4);
+void
+winMsgVerb(MessageType type, int verb, const char *format, ...)
+_X_ATTRIBUTE_PRINTF(3, 4);
+void
+winMsg(MessageType type, const char *format, ...)
+_X_ATTRIBUTE_PRINTF(2, 3);
+void
+winDebug(const char *format, ...)
+_X_ATTRIBUTE_PRINTF(1, 2);
+void
+winTrace(const char *format, ...)
+_X_ATTRIBUTE_PRINTF(1, 2);
 
-void winErrorFVerb(int verb, const char *format, ...);
+void
+winErrorFVerb(int verb, const char *format, ...)
+_X_ATTRIBUTE_PRINTF(2, 3);
 void winW32Error(int verb, const char *message);
 void winW32ErrorEx(int verb, const char *message, DWORD errorcode);
 void winDebugWin32Message(const char *function, HWND hwnd, UINT message,
diff --git a/hw/xwin/winmsgwindow.c b/hw/xwin/winmsgwindow.c
new file mode 100644 (file)
index 0000000..59f1da5
--- /dev/null
@@ -0,0 +1,184 @@
+/*
+ * Copyright (C) Jon TURNEY 2011
+ *
+ * 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.
+ *
+ */
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+
+#include "win.h"
+
+/*
+ * This is the messaging window, a hidden top-level window. We never do anything
+ * with it, but other programs may send messages to it.
+ */
+
+/*
+ * winMsgWindowProc - Window procedure for msg window
+ */
+
+static
+LRESULT CALLBACK
+winMsgWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
+{
+#if CYGDEBUG
+    winDebugWin32Message("winMsgWindowProc", hwnd, message, wParam, lParam);
+#endif
+
+    switch (message) {
+    case WM_ENDSESSION:
+        if (!wParam)
+            return 0;           /* shutdown is being cancelled */
+
+        /*
+           Send a WM_GIVEUP message to the X server thread so it wakes up if
+           blocked in select(), performs GiveUp(), and then notices that GiveUp()
+           has set the DE_TERMINATE flag so exits the msg dispatch loop.
+         */
+        {
+            ScreenPtr pScreen = screenInfo.screens[0];
+
+            winScreenPriv(pScreen);
+            PostMessage(pScreenPriv->hwndScreen, WM_GIVEUP, 0, 0);
+        }
+
+        /*
+           This process will be terminated by the system almost immediately
+           after the last thread with a message queue returns from processing
+           WM_ENDSESSION, so we cannot rely on any code executing after this
+           message is processed and need to wait here until ddxGiveUp() is called
+           and releases the termination mutex to guarantee that the lock file and
+           unix domain sockets have been removed
+
+           ofc, Microsoft doesn't document this under WM_ENDSESSION, you are supposed
+           to read the source of CRSS to find out how it works :-)
+
+           http://blogs.msdn.com/b/michen/archive/2008/04/04/application-termination-when-user-logs-off.aspx
+         */
+        {
+            int iReturn = pthread_mutex_lock(&g_pmTerminating);
+
+            if (iReturn != 0) {
+                ErrorF("winMsgWindowProc - pthread_mutex_lock () failed: %d\n",
+                       iReturn);
+            }
+            winDebug
+                ("winMsgWindowProc - WM_ENDSESSION termination lock acquired\n");
+        }
+
+        return 0;
+    }
+
+    return DefWindowProc(hwnd, message, wParam, lParam);
+}
+
+static HWND
+winCreateMsgWindow(void)
+{
+    HWND hwndMsg;
+    wATOM winClass;
+
+    // register window class
+    {
+        WNDCLASSEX wcx;
+
+        wcx.cbSize = sizeof(WNDCLASSEX);
+        wcx.style = CS_HREDRAW | CS_VREDRAW;
+        wcx.lpfnWndProc = winMsgWindowProc;
+        wcx.cbClsExtra = 0;
+        wcx.cbWndExtra = 0;
+        wcx.hInstance = g_hInstance;
+        wcx.hIcon = NULL;
+        wcx.hCursor = 0;
+        wcx.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
+        wcx.lpszMenuName = NULL;
+        wcx.lpszClassName = WINDOW_CLASS_X_MSG;
+        wcx.hIconSm = NULL;
+        winClass = RegisterClassEx(&wcx);
+    }
+
+    // Create the msg window.
+    hwndMsg = CreateWindowEx(0, // no extended styles
+                             WINDOW_CLASS_X_MSG,        // class name
+                             "XWin Msg Window", // window name
+                             WS_OVERLAPPEDWINDOW,       // overlapped window
+                             CW_USEDEFAULT,     // default horizontal position
+                             CW_USEDEFAULT,     // default vertical position
+                             CW_USEDEFAULT,     // default width
+                             CW_USEDEFAULT,     // default height
+                             (HWND) NULL,       // no parent or owner window
+                             (HMENU) NULL,      // class menu used
+                             GetModuleHandle(NULL),     // instance handle
+                             NULL);     // no window creation data
+
+    if (!hwndMsg) {
+        ErrorF("winCreateMsgWindow - Create msg window failed\n");
+        return NULL;
+    }
+
+    winDebug("winCreateMsgWindow - Created msg window hwnd 0x%x\n", hwndMsg);
+
+    return hwndMsg;
+}
+
+static void *
+winMsgWindowThreadProc(void *arg)
+{
+    HWND hwndMsg;
+
+    winDebug("winMsgWindowThreadProc - Hello\n");
+
+    hwndMsg = winCreateMsgWindow();
+    if (hwndMsg) {
+        MSG msg;
+
+        /* Pump the msg window message queue */
+        while (GetMessage(&msg, hwndMsg, 0, 0) > 0) {
+#if CYGDEBUG
+            winDebugWin32Message("winMsgWindowThread", msg.hwnd, msg.message,
+                                 msg.wParam, msg.lParam);
+#endif
+            DispatchMessage(&msg);
+        }
+    }
+
+    winDebug("winMsgWindowThreadProc - Exit\n");
+
+    return NULL;
+}
+
+Bool
+winCreateMsgWindowThread(void)
+{
+    pthread_t ptMsgWindowThreadProc;
+
+    /* Spawn a thread for the msg window  */
+    if (pthread_create(&ptMsgWindowThreadProc,
+                       NULL, winMsgWindowThreadProc, NULL)) {
+        /* Bail if thread creation failed */
+        ErrorF("winCreateMsgWindow - pthread_create failed.\n");
+        return FALSE;
+    }
+
+    return TRUE;
+}
index 1af104d..6787332 100644 (file)
@@ -68,7 +68,12 @@ winMultiWindowGetClassHint(WindowPtr pWin, char **res_name, char **res_class)
     while (prop) {
         if (prop->propertyName == XA_WM_CLASS
             && prop->type == XA_STRING && prop->format == 8 && prop->data) {
+            /*
+              WM_CLASS property should consist of 2 null terminated strings, but we
+              must handle the cases when one or both is absent or not null terminated
+            */
             len_name = strlen((char *) prop->data);
+            if (len_name > prop->size) len_name = prop->size;
 
             (*res_name) = malloc(len_name + 1);
 
@@ -77,13 +82,13 @@ winMultiWindowGetClassHint(WindowPtr pWin, char **res_name, char **res_class)
                 return 0;
             }
 
-            /* Add one to len_name to allow copying of trailing 0 */
-            strncpy((*res_name), prop->data, len_name + 1);
+            /* Copy name and ensure null terminated */
+            strncpy((*res_name), prop->data, len_name);
+            (*res_name)[len_name] = '\0';
 
-            if (len_name == prop->size)
-                len_name--;
-
-            len_class = strlen(((char *) prop->data) + 1 + len_name);
+            /* Compute length of class name, it could be that it is absent or not null terminated */
+            len_class = (len_name >= prop->size) ? 0 : (strlen(((char *) prop->data) + 1 + len_name));
+            if (len_class > prop->size - 1 - len_name) len_class = prop->size - 1 - len_name;
 
             (*res_class) = malloc(len_class + 1);
 
@@ -95,7 +100,9 @@ winMultiWindowGetClassHint(WindowPtr pWin, char **res_name, char **res_class)
                 return 0;
             }
 
-            strcpy((*res_class), ((char *) prop->data) + 1 + len_name);
+            /* Copy class name and ensure null terminated */
+            strncpy((*res_class), ((char *) prop->data) + 1 + len_name, len_class);
+            (*res_class)[len_class] = '\0';
 
             return 1;
         }
@@ -213,7 +220,7 @@ winMultiWindowGetWMNormalHints(WindowPtr pWin, WinXSizeHints * hints)
 }
 
 int
-winMultiWindowGetTransientFor(WindowPtr pWin, WindowPtr *ppDaddy)
+winMultiWindowGetTransientFor(WindowPtr pWin, Window *pDaddyId)
 {
     struct _Window *pwin;
     struct _Property *prop;
@@ -230,13 +237,13 @@ winMultiWindowGetTransientFor(WindowPtr pWin, WindowPtr *ppDaddy)
     else
         prop = NULL;
 
-    if (ppDaddy)
-        *ppDaddy = NULL;
+    if (pDaddyId)
+        *pDaddyId = 0;
 
     while (prop) {
         if (prop->propertyName == XA_WM_TRANSIENT_FOR) {
-            if (ppDaddy)
-                memcpy(ppDaddy, prop->data, sizeof(WindowPtr));
+            if (pDaddyId)
+                memcpy(pDaddyId, prop->data, sizeof(Window));
             return 1;
         }
         else
index 0e3465c..3244f78 100644 (file)
@@ -118,6 +118,6 @@ int
  winMultiWindowGetWMName(WindowPtr pWin, char **wmName);
 
 int
- winMultiWindowGetTransientFor(WindowPtr pWin, WindowPtr *ppDaddy);
+ winMultiWindowGetTransientFor(WindowPtr pWin, Window *ppDaddy);
 
 #endif
index b8357e7..93d389d 100644 (file)
@@ -253,10 +253,14 @@ NetWMToWinIconAlpha(uint32_t * icon)
     ii.fIcon = TRUE;
     ii.xHotspot = 0;            /* ignored */
     ii.yHotspot = 0;            /* ignored */
-    ii.hbmColor = CreateDIBSection(hdc, (BITMAPINFO *) & bmh,
+    ii.hbmColor = CreateDIBSection(hdc, (BITMAPINFO *) &bmh,
                                    DIB_RGB_COLORS, (void **) &DIB_pixels, NULL,
                                    0);
     ReleaseDC(NULL, hdc);
+
+    if (!ii.hbmColor)
+      return NULL;
+
     ii.hbmMask = CreateBitmap(width, height, 1, 1, NULL);
     memcpy(DIB_pixels, pixels, height * width * 4);
 
@@ -368,13 +372,12 @@ winXIconToHICON(Display * pDisplay, Window id, int iconSize)
     unsigned char *mask, *image = NULL, *imageMask;
     unsigned char *dst, *src;
     int planes, bpp, i;
-    int biggest_size = 0;
+    unsigned int biggest_size = 0;
     HDC hDC;
     ICONINFO ii;
     XWMHints *hints;
     HICON hIcon = NULL;
     uint32_t *biggest_icon = NULL;
-
     static Atom _XA_NET_WM_ICON;
     static int generation;
     uint32_t *icon, *icon_data = NULL;
@@ -401,10 +404,25 @@ winXIconToHICON(Display * pDisplay, Window id, int iconSize)
         (icon_data != NULL)) {
         for (icon = icon_data; icon < &icon_data[size] && *icon;
              icon = &icon[icon[0] * icon[1] + 2]) {
-            /* Find an exact match to the size we require...  */
+            winDebug("winXIconToHICON: %u x %u NetIcon\n", icon[0], icon[1]);
+
+            /* Icon data size will overflow an int and thus is bigger than the
+               property can possibly be */
+            if ((INT_MAX/icon[0]) < icon[1]) {
+                winDebug("winXIconToHICON: _NET_WM_ICON icon data size overflow\n");
+                break;
+            }
+
+            /* Icon data size is bigger than amount of data remaining */
+            if (&icon[icon[0] * icon[1] + 2] > &icon_data[size]) {
+                winDebug("winXIconToHICON: _NET_WM_ICON data is malformed\n");
+                break;
+            }
+
+            /* Found an exact match to the size we require...  */
             if (icon[0] == iconSize && icon[1] == iconSize) {
-                winDebug("winXIconToHICON: found %lu x %lu NetIcon\n", icon[0],
-                         icon[1]);
+                winDebug("winXIconToHICON: selected %d x %d NetIcon\n",
+                         iconSize, iconSize);
                 hIcon = NetWMToWinIcon(bpp, icon);
                 break;
             }
@@ -417,7 +435,7 @@ winXIconToHICON(Display * pDisplay, Window id, int iconSize)
 
         if (!hIcon && biggest_icon) {
             winDebug
-                ("winXIconToHICON: selected %lu x %lu NetIcon for scaling to %u x %u\n",
+                ("winXIconToHICON: selected %u x %u NetIcon for scaling to %d x %d\n",
                  biggest_icon[0], biggest_icon[1], iconSize, iconSize);
 
             hIcon = NetWMToWinIcon(bpp, biggest_icon);
@@ -624,7 +642,7 @@ winDestroyIcon(HICON hIcon)
     /* Delete the icon if its not one of the application defaults or an override */
     if (hIcon &&
         hIcon != g_hIconX &&
-        hIcon != g_hSmallIconX && !winIconIsOverride((unsigned long) hIcon))
+        hIcon != g_hSmallIconX && !winIconIsOverride(hIcon))
         DestroyIcon(hIcon);
 }
 #endif
index d5200cd..cb0f389 100644 (file)
@@ -137,7 +137,7 @@ winReshapeMultiWindow(WindowPtr pWin)
 
         /* Translate client rectangle coords to screen coords */
         /* NOTE: Only transforms top and left members */
-        ClientToScreen(pWinPriv->hWnd, (LPPOINT) & rcClient);
+        ClientToScreen(pWinPriv->hWnd, (LPPOINT) &rcClient);
 
         /* Get window rectangle */
         if (!GetWindowRect(pWinPriv->hWnd, &rcWindow)) {
index c0c7db2..f2e7907 100644 (file)
@@ -53,7 +53,7 @@ static void
  winUpdateWindowsWindow(WindowPtr pWin);
 
 static void
- winFindWindow(pointer value, XID id, pointer cdata);
+ winFindWindow(void *value, XID id, void *cdata);
 
 static
     void
@@ -486,7 +486,7 @@ winCreateWindowsWindow(WindowPtr pWin)
     winWindowPriv(pWin);
     winPrivScreenPtr pScreenPriv = pWinPriv->pScreenPriv;
     WinXSizeHints hints;
-    WindowPtr pDaddy;
+    Window daddyId;
     DWORD dwStyle, dwExStyle;
     RECT rc;
 
@@ -516,10 +516,10 @@ winCreateWindowsWindow(WindowPtr pWin)
     winDebug("winCreateWindowsWindow - %dx%d @ %dx%d\n", iWidth, iHeight, iX,
              iY);
 
-    if (winMultiWindowGetTransientFor(pWin, &pDaddy)) {
-        if (pDaddy) {
+    if (winMultiWindowGetTransientFor(pWin, &daddyId)) {
+        if (daddyId) {
             hFore = GetForegroundWindow();
-            if (hFore && (pDaddy != (WindowPtr) GetProp(hFore, WIN_WID_PROP)))
+            if (hFore && (daddyId != (Window) (INT_PTR) GetProp(hFore, WIN_WID_PROP)))
                 hFore = NULL;
         }
     }
@@ -593,7 +593,7 @@ winCreateWindowsWindow(WindowPtr pWin)
     /* Cause any .XWinrc menus to be added in main WNDPROC */
     PostMessage(hWnd, WM_INIT_SYS_MENU, 0, 0);
 
-    SetProp(hWnd, WIN_WID_PROP, (HANDLE) winGetWindowID(pWin));
+    SetProp(hWnd, WIN_WID_PROP, (HANDLE) (INT_PTR) winGetWindowID(pWin));
 
     /* Flag that this Windows window handles its own activation */
     SetProp(hWnd, WIN_NEEDMANAGE_PROP, (HANDLE) 0);
@@ -724,7 +724,7 @@ winGetWindowID(WindowPtr pWin)
  */
 
 static void
-winFindWindow(pointer value, XID id, pointer cdata)
+winFindWindow(void *value, XID id, void *cdata)
 {
     WindowIDPairPtr wi = (WindowIDPairPtr) cdata;
 
@@ -808,13 +808,12 @@ winMinimizeWindow(Window id)
     HWND hWnd;
     ScreenPtr pScreen = NULL;
     winPrivScreenPtr pScreenPriv = NULL;
-    winScreenInfo *pScreenInfo = NULL;
 
 #if CYGWINDOWING_DEBUG
     ErrorF("winMinimizeWindow\n");
 #endif
 
-    dixLookupResourceByType((pointer) &pWin, id, RT_WINDOW, NullClient,
+    dixLookupResourceByType((void *) &pWin, id, RT_WINDOW, NullClient,
                             DixUnknownAccess);
     if (!pWin) {
         ErrorF("%s: NULL pWin. Leaving\n", __FUNCTION__);
@@ -824,11 +823,9 @@ winMinimizeWindow(Window id)
     pScreen = pWin->drawable.pScreen;
     if (pScreen)
         pScreenPriv = winGetScreenPriv(pScreen);
-    if (pScreenPriv)
-        pScreenInfo = pScreenPriv->pScreenInfo;
 
 #ifdef XWIN_MULTIWINDOWEXTWM
-    if (pScreenPriv && pScreenInfo->fInternalWM) {
+    if (pScreenPriv && pScreenPriv->pScreenInfo->fInternalWM) {
         pRLWinPriv =
             (win32RootlessWindowPtr) RootlessFrameForWindow(pWin, FALSE);
         hWnd = pRLWinPriv->hWnd;
index ffb7c2d..618e381 100644 (file)
 #include <X11/Xwindows.h>
 
 /* Local headers */
-#include "objbase.h"
-#include "ddraw.h"
 #include "winwindow.h"
 #include "winprefs.h"
 #include "window.h"
 #include "pixmapstr.h"
 #include "windowstr.h"
+#include "winglobals.h"
 
 #ifdef XWIN_MULTIWINDOWEXTWM
 #include <X11/extensions/windowswmstr.h>
 #define WINDOWSWM_NATIVE_HWND "_WINDOWSWM_NATIVE_HWND"
 #endif
 
+#ifndef HOST_NAME_MAX
+#define HOST_NAME_MAX 255
+#endif
+
 extern void winDebug(const char *format, ...);
 extern void winReshapeMultiWindow(WindowPtr pWin);
 extern void winUpdateRgnMultiWindow(WindowPtr pWin);
@@ -113,6 +116,7 @@ typedef struct _WMInfo {
     WMMsgQueueRec wmMsgQueue;
     Atom atmWmProtos;
     Atom atmWmDelete;
+    Atom atmWmTakeFocus;
     Atom atmPrivMap;
     Bool fAllowOtherWM;
 } WMInfoRec, *WMInfoPtr;
@@ -132,13 +136,6 @@ typedef struct _XMsgProcArgRec {
 } XMsgProcArgRec, *XMsgProcArgPtr;
 
 /*
- * References to external symbols
- */
-
-extern char *display;
-extern void ErrorF(const char * /*f */ , ...);
-
-/*
  * Prototypes for local functions
  */
 
@@ -195,7 +192,7 @@ static void
  winApplyHints(Display * pDisplay, Window iWindow, HWND hWnd, HWND * zstyle);
 
 void
- winUpdateWindowPosition(HWND hWnd, Bool reshape, HWND * zstyle);
+ winUpdateWindowPosition(HWND hWnd, HWND * zstyle);
 
 /*
  * Local globals
@@ -414,7 +411,7 @@ Xutf8TextPropertyToString(Display * pDisplay, XTextProperty * xtp)
 
         for (i = 0; i < nNum; i++)
             iLen += strlen(ppList[i]);
-        pszReturnData = (char *) malloc(iLen + 1);
+        pszReturnData = malloc(iLen + 1);
         pszReturnData[0] = '\0';
         for (i = 0; i < nNum; i++)
             strcat(pszReturnData, ppList[i]);
@@ -422,7 +419,7 @@ Xutf8TextPropertyToString(Display * pDisplay, XTextProperty * xtp)
             XFreeStringList(ppList);
     }
     else {
-        pszReturnData = (char *) malloc(1);
+        pszReturnData = malloc(1);
         pszReturnData[0] = '\0';
     }
 
@@ -438,7 +435,10 @@ GetWindowName(Display * pDisplay, Window iWin, char **ppWindowName)
 {
     int nResult;
     XTextProperty xtpWindowName;
+    XTextProperty xtpClientMachine;
     char *pszWindowName;
+    char *pszClientMachine;
+    char hostname[HOST_NAME_MAX + 1];
 
 #if CYGMULTIWINDOW_DEBUG
     ErrorF("GetWindowName\n");
@@ -458,10 +458,66 @@ GetWindowName(Display * pDisplay, Window iWin, char **ppWindowName)
 
     pszWindowName = Xutf8TextPropertyToString(pDisplay, &xtpWindowName);
     XFree(xtpWindowName.value);
+
+    if (g_fHostInTitle) {
+        /* Try to get client machine name */
+        nResult = XGetWMClientMachine(pDisplay, iWin, &xtpClientMachine);
+        if (nResult && xtpClientMachine.value && xtpClientMachine.nitems) {
+            pszClientMachine =
+                Xutf8TextPropertyToString(pDisplay, &xtpClientMachine);
+            XFree(xtpClientMachine.value);
+
+            /*
+               If we have a client machine name
+               and it's not the local host name
+               and it's not already in the window title...
+             */
+            if (strlen(pszClientMachine) &&
+                !gethostname(hostname, HOST_NAME_MAX + 1) &&
+                strcmp(hostname, pszClientMachine) &&
+                (strstr(pszWindowName, pszClientMachine) == 0)) {
+                /* ... add '@<clientmachine>' to end of window name */
+                *ppWindowName =
+                    malloc(strlen(pszWindowName) +
+                           strlen(pszClientMachine) + 2);
+                strcpy(*ppWindowName, pszWindowName);
+                strcat(*ppWindowName, "@");
+                strcat(*ppWindowName, pszClientMachine);
+
+                free(pszWindowName);
+                free(pszClientMachine);
+
+                return;
+            }
+        }
+    }
+
+    /* otherwise just return the window name */
     *ppWindowName = pszWindowName;
 }
 
 /*
+ * Does the client support the specified WM_PROTOCOLS protocol?
+ */
+
+static Bool
+IsWmProtocolAvailable(Display * pDisplay, Window iWindow, Atom atmProtocol)
+{
+  int i, n, found = 0;
+  Atom *protocols;
+
+  if (XGetWMProtocols(pDisplay, iWindow, &protocols, &n)) {
+    for (i = 0; i < n; ++i)
+      if (protocols[i] == atmProtocol)
+        ++found;
+
+    XFree(protocols);
+  }
+
+  return found > 0;
+}
+
+/*
  * Send a message to the X server from the WM thread
  */
 
@@ -497,7 +553,7 @@ getHwnd(WMInfoPtr pWMInfo, Window iWindow)
                            iWindow,
                            pWMInfo->atmPrivMap,
                            0,
-                           1,
+                           sizeof(HWND)/4,
                            False,
                            XA_INTEGER,
                            &atmType,
@@ -526,7 +582,6 @@ getHwnd(WMInfoPtr pWMInfo, Window iWindow)
 static void
 UpdateName(WMInfoPtr pWMInfo, Window iWindow)
 {
-    wchar_t *pszName;
     HWND hWnd;
     XWindowAttributes attr;
 
@@ -547,7 +602,7 @@ UpdateName(WMInfoPtr pWMInfo, Window iWindow)
             int iLen =
                 MultiByteToWideChar(CP_UTF8, 0, pszWindowName, -1, NULL, 0);
             wchar_t *pwszWideWindowName =
-                (wchar_t *) malloc(sizeof(wchar_t) * (iLen + 1));
+                malloc(sizeof(wchar_t)*(iLen + 1));
             MultiByteToWideChar(CP_UTF8, 0, pszWindowName, -1,
                                 pwszWideWindowName, iLen);
 
@@ -600,6 +655,45 @@ UpdateIcon(WMInfoPtr pWMInfo, Window iWindow)
     winUpdateIcon(hWnd, pWMInfo->pDisplay, iWindow, hIconNew);
 }
 
+/*
+ * Updates the style of a HWND according to its X style properties
+ */
+
+static void
+UpdateStyle(WMInfoPtr pWMInfo, Window iWindow)
+{
+    HWND hWnd;
+    HWND zstyle = HWND_NOTOPMOST;
+    UINT flags;
+
+    hWnd = getHwnd(pWMInfo, iWindow);
+    if (!hWnd)
+        return;
+
+    /* Determine the Window style, which determines borders and clipping region... */
+    winApplyHints(pWMInfo->pDisplay, iWindow, hWnd, &zstyle);
+    winUpdateWindowPosition(hWnd, &zstyle);
+
+    /* Apply the updated window style, without changing it's show or activation state */
+    flags = SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE;
+    if (zstyle == HWND_NOTOPMOST)
+        flags |= SWP_NOZORDER | SWP_NOOWNERZORDER;
+    SetWindowPos(hWnd, NULL, 0, 0, 0, 0, flags);
+
+    /*
+       Use the WS_EX_TOOLWINDOW style to remove window from Alt-Tab window switcher
+
+       According to MSDN, this is supposed to remove the window from the taskbar as well,
+       if we SW_HIDE before changing the style followed by SW_SHOW afterwards.
+
+       But that doesn't seem to work reliably, and causes the window to flicker, so use
+       the iTaskbarList interface to tell the taskbar to show or hide this window.
+     */
+    winShowWindowOnTaskbar(hWnd,
+                           (GetWindowLongPtr(hWnd, GWL_EXSTYLE) &
+                            WS_EX_APPWINDOW) ? TRUE : FALSE);
+}
+
 #if 0
 /*
  * Fix up any differences between the X11 and Win32 window stacks
@@ -718,10 +812,10 @@ winMultiWindowWMProc(void *pArg)
             ErrorF("\tWM_WM_MAP\n");
 #endif
             /* Put a note as to the HWND associated with this Window */
-            XChangeProperty(pWMInfo->pDisplay, pNode->msg.iWindow, pWMInfo->atmPrivMap, XA_INTEGER,     //pWMInfo->atmPrivMap,
+            XChangeProperty(pWMInfo->pDisplay, pNode->msg.iWindow, pWMInfo->atmPrivMap, XA_INTEGER,
                             32,
                             PropModeReplace,
-                            (unsigned char *) &(pNode->msg.hwndWindow), 1);
+                            (unsigned char *) &(pNode->msg.hwndWindow), sizeof(HWND)/4);
             UpdateName(pWMInfo, pNode->msg.iWindow);
             UpdateIcon(pWMInfo, pNode->msg.iWindow);
             break;
@@ -730,10 +824,10 @@ winMultiWindowWMProc(void *pArg)
 #if CYGMULTIWINDOW_DEBUG
             ErrorF("\tWM_WM_MAP2\n");
 #endif
-            XChangeProperty(pWMInfo->pDisplay, pNode->msg.iWindow, pWMInfo->atmPrivMap, XA_INTEGER,     //pWMInfo->atmPrivMap,
+            XChangeProperty(pWMInfo->pDisplay, pNode->msg.iWindow, pWMInfo->atmPrivMap, XA_INTEGER,
                             32,
                             PropModeReplace,
-                            (unsigned char *) &(pNode->msg.hwndWindow), 1);
+                            (unsigned char *) &(pNode->msg.hwndWindow), sizeof(HWND)/4);
             break;
 
         case WM_WM_MAP3:
@@ -741,19 +835,25 @@ winMultiWindowWMProc(void *pArg)
             ErrorF("\tWM_WM_MAP3\n");
 #endif
             /* Put a note as to the HWND associated with this Window */
-            XChangeProperty(pWMInfo->pDisplay, pNode->msg.iWindow, pWMInfo->atmPrivMap, XA_INTEGER,     //pWMInfo->atmPrivMap,
+            XChangeProperty(pWMInfo->pDisplay, pNode->msg.iWindow, pWMInfo->atmPrivMap, XA_INTEGER,
                             32,
                             PropModeReplace,
-                            (unsigned char *) &(pNode->msg.hwndWindow), 1);
+                            (unsigned char *) &(pNode->msg.hwndWindow), sizeof(HWND)/4);
             UpdateName(pWMInfo, pNode->msg.iWindow);
             UpdateIcon(pWMInfo, pNode->msg.iWindow);
-            {
-                HWND zstyle = HWND_NOTOPMOST;
+            UpdateStyle(pWMInfo, pNode->msg.iWindow);
 
-                winApplyHints(pWMInfo->pDisplay, pNode->msg.iWindow,
-                              pNode->msg.hwndWindow, &zstyle);
-                winUpdateWindowPosition(pNode->msg.hwndWindow, TRUE, &zstyle);
+
+            /* Reshape */
+            {
+                WindowPtr pWin =
+                    GetProp(pNode->msg.hwndWindow, WIN_WINDOW_PROP);
+                if (pWin) {
+                    winReshapeMultiWindow(pWin);
+                    winUpdateRgnMultiWindow(pWin);
+                }
             }
+
             break;
 
         case WM_WM_UNMAP:
@@ -770,21 +870,10 @@ winMultiWindowWMProc(void *pArg)
             ErrorF("\tWM_WM_KILL\n");
 #endif
             {
-                int i, n, found = 0;
-                Atom *protocols;
-
                 /* --- */
-                if (XGetWMProtocols(pWMInfo->pDisplay,
-                                    pNode->msg.iWindow, &protocols, &n)) {
-                    for (i = 0; i < n; ++i)
-                        if (protocols[i] == pWMInfo->atmWmDelete)
-                            ++found;
-
-                    XFree(protocols);
-                }
-
-                /* --- */
-                if (found)
+                if (IsWmProtocolAvailable(pWMInfo->pDisplay,
+                                          pNode->msg.iWindow,
+                                          pWMInfo->atmWmDelete))
                     SendXMessage(pWMInfo->pDisplay,
                                  pNode->msg.iWindow,
                                  pWMInfo->atmWmProtos, pWMInfo->atmWmDelete);
@@ -797,11 +886,39 @@ winMultiWindowWMProc(void *pArg)
 #if CYGMULTIWINDOW_DEBUG
             ErrorF("\tWM_WM_ACTIVATE\n");
 #endif
-
             /* Set the input focus */
-            XSetInputFocus(pWMInfo->pDisplay,
-                           pNode->msg.iWindow,
-                           RevertToPointerRoot, CurrentTime);
+
+            /*
+               ICCCM 4.1.7 is pretty opaque, but it appears that the rules are
+               actually quite simple:
+               -- the WM_HINTS input field determines whether the WM should call
+               XSetInputFocus()
+               -- independently, the WM_TAKE_FOCUS protocol determines whether
+               the WM should send a WM_TAKE_FOCUS ClientMessage.
+            */
+            {
+              Bool neverFocus = FALSE;
+              XWMHints *hints = XGetWMHints(pWMInfo->pDisplay, pNode->msg.iWindow);
+
+              if (hints) {
+                if (hints->flags & InputHint)
+                  neverFocus = !hints->input;
+                XFree(hints);
+              }
+
+              if (!neverFocus)
+                XSetInputFocus(pWMInfo->pDisplay,
+                               pNode->msg.iWindow,
+                               RevertToPointerRoot, CurrentTime);
+
+              if (IsWmProtocolAvailable(pWMInfo->pDisplay,
+                                        pNode->msg.iWindow,
+                                        pWMInfo->atmWmTakeFocus))
+                SendXMessage(pWMInfo->pDisplay,
+                             pNode->msg.iWindow,
+                             pWMInfo->atmWmProtos, pWMInfo->atmWmTakeFocus);
+
+            }
             break;
 
         case WM_WM_NAME_EVENT:
@@ -812,6 +929,19 @@ winMultiWindowWMProc(void *pArg)
             UpdateIcon(pWMInfo, pNode->msg.iWindow);
             break;
 
+        case WM_WM_HINTS_EVENT:
+            {
+            XWindowAttributes attr;
+
+            /* Don't do anything if this is an override-redirect window */
+            XGetWindowAttributes (pWMInfo->pDisplay, pNode->msg.iWindow, &attr);
+            if (attr.override_redirect)
+              break;
+
+            UpdateStyle(pWMInfo, pNode->msg.iWindow);
+            }
+            break;
+
         case WM_WM_CHANGE_STATE:
             /* Minimize the window in Windows */
             winMinimizeWindow(pNode->msg.iWindow);
@@ -861,6 +991,7 @@ winMultiWindowXMsgProc(void *pArg)
     Atom atmWmHints;
     Atom atmWmChange;
     Atom atmNetWmIcon;
+    Atom atmWindowState, atmMotifWmHints, atmWindowType, atmNormalHints;
     int iReturn;
     XIconSize *xis;
 
@@ -987,6 +1118,10 @@ winMultiWindowXMsgProc(void *pArg)
     atmWmHints = XInternAtom(pProcArg->pDisplay, "WM_HINTS", False);
     atmWmChange = XInternAtom(pProcArg->pDisplay, "WM_CHANGE_STATE", False);
     atmNetWmIcon = XInternAtom(pProcArg->pDisplay, "_NET_WM_ICON", False);
+    atmWindowState = XInternAtom(pProcArg->pDisplay, "_NET_WM_STATE", False);
+    atmMotifWmHints = XInternAtom(pProcArg->pDisplay, "_MOTIF_WM_HINTS", False);
+    atmWindowType = XInternAtom(pProcArg->pDisplay, "_NET_WM_WINDOW_TYPE", False);
+    atmNormalHints = XInternAtom(pProcArg->pDisplay, "WM_NORMAL_HINTS", False);
 
     /*
        iiimxcf had a bug until 2009-04-27, assuming that the
@@ -1008,15 +1143,13 @@ winMultiWindowXMsgProc(void *pArg)
                 (pProcArg->pDisplay, pProcArg->dwScreen, TRUE)) {
                 if (!g_fAnotherWMRunning) {
                     g_fAnotherWMRunning = TRUE;
-                    SendMessage(*(HWND *) pProcArg->hwndScreen, WM_UNMANAGE, 0,
-                                0);
+                    SendMessage(pProcArg->hwndScreen, WM_UNMANAGE, 0, 0);
                 }
             }
             else {
                 if (g_fAnotherWMRunning) {
                     g_fAnotherWMRunning = FALSE;
-                    SendMessage(*(HWND *) pProcArg->hwndScreen, WM_MANAGE, 0,
-                                0);
+                    SendMessage(pProcArg->hwndScreen, WM_MANAGE, 0, 0);
                 }
             }
             Sleep(500);
@@ -1124,14 +1257,34 @@ winMultiWindowXMsgProc(void *pArg)
                 /* Other fields ignored */
                 winSendMessageToWM(pProcArg->pWMInfo, &msg);
             }
-            else if ((event.xproperty.atom == atmWmHints) ||
-                     (event.xproperty.atom == atmNetWmIcon)) {
-                memset(&msg, 0, sizeof(msg));
-                msg.msg = WM_WM_ICON_EVENT;
-                msg.iWindow = event.xproperty.window;
+            else {
+                /*
+                   Several properties are considered for WM hints, check if this property change affects any of them...
+                   (this list needs to be kept in sync with winApplyHints())
+                 */
+                if ((event.xproperty.atom == atmWmHints) ||
+                    (event.xproperty.atom == atmWindowState) ||
+                    (event.xproperty.atom == atmMotifWmHints) ||
+                    (event.xproperty.atom == atmWindowType) ||
+                    (event.xproperty.atom == atmNormalHints)) {
+                    memset(&msg, 0, sizeof(msg));
+                    msg.msg = WM_WM_HINTS_EVENT;
+                    msg.iWindow = event.xproperty.window;
+
+                    /* Other fields ignored */
+                    winSendMessageToWM(pProcArg->pWMInfo, &msg);
+                }
 
-                /* Other fields ignored */
-                winSendMessageToWM(pProcArg->pWMInfo, &msg);
+                /* Not an else as WM_HINTS affects both style and icon */
+                if ((event.xproperty.atom == atmWmHints) ||
+                    (event.xproperty.atom == atmNetWmIcon)) {
+                    memset(&msg, 0, sizeof(msg));
+                    msg.msg = WM_WM_ICON_EVENT;
+                    msg.iWindow = event.xproperty.window;
+
+                    /* Other fields ignored */
+                    winSendMessageToWM(pProcArg->pWMInfo, &msg);
+                }
             }
         }
         else if (event.type == ClientMessage
@@ -1166,9 +1319,9 @@ winInitWM(void **ppWMInfo,
           pthread_mutex_t * ppmServerStarted,
           int dwScreen, HWND hwndScreen, BOOL allowOtherWM)
 {
-    WMProcArgPtr pArg = (WMProcArgPtr) malloc(sizeof(WMProcArgRec));
-    WMInfoPtr pWMInfo = (WMInfoPtr) malloc(sizeof(WMInfoRec));
-    XMsgProcArgPtr pXMsgArg = (XMsgProcArgPtr) malloc(sizeof(XMsgProcArgRec));
+    WMProcArgPtr pArg = malloc(sizeof(WMProcArgRec));
+    WMInfoPtr pWMInfo = malloc(sizeof(WMInfoRec));
+    XMsgProcArgPtr pXMsgArg = malloc(sizeof(XMsgProcArgRec));
 
     /* Bail if the input parameters are bad */
     if (pArg == NULL || pWMInfo == NULL || pXMsgArg == NULL) {
@@ -1333,6 +1486,8 @@ winInitMultiWindowWM(WMInfoPtr pWMInfo, WMProcArgPtr pProcArg)
                                        "WM_PROTOCOLS", False);
     pWMInfo->atmWmDelete = XInternAtom(pWMInfo->pDisplay,
                                        "WM_DELETE_WINDOW", False);
+    pWMInfo->atmWmTakeFocus = XInternAtom(pWMInfo->pDisplay,
+                                       "WM_TAKE_FOCUS", False);
 
     pWMInfo->atmPrivMap = XInternAtom(pWMInfo->pDisplay,
                                       WINDOWSWM_NATIVE_HWND, False);
@@ -1361,7 +1516,7 @@ winSendMessageToWM(void *pWMInfo, winWMMessagePtr pMsg)
     ErrorF("winSendMessageToWM ()\n");
 #endif
 
-    pNode = (WMMsgNodePtr) malloc(sizeof(WMMsgNodeRec));
+    pNode = malloc(sizeof(WMMsgNodeRec));
     if (pNode != NULL) {
         memcpy(&pNode->msg, pMsg, sizeof(winWMMessageRec));
         PushMessage(&((WMInfoPtr) pWMInfo)->wmMsgQueue, pNode);
@@ -1397,7 +1552,7 @@ winMultiWindowWMErrorHandler(Display * pDisplay, XErrorEvent * pErr)
 static int
 winMultiWindowWMIOErrorHandler(Display * pDisplay)
 {
-    ErrorF("winMultiWindowWMIOErrorHandler!\n\n");
+    ErrorF("winMultiWindowWMIOErrorHandler!\n");
 
     if (pthread_equal(pthread_self(), g_winMultiWindowWMThread)) {
         if (g_shutdown)
@@ -1437,7 +1592,7 @@ winMultiWindowXMsgProcErrorHandler(Display * pDisplay, XErrorEvent * pErr)
 static int
 winMultiWindowXMsgProcIOErrorHandler(Display * pDisplay)
 {
-    ErrorF("winMultiWindowXMsgProcIOErrorHandler!\n\n");
+    ErrorF("winMultiWindowXMsgProcIOErrorHandler!\n");
 
     if (pthread_equal(pthread_self(), g_winMultiWindowXMsgProcThread)) {
         /* Restart at the main entry point */
@@ -1506,13 +1661,14 @@ winDeinitMultiWindowWM(void)
 }
 
 /* Windows window styles */
-#define HINT_NOFRAME   (1l<<0)
+#define HINT_NOFRAME   (1L<<0)
 #define HINT_BORDER    (1L<<1)
-#define HINT_SIZEBOX   (1l<<2)
-#define HINT_CAPTION   (1l<<3)
+#define HINT_SIZEBOX   (1L<<2)
+#define HINT_CAPTION   (1L<<3)
 #define HINT_NOMAXIMIZE (1L<<4)
 #define HINT_NOMINIMIZE (1L<<5)
 #define HINT_NOSYSMENU  (1L<<6)
+#define HINT_SKIPTASKBAR (1L<<7)
 /* These two are used on their own */
 #define HINT_MAX       (1L<<0)
 #define HINT_MIN       (1L<<1)
@@ -1521,12 +1677,14 @@ static void
 winApplyHints(Display * pDisplay, Window iWindow, HWND hWnd, HWND * zstyle)
 {
     static Atom windowState, motif_wm_hints, windowType;
-    static Atom hiddenState, fullscreenState, belowState, aboveState;
+    static Atom hiddenState, fullscreenState, belowState, aboveState,
+        skiptaskbarState;
     static Atom dockWindow;
     static int generation;
     Atom type, *pAtom = NULL;
     int format;
-    unsigned long hint = 0, maxmin = 0, style, nitems = 0, left = 0;
+    unsigned long hint = 0, maxmin = 0, nitems = 0, left = 0;
+    unsigned long style, exStyle;
     MwmHints *mwm_hint = NULL;
 
     if (!hWnd)
@@ -1545,24 +1703,32 @@ winApplyHints(Display * pDisplay, Window iWindow, HWND hWnd, HWND * zstyle)
         belowState = XInternAtom(pDisplay, "_NET_WM_STATE_BELOW", False);
         aboveState = XInternAtom(pDisplay, "_NET_WM_STATE_ABOVE", False);
         dockWindow = XInternAtom(pDisplay, "_NET_WM_WINDOW_TYPE_DOCK", False);
+        skiptaskbarState =
+            XInternAtom(pDisplay, "_NET_WM_STATE_SKIP_TASKBAR", False);
     }
 
     if (XGetWindowProperty(pDisplay, iWindow, windowState, 0L,
-                           1L, False, XA_ATOM, &type, &format,
+                           MAXINT, False, XA_ATOM, &type, &format,
                            &nitems, &left,
                            (unsigned char **) &pAtom) == Success) {
-        if (pAtom && nitems == 1) {
-            if (*pAtom == hiddenState)
-                maxmin |= HINT_MIN;
-            else if (*pAtom == fullscreenState)
-                maxmin |= HINT_MAX;
-            if (*pAtom == belowState)
-                *zstyle = HWND_BOTTOM;
-            else if (*pAtom == aboveState)
-                *zstyle = HWND_TOPMOST;
-        }
-        if (pAtom)
+        if (pAtom ) {
+            unsigned long i;
+
+            for (i = 0; i < nitems; i++) {
+                if (pAtom[i] == skiptaskbarState)
+                    hint |= HINT_SKIPTASKBAR;
+                if (pAtom[i] == hiddenState)
+                    maxmin |= HINT_MIN;
+                else if (pAtom[i] == fullscreenState)
+                    maxmin |= HINT_MAX;
+                if (pAtom[i] == belowState)
+                    *zstyle = HWND_BOTTOM;
+                else if (pAtom[i] == aboveState)
+                    *zstyle = HWND_TOPMOST;
+            }
+
             XFree(pAtom);
+        }
     }
 
     nitems = left = 0;
@@ -1640,10 +1806,14 @@ winApplyHints(Display * pDisplay, Window iWindow, HWND hWnd, HWND * zstyle)
         XFree(normal_hint);
     }
 
-    /* Override hint settings from above with settings from config file */
+    /*
+       Override hint settings from above with settings from config file and set
+       application id for grouping.
+     */
     {
         XClassHint class_hint = { 0, 0 };
         char *window_name = 0;
+        char *application_id = 0;
 
         if (XGetClassHint(pDisplay, iWindow, &class_hint)) {
             XFetchName(pDisplay, iWindow, &window_name);
@@ -1652,10 +1822,24 @@ winApplyHints(Display * pDisplay, Window iWindow, HWND hWnd, HWND * zstyle)
                 winOverrideStyle(class_hint.res_name, class_hint.res_class,
                                  window_name);
 
+#define APPLICATION_ID_FORMAT  "%s.xwin.%s"
+#define APPLICATION_ID_UNKNOWN "unknown"
+            if (class_hint.res_class) {
+                asprintf(&application_id, APPLICATION_ID_FORMAT, XVENDORNAME,
+                         class_hint.res_class);
+            }
+            else {
+                asprintf(&application_id, APPLICATION_ID_FORMAT, XVENDORNAME,
+                         APPLICATION_ID_UNKNOWN);
+            }
+            winSetAppUserModelID(hWnd, application_id);
+
             if (class_hint.res_name)
                 XFree(class_hint.res_name);
             if (class_hint.res_class)
                 XFree(class_hint.res_class);
+            if (application_id)
+                free(application_id);
             if (window_name)
                 XFree(window_name);
         }
@@ -1692,13 +1876,15 @@ winApplyHints(Display * pDisplay, Window iWindow, HWND hWnd, HWND * zstyle)
             HINT_NOFRAME;
 
     /* Now apply styles to window */
-    style = GetWindowLongPtr(hWnd, GWL_STYLE) & ~WS_CAPTION & ~WS_SIZEBOX;      /* Just in case */
+    style = GetWindowLongPtr(hWnd, GWL_STYLE);
     if (!style)
-        return;
+        return;                 /* GetWindowLongPointer returns 0 on failure, we hope this isn't a valid style */
+
+    style &= ~WS_CAPTION & ~WS_SIZEBOX; /* Just in case */
 
-    if (!hint)                  /* All on */
+    if (!(hint & ~HINT_SKIPTASKBAR))    /* No hints, default */
         style = style | WS_CAPTION | WS_SIZEBOX;
-    else if (hint & HINT_NOFRAME)       /* All off */
+    else if (hint & HINT_NOFRAME)       /* No frame, no decorations */
         style = style & ~WS_CAPTION & ~WS_SIZEBOX;
     else
         style = style | ((hint & HINT_BORDER) ? WS_BORDER : 0) |
@@ -1714,11 +1900,25 @@ winApplyHints(Display * pDisplay, Window iWindow, HWND hWnd, HWND * zstyle)
     if (hint & HINT_NOSYSMENU)
         style = style & ~WS_SYSMENU;
 
+    if (hint & HINT_SKIPTASKBAR)
+        style = style & ~WS_MINIMIZEBOX;        /* window will become lost if minimized */
+
     SetWindowLongPtr(hWnd, GWL_STYLE, style);
+
+    exStyle = GetWindowLongPtr(hWnd, GWL_EXSTYLE);
+    if (hint & HINT_SKIPTASKBAR)
+        exStyle = (exStyle & ~WS_EX_APPWINDOW) | WS_EX_TOOLWINDOW;
+    else
+        exStyle = (exStyle & ~WS_EX_TOOLWINDOW) | WS_EX_APPWINDOW;
+    SetWindowLongPtr(hWnd, GWL_EXSTYLE, exStyle);
+
+    winDebug
+        ("winApplyHints: iWindow 0x%08x hints 0x%08x style 0x%08x exstyle 0x%08x\n",
+         iWindow, hint, style, exStyle);
 }
 
 void
-winUpdateWindowPosition(HWND hWnd, Bool reshape, HWND * zstyle)
+winUpdateWindowPosition(HWND hWnd, HWND * zstyle)
 {
     int iX, iY, iWidth, iHeight;
     int iDx, iDy;
@@ -1769,8 +1969,4 @@ winUpdateWindowPosition(HWND hWnd, Bool reshape, HWND * zstyle)
     SetWindowPos(hWnd, *zstyle, rcNew.left, rcNew.top,
                  rcNew.right - rcNew.left, rcNew.bottom - rcNew.top, 0);
 
-    if (reshape) {
-        winReshapeMultiWindow(pWin);
-        winUpdateRgnMultiWindow(pWin);
-    }
 }
index af917d6..17823ba 100644 (file)
@@ -42,7 +42,7 @@
 #include "winmsg.h"
 #include "inputstr.h"
 
-extern void winUpdateWindowPosition(HWND hWnd, Bool reshape, HWND * zstyle);
+extern void winUpdateWindowPosition(HWND hWnd, HWND * zstyle);
 
 /*
  * Local globals
@@ -316,6 +316,7 @@ winTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
     static Bool s_fTracking = FALSE;
     Bool needRestack = FALSE;
     LRESULT ret;
+    static Bool hasEnteredSizeMove = FALSE;
 
 #if CYGDEBUG
     winDebugWin32Message("winTopLevelWindowProc", hwnd, message, wParam,
@@ -343,7 +344,7 @@ winTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
         /* */
         wmMsg.msg = 0;
         wmMsg.hwndWindow = hwnd;
-        wmMsg.iWindow = (Window) GetProp(hwnd, WIN_WID_PROP);
+        wmMsg.iWindow = (Window) (INT_PTR) GetProp(hwnd, WIN_WID_PROP);
 
         wmMsg.iX = pDraw->x;
         wmMsg.iY = pDraw->y;
@@ -391,8 +392,8 @@ winTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
         /* */
         SetProp(hwnd,
                 WIN_WID_PROP,
-                (HANDLE) winGetWindowID(((LPCREATESTRUCT) lParam)->
-                                        lpCreateParams));
+                (HANDLE) (INT_PTR) winGetWindowID(((LPCREATESTRUCT) lParam)->
+                                                  lpCreateParams));
 
         /*
          * Make X windows' Z orders sync with Windows windows because
@@ -420,14 +421,14 @@ winTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
         /*
          * Add whatever the setup file wants to for this window
          */
-        SetupSysMenu((unsigned long) hwnd);
+        SetupSysMenu(hwnd);
         return 0;
 
     case WM_SYSCOMMAND:
         /*
          * Any window menu items go through here
          */
-        if (HandleCustomWM_COMMAND((unsigned long) hwnd, LOWORD(wParam))) {
+        if (HandleCustomWM_COMMAND(hwnd, LOWORD(wParam))) {
             /* Don't pass customized menus to DefWindowProc */
             return 0;
         }
@@ -443,7 +444,7 @@ winTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
 
     case WM_INITMENU:
         /* Checks/Unchecks any menu items before they are displayed */
-        HandleCustomWM_INITMENU((unsigned long) hwnd, wParam);
+        HandleCustomWM_INITMENU(hwnd, (HMENU)wParam);
         break;
 
     case WM_ERASEBKGND:
@@ -498,7 +499,7 @@ winTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
                           NULL,
                           GetLastError(),
                           MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
-                          (LPTSTR) & lpMsgBuf, 0, NULL);
+                          (LPTSTR) &lpMsgBuf, 0, NULL);
 
             ErrorF("winTopLevelWindowProc - BitBlt failed: %s\n",
                    (LPSTR) lpMsgBuf);
@@ -661,7 +662,7 @@ winTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
         if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
             break;
         SetCapture(hwnd);
-        return winMouseButtonsHandle(s_pScreen, ButtonPress, HIWORD(wParam) + 5,
+        return winMouseButtonsHandle(s_pScreen, ButtonPress, HIWORD(wParam) + 7,
                                      wParam);
 
     case WM_XBUTTONUP:
@@ -670,7 +671,7 @@ winTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
         ReleaseCapture();
         winStartMousePolling(s_pScreenPriv);
         return winMouseButtonsHandle(s_pScreen, ButtonRelease,
-                                     HIWORD(wParam) + 5, wParam);
+                                     HIWORD(wParam) + 7, wParam);
 
     case WM_MOUSEWHEEL:
         if (SendMessage
@@ -684,6 +685,18 @@ winTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
         else
             break;
 
+    case WM_MOUSEHWHEEL:
+        if (SendMessage
+            (hwnd, WM_NCHITTEST, 0,
+             MAKELONG(GET_X_LPARAM(lParam),
+                      GET_Y_LPARAM(lParam))) == HTCLIENT) {
+            /* Pass the message to the root window */
+            SendMessage(hwndScreen, message, wParam, lParam);
+            return 0;
+        }
+        else
+            break;
+
     case WM_SETFOCUS:
         if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
             break;
@@ -813,7 +826,7 @@ winTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
         }
         /* Prevent the mouse wheel from stalling when another window is minimized */
         if (HIWORD(wParam) == 0 && LOWORD(wParam) == WA_ACTIVE &&
-            (HWND) lParam != NULL && (HWND) lParam != (HWND) GetParent(hwnd))
+            (HWND) lParam != NULL && (HWND) lParam != GetParent(hwnd))
             SetFocus(hwnd);
         return 0;
 
@@ -825,6 +838,8 @@ winTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
         break;
 
     case WM_CLOSE:
+        /* Remove AppUserModelID property */
+        winSetAppUserModelID(hwnd, NULL);
         /* Branch on if the window was killed in X already */
         if (pWinPriv->fXKilled) {
             /* Window was killed, go ahead and destroy the window */
@@ -858,7 +873,9 @@ winTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
 
     case WM_MOVE:
         /* Adjust the X Window to the moved Windows window */
-        winAdjustXWindow(pWin, hwnd);
+        if (!hasEnteredSizeMove)
+            winAdjustXWindow(pWin, hwnd);
+        /* else: Wait for WM_EXITSIZEMOVE */
         return 0;
 
     case WM_SHOWWINDOW:
@@ -868,41 +885,36 @@ winTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
 
         /* */
         if (!pWin->overrideRedirect) {
+            HWND zstyle = HWND_NOTOPMOST;
+
             /* Flag that this window needs to be made active when clicked */
             SetProp(hwnd, WIN_NEEDMANAGE_PROP, (HANDLE) 1);
 
-            if (!(GetWindowLongPtr(hwnd, GWL_EXSTYLE) & WS_EX_APPWINDOW)) {
-                HWND zstyle = HWND_NOTOPMOST;
-
-                /* Set the window extended style flags */
-                SetWindowLongPtr(hwnd, GWL_EXSTYLE, WS_EX_APPWINDOW);
-
-                /* Set the transient style flags */
-                if (GetParent(hwnd))
-                    SetWindowLongPtr(hwnd, GWL_STYLE,
-                                     WS_POPUP | WS_OVERLAPPED | WS_SYSMENU |
-                                     WS_CLIPCHILDREN | WS_CLIPSIBLINGS);
-                /* Set the window standard style flags */
-                else
-                    SetWindowLongPtr(hwnd, GWL_STYLE,
-                                     (WS_POPUP | WS_OVERLAPPEDWINDOW |
-                                      WS_CLIPCHILDREN | WS_CLIPSIBLINGS)
-                                     & ~WS_CAPTION & ~WS_SIZEBOX);
-
-                winUpdateWindowPosition(hwnd, FALSE, &zstyle);
-
-                {
-                    WinXWMHints hints;
-
-                    if (winMultiWindowGetWMHints(pWin, &hints)) {
-                        /*
-                           Give the window focus, unless it has an InputHint
-                           which is FALSE (this is used by e.g. glean to
-                           avoid every test window grabbing the focus)
-                         */
-                        if (!((hints.flags & InputHint) && (!hints.input))) {
-                            SetForegroundWindow(hwnd);
-                        }
+            /* Set the transient style flags */
+            if (GetParent(hwnd))
+                SetWindowLongPtr(hwnd, GWL_STYLE,
+                                 WS_POPUP | WS_OVERLAPPED | WS_SYSMENU |
+                                 WS_CLIPCHILDREN | WS_CLIPSIBLINGS);
+            /* Set the window standard style flags */
+            else
+                SetWindowLongPtr(hwnd, GWL_STYLE,
+                                 (WS_POPUP | WS_OVERLAPPEDWINDOW |
+                                  WS_CLIPCHILDREN | WS_CLIPSIBLINGS)
+                                 & ~WS_CAPTION & ~WS_SIZEBOX);
+
+            winUpdateWindowPosition(hwnd, &zstyle);
+
+            {
+                WinXWMHints hints;
+
+                if (winMultiWindowGetWMHints(pWin, &hints)) {
+                    /*
+                       Give the window focus, unless it has an InputHint
+                       which is FALSE (this is used by e.g. glean to
+                       avoid every test window grabbing the focus)
+                     */
+                    if (!((hints.flags & InputHint) && (!hints.input))) {
+                        SetForegroundWindow(hwnd);
                     }
                 }
             }
@@ -996,6 +1008,16 @@ winTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
          */
         break;
 
+    case WM_ENTERSIZEMOVE:
+        hasEnteredSizeMove = TRUE;
+        return 0;
+
+    case WM_EXITSIZEMOVE:
+        /* Adjust the X Window to the moved Windows window */
+        hasEnteredSizeMove = FALSE;
+        winAdjustXWindow(pWin, hwnd);
+        return 0;
+
     case WM_SIZE:
         /* see dix/window.c */
 #if CYGWINDOWING_DEBUG
@@ -1020,8 +1042,11 @@ winTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
                (int) (GetTickCount()));
     }
 #endif
-        /* Adjust the X Window to the moved Windows window */
-        winAdjustXWindow(pWin, hwnd);
+        if (!hasEnteredSizeMove) {
+            /* Adjust the X Window to the moved Windows window */
+            winAdjustXWindow(pWin, hwnd);
+        }
+        /* else: wait for WM_EXITSIZEMOVE */
         return 0;               /* end of WM_SIZE handler */
 
     case WM_STYLECHANGING:
index a2a5123..1859698 100644 (file)
@@ -344,8 +344,7 @@ winCreateDIBNativeGDI(int iWidth, int iHeight, int iDepth,
     }
 
     /* Allocate bitmap info header */
-    pbmih = (BITMAPINFOHEADER *) malloc(sizeof(BITMAPINFOHEADER)
-                                        + 256 * sizeof(RGBQUAD));
+    pbmih = malloc(sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD));
     if (pbmih == NULL) {
         ErrorF("winCreateDIBNativeGDI - malloc () failed\n");
         return FALSE;
index 0fd0efe..0106161 100644 (file)
@@ -78,7 +78,7 @@ winAllocateFBPrimaryDD(ScreenPtr pScreen)
     /* Get client area location in screen coords */
     GetClientRect(pScreenPriv->hwndScreen, &rcClient);
     MapWindowPoints(pScreenPriv->hwndScreen,
-                    HWND_DESKTOP, (LPPOINT) & rcClient, 2);
+                    HWND_DESKTOP, (LPPOINT) &rcClient, 2);
 
     /* Create a DirectDraw object, store the address at lpdd */
     ddrval = (*g_fpDirectDrawCreate) (NULL, &pScreenPriv->pdd, NULL);
@@ -88,7 +88,7 @@ winAllocateFBPrimaryDD(ScreenPtr pScreen)
     /* Get a DirectDraw2 interface pointer */
     ddrval = IDirectDraw_QueryInterface(pScreenPriv->pdd,
                                         &IID_IDirectDraw2,
-                                        (LPVOID *) & pScreenPriv->pdd2);
+                                        (LPVOID *) &pScreenPriv->pdd2);
     if (FAILED(ddrval)) {
         ErrorF("winAllocateFBShadowDD - Failed DD2 query: %08x\n",
                (unsigned int) ddrval);
@@ -306,7 +306,7 @@ winCloseScreenPrimaryDD(ScreenPtr pScreen)
     pScreenInfo->pScreen = NULL;
 
     /* Free the screen privates for this screen */
-    free((pointer) pScreenPriv);
+    free((void *) pScreenPriv);
 
     return fReturn;
 }
@@ -465,7 +465,7 @@ winActivateAppPrimaryDD(ScreenPtr pScreen)
     /* Get client area in screen coords */
     GetClientRect(pScreenPriv->hwndScreen, &rcClient);
     MapWindowPoints(pScreenPriv->hwndScreen,
-                    HWND_DESKTOP, (LPPOINT) & rcClient, 2);
+                    HWND_DESKTOP, (LPPOINT) &rcClient, 2);
 
     /* Setup a source rectangle */
     rcSrc.left = 0;
@@ -514,8 +514,6 @@ static Bool
 winHotKeyAltTabPrimaryDD(ScreenPtr pScreen)
 {
     winScreenPriv(pScreen);
-    winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
-    RECT rcClient, rcSrc;
     HRESULT ddrval = DD_OK;
 
     ErrorF("\nwinHotKeyAltTabPrimaryDD\n\n");
@@ -527,11 +525,6 @@ winHotKeyAltTabPrimaryDD(ScreenPtr pScreen)
     if (pScreenPriv->pddsPrimary == NULL || pScreenPriv->pddsOffscreen == NULL)
         return FALSE;
 
-    /* Get client area in screen coords */
-    GetClientRect(pScreenPriv->hwndScreen, &rcClient);
-    MapWindowPoints(pScreenPriv->hwndScreen,
-                    HWND_DESKTOP, (LPPOINT) & rcClient, 2);
-
     /* Did we loose the primary surface? */
     ddrval = IDirectDrawSurface2_IsLost(pScreenPriv->pddsPrimary);
     if (ddrval == DD_OK) {
@@ -541,12 +534,6 @@ winHotKeyAltTabPrimaryDD(ScreenPtr pScreen)
                        "surface\n");
     }
 
-    /* Setup a source rectangle */
-    rcSrc.left = 0;
-    rcSrc.top = 0;
-    rcSrc.right = pScreenInfo->dwWidth;
-    rcSrc.bottom = pScreenInfo->dwHeight;
-
     /* Blit the primary surface to the offscreen surface */
     ddrval = IDirectDrawSurface2_Blt(pScreenPriv->pddsOffscreen, NULL,  /* should be rcDest */
                                      pScreenPriv->pddsPrimary,
index cb8ba91..ef158c8 100644 (file)
@@ -109,7 +109,7 @@ winCreatePixmapNativeGDI(ScreenPtr pScreen,
     /* Create a DIB for the pixmap */
     pPixmapPriv->hBitmap = winCreateDIBNativeGDI(iWidth, iHeight, iDepth,
                                                  &pPixmapPriv->pbBits,
-                                                 (BITMAPINFO **) & pPixmapPriv->
+                                                 (BITMAPINFO **) &pPixmapPriv->
                                                  pbmih);
 
 #if CYGDEBUG
@@ -178,7 +178,7 @@ Bool
 winModifyPixmapHeaderNativeGDI(PixmapPtr pPixmap,
                                int iWidth, int iHeight,
                                int iDepth,
-                               int iBitsPerPixel, int devKind, pointer pPixData)
+                               int iBitsPerPixel, int devKind, void *pPixData)
 {
     FatalError("winModifyPixmapHeaderNativeGDI ()\n");
     return TRUE;
index faa97c3..f386fac 100644 (file)
@@ -57,9 +57,6 @@ extern int parse_file(FILE * fp);
 /* Currently in use command ID, incremented each new menu item created */
 static int g_cmdid = STARTMENUID;
 
-/* Defined in DIX */
-extern char *display;
-
 /* Local function to handle comma-ified icon names */
 static HICON LoadImageComma(char *fname, int sx, int sy, int flags);
 
@@ -184,14 +181,14 @@ ReloadEnumWindowsProc(HWND hwnd, LPARAM lParam)
 
                 wmMsg.msg = WM_WM_ICON_EVENT;
                 wmMsg.hwndWindow = hwnd;
-                wmMsg.iWindow = (Window) GetProp(hwnd, WIN_WID_PROP);
+                wmMsg.iWindow = (Window) (INT_PTR) GetProp(hwnd, WIN_WID_PROP);
 
                 winSendMessageToWM(s_pScreenPriv->pWMInfo, &wmMsg);
             }
         }
 
         /* Update the system menu for this window */
-        SetupSysMenu((unsigned long) hwnd);
+        SetupSysMenu(hwnd);
 
         /* That was easy... */
     }
@@ -278,15 +275,11 @@ ReloadPrefs(void)
  * Check/uncheck the ALWAYSONTOP items in this menu
  */
 void
-HandleCustomWM_INITMENU(unsigned long hwndIn, unsigned long hmenuIn)
+HandleCustomWM_INITMENU(HWND hwnd, HMENU hmenu)
 {
-    HWND hwnd;
-    HMENU hmenu;
     DWORD dwExStyle;
     int i, j;
 
-    hwnd = (HWND) hwndIn;
-    hmenu = (HMENU) hmenuIn;
     if (!hwnd || !hmenu)
         return;
 
@@ -308,15 +301,12 @@ HandleCustomWM_INITMENU(unsigned long hwndIn, unsigned long hmenuIn)
  * Return TRUE if command is proccessed, FALSE otherwise.
  */
 Bool
-HandleCustomWM_COMMAND(unsigned long hwndIn, int command)
+HandleCustomWM_COMMAND(HWND hwnd, int command)
 {
-    HWND hwnd;
     int i, j;
     MENUPARSED *m;
     DWORD dwExStyle;
 
-    hwnd = (HWND) hwndIn;
-
     if (!command)
         return FALSE;
 
@@ -330,12 +320,12 @@ HandleCustomWM_COMMAND(unsigned long hwndIn, int command)
                 case CMD_EXEC:
                     if (fork() == 0) {
                         struct rlimit rl;
-                        unsigned long i;
+                        int fd;
 
                         /* Close any open descriptors except for STD* */
                         getrlimit(RLIMIT_NOFILE, &rl);
-                        for (i = STDERR_FILENO + 1; i < rl.rlim_cur; i++)
-                            close(i);
+                        for (fd = STDERR_FILENO + 1; fd < rl.rlim_cur; fd++)
+                            close(fd);
 
                         /* Disassociate any TTYs */
                         setsid();
@@ -415,15 +405,13 @@ HandleCustomWM_COMMAND(unsigned long hwndIn, int command)
  * Add the default or a custom menu depending on the class match
  */
 void
-SetupSysMenu(unsigned long hwndIn)
+SetupSysMenu(HWND hwnd)
 {
-    HWND hwnd;
     HMENU sys;
     int i;
     WindowPtr pWin;
     char *res_name, *res_class;
 
-    hwnd = (HWND) hwndIn;
     if (!hwnd)
         return;
 
@@ -468,11 +456,8 @@ SetupSysMenu(unsigned long hwndIn)
  * Possibly add a menu to the toolbar icon
  */
 void
-SetupRootMenu(unsigned long hmenuRoot)
+SetupRootMenu(HMENU root)
 {
-    HMENU root;
-
-    root = (HMENU) hmenuRoot;
     if (!root)
         return;
 
@@ -538,21 +523,21 @@ static HICON
 LoadImageComma(char *fname, int sx, int sy, int flags)
 {
     HICON hicon;
-    int index;
+    int i;
     char file[PATH_MAX + NAME_MAX + 2];
 
     /* Some input error checking */
     if (!fname || !fname[0])
         return NULL;
 
-    index = 0;
+    i = 0;
     hicon = NULL;
 
     if (fname[0] == ',') {
         /* It's the XWIN.EXE resource they want */
-        index = atoi(fname + 1);
+        i = atoi(fname + 1);
         hicon = LoadImage(g_hInstance,
-                          MAKEINTRESOURCE(index), IMAGE_ICON, sx, sy, flags);
+                          MAKEINTRESOURCE(i), IMAGE_ICON, sx, sy, flags);
     }
     else {
         file[0] = 0;
@@ -569,8 +554,8 @@ LoadImageComma(char *fname, int sx, int sy, int flags)
             /* Specified as <fname>,<index> */
 
             *(strrchr(file, ',')) = 0;  /* End string at comma */
-            index = atoi(strrchr(fname, ',') + 1);
-            hicon = ExtractIcon(g_hInstance, file, index);
+            i = atoi(strrchr(fname, ',') + 1);
+            hicon = ExtractIcon(g_hInstance, file, i);
         }
         else {
             /* Just an .ico file... */
@@ -620,13 +605,10 @@ winOverrideIcon(char *res_name, char *res_class, char *wmName)
  * ICONS{} overrides)?
  */
 int
-winIconIsOverride(unsigned hiconIn)
+winIconIsOverride(HICON hicon)
 {
-    HICON hicon;
     int i;
 
-    hicon = (HICON) hiconIn;
-
     if (!hicon)
         return 0;
 
@@ -648,6 +630,7 @@ winPrefsLoadPreferences(char *path)
 
     if (path)
         prefFile = fopen(path, "r");
+#ifdef __CYGWIN__
     else {
         char defaultPrefs[] =
             "MENU rmenu {\n"
@@ -659,6 +642,7 @@ winPrefsLoadPreferences(char *path)
         path = "built-in default";
         prefFile = fmemopen(defaultPrefs, strlen(defaultPrefs), "r");
     }
+#endif
 
     if (!prefFile) {
         ErrorF("LoadPreferences: %s not found\n", path);
index 5de5719..8f4eb08 100644 (file)
@@ -150,19 +150,19 @@ void
  LoadPreferences(void);
 
 void
- SetupRootMenu(unsigned long hmenuRoot);
+ SetupRootMenu(HMENU root);
 
 void
- SetupSysMenu(unsigned long hwndIn);
+ SetupSysMenu(HWND hwnd);
 
 void
- HandleCustomWM_INITMENU(unsigned long hwndIn, unsigned long hmenuIn);
+ HandleCustomWM_INITMENU(HWND hwnd, HMENU hmenu);
 
 Bool
- HandleCustomWM_COMMAND(unsigned long hwndIn, int command);
+ HandleCustomWM_COMMAND(HWND hwnd, int command);
 
 int
- winIconIsOverride(unsigned hiconIn);
+ winIconIsOverride(HICON hicon);
 
 HICON winOverrideIcon(char *res_name, char *res_class, char *wmName);
 
index ba8aea6..fd13edc 100644 (file)
 #include <string.h>
 #include "winprefsyacc.h"
 
-extern YYSTYPE yylval;
-extern char *yytext;
 extern int yyparse(void);
 
 extern void ErrorF (const char* /*f*/, ...);
 
-int yylineno;
-
 /* Copy the parsed string, must be free()d in yacc parser */
 static char *makestr(char *str)
 {
   char *ptr;
-  ptr = (char*)malloc (strlen(str)+1);
+  ptr = malloc(strlen(str)+1);
   if (!ptr)
     {
       ErrorF ("winMultiWindowLex:makestr() out of memory\n");
@@ -62,6 +58,9 @@ static char *makestr(char *str)
 %}
 
 %option yylineno
+%option nounput
+%option noinput
+%option never-interactive
 
 %%
 \#.*[\r\n]              { /* comment */ return NEWLINE; }
@@ -91,6 +90,7 @@ ALWAYSONTOP             { return ALWAYSONTOP; }
 DEBUG                   { return DEBUGOUTPUT; }
 RELOAD                  { return RELOAD; }
 TRAYICON                { return TRAYICON; }
+FORCEEXIT              { return FORCEEXIT; }
 SILENTEXIT             { return SILENTEXIT; }
 "{"                     { return LB; }
 "}"                     { return RB; }
index 0acf160..683fc44 100644 (file)
@@ -37,6 +37,7 @@
 #endif
 #include <stdio.h>
 #include <stdlib.h>
+#define _STDLIB_H 1 /* bison checks this to know if stdlib has been included */
 #include <string.h>
 #include "winprefs.h"
 
@@ -80,7 +81,6 @@ static void CloseSysMenu(void);
 
 static int yyerror (char *s);
 
-extern void ErrorF (const char* /*f*/, ...);
 extern char *yytext;
 extern int yylex(void);
 
@@ -283,16 +283,16 @@ SetTrayIcon (char *fname)
 }
 
 static void
-SetRootMenu (char *menu)
+SetRootMenu (char *menuname)
 {
-  strncpy (pref.rootMenuName, menu, MENU_MAX);
+  strncpy (pref.rootMenuName, menuname, MENU_MAX);
   pref.rootMenuName[MENU_MAX] = 0;
 }
 
 static void
-SetDefaultSysMenu (char *menu, int pos)
+SetDefaultSysMenu (char *menuname, int pos)
 {
-  strncpy (pref.defaultSysMenuName, menu, MENU_MAX);
+  strncpy (pref.defaultSysMenuName, menuname, MENU_MAX);
   pref.defaultSysMenuName[MENU_MAX] = 0;
   pref.defaultSysMenuPos = pos;
 }
@@ -311,10 +311,9 @@ static void
 AddMenuLine (char *text, MENUCOMMANDTYPE cmd, char *param)
 {
   if (menu.menuItem==NULL)
-    menu.menuItem = (MENUITEM*)malloc(sizeof(MENUITEM));
+    menu.menuItem = malloc(sizeof(MENUITEM));
   else
-    menu.menuItem = (MENUITEM*)
-      realloc(menu.menuItem, sizeof(MENUITEM)*(menu.menuItems+1));
+    menu.menuItem = realloc(menu.menuItem, sizeof(MENUITEM)*(menu.menuItems+1));
 
   strncpy (menu.menuItem[menu.menuItems].text, text, MENU_MAX);
   menu.menuItem[menu.menuItems].text[MENU_MAX] = 0;
@@ -339,10 +338,9 @@ CloseMenu (void)
     }
   
   if (pref.menuItems)
-    pref.menu = (MENUPARSED*)
-      realloc (pref.menu, (pref.menuItems+1)*sizeof(MENUPARSED));
+    pref.menu = realloc (pref.menu, (pref.menuItems+1)*sizeof(MENUPARSED));
   else
-    pref.menu = (MENUPARSED*)malloc (sizeof(MENUPARSED));
+    pref.menu = malloc (sizeof(MENUPARSED));
   
   memcpy (pref.menu+pref.menuItems, &menu, sizeof(MENUPARSED));
   pref.menuItems++;
@@ -365,10 +363,9 @@ static void
 AddIconLine (char *matchstr, char *iconfile)
 {
   if (pref.icon==NULL)
-    pref.icon = (ICONITEM*)malloc(sizeof(ICONITEM));
+    pref.icon = malloc(sizeof(ICONITEM));
   else
-    pref.icon = (ICONITEM*)
-      realloc(pref.icon, sizeof(ICONITEM)*(pref.iconItems+1));
+    pref.icon = realloc(pref.icon, sizeof(ICONITEM)*(pref.iconItems+1));
 
   strncpy(pref.icon[pref.iconItems].match, matchstr, MENU_MAX);
   pref.icon[pref.iconItems].match[MENU_MAX] = 0;
@@ -401,10 +398,9 @@ static void
 AddStyleLine (char *matchstr, unsigned long style)
 {
   if (pref.style==NULL)
-    pref.style = (STYLEITEM*)malloc(sizeof(STYLEITEM));
+    pref.style = malloc(sizeof(STYLEITEM));
   else
-    pref.style = (STYLEITEM*)
-      realloc(pref.style, sizeof(STYLEITEM)*(pref.styleItems+1));
+    pref.style = realloc(pref.style, sizeof(STYLEITEM)*(pref.styleItems+1));
 
   strncpy(pref.style[pref.styleItems].match, matchstr, MENU_MAX);
   pref.style[pref.styleItems].match[MENU_MAX] = 0;
@@ -434,10 +430,9 @@ static void
 AddSysMenuLine (char *matchstr, char *menuname, int pos)
 {
   if (pref.sysMenu==NULL)
-    pref.sysMenu = (SYSMENUITEM*)malloc(sizeof(SYSMENUITEM));
+    pref.sysMenu = malloc(sizeof(SYSMENUITEM));
   else
-    pref.sysMenu = (SYSMENUITEM*)
-      realloc(pref.sysMenu, sizeof(SYSMENUITEM)*(pref.sysMenuItems+1));
+    pref.sysMenu = realloc(pref.sysMenu, sizeof(SYSMENUITEM)*(pref.sysMenuItems+1));
 
   strncpy (pref.sysMenu[pref.sysMenuItems].match, matchstr, MENU_MAX);
   pref.sysMenu[pref.sysMenuItems].match[MENU_MAX] = 0;
index a5b3c07..f2bf05b 100644 (file)
@@ -56,10 +56,6 @@ void
 void
  winLogVersionInfo(void);
 
-#ifdef DDXOSVERRORF
-void OsVendorVErrorF(const char *pszFormat, va_list va_args);
-#endif
-
 /*
  * Process arguments on the command line
  */
@@ -146,7 +142,7 @@ winInitializeScreenDefaults(void)
 #endif
     defaultScreenInfo.fMultipleMonitors = FALSE;
     defaultScreenInfo.fLessPointer = FALSE;
-    defaultScreenInfo.iResizeMode = notAllowed;
+    defaultScreenInfo.iResizeMode = resizeWithRandr;
     defaultScreenInfo.fNoTrayIcon = FALSE;
     defaultScreenInfo.iE3BTimeout = WIN_E3B_DEFAULT;
     defaultScreenInfo.fUseWinKillKey = WIN_DEFAULT_WIN_KILL;
@@ -1078,6 +1074,11 @@ ddxProcessArgument(int argc, char *argv[], int i)
         return 1;
     }
 
+    if (IS_OPTION("-hostintitle")) {
+        g_fHostInTitle = TRUE;
+        return 1;
+    }
+
     return 0;
 }
 
@@ -1165,6 +1166,8 @@ winLogVersionInfo(void)
     ErrorF("Vendor: %s\n", XVENDORNAME);
     ErrorF("Release: %d.%d.%d.%d\n", XORG_VERSION_MAJOR,
            XORG_VERSION_MINOR, XORG_VERSION_PATCH, XORG_VERSION_SNAP);
-    ErrorF("%s\n\n", BUILDERSTRING);
+    if (strlen(BUILDERSTRING))
+        ErrorF("%s\n", BUILDERSTRING);
     ErrorF("Contact: %s\n", BUILDERADDR);
+    ErrorF("\n");
 }
diff --git a/hw/xwin/winregistry.c b/hw/xwin/winregistry.c
deleted file mode 100644 (file)
index d33f8c3..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- *Copyright (C) 2002-2004 Harold L Hunt II All Rights Reserved.
- *
- *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 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 HAROLD L HUNT II 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.
- *
- *Except as contained in this notice, the name of Harold L Hunt II
- *shall not be used in advertising or otherwise to promote the sale, use
- *or other dealings in this Software without prior written authorization
- *from Harold L Hunt II.
- *
- * Authors:    Harold L Hunt II
- */
-
-#ifdef HAVE_XWIN_CONFIG_H
-#include <xwin-config.h>
-#endif
-#include "win.h"
-
-/* Prototypes */
-DWORD winGetRegistryDWORD(HKEY hkey, char *pszRegistryKey);
-
-DWORD
-winGetRegistryDWORD(HKEY hkey, char *pszRegistryKey)
-{
-    HKEY hkResult;
-    DWORD dwDisposition;
-
-    RegCreateKeyEx(hkey,
-                   pszRegistryKey,
-                   0,
-                   '\0',
-                   REG_OPTION_NON_VOLATILE,
-                   KEY_READ, NULL, &hkResult, &dwDisposition);
-
-    if (dwDisposition == REG_CREATED_NEW_KEY) {
-        ErrorF("winGetRegistryDWORD - Created new key: %s\n", pszRegistryKey);
-    }
-    else if (dwDisposition == REG_OPENED_EXISTING_KEY) {
-        ErrorF("winGetRegistryDWORD - Opened existing key: %s\n",
-               pszRegistryKey);
-    }
-
-    /* Free the registry key handle */
-    RegCloseKey(hkResult);
-    hkResult = NULL;
-
-    return 0;
-}
index a14d402..afbf9f2 100644 (file)
@@ -44,9 +44,6 @@
 #define ID_APP_ALWAYS_ON_TOP   202
 #define ID_APP_ABOUT           203
 
-#define ID_ABOUT_UG            300
-#define ID_ABOUT_FAQ           301
-#define ID_ABOUT_CHANGELOG     302
 #define ID_ABOUT_WEBSITE       303
 
 #endif
index be25f12..23152cb 100644 (file)
@@ -254,12 +254,11 @@ winCreateScreenResources(ScreenPtr pScreen)
 
 /* See Porting Layer Definition - p. 20 */
 Bool
-winFinishScreenInitFB(int index, ScreenPtr pScreen, int argc, char **argv)
+winFinishScreenInitFB(int i, ScreenPtr pScreen, int argc, char **argv)
 {
     winScreenPriv(pScreen);
     winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
     VisualPtr pVisual = NULL;
-    char *pbits = NULL;
 
 #if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW)
     int iReturn;
@@ -293,9 +292,6 @@ winFinishScreenInitFB(int index, ScreenPtr pScreen, int argc, char **argv)
         return FALSE;
     }
 
-    /* Setup a local variable to point to the framebuffer */
-    pbits = pScreenInfo->pfb;
-
     /* Apparently we need this for the render extension */
     miSetPixmapDepths();
 
@@ -550,7 +546,7 @@ winFinishScreenInitFB(int index, ScreenPtr pScreen, int argc, char **argv)
                        &pScreenPriv->ptWMProc,
                        &pScreenPriv->ptXMsgProc,
                        &pScreenPriv->pmServerStarted,
-                       pScreenInfo->dwScreen, (HWND) & pScreenPriv->hwndScreen,
+                       pScreenInfo->dwScreen, (HWND) &pScreenPriv->hwndScreen,
 #ifdef XWIN_MULTIWINDOWEXTWM
                        pScreenInfo->fInternalWM ||
 #endif
@@ -578,11 +574,11 @@ winFinishScreenInitFB(int index, ScreenPtr pScreen, int argc, char **argv)
 /* See Porting Layer Definition - p. 20 */
 
 Bool
-winFinishScreenInitNativeGDI(int index,
+winFinishScreenInitNativeGDI(int i,
                              ScreenPtr pScreen, int argc, char **argv)
 {
     winScreenPriv(pScreen);
-    winScreenInfoPtr pScreenInfo = &g_ScreenInfo[index];
+    winScreenInfoPtr pScreenInfo = &g_ScreenInfo[i];
     VisualPtr pVisuals = NULL;
     DepthPtr pDepths = NULL;
     VisualID rootVisual = 0;
@@ -707,7 +703,7 @@ winFinishScreenInitNativeGDI(int index,
     pScreenPriv->fEnabled = TRUE;
 
     ErrorF("winFinishScreenInitNativeGDI - Successful addition of "
-           "screen %08x\n", (unsigned int) pScreen);
+           "screen %p\n", pScreen);
 
     return TRUE;
 }
index 8f75991..11108cb 100644 (file)
@@ -46,7 +46,7 @@ winSetSpansNativeGDI(DrawablePtr pDrawable,
     PixmapPtr pPixmap = NULL;
     winPrivPixmapPtr pPixmapPriv = NULL;
     HBITMAP hbmpOrig = NULL;
-    BITMAPINFO bmi;
+    BITMAPINFO *pbmi;
     HRGN hrgn = NULL, combined = NULL;
     int nbox;
     BoxPtr pbox;
@@ -57,6 +57,8 @@ winSetSpansNativeGDI(DrawablePtr pDrawable,
     if (!nbox)
         return;
 
+    pbmi = malloc(sizeof(BITMAPINFO) + sizeof(RGBQUAD));
+
     combined = CreateRectRgn(pbox->x1, pbox->y1, pbox->x2, pbox->y2);
     nbox--;
     pbox++;
@@ -86,19 +88,20 @@ winSetSpansNativeGDI(DrawablePtr pDrawable,
                        "failed on pPixmapPriv->hBitmap\n");
 
         while (iSpans--) {
-            ZeroMemory(&bmi, sizeof(BITMAPINFO));
-            bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
-            bmi.bmiHeader.biWidth = *piWidths;
-            bmi.bmiHeader.biHeight = 1;
-            bmi.bmiHeader.biPlanes = 1;
-            bmi.bmiHeader.biBitCount = pDrawable->depth;
-            bmi.bmiHeader.biCompression = BI_RGB;
+            ZeroMemory(pbmi, sizeof(BITMAPINFO));
+            pbmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
+            pbmi->bmiHeader.biWidth = *piWidths;
+            pbmi->bmiHeader.biHeight = 1;
+            pbmi->bmiHeader.biPlanes = 1;
+            pbmi->bmiHeader.biBitCount = pDrawable->depth;
+            pbmi->bmiHeader.biCompression = BI_RGB;
 
             /* Setup color table for mono DIBs */
             if (pDrawable->depth == 1) {
-                bmi.bmiColors[1].rgbBlue = 255;
-                bmi.bmiColors[1].rgbGreen = 255;
-                bmi.bmiColors[1].rgbRed = 255;
+                RGBQUAD *bmiColors = &(pbmi->bmiColors[0]);
+                bmiColors[1].rgbBlue = 255;
+                bmiColors[1].rgbGreen = 255;
+                bmiColors[1].rgbRed = 255;
             }
 
             StretchDIBits(pGCPriv->hdcMem,
@@ -107,7 +110,7 @@ winSetSpansNativeGDI(DrawablePtr pDrawable,
                           0, 0,
                           *piWidths, 1,
                           pSrcs,
-                          (BITMAPINFO *) bmi,
+                          (BITMAPINFO *) pbmi,
                           DIB_RGB_COLORS, g_copyROP[pGC->alu]);
 
             pSrcs += PixmapBytePad(*piWidths, pDrawable->depth);
@@ -129,19 +132,20 @@ winSetSpansNativeGDI(DrawablePtr pDrawable,
         combined = NULL;
 
         while (iSpans--) {
-            ZeroMemory(&bmi, sizeof(BITMAPINFO));
-            bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
-            bmi.bmiHeader.biWidth = *piWidths;
-            bmi.bmiHeader.biHeight = 1;
-            bmi.bmiHeader.biPlanes = 1;
-            bmi.bmiHeader.biBitCount = pDrawable->depth;
-            bmi.bmiHeader.biCompression = BI_RGB;
+            ZeroMemory(pbmi, sizeof(BITMAPINFO));
+            pbmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
+            pbmi->bmiHeader.biWidth = *piWidths;
+            pbmi->bmiHeader.biHeight = 1;
+            pbmi->bmiHeader.biPlanes = 1;
+            pbmi->bmiHeader.biBitCount = pDrawable->depth;
+            pbmi->bmiHeader.biCompression = BI_RGB;
 
             /* Setup color table for mono DIBs */
             if (pDrawable->depth == 1) {
-                bmi.bmiColors[1].rgbBlue = 255;
-                bmi.bmiColors[1].rgbGreen = 255;
-                bmi.bmiColors[1].rgbRed = 255;
+                RGBQUAD *bmiColors = &(pbmi->bmiColors[0]);
+                bmiColors[1].rgbBlue = 255;
+                bmiColors[1].rgbGreen = 255;
+                bmiColors[1].rgbRed = 255;
             }
 
             StretchDIBits(pGCPriv->hdc,
@@ -150,7 +154,7 @@ winSetSpansNativeGDI(DrawablePtr pDrawable,
                           0, 0,
                           *piWidths, 1,
                           pSrcs,
-                          (BITMAPINFO *) bmi,
+                          (BITMAPINFO *) pbmi,
                           DIB_RGB_COLORS, g_copyROP[pGC->alu]);
 
             pSrcs += PixmapBytePad(*piWidths, pDrawable->depth);
@@ -166,4 +170,6 @@ winSetSpansNativeGDI(DrawablePtr pDrawable,
         FatalError("\nwinSetSpansNativeGDI - Unknown drawable type\n\n");
         break;
     }
+
+    free(pbmi);
 }
index 4c77cc0..5f3b658 100644 (file)
 #include "win.h"
 
 /*
- * FIXME: Headers are broken, DEFINE_GUID doesn't work correctly,
- * so we have to redefine it here.
- */
-#ifdef DEFINE_GUID
-#undef DEFINE_GUID
-#define DEFINE_GUID(n,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) const GUID n GUID_SECT = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}}
-#endif                          /* DEFINE_GUID */
-
-/*
- * FIXME: Headers are broken, IID_IDirectDraw2 has to be defined
- * here manually.  Should be handled by ddraw.h
- */
-#ifndef IID_IDirectDraw2
-DEFINE_GUID(IID_IDirectDraw2, 0xB3A6F3E0, 0x2B43, 0x11CF, 0xA2, 0xDE, 0x00,
-            0xAA, 0x00, 0xB9, 0x33, 0x56);
-#endif                          /* IID_IDirectDraw2 */
-
-/*
  * Local prototypes
  */
 
@@ -250,7 +232,7 @@ winAllocateFBShadowDD(ScreenPtr pScreen)
     /* Get a DirectDraw2 interface pointer */
     ddrval = IDirectDraw_QueryInterface(pScreenPriv->pdd,
                                         &IID_IDirectDraw2,
-                                        (LPVOID *) & pScreenPriv->pdd2);
+                                        (LPVOID *) &pScreenPriv->pdd2);
     if (FAILED(ddrval)) {
         ErrorF("winAllocateFBShadowDD - Failed DD2 query: %08x\n",
                (unsigned int) ddrval);
@@ -507,7 +489,7 @@ winShadowUpdateDD(ScreenPtr pScreen, shadowBufPtr pBuf)
     POINT ptOrigin;
     DWORD dwBox = RegionNumRects(damage);
     BoxPtr pBox = RegionRects(damage);
-    HRGN hrgnTemp = NULL, hrgnCombined = NULL;
+    HRGN hrgnCombined = NULL;
 
     /*
      * Return immediately if the app is not active
@@ -525,7 +507,7 @@ winShadowUpdateDD(ScreenPtr pScreen, shadowBufPtr pBuf)
     ptOrigin.x = pScreenInfo->dwXOffset;
     ptOrigin.y = pScreenInfo->dwYOffset;
     MapWindowPoints(pScreenPriv->hwndScreen,
-                    HWND_DESKTOP, (LPPOINT) & ptOrigin, 1);
+                    HWND_DESKTOP, (LPPOINT) &ptOrigin, 1);
 
     /* Unlock the shadow surface, so we can blit */
     ddrval = IDirectDrawSurface2_Unlock(pScreenPriv->pddsShadow, NULL);
@@ -569,15 +551,9 @@ winShadowUpdateDD(ScreenPtr pScreen, shadowBufPtr pBuf)
         BoxPtr pBoxExtents = RegionExtents(damage);
 
         /* Compute a GDI region from the damaged region */
-        hrgnCombined = CreateRectRgn(pBox->x1, pBox->y1, pBox->x2, pBox->y2);
-        dwBox--;
-        pBox++;
-        while (dwBox--) {
-            hrgnTemp = CreateRectRgn(pBox->x1, pBox->y1, pBox->x2, pBox->y2);
-            CombineRgn(hrgnCombined, hrgnCombined, hrgnTemp, RGN_OR);
-            DeleteObject(hrgnTemp);
-            pBox++;
-        }
+        hrgnCombined =
+            CreateRectRgn(pBoxExtents->x1, pBoxExtents->y1, pBoxExtents->x2,
+                          pBoxExtents->y2);
 
         /* Install the GDI region as a clipping region */
         SelectClipRgn(pScreenPriv->hdcScreen, hrgnCombined);
@@ -700,7 +676,7 @@ winCloseScreenShadowDD(ScreenPtr pScreen)
     pScreenInfo->pScreen = NULL;
 
     /* Free the screen privates for this screen */
-    free((pointer) pScreenPriv);
+    free((void *) pScreenPriv);
 
     return fReturn;
 }
@@ -877,7 +853,7 @@ winBltExposedRegionsShadowDD(ScreenPtr pScreen)
     ptOrigin.y = pScreenInfo->dwYOffset;
 
     MapWindowPoints(pScreenPriv->hwndScreen,
-                    HWND_DESKTOP, (LPPOINT) & ptOrigin, 1);
+                    HWND_DESKTOP, (LPPOINT) &ptOrigin, 1);
     rcDest.left = ptOrigin.x;
     rcDest.right = ptOrigin.x + pScreenInfo->dwWidth;
     rcDest.top = ptOrigin.y;
@@ -1020,7 +996,7 @@ winRedrawScreenShadowDD(ScreenPtr pScreen)
     ptOrigin.x = pScreenInfo->dwXOffset;
     ptOrigin.y = pScreenInfo->dwYOffset;
     MapWindowPoints(pScreenPriv->hwndScreen,
-                    HWND_DESKTOP, (LPPOINT) & ptOrigin, 1);
+                    HWND_DESKTOP, (LPPOINT) &ptOrigin, 1);
     rcDest.left = ptOrigin.x;
     rcDest.right = ptOrigin.x + pScreenInfo->dwWidth;
     rcDest.top = ptOrigin.y;
index c087975..55af5c3 100644 (file)
 #endif
 #include "win.h"
 
-/*
- * FIXME: Headers are broken, DEFINE_GUID doesn't work correctly,
- * so we have to redefine it here.
- */
-#ifdef DEFINE_GUID
-#undef DEFINE_GUID
-#define DEFINE_GUID(n,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) const GUID n GUID_SECT = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}}
-#endif                          /* DEFINE_GUID */
-
-/*
- * FIXME: Headers are broken, IID_IDirectDraw4 has to be defined
- * here manually.  Should be handled by ddraw.h
- */
-#ifndef IID_IDirectDraw4
-DEFINE_GUID(IID_IDirectDraw4, 0x9c59509a, 0x39bd, 0x11d1, 0x8c, 0x4a, 0x00,
-            0xc0, 0x4f, 0xd9, 0x30, 0xc5);
-#endif                          /* IID_IDirectDraw4 */
-
 #define FAIL_MSG_MAX_BLT       10
 
 /*
@@ -267,7 +249,7 @@ winAllocateFBShadowDDNL(ScreenPtr pScreen)
 
     /* Create a DirectDraw object, store the address at lpdd */
     ddrval = (*g_fpDirectDrawCreate) (NULL,
-                                      (LPDIRECTDRAW *) & pScreenPriv->pdd,
+                                      (LPDIRECTDRAW *) &pScreenPriv->pdd,
                                       NULL);
     if (FAILED(ddrval)) {
         ErrorF("winAllocateFBShadowDDNL - Could not start "
@@ -282,7 +264,7 @@ winAllocateFBShadowDDNL(ScreenPtr pScreen)
     /* Get a DirectDraw4 interface pointer */
     ddrval = IDirectDraw_QueryInterface(pScreenPriv->pdd,
                                         &IID_IDirectDraw4,
-                                        (LPVOID *) & pScreenPriv->pdd4);
+                                        (LPVOID *) &pScreenPriv->pdd4);
     if (FAILED(ddrval)) {
         ErrorF("winAllocateFBShadowDDNL - Failed DD4 query: %08x\n",
                (unsigned int) ddrval);
@@ -526,50 +508,6 @@ winFreeFBShadowDDNL(ScreenPtr pScreen)
     pScreenInfo->pfb = NULL;
 }
 
-#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
-/*
- * Create a DirectDraw surface for the new multi-window window
- */
-
-static
-    Bool
-winFinishCreateWindowsWindowDDNL(WindowPtr pWin)
-{
-    winWindowPriv(pWin);
-    winPrivScreenPtr pScreenPriv = pWinPriv->pScreenPriv;
-    HRESULT ddrval = DD_OK;
-    DDSURFACEDESC2 ddsd;
-    int iWidth, iHeight;
-    int iX, iY;
-
-    winDebug("winFinishCreateWindowsWindowDDNL!\n\n");
-
-    iX = pWin->drawable.x + GetSystemMetrics(SM_XVIRTUALSCREEN);
-    iY = pWin->drawable.y + GetSystemMetrics(SM_YVIRTUALSCREEN);
-
-    iWidth = pWin->drawable.width;
-    iHeight = pWin->drawable.height;
-
-    /* Describe the primary surface */
-    ZeroMemory(&ddsd, sizeof(ddsd));
-    ddsd.dwSize = sizeof(ddsd);
-    ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT;
-    ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
-    ddsd.dwHeight = iHeight;
-    ddsd.dwWidth = iWidth;
-
-    /* Create the primary surface */
-    ddrval = IDirectDraw4_CreateSurface(pScreenPriv->pdd4,
-                                        &ddsd, &pWinPriv->pddsPrimary4, NULL);
-    if (FAILED(ddrval)) {
-        ErrorF("winFinishCreateWindowsWindowDDNL - Could not create primary "
-               "surface: %08x\n", (unsigned int) ddrval);
-        return FALSE;
-    }
-    return TRUE;
-}
-#endif
-
 /*
  * Transfer the damaged regions of the shadow framebuffer to the display.
  */
@@ -585,7 +523,7 @@ winShadowUpdateDDNL(ScreenPtr pScreen, shadowBufPtr pBuf)
     POINT ptOrigin;
     DWORD dwBox = RegionNumRects(damage);
     BoxPtr pBox = RegionRects(damage);
-    HRGN hrgnTemp = NULL, hrgnCombined = NULL;
+    HRGN hrgnCombined = NULL;
 
     /*
      * Return immediately if the app is not active
@@ -603,7 +541,7 @@ winShadowUpdateDDNL(ScreenPtr pScreen, shadowBufPtr pBuf)
     ptOrigin.x = pScreenInfo->dwXOffset;
     ptOrigin.y = pScreenInfo->dwYOffset;
     MapWindowPoints(pScreenPriv->hwndScreen,
-                    HWND_DESKTOP, (LPPOINT) & ptOrigin, 1);
+                    HWND_DESKTOP, (LPPOINT) &ptOrigin, 1);
 
     /*
      * Handle small regions with multiple blits,
@@ -657,15 +595,9 @@ winShadowUpdateDDNL(ScreenPtr pScreen, shadowBufPtr pBuf)
         BoxPtr pBoxExtents = RegionExtents(damage);
 
         /* Compute a GDI region from the damaged region */
-        hrgnCombined = CreateRectRgn(pBox->x1, pBox->y1, pBox->x2, pBox->y2);
-        dwBox--;
-        pBox++;
-        while (dwBox--) {
-            hrgnTemp = CreateRectRgn(pBox->x1, pBox->y1, pBox->x2, pBox->y2);
-            CombineRgn(hrgnCombined, hrgnCombined, hrgnTemp, RGN_OR);
-            DeleteObject(hrgnTemp);
-            pBox++;
-        }
+        hrgnCombined =
+            CreateRectRgn(pBoxExtents->x1, pBoxExtents->y1, pBoxExtents->x2,
+                          pBoxExtents->y2);
 
         /* Install the GDI region as a clipping region */
         SelectClipRgn(pScreenPriv->hdcScreen, hrgnCombined);
@@ -771,7 +703,7 @@ winCloseScreenShadowDDNL(ScreenPtr pScreen)
     pScreenInfo->pScreen = NULL;
 
     /* Free the screen privates for this screen */
-    free((pointer) pScreenPriv);
+    free((void *) pScreenPriv);
 
     return fReturn;
 }
@@ -948,7 +880,7 @@ winBltExposedRegionsShadowDDNL(ScreenPtr pScreen)
     ptOrigin.y = pScreenInfo->dwYOffset;
 
     MapWindowPoints(pScreenPriv->hwndScreen,
-                    HWND_DESKTOP, (LPPOINT) & ptOrigin, 1);
+                    HWND_DESKTOP, (LPPOINT) &ptOrigin, 1);
     rcDest.left = ptOrigin.x;
     rcDest.right = ptOrigin.x + pScreenInfo->dwWidth;
     rcDest.top = ptOrigin.y;
@@ -1058,7 +990,7 @@ winRedrawScreenShadowDDNL(ScreenPtr pScreen)
     ptOrigin.x = pScreenInfo->dwXOffset;
     ptOrigin.y = pScreenInfo->dwYOffset;
     MapWindowPoints(pScreenPriv->hwndScreen,
-                    HWND_DESKTOP, (LPPOINT) & ptOrigin, 1);
+                    HWND_DESKTOP, (LPPOINT) &ptOrigin, 1);
     rcDest.left = ptOrigin.x;
     rcDest.right = ptOrigin.x + pScreenInfo->dwWidth;
     rcDest.top = ptOrigin.y;
@@ -1278,7 +1210,7 @@ winSetEngineFunctionsShadowDDNL(ScreenPtr pScreen)
     pScreenPriv->pwinReleasePrimarySurface = winReleasePrimarySurfaceShadowDDNL;
 #ifdef XWIN_MULTIWINDOW
     pScreenPriv->pwinFinishCreateWindowsWindow
-        = winFinishCreateWindowsWindowDDNL;
+        = (winFinishCreateWindowsWindowProcPtr) (void (*)(void)) NoopDDA;
 #endif
 
     return TRUE;
index cdbb46b..5c815eb 100644 (file)
@@ -184,8 +184,7 @@ winQueryRGBBitsAndMasks(ScreenPtr pScreen)
     }
 
     /* Allocate a bitmap header and color table */
-    pbmih = (BITMAPINFOHEADER *) malloc(sizeof(BITMAPINFOHEADER)
-                                        + 256 * sizeof(RGBQUAD));
+    pbmih = malloc(sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD));
     if (pbmih == NULL) {
         ErrorF("winQueryRGBBitsAndMasks - malloc failed\n");
         return FALSE;
@@ -337,7 +336,7 @@ winAllocateFBShadowGDI(ScreenPtr pScreen)
     pScreenPriv->hbmpShadow = CreateDIBSection(pScreenPriv->hdcScreen,
                                                (BITMAPINFO *) pScreenPriv->
                                                pbmih, DIB_RGB_COLORS,
-                                               (VOID **) & pScreenInfo->pfb,
+                                               (VOID **) &pScreenInfo->pfb,
                                                NULL, 0);
     if (pScreenPriv->hbmpShadow == NULL || pScreenInfo->pfb == NULL) {
         winW32Error(2, "winAllocateFBShadowGDI - CreateDIBSection failed:");
@@ -439,7 +438,7 @@ winShadowUpdateGDI(ScreenPtr pScreen, shadowBufPtr pBuf)
     DWORD dwBox = RegionNumRects(damage);
     BoxPtr pBox = RegionRects(damage);
     int x, y, w, h;
-    HRGN hrgnTemp = NULL, hrgnCombined = NULL;
+    HRGN hrgnCombined = NULL;
 
 #ifdef XWIN_UPDATESTATS
     static DWORD s_dwNonUnitRegions = 0;
@@ -500,16 +499,11 @@ winShadowUpdateGDI(ScreenPtr pScreen, shadowBufPtr pBuf)
         }
     }
     else if (!pScreenInfo->fMultiWindow) {
+
         /* Compute a GDI region from the damaged region */
-        hrgnCombined = CreateRectRgn(pBox->x1, pBox->y1, pBox->x2, pBox->y2);
-        dwBox--;
-        pBox++;
-        while (dwBox--) {
-            hrgnTemp = CreateRectRgn(pBox->x1, pBox->y1, pBox->x2, pBox->y2);
-            CombineRgn(hrgnCombined, hrgnCombined, hrgnTemp, RGN_OR);
-            DeleteObject(hrgnTemp);
-            pBox++;
-        }
+        hrgnCombined =
+            CreateRectRgn(pBoxExtents->x1, pBoxExtents->y1, pBoxExtents->x2,
+                          pBoxExtents->y2);
 
         /* Install the GDI region as a clipping region */
         SelectClipRgn(pScreenPriv->hdcScreen, hrgnCombined);
@@ -550,8 +544,7 @@ winInitScreenShadowGDI(ScreenPtr pScreen)
     pScreenPriv->hdcShadow = CreateCompatibleDC(pScreenPriv->hdcScreen);
 
     /* Allocate bitmap info header */
-    pScreenPriv->pbmih = (BITMAPINFOHEADER *) malloc(sizeof(BITMAPINFOHEADER)
-                                                     + 256 * sizeof(RGBQUAD));
+    pScreenPriv->pbmih = malloc(sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD));
     if (pScreenPriv->pbmih == NULL) {
         ErrorF("winInitScreenShadowGDI - malloc () failed\n");
         return FALSE;
@@ -634,7 +627,7 @@ winCloseScreenShadowGDI(ScreenPtr pScreen)
     pScreenInfo->pScreen = NULL;
 
     /* Free the screen privates for this screen */
-    free((pointer) pScreenPriv);
+    free((void *) pScreenPriv);
 
     return fReturn;
 }
diff --git a/hw/xwin/wintaskbar.c b/hw/xwin/wintaskbar.c
new file mode 100644 (file)
index 0000000..7dd4ec3
--- /dev/null
@@ -0,0 +1,92 @@
+/*
+  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.
+*/
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+
+#include "win.h"
+#include "winwindow.h"
+
+const GUID CLSID_TaskbarList = {0x56fdf344,0xfd6d,0x11d0,{0x95,0x8a,0x0,0x60,0x97,0xc9,0xa0,0x90}};
+const GUID IID_ITaskbarList =  {0x56fdf342,0xfd6d,0x11d0,{0x95,0x8a,0x0,0x60,0x97,0xc9,0xa0,0x90}};
+
+#ifdef INTERFACE
+#undef INTERFACE
+#endif
+
+#define INTERFACE ITaskbarList
+DECLARE_INTERFACE_(ITaskbarList, IUnknown)
+{
+  /* IUnknown methods */
+  STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE;
+  STDMETHOD_(ULONG, AddRef) (THIS) PURE;
+  STDMETHOD_(ULONG, Release) (THIS) PURE;
+
+  /* ITaskbarList methods */
+  STDMETHOD(HrInit) (THIS) PURE;
+  STDMETHOD(AddTab) (THIS_ HWND hWnd) PURE;
+  STDMETHOD(DeleteTab) (THIS_ HWND hWnd) PURE;
+  STDMETHOD(ActivateTab) (THIS_ HWND hWnd) PURE;
+  STDMETHOD(SetActiveAlt) (THIS_ HWND hWnd) PURE;
+};
+#undef INTERFACE
+
+/*
+   The stuff above needs to be in win32api headers, not defined here,
+   or at least generated from the MIDL :-)
+*/
+
+/*
+  This is unnecessarily heavyweight, we could just call CoInitialize() once at
+   startup and CoUninitialize() once at shutdown
+*/
+
+/*
+  The documentation for ITaskbarList::AddTab says that we are responsible for
+   deleting the tab ourselves when the window is deleted, but that doesn't actually
+   seem to be the case
+*/
+
+void winShowWindowOnTaskbar(HWND hWnd, BOOL show)
+{
+  ITaskbarList* pTaskbarList = NULL;
+
+  if (SUCCEEDED(CoInitialize(NULL)))
+    {
+      if (SUCCEEDED(CoCreateInstance((const CLSID *)&CLSID_TaskbarList, NULL, CLSCTX_INPROC_SERVER, (const IID *)&IID_ITaskbarList, (void**)&pTaskbarList)))
+        {
+          if (SUCCEEDED(pTaskbarList->lpVtbl->HrInit(pTaskbarList)))
+            {
+              if (show)
+                {
+                  pTaskbarList->lpVtbl->AddTab(pTaskbarList,hWnd);
+                }
+              else
+                {
+                  pTaskbarList->lpVtbl->DeleteTab(pTaskbarList,hWnd);
+                }
+            }
+          pTaskbarList->lpVtbl->Release(pTaskbarList);
+        }
+      CoUninitialize();
+    }
+}
index dbc4725..e0aa7e5 100644 (file)
@@ -114,7 +114,7 @@ winHandleIconMessage(HWND hwnd, UINT message,
     switch (lParam) {
     case WM_LBUTTONUP:
         /* Restack and bring all windows to top */
-        SetForegroundWindow(hwnd);
+        SetForegroundWindow (pScreenPriv->hwndScreen);
 
 #ifdef XWIN_MULTIWINDOWEXTWM
         if (pScreenInfo->fMWExtWM)
@@ -170,7 +170,7 @@ winHandleIconMessage(HWND hwnd, UINT message,
             RemoveMenu(hmenuTray, ID_APP_HIDE_ROOT, MF_BYCOMMAND);
         }
 
-        SetupRootMenu((unsigned long) hmenuTray);
+        SetupRootMenu(hmenuTray);
 
         /*
          * NOTE: This three-step procedure is required for
index eb6e973..edfd71f 100644 (file)
@@ -57,9 +57,7 @@ Bool
 winValidateArgs(void)
 {
     int i;
-    int iMaxConsecutiveScreen = 0;
     BOOL fHasNormalScreen0 = FALSE;
-    BOOL fImplicitScreenFound = FALSE;
 
     /*
      * Check for a malformed set of -screen parameters.
index 77c1605..ebcb0fa 100644 (file)
 /* See Porting Layer Definition - p. 7 */
 void
 winWakeupHandler(ScreenPtr pScreen,
-                 unsigned long ulResult, pointer pReadmask)
+                 unsigned long ulResult, void *pReadmask)
 {
     MSG msg;
 
-    /* Process all messages on our queue */
-    while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
+    /* Process one message from our queue */
+    if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
         if ((g_hDlgDepthChange == 0
              || !IsDialogMessage(g_hDlgDepthChange, &msg))
             && (g_hDlgExit == 0 || !IsDialogMessage(g_hDlgExit, &msg))
index 5bf7102..660a78f 100644 (file)
@@ -39,7 +39,6 @@
 #include <winuser.h>
 #define _WINDOWSWM_SERVER_
 #include <X11/extensions/windowswmstr.h>
-#include "dixevents.h"
 #include "winmultiwindowclass.h"
 #include <X11/Xatom.h>
 
@@ -184,8 +183,8 @@ InitWin32RootlessEngine(win32RootlessWindowPtr pRLWinPriv)
 
     /* Allocate bitmap info header */
     pRLWinPriv->pbmihShadow =
-        (BITMAPINFOHEADER *) malloc(sizeof(BITMAPINFOHEADER)
-                                    + 256 * sizeof(RGBQUAD));
+        malloc(sizeof(BITMAPINFOHEADER)
+               + 256 * sizeof(RGBQUAD));
     if (pRLWinPriv->pbmihShadow == NULL) {
         ErrorF("InitWin32RootlessEngine - malloc () failed\n");
         return;
@@ -214,8 +213,7 @@ winMWExtWMCreateFrame(RootlessWindowPtr pFrame, ScreenPtr pScreen,
              newX, newY, pFrame->width, pFrame->height);
 #endif
 
-    pRLWinPriv =
-        (win32RootlessWindowPtr) malloc(sizeof(win32RootlessWindowRec));
+    pRLWinPriv = malloc(sizeof(win32RootlessWindowRec));
     pRLWinPriv->pFrame = pFrame;
     pRLWinPriv->pfb = NULL;
     pRLWinPriv->hbmpShadow = NULL;
@@ -263,7 +261,7 @@ winMWExtWMCreateFrame(RootlessWindowPtr pFrame, ScreenPtr pScreen,
     strcat(pszClass, pszWindowID);
 
 #if CYGMULTIWINDOW_DEBUG
-    winDebug("winCreateWindowsWindow - Creating class: %s\n", pszClass);
+    winDebug("winMWExtWMCreateFrame - Creating class: %s\n", pszClass);
 #endif
 
     /* Setup our window class */
@@ -312,8 +310,8 @@ winMWExtWMCreateFrame(RootlessWindowPtr pFrame, ScreenPtr pScreen,
     }
 
 #if CYGMULTIWINDOW_DEBUG
-    winDebug("winMWExtWMCreateFrame - (%08x) %08x\n",
-             (int) pFrame->wid, (int) pRLWinPriv->hWnd);
+    winDebug("winMWExtWMCreateFrame - (%p) %p\n",
+             pFrame->wid, pRLWinPriv->hWnd);
 #if 0
     {
         WindowPtr pWin2 = NULL;
@@ -350,8 +348,8 @@ winMWExtWMDestroyFrame(RootlessFrameID wid)
     char pszClass[CLASS_NAME_LENGTH];
 
 #if CYGMULTIWINDOW_DEBUG
-    winDebug("winMWExtWMDestroyFrame (%08x) %08x\n",
-             (int) pRLWinPriv, (int) pRLWinPriv->hWnd);
+    winDebug("winMWExtWMDestroyFrame (%p) %p\n",
+             pRLWinPriv, pRLWinPriv->hWnd);
 #if 0
     {
         WindowPtr pWin2 = NULL;
@@ -416,7 +414,7 @@ winMWExtWMMoveFrame(RootlessFrameID wid, ScreenPtr pScreen, int iNewX,
     int iX, iY, iWidth, iHeight;
 
 #if CYGMULTIWINDOW_DEBUG
-    winDebug("winMWExtWMMoveFrame (%08x) (%d %d)\n", (int) pRLWinPriv, iNewX,
+    winDebug("winMWExtWMMoveFrame (%p) (%d %d)\n", pRLWinPriv, iNewX,
              iNewY);
 #endif
 
@@ -456,7 +454,7 @@ winMWExtWMMoveFrame(RootlessFrameID wid, ScreenPtr pScreen, int iNewX,
                  SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOZORDER);
     g_fNoConfigureWindow = FALSE;
 #if CYGMULTIWINDOW_DEBUG
-    winDebug("winMWExtWMMoveFrame (%08x) done\n", (int) pRLWinPriv);
+    winDebug("winMWExtWMMoveFrame (%p) done\n", pRLWinPriv);
 #endif
 }
 
@@ -474,8 +472,8 @@ winMWExtWMResizeFrame(RootlessFrameID wid, ScreenPtr pScreen,
     int iX, iY;
 
 #if CYGMULTIWINDOW_DEBUG
-    winDebug("winMWExtWMResizeFrame (%08x) (%d %d)-(%d %d)\n",
-             (int) pRLWinPriv, iNewX, iNewY, uiNewWidth, uiNewHeight);
+    winDebug("winMWExtWMResizeFrame (%p) (%d %d)-(%d %d)\n",
+             pRLWinPriv, iNewX, iNewY, uiNewWidth, uiNewHeight);
 #endif
 
     pRLWinPriv->fResized = TRUE;
@@ -526,7 +524,7 @@ winMWExtWMRestackFrame(RootlessFrameID wid, RootlessFrameID nextWid)
     Bool fNeedRestack = TRUE;
 
 #if CYGMULTIWINDOW_DEBUG
-    winDebug("winMWExtWMRestackFrame (%08x)\n", (int) pRLWinPriv);
+    winDebug("winMWExtWMRestackFrame (%p)\n", pRLWinPriv);
 #endif
 
     if (pScreenPriv && pScreenPriv->fRestacking)
@@ -612,7 +610,7 @@ winMWExtWMRestackFrame(RootlessFrameID wid, RootlessFrameID nextWid)
                      0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
     }
 #if CYGMULTIWINDOW_DEBUG
-    winDebug("winMWExtWMRestackFrame - done (%08x)\n", (int) pRLWinPriv);
+    winDebug("winMWExtWMRestackFrame - done (%p)\n", pRLWinPriv);
 #endif
 
     pRLWinPriv->fRestackingNow = FALSE;
@@ -626,7 +624,7 @@ winMWExtWMReshapeFrame(RootlessFrameID wid, RegionPtr pShape)
     RECT rcWindow, rcClient;
 
 #if CYGMULTIWINDOW_DEBUG
-    winDebug("winMWExtWMReshapeFrame (%08x)\n", (int) pRLWinPriv);
+    winDebug("winMWExtWMReshapeFrame (%p)\n", pRLWinPriv);
 #endif
 
     hRgn = winMWExtWMCreateRgnFromRegion(pShape);
@@ -634,7 +632,7 @@ winMWExtWMReshapeFrame(RootlessFrameID wid, RegionPtr pShape)
     /* Create region for non-client area */
     GetWindowRect(pRLWinPriv->hWnd, &rcWindow);
     GetClientRect(pRLWinPriv->hWnd, &rcClient);
-    MapWindowPoints(pRLWinPriv->hWnd, HWND_DESKTOP, (LPPOINT) & rcClient, 2);
+    MapWindowPoints(pRLWinPriv->hWnd, HWND_DESKTOP, (LPPOINT) &rcClient, 2);
     OffsetRgn(hRgn, rcClient.left - rcWindow.left, rcClient.top - rcWindow.top);
     OffsetRect(&rcClient, -rcWindow.left, -rcWindow.top);
     OffsetRect(&rcWindow, -rcWindow.left, -rcWindow.top);
@@ -655,7 +653,7 @@ winMWExtWMUnmapFrame(RootlessFrameID wid)
     win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) wid;
 
 #if CYGMULTIWINDOW_DEBUG
-    winDebug("winMWExtWMUnmapFrame (%08x)\n", (int) pRLWinPriv);
+    winDebug("winMWExtWMUnmapFrame (%p)\n", pRLWinPriv);
 #endif
 
     g_fNoConfigureWindow = TRUE;
@@ -680,7 +678,7 @@ winMWExtWMStartDrawing(RootlessFrameID wid, char **pixelData, int *bytesPerRow)
     HBITMAP hbmpNew;
 
 #if CYGMULTIWINDOW_DEBUG
-    winDebug("winMWExtWMStartDrawing (%08x) %08x\n", (int) pRLWinPriv,
+    winDebug("winMWExtWMStartDrawing (%p) %08x\n", pRLWinPriv,
              pRLWinPriv->fDestroyed);
 #endif
 
@@ -692,8 +690,8 @@ winMWExtWMStartDrawing(RootlessFrameID wid, char **pixelData, int *bytesPerRow)
             pScreenInfo = pScreenPriv->pScreenInfo;
 
 #if CYGMULTIWINDOW_DEBUG
-        winDebug("\tpScreenPriv %08X\n", (int) pScreenPriv);
-        winDebug("\tpScreenInfo %08X\n", (int) pScreenInfo);
+        winDebug("\tpScreenPriv %p\n", pScreenPriv);
+        winDebug("\tpScreenInfo %p\n", pScreenInfo);
         winDebug("\t(%d, %d)\n", (int) pRLWinPriv->pFrame->width,
                  (int) pRLWinPriv->pFrame->height);
 #endif
@@ -725,7 +723,7 @@ winMWExtWMStartDrawing(RootlessFrameID wid, char **pixelData, int *bytesPerRow)
             hbmpNew = CreateDIBSection(pRLWinPriv->hdcScreen,
                                        (BITMAPINFO *) pRLWinPriv->pbmihShadow,
                                        DIB_RGB_COLORS,
-                                       (VOID **) & pRLWinPriv->pfb, NULL, 0);
+                                       (VOID **) &pRLWinPriv->pfb, NULL, 0);
             if (hbmpNew == NULL || pRLWinPriv->pfb == NULL) {
                 ErrorF("winMWExtWMStartDrawing - CreateDIBSection failed\n");
                 //return FALSE;
@@ -808,9 +806,9 @@ winMWExtWMStartDrawing(RootlessFrameID wid, char **pixelData, int *bytesPerRow)
         ErrorF("winMWExtWMStartDrawing - Already window was destroyed \n");
     }
 #if CYGMULTIWINDOW_DEBUG
-    winDebug("winMWExtWMStartDrawing - done (0x%08x) 0x%08x %d\n",
-             (int) pRLWinPriv,
-             (unsigned int) pRLWinPriv->pfb,
+    winDebug("winMWExtWMStartDrawing - done (%p) %p %d\n",
+             pRLWinPriv,
+             pRLWinPriv->pfb,
              (unsigned int) pRLWinPriv->dwWidthBytes);
 #endif
     *pixelData = pRLWinPriv->pfb;
@@ -883,7 +881,7 @@ winMWExtWMUpdateRegion(RootlessFrameID wid, RegionPtr pDamage)
                       NULL,
                       GetLastError(),
                       MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
-                      (LPTSTR) & lpMsgBuf, 0, NULL);
+                      (LPTSTR) &lpMsgBuf, 0, NULL);
 
         ErrorF("winMWExtWMUpdateRegion - UpdateLayeredWindow failed: %s\n",
                (LPSTR) lpMsgBuf);
@@ -924,8 +922,8 @@ winMWExtWMRootlessSwitchWindow(RootlessWindowPtr pFrame, WindowPtr oldWin)
     win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) pFrame->wid;
 
 #if CYGMULTIWINDOW_DEBUG
-    winDebug("winMWExtWMRootlessSwitchWindow (%08x) %08x\n",
-             (int) pRLWinPriv, (int) pRLWinPriv->hWnd);
+    winDebug("winMWExtWMRootlessSwitchWindow (%p) %p\n",
+             pRLWinPriv, pRLWinPriv->hWnd);
 #endif
     pRLWinPriv->pFrame = pFrame;
     pRLWinPriv->fResized = TRUE;
@@ -979,8 +977,8 @@ winMWExtWMCopyWindow(RootlessFrameID wid, int nDstRects,
     RECT rcDmg;
 
 #if CYGMULTIWINDOW_DEBUG
-    winDebug("winMWExtWMCopyWindow (%08x, %d, %08x, %d, %d)\n",
-             (int) pRLWinPriv, nDstRects, (int) pDstRects, nDx, nDy);
+    winDebug("winMWExtWMCopyWindow (%p, %d, %p, %d, %d)\n",
+             pRLWinPriv, nDstRects, pDstRects, nDx, nDy);
 #endif
 
     for (pEnd = pDstRects + nDstRects; pDstRects < pEnd; pDstRects++) {
index f2d68cb..1faa531 100644 (file)
@@ -186,7 +186,6 @@ winMWExtWMUpdateWindowDecoration(win32RootlessWindowPtr pRLWinPriv,
 {
     Bool fDecorate = FALSE;
     DWORD dwExStyle = 0;
-    DWORD dwStyle = 0;
     WINDOWPLACEMENT wndPlace;
     UINT showCmd = 0;
 
@@ -214,12 +213,11 @@ winMWExtWMUpdateWindowDecoration(win32RootlessWindowPtr pRLWinPriv,
 
     showCmd |= SWP_NOMOVE | SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOZORDER;
 
-    winDebug("winMWExtWMUpdateWindowDecoration %08x %s\n",
-             (int) pRLWinPriv, fDecorate ? "Decorate" : "Bare");
+    winDebug("winMWExtWMUpdateWindowDecoration %p %s\n",
+             pRLWinPriv, fDecorate ? "Decorate" : "Bare");
 
-    /* Get the standard and extended window style information */
+    /* Get the extended window style information */
     dwExStyle = GetWindowLongPtr(pRLWinPriv->hWnd, GWL_EXSTYLE);
-    dwStyle = GetWindowLongPtr(pRLWinPriv->hWnd, GWL_STYLE);
 
     if (fDecorate) {
         RECT rcNew;
index 436f9ed..001d0d2 100644 (file)
@@ -649,13 +649,13 @@ winMWExtWMWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
         if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput)
             break;
         SetCapture(hwnd);
-        return winMouseButtonsHandle(pScreen, ButtonPress, HIWORD(wParam) + 5,
+        return winMouseButtonsHandle(pScreen, ButtonPress, HIWORD(wParam) + 7,
                                      wParam);
     case WM_XBUTTONUP:
         if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput)
             break;
         ReleaseCapture();
-        return winMouseButtonsHandle(pScreen, ButtonRelease, HIWORD(wParam) + 5,
+        return winMouseButtonsHandle(pScreen, ButtonRelease, HIWORD(wParam) + 7,
                                      wParam);
 
     case WM_MOUSEWHEEL:
@@ -667,6 +667,15 @@ winMWExtWMWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
         SendMessage(hwndScreen, message, wParam, lParam);
         return 0;
 
+    case WM_MOUSEHWHEEL:
+#if CYGMULTIWINDOW_DEBUG
+        winDebug("winMWExtWMWindowProc - WM_MOUSEHWHEEL\n");
+#endif
+
+        /* Pass the message to the root window */
+        SendMessage(hwndScreen, message, wParam, lParam);
+        return 0;
+
     case WM_MOUSEACTIVATE:
 #if CYGMULTIWINDOW_DEBUG
         winDebug("winMWExtWMWindowProc - WM_MOUSEACTIVATE\n");
@@ -780,7 +789,7 @@ winMWExtWMWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
                           NULL,
                           GetLastError(),
                           MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
-                          (LPTSTR) & lpMsgBuf, 0, NULL);
+                          (LPTSTR) &lpMsgBuf, 0, NULL);
 
             ErrorF("winMWExtWMWindowProc - BitBlt failed: %s\n",
                    (LPSTR) lpMsgBuf);
@@ -823,24 +832,24 @@ winMWExtWMWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
         if (!(pWinPos->flags & SWP_NOZORDER)) {
             if (pRLWinPriv->fRestackingNow || pScreenPriv->fRestacking) {
 #if CYGMULTIWINDOW_DEBUG
-                winDebug("Win %08x is now restacking.\n",
-                         (unsigned int) pRLWinPriv);
+                winDebug("Win %p is now restacking.\n",
+                         pRLWinPriv);
 #endif
                 break;
             }
 
             if (winIsInternalWMRunning(pScreenInfo) || IsRaiseOnClick(pWin)) {
 #if CYGMULTIWINDOW_DEBUG
-                winDebug("Win %08x has WINDOWSWM_RAISE_ON_CLICK.\n",
-                         (unsigned int) pRLWinPriv);
+                winDebug("Win %p has WINDOWSWM_RAISE_ON_CLICK.\n",
+                         pRLWinPriv);
 #endif
                 break;
             }
 
 #if CYGMULTIWINDOW_DEBUG
-            winDebug("Win %08x forbid to change z order (%08x).\n",
-                     (unsigned int) pRLWinPriv,
-                     (unsigned int) pWinPos->hwndInsertAfter);
+            winDebug("Win %p forbid to change z order (%p).\n",
+                     pRLWinPriv,
+                     pWinPos->hwndInsertAfter);
 #endif
             pWinPos->flags |= SWP_NOZORDER;
         }
@@ -1058,7 +1067,7 @@ winMWExtWMWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
             if (!pRLWinPriv->fMovingOrSizing
                 /*&& (pWinPos->flags & SWP_SHOWWINDOW) */ ) {
                 GetClientRect(hwnd, &rcClient);
-                MapWindowPoints(hwnd, HWND_DESKTOP, (LPPOINT) & rcClient, 2);
+                MapWindowPoints(hwnd, HWND_DESKTOP, (LPPOINT) &rcClient, 2);
 
                 if (!(pWinPos->flags & SWP_NOMOVE)
                     && !(pWinPos->flags & SWP_NOSIZE)) {
@@ -1263,7 +1272,7 @@ winMWExtWMWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
 
         GetClientRect(hwnd, &rcClient);
 
-        MapWindowPoints(hwnd, HWND_DESKTOP, (LPPOINT) & rcClient, 2);
+        MapWindowPoints(hwnd, HWND_DESKTOP, (LPPOINT) &rcClient, 2);
 
         if (winIsInternalWMRunning(pScreenInfo))
             winAdjustXWindow(pWin, hwnd);
index 5947917..8c1c28f 100644 (file)
@@ -39,7 +39,7 @@
  */
 
 static int
- winAddRgn(WindowPtr pWindow, pointer data);
+ winAddRgn(WindowPtr pWindow, void *data);
 
 static
     void
@@ -59,7 +59,6 @@ winCreateWindowNativeGDI(WindowPtr pWin)
     Bool fResult = TRUE;
     ScreenPtr pScreen = pWin->drawable.pScreen;
 
-    winWindowPriv(pWin);
     winScreenPriv(pScreen);
 
 #if CYGDEBUG
@@ -82,7 +81,6 @@ winDestroyWindowNativeGDI(WindowPtr pWin)
     Bool fResult = TRUE;
     ScreenPtr pScreen = pWin->drawable.pScreen;
 
-    winWindowPriv(pWin);
     winScreenPriv(pScreen);
 
 #if CYGDEBUG
@@ -105,7 +103,6 @@ winPositionWindowNativeGDI(WindowPtr pWin, int x, int y)
     Bool fResult = TRUE;
     ScreenPtr pScreen = pWin->drawable.pScreen;
 
-    winWindowPriv(pWin);
     winScreenPriv(pScreen);
 
 #if CYGDEBUG
@@ -131,7 +128,6 @@ winCopyWindowNativeGDI(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
     BoxPtr pBox;
     int dx, dy;
     int i, nbox;
-    WindowPtr pwinRoot;
     BoxPtr pBoxDst;
     ScreenPtr pScreen = pWin->drawable.pScreen;
 
@@ -141,9 +137,6 @@ winCopyWindowNativeGDI(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
     ErrorF("winCopyWindow\n");
 #endif
 
-    /* Get a pointer to the root window */
-    pwinRoot = pWin->drawable.pScreen->root;
-
     /* Create a region for the destination */
     prgnDst = RegionCreate(NULL, 1);
 
@@ -162,7 +155,7 @@ winCopyWindowNativeGDI(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
     nbox = RegionNumRects(prgnDst);
 
     /* Allocate source points for each box */
-    if (!(pptSrc = (DDXPointPtr) malloc(nbox * sizeof(DDXPointRec))))
+    if (!(pptSrc = malloc(nbox * sizeof(DDXPointRec))))
         return;
 
     /* Set an iterator pointer */
@@ -210,7 +203,6 @@ winChangeWindowAttributesNativeGDI(WindowPtr pWin, unsigned long mask)
     Bool fResult = TRUE;
     ScreenPtr pScreen = pWin->drawable.pScreen;
 
-    winWindowPriv(pWin);
     winScreenPriv(pScreen);
 
 #if CYGDEBUG
@@ -238,7 +230,6 @@ winUnmapWindowNativeGDI(WindowPtr pWin)
     Bool fResult = TRUE;
     ScreenPtr pScreen = pWin->drawable.pScreen;
 
-    winWindowPriv(pWin);
     winScreenPriv(pScreen);
 
 #if CYGDEBUG
@@ -262,7 +253,6 @@ winMapWindowNativeGDI(WindowPtr pWin)
     Bool fResult = TRUE;
     ScreenPtr pScreen = pWin->drawable.pScreen;
 
-    winWindowPriv(pWin);
     winScreenPriv(pScreen);
 
 #if CYGDEBUG
@@ -466,7 +456,7 @@ winSetShapeRootless(WindowPtr pWin, int kind)
 
 static
     int
-winAddRgn(WindowPtr pWin, pointer data)
+winAddRgn(WindowPtr pWin, void *data)
 {
     int iX, iY, iWidth, iHeight, iBorder;
     HRGN hRgn = *(HRGN *) data;
index a5919ee..7e6bd56 100644 (file)
@@ -49,6 +49,7 @@
 #define WINDOW_TITLE_XDMCP     "%s:%s.%d"
 #define WIN_SCR_PROP           "cyg_screen_prop rl"
 #define WINDOW_CLASS_X         "cygwin/x X rl"
+#define WINDOW_CLASS_X_MSG      "cygwin/x X msg"
 #define WINDOW_TITLE_X         PROJECT_NAME " X"
 #define WIN_WINDOW_PROP                "cyg_window_prop_rl"
 #ifdef HAS_DEVWINDOWS
@@ -81,15 +82,6 @@ typedef struct {
 #ifdef XWIN_GLX_WINDOWS
     Bool fWglUsed;
 #endif
-
-    /* Privates used by primary fb DirectDraw server */
-    LPDDSURFACEDESC pddsdPrimary;
-
-    /* Privates used by shadow fb DirectDraw Nonlocking server */
-    LPDIRECTDRAWSURFACE4 pddsPrimary4;
-
-    /* Privates used by both shadow fb DirectDraw servers */
-    LPDIRECTDRAWCLIPPER pddcPrimary;
 } winPrivWinRec, *winPrivWinPtr;
 
 #ifdef XWIN_MULTIWINDOW
@@ -119,6 +111,7 @@ typedef struct _winWMMessageRec {
 #define                WM_WM_CHANGE_STATE      (WM_USER + 11)
 #define                WM_WM_MAP2              (WM_USER + 12)
 #define                WM_WM_MAP3              (WM_USER + 13)
+#define                WM_WM_HINTS_EVENT       (WM_USER + 14)
 #define                WM_MANAGE               (WM_USER + 100)
 #define                WM_UNMANAGE             (WM_USER + 102)
 
@@ -157,5 +150,17 @@ void
 void
  winMinimizeWindow(Window id);
 
+void
+ winPropertyStoreInit(void);
+
+void
+ winPropertyStoreDestroy(void);
+
+void
+ winSetAppUserModelID(HWND hWnd, const char *AppID);
+
+void
+ winShowWindowOnTaskbar(HWND hWnd, BOOL show);
+
 #endif                          /* XWIN_MULTIWINDOW */
 #endif
index 5d513a8..2805ff7 100644 (file)
@@ -53,8 +53,8 @@ static XID eventResource;
 /* Currently selected events */
 static unsigned int eventMask = 0;
 
-static int WMFreeClient(pointer data, XID id);
-static int WMFreeEvents(pointer data, XID id);
+static int WMFreeClient(void *data, XID id);
+static int WMFreeEvents(void *data, XID id);
 static void SNotifyEvent(xWindowsWMNotifyEvent * from,
                          xWindowsWMNotifyEvent * to);
 
@@ -66,23 +66,10 @@ typedef struct _WMEvent {
     unsigned int mask;
 } WMEventRec;
 
-static inline BoxRec
-make_box(int x, int y, int w, int h)
-{
-    BoxRec r;
-
-    r.x1 = x;
-    r.y1 = y;
-    r.x2 = x + w;
-    r.y2 = y + h;
-    return r;
-}
-
 static int
 ProcWindowsWMQueryVersion(ClientPtr client)
 {
     xWindowsWMQueryVersionReply rep;
-    int n;
 
     REQUEST_SIZE_MATCH(xWindowsWMQueryVersionReq);
     rep.type = X_Reply;
@@ -112,13 +99,13 @@ updateEventMask(WMEventPtr * pHead)
 }
 
  /*ARGSUSED*/ static int
-WMFreeClient(pointer data, XID id)
+WMFreeClient(void *data, XID id)
 {
     WMEventPtr pEvent;
     WMEventPtr *pHead, pCur, pPrev;
 
     pEvent = (WMEventPtr) data;
-    dixLookupResourceByType((pointer) &pHead, eventResource, eventResourceType,
+    dixLookupResourceByType((void *) &pHead, eventResource, eventResourceType,
                             NullClient, DixUnknownAccess);
     if (pHead) {
         pPrev = 0;
@@ -132,12 +119,12 @@ WMFreeClient(pointer data, XID id)
         }
         updateEventMask(pHead);
     }
-    free((pointer) pEvent);
+    free((void *) pEvent);
     return 1;
 }
 
  /*ARGSUSED*/ static int
-WMFreeEvents(pointer data, XID id)
+WMFreeEvents(void *data, XID id)
 {
     WMEventPtr *pHead, pCur, pNext;
 
@@ -145,9 +132,9 @@ WMFreeEvents(pointer data, XID id)
     for (pCur = *pHead; pCur; pCur = pNext) {
         pNext = pCur->next;
         FreeResource(pCur->clientResource, ClientType);
-        free((pointer) pCur);
+        free((void *) pCur);
     }
-    free((pointer) pHead);
+    free((void *) pHead);
     eventMask = 0;
     return 1;
 }
@@ -160,7 +147,7 @@ ProcWindowsWMSelectInput(ClientPtr client)
     XID clientResource;
 
     REQUEST_SIZE_MATCH(xWindowsWMSelectInputReq);
-    dixLookupResourceByType((pointer) &pHead, eventResource, eventResourceType,
+    dixLookupResourceByType((void *) &pHead, eventResource, eventResourceType,
                             client, DixWriteAccess);
     if (stuff->mask != 0) {
         if (pHead) {
@@ -175,7 +162,7 @@ ProcWindowsWMSelectInput(ClientPtr client)
         }
 
         /* build the entry */
-        pNewEvent = (WMEventPtr) malloc(sizeof(WMEventRec));
+        pNewEvent = malloc(sizeof(WMEventRec));
         if (!pNewEvent)
             return BadAlloc;
         pNewEvent->next = 0;
@@ -187,7 +174,7 @@ ProcWindowsWMSelectInput(ClientPtr client)
          */
         clientResource = FakeClientID(client->index);
         pNewEvent->clientResource = clientResource;
-        if (!AddResource(clientResource, ClientType, (pointer) pNewEvent))
+        if (!AddResource(clientResource, ClientType, (void *) pNewEvent))
             return BadAlloc;
         /*
          * create a resource to contain a pointer to the list
@@ -196,9 +183,9 @@ ProcWindowsWMSelectInput(ClientPtr client)
          * done through the resource database.
          */
         if (!pHead) {
-            pHead = (WMEventPtr *) malloc(sizeof(WMEventPtr));
+            pHead = malloc(sizeof(WMEventPtr));
             if (!pHead ||
-                !AddResource(eventResource, eventResourceType, (pointer) pHead))
+                !AddResource(eventResource, eventResourceType, (void *) pHead))
             {
                 FreeResource(clientResource, RT_NONE);
                 return BadAlloc;
@@ -252,14 +239,14 @@ winWindowsWMSendEvent(int type, unsigned int mask, int which, int arg,
     ErrorF("winWindowsWMSendEvent %d %d %d %d,  %d %d - %d %d\n",
            type, mask, which, arg, x, y, w, h);
 #endif
-    dixLookupResourceByType((pointer) &pHead, eventResource, eventResourceType,
+    dixLookupResourceByType((void *) &pHead, eventResource, eventResourceType,
                             NullClient, DixUnknownAccess);
     if (!pHead)
         return;
     for (pEvent = *pHead; pEvent; pEvent = pEvent->next) {
         client = pEvent->client;
 #if CYGMULTIWINDOW_DEBUG
-        ErrorF("winWindowsWMSendEvent - x%08x\n", (int) client);
+        ErrorF("winWindowsWMSendEvent - %p\n", client);
 #endif
         if ((pEvent->mask & mask) == 0) {
             continue;
@@ -320,7 +307,6 @@ static int
 ProcWindowsWMFrameGetRect(ClientPtr client)
 {
     xWindowsWMFrameGetRectReply rep;
-    BoxRec ir;
     RECT rcNew;
 
     REQUEST(xWindowsWMFrameGetRectReq);
@@ -335,8 +321,6 @@ ProcWindowsWMFrameGetRect(ClientPtr client)
     rep.length = 0;
     rep.sequenceNumber = client->sequence;
 
-    ir = make_box(stuff->ix, stuff->iy, stuff->iw, stuff->ih);
-
     if (stuff->frame_rect != 0) {
         ErrorF("ProcWindowsWMFrameGetRect - stuff->frame_rect != 0\n");
         return BadValue;
@@ -397,8 +381,8 @@ ProcWindowsWMFrameDraw(ClientPtr client)
         return BadWindow;
 
 #if CYGMULTIWINDOW_DEBUG
-    ErrorF("ProcWindowsWMFrameDraw - HWND 0x%08x 0x%08x 0x%08x\n",
-           (int) pRLWinPriv->hWnd, (int) stuff->frame_style,
+    ErrorF("ProcWindowsWMFrameDraw - HWND %p 0x%08x 0x%08x\n",
+           pRLWinPriv->hWnd, (int) stuff->frame_style,
            (int) stuff->frame_style_ex);
     ErrorF("ProcWindowsWMFrameDraw - %d %d %d %d\n",
            stuff->ix, stuff->iy, stuff->iw, stuff->ih);
@@ -491,7 +475,7 @@ ProcWindowsWMFrameSetTitle(ClientPtr client)
 #endif
 
     title_bytes = malloc(title_length + 1);
-    strncpy(title_bytes, (unsigned char *) &stuff[1], title_length);
+    strncpy(title_bytes, (char *) &stuff[1], title_length);
     title_bytes[title_length] = '\0';
 
     pRLWinPriv = (win32RootlessWindowPtr) RootlessFrameForWindow(pWin, FALSE);
@@ -525,7 +509,7 @@ ProcWindowsWMDispatch(ClientPtr client)
         return ProcWindowsWMQueryVersion(client);
     }
 
-    if (!LocalClient(client))
+    if (!client->local)
         return WMErrorBase + WindowsWMClientNotLocal;
 
     switch (stuff->data) {
@@ -562,8 +546,6 @@ SNotifyEvent(xWindowsWMNotifyEvent * from, xWindowsWMNotifyEvent * to)
 static int
 SProcWindowsWMQueryVersion(ClientPtr client)
 {
-    int n;
-
     REQUEST(xWindowsWMQueryVersionReq);
     swaps(&stuff->length);
     return ProcWindowsWMQueryVersion(client);
@@ -575,7 +557,7 @@ SProcWindowsWMDispatch(ClientPtr client)
     REQUEST(xReq);
 
     /* It is bound to be non-local when there is byte swapping */
-    if (!LocalClient(client))
+    if (!client->local)
         return WMErrorBase + WindowsWMClientNotLocal;
 
     /* only local clients are allowed WM access */
index fe662b9..bee223d 100644 (file)
@@ -62,7 +62,6 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
     static winScreenInfo *s_pScreenInfo = NULL;
     static ScreenPtr s_pScreen = NULL;
     static HWND s_hwndLastPrivates = NULL;
-    static HINSTANCE s_hInstance;
     static Bool s_fTracking = FALSE;
     static unsigned long s_ulServerGeneration = 0;
     static UINT s_uTaskbarRestart = 0;
@@ -117,7 +116,6 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
          * areas of our display window.
          */
         s_pScreenPriv = ((LPCREATESTRUCT) lParam)->lpCreateParams;
-        s_hInstance = ((LPCREATESTRUCT) lParam)->hInstance;
         s_pScreenInfo = s_pScreenPriv->pScreenInfo;
         s_pScreen = s_pScreenInfo->pScreen;
         s_hwndLastPrivates = hwnd;
@@ -896,7 +894,7 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
 #endif
             )
             SetCapture(hwnd);
-        return winMouseButtonsHandle(s_pScreen, ButtonPress, HIWORD(wParam) + 5,
+        return winMouseButtonsHandle(s_pScreen, ButtonPress, HIWORD(wParam) + 7,
                                      wParam);
     case WM_XBUTTONUP:
         if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
@@ -908,7 +906,7 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
             )
             ReleaseCapture();
         return winMouseButtonsHandle(s_pScreen, ButtonRelease,
-                                     HIWORD(wParam) + 5, wParam);
+                                     HIWORD(wParam) + 7, wParam);
 
     case WM_TIMER:
         if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
@@ -930,6 +928,7 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
 
         case WIN_POLLING_MOUSE_TIMER_ID:
         {
+            static POINT last_point;
             POINT point;
             WPARAM wL, wM, wR, wShift, wCtrl;
             LPARAM lPos;
@@ -941,8 +940,12 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
             point.x -= GetSystemMetrics(SM_XVIRTUALSCREEN);
             point.y -= GetSystemMetrics(SM_YVIRTUALSCREEN);
 
-            /* Deliver absolute cursor position to X Server */
-            winEnqueueMotion(point.x, point.y);
+            /* If the mouse pointer has moved, deliver absolute cursor position to X Server */
+            if (last_point.x != point.x || last_point.y != point.y) {
+                winEnqueueMotion(point.x, point.y);
+                last_point.x = point.x;
+                last_point.y = point.y;
+            }
 
             /* Check if a button was released but we didn't see it */
             GetCursorPos(&point);
@@ -952,11 +955,11 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
             wShift = (GetKeyState(VK_SHIFT) & 0x8000) ? MK_SHIFT : 0;
             wCtrl = (GetKeyState(VK_CONTROL) & 0x8000) ? MK_CONTROL : 0;
             lPos = MAKELPARAM(point.x, point.y);
-            if (g_fButton[0] & !wL)
+            if (g_fButton[0] && !wL)
                 PostMessage(hwnd, WM_LBUTTONUP, wCtrl | wM | wR | wShift, lPos);
-            if (g_fButton[1] & !wM)
+            if (g_fButton[1] && !wM)
                 PostMessage(hwnd, WM_MBUTTONUP, wCtrl | wL | wR | wShift, lPos);
-            if (g_fButton[2] & !wR)
+            if (g_fButton[2] && !wR)
                 PostMessage(hwnd, WM_RBUTTONUP, wCtrl | wL | wM | wShift, lPos);
         }
         }
@@ -973,7 +976,20 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
 #if CYGDEBUG
         winDebug("winWindowProc - WM_MOUSEWHEEL\n");
 #endif
-        winMouseWheel(s_pScreen, GET_WHEEL_DELTA_WPARAM(wParam));
+        /* Button4 = WheelUp */
+        /* Button5 = WheelDown */
+        winMouseWheel(&(s_pScreenPriv->iDeltaZ), GET_WHEEL_DELTA_WPARAM(wParam), Button4, Button5);
+        break;
+
+    case WM_MOUSEHWHEEL:
+        if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+            break;
+#if CYGDEBUG
+        winDebug("winWindowProc - WM_MOUSEHWHEEL\n");
+#endif
+        /* Button7 = TiltRight */
+        /* Button6 = TiltLeft */
+        winMouseWheel(&(s_pScreenPriv->iDeltaV), GET_WHEEL_DELTA_WPARAM(wParam), 7, 6);
         break;
 
     case WM_SETFOCUS:
@@ -1061,7 +1077,7 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
         }
 
         /* Translate Windows key code to X scan code */
-        winTranslateKey(wParam, lParam, &iScanCode);
+        iScanCode = winTranslateKey(wParam, lParam);
 
         /* Ignore repeats for CapsLock */
         if (wParam == VK_CAPITAL)
@@ -1090,7 +1106,7 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
             return 0;
 
         /* Enqueue a keyup event */
-        winTranslateKey(wParam, lParam, &iScanCode);
+        iScanCode = winTranslateKey(wParam, lParam);
         winSendKeyEvent(iScanCode, FALSE);
 
         /* Release all pressed shift keys */
@@ -1144,6 +1160,7 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
 
         /* Clear any lingering wheel delta */
         s_pScreenPriv->iDeltaZ = 0;
+        s_pScreenPriv->iDeltaV = 0;
 
         /* Reshow the Windows mouse cursor if we are being deactivated */
         if (g_fSoftwareCursor && LOWORD(wParam) == WA_INACTIVE && !g_fCursor) {
@@ -1218,7 +1235,6 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
         }
         break;
 
-    case WM_ENDSESSION:
     case WM_GIVEUP:
         /* Tell X that we are giving up */
 #ifdef XWIN_MULTIWINDOW
diff --git a/hwa/Makefile.am b/hwa/Makefile.am
new file mode 100644 (file)
index 0000000..83607e8
--- /dev/null
@@ -0,0 +1,12 @@
+noinst_LTLIBRARIES = libhwa.la
+
+AM_CFLAGS = $(DIX_CFLAGS)
+
+sdk_HEADERS = hwa.h
+
+libhwa_la_SOURCES = \
+        hwa.c \
+        hwa.h \
+        hwa_priv.h \
+        hwa_request.c \        
+        hwa_screen.c
diff --git a/hwa/hwa.c b/hwa/hwa.c
new file mode 100644 (file)
index 0000000..502c577
--- /dev/null
+++ b/hwa/hwa.c
@@ -0,0 +1,73 @@
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "hwa_priv.h"
+
+int hwa_request;
+
+DevPrivateKeyRec hwa_screen_private_key;
+DevPrivateKeyRec hwa_window_private_key;
+
+static Bool
+hwa_close_screen(ScreenPtr screen)
+{
+    hwa_screen_priv_ptr screen_priv = hwa_screen_priv(screen);
+
+    unwrap(screen_priv, screen, CloseScreen);
+
+    free(screen_priv);
+    return (*screen->CloseScreen) (screen);
+
+}
+
+Bool
+hwa_screen_init(ScreenPtr screen, hwa_screen_info_ptr info)
+{
+    if (!dixRegisterPrivateKey(&hwa_screen_private_key, PRIVATE_SCREEN, 0))
+        return FALSE;
+
+    if (!hwa_screen_priv(screen)) {
+        hwa_screen_priv_ptr screen_priv = calloc(1, sizeof (hwa_screen_priv_rec));
+        if (!screen_priv)
+            return FALSE;
+
+        wrap(screen_priv, screen, CloseScreen, hwa_close_screen);
+        /*
+        wrap(screen_priv, screen, ConfigNotify, hwa_config_notify);
+        */
+
+        screen_priv->info = info;
+
+        dixSetPrivate(&screen->devPrivates, &hwa_screen_private_key, screen_priv);
+    }
+
+    return TRUE;
+}
+
+/*
+ * Initialization of HWA extension
+ */
+void
+hwa_extension_init(void)
+{
+    ExtensionEntry *extension;
+    int i;
+
+    extension = AddExtension( HWA_NAME, HWANumberRequests, HWANumberErrors,
+                proc_hwa_dispatch, sproc_hwa_dispatch,
+                             NULL, StandardMinorOpcode );
+    if (!extension)
+        goto bail;
+
+    hwa_request = extension->base;
+
+    for (i = 0; i < screenInfo.numScreens; i++) {
+        if (!hwa_screen_init(screenInfo.screens[i], NULL))
+            goto bail;
+    }
+    return;
+
+bail:
+    FatalError("Cannot initialize HWA extension");
+}
diff --git a/hwa/hwa.h b/hwa/hwa.h
new file mode 100644 (file)
index 0000000..31a1d83
--- /dev/null
+++ b/hwa/hwa.h
@@ -0,0 +1,39 @@
+#ifndef HWA_H_
+#define HWA_H_
+
+#include <xorg-server.h>
+
+#include <X11/extensions/hwaproto.h>
+#include <randrstr.h>
+
+#define HWA_SCREEN_INFO_VERSION        1
+
+typedef enum
+{
+    HWA_OVERLAY_LAYER_UI = 0,
+    HWA_OVERLAY_LAYER_XV = 1
+}HWA_OVERLAY_LAYER;
+
+typedef int (*hwa_cursor_enable) (ScreenPtr screen, CARD16 *enable);
+typedef int (*hwa_cursor_rotate) (ScreenPtr screen, RRCrtc crtc_id, CARD16 *pdegree);
+typedef int (*hwa_screen_invert_negative_proc)(ScreenPtr pScreen, int accessibility_status);
+typedef int (*hwa_screen_scale_proc)(ScreenPtr pScreen, int scale_status, int x, int y, int w, int h);
+typedef int (*hwa_overlay_show_layer) (ScreenPtr screen, RRCrtc crtc_id, HWA_OVERLAY_LAYER ovrlayer);
+typedef int (*hwa_overlay_hide_layer) (ScreenPtr screen, RRCrtc crtc_id, HWA_OVERLAY_LAYER ovrlayer);
+
+typedef struct hwa_screen_info {
+    uint32_t                    version;
+
+    hwa_cursor_enable         cursor_enable;
+    hwa_cursor_rotate         cursor_rotate;
+    hwa_screen_invert_negative_proc  screen_invert_negative;
+    hwa_screen_scale_proc            screen_scale;
+    hwa_overlay_show_layer           show_layer;
+    hwa_overlay_hide_layer           hide_layer;
+
+} hwa_screen_info_rec, *hwa_screen_info_ptr;
+
+extern _X_EXPORT Bool
+hwa_screen_init(ScreenPtr screen, hwa_screen_info_ptr info);
+
+#endif /* HWA_H_ */
diff --git a/hwa/hwa_priv.h b/hwa/hwa_priv.h
new file mode 100644 (file)
index 0000000..40ef1fd
--- /dev/null
@@ -0,0 +1,75 @@
+#ifndef HWA_PRIV_H_
+#define HWA_PRIV_H_
+
+#define HAVE_STRNDUP
+#include <X11/X.h>
+#include "scrnintstr.h"
+#include "misc.h"
+#include "list.h"
+#include "windowstr.h"
+#include "dixstruct.h"
+#include <randrstr.h>
+#include "hwa.h"
+
+extern int hwa_request;
+extern DevPrivateKeyRec hwa_screen_private_key;
+
+typedef struct hwa_screen_priv {
+    CloseScreenProcPtr          CloseScreen;
+    ConfigNotifyProcPtr         ConfigNotify;
+    DestroyWindowProcPtr        DestroyWindow;
+
+    hwa_screen_info_ptr         info;
+} hwa_screen_priv_rec, *hwa_screen_priv_ptr;
+
+#define wrap(priv,real,mem,func) {\
+    priv->mem = real->mem; \
+    real->mem = func; \
+}
+
+#define unwrap(priv,real,mem) {\
+    real->mem = priv->mem; \
+}
+
+/*
+ * ...
+ */
+static inline hwa_screen_priv_ptr
+hwa_screen_priv(ScreenPtr screen)
+{
+    return (hwa_screen_priv_ptr)dixLookupPrivate(&(screen)->devPrivates, &hwa_screen_private_key);
+}
+
+/* Initialize main request handlers */
+int
+proc_hwa_dispatch(ClientPtr client);
+
+/* Initialize auxiliary request handlers */
+int
+sproc_hwa_dispatch(ClientPtr client);
+
+/* DDX interface */
+
+int
+hwa_CursorEnable( ScreenPtr screen, CARD16 *penable);
+
+int
+hwa_CursorRotate( ScreenPtr screen, RRCrtc crtc_id, CARD16 *pdegree);
+
+int
+hwa_screen_invert_negative( RRCrtcPtr target_crtc, int accessibility_status );
+
+int
+hwa_screen_scale(RRCrtcPtr target_crtc, int scale_status, int x, int y, int w, int h);
+
+int
+hwa_ShowLayer( ScreenPtr pScreen, RRCrtc crtc_id, HWA_OVERLAY_LAYER ovrlayer);
+
+int
+hwa_HideLayer( ScreenPtr pScreen, RRCrtc crtc_id, HWA_OVERLAY_LAYER ovrlayer);
+
+#endif /* HWA_PRIV_H_ */
+
+
+
+
diff --git a/hwa/hwa_request.c b/hwa/hwa_request.c
new file mode 100644 (file)
index 0000000..346ff2c
--- /dev/null
@@ -0,0 +1,464 @@
+
+#ifdef HAVE_XORG_CONFIG_H
+    #include <xorg-config.h>
+#endif
+
+#include "hwa_priv.h"
+
+#include <syncsrv.h>
+#include <unistd.h>
+#include <xace.h>
+
+#define VERIFY_RR_CRTC(id, ptr, a)\
+    {\
+       int rc = dixLookupResourceByType((void **)&(ptr), id,\
+                                        RRCrtcType, client, a);\
+       if (rc != Success) {\
+           client->errorValue = id;\
+           return rc;\
+       }\
+    }
+
+#define VERIFY_CRTC_OR_NONE(crtc_ptr, crtc_id, client, access) do {     \
+        if ((crtc_id) == None)                                          \
+            (crtc_ptr) = NULL;                                          \
+        else {                                                          \
+            VERIFY_RR_CRTC(crtc_id, crtc_ptr, access);                  \
+        }                                                               \
+    } while (0)
+
+
+#define ENABLE         1
+#define DISABLE 0
+#define IS_ON  1
+#define IS_OFF 0
+
+/* -------------------------------- Proc --------------------------------------- */
+
+/*
+ *  Main query version request
+ *
+ * This request returns the extension Major and Minor versions to a application
+ */
+static int
+proc_hwa_query_version( ClientPtr client )
+{
+    REQUEST(xHWAQueryVersionReq);
+    xHWAQueryVersionReply rep = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .majorVersion = HWA_MAJOR,
+        .minorVersion = HWA_MINOR
+    };
+
+    REQUEST_SIZE_MATCH(xHWAQueryVersionReq);
+    (void) stuff;
+    if (client->swapped) {
+        swaps(&rep.sequenceNumber);
+        swapl(&rep.length);
+        swapl(&rep.majorVersion);
+        swapl(&rep.minorVersion);
+    }
+    WriteToClient(client, sizeof(rep), &rep);
+    return Success;
+}
+
+
+static int
+proc_hwa_cursor_enable(ClientPtr client)
+{
+    REQUEST(xHWACursorEnableReq);
+    xHWACursorEnableReply rep = {
+            .type = X_Reply,
+            .sequenceNumber = client->sequence,
+            .length = 0,
+            .status = 0
+        };
+
+    int status,i;
+    ScreenPtr pScreen = NULL;
+    CARD16 enable = 0;
+    enable = (CARD16) stuff->enable;
+
+    REQUEST_SIZE_MATCH(xHWACursorEnableReq);
+
+    for (i = 0; i < screenInfo.numScreens; i++) {
+        pScreen = screenInfo.screens[i];
+        }
+
+    if(!pScreen)
+        return FALSE;
+    status = hwa_CursorEnable( pScreen, &enable);
+    if (status != Success)
+        return status;
+
+    rep.status = enable;
+    (void) stuff;
+    if (client->swapped) {
+        swaps(&rep.status);
+        swaps(&rep.sequenceNumber);
+        swapl(&rep.length);
+    }
+
+    WriteToClient(client, sizeof (rep), &rep);
+
+    return Success;
+}
+
+static int
+proc_hwa_cursor_rotate(ClientPtr client)
+{
+    REQUEST(xHWACursorRotateReq);
+    xHWACursorRotateReply rep = {
+            .type = X_Reply,
+            .sequenceNumber = client->sequence,
+            .length = 0,
+            .status = 0,
+            .degree = 0
+        };
+
+    int status,i;
+    ScreenPtr pScreen = NULL;
+    CARD16 degree = stuff->degree;
+
+    RRCrtc crtc_id = stuff->crtc_id;
+
+    REQUEST_SIZE_MATCH(xHWACursorRotateReq);
+
+    for (i = 0; i < screenInfo.numScreens; i++) {
+        pScreen = screenInfo.screens[i];
+    }
+
+
+    if(!pScreen)
+        return FALSE;
+    status = hwa_CursorRotate( pScreen, crtc_id, &degree);
+    if (status != Success)
+        return status;
+
+
+    rep.status = (CARD16)status;
+    rep.degree = (CARD16)degree;
+
+    if (client->swapped) {
+        swaps(&rep.status);
+        swaps(&rep.degree);
+        swaps(&rep.sequenceNumber);
+        swapl(&rep.length);
+    }
+
+    WriteToClient(client, sizeof (rep), &rep);
+
+    return Success;
+}
+
+static int
+proc_hwa_screen_invert_negative( ClientPtr client )
+{
+    RRCrtcPtr target_crtc = NULL;
+
+    int accessibility_status = 0;
+    int status = 0;
+
+    REQUEST(xHWAScreenInvertNegativeReq);
+    xHWAScreenInvertNegativeReply rep = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .status = 0,
+    };
+
+    REQUEST_SIZE_MATCH(xHWAScreenInvertNegativeReq);
+
+    if( stuff->enable )
+        accessibility_status = ENABLE;
+    else
+        accessibility_status = DISABLE;
+
+
+    VERIFY_CRTC_OR_NONE(target_crtc, stuff->crtc_id, client, DixReadAccess);
+
+    status = hwa_screen_invert_negative( target_crtc, accessibility_status );
+    if( status != Success )
+       return BadRequest;
+
+    if (client->swapped) {
+        swaps(&rep.sequenceNumber);
+        swapl(&rep.length);
+    }
+
+    if( accessibility_status )
+        rep.status = IS_ON;
+    else
+        rep.status = IS_OFF;
+
+
+    WriteToClient(client, sizeof(rep), &rep);
+    return Success;
+}
+
+static int
+proc_hwa_screen_scale( ClientPtr client )
+{
+    RRCrtcPtr target_crtc = NULL;
+
+    int scale_status = 0;
+    int status = 0;
+
+    REQUEST(xHWAScreenScaleReq);
+    xHWAScreenScaleReply rep = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .status = 0,
+    };
+
+    REQUEST_SIZE_MATCH(xHWAScreenScaleReq);
+
+    if( stuff->enable )
+       scale_status = ENABLE;
+    else
+       scale_status = DISABLE;
+
+    VERIFY_CRTC_OR_NONE(target_crtc, stuff->crtc_id, client, DixReadAccess);
+
+    status = hwa_screen_scale( target_crtc,
+                               scale_status,
+                               stuff->x,
+                               stuff->y,
+                               stuff->w,
+                               stuff->h);
+    if( status != Success )
+       return BadRequest;
+
+    if (client->swapped) {
+        swaps(&rep.sequenceNumber);
+        swapl(&rep.length);
+    }
+
+    if( scale_status )
+        rep.status = IS_ON;
+    else
+        rep.status = IS_OFF;
+
+    WriteToClient(client, sizeof(rep), &rep);
+    return Success;
+}
+
+static int
+proc_hwa_show_layer(ClientPtr client)
+{
+    REQUEST(xHWAShowLayerReq);
+
+    int status,i;
+    ScreenPtr pScreen = NULL;
+    CARD16 ovrlayer = stuff->ovrlayer;
+
+    RRCrtc crtc_id = stuff->crtc_id;
+
+    REQUEST_SIZE_MATCH(xHWAShowLayerReq);
+
+    for (i = 0; i < screenInfo.numScreens; i++) {
+        pScreen = screenInfo.screens[i];
+    }
+
+    if(!pScreen)
+        return FALSE;
+
+    status = hwa_ShowLayer( pScreen, crtc_id, ovrlayer );
+    if (status != Success)
+        return status;
+
+    return Success;
+}
+
+static int
+proc_hwa_hide_layer(ClientPtr client)
+{
+    REQUEST(xHWAHideLayerReq);
+
+    int status,i;
+    ScreenPtr pScreen = NULL;
+    CARD16 ovrlayer = stuff->ovrlayer;
+
+    RRCrtc crtc_id = stuff->crtc_id;
+
+    REQUEST_SIZE_MATCH(xHWAHideLayerReq);
+
+    for (i = 0; i < screenInfo.numScreens; i++) {
+        pScreen = screenInfo.screens[i];
+    }
+
+
+    if(!pScreen)
+        return FALSE;
+
+    status = hwa_HideLayer( pScreen, crtc_id, ovrlayer );
+    if (status != Success)
+        return status;
+
+    return Success;
+}
+
+/*
+ *  proc_hwa_vector stores Main request handlers
+ */
+int
+(*proc_hwa_vector[HWANumberRequests]) (ClientPtr) = {
+    proc_hwa_query_version,             /* 0 */
+    proc_hwa_cursor_enable,             /* 1 */
+    proc_hwa_cursor_rotate,             /* 2 */
+    proc_hwa_screen_invert_negative,    /* 3 */
+    proc_hwa_screen_scale,              /* 4 */
+    proc_hwa_show_layer,                /* 5 */
+    proc_hwa_hide_layer,                /* 6 */
+};
+
+/*
+ * MainProc function ( See AddExtension functions )
+ *
+ * It is used to initialize the hwa extension's main request handlers
+ */
+int
+proc_hwa_dispatch(ClientPtr client)
+{
+    REQUEST(xReq);
+    if (stuff->data >= HWANumberRequests || !proc_hwa_vector[stuff->data])
+        return BadRequest;
+    return (*proc_hwa_vector[stuff->data]) (client);
+}
+
+/* ------------------------------- End Proc ------------------------------------ */
+
+
+
+/* -------------------------------- SProc -------------------------------------- */
+
+/*
+ *  Auxiliary query version request:
+ *
+ *    This function prepares some request data and then call
+ *    the Main query version request
+ */
+static int
+sproc_hwa_query_version(ClientPtr client)
+{
+    REQUEST( xHWAQueryVersionReq );
+
+    swaps(&stuff->length);
+    swapl(&stuff->majorVersion);
+    swapl(&stuff->minorVersion);
+    return (*proc_hwa_vector[stuff->hwaReqType]) (client);
+}
+
+static int sproc_hwa_cursor_enable(ClientPtr client)
+{
+    REQUEST( xHWACursorEnableReq );
+
+    swaps(&stuff->length);
+    return (*proc_hwa_vector[stuff->hwaReqType]) (client);
+}
+
+static int sproc_hwa_cursor_rotate(ClientPtr client)
+{
+    REQUEST( xHWACursorRotateReq );
+
+    swaps(&stuff->length);
+    swapl(&stuff->crtc_id);
+    swaps(&stuff->degree);
+    return (*proc_hwa_vector[stuff->hwaReqType]) (client);
+}
+
+static int
+sproc_hwa_screen_invert_negative(ClientPtr client)
+{
+    REQUEST( xHWAScreenInvertNegativeReq );
+
+    swaps(&stuff->length);
+    swapl(&stuff->crtc_id);
+
+    return (*proc_hwa_vector[stuff->hwaReqType]) (client);
+}
+
+static int
+sproc_hwa_screen_scale(ClientPtr client)
+{
+    REQUEST( xHWAScreenScaleReq );
+
+    swaps(&stuff->length);
+    swapl(&stuff->crtc_id);
+    swapl(&stuff->x);
+    swapl(&stuff->y);
+    swapl(&stuff->w);
+    swapl(&stuff->h);
+
+    return (*proc_hwa_vector[stuff->hwaReqType]) (client);
+}
+
+static int sproc_hwa_show_layer(ClientPtr client)
+{
+    REQUEST( xHWAShowLayerReq );
+
+    swaps(&stuff->length);
+    swapl(&stuff->crtc_id);
+    swaps(&stuff->ovrlayer);
+    return (*proc_hwa_vector[stuff->hwaReqType]) (client);
+}
+
+static int sproc_hwa_hide_layer(ClientPtr client)
+{
+    REQUEST( xHWAHideLayerReq );
+
+    swaps(&stuff->length);
+    swapl(&stuff->crtc_id);
+    swaps(&stuff->ovrlayer);
+    return (*proc_hwa_vector[stuff->hwaReqType]) (client);
+}
+
+/*
+ *  sproc_hwa_vector stores Auxiliary request handlers
+ */
+int (*sproc_hwa_vector[HWANumberRequests]) (ClientPtr) = {
+    sproc_hwa_query_version,           /* 0 */
+    sproc_hwa_cursor_enable,           /* 1 */
+    sproc_hwa_cursor_rotate,           /* 2 */
+    sproc_hwa_screen_invert_negative,  /* 3 */
+    sproc_hwa_screen_scale,            /* 4 */
+    sproc_hwa_show_layer,              /* 5 */
+    sproc_hwa_hide_layer,              /* 6 */
+};
+
+
+/*
+ * SwappedMainProc function ( See AddExtension functions )
+ *
+ * It is used to initialize the hwa extension's auxiliary request handlers
+ */
+int
+sproc_hwa_dispatch(ClientPtr client)
+{
+    REQUEST(xReq);
+    if (stuff->data >= HWANumberRequests || !sproc_hwa_vector[stuff->data])
+        return BadRequest;
+    return (*sproc_hwa_vector[stuff->data]) (client);
+}
+
+/* ------------------------------- End Proc ------------------------------------ */
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/hwa/hwa_screen.c b/hwa/hwa_screen.c
new file mode 100644 (file)
index 0000000..89830ee
--- /dev/null
@@ -0,0 +1,153 @@
+/*
+ * Copyright Â© 2013 SAMSUNG
+ *
+ * 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 the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  The copyright holders make no representations
+ * about the suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS 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.
+ *
+ * Author: Sangjin Lee <lsj119@samsung.com>
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "hwa_priv.h"
+#include <syncsdk.h>
+#include <misync.h>
+#include <misyncshm.h>
+#include <randrstr.h>
+#include "hwa.h"
+
+int
+hwa_CursorEnable( ScreenPtr screen,  CARD16 *penable)
+{
+    hwa_screen_priv_ptr        ds = hwa_screen_priv(screen);
+    hwa_screen_info_ptr        info = ds->info;
+    int                        rc;
+  
+    if (!info)
+        return BadMatch;
+
+    rc = (*info->cursor_enable)(screen, penable);
+    if (rc != Success)
+        return rc;
+
+    return Success;
+}
+
+int
+hwa_CursorRotate( ScreenPtr screen, RRCrtc crtc_id, CARD16 *pdegree)
+{
+    hwa_screen_priv_ptr        ds = hwa_screen_priv(screen);
+    hwa_screen_info_ptr        info = ds->info;
+    int                        rc;
+   
+    if (!info)
+        return BadMatch;
+
+    rc = (*info->cursor_rotate)(screen, crtc_id, pdegree);
+    if (rc != Success)
+        return rc;
+
+    return Success;
+}
+
+int
+hwa_screen_invert_negative(RRCrtcPtr target_crtc, int accessibility_status)
+{
+    hwa_screen_priv_ptr ds = NULL;
+    hwa_screen_info_ptr info = NULL;
+    ScreenPtr pScreen = NULL;
+    int rc;
+
+    if (!target_crtc)
+        return BadValue;
+
+    pScreen = target_crtc->pScreen;
+    ds = hwa_screen_priv( pScreen );
+    info = ds->info;
+
+    if (!info)
+        return BadAlloc;
+
+    rc = info->screen_invert_negative( pScreen, accessibility_status );
+    if( rc != Success )
+        return rc;
+
+    return Success;
+}
+
+
+int
+hwa_screen_scale(RRCrtcPtr target_crtc, int scale_status, int x, int y, int w, int h)
+{
+    hwa_screen_priv_ptr ds = NULL;
+    hwa_screen_info_ptr info = NULL;
+    ScreenPtr pScreen = NULL;
+    int rc;
+
+    if (!target_crtc)
+        return BadValue;
+
+    pScreen = target_crtc->pScreen;
+    ds = hwa_screen_priv( pScreen );
+    info = ds->info;
+
+    if (!info)
+        return BadAlloc;
+
+    rc = info->screen_scale( pScreen, scale_status, x, y, w, h );
+    if( rc != Success )
+        return rc;
+
+    return Success;
+}
+
+int
+hwa_ShowLayer( ScreenPtr screen, RRCrtc crtc_id, HWA_OVERLAY_LAYER ovrlayer)
+{
+    hwa_screen_priv_ptr        ds = hwa_screen_priv(screen);
+    hwa_screen_info_ptr        info = ds->info;
+    int                        rc;
+
+    if (!info)
+        return BadMatch;
+
+    rc = (*info->show_layer)(screen, crtc_id, ovrlayer);
+    if (rc != Success)
+        return rc;
+
+    return Success;
+}
+
+int
+hwa_HideLayer( ScreenPtr screen, RRCrtc crtc_id, HWA_OVERLAY_LAYER ovrlayer)
+{
+    hwa_screen_priv_ptr        ds = hwa_screen_priv(screen);
+    hwa_screen_info_ptr        info = ds->info;
+    int                        rc;
+
+    if (!info)
+        return BadMatch;
+
+    rc = (*info->hide_layer)(screen, crtc_id, ovrlayer);
+    if (rc != Success)
+        return rc;
+
+    return Success;
+}
index fdaeb5c..22b79b8 100644 (file)
@@ -1,14 +1,14 @@
 noinst_LTLIBRARIES = libhwc.la
-AM_CFLAGS = \
-       -DHAVE_XORG_CONFIG_H \
-       @DIX_CFLAGS@ @XORG_CFLAGS@
+
+AM_CFLAGS = $(DIX_CFLAGS)
+
+sdk_HEADERS = hwc.h
 
 libhwc_la_SOURCES = \
+       hwc.c \
        hwc.h \
        hwc_priv.h \
-       hwc.c \
        hwc_request.c \
        hwc_event.c \
-       hwc_screen.c
-
-sdk_HEADERS = hwc.h
+       hwc_screen.c \
+       hwc_storage.c
old mode 100755 (executable)
new mode 100644 (file)
index 6ba616c..82433dc
--- a/hwc/hwc.c
+++ b/hwc/hwc.c
@@ -137,6 +137,10 @@ hwc_destroy_window (WindowPtr pWin)
 
     hwc_free_events(pWin);
 
+#if defined (_F_PRESENT_HWC_FLIP_) && defined (_F_PRESENT_SCANOUT_NOTIFY_)
+    hwc_storage_remove_drawables (drawable);
+#endif
+
     unwrap(screen_priv, screen, DestroyWindow);
     ret = (*screen->DestroyWindow) (pWin);
     wrap(screen_priv, screen, DestroyWindow, hwc_destroy_window);
old mode 100755 (executable)
new mode 100644 (file)
index e54d6dd..bb1e383
--- a/hwc/hwc.h
+++ b/hwc/hwc.h
 #define _HWC_H_
 
 #include <X11/extensions/hwcproto.h>
+#include "randrstr.h"
 
 #define HWC_SCREEN_INFO_VERSION        0
 
 typedef int (*hwc_open_proc)(ScreenPtr screen, int *maxLayer);
+typedef int (*hwc_open_2_proc)(ScreenPtr screen, RRCrtcPtr crtc, int *maxLayer);
 
 typedef int (*hwc_set_drawables_proc) (ScreenPtr screen,
                                                DrawablePtr *drawables,
@@ -37,6 +39,14 @@ typedef int (*hwc_set_drawables_proc) (ScreenPtr screen,
                                                xRectangle *pDstRects,
                                                int count);
 
+typedef int (*hwc_set_drawables_2_proc) (ScreenPtr screen,
+                                               RRCrtcPtr crtc,
+                                               DrawablePtr *drawables,
+                                               xRectangle *pSrcRects,
+                                               xRectangle *pDstRects,
+                                               HWCCompositeMethod *copmMethods,
+                                               int count);
+
 typedef int (*hwc_update_drawable) (ScreenPtr screen,
                                                 DrawablePtr drawable,
                                                 int x,
@@ -68,6 +78,11 @@ typedef struct hwc_screen_info {
     hwc_update_drawable     update_drawable;
     hwc_move_drawable       move_drawable;
     hwc_resize_drawable       resize_drawable;
+
+    /*V2.0*/
+    hwc_open_2_proc         open2;
+    hwc_set_drawables_2_proc set_drawables2;
+
 } hwc_screen_info_rec, *hwc_screen_info_ptr;
 
 extern _X_EXPORT Bool
@@ -76,10 +91,16 @@ hwc_screen_init(ScreenPtr screen, hwc_screen_info_ptr info);
 extern _X_EXPORT void
 hwc_send_config_notify(ScreenPtr screen, int maxLayer);
 
+extern _X_EXPORT void
+hwc_send_config_notify2(ScreenPtr screen, RRCrtcPtr crtc, int maxLayer);
+
 int
-hwc_open(ClientPtr client, ScreenPtr screen, int *maxLayer);
+hwc_open(ClientPtr client, ScreenPtr screen, RRCrtcPtr crtc, int *maxLayer);
 
 int
-hwc_set_drawables(ClientPtr client, ScreenPtr screen, XID* drawables, xRectangle *srcRects, xRectangle *dstRects, int count);
+hwc_set_drawables(ClientPtr client, ScreenPtr screen, RRCrtcPtr crtc,  XID* drawables, xRectangle *srcRects, xRectangle *dstRects, HWCCompositeMethod *copmMethods, int count);
+
+/* Check does given window (drawable) belong to HWC windows*/
+int hwc_validate_window(WindowPtr window);
 
 #endif /* _HWC_H_ */
old mode 100755 (executable)
new mode 100644 (file)
index 9f4ccdf..4536027
@@ -33,7 +33,7 @@ hwc_free_events(WindowPtr window)
 {
     hwc_screen_priv_ptr screen_priv = hwc_screen_priv(window->drawable.pScreen);
     hwc_event_ptr *previous, current=NULL;
-    
+
     if (!screen_priv)
         return;
 
@@ -45,7 +45,7 @@ hwc_free_events(WindowPtr window)
     }
 
     if(current)
-        free((pointer) current);
+        free((void *) current);
 }
 
 static void
@@ -68,8 +68,15 @@ hwc_event_swap(xGenericEvent *from, xGenericEvent *to)
 void
 hwc_send_config_notify(ScreenPtr screen, int maxLayer)
 {
+    hwc_send_config_notify2(screen, NULL, maxLayer);
+}
+
+void
+hwc_send_config_notify2(ScreenPtr screen, RRCrtcPtr crtc, int maxLayer)
+{
     hwc_screen_priv_ptr screen_priv = hwc_screen_priv(screen);
 
+    CARD32 crtc_id = crtc ? crtc->id : 0;
     if (screen_priv) {
         xHWCConfigureNotify cn = {
             .type = GenericEvent,
@@ -77,6 +84,7 @@ hwc_send_config_notify(ScreenPtr screen, int maxLayer)
             .length = (sizeof(xHWCConfigureNotify) - 32) >> 2,
             .evtype = HWCConfigureNotify,
             .maxLayer = maxLayer,
+            .crtc = crtc_id,
         };
         hwc_event_ptr event;
 
old mode 100755 (executable)
new mode 100644 (file)
index 0eb547e..1420520
@@ -25,6 +25,7 @@
 #ifndef _HWCPRIV_H_
 #define _HWCPRIV_H_
 
+#define HAVE_STRNDUP
 #include <X11/X.h>
 #include "scrnintstr.h"
 #include "misc.h"
@@ -35,6 +36,9 @@
 
 extern int hwc_request;
 
+#define STORAGE_SIZE 10
+#define STORAGE_EMPTY 0
+
 /*
  * Each screen has a list of clients and event masks
  */
@@ -61,6 +65,13 @@ typedef struct hwc_screen_priv {
     hwc_event_ptr events;
 } hwc_screen_priv_rec, *hwc_screen_priv_ptr;
 
+#ifdef _F_PRESENT_HWC_FLIP_
+typedef struct storage_of_drawables {
+    DrawablePtr drawables[STORAGE_SIZE];
+    unsigned int count;
+} storage_of_drawables_rec, *storage_of_drawables_ptr;
+#endif
+
 #define wrap(priv,real,mem,func) {\
     priv->mem = real->mem; \
     real->mem = func; \
@@ -90,6 +101,23 @@ hwc_free_events(WindowPtr window);
 
 int
 hwc_select_input(ClientPtr client, ScreenPtr screen, WindowPtr window, CARD32 mask);
-/* DDX interface */
+
+#ifdef _F_PRESENT_HWC_FLIP_
+/* Management ofStorage of drawables */
+void
+hwc_storage_add_drawables( DrawablePtr *drawable, int indx );
+
+void
+hwc_storage_clear( void );
+
+int
+hwc_storage_is_empty( void );
+
+#ifdef _F_PRESENT_SCANOUT_NOTIFY_
+void
+hwc_storage_remove_drawables (DrawablePtr drawable);
+#endif
+
+#endif
 
 #endif /* _HWCPRIV_H_ */
old mode 100755 (executable)
new mode 100644 (file)
index b553cf8..f52bb30
 #include <syncsrv.h>
 #include <unistd.h>
 #include <xace.h>
+#include "randrstr.h"
+
+#define VERIFY_CRTC_OR_NONE(crtc_ptr, crtc_id, client, access) do {     \
+        if ((crtc_id) == None)                                          \
+            (crtc_ptr) = NULL;                                          \
+        else {                                                          \
+            VERIFY_RR_CRTC(crtc_id, crtc_ptr, access);                  \
+        }                                                               \
+    } while (0)
 
 static int
 proc_hwc_query_version(ClientPtr client)
@@ -52,6 +61,7 @@ proc_hwc_query_version(ClientPtr client)
         swapl(&rep.majorVersion);
         swapl(&rep.minorVersion);
     }
+
     WriteToClient(client, sizeof(rep), &rep);
     return Success;
 }
@@ -67,19 +77,21 @@ proc_hwc_open(ClientPtr client)
         .maxLayer = 0
     };
     WindowPtr window;
+    RRCrtcPtr crtc;
     ScreenPtr screen;
     int maxLayer = 0;
     int status;
 
     REQUEST_SIZE_MATCH(xHWCOpenReq);
 
-    status = dixLookupWindow(&window, stuff->window, client, DixReadAccess);
-    if (status != Success)
-        return status;
+    VERIFY_CRTC_OR_NONE(crtc, stuff->crtc, client, DixReadAccess);
 
-    screen = window->drawable.pScreen;
+    if (crtc != 0)
+        screen = crtc->pScreen;
+    else
+        screen = screenInfo.screens[0];     //get default screen
 
-    status = hwc_open(client, screen, &maxLayer);
+    status = hwc_open(client, screen, crtc, &maxLayer);
     if (status != Success)
         return status;
 
@@ -100,25 +112,48 @@ proc_hwc_set_drawables(ClientPtr client)
     REQUEST(xHWCSetDrawablesReq);
     WindowPtr window;
     ScreenPtr screen;
+    RRCrtcPtr crtc;
     int status;
     int i;
     xHWCDrawInfo *drawInfo;
     XID *drawables;
-    xRectangle *srcRects;
-    xRectangle *dstRects;
+    xRectangle *srcRects = NULL;
+    xRectangle *dstRects = NULL;
+    HWCCompositeMethod *compMeth = NULL;
 
-    REQUEST_FIXED_SIZE(xHWCSetDrawablesReq, stuff->count * 20);
+    REQUEST_FIXED_SIZE(xHWCSetDrawablesReq, stuff->count * sz_xHWCDrawInfo);
 
-    status  = dixLookupWindow(&window, stuff->window, client, DixReadAccess);
-    if (status != Success)
-        return status;
+    VERIFY_CRTC_OR_NONE(crtc, stuff->crtc, client, DixReadAccess);
 
-    screen = window->drawable.pScreen;
+    if (crtc != 0)
+        screen = crtc->pScreen;
+    else
+        screen = screenInfo.screens[0];     //get default screen
 
     drawables = (XID *)calloc(1, sizeof(XID) * stuff->count);
+    if (!drawables)
+    {
+        ErrorF("drawables calloc fail\n");
+        goto fail;
+    }
     srcRects = (xRectangle *)calloc(1, sizeof(xRectangle) * stuff->count);
+    if (!srcRects)
+    {
+        ErrorF("srcRects calloc fail\n");
+        goto fail;
+    }
     dstRects = (xRectangle *)calloc(1, sizeof(xRectangle) * stuff->count);
-    //drawables = (XID*) &stuff[1];
+    if (!dstRects)
+    {
+        ErrorF("dstRects calloc fail\n");
+        goto fail;
+    }
+    compMeth = (xRectangle *)calloc(1, sizeof(HWCCompositeMethod) * stuff->count);
+    if (!compMeth)
+    {
+        ErrorF("compMeth calloc fail\n");
+        goto fail;
+    }
     drawInfo = (xHWCDrawInfo *) &stuff[1];
     for(i=0; i<stuff->count ; i++)
     {
@@ -131,18 +166,30 @@ proc_hwc_set_drawables(ClientPtr client)
         dstRects[i].y = drawInfo[i].dstY;
         dstRects[i].width = drawInfo[i].dstWidth;
         dstRects[i].height = drawInfo[i].dstHeight;
-        ErrorF("srcRects[%d] - drawable(%d) src_rect(%d,%d,%d,%d) dst_rect(%d,%d,%d,%d)  count(%d)\n",
-                i,drawInfo[i].drawable,srcRects[i].x, srcRects[i].y, srcRects[i].width, srcRects[i].height,
+        compMeth[i] = drawInfo[i].compMethod;
+        ErrorF("crtc(%d) srcRects[%d] - drawable(%d) src_rect(%d,%d,%d,%d) dst_rect(%d,%d,%d,%d) copm(%d) count(%d)\n",
+                stuff->crtc, i,drawInfo[i].drawable,srcRects[i].x, srcRects[i].y, srcRects[i].width, srcRects[i].height,
                  dstRects[i].x, dstRects[i].y, dstRects[i].width, dstRects[i].height, stuff->count);
     }
 
-    status = hwc_set_drawables(client, screen, drawables, srcRects, dstRects, stuff->count);
+    status = hwc_set_drawables(client, screen, crtc, drawables, srcRects, dstRects, compMeth, stuff->count);
 
     free(drawables);
     free(srcRects);
     free(dstRects);
+    free(compMeth);
 
     return status;
+
+fail:
+    if (drawables)
+        free(drawables);
+    if (srcRects)
+        free(srcRects);
+    if (dstRects)
+        free(dstRects);
+
+    return BadAlloc;
 }
 
 static int
@@ -172,7 +219,7 @@ proc_hwc_select_input (ClientPtr client)
 int (*proc_hwc_vector[HWCNumberRequests]) (ClientPtr) = {
     proc_hwc_query_version,            /* 0 */
     proc_hwc_open,                     /* 1 */
-    proc_hwc_set_drawables,       /* 2 */
+    proc_hwc_set_drawables,            /* 2 */
     proc_hwc_select_input,              /*3*/
 };
 
@@ -203,6 +250,7 @@ sproc_hwc_open(ClientPtr client)
 
     swaps(&stuff->length);
     swapl(&stuff->window);
+    swapl(&stuff->crtc);
     return (*proc_hwc_vector[stuff->hwcReqType]) (client);
 }
 
@@ -213,6 +261,7 @@ sproc_hwc_set_drawables(ClientPtr client)
 
     swaps(&stuff->length);
     swapl(&stuff->window);
+    swapl(&stuff->crtc);
     swapl(&stuff->count);
     return (*proc_hwc_vector[stuff->hwcReqType]) (client);
 }
index c048eb4..5a189a6 100644 (file)
 #include "hwc_priv.h"
 
 int
-hwc_open(ClientPtr client, ScreenPtr screen, int *maxLayer)
+hwc_open(ClientPtr client, ScreenPtr screen, RRCrtcPtr crtc, int *maxLayer)
 {
     hwc_screen_priv_ptr        ds = hwc_screen_priv(screen);
     hwc_screen_info_ptr        info = ds->info;
     int                         rc;
 
-    if (!info || !info->open)
+    if (!info || !(info->open || info->open2))
         return BadMatch;
 
-    rc = (*info->open) (screen, maxLayer);
+    if(info->open2)
+        rc = (*info->open2) (screen, crtc, maxLayer);
+    else
+        rc = (*info->open) (screen, maxLayer);
     if (rc != Success)
         return rc;
 
@@ -46,18 +49,15 @@ hwc_open(ClientPtr client, ScreenPtr screen, int *maxLayer)
 }
 
 int
-hwc_set_drawables(ClientPtr client, ScreenPtr screen, XID* ids, xRectangle *srcRects, xRectangle *dstRects, int count)
+hwc_set_drawables(ClientPtr client, ScreenPtr screen, RRCrtcPtr crtc, XID* ids, xRectangle *srcRects, xRectangle *dstRects, HWCCompositeMethod *copmMethods, int count)
 {
     hwc_screen_priv_ptr        ds = hwc_screen_priv(screen);
     hwc_screen_info_ptr        info = ds->info;
-    int                         rc;
+    int                        rc = BadMatch;
     int i;
     DrawablePtr *drawables;
 
-    if (!info || !info->open)
-        return BadMatch;
-
-    if (count > info->maxLayer)
+    if (!info || !(info->open || info->open2))
         return BadMatch;
 
     drawables = (DrawablePtr *)malloc(sizeof(DrawablePtr)*count);
@@ -66,7 +66,7 @@ hwc_set_drawables(ClientPtr client, ScreenPtr screen, XID* ids, xRectangle *srcR
         rc  = dixLookupDrawable(drawables+i, ids[i], client, 0, DixReadAccess);
         if (rc != Success)
         {
-            free (drawables);
+            free(drawables);
             return rc;
         }
     }
@@ -81,13 +81,37 @@ hwc_set_drawables(ClientPtr client, ScreenPtr screen, XID* ids, xRectangle *srcR
     }
 #endif
 
-    rc = (*info->set_drawables)(screen, drawables, srcRects, dstRects, count);
+    if (info->set_drawables2)
+        rc = (*info->set_drawables2) (screen, crtc, drawables, srcRects, dstRects, copmMethods, count);
+    else if (info->set_drawables)
+        rc = (*info->set_drawables) (screen, drawables, srcRects, dstRects, count);
+
     if (rc != Success)
     {
-        free (drawables);
+        free(drawables);
         return rc;
     }
 
+#ifdef _F_PRESENT_HWC_FLIP_
+    /*
+     * On this step we want to know which drawables (windows) are owned
+     * by HWC extension so we store them in the storage. It is done for
+     * HWC and DRI3 cowork
+     */
+
+    /*
+     * Clear previously stored drawables(windows)
+     */
+    hwc_storage_clear();
+
+    /*
+     * Store new drawables(windows) to the storage
+     */
+    hwc_storage_add_drawables(drawables, count);
+#endif
+
+    free(drawables);
+
     return Success;
 }
 
diff --git a/hwc/hwc_storage.c b/hwc/hwc_storage.c
new file mode 100644 (file)
index 0000000..85569f2
--- /dev/null
@@ -0,0 +1,149 @@
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "hwc_priv.h"
+
+#ifdef _F_PRESENT_SCANOUT_NOTIFY_
+#include "present.h"
+#endif //_F_PRESENT_SCANOUT_NOTIFY_
+
+/*
+ *  Storage of drawables(windows) which was sent to HWC
+ */
+storage_of_drawables_rec hwc_storage_of_drawables;
+#ifdef _F_PRESENT_SCANOUT_NOTIFY_
+storage_of_drawables_rec hwc_previous_storage_of_drawables;
+#endif //_F_PRESENT_SCANOUT_NOTIFY_
+
+void
+hwc_storage_clear( void )
+{
+    int i = 0;
+
+    if( STORAGE_EMPTY == hwc_storage_of_drawables.count )
+        return;
+
+    /*
+     * The storage does not do memory management so just initialize with NULL
+     */
+
+#ifdef _F_PRESENT_SCANOUT_NOTIFY_
+    for( i = 0; i < STORAGE_SIZE; i++)
+        hwc_previous_storage_of_drawables.drawables[i] = NULL;
+
+    hwc_previous_storage_of_drawables.count = hwc_storage_of_drawables.count;
+#endif //_F_PRESENT_SCANOUT_NOTIFY_
+
+    for( i = 0; i < STORAGE_SIZE; i++)
+    {
+#ifdef _F_PRESENT_SCANOUT_NOTIFY_
+        hwc_previous_storage_of_drawables.drawables[i] = hwc_storage_of_drawables.drawables[i];
+#endif //_F_PRESENT_SCANOUT_NOTIFY_
+
+        hwc_storage_of_drawables.drawables[i] = NULL;
+    }
+
+    hwc_storage_of_drawables.count = STORAGE_EMPTY;
+}
+
+#ifdef _F_PRESENT_SCANOUT_NOTIFY_
+void
+hwc_storage_remove_drawables (DrawablePtr drawable)
+{
+    int i = 0;
+
+    if( STORAGE_EMPTY == hwc_storage_of_drawables.count)
+        return;
+
+    for( i = 0; i < hwc_storage_of_drawables.count; i++)
+    {
+        if (hwc_storage_of_drawables.drawables[i] == drawable)
+            hwc_storage_of_drawables.drawables[i] = NULL;
+    }
+}
+#endif //_F_PRESENT_SCANOUT_NOTIFY_
+
+void
+hwc_storage_add_drawables( DrawablePtr *drawables, int count )
+{
+    int i = 0;
+    int j = 0;
+
+#ifdef _F_PRESENT_SCANOUT_NOTIFY_
+    for ( i = 0; i < hwc_previous_storage_of_drawables.count; i++)
+    {
+        if (hwc_previous_storage_of_drawables.drawables[i])
+        {
+            for ( j = 0; j < count; j++)
+            {
+                if (hwc_previous_storage_of_drawables.drawables[i] == drawables[j])
+                    break;
+            }
+
+            if (j == count)
+            {
+                if (hwc_previous_storage_of_drawables.drawables[i]->type == DRAWABLE_WINDOW)
+                    present_send_scanout_notify ((WindowPtr)hwc_previous_storage_of_drawables.drawables[i], 0);
+            }
+        }
+    }
+#endif //_F_PRESENT_SCANOUT_NOTIFY_
+
+    for( i = 0; i < count; i++)
+    {
+        hwc_storage_of_drawables.drawables[i] = drawables[i];
+
+#ifdef _F_PRESENT_SCANOUT_NOTIFY_
+        for ( j = 0; j < hwc_previous_storage_of_drawables.count; j++)
+        {
+            if (hwc_previous_storage_of_drawables.drawables[j] == drawables[i])
+                break;
+        }
+
+        if (j == hwc_previous_storage_of_drawables.count)
+        {
+            if (hwc_storage_of_drawables.drawables[i]->type == DRAWABLE_WINDOW)
+                present_send_scanout_notify ((WindowPtr)hwc_storage_of_drawables.drawables[i], 1);
+        }
+#endif //_F_PRESENT_SCANOUT_NOTIFY_
+    }
+
+    hwc_storage_of_drawables.count = count;
+}
+
+int
+hwc_storage_is_empty( void )
+{
+    if( STORAGE_EMPTY == hwc_storage_of_drawables.count )
+        return TRUE;
+    return FALSE;
+}
+
+
+int hwc_validate_window(WindowPtr window)
+{
+    DrawablePtr drawable = NULL;
+    int check = FALSE;
+    int i = 0;
+
+    if(hwc_storage_is_empty())
+        return FALSE;
+
+    for( i = 0; i < hwc_storage_of_drawables.count; i++ )
+    {
+        drawable = hwc_storage_of_drawables.drawables[i];
+        if (drawable && DRAWABLE_WINDOW == drawable->type)
+            if ( window == (WindowPtr) drawable)
+            {
+                check = TRUE;
+                break;
+            }
+    }
+
+    if(!check)
+        return FALSE;
+
+    return TRUE;
+}
+
index 33116f2..6578038 100644 (file)
@@ -68,7 +68,9 @@ endif
 AM_CFLAGS = $(DIX_CFLAGS)
 
 EXTRA_DIST =   \
+       busfault.h dbus-core.h \
        dix-config-apple-verbatim.h \
-       eventconvert.h eventstr.h inpututils.h \
+       dixfontstubs.h eventconvert.h eventstr.h inpututils.h \
        protocol-versions.h \
+       systemd-logind.h \
        xsha1.h
diff --git a/include/busfault.h b/include/busfault.h
new file mode 100644 (file)
index 0000000..3b66881
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * Copyright Â© 2013 Keith Packard
+ *
+ * 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 the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  The copyright holders make no representations
+ * about the suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS 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.
+ */
+
+#ifndef _BUSFAULT_H_
+#define _BUSFAULT_H_
+
+#include <dix-config.h>
+
+#ifdef BUSFAULT
+
+#include <sys/types.h>
+
+typedef void (*busfault_notify_ptr) (void *context);
+
+struct busfault *
+busfault_register_mmap(void *addr, size_t size, busfault_notify_ptr notify, void *context);
+
+void
+busfault_unregister(struct busfault *busfault);
+
+void
+busfault_check(void);
+
+Bool
+busfault_init(void);
+
+#endif
+
+#endif /* _BUSFAULT_H_ */
index ed6b678..df638c0 100644 (file)
@@ -62,21 +62,21 @@ typedef struct _CallbackList *CallbackListPtr;  /* also in misc.h */
 #define _XTYPEDEF_CALLBACKLISTPTR
 #endif
 
-typedef void (*CallbackProcPtr) (CallbackListPtr *, pointer, pointer);
+typedef void (*CallbackProcPtr) (CallbackListPtr *, void *, void *);
 
 extern _X_EXPORT Bool AddCallback(CallbackListPtr * /*pcbl */ ,
                                   CallbackProcPtr /*callback */ ,
-                                  pointer /*data */ );
+                                  void */*data */ );
 
 extern _X_EXPORT Bool DeleteCallback(CallbackListPtr * /*pcbl */ ,
                                      CallbackProcPtr /*callback */ ,
-                                     pointer /*data */ );
+                                     void */*data */ );
 
 extern _X_EXPORT void _CallCallbacks(CallbackListPtr * /*pcbl */ ,
-                                     pointer /*call_data */ );
+                                     void */*call_data */ );
 
 static inline void
-CallCallbacks(CallbackListPtr *pcbl, pointer call_data)
+CallCallbacks(CallbackListPtr *pcbl, void *call_data)
 {
     if (!pcbl || !*pcbl)
         return;
@@ -86,5 +86,6 @@ CallCallbacks(CallbackListPtr *pcbl, pointer call_data)
 extern _X_EXPORT void DeleteCallbackList(CallbackListPtr * /*pcbl */ );
 
 extern _X_EXPORT void InitCallbackManager(void);
+extern _X_EXPORT void DeleteCallbackManager(void);
 
 #endif                          /* CALLBACK_H */
index c6aa129..60e6f09 100644 (file)
@@ -47,7 +47,7 @@ typedef struct _OFclosure {
     Mask flags;
 
 /* XXX -- get these from request buffer instead? */
-    char *origFontName;
+    const char *origFontName;
     int origFontNameLen;
     XID fontid;
     char *fontname;
@@ -64,7 +64,7 @@ typedef struct _LFWIstate {
     int current_fpe;
     int max_names;
     Bool list_started;
-    pointer private;
+    void *private;
 } LFWIstateRec, *LFWIstatePtr;
 
 typedef struct _LFWIclosure {
index 8996cfe..22229ca 100644 (file)
@@ -82,14 +82,14 @@ extern _X_EXPORT int CreateColormap(Colormap /*mid */ ,
                                     int /*alloc */ ,
                                     int /*client */ );
 
-extern _X_EXPORT int FreeColormap(pointer /*pmap */ ,
+extern _X_EXPORT int FreeColormap(void */*pmap */ ,
                                   XID /*mid */ );
 
 extern _X_EXPORT int TellLostMap(WindowPtr /*pwin */ ,
-                                 pointer /* Colormap *pmid */ );
+                                 void */* Colormap *pmid */ );
 
 extern _X_EXPORT int TellGainedMap(WindowPtr /*pwin */ ,
-                                   pointer /* Colormap *pmid */ );
+                                   void */* Colormap *pmid */ );
 
 extern _X_EXPORT int CopyColormapAndFree(Colormap /*mid */ ,
                                          ColormapPtr /*pSrc */ ,
@@ -126,7 +126,7 @@ extern _X_EXPORT int QueryColors(ColormapPtr /*pmap */ ,
                                  xrgb * /*prgbList */ ,
                                  ClientPtr client);
 
-extern _X_EXPORT int FreeClientPixels(pointer /*pcr */ ,
+extern _X_EXPORT int FreeClientPixels(void */*pcr */ ,
                                       XID /*fakeid */ );
 
 extern _X_EXPORT int AllocColorCells(int /*client */ ,
index 0823251..9da08af 100644 (file)
@@ -68,9 +68,13 @@ extern _X_EXPORT DevScreenPrivateKeyRec cursorScreenDevPriv;
 
 extern _X_EXPORT CursorPtr rootCursor;
 
-extern _X_EXPORT int FreeCursor(pointer /*pCurs */ ,
+extern _X_EXPORT int FreeCursor(void */*pCurs */ ,
                                 XID /*cid */ );
 
+extern _X_EXPORT CursorPtr RefCursor(CursorPtr /* cursor */);
+extern _X_EXPORT CursorPtr UnrefCursor(CursorPtr /* cursor */);
+extern _X_EXPORT int CursorRefCount(const CursorPtr /* cursor */);
+
 extern _X_EXPORT int AllocARGBCursor(unsigned char * /*psrcbits */ ,
                                      unsigned char * /*pmaskbits */ ,
                                      CARD32 * /*argb */ ,
index 68ab2ec..2157954 100644 (file)
@@ -78,10 +78,8 @@ typedef struct _Cursor {
     int refcnt;
     PrivateRec *devPrivates;    /* set by pScr->RealizeCursor */
     XID id;
-#ifdef XFIXES
     CARD32 serialNumber;
     Atom name;
-#endif
 } CursorRec;
 
 #define CURSOR_REC_SIZE (sizeof(CursorRec) + dixPrivatesSize(PRIVATE_CURSOR))
diff --git a/include/dbus-core.h b/include/dbus-core.h
new file mode 100644 (file)
index 0000000..b2d6d1b
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * Copyright Â© 2013 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * 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.
+ *
+ * Author: Hans de Goede <hdegoede@redhat.com>
+ */
+
+#ifndef DBUS_CORE_H
+#define DBUS_CORE_H
+
+#ifdef NEED_DBUS
+typedef struct DBusConnection DBusConnection;
+
+typedef void (*dbus_core_connect_hook) (DBusConnection * connection,
+                                               void *data);
+typedef void (*dbus_core_disconnect_hook) (void *data);
+
+struct dbus_core_hook {
+    dbus_core_connect_hook connect;
+    dbus_core_disconnect_hook disconnect;
+    void *data;
+
+    struct dbus_core_hook *next;
+};
+
+int dbus_core_init(void);
+void dbus_core_fini(void);
+int dbus_core_add_hook(struct dbus_core_hook *hook);
+void dbus_core_remove_hook(struct dbus_core_hook *hook);
+
+#else
+
+#define dbus_core_init()
+#define dbus_core_fini()
+
+#endif
+
+#endif
index 5b6d71f..a39f0d1 100644 (file)
@@ -27,6 +27,9 @@
 /* Support Composite Extension */
 #undef COMPOSITE
 
+/* Support Container Extension */
+#undef CONTAINER
+
 /* Support Damage extension */
 #undef DAMAGE
 
@@ -39,6 +42,9 @@
 /* Build DPMS extension */
 #undef DPMSExtension
 
+/* Build DRI3 extension */
+#undef DRI3
+
 /* Build GLX extension */
 #undef GLXEXT
 
 #undef HAVE_ASM_MTRR_H
 
 /* Has backtrace support */
+#if SUPPORT_BACKTRACE
 #undef HAVE_BACKTRACE
+#endif
+
+/* Has libunwind support */
+#undef HAVE_LIBUNWIND
 
 /* Define to 1 if you have the <byteswap.h> header file. */
 #undef HAVE_BYTESWAP_H
 /* Define to use libgcrypt SHA1 functions */
 #undef HAVE_SHA1_IN_LIBGCRYPT
 
+/* Define to use libnettle SHA1 functions */
+#undef HAVE_SHA1_IN_LIBNETTLE
+
 /* Define to use libsha1 for SHA1 */
 #undef HAVE_SHA1_IN_LIBSHA1
 
 /* Define to 1 if you have the `strndup' function. */
 #undef HAVE_STRNDUP
 
-/* Define if libsystemd-daemon is available */
+/* Define to 1 if libsystemd-daemon is available */
 #undef HAVE_SYSTEMD_DAEMON
 
 /* Define to 1 if SYSV IPC is available */
 /* Internal define for Xinerama */
 #undef PANORAMIX
 
+/* Support Present extension */
+#undef PRESENT
+
 /* Overall prefix */
 #undef PROJECTROOT
 
 /* Support SHAPE extension */
 #undef SHAPE
 
+/* Where to install Xorg.bin and Xorg.wrap */
+#undef SUID_WRAPPER_DIR
+
 /* Define to 1 on systems derived from System V Release 4 */
 #undef SVR4
 
+/* sysconfdir */
+#undef SYSCONFDIR
+
 /* Support TCP socket connections */
 #undef TCPCONN
 
 /* Build SELinux extension */
 #undef XSELINUX
 
-/* Build Smack extension */
-#undef XSMACK
-
 /* Support XCMisc extension */
 #undef XCMISC
 
 /* Use udev_enumerate_add_match_tag() */
 #undef HAVE_UDEV_ENUMERATE_ADD_MATCH_TAG
 
-/* Use D-Bus for input hotplug */
-#undef CONFIG_NEED_DBUS
-
-/* Support the D-Bus hotplug API */
-#undef CONFIG_DBUS_API
+/* Enable D-Bus core */
+#undef NEED_DBUS
 
 /* Support HAL for hotplug */
 #undef CONFIG_HAL
 
+/* Enable systemd-logind integration */
+#undef SYSTEMD_LOGIND 1
+
 /* Have a monotonic clock from clock_gettime() */
 #undef MONOTONIC_CLOCK
 
 /* Define to 1 if typeof works with your compiler. */
 #undef HAVE_TYPEOF
 
+/* Define to __typeof__ if your compiler spells it that way. */
+#undef typeof
+
 /* The compiler supported TLS storage class, prefering initial-exec if tls_model is supported */
 #undef TLS
 
 #include "dix-config-apple-verbatim.h"
 #endif
 
-/* Support HWC extension */
+/* Enable general extensions on Solaris.  */
+#ifndef __EXTENSIONS__
+# undef __EXTENSIONS__
+#endif
+
+/* Defined if needed to expose struct msghdr.msg_control */
+#undef _XOPEN_SOURCE
+
+/* Have support for X shared memory fence library (xshmfence) */
+#undef HAVE_XSHMFENCE
+
+/* Use XTrans FD passing support */
+#undef XTRANS_SEND_FDS
+
+/* Wrap SIGBUS to catch MIT-SHM faults */
+#undef BUSFAULT
+
+/* Directory for shared memory temp files */
+#undef SHMDIR
+
+/* Don't let Xdefs.h define 'pointer' */
+#define _XTYPEDEF_POINTER       1
+
+/* Don't let XIproto define 'Pointer' */
+#define _XITYPEDEF_POINTER      1
+
+/* Ask fontsproto to make font path element names const */
+#define FONT_PATH_ELEMENT_NAME_CONST    1
+
+/* Build GLAMOR */
+#undef GLAMOR
+
+/* Build glamor's GBM-based EGL support */
+#undef GLAMOR_HAS_GBM
+
+/* Enable ttrace for trace server's performance */
+#undef ENABLE_TTRACE
+
+/* Enable dlog */
+#undef ENABLE_DLOG
+
+/* Enable Smack utility*/
+#undef SMACK_UTIL
+
+/* Enable HWC*/
 #undef HWC
 
+/* Enable HWA*/
+#undef HWA
 #endif /* _DIX_CONFIG_H_ */
old mode 100644 (file)
new mode 100755 (executable)
index 74123b5..ecd8a98
@@ -26,13 +26,13 @@ Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
 
                         All Rights Reserved
 
-Permission to use, copy, modify, and distribute this software and its 
-documentation for any purpose and without fee is hereby granted, 
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
 provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in 
+both that copyright notice and this permission notice appear in
 supporting documentation, and that the name of Digital not be
 used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.  
+software without specific, written prior permission.
 
 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
@@ -88,12 +88,12 @@ SOFTWARE.
 
 #define VALIDATE_DRAWABLE_AND_GC(drawID, pDraw, mode)\
     {\
-       int rc = dixLookupDrawable(&(pDraw), drawID, client, M_ANY, mode);\
-       if (rc != Success)\
-           return rc;\
-       rc = dixLookupGC(&(pGC), stuff->gc, client, DixUseAccess);\
-       if (rc != Success)\
-           return rc;\
+       int tmprc = dixLookupDrawable(&(pDraw), drawID, client, M_ANY, mode);\
+       if (tmprc != Success)\
+           return tmprc;\
+       tmprc = dixLookupGC(&(pGC), stuff->gc, client, DixUseAccess);\
+       if (tmprc != Success)\
+           return tmprc;\
        if ((pGC->depth != pDraw->depth) || (pGC->pScreen != pDraw->pScreen))\
            return BadMatch;\
     }\
@@ -147,14 +147,14 @@ extern _X_EXPORT void UpdateCurrentTime(void);
 
 extern _X_EXPORT void UpdateCurrentTimeIf(void);
 
-extern _X_EXPORT int dixDestroyPixmap(pointer /*value */ ,
+extern _X_EXPORT int dixDestroyPixmap(void */*value */ ,
                                       XID /*pid */ );
 
 extern _X_EXPORT void InitClient(ClientPtr /*client */ ,
                                  int /*i */ ,
-                                 pointer /*ospriv */ );
+                                 void */*ospriv */ );
 
-extern _X_EXPORT ClientPtr NextAvailableClient(pointer /*ospriv */ );
+extern _X_EXPORT ClientPtr NextAvailableClient(void */*ospriv */ );
 
 extern _X_EXPORT void SendErrorToClient(ClientPtr /*client */ ,
                                         unsigned int /*majorCode */ ,
@@ -203,11 +203,11 @@ extern _X_EXPORT int AlterSaveSetForClient(ClientPtr /*client */ ,
 
 extern _X_EXPORT void DeleteWindowFromAnySaveSet(WindowPtr /*pWin */ );
 
-extern _X_EXPORT void BlockHandler(pointer /*pTimeout */ ,
-                                   pointer /*pReadmask */ );
+extern _X_EXPORT void BlockHandler(void */*pTimeout */ ,
+                                   void */*pReadmask */ );
 
 extern _X_EXPORT void WakeupHandler(int /*result */ ,
-                                    pointer /*pReadmask */ );
+                                    void */*pReadmask */ );
 
 void
  EnableLimitedSchedulingLatency(void);
@@ -215,21 +215,21 @@ void
 void
  DisableLimitedSchedulingLatency(void);
 
-typedef void (*WakeupHandlerProcPtr) (pointer /* blockData */ ,
+typedef void (*WakeupHandlerProcPtr) (void */* blockData */ ,
                                       int /* result */ ,
-                                      pointer /* pReadmask */ );
+                                      void */* pReadmask */ );
 
 extern _X_EXPORT Bool RegisterBlockAndWakeupHandlers(BlockHandlerProcPtr
                                                      /*blockHandler */ ,
                                                      WakeupHandlerProcPtr
                                                      /*wakeupHandler */ ,
-                                                     pointer /*blockData */ );
+                                                     void */*blockData */ );
 
 extern _X_EXPORT void RemoveBlockAndWakeupHandlers(BlockHandlerProcPtr
                                                    /*blockHandler */ ,
                                                    WakeupHandlerProcPtr
                                                    /*wakeupHandler */ ,
-                                                   pointer /*blockData */ );
+                                                   void */*blockData */ );
 
 extern _X_EXPORT void InitBlockAndWakeupHandlers(void);
 
@@ -241,18 +241,18 @@ extern _X_EXPORT Bool QueueWorkProc(Bool (* /*function */ )(
                                                                ClientPtr
                                                                /*clientUnused */
                                                                ,
-                                                               pointer
+                                                               void *
                                                                /*closure */ ),
                                     ClientPtr /*client */ ,
-                                    pointer     /*closure */
+                                    void */*closure */
     );
 
 typedef Bool (*ClientSleepProcPtr) (ClientPtr /*client */ ,
-                                    pointer /*closure */ );
+                                    void */*closure */ );
 
 extern _X_EXPORT Bool ClientSleep(ClientPtr /*client */ ,
                                   ClientSleepProcPtr /* function */ ,
-                                  pointer /*closure */ );
+                                  void */*closure */ );
 
 #ifndef ___CLIENTSIGNAL_DEFINED___
 #define ___CLIENTSIGNAL_DEFINED___
@@ -289,7 +289,10 @@ extern _X_EXPORT void
 SetVendorRelease(int release);
 
 extern _X_EXPORT void
-SetVendorString(char *string);
+SetVendorString(const char *string);
+
+int
+dix_main(int argc, char *argv[], char *envp[]);
 
 /* events.c */
 
@@ -315,8 +318,19 @@ extern _X_EXPORT WindowPtr
 GetSpriteWindow(DeviceIntPtr pDev);
 
 extern _X_EXPORT void
+NoticeTime(const DeviceIntPtr dev,
+           TimeStamp time);
+extern _X_EXPORT void
 NoticeEventTime(InternalEvent *ev,
                 DeviceIntPtr dev);
+extern _X_EXPORT TimeStamp
+LastEventTime(int deviceid);
+extern _X_EXPORT Bool
+LastEventTimeWasReset(int deviceid);
+extern _X_EXPORT void
+LastEventTimeToggleResetFlag(int deviceid, Bool state);
+extern _X_EXPORT void
+LastEventTimeToggleResetAll(Bool state);
 
 extern void
 EnqueueEvent(InternalEvent * /* ev */ ,
@@ -430,7 +444,7 @@ extern void
 RecalculateDeliverableEvents(WindowPtr /* pWin */ );
 
 extern _X_EXPORT int
-OtherClientGone(pointer /* value */ ,
+OtherClientGone(void */* value */ ,
                 XID /* id */ );
 
 extern void
@@ -570,6 +584,19 @@ typedef struct {
     DeviceIntPtr device;
 } DeviceEventInfoRec;
 
+/*
+ * WarpPointerCallback stuff
+ */
+//#ifdef _ADD_HOOK_FOR_WARP_POINTER_
+extern _X_EXPORT CallbackListPtr WarpPointerCallback;
+typedef struct {
+    int x;
+    int y;
+    int width;
+    int height;
+}  WarpPointerInfoRec;
+//#endif
+
 extern int
 XItoCoreType(int xi_type);
 extern Bool
@@ -593,5 +620,11 @@ extern _X_HIDDEN int
 CorePointerProc(DeviceIntPtr dev, int what);
 extern _X_HIDDEN int
 CoreKeyboardProc(DeviceIntPtr dev, int what);
+#ifdef _F_SUPPORT_XTEST_TOUCH_EVENT_
+extern _X_HIDDEN int
+CoreTouchProc(DeviceIntPtr dev, int what);
+#endif //_F_SUPPORT_XTEST_TOUCH_EVENT_
+
+extern _X_EXPORT void *lastGLContext;
 
 #endif                          /* DIX_H */
index 3d09eb5..40d80c1 100644 (file)
@@ -28,28 +28,29 @@ SOFTWARE.
 #include <X11/fonts/font.h>
 #include "closure.h"
 #include <X11/fonts/fontstruct.h>
+#include <X11/fonts/fontproto.h>
 
 #define NullDIXFontProp ((DIXFontPropPtr)0)
 
 typedef struct _DIXFontProp *DIXFontPropPtr;
 
-extern _X_EXPORT Bool SetDefaultFont(char * /*defaultfontname */ );
+extern _X_EXPORT Bool SetDefaultFont(const char * /*defaultfontname */ );
 
 extern _X_EXPORT void QueueFontWakeup(FontPathElementPtr /*fpe */ );
 
 extern _X_EXPORT void RemoveFontWakeup(FontPathElementPtr /*fpe */ );
 
-extern _X_EXPORT void FontWakeup(pointer /*data */ ,
+extern _X_EXPORT void FontWakeup(void */*data */ ,
                                  int /*count */ ,
-                                 pointer /*LastSelectMask */ );
+                                 void */*LastSelectMask */ );
 
 extern _X_EXPORT int OpenFont(ClientPtr /*client */ ,
                               XID /*fid */ ,
                               Mask /*flags */ ,
                               unsigned /*lenfname */ ,
-                              char * /*pfontname */ );
+                              const char * /*pfontname */ );
 
-extern _X_EXPORT int CloseFont(pointer /*pfont */ ,
+extern _X_EXPORT int CloseFont(void */*pfont */ ,
                                XID /*fid */ );
 
 typedef struct _xQueryFontReply *xQueryFontReplyPtr;
@@ -98,7 +99,7 @@ extern _X_EXPORT int SetFontPath(ClientPtr /*client */ ,
                                  int /*npaths */ ,
                                  unsigned char * /*paths */ );
 
-extern _X_EXPORT int SetDefaultFontPath(char * /*path */ );
+extern _X_EXPORT int SetDefaultFontPath(const char * /*path */ );
 
 extern _X_EXPORT int GetFontPath(ClientPtr client,
                                  int *count,
@@ -143,42 +144,4 @@ extern _X_EXPORT void SetGlyphCachingMode(int /*newmode */ );
 
 extern _X_EXPORT void register_fpe_functions(void);
 
-/*
- * libXfont stubs.
- */
-extern _X_EXPORT int client_auth_generation(ClientPtr client);
-
-extern _X_EXPORT void DeleteFontClientID(Font id);
-
-extern _X_EXPORT FontResolutionPtr GetClientResolutions(int *num);
-
-extern _X_EXPORT int GetDefaultPointSize(void);
-
-extern _X_EXPORT Font GetNewFontClientID(void);
-
-extern _X_EXPORT int init_fs_handlers(FontPathElementPtr fpe,
-                                      BlockHandlerProcPtr block_handler);
-
-extern _X_EXPORT int RegisterFPEFunctions(NameCheckFunc name_func,
-                                          InitFpeFunc init_func,
-                                          FreeFpeFunc free_func,
-                                          ResetFpeFunc reset_func,
-                                          OpenFontFunc open_func,
-                                          CloseFontFunc close_func,
-                                          ListFontsFunc list_func,
-                                          StartLfwiFunc start_lfwi_func,
-                                          NextLfwiFunc next_lfwi_func,
-                                          WakeupFpeFunc wakeup_func,
-                                          ClientDiedFunc client_died,
-                                          LoadGlyphsFunc load_glyphs,
-                                          StartLaFunc start_list_alias_func,
-                                          NextLaFunc next_list_alias_func,
-                                          SetPathFunc set_path_func);
-
-extern _X_EXPORT void remove_fs_handlers(FontPathElementPtr fpe,
-                                         BlockHandlerProcPtr blockHandler,
-                                         Bool all);
-
-extern _X_EXPORT int StoreFontClientFont(FontPtr pfont, Font id);
-
 #endif                          /* DIXFONT_H */
diff --git a/include/dixfontstubs.h b/include/dixfontstubs.h
new file mode 100644 (file)
index 0000000..535d312
--- /dev/null
@@ -0,0 +1,43 @@
+#ifndef DIXFONTSTUBS_H
+#define DIXFONTSTUBS_H 1
+
+/*
+ * libXfont stubs replacements
+ * This header exists solely for the purpose of sdksyms generation;
+ * source code should #include "dixfonts.h" instead, which pulls in these
+ * declarations from <X11/fonts/fontproto.h>
+ */
+extern _X_EXPORT int client_auth_generation(ClientPtr client);
+
+extern _X_EXPORT void DeleteFontClientID(Font id);
+
+extern _X_EXPORT int GetDefaultPointSize(void);
+
+extern _X_EXPORT Font GetNewFontClientID(void);
+
+extern _X_EXPORT int init_fs_handlers(FontPathElementPtr fpe,
+                                      BlockHandlerProcPtr block_handler);
+
+extern _X_EXPORT int RegisterFPEFunctions(NameCheckFunc name_func,
+                                          InitFpeFunc init_func,
+                                          FreeFpeFunc free_func,
+                                          ResetFpeFunc reset_func,
+                                          OpenFontFunc open_func,
+                                          CloseFontFunc close_func,
+                                          ListFontsFunc list_func,
+                                          StartLfwiFunc start_lfwi_func,
+                                          NextLfwiFunc next_lfwi_func,
+                                          WakeupFpeFunc wakeup_func,
+                                          ClientDiedFunc client_died,
+                                          LoadGlyphsFunc load_glyphs,
+                                          StartLaFunc start_list_alias_func,
+                                          NextLaFunc next_list_alias_func,
+                                          SetPathFunc set_path_func);
+
+extern _X_EXPORT void remove_fs_handlers(FontPathElementPtr fpe,
+                                         BlockHandlerProcPtr blockHandler,
+                                         Bool all);
+
+extern _X_EXPORT int StoreFontClientFont(FontPtr pfont, Font id);
+
+#endif
index eccec77..d78d812 100644 (file)
@@ -31,7 +31,7 @@ struct _GrabParameters;
 extern void PrintDeviceGrabInfo(DeviceIntPtr dev);
 extern void UngrabAllDevices(Bool kill_client);
 
-extern GrabPtr AllocGrab(void);
+extern GrabPtr AllocGrab(const GrabPtr src);
 extern void FreeGrab(GrabPtr grab);
 extern Bool CopyGrab(GrabPtr dst, const GrabPtr src);
 
@@ -47,7 +47,7 @@ extern GrabPtr CreateGrab(int /* client */ ,
                           WindowPtr /* confineTo */ ,
                           CursorPtr /* cursor */ );
 
-extern _X_EXPORT int DeletePassiveGrab(pointer /* value */ ,
+extern _X_EXPORT int DeletePassiveGrab(void */* value */ ,
                                        XID /* id */ );
 
 extern _X_EXPORT Bool GrabMatchesSecond(GrabPtr /* pFirstGrab */ ,
old mode 100755 (executable)
new mode 100644 (file)
index b2a168a..6c13895
@@ -56,13 +56,11 @@ ReplyNotSwappd(ClientPtr /* pClient */ ,
                void * /* pbuf */ ) _X_NORETURN;
 
 typedef enum { ClientStateInitial,
-    /* 1 is unused now, was ClientStateAuthenticating */
-    ClientStateRunning = 2,
+    ClientStateRunning,
     ClientStateRetained,
     ClientStateGone
 } ClientState;
 
-#ifdef XFIXES
 typedef struct _saveSet {
     struct _Window *windowPtr;
     Bool toRoot;
@@ -74,38 +72,31 @@ typedef struct _saveSet {
 #define SaveSetAssignWindow(ss,w)   ((ss).windowPtr = (w))
 #define SaveSetAssignToRoot(ss,tr)  ((ss).toRoot = (tr))
 #define SaveSetAssignMap(ss,m)      ((ss).map = (m))
-#else
-typedef struct _Window *SaveSetElt;
-
-#define SaveSetWindow(ss)   (ss)
-#define SaveSetToRoot(ss)   FALSE
-#define SaveSetShouldMap(ss)       TRUE
-#define SaveSetAssignWindow(ss,w)   ((ss) = (w))
-#define SaveSetAssignToRoot(ss,tr)
-#define SaveSetAssignMap(ss,m)
-#endif
 
 typedef struct _Client {
-    int index;
+    void *requestBuffer;
+    void *osPrivate;             /* for OS layer, including scheduler */
     Mask clientAsMask;
-    pointer requestBuffer;
-    pointer osPrivate;          /* for OS layer, including scheduler */
-    Bool swapped;
+    short index;
+    unsigned char majorOp, minorOp;
+    unsigned int swapped:1;
+    unsigned int local:1;
+    unsigned int big_requests:1; /* supports large requests */
+    unsigned int clientGone:1;
+    unsigned int closeDownMode:2;
+    unsigned int clientState:2;
+    signed char smart_priority;
+    short noClientException;      /* this client died or needs to be killed */
+    int priority;
     ReplySwapPtr pSwapReplyFunc;
     XID errorValue;
     int sequence;
-    int closeDownMode;
-    int clientGone;
-    int noClientException;      /* this client died or needs to be
-                                 * killed */
     int ignoreCount;            /* count for Attend/IgnoreClient */
-    SaveSetElt *saveSet;
     int numSaved;
+    SaveSetElt *saveSet;
     int (**requestVector) (ClientPtr /* pClient */ );
     CARD32 req_len;             /* length of current request */
-    Bool big_requests;          /* supports large requests */
-    int priority;
-    ClientState clientState;
+    unsigned int replyBytesRemaining;
     PrivateRec *devPrivates;
     unsigned short xkbClientFlags;
     unsigned short mapNotifyMask;
@@ -113,17 +104,25 @@ typedef struct _Client {
     unsigned short vMajor, vMinor;
     KeyCode minKC, maxKC;
 
-    unsigned long replyBytesRemaining;
-    int smart_priority;
-    long smart_start_tick;
-    long smart_stop_tick;
-    long smart_check_tick;
+    int smart_start_tick;
+    int smart_stop_tick;
 
     DeviceIntPtr clientPtr;
     ClientIdPtr clientIds;
-    unsigned short majorOp, minorOp;
+#if XTRANS_SEND_FDS
+    int req_fds;
+#endif
 } ClientRec;
 
+#if XTRANS_SEND_FDS
+static inline void
+SetReqFds(ClientPtr client, int req_fds) {
+    if (client->req_fds != 0 && req_fds != client->req_fds)
+        LogMessage(X_ERROR, "Mismatching number of request fds %d != %d\n", req_fds, client->req_fds);
+    client->req_fds = req_fds;
+}
+#endif
+
 /*
  * Scheduling interface
  */
@@ -149,14 +148,13 @@ SmartScheduleInit(void);
 typedef struct _WorkQueue {
     struct _WorkQueue *next;
     Bool (*function) (ClientPtr /* pClient */ ,
-                      pointer   /* closure */
+                      void *    /* closure */
         );
     ClientPtr client;
-    pointer closure;
+    void *closure;
 } WorkQueueRec;
 
 extern _X_EXPORT TimeStamp currentTime;
-extern _X_EXPORT TimeStamp lastDeviceEventTime[MAXDEVICES];
 
 extern _X_EXPORT int
 CompareTimeStamps(TimeStamp /*a */ ,
@@ -167,7 +165,7 @@ ClientTimeToServerTime(CARD32 /*c */ );
 
 typedef struct _CallbackRec {
     CallbackProcPtr proc;
-    pointer data;
+    void *data;
     Bool deleted;
     struct _CallbackRec *next;
 } CallbackRec, *CallbackPtr;
index 6a98a75..c4bb05b 100644 (file)
@@ -29,7 +29,6 @@
 #include "events.h"
 #include "eventstr.h"
 
-#define FP1616(integral, frac) ((integral) * (1 << 16) + (frac) * (1 << 16))
 #ifdef _F_INPUT_REDIRECTION_
 #define AXIS_LABEL_PROP_ABS_X           "Abs X"
 #define AXIS_LABEL_PROP_ABS_Y           "Abs Y"
index 081c16e..1ee7b1d 100644 (file)
@@ -28,6 +28,7 @@ typedef struct _DeviceEvent DeviceEvent;
 typedef struct _DeviceChangedEvent DeviceChangedEvent;
 typedef struct _TouchOwnershipEvent TouchOwnershipEvent;
 typedef struct _TouchCancelEvent TouchCancelEvent;
+typedef struct _BarrierEvent BarrierEvent;
 
 #if XFreeXDGA
 typedef struct _DGAEvent DGAEvent;
index 7f6ce7e..6d74eb1 100644 (file)
@@ -72,7 +72,9 @@ enum EventType {
     ET_RawTouchUpdate,
     ET_RawTouchEnd,
     ET_XQuartz,
-    ET_TouchCancel = 31,
+    ET_BarrierHit,
+    ET_BarrierLeave,
+    ET_TouchCancel,
 #ifdef _F_GESTURE_EXTENSION_
     ET_MTSync = 0x7E,
 #endif//_F_GESTURE_EXTENSION_
@@ -125,6 +127,7 @@ struct _DeviceEvent {
     int corestate;    /**< Core key/button state BEFORE the event */
     int key_repeat;   /**< Internally-generated key repeat event */
     uint32_t flags;   /**< Flags to be copied into the generated event */
+    uint32_t resource; /**< Touch event resource, only for TOUCH_REPLAYING */
 };
 
 /**
@@ -134,7 +137,7 @@ struct _DeviceEvent {
  */
 struct _TouchOwnershipEvent {
     unsigned char header; /**< Always ET_Internal */
-    enum EventType type;  /**< One of EventType */
+    enum EventType type;  /**< ET_TouchOwnership */
     int length;           /**< Length in bytes */
     Time time;            /**< Time in ms */
     int deviceid;         /**< Device to post this event for */
@@ -189,6 +192,7 @@ struct _DeviceChangedEvent {
     struct {
         uint32_t min;           /**< Minimum value */
         uint32_t max;           /**< Maximum value */
+        double value;           /**< Current value */
         /* FIXME: frac parts of min/max */
         uint32_t resolution;    /**< Resolution counts/m */
         uint8_t mode;           /**< Relative or Absolute */
@@ -243,6 +247,25 @@ struct _RawDeviceEvent {
     uint32_t flags;       /**< Flags to be copied into the generated event */
 };
 
+struct _BarrierEvent {
+    unsigned char header; /**<  Always ET_Internal */
+    enum EventType type;  /**<  ET_BarrierHit, ET_BarrierLeave */
+    int length;           /**<  Length in bytes */
+    Time time;            /**<  Time in ms */
+    int deviceid;         /**< Device to post this event for */
+    int sourceid;         /**< The physical source device */
+    int barrierid;
+    Window window;
+    Window root;
+    double dx;
+    double dy;
+    double root_x;
+    double root_y;
+    int16_t dt;
+    int32_t event_id;
+    uint32_t flags;
+};
+
 #ifdef XQUARTZ
 #define XQUARTZ_EVENT_MAXARGS 5
 struct _XQuartzEvent {
@@ -269,6 +292,7 @@ union _InternalEvent {
     DeviceEvent device_event;
     DeviceChangedEvent changed_event;
     TouchOwnershipEvent touch_ownership_event;
+    BarrierEvent barrier_event;
 #if XFreeXDGA
     DGAEvent dga_event;
 #endif
index 0f55d90..7c09af1 100644 (file)
@@ -97,6 +97,7 @@ extern _X_EXPORT void InitExtensions(int argc, char **argv);
 
 extern _X_EXPORT void CloseDownExtensions(void);
 
-extern _X_EXPORT void LoadExtension(ExtensionModule *ext, Bool external);
+extern _X_EXPORT void LoadExtensionList(const ExtensionModule ext[],
+                                        int listSize, Bool external);
 
 #endif                          /* EXTENSION_H */
index 9141a5e..ff51822 100755 (executable)
@@ -68,10 +68,6 @@ extern _X_EXPORT Bool noDbeExtension;
 extern void DbeExtensionInit(void);
 #endif
 
-#ifdef DMXEXT
-extern void DMXExtensionInit(void);
-#endif
-
 #if defined(DPMSExtension)
 #include <X11/extensions/dpmsconst.h>
 extern _X_EXPORT Bool noDPMSExtension;
@@ -148,10 +144,8 @@ extern void XFree86BigfontExtensionInit(void);
 
 extern void BigReqExtensionInit(void);
 
-#ifdef XFIXES
 extern _X_EXPORT Bool noXFixesExtension;
 extern void XFixesExtensionInit(void);
-#endif
 
 extern void XInputExtensionInit(void);
 extern _X_EXPORT void AssignTypeAndName(DeviceIntPtr dev,
@@ -173,6 +167,16 @@ extern _X_EXPORT Bool noSmackExtension;
 extern void SmackExtensionInit(void);
 #endif
 
+#if defined(SMACK_UTIL)
+#include "smack_util.h"
+#endif
+
+#if defined(CONTAINER)
+#include "container.h"
+extern _X_EXPORT Bool noContainerExtension;
+extern void ContainerExtensionInit(void);
+#endif // _F_CONTAINER_EXTENSION_
+
 #ifdef XTEST
 #include <X11/extensions/xtestconst.h>
 #include <X11/extensions/xtestproto.h>
@@ -195,7 +199,26 @@ extern void XvMCExtensionInit(void);
 #if defined(HWC)
 #include <X11/extensions/hwctokens.h>
 #include <X11/extensions/hwcproto.h>
+extern _X_EXPORT Bool noHWCExtension;
 extern void hwc_extension_init(void);
 #endif
 
+#if defined(HWA)
+#include <X11/extensions/hwaproto.h>
+extern _X_EXPORT Bool noHWAExtension;
+extern void hwa_extension_init(void);
+#endif
+
+#if defined(DRI3)
+#include <X11/extensions/dri3proto.h>
+extern _X_EXPORT Bool noDRI3Extension;
+extern void dri3_extension_init(void);
+#endif
+
+#if defined(PRESENT)
+#include <X11/extensions/presentproto.h>
+#include "presentext.h"
+extern _X_EXPORT Bool noPresentExtension;
+#endif
+
 #endif
index e825236..fbdb73c 100644 (file)
@@ -58,15 +58,15 @@ typedef struct _ExtensionEntry {
     int index;
     void (*CloseDown) (         /* called at server shutdown */
                           struct _ExtensionEntry * /* extension */ );
-    char *name;                 /* extension name */
+    const char *name;           /* extension name */
     int base;                   /* base request number */
     int eventBase;
     int eventLast;
     int errorBase;
     int errorLast;
     int num_aliases;
-    char **aliases;
-    pointer extPrivate;
+    const char **aliases;
+    void *extPrivate;
     unsigned short (*MinorOpcode) (     /* called for errors */
                                       ClientPtr /* client */ );
     PrivateRec *devPrivates;
index 6e5b92d..ecaa257 100644 (file)
@@ -88,7 +88,7 @@ extern _X_EXPORT void ValidateGC(DrawablePtr /*pDraw */ ,
 
 typedef union {
     CARD32 val;
-    pointer ptr;
+    void *ptr;
 } ChangeGCVal, *ChangeGCValPtr;
 
 extern int ChangeGCXIDs(ClientPtr /*client */ ,
@@ -112,7 +112,7 @@ extern _X_EXPORT int CopyGC(GCPtr /*pgcSrc */ ,
                             GCPtr /*pgcDst */ ,
                             BITS32 /*mask */ );
 
-extern _X_EXPORT int FreeGC(pointer /*pGC */ ,
+extern _X_EXPORT int FreeGC(void */*pGC */ ,
                             XID /*gid */ );
 
 extern _X_EXPORT void FreeGCperDepth(int /*screenNum */ );
index 7621ceb..c830ccd 100644 (file)
@@ -78,7 +78,7 @@ typedef struct _GCFuncs {
 
     void (*ChangeClip) (GCPtr /*pGC */ ,
                         int /*type */ ,
-                        pointer /*pvalue */ ,
+                        void */*pvalue */ ,
                         int /*nrects */ );
 
     void (*DestroyClip) (GCPtr /*pGC */ );
@@ -216,7 +216,7 @@ typedef struct _GCOps {
                            int /*y */ ,
                            unsigned int /*nglyph */ ,
                            CharInfoPtr * /*ppci */ ,
-                           pointer /*pglyphBase */ );
+                           void */*pglyphBase */ );
 
     void (*PolyGlyphBlt) (DrawablePtr /*pDrawable */ ,
                           GCPtr /*pGC */ ,
@@ -224,7 +224,7 @@ typedef struct _GCOps {
                           int /*y */ ,
                           unsigned int /*nglyph */ ,
                           CharInfoPtr * /*ppci */ ,
-                          pointer /*pglyphBase */ );
+                          void */*pglyphBase */ );
 
     void (*PushPixels) (GCPtr /*pGC */ ,
                         PixmapPtr /*pBitMap */ ,
@@ -273,11 +273,11 @@ typedef struct _GC {
     DDXPointRec patOrg;         /* origin for (tile, stipple) */
     struct _Font *font;
     DDXPointRec clipOrg;
-    pointer clientClip;
+    void *clientClip;
     unsigned long stateChanges; /* masked with GC_<kind> */
     unsigned long serialNumber;
-    GCFuncs *funcs;
-    GCOps *ops;
+    const GCFuncs *funcs;
+    const GCOps *ops;
     PrivateRec *devPrivates;
     /*
      * The following were moved here from private storage to allow device-
index 2ba1f13..23e7247 100755 (executable)
@@ -7,6 +7,20 @@
 #include "window.h"             /* for WindowPtr */
 #include "extinit.h"
 
+#ifdef ENABLE_TTRACE
+#include <ttrace.h>
+
+#define TTRACE_INPUT_BEGIN(NAME) traceBegin(TTRACE_TAG_INPUT, NAME)
+#define TTRACE_INPUT_END() traceEnd(TTRACE_TAG_INPUT)
+#define TTRACE_VIDEO_BEGIN(NAME) traceBegin(TTRACE_TAG_VIDEO, NAME)
+#define TTRACE_VIDEO_END() traceEnd(TTRACE_TAG_VIDEO)
+#else //ENABLE_TTRACE
+#define TTRACE_INPUT_BEGIN(NAME)
+#define TTRACE_INPUT_END()
+#define TTRACE_VIDEO_BEGIN(NAME)
+#define TTRACE_VIDEO_END()
+#endif //ENABLE_TTRACE
+
 /* Global X server variables that are visible to mi, dix, os, and ddx */
 
 extern _X_EXPORT CARD32 defaultScreenSaverTime;
@@ -22,7 +36,7 @@ extern _X_EXPORT Bool noInputInit;
 extern _X_EXPORT Bool screenSaverSuspended;
 #endif
 
-extern _X_EXPORT char *defaultFontPath;
+extern _X_EXPORT const char *defaultFontPath;
 extern _X_EXPORT int monitorResolution;
 extern _X_EXPORT int defaultColorVisualClass;
 
index 2a95b45..4c2fa97 100644 (file)
@@ -32,26 +32,46 @@ extern _X_EXPORT void config_pre_init(void);
 extern _X_EXPORT void config_init(void);
 extern _X_EXPORT void config_fini(void);
 
+enum { ODEV_ATTRIB_UNKNOWN = -1, ODEV_ATTRIB_STRING = 0, ODEV_ATTRIB_INT };
+
 struct OdevAttribute {
     struct xorg_list member;
     int attrib_id;
-    char *attrib_name;
+    union {
+        char *attrib_name;
+        int attrib_value;
+    };
+    int attrib_type;
 };
 
 struct OdevAttributes {
     struct xorg_list list;
 };
 
+/* Note starting with xserver 1.16 this function never fails */
 struct OdevAttributes *
 config_odev_allocate_attribute_list(void);
 
 void
 config_odev_free_attribute_list(struct OdevAttributes *attribs);
 
+/* Note starting with xserver 1.16 this function never fails */
 Bool
 config_odev_add_attribute(struct OdevAttributes *attribs, int attrib,
                           const char *attrib_name);
 
+char *
+config_odev_get_attribute(struct OdevAttributes *attribs, int attrib_id);
+
+/* Note starting with xserver 1.16 this function never fails */
+Bool
+config_odev_add_int_attribute(struct OdevAttributes *attribs, int attrib,
+                              int attrib_value);
+
+int
+config_odev_get_int_attribute(struct OdevAttributes *attribs, int attrib,
+                              int def);
+
 void
 config_odev_free_attributes(struct OdevAttributes *attribs);
 
@@ -61,6 +81,14 @@ config_odev_free_attributes(struct OdevAttributes *attribs);
 #define ODEV_ATTRIB_SYSPATH 2
 /* DRI-style bus id */
 #define ODEV_ATTRIB_BUSID 3
+/* Server managed FD */
+#define ODEV_ATTRIB_FD 4
+/* Major number of the device node pointed to by ODEV_ATTRIB_PATH */
+#define ODEV_ATTRIB_MAJOR 5
+/* Minor number of the device node pointed to by ODEV_ATTRIB_PATH */
+#define ODEV_ATTRIB_MINOR 6
+/* kernel driver name */
+#define ODEV_ATTRIB_DRIVER 7
 
 typedef void (*config_odev_probe_proc_ptr)(struct OdevAttributes *attribs);
 void config_odev_probe(config_odev_probe_proc_ptr probe_callback);
@@ -71,4 +99,8 @@ void DeleteGPUDeviceRequest(struct OdevAttributes *attribs);
 #endif
 
 #define ServerIsNotSeat0() (SeatId && strcmp(SeatId, "seat0"))
+
+struct xf86_platform_device *
+xf86_find_platform_device_by_devnum(int major, int minor);
+
 #endif                          /* HOTPLUG_H */
old mode 100644 (file)
new mode 100755 (executable)
index 98bc680..7530b0f
@@ -62,6 +62,7 @@ SOFTWARE.
 #define DEVICE_ON      1
 #define DEVICE_OFF     2
 #define DEVICE_CLOSE   3
+#define DEVICE_ABORT   4
 
 #define POINTER_RELATIVE       (1 << 1)
 #define POINTER_ABSOLUTE       (1 << 2)
@@ -69,6 +70,7 @@ SOFTWARE.
 #define POINTER_SCREEN         (1 << 4)        /* Data in screen coordinates */
 #define POINTER_NORAW          (1 << 5)        /* Don't generate RawEvents */
 #define POINTER_EMULATED       (1 << 6)        /* Event was emulated from another event */
+#define POINTER_DESKTOP                (1 << 7)        /* Data in desktop coordinates */
 
 /* GetTouchEvent flags */
 #define TOUCH_ACCEPT            (1 << 0)
@@ -93,8 +95,8 @@ SOFTWARE.
 
 #define NO_AXIS_LIMITS -1
 
-#define MAP_LENGTH     256
-#define DOWN_LENGTH    32      /* 256/8 => number of bytes to hold 256 bits */
+#define MAP_LENGTH     MAX_BUTTONS
+#define DOWN_LENGTH    (MAX_BUTTONS/8)      /* 256/8 => number of bytes to hold 256 bits */
 #define NullGrab ((GrabPtr)NULL)
 #define PointerRootWin ((WindowPtr)PointerRoot)
 #define NoneWin ((WindowPtr)None)
@@ -111,9 +113,9 @@ SOFTWARE.
 #endif
 
 enum InputLevel {
-    CORE,
-    XI,
-    XI2,
+    CORE = 1,
+    XI = 2,
+    XI2 = 3,
 };
 
 typedef unsigned long Leds;
@@ -161,7 +163,7 @@ typedef Bool (*PointerAccelSchemeInitProc) (DeviceIntPtr /*dev */ ,
                                             /*protoScheme */ );
 
 typedef struct _DeviceRec {
-    pointer devicePrivate;
+    void *devicePrivate;
     ProcessInputProc processInputProc;  /* current */
     ProcessInputProc realInputProc;     /* deliver */
     ProcessInputProc enqueueInputProc;  /* enqueue */
@@ -242,15 +244,18 @@ typedef struct _InputAttributes {
 #define KEY_POSTED 2
 #define BUTTON_POSTED 2
 
-extern void set_key_down(DeviceIntPtr pDev, int key_code, int type);
-extern void set_key_up(DeviceIntPtr pDev, int key_code, int type);
-extern int key_is_down(DeviceIntPtr pDev, int key_code, int type);
-extern void set_button_down(DeviceIntPtr pDev, int button, int type);
-extern void set_button_up(DeviceIntPtr pDev, int button, int type);
-extern int button_is_down(DeviceIntPtr pDev, int button, int type);
+extern _X_EXPORT void set_key_down(DeviceIntPtr pDev, int key_code, int type);
+extern _X_EXPORT void set_key_up(DeviceIntPtr pDev, int key_code, int type);
+extern _X_EXPORT int key_is_down(DeviceIntPtr pDev, int key_code, int type);
+extern _X_EXPORT void set_button_down(DeviceIntPtr pDev, int button, int type);
+extern _X_EXPORT void set_button_up(DeviceIntPtr pDev, int button, int type);
+extern _X_EXPORT int button_is_down(DeviceIntPtr pDev, int button, int type);
 
 extern void InitCoreDevices(void);
 extern void InitXTestDevices(void);
+#ifdef _F_SUPPORT_XTEST_TOUCH_EVENT_
+extern void InitXTestHWKeyTouchDevices(void);
+#endif //_F_SUPPORT_XTEST_TOUCH_EVENT_
 
 extern _X_EXPORT DeviceIntPtr AddInputDevice(ClientPtr /*client */ ,
                                              DeviceProc /*deviceProc */ ,
@@ -268,6 +273,7 @@ extern void DisableAllDevices(void);
 extern int InitAndStartDevices(void);
 
 extern void CloseDownDevices(void);
+extern void AbortDevices(void);
 
 extern void UndisplayDevices(void);
 
@@ -313,7 +319,7 @@ extern _X_EXPORT Bool InitTouchClassDeviceStruct(DeviceIntPtr /*device */ ,
 
 typedef void (*BellProcPtr) (int /*percent */ ,
                              DeviceIntPtr /*device */ ,
-                             pointer /*ctrl */ ,
+                             void */*ctrl */ ,
                              int);
 
 typedef void (*KbdCtrlProcPtr) (DeviceIntPtr /*device */ ,
@@ -381,6 +387,25 @@ extern _X_EXPORT Bool InitKeyboardDeviceStruct(DeviceIntPtr /*device */ ,
                                                BellProcPtr /*bellProc */ ,
                                                KbdCtrlProcPtr /*controlProc */
                                                );
+#ifdef _F_SUPPORT_XTEST_TOUCH_EVENT_
+extern _X_EXPORT Bool InitTouchDeviceStruct(DeviceIntPtr /*device*/ ,
+                                               int /* numAxis */,
+                                               Atom * /* axes_labels */,
+                                               int /* numMotionEvents */ ,
+                                               int /* valuatormode */ ,
+                                               int /* numTouches */ ,
+                                               unsigned int /* touchMode */,
+                                               int /* numButtons */ ,
+                                               Atom * /* btn_labels */ ,
+                                               CARD8 * /* map */
+                                               );
+#endif //_F_SUPPORT_XTEST_TOUCH_EVENT_
+
+extern _X_EXPORT Bool InitKeyboardDeviceStructFromString(DeviceIntPtr dev,
+                                                        const char *keymap,
+                                                        int keymap_length,
+                                                        BellProcPtr bell_func,
+                                                        KbdCtrlProcPtr ctrl_func);
 
 extern int ApplyPointerMapping(DeviceIntPtr /* pDev */ ,
                                CARD8 * /* map */ ,
@@ -465,6 +490,11 @@ extern int GetTouchOwnershipEvents(InternalEvent *events,
                                    TouchPointInfoPtr ti,
                                    uint8_t mode, XID resource, uint32_t flags);
 
+extern void GetDixTouchEnd(InternalEvent *ievent,
+                           DeviceIntPtr dev,
+                           TouchPointInfoPtr ti,
+                           uint32_t flags);
+
 extern _X_EXPORT int GetProximityEvents(InternalEvent *events,
                                         DeviceIntPtr pDev,
                                         int type, const ValuatorMask *mask);
@@ -502,6 +532,16 @@ extern _X_EXPORT int AllocDevicePair(ClientPtr client,
                                      DeviceIntPtr *keybd,
                                      DeviceProc ptr_proc,
                                      DeviceProc keybd_proc, Bool master);
+
+#ifdef _F_SUPPORT_XTEST_TOUCH_EVENT_
+extern _X_EXPORT int AllocHWKeyTouchDevicePair(ClientPtr client,
+                                     const char *name,
+                                     DeviceIntPtr *ptr,
+                                     DeviceIntPtr *keybd,
+                                     DeviceProc ptr_proc,
+                                     DeviceProc keybd_proc, Bool master);
+#endif //_F_SUPPORT_XTEST_TOUCH_EVENT_
+
 extern void DeepCopyDeviceClasses(DeviceIntPtr from,
                                   DeviceIntPtr to, DeviceChangedEvent *dce);
 
@@ -514,6 +554,11 @@ extern int change_modmap(ClientPtr client, DeviceIntPtr dev, KeyCode *map,
 extern int AllocXTestDevice(ClientPtr client, const char *name,
                             DeviceIntPtr *ptr, DeviceIntPtr *keybd,
                             DeviceIntPtr master_ptr, DeviceIntPtr master_keybd);
+#ifdef _F_SUPPORT_XTEST_TOUCH_EVENT_
+extern int AllocXTestHWKeyTouchDevice(ClientPtr client, const char *name,
+                            DeviceIntPtr *ptr, DeviceIntPtr *keybd,
+                            DeviceIntPtr master_ptr, DeviceIntPtr master_keybd);
+#endif //_F_SUPPORT_XTEST_TOUCH_EVENT_
 extern BOOL IsXTestDevice(DeviceIntPtr dev, DeviceIntPtr master);
 extern DeviceIntPtr GetXTestDevice(DeviceIntPtr master);
 extern void SendDevicePresenceEvent(int deviceid, int type);
@@ -581,6 +626,11 @@ extern int TouchListenerAcceptReject(DeviceIntPtr dev, TouchPointInfoPtr ti,
                                      int listener, int mode);
 extern int TouchAcceptReject(ClientPtr client, DeviceIntPtr dev, int mode,
                              uint32_t touchid, Window grab_window, XID *error);
+extern void TouchEndPhysicallyActiveTouches(DeviceIntPtr dev);
+extern void TouchDeliverDeviceClassesChangedEvent(TouchPointInfoPtr ti,
+                                                  Time time, XID resource);
+extern void TouchEmitTouchEnd(DeviceIntPtr dev, TouchPointInfoPtr ti, int flags, XID resource);
+extern void TouchAcceptAndEnd(DeviceIntPtr dev, int touchid);
 
 /* misc event helpers */
 extern Mask GetEventMask(DeviceIntPtr dev, xEvent *ev, InputClientsPtr clients);
@@ -590,6 +640,7 @@ extern int GetXI2MaskByte(XI2Mask *mask, DeviceIntPtr dev, int event_type);
 void FixUpEventFromWindow(SpritePtr pSprite,
                           xEvent *xE,
                           WindowPtr pWin, Window child, Bool calcChild);
+extern Bool PointInBorderSize(WindowPtr pWin, int x, int y);
 extern WindowPtr XYToWindow(SpritePtr pSprite, int x, int y);
 extern int EventIsDeliverable(DeviceIntPtr dev, int evtype, WindowPtr win);
 extern Bool ActivatePassiveGrab(DeviceIntPtr dev, GrabPtr grab,
@@ -629,6 +680,11 @@ extern _X_HIDDEN void valuator_set_mode(DeviceIntPtr dev, int axis, int mode);
    xfixes/cursor.c uses it to determine if the cursor is enabled */
 extern Bool EnableCursor;
 
+/* Set to FALSE by default - ChangeWindowAttributes sets it to TRUE on
+ * CWCursor, xfixes/cursor.c uses it to determine if the cursor is enabled
+ */
+extern Bool CursorVisible;
+
 extern _X_EXPORT ValuatorMask *valuator_mask_new(int num_valuators);
 extern _X_EXPORT void valuator_mask_free(ValuatorMask **mask);
 extern _X_EXPORT void valuator_mask_set_range(ValuatorMask *mask,
@@ -672,4 +728,10 @@ extern _X_EXPORT void input_option_set_value(InputOption *opt,
 extern _X_HIDDEN Bool point_on_screen(ScreenPtr pScreen, int x, int y);
 extern _X_HIDDEN void update_desktop_dimensions(void);
 
+extern _X_HIDDEN void input_constrain_cursor(DeviceIntPtr pDev, ScreenPtr screen,
+                                             int current_x, int current_y,
+                                             int dest_x, int dest_y,
+                                             int *out_x, int *out_y,
+                                             int *nevents, InternalEvent* events);
+
 #endif                          /* INPUT_H */
index 0159c99..7982d64 100644 (file)
@@ -65,7 +65,7 @@ extern _X_EXPORT int CountBits(const uint8_t * mask, int len);
 #define SameClient(obj,client) \
        (CLIENT_BITS((obj)->resource) == (client)->clientAsMask)
 
-#define EMASKSIZE      MAXDEVICES + 2
+#define EMASKSIZE      (MAXDEVICES + 2)
 
 /* This is the last XI2 event supported by the server. If you add
  * events to the protocol, the server will not support these events until
@@ -195,7 +195,7 @@ typedef struct _GrabRec {
     unsigned keyboardMode:1;
     unsigned pointerMode:1;
     enum InputLevel grabtype;
-    CARD8 type;                 /* event type */
+    CARD8 type;                 /* event type for passive grabs, 0 for active grabs */
     DetailRec modifiersDetail;
     DeviceIntPtr modifierDevice;
     DetailRec detail;           /* key or button */
@@ -333,7 +333,7 @@ typedef struct _DDXTouchPointInfo {
     uint32_t ddx_id;            /* touch ID given by the DDX */
     Bool emulate_pointer;
 
-    ValuatorMask *valuators;    /* last recorded axis values */
+    ValuatorMask *valuators;    /* last axis values as posted, pre-transform */
 } DDXTouchPointInfoRec;
 
 typedef struct _TouchClassRec {
@@ -447,7 +447,7 @@ typedef struct _XIPropertyValue {
     Atom type;                  /* ignored by server */
     short format;               /* format of data for swapping - 8,16,32 */
     long size;                  /* size of data in (format/8) bytes */
-    pointer data;               /* private to client */
+    void *data;                 /* private to client */
 } XIPropertyValueRec;
 
 typedef struct _XIProperty {
@@ -485,7 +485,7 @@ typedef struct _GrabInfoRec {
     TimeStamp grabTime;
     Bool fromPassiveGrab;       /* true if from passive grab */
     Bool implicitGrab;          /* implicit from ButtonPress */
-    GrabPtr activeGrab;
+    GrabPtr unused;             /* Kept for ABI stability, remove soon */
     GrabPtr grab;
     CARD8 activatingKey;
     void (*ActivateGrab) (DeviceIntPtr /*device */ ,
@@ -588,8 +588,12 @@ typedef struct _DeviceIntRec {
         XIPropertyHandlerPtr handlers;  /* NULL-terminated */
     } properties;
 
-    /* coordinate transformation matrix for absolute input devices */
-    struct pixman_f_transform transform;
+    /* coordinate transformation matrix for relative movement. Matrix with
+     * the translation component dropped */
+    struct pixman_f_transform relative_transform;
+    /* scale matrix for absolute devices, this is the combined matrix of
+       [1/scale] . [transform] . [scale]. See DeviceSetTransform */
+    struct pixman_f_transform scale_and_transform;
 
     /* XTest related master device id */
     int xtest_master_id;
index cd9a4de..53c96ba 100644 (file)
@@ -57,6 +57,7 @@ XI2Mask *xi2mask_new(void);
 XI2Mask *xi2mask_new_with_size(size_t, size_t); /* don't use it */
 void xi2mask_free(XI2Mask **mask);
 Bool xi2mask_isset(XI2Mask *mask, const DeviceIntPtr dev, int event_type);
+Bool xi2mask_isset_for_device(XI2Mask *mask, const DeviceIntPtr dev, int event_type);
 void xi2mask_set(XI2Mask *mask, int deviceid, int event_type);
 void xi2mask_zero(XI2Mask *mask, int deviceid);
 void xi2mask_merge(XI2Mask *dest, const XI2Mask *source);
index 0e54aa1..b666029 100644 (file)
@@ -32,7 +32,9 @@
 #undef DEBUG
 
 /* Have the backtrace() function. */
+#if SUPPORT_BACKTRACE
 #undef HAVE_BACKTRACE
+#endif
 
 /* Have execinfo.h for backtrace(). */
 #undef HAVE_EXECINFO_H
index 2d48a86..455c670 100644 (file)
@@ -119,7 +119,7 @@ struct xorg_list {
  *
  * @param The list to initialized.
  */
-static void
+static inline void
 xorg_list_init(struct xorg_list *list)
 {
     list->next = list->prev = list;
@@ -213,7 +213,7 @@ xorg_list_del(struct xorg_list *entry)
  *
  * @return True if the list contains one or more elements or False otherwise.
  */
-static inline Bool
+static inline int
 xorg_list_is_empty(struct xorg_list *head)
 {
     return head->next == head;
@@ -358,7 +358,7 @@ xorg_list_is_empty(struct xorg_list *head)
  * struct foo *element = list;
  * while ((element = nt_list_next(element, next)) { }
  *
- * This macro is not safe for node deletion. Use xorg_list_for_each_entry_safe
+ * This macro is not safe for node deletion. Use nt_list_for_each_entry_safe
  * instead.
  *
  * @param list The list or current element.
index 3487176..9c2f573 100644 (file)
@@ -250,6 +250,7 @@ extern char **xstrtokenize(const char *str, const char *separators);
 extern void FormatInt64(int64_t num, char *string);
 extern void FormatUInt64(uint64_t num, char *string);
 extern void FormatUInt64Hex(uint64_t num, char *string);
+extern void FormatDouble(double dbl, char *string);
 
 /**
  * Compare the two version numbers comprising of major.minor.
@@ -258,15 +259,19 @@ extern void FormatUInt64Hex(uint64_t num, char *string);
  * or a value greater than 0
  */
 static inline int
-version_compare(uint16_t a_major, uint16_t a_minor,
-                uint16_t b_major, uint16_t b_minor)
+version_compare(uint32_t a_major, uint32_t a_minor,
+                uint32_t b_major, uint32_t b_minor)
 {
-    int a, b;
+    if (a_major > b_major)
+        return 1;
+    if (a_major < b_major)
+        return -1;
+    if (a_minor > b_minor)
+        return 1;
+    if (a_minor < b_minor)
+        return -1;
 
-    a = a_major << 16 | a_minor;
-    b = b_major << 16 | b_minor;
-
-    return (a - b);
+    return 0;
 }
 
 /* some macros to help swap requests, replies, and events */
@@ -304,6 +309,35 @@ __builtin_constant_p(int x)
 }
 #endif
 
+/* byte swap a 64-bit value */
+static inline void
+swap_uint64(uint64_t *x)
+{
+    char n;
+
+    n = ((char *) x)[0];
+    ((char *) x)[0] = ((char *) x)[7];
+    ((char *) x)[7] = n;
+
+    n = ((char *) x)[1];
+    ((char *) x)[1] = ((char *) x)[6];
+    ((char *) x)[6] = n;
+
+    n = ((char *) x)[2];
+    ((char *) x)[2] = ((char *) x)[5];
+    ((char *) x)[5] = n;
+
+    n = ((char *) x)[3];
+    ((char *) x)[3] = ((char *) x)[4];
+    ((char *) x)[4] = n;
+}
+
+#define swapll(x) do { \
+               if (sizeof(*(x)) != 8) \
+                       wrong_size(); \
+                swap_uint64((uint64_t *)(x));   \
+       } while (0)
+
 /* byte swap a 32-bit value */
 static inline void
 swap_uint32(uint32_t * x)
index 0820e1e..dbab10f 100644 (file)
@@ -56,10 +56,10 @@ typedef xPoint DDXPointRec;
 typedef struct pixman_box16 BoxRec;
 
 typedef union _DevUnion {
-    pointer ptr;
+    void *ptr;
     long val;
     unsigned long uval;
-    pointer (*fptr) (void);
+    void *(*fptr) (void);
 } DevUnion;
 
 #endif                          /* MISCSTRUCT_H */
index b76ab6e..a2c54aa 100644 (file)
@@ -33,8 +33,8 @@ from The Open Group.
 
 #include "globals.h"
 
-extern _X_EXPORT char *defaultTextFont;
-extern _X_EXPORT char *defaultCursorFont;
+extern _X_EXPORT const char *defaultTextFont;
+extern _X_EXPORT const char *defaultCursorFont;
 extern _X_EXPORT int MaxClients;
 extern _X_EXPORT volatile char isItTimeToYield;
 extern _X_EXPORT volatile char dispatchException;
@@ -49,12 +49,14 @@ extern _X_EXPORT int ScreenSaverBlanking;
 extern _X_EXPORT int ScreenSaverAllowExposures;
 extern _X_EXPORT int defaultScreenSaverBlanking;
 extern _X_EXPORT int defaultScreenSaverAllowExposures;
-extern _X_EXPORT char *display;
+extern _X_EXPORT const char *display;
 extern _X_EXPORT int displayfd;
+extern _X_EXPORT Bool explicit_display;
 
 extern _X_EXPORT int defaultBackingStore;
 extern _X_EXPORT Bool disableBackingStore;
 extern _X_EXPORT Bool enableBackingStore;
+extern _X_EXPORT Bool enableIndirectGLX;
 extern _X_EXPORT Bool PartialNetwork;
 extern _X_EXPORT Bool RunFromSigStopParent;
 
@@ -74,5 +76,6 @@ extern _X_EXPORT Bool whiteRoot;
 extern _X_EXPORT Bool bgNoneRoot;
 
 extern _X_EXPORT Bool CoreDump;
+extern _X_EXPORT Bool NoListenAll;
 
 #endif                          /* OPAQUE_H */
index 9e323f3..d26e399 100644 (file)
@@ -70,12 +70,12 @@ typedef struct _NewClientRec *NewClientPtr;
 #ifndef xalloc
 #define xnfalloc(size) XNFalloc((unsigned long)(size))
 #define xnfcalloc(_num, _size) XNFcalloc((unsigned long)(_num)*(unsigned long)(_size))
-#define xnfrealloc(ptr, size) XNFrealloc((pointer)(ptr), (unsigned long)(size))
+#define xnfrealloc(ptr, size) XNFrealloc((void *)(ptr), (unsigned long)(size))
 
 #define xalloc(size) Xalloc((unsigned long)(size))
 #define xcalloc(_num, _size) Xcalloc((unsigned long)(_num)*(unsigned long)(_size))
-#define xrealloc(ptr, size) Xrealloc((pointer)(ptr), (unsigned long)(size))
-#define xfree(ptr) Xfree((pointer)(ptr))
+#define xrealloc(ptr, size) Xrealloc((void *)(ptr), (unsigned long)(size))
+#define xfree(ptr) Xfree((void *)(ptr))
 #define xstrdup(s) Xstrdup(s)
 #define xnfstrdup(s) XNFstrdup(s)
 #endif
@@ -88,7 +88,9 @@ extern void ddxBeforeReset(void);
 #endif
 
 #ifdef DDXOSVERRORF
-extern _X_EXPORT void (*OsVendorVErrorFProc) (const char *, va_list args);
+extern _X_EXPORT void (*OsVendorVErrorFProc) (const char *,
+                                              va_list args)
+_X_ATTRIBUTE_PRINTF(1, 0);
 #endif
 
 extern _X_EXPORT int WaitForSomething(int *     /*pClientsReady */
@@ -96,6 +98,12 @@ extern _X_EXPORT int WaitForSomething(int *     /*pClientsReady */
 
 extern _X_EXPORT int ReadRequestFromClient(ClientPtr /*client */ );
 
+#if XTRANS_SEND_FDS
+extern _X_EXPORT int ReadFdFromClient(ClientPtr client);
+
+extern _X_EXPORT int WriteFdToClient(ClientPtr client, int fd, Bool do_close);
+#endif
+
 extern _X_EXPORT Bool InsertFakeRequest(ClientPtr /*client */ ,
                                         char * /*data */ ,
                                         int /*count */ );
@@ -132,7 +140,7 @@ extern _X_EXPORT const char *ClientAuthorized(ClientPtr /*client */ ,
                                               char * /*auth_string */ );
 
 extern _X_EXPORT Bool EstablishNewConnections(ClientPtr /*clientUnused */ ,
-                                              pointer /*closure */ );
+                                              void */*closure */ );
 
 extern _X_EXPORT void CheckConnections(void);
 
@@ -158,20 +166,21 @@ extern _X_EXPORT void MakeClientGrabImpervious(ClientPtr /*client */ );
 
 extern _X_EXPORT void MakeClientGrabPervious(ClientPtr /*client */ );
 
-#ifdef XQUARTZ
-extern void ListenOnOpenFD(int /* fd */ , int /* noxauth */ );
-#endif
+extern _X_EXPORT void ListenOnOpenFD(int /* fd */ , int /* noxauth */ );
+
+extern _X_EXPORT Bool AddClientOnOpenFD(int /* fd */ );
 
 extern _X_EXPORT CARD32 GetTimeInMillis(void);
+extern _X_EXPORT CARD64 GetTimeInMicros(void);
 
-extern _X_EXPORT void AdjustWaitForDelay(pointer /*waitTime */ ,
+extern _X_EXPORT void AdjustWaitForDelay(void */*waitTime */ ,
                                          unsigned long /*newdelay */ );
 
 typedef struct _OsTimerRec *OsTimerPtr;
 
 typedef CARD32 (*OsTimerCallback) (OsTimerPtr /* timer */ ,
                                    CARD32 /* time */ ,
-                                   pointer /* arg */ );
+                                   void */* arg */ );
 
 extern _X_EXPORT void TimerInit(void);
 
@@ -184,7 +193,7 @@ extern _X_EXPORT OsTimerPtr TimerSet(OsTimerPtr /* timer */ ,
                                      int /* flags */ ,
                                      CARD32 /* millis */ ,
                                      OsTimerCallback /* func */ ,
-                                     pointer /* arg */ );
+                                     void */* arg */ );
 
 extern _X_EXPORT void TimerCheck(void);
 extern _X_EXPORT void TimerCancel(OsTimerPtr /* pTimer */ );
@@ -203,7 +212,7 @@ extern _X_EXPORT void ProcessCommandLine(int /*argc */ , char * /*argv */ []);
 
 extern _X_EXPORT int set_font_authorizations(char ** /* authorizations */ ,
                                              int * /*authlen */ ,
-                                             pointer /* client */ );
+                                             void */* client */ );
 
 #ifndef _HAVE_XALLOC_DECLS
 #define _HAVE_XALLOC_DECLS
@@ -350,14 +359,14 @@ OsAbort(void)
 #if !defined(WIN32)
 extern _X_EXPORT int
 System(const char *);
-extern _X_EXPORT pointer
+extern _X_EXPORT void *
 Popen(const char *, const char *);
 extern _X_EXPORT int
-Pclose(pointer);
-extern _X_EXPORT pointer
+Pclose(void *);
+extern _X_EXPORT void *
 Fopen(const char *, const char *);
 extern _X_EXPORT int
-Fclose(pointer);
+Fclose(void *);
 #else
 
 extern const char *
@@ -386,17 +395,17 @@ ForEachHostInFamily(int /*family */ ,
                     Bool (* /*func */ )(
                                            unsigned char * /* addr */ ,
                                            short /* len */ ,
-                                           pointer /* closure */ ),
-                    pointer /*closure */ );
+                                           void */* closure */ ),
+                    void */*closure */ );
 
 extern _X_EXPORT int
 RemoveHost(ClientPtr /*client */ ,
            int /*family */ ,
            unsigned /*length */ ,
-           pointer /*pAddr */ );
+           void */*pAddr */ );
 
 extern _X_EXPORT int
-GetHosts(pointer * /*data */ ,
+GetHosts(void ** /*data */ ,
          int * /*pnHosts */ ,
          int * /*pLen */ ,
          BOOL * /*pEnabled */ );
@@ -407,9 +416,6 @@ extern _X_EXPORT int
 InvalidHost(sockaddrPtr /*saddr */ , int /*len */ , ClientPtr client);
 
 extern _X_EXPORT int
-LocalClient(ClientPtr /* client */ );
-
-extern _X_EXPORT int
 LocalClientCred(ClientPtr, int *, int *);
 
 #define LCC_UID_SET    (1 << 0)
@@ -442,7 +448,7 @@ extern _X_EXPORT void
 AddLocalHosts(void);
 
 extern _X_EXPORT void
-ResetHosts(char *display);
+ResetHosts(const char *display);
 
 extern _X_EXPORT void
 EnableLocalHost(void);
@@ -458,14 +464,14 @@ DefineSelf(int /*fd */ );
 
 #if XDMCP
 extern _X_EXPORT void
-AugmentSelf(pointer /*from */ , int /*len */ );
+AugmentSelf(void */*from */ , int /*len */ );
 
 extern _X_EXPORT void
 RegisterAuthorizations(void);
 #endif
 
 extern _X_EXPORT void
-InitAuthorization(char * /*filename */ );
+InitAuthorization(const char * /*filename */ );
 
 /* extern int LoadAuthorization(void); */
 
@@ -680,4 +686,7 @@ LogPrintMarkers(void);
 extern _X_EXPORT void
 xorg_backtrace(void);
 
+extern _X_EXPORT int
+os_move_fd(int fd);
+
 #endif                          /* OS_H */
index 921a94d..46ec3f5 100644 (file)
@@ -99,7 +99,7 @@ extern _X_EXPORT PixmapPtr GetScratchPixmapHeader(ScreenPtr /*pScreen */ ,
                                                   int /*depth */ ,
                                                   int /*bitsPerPixel */ ,
                                                   int /*devKind */ ,
-                                                  pointer /*pPixData */ );
+                                                  void */*pPixData */ );
 
 extern _X_EXPORT void FreeScratchPixmapHeader(PixmapPtr /*pPixmap */ );
 
index 2a1ef9b..41e842e 100644 (file)
@@ -83,6 +83,10 @@ typedef struct _Pixmap {
     unsigned usage_hint;        /* see CREATE_PIXMAP_USAGE_* */
 
     PixmapPtr master_pixmap;    /* pointer to master copy of pixmap for pixmap sharing */
+
+#if defined (_F_PRESENT_PIXMAP_SWAP_) || defined (_F_PRESENT_HWC_FLIP_)
+    XID destroy_pixmap_id;
+#endif //_F_PRESENT_PIXMAP_SWAP_
 } PixmapRec;
 
 typedef struct _PixmapDirtyUpdate {
@@ -113,3 +117,4 @@ PixmapRegionInit(RegionPtr region, PixmapPtr pixmap)
 }
 
 #endif                          /* PIXMAPSTRUCT_H */
+
index 2c8864b..7d1461c 100644 (file)
@@ -46,7 +46,6 @@ typedef enum {
     PRIVATE_CURSOR_BITS,
 
     /* extension privates */
-    PRIVATE_DBE_WINDOW,
     PRIVATE_DAMAGE,
     PRIVATE_GLYPH,
     PRIVATE_GLYPHSET,
@@ -143,10 +142,10 @@ dixGetPrivate(PrivatePtr *privates, const DevPrivateKey key)
  * dixLookupPrivate(privates, key) will return 'val'.
  */
 static inline void
-dixSetPrivate(PrivatePtr *privates, const DevPrivateKey key, pointer val)
+dixSetPrivate(PrivatePtr *privates, const DevPrivateKey key, void *val)
 {
     assert(key->size == 0);
-    *(pointer *) dixGetPrivateAddr(privates, key) = val;
+    *(void **) dixGetPrivateAddr(privates, key) = val;
 }
 
 #include "dix.h"
@@ -159,7 +158,7 @@ dixSetPrivate(PrivatePtr *privates, const DevPrivateKey key, pointer val)
  * storage. For privates without defined storage, return the pointer
  * contents
  */
-static inline pointer
+static inline void *
 dixLookupPrivate(PrivatePtr *privates, const DevPrivateKey key)
 {
     if (key->size)
@@ -174,11 +173,11 @@ dixLookupPrivate(PrivatePtr *privates, const DevPrivateKey key)
  * This returns the place where the private pointer is stored,
  * which is only valid for privates without predefined storage.
  */
-static inline pointer *
+static inline void **
 dixLookupPrivateAddr(PrivatePtr *privates, const DevPrivateKey key)
 {
     assert(key->size == 0);
-    return (pointer *) dixGetPrivateAddr(privates, key);
+    return (void **) dixGetPrivateAddr(privates, key);
 }
 
 extern _X_EXPORT Bool
@@ -205,19 +204,19 @@ dixGetScreenPrivate(PrivatePtr *privates, const DevScreenPrivateKey key,
 
 static inline void
 dixSetScreenPrivate(PrivatePtr *privates, const DevScreenPrivateKey key,
-                    ScreenPtr pScreen, pointer val)
+                    ScreenPtr pScreen, void *val)
 {
     dixSetPrivate(privates, _dixGetScreenPrivateKey(key, pScreen), val);
 }
 
-static inline pointer
+static inline void *
 dixLookupScreenPrivate(PrivatePtr *privates, const DevScreenPrivateKey key,
                        ScreenPtr pScreen)
 {
     return dixLookupPrivate(privates, _dixGetScreenPrivateKey(key, pScreen));
 }
 
-static inline pointer *
+static inline void **
 dixLookupScreenPrivateAddr(PrivatePtr *privates, const DevScreenPrivateKey key,
                            ScreenPtr pScreen)
 {
index 4219fc4..3b8ea8b 100644 (file)
@@ -64,7 +64,7 @@ extern _X_EXPORT int dixChangeWindowProperty(ClientPtr /*pClient */ ,
                                              int /*format */ ,
                                              int /*mode */ ,
                                              unsigned long /*len */ ,
-                                             pointer /*value */ ,
+                                             void */*value */ ,
                                              Bool /*sendevent */ );
 
 extern _X_EXPORT int ChangeWindowProperty(WindowPtr /*pWin */ ,
@@ -73,7 +73,7 @@ extern _X_EXPORT int ChangeWindowProperty(WindowPtr /*pWin */ ,
                                           int /*format */ ,
                                           int /*mode */ ,
                                           unsigned long /*len */ ,
-                                          pointer /*value */ ,
+                                          void */*value */ ,
                                           Bool /*sendevent */ );
 
 extern _X_EXPORT int DeleteProperty(ClientPtr /*client */ ,
index c12c71a..da99576 100644 (file)
@@ -59,7 +59,7 @@ typedef struct _Property {
     ATOM type;                  /* ignored by server */
     uint32_t format;            /* format of data for swapping - 8,16,32 */
     uint32_t size;              /* size of data in (format/8) bytes */
-    pointer data;               /* private to client */
+    void *data;                 /* private to client */
     PrivateRec *devPrivates;
 } PropertyRec;
 
index 576329a..3b389c1 100644 (file)
 #define SERVER_DAMAGE_MAJOR_VERSION            1
 #define SERVER_DAMAGE_MINOR_VERSION            1
 
+/* DRI3 */
+#define SERVER_DRI3_MAJOR_VERSION               1
+#define SERVER_DRI3_MINOR_VERSION               0
+
 /* DMX */
 #define SERVER_DMX_MAJOR_VERSION               2
 #define SERVER_DMX_MINOR_VERSION               2
 #define SERVER_PANORAMIX_MAJOR_VERSION          1
 #define SERVER_PANORAMIX_MINOR_VERSION         1
 
+/* Present */
+#define SERVER_PRESENT_MAJOR_VERSION            1
+#define SERVER_PRESENT_MINOR_VERSION            0
+
 /* RandR */
 #define SERVER_RANDR_MAJOR_VERSION             1
-#define SERVER_RANDR_MINOR_VERSION             3
+#define SERVER_RANDR_MINOR_VERSION             4
 
 /* Record */
 #define SERVER_RECORD_MAJOR_VERSION            1
 
 /* SHM */
 #define SERVER_SHM_MAJOR_VERSION               1
+#if XTRANS_SEND_FDS
+#define SERVER_SHM_MINOR_VERSION               2
+#else
 #define SERVER_SHM_MINOR_VERSION               1
+#endif
 
 /* Sync */
 #define SERVER_SYNC_MAJOR_VERSION              3
 
 /* X Input */
 #define SERVER_XI_MAJOR_VERSION                        2
-#define SERVER_XI_MINOR_VERSION                        2
+#define SERVER_XI_MINOR_VERSION                        3
 
 /* XKB */
 #define SERVER_XKB_MAJOR_VERSION               1
index 805257b..4a0725d 100644 (file)
@@ -213,6 +213,8 @@ extern _X_EXPORT RegionPtr RegionCreate(BoxPtr /*rect */ ,
 
 extern _X_EXPORT void RegionDestroy(RegionPtr /*pReg */ );
 
+extern _X_EXPORT RegionPtr RegionDuplicate(RegionPtr /* pOld */);
+
 static inline Bool
 RegionCopy(RegionPtr dst, RegionPtr src)
 {
index f471b89..96be87a 100644 (file)
@@ -44,6 +44,7 @@ extern _X_EXPORT const char *LookupResourceName(RESTYPE rtype);
  * Setup and teardown
  */
 extern _X_EXPORT void dixResetRegistry(void);
+extern _X_EXPORT void dixFreeRegistry(void);
 
 #else                           /* XREGISTRY */
 
@@ -59,6 +60,7 @@ extern _X_EXPORT void dixResetRegistry(void);
 #define LookupResourceName(a) XREGISTRY_UNKNOWN
 
 #define dixResetRegistry() { ; }
+#define dixFreeRegistry() { ; }
 
 #endif                          /* XREGISTRY */
 #endif                          /* DIX_REGISTRY_H */
index 4a8dc31..db44aef 100644 (file)
@@ -133,24 +133,24 @@ typedef struct {
     ResourceState state;
     XID id;
     RESTYPE type;
-    pointer value;
+    void *value;
 } ResourceStateInfoRec;
 
-typedef int (*DeleteType) (pointer /*value */ ,
+typedef int (*DeleteType) (void */*value */ ,
                            XID /*id */ );
 
-typedef void (*FindResType) (pointer /*value */ ,
+typedef void (*FindResType) (void */*value */ ,
                              XID /*id */ ,
-                             pointer /*cdata */ );
+                             void */*cdata */ );
 
-typedef void (*FindAllRes) (pointer /*value */ ,
+typedef void (*FindAllRes) (void */*value */ ,
                             XID /*id */ ,
                             RESTYPE /*type */ ,
-                            pointer /*cdata */ );
+                            void */*cdata */ );
 
-typedef Bool (*FindComplexResType) (pointer /*value */ ,
+typedef Bool (*FindComplexResType) (void */*value */ ,
                                     XID /*id */ ,
-                                    pointer /*cdata */ );
+                                    void */*cdata */ );
 
 /* Structure for estimating resource memory usage. Memory usage
  * consists of space allocated for the resource itself and of
@@ -166,16 +166,16 @@ typedef struct {
     unsigned long refCnt;
 } ResourceSizeRec, *ResourceSizePtr;
 
-typedef void (*SizeType)(pointer /*value*/,
+typedef void (*SizeType)(void */*value*/,
                          XID /*id*/,
                          ResourceSizePtr /*size*/);
 
 extern _X_EXPORT RESTYPE CreateNewResourceType(DeleteType /*deleteFunc */ ,
                                                const char * /*name */ );
 
-typedef void (*FindTypeSubResources)(pointer /* value */,
+typedef void (*FindTypeSubResources)(void */* value */,
                                      FindAllRes /* func */,
-                                     pointer /* cdata */);
+                                     void */* cdata */);
 
 extern _X_EXPORT SizeType GetResourceTypeSizeFunc(
     RESTYPE /*type*/);
@@ -202,7 +202,7 @@ extern _X_EXPORT XID FakeClientID(int /*client */ );
 #endif
 extern _X_EXPORT Bool AddResource(XID /*id */ ,
                                   RESTYPE /*type */ ,
-                                  pointer /*value */ );
+                                  void */*value */ );
 
 extern _X_EXPORT void FreeResource(XID /*id */ ,
                                    RESTYPE /*skipDeleteFuncType */ );
@@ -213,25 +213,25 @@ extern _X_EXPORT void FreeResourceByType(XID /*id */ ,
 
 extern _X_EXPORT Bool ChangeResourceValue(XID /*id */ ,
                                           RESTYPE /*rtype */ ,
-                                          pointer /*value */ );
+                                          void */*value */ );
 
 extern _X_EXPORT void FindClientResourcesByType(ClientPtr /*client */ ,
                                                 RESTYPE /*type */ ,
                                                 FindResType /*func */ ,
-                                                pointer /*cdata */ );
+                                                void */*cdata */ );
 
 extern _X_EXPORT void FindAllClientResources(ClientPtr /*client */ ,
                                              FindAllRes /*func */ ,
-                                             pointer /*cdata */ );
+                                             void */*cdata */ );
 
 /** @brief Iterate through all subresources of a resource.
 
     @note The XID argument provided to the FindAllRes function
           may be 0 for subresources that don't have an XID */
-extern _X_EXPORT void FindSubResources(pointer /*resource*/,
+extern _X_EXPORT void FindSubResources(void */*resource*/,
                                        RESTYPE /*type*/,
                                        FindAllRes /*func*/,
-                                       pointer /*cdata*/);
+                                       void */*cdata*/);
 
 extern _X_EXPORT void FreeClientNeverRetainResources(ClientPtr /*client */ );
 
@@ -242,18 +242,18 @@ extern _X_EXPORT void FreeAllResources(void);
 extern _X_EXPORT Bool LegalNewID(XID /*id */ ,
                                  ClientPtr /*client */ );
 
-extern _X_EXPORT pointer LookupClientResourceComplex(ClientPtr client,
+extern _X_EXPORT void *LookupClientResourceComplex(ClientPtr client,
                                                      RESTYPE type,
                                                      FindComplexResType func,
-                                                     pointer cdata);
+                                                     void *cdata);
 
-extern _X_EXPORT int dixLookupResourceByType(pointer *result,
+extern _X_EXPORT int dixLookupResourceByType(void **result,
                                              XID id,
                                              RESTYPE rtype,
                                              ClientPtr client,
                                              Mask access_mode);
 
-extern _X_EXPORT int dixLookupResourceByClass(pointer *result,
+extern _X_EXPORT int dixLookupResourceByClass(void **result,
                                               XID id,
                                               RESTYPE rclass,
                                               ClientPtr client,
index d63768a..7597ebe 100644 (file)
@@ -262,12 +262,12 @@ typedef void (*SendGraphicsExposeProcPtr) (ClientPtr /*client */ ,
                                            int /*minor */ );
 
 typedef void (*ScreenBlockHandlerProcPtr) (ScreenPtr /*pScreen*/ ,
-                                           pointer /*pTimeout */ ,
-                                           pointer /*pReadmask */ );
+                                           void */*pTimeout */ ,
+                                           void */*pReadmask */ );
 
 typedef void (*ScreenWakeupHandlerProcPtr) (ScreenPtr /*pScreen*/ ,
                                             unsigned long /*result */ ,
-                                            pointer /*pReadMask */ );
+                                            void */*pReadMask */ );
 
 typedef Bool (*CreateScreenResourcesProcPtr) (ScreenPtr /*pScreen */ );
 
@@ -277,7 +277,7 @@ typedef Bool (*ModifyPixmapHeaderProcPtr) (PixmapPtr /*pPixmap */ ,
                                            int /*depth */ ,
                                            int /*bitsPerPixel */ ,
                                            int /*devKind */ ,
-                                           pointer /*pPixData */ );
+                                           void */*pPixData */ );
 
 typedef PixmapPtr (*GetWindowPixmapProcPtr) (WindowPtr /*pWin */ );
 
@@ -355,6 +355,17 @@ typedef Bool (*StopPixmapTrackingProcPtr)(PixmapPtr, PixmapPtr);
 
 typedef Bool (*ReplaceScanoutPixmapProcPtr)(DrawablePtr, PixmapPtr, Bool);
 
+typedef WindowPtr (*XYToWindowProcPtr)(ScreenPtr pScreen,
+                                       SpritePtr pSprite, int x, int y);
+
+typedef int (*NameWindowPixmapProcPtr)(WindowPtr, PixmapPtr, CARD32);
+
+#ifdef _F_ADD_HOOK_PROC_COMP_REDIRECT_UNREDIRECT_
+typedef int (*CompRedirectWindowProcPtr) (WindowPtr pWin, int update);
+
+typedef int (*CompUnredirectWindowProcPtr) (WindowPtr pWin, int update);
+#endif //_F_ADD_HOOK_PROC_COMP_REDIRECT_UNREDIRECT_
+
 typedef struct _Screen {
     int myNum;                  /* index of this instance in Screens[] */
     ATOM id;
@@ -377,7 +388,7 @@ typedef struct _Screen {
        a standard one.
      */
     PixmapPtr PixmapPerDepth[1];
-    pointer devPrivate;
+    void *devPrivate;
     short numVisuals;
     VisualPtr visuals;
     WindowPtr root;
@@ -465,6 +476,7 @@ typedef struct _Screen {
     SetWindowPixmapProcPtr SetWindowPixmap;
     GetScreenPixmapProcPtr GetScreenPixmap;
     SetScreenPixmapProcPtr SetScreenPixmap;
+    NameWindowPixmapProcPtr NameWindowPixmap;
 
     PixmapPtr pScratchPixmap;   /* scratch pixmap "pool" */
 
@@ -515,6 +527,13 @@ typedef struct _Screen {
     struct xorg_list offload_head;
 
     ReplaceScanoutPixmapProcPtr ReplaceScanoutPixmap;
+    XYToWindowProcPtr XYToWindow;
+
+#ifdef _F_ADD_HOOK_PROC_COMP_REDIRECT_UNREDIRECT_
+    CompRedirectWindowProcPtr ProcCompRedirectWindow;
+    CompUnredirectWindowProcPtr ProcCompUnredirectWindow;
+#endif //_F_ADD_HOOK_PROC_COMP_REDIRECT_UNREDIRECT_
+
 } ScreenRec;
 
 static inline RegionPtr
index d6a9a3a..e413314 100644 (file)
@@ -114,8 +114,13 @@ SOFTWARE.
 
 #if defined(__powerpc__) || defined(__ppc__) || defined(__ppc64__)
 
-#define IMAGE_BYTE_ORDER        MSBFirst
-#define BITMAP_BIT_ORDER        MSBFirst
+#if defined(__LITTLE_ENDIAN__)
+#define IMAGE_BYTE_ORDER      LSBFirst
+#define BITMAP_BIT_ORDER      LSBFirst
+#else
+#define IMAGE_BYTE_ORDER      MSBFirst
+#define BITMAP_BIT_ORDER      MSBFirst
+#endif
 #define GLYPHPADBYTES           4
 
 #endif                          /* PowerPC */
@@ -286,6 +291,47 @@ SOFTWARE.
 #define GLYPHPADBYTES          4
 #endif                          /* linux/s390 */
 
+#ifdef __aarch64__
+
+#ifdef __AARCH64EL__
+#define IMAGE_BYTE_ORDER        LSBFirst
+#define BITMAP_BIT_ORDER        LSBFirst
+#endif
+#ifdef __AARCH64EB__
+#define IMAGE_BYTE_ORDER        MSBFirst
+#define BITMAP_BIT_ORDER        MSBFirst
+#endif
+#define GLYPHPADBYTES           4
+
+#endif                          /* __aarch64__ */
+
+#if defined(__arc__)
+
+#if defined(__BIG_ENDIAN__)
+#define IMAGE_BYTE_ORDER       MSBFirst
+#define BITMAP_BIT_ORDER       MSBFirst
+#else
+#define IMAGE_BYTE_ORDER       LSBFirst
+#define BITMAP_BIT_ORDER       LSBFirst
+#endif
+#define GLYPHPADBYTES          4
+
+#endif                          /* ARC */
+
+#ifdef __xtensa__
+
+#ifdef __XTENSA_EL__
+#define IMAGE_BYTE_ORDER        LSBFirst
+#define BITMAP_BIT_ORDER        LSBFirst
+#endif
+#ifdef __XTENSA_EB__
+#define IMAGE_BYTE_ORDER        MSBFirst
+#define BITMAP_BIT_ORDER        MSBFirst
+#endif
+#define GLYPHPADBYTES           4
+
+#endif                          /* __xtensa__ */
+
 /* size of buffer to use with GetImage, measured in bytes. There's obviously
  * a trade-off between the amount of heap used and the number of times the
  * ddx routine has to be called.
diff --git a/include/systemd-logind.h b/include/systemd-logind.h
new file mode 100644 (file)
index 0000000..a4067d0
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * Copyright Â© 2013 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * 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.
+ *
+ * Author: Hans de Goede <hdegoede@redhat.com>
+ */
+
+#ifndef SYSTEMD_LOGIND_H
+#define SYSTEMD_LOGIND_H
+
+#ifdef SYSTEMD_LOGIND
+int systemd_logind_init(void);
+void systemd_logind_fini(void);
+int systemd_logind_take_fd(int major, int minor, const char *path, Bool *paus);
+void systemd_logind_release_fd(int major, int minor, int fd);
+int systemd_logind_controls_session(void);
+void systemd_logind_vtenter(void);
+#else
+#define systemd_logind_init()
+#define systemd_logind_fini()
+#define systemd_logind_take_fd(major, minor, path, paus) -1
+#define systemd_logind_release_fd(major, minor, fd) close(fd)
+#define systemd_logind_controls_session() 0
+#define systemd_logind_vtenter()
+#endif
+
+#endif
index 8eb6533..b5a937e 100644 (file)
@@ -26,13 +26,13 @@ Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
 
                         All Rights Reserved
 
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
+Permission to use, copy, modify, and distribute this software and its 
+documentation for any purpose and without fee is hereby granted, 
 provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
+both that copyright notice and this permission notice appear in 
 supporting documentation, and that the name of Digital not be
 used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
+software without specific, written prior permission.  
 
 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
@@ -73,15 +73,15 @@ typedef struct _BackingStore *BackingStorePtr;
 typedef struct _Window *WindowPtr;
 
 typedef int (*VisitWindowProcPtr) (WindowPtr /*pWin */ ,
-                                   pointer /*data */ );
+                                   void */*data */ );
 
 extern _X_EXPORT int TraverseTree(WindowPtr /*pWin */ ,
                                   VisitWindowProcPtr /*func */ ,
-                                  pointer /*data */ );
+                                  void */*data */ );
 
 extern _X_EXPORT int WalkTree(ScreenPtr /*pScreen */ ,
                               VisitWindowProcPtr /*func */ ,
-                              pointer /*data */ );
+                              void */*data */ );
 
 extern _X_EXPORT Bool CreateRootWindow(ScreenPtr /*pScreen */ );
 
@@ -108,7 +108,7 @@ extern _X_EXPORT WindowPtr CreateWindow(Window /*wid */ ,
                                         VisualID /*visual */ ,
                                         int * /*error */ );
 
-extern _X_EXPORT int DeleteWindow(pointer /*pWin */ ,
+extern _X_EXPORT int DeleteWindow(void */*pWin */ ,
                                   XID /*wid */ );
 
 extern _X_EXPORT int DestroySubwindows(WindowPtr /*pWin */ ,
@@ -221,9 +221,6 @@ extern _X_EXPORT RegionPtr CreateBoundingShape(WindowPtr /* pWin */ );
 
 extern _X_EXPORT RegionPtr CreateClipShape(WindowPtr /* pWin */ );
 
-extern _X_EXPORT void DisableMapUnmapEvents(WindowPtr /* pWin */ );
-extern _X_EXPORT void EnableMapUnmapEvents(WindowPtr /* pWin */ );
-
 extern _X_EXPORT void SetRootClip(ScreenPtr pScreen, Bool enable);
 extern _X_EXPORT void PrintWindowTree(void);
 
index 9caafba..6b79bbd 100644 (file)
@@ -86,8 +86,8 @@ typedef struct _WindowOpt {
     struct _OtherClients *otherClients; /* default: NULL */
     struct _GrabRec *passiveGrabs;      /* default: NULL */
     PropertyPtr userProps;      /* default: NULL */
-    unsigned long backingBitPlanes;     /* default: ~0L */
-    unsigned long backingPixel; /* default: 0 */
+    CARD32 backingBitPlanes;    /* default: ~0L */
+    CARD32 backingPixel;        /* default: 0 */
     RegionPtr boundingShape;    /* default: NULL */
     RegionPtr clipShape;        /* default: NULL */
     RegionPtr inputShape;       /* default: NULL */
@@ -144,7 +144,7 @@ typedef struct _Window {
     Mask eventMask;             /* mask from the creating client */
     PixUnion background;
     PixUnion border;
-    pointer backStorage;        /* null when BS disabled */
+    void *backStorage;          /* null when BS disabled */
     WindowOptPtr optional;
     unsigned backgroundState:2; /* None, Relative, Pixel, Pixmap */
     unsigned borderIsPixel:1;
index d217318..ab5b4b2 100644 (file)
@@ -38,32 +38,32 @@ typedef struct _XkbRMLVOSet {
 } XkbRMLVOSet;
 
 typedef struct _XkbRF_VarDefs {
-    char *model;
-    char *layout;
-    char *variant;
-    char *options;
+    const char *model;
+    const char *layout;
+    const char *variant;
+    const char *options;
 } XkbRF_VarDefsRec, *XkbRF_VarDefsPtr;
 
 typedef struct _XkbRF_Rule {
     int number;
     int layout_num;
     int variant_num;
-    char *model;
-    char *layout;
-    char *variant;
-    char *option;
+    const char *model;
+    const char *layout;
+    const char *variant;
+    const char *option;
     /* yields */
-    char *keycodes;
-    char *symbols;
-    char *types;
-    char *compat;
-    char *geometry;
+    const char *keycodes;
+    const char *symbols;
+    const char *types;
+    const char *compat;
+    const char *geometry;
     unsigned flags;
 } XkbRF_RuleRec, *XkbRF_RulePtr;
 
 typedef struct _XkbRF_Group {
     int number;
-    char *name;
+    const char *name;
     char *words;
 } XkbRF_GroupRec, *XkbRF_GroupPtr;
 
index 7b17282..951494f 100644 (file)
@@ -171,6 +171,7 @@ typedef struct _XkbSrvInfo {
     KeyCode mouseKey;
     KeyCode inactiveKey;
     KeyCode slowKey;
+    KeyCode slowKeyEnableKey;
     KeyCode repeatKey;
     CARD8 krgTimerActive;
     CARD8 beepType;
@@ -280,7 +281,7 @@ extern _X_EXPORT DevPrivateKeyRec xkbDevicePrivateKeyRec;
 
 #define XKBDEVICEINFO(dev) ((xkbDeviceInfoPtr)dixLookupPrivate(&(dev)->devPrivates, xkbDevicePrivateKey))
 
-extern void xkbUnwrapProc(DeviceIntPtr, DeviceHandleProc, pointer);
+extern void xkbUnwrapProc(DeviceIntPtr, DeviceHandleProc, void *);
 
 /***====================================================================***/
 
@@ -599,7 +600,7 @@ extern _X_EXPORT void XkbHandleBell(BOOL /* force */ ,
                                     BOOL /* eventOnly */ ,
                                     DeviceIntPtr /* kbd */ ,
                                     CARD8 /* percent */ ,
-                                    pointer /* ctrl */ ,
+                                    void */* ctrl */ ,
                                     CARD8 /* class */ ,
                                     Atom /* name */ ,
                                     WindowPtr /* pWin */ ,
@@ -637,6 +638,10 @@ extern _X_EXPORT void XkbHandleActions(DeviceIntPtr /* dev */ ,
                                        DeviceEvent *    /* event */
     );
 
+extern void XkbPushLockedStateToSlaves(DeviceIntPtr /* master */,
+                                       int /* evtype */,
+                                       int /* key */);
+
 extern _X_EXPORT Bool XkbEnableDisableControls(XkbSrvInfoPtr /* xkbi */ ,
                                                unsigned long /* change */ ,
                                                unsigned long /* newValues */ ,
@@ -737,6 +742,14 @@ extern _X_EXPORT void XkbClearAllLatchesAndLocks(DeviceIntPtr /* dev */ ,
                                                  XkbEventCausePtr       /* cause */
     );
 
+extern _X_EXPORT void XkbInitRules(XkbRMLVOSet * /* rmlvo   */,
+                                   const char *  /* rules   */,
+                                   const char *  /* model   */,
+                                   const char *  /* layout  */,
+                                   const char *  /* variant */,
+                                   const char *  /* options */
+    ) ;
+
 extern _X_EXPORT void XkbGetRulesDflts(XkbRMLVOSet *    /* rmlvo */
     );
 
@@ -750,6 +763,9 @@ extern _X_EXPORT void XkbSetRulesDflts(XkbRMLVOSet *    /* rmlvo */
 extern _X_EXPORT void XkbDeleteRulesDflts(void
     );
 
+extern _X_EXPORT void XkbDeleteRulesUsed(void
+    );
+
 extern _X_EXPORT int SProcXkbDispatch(ClientPtr /* client */
     );
 
@@ -808,8 +824,11 @@ extern _X_EXPORT void XkbSendNewKeyboardNotify(DeviceIntPtr /* kbd */ ,
 extern Bool XkbCopyKeymap(XkbDescPtr /* dst */ ,
                           XkbDescPtr /* src */ );
 
-extern _X_EXPORT Bool XkbCopyDeviceKeymap(DeviceIntPtr /* dst */ ,
-                                          DeviceIntPtr /* src */ );
+extern _X_EXPORT Bool XkbCopyDeviceKeymap(DeviceIntPtr /* dst */,
+                                         DeviceIntPtr /* src */);
+
+extern _X_EXPORT Bool XkbDeviceApplyKeymap(DeviceIntPtr /* dst */ ,
+                                           XkbDescPtr /* src */ );
 
 extern void XkbFilterEvents(ClientPtr /* pClient */ ,
                             int /* nEvents */ ,
@@ -825,6 +844,9 @@ extern void XkbFakeDeviceButton(DeviceIntPtr /* dev */ ,
                                 int /* press */ ,
                                 int /* button */ );
 
+extern _X_EXPORT void XkbCopyControls(XkbDescPtr /* dst */ ,
+                                      XkbDescPtr /* src */ );
+
 #include "xkbfile.h"
 #include "xkbrules.h"
 
@@ -835,33 +857,16 @@ extern void XkbFakeDeviceButton(DeviceIntPtr /* dev */ ,
 #define        _XkbListGeometry        4
 #define        _XkbListNumComponents   5
 
-typedef struct _XkbSrvListInfo {
-    int szPool;
-    int nPool;
-    char *pool;
-
-    int maxRtrn;
-    int nTotal;
-
-    char *pattern[_XkbListNumComponents];
-    int nFound[_XkbListNumComponents];
-} XkbSrvListInfoRec, *XkbSrvListInfoPtr;
-
-extern _X_EXPORT Status XkbDDXList(DeviceIntPtr /* dev */ ,
-                                   XkbSrvListInfoPtr /* listing */ ,
-                                   ClientPtr    /* client */
-    );
-
 extern _X_EXPORT unsigned int XkbDDXLoadKeymapByNames(DeviceIntPtr /* keybd */ ,
                                                       XkbComponentNamesPtr
                                                       /* names */ ,
                                                       unsigned int /* want */ ,
                                                       unsigned int /* need */ ,
-                                                      XkbDescPtr *xkbRtrn,
-                                                      char *path_name);
+                                                      XkbDescPtr * /* xkbRtrn */ ,
+                                                      char * /* path_name */);
 
 extern _X_EXPORT Bool XkbDDXNamesFromRules(DeviceIntPtr /* keybd */ ,
-                                           char * /* rules */ ,
+                                           const char * /* rules */ ,
                                            XkbRF_VarDefsPtr /* defs */ ,
                                            XkbComponentNamesPtr /* names */
     );
@@ -870,4 +875,8 @@ extern _X_EXPORT XkbDescPtr XkbCompileKeymap(DeviceIntPtr /* dev */ ,
                                              XkbRMLVOSet *      /* rmlvo */
     );
 
+extern _X_EXPORT XkbDescPtr XkbCompileKeymapFromString(DeviceIntPtr dev,
+                                                      const char *keymap,
+                                                      int keymap_length);
+
 #endif                          /* _XKBSRV_H_ */
index 6f72fea..345e6ab 100644 (file)
@@ -1,5 +1,5 @@
 /* xorg-config.h.in: not at all generated.                      -*- c -*-
- * 
+ *
  * This file differs from xorg-server.h.in in that -server is installed
  * with the rest of the SDK for external drivers/modules to use, whereas
  * -config is for internal use only (i.e. building the DDX).
 /* Path to installed libraries. */
 #undef DEFAULT_LIBRARY_PATH
 
-/* Path to server log file. */
+/* Default log location */
+#undef DEFAULT_LOGDIR
+
+/* Default logfile prefix */
 #undef DEFAULT_LOGPREFIX
 
+/* Default XDG_DATA dir under HOME */
+#undef DEFAULT_XDG_DATA_HOME
+
+/* Default log dir under XDG_DATA_HOME */
+#undef DEFAULT_XDG_DATA_HOME_LOGDIR
+
 /* Building DRI-capable DDX. */
 #undef XF86DRI
 
 #undef HAS_APERTURE_DRV
 
 /* Has backtrace support */
+#if SUPPORT_BACKTRACE
 #undef HAVE_BACKTRACE
+#endif
 
 /* Name of the period field in struct kbd_repeat */
 #undef LNX_KBD_PERIOD_NAME
 /* Have execinfo.h */
 #undef HAVE_EXECINFO_H
 
+/* Define to 1 if you have the <sys/mkdev.h> header file. */
+#undef HAVE_SYS_MKDEV_H
+
 /* Path to text files containing PCI IDs */
 #undef PCI_TXT_IDS_PATH
 
 /* Support HWC extension */
 #undef HWC
 
+/* Support HWA extension */
+#undef HWA
+
+/* Support Container extension */
+#undef CONTAINER
+
+/* Define to 1 if you have the `seteuid' function. */
+#undef HAVE_SETEUID
+
+/* Support APM/ACPI power management in the server */
+#undef XF86PM
+
 #endif /* _XORG_CONFIG_H_ */
index 312fb20..949c8b8 100644 (file)
 /* Support Composite Extension */
 #undef COMPOSITE
 
+/* Support Container Extension */
+#undef CONTAINER
+
 /* Build DPMS extension */
 #undef DPMSExtension
 
+/* Build DRI3 extension */
+#undef DRI3
+
+/* Support HWC extension */
+#undef HWC
+
+/* Support HWA extension */
+#undef HWA
+
 /* Build GLX extension */
 #undef GLXEXT
 
@@ -67,6 +79,9 @@
 /* Internal define for Xinerama */
 #undef PANORAMIX
 
+/* Support Present extension */
+#undef PRESENT
+
 /* Support RANDR extension */
 #undef RANDR
 
 #define _XSERVER64 1
 #endif
 
-/* Support HWC extension */
-#undef HWC
+/* Have support for X shared memory fence library (xshmfence) */
+#undef HAVE_XSHMFENCE
+
+/* Use XTrans FD passing support */
+#undef XTRANS_SEND_FDS
+
+/* Ask fontsproto to make font path element names const */
+#define FONT_PATH_ELEMENT_NAME_CONST    1
 
 #endif /* _XORG_SERVER_H_ */
old mode 100644 (file)
new mode 100755 (executable)
index 23bb3b7..0ff982d
 #define AXIS_LABEL_PROP_ABS_MT_BLOB_ID     "Abs MT Blob ID"
 #define AXIS_LABEL_PROP_ABS_MT_TRACKING_ID "Abs MT Tracking ID"
 #define AXIS_LABEL_PROP_ABS_MT_PRESSURE    "Abs MT Pressure"
+#define AXIS_LABEL_PROP_ABS_MT_DISTANCE    "Abs MT Distance"
+#define AXIS_LABEL_PROP_ABS_MT_TOOL_X      "Abs MT Tool X"
+#define AXIS_LABEL_PROP_ABS_MT_TOOL_Y      "Abs MT Tool Y"
 #define AXIS_LABEL_PROP_ABS_MISC        "Abs Misc"
+
+//#ifdef  _F_SET_PROPERTY_MT_
 #define AXIS_LABEL_PROP_ABS_MT_SLOT "Abs MT Slot"
 #define AXIS_LABEL_PROP_ABS_MT_DISTANCE "Abs MT Distance"
 #define AXIS_LABEL_PROP_ABS_MT_ANGLE "Abs MT Angle/MT Component"
 #define AXIS_LABEL_PROP_ABS_MT_PALM "Abs MT Palm/MT Sumsize"
+//#endif //_F_SET_PROPERTY_MT_
 
 /* Button names */
 #define BTN_LABEL_PROP "Button Labels"
index 8122f55..176c019 100644 (file)
@@ -26,8 +26,8 @@
 /* Vendor web address for support */
 #undef __VENDORDWEBSUPPORT__
 
-/* Location of system.XWinrc */
-#undef SYSCONFDIR
-
 /* Default log location */
 #undef DEFAULT_LOGDIR
+
+/* Whether we should re-locate the root to where the executable lives */
+#undef RELOCATE_PROJECTROOT
index 237fdcd..5768775 100644 (file)
@@ -28,7 +28,7 @@ AC_DEFUN([XORG_TLS], [
         ac_cv_tls=none
         keywords="__thread __declspec(thread)"
         for kw in $keywords ; do
-            AC_TRY_COMPILE([int $kw test;], [], ac_cv_tls=$kw)
+            AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[int $kw test;]], [])], ac_cv_tls=$kw ; break ;)
         done
     ])
     AC_MSG_RESULT($ac_cv_tls)
@@ -38,7 +38,7 @@ AC_DEFUN([XORG_TLS], [
         AC_CACHE_VAL(ac_cv_tls_model, [
             save_CFLAGS="$CFLAGS"
             CFLAGS="$CFLAGS $STRICT_CFLAGS"
-            AC_TRY_COMPILE([int $ac_cv_tls __attribute__((tls_model("initial-exec"))) test;], [],
+            AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[int $ac_cv_tls __attribute__((tls_model("initial-exec"))) test;]], [])],
                            ac_cv_tls_model=yes, ac_cv_tls_model=no)
             CFLAGS="$save_CFLAGS"
         ])
index 8d243d6..7a74e85 100644 (file)
@@ -130,7 +130,7 @@ causes the server to generate a core dump on fatal errors.
 .B \-displayfd \fIfd\fP
 specifies a file descriptor in the launching process.  Rather than specify
 a display number, the X server will attempt to listen on successively higher
-display numbers, and upon finding a free one, will write the port number back
+display numbers, and upon finding a free one, will write the display number back
 on this file descriptor as a newline-terminated string.  The \-pn option is
 ignored when using \-displayfd.
 .TP 8
@@ -223,9 +223,8 @@ turns on auto-repeat.
 .B -retro
 starts the stipple with the classic stipple and cursor visible.  The default
 is to start with a black root window, and to suppress display of the cursor
-until the first time an application calls XDefineCursor().  For the Xorg
-server, this also sets the default for the DontZap option to FALSE.  For
-kdrive servers, this implies -zap.
+until the first time an application calls XDefineCursor(). For kdrive
+servers, this implies -zap.
 .TP 8
 .B \-s \fIminutes\fP
 sets screen-saver timeout time in minutes.
index dfd6719..648210b 100644 (file)
@@ -31,6 +31,7 @@ MAN_SUBSTS +=         -e 's|__logdir__|$(logdir)|g' \
                -e 's|__XKB_DFLT_OPTIONS__|$(XKB_DFLT_OPTIONS)|g' \
                -e 's|__bundle_id_prefix__|$(BUNDLE_ID_PREFIX)|g' \
                -e 's|__modulepath__|$(DEFAULT_MODULE_PATH)|g' \
+               -e 's|__suid_wrapper_dir__|$(SUID_WRAPPER_DIR)|g' \
                -e 's|__default_font_path__|$(COMPILEDDEFAULTFONTPATH)|g' \
                -e '\|$(COMPILEDDEFAULTFONTPATH)| s|/,|/, |g'
 
index 96ceeaa..0cef779 100644 (file)
@@ -1,7 +1,7 @@
 noinst_LTLIBRARIES = libmi.la
 
 if XORG
-sdk_HEADERS = micmap.h miline.h mipointer.h mi.h mibstore.h \
+sdk_HEADERS = micmap.h miline.h mipointer.h mi.h \
               migc.h mipointrst.h mizerarc.h micoord.h mifillarc.h \
               mispans.h miwideline.h mistruct.h mifpoly.h mioverlay.h
 endif
@@ -12,7 +12,6 @@ libmi_la_SOURCES =    \
        mi.h            \
        miarc.c         \
        mibitblt.c      \
-       mibstore.h      \
        micmap.c        \
        micmap.h        \
        micoord.h       \
diff --git a/mi/mi.h b/mi/mi.h
old mode 100644 (file)
new mode 100755 (executable)
index 20df51b..80e9929
--- a/mi/mi.h
+++ b/mi/mi.h
@@ -26,13 +26,13 @@ Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
 
                         All Rights Reserved
 
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
+Permission to use, copy, modify, and distribute this software and its 
+documentation for any purpose and without fee is hereby granted, 
 provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
+both that copyright notice and this permission notice appear in 
 supporting documentation, and that the name of Digital not be
 used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
+software without specific, written prior permission.  
 
 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
@@ -216,6 +216,7 @@ void _X_EXPORT mieqSetHandler(int event, mieqHandler handler);
 
 /* miexpose.c */
 
+//#ifdef _F_SNIFF_MIEQ_
 typedef struct _Event {
     InternalEvent *events;
     ScreenPtr pScreen;
@@ -235,6 +236,7 @@ typedef struct _EventQueue {
 extern _X_EXPORT EventQueuePtr mieqGetEventQueuePtr();
 
 extern _X_EXPORT size_t mieqNumEnqueued(EventQueuePtr eventQueue);
+//#endif //_F_SNIFF_MIEQ_
 
 extern _X_EXPORT RegionPtr miHandleExposures(DrawablePtr /*pSrcDrawable */ ,
                                              DrawablePtr /*pDstDrawable */ ,
@@ -291,7 +293,7 @@ extern _X_EXPORT void miPolyGlyphBlt(DrawablePtr /*pDrawable */ ,
                                      int /*y */ ,
                                      unsigned int /*nglyph */ ,
                                      CharInfoPtr * /*ppci */ ,
-                                     pointer    /*pglyphBase */
+                                     void */*pglyphBase */
     );
 
 extern _X_EXPORT void miImageGlyphBlt(DrawablePtr /*pDrawable */ ,
@@ -300,7 +302,7 @@ extern _X_EXPORT void miImageGlyphBlt(DrawablePtr /*pDrawable */ ,
                                       int /*y */ ,
                                       unsigned int /*nglyph */ ,
                                       CharInfoPtr * /*ppci */ ,
-                                      pointer   /*pglyphBase */
+                                      void */*pglyphBase */
     );
 
 /* mipoly.c */
@@ -407,7 +409,7 @@ extern _X_EXPORT Bool miModifyPixmapHeader(PixmapPtr /*pPixmap */ ,
                                            int /*depth */ ,
                                            int /*bitsPerPixel */ ,
                                            int /*devKind */ ,
-                                           pointer      /*pPixData */
+                                           void */*pPixData */
     );
 
 extern _X_EXPORT Bool miCreateScreenResources(ScreenPtr /*pScreen */
@@ -415,11 +417,11 @@ extern _X_EXPORT Bool miCreateScreenResources(ScreenPtr /*pScreen */
 
 extern _X_EXPORT Bool miScreenDevPrivateInit(ScreenPtr /*pScreen */ ,
                                              int /*width */ ,
-                                             pointer    /*pbits */
+                                             void */*pbits */
     );
 
 extern _X_EXPORT Bool miScreenInit(ScreenPtr /*pScreen */ ,
-                                   pointer /*pbits */ ,
+                                   void */*pbits */ ,
                                    int /*xsize */ ,
                                    int /*ysize */ ,
                                    int /*dpix */ ,
@@ -527,6 +529,10 @@ extern _X_EXPORT void miMarkUnrealizedWindow(WindowPtr /*pChild */ ,
 extern _X_EXPORT void miSegregateChildren(WindowPtr pWin, RegionPtr pReg,
                                           int depth);
 
+extern _X_EXPORT WindowPtr miSpriteTrace(SpritePtr pSprite, int x, int y);
+
+extern _X_EXPORT WindowPtr miXYToWindow(ScreenPtr pScreen, SpritePtr pSprite, int x, int y);
+
 /* mizerarc.c */
 
 extern _X_EXPORT void miZeroPolyArc(DrawablePtr /*pDraw */ ,
index 0f6448b..0f56c7d 100644 (file)
@@ -1489,7 +1489,7 @@ miGetArcPts(SppArcPtr parc,     /* points to an arc */
     count++;
 
     cdt = 2 * miDcos(dt);
-    if (!(poly = (SppPointPtr) realloc((pointer) *ppPts,
+    if (!(poly = (SppPointPtr) realloc((void *) *ppPts,
                                        (cpt + count) * sizeof(SppPointRec))))
         return 0;
     *ppPts = poly;
index b9873c1..3ed4ed1 100644 (file)
@@ -614,7 +614,7 @@ miGetImage(DrawablePtr pDraw, int sx, int sy, int w, int h,
     if (format == ZPixmap) {
         if ((((1LL << depth) - 1) & planeMask) != (1LL << depth) - 1) {
             ChangeGCVal gcv;
-            xPoint pt;
+            xPoint xpt;
 
             pGC = GetScratchGC(depth, pDraw->pScreen);
             if (!pGC)
@@ -629,9 +629,9 @@ miGetImage(DrawablePtr pDraw, int sx, int sy, int w, int h,
              * Clear the pixmap before doing anything else
              */
             ValidateGC((DrawablePtr) pPixmap, pGC);
-            pt.x = pt.y = 0;
+            xpt.x = xpt.y = 0;
             width = w;
-            (*pGC->ops->FillSpans) ((DrawablePtr) pPixmap, pGC, 1, &pt, &width,
+            (*pGC->ops->FillSpans) ((DrawablePtr) pPixmap, pGC, 1, &xpt, &width,
                                     TRUE);
 
             /* alu is already GXCopy */
@@ -730,7 +730,7 @@ miPutImage(DrawablePtr pDraw, GCPtr pGC, int depth,
         ChangeGC(NullClient, pGC, GCForeground | GCBackground, gcv);
         bytesPer = (long) h *BitmapBytePad(w + leftPad);
 
-        for (i = 1 << (depth - 1); i != 0; i >>= 1, pImage += bytesPer) {
+        for (i = (unsigned long) 1 << (depth - 1); i != 0; i >>= 1, pImage += bytesPer) {
             if (i & oldPlanemask) {
                 gcv[0].val = (XID) i;
                 ChangeGC(NullClient, pGC, GCPlaneMask, gcv);
diff --git a/mi/mibstore.h b/mi/mibstore.h
deleted file mode 100644 (file)
index f8ed444..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*-
- * mibstore.h --
- *     Header file for users of the MI backing-store scheme.
- *
- * Copyright (c) 1987 by the Regents of the University of California
- *
- * Permission to use, copy, modify, and distribute this
- * software and its documentation for any purpose and without
- * fee is hereby granted, provided that the above copyright
- * notice appear in all copies.  The University of California
- * makes no representations about the suitability of this
- * software for any purpose.  It is provided "as is" without
- * express or implied warranty.
- */
-
-#ifndef _MIBSTORE_H
-#define _MIBSTORE_H
-
-#include "screenint.h"
-
-#define miInitializeBackingStore(x) do {} while (0)
-
-#endif                          /* _MIBSTORE_H */
index 3ef0c8c..4648b9a 100644 (file)
@@ -75,7 +75,7 @@ miUninstallColormap(ColormapPtr pmap)
 
     if (pmap == curpmap) {
         if (pmap->mid != pmap->pScreen->defColormap) {
-            dixLookupResourceByType((pointer *) &curpmap,
+            dixLookupResourceByType((void **) &curpmap,
                                     pmap->pScreen->defColormap,
                                     RT_COLORMAP, serverClient, DixUseAccess);
             (*pmap->pScreen->InstallColormap) (curpmap);
index edca969..8cca5fe 100644 (file)
@@ -79,7 +79,7 @@ typedef struct {
   (miDCBufferPtr)dixLookupScreenPrivate(&GetMaster(dev, MASTER_POINTER)->devPrivates, miDCDeviceKey, screen))
 
 /* 
- * The core pointer buffer will point to the index of the virtual core pointer
+ * The core pointer buffer will point to the index of the virtual pointer
  * in the pCursorBuffers array. 
  */
 typedef struct {
@@ -114,7 +114,7 @@ miDCInitialize(ScreenPtr pScreen, miPointerScreenFuncPtr screenFuncs)
     dixSetPrivate(&pScreen->devPrivates, miDCScreenKey, pScreenPriv);
 
     if (!miSpriteInitialize(pScreen, screenFuncs)) {
-        free((pointer) pScreenPriv);
+        free((void *) pScreenPriv);
         return FALSE;
     }
     return TRUE;
@@ -152,7 +152,7 @@ miDCCloseScreen(ScreenPtr pScreen)
     pScreen->CloseScreen = pScreenPriv->CloseScreen;
 
     miDCSwitchScreenCursor(pScreen, NULL, NULL, NULL, NULL);
-    free((pointer) pScreenPriv);
+    free((void *) pScreenPriv);
     return (*pScreen->CloseScreen) (pScreen);
 }
 
index 45a84c3..e6371f9 100644 (file)
--- a/mi/mieq.c
+++ b/mi/mieq.c
@@ -92,13 +92,19 @@ wait_for_server_init(void)
 }
 #endif
 
+#ifdef _F_SNIFF_MIEQ_
 EventQueuePtr
 mieqGetEventQueuePtr()
 {
        return &miEventQueue;
 }
+#endif //_F_SNIFF_MIEQ
 
+#ifdef _F_SNIFF_MIEQ_
 size_t
+#else
+static size_t
+#endif //_F_SNIFF_MIEQ
 mieqNumEnqueued(EventQueuePtr eventQueue)
 {
     size_t n_enqueued = 0;
@@ -276,7 +282,7 @@ mieqEnqueue(DeviceIntPtr pDev, InternalEvent *e)
         else if (miEventQueue.dropped % QUEUE_DROP_BACKTRACE_FREQUENCY == 0 &&
                  miEventQueue.dropped / QUEUE_DROP_BACKTRACE_FREQUENCY <=
                  QUEUE_DROP_BACKTRACE_MAX) {
-            ErrorFSigSafe("[mi] EQ overflow continuing.  %u events have been "
+            ErrorFSigSafe("[mi] EQ overflow continuing.  %zu events have been "
                          "dropped.\n", miEventQueue.dropped);
             if (miEventQueue.dropped / QUEUE_DROP_BACKTRACE_FREQUENCY ==
                 QUEUE_DROP_BACKTRACE_MAX) {
@@ -401,6 +407,10 @@ ChangeDeviceID(DeviceIntPtr dev, InternalEvent *event)
     case ET_RawTouchUpdate:
         event->raw_event.deviceid = dev->id;
         break;
+    case ET_BarrierHit:
+    case ET_BarrierLeave:
+        event->barrier_event.deviceid = dev->id;
+        break;
     default:
         ErrorF("[mi] Unknown event type (%d), cannot change id.\n",
                event->any.type);
@@ -472,8 +482,10 @@ CopyGetMasterEvent(DeviceIntPtr sdev,
 
     mdev = GetMaster(sdev, mtype);
     memcpy(copy, original, len);
-    ChangeDeviceID(mdev, copy);
-    FixUpEventForMaster(mdev, sdev, original, copy);
+    if (mdev) {
+        ChangeDeviceID(mdev, copy);
+        FixUpEventForMaster(mdev, sdev, original, copy);
+    }
 
     return mdev;
 }
@@ -505,6 +517,10 @@ mieqProcessDeviceEvent(DeviceIntPtr dev, InternalEvent *event, ScreenPtr screen)
 
     verify_internal_event(event);
 
+    /* refuse events from disabled devices */
+    if (!dev->enabled)
+        return;
+
     /* Custom event handler */
     handler = miEventQueue.handlers[event->any.type];
 
@@ -547,6 +563,11 @@ mieqProcessDeviceEvent(DeviceIntPtr dev, InternalEvent *event, ScreenPtr screen)
     if (master)
         master->lastSlave = dev;
 #endif//_F_GESTURE_EXTENSION_
+#ifdef ENABLE_TTRACE
+    if (event->any.type == ET_KeyPress || event->any.type == ET_KeyRelease) {
+        TTRACE_INPUT_BEGIN("XORG:SERVER:mieqProcessDeviceEvent");
+    }
+#endif //ENABLE_TTRACE
 
     /* If someone's registered a custom event handler, let them
      * steal it. */
@@ -569,6 +590,11 @@ mieqProcessDeviceEvent(DeviceIntPtr dev, InternalEvent *event, ScreenPtr screen)
         if (master && !IsFloating(dev))
             master->public.processInputProc(&mevent, master);
     }
+#ifdef ENABLE_TTRACE
+        if (event->any.type == ET_KeyPress || event->any.type == ET_KeyRelease) {
+            TTRACE_INPUT_END();
+        }
+#endif //ENABLE_TTRACE
 }
 
 /* Call this from ProcessInputEvents(). */
@@ -590,7 +616,7 @@ mieqProcessInputEvents(void)
     if (n_enqueued >= (miEventQueue.nevents - (2 * QUEUE_RESERVED_SIZE)) &&
         miEventQueue.nevents < QUEUE_MAXIMUM_SIZE) {
         ErrorF("[mi] Increasing EQ size to %lu to prevent dropped events.\n",
-               miEventQueue.nevents << 1);
+               (unsigned long) (miEventQueue.nevents << 1));
         if (!mieqGrowQueue(&miEventQueue, miEventQueue.nevents << 1)) {
             ErrorF("[mi] Increasing the size of EQ failed.\n");
         }
@@ -598,7 +624,7 @@ mieqProcessInputEvents(void)
 
     if (miEventQueue.dropped) {
         ErrorF("[mi] EQ processing has resumed after %lu dropped events.\n",
-               miEventQueue.dropped);
+               (unsigned long) miEventQueue.dropped);
         ErrorF
             ("[mi] This may be caused my a misbehaving driver monopolizing the server's resources.\n");
         miEventQueue.dropped = 0;
@@ -633,11 +659,15 @@ mieqProcessInputEvents(void)
             DPMSSet(serverClient, DPMSModeOn);
 #endif
 #endif
-
-        mieqProcessDeviceEvent(dev, &event, screen);
+        if (dev)
+            mieqProcessDeviceEvent(dev, &event, screen);
 
         /* Update the sprite now. Next event may be from different device. */
-        if (event.any.type == ET_Motion && master)
+        if (master &&
+            (event.any.type == ET_Motion ||
+             ((event.any.type == ET_TouchBegin ||
+               event.any.type == ET_TouchUpdate) &&
+              event.device_event.flags & TOUCH_POINTER_EMULATED)))
             miPointerUpdateSprite(dev);
 
 #ifdef XQUARTZ
index 8b7c93f..198c433 100644 (file)
@@ -610,7 +610,7 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
         gcmask |= GCPlaneMask;
 #endif
         gcval[c++].val = FillTiled;
-        gcval[c++].ptr = (pointer) fill.pixmap;
+        gcval[c++].ptr = (void *) fill.pixmap;
         gcval[c++].val = tile_x_off;
         gcval[c++].val = tile_y_off;
         gcmask |= GCFillStyle | GCTile | GCTileStipXOrigin | GCTileStipYOrigin;
index c9cdd12..9bbe884 100644 (file)
--- a/mi/migc.c
+++ b/mi/migc.c
@@ -72,12 +72,12 @@ miDestroyClip(GCPtr pGC)
 }
 
 void
-miChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects)
+miChangeClip(GCPtr pGC, int type, void *pvalue, int nrects)
 {
     (*pGC->funcs->DestroyClip) (pGC);
     if (type == CT_PIXMAP) {
         /* convert the pixmap to a region */
-        pGC->clientClip = (pointer) BitmapToRegion(pGC->pScreen,
+        pGC->clientClip = (void *) BitmapToRegion(pGC->pScreen,
                                                    (PixmapPtr) pvalue);
         (*pGC->pScreen->DestroyPixmap) (pvalue);
     }
@@ -86,7 +86,7 @@ miChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects)
         pGC->clientClip = pvalue;
     }
     else if (type != CT_NONE) {
-        pGC->clientClip = (pointer) RegionFromRects(nrects,
+        pGC->clientClip = (void *) RegionFromRects(nrects,
                                                     (xRectangle *) pvalue,
                                                     type);
         free(pvalue);
@@ -112,7 +112,7 @@ miCopyClip(GCPtr pgcDst, GCPtr pgcSrc)
     case CT_REGION:
         prgnNew = RegionCreate(NULL, 1);
         RegionCopy(prgnNew, (RegionPtr) (pgcSrc->clientClip));
-        (*pgcDst->funcs->ChangeClip) (pgcDst, CT_REGION, (pointer) prgnNew, 0);
+        (*pgcDst->funcs->ChangeClip) (pgcDst, CT_REGION, (void *) prgnNew, 0);
         break;
     }
 }
index 8c13b2e..8d06a6f 100644 (file)
--- a/mi/migc.h
+++ b/mi/migc.h
@@ -26,31 +26,24 @@ from The Open Group.
 
 */
 
-extern _X_EXPORT void miChangeGC(GCPtr /*pGC */ ,
-                                 unsigned long  /*mask */
-    );
-
-extern _X_EXPORT void miDestroyGC(GCPtr /*pGC */
-    );
-
-extern _X_EXPORT void miDestroyClip(GCPtr       /*pGC */
-    );
-
-extern _X_EXPORT void miChangeClip(GCPtr /*pGC */ ,
-                                   int /*type */ ,
-                                   pointer /*pvalue */ ,
-                                   int  /*nrects */
-    );
-
-extern _X_EXPORT void miCopyClip(GCPtr /*pgcDst */ ,
-                                 GCPtr  /*pgcSrc */
-    );
-
-extern _X_EXPORT void miCopyGC(GCPtr /*pGCSrc */ ,
-                               unsigned long /*changes */ ,
-                               GCPtr    /*pGCDst */
-    );
-
-extern _X_EXPORT void miComputeCompositeClip(GCPtr /*pGC */ ,
-                                             DrawablePtr        /*pDrawable */
-    );
+extern _X_EXPORT void miChangeGC(GCPtr          pGC,
+                                 unsigned long  mask);
+
+extern _X_EXPORT void miDestroyGC(GCPtr         pGC);
+
+extern _X_EXPORT void miDestroyClip(GCPtr       pGC);
+
+extern _X_EXPORT void miChangeClip(GCPtr        pGC,
+                                   int          type,
+                                   void         *pvalue,
+                                   int          nrects);
+
+extern _X_EXPORT void miCopyClip(GCPtr          pgcDst,
+                                 GCPtr          pgcSrc);
+
+extern _X_EXPORT void miCopyGC(GCPtr            pGCSrc,
+                               unsigned long    changes,
+                               GCPtr            pGCDst);
+
+extern _X_EXPORT void miComputeCompositeClip(GCPtr              pGC,
+                                             DrawablePtr        pDrawable);
index 1a70911..b53ab9c 100644 (file)
@@ -81,7 +81,7 @@ with the sample server.
 
 void
 miPolyGlyphBlt(DrawablePtr pDrawable, GC * pGC, int x, int y, unsigned int nglyph, CharInfoPtr * ppci,  /* array of character info */
-               pointer pglyphBase       /* start of array of glyphs */
+               void *pglyphBase       /* start of array of glyphs */
     )
 {
     int width, height;
@@ -182,7 +182,7 @@ miPolyGlyphBlt(DrawablePtr pDrawable, GC * pGC, int x, int y, unsigned int nglyp
 
 void
 miImageGlyphBlt(DrawablePtr pDrawable, GC * pGC, int x, int y, unsigned int nglyph, CharInfoPtr * ppci, /* array of character info */
-                pointer pglyphBase      /* start of array of glyphs */
+                void *pglyphBase      /* start of array of glyphs */
     )
 {
     ExtentInfoRec info;         /* used by QueryGlyphExtents() */
index ceb6d0e..981140d 100755 (executable)
@@ -86,7 +86,6 @@ SOFTWARE.
 #undef DBE
 #undef SCREENSAVER
 #undef RANDR
-#undef XFIXES
 #undef DAMAGE
 #undef COMPOSITE
 #undef MITSHM
@@ -126,6 +125,9 @@ static ExtensionToggle ExtensionToggleList[] = {
 #ifdef COMPOSITE
     {"Composite", &noCompositeExtension},
 #endif
+#ifdef CONTAINER
+    {"Container", &noContainerExtension},
+#endif //_F_CONTAINER_EXTENSION_
 #ifdef DAMAGE
     {"DAMAGE", &noDamageExtension},
 #endif
@@ -157,7 +159,7 @@ static ExtensionToggle ExtensionToggleList[] = {
 #ifdef XF86BIGFONT
     {"XFree86-Bigfont", &noXFree86BigfontExtension},
 #endif
-#ifdef XorgLoader
+#ifdef XORGSERVER
 #ifdef XFreeXDGA
     {"XFree86-DGA", &noXFree86DGAExtension},
 #endif
@@ -168,9 +170,7 @@ static ExtensionToggle ExtensionToggleList[] = {
     {"XFree86-VidModeExtension", &noXFree86VidModeExtension},
 #endif
 #endif
-#ifdef XFIXES
     {"XFIXES", &noXFixesExtension},
-#endif
 #ifdef PANORAMIX
     {"XINERAMA", &noPanoramiXExtension},
 #endif
@@ -186,6 +186,27 @@ static ExtensionToggle ExtensionToggleList[] = {
 #ifdef XV
     {"XVideo", &noXvExtension},
 #endif
+#ifdef _F_DRI2_RUNTIME_DISABLE_EXT_
+#ifdef DRI2
+    {"DRI2", &noDRI2Extension},
+#endif
+#endif
+#ifdef _F_RUN_TIME_DISABLE_EXTENSION_
+#ifdef DRI3
+    {"DRI3", &noDRI3Extension},
+#endif
+#ifdef PRESENT
+#ifdef DRI3
+    {"Present", &noPresentExtension},
+#endif
+#endif
+#ifdef HWC
+    {"HWC", &noHWCExtension},
+#endif
+#ifdef HWA
+    {"HWA", &noHWAExtension},
+#endif
+#endif
 };
 
 Bool
@@ -215,10 +236,12 @@ EnableDisableExtension(const char *name, Bool enable)
 void
 EnableDisableExtensionError(const char *name, Bool enable)
 {
-    ExtensionToggle *ext = &ExtensionToggleList[0];
+    ExtensionToggle *ext;
+    int i;
     Bool found = FALSE;
 
-    for (ext = &ExtensionToggleList[0]; ext->name != NULL; ext++) {
+    for (i = 0; i < ARRAY_SIZE(ExtensionToggleList); i++) {
+        ext = &ExtensionToggleList[i];
         if ((strcmp(name, ext->name) == 0) && (ext->disablePtr == NULL)) {
             ErrorF("[mi] Extension \"%s\" can not be disabled\n", name);
             found = TRUE;
@@ -229,7 +252,8 @@ EnableDisableExtensionError(const char *name, Bool enable)
         ErrorF("[mi] Extension \"%s\" is not recognized\n", name);
     ErrorF("[mi] Only the following extensions can be run-time %s:\n",
            enable ? "enabled" : "disabled");
-    for (ext = &ExtensionToggleList[0]; ext->name != NULL; ext++) {
+    for (i = 0; i < ARRAY_SIZE(ExtensionToggleList); i++) {
+        ext = &ExtensionToggleList[i];
         if (ext->disablePtr != NULL) {
             ErrorF("[mi]    %s\n", ext->name);
         }
@@ -237,7 +261,7 @@ EnableDisableExtensionError(const char *name, Bool enable)
 }
 
 /* List of built-in (statically linked) extensions */
-static ExtensionModule staticExtensions[] = {
+static const ExtensionModule staticExtensions[] = {
     {GEExtensionInit, "Generic Event Extension", &noGEExtension},
     {ShapeExtensionInit, "SHAPE", NULL},
 #ifdef _F_GESTURE_EXTENSION_
@@ -266,10 +290,8 @@ static ExtensionModule staticExtensions[] = {
      */
     {PseudoramiXExtensionInit, "PseudoramiX", &noPseudoramiXExtension},
 #endif
-#ifdef XFIXES
     /* must be before Render to layer DisplayCursor correctly */
     {XFixesExtensionInit, "XFIXES", &noXFixesExtension},
-#endif
 #ifdef XF86BIGFONT
     {XFree86BigfontExtensionInit, XF86BIGFONTNAME, &noXFree86BigfontExtension},
 #endif
@@ -295,6 +317,21 @@ static ExtensionModule staticExtensions[] = {
 #ifdef DPMSExtension
     {DPMSExtensionInit, DPMSExtensionName, &noDPMSExtension},
 #endif
+#ifdef _F_RUN_TIME_DISABLE_EXTENSION_
+#ifdef PRESENT
+    {present_extension_init, PRESENT_NAME, &noPresentExtension},
+#endif
+#ifdef DRI3
+    {dri3_extension_init, DRI3_NAME, &noDRI3Extension},
+#endif
+#else
+#ifdef PRESENT
+    {present_extension_init, PRESENT_NAME, NULL},
+#endif
+#ifdef DRI3
+    {dri3_extension_init, DRI3_NAME, NULL},
+#endif
+#endif
 #ifdef RES
     {ResExtensionInit, XRES_NAME, &noResExtension},
 #endif
@@ -309,8 +346,14 @@ static ExtensionModule staticExtensions[] = {
     {SmackExtensionInit, SMACK_EXTENSION_NAME, &noSmackExtension},
 #endif
 #ifdef HWC
-    { hwc_extension_init, HWC_NAME, NULL},
+    { hwc_extension_init, HWC_NAME, &noHWCExtension},
 #endif //_F_HWC_EXTENSION_
+#ifdef HWA
+    { hwa_extension_init, HWA_NAME, &noHWAExtension},
+#endif //_F_HWA_EXTENSION_
+#ifdef CONTAINER
+    {ContainerExtensionInit, CONTAINER_EXTENSION_NAME, &noContainerExtension},
+#endif //_F_CONTAINER_EXTENSION_
 };
 
 static ExtensionModule *ExtensionModuleList = NULL;
@@ -320,15 +363,13 @@ static void
 AddStaticExtensions(void)
 {
     static Bool listInitialised = FALSE;
-    int i;
 
     if (listInitialised)
         return;
     listInitialised = TRUE;
 
     /* Add built-in extensions to the list. */
-    for (i = 0; i < ARRAY_SIZE(staticExtensions); i++)
-        LoadExtension(&staticExtensions[i], TRUE);
+    LoadExtensionList(staticExtensions, ARRAY_SIZE(staticExtensions), TRUE);
 }
 
 void
@@ -339,7 +380,7 @@ InitExtensions(int argc, char *argv[])
 
     AddStaticExtensions();
 
-    for (i = 0; ExtensionModuleList[i].name != NULL; i++) {
+    for (i = 0; i < numExtensionModules; i++) {
         ext = &ExtensionModuleList[i];
         if (ext->initFunc != NULL &&
             (ext->disablePtr == NULL || !*ext->disablePtr)) {
@@ -349,50 +390,44 @@ InitExtensions(int argc, char *argv[])
 }
 
 static ExtensionModule *
-NewExtensionModule(void)
+NewExtensionModuleList(int size)
 {
     ExtensionModule *save = ExtensionModuleList;
     int n;
 
-    /* Make sure built-in extensions get added to the list before those
-     * in modules. */
-    AddStaticExtensions();
-
     /* Sanity check */
     if (!ExtensionModuleList)
         numExtensionModules = 0;
 
-    n = numExtensionModules + 1;
+    n = numExtensionModules + size;
     ExtensionModuleList = realloc(ExtensionModuleList,
-                                  (n + 1) * sizeof(ExtensionModule));
+                                  n * sizeof(ExtensionModule));
     if (ExtensionModuleList == NULL) {
         ExtensionModuleList = save;
         return NULL;
     }
     else {
-        numExtensionModules++;
-        ExtensionModuleList[numExtensionModules].name = NULL;
-        return ExtensionModuleList + (numExtensionModules - 1);
+        numExtensionModules += size;
+        return ExtensionModuleList + (numExtensionModules - size);
     }
 }
 
 void
-LoadExtension(ExtensionModule * e, Bool builtin)
+LoadExtensionList(const ExtensionModule ext[], int size, Bool builtin)
 {
     ExtensionModule *newext;
+    int i;
 
-    if (e == NULL || e->name == NULL)
-        return;
+    /* Make sure built-in extensions get added to the list before those
+     * in modules. */
+    AddStaticExtensions();
 
-    if (!(newext = NewExtensionModule()))
+    if (!(newext = NewExtensionModuleList(size)))
         return;
 
-    if (builtin)
-        ErrorF("Initializing built-in extension %s\n", e->name);
-    else
-        ErrorF("Loading extension %s\n", e->name);
-
-    newext->name = e->name;
-    newext->initFunc = e->initFunc;
-    newext->disablePtr = e->disablePtr;
+    for (i = 0; i < size; i++, newext++) {
+        newext->name = ext[i].name;
+        newext->initFunc = ext[i].initFunc;
+        newext->disablePtr = ext[i].disablePtr;
+    }
 }
index 3c9519f..4315a78 100644 (file)
@@ -1050,7 +1050,7 @@ typedef struct {
 } miOverlayTwoRegions;
 
 static int
-miOverlayRecomputeExposures(WindowPtr pWin, pointer value)
+miOverlayRecomputeExposures(WindowPtr pWin, void *value)
 {
     miOverlayTwoRegions *pValid = (miOverlayTwoRegions *) value;
     miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pWin);
@@ -1405,7 +1405,7 @@ miOverlayResizeWindow(WindowPtr pWin,
                 TwoRegions.under = gravitate2[g];
 
                 TraverseTree(pChild, miOverlayRecomputeExposures,
-                             (pointer) (&TwoRegions));
+                             (void *) (&TwoRegions));
             }
 
             /*
old mode 100644 (file)
new mode 100755 (executable)
index 4defaf5..d88bab4
@@ -98,7 +98,7 @@ static void miPointerDeviceCleanup(DeviceIntPtr pDev, ScreenPtr pScreen);
 static void miPointerMoveNoEvent(DeviceIntPtr pDev, ScreenPtr pScreen, int x,
                                  int y);
 
-static InternalEvent *events;   /* for WarpPointer MotionNotifies */
+static InternalEvent *mipointermove_events;   /* for WarpPointer MotionNotifies */
 
 Bool
 miPointerInitialize(ScreenPtr pScreen,
@@ -118,13 +118,6 @@ miPointerInitialize(ScreenPtr pScreen,
         return FALSE;
     pScreenPriv->spriteFuncs = spriteFuncs;
     pScreenPriv->screenFuncs = screenFuncs;
-    /*
-     * check for uninitialized methods
-     */
-    if (!screenFuncs->EnqueueEvent)
-        screenFuncs->EnqueueEvent = mieqEnqueue;
-    if (!screenFuncs->NewEventScreen)
-        screenFuncs->NewEventScreen = mieqSwitchScreen;
     pScreenPriv->waitForUpdate = waitForUpdate;
     pScreenPriv->showTransparent = FALSE;
     pScreenPriv->CloseScreen = pScreen->CloseScreen;
@@ -143,7 +136,7 @@ miPointerInitialize(ScreenPtr pScreen,
     pScreen->DeviceCursorInitialize = miPointerDeviceInitialize;
     pScreen->DeviceCursorCleanup = miPointerDeviceCleanup;
 
-    events = NULL;
+    mipointermove_events = NULL;
     return TRUE;
 }
 
@@ -159,9 +152,9 @@ miPointerCloseScreen(ScreenPtr pScreen)
     SetupScreen(pScreen);
 
     pScreen->CloseScreen = pScreenPriv->CloseScreen;
-    free((pointer) pScreenPriv);
-    FreeEventList(events, GetMaximumEventsNum());
-    events = NULL;
+    free((void *) pScreenPriv);
+    FreeEventList(mipointermove_events, GetMaximumEventsNum());
+    mipointermove_events = NULL;
     return (*pScreen->CloseScreen) (pScreen);
 }
 
@@ -359,11 +352,10 @@ miPointerWarpCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
     miPointerPtr pPointer;
     BOOL changedScreen = FALSE;
 
-    SetupScreen(pScreen);
     pPointer = MIPOINTER(pDev);
 
     if (pPointer->pScreen != pScreen) {
-        (*pScreenPriv->screenFuncs->NewEventScreen) (pDev, pScreen, TRUE);
+        mieqSwitchScreen(pDev, pScreen, TRUE);
         changedScreen = TRUE;
     }
 
@@ -472,21 +464,20 @@ miPointerUpdateSprite(DeviceIntPtr pDev)
 void
 miPointerSetScreen(DeviceIntPtr pDev, int screen_no, int x, int y)
 {
-    miPointerScreenPtr pScreenPriv;
     ScreenPtr pScreen;
     miPointerPtr pPointer;
 
     pPointer = MIPOINTER(pDev);
 
     pScreen = screenInfo.screens[screen_no];
-    pScreenPriv = GetScreenPrivate(pScreen);
-    (*pScreenPriv->screenFuncs->NewEventScreen) (pDev, pScreen, FALSE);
+    mieqSwitchScreen(pDev, pScreen, FALSE);
     NewCurrentScreen(pDev, pScreen, x, y);
 
     pPointer->limits.x2 = pScreen->width;
     pPointer->limits.y2 = pScreen->height;
 }
 
+#ifdef _F_GET_CURRENT_SCREEN_
 /**
  * @return The current screen of the VCP
  */
@@ -495,6 +486,7 @@ miPointerCurrentScreen(void)
 {
     return miPointerGetScreen(inputInfo.pointer);
 }
+#endif //_F_GET_CURRENT_SCREEN_
 
 /**
  * @return The current screen of the given device or NULL.
@@ -565,23 +557,21 @@ miPointerMoveNoEvent(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
  */
 ScreenPtr
 miPointerSetPosition(DeviceIntPtr pDev, int mode, double *screenx,
-                     double *screeny)
+                     double *screeny,
+                     int *nevents, InternalEvent* events)
 {
     miPointerScreenPtr pScreenPriv;
     ScreenPtr pScreen;
     ScreenPtr newScreen;
     int x, y;
     Bool switch_screen = FALSE;
+    Bool should_constrain_barriers = FALSE;
+    int i;
 
     miPointerPtr pPointer;
 
-    if (!pDev)
-        return NULL;
-
     pPointer = MIPOINTER(pDev);
     pScreen = pPointer->pScreen;
-    if (!pScreen)
-        return NULL;            /* called before ready */
 
     x = trunc(*screenx);
     y = trunc(*screeny);
@@ -593,6 +583,25 @@ miPointerSetPosition(DeviceIntPtr pDev, int mode, double *screenx,
     x -= pScreen->x;
     y -= pScreen->y;
 
+    should_constrain_barriers = (mode == Relative);
+
+    if (should_constrain_barriers) {
+        /* coordinates after clamped to a barrier */
+        int constrained_x, constrained_y;
+        int current_x, current_y; /* current position in per-screen coord */
+
+        current_x = MIPOINTER(pDev)->x - pScreen->y;
+        current_y = MIPOINTER(pDev)->y - pScreen->x;
+
+        input_constrain_cursor(pDev, pScreen,
+                               current_x, current_y, x, y,
+                               &constrained_x, &constrained_y,
+                               nevents, events);
+
+        x = constrained_x;
+        y = constrained_y;
+    }
+
     if (switch_screen) {
         pScreenPriv = GetScreenPrivate(pScreen);
         if (!pPointer->confined) {
@@ -600,8 +609,7 @@ miPointerSetPosition(DeviceIntPtr pDev, int mode, double *screenx,
             (*pScreenPriv->screenFuncs->CursorOffScreen) (&newScreen, &x, &y);
             if (newScreen != pScreen) {
                 pScreen = newScreen;
-                (*pScreenPriv->screenFuncs->NewEventScreen) (pDev, pScreen,
-                                                             FALSE);
+                mieqSwitchScreen(pDev, pScreen, FALSE);
                 /* Smash the confine to the new screen */
                 pPointer->limits.x2 = pScreen->width;
                 pPointer->limits.y2 = pScreen->height;
@@ -624,6 +632,18 @@ miPointerSetPosition(DeviceIntPtr pDev, int mode, double *screenx,
     if (pPointer->x != x || pPointer->y != y || pPointer->pScreen != pScreen)
         miPointerMoveNoEvent(pDev, pScreen, x, y);
 
+    /* check if we generated any barrier events and if so, update root x/y
+     * to the fully constrained coords */
+    if (should_constrain_barriers) {
+        for (i = 0; i < *nevents; i++) {
+            if (events[i].any.type == ET_BarrierHit ||
+                events[i].any.type == ET_BarrierLeave) {
+                events[i].barrier_event.root_x = x;
+                events[i].barrier_event.root_y = y;
+            }
+        }
+    }
+
     /* Convert to desktop coordinates again */
     x += pScreen->x;
     y += pScreen->y;
@@ -681,17 +701,17 @@ miPointerMove(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
     valuators[0] = x;
     valuators[1] = y;
 
-    if (!events) {
-        events = InitEventList(GetMaximumEventsNum());
+    if (!mipointermove_events) {
+        mipointermove_events = InitEventList(GetMaximumEventsNum());
 
-        if (!events) {
+        if (!mipointermove_events) {
             FatalError("Could not allocate event store.\n");
             return;
         }
     }
 
     valuator_mask_set_range(&mask, 0, 2, valuators);
-    nevents = GetPointerEvents(events, pDev, MotionNotify, 0,
+    nevents = GetPointerEvents(mipointermove_events, pDev, MotionNotify, 0,
                                POINTER_SCREEN | POINTER_ABSOLUTE |
                                POINTER_NORAW, &mask);
 
@@ -700,7 +720,7 @@ miPointerMove(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
     darwinEvents_lock();
 #endif
     for (i = 0; i < nevents; i++)
-        mieqEnqueue(pDev, &events[i]);
+        mieqEnqueue(pDev, &mipointermove_events[i]);
 #ifdef XQUARTZ
     darwinEvents_unlock();
 #endif
old mode 100644 (file)
new mode 100755 (executable)
index 1500e21..43f3e9a
@@ -71,13 +71,6 @@ typedef struct _miPointerScreenFuncRec {
                         int /* x */ ,
                         int     /* y */
         );
-    void (*EnqueueEvent) (DeviceIntPtr /* pDev */ ,
-                          InternalEvent *       /* event */
-        );
-    void (*NewEventScreen) (DeviceIntPtr /* pDev */ ,
-                            ScreenPtr /* pScr */ ,
-                            Bool        /* set_dequeue_screen */
-        );
 } miPointerScreenFuncRec, *miPointerScreenFuncPtr;
 
 extern _X_EXPORT Bool miDCInitialize(ScreenPtr /*pScreen */ ,
@@ -98,10 +91,12 @@ extern _X_EXPORT void miPointerWarpCursor(DeviceIntPtr /*pDev */ ,
                                           int   /*y */
     );
 
+//#ifdef _F_GET_CURRENT_SCREEN_
 /* Deprecated in favour of miPointerGetScreen. */
 extern _X_EXPORT ScreenPtr
 miPointerCurrentScreen(void
 ) _X_DEPRECATED;
+//#endif //_F_GET_CURRENT_SCREEN_
 
 extern _X_EXPORT ScreenPtr
 miPointerGetScreen(DeviceIntPtr pDev);
@@ -115,7 +110,8 @@ miPointerGetPosition(DeviceIntPtr pDev, int *x, int *y);
 /* Moves the cursor to the specified position.  May clip the co-ordinates:
  * x and y are modified in-place. */
 extern _X_EXPORT ScreenPtr
-miPointerSetPosition(DeviceIntPtr pDev, int mode, double *x, double *y);
+miPointerSetPosition(DeviceIntPtr pDev, int mode, double *x, double *y,
+                     int *nevents, InternalEvent *events);
 
 extern _X_EXPORT void
 miPointerUpdateSprite(DeviceIntPtr pDev);
index a0e88d2..e316ae0 100644 (file)
@@ -148,7 +148,7 @@ miPolyRectangle(DrawablePtr pDraw, GCPtr pGC, int nrects, xRectangle *pRects)
             }
         }
         (*pGC->ops->PolyFillRect) (pDraw, pGC, t - tmp, tmp);
-        free((pointer) tmp);
+        free((void *) tmp);
     }
     else {
 
index 4698b53..00c15f7 100644 (file)
@@ -53,14 +53,14 @@ from The Open Group.
  */
 
 typedef struct {
-    pointer pbits;              /* pointer to framebuffer */
+    void *pbits;                /* pointer to framebuffer */
     int width;                  /* delta to add to a framebuffer addr to move one row down */
 } miScreenInitParmsRec, *miScreenInitParmsPtr;
 
 /* this plugs into pScreen->ModifyPixmapHeader */
 Bool
 miModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, int depth,
-                     int bitsPerPixel, int devKind, pointer pPixData)
+                     int bitsPerPixel, int devKind, void *pPixData)
 {
     if (!pPixmap)
         return FALSE;
@@ -135,7 +135,7 @@ Bool
 miCreateScreenResources(ScreenPtr pScreen)
 {
     miScreenInitParmsPtr pScrInitParms;
-    pointer value;
+    void *value;
 
     pScrInitParms = (miScreenInitParmsPtr) pScreen->devPrivate;
 
@@ -161,7 +161,7 @@ miCreateScreenResources(ScreenPtr pScreen)
                                                            pScreen->rootDepth),
                                              pScrInitParms->pbits))
             return FALSE;
-        value = (pointer) pPixmap;
+        value = (void *) pPixmap;
     }
     else {
         value = pScrInitParms->pbits;
@@ -172,7 +172,7 @@ miCreateScreenResources(ScreenPtr pScreen)
 }
 
 Bool
-miScreenDevPrivateInit(ScreenPtr pScreen, int width, pointer pbits)
+miScreenDevPrivateInit(ScreenPtr pScreen, int width, void *pbits)
 {
     miScreenInitParmsPtr pScrInitParms;
 
@@ -185,7 +185,7 @@ miScreenDevPrivateInit(ScreenPtr pScreen, int width, pointer pbits)
         return FALSE;
     pScrInitParms->pbits = pbits;
     pScrInitParms->width = width;
-    pScreen->devPrivate = (pointer) pScrInitParms;
+    pScreen->devPrivate = (void *) pScrInitParms;
     return TRUE;
 }
 
@@ -199,11 +199,11 @@ static void
 miSetScreenPixmap(PixmapPtr pPix)
 {
     if (pPix)
-        pPix->drawable.pScreen->devPrivate = (pointer) pPix;
+        pPix->drawable.pScreen->devPrivate = (void *) pPix;
 }
 
 Bool
-miScreenInit(ScreenPtr pScreen, pointer pbits,  /* pointer to screen bits */
+miScreenInit(ScreenPtr pScreen, void *pbits,  /* pointer to screen bits */
              int xsize, int ysize,      /* in pixels */
              int dpix, int dpiy,        /* dots per inch */
              int width,         /* pixel width of frame buffer */
@@ -272,6 +272,7 @@ miScreenInit(ScreenPtr pScreen, pointer pbits,  /* pointer to screen bits */
     pScreen->ChangeBorderWidth = miChangeBorderWidth;
     pScreen->SetShape = miSetShape;
     pScreen->MarkUnrealizedWindow = miMarkUnrealizedWindow;
+    pScreen->XYToWindow = miXYToWindow;
 
     miSetZeroLineBias(pScreen, DEFAULTZEROLINEBIAS);
 
index 0f89880..11c8a43 100644 (file)
@@ -453,8 +453,6 @@ miFillUniqueSpanGroup(DrawablePtr pDraw, GCPtr pGC, SpanGroup * spanGroup)
                             (int *) realloc(newspans->widths,
                                             ysizes[index] * sizeof(int));
                         if (!newpoints || !newwidths) {
-                            int i;
-
                             for (i = 0; i < ylength; i++) {
                                 free(yspans[i].points);
                                 free(yspans[i].widths);
@@ -485,8 +483,6 @@ miFillUniqueSpanGroup(DrawablePtr pDraw, GCPtr pGC, SpanGroup * spanGroup)
         points = malloc(count * sizeof(DDXPointRec));
         widths = malloc(count * sizeof(int));
         if (!points || !widths) {
-            int i;
-
             for (i = 0; i < ylength; i++) {
                 free(yspans[i].points);
                 free(yspans[i].widths);
index de43c6a..f6ff4c1 100644 (file)
@@ -86,10 +86,6 @@ typedef struct {
     /* os layer procedures */
     ScreenBlockHandlerProcPtr BlockHandler;
 
-    /* device cursor procedures */
-    DeviceCursorInitializeProcPtr DeviceCursorInitialize;
-    DeviceCursorCleanupProcPtr DeviceCursorCleanup;
-
     xColorItem colors[2];
     ColormapPtr pInstalledMap;
     ColormapPtr pColormap;
@@ -150,8 +146,7 @@ static void
 miSpriteDisableDamage(ScreenPtr pScreen, miSpriteScreenPtr pScreenPriv)
 {
     if (pScreenPriv->damageRegistered) {
-        DamageUnregister(&(pScreen->GetScreenPixmap(pScreen)->drawable),
-                         pScreenPriv->pDamage);
+        DamageUnregister(pScreenPriv->pDamage);
         pScreenPriv->damageRegistered = 0;
     }
 }
@@ -204,7 +199,7 @@ static void miSpriteSourceValidate(DrawablePtr pDrawable, int x, int y,
 static void miSpriteCopyWindow(WindowPtr pWindow,
                                DDXPointRec ptOldOrg, RegionPtr prgnSrc);
 static void miSpriteBlockHandler(ScreenPtr pScreen,
-                                 pointer pTimeout, pointer pReadMask);
+                                 void *pTimeout, void *pReadMask);
 static void miSpriteInstallColormap(ColormapPtr pMap);
 static void miSpriteStoreColors(ColormapPtr pMap, int ndef, xColorItem * pdef);
 
@@ -329,9 +324,6 @@ miSpriteInitialize(ScreenPtr pScreen, miPointerScreenFuncPtr screenFuncs)
 
     pScreenPriv->BlockHandler = NULL;
 
-    pScreenPriv->DeviceCursorInitialize = pScreen->DeviceCursorInitialize;
-    pScreenPriv->DeviceCursorCleanup = pScreen->DeviceCursorCleanup;
-
     pScreenPriv->pInstalledMap = NULL;
     pScreenPriv->pColormap = NULL;
     pScreenPriv->colors[SOURCE_COLOR].red = 0;
@@ -520,8 +512,8 @@ miSpriteCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
 }
 
 static void
-miSpriteBlockHandler(ScreenPtr pScreen, pointer pTimeout,
-                     pointer pReadmask)
+miSpriteBlockHandler(ScreenPtr pScreen, void *pTimeout,
+                     void *pReadmask)
 {
     miSpriteScreenPtr pPriv = GetSpriteScreen(pScreen);
     DeviceIntPtr pDev;
index ca18f15..b76e7a8 100644 (file)
@@ -994,7 +994,7 @@ miLineProjectingCap(DrawablePtr pDrawable, GCPtr pGC, unsigned long pixel,
 {
     int xorgi = 0, yorgi = 0;
     int lw;
-    PolyEdgeRec lefts[2], rights[2];
+    PolyEdgeRec lefts[4], rights[4];
     int lefty, righty, topy, bottomy;
     PolyEdgePtr left, right;
     PolyEdgePtr top, bottom;
@@ -1166,7 +1166,7 @@ miWideSegment(DrawablePtr pDrawable,
     PolyEdgePtr top, bottom;
     int lefty, righty, topy, bottomy;
     int signdx;
-    PolyEdgeRec lefts[2], rights[2];
+    PolyEdgeRec lefts[4], rights[4];
     LineFacePtr tface;
     int lw = pGC->lineWidth;
 
@@ -1520,7 +1520,7 @@ miWideDashSegment(DrawablePtr pDrawable,
     PolyVertexRec vertices[4];
     PolyVertexRec saveRight, saveBottom;
     PolySlopeRec slopes[4];
-    PolyEdgeRec left[2], right[2];
+    PolyEdgeRec left[4], right[4];
     LineFaceRec lcapFace, rcapFace;
     int nleft, nright;
     int h;
index bee6727..33f8a4b 100644 (file)
@@ -57,6 +57,11 @@ SOFTWARE.
 #include "scrnintstr.h"
 #include "pixmapstr.h"
 #include "mivalidate.h"
+#include "inputstr.h"
+
+#ifdef _F_INPUT_REDIRECTION_
+#include "compint.h"
+#endif //_F_INPUT_REDIRECTION_
 
 void
 miClearToBackground(WindowPtr pWin,
@@ -305,7 +310,7 @@ miMoveWindow(WindowPtr pWin, int x, int y, WindowPtr pNextSib, VTKind kind)
  */
 
 static int
-miRecomputeExposures(WindowPtr pWin, pointer value)
+miRecomputeExposures(WindowPtr pWin, void *value)
 {                               /* must conform to VisitWindowProcPtr */
     RegionPtr pValid = (RegionPtr) value;
 
@@ -585,7 +590,7 @@ miSlideAndSizeWindow(WindowPtr pWin,
                 if (pChild->winGravity != g)
                     continue;
                 RegionIntersect(pRegion, &pChild->borderClip, gravitate[g]);
-                TraverseTree(pChild, miRecomputeExposures, (pointer) pRegion);
+                TraverseTree(pChild, miRecomputeExposures, (void *) pRegion);
             }
 
             /*
@@ -759,3 +764,77 @@ miSegregateChildren(WindowPtr pWin, RegionPtr pReg, int depth)
             miSegregateChildren(pChild, pReg, depth);
     }
 }
+
+WindowPtr
+miSpriteTrace(SpritePtr pSprite, int x, int y)
+{
+    WindowPtr pWin;
+    BoxRec box;
+#ifdef _F_INPUT_REDIRECTION_
+    int rootX,rootY;
+
+    rootX = x;
+    rootY = y;
+#endif //_F_INPUT_REDIRECTION_
+
+    pWin = DeepestSpriteWin(pSprite)->firstChild;
+    while (pWin) {
+#ifdef _F_INPUT_REDIRECTION_
+        CompositeXYScreenToWindowRootCoordinate(pWin, rootX, rootY, &x, &y);
+#endif //_F_INPUT_REDIRECTION_
+        if ((pWin->mapped) &&
+            (x >= pWin->drawable.x - wBorderWidth(pWin)) &&
+            (x < pWin->drawable.x + (int) pWin->drawable.width +
+             wBorderWidth(pWin)) &&
+            (y >= pWin->drawable.y - wBorderWidth(pWin)) &&
+            (y < pWin->drawable.y + (int) pWin->drawable.height +
+             wBorderWidth(pWin))
+            /* When a window is shaped, a further check
+             * is made to see if the point is inside
+             * borderSize
+             */
+            && (!wBoundingShape(pWin) || PointInBorderSize(pWin, x, y))
+            && (!wInputShape(pWin) ||
+                RegionContainsPoint(wInputShape(pWin),
+                                    x - pWin->drawable.x,
+                                    y - pWin->drawable.y, &box))
+#ifdef ROOTLESS
+            /* In rootless mode windows may be offscreen, even when
+             * they're in X's stack. (E.g. if the native window system
+             * implements some form of virtual desktop system).
+             */
+            && !pWin->rootlessUnhittable
+#endif
+            ) {
+            if (pSprite->spriteTraceGood >= pSprite->spriteTraceSize) {
+                pSprite->spriteTraceSize += 10;
+                pSprite->spriteTrace = realloc(pSprite->spriteTrace,
+                                               pSprite->spriteTraceSize *
+                                               sizeof(WindowPtr));
+            }
+            pSprite->spriteTrace[pSprite->spriteTraceGood++] = pWin;
+            pWin = pWin->firstChild;
+        }
+        else
+            pWin = pWin->nextSib;
+    }
+    return DeepestSpriteWin(pSprite);
+}
+
+/**
+ * Traversed from the root window to the window at the position x/y. While
+ * traversing, it sets up the traversal history in the spriteTrace array.
+ * After completing, the spriteTrace history is set in the following way:
+ *   spriteTrace[0] ... root window
+ *   spriteTrace[1] ... top level window that encloses x/y
+ *       ...
+ *   spriteTrace[spriteTraceGood - 1] ... window at x/y
+ *
+ * @returns the window at the given coordinates.
+ */
+WindowPtr
+miXYToWindow(ScreenPtr pScreen, SpritePtr pSprite, int x, int y)
+{
+    pSprite->spriteTraceGood = 1;       /* root window still there */
+    return miSpriteTrace(pSprite, x, y);
+}
index 767a65a..a7f432a 100644 (file)
@@ -2,7 +2,7 @@ noinst_LTLIBRARIES = libdamage.la
 
 AM_CFLAGS = $(DIX_CFLAGS)
 
-INCLUDES = -I$(srcdir)/../cw
+AM_CPPFLAGS = -I$(srcdir)/../cw
 
 if XORG
 sdk_HEADERS = damage.h damagestr.h
index 2d2b422..9bd9c84 100644 (file)
@@ -119,51 +119,6 @@ getDrawableDamageRef(DrawablePtr pDrawable)
     DamagePtr  *pPrev = (DamagePtr *) \
        dixLookupPrivateAddr(&(pWindow)->devPrivates, damageWinPrivateKey)
 
-static void
-damageReportDamagePostRendering(DamagePtr pDamage, RegionPtr pOldDamage,
-                                RegionPtr pDamageRegion)
-{
-    BoxRec tmpBox;
-    RegionRec tmpRegion, newDamage;
-    Bool was_empty;
-
-    RegionUnion(&newDamage, pOldDamage, pDamageRegion);
-
-    switch (pDamage->damageLevel) {
-    case DamageReportRawRegion:
-        (*pDamage->damageReportPostRendering) (pDamage, pDamageRegion,
-                                               pDamage->closure);
-        break;
-    case DamageReportDeltaRegion:
-        RegionNull(&tmpRegion);
-        RegionSubtract(&tmpRegion, pDamageRegion, pOldDamage);
-        if (RegionNotEmpty(&tmpRegion)) {
-            (*pDamage->damageReportPostRendering) (pDamage, &tmpRegion,
-                                                   pDamage->closure);
-        }
-        RegionUninit(&tmpRegion);
-        break;
-    case DamageReportBoundingBox:
-        tmpBox = *RegionExtents(pOldDamage);
-        if (!BOX_SAME(&tmpBox, RegionExtents(&newDamage))) {
-            (*pDamage->damageReportPostRendering) (pDamage, &newDamage,
-                                                   pDamage->closure);
-        }
-        break;
-    case DamageReportNonEmpty:
-        was_empty = !RegionNotEmpty(pOldDamage);
-        if (was_empty && RegionNotEmpty(&newDamage)) {
-            (*pDamage->damageReportPostRendering) (pDamage, &newDamage,
-                                                   pDamage->closure);
-        }
-        break;
-    case DamageReportNone:
-        break;
-    }
-
-    RegionUninit(&newDamage);
-}
-
 #if DAMAGE_DEBUG_ENABLE
 static void
 _damageRegionAppend(DrawablePtr pDrawable, RegionPtr pRegion, Bool clip,
@@ -299,14 +254,10 @@ damageRegionAppend(DrawablePtr pDrawable, RegionPtr pRegion, Bool clip,
             RegionTranslate(pDamageRegion, -draw_x, -draw_y);
 
         /* Store damage region if needed after submission. */
-        if (pDamage->reportAfter || pDamage->damageMarker)
+        if (pDamage->reportAfter)
             RegionUnion(&pDamage->pendingDamage,
                         &pDamage->pendingDamage, pDamageRegion);
 
-        /* Duplicate current damage if needed. */
-        if (pDamage->damageMarker)
-            RegionCopy(&pDamage->backupDamage, &pDamage->damage);
-
         /* Report damage now, if desired. */
         if (!pDamage->reportAfter) {
             if (pDamage->damageReport)
@@ -335,12 +286,6 @@ damageRegionProcessPending(DrawablePtr pDrawable)
     drawableDamage(pDrawable);
 
     for (; pDamage != NULL; pDamage = pDamage->pNext) {
-        /* submit damage marker whenever possible. */
-        if (pDamage->damageMarker)
-            (*pDamage->damageMarker) (pDrawable, pDamage,
-                                      &pDamage->backupDamage,
-                                      &pDamage->pendingDamage,
-                                      pDamage->closure);
         if (pDamage->reportAfter) {
             /* It's possible that there is only interest in postRendering reporting. */
             if (pDamage->damageReport)
@@ -350,10 +295,8 @@ damageRegionProcessPending(DrawablePtr pDrawable)
                             &pDamage->pendingDamage);
         }
 
-        if (pDamage->reportAfter || pDamage->damageMarker)
+        if (pDamage->reportAfter)
             RegionEmpty(&pDamage->pendingDamage);
-        if (pDamage->damageMarker)
-            RegionEmpty(&pDamage->backupDamage);
     }
 
 }
@@ -383,7 +326,7 @@ static void damageValidateGC(GCPtr, unsigned long, DrawablePtr);
 static void damageChangeGC(GCPtr, unsigned long);
 static void damageCopyGC(GCPtr, unsigned long, GCPtr);
 static void damageDestroyGC(GCPtr);
-static void damageChangeClip(GCPtr, int, pointer, int);
+static void damageChangeClip(GCPtr, int, void *, int);
 static void damageDestroyClip(GCPtr);
 static void damageCopyClip(GCPtr, GCPtr);
 
@@ -416,7 +359,7 @@ damageCreateGC(GCPtr pGC)
 
 #define DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable) \
     damageGCPriv(pGC);  \
-    GCFuncs *oldFuncs = pGC->funcs; \
+    const GCFuncs *oldFuncs = pGC->funcs; \
     unwrap(pGCPriv, pGC, funcs);  \
     unwrap(pGCPriv, pGC, ops); \
 
@@ -438,7 +381,7 @@ damageValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable)
 {
     DAMAGE_GC_FUNC_PROLOGUE(pGC);
     (*pGC->funcs->ValidateGC) (pGC, changes, pDrawable);
-    pGCPriv->ops = pGC->ops;    /* just so it's not NULL */
+    pGCPriv->ops = pGC->ops; /* just so it's not NULL */
     DAMAGE_GC_FUNC_EPILOGUE(pGC);
 }
 
@@ -467,7 +410,7 @@ damageCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst)
 }
 
 static void
-damageChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects)
+damageChangeClip(GCPtr pGC, int type, void *pvalue, int nrects)
 {
     DAMAGE_GC_FUNC_PROLOGUE(pGC);
     (*pGC->funcs->ChangeClip) (pGC, type, pvalue, nrects);
@@ -1332,7 +1275,7 @@ damageDamageChars(DrawablePtr pDrawable,
 #define TT_POLY16  2
 #define TT_IMAGE16 3
 
-static int
+static void
 damageText(DrawablePtr pDrawable,
            GCPtr pGC,
            int x,
@@ -1341,39 +1284,29 @@ damageText(DrawablePtr pDrawable,
            char *chars, FontEncoding fontEncoding, Bool textType)
 {
     CharInfoPtr *charinfo;
-    CharInfoPtr *info;
     unsigned long i;
     unsigned int n;
-    int w;
     Bool imageblt;
 
     imageblt = (textType == TT_IMAGE8) || (textType == TT_IMAGE16);
 
+    if (!checkGCDamage(pDrawable, pGC))
+        return;
+
     charinfo = malloc(count * sizeof(CharInfoPtr));
     if (!charinfo)
-        return x;
+        return;
 
     GetGlyphs(pGC->font, count, (unsigned char *) chars,
               fontEncoding, &i, charinfo);
     n = (unsigned int) i;
-    w = 0;
-    if (!imageblt)
-        for (info = charinfo; i--; info++)
-            w += (*info)->metrics.characterWidth;
 
     if (n != 0) {
         damageDamageChars(pDrawable, pGC->font, x + pDrawable->x,
                           y + pDrawable->y, n, charinfo, imageblt,
                           pGC->subWindowMode);
-        if (imageblt)
-            (*pGC->ops->ImageGlyphBlt) (pDrawable, pGC, x, y, n, charinfo,
-                                        FONTGLYPHS(pGC->font));
-        else
-            (*pGC->ops->PolyGlyphBlt) (pDrawable, pGC, x, y, n, charinfo,
-                                       FONTGLYPHS(pGC->font));
     }
     free(charinfo);
-    return x + w;
 }
 
 static int
@@ -1381,12 +1314,9 @@ damagePolyText8(DrawablePtr pDrawable,
                 GCPtr pGC, int x, int y, int count, char *chars)
 {
     DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable);
-
-    if (checkGCDamage(pDrawable, pGC))
-        x = damageText(pDrawable, pGC, x, y, (unsigned long) count, chars,
-                       Linear8Bit, TT_POLY8);
-    else
-        x = (*pGC->ops->PolyText8) (pDrawable, pGC, x, y, count, chars);
+    damageText(pDrawable, pGC, x, y, (unsigned long) count, chars, Linear8Bit,
+               TT_POLY8);
+    x = (*pGC->ops->PolyText8) (pDrawable, pGC, x, y, count, chars);
     damageRegionProcessPending(pDrawable);
     DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
     return x;
@@ -1397,14 +1327,10 @@ damagePolyText16(DrawablePtr pDrawable,
                  GCPtr pGC, int x, int y, int count, unsigned short *chars)
 {
     DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable);
-
-    if (checkGCDamage(pDrawable, pGC))
-        x = damageText(pDrawable, pGC, x, y, (unsigned long) count,
-                       (char *) chars,
-                       FONTLASTROW(pGC->font) == 0 ? Linear16Bit : TwoD16Bit,
-                       TT_POLY16);
-    else
-        x = (*pGC->ops->PolyText16) (pDrawable, pGC, x, y, count, chars);
+    damageText(pDrawable, pGC, x, y, (unsigned long) count, (char *) chars,
+               FONTLASTROW(pGC->font) == 0 ? Linear16Bit : TwoD16Bit,
+               TT_POLY16);
+    x = (*pGC->ops->PolyText16) (pDrawable, pGC, x, y, count, chars);
     damageRegionProcessPending(pDrawable);
     DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
     return x;
@@ -1415,12 +1341,9 @@ damageImageText8(DrawablePtr pDrawable,
                  GCPtr pGC, int x, int y, int count, char *chars)
 {
     DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable);
-
-    if (checkGCDamage(pDrawable, pGC))
-        damageText(pDrawable, pGC, x, y, (unsigned long) count, chars,
-                   Linear8Bit, TT_IMAGE8);
-    else
-        (*pGC->ops->ImageText8) (pDrawable, pGC, x, y, count, chars);
+    damageText(pDrawable, pGC, x, y, (unsigned long) count, chars, Linear8Bit,
+               TT_IMAGE8);
+    (*pGC->ops->ImageText8) (pDrawable, pGC, x, y, count, chars);
     damageRegionProcessPending(pDrawable);
     DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
 }
@@ -1430,13 +1353,10 @@ damageImageText16(DrawablePtr pDrawable,
                   GCPtr pGC, int x, int y, int count, unsigned short *chars)
 {
     DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable);
-
-    if (checkGCDamage(pDrawable, pGC))
-        damageText(pDrawable, pGC, x, y, (unsigned long) count, (char *) chars,
-                   FONTLASTROW(pGC->font) == 0 ? Linear16Bit : TwoD16Bit,
-                   TT_IMAGE16);
-    else
-        (*pGC->ops->ImageText16) (pDrawable, pGC, x, y, count, chars);
+    damageText(pDrawable, pGC, x, y, (unsigned long) count, (char *) chars,
+               FONTLASTROW(pGC->font) == 0 ? Linear16Bit : TwoD16Bit,
+               TT_IMAGE16);
+    (*pGC->ops->ImageText16) (pDrawable, pGC, x, y, count, chars);
     damageRegionProcessPending(pDrawable);
     DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
 }
@@ -1446,7 +1366,7 @@ damageImageGlyphBlt(DrawablePtr pDrawable,
                     GCPtr pGC,
                     int x,
                     int y,
-                    unsigned int nglyph, CharInfoPtr * ppci, pointer pglyphBase)
+                    unsigned int nglyph, CharInfoPtr * ppci, void *pglyphBase)
 {
     DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable);
     damageDamageChars(pDrawable, pGC->font, x + pDrawable->x, y + pDrawable->y,
@@ -1461,7 +1381,7 @@ damagePolyGlyphBlt(DrawablePtr pDrawable,
                    GCPtr pGC,
                    int x,
                    int y,
-                   unsigned int nglyph, CharInfoPtr * ppci, pointer pglyphBase)
+                   unsigned int nglyph, CharInfoPtr * ppci, void *pglyphBase)
 {
     DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable);
     damageDamageChars(pDrawable, pGC->font, x + pDrawable->x, y + pDrawable->y,
@@ -1633,7 +1553,6 @@ damageDestroyWindow(WindowPtr pWindow)
     damageScrPriv(pScreen);
 
     while ((pDamage = damageGetWinPriv(pWindow))) {
-        DamageUnregister(&pWindow->drawable, pDamage);
         DamageDestroy(pDamage);
     }
     unwrap(pScrPriv, pScreen, DestroyWindow);
@@ -1663,14 +1582,38 @@ miDamageCreate(DamagePtr pDamage)
 {
 }
 
+/*
+ * We only wrap into the GC when there's a registered listener.  For windows,
+ * damage includes damage to children.  So if there's a GC validated against
+ * a subwindow and we then register a damage on the parent, we need to bump
+ * the serial numbers of the children to re-trigger validation.
+ *
+ * Since we can't know if a GC has been validated against one of the affected
+ * children, just bump them all to be safe.
+ */
+static int 
+damageRegisterVisit(WindowPtr pWin, void *data)
+{
+    pWin->drawable.serialNumber = NEXT_SERIAL_NUMBER;
+    return WT_WALKCHILDREN;
+}
+
 void
 miDamageRegister(DrawablePtr pDrawable, DamagePtr pDamage)
 {
+    if (pDrawable->type == DRAWABLE_WINDOW)
+        TraverseTree((WindowPtr)pDrawable, damageRegisterVisit, NULL);
+    else
+        pDrawable->serialNumber = NEXT_SERIAL_NUMBER;
 }
 
 void
 miDamageUnregister(DrawablePtr pDrawable, DamagePtr pDamage)
 {
+    if (pDrawable->type == DRAWABLE_WINDOW)
+        TraverseTree((WindowPtr)pDrawable, damageRegisterVisit, NULL);
+    else
+        pDrawable->serialNumber = NEXT_SERIAL_NUMBER;
 }
 
 void
@@ -1758,9 +1701,7 @@ DamageCreate(DamageReportFunc damageReport,
     pDamage->reportAfter = FALSE;
 
     pDamage->damageReport = damageReport;
-    pDamage->damageReportPostRendering = NULL;
     pDamage->damageDestroy = damageDestroy;
-    pDamage->damageMarker = NULL;
     pDamage->pScreen = pScreen;
 
     (*pScrPriv->funcs.Create) (pDamage);
@@ -1816,8 +1757,9 @@ DamageDrawInternal(ScreenPtr pScreen, Bool enable)
 }
 
 void
-DamageUnregister(DrawablePtr pDrawable, DamagePtr pDamage)
+DamageUnregister(DamagePtr pDamage)
 {
+    DrawablePtr pDrawable = pDamage->pDrawable;
     ScreenPtr pScreen = pDrawable->pScreen;
 
     damageScrPriv(pScreen);
@@ -1860,6 +1802,9 @@ DamageDestroy(DamagePtr pDamage)
 
     damageScrPriv(pScreen);
 
+    if (pDamage->pDrawable)
+        DamageUnregister(pDamage);
+
     if (pDamage->damageDestroy)
         (*pDamage->damageDestroy) (pDamage, pDamage->closure);
     (*pScrPriv->funcs.Destroy) (pDamage);
@@ -1928,17 +1873,6 @@ DamageRegionProcessPending(DrawablePtr pDrawable)
     damageRegionProcessPending(pDrawable);
 }
 
-/* If a damage marker is provided, then this function must be called after rendering is done. */
-/* Please do call back so any future enhancements can assume this function is called. */
-/* There are no strict timing requirements for calling this function, just as soon as (is cheaply) possible. */
-void
-DamageRegionRendered(DrawablePtr pDrawable, DamagePtr pDamage,
-                     RegionPtr pOldDamage, RegionPtr pRegion)
-{
-    if (pDamage->damageReportPostRendering)
-        damageReportDamagePostRendering(pDamage, pOldDamage, pRegion);
-}
-
 /* This call is very odd, i'm leaving it intact for API sake, but please don't use it. */
 void
 DamageDamageRegion(DrawablePtr pDrawable, RegionPtr pRegion)
@@ -1958,15 +1892,6 @@ DamageSetReportAfterOp(DamagePtr pDamage, Bool reportAfter)
     pDamage->reportAfter = reportAfter;
 }
 
-void
-DamageSetPostRenderingFunctions(DamagePtr pDamage,
-                                DamageReportFunc damageReportPostRendering,
-                                DamageMarkerFunc damageMarker)
-{
-    pDamage->damageReportPostRendering = damageReportPostRendering;
-    pDamage->damageMarker = damageMarker;
-}
-
 DamageScreenFuncsPtr
 DamageGetScreenFuncs(ScreenPtr pScreen)
 {
index c2c313a..525b2db 100644 (file)
@@ -41,12 +41,6 @@ typedef void (*DamageReportFunc) (DamagePtr pDamage, RegionPtr pRegion,
                                   void *closure);
 typedef void (*DamageDestroyFunc) (DamagePtr pDamage, void *closure);
 
-/* It's the responsibility of the driver to duplicate both regions. */
-/* At some point DamageRegionRendered() must be called. */
-typedef void (*DamageMarkerFunc) (DrawablePtr pDrawable, DamagePtr pDamage,
-                                  RegionPtr pOldDamage, RegionPtr pRegion,
-                                  void *closure);
-
 typedef void (*DamageScreenCreateFunc) (DamagePtr);
 typedef void (*DamageScreenRegisterFunc) (DrawablePtr, DamagePtr);
 typedef void (*DamageScreenUnregisterFunc) (DrawablePtr, DamagePtr);
@@ -80,7 +74,7 @@ extern _X_EXPORT void
  DamageRegister(DrawablePtr pDrawable, DamagePtr pDamage);
 
 extern _X_EXPORT void
- DamageUnregister(DrawablePtr pDrawable, DamagePtr pDamage);
+ DamageUnregister(DamagePtr pDamage);
 
 extern _X_EXPORT void
  DamageDestroy(DamagePtr pDamage);
@@ -105,12 +99,6 @@ extern _X_EXPORT void
 extern _X_EXPORT void
  DamageRegionProcessPending(DrawablePtr pDrawable);
 
-/* Call this some time after rendering is done, only relevant when a damageMarker is provided. */
-extern _X_EXPORT void
-
-DamageRegionRendered(DrawablePtr pDrawable, DamagePtr pDamage,
-                     RegionPtr pOldDamage, RegionPtr pRegion);
-
 /* Call this when you create a new Damage and you wish to send an initial damage message (to it). */
 extern _X_EXPORT void
  DamageReportDamage(DamagePtr pDamage, RegionPtr pDamageRegion);
@@ -122,12 +110,6 @@ extern _X_EXPORT void
 extern _X_EXPORT void
  DamageSetReportAfterOp(DamagePtr pDamage, Bool reportAfter);
 
-extern _X_EXPORT void
-
-DamageSetPostRenderingFunctions(DamagePtr pDamage,
-                                DamageReportFunc damageReportPostRendering,
-                                DamageMarkerFunc damageMarker);
-
 extern _X_EXPORT DamageScreenFuncsPtr DamageGetScreenFuncs(ScreenPtr);
 
 #endif                          /* _DAMAGE_H_ */
index 8918990..2786156 100644 (file)
@@ -44,13 +44,10 @@ typedef struct _damage {
     DrawablePtr pDrawable;
 
     DamageReportFunc damageReport;
-    DamageReportFunc damageReportPostRendering;
     DamageDestroyFunc damageDestroy;
-    DamageMarkerFunc damageMarker;
 
     Bool reportAfter;
     RegionRec pendingDamage;    /* will be flushed post submission at the latest */
-    RegionRec backupDamage;     /* for use with damageMarker */
     ScreenPtr pScreen;
     PrivateRec *devPrivates;
 } DamageRec;
@@ -79,8 +76,8 @@ typedef struct _damageScrPriv {
 } DamageScrPrivRec, *DamageScrPrivPtr;
 
 typedef struct _damageGCPriv {
-    GCOps *ops;
-    GCFuncs *funcs;
+    const GCOps *ops;
+    const GCFuncs *funcs;
 } DamageGCPrivRec, *DamageGCPrivPtr;
 
 /* XXX should move these into damage.c, damageScrPrivateIndex is static */
index d8f43bd..5043627 100644 (file)
@@ -202,7 +202,7 @@ RootlessStartDrawing(WindowPtr pWindow)
  *  damaged regions are flushed to the screen.
  */
 static int
-RestorePreDrawingPixmapVisitor(WindowPtr pWindow, pointer data)
+RestorePreDrawingPixmapVisitor(WindowPtr pWindow, void *data)
 {
     RootlessWindowRec *winRec = (RootlessWindowRec *) data;
     ScreenPtr pScreen = pWindow->drawable.pScreen;
@@ -249,7 +249,7 @@ RootlessStopDrawing(WindowPtr pWindow, Bool flush)
         SCREENREC(pScreen)->imp->StopDrawing(winRec->wid, flush);
 
         FreeScratchPixmapHeader(winRec->pixmap);
-        TraverseTree(top, RestorePreDrawingPixmapVisitor, (pointer) winRec);
+        TraverseTree(top, RestorePreDrawingPixmapVisitor, (void *) winRec);
         winRec->pixmap = NULL;
 
         winRec->is_drawing = FALSE;
index 9328995..23ff393 100644 (file)
@@ -55,7 +55,7 @@ static void RootlessValidateGC(GCPtr pGC, unsigned long changes,
 static void RootlessChangeGC(GCPtr pGC, unsigned long mask);
 static void RootlessCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst);
 static void RootlessDestroyGC(GCPtr pGC);
-static void RootlessChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects);
+static void RootlessChangeClip(GCPtr pGC, int type, void *pvalue, int nrects);
 static void RootlessDestroyClip(GCPtr pGC);
 static void RootlessCopyClip(GCPtr pgcDst, GCPtr pgcSrc);
 
@@ -113,10 +113,10 @@ static void RootlessImageText16(DrawablePtr dst, GCPtr pGC, int x, int y,
                                 int count, unsigned short *chars);
 static void RootlessImageGlyphBlt(DrawablePtr dst, GCPtr pGC, int x, int y,
                                   unsigned int nglyphInit,
-                                  CharInfoPtr * ppciInit, pointer unused);
+                                  CharInfoPtr * ppciInit, void *unused);
 static void RootlessPolyGlyphBlt(DrawablePtr dst, GCPtr pGC, int x, int y,
                                  unsigned int nglyph, CharInfoPtr * ppci,
-                                 pointer pglyphBase);
+                                 void *pglyphBase);
 static void RootlessPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr dst,
                                int dx, int dy, int xOrg, int yOrg);
 
@@ -368,7 +368,7 @@ RootlessDestroyGC(GCPtr pGC)
 }
 
 static void
-RootlessChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects)
+RootlessChangeClip(GCPtr pGC, int type, void *pvalue, int nrects)
 {
     GCFUNC_UNWRAP(pGC);
     pGC->funcs->ChangeClip(pGC, type, pvalue, nrects);
@@ -1356,7 +1356,7 @@ RootlessPolyText16(DrawablePtr dst, GCPtr pGC,
 static void
 RootlessImageGlyphBlt(DrawablePtr dst, GCPtr pGC,
                       int x, int y, unsigned int nglyphInit,
-                      CharInfoPtr * ppciInit, pointer unused)
+                      CharInfoPtr * ppciInit, void *unused)
 {
     GC_SAVE(pGC);
     GCOP_UNWRAP(pGC);
@@ -1419,7 +1419,7 @@ RootlessImageGlyphBlt(DrawablePtr dst, GCPtr pGC,
 static void
 RootlessPolyGlyphBlt(DrawablePtr dst, GCPtr pGC,
                      int x, int y, unsigned int nglyph,
-                     CharInfoPtr * ppci, pointer pglyphBase)
+                     CharInfoPtr * ppci, void *pglyphBase)
 {
     GCOP_UNWRAP(pGC);
     RL_DEBUG_MSG("polyglyph start ");
index a1af3e7..6226ee8 100644 (file)
@@ -603,7 +603,7 @@ RootlessQueueRedisplay(ScreenPtr pScreen)
  *  on select().
  */
 static void
-RootlessBlockHandler(pointer pbdata, OSTimePtr pTimeout, pointer pReadmask)
+RootlessBlockHandler(void *pbdata, OSTimePtr pTimeout, void *pReadmask)
 {
     ScreenPtr pScreen = pbdata;
     RootlessScreenRec *screenRec = SCREENREC(pScreen);
@@ -616,7 +616,7 @@ RootlessBlockHandler(pointer pbdata, OSTimePtr pTimeout, pointer pReadmask)
 }
 
 static void
-RootlessWakeupHandler(pointer data, int i, pointer LastSelectMask)
+RootlessWakeupHandler(void *data, int i, void *LastSelectMask)
 {
     // nothing here
 }
@@ -728,7 +728,7 @@ RootlessInit(ScreenPtr pScreen, RootlessFrameProcsPtr procs)
 
     if (!RegisterBlockAndWakeupHandlers(RootlessBlockHandler,
                                         RootlessWakeupHandler,
-                                        (pointer) pScreen)) {
+                                        (void *) pScreen)) {
         return FALSE;
     }
 
index cfcb6e5..3dbd588 100644 (file)
@@ -625,7 +625,7 @@ RootlessRestackWindow(WindowPtr pWin, WindowPtr pOldNextSib)
  */
 
 // Globals needed during window resize and move.
-static pointer gResizeDeathBits = NULL;
+static void *gResizeDeathBits = NULL;
 static int gResizeDeathCount = 0;
 static PixmapPtr gResizeDeathPix[2] = { NULL, NULL };
 
@@ -684,7 +684,7 @@ RootlessResizeCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg,
     if (gResizeDeathCount == 1) {
         /* Simple case, we only have a single source pixmap. */
 
-        fbCopyRegion(&gResizeDeathPix[0]->drawable,
+        miCopyRegion(&gResizeDeathPix[0]->drawable,
                      &pScreen->GetWindowPixmap(pWin)->drawable, 0,
                      &rgnDst, dx, dy, fbCopyWindowProc, 0, 0);
     }
@@ -700,7 +700,7 @@ RootlessResizeCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg,
             RegionNull(&clipped);
             RegionIntersect(&rgnDst, &clip, &clipped);
 
-            fbCopyRegion(&gResizeDeathPix[i]->drawable,
+            miCopyRegion(&gResizeDeathPix[i]->drawable,
                          &pScreen->GetWindowPixmap(pWin)->drawable, 0,
                          &clipped, dx, dy, fbCopyWindowProc, 0, 0);
 
@@ -778,7 +778,7 @@ RootlessCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
     else {
         RootlessStartDrawing(pWin);
 
-        fbCopyRegion((DrawablePtr) pWin, (DrawablePtr) pWin,
+        miCopyRegion((DrawablePtr) pWin, (DrawablePtr) pWin,
                      0, &rgnDst, dx, dy, fbCopyWindowProc, 0, 0);
 
         /* prgnSrc has been translated to dst position */
index 30f7bda..27cf414 100644 (file)
@@ -7,9 +7,14 @@ sdk_HEADERS = shadow.h
 endif
 
 libshadow_la_SOURCES =         \
+       c2p_core.h              \
        shadow.c                \
        shadow.h                \
+       shafb4.c                \
+       shafb8.c                \
        shalloc.c               \
+       shiplan2p4.c            \
+       shiplan2p8.c            \
        shpacked.c              \
        shplanar8.c             \
        shplanar.c              \
diff --git a/miext/shadow/c2p_core.h b/miext/shadow/c2p_core.h
new file mode 100644 (file)
index 0000000..5b9ea06
--- /dev/null
@@ -0,0 +1,187 @@
+/*
+ *  Fast C2P (Chunky-to-Planar) Conversion
+ *
+ *  NOTES:
+ *    - This code was inspired by Scout's C2P tutorial
+ *    - It assumes to run on a big endian system
+ *
+ *  Copyright Â© 2003-2008 Geert Uytterhoeven
+ *
+ *  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.
+ */
+
+
+    /*
+     *  Basic transpose step
+     */
+
+static inline void _transp(CARD32 d[], unsigned int i1, unsigned int i2,
+                           unsigned int shift, CARD32 mask)
+{
+    CARD32 t = (d[i1] ^ (d[i2] >> shift)) & mask;
+
+    d[i1] ^= t;
+    d[i2] ^= t << shift;
+}
+
+
+static inline void c2p_unsupported(void) {
+    BUG_WARN(1);
+}
+
+static inline CARD32 get_mask(unsigned int n)
+{
+    switch (n) {
+    case 1:
+        return 0x55555555;
+
+    case 2:
+        return 0x33333333;
+
+    case 4:
+        return 0x0f0f0f0f;
+
+    case 8:
+        return 0x00ff00ff;
+
+    case 16:
+        return 0x0000ffff;
+    }
+
+    c2p_unsupported();
+    return 0;
+}
+
+
+    /*
+     *  Transpose operations on 8 32-bit words
+     */
+
+static inline void transp8(CARD32 d[], unsigned int n, unsigned int m)
+{
+    CARD32 mask = get_mask(n);
+
+    switch (m) {
+    case 1:
+        /* First n x 1 block */
+        _transp(d, 0, 1, n, mask);
+        /* Second n x 1 block */
+        _transp(d, 2, 3, n, mask);
+        /* Third n x 1 block */
+        _transp(d, 4, 5, n, mask);
+        /* Fourth n x 1 block */
+        _transp(d, 6, 7, n, mask);
+        return;
+
+    case 2:
+        /* First n x 2 block */
+        _transp(d, 0, 2, n, mask);
+        _transp(d, 1, 3, n, mask);
+        /* Second n x 2 block */
+        _transp(d, 4, 6, n, mask);
+        _transp(d, 5, 7, n, mask);
+        return;
+
+    case 4:
+        /* Single n x 4 block */
+        _transp(d, 0, 4, n, mask);
+        _transp(d, 1, 5, n, mask);
+        _transp(d, 2, 6, n, mask);
+        _transp(d, 3, 7, n, mask);
+        return;
+    }
+
+    c2p_unsupported();
+}
+
+
+    /*
+     *  Transpose operations on 4 32-bit words
+     */
+
+static inline void transp4(CARD32 d[], unsigned int n, unsigned int m)
+{
+    CARD32 mask = get_mask(n);
+
+    switch (m) {
+    case 1:
+        /* First n x 1 block */
+        _transp(d, 0, 1, n, mask);
+        /* Second n x 1 block */
+        _transp(d, 2, 3, n, mask);
+        return;
+
+    case 2:
+        /* Single n x 2 block */
+        _transp(d, 0, 2, n, mask);
+        _transp(d, 1, 3, n, mask);
+        return;
+    }
+
+    c2p_unsupported();
+}
+
+
+    /*
+     *  Transpose operations on 4 32-bit words (reverse order)
+     */
+
+static inline void transp4x(CARD32 d[], unsigned int n, unsigned int m)
+{
+    CARD32 mask = get_mask(n);
+
+    switch (m) {
+    case 2:
+        /* Single n x 2 block */
+        _transp(d, 2, 0, n, mask);
+        _transp(d, 3, 1, n, mask);
+        return;
+    }
+
+    c2p_unsupported();
+}
+
+
+    /*
+     *  Transpose operations on 2 32-bit words
+     */
+
+static inline void transp2(CARD32 d[], unsigned int n)
+{
+    CARD32 mask = get_mask(n);
+
+    /* Single n x 1 block */
+    _transp(d, 0, 1, n, mask);
+    return;
+}
+
+
+    /*
+     *  Transpose operations on 2 32-bit words (reverse order)
+     */
+
+static inline void transp2x(CARD32 d[], unsigned int n)
+{
+    CARD32 mask = get_mask(n);
+
+    /* Single n x 1 block */
+    _transp(d, 1, 0, n, mask);
+    return;
+}
index 2d869e5..522e21b 100644 (file)
@@ -65,7 +65,7 @@ shadowRedisplay(ScreenPtr pScreen)
 }
 
 static void
-shadowBlockHandler(pointer data, OSTimePtr pTimeout, pointer pRead)
+shadowBlockHandler(void *data, OSTimePtr pTimeout, void *pRead)
 {
     ScreenPtr pScreen = (ScreenPtr) data;
 
@@ -73,7 +73,7 @@ shadowBlockHandler(pointer data, OSTimePtr pTimeout, pointer pRead)
 }
 
 static void
-shadowWakeupHandler(pointer data, int i, pointer LastSelectMask)
+shadowWakeupHandler(void *data, int i, void *LastSelectMask)
 {
 }
 
@@ -183,7 +183,7 @@ shadowAdd(ScreenPtr pScreen, PixmapPtr pPixmap, ShadowUpdateProc update,
     shadowBuf(pScreen);
 
     if (!RegisterBlockAndWakeupHandlers(shadowBlockHandler, shadowWakeupHandler,
-                                        (pointer) pScreen))
+                                        (void *) pScreen))
         return FALSE;
 
     /*
@@ -219,7 +219,7 @@ shadowRemove(ScreenPtr pScreen, PixmapPtr pPixmap)
     shadowBuf(pScreen);
 
     if (pBuf->pPixmap) {
-        DamageUnregister(&pBuf->pPixmap->drawable, pBuf->pDamage);
+        DamageUnregister(pBuf->pDamage);
         pBuf->update = 0;
         pBuf->window = 0;
         pBuf->randr = 0;
@@ -228,7 +228,7 @@ shadowRemove(ScreenPtr pScreen, PixmapPtr pPixmap)
     }
 
     RemoveBlockAndWakeupHandlers(shadowBlockHandler, shadowWakeupHandler,
-                                 (pointer) pScreen);
+                                 (void *) pScreen);
 }
 
 Bool
index 83de22c..421ae96 100644 (file)
@@ -96,6 +96,18 @@ shadowInit(ScreenPtr pScreen, ShadowUpdateProc update, ShadowWindowProc window);
 extern _X_EXPORT void *shadowAlloc(int width, int height, int bpp);
 
 extern _X_EXPORT void
+ shadowUpdateAfb4(ScreenPtr pScreen, shadowBufPtr pBuf);
+
+extern _X_EXPORT void
+ shadowUpdateAfb8(ScreenPtr pScreen, shadowBufPtr pBuf);
+
+extern _X_EXPORT void
+ shadowUpdateIplan2p4(ScreenPtr pScreen, shadowBufPtr pBuf);
+
+extern _X_EXPORT void
+ shadowUpdateIplan2p8(ScreenPtr pScreen, shadowBufPtr pBuf);
+
+extern _X_EXPORT void
  shadowUpdatePacked(ScreenPtr pScreen, shadowBufPtr pBuf);
 
 extern _X_EXPORT void
diff --git a/miext/shadow/shafb4.c b/miext/shadow/shafb4.c
new file mode 100644 (file)
index 0000000..d88ae1c
--- /dev/null
@@ -0,0 +1,139 @@
+/*
+ *  Copyright Â© 2013 Geert Uytterhoeven
+ *
+ *  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.
+ *
+ *  Based on shpacked.c, which is Copyright Â© 2000 Keith Packard
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <stdlib.h>
+
+#include    <X11/X.h>
+#include    "scrnintstr.h"
+#include    "windowstr.h"
+#include    <X11/fonts/font.h>
+#include    "dixfontstr.h"
+#include    <X11/fonts/fontstruct.h>
+#include    "mi.h"
+#include    "regionstr.h"
+#include    "globals.h"
+#include    "gcstruct.h"
+#include    "shadow.h"
+#include    "fb.h"
+#include    "c2p_core.h"
+
+
+    /*
+     *  Perform a full C2P step on 32 4-bit pixels, stored in 4 32-bit words
+     *  containing
+     *    - 32 4-bit chunky pixels on input
+     *    - permutated planar data (1 plane per 32-bit word) on output
+     */
+
+static void c2p_32x4(CARD32 d[4])
+{
+    transp4(d, 16, 2);
+    transp4(d, 8, 1);
+    transp4(d, 4, 2);
+    transp4(d, 2, 1);
+    transp4(d, 1, 2);
+}
+
+
+    /*
+     *  Store a full block of permutated planar data after c2p conversion
+     */
+
+static inline void store_afb4(void *dst, unsigned int stride,
+                              const CARD32 d[4])
+{
+    CARD8 *p = dst;
+
+    *(CARD32 *)p = d[3]; p += stride;
+    *(CARD32 *)p = d[1]; p += stride;
+    *(CARD32 *)p = d[2]; p += stride;
+    *(CARD32 *)p = d[0]; p += stride;
+}
+
+
+void
+shadowUpdateAfb4(ScreenPtr pScreen, shadowBufPtr pBuf)
+{
+    RegionPtr damage = shadowDamage(pBuf);
+    PixmapPtr pShadow = pBuf->pPixmap;
+    int nbox = RegionNumRects(damage);
+    BoxPtr pbox = RegionRects(damage);
+    FbBits *shaBase;
+    CARD32 *shaLine, *sha;
+    FbStride shaStride;
+    int scrLine;
+    _X_UNUSED int shaBpp, shaXoff, shaYoff;
+    int x, y, w, h;
+    int i, n;
+    CARD32 *win;
+    CARD32 off, winStride;
+    union {
+        CARD8 bytes[16];
+        CARD32 words[4];
+    } d;
+
+    fbGetDrawable(&pShadow->drawable, shaBase, shaStride, shaBpp, shaXoff,
+                  shaYoff);
+    if (sizeof(FbBits) != sizeof(CARD32))
+        shaStride = shaStride * sizeof(FbBits) / sizeof(CARD32);
+
+    while (nbox--) {
+        x = pbox->x1;
+        y = pbox->y1;
+        w = pbox->x2 - pbox->x1;
+        h = pbox->y2 - pbox->y1;
+
+        scrLine = (x & -32) / 2;
+        shaLine = (CARD32 *)shaBase + y * shaStride + scrLine / sizeof(CARD32);
+
+        off = scrLine / 4;              /* byte offset in bitplane scanline */
+        n = ((x & 31) + w + 31) / 32;   /* number of c2p units in scanline */
+
+        while (h--) {
+            sha = shaLine;
+            win = (CARD32 *) (*pBuf->window) (pScreen,
+                                             y,
+                                             off,
+                                             SHADOW_WINDOW_WRITE,
+                                             &winStride,
+                                             pBuf->closure);
+            if (!win)
+                return;
+            for (i = 0; i < n; i++) {
+                memcpy(d.bytes, sha, sizeof(d.bytes));
+                c2p_32x4(d.words);
+                store_afb4(win++, winStride, d.words);
+                sha += sizeof(d.bytes) / sizeof(*sha);
+            }
+            shaLine += shaStride;
+            y++;
+        }
+        pbox++;
+    }
+}
diff --git a/miext/shadow/shafb8.c b/miext/shadow/shafb8.c
new file mode 100644 (file)
index 0000000..8d84bfa
--- /dev/null
@@ -0,0 +1,143 @@
+/*
+ *  Copyright Â© 2013 Geert Uytterhoeven
+ *
+ *  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.
+ *
+ *  Based on shpacked.c, which is Copyright Â© 2000 Keith Packard
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <stdlib.h>
+
+#include    <X11/X.h>
+#include    "scrnintstr.h"
+#include    "windowstr.h"
+#include    <X11/fonts/font.h>
+#include    "dixfontstr.h"
+#include    <X11/fonts/fontstruct.h>
+#include    "mi.h"
+#include    "regionstr.h"
+#include    "globals.h"
+#include    "gcstruct.h"
+#include    "shadow.h"
+#include    "fb.h"
+#include    "c2p_core.h"
+
+
+    /*
+     *  Perform a full C2P step on 32 8-bit pixels, stored in 8 32-bit words
+     *  containing
+     *    - 32 8-bit chunky pixels on input
+     *    - permutated planar data (1 plane per 32-bit word) on output
+     */
+
+static void c2p_32x8(CARD32 d[8])
+{
+    transp8(d, 16, 4);
+    transp8(d, 8, 2);
+    transp8(d, 4, 1);
+    transp8(d, 2, 4);
+    transp8(d, 1, 2);
+}
+
+
+    /*
+     *  Store a full block of permutated planar data after c2p conversion
+     */
+
+static inline void store_afb8(void *dst, unsigned int stride,
+                              const CARD32 d[8])
+{
+    CARD8 *p = dst;
+
+    *(CARD32 *)p = d[7]; p += stride;
+    *(CARD32 *)p = d[5]; p += stride;
+    *(CARD32 *)p = d[3]; p += stride;
+    *(CARD32 *)p = d[1]; p += stride;
+    *(CARD32 *)p = d[6]; p += stride;
+    *(CARD32 *)p = d[4]; p += stride;
+    *(CARD32 *)p = d[2]; p += stride;
+    *(CARD32 *)p = d[0]; p += stride;
+}
+
+
+void
+shadowUpdateAfb8(ScreenPtr pScreen, shadowBufPtr pBuf)
+{
+    RegionPtr damage = shadowDamage(pBuf);
+    PixmapPtr pShadow = pBuf->pPixmap;
+    int nbox = RegionNumRects(damage);
+    BoxPtr pbox = RegionRects(damage);
+    FbBits *shaBase;
+    CARD32 *shaLine, *sha;
+    FbStride shaStride;
+    int scrLine;
+    _X_UNUSED int shaBpp, shaXoff, shaYoff;
+    int x, y, w, h;
+    int i, n;
+    CARD32 *win;
+    CARD32 off, winStride;
+    union {
+        CARD8 bytes[32];
+        CARD32 words[8];
+    } d;
+
+    fbGetDrawable(&pShadow->drawable, shaBase, shaStride, shaBpp, shaXoff,
+                  shaYoff);
+    if (sizeof(FbBits) != sizeof(CARD32))
+        shaStride = shaStride * sizeof(FbBits) / sizeof(CARD32);
+
+    while (nbox--) {
+        x = pbox->x1;
+        y = pbox->y1;
+        w = pbox->x2 - pbox->x1;
+        h = pbox->y2 - pbox->y1;
+
+        scrLine = x & -32;
+        shaLine = (CARD32 *)shaBase + y * shaStride + scrLine / sizeof(CARD32);
+
+        off = scrLine / 8;              /* byte offset in bitplane scanline */
+        n = ((x & 31) + w + 31) / 32;   /* number of c2p units in scanline */
+
+        while (h--) {
+            sha = shaLine;
+            win = (CARD32 *) (*pBuf->window) (pScreen,
+                                              y,
+                                              off,
+                                              SHADOW_WINDOW_WRITE,
+                                              &winStride,
+                                              pBuf->closure);
+            if (!win)
+                return;
+            for (i = 0; i < n; i++) {
+                memcpy(d.bytes, sha, sizeof(d.bytes));
+                c2p_32x8(d.words);
+                store_afb8(win++, winStride, d.words);
+                sha += sizeof(d.bytes) / sizeof(*sha);
+            }
+            shaLine += shaStride;
+            y++;
+        }
+        pbox++;
+    }
+}
diff --git a/miext/shadow/shiplan2p4.c b/miext/shadow/shiplan2p4.c
new file mode 100644 (file)
index 0000000..0e46bae
--- /dev/null
@@ -0,0 +1,136 @@
+/*
+ *  Copyright Â© 2013 Geert Uytterhoeven
+ *
+ *  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.
+ *
+ *  Based on shpacked.c, which is Copyright Â© 2000 Keith Packard
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <stdlib.h>
+
+#include    <X11/X.h>
+#include    "scrnintstr.h"
+#include    "windowstr.h"
+#include    <X11/fonts/font.h>
+#include    "dixfontstr.h"
+#include    <X11/fonts/fontstruct.h>
+#include    "mi.h"
+#include    "regionstr.h"
+#include    "globals.h"
+#include    "gcstruct.h"
+#include    "shadow.h"
+#include    "fb.h"
+#include    "c2p_core.h"
+
+
+    /*
+     *  Perform a full C2P step on 16 4-bit pixels, stored in 2 32-bit words
+     *  containing
+     *    - 16 4-bit chunky pixels on input
+     *    - permutated planar data (2 planes per 32-bit word) on output
+     */
+
+static void c2p_16x4(CARD32 d[2])
+{
+    transp2(d, 8);
+    transp2(d, 2);
+    transp2x(d, 1);
+    transp2(d, 16);
+    transp2(d, 4);
+    transp2(d, 1);
+}
+
+
+    /*
+     *  Store a full block of iplan2p4 data after c2p conversion
+     */
+
+static inline void store_iplan2p4(void *dst, const CARD32 d[2])
+{
+    CARD32 *p = dst;
+
+    *p++ = d[0];
+    *p++ = d[1];
+}
+
+
+void
+shadowUpdateIplan2p4(ScreenPtr pScreen, shadowBufPtr pBuf)
+{
+    RegionPtr damage = shadowDamage(pBuf);
+    PixmapPtr pShadow = pBuf->pPixmap;
+    int nbox = RegionNumRects(damage);
+    BoxPtr pbox = RegionRects(damage);
+    FbBits *shaBase;
+    CARD16 *shaLine, *sha;
+    FbStride shaStride;
+    int scrLine;
+    _X_UNUSED int shaBpp, shaXoff, shaYoff;
+    int x, y, w, h;
+    int i, n;
+    CARD16 *win;
+    _X_UNUSED CARD32 winSize;
+    union {
+        CARD8 bytes[8];
+        CARD32 words[2];
+    } d;
+
+    fbGetDrawable(&pShadow->drawable, shaBase, shaStride, shaBpp, shaXoff,
+                  shaYoff);
+    shaStride *= sizeof(FbBits) / sizeof(CARD16);
+
+    while (nbox--) {
+        x = pbox->x1;
+        y = pbox->y1;
+        w = pbox->x2 - pbox->x1;
+        h = pbox->y2 - pbox->y1;
+
+        scrLine = (x & -16) / 2;
+        shaLine = (CARD16 *)shaBase + y * shaStride + scrLine / sizeof(CARD16);
+
+        n = ((x & 15) + w + 15) / 16;   /* number of c2p units in scanline */
+
+        while (h--) {
+            sha = shaLine;
+            win = (CARD16 *) (*pBuf->window) (pScreen,
+                                              y,
+                                              scrLine,
+                                              SHADOW_WINDOW_WRITE,
+                                              &winSize,
+                                              pBuf->closure);
+            if (!win)
+                return;
+            for (i = 0; i < n; i++) {
+                memcpy(d.bytes, sha, sizeof(d.bytes));
+                c2p_16x4(d.words);
+                store_iplan2p4(win, d.words);
+                sha += sizeof(d.bytes) / sizeof(*sha);
+                win += sizeof(d.bytes) / sizeof(*win);
+            }
+            shaLine += shaStride;
+            y++;
+        }
+        pbox++;
+    }
+}
diff --git a/miext/shadow/shiplan2p8.c b/miext/shadow/shiplan2p8.c
new file mode 100644 (file)
index 0000000..17d6a13
--- /dev/null
@@ -0,0 +1,137 @@
+/*
+ *  Copyright Â© 2013 Geert Uytterhoeven
+ *
+ *  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.
+ *
+ *  Based on shpacked.c, which is Copyright Â© 2000 Keith Packard
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <stdlib.h>
+
+#include    <X11/X.h>
+#include    "scrnintstr.h"
+#include    "windowstr.h"
+#include    <X11/fonts/font.h>
+#include    "dixfontstr.h"
+#include    <X11/fonts/fontstruct.h>
+#include    "mi.h"
+#include    "regionstr.h"
+#include    "globals.h"
+#include    "gcstruct.h"
+#include    "shadow.h"
+#include    "fb.h"
+#include    "c2p_core.h"
+
+
+    /*
+     *  Perform a full C2P step on 16 8-bit pixels, stored in 4 32-bit words
+     *  containing
+     *    - 16 8-bit chunky pixels on input
+     *    - permutated planar data (2 planes per 32-bit word) on output
+     */
+
+static void c2p_16x8(CARD32 d[4])
+{
+    transp4(d, 8, 2);
+    transp4(d, 1, 2);
+    transp4x(d, 16, 2);
+    transp4x(d, 2, 2);
+    transp4(d, 4, 1);
+}
+
+
+    /*
+     *  Store a full block of permutated iplan2p8 data after c2p conversion
+     */
+
+static inline void store_iplan2p8(void *dst, const CARD32 d[4])
+{
+    CARD32 *p = dst;
+
+    *p++ = d[1];
+    *p++ = d[3];
+    *p++ = d[0];
+    *p++ = d[2];
+}
+
+
+void
+shadowUpdateIplan2p8(ScreenPtr pScreen, shadowBufPtr pBuf)
+{
+    RegionPtr damage = shadowDamage(pBuf);
+    PixmapPtr pShadow = pBuf->pPixmap;
+    int nbox = RegionNumRects(damage);
+    BoxPtr pbox = RegionRects(damage);
+    FbBits *shaBase;
+    CARD16 *shaLine, *sha;
+    FbStride shaStride;
+    int scrLine;
+    _X_UNUSED int shaBpp, shaXoff, shaYoff;
+    int x, y, w, h;
+    int i, n;
+    CARD16 *win;
+    _X_UNUSED CARD32 winSize;
+    union {
+        CARD8 bytes[16];
+        CARD32 words[4];
+    } d;
+
+    fbGetDrawable(&pShadow->drawable, shaBase, shaStride, shaBpp, shaXoff,
+                  shaYoff);
+    shaStride *= sizeof(FbBits) / sizeof(CARD16);
+
+    while (nbox--) {
+        x = pbox->x1;
+        y = pbox->y1;
+        w = pbox->x2 - pbox->x1;
+        h = pbox->y2 - pbox->y1;
+
+        scrLine = x & -16;
+        shaLine = (CARD16 *)shaBase + y * shaStride + scrLine / sizeof(CARD16);
+
+        n = ((x & 15) + w + 15) / 16;   /* number of c2p units in scanline */
+
+        while (h--) {
+            sha = shaLine;
+            win = (CARD16 *) (*pBuf->window) (pScreen,
+                                              y,
+                                              scrLine,
+                                              SHADOW_WINDOW_WRITE,
+                                              &winSize,
+                                              pBuf->closure);
+            if (!win)
+                return;
+            for (i = 0; i < n; i++) {
+                memcpy(d.bytes, sha, sizeof(d.bytes));
+                c2p_16x8(d.words);
+                store_iplan2p8(win, d.words);
+                sha += sizeof(d.bytes) / sizeof(*sha);
+                win += sizeof(d.bytes) / sizeof(*win);
+            }
+            shaLine += shaStride;
+            y++;
+        }
+        pbox++;
+    }
+}
index d2b2e5e..5ef18f8 100644 (file)
@@ -98,7 +98,6 @@ shadowUpdatePacked(ScreenPtr pScreen, shadowBufPtr pBuf)
                     i = width;
                 width -= i;
                 scr += i;
-#define PickBit(a,i)   (((a) >> (i)) & 1)
                 memcpy(win, sha, i * sizeof(FbBits));
                 sha += i;
             }
index 36b2816..34961d5 100644 (file)
@@ -2,13 +2,20 @@ noinst_LTLIBRARIES = libsync.la
 
 AM_CFLAGS = $(DIX_CFLAGS)
 
-INCLUDES = 
+AM_CPPFLAGS = 
 
 if XORG
-sdk_HEADERS = misync.h misyncstr.h
+sdk_HEADERS = misync.h misyncstr.h misyncshm.h misyncfd.h
 endif
 
+XSHMFENCE_SRCS = misyncshm.c
+
 libsync_la_SOURCES =   \
        misync.c        \
        misync.h        \
+       misyncfd.c      \
        misyncstr.h
+
+if XSHMFENCE
+libsync_la_SOURCES += $(XSHMFENCE_SRCS)
+endif
index d24921a..3d03d1b 100644 (file)
 #include "misync.h"
 #include "misyncstr.h"
 
-static DevPrivateKeyRec syncScreenPrivateKeyRec;
-static DevPrivateKey syncScreenPrivateKey = &syncScreenPrivateKeyRec;
-
-#define SYNC_SCREEN_PRIV(pScreen)                              \
-    (SyncScreenPrivPtr) dixLookupPrivate(&pScreen->devPrivates,        \
-                                        syncScreenPrivateKey)
-
-typedef struct _syncScreenPriv {
-    /* Wrappable sync-specific screen functions */
-    SyncScreenFuncsRec funcs;
-
-    /* Wrapped screen functions */
-    CloseScreenProcPtr CloseScreen;
-} SyncScreenPrivRec, *SyncScreenPrivPtr;
+DevPrivateKeyRec miSyncScreenPrivateKey;
 
 /* Default implementations of the sync screen functions */
 void
@@ -62,25 +49,25 @@ miSyncScreenDestroyFence(ScreenPtr pScreen, SyncFence * pFence)
 }
 
 /* Default implementations of the per-object functions */
-static void
+void
 miSyncFenceSetTriggered(SyncFence * pFence)
 {
     pFence->triggered = TRUE;
 }
 
-static void
+void
 miSyncFenceReset(SyncFence * pFence)
 {
     pFence->triggered = FALSE;
 }
 
-static Bool
+Bool
 miSyncFenceCheckTriggered(SyncFence * pFence)
 {
     return pFence->triggered;
 }
 
-static void
+void
 miSyncFenceAddTrigger(SyncTrigger * pTrigger)
 {
     (void) pTrigger;
@@ -88,7 +75,7 @@ miSyncFenceAddTrigger(SyncTrigger * pTrigger)
     return;
 }
 
-static void
+void
 miSyncFenceDeleteTrigger(SyncTrigger * pTrigger)
 {
     (void) pTrigger;
@@ -182,20 +169,21 @@ miSyncSetup(ScreenPtr pScreen)
         &miSyncScreenDestroyFence
     };
 
-    if (dixPrivateKeyRegistered(syncScreenPrivateKey))
-        return TRUE;
-
-    if (!dixRegisterPrivateKey(syncScreenPrivateKey, PRIVATE_SCREEN,
-                               sizeof(SyncScreenPrivRec)))
-        return FALSE;
+    if (!dixPrivateKeyRegistered(&miSyncScreenPrivateKey)) {
+        if (!dixRegisterPrivateKey(&miSyncScreenPrivateKey, PRIVATE_SCREEN,
+                                   sizeof(SyncScreenPrivRec)))
+            return FALSE;
+    }
 
     pScreenPriv = SYNC_SCREEN_PRIV(pScreen);
 
-    pScreenPriv->funcs = miSyncScreenFuncs;
+    if (!pScreenPriv->funcs.CreateFence) {
+        pScreenPriv->funcs = miSyncScreenFuncs;
 
-    /* Wrap CloseScreen to clean up */
-    pScreenPriv->CloseScreen = pScreen->CloseScreen;
-    pScreen->CloseScreen = SyncCloseScreen;
+        /* Wrap CloseScreen to clean up */
+        pScreenPriv->CloseScreen = pScreen->CloseScreen;
+        pScreen->CloseScreen = SyncCloseScreen;
+    }
 
     return TRUE;
 }
index deebb82..dc78c5f 100644 (file)
@@ -42,8 +42,8 @@ typedef struct _syncScreenFuncs {
     SyncScreenDestroyFenceFunc DestroyFence;
 } SyncScreenFuncsRec, *SyncScreenFuncsPtr;
 
-extern _X_EXPORT void
 
+extern _X_EXPORT void
 miSyncScreenCreateFence(ScreenPtr pScreen, SyncFence * pFence,
                         Bool initially_triggered);
 extern _X_EXPORT void
@@ -76,4 +76,25 @@ extern _X_EXPORT SyncScreenFuncsPtr miSyncGetScreenFuncs(ScreenPtr pScreen);
 extern _X_EXPORT Bool
  miSyncSetup(ScreenPtr pScreen);
 
+Bool
+miSyncFenceCheckTriggered(SyncFence * pFence);
+
+void
+miSyncFenceSetTriggered(SyncFence * pFence);
+
+void
+miSyncFenceReset(SyncFence * pFence);
+
+void
+miSyncFenceAddTrigger(SyncTrigger * pTrigger);
+
+void
+miSyncFenceDeleteTrigger(SyncTrigger * pTrigger);
+
+int
+miSyncInitFenceFromFD(DrawablePtr pDraw, SyncFence *pFence, int fd, BOOL initially_triggered);
+
+int
+miSyncFDFromFence(DrawablePtr pDraw, SyncFence *pFence);
+
 #endif                          /* _MISYNC_H_ */
diff --git a/miext/sync/misyncfd.c b/miext/sync/misyncfd.c
new file mode 100644 (file)
index 0000000..93ff85f
--- /dev/null
@@ -0,0 +1,99 @@
+/*
+ * Copyright Â© 2013 Keith Packard
+ *
+ * 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 the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  The copyright holders make no representations
+ * about the suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS 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_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "scrnintstr.h"
+#include "misync.h"
+#include "misyncstr.h"
+#include "misyncfd.h"
+#include "pixmapstr.h"
+
+static DevPrivateKeyRec syncFdScreenPrivateKey;
+
+typedef struct _SyncFdScreenPrivate {
+    SyncFdScreenFuncsRec        funcs;
+} SyncFdScreenPrivateRec, *SyncFdScreenPrivatePtr;
+
+static inline SyncFdScreenPrivatePtr sync_fd_screen_priv(ScreenPtr pScreen)
+{
+    if (!dixPrivateKeyRegistered(&syncFdScreenPrivateKey))
+        return NULL;
+    return dixLookupPrivate(&pScreen->devPrivates, &syncFdScreenPrivateKey);
+}
+
+int
+miSyncInitFenceFromFD(DrawablePtr pDraw, SyncFence *pFence, int fd, BOOL initially_triggered)
+
+{
+    SyncFdScreenPrivatePtr      priv = sync_fd_screen_priv(pDraw->pScreen);
+
+    if (!priv)
+        return BadMatch;
+
+    return (*priv->funcs.CreateFenceFromFd)(pDraw->pScreen, pFence, fd, initially_triggered);
+}
+
+int
+miSyncFDFromFence(DrawablePtr pDraw, SyncFence *pFence)
+{
+    SyncFdScreenPrivatePtr      priv = sync_fd_screen_priv(pDraw->pScreen);
+
+    if (!priv)
+        return -1;
+
+    return (*priv->funcs.GetFenceFd)(pDraw->pScreen, pFence);
+}
+
+_X_EXPORT Bool miSyncFdScreenInit(ScreenPtr pScreen,
+                                  const SyncFdScreenFuncsRec *funcs)
+{
+    SyncFdScreenPrivatePtr     priv;
+
+    /* Check to see if we've already been initialized */
+    if (sync_fd_screen_priv(pScreen) != NULL)
+        return FALSE;
+
+    if (!miSyncSetup(pScreen))
+        return FALSE;
+    
+    if (!dixPrivateKeyRegistered(&syncFdScreenPrivateKey)) {
+        if (!dixRegisterPrivateKey(&syncFdScreenPrivateKey, PRIVATE_SCREEN, 0))
+            return FALSE;
+    }
+
+    priv = calloc(1, sizeof (SyncFdScreenPrivateRec));
+    if (!priv)
+        return FALSE;
+
+    /* Will require version checks when there are multiple versions
+     * of the funcs structure
+     */
+
+    priv->funcs = *funcs;
+
+    dixSetPrivate(&pScreen->devPrivates, &syncFdScreenPrivateKey, priv);
+    
+    return TRUE;
+}
diff --git a/miext/sync/misyncfd.h b/miext/sync/misyncfd.h
new file mode 100644 (file)
index 0000000..c1d05f9
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * Copyright Â© 2013 Keith Packard
+ *
+ * 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 the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  The copyright holders make no representations
+ * about the suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS 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.
+ */
+
+#ifndef _MISYNCFD_H_
+#define _MISYNCFD_H_
+
+typedef int (*SyncScreenCreateFenceFromFdFunc) (ScreenPtr screen,
+                                                SyncFence *fence,
+                                                int fd,
+                                                Bool initially_triggered);
+
+typedef int (*SyncScreenGetFenceFdFunc) (ScreenPtr screen,
+                                      SyncFence *fence);
+
+#define SYNC_FD_SCREEN_FUNCS_VERSION    1
+
+typedef struct _syncFdScreenFuncs {
+    int                                 version;
+    SyncScreenCreateFenceFromFdFunc     CreateFenceFromFd;
+    SyncScreenGetFenceFdFunc            GetFenceFd;
+} SyncFdScreenFuncsRec, *SyncFdScreenFuncsPtr;
+
+extern _X_EXPORT Bool miSyncFdScreenInit(ScreenPtr pScreen,
+                                         const SyncFdScreenFuncsRec *funcs);
+
+#endif /* _MISYNCFD_H_ */
diff --git a/miext/sync/misyncshm.c b/miext/sync/misyncshm.c
new file mode 100644 (file)
index 0000000..01f82fc
--- /dev/null
@@ -0,0 +1,186 @@
+/*
+ * Copyright Â© 2013 Keith Packard
+ *
+ * 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 the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  The copyright holders make no representations
+ * about the suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS 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_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "scrnintstr.h"
+#include "misync.h"
+#include "misyncstr.h"
+#include "misyncshm.h"
+#include "misyncfd.h"
+#include "pixmapstr.h"
+#include <sys/mman.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <X11/xshmfence.h>
+
+static DevPrivateKeyRec syncShmFencePrivateKey;
+
+typedef struct _SyncShmFencePrivate {
+    struct xshmfence    *fence;
+    int                 fd;
+} SyncShmFencePrivateRec, *SyncShmFencePrivatePtr;
+
+#define SYNC_FENCE_PRIV(pFence) \
+    (SyncShmFencePrivatePtr) dixLookupPrivate(&pFence->devPrivates, &syncShmFencePrivateKey)
+
+static void
+miSyncShmFenceSetTriggered(SyncFence * pFence)
+{
+    SyncShmFencePrivatePtr      pPriv = SYNC_FENCE_PRIV(pFence);
+
+    if (pPriv->fence)
+        xshmfence_trigger(pPriv->fence);
+    miSyncFenceSetTriggered(pFence);
+}
+
+static void
+miSyncShmFenceReset(SyncFence * pFence)
+{
+    SyncShmFencePrivatePtr      pPriv = SYNC_FENCE_PRIV(pFence);
+
+    if (pPriv->fence)
+        xshmfence_reset(pPriv->fence);
+    miSyncFenceReset(pFence);
+}
+
+static Bool
+miSyncShmFenceCheckTriggered(SyncFence * pFence)
+{
+    SyncShmFencePrivatePtr      pPriv = SYNC_FENCE_PRIV(pFence);
+
+    if (pPriv->fence)
+        return xshmfence_query(pPriv->fence);
+    else
+        return miSyncFenceCheckTriggered(pFence);
+}
+
+static void
+miSyncShmFenceAddTrigger(SyncTrigger * pTrigger)
+{
+    miSyncFenceAddTrigger(pTrigger);
+}
+
+static void
+miSyncShmFenceDeleteTrigger(SyncTrigger * pTrigger)
+{
+    miSyncFenceDeleteTrigger(pTrigger);
+}
+
+static const SyncFenceFuncsRec miSyncShmFenceFuncs = {
+    &miSyncShmFenceSetTriggered,
+    &miSyncShmFenceReset,
+    &miSyncShmFenceCheckTriggered,
+    &miSyncShmFenceAddTrigger,
+    &miSyncShmFenceDeleteTrigger
+};
+
+static void
+miSyncShmScreenCreateFence(ScreenPtr pScreen, SyncFence * pFence,
+                        Bool initially_triggered)
+{
+    SyncShmFencePrivatePtr      pPriv = SYNC_FENCE_PRIV(pFence);
+
+    pPriv->fence = NULL;
+    miSyncScreenCreateFence(pScreen, pFence, initially_triggered);
+    pFence->funcs = miSyncShmFenceFuncs;
+}
+
+static void
+miSyncShmScreenDestroyFence(ScreenPtr pScreen, SyncFence * pFence)
+{
+    SyncShmFencePrivatePtr      pPriv = SYNC_FENCE_PRIV(pFence);
+
+    if (pPriv->fence) {
+        xshmfence_trigger(pPriv->fence);
+        xshmfence_unmap_shm(pPriv->fence);
+        close(pPriv->fd);
+    }
+    miSyncScreenDestroyFence(pScreen, pFence);
+}
+
+static int
+miSyncShmCreateFenceFromFd(ScreenPtr pScreen, SyncFence *pFence, int fd, Bool initially_triggered)
+{
+    SyncShmFencePrivatePtr      pPriv = SYNC_FENCE_PRIV(pFence);
+
+    miSyncInitFence(pScreen, pFence, initially_triggered);
+
+    fd = os_move_fd(fd);
+    pPriv->fence = xshmfence_map_shm(fd);
+    if (pPriv->fence) {
+        pPriv->fd = fd;
+        return Success;
+    }
+    else
+        close(fd);
+    return BadValue;
+}
+
+static int
+miSyncShmGetFenceFd(ScreenPtr pScreen, SyncFence *pFence)
+{
+    SyncShmFencePrivatePtr      pPriv = SYNC_FENCE_PRIV(pFence);
+
+    if (!pPriv->fence) {
+        pPriv->fd = xshmfence_alloc_shm();
+        if (pPriv->fd < 0)
+            return -1;
+        pPriv->fd = os_move_fd(pPriv->fd);
+        pPriv->fence = xshmfence_map_shm(pPriv->fd);
+        if (!pPriv->fence) {
+            close (pPriv->fd);
+            return -1;
+        }
+    }
+    return pPriv->fd;
+}
+
+static const SyncFdScreenFuncsRec miSyncShmScreenFuncs = {
+    .version = SYNC_FD_SCREEN_FUNCS_VERSION,
+    .CreateFenceFromFd = miSyncShmCreateFenceFromFd,
+    .GetFenceFd = miSyncShmGetFenceFd
+};
+
+_X_EXPORT Bool miSyncShmScreenInit(ScreenPtr pScreen)
+{
+    SyncScreenFuncsPtr  funcs;
+
+    if (!miSyncFdScreenInit(pScreen, &miSyncShmScreenFuncs))
+        return FALSE;
+
+    if (!dixPrivateKeyRegistered(&syncShmFencePrivateKey)) {
+        if (!dixRegisterPrivateKey(&syncShmFencePrivateKey, PRIVATE_SYNC_FENCE,
+                                   sizeof(SyncShmFencePrivateRec)))
+            return FALSE;
+    }
+
+    funcs = miSyncGetScreenFuncs(pScreen);
+
+    funcs->CreateFence = miSyncShmScreenCreateFence;
+    funcs->DestroyFence = miSyncShmScreenDestroyFence;
+
+    return TRUE;
+}
+
diff --git a/miext/sync/misyncshm.h b/miext/sync/misyncshm.h
new file mode 100644 (file)
index 0000000..23c001a
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * Copyright Â© 2013 Keith Packard
+ *
+ * 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 the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  The copyright holders make no representations
+ * about the suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS 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.
+ */
+
+#ifndef _MISYNCSHM_H_
+#define _MISYNCSHM_H_
+
+extern _X_EXPORT Bool miSyncShmScreenInit(ScreenPtr pScreen);
+
+#endif /* _MISYNCSHM_H_ */
index e19256f..ad69e8e 100644 (file)
@@ -29,6 +29,8 @@
 #define _MISYNCSTR_H_
 
 #include "dix.h"
+#include "misync.h"
+#include "scrnintstr.h"
 #include <X11/extensions/syncconst.h>
 
 #define CARD64 XSyncValue       /* XXX temporary! need real 64 bit values for Alpha */
@@ -79,4 +81,18 @@ typedef struct _SyncTriggerList {
     struct _SyncTriggerList *next;
 } SyncTriggerList;
 
+extern DevPrivateKeyRec miSyncScreenPrivateKey;
+
+#define SYNC_SCREEN_PRIV(pScreen)                              \
+    (SyncScreenPrivPtr) dixLookupPrivate(&pScreen->devPrivates,        \
+                                        &miSyncScreenPrivateKey)
+
+typedef struct _syncScreenPriv {
+    /* Wrappable sync-specific screen functions */
+    SyncScreenFuncsRec funcs;
+
+    /* Wrapped screen functions */
+    CloseScreenProcPtr CloseScreen;
+} SyncScreenPrivRec, *SyncScreenPrivPtr;
+
 #endif                          /* _MISYNCSTR_H_ */
index 8891485..a1bbb4d 100644 (file)
@@ -5,6 +5,7 @@ AM_CFLAGS = $(DIX_CFLAGS) $(SHA1_CFLAGS)
 SECURERPC_SRCS = rpcauth.c
 XDMCP_SRCS = xdmcp.c
 XORG_SRCS = log.c
+BUSFAULT_SRCS = busfault.c
 
 libos_la_SOURCES =     \
        WaitFor.c       \
@@ -34,6 +35,15 @@ if XDMCP
 libos_la_SOURCES += $(XDMCP_SRCS)
 endif
 
+if HAVE_LIBUNWIND
+AM_CFLAGS += $(LIBUNWIND_CFLAGS)
+libos_la_LIBADD += $(LIBUNWIND_LIBS)
+endif
+
+if BUSFAULT
+libos_la_SOURCES += $(BUSFAULT_SRCS)
+endif
+
 EXTRA_DIST = $(SECURERPC_SRCS) $(XDMCP_SRCS)
 
 if SPECIAL_DTRACE_OBJECTS
index 5dba236..7d442af 100644 (file)
@@ -72,6 +72,7 @@ SOFTWARE.
 #ifdef DPMSExtension
 #include "dpmsproc.h"
 #endif
+#include "busfault.h"
 
 #ifdef WIN32
 /* Error codes from windows sockets differ from fileio error codes  */
@@ -117,7 +118,7 @@ struct _OsTimerRec {
     CARD32 expires;
     CARD32 delta;
     OsTimerCallback callback;
-    pointer arg;
+    void *arg;
 };
 
 static void DoTimer(OsTimerPtr timer, CARD32 now, OsTimerPtr *prev);
@@ -162,6 +163,10 @@ WaitForSomething(int *pClientsReady)
         SmartScheduleStopTimer();
     nready = 0;
 
+#ifdef BUSFAULT
+    busfault_check();
+#endif
+
     /* We need a while loop here to handle 
        crashed connections and the screen saver timeout */
     while (1) {
@@ -207,7 +212,7 @@ WaitForSomething(int *pClientsReady)
             XFD_COPYSET(&AllSockets, &LastSelectMask);
         }
 
-        BlockHandler((pointer) &wt, (pointer) &LastSelectMask);
+        BlockHandler((void *) &wt, (void *) &LastSelectMask);
         if (NewOutputPending)
             FlushAllOutput();
         /* keep this check close to select() call to minimize race */
@@ -234,7 +239,7 @@ WaitForSomething(int *pClientsReady)
 #endif
         }
         selecterr = GetErrno();
-        WakeupHandler(i, (pointer) &LastSelectMask);
+        WakeupHandler(i, (void *) &LastSelectMask);
         if (i <= 0) {           /* An error or timeout occurred */
             if (dispatchException)
                 return 0;
@@ -311,7 +316,7 @@ WaitForSomething(int *pClientsReady)
             XFD_ANDSET(&tmp_set, &LastSelectMask, &WellKnownConnections);
             if (XFD_ANYSET(&tmp_set))
                 QueueWorkProc(EstablishNewConnections, NULL,
-                              (pointer) &LastSelectMask);
+                              (void *) &LastSelectMask);
 
             if (XFD_ANYSET(&devicesReadable) || XFD_ANYSET(&clientsReadable))
                 break;
@@ -424,7 +429,7 @@ DoTimer(OsTimerPtr timer, CARD32 now, OsTimerPtr *prev)
 
 OsTimerPtr
 TimerSet(OsTimerPtr timer, int flags, CARD32 millis,
-         OsTimerCallback func, pointer arg)
+         OsTimerCallback func, void *arg)
 {
     register OsTimerPtr *prev;
     CARD32 now = GetTimeInMillis();
@@ -572,9 +577,9 @@ NextDPMSTimeout(INT32 timeout)
 #endif                          /* DPMSExtension */
 
 static CARD32
-ScreenSaverTimeoutExpire(OsTimerPtr timer, CARD32 now, pointer arg)
+ScreenSaverTimeoutExpire(OsTimerPtr timer, CARD32 now, void *arg)
 {
-    INT32 timeout = now - lastDeviceEventTime[XIAllDevices].milliseconds;
+    INT32 timeout = now - LastEventTime(XIAllDevices).milliseconds;
     CARD32 nextTimeout = 0;
 
 #ifdef DPMSExtension
index 550f2ed..d061003 100644 (file)
@@ -163,6 +163,10 @@ SOFTWARE.
 /* #endif */
 #endif
 
+#if defined(IPv6) && defined(AF_INET6)
+#include <arpa/inet.h>
+#endif
+
 #endif                          /* WIN32 */
 
 #define X_INCLUDE_NETDB_H
@@ -182,7 +186,7 @@ Bool defeatAccessControl = FALSE;
 
 static int ConvertAddr(struct sockaddr * /*saddr */ ,
                        int * /*len */ ,
-                       pointer * /*addr */ );
+                       void ** /*addr */ );
 
 static int CheckAddr(int /*family */ ,
                      const void * /*pAddr */ ,
@@ -222,7 +226,7 @@ static int LocalHostRequested = FALSE;
 static int UsingXdmcp = FALSE;
 
 /* FamilyServerInterpreted implementation */
-static Bool siAddrMatch(int family, pointer addr, int len, HOST * host,
+static Bool siAddrMatch(int family, void *addr, int len, HOST * host,
                         ClientPtr client);
 static int siCheckAddr(const char *addrString, int length);
 static void siTypesInitialize(void);
@@ -254,7 +258,7 @@ DisableLocalHost(void)
     for (self = selfhosts; self; self = self->next) {
         if (!self->requested)   /* Fix for XFree86 bug #156 */
             (void) RemoveHost((ClientPtr) NULL, self->family, self->len,
-                              (pointer) self->addr);
+                              (void *) self->addr);
     }
 }
 
@@ -378,7 +382,7 @@ DefineSelf(int fd)
         default:
             goto DefineLocalHost;
         }
-        family = ConvertAddr(&(saddr.sa), &len, (pointer *) &addr);
+        family = ConvertAddr(&(saddr.sa), &len, (void **) &addr);
         if (family != -1 && family != FamilyLocal) {
             for (host = selfhosts;
                  host && !addrEqual(family, addr, len, host);
@@ -461,17 +465,13 @@ DefineSelf(int fd)
 #endif
 
 #if defined(IPv6) && defined(AF_INET6)
-#include <arpa/inet.h>
-#endif
-
-#if defined(IPv6) && defined(AF_INET6)
 static void
 in6_fillscopeid(struct sockaddr_in6 *sin6)
 {
 #if defined(__KAME__)
     if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr)) {
         sin6->sin6_scope_id =
-            ntohs(*(u_int16_t *) & sin6->sin6_addr.s6_addr[2]);
+            ntohs(*(u_int16_t *) &sin6->sin6_addr.s6_addr[2]);
         sin6->sin6_addr.s6_addr[2] = sin6->sin6_addr.s6_addr[3] = 0;
     }
 #endif
@@ -545,7 +545,7 @@ DefineSelf(int fd)
 #define IFR_IFR_NAME ifr->ifr_name
 #endif
 
-    if (ifioctl(fd, IFC_IOCTL_REQ, (pointer) &ifc) < 0)
+    if (ifioctl(fd, IFC_IOCTL_REQ, (void *) &ifc) < 0)
         ErrorF("Getting interface configuration (4): %s\n", strerror(errno));
 
     cplim = (char *) IFC_IFC_REQ + IFC_IFC_LEN;
@@ -554,7 +554,7 @@ DefineSelf(int fd)
         ifr = (ifr_type *) cp;
         len = ifraddr_size(IFR_IFR_ADDR);
         family = ConvertAddr((struct sockaddr *) &IFR_IFR_ADDR,
-                             &len, (pointer *) &addr);
+                             &len, (void **) &addr);
         if (family == -1 || family == FamilyLocal)
             continue;
 #if defined(IPv6) && defined(AF_INET6)
@@ -649,12 +649,12 @@ DefineSelf(int fd)
                 struct ifreq broad_req;
 
                 broad_req = *ifr;
-                if (ifioctl(fd, SIOCGIFFLAGS, (pointer) &broad_req) != -1 &&
+                if (ifioctl(fd, SIOCGIFFLAGS, (void *) &broad_req) != -1 &&
                     (broad_req.ifr_flags & IFF_BROADCAST) &&
                     (broad_req.ifr_flags & IFF_UP)
                     ) {
                     broad_req = *ifr;
-                    if (ifioctl(fd, SIOCGIFBRDADDR, (pointer) &broad_req) != -1)
+                    if (ifioctl(fd, SIOCGIFBRDADDR, (void *) &broad_req) != -1)
                         broad_addr = broad_req.ifr_addr;
                     else
                         continue;
@@ -679,7 +679,7 @@ DefineSelf(int fd)
             continue;
         len = sizeof(*(ifr->ifa_addr));
         family = ConvertAddr((struct sockaddr *) ifr->ifa_addr, &len,
-                             (pointer *) &addr);
+                             (void **) &addr);
         if (family == -1 || family == FamilyLocal)
             continue;
 #if defined(IPv6) && defined(AF_INET6)
@@ -775,13 +775,13 @@ DefineSelf(int fd)
 
 #ifdef XDMCP
 void
-AugmentSelf(pointer from, int len)
+AugmentSelf(void *from, int len)
 {
     int family;
-    pointer addr;
+    void *addr;
     register HOST *host;
 
-    family = ConvertAddr(from, &len, (pointer *) &addr);
+    family = ConvertAddr(from, &len, (void **) &addr);
     if (family == -1 || family == FamilyLocal)
         return;
     for (host = selfhosts; host; host = host->next) {
@@ -814,7 +814,7 @@ AddLocalHosts(void)
 
 /* Reset access control list to initial hosts */
 void
-ResetHosts(char *display)
+ResetHosts(const char *display)
 {
     register HOST *host;
     char lhostname[120], ohostname[120];
@@ -835,7 +835,7 @@ ResetHosts(char *display)
     } saddr;
 #endif
     int family = 0;
-    pointer addr;
+    void *addr;
     int len;
 
     siTypesInitialize();
@@ -927,7 +927,7 @@ ResetHosts(char *display)
                         for (a = addresses; a != NULL; a = a->ai_next) {
                             len = a->ai_addrlen;
                             f = ConvertAddr(a->ai_addr, &len,
-                                            (pointer *) &addr);
+                                            (void **) &addr);
                             if ((family == f) ||
                                 ((family == FamilyWild) && (f != -1))) {
                                 NewHost(f, addr, len, FALSE);
@@ -950,15 +950,15 @@ ResetHosts(char *display)
                     len = sizeof(saddr.sa);
                     if ((family =
                          ConvertAddr(&saddr.sa, &len,
-                                     (pointer *) &addr)) != -1) {
+                                     (void **) &addr)) != -1) {
 #ifdef h_addr                   /* new 4.3bsd version of gethostent */
                         char **list;
 
                         /* iterate over the addresses */
                         for (list = hp->h_addr_list; *list; list++)
-                            (void) NewHost(family, (pointer) *list, len, FALSE);
+                            (void) NewHost(family, (void *) *list, len, FALSE);
 #else
-                        (void) NewHost(family, (pointer) hp->h_addr, len,
+                        (void) NewHost(family, (void *) hp->h_addr, len,
                                        FALSE);
 #endif
                     }
@@ -978,7 +978,7 @@ ComputeLocalClient(ClientPtr client)
 {
     int alen, family, notused;
     Xtransaddr *from = NULL;
-    pointer addr;
+    void *addr;
     register HOST *host;
     OsCommPtr oc = (OsCommPtr) client->osPrivate;
 
@@ -987,7 +987,7 @@ ComputeLocalClient(ClientPtr client)
 
     if (!_XSERVTransGetPeerAddr(oc->trans_conn, &notused, &alen, &from)) {
         family = ConvertAddr((struct sockaddr *) from,
-                             &alen, (pointer *) &addr);
+                             &alen, (void **) &addr);
         if (family == -1) {
             free(from);
             return FALSE;
@@ -1007,14 +1007,6 @@ ComputeLocalClient(ClientPtr client)
     return FALSE;
 }
 
-Bool
-LocalClient(ClientPtr client)
-{
-    if (!client->osPrivate)
-        return FALSE;
-    return ((OsCommPtr) client->osPrivate)->local_client;
-}
-
 /*
  * Return the uid and gid of a connected local client
  * 
@@ -1176,7 +1168,7 @@ AuthorizedClient(ClientPtr client)
     if (rc != Success)
         return rc;
 
-    return LocalClient(client) ? Success : BadAccess;
+    return client->local ? Success : BadAccess;
 }
 
 /* Add a host to the access control list.  This is the external interface
@@ -1227,8 +1219,8 @@ AddHost(ClientPtr client, int family, unsigned length,  /* of bytes in pAddr */
 Bool
 ForEachHostInFamily(int family, Bool (*func) (unsigned char * /* addr */ ,
                                               short /* len */ ,
-                                              pointer /* closure */ ),
-                    pointer closure)
+                                              void */* closure */ ),
+                    void *closure)
 {
     HOST *host;
 
@@ -1272,7 +1264,7 @@ NewHost(int family, const void *addr, int len, int addingLocalHosts)
 
 int
 RemoveHost(ClientPtr client, int family, unsigned length,       /* of bytes in pAddr */
-           pointer pAddr)
+           void *pAddr)
 {
     int rc, len;
     register HOST *host, **prev;
@@ -1319,7 +1311,7 @@ RemoveHost(ClientPtr client, int family, unsigned length,       /* of bytes in p
 
 /* Get all hosts in the access control list */
 int
-GetHosts(pointer *data, int *pnHosts, int *pLen, BOOL * pEnabled)
+GetHosts(void **data, int *pnHosts, int *pLen, BOOL * pEnabled)
 {
     int len;
     register int n = 0;
@@ -1394,12 +1386,12 @@ int
 InvalidHost(register struct sockaddr *saddr, int len, ClientPtr client)
 {
     int family;
-    pointer addr;
+    void *addr;
     register HOST *selfhost, *host;
 
     if (!AccessEnabled)         /* just let them in */
         return 0;
-    family = ConvertAddr(saddr, &len, (pointer *) &addr);
+    family = ConvertAddr(saddr, &len, (void **) &addr);
     if (family == -1)
         return 1;
     if (family == FamilyLocal) {
@@ -1435,7 +1427,7 @@ InvalidHost(register struct sockaddr *saddr, int len, ClientPtr client)
 }
 
 static int
-ConvertAddr(register struct sockaddr *saddr, int *len, pointer *addr)
+ConvertAddr(register struct sockaddr *saddr, int *len, void **addr)
 {
     if (*len == 0)
         return FamilyLocal;
@@ -1452,7 +1444,7 @@ ConvertAddr(register struct sockaddr *saddr, int *len, pointer *addr)
             return FamilyLocal;
 #endif
         *len = sizeof(struct in_addr);
-        *addr = (pointer) &(((struct sockaddr_in *) saddr)->sin_addr);
+        *addr = (void *) &(((struct sockaddr_in *) saddr)->sin_addr);
         return FamilyInternet;
 #if defined(IPv6) && defined(AF_INET6)
     case AF_INET6:
@@ -1461,12 +1453,12 @@ ConvertAddr(register struct sockaddr *saddr, int *len, pointer *addr)
 
         if (IN6_IS_ADDR_V4MAPPED(&(saddr6->sin6_addr))) {
             *len = sizeof(struct in_addr);
-            *addr = (pointer) &(saddr6->sin6_addr.s6_addr[12]);
+            *addr = (void *) &(saddr6->sin6_addr.s6_addr[12]);
             return FamilyInternet;
         }
         else {
             *len = sizeof(struct in6_addr);
-            *addr = (pointer) &(saddr6->sin6_addr);
+            *addr = (void *) &(saddr6->sin6_addr);
             return FamilyInternet6;
         }
     }
@@ -1513,7 +1505,7 @@ GetAccessControl(void)
  * future to enable loading additional host types, but that was not done for
  * the initial implementation.
  */
-typedef Bool (*siAddrMatchFunc) (int family, pointer addr, int len,
+typedef Bool (*siAddrMatchFunc) (int family, void *addr, int len,
                                  const char *siAddr, int siAddrlen,
                                  ClientPtr client, void *siTypePriv);
 typedef int (*siCheckAddrFunc) (const char *addrString, int length,
@@ -1566,7 +1558,7 @@ siTypeAdd(const char *typeName, siAddrMatchFunc addrMatch,
 
 /* Checks to see if a host matches a server-interpreted host entry */
 static Bool
-siAddrMatch(int family, pointer addr, int len, HOST * host, ClientPtr client)
+siAddrMatch(int family, void *addr, int len, HOST * host, ClientPtr client)
 {
     Bool matches = FALSE;
     struct siType *s;
@@ -1667,7 +1659,7 @@ siCheckAddr(const char *addrString, int length)
 #endif
 
 static Bool
-siHostnameAddrMatch(int family, pointer addr, int len,
+siHostnameAddrMatch(int family, void *addr, int len,
                     const char *siAddr, int siAddrLen, ClientPtr client,
                     void *typePriv)
 {
@@ -1683,7 +1675,7 @@ siHostnameAddrMatch(int family, pointer addr, int len,
         struct addrinfo *addresses;
         struct addrinfo *a;
         int f, hostaddrlen;
-        pointer hostaddr;
+        void *hostaddr;
 
         if (siAddrLen >= sizeof(hostname))
             return FALSE;
@@ -1712,7 +1704,7 @@ siHostnameAddrMatch(int family, pointer addr, int len,
 #endif
         char hostname[SI_HOSTNAME_MAXLEN];
         int f, hostaddrlen;
-        pointer hostaddr;
+        void *hostaddr;
         const char **addrlist;
 
         if (siAddrLen >= sizeof(hostname))
@@ -1816,7 +1808,7 @@ siHostnameCheckAddr(const char *valueString, int length, void *typePriv)
 #define SI_IPv6_MAXLEN INET6_ADDRSTRLEN
 
 static Bool
-siIPv6AddrMatch(int family, pointer addr, int len,
+siIPv6AddrMatch(int family, void *addr, int len,
                 const char *siAddr, int siAddrlen, ClientPtr client,
                 void *typePriv)
 {
@@ -1920,29 +1912,60 @@ siLocalCredGetId(const char *addr, int len, siLocalCredPrivPtr lcPriv, int *id)
     }
     else {                      /* non-numeric name */
         if (lcPriv->credType == LOCAL_USER) {
-            struct passwd *pw = getpwnam(addrbuf);
+            struct passwd *pw;
+            struct passwd pwd;
+            char *buf;
+            size_t bufsize=0;
+            int s;
+
+            bufsize = sysconf(_SC_GETPW_R_SIZE_MAX);
+            if (bufsize == -1) /* Value was indeterminate */
+                bufsize = 16384; /* Should be more than enough */
+
+            buf = malloc(bufsize);
+            if (!buf)
+                goto out;
+            s = getpwnam_r(addrbuf, &pwd, buf, bufsize, &pw);
 
             if (pw != NULL) {
                 *id = (int) pw->pw_uid;
                 parsedOK = TRUE;
             }
+
+            free(buf);
         }
         else {                  /* group */
-            struct group *gr = getgrnam(addrbuf);
+            struct group *gr;
+            struct group grp;
+            char *buf;
+            size_t bufsize=0;
+            int s;
+
+            bufsize = sysconf(_SC_GETGR_R_SIZE_MAX);
+            if (bufsize == -1) /* Value was indeterminate */
+                bufsize = 16384; /* Should be more than enough */
+
+           buf = malloc(bufsize);
+            if (!buf)
+                goto out;
+            s = getgrnam_r(addrbuf, &grp, buf, bufsize, &gr);
 
             if (gr != NULL) {
                 *id = (int) gr->gr_gid;
                 parsedOK = TRUE;
             }
+
+            free(buf);
         }
     }
 
+out:
     free(addrbuf);
     return parsedOK;
 }
 
 static Bool
-siLocalCredAddrMatch(int family, pointer addr, int len,
+siLocalCredAddrMatch(int family, void *addr, int len,
                      const char *siAddr, int siAddrlen, ClientPtr client,
                      void *typePriv)
 {
index ac20de4..5fcb538 100644 (file)
--- a/os/auth.c
+++ b/os/auth.c
@@ -96,12 +96,12 @@ static struct protocol protocols[] = {
  * specified authorization file
  */
 
-static char *authorization_file = (char *) NULL;
+static const char *authorization_file = NULL;
 
 static Bool ShouldLoadAuth = TRUE;
 
 void
-InitAuthorization(char *file_name)
+InitAuthorization(const char *file_name)
 {
     authorization_file = file_name;
 }
index daac60c..9672ab4 100644 (file)
 #include <errno.h>
 #include <string.h>
 
+#ifdef HAVE_LIBUNWIND
+
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+#include <dlfcn.h>
+
+void
+xorg_backtrace(void)
+{
+#ifdef HAVE_BACKTRACE
+    unw_cursor_t cursor;
+    unw_context_t context;
+    unw_word_t off;
+    unw_proc_info_t pip;
+    int ret, i = 0;
+    char procname[256];
+    const char *filename;
+    Dl_info dlinfo;
+
+    pip.unwind_info = NULL;
+    ret = unw_getcontext(&context);
+    if (ret) {
+        ErrorFSigSafe("unw_getcontext failed: %s [%d]\n", unw_strerror(ret),
+                ret);
+        return;
+    }
+
+    ret = unw_init_local(&cursor, &context);
+    if (ret) {
+        ErrorFSigSafe("unw_init_local failed: %s [%d]\n", unw_strerror(ret),
+                ret);
+        return;
+    }
+
+    ErrorFSigSafe("\n");
+    ErrorFSigSafe("Backtrace:\n");
+    ret = unw_step(&cursor);
+    while (ret > 0) {
+        ret = unw_get_proc_info(&cursor, &pip);
+        if (ret) {
+            ErrorFSigSafe("unw_get_proc_info failed: %s [%d]\n",
+                    unw_strerror(ret), ret);
+            break;
+        }
+
+        ret = unw_get_proc_name(&cursor, procname, 256, &off);
+        if (ret && ret != -UNW_ENOMEM) {
+            if (ret != -UNW_EUNSPEC)
+                ErrorFSigSafe("unw_get_proc_name failed: %s [%d]\n",
+                        unw_strerror(ret), ret);
+            procname[0] = '?';
+            procname[1] = 0;
+        }
+
+        if (dladdr((void *)(pip.start_ip + off), &dlinfo) && dlinfo.dli_fname &&
+                *dlinfo.dli_fname)
+            filename = dlinfo.dli_fname;
+        else
+            filename = "?";
+
+        ErrorFSigSafe("%u: %s (%s%s+0x%x) [%p]\n", i++, filename, procname,
+            ret == -UNW_ENOMEM ? "..." : "", (int)off,
+            (void *)(pip.start_ip + off));
+
+        ret = unw_step(&cursor);
+        if (ret < 0)
+            ErrorFSigSafe("unw_step failed: %s [%d]\n", unw_strerror(ret), ret);
+    }
+    ErrorFSigSafe("\n");
+#endif
+}
+#else /* HAVE_LIBUNWIND */
 #ifdef HAVE_BACKTRACE
 #ifndef _GNU_SOURCE
 #define _GNU_SOURCE
 void
 xorg_backtrace(void)
 {
-    void *array[64];
+#ifdef HAVE_BACKTRACE
+    const int BT_SIZE = 64;
+    void *array[BT_SIZE];
     const char *mod;
     int size, i;
     Dl_info info;
 
     ErrorFSigSafe("\n");
     ErrorFSigSafe("Backtrace:\n");
-    size = backtrace(array, 64);
+    size = backtrace(array, BT_SIZE);
     for (i = 0; i < size; i++) {
         int rc = dladdr(array[i], &info);
 
@@ -76,6 +154,7 @@ xorg_backtrace(void)
                 array[i]);
     }
     ErrorFSigSafe("\n");
+#endif
 }
 
 #else                           /* not glibc or glibc < 2.1 */
@@ -211,7 +290,7 @@ xorg_backtrace_pstack(void)
 void
 xorg_backtrace(void)
 {
-
+#ifdef HAVE_BACKTRACE
     ErrorFSigSafe("\n");
     ErrorFSigSafe("Backtrace:\n");
 
@@ -233,6 +312,7 @@ xorg_backtrace(void)
             ErrorFSigSafe("Failed to get backtrace info: %s\n", strerror(errno));
     }
     ErrorFSigSafe("\n");
+#endif
 }
 
 #else
@@ -246,3 +326,4 @@ xorg_backtrace(void)
 
 #endif
 #endif
+#endif
diff --git a/os/busfault.c b/os/busfault.c
new file mode 100644 (file)
index 0000000..ac0268f
--- /dev/null
@@ -0,0 +1,151 @@
+/*
+ * Copyright Â© 2013 Keith Packard
+ *
+ * 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 the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  The copyright holders make no representations
+ * about the suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS 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_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <X11/Xos.h>
+#include <X11/Xdefs.h>
+#include "misc.h"
+#include <busfault.h>
+#include <list.h>
+#include <stddef.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <sys/mman.h>
+#include <signal.h>
+
+struct busfault {
+    struct xorg_list    list;
+
+    void                *addr;
+    size_t              size;
+
+    Bool                valid;
+
+    busfault_notify_ptr notify;
+    void                *context;
+};
+
+static Bool             busfaulted;        
+static struct xorg_list busfaults;
+
+struct busfault *
+busfault_register_mmap(void *addr, size_t size, busfault_notify_ptr notify, void *context)
+{
+    struct busfault     *busfault;
+
+    busfault = calloc(1, sizeof (struct busfault));
+    if (!busfault)
+        return NULL;
+
+    busfault->addr = addr;
+    busfault->size = size;
+    busfault->notify = notify;
+    busfault->context = context;
+    busfault->valid = TRUE;
+
+    xorg_list_add(&busfault->list, &busfaults);
+    return busfault;
+}
+
+void
+busfault_unregister(struct busfault *busfault)
+{
+    xorg_list_del(&busfault->list);
+    free(busfault);
+}
+
+void
+busfault_check(void)
+{
+    struct busfault     *busfault, *tmp;
+
+    if (!busfaulted)
+        return;
+
+    busfaulted = FALSE;
+
+    xorg_list_for_each_entry_safe(busfault, tmp, &busfaults, list) {
+        if (!busfault->valid)
+            (*busfault->notify)(busfault->context);
+    }
+}
+
+static void (*previous_busfault_sigaction)(int sig, siginfo_t *info, void *param);
+
+static void
+busfault_sigaction(int sig, siginfo_t *info, void *param)
+{
+    void                *fault = info->si_addr;
+    struct busfault     *busfault = NULL;
+    void                *new_addr;
+
+    /* Locate the faulting address in our list of shared segments
+     */
+    xorg_list_for_each_entry(busfault, &busfaults, list) {
+        if ((char *) busfault->addr <= (char *) fault && (char *) fault < (char *) busfault->addr + busfault->size) {
+            break;
+        }
+    }
+    if (!busfault)
+        goto panic;
+
+    if (!busfault->valid)
+        goto panic;
+
+    busfault->valid = FALSE;
+    busfaulted = TRUE;
+
+    /* The client truncated the file; unmap the shared file, map
+     * /dev/zero over that area and keep going
+     */
+
+    new_addr = mmap(busfault->addr, busfault->size, PROT_READ|PROT_WRITE,
+                    MAP_ANON|MAP_PRIVATE|MAP_FIXED, -1, 0);
+
+    if (new_addr == MAP_FAILED)
+        goto panic;
+
+    return;
+panic:
+    if (previous_busfault_sigaction)
+        (*previous_busfault_sigaction)(sig, info, param);
+    else
+        FatalError("bus error");
+}
+
+Bool
+busfault_init(void)
+{
+    struct sigaction    act, old_act;
+
+    act.sa_sigaction = busfault_sigaction;
+    act.sa_flags = SA_SIGINFO;
+    sigemptyset(&act.sa_mask);
+    if (sigaction(SIGBUS, &act, &old_act) < 0)
+        return FALSE;
+    previous_busfault_sigaction = old_act.sa_sigaction;
+    xorg_list_init(&busfaults);
+    return TRUE;
+}
index e4847a0..0b25218 100755 (executable)
@@ -138,6 +138,7 @@ fd_set OutputPending;           /* clients with reply/event data ready to go */
 int MaxClients = 0;
 Bool NewOutputPending;          /* not yet attempted to write some new output */
 Bool AnyClientsWriteBlocked;    /* true if some client blocked on write */
+Bool NoListenAll;               /* Don't establish any listening sockets */
 
 static Bool RunFromSmartParent; /* send SIGUSR1 to parent process */
 Bool RunFromSigStopParent;      /* send SIGSTOP to our own process; Upstart (or
@@ -360,10 +361,13 @@ void
 NotifyParentProcess(void)
 {
 #if !defined(WIN32)
-    if (dynamic_display[0]) {
-        write(displayfd, dynamic_display, strlen(dynamic_display));
-        write(displayfd, "\n", 1);
+    if (displayfd >= 0) {
+        if (write(displayfd, display, strlen(display)) != strlen(display))
+            FatalError("Cannot write display number to fd %d\n", displayfd);
+        if (write(displayfd, "\n", 1) != 1)
+            FatalError("Cannot write display number to fd %d\n", displayfd);
         close(displayfd);
+        displayfd = -1;
     }
     if (RunFromSmartParent) {
         if (ParentProcess > 1) {
@@ -417,15 +421,18 @@ CreateWellKnownSockets(void)
     FD_ZERO(&WellKnownConnections);
 
     /* display is initialized to "0" by main(). It is then set to the display
-     * number if specified on the command line, or to NULL when the -displayfd
-     * option is used. */
-    if (display) {
+     * number if specified on the command line. */
+
+    if (NoListenAll) {
+        ListenTransCount = 0;
+    }
+    else if ((displayfd < 0) || explicit_display) {
         if (TryCreateSocket(atoi(display), &partial) &&
             ListenTransCount >= 1)
             if (!PartialNetwork && partial)
                 FatalError ("Failed to establish all listening sockets");
     }
-    else { /* -displayfd */
+    else { /* -displayfd and no explicit display number */
         Bool found = 0;
         for (i = 0; i < 65535 - X_TCP_PORT; i++) {
             if (TryCreateSocket(i, &partial) && !partial) {
@@ -453,9 +460,10 @@ CreateWellKnownSockets(void)
             DefineSelf (fd);
     }
 
-    if (!XFD_ANYSET(&WellKnownConnections))
+    if (!XFD_ANYSET(&WellKnownConnections) && !NoListenAll)
         FatalError
             ("Cannot establish any listening sockets - Make sure an X server isn't already running");
+
 #if !defined(WIN32)
     OsSignal(SIGPIPE, SIG_IGN);
     OsSignal(SIGHUP, AutoResetServer);
@@ -773,11 +781,11 @@ AllocNewConnection(XtransConnInfo trans_conn, int fd, CARD32 conn_time)
     oc->output = (ConnectionOutputPtr) NULL;
     oc->auth_id = None;
     oc->conn_time = conn_time;
-    if (!(client = NextAvailableClient((pointer) oc))) {
+    if (!(client = NextAvailableClient((void *) oc))) {
         free(oc);
         return NullClient;
     }
-    oc->local_client = ComputeLocalClient(client);
+    client->local = ComputeLocalClient(client);
 #if !defined(WIN32)
     ConnectionTranslation[fd] = client->index;
 #else
@@ -811,7 +819,7 @@ AllocNewConnection(XtransConnInfo trans_conn, int fd, CARD32 conn_time)
  *****************/
 
  /*ARGSUSED*/ Bool
-EstablishNewConnections(ClientPtr clientUnused, pointer closure)
+EstablishNewConnections(ClientPtr clientUnused, void *closure)
 {
     fd_set readyconnections;    /* set of listeners that are ready */
     int curconn;                /* fd of listener that's ready */
@@ -907,7 +915,7 @@ ErrorConnMax(XtransConnInfo trans_conn)
     xConnSetupPrefix csp;
     char pad[3] = { 0, 0, 0 };
     struct iovec iov[3];
-    char byteOrder = 0;
+    char order = 0;
     int whichbyte = 1;
     struct timeval waittime;
     fd_set mask;
@@ -920,15 +928,15 @@ ErrorConnMax(XtransConnInfo trans_conn)
     FD_SET(fd, &mask);
     (void) Select(fd + 1, &mask, NULL, NULL, &waittime);
     /* try to read the byte-order of the connection */
-    (void) _XSERVTransRead(trans_conn, &byteOrder, 1);
-    if ((byteOrder == 'l') || (byteOrder == 'B')) {
+    (void) _XSERVTransRead(trans_conn, &order, 1);
+    if (order == 'l' || order == 'B' || order == 'r' || order == 'R') {
         csp.success = xFalse;
         csp.lengthReason = sizeof(NOROOM) - 1;
         csp.length = (sizeof(NOROOM) + 2) >> 2;
         csp.majorVersion = X_PROTOCOL;
         csp.minorVersion = X_PROTOCOL_REVISION;
-        if (((*(char *) &whichbyte) && (byteOrder == 'B')) ||
-            (!(*(char *) &whichbyte) && (byteOrder == 'l'))) {
+       if (((*(char *) &whichbyte) && (order == 'B' || order == 'R')) ||
+           (!(*(char *) &whichbyte) && (order == 'l' || order == 'r'))) {
             swaps(&csp.majorVersion);
             swaps(&csp.minorVersion);
             swaps(&csp.length);
@@ -936,7 +944,7 @@ ErrorConnMax(XtransConnInfo trans_conn)
         iov[0].iov_len = sz_xConnSetupPrefix;
         iov[0].iov_base = (char *) &csp;
         iov[1].iov_len = csp.lengthReason;
-        iov[1].iov_base = NOROOM;
+        iov[1].iov_base = (void *) NOROOM;
         iov[2].iov_len = (4 - (csp.lengthReason & 3)) & 3;
         iov[2].iov_base = pad;
         (void) _XSERVTransWritev(trans_conn, iov, 3);
@@ -1051,15 +1059,15 @@ CloseDownConnection(ClientPtr client)
     if (FlushCallback)
         CallCallbacks(&FlushCallback, NULL);
 
-    if (oc->output && oc->output->count)
-        FlushClient(client, oc, (char *) NULL, 0);
+    if (oc->output)
+       FlushClient(client, oc, (char *) NULL, 0);
 #ifdef XDMCP
     XdmcpCloseDisplay(oc->fd);
 #endif
     CloseDownFileDescriptor(oc);
     FreeOsBuffers(oc);
     free(client->osPrivate);
-    client->osPrivate = (pointer) NULL;
+    client->osPrivate = (void *) NULL;
     if (auditTrailLevel > 1)
         AuditF("client %d disconnected\n", client->index);
 }
@@ -1276,8 +1284,7 @@ MakeClientGrabPervious(ClientPtr client)
     }
 }
 
-#ifdef XQUARTZ
-/* Add a fd (from launchd) to our listeners */
+/* Add a fd (from launchd or similar) to our listeners */
 void
 ListenOnOpenFD(int fd, int noxauth)
 {
@@ -1299,7 +1306,7 @@ ListenOnOpenFD(int fd, int noxauth)
      */
     ciptr = _XSERVTransReopenCOTSServer(5, fd, port);
     if (ciptr == NULL) {
-        ErrorF("Got NULL while trying to Reopen launchd port.\n");
+        ErrorF("Got NULL while trying to Reopen listen port.\n");
         return;
     }
 
@@ -1332,4 +1339,29 @@ ListenOnOpenFD(int fd, int noxauth)
 #endif
 }
 
-#endif
+/* based on TRANS(SocketUNIXAccept) (XtransConnInfo ciptr, int *status) */
+Bool
+AddClientOnOpenFD(int fd)
+{
+    XtransConnInfo ciptr;
+    CARD32 connect_time;
+    char port[20];
+
+    snprintf(port, sizeof(port), ":%d", atoi(display));
+    ciptr = _XSERVTransReopenCOTSServer(5, fd, port);
+    if (ciptr == NULL)
+        return FALSE;
+
+    _XSERVTransSetOption(ciptr, TRANS_NONBLOCKING, 1);
+    ciptr->flags |= TRANS_NOXAUTH;
+
+    connect_time = GetTimeInMillis();
+
+    if (!AllocNewConnection(ciptr, fd, connect_time)) {
+        ErrorConnMax(ciptr);
+        _XSERVTransClose(ciptr);
+        return FALSE;
+    }
+
+    return TRUE;
+}
diff --git a/os/io.c b/os/io.c
index e44db39..8181a86 100644 (file)
--- a/os/io.c
+++ b/os/io.c
@@ -82,15 +82,37 @@ SOFTWARE.
 CallbackListPtr ReplyCallback;
 CallbackListPtr FlushCallback;
 
+typedef struct _connectionInput {
+    struct _connectionInput *next;
+    char *buffer;               /* contains current client input */
+    char *bufptr;               /* pointer to current start of data */
+    int bufcnt;                 /* count of bytes in buffer */
+    int lenLastReq;
+    int size;
+    unsigned int ignoreBytes;   /* bytes to ignore before the next request */
+} ConnectionInput;
+
+typedef struct _connectionOutput {
+    struct _connectionOutput *next;
+    unsigned char *buf;
+    int size;
+    int count;
+} ConnectionOutput;
+
 static ConnectionInputPtr AllocateInputBuffer(void);
 static ConnectionOutputPtr AllocateOutputBuffer(void);
 
-/* check for both EAGAIN and EWOULDBLOCK, because some supposedly POSIX
+/* If EAGAIN and EWOULDBLOCK are distinct errno values, then we check errno
+ * for both EAGAIN and EWOULDBLOCK, because some supposedly POSIX
  * systems are broken and return EWOULDBLOCK when they should return EAGAIN
  */
 #ifndef WIN32
-#define ETEST(err) (err == EAGAIN || err == EWOULDBLOCK)
-#else                           /* WIN32 The socket errorcodes differ from the normal errors */
+# if (EAGAIN != EWOULDBLOCK)
+#  define ETEST(err) (err == EAGAIN || err == EWOULDBLOCK)
+# else
+#  define ETEST(err) (err == EAGAIN)
+# endif
+#else   /* WIN32 The socket errorcodes differ from the normal errors */
 #define ETEST(err) (err == EAGAIN || err == WSAEWOULDBLOCK)
 #endif
 
@@ -189,27 +211,17 @@ YieldControlDeath(void)
     timesThisConnection = 0;
 }
 
-int
-ReadRequestFromClient(ClientPtr client)
+/* If an input buffer was empty, either free it if it is too big or link it
+ * into our list of free input buffers.  This means that different clients can
+ * share the same input buffer (at different times).  This was done to save
+ * memory.
+ */
+static void
+NextAvailableInput(OsCommPtr oc)
 {
-    OsCommPtr oc = (OsCommPtr) client->osPrivate;
-    ConnectionInputPtr oci = oc->input;
-    int fd = oc->fd;
-    unsigned int gotnow, needed;
-    int result;
-    register xReq *request;
-    Bool need_header;
-    Bool move_header;
-
-    /* If an input buffer was empty, either free it if it is too big
-     * or link it into our list of free input buffers.  This means that
-     * different clients can share the same input buffer (at different
-     * times).  This was done to save memory.
-     */
-
     if (AvailableInput) {
         if (AvailableInput != oc) {
-            register ConnectionInputPtr aci = AvailableInput->input;
+            ConnectionInputPtr aci = AvailableInput->input;
 
             if (aci->size > BUFWATERMARK) {
                 free(aci->buffer);
@@ -219,10 +231,25 @@ ReadRequestFromClient(ClientPtr client)
                 aci->next = FreeInputs;
                 FreeInputs = aci;
             }
-            AvailableInput->input = (ConnectionInputPtr) NULL;
+            AvailableInput->input = NULL;
         }
-        AvailableInput = (OsCommPtr) NULL;
+        AvailableInput = NULL;
     }
+}
+
+int
+ReadRequestFromClient(ClientPtr client)
+{
+    OsCommPtr oc = (OsCommPtr) client->osPrivate;
+    ConnectionInputPtr oci = oc->input;
+    int fd = oc->fd;
+    unsigned int gotnow, needed;
+    int result;
+    register xReq *request;
+    Bool need_header;
+    Bool move_header;
+
+    NextAvailableInput(oc);
 
     /* make sure we have an input buffer */
 
@@ -237,6 +264,14 @@ ReadRequestFromClient(ClientPtr client)
         oc->input = oci;
     }
 
+#if XTRANS_SEND_FDS
+    /* Discard any unused file descriptors */
+    while (client->req_fds > 0) {
+        int req_fd = ReadFdFromClient(client);
+        if (req_fd >= 0)
+            close(req_fd);
+    }
+#endif
     /* advance to start of next request */
 
     oci->bufptr += oci->lenLastReq;
@@ -451,7 +486,7 @@ ReadRequestFromClient(ClientPtr client)
         oci->lenLastReq -= (sizeof(xBigReq) - sizeof(xReq));
         client->req_len -= bytes_to_int32(sizeof(xBigReq) - sizeof(xReq));
     }
-    client->requestBuffer = (pointer) oci->bufptr;
+    client->requestBuffer = (void *) oci->bufptr;
 #ifdef DEBUG_COMMUNICATION
     {
         xReq *req = client->requestBuffer;
@@ -463,6 +498,31 @@ ReadRequestFromClient(ClientPtr client)
     return needed;
 }
 
+#if XTRANS_SEND_FDS
+int
+ReadFdFromClient(ClientPtr client)
+{
+    int fd = -1;
+
+    if (client->req_fds > 0) {
+        OsCommPtr oc = (OsCommPtr) client->osPrivate;
+
+        --client->req_fds;
+        fd = _XSERVTransRecvFd(oc->trans_conn);
+    } else
+        LogMessage(X_ERROR, "Request asks for FD without setting req_fds\n");
+    return fd;
+}
+
+int
+WriteFdToClient(ClientPtr client, int fd, Bool do_close)
+{
+    OsCommPtr oc = (OsCommPtr) client->osPrivate;
+
+    return _XSERVTransSendFd(oc->trans_conn, fd, do_close);
+}
+#endif
+
 /*****************************************************************
  * InsertFakeRequest
  *    Splice a consed up (possibly partial) request in as the next request.
@@ -477,22 +537,8 @@ InsertFakeRequest(ClientPtr client, char *data, int count)
     int fd = oc->fd;
     int gotnow, moveup;
 
-    if (AvailableInput) {
-        if (AvailableInput != oc) {
-            ConnectionInputPtr aci = AvailableInput->input;
+    NextAvailableInput(oc);
 
-            if (aci->size > BUFWATERMARK) {
-                free(aci->buffer);
-                free(aci);
-            }
-            else {
-                aci->next = FreeInputs;
-                FreeInputs = aci;
-            }
-            AvailableInput->input = (ConnectionInputPtr) NULL;
-        }
-        AvailableInput = (OsCommPtr) NULL;
-    }
     if (!oci) {
         if ((oci = FreeInputs))
             FreeInputs = oci->next;
@@ -768,7 +814,7 @@ WriteToClient(ClientPtr who, int count, const void *__buf)
             who->replyBytesRemaining -= count + padBytes;
             replyinfo.startOfReply = FALSE;
             replyinfo.bytesRemaining = who->replyBytesRemaining;
-            CallCallbacks((&ReplyCallback), (pointer) &replyinfo);
+            CallCallbacks((&ReplyCallback), (void *) &replyinfo);
         }
         else if (who->clientState == ClientStateRunning && buf[0] == X_Reply) { /* start of new reply */
             CARD32 replylen;
@@ -780,7 +826,7 @@ WriteToClient(ClientPtr who, int count, const void *__buf)
             bytesleft = (replylen * 4) + SIZEOF(xReply) - count - padBytes;
             replyinfo.startOfReply = TRUE;
             replyinfo.bytesRemaining = who->replyBytesRemaining = bytesleft;
-            CallCallbacks((&ReplyCallback), (pointer) &replyinfo);
+            CallCallbacks((&ReplyCallback), (void *) &replyinfo);
         }
     }
 #ifdef DEBUG_COMMUNICATION
@@ -797,7 +843,7 @@ WriteToClient(ClientPtr who, int count, const void *__buf)
         }
     }
 #endif
-    if (oco->count + count + padBytes > oco->size) {
+    if (oco->count == 0 || oco->count + count + padBytes > oco->size) {
         FD_CLR(oc->fd, &OutputPending);
         if (!XFD_ANYSET(&OutputPending)) {
             CriticalOutputPending = FALSE;
@@ -846,10 +892,13 @@ FlushClient(ClientPtr who, OsCommPtr oc, const void *__extraBuf, int extraCount)
     long todo;
 
     if (!oco)
-        return 0;
+       return 0;
     written = 0;
     padsize = padding_for_int32(extraCount);
     notWritten = oco->count + extraCount + padsize;
+    if (!notWritten)
+        return 0;
+
     todo = notWritten;
     while (notWritten) {
         long before = written;  /* amount of whole thing written */
@@ -1043,6 +1092,7 @@ FreeOsBuffers(OsCommPtr oc)
             oci->bufptr = oci->buffer;
             oci->bufcnt = 0;
             oci->lenLastReq = 0;
+            oci->ignoreBytes = 0;
         }
     }
     if ((oco = oc->output)) {
index 4820e9a..2a721b9 100644 (file)
--- a/os/log.c
+++ b/os/log.c
@@ -195,6 +195,9 @@ LogInit(const char *fname, const char *backup)
     char *logFileName = NULL;
 
     if (fname && *fname) {
+#if __GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ > 2
+#pragma GCC diagnostic ignored "-Wformat-nonliteral"
+#endif
         if (asprintf(&logFileName, fname, display) == -1)
             FatalError("Cannot allocate space for the log file name\n");
 
@@ -205,6 +208,9 @@ LogInit(const char *fname, const char *backup)
                 char *suffix;
                 char *oldLog;
 
+#if __GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ > 2
+#pragma GCC diagnostic ignored "-Wformat-nonliteral"
+#endif
                 if ((asprintf(&suffix, backup, display) == -1) ||
                     (asprintf(&oldLog, "%s%s", logFileName, suffix) == -1))
                     FatalError("Cannot allocate space for the log file name\n");
@@ -216,6 +222,9 @@ LogInit(const char *fname, const char *backup)
                 free(oldLog);
             }
         }
+        else {
+            unlink(logFileName);
+        }
         if ((logFile = fopen(logFileName, "w")) == NULL)
             FatalError("Cannot open log file \"%s\"\n", logFileName);
         setvbuf(logFile, NULL, _IONBF, 0);
@@ -250,7 +259,7 @@ void
 LogClose(enum ExitCode error)
 {
     if (logFile) {
-        ErrorF("Server terminated %s (%d). Closing log file.\n",
+        ErrorFSigSafe("Server terminated %s (%d). Closing log file.\n",
                (error == EXIT_NO_ERROR) ? "successfully" : "with error", error);
         fclose(logFile);
         logFile = NULL;
@@ -279,8 +288,61 @@ LogSetParameter(LogParameter param, int value)
     }
 }
 
+enum {
+    LMOD_LONG     = 0x1,
+    LMOD_LONGLONG = 0x2,
+    LMOD_SHORT    = 0x4,
+    LMOD_SIZET    = 0x8,
+};
+
+/**
+ * Parse non-digit length modifiers and set the corresponding flag in
+ * flags_return.
+ *
+ * @return the number of bytes parsed
+ */
+static int parse_length_modifier(const char *format, size_t len, int *flags_return)
+{
+    int idx = 0;
+    int length_modifier = 0;
+
+    while (idx < len) {
+        switch (format[idx]) {
+            case 'l':
+                BUG_RETURN_VAL(length_modifier & LMOD_SHORT, 0);
+
+                if (length_modifier & LMOD_LONG)
+                    length_modifier |= LMOD_LONGLONG;
+                else
+                    length_modifier |= LMOD_LONG;
+                break;
+            case 'h':
+                BUG_RETURN_VAL(length_modifier & (LMOD_LONG|LMOD_LONGLONG), 0);
+                length_modifier |= LMOD_SHORT;
+                /* gcc says 'short int' is promoted to 'int' when
+                 * passed through '...', so ignored during
+                 * processing */
+                break;
+            case 'z':
+                length_modifier |= LMOD_SIZET;
+                break;
+            default:
+                goto out;
+        }
+        idx++;
+    }
+
+out:
+    *flags_return = length_modifier;
+    return idx;
+}
+
+/**
+ * Signal-safe snprintf, with some limitations over snprintf. Be careful
+ * which directives you use.
+ */
 static int
-pnprintf(char *string, size_t size, const char *f, va_list args)
+vpnprintf(char *string, int size_in, const char *f, va_list args)
 {
     int f_idx = 0;
     int s_idx = 0;
@@ -291,14 +353,33 @@ pnprintf(char *string, size_t size, const char *f, va_list args)
     int i;
     uint64_t ui;
     int64_t si;
+    size_t size = size_in;
 
     for (; f_idx < f_len && s_idx < size - 1; f_idx++) {
+        int length_modifier = 0;
         if (f[f_idx] != '%') {
             string[s_idx++] = f[f_idx];
             continue;
         }
 
-        switch (f[++f_idx]) {
+        f_idx++;
+
+        /* silently swallow digit length modifiers */
+        while (f_idx < f_len && ((f[f_idx] >= '0' && f[f_idx] <= '9') || f[f_idx] == '.'))
+            f_idx++;
+
+        /* non-digit length modifiers */
+        if (f_idx < f_len) {
+            int parsed_bytes = parse_length_modifier(&f[f_idx], f_len - f_idx, &length_modifier);
+            if (parsed_bytes < 0)
+                return 0;
+            f_idx += parsed_bytes;
+        }
+
+        if (f_idx >= f_len)
+            break;
+
+        switch (f[f_idx]) {
         case 's':
             string_arg = va_arg(args, char*);
             p_len = strlen_sigsafe(string_arg);
@@ -308,7 +389,15 @@ pnprintf(char *string, size_t size, const char *f, va_list args)
             break;
 
         case 'u':
-            ui = va_arg(args, unsigned);
+            if (length_modifier & LMOD_LONGLONG)
+                ui = va_arg(args, unsigned long long);
+            else if (length_modifier & LMOD_LONG)
+                ui = va_arg(args, unsigned long);
+            else if (length_modifier & LMOD_SIZET)
+                ui = va_arg(args, size_t);
+            else
+                ui = va_arg(args, unsigned);
+
             FormatUInt64(ui, number);
             p_len = strlen_sigsafe(number);
 
@@ -317,7 +406,15 @@ pnprintf(char *string, size_t size, const char *f, va_list args)
             break;
         case 'i':
         case 'd':
-            si = va_arg(args, int);
+            if (length_modifier & LMOD_LONGLONG)
+                si = va_arg(args, long long);
+            else if (length_modifier & LMOD_LONG)
+                si = va_arg(args, long);
+            else if (length_modifier & LMOD_SIZET)
+                si = va_arg(args, ssize_t);
+            else
+                si = va_arg(args, int);
+
             FormatInt64(si, number);
             p_len = strlen_sigsafe(number);
 
@@ -338,15 +435,43 @@ pnprintf(char *string, size_t size, const char *f, va_list args)
             break;
 
         case 'x':
-            ui = va_arg(args, unsigned);
+            if (length_modifier & LMOD_LONGLONG)
+                ui = va_arg(args, unsigned long long);
+            else if (length_modifier & LMOD_LONG)
+                ui = va_arg(args, unsigned long);
+            else if (length_modifier & LMOD_SIZET)
+                ui = va_arg(args, size_t);
+            else
+                ui = va_arg(args, unsigned);
+
             FormatUInt64Hex(ui, number);
             p_len = strlen_sigsafe(number);
 
             for (i = 0; i < p_len && s_idx < size - 1; i++)
                 string[s_idx++] = number[i];
             break;
-
+        case 'f':
+            {
+                double d = va_arg(args, double);
+                FormatDouble(d, number);
+                p_len = strlen_sigsafe(number);
+
+                for (i = 0; i < p_len && s_idx < size - 1; i++)
+                    string[s_idx++] = number[i];
+            }
+            break;
+        case 'c':
+            {
+                char c = va_arg(args, int);
+                if (s_idx < size - 1)
+                    string[s_idx++] = c;
+            }
+            break;
+        case '%':
+            string[s_idx++] = '%';
+            break;
         default:
+            BUG_WARN_MSG(f[f_idx], "Unsupported printf directive '%c'\n", f[f_idx]);
             va_arg(args, char*);
             string[s_idx++] = '%';
             if (s_idx < size - 1)
@@ -360,6 +485,19 @@ pnprintf(char *string, size_t size, const char *f, va_list args)
     return s_idx;
 }
 
+static int
+pnprintf(char *string, int size, const char *f, ...)
+{
+    int rc;
+    va_list args;
+
+    va_start(args, f);
+    rc = vpnprintf(string, size, f, args);
+    va_end(args);
+
+    return rc;
+}
+
 /* This function does the actual log message writes. It must be signal safe.
  * When attempting to call non-signal-safe functions, guard them with a check
  * of the inSignalContext global variable. */
@@ -367,13 +505,14 @@ static void
 LogSWrite(int verb, const char *buf, size_t len, Bool end_line)
 {
     static Bool newline = TRUE;
+    int ret;
 
     if (verb < 0 || logVerbosity >= verb)
-        write(2, buf, len);
+        ret = write(2, buf, len);
 
     if (verb < 0 || logFileVerbosity >= verb) {
         if (inSignalContext && logFileFd >= 0) {
-            write(logFileFd, buf, len);
+            ret = write(logFileFd, buf, len);
 #ifndef WIN32
             if (logFlush && logSync)
                 fsync(logFileFd);
@@ -405,6 +544,11 @@ LogSWrite(int verb, const char *buf, size_t len, Bool end_line)
             bufferPos += len;
         }
     }
+
+    /* There's no place to log an error message if the log write
+     * fails...
+     */
+    (void) ret;
 }
 
 void
@@ -467,7 +611,6 @@ LogMessageTypeVerbString(MessageType type, int verb)
 void
 LogVMessageVerb(MessageType type, int verb, const char *format, va_list args)
 {
-    static unsigned int warned;
     const char *type_str;
     char buf[1024];
     const size_t size = sizeof(buf);
@@ -475,17 +618,8 @@ LogVMessageVerb(MessageType type, int verb, const char *format, va_list args)
     size_t len = 0;
 
     if (inSignalContext) {
-        if (warned < 3) {
-            BUG_WARN_MSG(inSignalContext,
-                         "Warning: attempting to log data in a signal unsafe "
-                         "manner while in signal context.\nPlease update to check "
-                         "inSignalContext and/or use LogMessageVerbSigSafe() or "
-                         "ErrorFSigSafe().\nThe offending log format message is:\n"
-                         "%s\n", format);
-            warned++;
-            if (warned == 3)
-                LogMessageVerbSigSafe(X_WARNING, -1, "Warned %u times about sigsafe logging. Will be quiet now.\n", warned);
-        }
+        LogVMessageVerbSigSafe(type, verb, format, args);
+        return;
     }
 
     type_str = LogMessageTypeVerbString(type, verb);
@@ -557,13 +691,13 @@ LogVMessageVerbSigSafe(MessageType type, int verb, const char *format, va_list a
         LogSWrite(verb, " ", 1, FALSE);
     }
 
-    len = pnprintf(buf, sizeof(buf), format, args);
+    len = vpnprintf(buf, sizeof(buf), format, args);
 
     /* Force '\n' at end of truncated line */
     if (sizeof(buf) - len == 1)
         buf[len - 1] = '\n';
 
-    newline = (buf[len - 1] == '\n');
+    newline = (len > 0 && buf[len - 1] == '\n');
     LogSWrite(verb, buf, len, newline);
 }
 
@@ -571,40 +705,37 @@ void
 LogVHdrMessageVerb(MessageType type, int verb, const char *msg_format,
                    va_list msg_args, const char *hdr_format, va_list hdr_args)
 {
-    static unsigned int warned;
     const char *type_str;
     char buf[1024];
     const size_t size = sizeof(buf);
     Bool newline;
     size_t len = 0;
-
-    if (inSignalContext) {
-        if (warned < 3) {
-            BUG_WARN_MSG(inSignalContext,
-                         "Warning: attempting to log data in a signal unsafe "
-                         "manner while in signal context.\nPlease update to check "
-                         "inSignalContext and/or use LogMessageVerbSigSafe().\nThe "
-                         "offending header and log message formats are:\n%s %s\n",
-                         hdr_format, msg_format);
-            warned++;
-            if (warned == 3)
-                LogMessageVerbSigSafe(X_WARNING, -1, "Warned %u times about sigsafe logging. Will be quiet now.\n", warned);
-        }
-    }
+    int (*vprintf_func)(char *, int, const char* _X_RESTRICT_KYWD f, va_list args)
+            _X_ATTRIBUTE_PRINTF(3, 0);
+    int (*printf_func)(char *, int, const char* _X_RESTRICT_KYWD f, ...)
+            _X_ATTRIBUTE_PRINTF(3, 4);
 
     type_str = LogMessageTypeVerbString(type, verb);
     if (!type_str)
         return;
 
+    if (inSignalContext) {
+        vprintf_func = vpnprintf;
+        printf_func = pnprintf;
+    } else {
+        vprintf_func = Xvscnprintf;
+        printf_func = Xscnprintf;
+    }
+
     /* if type_str is not "", prepend it and ' ', to message */
     if (type_str[0] != '\0')
-        len += Xscnprintf(&buf[len], size - len, "%s ", type_str);
+        len += printf_func(&buf[len], size - len, "%s ", type_str);
 
     if (hdr_format && size - len > 1)
-        len += Xvscnprintf(&buf[len], size - len, hdr_format, hdr_args);
+        len += vprintf_func(&buf[len], size - len, hdr_format, hdr_args);
 
     if (msg_format && size - len > 1)
-        len += Xvscnprintf(&buf[len], size - len, msg_format, msg_args);
+        len += vprintf_func(&buf[len], size - len, msg_format, msg_args);
 
     /* Force '\n' at end of truncated line */
     if (size - len == 1)
@@ -648,7 +779,7 @@ AbortServer(void)
 #endif
     CloseWellKnownConnections();
     OsCleanup(TRUE);
-    CloseDownDevices();
+    AbortDevices();
     AbortDDX(EXIT_ERR_ABORT);
     fflush(stderr);
     if (CoreDump)
@@ -708,7 +839,7 @@ AuditF(const char *f, ...)
 }
 
 static CARD32
-AuditFlush(OsTimerPtr timer, CARD32 now, pointer arg)
+AuditFlush(OsTimerPtr timer, CARD32 now, void *arg)
 {
     char *prefix;
 
@@ -763,9 +894,9 @@ FatalError(const char *f, ...)
     static Bool beenhere = FALSE;
 
     if (beenhere)
-        ErrorF("\nFatalError re-entered, aborting\n");
+        ErrorFSigSafe("\nFatalError re-entered, aborting\n");
     else
-        ErrorF("\nFatal server error:\n");
+        ErrorFSigSafe("\nFatal server error:\n");
 
     va_start(args, f);
 
@@ -782,9 +913,9 @@ FatalError(const char *f, ...)
         va_end(apple_args);
     }
 #endif
-    VErrorF(f, args);
+    VErrorFSigSafe(f, args);
     va_end(args);
-    ErrorF("\n");
+    ErrorFSigSafe("\n");
     if (!beenhere)
         OsVendorFatalError(f, args2);
     va_end(args2);
index fff0887..0ccdb62 100644 (file)
@@ -107,22 +107,8 @@ typedef Bool (*AddAuthorFunc) (unsigned name_length, const char *name,
                                unsigned data_length, char *data);
 #endif
 
-typedef struct _connectionInput {
-    struct _connectionInput *next;
-    char *buffer;               /* contains current client input */
-    char *bufptr;               /* pointer to current start of data */
-    int bufcnt;                 /* count of bytes in buffer */
-    int lenLastReq;
-    int size;
-    unsigned int ignoreBytes;   /* bytes to ignore before the next request */
-} ConnectionInput, *ConnectionInputPtr;
-
-typedef struct _connectionOutput {
-    struct _connectionOutput *next;
-    int size;
-    unsigned char *buf;
-    int count;
-} ConnectionOutput, *ConnectionOutputPtr;
+typedef struct _connectionInput *ConnectionInputPtr;
+typedef struct _connectionOutput *ConnectionOutputPtr;
 
 struct _osComm;
 
@@ -162,7 +148,6 @@ typedef struct _osComm {
     XID auth_id;                /* authorization id */
     CARD32 conn_time;           /* timestamp if not established, else 0  */
     struct _XtransConnInfo *trans_conn; /* transport connection object */
-    Bool local_client;
 } OsCommRec, *OsCommPtr;
 
 extern int FlushClient(ClientPtr /*who */ ,
index 786d5ae..3bca2b9 100644 (file)
@@ -102,6 +102,7 @@ OsRegisterSigWrapper(OsSigWrapperPtr newSigWrapper)
  * OsSigHandler --
  *    Catch unexpected signals and exit or continue cleanly.
  */
+#if !defined(WIN32) || defined(__CYGWIN__)
 static void
 #ifdef SA_SIGINFO
 OsSigHandler(int signo, siginfo_t * sip, void *unused)
@@ -129,7 +130,7 @@ OsSigHandler(int signo)
 
 #ifdef SA_SIGINFO
     if (sip->si_code == SI_USER) {
-        ErrorFSigSafe("Recieved signal %u sent by process %u, uid %u\n", signo,
+        ErrorFSigSafe("Received signal %u sent by process %u, uid %u\n", signo,
                      sip->si_pid, sip->si_uid);
     }
     else {
@@ -146,6 +147,9 @@ OsSigHandler(int signo)
     FatalError("Caught signal %d (%s). Server aborting\n",
                signo, strsignal(signo));
 }
+#endif /* !WIN32 || __CYGWIN__ */
+
+#include "busfault.h"
 
 void
 OsInit(void)
@@ -155,6 +159,7 @@ OsInit(void)
     char fname[PATH_MAX];
 
     if (!been_here) {
+#if !defined(WIN32) || defined(__CYGWIN__)
         struct sigaction act, oact;
         int i;
 
@@ -185,6 +190,11 @@ OsInit(void)
                        siglist[i], strerror(errno));
             }
         }
+#endif /* !WIN32 || __CYGWIN__ */
+#ifdef BUSFAULT
+        busfault_init();
+#endif
+
 #ifdef HAVE_BACKTRACE
         /*
          * initialize the backtracer, since the ctor calls dlopen(), which
@@ -207,10 +217,18 @@ OsInit(void)
         dlinfo(RTLD_SELF, RTLD_DI_SETSIGNAL, &failure_signal);
 #endif
 
-#if !defined(__CYGWIN__)
+#if !defined(XQUARTZ)    /* STDIN is already /dev/null and STDOUT/STDERR is managed by console_redirect.c */
+# if defined(__APPLE__)
+        int devnullfd = open(devnull, O_RDWR, 0);
+        assert(devnullfd > 2);
+
+        dup2(devnullfd, STDIN_FILENO);
+        dup2(devnullfd, STDOUT_FILENO);
+        close(devnullfd);
+# elif !defined(__CYGWIN__)
         fclose(stdin);
         fclose(stdout);
-#endif
+# endif
         /* 
          * If a write of zero bytes to stderr returns non-zero, i.e. -1, 
          * then writing to stderr failed, and we'll write somewhere else 
@@ -244,9 +262,12 @@ OsInit(void)
             setlinebuf(stderr);
 #endif
         }
+#endif /* !XQUARTZ */
 
+#if !defined(WIN32) || defined(__CYGWIN__)
         if (getpgrp() == 0)
             setpgid(0, 0);
+#endif
 
 #ifdef RLIMIT_DATA
         if (limitDataSpace >= 0) {
index bd219ac..d60ea35 100644 (file)
@@ -113,7 +113,7 @@ authdes_ezdecode(const char *inmsg, int len)
 static XID rpc_id = (XID) ~0L;
 
 static Bool
-CheckNetName(unsigned char *addr, short len, pointer closure)
+CheckNetName(unsigned char *addr, short len, void *closure)
 {
     return (len == strlen((char *) closure) &&
             strncmp((char *) addr, (char *) closure, len) == 0);
@@ -159,7 +159,7 @@ _X_HIDDEN int
 SecureRPCAdd(unsigned short data_length, const char *data, XID id)
 {
     if (data_length)
-        AddHost((pointer) 0, FamilyNetname, data_length, data);
+        AddHost((void *) 0, FamilyNetname, data_length, data);
     rpc_id = id;
     return 1;
 }
index b604b9b..e0eddf1 100644 (file)
  * SUCH DAMAGE.
  */
 
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
 #include <stddef.h>
 #include <stdlib.h>
 #include <string.h>
index 4a234fd..8294b63 100755 (executable)
@@ -71,6 +71,7 @@ __stdcall unsigned long GetTickCount(void);
 #if !defined(WIN32) || !defined(__MINGW32__)
 #include <sys/time.h>
 #include <sys/resource.h>
+# define SMART_SCHEDULE_POSSIBLE
 #endif
 #include "misc.h"
 #include <X11/X.h>
@@ -168,9 +169,7 @@ Bool noXFree86DRIExtension = FALSE;
 #ifdef XF86VIDMODE
 Bool noXFree86VidModeExtension = FALSE;
 #endif
-#ifdef XFIXES
 Bool noXFixesExtension = FALSE;
-#endif
 #ifdef PANORAMIX
 /* Xinerama is disabled by default unless enabled via +xinerama */
 Bool noPanoramiXExtension = TRUE;
@@ -188,6 +187,25 @@ Bool noXvExtension = FALSE;
 #ifdef DRI2
 Bool noDRI2Extension = FALSE;
 #endif
+#ifdef CONTAINER
+Bool noContainerExtension = FALSE;
+#endif //_F_CONTAINER_EXTENSION_
+#ifdef HWC
+Bool noHWCExtension = FALSE;
+#endif
+#ifdef HWA
+Bool noHWAExtension = FALSE;
+#endif
+
+#ifdef _F_RUN_TIME_DISABLE_EXTENSION_
+#ifdef DRI3
+Bool noDRI3Extension = FALSE;
+#endif
+#ifdef PRESENT
+Bool noPresentExtension = FALSE;
+#endif
+#endif
+
 
 Bool noGEExtension = FALSE;
 
@@ -198,6 +216,8 @@ Bool noGEExtension = FALSE;
 
 Bool CoreDump;
 
+Bool enableIndirectGLX = TRUE;
+
 #ifdef PANORAMIX
 Bool PanoramiXExtensionDisabledHack = FALSE;
 #endif
@@ -215,6 +235,9 @@ sig_atomic_t inSignalContext = FALSE;
 OsSigHandlerPtr
 OsSignal(int sig, OsSigHandlerPtr handler)
 {
+#if defined(WIN32) && !defined(__CYGWIN__)
+    return signal(sig, handler);
+#else
     struct sigaction act, oact;
 
     sigemptyset(&act.sa_mask);
@@ -225,6 +248,7 @@ OsSignal(int sig, OsSigHandlerPtr handler)
     if (sigaction(sig, &act, &oact))
         perror("sigaction");
     return oact.sa_handler;
+#endif
 }
 
 /*
@@ -238,6 +262,19 @@ OsSignal(int sig, OsSigHandlerPtr handler)
 #define LOCK_PREFIX "/.X"
 #define LOCK_SUFFIX "-lock"
 
+#if !defined(WIN32) || defined(__CYGWIN__)
+#define LOCK_SERVER
+#endif
+
+#ifndef LOCK_SERVER
+void
+LockServer(void)
+{}
+
+void
+UnlockServer(void)
+{}
+#else /* LOCK_SERVER */
 static Bool StillLocking = FALSE;
 static char LockFile[PATH_MAX];
 static Bool nolock = FALSE;
@@ -257,7 +294,7 @@ LockServer(void)
     int len;
     char port[20];
 
-    if (nolock)
+    if (nolock || NoListenAll)
         return;
     /*
      * Path names
@@ -268,8 +305,8 @@ LockServer(void)
     len += strlen(tmppath) + strlen(port) + strlen(LOCK_SUFFIX) + 1;
     if (len > sizeof(LockFile))
         FatalError("Display name `%s' is too long\n", port);
-    (void) sprintf(tmp, "%s" LOCK_TMP_PREFIX "%s" LOCK_SUFFIX, tmppath, port);
-    (void) sprintf(LockFile, "%s" LOCK_PREFIX "%s" LOCK_SUFFIX, tmppath, port);
+    (void) snprintf(tmp, PATH_MAX, "%s" LOCK_TMP_PREFIX "%s" LOCK_SUFFIX, tmppath, port);
+    (void) snprintf(LockFile, PATH_MAX, "%s" LOCK_PREFIX "%s" LOCK_SUFFIX, tmppath, port);
 
     /*
      * Create a temporary file containing our PID.  Attempt three times
@@ -300,7 +337,8 @@ LockServer(void)
     if (lfd < 0)
         FatalError("Could not create lock file in %s\n", tmp);
     snprintf(pid_str, sizeof(pid_str), "%10ld\n", (long) getpid());
-    (void) write(lfd, pid_str, 11);
+    if (write(lfd, pid_str, 11) != 11)
+        FatalError("Could not write pid to lock file in %s\n", tmp);
     (void) fchmod(lfd, 0444);
     (void) close(lfd);
 
@@ -377,7 +415,7 @@ LockServer(void)
 void
 UnlockServer(void)
 {
-    if (nolock)
+    if (nolock || NoListenAll)
         return;
 
     if (!StillLocking) {
@@ -385,6 +423,7 @@ UnlockServer(void)
         (void) unlink(LockFile);
     }
 }
+#endif /* LOCK_SERVER */
 
 /* Force connections to close on SIGHUP from init */
 
@@ -416,6 +455,11 @@ GetTimeInMillis(void)
 {
     return GetTickCount();
 }
+CARD64
+GetTimeInMicros(void)
+{
+    return (CARD64) GetTickCount() * 1000;
+}
 #else
 CARD32
 GetTimeInMillis(void)
@@ -446,10 +490,32 @@ GetTimeInMillis(void)
     X_GETTIMEOFDAY(&tv);
     return (tv.tv_sec * 1000) + (tv.tv_usec / 1000);
 }
+
+CARD64
+GetTimeInMicros(void)
+{
+    struct timeval tv;
+#ifdef MONOTONIC_CLOCK
+    struct timespec tp;
+    static clockid_t clockid;
+
+    if (!clockid) {
+        if (clock_gettime(CLOCK_MONOTONIC, &tp) == 0)
+            clockid = CLOCK_MONOTONIC;
+        else
+            clockid = ~0L;
+    }
+    if (clockid != ~0L && clock_gettime(clockid, &tp) == 0)
+        return (CARD64) tp.tv_sec * (CARD64)1000000 + tp.tv_nsec / 1000;
+#endif
+
+    X_GETTIMEOFDAY(&tv);
+    return (CARD64) tv.tv_sec * (CARD64)1000000000 + (CARD64) tv.tv_usec * 1000;
+}
 #endif
 
 void
-AdjustWaitForDelay(pointer waitTime, unsigned long newdelay)
+AdjustWaitForDelay(void *waitTime, unsigned long newdelay)
 {
     static struct timeval delay_val;
     struct timeval **wt = (struct timeval **) waitTime;
@@ -485,6 +551,7 @@ UseMsg(void)
     ErrorF("-cc int                default color visual class\n");
     ErrorF("-nocursor              disable the cursor\n");
     ErrorF("-core                  generate core dump on fatal error\n");
+    ErrorF("-displayfd fd          file descriptor to write display number to when ready to connect\n");
     ErrorF("-dpi int               screen resolution in dots per inch\n");
 #ifdef DPMSExtension
     ErrorF("-dpms                  disables VESA DPMS monitor control\n");
@@ -499,6 +566,8 @@ UseMsg(void)
     ErrorF("-fn string             default font name\n");
     ErrorF("-fp string             default font path\n");
     ErrorF("-help                  prints message with these options\n");
+    ErrorF("+iglx                  Allow creating indirect GLX contexts (default)\n");
+    ErrorF("-iglx                  Prohibit creating indirect GLX contexts\n");
     ErrorF("-I                     ignore all remaining arguments\n");
 #ifdef RLIMIT_DATA
     ErrorF("-ld int                limit data space to N Kb\n");
@@ -509,7 +578,9 @@ UseMsg(void)
 #ifdef RLIMIT_STACK
     ErrorF("-ls int                limit stack space to N Kb\n");
 #endif
+#ifdef LOCK_SERVER
     ErrorF("-nolock                disable the locking mechanism\n");
+#endif
     ErrorF("-nolisten string       don't listen on protocol\n");
     ErrorF("-noreset               don't reset after last client exists\n");
     ErrorF("-background [none]     create root window with no background\n");
@@ -560,6 +631,10 @@ UseMsg(void)
 static int
 VerifyDisplayName(const char *d)
 {
+    int i;
+    int period_found = FALSE;
+    int after_period = 0;
+
     if (d == (char *) 0)
         return 0;               /*  null  */
     if (*d == '\0')
@@ -570,6 +645,29 @@ VerifyDisplayName(const char *d)
         return 0;               /*  must not equal "." or ".."  */
     if (strchr(d, '/') != (char *) 0)
         return 0;               /*  very important!!!  */
+
+    /* Since we run atoi() on the display later, only allow
+       for digits, or exception of :0.0 and similar (two decimal points max)
+       */
+    for (i = 0; i < strlen(d); i++) {
+        if (!isdigit(d[i])) {
+            if (d[i] != '.' || period_found)
+                return 0;
+            period_found = TRUE;
+        } else if (period_found)
+            after_period++;
+
+        if (after_period > 2)
+            return 0;
+    }
+
+    /* don't allow for :0. */
+    if (period_found && after_period == 0)
+        return 0;
+
+    if (atol(d) > INT_MAX)
+        return 0;
+
     return 1;
 }
 
@@ -599,6 +697,7 @@ ProcessCommandLine(int argc, char *argv[])
         else if (argv[i][0] == ':') {
             /* initialize display */
             display = argv[i];
+            explicit_display = TRUE;
             display++;
             if (!VerifyDisplayName(display)) {
                 ErrorF("Bad display name: %s\n", display);
@@ -674,8 +773,9 @@ ProcessCommandLine(int argc, char *argv[])
         else if (strcmp(argv[i], "-displayfd") == 0) {
             if (++i < argc) {
                 displayfd = atoi(argv[i]);
-                display = NULL;
+#ifdef LOCK_SERVER
                 nolock = TRUE;
+#endif
             }
             else
                 UseMsg();
@@ -723,6 +823,10 @@ ProcessCommandLine(int argc, char *argv[])
             UseMsg();
             exit(0);
         }
+        else if (strcmp(argv[i], "+iglx") == 0)
+            enableIndirectGLX = TRUE;
+        else if (strcmp(argv[i], "-iglx") == 0)
+            enableIndirectGLX = FALSE;
         else if ((skip = XkbProcessArguments(argc, argv, i)) != 0) {
             if (skip > 0)
                 i += skip - 1;
@@ -759,6 +863,7 @@ ProcessCommandLine(int argc, char *argv[])
                 UseMsg();
         }
 #endif
+#ifdef LOCK_SERVER
         else if (strcmp(argv[i], "-nolock") == 0) {
 #if !defined(WIN32) && !defined(__CYGWIN__)
             if (getuid() != 0)
@@ -768,6 +873,7 @@ ProcessCommandLine(int argc, char *argv[])
 #endif
                 nolock = TRUE;
         }
+#endif
         else if (strcmp(argv[i], "-nolisten") == 0) {
             if (++i < argc) {
                 if (_XSERVTransNoListen(argv[i]))
@@ -889,6 +995,7 @@ ProcessCommandLine(int argc, char *argv[])
             i = skip - 1;
         }
 #endif
+#ifdef SMART_SCHEDULE_POSSIBLE
         else if (strcmp(argv[i], "-dumbSched") == 0) {
             SmartScheduleDisable = TRUE;
         }
@@ -907,6 +1014,7 @@ ProcessCommandLine(int argc, char *argv[])
             else
                 UseMsg();
         }
+#endif
         else if (strcmp(argv[i], "-render") == 0) {
             if (++i < argc) {
                 int policy = PictureParseCmapPolicy(argv[i]);
@@ -949,7 +1057,7 @@ ProcessCommandLine(int argc, char *argv[])
 /* Implement a simple-minded font authorization scheme.  The authorization
    name is "hp-hostname-1", the contents are simply the host name. */
 int
-set_font_authorizations(char **authorizations, int *authlen, pointer client)
+set_font_authorizations(char **authorizations, int *authlen, void *client)
 {
 #define AUTHORIZATION_NAME "hp-hostname-1"
 #if defined(TCPCONN) || defined(STREAMSCONN)
@@ -1118,6 +1226,7 @@ XNFstrdup(const char *s)
 void
 SmartScheduleStopTimer(void)
 {
+#ifdef SMART_SCHEDULE_POSSIBLE
     struct itimerval timer;
 
     if (SmartScheduleDisable)
@@ -1127,11 +1236,13 @@ SmartScheduleStopTimer(void)
     timer.it_value.tv_sec = 0;
     timer.it_value.tv_usec = 0;
     (void) setitimer(ITIMER_REAL, &timer, 0);
+#endif
 }
 
 void
 SmartScheduleStartTimer(void)
 {
+#ifdef SMART_SCHEDULE_POSSIBLE
     struct itimerval timer;
 
     if (SmartScheduleDisable)
@@ -1141,6 +1252,7 @@ SmartScheduleStartTimer(void)
     timer.it_value.tv_sec = 0;
     timer.it_value.tv_usec = SmartScheduleInterval * 1000;
     setitimer(ITIMER_REAL, &timer, 0);
+#endif
 }
 
 static void
@@ -1152,6 +1264,7 @@ SmartScheduleTimer(int sig)
 void
 SmartScheduleInit(void)
 {
+#ifdef SMART_SCHEDULE_POSSIBLE
     struct sigaction act;
 
     if (SmartScheduleDisable)
@@ -1167,6 +1280,7 @@ SmartScheduleInit(void)
         perror("sigaction for smart scheduler");
         SmartScheduleDisable = TRUE;
     }
+#endif
 }
 
 #ifdef SIG_BLOCK
@@ -1222,10 +1336,10 @@ OsBlockSIGIO(void)
         sigprocmask(SIG_BLOCK, &set, &PreviousSigIOMask);
         ret = sigismember(&PreviousSigIOMask, SIGIO);
         return ret;
-    } else
-        return 1;
+    }
 #endif
 #endif
+    return 1;
 }
 
 void
@@ -1342,7 +1456,7 @@ static struct pid {
 
 OsSigHandlerPtr old_alarm = NULL;       /* XXX horrible awful hack */
 
-pointer
+void *
 Popen(const char *command, const char *type)
 {
     struct pid *cur;
@@ -1430,7 +1544,7 @@ Popen(const char *command, const char *type)
 }
 
 /* fopen that drops privileges */
-pointer
+void *
 Fopen(const char *file, const char *type)
 {
     FILE *iop;
@@ -1525,7 +1639,7 @@ Fopen(const char *file, const char *type)
 }
 
 int
-Pclose(pointer iop)
+Pclose(void *iop)
 {
     struct pid *cur, *last;
     int pstat;
@@ -1562,7 +1676,7 @@ Pclose(pointer iop)
 }
 
 int
-Fclose(pointer iop)
+Fclose(void *iop)
 {
 #ifdef HAS_SAVED_IDS_AND_SETEUID
     return fclose(iop);
@@ -1621,7 +1735,7 @@ System(const char *cmdline)
                            NULL,
                            GetLastError(),
                            MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
-                           (LPTSTR) & buffer, 0, NULL)) {
+                           (LPTSTR) &buffer, 0, NULL)) {
             ErrorF("[xkb] Starting '%s' failed!\n", cmdline);
         }
         else {
@@ -1972,6 +2086,38 @@ FormatUInt64(uint64_t num, char *string)
     string[len] = '\0';
 }
 
+/**
+ * Format a double number as %.2f.
+ */
+void
+FormatDouble(double dbl, char *string)
+{
+    int slen = 0;
+    uint64_t frac;
+
+    frac = (dbl > 0 ? dbl : -dbl) * 100.0 + 0.5;
+    frac %= 100;
+
+    /* write decimal part to string */
+    if (dbl < 0 && dbl > -1)
+        string[slen++] = '-';
+    FormatInt64((int64_t)dbl, &string[slen]);
+
+    while(string[slen] != '\0')
+        slen++;
+
+    /* append fractional part, but only if we have enough characters. We
+     * expect string to be 21 chars (incl trailing \0) */
+    if (slen <= 17) {
+        string[slen++] = '.';
+        if (frac < 10)
+            string[slen++] = '0';
+
+        FormatUInt64(frac, &string[slen]);
+    }
+}
+
+
 /* Format a number into a hexadecimal string in a signal safe manner. The string
  * should be at least 17 characters in order to handle all uint64_t values. */
 void
@@ -1996,3 +2142,27 @@ FormatUInt64Hex(uint64_t num, char *string)
 
     string[len] = '\0';
 }
+
+/* Move a file descriptor out of the way of our select mask; this
+ * is useful for file descriptors which will never appear in the
+ * select mask to avoid reducing the number of clients that can
+ * connect to the server
+ */
+int
+os_move_fd(int fd)
+{
+    int newfd;
+
+#ifdef F_DUPFD_CLOEXEC
+    newfd = fcntl(fd, F_DUPFD_CLOEXEC, MAXCLIENTS);
+#else
+    newfd = fcntl(fd, F_DUPFD, MAXCLIENTS);
+#endif
+    if (newfd < 0)
+        return fd;
+#ifndef F_DUPFD_CLOEXEC
+    fcntl(newfd, F_SETFD, FD_CLOEXEC);
+#endif
+    close(fd);
+    return newfd;
+}
index 28584d2..f11cbb9 100644 (file)
@@ -62,7 +62,7 @@ static XdmAuthKeyRec privateKey;
 static char XdmAuthenticationName[] = "XDM-AUTHENTICATION-1";
 
 #define XdmAuthenticationNameLen (sizeof XdmAuthenticationName - 1)
-static XdmAuthKeyRec rho;
+static XdmAuthKeyRec global_rho;
 
 static Bool
 XdmAuthenticationValidator(ARRAY8Ptr privateData, ARRAY8Ptr incomingData,
@@ -77,7 +77,7 @@ XdmAuthenticationValidator(ARRAY8Ptr privateData, ARRAY8Ptr incomingData,
             return FALSE;
         incoming = (XdmAuthKeyPtr) incomingData->data;
         XdmcpDecrementKey(incoming);
-        return XdmcpCompareKeys(incoming, &rho);
+        return XdmcpCompareKeys(incoming, &global_rho);
     }
     return FALSE;
 }
@@ -90,7 +90,7 @@ XdmAuthenticationGenerator(ARRAY8Ptr privateData, ARRAY8Ptr outgoingData,
     outgoingData->data = 0;
     if (packet_type == REQUEST) {
         if (XdmcpAllocARRAY8(outgoingData, 8))
-            XdmcpWrap((unsigned char *) &rho, (unsigned char *) &privateKey,
+            XdmcpWrap((unsigned char *) &global_rho, (unsigned char *) &privateKey,
                       outgoingData->data, 8);
     }
     return TRUE;
@@ -150,10 +150,10 @@ XdmAuthenticationInit(const char *cookie, int cookie_len)
             cookie_len = 7;
         memmove(privateKey.data + 1, cookie, cookie_len);
     }
-    XdmcpGenerateKey(&rho);
+    XdmcpGenerateKey(&global_rho);
     XdmcpRegisterAuthentication(XdmAuthenticationName, XdmAuthenticationNameLen,
-                                (char *) &rho,
-                                sizeof(rho),
+                                (char *) &global_rho,
+                                sizeof(global_rho),
                                 (ValidatorFunc) XdmAuthenticationValidator,
                                 (GeneratorFunc) XdmAuthenticationGenerator,
                                 (AddAuthorFunc) XdmAuthenticationAddAuth);
@@ -328,7 +328,7 @@ XdmAddCookie(unsigned short data_length, const char *data, XID id)
         if (authFromXDMCP) {
             /* R5 xdm sent bogus authorization data in the accept packet,
              * but we can recover */
-            rho_bits = rho.data;
+            rho_bits = global_rho.data;
             key_bits = (unsigned char *) data;
             key_bits[0] = '\0';
         }
@@ -341,7 +341,7 @@ XdmAddCookie(unsigned short data_length, const char *data, XID id)
         break;
 #ifdef XDMCP
     case 8:                    /* auth from XDMCP is 8 bytes long */
-        rho_bits = rho.data;
+        rho_bits = global_rho.data;
         key_bits = (unsigned char *) data;
         break;
 #endif
@@ -466,7 +466,7 @@ XdmRemoveCookie(unsigned short data_length, const char *data)
         break;
 #ifdef XDMCP
     case 8:
-        rho_bits = &rho;
+        rho_bits = &global_rho;
         key_bits = (XdmAuthKeyPtr) data;
         break;
 #endif
index 87f04b4..99616d9 100644 (file)
@@ -145,43 +145,46 @@ static void get_xdmcp_sock(void);
 
 static void send_query_msg(void);
 
-static void recv_willing_msg(struct sockaddr * /*from */ ,
-                             int /*fromlen */ ,
-                             unsigned /*length */ );
+static void recv_willing_msg(struct sockaddr    *from,
+                             int                fromlen,
+                             unsigned           length);
 
 static void send_request_msg(void);
 
-static void recv_accept_msg(unsigned /*length */ );
+static void recv_accept_msg(unsigned    length);
 
-static void recv_decline_msg(unsigned /*length */ );
+static void recv_decline_msg(unsigned   length);
 
 static void send_manage_msg(void);
 
-static void recv_refuse_msg(unsigned /*length */ );
+static void recv_refuse_msg(unsigned    length);
 
-static void recv_failed_msg(unsigned /*length */ );
+static void recv_failed_msg(unsigned    length);
 
 static void send_keepalive_msg(void);
 
-static void recv_alive_msg(unsigned /*length */ );
+static void recv_alive_msg(unsigned     length );
 
-static void XdmcpFatal(const char * /*type */ ,
-                       ARRAY8Ptr /*status */ );
+static void XdmcpFatal(const char       *type,
+                       ARRAY8Ptr        status);
 
-static void XdmcpWarning(const char * /*str */ );
+static void XdmcpWarning(const char     *str);
 
-static void get_manager_by_name(int /*argc */ ,
-                                char ** /*argv */ ,
-                                int /*i */ );
+static void get_manager_by_name(int     argc,
+                                char    **argv,
+                                int     i);
 
-static void get_fromaddr_by_name(int /*argc */ , char ** /*argv */ ,
-                                 int /*i */ );
+static void get_fromaddr_by_name(int    argc,
+                                 char   **argv,
+                                 int    i);
 
 #if defined(IPv6) && defined(AF_INET6)
-static int get_mcast_options(int /*argc */ , char ** /*argv */ , int /*i */ );
+static int get_mcast_options(int        argc,
+                             char       **argv,
+                             int        i);
 #endif
 
-static void receive_packet(int /*socketfd */ );
+static void receive_packet(int socketfd);
 
 static void send_packet(void);
 
@@ -189,13 +192,13 @@ static void timeout(void);
 
 static void restart(void);
 
-static void XdmcpBlockHandler(pointer /*data */ ,
-                              struct timeval ** /*wt */ ,
-                              pointer /*LastSelectMask */ );
+static void XdmcpBlockHandler(void              *data ,
+                              struct timeval    **wt,
+                              void              *LastSelectMask);
 
-static void XdmcpWakeupHandler(pointer /*data */ ,
-                               int /*i */ ,
-                               pointer /*LastSelectMask */ );
+static void XdmcpWakeupHandler(void             *data,
+                               int              i,
+                               void             *LastSelectMask);
 
 /*
  * Register the Manufacturer display ID
@@ -578,7 +581,7 @@ XdmcpInit(void)
                                   strlen(defaultDisplayClass));
         AccessUsingXdmcp();
         RegisterBlockAndWakeupHandlers(XdmcpBlockHandler, XdmcpWakeupHandler,
-                                       (pointer) 0);
+                                       (void *) 0);
         timeOutRtx = 0;
         DisplayNumber = (CARD16) atoi(display);
         get_xdmcp_sock();
@@ -592,7 +595,7 @@ XdmcpReset(void)
     state = XDM_INIT_STATE;
     if (state != XDM_OFF) {
         RegisterBlockAndWakeupHandlers(XdmcpBlockHandler, XdmcpWakeupHandler,
-                                       (pointer) 0);
+                                       (void *) 0);
         timeOutRtx = 0;
         send_packet();
     }
@@ -635,18 +638,18 @@ XdmcpCloseDisplay(int sock)
  */
 
  /*ARGSUSED*/ static void
-XdmcpBlockHandler(pointer data, /* unused */
-                  struct timeval **wt, pointer pReadmask)
+XdmcpBlockHandler(void *data, /* unused */
+                  struct timeval **wt, void *pReadmask)
 {
-    fd_set *LastSelectMask = (fd_set *) pReadmask;
+    fd_set *last_select_mask = (fd_set *) pReadmask;
     CARD32 millisToGo;
 
     if (state == XDM_OFF)
         return;
-    FD_SET(xdmcpSocket, LastSelectMask);
+    FD_SET(xdmcpSocket, last_select_mask);
 #if defined(IPv6) && defined(AF_INET6)
     if (xdmcpSocket6 >= 0)
-        FD_SET(xdmcpSocket6, LastSelectMask);
+        FD_SET(xdmcpSocket6, last_select_mask);
 #endif
     if (timeOutTime == 0)
         return;
@@ -663,26 +666,26 @@ XdmcpBlockHandler(pointer data, /* unused */
  */
 
  /*ARGSUSED*/ static void
-XdmcpWakeupHandler(pointer data,        /* unused */
-                   int i, pointer pReadmask)
+XdmcpWakeupHandler(void *data,        /* unused */
+                   int i, void *pReadmask)
 {
-    fd_set *LastSelectMask = (fd_set *) pReadmask;
+    fd_set *last_select_mask = (fd_set *) pReadmask;
     fd_set devicesReadable;
 
     if (state == XDM_OFF)
         return;
     if (i > 0) {
-        if (FD_ISSET(xdmcpSocket, LastSelectMask)) {
+        if (FD_ISSET(xdmcpSocket, last_select_mask)) {
             receive_packet(xdmcpSocket);
-            FD_CLR(xdmcpSocket, LastSelectMask);
+            FD_CLR(xdmcpSocket, last_select_mask);
         }
 #if defined(IPv6) && defined(AF_INET6)
-        if (xdmcpSocket6 >= 0 && FD_ISSET(xdmcpSocket6, LastSelectMask)) {
+        if (xdmcpSocket6 >= 0 && FD_ISSET(xdmcpSocket6, last_select_mask)) {
             receive_packet(xdmcpSocket6);
-            FD_CLR(xdmcpSocket6, LastSelectMask);
+            FD_CLR(xdmcpSocket6, last_select_mask);
         }
 #endif
-        XFD_ANDSET(&devicesReadable, LastSelectMask, &EnabledDevices);
+        XFD_ANDSET(&devicesReadable, last_select_mask, &EnabledDevices);
         if (XFD_ANYSET(&devicesReadable)) {
             if (state == XDM_AWAIT_USER_INPUT)
                 restart();
@@ -709,12 +712,12 @@ XdmcpWakeupHandler(pointer data,        /* unused */
 
 static void
 XdmcpSelectHost(const struct sockaddr *host_sockaddr,
-                int host_len, ARRAY8Ptr AuthenticationName)
+                int host_len, ARRAY8Ptr auth_name)
 {
     state = XDM_START_CONNECTION;
     memmove(&req_sockaddr, host_sockaddr, host_len);
     req_socklen = host_len;
-    XdmcpSetAuthentication(AuthenticationName);
+    XdmcpSetAuthentication(auth_name);
     send_packet();
 }
 
@@ -727,9 +730,9 @@ XdmcpSelectHost(const struct sockaddr *host_sockaddr,
  /*ARGSUSED*/ static void
 XdmcpAddHost(const struct sockaddr *from,
              int fromlen,
-             ARRAY8Ptr AuthenticationName, ARRAY8Ptr hostname, ARRAY8Ptr status)
+             ARRAY8Ptr auth_name, ARRAY8Ptr hostname, ARRAY8Ptr status)
 {
-    XdmcpSelectHost(from, fromlen, AuthenticationName);
+    XdmcpSelectHost(from, fromlen, auth_name);
 }
 
 /*
@@ -751,7 +754,7 @@ receive_packet(int socketfd)
     XdmcpHeader header;
 
     /* read message off socket */
-    if (!XdmcpFill(socketfd, &buffer, (XdmcpNetaddr) & from, &fromlen))
+    if (!XdmcpFill(socketfd, &buffer, (XdmcpNetaddr) &from, &fromlen))
         return;
 
     /* reset retransmission backoff */
@@ -1055,11 +1058,9 @@ send_query_msg(void)
     XdmcpWriteHeader(&buffer, &header);
     XdmcpWriteARRAYofARRAY8(&buffer, &AuthenticationNames);
     if (broadcast) {
-        int i;
-
         for (i = 0; i < NumBroadcastAddresses; i++)
             XdmcpFlush(xdmcpSocket, &buffer,
-                       (XdmcpNetaddr) & BroadcastAddresses[i],
+                       (XdmcpNetaddr) &BroadcastAddresses[i],
                        sizeof(struct sockaddr_in));
     }
 #if defined(IPv6) && defined(AF_INET6)
@@ -1098,7 +1099,7 @@ send_query_msg(void)
         if (SOCKADDR_FAMILY(ManagerAddress) == AF_INET6)
             socketfd = xdmcpSocket6;
 #endif
-        XdmcpFlush(socketfd, &buffer, (XdmcpNetaddr) & ManagerAddress,
+        XdmcpFlush(socketfd, &buffer, (XdmcpNetaddr) &ManagerAddress,
                    ManagerAddressLen);
     }
 }
@@ -1223,7 +1224,7 @@ send_request_msg(void)
         socketfd = xdmcpSocket6;
 #endif
     if (XdmcpFlush(socketfd, &buffer,
-                   (XdmcpNetaddr) & req_sockaddr, req_socklen))
+                   (XdmcpNetaddr) &req_sockaddr, req_socklen))
         state = XDM_AWAIT_REQUEST_RESPONSE;
 }
 
@@ -1316,7 +1317,7 @@ send_manage_msg(void)
     if (SOCKADDR_FAMILY(req_sockaddr) == AF_INET6)
         socketfd = xdmcpSocket6;
 #endif
-    XdmcpFlush(socketfd, &buffer, (XdmcpNetaddr) & req_sockaddr, req_socklen);
+    XdmcpFlush(socketfd, &buffer, (XdmcpNetaddr) &req_sockaddr, req_socklen);
 }
 
 static void
@@ -1373,7 +1374,7 @@ send_keepalive_msg(void)
     if (SOCKADDR_FAMILY(req_sockaddr) == AF_INET6)
         socketfd = xdmcpSocket6;
 #endif
-    XdmcpFlush(socketfd, &buffer, (XdmcpNetaddr) & req_sockaddr, req_socklen);
+    XdmcpFlush(socketfd, &buffer, (XdmcpNetaddr) &req_sockaddr, req_socklen);
 }
 
 static void
@@ -1391,7 +1392,7 @@ recv_alive_msg(unsigned length)
         if (SessionRunning && AliveSessionID == SessionID) {
             /* backoff dormancy period */
             state = XDM_RUN_SESSION;
-            if ((GetTimeInMillis() - lastDeviceEventTime[XIAllDevices].milliseconds) >
+            if ((GetTimeInMillis() - LastEventTime(XIAllDevices).milliseconds) >
                 keepaliveDormancy * 1000) {
                 keepaliveDormancy <<= 1;
                 if (keepaliveDormancy > XDM_MAX_DORMANCY)
index fa66c7a..24c0aa2 100644 (file)
@@ -116,6 +116,36 @@ x_sha1_final(void *ctx, unsigned char result[20])
     return 1;
 }
 
+#elif defined(HAVE_SHA1_IN_LIBNETTLE)   /* Use libnettle for SHA1 */
+
+#include <nettle/sha.h>
+
+void *
+x_sha1_init(void)
+{
+    struct sha1_ctx *ctx = malloc(sizeof(*ctx));
+
+    if (!ctx)
+        return NULL;
+    sha1_init(ctx);
+    return ctx;
+}
+
+int
+x_sha1_update(void *ctx, void *data, int size)
+{
+    sha1_update(ctx, size, data);
+    return 1;
+}
+
+int
+x_sha1_final(void *ctx, unsigned char result[20])
+{
+    sha1_digest(ctx, 20, result);
+    free(ctx);
+    return 1;
+}
+
 #elif defined(HAVE_SHA1_IN_LIBGCRYPT)   /* Use libgcrypt for SHA1 */
 
 #include <gcrypt.h>
index 6348a65..2bc79e7 100644 (file)
@@ -5,9 +5,11 @@
 #include <X11/Xfuncproto.h>
 
 /* ErrorF is used by xtrans */
+#ifndef HAVE_DIX_CONFIG_H
 extern _X_EXPORT void
 ErrorF(const char *f, ...)
 _X_ATTRIBUTE_PRINTF(1, 2);
+#endif
 
 #define TRANS_REOPEN
 #define TRANS_SERVER
index c153c37..3ad2ac2 100755 (executable)
@@ -1,12 +1,13 @@
 Name:      xorg-x11-server
 Summary:    X.Org X11 X server
-Version:    1.13.30
-Release:    3
+Version:    1.16.9.2
+Release:    0
 Group:      System/X11
 License:    MIT
 URL:        http://www.x.org
 Source0:    %{name}-%{version}.tar.gz
 Requires:   libdrm2 >= 2.4.0
+BuildRequires:  libgcrypt-devel
 BuildRequires:  pkgconfig(xorg-macros)
 BuildRequires:  pkgconfig(fontutil)
 BuildRequires:  pkgconfig(xtrans)
@@ -30,7 +31,7 @@ BuildRequires:  pkgconfig(inputproto)
 BuildRequires:  pkgconfig(fontsproto)
 BuildRequires:  pkgconfig(videoproto)
 BuildRequires:  pkgconfig(xf86vidmodeproto)
-BuildRequires:  xorg-x11-proto-gesture
+BuildRequires:  pkgconfig(gestureproto)
 BuildRequires:  pkgconfig(xdmcp)
 BuildRequires:  pkgconfig(xfont)
 BuildRequires:  pkgconfig(xkbfile)
@@ -38,11 +39,16 @@ BuildRequires:  pkgconfig(pixman-1)
 BuildRequires:  pkgconfig(xv)
 BuildRequires:  pkgconfig(libudev)
 BuildRequires:  pkgconfig(libdrm)
-BuildRequires:  libpciaccess-devel
-BuildRequires:  libgcrypt-devel
-BuildRequires:  xorg-x11-proto-hwc
+BuildRequires:  pkgconfig(pciaccess)
+BuildRequires:  pkgconfig(hwcproto)
+BuildRequires:  pkgconfig(hwaproto)
 BuildRequires:  pkgconfig(libsystemd-daemon)
-
+BuildRequires:  pkgconfig(dri3proto)
+BuildRequires:  pkgconfig(presentproto)
+BuildRequires:  pkgconfig(xshmfence)
+BuildRequires:  pkgconfig(ttrace)
+BuildRequires:  pkgconfig(vasum)
+BuildRequires:  pkgconfig(dlog)
 
 %description
 Description: %{summary}
@@ -103,12 +109,23 @@ drivers, input drivers, or other X modules should install this package.
 
 %build
 
-%autogen -i -v -f
-%configure \
+%if "%{?tizen_profile_name}" == "mobile"
+  export CFLAGS+=" "
+%else
+  %if "%{?tizen_profile_name}" == "wearable"
+    export CFLAGS+=" "
+  %else
+    %if "%{?tizen_profile_name}" == "tv"
+      export CFLAGS+=" -D_F_STEREOSCOPIC_SEND_FBSIZE_TO_WM_ -D_F_STEREOSCOPIC_LEFT_BUFFER_COODINATE_ "
+    %endif
+  %endif
+%endif
+
+%autogen \
        --disable-strict-compilation \
        --disable-static \
        --disable-debug \
-       --disable-unit-tests \
+       --enable-unit-tests \
        --disable-sparkle \
        --disable-builddocs \
        --disable-install-libxf86config \
@@ -123,7 +140,7 @@ drivers, input drivers, or other X modules should install this package.
        --enable-xv \
        --enable-xvmc \
        --disable-dga \
-       --disable-screensaver \
+       --enable-screensaver \
        --enable-xdmcp \
        --enable-xdm-auth-1 \
        --disable-glx \
@@ -164,9 +181,13 @@ drivers, input drivers, or other X modules should install this package.
        --disable-kdrive-evdev \
        --disable-doc \
        --disable-devel-doc \
+       --enable-present \
+       --enable-dri3 \
+       --disable-container \
+       --disable-dlog \
        --without-dtrace \
        --with-extra-module-dir="/usr/lib/xorg/extra-modules" \
-       --with-os-vendor="SLP(Samsung Linux Platform)" \
+       --with-os-vendor="Tizen Platform" \
        --with-xkb-path=/etc/X11/xkb \
        --with-xkb-output=/var/xkb \
        --with-default-font-path="built-ins" \
@@ -174,8 +195,11 @@ drivers, input drivers, or other X modules should install this package.
        --with-sha1=libgcrypt \
        --enable-gestures \
        --enable-hwc \
+       --enable-hwa \
        --enable-ir \
        --with-systemd-daemon \
+       --with-default-xkb-model="evdev" \
+       --enable-smack-util \
        CFLAGS="${CFLAGS} \
                -Wall -g \
                -D_F_UDEV_DEBUG_ \
@@ -183,31 +207,64 @@ drivers, input drivers, or other X modules should install this package.
                -D_F_NO_GRABTIME_UPDATE_ \
                -D_F_NO_CATCH_SIGNAL_ \
                -D_F_CHECK_NULL_CLIENT_ \
-               -D_F_COMP_OVL_PATCH \
                -D_F_PUT_ON_PIXMAP_ \
                -D_F_GETSTILL_GET_STOP_REQUEST_ \
                -D_F_IGNORE_MOVE_SPRITE_FOR_FLOATING_POINTER_ \
-               -D_F_NOT_ALWAYS_CREATE_FRONTBUFFER_ \
-               -D_F_DISABLE_SCALE_TO_DESKTOP_FOR_DIRECT_TOUCH_ \
                -D_F_GESTURE_EXTENSION_ \
                -D_F_DO_NULL_CHECK_AT_XKBFAKEDEVICEBUTTON_ \
-               -D_F_DRI2_SWAP_REGION_ \
                -D_F_NO_DAMAGE_DESCENDANT_FOR_HWC_ \
+               -D_F_NO_DAMAGE_DESCENDANT_FOR_HWA_ \
                -D_F_NOT_USE_SW_CURSOR_ \
                -D_F_DPMS_PHONE_CTRL_ \
+               -D_F_DRI2_NOT_ALWAYS_CREATE_FRONTBUFFER_ \
+               -D_F_DRI2_SWAP_REGION_ \
                -D_F_DRI2_FIX_INVALIDATE \
+        -D_F_DRI2_COMMIT_FRAME_DONE_ \
+        -D_F_DRI2_SKIP_FRAME_NOT_VIEWABLE_ \
+        -D_F_DRI2_SKIP_FRAME_WINDOW_SIZE_CHANGED_ \
                -D_F_RETURN_IF_INPUT_REMAINS_IN_WAITFORSTH_ \
                -D_F_NO_INPUT_INIT_ \
                -D_F_EXCLUDE_NON_MASK_SELECTED_FD_FROM_MAXCLIENTS_ \
                -D_F_HWC_EXTENSION_ \
+               -D_F_HWA_EXTENSION_ \
                -D_F_MIEQ_SPRITEINFO_NULL_CHECK_ \
                -D_F_DO_NOT_COPY_IN_RESIZE_WINDOW \
                -D_F_SET_XKB_DEFAULT_OPTIONS_FROM_CONFIGURE_ \
                -D_F_INPUT_REDIRECTION_ \
+               -D_F_SNIFF_MIEQ_ \
+               -D_F_SET_PROPERTY_MT_ \
+               -D_F_GET_CURRENT_SCREEN_ \
+        -D_F_EXYNOS_DRV_LOAD_ \
+        -D_F_CONTAINER_EXTENSION_ \
+        -D_F_SUPPORT_XTEST_TOUCH_EVENT_ \
+        -D_F_PRESENT_PIXMAP_SWAP_ \
+        -D_F_PRESENT_SYNC_DRAW_DONE_ \
+        -D_F_PRESENT_SELECTIVE_COMPOSITE_ \
+        -D_F_PRESENT_HWC_FLIP_ \
+        -D_F_PRESENT_SCANOUT_NOTIFY_ \
+        -D_F_ADD_HOOK_PROC_COMP_REDIRECT_UNREDIRECT_ \
+        -D_F_PRESENT_NOT_USE_FAKE_VBLANK_ \
+        -D_ENABLE_PRIVILEGE_CHECK_ON_XTEST_DEVICE_API_ \
+        -D_F_XV_PUTSTILL_CHECK_PRIVILEGE_ \
+        -D_XV_REPUTORSTOP_CHECK_XV_OFF_ \
+        -D_F_XV_DO_NOT_CHECK_OBSCURED_ \
+        -D_ADD_HOOK_FOR_WARP_POINTER_ \
+        -D_F_DRI2_RUNTIME_DISABLE_EXT_ \
+        -D_F_RUN_TIME_DISABLE_EXTENSION_ \
+       -D_F_NO_IMPLICIT_REDIRECT_ \
+%if "%{?TIZEN_PRODUCT_TV}" == "1"
+        -D_F_DRI2_CHECK_SERIALNUMBER_ \
+        -D_F_UDEV_MONITORING_WITH_KERNEL_UEVENT_ \
+        -D_F_PREVENT_CURSOR_FLICKER_ \
+        -D_F_XV_DRAW_CHECK_NULL_
+%else
+        -D_F_DRI2_CHECK_SERIALNUMBER_
+%endif
         " \
        CPPFLAGS="${CPPFLAGS} "
 
 #excluded macros
+#       -D_F_PRESENT_VBLANK_PENDING_ \
 #              -D_F_DYNAMIC_MIEQ_ \
 #              -D_F_NO_FLOATINGDEVICE_ERROR_ \
 #              -D_F_ENABLE_XI2_SENDEVENT_ \
@@ -231,8 +288,13 @@ rm -f %{buildroot}/usr/lib/xorg/modules/libxaa.so
 rm -f %{buildroot}/usr/lib/xorg/modules/libwfb.so
 rm -f %{buildroot}/usr/lib/xorg/modules/libxf8_16bpp.so
 
+rm -f %{buildroot}/usr/lib/xorg/modules/libshadow.so
+rm -f %{buildroot}/usr/lib/xorg/modules/libshadowfb.so
+rm -f %{buildroot}/usr/lib/xorg/modules/libint10.so
+
 rm -f %{buildroot}/var/xkb/README.compiled
 rm -f %{buildroot}/usr/share/X11/xorg.conf.d/10-evdev.conf
+rm -f %{buildroot}/usr/share/X11/xorg.conf.d/10-quirks.conf
 rm -rf %{buildroot}/usr/share/man/*
 
 #mkdir -p %{buildroot}/usr/share/X11/xorg.conf.d
@@ -261,7 +323,6 @@ rm -rf %{buildroot}/usr/share/man/*
 #cp xkb/README.compiled %{inst_srcdir}/xkb
 #cp hw/xfree86/xorgconf.cpp %{inst_srcdir}/hw/xfree86
 
-
 %clean
 rm -rf $RPM_BUILD_ROOT
 
diff --git a/present/Makefile.am b/present/Makefile.am
new file mode 100644 (file)
index 0000000..969b366
--- /dev/null
@@ -0,0 +1,18 @@
+noinst_LTLIBRARIES = libpresent.la
+AM_CFLAGS = \
+       -DHAVE_XORG_CONFIG_H \
+       @DIX_CFLAGS@ @XORG_CFLAGS@ \
+       -I$(top_srcdir)/hw/xfree86/common
+
+libpresent_la_SOURCES = \
+       present.h \
+       present.c \
+       present_event.c \
+       present_fake.c \
+       present_fence.c \
+       present_notify.c \
+       present_priv.h \
+       present_request.c \
+       present_screen.c
+
+sdk_HEADERS = present.h presentext.h
diff --git a/present/present.c b/present/present.c
new file mode 100755 (executable)
index 0000000..ba3a13a
--- /dev/null
@@ -0,0 +1,1652 @@
+/*
+ * Copyright Â© 2013 Keith Packard
+ *
+ * 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 the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  The copyright holders make no representations
+ * about the suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS 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_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "present_priv.h"
+
+#ifdef _F_PRESENT_HWC_FLIP_
+#include "hwc.h"
+#endif
+
+#include <gcstruct.h>
+#include <misync.h>
+#include <misyncstr.h>
+#ifdef MONOTONIC_CLOCK
+#include <time.h>
+#endif
+
+#ifdef _F_PRESENT_PIXMAP_SWAP_
+#include "compint.h"
+#endif //_F_PRESENT_PIXMAP_SWAP_
+
+#ifdef _F_PRESENT_SYNC_DRAW_DONE_
+#include "xf86.h"
+#endif //_F_PRESENT_SYNC_DRAW_DONE_
+
+
+static uint64_t         present_event_id;
+static struct xorg_list present_exec_queue;
+static struct xorg_list present_flip_queue;
+
+static void
+present_execute(present_vblank_ptr vblank, uint64_t ust, uint64_t crtc_msc);
+
+static inline PixmapPtr
+present_flip_pending_pixmap(ScreenPtr screen)
+{
+    present_screen_priv_ptr     screen_priv = present_screen_priv(screen);
+
+    if (!screen_priv)
+        return NULL;
+
+    if (!screen_priv->flip_pending)
+        return NULL;
+
+    return screen_priv->flip_pending->pixmap;
+}
+
+#if defined (_F_PRESENT_PIXMAP_SWAP_) || defined (_F_PRESENT_SYNC_DRAW_DONE_) || defined (_F_PRESENT_HWC_FLIP_)
+static WindowPtr
+_FindTopLevelWindowPtr (ScreenPtr screen, WindowPtr pWin)
+{
+    WindowPtr pRoot = screen->root;
+    CompScreenPtr pCompScreen = GetCompScreen (screen);
+
+    while (pWin->parent && pWin->parent->drawable.id != pRoot->drawable.id
+            && pWin->parent != pCompScreen->pOverlayWin)
+        pWin = pWin->parent;
+
+    return pWin;
+}
+#endif // _F_PRESENT_PIXMAP_SWAP_ || _F_PRESENT_SYNC_DRAW_DONE_
+
+#if defined (_F_PRESENT_PIXMAP_SWAP_) || defined (_F_PRESENT_HWC_FLIP_)
+static void
+_generateDamage (WindowPtr pWin)
+{
+    DrawablePtr pDraw = (DrawablePtr)pWin;
+    BoxRec box;
+    RegionRec region;
+
+    box.x1 = pDraw->x;
+    box.y1 = pDraw->y;
+    box.x2 = box.x1 + pDraw->width;
+    box.y2 = box.y1 + pDraw->height;
+    RegionInit (&region, &box, 0);
+    DamageDamageRegion (pDraw, &region);
+}
+
+static Bool
+present_check_swap (WindowPtr window, PixmapPtr pixmap)
+{
+    if (
+        window->drawable.width != pixmap->drawable.width ||
+        window->drawable.height != pixmap->drawable.height) {
+        DebugPixmap("      copy size pix_id:%p, pixmap:%p (%dx%d) refcnt:%d win_id:%p win:%p (%dx%d) view:%d\n",
+            pixmap->drawable.id,
+            pixmap,
+            pixmap->drawable.width,
+            pixmap->drawable.height,
+            pixmap->refcnt,
+            window->drawable.id,
+            window,
+            window->drawable.width,
+            window->drawable.height,
+            window->viewable);
+        return FALSE;
+    }
+
+    return TRUE;
+}
+#endif //_F_PRESENT_PIXMAP_SWAP_
+
+#ifdef _F_PRESENT_SYNC_DRAW_DONE_
+static void
+_SendSyncDrawDoneMessage(ScreenPtr screen, WindowPtr pWin)
+{
+    static Atom sync_draw_done = None;
+    xEvent event;
+    DeviceIntPtr dev = PickPointer(wClient(pWin));
+    WindowPtr top_level_window;
+    XID ret;
+
+    if (!dev)
+    {
+        xf86DrvMsg(screen->myNum, X_WARNING, "[Present] %s:Fail to get DeviceIntPtr", __func__);
+        return;
+    }
+
+    if (sync_draw_done == None)
+        sync_draw_done = MakeAtom ("_E_COMP_SYNC_DRAW_DONE", strlen ("_E_COMP_SYNC_DRAW_DONE"), TRUE);
+
+    top_level_window = _FindTopLevelWindowPtr (screen, pWin);
+    ret = top_level_window->drawable.id;
+
+    memset (&event, 0, sizeof (xEvent));
+    event.u.u.type = ClientMessage;
+    event.u.u.detail = 32;
+    event.u.clientMessage.window = ret;
+    event.u.clientMessage.u.l.type = sync_draw_done;
+    event.u.clientMessage.u.l.longs0 = ret; // window id
+    event.u.clientMessage.u.l.longs1 = 1; // version
+    event.u.clientMessage.u.l.longs2 = pWin->drawable.width; // window's width
+    event.u.clientMessage.u.l.longs3 = pWin->drawable.height; // window's height
+
+    DeliverEventsToWindow(dev, screen->root, &event, 1, SubstructureRedirectMask | SubstructureNotifyMask, NullGrab);
+}
+#endif //_F_PRESENT_SYNC_DRAW_DONE_
+
+/*
+ * Copies the update region from a pixmap to the target drawable
+ */
+static void
+present_copy_region(DrawablePtr drawable,
+                    PixmapPtr pixmap,
+                    RegionPtr update,
+                    int16_t x_off,
+                    int16_t y_off)
+{
+    ScreenPtr   screen = drawable->pScreen;
+    GCPtr       gc;
+
+    gc = GetScratchGC(drawable->depth, screen);
+    if (!gc)
+        return;
+
+    if (update) {
+        ChangeGCVal     changes[2];
+
+        changes[0].val = x_off;
+        changes[1].val = y_off;
+        ChangeGC(serverClient, gc,
+                 GCClipXOrigin|GCClipYOrigin,
+                 changes);
+        (*gc->funcs->ChangeClip)(gc, CT_REGION, update, 0);
+    }
+    ValidateGC(drawable, gc);
+    (*gc->ops->CopyArea)(&pixmap->drawable,
+                         drawable,
+                         gc,
+                         0, 0,
+                         pixmap->drawable.width, pixmap->drawable.height,
+                         x_off, y_off);
+    if (update)
+        (*gc->funcs->ChangeClip)(gc, CT_NONE, NULL, 0);
+    FreeScratchGC(gc);
+}
+
+#ifdef _F_PRESENT_HWC_FLIP_
+static Bool
+present_check_window_flip(RRCrtcPtr    crtc,
+                          WindowPtr    window,
+                          PixmapPtr    pixmap,
+                          Bool         sync_flip,
+                          RegionPtr    valid,
+                          int16_t      x_off,
+                          int16_t      y_off)
+{
+    if (!present_check_swap (window, pixmap))
+        return FALSE;
+    return hwc_validate_window (window);
+}
+#endif
+
+static Bool
+present_check_flip(RRCrtcPtr    crtc,
+                   WindowPtr    window,
+                   PixmapPtr    pixmap,
+                   Bool         sync_flip,
+                   RegionPtr    valid,
+                   int16_t      x_off,
+                   int16_t      y_off)
+{
+    ScreenPtr                   screen = window->drawable.pScreen;
+    PixmapPtr                   window_pixmap;
+    present_screen_priv_ptr     screen_priv = present_screen_priv(screen);
+#ifdef _F_PRESENT_PIXMAP_SWAP_
+    WindowPtr                   toplevel_window = _FindTopLevelWindowPtr (screen, window);
+#else
+    WindowPtr                   root = screen->root;
+#endif
+
+    if (!screen_priv)
+        return FALSE;
+
+    if (!screen_priv->info)
+        return FALSE;
+
+    if (!crtc)
+        return FALSE;
+
+    /* Check to see if the driver supports flips at all */
+    if (!screen_priv->info->flip)
+        return FALSE;
+
+    /* Make sure the window hasn't been redirected with Composite */
+    window_pixmap = screen->GetWindowPixmap(window);
+    if (window_pixmap != screen->GetScreenPixmap(screen) &&
+        window_pixmap != screen_priv->flip_pixmap &&
+#ifdef _F_PRESENT_PIXMAP_SWAP_
+        toplevel_window->redirectDraw &&
+#endif
+        window_pixmap != present_flip_pending_pixmap(screen))
+        return FALSE;
+
+#ifdef _F_PRESENT_PIXMAP_SWAP_
+    if (toplevel_window->redirectDraw)
+        return FALSE;
+
+    /* TODO [cyeon.lee] temp condition, will be removed
+       lock screen do flip when destroy window because window set screen pixmap
+     */
+    if (window->drawable.depth == 32)
+        return FALSE;
+#endif
+
+#ifndef _F_PRESENT_PIXMAP_SWAP_
+    /* Check for full-screen window */
+    if (!RegionEqual(&window->clipList, &root->winSize)) {
+        return FALSE;
+    }
+
+    /* Source pixmap must align with window exactly */
+    if (x_off || y_off) {
+        return FALSE;
+    }
+
+    /* Make sure the area marked as valid fills the screen */
+    if (valid && !RegionEqual(valid, &root->winSize)) {
+        return FALSE;
+    }
+
+    /* Does the window match the pixmap exactly? */
+    if (window->drawable.x != 0 || window->drawable.y != 0 ||
+#ifdef COMPOSITE
+        window->drawable.x != pixmap->screen_x || window->drawable.y != pixmap->screen_y ||
+#endif
+        window->drawable.width != pixmap->drawable.width ||
+        window->drawable.height != pixmap->drawable.height) {
+        return FALSE;
+    }
+#endif //_F_PRESENT_PIXMAP_SWAP_
+
+    /* Ask the driver for permission */
+    if (screen_priv->info->check_flip) {
+        if (!(*screen_priv->info->check_flip) (crtc, window, pixmap, sync_flip)) {
+            DebugPixmap("     d win_id,%p -> pix_id,%p\n",
+                      window->drawable.id, pixmap ? pixmap->drawable.id : 0);
+            return FALSE;
+        }
+    }
+
+    return TRUE;
+}
+
+static Bool
+present_flip(RRCrtcPtr crtc,
+             uint64_t event_id,
+             uint64_t target_msc,
+             PixmapPtr pixmap,
+             Bool sync_flip)
+{
+    ScreenPtr                   screen = crtc->pScreen;
+    present_screen_priv_ptr     screen_priv = present_screen_priv(screen);
+
+    return (*screen_priv->info->flip) (crtc, event_id, target_msc, pixmap, sync_flip);
+}
+
+#ifdef _F_PRESENT_HWC_FLIP_
+static Bool
+present_window_flip(RRCrtcPtr crtc,
+             uint64_t event_id,
+             uint64_t target_msc,
+             WindowPtr window,
+             PixmapPtr pixmap,
+             Bool sync_flip)
+{
+    ScreenPtr                   screen = crtc->pScreen;
+    present_screen_priv_ptr     screen_priv = present_screen_priv(screen);
+
+    if (screen_priv->info->window_flip)
+        return (*screen_priv->info->window_flip) (crtc, event_id, target_msc, window, pixmap, sync_flip);
+    return FALSE;
+}
+#endif
+
+static void
+present_vblank_notify(present_vblank_ptr vblank, CARD8 kind, CARD8 mode, uint64_t ust, uint64_t crtc_msc)
+{
+    int n;
+
+    if (vblank->window)
+        present_send_complete_notify(vblank->window, kind, mode, vblank->serial, ust, crtc_msc - vblank->msc_offset);
+    for (n = 0; n < vblank->num_notifies; n++) {
+        WindowPtr window = vblank->notifies[n].window;
+        CARD32 serial = vblank->notifies[n].serial;
+
+        if (window)
+            present_send_complete_notify(window, kind, mode, serial, ust, crtc_msc - vblank->msc_offset);
+    }
+}
+
+#if defined (_F_PRESENT_PIXMAP_SWAP_) || defined (_F_PRESENT_HWC_FLIP_)
+void
+#else
+static void
+#endif //_F_PRESENT_PIXMAP_SWAP_
+present_pixmap_idle(PixmapPtr pixmap, WindowPtr window, CARD32 serial, struct present_fence *present_fence)
+{
+    if (present_fence)
+        present_fence_set_triggered(present_fence);
+    if (window) {
+        DebugPixmap("     i pix_id,%p\n", pixmap ? pixmap->drawable.id : 0);
+        present_send_idle_notify(window, serial, pixmap, present_fence);
+    }
+}
+
+RRCrtcPtr
+present_get_crtc(WindowPtr window)
+{
+    ScreenPtr                   screen = window->drawable.pScreen;
+    present_screen_priv_ptr     screen_priv = present_screen_priv(screen);
+
+    if (!screen_priv)
+        return NULL;
+
+    if (!screen_priv->info)
+        return NULL;
+
+    return (*screen_priv->info->get_crtc)(window);
+}
+
+uint32_t
+present_query_capabilities(RRCrtcPtr crtc)
+{
+    present_screen_priv_ptr     screen_priv;
+
+    if (!crtc)
+        return 0;
+
+    screen_priv = present_screen_priv(crtc->pScreen);
+
+    if (!screen_priv)
+        return 0;
+
+    if (!screen_priv->info)
+        return 0;
+
+    return screen_priv->info->capabilities;
+}
+
+static int
+present_get_ust_msc(ScreenPtr screen, RRCrtcPtr crtc, uint64_t *ust, uint64_t *msc)
+{
+    present_screen_priv_ptr     screen_priv = present_screen_priv(screen);
+
+    if (crtc == NULL)
+        return present_fake_get_ust_msc(screen, ust, msc);
+    else
+        return (*screen_priv->info->get_ust_msc)(crtc, ust, msc);
+}
+
+static void
+present_flush(WindowPtr window)
+{
+    ScreenPtr                   screen = window->drawable.pScreen;
+    present_screen_priv_ptr     screen_priv = present_screen_priv(screen);
+
+    if (!screen_priv)
+        return;
+
+    if (!screen_priv->info)
+        return;
+
+    (*screen_priv->info->flush) (window);
+}
+
+static int
+present_queue_vblank(ScreenPtr screen,
+                     RRCrtcPtr crtc,
+                     uint64_t event_id,
+                     uint64_t msc)
+{
+    Bool                        ret;
+
+    if (crtc == NULL)
+        ret = present_fake_queue_vblank(screen, event_id, msc);
+    else
+    {
+        present_screen_priv_ptr     screen_priv = present_screen_priv(screen);
+        ret = (*screen_priv->info->queue_vblank) (crtc, event_id, msc);
+    }
+    return ret;
+}
+
+static uint64_t
+present_window_to_crtc_msc(WindowPtr window, RRCrtcPtr crtc, uint64_t window_msc, uint64_t new_msc)
+{
+    present_window_priv_ptr     window_priv = present_get_window_priv(window, TRUE);
+
+    if (!window_priv)
+        return window_msc;
+
+    if (crtc != window_priv->crtc) {
+        uint64_t        old_ust, old_msc;
+
+        /* The old CRTC may have been turned off, in which case
+         * we'll just use whatever previous MSC we'd seen from this CRTC
+         */
+
+        if (present_get_ust_msc(window->drawable.pScreen, window_priv->crtc, &old_ust, &old_msc) != Success)
+            old_msc = window_priv->msc;
+
+        window_priv->msc_offset += new_msc - old_msc;
+        window_priv->crtc = crtc;
+
+        DebugPixmap("msc set window:%p crtc:%p msc_offset,%8lld += new_msc,%8lld - old_msc,%8lld\n",
+                      window, crtc?crtc->id:0, window_priv->msc_offset, new_msc, old_msc);
+    }
+
+    DebugPixmap("msc cal target_msc window:%p window_msc,%8lld msc_offset,%8lld\n",
+                  window, window_msc, window_priv->msc_offset);
+
+    return window_msc + window_priv->msc_offset;
+}
+
+/*
+ * When the wait fence or previous flip is completed, it's time
+ * to re-try the request
+ */
+static void
+present_re_execute(present_vblank_ptr vblank)
+{
+    uint64_t            ust = 0, crtc_msc = 0;
+
+    if (vblank->crtc)
+        (void) present_get_ust_msc(vblank->screen, vblank->crtc, &ust, &crtc_msc);
+
+    present_execute(vblank, ust, crtc_msc);
+}
+
+static void
+present_flip_try_ready(ScreenPtr screen)
+{
+    present_vblank_ptr  vblank, tmp;
+
+    /*TODO: find all events with flag 'flip_ready'*/
+    xorg_list_for_each_entry_safe(vblank, tmp, &present_exec_queue, event_queue) {
+        if (vblank->flip_ready) {
+            present_re_execute(vblank);
+            return;
+        }
+    }
+}
+
+#ifdef _F_PRESENT_HWC_FLIP_
+void
+present_window_flip_idle(WindowPtr window)
+{
+    present_window_priv_ptr     window_priv = present_get_window_priv(window, FALSE);
+
+    if (window_priv->flip_pixmap) {
+        present_pixmap_idle(window_priv->flip_pixmap, window,
+                window_priv->flip_serial, window_priv->flip_idle_fence);
+        if (window_priv->flip_idle_fence)
+            present_fence_destroy(window_priv->flip_idle_fence);
+        dixDestroyPixmap(window_priv->flip_pixmap, window_priv->flip_pixmap->drawable.id);
+        window_priv->flip_crtc = NULL;
+        window_priv->flip_serial = 0;
+        window_priv->flip_pixmap = NULL;
+        window_priv->flip_idle_fence = NULL;
+    }
+}
+#endif
+
+#ifdef _F_PRESENT_VBLANK_PENDING_
+static void
+present_vblank_try_ready(WindowPtr pWin)
+{
+    present_window_priv_ptr window_priv = present_get_window_priv(pWin, TRUE);
+    present_vblank_ptr      vblank, tmp;
+
+    xorg_list_for_each_entry_safe(vblank, tmp, &window_priv->vblank, window_list) {
+        if (vblank->vblank_ready) {
+            DebugPixmap("         vt eid,%lld vblank,%p target_msc,%8lld: pix_id,%p -> win_id,%p (crtc_id,%p\n",
+              vblank->event_id, vblank, vblank->target_msc,
+              vblank->pixmap->drawable.id, vblank->window->drawable.id,
+              vblank->crtc->id);
+            present_re_execute(vblank);
+        }
+    }
+}
+#endif //_F_PRESENT_VBLANK_PENDING_
+
+static void
+present_flip_idle(ScreenPtr screen)
+{
+    present_screen_priv_ptr screen_priv = present_screen_priv(screen);
+
+    if (screen_priv->flip_pixmap) {
+        present_pixmap_idle(screen_priv->flip_pixmap, screen_priv->flip_window,
+                            screen_priv->flip_serial, screen_priv->flip_idle_fence);
+        if (screen_priv->flip_idle_fence)
+            present_fence_destroy(screen_priv->flip_idle_fence);
+
+        if (screen_priv->flip_window)
+        {
+            DebugPixmap("       pd pix_id:%p, pixmap:%p (%dx%d) refcnt:%d-1 win_id:%p win:%p (%dx%d) view:%d\n",
+                screen_priv->flip_pixmap->drawable.id,
+                screen_priv->flip_pixmap,
+                screen_priv->flip_pixmap->drawable.width,
+                screen_priv->flip_pixmap->drawable.height,
+                screen_priv->flip_pixmap->refcnt,
+                screen_priv->flip_window->drawable.id,
+                screen_priv->flip_window,
+                screen_priv->flip_window->drawable.width,
+                screen_priv->flip_window->drawable.height,
+                screen_priv->flip_window->viewable);
+        }
+        else
+        {
+            DebugPixmap("       pd pix_id:%p, pixmap:%p (%dx%d) refcnt:%d-1 screen_priv->flip_window==NULL\n",
+                screen_priv->flip_pixmap->drawable.id,
+                screen_priv->flip_pixmap,
+                screen_priv->flip_pixmap->drawable.width,
+                screen_priv->flip_pixmap->drawable.height,
+                screen_priv->flip_pixmap->refcnt);
+        }
+
+        dixDestroyPixmap(screen_priv->flip_pixmap, screen_priv->flip_pixmap->drawable.id);
+        screen_priv->flip_crtc = NULL;
+        screen_priv->flip_window = NULL;
+        screen_priv->flip_serial = 0;
+        screen_priv->flip_pixmap = NULL;
+        screen_priv->flip_idle_fence = NULL;
+    }
+}
+
+struct pixmap_visit {
+    PixmapPtr   old;
+    PixmapPtr   new;
+};
+
+static int
+present_set_tree_pixmap_visit(WindowPtr window, void *data)
+{
+    struct pixmap_visit *visit = data;
+    ScreenPtr           screen = window->drawable.pScreen;
+
+    if ((*screen->GetWindowPixmap)(window) != visit->old)
+        return WT_DONTWALKCHILDREN;
+    (*screen->SetWindowPixmap)(window, visit->new);
+    return WT_WALKCHILDREN;
+}
+
+static void
+present_set_tree_pixmap(WindowPtr window, PixmapPtr pixmap)
+{
+    struct pixmap_visit visit;
+    ScreenPtr           screen = window->drawable.pScreen;
+
+    visit.old = (*screen->GetWindowPixmap)(window);
+    visit.new = pixmap;
+    if (visit.old == visit.new)
+        return;
+    TraverseTree(window, present_set_tree_pixmap_visit, &visit);
+}
+
+static void
+present_set_abort_flip(ScreenPtr screen)
+{
+    present_screen_priv_ptr screen_priv = present_screen_priv(screen);
+
+    /* Switch back to using the screen pixmap now to avoid
+     * 2D applications drawing to the wrong pixmap.
+     */
+
+    if (screen_priv->flip_window)
+        present_set_tree_pixmap(screen_priv->flip_window,
+                                  (*screen->GetScreenPixmap)(screen));
+
+    present_set_tree_pixmap(screen->root, (*screen->GetScreenPixmap)(screen));
+
+    screen_priv->flip_pending->abort_flip = TRUE;
+
+}
+
+#ifdef _F_PRESENT_HWC_FLIP_
+static void
+present_window_unflip(WindowPtr window)
+{
+    present_window_priv_ptr window_priv = present_window_priv(window);
+
+    assert (!window_priv->unflip_event_id);
+    assert (!window_priv->flip_pending);
+
+    /*TODO*/
+    present_set_tree_pixmap(window, NULL/*firstPixmap*/);
+
+    /* Update the first pixmap with the current flip pixmap contents
+     */
+    if (window_priv->flip_pixmap) {
+        present_copy_region(&window->drawable,
+                            window_priv->flip_pixmap,
+                            NULL, 0, 0);
+    }
+    window_priv->unflip_event_id = ++present_event_id;
+    DebugPixmap("wu %lld\n", window_priv->unflip_event_id);
+    /*TODO*/
+//    (*screen_priv->info->window_unflip) (screen, window, window_priv->unflip_event_id);
+}
+#endif
+
+static void
+present_unflip(ScreenPtr screen)
+{
+    present_screen_priv_ptr screen_priv = present_screen_priv(screen);
+
+    assert (!screen_priv->unflip_event_id);
+    assert (!screen_priv->flip_pending);
+
+    if (screen_priv->flip_window)
+        present_set_tree_pixmap(screen_priv->flip_window,
+                                  (*screen->GetScreenPixmap)(screen));
+
+    present_set_tree_pixmap(screen->root, (*screen->GetScreenPixmap)(screen));
+
+    /* Update the screen pixmap with the current flip pixmap contents
+     */
+    if (screen_priv->flip_pixmap && screen_priv->flip_window) {
+        present_copy_region(&screen_priv->flip_window->drawable,
+                            screen_priv->flip_pixmap,
+                            NULL, 0, 0);
+    }
+    screen_priv->unflip_event_id = ++present_event_id;
+    DebugPixmap("          u unflip_eid,%lld\n", screen_priv->unflip_event_id);
+
+    (*screen_priv->info->unflip) (screen, screen_priv->unflip_event_id);
+}
+
+static void
+present_flip_notify(present_vblank_ptr vblank, uint64_t ust, uint64_t crtc_msc)
+{
+    ScreenPtr                   screen = vblank->screen;
+    present_screen_priv_ptr     screen_priv = present_screen_priv(screen);
+#ifdef _F_PRESENT_HWC_FLIP_
+    WindowPtr                                  window = NULL;
+    present_window_priv_ptr     window_priv = NULL;
+
+    if (vblank->window_flip) {
+
+       window = vblank->window;
+        window_priv = present_window_priv(window);
+
+        DebugPixmap("     n eid,%lld vblank,%p target_msc,%8lld: pix_id,%p -> win_id,%p\n",
+                      vblank->event_id, vblank, vblank->target_msc,
+                      vblank->pixmap ? vblank->pixmap->drawable.id : 0,
+                      vblank->window ? vblank->window->drawable.id : 0);
+
+        /*
+         * By this time the window can be already removed.
+         * In this case just delete the vblank and all vblank for the window in present_exec_queue.
+         */
+        if (!window_priv || !window_priv->flip_pending) {
+            xorg_list_del(&vblank->event_queue);
+            present_vblank_destroy(vblank);
+            present_vblank_ptr  vblank, tmp;
+            xorg_list_for_each_entry_safe(vblank, tmp, &present_exec_queue, event_queue) {
+                if (vblank->window == window) {
+                    xorg_list_del(&vblank->event_queue);
+                    present_vblank_destroy(vblank);
+                }
+            }
+            return;
+        }
+
+        if (vblank->window == screen_priv->flip_window)
+            present_flip_idle(screen);
+
+        present_window_flip_idle(vblank->window);
+
+        xorg_list_del(&vblank->event_queue);
+
+        /* Transfer reference for pixmap and fence from vblank to window_priv */
+        window_priv->flip_crtc = vblank->crtc;
+        window_priv->flip_serial = vblank->serial;
+        window_priv->flip_pixmap = vblank->pixmap;
+        window_priv->flip_idle_fence = vblank->idle_fence;
+
+        vblank->pixmap = NULL;
+        vblank->idle_fence = NULL;
+
+        window_priv->flip_pending = NULL;
+
+        if (vblank->abort_flip)
+            present_window_unflip(window);
+
+        present_vblank_notify(vblank, PresentCompleteKindPixmap, PresentCompleteModeFlip, ust, crtc_msc);
+        present_vblank_destroy(vblank);
+
+        present_flip_try_ready(screen);
+
+        return;
+    }
+#endif
+
+    DebugPixmap("     n eid,%lld vblank,%p target_msc,%8lld: pix_id,%p -> win_id,%p\n",
+                  vblank->event_id, vblank, vblank->target_msc,
+                  vblank->pixmap ? vblank->pixmap->drawable.id : 0,
+                  vblank->window ? vblank->window->drawable.id : 0);
+
+    assert (vblank == screen_priv->flip_pending);
+
+#ifdef _F_PRESENT_HWC_FLIP_
+    if (screen_priv->flip_pending->window)
+        present_window_flip_idle(vblank->window);
+#endif
+
+    present_flip_idle(screen);
+
+    xorg_list_del(&vblank->event_queue);
+
+    /* Transfer reference for pixmap and fence from vblank to screen_priv */
+    screen_priv->flip_crtc = vblank->crtc;
+    screen_priv->flip_window = vblank->window;
+    screen_priv->flip_serial = vblank->serial;
+    screen_priv->flip_pixmap = vblank->pixmap;
+    screen_priv->flip_idle_fence = vblank->idle_fence;
+
+    vblank->pixmap = NULL;
+    vblank->idle_fence = NULL;
+
+    screen_priv->flip_pending = NULL;
+
+    if (vblank->abort_flip)
+        present_unflip(screen);
+
+    present_vblank_notify(vblank, PresentCompleteKindPixmap, PresentCompleteModeFlip, ust, crtc_msc);
+    present_vblank_destroy(vblank);
+
+    present_flip_try_ready(screen);
+}
+
+void
+present_event_notify(uint64_t event_id, uint64_t ust, uint64_t msc)
+{
+    present_vblank_ptr  vblank, tmp;
+    int                 s;
+
+    if (!event_id)
+        return;
+
+    DebugPixmap("    e eid,%lld ust,%lld msc,%lld\n", event_id, ust, msc);
+
+    xorg_list_for_each_entry_safe(vblank, tmp, &present_exec_queue, event_queue) {
+        if (vblank->event_id == event_id) {
+            present_execute(vblank, ust, msc);
+#ifdef _F_PRESENT_VBLANK_PENDING_
+            present_window_priv_ptr window_priv = present_get_window_priv(vblank->window, TRUE);
+            if (window_priv->vblank_pending && window_priv->vblank_pending->event_id == event_id) {
+                DebugPixmap("    vpe eid,%lld vblank,%p target_msc,%8lld: pix_id,%p -> win_id,%p (crtc_id,%p)\n",
+                          window_priv->vblank_pending->event_id, window_priv->vblank_pending, window_priv->vblank_pending->target_msc,
+                          window_priv->vblank_pending->pixmap->drawable.id, window_priv->vblank_pending->window->drawable.id,
+                          window_priv->vblank_pending->crtc?vblank->crtc->id:0);
+                window_priv->vblank_pending = NULL;
+                present_vblank_try_ready (vblank->window);
+            }
+#endif //_F_PRESENT_PIXMAP_SWAP_
+            return;
+        }
+    }
+    xorg_list_for_each_entry_safe(vblank, tmp, &present_flip_queue, event_queue) {
+        if (vblank->event_id == event_id) {
+            present_flip_notify(vblank, ust, msc);
+            return;
+        }
+    }
+
+    for (s = 0; s < screenInfo.numScreens; s++) {
+        ScreenPtr               screen = screenInfo.screens[s];
+        present_screen_priv_ptr screen_priv = present_screen_priv(screen);
+
+        if (event_id == screen_priv->unflip_event_id) {
+            DebugPixmap("    un eid,%lld\n", event_id);
+
+            screen_priv->unflip_event_id = 0;
+            present_flip_idle(screen);
+            present_flip_try_ready(screen);
+            return;
+        }
+    }
+}
+
+/*
+ * 'window' is being reconfigured. Check to see if it is involved
+ * in flipping and clean up as necessary
+ */
+void
+present_check_flip_window (WindowPtr window)
+{
+    ScreenPtr                   screen = window->drawable.pScreen;
+    present_screen_priv_ptr     screen_priv = present_screen_priv(screen);
+    present_window_priv_ptr     window_priv = present_window_priv(window);
+    present_vblank_ptr          flip_pending = screen_priv->flip_pending;
+    present_vblank_ptr          vblank;
+
+    /* If this window hasn't ever been used with Present, it can't be
+     * flipping
+     */
+    if (!window_priv)
+        return;
+
+    if (screen_priv->unflip_event_id)
+        return;
+
+    if (flip_pending) {
+        /*
+         * Check pending flip
+         */
+        if (flip_pending->window == window) {
+            if (!present_check_flip(flip_pending->crtc, window, flip_pending->pixmap,
+                                    flip_pending->sync_flip, NULL, 0, 0))
+                present_set_abort_flip(screen);
+        }
+    } else {
+        /*
+         * Check current flip
+         */
+        if (window == screen_priv->flip_window) {
+            if (!present_check_flip(screen_priv->flip_crtc, window, screen_priv->flip_pixmap, FALSE, NULL, 0, 0))
+                present_unflip(screen);
+        }
+    }
+
+    /* Now check any queued vblanks */
+    xorg_list_for_each_entry(vblank, &window_priv->vblank, window_list) {
+        if (vblank->queued && vblank->flip && !present_check_flip(vblank->crtc, window, vblank->pixmap, FALSE, NULL, 0, 0))
+            vblank->flip = FALSE;
+    }
+}
+
+/*
+ * Called when the wait fence is triggered; just gets the current msc/ust and
+ * calls present_execute again. That will re-check the fence and pend the
+ * request again if it's still not actually ready
+ */
+static void
+present_wait_fence_triggered(void *param)
+{
+    present_vblank_ptr  vblank = param;
+    present_re_execute(vblank);
+}
+
+#if defined (_F_PRESENT_PIXMAP_SWAP_) || defined (_F_PRESENT_HWC_FLIP_)
+static void
+present_set_swap_vblank (present_vblank_ptr vblank)
+{
+    present_window_priv_ptr window_priv = present_get_window_priv(vblank->window, TRUE);
+
+    if (!window_priv)
+        return;
+
+    if (window_priv->swap_vblank) {
+        DebugPixmap("        ex swap_vblank pix_id:%p, pixmap:%p (%dx%d) refcnt:%d win_id:%p win:%p (%dx%d) view:%d\n",
+            window_priv->swap_vblank->pixmap->drawable.id,
+            window_priv->swap_vblank->pixmap,
+            window_priv->swap_vblank->pixmap->drawable.width,
+            window_priv->swap_vblank->pixmap->drawable.height,
+            window_priv->swap_vblank->pixmap->refcnt,
+            window_priv->swap_vblank->window->drawable.id,
+            window_priv->swap_vblank->window,
+            window_priv->swap_vblank->window->drawable.width,
+            window_priv->swap_vblank->window->drawable.height,
+            window_priv->swap_vblank->window->viewable);
+        present_pixmap_idle(window_priv->swap_vblank->pixmap,
+                            window_priv->swap_vblank->window,
+                            window_priv->swap_vblank->serial,
+                            window_priv->swap_vblank->idle_fence);
+        present_vblank_destroy(window_priv->swap_vblank);
+    }
+    window_priv->swap_vblank = vblank;
+
+    return;
+}
+
+static void
+present_swap_vblank_idle (present_vblank_ptr vblank)
+{
+    present_window_priv_ptr window_priv = present_get_window_priv(vblank->window, TRUE);
+
+    if (!window_priv)
+        return;
+
+    if (window_priv->swap_vblank) {
+        DebugPixmap("        ex swap_vblank pix_id:%p, pixmap:%p (%dx%d) refcnt:%d win_id:%p win:%p (%dx%d) view:%d\n",
+            window_priv->swap_vblank->pixmap->drawable.id,
+            window_priv->swap_vblank->pixmap,
+            window_priv->swap_vblank->pixmap->drawable.width,
+            window_priv->swap_vblank->pixmap->drawable.height,
+            window_priv->swap_vblank->pixmap->refcnt,
+            window_priv->swap_vblank->window->drawable.id,
+            window_priv->swap_vblank->window,
+            window_priv->swap_vblank->window->drawable.width,
+            window_priv->swap_vblank->window->drawable.height,
+            window_priv->swap_vblank->window->viewable);
+        present_pixmap_idle(window_priv->swap_vblank->pixmap,
+                            window_priv->swap_vblank->window,
+                            window_priv->swap_vblank->serial,
+                            window_priv->swap_vblank->idle_fence);
+        present_vblank_destroy(window_priv->swap_vblank);
+    }
+    window_priv->swap_vblank = NULL;
+
+    return;
+}
+
+static void
+present_set_swap_pixmap (present_vblank_ptr vblank)
+{
+    ScreenPtr screen = vblank->window->drawable.pScreen;
+    WindowPtr toplevel_window = _FindTopLevelWindowPtr (screen, vblank->window);
+
+    if (toplevel_window->redirectDraw)
+    {
+        PixmapPtr toplevel_pixmap = (*screen->GetWindowPixmap) (toplevel_window);
+
+        vblank->pixmap->screen_x = toplevel_pixmap->screen_x;
+        vblank->pixmap->screen_y = toplevel_pixmap->screen_y;
+
+        DebugPixmap("        pd pix_id:%p, pixmap:%p (%dx%d) refcnt:%d-1 win_id:%p win:%p (%dx%d) view:%d\n",
+            toplevel_pixmap->drawable.id,
+            toplevel_pixmap,
+            toplevel_pixmap->drawable.width,
+            toplevel_pixmap->drawable.height,
+            toplevel_pixmap->refcnt,
+            toplevel_window->drawable.id,
+            toplevel_window,
+            toplevel_window->drawable.width,
+            toplevel_window->drawable.height,
+            toplevel_window->viewable);
+        dixDestroyPixmap (toplevel_pixmap, toplevel_pixmap->drawable.id);
+        DebugPixmap("        pi pix_id:%p, pixmap:%p (%dx%d) refcnt:%d+1 win_id:%p win:%p (%dx%d) view:%d\n",
+            vblank->pixmap->drawable.id,
+            vblank->pixmap,
+            vblank->pixmap->drawable.width,
+            vblank->pixmap->drawable.height,
+            vblank->pixmap->refcnt,
+            vblank->window->drawable.id,
+            vblank->window,
+            vblank->window->drawable.width,
+            vblank->window->drawable.height,
+            vblank->window->viewable);
+        vblank->pixmap->refcnt++;
+        present_set_tree_pixmap(toplevel_window, vblank->pixmap);
+    }
+
+    present_set_tree_pixmap(vblank->window, vblank->pixmap);
+
+    present_name_pixmap_ptr     name_pixmap, temp;
+    xorg_list_for_each_entry_safe(name_pixmap, temp,    &present_name_pixmap_list, name_pixmap_list) {
+
+        if (toplevel_window == name_pixmap->window) {
+            /* for name window ref cnt */
+            DebugPixmap("        pi pix_id:%p, pixmap:%p (%dx%d) refcnt:%d+1 win_id:%p win:%p (%dx%d) view:%d\n",
+                vblank->pixmap->drawable.id,
+                vblank->pixmap,
+                vblank->pixmap->drawable.width,
+                vblank->pixmap->drawable.height,
+                vblank->pixmap->refcnt,
+                vblank->window->drawable.id,
+                vblank->window,
+                vblank->window->drawable.width,
+                vblank->window->drawable.height,
+                vblank->window->viewable);
+            vblank->pixmap->refcnt++;
+
+            DebugPixmap("        set name pix_id:%p, pixmap:%p (%dx%d) refcnt:%d win_id:%p win:%p (%dx%d) view:%d -> name_pix_id:%p\n",
+                vblank->pixmap->drawable.id,
+                vblank->pixmap,
+                vblank->pixmap->drawable.width,
+                vblank->pixmap->drawable.height,
+                vblank->pixmap->refcnt,
+                vblank->window->drawable.id,
+                vblank->window,
+                vblank->window->drawable.width,
+                vblank->window->drawable.height,
+                vblank->window->viewable,
+                name_pixmap->id);
+            ChangeResourceValue (name_pixmap->id, RT_PIXMAP, vblank->pixmap);
+
+            DebugPixmap("        pd pix_id:%p, pixmap:%p (%dx%d) refcnt:%d-1 win_id:%p win:%p (%dx%d) view:%d\n",
+                name_pixmap->pixmap->drawable.id,
+                name_pixmap->pixmap,
+                name_pixmap->pixmap->drawable.width,
+                name_pixmap->pixmap->drawable.height,
+                name_pixmap->pixmap->refcnt,
+                vblank->window->drawable.id,
+                vblank->window,
+                vblank->window->drawable.width,
+                vblank->window->drawable.height,
+                vblank->window->viewable);
+            dixDestroyPixmap (name_pixmap->pixmap, name_pixmap->pixmap->drawable.id);
+            name_pixmap->pixmap = vblank->pixmap;
+        }
+    }
+
+    return;
+}
+#endif //defined (_F_PRESENT_PIXMAP_SWAP_) || defined (_F_PRESENT_HWC_FLIP_)
+
+/*
+ * Once the required MSC has been reached, execute the pending request.
+ *
+ * For requests to actually present something, either blt contents to
+ * the screen or queue a frame buffer swap.
+ *
+ * For requests to just get the current MSC/UST combo, skip that part and
+ * go straight to event delivery
+ */
+
+static void
+present_execute(present_vblank_ptr vblank, uint64_t ust, uint64_t crtc_msc)
+{
+    WindowPtr                   window = vblank->window;
+    ScreenPtr                   screen = window->drawable.pScreen;
+    present_screen_priv_ptr     screen_priv = present_screen_priv(screen);
+    uint8_t                     mode;
+#if _F_PRESENT_HWC_FLIP_
+    present_window_priv_ptr    window_priv = NULL;
+#endif
+
+    if (vblank->wait_fence) {
+        if (!present_fence_check_triggered(vblank->wait_fence)) {
+            present_fence_set_callback(vblank->wait_fence, present_wait_fence_triggered, vblank);
+            return;
+        }
+    }
+
+    if (vblank->flip && vblank->pixmap && vblank->window) {
+        if (screen_priv->flip_pending || screen_priv->unflip_event_id) {
+            DebugPixmap("        r eid,%lld \t(pending %p unflip_eid,%lld)\n",
+                          vblank->event_id,
+                          screen_priv->flip_pending, screen_priv->unflip_event_id);
+            vblank->flip_ready = TRUE;
+            return;
+        }
+    }
+
+#ifdef _F_PRESENT_HWC_FLIP_
+    if (vblank->window_flip && vblank->pixmap && vblank->window) {
+        window_priv = present_get_window_priv(window, TRUE);
+        if (window_priv) {
+            if (window_priv->flip_pending || window_priv->unflip_event_id) {
+                DebugPixmap("        r eid,%lld \t(pending %p unflip_eid,%lld)\n",
+                              vblank->event_id,
+                              window_priv->flip_pending, window_priv->unflip_event_id);
+                vblank->flip_ready = TRUE;
+                return;
+            }
+        }
+    }
+#endif
+
+    xorg_list_del(&vblank->event_queue);
+    xorg_list_del(&vblank->window_list);
+    vblank->queued = FALSE;
+
+    if (vblank->pixmap && vblank->window) {
+
+#ifdef _F_PRESENT_HWC_FLIP_
+        if (vblank->window_flip && window_priv) {
+
+            DebugPixmap("        fw %lld %p %8lld: %08lx -> %08lx\n",
+                          vblank->event_id, vblank, crtc_msc,
+                          vblank->pixmap->drawable.id, vblank->window->drawable.id);
+
+            /* Prepare to flip by placing it in the flip queue and
+             * and sticking it into the flip_pending field
+             */
+            window_priv->flip_pending = vblank;
+
+            xorg_list_add(&vblank->event_queue, &present_flip_queue);
+            /* Try to flip
+             */
+            if (present_window_flip(vblank->crtc, vblank->event_id, vblank->target_msc, vblank->window, vblank->pixmap, vblank->sync_flip)) {
+
+                present_set_swap_pixmap (vblank);
+
+                present_swap_vblank_idle (vblank);
+
+                /* Report update region as damaged
+                 */
+                _generateDamage(window);
+                _SendSyncDrawDoneMessage(screen, vblank->window);
+                return;
+            }
+
+            xorg_list_del(&vblank->event_queue);
+            /* Oops, flip failed. Clear the flip_pending field
+              */
+
+            window_priv->flip_pending = NULL;
+            vblank->flip = FALSE;
+        }
+#endif
+        if (vblank->flip) {
+
+            DebugPixmap("        f eid,%lld vblank,%p target_msc,%8lld: pix_id,%p -> win_id,%p\n",
+                          vblank->event_id, vblank, crtc_msc,
+                          vblank->pixmap->drawable.id, vblank->window->drawable.id);
+
+            /* Prepare to flip by placing it in the flip queue and
+             * and sticking it into the flip_pending field
+             */
+            screen_priv->flip_pending = vblank;
+
+            xorg_list_add(&vblank->event_queue, &present_flip_queue);
+            /* Try to flip
+             */
+            if (present_flip(vblank->crtc, vblank->event_id, vblank->target_msc, vblank->pixmap, vblank->sync_flip)) {
+                RegionPtr damage;
+
+                /* Fix window pixmaps:
+                 *  1) Restore previous flip window pixmap
+                 *  2) Set current flip window pixmap to the new pixmap
+                 */
+
+                if (screen_priv->flip_window && screen_priv->flip_window != window)
+                    present_set_tree_pixmap(screen_priv->flip_window,
+                                              (*screen->GetScreenPixmap)(screen));
+
+                present_set_tree_pixmap(vblank->window, vblank->pixmap);
+                present_set_tree_pixmap(screen->root, vblank->pixmap);
+
+#ifdef _F_PRESENT_PIXMAP_SWAP_
+                present_swap_vblank_idle (vblank);
+#endif //_F_PRESENT_PIXMAP_SWAP_
+
+                /* Report update region as damaged
+                 */
+                if (vblank->update) {
+                    damage = vblank->update;
+                    RegionIntersect(damage, damage, &window->clipList);
+                } else
+                    damage = &window->clipList;
+
+                DamageDamageRegion(&vblank->window->drawable, damage);
+                _SendSyncDrawDoneMessage(screen, vblank->window);
+                return;
+            }
+
+            xorg_list_del(&vblank->event_queue);
+            /* Oops, flip failed. Clear the flip_pending field
+              */
+            screen_priv->flip_pending = NULL;
+            vblank->flip = FALSE;
+        }
+
+        DebugPixmap("        c vblank,%p crtc_msc,%8lld: pix_id,%p -> win_id,%p\n", vblank, crtc_msc,
+                   vblank->pixmap->drawable.id, vblank->window->drawable.id);
+
+        if (screen_priv->flip_pending) {
+
+            /* Check pending flip
+             */
+            if (window == screen_priv->flip_pending->window)
+                present_set_abort_flip(screen);
+        } else if (!screen_priv->unflip_event_id) {
+
+            /* Check current flip
+             */
+            if (window == screen_priv->flip_window)
+                present_unflip(screen);
+        }
+
+#ifdef _F_PRESENT_PIXMAP_SWAP_
+        Bool can_swap = present_check_swap (vblank->window, vblank->pixmap);
+
+        if (!vblank->flip && can_swap) {
+            DebugPixmap("        sw vblank,%p crtc_msc,%8lld: pix_id,%p -> win_id,%p\n", vblank, crtc_msc,
+                       vblank->pixmap->drawable.id, vblank->window->drawable.id);
+
+            present_set_swap_pixmap (vblank);
+            present_set_swap_vblank (vblank);
+
+#ifdef _F_PRESENT_HWC_FLIP_
+            present_window_flip_idle(window);
+#endif //_F_PRESENT_HWC_FLIP_
+
+            _generateDamage (vblank->window);
+
+            vblank->update = NULL;
+            present_flush(window);
+
+            mode = PresentCompleteModeCopy;
+            present_vblank_notify(vblank, vblank->kind, mode, ust, crtc_msc);
+
+#ifdef _F_PRESENT_SYNC_DRAW_DONE_
+            _SendSyncDrawDoneMessage(screen, vblank->window);
+#endif //_F_PRESENT_SYNC_DRAW_DONE_
+
+            return;
+        }
+#endif //_F_PRESENT_PIXMAP_SWAP_
+
+        present_copy_region(&window->drawable, vblank->pixmap, vblank->update, vblank->x_off, vblank->y_off);
+
+#ifdef _F_PRESENT_SYNC_DRAW_DONE_
+        _SendSyncDrawDoneMessage(screen, vblank->window);
+#endif //_F_PRESENT_SYNC_DRAW_DONE_
+        /* present_copy_region sticks the region into a scratch GC,
+         * which is then freed, freeing the region
+         */
+
+        vblank->update = NULL;
+        present_flush(window);
+
+        present_pixmap_idle(vblank->pixmap, vblank->window, vblank->serial, vblank->idle_fence);
+    }
+    /* Compute correct CompleteMode
+     */
+    if (vblank->kind == PresentCompleteKindPixmap) {
+        if (vblank->pixmap && vblank->window)
+            mode = PresentCompleteModeCopy;
+        else
+            mode = PresentCompleteModeSkip;
+    }
+    else
+        mode = PresentCompleteModeCopy;
+
+    present_vblank_notify(vblank, vblank->kind, mode, ust, crtc_msc);
+    present_vblank_destroy(vblank);
+}
+
+int
+present_pixmap(WindowPtr window,
+               PixmapPtr pixmap,
+               CARD32 serial,
+               RegionPtr valid,
+               RegionPtr update,
+               int16_t x_off,
+               int16_t y_off,
+               RRCrtcPtr target_crtc,
+               SyncFence *wait_fence,
+               SyncFence *idle_fence,
+               uint32_t options,
+               uint64_t window_msc,
+               uint64_t divisor,
+               uint64_t remainder,
+               present_notify_ptr notifies,
+               int num_notifies)
+{
+    uint64_t                    ust;
+    uint64_t                    target_msc;
+    uint64_t                    crtc_msc;
+    int                         ret;
+    present_vblank_ptr          vblank, tmp;
+    ScreenPtr                   screen = window->drawable.pScreen;
+    present_window_priv_ptr     window_priv = present_get_window_priv(window, TRUE);
+    present_screen_priv_ptr     screen_priv = present_screen_priv(screen);
+
+    if (!window_priv)
+        return BadAlloc;
+
+    if (!screen_priv || !screen_priv->info)
+        target_crtc = NULL;
+    else if (!target_crtc) {
+        /* Update the CRTC if we have a pixmap or we don't have a CRTC
+         */
+        if (!pixmap)
+            target_crtc = window_priv->crtc;
+
+        if (!target_crtc)
+            target_crtc = present_get_crtc(window);
+    }
+
+    present_get_ust_msc(screen, target_crtc, &ust, &crtc_msc);
+
+    DebugPixmap("         msc get window:%p target_crtc:%p ust,%8lld crtc_msc,%8lld\n",
+                  window, target_crtc?target_crtc->id:0, ust, crtc_msc);
+
+    target_msc = present_window_to_crtc_msc(window, target_crtc, window_msc, crtc_msc);
+
+    /* Stash the current MSC away in case we need it later
+     */
+    window_priv->msc = crtc_msc;
+
+    /* Adjust target_msc to match modulus
+     */
+    if (crtc_msc >= target_msc) {
+        if (divisor != 0) {
+            target_msc = crtc_msc - (crtc_msc % divisor) + remainder;
+            if (options & PresentOptionAsync) {
+                if (target_msc < crtc_msc)
+                    target_msc += divisor;
+            } else {
+                if (target_msc <= crtc_msc)
+                    target_msc += divisor;
+            }
+        } else {
+            target_msc = crtc_msc;
+            if (!(options & PresentOptionAsync))
+                target_msc++;
+        }
+    }
+
+    /*
+     * Look for a matching presentation already on the list and
+     * don't bother doing the previous one if this one will overwrite it
+     * in the same frame
+     */
+#ifndef _F_PRESENT_VBLANK_PENDING_
+    if (!update) {
+        xorg_list_for_each_entry_safe(vblank, tmp, &window_priv->vblank, window_list) {
+
+            if (!vblank->pixmap)
+                continue;
+
+            if (!vblank->queued)
+                continue;
+
+            if (vblank->crtc != target_crtc || vblank->target_msc != target_msc)
+                continue;
+
+            DebugPixmap("         x eid,%lld vblank,%p target_msc,%8lld: pix_id,%p -> win_id,%p (crtc_id,%p\n",
+                          vblank->event_id, vblank, vblank->target_msc,
+                          vblank->pixmap->drawable.id, vblank->window->drawable.id,
+                          vblank->crtc->id);
+
+            present_pixmap_idle(vblank->pixmap, vblank->window, vblank->serial, vblank->idle_fence);
+            present_fence_destroy(vblank->idle_fence);
+
+            DebugPixmap("         pd pix_id:%p, pixmap:%p (%dx%d) refcnt:%d-1 win_id:%p win:%p (%dx%d) view:%d\n",
+                vblank->pixmap->drawable.id,
+                vblank->pixmap,
+                vblank->pixmap->drawable.width,
+                vblank->pixmap->drawable.height,
+                vblank->pixmap->refcnt,
+                vblank->window->drawable.id,
+                vblank->window,
+                vblank->window->drawable.width,
+                vblank->window->drawable.height,
+                vblank->window->viewable);
+
+            dixDestroyPixmap(vblank->pixmap, vblank->pixmap->drawable.id);
+
+            vblank->pixmap = NULL;
+            vblank->idle_fence = NULL;
+            vblank->flip = FALSE;
+            if (vblank->flip_ready)
+                present_re_execute(vblank);
+        }
+    }
+#endif //_F_PRESENT_PIXMAP_SWAP_
+
+    vblank = calloc (1, sizeof (present_vblank_rec));
+    if (!vblank)
+        return BadAlloc;
+
+    xorg_list_append(&vblank->window_list, &window_priv->vblank);
+    xorg_list_init(&vblank->event_queue);
+
+    vblank->screen = screen;
+    vblank->window = window;
+    vblank->pixmap = pixmap;
+    vblank->event_id = ++present_event_id;
+    if (pixmap) {
+        vblank->kind = PresentCompleteKindPixmap;
+
+        DebugPixmap("         pi pix_id:%p, pixmap:%p (%dx%d) refcnt:%d+1 win_id:%p win:%p (%dx%d) view:%d\n",
+            pixmap->drawable.id,
+            pixmap,
+            pixmap->drawable.width,
+            pixmap->drawable.height,
+            pixmap->refcnt,
+            window->drawable.id,
+            window,
+            window->drawable.width,
+            window->drawable.height,
+            window->viewable);
+
+        pixmap->refcnt++;
+    } else
+        vblank->kind = PresentCompleteKindNotifyMSC;
+
+    vblank->serial = serial;
+
+    if (valid) {
+        vblank->valid = RegionDuplicate(valid);
+        if (!vblank->valid)
+            goto no_mem;
+    }
+    if (update) {
+        vblank->update = RegionDuplicate(update);
+        if (!vblank->update)
+            goto no_mem;
+    }
+
+    vblank->x_off = x_off;
+    vblank->y_off = y_off;
+    vblank->target_msc = target_msc;
+    vblank->crtc = target_crtc;
+    vblank->msc_offset = window_priv->msc_offset;
+    vblank->notifies = notifies;
+    vblank->num_notifies = num_notifies;
+
+    if (!screen_priv || !screen_priv->info || !(screen_priv->info->capabilities & PresentCapabilityAsync))
+        vblank->sync_flip = TRUE;
+
+#ifdef _F_PRESENT_HWC_FLIP_
+    if (pixmap && present_check_window_flip (target_crtc, window, pixmap, vblank->sync_flip, valid, x_off, y_off)) {
+        vblank->window_flip = TRUE;
+        if (vblank->sync_flip)
+            target_msc--;
+    } else
+#endif
+    if (pixmap && present_check_flip (target_crtc, window, pixmap, vblank->sync_flip, valid, x_off, y_off)) {
+        vblank->flip = TRUE;
+        if (vblank->sync_flip)
+            target_msc--;
+    }
+
+    if (wait_fence) {
+        vblank->wait_fence = present_fence_create(wait_fence);
+        if (!vblank->wait_fence)
+            goto no_mem;
+    }
+
+    if (idle_fence) {
+        vblank->idle_fence = present_fence_create(idle_fence);
+        if (!vblank->idle_fence)
+            goto no_mem;
+    }
+
+    if (pixmap) {
+        DebugPixmap("         q eid,%lld vblank,%p target_msc,%8lld: pix_id,%p -> win_id,%p (crtc id,%p)\n",
+                      vblank->event_id, vblank, target_msc,
+                      vblank->pixmap->drawable.id, vblank->window->drawable.id,
+                      target_crtc?target_crtc->id:0);
+    }
+
+    xorg_list_add(&vblank->event_queue, &present_exec_queue);
+    vblank->queued = TRUE;
+
+#ifdef _F_PRESENT_VBLANK_PENDING_
+    vblank->vblank_ready = FALSE;
+    if (window_priv->vblank_pending && window_priv->vblank_pending->target_msc >= vblank->target_msc) {
+        vblank->vblank_ready =TRUE;
+        DebugPixmap("         vp eid,%lld vblank,%p target_msc,%8lld: pix_id,%p -> win_id,%p (crtc_id,%p) pending vblank,%p pix_id,%p\n",
+                      vblank->event_id, vblank, vblank->target_msc,
+                      vblank->pixmap->drawable.id, vblank->window->drawable.id,
+                      vblank->crtc?vblank->crtc->id:0,
+                      window_priv->vblank_pending, window_priv->vblank_pending->pixmap->drawable.id);
+
+        return Success;
+    }
+#endif //_F_PRESENT_VBLANK_PENDING_
+
+#ifdef _F_PRESENT_PIXMAP_SWAP_
+    if (target_msc >= crtc_msc && !vblank->flip && !vblank->window_flip) {
+#else
+    if (target_msc >= crtc_msc) {
+#endif
+
+#ifdef _F_PRESENT_VBLANK_PENDING_
+        window_priv->vblank_pending = vblank;
+        DebugPixmap("         vps eid,%lld vblank,%p target_msc,%8lld: pix_id,%p -> win_id,%p (crtc_id,%p)\n",
+                      vblank->event_id, vblank, vblank->target_msc,
+                      vblank->pixmap->drawable.id, vblank->window->drawable.id,
+                      vblank->crtc?vblank->crtc->id:0);
+#endif //_F_PRESENT_VBLANK_PENDING_
+        ret = present_queue_vblank(screen, target_crtc, vblank->event_id, target_msc);
+        if (ret != Success) {
+            xorg_list_del(&vblank->event_queue);
+            vblank->queued = FALSE;
+            goto failure;
+        }
+    } else
+        present_execute(vblank, ust, crtc_msc);
+
+    return Success;
+
+no_mem:
+    ret = BadAlloc;
+failure:
+    vblank->notifies = NULL;
+    present_vblank_destroy(vblank);
+    return ret;
+}
+
+void
+present_abort_vblank(ScreenPtr screen, RRCrtcPtr crtc, uint64_t event_id, uint64_t msc)
+{
+    present_vblank_ptr  vblank, tmp;
+
+    if (crtc == NULL)
+        present_fake_abort_vblank(screen, event_id, msc);
+    else
+    {
+        present_screen_priv_ptr     screen_priv = present_screen_priv(screen);
+
+        (*screen_priv->info->abort_vblank) (crtc, event_id, msc);
+    }
+
+    xorg_list_for_each_entry_safe(vblank, tmp, &present_exec_queue, event_queue) {
+        if (vblank->event_id == event_id) {
+            xorg_list_del(&vblank->event_queue);
+            vblank->queued = FALSE;
+            return;
+        }
+    }
+    xorg_list_for_each_entry_safe(vblank, tmp, &present_flip_queue, event_queue) {
+        if (vblank->event_id == event_id) {
+            xorg_list_del(&vblank->event_queue);
+            return;
+        }
+    }
+}
+
+int
+present_notify_msc(WindowPtr window,
+                   CARD32 serial,
+                   uint64_t target_msc,
+                   uint64_t divisor,
+                   uint64_t remainder)
+{
+    return present_pixmap(window,
+                          NULL,
+                          serial,
+                          NULL, NULL,
+                          0, 0,
+                          NULL,
+                          NULL, NULL,
+                          0,
+                          target_msc, divisor, remainder, NULL, 0);
+}
+
+void
+present_flip_destroy(ScreenPtr screen)
+{
+    present_screen_priv_ptr     screen_priv = present_screen_priv(screen);
+
+    /* XXX this needs to be synchronous for server reset */
+
+    /* Do the actual cleanup once the flip has been performed by the hardware */
+    if (screen_priv->flip_pending)
+        present_set_abort_flip(screen);
+}
+
+void
+present_vblank_destroy(present_vblank_ptr vblank)
+{
+    /* Remove vblank from window and screen lists */
+    xorg_list_del(&vblank->window_list);
+
+    DebugPixmap(" d eid,%lld vblank,%p target_msc,%8lld: pix_id,%p -> win_id,%p\n",
+                  vblank->event_id, vblank, vblank->target_msc,
+                  vblank->pixmap ? vblank->pixmap->drawable.id : 0,
+                  vblank->window ? vblank->window->drawable.id : 0);
+
+    /* Drop pixmap reference */
+    if (vblank->pixmap) {
+        DebugPixmap(" pd pix_id:%p, pixmap:%p (%dx%d) refcnt:%d-1 win_id:%p win:%p (%dx%d) view:%d\n",
+            vblank->pixmap->drawable.id,
+            vblank->pixmap,
+            vblank->pixmap->drawable.width,
+            vblank->pixmap->drawable.height,
+            vblank->pixmap->refcnt,
+            vblank->window->drawable.id,
+            vblank->window,
+            vblank->window->drawable.width,
+            vblank->window->drawable.height,
+            vblank->window->viewable);
+        dixDestroyPixmap(vblank->pixmap, vblank->pixmap->drawable.id);
+    }
+    /* Free regions */
+    if (vblank->valid)
+        RegionDestroy(vblank->valid);
+    if (vblank->update)
+        RegionDestroy(vblank->update);
+
+    if (vblank->wait_fence)
+        present_fence_destroy(vblank->wait_fence);
+
+    if (vblank->idle_fence)
+        present_fence_destroy(vblank->idle_fence);
+
+    if (vblank->notifies)
+        present_destroy_notifies(vblank->notifies, vblank->num_notifies);
+
+    free(vblank);
+}
+
+Bool
+present_init(void)
+{
+    xorg_list_init(&present_exec_queue);
+    xorg_list_init(&present_flip_queue);
+    present_fake_queue_init();
+    return TRUE;
+}
diff --git a/present/present.h b/present/present.h
new file mode 100644 (file)
index 0000000..dbdf195
--- /dev/null
@@ -0,0 +1,171 @@
+/*
+ * Copyright Â© 2013 Keith Packard
+ *
+ * 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 the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  The copyright holders make no representations
+ * about the suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS 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.
+ */
+
+#ifndef _PRESENT_H_
+#define _PRESENT_H_
+
+#ifdef ENABLE_DLOG
+#include <dlog.h>
+#include <stdarg.h>
+#define PRESENT_LOG_TAG "XORG_PIXMAP"
+#define DebugPixmap(f, x...) {SLOG(LOG_INFO, PRESENT_LOG_TAG, f, ##x);}
+#else
+#define DebugPixmap(...) {;}
+#endif
+
+#include <X11/extensions/presentproto.h>
+#include "randrstr.h"
+#include "presentext.h"
+
+typedef struct present_vblank present_vblank_rec, *present_vblank_ptr;
+
+/* Return the current CRTC for 'window'.
+ */
+typedef RRCrtcPtr (*present_get_crtc_ptr) (WindowPtr window);
+
+/* Return the current ust/msc for 'crtc'
+ */
+typedef int (*present_get_ust_msc_ptr) (RRCrtcPtr crtc, uint64_t *ust, uint64_t *msc);
+
+/* Queue callback on 'crtc' for time 'msc'. Call present_event_notify with 'event_id'
+ * at or after 'msc'. Return false if it didn't happen (which might occur if 'crtc'
+ * is not currently generating vblanks).
+ */
+typedef Bool (*present_queue_vblank_ptr) (RRCrtcPtr crtc,
+                                          uint64_t event_id,
+                                          uint64_t msc);
+
+/* Abort pending vblank. The extension is no longer interested in
+ * 'event_id' which was to be notified at 'msc'. If possible, the
+ * driver is free to de-queue the notification.
+ */
+typedef void (*present_abort_vblank_ptr) (RRCrtcPtr crtc, uint64_t event_id, uint64_t msc);
+
+/* Flush pending drawing on 'window' to the hardware.
+ */
+typedef void (*present_flush_ptr) (WindowPtr window);
+
+/* Check if 'pixmap' is suitable for flipping to 'window'.
+ */
+typedef Bool (*present_check_flip_ptr) (RRCrtcPtr crtc, WindowPtr window, PixmapPtr pixmap, Bool sync_flip);
+
+/* Flip pixmap, return false if it didn't happen.
+ *
+ * 'crtc' is to be used for any necessary synchronization.
+ *
+ * 'sync_flip' requests that the flip be performed at the next
+ * vertical blank interval to avoid tearing artifacts. If false, the
+ * flip should be performed as soon as possible.
+ *
+ * present_event_notify should be called with 'event_id' when the flip
+ * occurs
+ */
+typedef Bool (*present_flip_ptr) (RRCrtcPtr crtc,
+                                  uint64_t event_id,
+                                  uint64_t target_msc,
+                                  PixmapPtr pixmap,
+                                  Bool sync_flip);
+/* #ifdef _F_PRESENT_HWC_FLIP_ */
+/* Add in for Tizen.
+ * Flip pixmap, return false if it didn't happen.
+ *
+ * 'crtc' is to be used for any necessary synchronization.
+ *
+ * 'sync_flip' requests that the flip be performed at the next
+ * vertical blank interval to avoid tearing artifacts. If false, the
+ * flip should be performed as soon as possible.
+ *
+ * present_event_notify should be called with 'event_id' when the flip
+ * occurs
+ */
+typedef Bool (*present_window_flip_ptr) (RRCrtcPtr crtc,
+                                  uint64_t event_id,
+                                  uint64_t target_msc,
+                                  WindowPtr window,
+                                  PixmapPtr pixmap,
+                                  Bool sync_flip);
+/* #endif */
+
+/* "unflip" back to the regular screen scanout buffer
+ *
+ * present_event_notify should be called with 'event_id' when the unflip occurs.
+ */
+typedef void (*present_unflip_ptr) (ScreenPtr screen,
+                                    uint64_t event_id);
+
+typedef void (*present_get_scanout_flag_ptr) (WindowPtr window,
+                                    uint32_t *flag);
+
+#define PRESENT_SCREEN_INFO_VERSION        0
+
+typedef struct present_screen_info {
+    uint32_t                            version;
+
+    present_get_crtc_ptr                get_crtc;
+    present_get_ust_msc_ptr             get_ust_msc;
+    present_queue_vblank_ptr            queue_vblank;
+    present_abort_vblank_ptr            abort_vblank;
+    present_flush_ptr                   flush;
+    uint32_t                            capabilities;
+    present_check_flip_ptr              check_flip;
+    present_flip_ptr                    flip;
+    present_unflip_ptr                  unflip;
+/* #ifdef _F_PRESENT_HWC_FLIP_ */
+    present_window_flip_ptr             window_flip;
+    present_get_scanout_flag_ptr        get_scanout_flag;
+/* #endif */
+
+} present_screen_info_rec, *present_screen_info_ptr;
+
+/*
+ * Called when 'event_id' occurs. 'ust' and 'msc' indicate when the
+ * event actually happened
+ */
+extern _X_EXPORT void
+present_event_notify(uint64_t event_id, uint64_t ust, uint64_t msc);
+
+/* 'crtc' has been turned off, so any pending events will never occur.
+ */
+extern _X_EXPORT void
+present_event_abandon(RRCrtcPtr crtc);
+
+extern _X_EXPORT Bool
+present_screen_init(ScreenPtr screen, present_screen_info_ptr info);
+
+typedef void (*present_complete_notify_proc)(WindowPtr window,
+                                             CARD8 mode,
+                                             CARD32 serial,
+                                             uint64_t ust,
+                                             uint64_t msc);
+
+extern _X_EXPORT void
+present_register_complete_notify(present_complete_notify_proc proc);
+
+#ifdef _F_PRESENT_SCANOUT_NOTIFY_
+extern _X_EXPORT void
+present_send_scanout_notify(WindowPtr window, CARD16 scanout);
+
+extern _X_EXPORT void
+present_send_tree_scanout_notify(WindowPtr window, CARD16 scanout);
+#endif //_F_PRESENT_SCANOUT_NOTIFY_
+
+#endif /* _PRESENT_H_ */
diff --git a/present/present_event.c b/present/present_event.c
new file mode 100644 (file)
index 0000000..08898f4
--- /dev/null
@@ -0,0 +1,336 @@
+/*
+ * Copyright Â© 2013 Keith Packard
+ *
+ * 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 the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  The copyright holders make no representations
+ * about the suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS 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_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "present_priv.h"
+
+RESTYPE present_event_type;
+
+#ifdef _F_PRESENT_SCANOUT_NOTIFY_
+#include "compint.h"
+
+static WindowPtr
+_FindTopLevelWindowPtr (ScreenPtr screen, WindowPtr pWin)
+{
+    WindowPtr pRoot = screen->root;
+    while (pWin->parent && pWin->parent->drawable.id != pRoot->drawable.id)
+        pWin = pWin->parent;
+
+    return pWin;
+}
+#endif //_F_PRESENT_SCANOUT_NOTIFY_
+
+static int
+present_free_event(void *data, XID id)
+{
+    present_event_ptr present_event = (present_event_ptr) data;
+    present_window_priv_ptr window_priv = present_window_priv(present_event->window);
+    present_event_ptr *previous, current;
+
+    for (previous = &window_priv->events; (current = *previous); previous = &current->next) {
+        if (current == present_event) {
+            *previous = present_event->next;
+            break;
+        }
+    }
+    free((void *) present_event);
+    return 1;
+
+}
+
+void
+present_free_events(WindowPtr window)
+{
+    present_window_priv_ptr window_priv = present_window_priv(window);
+    present_event_ptr event;
+
+    if (!window_priv)
+        return;
+
+    while ((event = window_priv->events))
+        FreeResource(event->id, RT_NONE);
+}
+
+static void
+present_event_swap(xGenericEvent *from, xGenericEvent *to)
+{
+    *to = *from;
+    swaps(&to->sequenceNumber);
+    swapl(&to->length);
+    swaps(&to->evtype);
+    switch (from->evtype) {
+    case PresentConfigureNotify: {
+        xPresentConfigureNotify *c = (xPresentConfigureNotify *) to;
+
+        swapl(&c->eid);
+        swapl(&c->window);
+        swaps(&c->x);
+        swaps(&c->y);
+        swaps(&c->width);
+        swaps(&c->height);
+        swaps(&c->off_x);
+        swaps(&c->off_y);
+        swaps(&c->pixmap_width);
+        swaps(&c->pixmap_height);
+        swapl(&c->pixmap_flags);
+        break;
+    }
+    case PresentCompleteNotify:
+    {
+        xPresentCompleteNotify *c = (xPresentCompleteNotify *) to;
+        swapl(&c->eid);
+        swapl(&c->window);
+        swapl(&c->serial);
+        swapll(&c->ust);
+        swapll(&c->msc);
+        break;
+    }
+    case PresentIdleNotify:
+    {
+        xPresentIdleNotify *c = (xPresentIdleNotify *) to;
+        swapl(&c->eid);
+        swapl(&c->window);
+        swapl(&c->serial);
+        swapl(&c->idle_fence);
+        break;
+    }
+#ifdef _F_PRESENT_SCANOUT_NOTIFY_
+    case PresentScanoutNotify:
+    {
+        xPresentScanoutNotify *c = (xPresentScanoutNotify *) to;
+        swapl(&c->eid);
+        swapl(&c->window);
+        swaps(&c->scanout);
+        break;
+    }
+#endif //_F_PRESENT_SCANOUT_NOTIFY_
+    }
+}
+
+void
+present_send_config_notify(WindowPtr window, int x, int y, int w, int h, int bw, WindowPtr sibling)
+{
+    present_window_priv_ptr window_priv = present_window_priv(window);
+
+    if (window_priv) {
+        xPresentConfigureNotify cn = {
+            .type = GenericEvent,
+            .extension = present_request,
+            .length = (sizeof(xPresentConfigureNotify) - 32) >> 2,
+            .evtype = PresentConfigureNotify,
+            .eid = 0,
+            .window = window->drawable.id,
+            .x = x,
+            .y = y,
+            .width = w,
+            .height = h,
+            .off_x = 0,
+            .off_y = 0,
+            .pixmap_width = w,
+            .pixmap_height = h,
+            .pixmap_flags = 0
+        };
+        present_event_ptr event;
+
+        for (event = window_priv->events; event; event = event->next) {
+            if (event->mask & (1 << PresentConfigureNotify)) {
+                cn.eid = event->id;
+                WriteEventsToClient(event->client, 1, (xEvent *) &cn);
+            }
+        }
+    }
+}
+
+static present_complete_notify_proc complete_notify;
+
+void
+present_register_complete_notify(present_complete_notify_proc proc)
+{
+    complete_notify = proc;
+}
+
+void
+present_send_complete_notify(WindowPtr window, CARD8 kind, CARD8 mode, CARD32 serial, uint64_t ust, uint64_t msc)
+{
+    present_window_priv_ptr window_priv = present_window_priv(window);
+
+    if (window_priv) {
+        xPresentCompleteNotify cn = {
+            .type = GenericEvent,
+            .extension = present_request,
+            .length = (sizeof(xPresentCompleteNotify) - 32) >> 2,
+            .evtype = PresentCompleteNotify,
+            .kind = kind,
+            .mode = mode,
+            .eid = 0,
+            .window = window->drawable.id,
+            .serial = serial,
+            .ust = ust,
+            .msc = msc,
+        };
+        present_event_ptr event;
+
+        for (event = window_priv->events; event; event = event->next) {
+            if (event->mask & PresentCompleteNotifyMask) {
+                cn.eid = event->id;
+                WriteEventsToClient(event->client, 1, (xEvent *) &cn);
+            }
+        }
+    }
+    if (complete_notify)
+        (*complete_notify)(window, mode, serial, ust, msc);
+}
+
+void
+present_send_idle_notify(WindowPtr window, CARD32 serial, PixmapPtr pixmap, struct present_fence *idle_fence)
+{
+    present_window_priv_ptr window_priv = present_window_priv(window);
+
+    if (window_priv) {
+        xPresentIdleNotify in = {
+            .type = GenericEvent,
+            .extension = present_request,
+            .length = (sizeof(xPresentIdleNotify) - 32) >> 2,
+            .evtype = PresentIdleNotify,
+            .eid = 0,
+            .window = window->drawable.id,
+            .serial = serial,
+            .pixmap = pixmap->drawable.id,
+            .idle_fence = present_fence_id(idle_fence)
+        };
+        present_event_ptr event;
+
+        for (event = window_priv->events; event; event = event->next) {
+            if (event->mask & PresentIdleNotifyMask) {
+                in.eid = event->id;
+                WriteEventsToClient(event->client, 1, (xEvent *) &in);
+            }
+        }
+    }
+}
+
+#ifdef _F_PRESENT_SCANOUT_NOTIFY_
+void
+present_send_scanout_notify(WindowPtr window, CARD16 scanout)
+{
+    present_window_priv_ptr window_priv = present_window_priv(window);
+
+    if (window_priv) {
+        present_screen_priv_ptr screen_priv = present_screen_priv(window->drawable.pScreen);
+        uint32_t flag = 0;
+
+        if (screen_priv->info->get_scanout_flag)
+            (*screen_priv->info->get_scanout_flag) (window, &flag);
+
+        xPresentScanoutNotify in = {
+            .type = GenericEvent,
+            .extension = present_request,
+            .length = (sizeof(xPresentScanoutNotify) - 32) >> 2,
+            .evtype = PresentScanoutNotify,
+            .eid = 0,
+            .window = window->drawable.id,
+            .scanout = scanout,
+            .flag = flag
+        };
+        present_event_ptr event;
+
+        for (event = window_priv->events; event; event = event->next) {
+            if (event->mask & PresentScanoutNotifyMask) {
+                in.eid = event->id;
+                WriteEventsToClient(event->client, 1, (xEvent *) &in);
+            }
+        }
+    }
+}
+
+static int
+present_send_scanout_notify_visit(WindowPtr window, void *data)
+{
+    CARD16 scanout = *(CARD16 *)data;
+
+    present_send_scanout_notify (window, scanout);
+    return WT_WALKCHILDREN;
+}
+
+void
+present_send_tree_scanout_notify (WindowPtr window, CARD16 scanout)
+{
+    TraverseTree(window, present_send_scanout_notify_visit, (void *)&scanout);
+}
+#endif //_F_PRESENT_SCANOUT_NOTIFY_
+
+int
+present_select_input(ClientPtr client, XID eid, WindowPtr window, CARD32 mask)
+{
+    present_window_priv_ptr window_priv = present_get_window_priv(window, mask != 0);
+    present_event_ptr event;
+
+    if (!window_priv) {
+        if (mask)
+            return BadAlloc;
+        return Success;
+    }
+
+    event = calloc (1, sizeof (present_event_rec));
+    if (!event)
+        return BadAlloc;
+
+    event->client = client;
+    event->window = window;
+    event->id = eid;
+    event->mask = mask;
+
+    event->next = window_priv->events;
+    window_priv->events = event;
+
+    if (!AddResource(event->id, present_event_type, (void *) event))
+        return BadAlloc;
+
+#ifdef _F_PRESENT_SCANOUT_NOTIFY_
+    if (mask & PresentScanoutNotify) {
+        CompScreenPtr pCompScreen = GetCompScreen (window->drawable.pScreen);
+        WindowPtr toplevel_window = _FindTopLevelWindowPtr (window->drawable.pScreen, window);
+        CARD16 scanout = 0;
+
+        if (toplevel_window->drawable.id == pCompScreen->overlayWid)
+            scanout = 1;
+
+        present_send_scanout_notify (window, scanout);
+    }
+#endif //_F_PRESENT_SCANOUT_NOTIFY_
+
+    return Success;
+}
+
+Bool
+present_event_init(void)
+{
+    present_event_type = CreateNewResourceType(present_free_event, "PresentEvent");
+    if (!present_event_type)
+        return FALSE;
+
+    GERegisterExtension(present_request, present_event_swap);
+    return TRUE;
+}
diff --git a/present/present_fake.c b/present/present_fake.c
new file mode 100644 (file)
index 0000000..ac7bd83
--- /dev/null
@@ -0,0 +1,169 @@
+/*
+ * Copyright Â© 2013 Keith Packard
+ *
+ * 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 the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  The copyright holders make no representations
+ * about the suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS 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_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "present_priv.h"
+#include "list.h"
+
+static struct xorg_list fake_vblank_queue;
+
+typedef struct present_fake_vblank {
+    struct xorg_list            list;
+    uint64_t                    event_id;
+    OsTimerPtr                  timer;
+    ScreenPtr                   screen;
+} present_fake_vblank_rec, *present_fake_vblank_ptr;
+
+int
+present_fake_get_ust_msc(ScreenPtr screen, uint64_t *ust, uint64_t *msc)
+{
+    present_screen_priv_ptr screen_priv = present_screen_priv(screen);
+
+    *ust = GetTimeInMicros();
+    *msc = (*ust + screen_priv->fake_interval / 2) / screen_priv->fake_interval;
+    return Success;
+}
+
+static void
+present_fake_notify(ScreenPtr screen, uint64_t event_id)
+{
+    uint64_t                    ust, msc;
+
+    present_fake_get_ust_msc(screen, &ust, &msc);
+    present_event_notify(event_id, ust, msc);
+}
+
+static CARD32
+present_fake_do_timer(OsTimerPtr timer,
+                      CARD32 time,
+                      void *arg)
+{
+    present_fake_vblank_ptr     fake_vblank = arg;
+
+    DebugPixmap("     e fake eid,%lld fake_vblank,%p time,%8lld\n",
+                  fake_vblank->event_id, fake_vblank, time);
+
+    ErrorF("     e fake eid,%lld fake_vblank,%p time,%8lld\n",
+                  fake_vblank->event_id, fake_vblank, time);
+
+    present_fake_notify(fake_vblank->screen, fake_vblank->event_id);
+    xorg_list_del(&fake_vblank->list);
+    free(fake_vblank);
+    return 0;
+}
+
+void
+present_fake_abort_vblank(ScreenPtr screen, uint64_t event_id, uint64_t msc)
+{
+    present_fake_vblank_ptr     fake_vblank, tmp;
+
+    DebugPixmap("  a fake eid,%lld\n",
+                  event_id);
+
+    xorg_list_for_each_entry_safe(fake_vblank, tmp, &fake_vblank_queue, list) {
+        if (fake_vblank->event_id == event_id) {
+            DebugPixmap("  c cancle fake eid,%lld fake_vblank,%p\n",
+                          fake_vblank->event_id, fake_vblank);
+            TimerCancel(fake_vblank->timer);
+            xorg_list_del(&fake_vblank->list);
+            free (fake_vblank);
+            break;
+        }
+    }
+}
+
+int
+present_fake_queue_vblank(ScreenPtr     screen,
+                          uint64_t      event_id,
+                          uint64_t      msc)
+{
+    present_screen_priv_ptr     screen_priv = present_screen_priv(screen);
+    uint64_t                    ust = msc * screen_priv->fake_interval;
+    uint64_t                    now = GetTimeInMicros();
+    INT32                       delay = ((int64_t) (ust - now)) / 1000;
+    present_fake_vblank_ptr     fake_vblank;
+
+#ifdef _F_PRESENT_NOT_USE_FAKE_VBLANK_
+    /* [cyeon.lee]
+        TODO
+        some times delay is too long, it is temp code
+    */
+    if (1) {
+#else
+    if (delay <= 0) {
+#endif
+        DebugPixmap("  qd fake eid,%lld msc,%8lld now,%8lld delay,%d\n",
+                      event_id, msc, now, delay);
+
+        present_fake_notify(screen, event_id);
+        return Success;
+    }
+
+    fake_vblank = calloc (1, sizeof (present_fake_vblank_rec));
+    if (!fake_vblank)
+        return BadAlloc;
+
+    fake_vblank->screen = screen;
+    fake_vblank->event_id = event_id;
+    fake_vblank->timer = TimerSet(NULL, 0, delay, present_fake_do_timer, fake_vblank);
+
+    if (!fake_vblank->timer) {
+        free(fake_vblank);
+        return BadAlloc;
+    }
+
+    DebugPixmap(" q fake eid,%lld fake_vblank,%p msc,%8lld now,%8lld delay,%d\n",
+                  fake_vblank->event_id, fake_vblank, msc, now, delay);
+
+    ErrorF(" q fake eid,%lld fake_vblank,%p msc,%8lld now,%8lld delay,%d\n",
+                  fake_vblank->event_id, fake_vblank, msc, now, delay);
+
+    xorg_list_add(&fake_vblank->list, &fake_vblank_queue);
+
+    return Success;
+}
+
+void
+present_fake_screen_init(ScreenPtr screen)
+{
+    present_screen_priv_ptr screen_priv = present_screen_priv(screen);
+
+    /* For screens with hardware vblank support, the fake code
+     * will be used for off-screen windows and while screens are blanked,
+     * in which case we want a slow interval here
+     *
+     * Otherwise, pretend that the screen runs at 60Hz
+     */
+    if (screen_priv->info && screen_priv->info->get_crtc)
+        screen_priv->fake_interval = 1000000;
+    else
+        screen_priv->fake_interval = 16667;
+}
+
+void
+present_fake_queue_init(void)
+{
+    xorg_list_init(&fake_vblank_queue);
+}
diff --git a/present/present_fence.c b/present/present_fence.c
new file mode 100644 (file)
index 0000000..e09657d
--- /dev/null
@@ -0,0 +1,139 @@
+/*
+ * Copyright Â© 2013 Keith Packard
+ *
+ * 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 the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  The copyright holders make no representations
+ * about the suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS 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_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "present_priv.h"
+#include <gcstruct.h>
+#include <misync.h>
+#include <misyncstr.h>
+
+/*
+ * Wraps SyncFence objects so we can add a SyncTrigger to find out
+ * when the SyncFence gets destroyed and clean up appropriately
+ */
+
+struct present_fence {
+    SyncTrigger         trigger;
+    SyncFence           *fence;
+    void                (*callback)(void *param);
+    void                *param;
+};
+
+/*
+ * SyncTrigger callbacks
+ */
+static Bool
+present_fence_sync_check_trigger(SyncTrigger *trigger, XSyncValue oldval)
+{
+    struct present_fence        *present_fence = container_of(trigger, struct present_fence, trigger);
+
+    return present_fence->callback != NULL;
+}
+
+static void
+present_fence_sync_trigger_fired(SyncTrigger *trigger)
+{
+    struct present_fence        *present_fence = container_of(trigger, struct present_fence, trigger);
+
+    if (present_fence->callback)
+        (*present_fence->callback)(present_fence->param);
+}
+
+static void
+present_fence_sync_counter_destroyed(SyncTrigger *trigger)
+{
+    struct present_fence        *present_fence = container_of(trigger, struct present_fence, trigger);
+
+    present_fence->fence = NULL;
+}
+
+struct present_fence *
+present_fence_create(SyncFence *fence)
+{
+    struct present_fence        *present_fence;
+
+    present_fence = calloc (1, sizeof (struct present_fence));
+    if (!present_fence)
+        return NULL;
+
+    present_fence->fence = fence;
+    present_fence->trigger.pSync = (SyncObject *) fence;
+    present_fence->trigger.CheckTrigger = present_fence_sync_check_trigger;
+    present_fence->trigger.TriggerFired = present_fence_sync_trigger_fired;
+    present_fence->trigger.CounterDestroyed = present_fence_sync_counter_destroyed;
+
+    if (SyncAddTriggerToSyncObject(&present_fence->trigger) != Success) {
+        free (present_fence);
+        return NULL;
+    }
+    return present_fence;
+}
+
+void
+present_fence_destroy(struct present_fence *present_fence)
+{
+    if (present_fence) {
+        if (present_fence->fence)
+            SyncDeleteTriggerFromSyncObject(&present_fence->trigger);
+        free(present_fence);
+    }
+}
+
+void
+present_fence_set_triggered(struct present_fence *present_fence)
+{
+    if (present_fence)
+        if (present_fence->fence)
+            (*present_fence->fence->funcs.SetTriggered) (present_fence->fence);
+}
+
+Bool
+present_fence_check_triggered(struct present_fence *present_fence)
+{
+    if (!present_fence)
+        return TRUE;
+    if (!present_fence->fence)
+        return TRUE;
+    return (*present_fence->fence->funcs.CheckTriggered)(present_fence->fence);
+}
+
+void
+present_fence_set_callback(struct present_fence *present_fence,
+                           void (*callback) (void *param),
+                           void *param)
+{
+    present_fence->callback = callback;
+    present_fence->param = param;
+}
+
+XID
+present_fence_id(struct present_fence *present_fence)
+{
+    if (!present_fence)
+        return None;
+    if (!present_fence->fence)
+        return None;
+    return present_fence->fence->sync.id;
+}
diff --git a/present/present_notify.c b/present/present_notify.c
new file mode 100644 (file)
index 0000000..e272e08
--- /dev/null
@@ -0,0 +1,114 @@
+/*
+ * Copyright Â© 2013 Keith Packard
+ *
+ * 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 the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  The copyright holders make no representations
+ * about the suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS 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_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "present_priv.h"
+
+/*
+ * Mark all pending notifies for 'window' as invalid when
+ * the window is destroyed
+ */
+
+void
+present_clear_window_notifies(WindowPtr window)
+{
+    present_notify_ptr          notify;
+    present_window_priv_ptr     window_priv = present_window_priv(window);
+
+    if (!window_priv)
+        return;
+
+    xorg_list_for_each_entry(notify, &window_priv->notifies, window_list) {
+        notify->window = NULL;
+    }
+}
+
+/*
+ * 'notify' is being freed; remove it from the window's notify list
+ */
+
+void
+present_free_window_notify(present_notify_ptr notify)
+{
+    xorg_list_del(&notify->window_list);
+}
+
+/*
+ * 'notify' is new; add it to the specified window
+ */
+
+int
+present_add_window_notify(present_notify_ptr notify)
+{
+    WindowPtr                   window = notify->window;
+    present_window_priv_ptr     window_priv = present_get_window_priv(window, TRUE);
+
+    if (!window_priv)
+        return BadAlloc;
+
+    xorg_list_add(&notify->window_list, &window_priv->notifies);
+    return Success;
+}
+
+int
+present_create_notifies(ClientPtr client, int num_notifies, xPresentNotify *x_notifies, present_notify_ptr *p_notifies)
+{
+    present_notify_ptr  notifies;
+    int                 i;
+    int                 added = 0;
+    int                 status;
+
+    notifies = calloc (num_notifies, sizeof (present_notify_rec));
+    if (!notifies)
+        return BadAlloc;
+
+    for (i = 0; i < num_notifies; i++) {
+        status = dixLookupWindow(&notifies[i].window, x_notifies[i].window, client, DixGetAttrAccess);
+        if (status != Success)
+            goto bail;
+
+        notifies[i].serial = x_notifies[i].serial;
+        status = present_add_window_notify(&notifies[i]);
+        if (status != Success)
+            goto bail;
+
+        added = i;
+    }
+    return Success;
+
+bail:
+    present_destroy_notifies(notifies, added);
+    return status;
+}
+
+void
+present_destroy_notifies(present_notify_ptr notifies, int num_notifies)
+{
+    int i;
+    for (i = 0; i < num_notifies; i++)
+        present_free_window_notify(&notifies[i]);
+
+    free(notifies);
+}
diff --git a/present/present_priv.h b/present/present_priv.h
new file mode 100644 (file)
index 0000000..b9a1514
--- /dev/null
@@ -0,0 +1,360 @@
+/*
+ * Copyright Â© 2013 Keith Packard
+ *
+ * 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 the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  The copyright holders make no representations
+ * about the suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS 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.
+ */
+
+#ifndef _PRESENT_PRIV_H_
+#define _PRESENT_PRIV_H_
+
+#include <X11/X.h>
+#include "scrnintstr.h"
+#include "misc.h"
+#include "list.h"
+#include "windowstr.h"
+#include "dixstruct.h"
+#include "present.h"
+#include <syncsdk.h>
+#include <syncsrv.h>
+#include <xfixes.h>
+#include <randrstr.h>
+
+extern int present_request;
+
+extern DevPrivateKeyRec present_screen_private_key;
+
+#if defined (_F_PRESENT_PIXMAP_SWAP_) || defined (_F_PRESENT_HWC_FLIP_)
+extern struct xorg_list present_name_pixmap_list;
+#endif //_F_PRESENT_PIXMAP_SWAP_
+
+typedef struct present_fence *present_fence_ptr;
+
+typedef struct present_notify present_notify_rec, *present_notify_ptr;
+
+struct present_notify {
+    struct xorg_list    window_list;
+    WindowPtr           window;
+    CARD32              serial;
+};
+
+struct present_vblank {
+    struct xorg_list    window_list;
+    struct xorg_list    event_queue;
+    ScreenPtr           screen;
+    WindowPtr           window;
+    PixmapPtr           pixmap;
+    RegionPtr           valid;
+    RegionPtr           update;
+    RRCrtcPtr           crtc;
+    uint32_t            serial;
+    int16_t             x_off;
+    int16_t             y_off;
+    CARD16              kind;
+    uint64_t            event_id;
+    uint64_t            target_msc;
+    uint64_t            msc_offset;
+    present_fence_ptr   idle_fence;
+    present_fence_ptr   wait_fence;
+    present_notify_ptr  notifies;
+    int                 num_notifies;
+    Bool                queued;         /* on present_exec_queue */
+    Bool                flip;           /* planning on using flip */
+    Bool                flip_ready;     /* wants to flip, but waiting for previous flip or unflip */
+    Bool                sync_flip;      /* do flip synchronous to vblank */
+    Bool                abort_flip;     /* aborting this flip */
+#ifdef _F_PRESENT_VBLANK_PENDING_
+Bool                vblank_ready;
+#endif //_F_PRESENT_VBLANK_PENDING_
+#ifdef _F_PRESENT_HWC_FLIP_
+    Bool                window_flip;    /* planning on using flip for a redirect window*/
+#endif
+};
+
+typedef struct present_screen_priv {
+    CloseScreenProcPtr          CloseScreen;
+    ConfigNotifyProcPtr         ConfigNotify;
+    DestroyWindowProcPtr        DestroyWindow;
+    ClipNotifyProcPtr           ClipNotify;
+#if defined (_F_PRESENT_PIXMAP_SWAP_) || defined (_F_PRESENT_HWC_FLIP_)
+    NameWindowPixmapProcPtr     NameWindowPixmap;
+    CompRedirectWindowProcPtr   ProcCompRedirectWindow;
+    CompUnredirectWindowProcPtr ProcCompUnredirectWindow;
+    DestroyPixmapProcPtr        DestroyPixmap;
+#endif //_F_PRESENT_PIXMAP_SWAP_
+
+    present_vblank_ptr          flip_pending;
+    uint64_t                    unflip_event_id;
+
+    uint32_t                    fake_interval;
+
+    /* Currently active flipped pixmap and fence */
+    RRCrtcPtr                   flip_crtc;
+    WindowPtr                   flip_window;
+    uint32_t                    flip_serial;
+    PixmapPtr                   flip_pixmap;
+    present_fence_ptr           flip_idle_fence;
+
+    present_screen_info_ptr     info;
+} present_screen_priv_rec, *present_screen_priv_ptr;
+
+#define wrap(priv,real,mem,func) {\
+    priv->mem = real->mem; \
+    real->mem = func; \
+}
+
+#define unwrap(priv,real,mem) {\
+    real->mem = priv->mem; \
+}
+
+static inline present_screen_priv_ptr
+present_screen_priv(ScreenPtr screen)
+{
+    return (present_screen_priv_ptr)dixLookupPrivate(&(screen)->devPrivates, &present_screen_private_key);
+}
+
+/*
+ * Each window has a list of clients and event masks
+ */
+typedef struct present_event *present_event_ptr;
+
+typedef struct present_event {
+    present_event_ptr next;
+    ClientPtr client;
+    WindowPtr window;
+    XID id;
+    int mask;
+} present_event_rec;
+
+typedef struct present_window_priv {
+    present_event_ptr      events;
+    RRCrtcPtr              crtc;        /* Last reported CRTC from get_ust_msc */
+    uint64_t               msc_offset;
+    uint64_t               msc;         /* Last reported MSC from the current crtc */
+#ifdef _F_PRESENT_PIXMAP_SWAP_
+    present_vblank_ptr     swap_vblank;
+    WindowPtr              swap_window;
+#endif //_F_PRESENT_PIXMAP_SWAP_
+#ifdef _F_PRESENT_VBLANK_PENDING_
+    present_vblank_ptr     vblank_pending;
+#endif //_F_PRESENT_VBLANK_PENDING_
+    struct xorg_list       vblank;
+    struct xorg_list       notifies;
+
+#ifdef _F_PRESENT_HWC_FLIP_
+    //HWC extension allows flip several windows ar the same time.
+    present_vblank_ptr          flip_pending;
+    uint64_t                    unflip_event_id;
+    uint32_t                    fake_interval;
+#endif
+    /* Currently active flipped pixmap and fence */
+    RRCrtcPtr                   flip_crtc;
+    uint32_t                    flip_serial;
+    PixmapPtr                   flip_pixmap;
+    present_fence_ptr           flip_idle_fence;
+} present_window_priv_rec, *present_window_priv_ptr;
+
+extern DevPrivateKeyRec present_window_private_key;
+
+static inline present_window_priv_ptr
+present_window_priv(WindowPtr window)
+{
+    return (present_window_priv_ptr)dixGetPrivate(&(window)->devPrivates, &present_window_private_key);
+}
+
+present_window_priv_ptr
+present_get_window_priv(WindowPtr window, Bool create);
+
+extern RESTYPE present_event_type;
+
+#if defined (_F_PRESENT_PIXMAP_SWAP_) || defined (_F_PRESENT_HWC_FLIP_)
+
+typedef struct present_name_pixmap *present_name_pixmap_ptr;
+
+typedef struct present_name_pixmap {
+    struct xorg_list    name_pixmap_list;
+    XID                 id;
+    PixmapPtr           pixmap;
+    WindowPtr           window;
+} present_name_pixmap_rec;
+
+#endif //_F_PRESENT_PIXMAP_SWAP_
+
+/*
+ * present.c
+ */
+int
+present_pixmap(WindowPtr window,
+               PixmapPtr pixmap,
+               CARD32 serial,
+               RegionPtr valid,
+               RegionPtr update,
+               int16_t x_off,
+               int16_t y_off,
+               RRCrtcPtr target_crtc,
+               SyncFence *wait_fence,
+               SyncFence *idle_fence,
+               uint32_t options,
+               uint64_t target_msc,
+               uint64_t divisor,
+               uint64_t remainder,
+               present_notify_ptr notifies,
+               int num_notifies);
+
+int
+present_notify_msc(WindowPtr window,
+                   CARD32 serial,
+                   uint64_t target_msc,
+                   uint64_t divisor,
+                   uint64_t remainder);
+
+void
+present_abort_vblank(ScreenPtr screen, RRCrtcPtr crtc, uint64_t event_id, uint64_t msc);
+
+void
+present_vblank_destroy(present_vblank_ptr vblank);
+
+void
+present_flip_destroy(ScreenPtr screen);
+
+void
+present_check_flip_window(WindowPtr window);
+
+RRCrtcPtr
+present_get_crtc(WindowPtr window);
+
+uint32_t
+present_query_capabilities(RRCrtcPtr crtc);
+
+Bool
+present_init(void);
+
+/*
+ * present_event.c
+ */
+
+void
+present_free_events(WindowPtr window);
+
+void
+present_send_config_notify(WindowPtr window, int x, int y, int w, int h, int bw, WindowPtr sibling);
+
+void
+present_send_complete_notify(WindowPtr window, CARD8 kind, CARD8 mode, CARD32 serial, uint64_t ust, uint64_t msc);
+
+void
+present_send_idle_notify(WindowPtr window, CARD32 serial, PixmapPtr pixmap, present_fence_ptr idle_fence);
+
+int
+present_select_input(ClientPtr client,
+                     CARD32 eid,
+                     WindowPtr window,
+                     CARD32 event_mask);
+
+Bool
+present_event_init(void);
+
+/*
+ * present_fake.c
+ */
+int
+present_fake_get_ust_msc(ScreenPtr screen, uint64_t *ust, uint64_t *msc);
+
+int
+present_fake_queue_vblank(ScreenPtr screen, uint64_t event_id, uint64_t msc);
+
+void
+present_fake_abort_vblank(ScreenPtr screen, uint64_t event_id, uint64_t msc);
+
+void
+present_fake_screen_init(ScreenPtr screen);
+
+void
+present_fake_queue_init(void);
+
+/*
+ * present_fence.c
+ */
+struct present_fence *
+present_fence_create(SyncFence *sync_fence);
+
+void
+present_fence_destroy(struct present_fence *present_fence);
+
+void
+present_fence_set_triggered(struct present_fence *present_fence);
+
+Bool
+present_fence_check_triggered(struct present_fence *present_fence);
+
+void
+present_fence_set_callback(struct present_fence *present_fence,
+                           void (*callback)(void *param),
+                           void *param);
+
+XID
+present_fence_id(struct present_fence *present_fence);
+
+/*
+ * present_notify.c
+ */
+void
+present_clear_window_notifies(WindowPtr window);
+
+void
+present_free_window_notify(present_notify_ptr notify);
+
+int
+present_add_window_notify(present_notify_ptr notify);
+
+int
+present_create_notifies(ClientPtr client, int num_notifies, xPresentNotify *x_notifies, present_notify_ptr *p_notifies);
+
+void
+present_destroy_notifies(present_notify_ptr notifies, int num_notifies);
+
+/*
+ * present_redirect.c
+ */
+
+WindowPtr
+present_redirect(ClientPtr client, WindowPtr target);
+
+/*
+ * present_request.c
+ */
+int
+proc_present_dispatch(ClientPtr client);
+
+int
+sproc_present_dispatch(ClientPtr client);
+
+/*
+ * present_screen.c
+ */
+#if defined (_F_PRESENT_PIXMAP_SWAP_) || defined (_F_PRESENT_HWC_FLIP_)
+void
+present_pixmap_idle(PixmapPtr pixmap, WindowPtr window, CARD32 serial, struct present_fence *present_fence);
+#endif //_F_PRESENT_PIXMAP_SWAP_
+
+#ifdef _F_PRESENT_HWC_FLIP_
+void
+present_window_flip_idle(WindowPtr window);
+#endif //_F_PRESENT_HWC_FLIP_
+
+#endif /*  _PRESENT_PRIV_H_ */
diff --git a/present/present_request.c b/present/present_request.c
new file mode 100644 (file)
index 0000000..835890d
--- /dev/null
@@ -0,0 +1,331 @@
+/*
+ * Copyright Â© 2013 Keith Packard
+ *
+ * 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 the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  The copyright holders make no representations
+ * about the suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS 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_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "present_priv.h"
+#include "randrstr.h"
+#include <protocol-versions.h>
+
+static int
+proc_present_query_version(ClientPtr client)
+{
+    REQUEST(xPresentQueryVersionReq);
+    xPresentQueryVersionReply rep = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+        .majorVersion = SERVER_PRESENT_MAJOR_VERSION,
+        .minorVersion = SERVER_PRESENT_MINOR_VERSION
+    };
+
+    REQUEST_SIZE_MATCH(xPresentQueryVersionReq);
+    (void) stuff;
+    if (client->swapped) {
+        swaps(&rep.sequenceNumber);
+        swapl(&rep.length);
+        swapl(&rep.majorVersion);
+        swapl(&rep.minorVersion);
+    }
+    WriteToClient(client, sizeof(rep), &rep);
+    return Success;
+}
+
+#define VERIFY_FENCE_OR_NONE(fence_ptr, fence_id, client, access) do {  \
+        if ((fence_id) == None)                                         \
+            (fence_ptr) = NULL;                                         \
+        else {                                                          \
+            int __rc__ = SyncVerifyFence(&fence_ptr, fence_id, client, access); \
+            if (__rc__ != Success)                                      \
+                return __rc__;                                          \
+        }                                                               \
+    } while (0)
+
+#define VERIFY_CRTC_OR_NONE(crtc_ptr, crtc_id, client, access) do {     \
+        if ((crtc_id) == None)                                          \
+            (crtc_ptr) = NULL;                                          \
+        else {                                                          \
+            VERIFY_RR_CRTC(crtc_id, crtc_ptr, access);                  \
+        }                                                               \
+    } while (0)
+
+static int
+proc_present_pixmap(ClientPtr client)
+{
+    REQUEST(xPresentPixmapReq);
+    WindowPtr           window;
+    PixmapPtr           pixmap;
+    RegionPtr           valid = NULL;
+    RegionPtr           update = NULL;
+    SyncFence           *wait_fence;
+    SyncFence           *idle_fence;
+    RRCrtcPtr           target_crtc;
+    int                 ret;
+    int                 nnotifies;
+    present_notify_ptr  notifies = NULL;
+
+    REQUEST_AT_LEAST_SIZE(xPresentPixmapReq);
+    ret = dixLookupWindow(&window, stuff->window, client, DixWriteAccess);
+    if (ret != Success)
+        return ret;
+    ret = dixLookupResourceByType((void **) &pixmap, stuff->pixmap, RT_PIXMAP, client, DixReadAccess);
+    if (ret != Success)
+        return ret;
+
+    if (window->drawable.depth != pixmap->drawable.depth)
+        return BadMatch;
+
+    VERIFY_REGION_OR_NONE(valid, stuff->valid, client, DixReadAccess);
+    VERIFY_REGION_OR_NONE(update, stuff->update, client, DixReadAccess);
+
+    VERIFY_CRTC_OR_NONE(target_crtc, stuff->target_crtc, client, DixReadAccess);
+
+    VERIFY_FENCE_OR_NONE(wait_fence, stuff->wait_fence, client, DixReadAccess);
+    VERIFY_FENCE_OR_NONE(idle_fence, stuff->idle_fence, client, DixWriteAccess);
+
+    if (stuff->options & ~(PresentAllOptions)) {
+        client->errorValue = stuff->options;
+        return BadValue;
+    }
+
+    /*
+     * Check to see if remainder is sane
+     */
+    if (stuff->divisor == 0) {
+        if (stuff->remainder != 0) {
+            client->errorValue = (CARD32) stuff->remainder;
+            return BadValue;
+        }
+    } else {
+        if (stuff->remainder >= stuff->divisor) {
+            client->errorValue = (CARD32) stuff->remainder;
+            return BadValue;
+        }
+    }
+
+    nnotifies = (client->req_len << 2) - sizeof (xPresentPixmapReq);
+    if (nnotifies % sizeof (xPresentNotify))
+        return BadLength;
+
+    nnotifies /= sizeof (xPresentNotify);
+    if (nnotifies) {
+        ret = present_create_notifies(client, nnotifies, (xPresentNotify *) (stuff + 1), &notifies);
+        if (ret != Success)
+            return ret;
+    }
+
+    ret = present_pixmap(window, pixmap, stuff->serial, valid, update,
+                         stuff->x_off, stuff->y_off, target_crtc,
+                         wait_fence, idle_fence, stuff->options,
+                         stuff->target_msc, stuff->divisor, stuff->remainder, notifies, nnotifies);
+    if (ret != Success)
+        present_destroy_notifies(notifies, nnotifies);
+    return ret;
+}
+
+static int
+proc_present_notify_msc(ClientPtr client)
+{
+    REQUEST(xPresentNotifyMSCReq);
+    WindowPtr   window;
+    int         rc;
+
+    REQUEST_SIZE_MATCH(xPresentNotifyMSCReq);
+    rc = dixLookupWindow(&window, stuff->window, client, DixReadAccess);
+    if (rc != Success)
+        return rc;
+
+    /*
+     * Check to see if remainder is sane
+     */
+    if (stuff->divisor == 0) {
+        if (stuff->remainder != 0) {
+            client->errorValue = (CARD32) stuff->remainder;
+            return BadValue;
+        }
+    } else {
+        if (stuff->remainder >= stuff->divisor) {
+            client->errorValue = (CARD32) stuff->remainder;
+            return BadValue;
+        }
+    }
+
+    return present_notify_msc(window, stuff->serial,
+                              stuff->target_msc, stuff->divisor, stuff->remainder);
+}
+
+static int
+proc_present_select_input (ClientPtr client)
+{
+    REQUEST(xPresentSelectInputReq);
+    WindowPtr window;
+    int rc;
+
+    REQUEST_SIZE_MATCH(xPresentSelectInputReq);
+
+    LEGAL_NEW_RESOURCE(stuff->eid, client);
+
+    rc = dixLookupWindow(&window, stuff->window, client, DixGetAttrAccess);
+    if (rc != Success)
+        return rc;
+
+    if (stuff->eventMask & ~PresentAllEvents) {
+        client->errorValue = stuff->eventMask;
+        return BadValue;
+    }
+    return present_select_input(client, stuff->eid, window, stuff->eventMask);
+}
+
+static int
+proc_present_query_capabilities (ClientPtr client)
+{
+    REQUEST(xPresentQueryCapabilitiesReq);
+    xPresentQueryCapabilitiesReply rep = {
+        .type = X_Reply,
+        .sequenceNumber = client->sequence,
+        .length = 0,
+    };
+    WindowPtr   window;
+    RRCrtcPtr   crtc = NULL;
+    int         r;
+
+    r = dixLookupWindow(&window, stuff->target, client, DixGetAttrAccess);
+    switch (r) {
+    case Success:
+        crtc = present_get_crtc(window);
+        break;
+    case BadWindow:
+        VERIFY_RR_CRTC(stuff->target, crtc, DixGetAttrAccess);
+        break;
+    default:
+        return r;
+    }
+
+    rep.capabilities = present_query_capabilities(crtc);
+
+    if (client->swapped) {
+        swaps(&rep.sequenceNumber);
+        swapl(&rep.length);
+        swapl(&rep.capabilities);
+    }
+    WriteToClient(client, sizeof(rep), &rep);
+    return Success;
+}
+
+int (*proc_present_vector[PresentNumberRequests]) (ClientPtr) = {
+    proc_present_query_version,            /* 0 */
+    proc_present_pixmap,                   /* 1 */
+    proc_present_notify_msc,               /* 2 */
+    proc_present_select_input,             /* 3 */
+    proc_present_query_capabilities,       /* 4 */
+};
+
+int
+proc_present_dispatch(ClientPtr client)
+{
+    REQUEST(xReq);
+    if (stuff->data >= PresentNumberRequests || !proc_present_vector[stuff->data])
+        return BadRequest;
+    return (*proc_present_vector[stuff->data]) (client);
+}
+
+static int
+sproc_present_query_version(ClientPtr client)
+{
+    REQUEST(xPresentQueryVersionReq);
+
+    swaps(&stuff->length);
+    swapl(&stuff->majorVersion);
+    swapl(&stuff->minorVersion);
+    return (*proc_present_vector[stuff->presentReqType]) (client);
+}
+
+static int
+sproc_present_pixmap(ClientPtr client)
+{
+    REQUEST(xPresentPixmapReq);
+
+    swaps(&stuff->length);
+    swapl(&stuff->window);
+    swapl(&stuff->pixmap);
+    swapl(&stuff->valid);
+    swapl(&stuff->update);
+    swaps(&stuff->x_off);
+    swaps(&stuff->y_off);
+    swapll(&stuff->target_msc);
+    swapll(&stuff->divisor);
+    swapll(&stuff->remainder);
+    swapl(&stuff->idle_fence);
+    return (*proc_present_vector[stuff->presentReqType]) (client);
+}
+
+static int
+sproc_present_notify_msc(ClientPtr client)
+{
+    REQUEST(xPresentNotifyMSCReq);
+
+    swaps(&stuff->length);
+    swapl(&stuff->window);
+    swapll(&stuff->target_msc);
+    swapll(&stuff->divisor);
+    swapll(&stuff->remainder);
+    return (*proc_present_vector[stuff->presentReqType]) (client);
+}
+
+static int
+sproc_present_select_input (ClientPtr client)
+{
+    REQUEST(xPresentSelectInputReq);
+
+    swaps(&stuff->length);
+    swapl(&stuff->window);
+    swapl(&stuff->eventMask);
+    return (*proc_present_vector[stuff->presentReqType]) (client);
+}
+
+static int
+sproc_present_query_capabilities (ClientPtr client)
+{
+    REQUEST(xPresentQueryCapabilitiesReq);
+    swaps(&stuff->length);
+    swapl(&stuff->target);
+    return (*proc_present_vector[stuff->presentReqType]) (client);
+}
+
+int (*sproc_present_vector[PresentNumberRequests]) (ClientPtr) = {
+    sproc_present_query_version,           /* 0 */
+    sproc_present_pixmap,                  /* 1 */
+    sproc_present_notify_msc,              /* 2 */
+    sproc_present_select_input,            /* 3 */
+    sproc_present_query_capabilities,      /* 4 */
+};
+
+int
+sproc_present_dispatch(ClientPtr client)
+{
+    REQUEST(xReq);
+    if (stuff->data >= PresentNumberRequests || !sproc_present_vector[stuff->data])
+        return BadRequest;
+    return (*sproc_present_vector[stuff->data]) (client);
+}
diff --git a/present/present_screen.c b/present/present_screen.c
new file mode 100644 (file)
index 0000000..46d88a2
--- /dev/null
@@ -0,0 +1,411 @@
+/*
+ * Copyright Â© 2013 Keith Packard
+ *
+ * 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 the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  The copyright holders make no representations
+ * about the suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS 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_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "present_priv.h"
+
+#ifdef _F_PRESENT_SELECTIVE_COMPOSITE_
+#include <X11/Xatom.h>
+#endif //_F_PRESENT_SELECTIVE_COMPOSITE_
+
+int present_request;
+DevPrivateKeyRec present_screen_private_key;
+DevPrivateKeyRec present_window_private_key;
+
+#if defined (_F_PRESENT_PIXMAP_SWAP_) || defined (_F_PRESENT_HWC_FLIP_)
+struct xorg_list present_name_pixmap_list;
+#endif //_F_PRESENT_PIXMAP_SWAP_
+
+#ifdef _F_PRESENT_SELECTIVE_COMPOSITE_
+static void
+_present_set_selective_composite (WindowPtr window)
+{
+    static Atom atom_use_dri2= 0;
+    static int use = 1;
+
+    if(!atom_use_dri2)
+        atom_use_dri2 = MakeAtom ("X_WIN_USE_DRI2", 14, TRUE);
+
+    dixChangeWindowProperty (serverClient,
+                             window, atom_use_dri2, XA_CARDINAL, 32,
+                             PropModeReplace, 1, &use, TRUE);
+}
+#endif //_F_PRESENT_SELECTIVE_COMPOSITE_
+
+/*
+ * Get a pointer to a present window private, creating if necessary
+ */
+present_window_priv_ptr
+present_get_window_priv(WindowPtr window, Bool create)
+{
+    present_window_priv_ptr window_priv = present_window_priv(window);
+
+    if (!create || window_priv != NULL)
+        return window_priv;
+    window_priv = calloc (1, sizeof (present_window_priv_rec));
+    if (!window_priv)
+        return NULL;
+    xorg_list_init(&window_priv->vblank);
+    xorg_list_init(&window_priv->notifies);
+#ifdef _F_PRESENT_SELECTIVE_COMPOSITE_
+    _present_set_selective_composite (window);
+#endif //_F_PRESENT_SELECTIVE_COMPOSITE_
+    dixSetPrivate(&window->devPrivates, &present_window_private_key, window_priv);
+    return window_priv;
+}
+
+/*
+ * Hook the close screen function to clean up our screen private
+ */
+static Bool
+present_close_screen(ScreenPtr screen)
+{
+    present_screen_priv_ptr screen_priv = present_screen_priv(screen);
+
+    present_flip_destroy(screen);
+
+    unwrap(screen_priv, screen, CloseScreen);
+#if defined (_F_PRESENT_PIXMAP_SWAP_) || defined (_F_PRESENT_HWC_FLIP_)
+    unwrap(screen_priv, screen, NameWindowPixmap);
+    unwrap(screen_priv, screen, ProcCompRedirectWindow);
+    unwrap(screen_priv, screen, ProcCompUnredirectWindow);
+    unwrap(screen_priv, screen, DestroyPixmap);
+#endif //_F_PRESENT_PIXMAP_SWAP_
+    (*screen->CloseScreen) (screen);
+    free(screen_priv);
+    return TRUE;
+}
+
+/*
+ * Free any queued presentations for this window
+ */
+static void
+present_free_window_vblank(WindowPtr window)
+{
+    present_window_priv_ptr     window_priv = present_window_priv(window);
+    present_vblank_ptr          vblank, tmp;
+
+    xorg_list_for_each_entry_safe(vblank, tmp, &window_priv->vblank, window_list) {
+        present_abort_vblank(window->drawable.pScreen, vblank->crtc, vblank->event_id, vblank->target_msc);
+        present_vblank_destroy(vblank);
+    }
+#ifdef _F_PRESENT_PIXMAP_SWAP_
+    if (window_priv->swap_vblank) {
+        present_pixmap_idle(window_priv->swap_vblank->pixmap,
+                            window_priv->swap_vblank->window,
+                            window_priv->swap_vblank->serial,
+                            window_priv->swap_vblank->idle_fence);
+        present_vblank_destroy(window_priv->swap_vblank);
+    }
+#endif //_F_PRESENT_PIXMAP_SWAP_
+}
+
+/*
+ * Clean up any pending or current flips for this window
+ */
+static void
+present_clear_window_flip(WindowPtr window)
+{
+    ScreenPtr                   screen = window->drawable.pScreen;
+    present_screen_priv_ptr     screen_priv = present_screen_priv(screen);
+    present_vblank_ptr          flip_pending = screen_priv->flip_pending;
+
+    if (flip_pending && flip_pending->window == window) {
+#ifndef _F_PRESENT_PIXMAP_SWAP_
+        assert (flip_pending->abort_flip);
+#endif
+        flip_pending->window = NULL;
+    }
+    if (screen_priv->flip_window == window)
+        screen_priv->flip_window = NULL;
+
+#ifdef _F_PRESENT_HWC_FLIP_
+    present_window_flip_idle(window);
+#endif //_F_PRESENT_HWC_FLIP_
+}
+
+/*
+ * Hook the close window function to clean up our window private
+ */
+static Bool
+present_destroy_window(WindowPtr window)
+{
+    Bool ret;
+    ScreenPtr screen = window->drawable.pScreen;
+    present_screen_priv_ptr screen_priv = present_screen_priv(screen);
+    present_window_priv_ptr window_priv = present_window_priv(window);
+
+    if (window_priv) {
+        present_clear_window_notifies(window);
+        present_free_events(window);
+        present_free_window_vblank(window);
+        present_clear_window_flip(window);
+
+        free(window_priv);
+    }
+    unwrap(screen_priv, screen, DestroyWindow);
+    if (screen->DestroyWindow)
+        ret = screen->DestroyWindow (window);
+    else
+        ret = TRUE;
+    wrap(screen_priv, screen, DestroyWindow, present_destroy_window);
+    return ret;
+}
+
+/*
+ * Hook the config notify screen function to deliver present config notify events
+ */
+static int
+present_config_notify(WindowPtr window,
+                   int x, int y, int w, int h, int bw,
+                   WindowPtr sibling)
+{
+    int ret;
+    ScreenPtr screen = window->drawable.pScreen;
+    present_screen_priv_ptr screen_priv = present_screen_priv(screen);
+
+    present_send_config_notify(window, x, y, w, h, bw, sibling);
+
+    unwrap(screen_priv, screen, ConfigNotify);
+    if (screen->ConfigNotify)
+        ret = screen->ConfigNotify (window, x, y, w, h, bw, sibling);
+    else
+        ret = 0;
+    wrap(screen_priv, screen, ConfigNotify, present_config_notify);
+    return ret;
+}
+
+/*
+ * Hook the clip notify screen function to un-flip as necessary
+ */
+
+static void
+present_clip_notify(WindowPtr window, int dx, int dy)
+{
+    ScreenPtr screen = window->drawable.pScreen;
+    present_screen_priv_ptr screen_priv = present_screen_priv(screen);
+
+    present_check_flip_window(window);
+    unwrap(screen_priv, screen, ClipNotify)
+    if (screen->ClipNotify)
+        screen->ClipNotify (window, dx, dy);
+    wrap(screen_priv, screen, ClipNotify, present_clip_notify);
+}
+
+#if defined (_F_PRESENT_PIXMAP_SWAP_) || defined (_F_PRESENT_HWC_FLIP_)
+int
+present_name_window_pixmap (WindowPtr pWin, PixmapPtr pPix, CARD32 namePix)
+{
+    int ret;
+    ScreenPtr                   screen = pWin->drawable.pScreen;
+    present_screen_priv_ptr     screen_priv = present_screen_priv(screen);
+    present_window_priv_ptr     window_priv = present_window_priv(pWin);
+    present_name_pixmap_ptr     name_pixmap;
+
+    name_pixmap = calloc (1, sizeof (present_name_pixmap_rec));
+    if (!name_pixmap)
+        return BadAlloc;
+
+    name_pixmap->id = namePix;
+    name_pixmap->pixmap = pPix;
+    name_pixmap->window = pWin;
+
+    xorg_list_append(&name_pixmap->name_pixmap_list, &present_name_pixmap_list);
+
+    DebugPixmap("  add name pixmap list id:%p pix_id:%p, pixmap:%p (%dx%d) refcnt:%d pWin:%p pWin_id:%p",
+        name_pixmap->id,
+        name_pixmap->pixmap->drawable.id,
+        name_pixmap->pixmap,
+        name_pixmap->pixmap->drawable.width,
+        name_pixmap->pixmap->drawable.height,
+        name_pixmap->pixmap->refcnt,
+        name_pixmap->window,
+        name_pixmap->window->drawable.id);
+
+    unwrap(screen_priv, screen, NameWindowPixmap)
+    if (screen->NameWindowPixmap)
+        ret = screen->NameWindowPixmap (pWin, pPix, namePix);
+    else
+        ret = 0;
+    wrap(screen_priv, screen, NameWindowPixmap, present_name_window_pixmap);
+
+    return ret ;
+}
+
+static int
+present_proc_comp_redirect_window (WindowPtr window, int update)
+{
+    ScreenPtr                   screen = window->drawable.pScreen;
+    present_screen_priv_ptr     screen_priv = present_screen_priv(screen);
+    int ret;
+    CARD16 scanout = 0;
+
+    present_send_tree_scanout_notify (window, scanout);
+
+    unwrap(screen_priv, screen, ProcCompRedirectWindow);
+    if (screen->ProcCompRedirectWindow)
+        ret = screen->ProcCompRedirectWindow (window, update);
+    else
+        ret = 0;
+    wrap(screen_priv, screen, ProcCompRedirectWindow, present_proc_comp_redirect_window);
+
+    return ret;
+}
+
+static int
+present_proc_comp_unredirect_window (WindowPtr window, int update)
+{
+    ScreenPtr                   screen = window->drawable.pScreen;
+    present_screen_priv_ptr     screen_priv = present_screen_priv(screen);
+    int ret;
+    CARD16 scanout = 1;
+
+    present_send_tree_scanout_notify (window, scanout);
+
+    unwrap(screen_priv, screen, ProcCompUnredirectWindow);
+    if (screen->ProcCompUnredirectWindow)
+        ret = screen->ProcCompUnredirectWindow (window, update);
+    else
+        ret = 0;
+    wrap(screen_priv, screen, ProcCompUnredirectWindow, present_proc_comp_unredirect_window);
+
+    return ret;
+}
+
+static int
+present_destroy_pixmap (PixmapPtr pixmap)
+{
+    ScreenPtr                   screen = pixmap->drawable.pScreen;
+    present_screen_priv_ptr     screen_priv = present_screen_priv(screen);
+    int ret;
+    present_name_pixmap_ptr     name_pixmap, temp;
+
+    xorg_list_for_each_entry_safe(name_pixmap, temp,    &present_name_pixmap_list, name_pixmap_list) {
+
+        if (pixmap->destroy_pixmap_id == name_pixmap->id) {
+            DebugPixmap("     remove name pixmap list id:%p pix_id:%p, pixmap:%p (%dx%d) refcnt:%d pWin:%p pWin_id:%p",
+                name_pixmap->id,
+                pixmap->drawable.id,
+                pixmap,
+                pixmap->drawable.width,
+                pixmap->drawable.height,
+                pixmap->refcnt,
+                name_pixmap->window,
+                name_pixmap->window->drawable.id);
+
+            xorg_list_del (&name_pixmap->name_pixmap_list);
+            free (name_pixmap);
+        }
+    }
+
+    unwrap(screen_priv, screen, DestroyPixmap);
+    if (screen->DestroyPixmap)
+        ret = screen->DestroyPixmap (pixmap);
+    else
+        ret = 0;
+    wrap(screen_priv, screen, DestroyPixmap, present_destroy_pixmap);
+
+    return ret;
+}
+#endif //_F_PRESENT_PIXMAP_SWAP_
+
+/*
+ * Initialize a screen for use with present
+ */
+int
+present_screen_init(ScreenPtr screen, present_screen_info_ptr info)
+{
+    if (!dixRegisterPrivateKey(&present_screen_private_key, PRIVATE_SCREEN, 0))
+        return FALSE;
+
+    if (!dixRegisterPrivateKey(&present_window_private_key, PRIVATE_WINDOW, 0))
+        return FALSE;
+
+    if (!present_screen_priv(screen)) {
+        present_screen_priv_ptr screen_priv = calloc(1, sizeof (present_screen_priv_rec));
+        if (!screen_priv)
+            return FALSE;
+
+        wrap(screen_priv, screen, CloseScreen, present_close_screen);
+        wrap(screen_priv, screen, DestroyWindow, present_destroy_window);
+        wrap(screen_priv, screen, ConfigNotify, present_config_notify);
+        wrap(screen_priv, screen, ClipNotify, present_clip_notify);
+
+#if defined (_F_PRESENT_PIXMAP_SWAP_) || defined (_F_PRESENT_HWC_FLIP_)
+        wrap(screen_priv, screen, NameWindowPixmap, present_name_window_pixmap);
+        wrap(screen_priv, screen, ProcCompRedirectWindow, present_proc_comp_redirect_window);
+        wrap(screen_priv, screen, ProcCompUnredirectWindow, present_proc_comp_unredirect_window);
+        wrap(screen_priv, screen, DestroyPixmap, present_destroy_pixmap);
+
+        xorg_list_init(&present_name_pixmap_list);
+#endif //_F_PRESENT_PIXMAP_SWAP_
+
+        screen_priv->info = info;
+
+        dixSetPrivate(&screen->devPrivates, &present_screen_private_key, screen_priv);
+
+        present_fake_screen_init(screen);
+    }
+
+    return TRUE;
+}
+
+/*
+ * Initialize the present extension
+ */
+void
+present_extension_init(void)
+{
+    ExtensionEntry *extension;
+    int i;
+
+#ifdef PANORAMIX
+    if (!noPanoramiXExtension)
+        return;
+#endif
+
+    extension = AddExtension(PRESENT_NAME, PresentNumberEvents, PresentNumberErrors,
+                             proc_present_dispatch, sproc_present_dispatch,
+                             NULL, StandardMinorOpcode);
+    if (!extension)
+        goto bail;
+
+    present_request = extension->base;
+
+    if (!present_init())
+        goto bail;
+
+    if (!present_event_init())
+        goto bail;
+
+    for (i = 0; i < screenInfo.numScreens; i++) {
+        if (!present_screen_init(screenInfo.screens[i], NULL))
+            goto bail;
+    }
+    return;
+
+bail:
+    FatalError("Cannot initialize Present extension");
+}
diff --git a/present/presentext.h b/present/presentext.h
new file mode 100644 (file)
index 0000000..f177f55
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * Copyright Â© 2013 Keith Packard
+ *
+ * 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 the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  The copyright holders make no representations
+ * about the suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS 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.
+ */
+
+#ifndef _PRESENTEXT_H_
+#define _PRESENTEXT_H_
+
+extern _X_EXPORT void
+present_extension_init(void);
+
+#endif /* _PRESENTEXT_H_ */
diff --git a/pseudoramiX/Makefile.am b/pseudoramiX/Makefile.am
new file mode 100644 (file)
index 0000000..17b664b
--- /dev/null
@@ -0,0 +1,7 @@
+# Fake Xinerama extension
+
+AM_CFLAGS = $(DIX_CFLAGS)
+
+noinst_LTLIBRARIES = libPseudoramiX.la
+
+libPseudoramiX_la_SOURCES = pseudoramiX.c pseudoramiX.h
similarity index 98%
rename from hw/xquartz/pseudoramiX.c
rename to pseudoramiX/pseudoramiX.c
index 23dbc73..f47c783 100644 (file)
@@ -100,6 +100,10 @@ static unsigned long pseudoramiXGeneration = 0;
 
 static void
 PseudoramiXTrace(const char *format, ...)
+    _X_ATTRIBUTE_PRINTF(1, 2);
+
+static void
+PseudoramiXTrace(const char *format, ...)
 {
     va_list ap;
 
@@ -110,6 +114,10 @@ PseudoramiXTrace(const char *format, ...)
 
 static void
 PseudoramiXDebug(const char *format, ...)
+    _X_ATTRIBUTE_PRINTF(1, 2);
+
+static void
+PseudoramiXDebug(const char *format, ...)
 {
     va_list ap;
 
index da48c3f..6e3f14b 100644 (file)
@@ -60,7 +60,7 @@ DevPrivateKeyRec RRClientPrivateKeyRec;
 DevPrivateKeyRec rrPrivKeyRec;
 
 static void
-RRClientCallback(CallbackListPtr *list, pointer closure, pointer data)
+RRClientCallback(CallbackListPtr *list, void *closure, void *data)
 {
     NewClientInfoRec *clientinfo = (NewClientInfoRec *) data;
     ClientPtr pClient = clientinfo->client;
@@ -264,6 +264,8 @@ RRInit(void)
             return FALSE;
         if (!RROutputInit())
             return FALSE;
+        if (!RRProviderInit())
+            return FALSE;
         RRGeneration = serverGeneration;
     }
     if (!dixRegisterPrivateKey(&rrPrivKeyRec, PRIVATE_SCREEN, 0))
@@ -336,7 +338,7 @@ RRScreenInit(ScreenPtr pScreen)
 }
 
  /*ARGSUSED*/ static int
-RRFreeClient(pointer data, XID id)
+RRFreeClient(void *data, XID id)
 {
     RREventPtr pRREvent;
     WindowPtr pWin;
@@ -344,7 +346,7 @@ RRFreeClient(pointer data, XID id)
 
     pRREvent = (RREventPtr) data;
     pWin = pRREvent->window;
-    dixLookupResourceByType((pointer *) &pHead, pWin->drawable.id,
+    dixLookupResourceByType((void **) &pHead, pWin->drawable.id,
                             RREventType, serverClient, DixDestroyAccess);
     if (pHead) {
         pPrev = 0;
@@ -357,12 +359,12 @@ RRFreeClient(pointer data, XID id)
                 *pHead = pRREvent->next;
         }
     }
-    free((pointer) pRREvent);
+    free((void *) pRREvent);
     return 1;
 }
 
  /*ARGSUSED*/ static int
-RRFreeEvents(pointer data, XID id)
+RRFreeEvents(void *data, XID id)
 {
     RREventPtr *pHead, pCur, pNext;
 
@@ -370,9 +372,9 @@ RRFreeEvents(pointer data, XID id)
     for (pCur = *pHead; pCur; pCur = pNext) {
         pNext = pCur->next;
         FreeResource(pCur->clientResource, RRClientType);
-        free((pointer) pCur);
+        free((void *) pCur);
     }
-    free((pointer) pHead);
+    free((void *) pHead);
     return 1;
 }
 
@@ -418,17 +420,45 @@ RRExtensionInit(void)
 #endif
 }
 
+void
+RRResourcesChanged(ScreenPtr pScreen)
+{
+    rrScrPriv(pScreen);
+    pScrPriv->resourcesChanged = TRUE;
+
+    RRSetChanged(pScreen);
+}
+
+static void
+RRDeliverResourceEvent(ClientPtr client, WindowPtr pWin)
+{
+    ScreenPtr pScreen = pWin->drawable.pScreen;
+
+    rrScrPriv(pScreen);
+
+    xRRResourceChangeNotifyEvent re = {
+        .type = RRNotify + RREventBase,
+        .subCode = RRNotify_ResourceChange,
+        .timestamp = pScrPriv->lastSetTime.milliseconds,
+        .window = pWin->drawable.id
+    };
+
+    WriteEventsToClient(client, 1, (xEvent *) &re);
+}
+
 static int
-TellChanged(WindowPtr pWin, pointer value)
+TellChanged(WindowPtr pWin, void *value)
 {
     RREventPtr *pHead, pRREvent;
     ClientPtr client;
     ScreenPtr pScreen = pWin->drawable.pScreen;
+    ScreenPtr iter;
+    rrScrPrivPtr pSlaveScrPriv;
 
     rrScrPriv(pScreen);
     int i;
 
-    dixLookupResourceByType((pointer *) &pHead, pWin->drawable.id,
+    dixLookupResourceByType((void **) &pHead, pWin->drawable.id,
                             RREventType, serverClient, DixReadAccess);
     if (!pHead)
         return WT_WALKCHILDREN;
@@ -448,6 +478,16 @@ TellChanged(WindowPtr pWin, pointer value)
                 if (crtc->changed)
                     RRDeliverCrtcEvent(client, pWin, crtc);
             }
+
+            xorg_list_for_each_entry(iter, &pScreen->output_slave_list, output_head) {
+                pSlaveScrPriv = rrGetScrPriv(iter);
+                for (i = 0; i < pSlaveScrPriv->numCrtcs; i++) {
+                    RRCrtcPtr crtc = pSlaveScrPriv->crtcs[i];
+
+                    if (crtc->changed)
+                        RRDeliverCrtcEvent(client, pWin, crtc);
+                }
+            }
         }
 
         if (pRREvent->mask & RROutputChangeNotifyMask) {
@@ -457,11 +497,67 @@ TellChanged(WindowPtr pWin, pointer value)
                 if (output->changed)
                     RRDeliverOutputEvent(client, pWin, output);
             }
+
+            xorg_list_for_each_entry(iter, &pScreen->output_slave_list, output_head) {
+                pSlaveScrPriv = rrGetScrPriv(iter);
+                for (i = 0; i < pSlaveScrPriv->numOutputs; i++) {
+                    RROutputPtr output = pSlaveScrPriv->outputs[i];
+
+                    if (output->changed)
+                        RRDeliverOutputEvent(client, pWin, output);
+                }
+            }
+        }
+
+        if (pRREvent->mask & RRProviderChangeNotifyMask) {
+            xorg_list_for_each_entry(iter, &pScreen->output_slave_list, output_head) {
+                pSlaveScrPriv = rrGetScrPriv(iter);
+                if (pSlaveScrPriv->provider->changed)
+                    RRDeliverProviderEvent(client, pWin, pSlaveScrPriv->provider);
+            }
+            xorg_list_for_each_entry(iter, &pScreen->offload_slave_list, offload_head) {
+                pSlaveScrPriv = rrGetScrPriv(iter);
+                if (pSlaveScrPriv->provider->changed)
+                    RRDeliverProviderEvent(client, pWin, pSlaveScrPriv->provider);
+            }
+            xorg_list_for_each_entry(iter, &pScreen->unattached_list, unattached_head) {
+                pSlaveScrPriv = rrGetScrPriv(iter);
+                if (pSlaveScrPriv->provider->changed)
+                    RRDeliverProviderEvent(client, pWin, pSlaveScrPriv->provider);
+            }
+        }
+
+        if (pRREvent->mask & RRResourceChangeNotifyMask) {
+            if (pScrPriv->resourcesChanged) {
+                RRDeliverResourceEvent(client, pWin);
+            }
         }
     }
     return WT_WALKCHILDREN;
 }
 
+void
+RRSetChanged(ScreenPtr pScreen)
+{
+    /* set changed bits on the master screen only */
+    ScreenPtr master;
+    rrScrPriv(pScreen);
+    rrScrPrivPtr mastersp;
+
+    if (pScreen->isGPU) {
+        master = pScreen->current_master;
+        if (!master)
+            return;
+        mastersp = rrGetScrPriv(master);
+    }
+    else {
+        master = pScreen;
+        mastersp = pScrPriv;
+    }
+
+    mastersp->changed = TRUE;
+}
+
 /*
  * Something changed; send events and adjust pointer position
  */
@@ -472,6 +568,8 @@ RRTellChanged(ScreenPtr pScreen)
     rrScrPriv(pScreen);
     rrScrPrivPtr mastersp;
     int i;
+    ScreenPtr iter;
+    rrScrPrivPtr pSlaveScrPriv;
 
     if (pScreen->isGPU) {
         master = pScreen->current_master;
@@ -482,7 +580,7 @@ RRTellChanged(ScreenPtr pScreen)
         mastersp = pScrPriv;
     }
 
-    if (pScrPriv->changed) {
+    if (mastersp->changed) {
         UpdateCurrentTimeIf();
         if (mastersp->configChanged) {
             mastersp->lastConfigTime = currentTime;
@@ -490,11 +588,33 @@ RRTellChanged(ScreenPtr pScreen)
         }
         pScrPriv->changed = FALSE;
         mastersp->changed = FALSE;
-        WalkTree(master, TellChanged, (pointer) master);
+
+        WalkTree(master, TellChanged, (void *) master);
+
+        mastersp->resourcesChanged = FALSE;
+
         for (i = 0; i < pScrPriv->numOutputs; i++)
             pScrPriv->outputs[i]->changed = FALSE;
         for (i = 0; i < pScrPriv->numCrtcs; i++)
             pScrPriv->crtcs[i]->changed = FALSE;
+
+        xorg_list_for_each_entry(iter, &master->output_slave_list, output_head) {
+            pSlaveScrPriv = rrGetScrPriv(iter);
+            pSlaveScrPriv->provider->changed = FALSE;
+            for (i = 0; i < pSlaveScrPriv->numOutputs; i++)
+                pSlaveScrPriv->outputs[i]->changed = FALSE;
+            for (i = 0; i < pSlaveScrPriv->numCrtcs; i++)
+                pSlaveScrPriv->crtcs[i]->changed = FALSE;
+        }
+        xorg_list_for_each_entry(iter, &master->offload_slave_list, offload_head) {
+            pSlaveScrPriv = rrGetScrPriv(iter);
+            pSlaveScrPriv->provider->changed = FALSE;
+        }
+        xorg_list_for_each_entry(iter, &master->unattached_list, unattached_head) {
+            pSlaveScrPriv = rrGetScrPriv(iter);
+            pSlaveScrPriv->provider->changed = FALSE;
+        }
+
         if (mastersp->layoutChanged) {
             pScrPriv->layoutChanged = FALSE;
             RRPointerScreenConfigured(master);
@@ -559,7 +679,7 @@ static int
 SProcRRDispatch(ClientPtr client)
 {
     REQUEST(xReq);
-    if (stuff->data >= RRNumberRequests || !ProcRandrVector[stuff->data])
+    if (stuff->data >= RRNumberRequests || !SProcRandrVector[stuff->data])
         return BadRequest;
     return (*SProcRandrVector[stuff->data]) (client);
 }
old mode 100644 (file)
new mode 100755 (executable)
index 212b0a9..4b3f37c
@@ -57,7 +57,7 @@
 #define RANDR_13_INTERFACE 1    /* requires RANDR_12_INTERFACE */
 #define RANDR_GET_CRTC_INTERFACE 1
 
-#define RANDR_INTERFACE_VERSION 0x0103
+#define RANDR_INTERFACE_VERSION 0x0104
 
 typedef XID RRMode;
 typedef XID RROutput;
@@ -92,7 +92,7 @@ struct _rrPropertyValue {
     Atom type;                  /* ignored by server */
     short format;               /* format of data for swapping - 8,16,32 */
     long size;                  /* size of data in (format/8) bytes */
-    pointer data;               /* private to client */
+    void *data;                 /* private to client */
 };
 
 struct _rrProperty {
@@ -164,6 +164,7 @@ struct _rrProvider {
     int nameLength;
     RRPropertyPtr properties;
     Bool pendingProperties;
+    Bool changed;
     struct _rrProvider *offload_sink;
     struct _rrProvider *output_source;
 };
@@ -232,6 +233,9 @@ typedef Bool (*RRProviderSetOffloadSinkProcPtr)(ScreenPtr pScreen,
                                          RRProviderPtr offload_sink);
 
 
+typedef void (*RRProviderDestroyProcPtr)(ScreenPtr pScreen,
+                                         RRProviderPtr provider);
+
 /* These are for 1.0 compatibility */
 
 typedef struct _rrRefresh {
@@ -257,6 +261,29 @@ typedef Bool (*RRSetConfigProcPtr) (ScreenPtr pScreen,
 
 typedef Bool (*RRCrtcSetScanoutPixmapProcPtr)(RRCrtcPtr crtc, PixmapPtr pixmap);
 
+//#ifdef _F_STEREOSCOPIC_SEND_FBSIZE_TO_WM_
+typedef enum
+{
+   RECT_L ,
+   RECT_R ,
+   RECT_MAX
+}rectNum;
+
+typedef struct
+{
+   short x;
+   short y;
+   short w;
+   short h;
+}DrawRect;
+
+typedef void (*GetStereoBufferSizeProcPtr)(RROutputPtr output,
+              int planeID, short* width, short* height) ;
+
+typedef void (*GetDrawingRectProcPtr)(RROutputPtr output, int planeID,
+          DrawRect* rect[RECT_MAX]);
+//#endif
+
 typedef struct _rrScrPriv {
     /*
      * 'public' part of the structure; DDXen fill this in
@@ -297,6 +324,7 @@ typedef struct _rrScrPriv {
     Bool changed;               /* some config changed */
     Bool configChanged;         /* configuration changed */
     Bool layoutChanged;         /* screen layout changed */
+    Bool resourcesChanged;      /* screen resources change */
 
     CARD16 minWidth, minHeight;
     CARD16 maxWidth, maxHeight;
@@ -330,6 +358,14 @@ typedef struct _rrScrPriv {
     Bool discontiguous;
 
     RRProviderPtr provider;
+
+    RRProviderDestroyProcPtr rrProviderDestroy;
+
+//#ifdef _F_STEREOSCOPIC_SEND_FBSIZE_TO_WM_
+    /* added for stereoscopic mode support */
+    GetStereoBufferSizeProcPtr getStereoBufferSize ;
+    GetDrawingRectProcPtr  getDrawingRect ;
+//#endif
 } rrScrPrivRec, *rrScrPrivPtr;
 
 extern _X_EXPORT DevPrivateKeyRec rrPrivKeyRec;
@@ -377,7 +413,7 @@ extern _X_EXPORT RESTYPE RRCrtcType, RRModeType, RROutputType, RRProviderType;
 
 #define VERIFY_RR_OUTPUT(id, ptr, a)\
     {\
-       int rc = dixLookupResourceByType((pointer *)&(ptr), id,\
+       int rc = dixLookupResourceByType((void **)&(ptr), id,\
                                         RROutputType, client, a);\
        if (rc != Success) {\
            client->errorValue = id;\
@@ -387,7 +423,7 @@ extern _X_EXPORT RESTYPE RRCrtcType, RRModeType, RROutputType, RRProviderType;
 
 #define VERIFY_RR_CRTC(id, ptr, a)\
     {\
-       int rc = dixLookupResourceByType((pointer *)&(ptr), id,\
+       int rc = dixLookupResourceByType((void **)&(ptr), id,\
                                         RRCrtcType, client, a);\
        if (rc != Success) {\
            client->errorValue = id;\
@@ -397,7 +433,7 @@ extern _X_EXPORT RESTYPE RRCrtcType, RRModeType, RROutputType, RRProviderType;
 
 #define VERIFY_RR_MODE(id, ptr, a)\
     {\
-       int rc = dixLookupResourceByType((pointer *)&(ptr), id,\
+       int rc = dixLookupResourceByType((void **)&(ptr), id,\
                                         RRModeType, client, a);\
        if (rc != Success) {\
            client->errorValue = id;\
@@ -407,7 +443,7 @@ extern _X_EXPORT RESTYPE RRCrtcType, RRModeType, RROutputType, RRProviderType;
 
 #define VERIFY_RR_PROVIDER(id, ptr, a)\
     {\
-        int rc = dixLookupResourceByType((pointer *)&(ptr), id,\
+        int rc = dixLookupResourceByType((void **)&(ptr), id,\
                                          RRProviderType, client, a);\
         if (rc != Success) {\
             client->errorValue = id;\
@@ -479,7 +515,14 @@ extern _X_EXPORT int
 extern _X_EXPORT void
  RRDeliverScreenEvent(ClientPtr client, WindowPtr pWin, ScreenPtr pScreen);
 
+extern _X_EXPORT void
+ RRResourcesChanged(ScreenPtr pScreen);
+
 /* randr.c */
+/* set a screen change on the primary screen */
+extern _X_EXPORT void
+RRSetChanged(ScreenPtr pScreen);
+
 /*
  * Send all pending events
  */
@@ -856,7 +899,7 @@ extern _X_EXPORT int
 
 RRChangeOutputProperty(RROutputPtr output, Atom property, Atom type,
                        int format, int mode, unsigned long len,
-                       pointer value, Bool sendevent, Bool pending);
+                       void *value, Bool sendevent, Bool pending);
 
 extern _X_EXPORT int
 
@@ -913,6 +956,9 @@ RRProviderSetCapabilities(RRProviderPtr provider, uint32_t capabilities);
 extern _X_EXPORT Bool
 RRProviderLookup(XID id, RRProviderPtr *provider_p);
 
+extern _X_EXPORT void
+RRDeliverProviderEvent(ClientPtr client, WindowPtr pWin, RRProviderPtr provider);
+
 /* rrproviderproperty.c */
 
 extern _X_EXPORT void
@@ -930,7 +976,15 @@ extern _X_EXPORT void
 extern _X_EXPORT int
 RRChangeProviderProperty(RRProviderPtr provider, Atom property, Atom type,
                        int format, int mode, unsigned long len,
-                       pointer value, Bool sendevent, Bool pending);
+                       void *value, Bool sendevent, Bool pending);
+
+extern _X_EXPORT int
+ RRConfigureProviderProperty(RRProviderPtr provider, Atom property,
+                             Bool pending, Bool range, Bool immutable,
+                             int num_values, INT32 *values);
+
+extern _X_EXPORT Bool
+ RRPostProviderPendingProperties(RRProviderPtr provider);
 
 extern _X_EXPORT int
  ProcRRGetProviderProperty(ClientPtr client);
@@ -958,17 +1012,17 @@ extern _X_EXPORT void
 #endif                          /* _RANDRSTR_H_ */
 
 /*
+
 randr extension implementation structure
 
 Query state:
     ProcRRGetScreenInfo/ProcRRGetScreenResources
        RRGetInfo
+
            â€¢ Request configuration from driver, either 1.0 or 1.2 style
            â€¢ These functions only record state changes, all
              other actions are pended until RRTellChanged is called
+
            ->rrGetInfo
            1.0:
                RRRegisterSize
@@ -983,15 +1037,15 @@ Query state:
                RROutputSetSubpixelOrder
                RROutputSetClones
                RRCrtcNotify
+
        â€¢ Must delay scanning configuration until after ->rrGetInfo returns
          because some drivers will call SetCurrentConfig in the middle
          of the ->rrGetInfo operation.
+
        1.0:
 
            â€¢ Scan old configuration, mirror to new structures
+
            RRScanOldConfig
                RRCrtcCreate
                RROutputCreate
@@ -1001,16 +1055,16 @@ Query state:
                RROldModeAdd    â€¢ This adds modes one-at-a-time
                    RRModeGet
                RRCrtcNotify
+
        â€¢ send events, reset pointer if necessary
+
        RRTellChanged
            WalkTree (sending events)
+
            â€¢ when layout has changed:
                RRPointerScreenConfigured
                RRSendConfigNotify
+
 Asynchronous state setting (1.2 only)
     When setting state asynchronously, the driver invokes the
     ->rrGetInfo function and then calls RRTellChanged to flush
old mode 100644 (file)
new mode 100755 (executable)
index e82d050..e356c5c
@@ -39,7 +39,7 @@ RRCrtcChanged(RRCrtcPtr crtc, Bool layoutChanged)
     if (pScreen) {
         rrScrPriv(pScreen);
 
-        pScrPriv->changed = TRUE;
+        RRSetChanged(pScreen);
         /*
          * Send ConfigureNotify on any layout change
          */
@@ -95,13 +95,15 @@ RRCrtcCreate(ScreenPtr pScreen, void *devPrivate)
     pixman_f_transform_init_identity(&crtc->f_transform);
     pixman_f_transform_init_identity(&crtc->f_inverse);
 
-    if (!AddResource(crtc->id, RRCrtcType, (pointer) crtc))
+    if (!AddResource(crtc->id, RRCrtcType, (void *) crtc))
         return NULL;
 
     /* attach the screen and crtc together */
     crtc->pScreen = pScreen;
     pScrPriv->crtcs[pScrPriv->numCrtcs++] = crtc;
 
+    RRResourcesChanged(pScreen);
+
     return crtc;
 }
 
@@ -363,15 +365,19 @@ void
 RRCrtcDetachScanoutPixmap(RRCrtcPtr crtc)
 {
     ScreenPtr master = crtc->pScreen->current_master;
-    int ret;
     PixmapPtr mscreenpix;
     rrScrPriv(crtc->pScreen);
 
     mscreenpix = master->GetScreenPixmap(master);
 
-    ret = pScrPriv->rrCrtcSetScanoutPixmap(crtc, NULL);
+    pScrPriv->rrCrtcSetScanoutPixmap(crtc, NULL);
     if (crtc->scanout_pixmap) {
         master->StopPixmapTracking(mscreenpix, crtc->scanout_pixmap);
+        /*
+         * Unref the pixmap twice: once for the original reference, and once
+         * for the reference implicitly added by PixmapShareToSlave.
+         */
+        master->DestroyPixmap(crtc->scanout_pixmap->master_pixmap);
         master->DestroyPixmap(crtc->scanout_pixmap->master_pixmap);
         crtc->pScreen->DestroyPixmap(crtc->scanout_pixmap);
     }
@@ -437,7 +443,7 @@ rrCheckPixmapBounding(ScreenPtr pScreen,
                       RRCrtcPtr rr_crtc, int x, int y, int w, int h)
 {
     RegionRec root_pixmap_region, total_region, new_crtc_region;
-    int i, c;
+    int c;
     BoxRec newbox;
     BoxPtr newsize;
     ScreenPtr slave;
@@ -469,24 +475,25 @@ rrCheckPixmapBounding(ScreenPtr pScreen,
     }
 
     xorg_list_for_each_entry(slave, &pScreen->output_slave_list, output_head) {
-        rrScrPriv(slave);
-        for (c = 0; c < pScrPriv->numCrtcs; c++)
-            if (pScrPriv->crtcs[c] == rr_crtc) {
+        rrScrPrivPtr    slave_priv = rrGetScrPriv(slave);
+        for (c = 0; c < slave_priv->numCrtcs; c++) {
+            if (slave_priv->crtcs[c] == rr_crtc) {
                 newbox.x1 = x;
                 newbox.x2 = x + w;
                 newbox.y1 = y;
                 newbox.y2 = y + h;
             }
             else {
-                if (!pScrPriv->crtcs[c]->mode)
+                if (!slave_priv->crtcs[c]->mode)
                     continue;
-                newbox.x1 = pScrPriv->crtcs[c]->x;
-                newbox.x2 = pScrPriv->crtcs[c]->x + pScrPriv->crtcs[c]->mode->mode.width;
-                newbox.y1 = pScrPriv->crtcs[c]->y;
-                newbox.y2 = pScrPriv->crtcs[c]->y + pScrPriv->crtcs[c]->mode->mode.height;
+                newbox.x1 = slave_priv->crtcs[c]->x;
+                newbox.x2 = slave_priv->crtcs[c]->x + slave_priv->crtcs[c]->mode->mode.width;
+                newbox.y1 = slave_priv->crtcs[c]->y;
+                newbox.y2 = slave_priv->crtcs[c]->y + slave_priv->crtcs[c]->mode->mode.height;
             }
-        RegionInit(&new_crtc_region, &newbox, 1);
-        RegionUnion(&total_region, &total_region, &new_crtc_region);
+            RegionInit(&new_crtc_region, &newbox, 1);
+            RegionUnion(&total_region, &total_region, &new_crtc_region);
+        }
     }
 
     newsize = RegionExtents(&total_region);
@@ -497,10 +504,7 @@ rrCheckPixmapBounding(ScreenPtr pScreen,
         new_height == screen_pixmap->drawable.height) {
         ErrorF("adjust shatters %d %d\n", newsize->x1, newsize->x2);
     } else {
-        int ret;
-        rrScrPriv(pScreen);
-        ret = pScrPriv->rrScreenSetSize(pScreen,
-                                           new_width, new_height, 0, 0);
+        pScrPriv->rrScreenSetSize(pScreen, new_width, new_height, 0, 0);
     }
 
     /* set shatters TODO */
@@ -511,17 +515,34 @@ rrCheckPixmapBounding(ScreenPtr pScreen,
  * Request that the Crtc be reconfigured
  */
 Bool
+#ifdef _F_XF86_DISABLE_UNUSED_FUNC_RESCHANGE_
+RRCrtcSet(RRCrtcPtr crtc,
+          RRModePtr mode,
+          int x,
+          int y, Rotation rotation, int numOutputs, RROutputPtr * outputs, Bool is_res_change)
+#else
 RRCrtcSet(RRCrtcPtr crtc,
           RRModePtr mode,
           int x,
           int y, Rotation rotation, int numOutputs, RROutputPtr * outputs)
+#endif
 {
     ScreenPtr pScreen = crtc->pScreen;
     Bool ret = FALSE;
     Bool recompute = TRUE;
+    Bool crtcChanged;
+    int  o;
 
     rrScrPriv(pScreen);
 
+    crtcChanged = FALSE;
+    for (o = 0; o < numOutputs; o++) {
+        if (outputs[o] && outputs[o]->crtc != crtc) {
+            crtcChanged = TRUE;
+            break;
+        }
+    }
+
     /* See if nothing changed */
     if (crtc->mode == mode &&
         crtc->x == x &&
@@ -529,7 +550,8 @@ RRCrtcSet(RRCrtcPtr crtc,
         crtc->rotation == rotation &&
         crtc->numOutputs == numOutputs &&
         !memcmp(crtc->outputs, outputs, numOutputs * sizeof(RROutputPtr)) &&
-        !RRCrtcPendingProperties(crtc) && !RRCrtcPendingTransform(crtc)) {
+        !RRCrtcPendingProperties(crtc) && !RRCrtcPendingTransform(crtc) &&
+        !crtcChanged) {
         recompute = FALSE;
         ret = TRUE;
     }
@@ -556,8 +578,14 @@ RRCrtcSet(RRCrtcPtr crtc,
         }
 #if RANDR_12_INTERFACE
         if (pScrPriv->rrCrtcSet) {
+
+#ifdef _F_XF86_DISABLE_UNUSED_FUNC_RESCHANGE_
+            ret = (*pScrPriv->rrCrtcSet) (pScreen, crtc, mode, x, y,
+                                          rotation, numOutputs, outputs, FALSE);
+#else
             ret = (*pScrPriv->rrCrtcSet) (pScreen, crtc, mode, x, y,
                                           rotation, numOutputs, outputs);
+#endif
         }
         else
 #endif
@@ -601,7 +629,6 @@ RRCrtcSet(RRCrtcPtr crtc,
 #endif
         }
         if (ret) {
-            int o;
 
             RRTellChanged(pScreen);
 
@@ -650,7 +677,7 @@ RRCrtcDestroy(RRCrtcPtr crtc)
 }
 
 static int
-RRCrtcDestroyResource(pointer value, XID pid)
+RRCrtcDestroyResource(void *value, XID pid)
 {
     RRCrtcPtr crtc = (RRCrtcPtr) value;
     ScreenPtr pScreen = crtc->pScreen;
@@ -667,6 +694,8 @@ RRCrtcDestroyResource(pointer value, XID pid)
                 break;
             }
         }
+
+        RRResourcesChanged(pScreen);
     }
 
     if (crtc->scanout_pixmap)
@@ -1020,7 +1049,7 @@ ProcRRSetCrtcConfig(ClientPtr client)
 
     outputIds = (RROutput *) (stuff + 1);
     for (i = 0; i < numOutputs; i++) {
-        ret = dixLookupResourceByType((pointer *) (outputs + i), outputIds[i],
+        ret = dixLookupResourceByType((void **) (outputs + i), outputIds[i],
                                      RROutputType, client, DixSetAttrAccess);
         if (ret != Success) {
             free(outputs);
@@ -1154,8 +1183,14 @@ ProcRRSetCrtcConfig(ClientPtr client)
 #endif
     }
 
+#ifdef _F_XF86_DISABLE_UNUSED_FUNC_RESCHANGE_
+    if (!RRCrtcSet(crtc, mode, stuff->x, stuff->y,
+                   rotation, numOutputs, outputs, FALSE))
+#else
     if (!RRCrtcSet(crtc, mode, stuff->x, stuff->y,
-                   rotation, numOutputs, outputs)) {
+                   rotation, numOutputs, outputs))
+#endif
+    {
         status = RRSetConfigFailed;
         goto sendReply;
     }
@@ -1698,8 +1733,13 @@ RRReplaceScanoutPixmap(DrawablePtr pDrawable, PixmapPtr pPixmap, Bool enable)
         if (changed && pScrPriv->rrCrtcSet) {
             pScrPriv->rrCrtcSetScanoutPixmap(crtc, crtc->scanout_pixmap);
 
+#ifdef _F_XF86_DISABLE_UNUSED_FUNC_RESCHANGE_
+            (*pScrPriv->rrCrtcSet) (pDrawable->pScreen, crtc, crtc->mode, crtc->x, crtc->y,
+                                    crtc->rotation, crtc->numOutputs, crtc->outputs, FALSE);
+#else
             (*pScrPriv->rrCrtcSet) (pDrawable->pScreen, crtc, crtc->mode, crtc->x, crtc->y,
                                     crtc->rotation, crtc->numOutputs, crtc->outputs);
+#endif
         }
     }
     return ret;
index 7fbc9f0..b9346d3 100644 (file)
@@ -83,7 +83,7 @@ ProcRRSelectInput(ClientPtr client)
     rc = dixLookupWindow(&pWin, stuff->window, client, DixReceiveAccess);
     if (rc != Success)
         return rc;
-    rc = dixLookupResourceByType((pointer *) &pHead, pWin->drawable.id,
+    rc = dixLookupResourceByType((void **) &pHead, pWin->drawable.id,
                                  RREventType, client, DixWriteAccess);
     if (rc != Success && rc != BadValue)
         return rc;
@@ -120,7 +120,7 @@ ProcRRSelectInput(ClientPtr client)
              */
             clientResource = FakeClientID(client->index);
             pRREvent->clientResource = clientResource;
-            if (!AddResource(clientResource, RRClientType, (pointer) pRREvent))
+            if (!AddResource(clientResource, RRClientType, (void *) pRREvent))
                 return BadAlloc;
             /*
              * create a resource to contain a pointer to the list
@@ -132,7 +132,7 @@ ProcRRSelectInput(ClientPtr client)
                 pHead = (RREventPtr *) malloc(sizeof(RREventPtr));
                 if (!pHead ||
                     !AddResource(pWin->drawable.id, RREventType,
-                                 (pointer) pHead)) {
+                                 (void *) pHead)) {
                     FreeResource(clientResource, RT_NONE);
                     return BadAlloc;
                 }
index 1408d6f..fc57bd4 100644 (file)
@@ -225,7 +225,7 @@ RRScreenSetSizeRange(ScreenPtr pScreen,
     pScrPriv->minHeight = minHeight;
     pScrPriv->maxWidth = maxWidth;
     pScrPriv->maxHeight = maxHeight;
-    pScrPriv->changed = TRUE;
+    RRSetChanged(pScreen);
     pScrPriv->configChanged = TRUE;
 }
 
index f5d3f9e..befac47 100644 (file)
@@ -89,7 +89,7 @@ RRModeCreate(xRRModeInfo * modeInfo, const char *name, ScreenPtr userScreen)
     }
 
     mode->mode.id = FakeClientID(0);
-    if (!AddResource(mode->mode.id, RRModeType, (pointer) mode)) {
+    if (!AddResource(mode->mode.id, RRModeType, (void *) mode)) {
         free(newModes);
         return NULL;
     }
@@ -250,7 +250,7 @@ RRModeDestroy(RRModePtr mode)
 }
 
 static int
-RRModeDestroyResource(pointer value, XID pid)
+RRModeDestroyResource(void *value, XID pid)
 {
     RRModeDestroy((RRModePtr) value);
     return 1;
index 88781ba..f824f50 100644 (file)
@@ -36,7 +36,7 @@ RROutputChanged(RROutputPtr output, Bool configChanged)
     output->changed = TRUE;
     if (pScreen) {
         rrScrPriv(pScreen);
-        pScrPriv->changed = TRUE;
+        RRSetChanged(pScreen);
         if (configChanged)
             pScrPriv->configChanged = TRUE;
     }
@@ -97,10 +97,13 @@ RROutputCreate(ScreenPtr pScreen,
     output->changed = FALSE;
     output->devPrivate = devPrivate;
 
-    if (!AddResource(output->id, RROutputType, (pointer) output))
+    if (!AddResource(output->id, RROutputType, (void *) output))
         return NULL;
 
     pScrPriv->outputs[pScrPriv->numOutputs++] = output;
+
+    RRResourcesChanged(pScreen);
+
     return output;
 }
 
@@ -334,7 +337,7 @@ RROutputDestroy(RROutputPtr output)
 }
 
 static int
-RROutputDestroyResource(pointer value, XID pid)
+RROutputDestroyResource(void *value, XID pid)
 {
     RROutputPtr output = (RROutputPtr) value;
     ScreenPtr pScreen = output->pScreen;
@@ -355,6 +358,8 @@ RROutputDestroyResource(pointer value, XID pid)
                 break;
             }
         }
+
+        RRResourcesChanged(pScreen);
     }
     if (output->modes) {
         for (m = 0; m < output->numModes; m++)
index ec803e9..eb6b677 100644 (file)
@@ -82,7 +82,7 @@ RRPointerToNearestCrtc(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y,
         else
             dx = 0;
         if (y < crtc->y)
-            dy = crtc->y - x;
+            dy = crtc->y - y;
         else if (y > crtc->y + scan_height)
             dy = y - (crtc->y + scan_height);
         else
old mode 100644 (file)
new mode 100755 (executable)
index 67b5467..3dd1faa
 #include "propertyst.h"
 #include "swaprep.h"
 
+#ifdef _F_STEREOSCOPIC_SEND_FBSIZE_TO_WM_
+#define STEREOSCOPIC_ATOM "_E_COMP_STEREOSCOPIC_MODE"
+#define GFX_PLANE   1
+#define INIT_DEFAULT -1
+
+typedef struct _Data_Rrprop
+{
+   unsigned int freq;
+   unsigned int b_is_component;
+   int mode_3d; // 3D mode
+   int format_3d; // 3D format
+   Bool is_single_source;
+   Window win ;
+   short fb_width;
+   short fb_height ;
+   short x_L ;
+   short y_L;
+   short w_L ;
+   short h_L ;
+   short x_R ;
+   short y_R ;
+   short w_R ;
+   short h_R ;
+} Data_RRprop;
+#endif
+
 static int
 DeliverPropertyEvent(WindowPtr pWin, void *value)
 {
     xRROutputPropertyNotifyEvent *event = value;
     RREventPtr *pHead, pRREvent;
 
-    dixLookupResourceByType((pointer *) &pHead, pWin->drawable.id,
+    dixLookupResourceByType((void **) &pHead, pWin->drawable.id,
                             RREventType, serverClient, DixReadAccess);
     if (!pHead)
         return WT_WALKCHILDREN;
@@ -135,7 +161,7 @@ RRDeleteOutputProperty(RROutputPtr output, Atom property)
 int
 RRChangeOutputProperty(RROutputPtr output, Atom property, Atom type,
                        int format, int mode, unsigned long len,
-                       pointer value, Bool sendevent, Bool pending)
+                       void *value, Bool sendevent, Bool pending)
 {
     RRPropertyPtr prop;
     rrScrPrivPtr pScrPriv = rrGetScrPriv(output->pScreen);
@@ -178,10 +204,10 @@ RRChangeOutputProperty(RROutputPtr output, Atom property, Atom type,
         total_len = prop_value->size + len;
 
     if (mode == PropModeReplace || len > 0) {
-        pointer new_data = NULL, old_data = NULL;
+        void *new_data = NULL, *old_data = NULL;
 
         total_size = total_len * size_in_bytes;
-        new_value.data = (pointer) malloc(total_size);
+        new_value.data = (void *) malloc(total_size);
         if (!new_value.data && total_size) {
             if (add)
                 RRDestroyOutputProperty(prop);
@@ -197,13 +223,13 @@ RRChangeOutputProperty(RROutputPtr output, Atom property, Atom type,
             old_data = NULL;
             break;
         case PropModeAppend:
-            new_data = (pointer) (((char *) new_value.data) +
+            new_data = (void *) (((char *) new_value.data) +
                                   (prop_value->size * size_in_bytes));
             old_data = new_value.data;
             break;
         case PropModePrepend:
             new_data = new_value.data;
-            old_data = (pointer) (((char *) new_value.data) +
+            old_data = (void *) (((char *) new_value.data) +
                                   (prop_value->size * size_in_bytes));
             break;
         }
@@ -538,7 +564,7 @@ ProcRRChangeOutputProperty(ClientPtr client)
 
     err = RRChangeOutputProperty(output, stuff->property,
                                  stuff->type, (int) format,
-                                 (int) mode, len, (pointer) &stuff[1], TRUE,
+                                 (int) mode, len, (void *) &stuff[1], TRUE,
                                  TRUE);
     if (err != Success)
         return err;
@@ -588,6 +614,15 @@ ProcRRGetOutputProperty(ClientPtr client)
     xRRGetOutputPropertyReply reply;
     char *extra = NULL;
 
+#ifdef _F_STEREOSCOPIC_SEND_FBSIZE_TO_WM_
+    /* BEGIN : added for stereoscopic mode support */
+    DrawRect* rect[RECT_MAX] ;
+    short new_w = INIT_DEFAULT ;
+    short new_h = INIT_DEFAULT ;
+    Data_RRprop *stereoData = NULL ;
+    /* END : added for stereoscopic mode support */
+#endif
+
     REQUEST_SIZE_MATCH(xRRGetOutputPropertyReq);
     if (stuff->delete)
         UpdateCurrentTime();
@@ -639,6 +674,47 @@ ProcRRGetOutputProperty(ClientPtr client)
     if (!prop_value)
         return BadAtom;
 
+#ifdef _F_STEREOSCOPIC_SEND_FBSIZE_TO_WM_
+    /* BEGIN : added for stereoscopic support */
+    Atom stereoAtom = MakeAtom(STEREOSCOPIC_ATOM,
+                        strlen(STEREOSCOPIC_ATOM), FALSE ) ;
+    if (stereoAtom == stuff->property)
+    {
+        rect[RECT_L] = (DrawRect*)malloc(sizeof(DrawRect));
+        rect[RECT_R] = (DrawRect*)malloc(sizeof(DrawRect));
+
+        rrScrPrivPtr pScrPriv = rrGetScrPriv(output->pScreen);
+        if (pScrPriv->getStereoBufferSize)
+        {
+            pScrPriv->getStereoBufferSize(output, GFX_PLANE, &new_w, &new_h);
+        }
+
+        if (pScrPriv->getDrawingRect)
+        {
+            pScrPriv->getDrawingRect(output, GFX_PLANE, rect);
+        }
+
+        stereoData = (Data_RRprop *)prop_value->data ;
+        if (NULL != stereoData)
+        {
+            stereoData->fb_width = new_w ;
+            stereoData->fb_height = new_h ;
+            stereoData->x_L = rect[RECT_L]->x ;
+            stereoData->y_L = rect[RECT_L]->y ;
+            stereoData->w_L = rect[RECT_L]->w ;
+            stereoData->h_L = rect[RECT_L]->h ;
+            stereoData->x_R = rect[RECT_R]->x ;
+            stereoData->y_R = rect[RECT_R]->y ;
+            stereoData->w_R = rect[RECT_R]->w ;
+            stereoData->h_R = rect[RECT_R]->h ;
+        }
+
+        free(rect[RECT_L]) ;
+        free(rect[RECT_R]) ;
+    }
+    /* END : added for stereoscopic support */
+#endif
+
     /* If the request type and actual type don't match. Return the
        property information, but not the data. */
 
index c4ed515..4507ba8 100644 (file)
@@ -285,7 +285,7 @@ ProcRRSetProviderOutputSource(ClientPtr client)
     RRProviderPtr provider, source_provider = NULL;
     ScreenPtr pScreen;
 
-    REQUEST_AT_LEAST_SIZE(xRRSetProviderOutputSourceReq);
+    REQUEST_SIZE_MATCH(xRRSetProviderOutputSourceReq);
 
     VERIFY_RR_PROVIDER(stuff->provider, provider, DixReadAccess);
 
@@ -304,6 +304,9 @@ ProcRRSetProviderOutputSource(ClientPtr client)
 
     pScrPriv->rrProviderSetOutputSource(pScreen, provider, source_provider);
 
+    provider->changed = TRUE;
+    RRSetChanged(pScreen);
+
     RRTellChanged (pScreen);
 
     return Success;
@@ -317,7 +320,7 @@ ProcRRSetProviderOffloadSink(ClientPtr client)
     RRProviderPtr provider, sink_provider = NULL;
     ScreenPtr pScreen;
 
-    REQUEST_AT_LEAST_SIZE(xRRSetProviderOffloadSinkReq);
+    REQUEST_SIZE_MATCH(xRRSetProviderOffloadSinkReq);
 
     VERIFY_RR_PROVIDER(stuff->provider, provider, DixReadAccess);
     if (!(provider->capabilities & RR_Capability_SourceOffload))
@@ -333,6 +336,9 @@ ProcRRSetProviderOffloadSink(ClientPtr client)
 
     pScrPriv->rrProviderSetOffloadSink(pScreen, provider, sink_provider);
 
+    provider->changed = TRUE;
+    RRSetChanged(pScreen);
+
     RRTellChanged (pScreen);
 
     return Success;
@@ -357,8 +363,9 @@ RRProviderCreate(ScreenPtr pScreen, const char *name,
     provider->nameLength = nameLength;
     memcpy(provider->name, name, nameLength);
     provider->name[nameLength] = '\0';
+    provider->changed = FALSE;
 
-    if (!AddResource (provider->id, RRProviderType, (pointer) provider))
+    if (!AddResource (provider->id, RRProviderType, (void *) provider))
         return NULL;
     pScrPriv->provider = provider;
     return provider;
@@ -380,7 +387,7 @@ RRProviderSetCapabilities(RRProviderPtr provider, uint32_t capabilities)
 }
 
 static int
-RRProviderDestroyResource (pointer value, XID pid)
+RRProviderDestroyResource (void *value, XID pid)
 {
     RRProviderPtr provider = (RRProviderPtr)value;
     ScreenPtr pScreen = provider->pScreen;
@@ -389,6 +396,8 @@ RRProviderDestroyResource (pointer value, XID pid)
     {
         rrScrPriv(pScreen);
 
+        if (pScrPriv->rrProviderDestroy)
+            (*pScrPriv->rrProviderDestroy)(pScreen, provider);
         pScrPriv->provider = NULL;
     }
     free(provider);
@@ -414,3 +423,21 @@ RRProviderLookup(XID id, RRProviderPtr *provider_p)
         return TRUE;
     return FALSE;
 }
+
+void
+RRDeliverProviderEvent(ClientPtr client, WindowPtr pWin, RRProviderPtr provider)
+{
+    ScreenPtr pScreen = pWin->drawable.pScreen;
+
+    rrScrPriv(pScreen);
+
+    xRRProviderChangeNotifyEvent pe = {
+        .type = RRNotify + RREventBase,
+        .subCode = RRNotify_ProviderChange,
+        .timestamp = pScrPriv->lastSetTime.milliseconds,
+        .window = pWin->drawable.id,
+        .provider = provider->id
+    };
+
+    WriteEventsToClient(client, 1, (xEvent *) &pe);
+}
index ab601da..ff2c614 100644 (file)
@@ -30,7 +30,7 @@ DeliverPropertyEvent(WindowPtr pWin, void *value)
     xRRProviderPropertyNotifyEvent *event = value;
     RREventPtr *pHead, pRREvent;
 
-    dixLookupResourceByType((pointer *) &pHead, pWin->drawable.id,
+    dixLookupResourceByType((void **) &pHead, pWin->drawable.id,
                             RREventType, serverClient, DixReadAccess);
     if (!pHead)
         return WT_WALKCHILDREN;
@@ -135,7 +135,7 @@ RRDeleteProviderProperty(RRProviderPtr provider, Atom property)
 int
 RRChangeProviderProperty(RRProviderPtr provider, Atom property, Atom type,
                        int format, int mode, unsigned long len,
-                       pointer value, Bool sendevent, Bool pending)
+                       void *value, Bool sendevent, Bool pending)
 {
     RRPropertyPtr prop;
     rrScrPrivPtr pScrPriv = rrGetScrPriv(provider->pScreen);
@@ -178,10 +178,10 @@ RRChangeProviderProperty(RRProviderPtr provider, Atom property, Atom type,
         total_len = prop_value->size + len;
 
     if (mode == PropModeReplace || len > 0) {
-        pointer new_data = NULL, old_data = NULL;
+        void *new_data = NULL, *old_data = NULL;
 
         total_size = total_len * size_in_bytes;
-        new_value.data = (pointer) malloc(total_size);
+        new_value.data = (void *) malloc(total_size);
         if (!new_value.data && total_size) {
             if (add)
                 RRDestroyProviderProperty(prop);
@@ -197,13 +197,13 @@ RRChangeProviderProperty(RRProviderPtr provider, Atom property, Atom type,
             old_data = NULL;
             break;
         case PropModeAppend:
-            new_data = (pointer) (((char *) new_value.data) +
+            new_data = (void *) (((char *) new_value.data) +
                                   (prop_value->size * size_in_bytes));
             old_data = new_value.data;
             break;
         case PropModePrepend:
             new_data = new_value.data;
-            old_data = (pointer) (((char *) new_value.data) +
+            old_data = (void *) (((char *) new_value.data) +
                                   (prop_value->size * size_in_bytes));
             break;
         }
@@ -534,7 +534,7 @@ ProcRRChangeProviderProperty(ClientPtr client)
 
     err = RRChangeProviderProperty(provider, stuff->property,
                                  stuff->type, (int) format,
-                                 (int) mode, len, (pointer) &stuff[1], TRUE,
+                                 (int) mode, len, (void *) &stuff[1], TRUE,
                                  TRUE);
     if (err != Success)
         return err;
index 39340cc..36179ae 100644 (file)
@@ -143,7 +143,7 @@ RRScreenSizeNotify(ScreenPtr pScreen)
     pScrPriv->height = pScreen->height;
     pScrPriv->mmWidth = pScreen->mmWidth;
     pScrPriv->mmHeight = pScreen->mmHeight;
-    pScrPriv->changed = TRUE;
+    RRSetChanged(pScreen);
 /*    pScrPriv->sizeChanged = TRUE; */
 
     RRTellChanged(pScreen);
index 9968c7f..08c3b6a 100644 (file)
@@ -434,6 +434,133 @@ SProcRRGetOutputPrimary(ClientPtr client)
     return ProcRandrVector[stuff->randrReqType] (client);
 }
 
+static int SProcRRGetProviders(ClientPtr client)
+{
+    REQUEST(xRRGetProvidersReq);
+
+    REQUEST_SIZE_MATCH(xRRGetProvidersReq);
+    swaps(&stuff->length);
+    swapl(&stuff->window);
+    return ProcRandrVector[stuff->randrReqType] (client);
+}
+
+static int SProcRRGetProviderInfo(ClientPtr client)
+{
+    REQUEST(xRRGetProviderInfoReq);
+
+    REQUEST_SIZE_MATCH(xRRGetProviderInfoReq);
+    swaps(&stuff->length);
+    swapl(&stuff->provider);
+    swapl(&stuff->configTimestamp);
+    return ProcRandrVector[stuff->randrReqType] (client);
+}
+
+static int SProcRRSetProviderOffloadSink(ClientPtr client)
+{
+    REQUEST(xRRSetProviderOffloadSinkReq);
+
+    REQUEST_SIZE_MATCH(xRRSetProviderOffloadSinkReq);
+    swaps(&stuff->length);
+    swapl(&stuff->provider);
+    swapl(&stuff->sink_provider);
+    swapl(&stuff->configTimestamp);
+    return ProcRandrVector[stuff->randrReqType] (client);
+}
+
+static int SProcRRSetProviderOutputSource(ClientPtr client)
+{
+    REQUEST(xRRSetProviderOutputSourceReq);
+
+    REQUEST_SIZE_MATCH(xRRSetProviderOutputSourceReq);
+    swaps(&stuff->length);
+    swapl(&stuff->provider);
+    swapl(&stuff->source_provider);
+    swapl(&stuff->configTimestamp);
+    return ProcRandrVector[stuff->randrReqType] (client);
+}
+
+static int SProcRRListProviderProperties(ClientPtr client)
+{
+    REQUEST(xRRListProviderPropertiesReq);
+
+    REQUEST_SIZE_MATCH(xRRListProviderPropertiesReq);
+    swaps(&stuff->length);
+    swapl(&stuff->provider);
+    return ProcRandrVector[stuff->randrReqType] (client);
+}
+
+static int SProcRRQueryProviderProperty(ClientPtr client)
+{
+    REQUEST(xRRQueryProviderPropertyReq);
+
+    REQUEST_SIZE_MATCH(xRRQueryProviderPropertyReq);
+    swaps(&stuff->length);
+    swapl(&stuff->provider);
+    swapl(&stuff->property);
+    return ProcRandrVector[stuff->randrReqType] (client);
+}
+
+static int SProcRRConfigureProviderProperty(ClientPtr client)
+{
+    REQUEST(xRRConfigureProviderPropertyReq);
+
+    REQUEST_AT_LEAST_SIZE(xRRConfigureProviderPropertyReq);
+    swaps(&stuff->length);
+    swapl(&stuff->provider);
+    swapl(&stuff->property);
+    /* TODO: no way to specify format? */
+    SwapRestL(stuff);
+    return ProcRandrVector[stuff->randrReqType] (client);
+}
+
+static int SProcRRChangeProviderProperty(ClientPtr client)
+{
+    REQUEST(xRRChangeProviderPropertyReq);
+
+    REQUEST_AT_LEAST_SIZE(xRRChangeProviderPropertyReq);
+    swaps(&stuff->length);
+    swapl(&stuff->provider);
+    swapl(&stuff->property);
+    swapl(&stuff->type);
+    swapl(&stuff->nUnits);
+    switch (stuff->format) {
+    case 8:
+        break;
+    case 16:
+        SwapRestS(stuff);
+        break;
+    case 32:
+        SwapRestL(stuff);
+        break;
+    }
+    return ProcRandrVector[stuff->randrReqType] (client);
+}
+
+static int SProcRRDeleteProviderProperty(ClientPtr client)
+{
+    REQUEST(xRRDeleteProviderPropertyReq);
+
+    REQUEST_SIZE_MATCH(xRRDeleteProviderPropertyReq);
+    swaps(&stuff->length);
+    swapl(&stuff->provider);
+    swapl(&stuff->property);
+    return ProcRandrVector[stuff->randrReqType] (client);
+}
+
+static int SProcRRGetProviderProperty(ClientPtr client)
+{
+    REQUEST(xRRGetProviderPropertyReq);
+
+    REQUEST_SIZE_MATCH(xRRGetProviderPropertyReq);
+    swaps(&stuff->length);
+    swapl(&stuff->provider);
+    swapl(&stuff->property);
+    swapl(&stuff->type);
+    swapl(&stuff->longOffset);
+    swapl(&stuff->longLength);
+    return ProcRandrVector[stuff->randrReqType] (client);
+}
+
 int (*SProcRandrVector[RRNumberRequests]) (ClientPtr) = {
     SProcRRQueryVersion,        /* 0 */
 /* we skip 1 to make old clients fail pretty immediately */
@@ -472,4 +599,15 @@ int (*SProcRandrVector[RRNumberRequests]) (ClientPtr) = {
         SProcRRSetPanning,      /* 29 */
         SProcRRSetOutputPrimary,        /* 30 */
         SProcRRGetOutputPrimary,        /* 31 */
+/* V1.4 additions */
+        SProcRRGetProviders,            /* 32 */
+        SProcRRGetProviderInfo,         /* 33 */
+        SProcRRSetProviderOffloadSink,  /* 34 */
+        SProcRRSetProviderOutputSource, /* 35 */
+        SProcRRListProviderProperties,  /* 36 */
+        SProcRRQueryProviderProperty,   /* 37 */
+        SProcRRConfigureProviderProperty, /* 38 */
+        SProcRRChangeProviderProperty,  /* 39 */
+        SProcRRDeleteProviderProperty,  /* 40 */
+        SProcRRGetProviderProperty,     /* 41 */
 };
index f3a26a7..c900219 100644 (file)
@@ -130,15 +130,14 @@ static int numEnabledRCAPs;
  *  returns an error.
  */
 #define VERIFY_CONTEXT(_pContext, _contextid, _client) { \
-    int rc = dixLookupResourceByType((pointer *)&(_pContext), _contextid, \
+    int rc = dixLookupResourceByType((void **)&(_pContext), _contextid, \
                                      RTContext, _client, DixUseAccess); \
     if (rc != Success) \
        return rc; \
 }
 
-static int RecordDeleteContext(pointer /*value */ ,
-                               XID      /*id */
-    );
+static int RecordDeleteContext(void     *value,
+                               XID      id);
 
 /***************************************************************************/
 
@@ -232,7 +231,7 @@ RecordFindContextOnAllContexts(RecordContextPtr pContext)
  */
 static void
 RecordFlushReplyBuffer(RecordContextPtr pContext,
-                       pointer data1, int len1, pointer data2, int len2)
+                       void *data1, int len1, void *data2, int len2)
 {
     if (!pContext->pRecordingClient || pContext->pRecordingClient->clientGone ||
         pContext->inFlush)
@@ -279,7 +278,7 @@ RecordFlushReplyBuffer(RecordContextPtr pContext,
  */
 static void
 RecordAProtocolElement(RecordContextPtr pContext, ClientPtr pClient,
-                       int category, pointer data, int datalen, int padlen,
+                       int category, void *data, int datalen, int padlen,
                        int futurelen)
 {
     CARD32 elemHeaderData[2];
@@ -390,8 +389,8 @@ RecordAProtocolElement(RecordContextPtr pContext, ClientPtr pClient,
         }
     }
     else {
-        RecordFlushReplyBuffer(pContext, (pointer) elemHeaderData,
-                               numElemHeaders, (pointer) data,
+        RecordFlushReplyBuffer(pContext, (void *) elemHeaderData,
+                               numElemHeaders, (void *) data,
                                datalen - padlen);
     }
 }                               /* RecordAProtocolElement */
@@ -463,20 +462,20 @@ RecordABigRequest(RecordContextPtr pContext, ClientPtr client, xReq * stuff)
     /* record the request header */
     bytesLeft = client->req_len << 2;
     RecordAProtocolElement(pContext, client, XRecordFromClient,
-                           (pointer) stuff, SIZEOF(xReq), 0, bytesLeft);
+                           (void *) stuff, SIZEOF(xReq), 0, bytesLeft);
 
     /* reinsert the extended length field that was squished out */
     bigLength = client->req_len + bytes_to_int32(sizeof(bigLength));
     if (client->swapped)
         swapl(&bigLength);
     RecordAProtocolElement(pContext, client, XRecordFromClient,
-                           (pointer) &bigLength, sizeof(bigLength), 0,
+                           (void *) &bigLength, sizeof(bigLength), 0,
                            /* continuation */ -1);
     bytesLeft -= sizeof(bigLength);
 
     /* record the rest of the request after the length */
     RecordAProtocolElement(pContext, client, XRecordFromClient,
-                           (pointer) (stuff + 1), bytesLeft, 0,
+                           (void *) (stuff + 1), bytesLeft, 0,
                            /* continuation */ -1);
 }                               /* RecordABigRequest */
 
@@ -520,7 +519,7 @@ RecordARequest(ClientPtr client)
                     RecordABigRequest(pContext, client, stuff);
                 else
                     RecordAProtocolElement(pContext, client, XRecordFromClient,
-                                           (pointer) stuff,
+                                           (void *) stuff,
                                            client->req_len << 2, 0, 0);
             }
             else {              /* extension, check minor opcode */
@@ -543,7 +542,7 @@ RecordARequest(ClientPtr client)
                         else
                             RecordAProtocolElement(pContext, client,
                                                    XRecordFromClient,
-                                                   (pointer) stuff,
+                                                   (void *) stuff,
                                                    client->req_len << 2, 0, 0);
                         break;
                     }
@@ -576,7 +575,7 @@ RecordARequest(ClientPtr client)
  *     chunk of data belonging to this reply, it is set to 0.
  */
 static void
-RecordAReply(CallbackListPtr *pcbl, pointer nulldata, pointer calldata)
+RecordAReply(CallbackListPtr *pcbl, void *nulldata, void *calldata)
 {
     RecordContextPtr pContext;
     RecordClientsAndProtocolPtr pRCAP;
@@ -592,7 +591,7 @@ RecordAReply(CallbackListPtr *pcbl, pointer nulldata, pointer calldata)
 
             if (pContext->continuedReply) {
                 RecordAProtocolElement(pContext, client, XRecordFromServer,
-                                       (pointer) pri->replyData,
+                                       (void *) pri->replyData,
                                        pri->dataLenBytes, pri->padBytes,
                                        /* continuation */ -1);
                 if (!pri->bytesRemaining)
@@ -602,7 +601,7 @@ RecordAReply(CallbackListPtr *pcbl, pointer nulldata, pointer calldata)
                      RecordIsMemberOfSet(pRCAP->pReplyMajorOpSet, majorop)) {
                 if (majorop <= 127) {   /* core reply */
                     RecordAProtocolElement(pContext, client, XRecordFromServer,
-                                           (pointer) pri->replyData,
+                                           (void *) pri->replyData,
                                            pri->dataLenBytes, 0,
                                            pri->bytesRemaining);
                     if (pri->bytesRemaining)
@@ -625,7 +624,7 @@ RecordAReply(CallbackListPtr *pcbl, pointer nulldata, pointer calldata)
                                                 minorop)) {
                             RecordAProtocolElement(pContext, client,
                                                    XRecordFromServer,
-                                                   (pointer) pri->replyData,
+                                                   (void *) pri->replyData,
                                                    pri->dataLenBytes, 0,
                                                    pri->bytesRemaining);
                             if (pri->bytesRemaining)
@@ -655,8 +654,8 @@ RecordAReply(CallbackListPtr *pcbl, pointer nulldata, pointer calldata)
  *     it for this client.
  */
 static void
-RecordADeliveredEventOrError(CallbackListPtr *pcbl, pointer nulldata,
-                             pointer calldata)
+RecordADeliveredEventOrError(CallbackListPtr *pcbl, void *nulldata,
+                             void *calldata)
 {
     EventInfoRec *pei = (EventInfoRec *) calldata;
     RecordContextPtr pContext;
@@ -766,7 +765,7 @@ RecordSendProtocolEvents(RecordClientsAndProtocolPtr pRCAP,
  *     it for this client.
  */
 static void
-RecordADeviceEvent(CallbackListPtr *pcbl, pointer nulldata, pointer calldata)
+RecordADeviceEvent(CallbackListPtr *pcbl, void *nulldata, void *calldata)
 {
     DeviceEventInfoRec *pei = (DeviceEventInfoRec *) calldata;
     RecordContextPtr pContext;
@@ -812,7 +811,7 @@ RecordADeviceEvent(CallbackListPtr *pcbl, pointer nulldata, pointer calldata)
  */
 static void
 RecordFlushAllContexts(CallbackListPtr *pcbl,
-                       pointer nulldata, pointer calldata)
+                       void *nulldata, void *calldata)
 {
     int eci;                    /* enabled context index */
     RecordContextPtr pContext;
@@ -1143,7 +1142,7 @@ RecordSanityCheckClientSpecifiers(ClientPtr client, XID *clientspecs,
     int i;
     int clientIndex;
     int rc;
-    pointer value;
+    void *value;
 
     for (i = 0; i < nspecs; i++) {
         if (clientspecs[i] == XRecordCurrentClients ||
@@ -1393,6 +1392,10 @@ typedef struct {
     short first, last;          /* if for extension, major opcode interval */
 } SetInfoRec, *SetInfoPtr;
 
+#if defined(ERR) && defined(__sun)
+#undef ERR /* Avoid conflict with Solaris <sys/regset.h> */
+#endif
+
 /* These constant are used to index into an array of SetInfoRec. */
 enum { REQ,                     /* set info for requests */
     REP,                        /* set info for replies */
@@ -1876,7 +1879,7 @@ ProcRecordCreateContext(ClientPtr client)
         return Success;
     }
     else {
-        RecordDeleteContext((pointer) pContext, pContext->id);
+        RecordDeleteContext((void *) pContext, pContext->id);
         return BadAlloc;
     }
  bailout:
@@ -2412,7 +2415,7 @@ ProcRecordDisableContext(ClientPtr client)
  *     it from the ppAllContexts array.
  */
 static int
-RecordDeleteContext(pointer value, XID id)
+RecordDeleteContext(void *value, XID id)
 {
     int i;
     RecordContextPtr pContext = (RecordContextPtr) value;
@@ -2531,7 +2534,7 @@ SProcRecordCreateContext(ClientPtr client)
 
     swaps(&stuff->length);
     REQUEST_AT_LEAST_SIZE(xRecordCreateContextReq);
-    if ((status = SwapCreateRegister((pointer) stuff)) != Success)
+    if ((status = SwapCreateRegister((void *) stuff)) != Success)
         return status;
     return ProcRecordCreateContext(client);
 }                               /* SProcRecordCreateContext */
@@ -2544,7 +2547,7 @@ SProcRecordRegisterClients(ClientPtr client)
 
     swaps(&stuff->length);
     REQUEST_AT_LEAST_SIZE(xRecordRegisterClientsReq);
-    if ((status = SwapCreateRegister((pointer) stuff)) != Success)
+    if ((status = SwapCreateRegister((void *) stuff)) != Success)
         return status;
     return ProcRecordRegisterClients(client);
 }                               /* SProcRecordRegisterClients */
@@ -2660,7 +2663,7 @@ RecordConnectionSetupInfo(RecordContextPtr pContext, NewClientInfoRec * pci)
         SwapConnSetupInfo((char *) pci->setup,
                           (char *) (pConnSetup + prefixsize));
         RecordAProtocolElement(pContext, pci->client, XRecordClientStarted,
-                               (pointer) pConnSetup, prefixsize + restsize, 0,
+                               (void *) pConnSetup, prefixsize + restsize, 0,
                                0);
         free(pConnSetup);
     }
@@ -2669,9 +2672,9 @@ RecordConnectionSetupInfo(RecordContextPtr pContext, NewClientInfoRec * pci)
          * data in two pieces
          */
         RecordAProtocolElement(pContext, pci->client, XRecordClientStarted,
-                               (pointer) pci->prefix, prefixsize, 0, restsize);
+                               (void *) pci->prefix, prefixsize, 0, restsize);
         RecordAProtocolElement(pContext, pci->client, XRecordClientStarted,
-                               (pointer) pci->setup, restsize, 0,
+                               (void *) pci->setup, restsize, 0,
                                /* continuation */ -1);
     }
 }                               /* RecordConnectionSetupInfo */
@@ -2700,8 +2703,8 @@ RecordConnectionSetupInfo(RecordContextPtr pContext, NewClientInfoRec * pci)
  */
 
 static void
-RecordAClientStateChange(CallbackListPtr *pcbl, pointer nulldata,
-                         pointer calldata)
+RecordAClientStateChange(CallbackListPtr *pcbl, void *nulldata,
+                         void *calldata)
 {
     NewClientInfoRec *pci = (NewClientInfoRec *) calldata;
     int i;
index ebc5b8e..69f9f88 100644 (file)
@@ -136,13 +136,15 @@ AnimCurCursorLimits(DeviceIntPtr pDev,
 
 static void
 AnimCurScreenBlockHandler(ScreenPtr pScreen,
-                          pointer pTimeout, pointer pReadmask)
+                          void *pTimeout, void *pReadmask)
 {
     AnimCurScreenPtr as = GetAnimCurScreen(pScreen);
     DeviceIntPtr dev;
     Bool activeDevice = FALSE;
     CARD32 now = 0, soonest = ~0;       /* earliest time to wakeup again */
 
+    Unwrap(as, pScreen, BlockHandler);
+
     for (dev = inputInfo.devices; dev; dev = dev->next) {
         if (IsPointerDevice(dev) && pScreen == dev->spriteInfo->anim.pScreen) {
             if (!activeDevice) {
@@ -180,7 +182,6 @@ AnimCurScreenBlockHandler(ScreenPtr pScreen,
     if (activeDevice)
         AdjustWaitForDelay(pTimeout, soonest - now);
 
-    Unwrap(as, pScreen, BlockHandler);
     (*pScreen->BlockHandler) (pScreen, pTimeout, pReadmask);
     if (activeDevice)
         Wrap(as, pScreen, BlockHandler, AnimCurScreenBlockHandler);
@@ -382,8 +383,7 @@ AnimCursorCreate(CursorPtr *cursors, CARD32 *deltas, int ncursor,
     ac->elts = (AnimCurElt *) (ac + 1);
 
     for (i = 0; i < ncursor; i++) {
-        cursors[i]->refcnt++;
-        ac->elts[i].pCursor = cursors[i];
+        ac->elts[i].pCursor = RefCursor(cursors[i]);
         ac->elts[i].delay = deltas[i];
     }
 
index e1dc662..ae38121 100644 (file)
@@ -97,7 +97,7 @@ GlyphUninit(ScreenPtr pScreen)
             glyph = globalGlyphs[fdepth].table[i].glyph;
             if (glyph && glyph != DeletedGlyph) {
                 if (GetGlyphPicture(glyph, pScreen)) {
-                    FreePicture((pointer) GetGlyphPicture(glyph, pScreen), 0);
+                    FreePicture((void *) GetGlyphPicture(glyph, pScreen), 0);
                     SetGlyphPicture(glyph, pScreen, NULL);
                 }
                 (*ps->UnrealizeGlyph) (pScreen, glyph);
@@ -237,7 +237,7 @@ FreeGlyphPicture(GlyphPtr glyph)
         ScreenPtr pScreen = screenInfo.screens[i];
 
         if (GetGlyphPicture(glyph, pScreen))
-            FreePicture((pointer) GetGlyphPicture(glyph, pScreen), 0);
+            FreePicture((void *) GetGlyphPicture(glyph, pScreen), 0);
 
         ps = GetPictureScreenIfSet(pScreen);
         if (ps)
@@ -467,7 +467,7 @@ AllocateGlyphSet(int fdepth, PictFormatPtr format)
 }
 
 int
-FreeGlyphSet(pointer value, XID gid)
+FreeGlyphSet(void *value, XID gid)
 {
     GlyphSetPtr glyphSet = (GlyphSetPtr) value;
 
@@ -678,7 +678,7 @@ miGlyphs(CARD8 op,
                          pDst,
                          xSrc + x - xDst,
                          ySrc + y - yDst, 0, 0, x, y, width, height);
-        FreePicture((pointer) pMask, (XID) 0);
+        FreePicture((void *) pMask, (XID) 0);
         (*pScreen->DestroyPixmap) (pMaskPixmap);
     }
 }
index 7d178be..835c1a7 100644 (file)
@@ -131,7 +131,7 @@ extern _X_EXPORT Bool
 extern _X_EXPORT GlyphSetPtr AllocateGlyphSet(int fdepth, PictFormatPtr format);
 
 extern _X_EXPORT int
- FreeGlyphSet(pointer value, XID gid);
+ FreeGlyphSet(void *value, XID gid);
 
 #define GLYPH_HAS_GLYPH_PICTURE_ACCESSOR 1 /* used for api compat */
 extern _X_EXPORT PicturePtr
index 2e64b20..3959fc4 100644 (file)
@@ -69,17 +69,17 @@ miDestroyPictureClip(PicturePtr pPicture)
 }
 
 int
-miChangePictureClip(PicturePtr pPicture, int type, pointer value, int n)
+miChangePictureClip(PicturePtr pPicture, int type, void *value, int n)
 {
     ScreenPtr pScreen = pPicture->pDrawable->pScreen;
     PictureScreenPtr ps = GetPictureScreen(pScreen);
-    pointer clientClip;
+    void *clientClip;
     int clientClipType;
 
     switch (type) {
     case CT_PIXMAP:
         /* convert the pixmap to a region */
-        clientClip = (pointer) BitmapToRegion(pScreen, (PixmapPtr) value);
+        clientClip = (void *) BitmapToRegion(pScreen, (PixmapPtr) value);
         if (!clientClip)
             return BadAlloc;
         clientClipType = CT_REGION;
@@ -94,7 +94,7 @@ miChangePictureClip(PicturePtr pPicture, int type, pointer value, int n)
         clientClipType = CT_NONE;
         break;
     default:
-        clientClip = (pointer) RegionFromRects(n, (xRectangle *) value, type);
+        clientClip = (void *) RegionFromRects(n, (xRectangle *) value, type);
         if (!clientClip)
             return BadAlloc;
         clientClipType = CT_REGION;
index 9436228..a16dd31 100644 (file)
@@ -57,7 +57,7 @@ extern _X_EXPORT void
  miDestroyPictureClip(PicturePtr pPicture);
 
 extern _X_EXPORT int
- miChangePictureClip(PicturePtr pPicture, int type, pointer value, int n);
+ miChangePictureClip(PicturePtr pPicture, int type, void *value, int n);
 
 extern _X_EXPORT void
  miChangePicture(PicturePtr pPicture, Mask mask);
index 357d528..4e76972 100644 (file)
@@ -156,7 +156,7 @@ miCompositeRects(CARD8 op,
             rects++;
         }
 
-        FreePicture((pointer) pSrc, 0);
+        FreePicture((void *) pSrc, 0);
  bail4:
         FreeScratchGC(pGC);
  bail3:
index 2908b76..7da9310 100644 (file)
@@ -70,7 +70,7 @@ PictureDestroyWindow(WindowPtr pWindow)
         SetPictureWindow(pWindow, pPicture->pNext);
         if (pPicture->id)
             FreeResource(pPicture->id, PictureType);
-        FreePicture((pointer) pPicture, pPicture->id);
+        FreePicture((void *) pPicture, pPicture->id);
     }
     pScreen->DestroyWindow = ps->DestroyWindow;
     ret = (*pScreen->DestroyWindow) (pWindow);
@@ -445,7 +445,7 @@ PictureInitIndexedFormat(ScreenPtr pScreen, PictFormatPtr format)
         return TRUE;
 
     if (format->index.vid == pScreen->rootVisual) {
-        dixLookupResourceByType((pointer *) &format->index.pColormap,
+        dixLookupResourceByType((void **) &format->index.pColormap,
                                 pScreen->defColormap, RT_COLORMAP,
                                 serverClient, DixGetAttrAccess);
     }
@@ -601,7 +601,7 @@ PictureParseCmapPolicy(const char *name)
 
 /** @see GetDefaultBytes */
 static void
-GetPictureBytes(pointer value, XID id, ResourceSizePtr size)
+GetPictureBytes(void *value, XID id, ResourceSizePtr size)
 {
     PicturePtr picture = value;
 
@@ -655,7 +655,7 @@ PictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats)
     }
     for (n = 0; n < nformats; n++) {
         if (!AddResource
-            (formats[n].id, PictFormatType, (pointer) (formats + n))) {
+            (formats[n].id, PictFormatType, (void *) (formats + n))) {
             free(formats);
             return FALSE;
         }
@@ -1054,7 +1054,7 @@ ChangePicture(PicturePtr pPicture,
                 if (pid == None)
                     pAlpha = 0;
                 else {
-                    error = dixLookupResourceByType((pointer *) &pAlpha, pid,
+                    error = dixLookupResourceByType((void **) &pAlpha, pid,
                                                     PictureType, client,
                                                     DixReadAccess);
                     if (error != Success) {
@@ -1075,7 +1075,7 @@ ChangePicture(PicturePtr pPicture,
                 if (pAlpha && pAlpha->pDrawable->type == DRAWABLE_PIXMAP)
                     pAlpha->refcnt++;
                 if (pPicture->alphaMap)
-                    FreePicture((pointer) pPicture->alphaMap, (XID) 0);
+                    FreePicture((void *) pPicture->alphaMap, (XID) 0);
                 pPicture->alphaMap = pAlpha;
             }
         }
@@ -1113,7 +1113,7 @@ ChangePicture(PicturePtr pPicture,
                 }
                 else {
                     clipType = CT_PIXMAP;
-                    error = dixLookupResourceByType((pointer *) &pPixmap, pid,
+                    error = dixLookupResourceByType((void **) &pPixmap, pid,
                                                     RT_PIXMAP, client,
                                                     DixReadAccess);
                     if (error != Success) {
@@ -1143,7 +1143,7 @@ ChangePicture(PicturePtr pPicture,
                 }
             }
             error = (*ps->ChangePictureClip) (pPicture, clipType,
-                                              (pointer) pPixmap, 0);
+                                              (void *) pPixmap, 0);
             break;
         }
         case CPGraphicsExposure:
@@ -1240,7 +1240,7 @@ SetPictureClipRects(PicturePtr pPicture,
     if (!clientClip)
         return BadAlloc;
     result = (*ps->ChangePictureClip) (pPicture, CT_REGION,
-                                       (pointer) clientClip, 0);
+                                       (void *) clientClip, 0);
     if (result == Success) {
         pPicture->clipOrigin.x = xOrigin;
         pPicture->clipOrigin.y = yOrigin;
@@ -1276,7 +1276,7 @@ SetPictureClipRegion(PicturePtr pPicture,
         clientClip = 0;
     }
 
-    result = (*ps->ChangePictureClip) (pPicture, type, (pointer) clientClip, 0);
+    result = (*ps->ChangePictureClip) (pPicture, type, (void *) clientClip, 0);
     if (result == Success) {
         pPicture->clipOrigin.x = xOrigin;
         pPicture->clipOrigin.y = yOrigin;
@@ -1354,7 +1354,7 @@ CopyPicture(PicturePtr pSrc, Mask mask, PicturePtr pDst)
                 pSrc->alphaMap->pDrawable->type == DRAWABLE_PIXMAP)
                 pSrc->alphaMap->refcnt++;
             if (pDst->alphaMap)
-                FreePicture((pointer) pDst->alphaMap, (XID) 0);
+                FreePicture((void *) pDst->alphaMap, (XID) 0);
             pDst->alphaMap = pSrc->alphaMap;
             break;
         case CPAlphaXOrigin:
@@ -1435,7 +1435,7 @@ ValidatePicture(PicturePtr pPicture)
 }
 
 int
-FreePicture(pointer value, XID pid)
+FreePicture(void *value, XID pid)
 {
     PicturePtr pPicture = (PicturePtr) value;
 
@@ -1454,7 +1454,7 @@ FreePicture(pointer value, XID pid)
             PictureScreenPtr ps = GetPictureScreen(pScreen);
 
             if (pPicture->alphaMap)
-                FreePicture((pointer) pPicture->alphaMap, (XID) 0);
+                FreePicture((void *) pPicture->alphaMap, (XID) 0);
             (*ps->DestroyPicture) (pPicture);
             (*ps->DestroyPictureClip) (pPicture);
             if (pPicture->pDrawable->type == DRAWABLE_WINDOW) {
@@ -1480,7 +1480,7 @@ FreePicture(pointer value, XID pid)
 }
 
 int
-FreePictFormat(pointer pPictFormat, XID pid)
+FreePictFormat(void *pPictFormat, XID pid)
 {
     return Success;
 }
index dc00f41..8c8100d 100644 (file)
@@ -145,7 +145,7 @@ typedef struct _Picture {
     DDXPointRec alphaOrigin;
 
     DDXPointRec clipOrigin;
-    pointer clientClip;
+    void *clientClip;
 
     unsigned long serialNumber;
 
@@ -189,7 +189,7 @@ typedef struct {
 typedef int (*CreatePictureProcPtr) (PicturePtr pPicture);
 typedef void (*DestroyPictureProcPtr) (PicturePtr pPicture);
 typedef int (*ChangePictureClipProcPtr) (PicturePtr pPicture,
-                                         int clipType, pointer value, int n);
+                                         int clipType, void *value, int n);
 typedef void (*DestroyPictureClipProcPtr) (PicturePtr pPicture);
 
 typedef int (*ChangePictureTransformProcPtr) (PicturePtr pPicture,
@@ -363,10 +363,10 @@ extern _X_EXPORT RESTYPE GlyphSetType;
 #define SetPictureWindow(w,p) dixSetPrivate(&(w)->devPrivates, PictureWindowPrivateKey, p)
 
 #define VERIFY_PICTURE(pPicture, pid, client, mode) {\
-    int rc = dixLookupResourceByType((pointer)&(pPicture), pid,\
-                                    PictureType, client, mode);\
-    if (rc != Success)\
-       return rc;\
+    int tmprc = dixLookupResourceByType((void *)&(pPicture), pid,\
+                                       PictureType, client, mode);\
+    if (tmprc != Success)\
+       return tmprc;\
 }
 
 #define VERIFY_ALPHA(pPicture, pid, client, mode) {\
@@ -482,10 +482,10 @@ extern _X_EXPORT void
  ValidatePicture(PicturePtr pPicture);
 
 extern _X_EXPORT int
- FreePicture(pointer pPicture, XID pid);
+ FreePicture(void *pPicture, XID pid);
 
 extern _X_EXPORT int
- FreePictFormat(pointer pPictFormat, XID pid);
+ FreePictFormat(void *pPictFormat, XID pid);
 
 extern _X_EXPORT void
 
index 51f75ae..9ac4a98 100644 (file)
@@ -220,7 +220,7 @@ typedef struct _RenderClient {
 #define GetRenderClient(pClient) ((RenderClientPtr)dixLookupPrivate(&(pClient)->devPrivates, RenderClientPrivateKey))
 
 static void
-RenderClientCallback(CallbackListPtr *list, pointer closure, pointer data)
+RenderClientCallback(CallbackListPtr *list, void *closure, void *data)
 {
     NewClientInfoRec *clientinfo = (NewClientInfoRec *) data;
     ClientPtr pClient = clientinfo->client;
@@ -520,7 +520,7 @@ ProcRenderQueryPictIndexValues(ClientPtr client)
 
     REQUEST_AT_LEAST_SIZE(xRenderQueryPictIndexValuesReq);
 
-    rc = dixLookupResourceByType((pointer *) &pFormat, stuff->format,
+    rc = dixLookupResourceByType((void **) &pFormat, stuff->format,
                                  PictFormatType, client, DixReadAccess);
     if (rc != Success)
         return rc;
@@ -587,7 +587,7 @@ ProcRenderCreatePicture(ClientPtr client)
     if (rc != Success)
         return rc;
 
-    rc = dixLookupResourceByType((pointer *) &pFormat, stuff->format,
+    rc = dixLookupResourceByType((void **) &pFormat, stuff->format,
                                  PictFormatType, client, DixReadAccess);
     if (rc != Success)
         return rc;
@@ -604,7 +604,7 @@ ProcRenderCreatePicture(ClientPtr client)
                              stuff->mask, (XID *) (stuff + 1), client, &error);
     if (!pPicture)
         return error;
-    if (!AddResource(stuff->pid, PictureType, (pointer) pPicture))
+    if (!AddResource(stuff->pid, PictureType, (void *) pPicture))
         return BadAlloc;
     return Success;
 }
@@ -638,7 +638,7 @@ ProcRenderSetPictureClipRectangles(ClientPtr client)
     REQUEST_AT_LEAST_SIZE(xRenderSetPictureClipRectanglesReq);
     VERIFY_PICTURE(pPicture, stuff->picture, client, DixSetAttrAccess);
     if (!pPicture->pDrawable)
-        return BadDrawable;
+        return RenderErrBase + BadPicture;
 
     nr = (client->req_len << 2) - sizeof(xRenderSetPictureClipRectanglesReq);
     if (nr & 4)
@@ -744,7 +744,7 @@ ProcRenderTrapezoids(ClientPtr client)
     if (pSrc->pDrawable && pSrc->pDrawable->pScreen != pDst->pDrawable->pScreen)
         return BadMatch;
     if (stuff->maskFormat) {
-        rc = dixLookupResourceByType((pointer *) &pFormat, stuff->maskFormat,
+        rc = dixLookupResourceByType((void **) &pFormat, stuff->maskFormat,
                                      PictFormatType, client, DixReadAccess);
         if (rc != Success)
             return rc;
@@ -783,7 +783,7 @@ ProcRenderTriangles(ClientPtr client)
     if (pSrc->pDrawable && pSrc->pDrawable->pScreen != pDst->pDrawable->pScreen)
         return BadMatch;
     if (stuff->maskFormat) {
-        rc = dixLookupResourceByType((pointer *) &pFormat, stuff->maskFormat,
+        rc = dixLookupResourceByType((void **) &pFormat, stuff->maskFormat,
                                      PictFormatType, client, DixReadAccess);
         if (rc != Success)
             return rc;
@@ -822,7 +822,7 @@ ProcRenderTriStrip(ClientPtr client)
     if (pSrc->pDrawable && pSrc->pDrawable->pScreen != pDst->pDrawable->pScreen)
         return BadMatch;
     if (stuff->maskFormat) {
-        rc = dixLookupResourceByType((pointer *) &pFormat, stuff->maskFormat,
+        rc = dixLookupResourceByType((void **) &pFormat, stuff->maskFormat,
                                      PictFormatType, client, DixReadAccess);
         if (rc != Success)
             return rc;
@@ -861,7 +861,7 @@ ProcRenderTriFan(ClientPtr client)
     if (pSrc->pDrawable && pSrc->pDrawable->pScreen != pDst->pDrawable->pScreen)
         return BadMatch;
     if (stuff->maskFormat) {
-        rc = dixLookupResourceByType((pointer *) &pFormat, stuff->maskFormat,
+        rc = dixLookupResourceByType((void **) &pFormat, stuff->maskFormat,
                                      PictFormatType, client, DixReadAccess);
         if (rc != Success)
             return rc;
@@ -909,7 +909,7 @@ ProcRenderCreateGlyphSet(ClientPtr client)
     REQUEST_SIZE_MATCH(xRenderCreateGlyphSetReq);
 
     LEGAL_NEW_RESOURCE(stuff->gsid, client);
-    rc = dixLookupResourceByType((pointer *) &format, stuff->format,
+    rc = dixLookupResourceByType((void **) &format, stuff->format,
                                  PictFormatType, client, DixReadAccess);
     if (rc != Success)
         return rc;
@@ -943,7 +943,7 @@ ProcRenderCreateGlyphSet(ClientPtr client)
                   glyphSet, RT_NONE, NULL, DixCreateAccess);
     if (rc != Success)
         return rc;
-    if (!AddResource(stuff->gsid, GlyphSetType, (pointer) glyphSet))
+    if (!AddResource(stuff->gsid, GlyphSetType, (void *) glyphSet))
         return BadAlloc;
     return Success;
 }
@@ -960,14 +960,14 @@ ProcRenderReferenceGlyphSet(ClientPtr client)
 
     LEGAL_NEW_RESOURCE(stuff->gsid, client);
 
-    rc = dixLookupResourceByType((pointer *) &glyphSet, stuff->existing,
+    rc = dixLookupResourceByType((void **) &glyphSet, stuff->existing,
                                  GlyphSetType, client, DixGetAttrAccess);
     if (rc != Success) {
         client->errorValue = stuff->existing;
         return rc;
     }
     glyphSet->refcnt++;
-    if (!AddResource(stuff->gsid, GlyphSetType, (pointer) glyphSet))
+    if (!AddResource(stuff->gsid, GlyphSetType, (void *) glyphSet))
         return BadAlloc;
     return Success;
 }
@@ -984,7 +984,7 @@ ProcRenderFreeGlyphSet(ClientPtr client)
     REQUEST(xRenderFreeGlyphSetReq);
 
     REQUEST_SIZE_MATCH(xRenderFreeGlyphSetReq);
-    rc = dixLookupResourceByType((pointer *) &glyphSet, stuff->glyphset,
+    rc = dixLookupResourceByType((void **) &glyphSet, stuff->glyphset,
                                  GlyphSetType, client, DixDestroyAccess);
     if (rc != Success) {
         client->errorValue = stuff->glyphset;
@@ -1024,7 +1024,7 @@ ProcRenderAddGlyphs(ClientPtr client)
 
     REQUEST_AT_LEAST_SIZE(xRenderAddGlyphsReq);
     err =
-        dixLookupResourceByType((pointer *) &glyphSet, stuff->glyphset,
+        dixLookupResourceByType((void **) &glyphSet, stuff->glyphset,
                                 GlyphSetType, client, DixAddAccess);
     if (err != Success) {
         client->errorValue = stuff->glyphset;
@@ -1157,7 +1157,7 @@ ProcRenderAddGlyphs(ClientPtr client)
                                  pSrc,
                                  None, pDst, 0, 0, 0, 0, 0, 0, width, height);
 
-                FreePicture((pointer) pSrc, 0);
+                FreePicture((void *) pSrc, 0);
                 pSrc = NULL;
                 FreeScratchPixmapHeader(pSrcPix);
                 pSrcPix = NULL;
@@ -1189,7 +1189,7 @@ ProcRenderAddGlyphs(ClientPtr client)
     return Success;
  bail:
     if (pSrc)
-        FreePicture((pointer) pSrc, 0);
+        FreePicture((void *) pSrc, 0);
     if (pSrcPix)
         FreeScratchPixmapHeader(pSrcPix);
     for (i = 0; i < nglyphs; i++)
@@ -1216,7 +1216,7 @@ ProcRenderFreeGlyphs(ClientPtr client)
     CARD32 glyph;
 
     REQUEST_AT_LEAST_SIZE(xRenderFreeGlyphsReq);
-    rc = dixLookupResourceByType((pointer *) &glyphSet, stuff->glyphset,
+    rc = dixLookupResourceByType((void **) &glyphSet, stuff->glyphset,
                                  GlyphSetType, client, DixRemoveAccess);
     if (rc != Success) {
         client->errorValue = stuff->glyphset;
@@ -1282,7 +1282,7 @@ ProcRenderCompositeGlyphs(ClientPtr client)
     if (pSrc->pDrawable && pSrc->pDrawable->pScreen != pDst->pDrawable->pScreen)
         return BadMatch;
     if (stuff->maskFormat) {
-        rc = dixLookupResourceByType((pointer *) &pFormat, stuff->maskFormat,
+        rc = dixLookupResourceByType((void **) &pFormat, stuff->maskFormat,
                                      PictFormatType, client, DixReadAccess);
         if (rc != Success)
             return rc;
@@ -1290,7 +1290,7 @@ ProcRenderCompositeGlyphs(ClientPtr client)
     else
         pFormat = 0;
 
-    rc = dixLookupResourceByType((pointer *) &glyphSet, stuff->glyphset,
+    rc = dixLookupResourceByType((void **) &glyphSet, stuff->glyphset,
                                  GlyphSetType, client, DixUseAccess);
     if (rc != Success)
         return rc;
@@ -1341,7 +1341,7 @@ ProcRenderCompositeGlyphs(ClientPtr client)
         if (elt->len == 0xff) {
             if (buffer + sizeof(GlyphSet) < end) {
                 memcpy(&gs, buffer, sizeof(GlyphSet));
-                rc = dixLookupResourceByType((pointer *) &glyphSet, gs,
+                rc = dixLookupResourceByType((void **) &glyphSet, gs,
                                              GlyphSetType, client,
                                              DixUseAccess);
                 if (rc != Success)
@@ -1508,7 +1508,7 @@ ProcRenderCreateCursor(ClientPtr client)
     if (pSrc->format == PICT_a8r8g8b8) {
         (*pScreen->GetImage) (pSrc->pDrawable,
                               0, 0, width, height, ZPixmap,
-                              0xffffffff, (pointer) argbbits);
+                              0xffffffff, (void *) argbbits);
     }
     else {
         PixmapPtr pPixmap;
@@ -1544,7 +1544,7 @@ ProcRenderCreateCursor(ClientPtr client)
                          pSrc, 0, pPicture, 0, 0, 0, 0, 0, 0, width, height);
         (*pScreen->GetImage) (pPicture->pDrawable,
                               0, 0, width, height, ZPixmap,
-                              0xffffffff, (pointer) argbbits);
+                              0xffffffff, (void *) argbbits);
         FreePicture(pPicture, 0);
     }
     /*
@@ -1633,7 +1633,7 @@ ProcRenderCreateCursor(ClientPtr client)
                          &pCursor, client, stuff->cid);
     if (rc != Success)
         goto bail;
-    if (!AddResource(stuff->cid, RT_CURSOR, (pointer) pCursor)) {
+    if (!AddResource(stuff->cid, RT_CURSOR, (void *) pCursor)) {
         rc = BadAlloc;
         goto bail;
     }
@@ -1799,7 +1799,7 @@ ProcRenderCreateAnimCursor(ClientPtr client)
     deltas = (CARD32 *) (cursors + ncursor);
     elt = (xAnimCursorElt *) (stuff + 1);
     for (i = 0; i < ncursor; i++) {
-        ret = dixLookupResourceByType((pointer *) (cursors + i), elt->cursor,
+        ret = dixLookupResourceByType((void **) (cursors + i), elt->cursor,
                                       RT_CURSOR, client, DixReadAccess);
         if (ret != Success) {
             free(cursors);
@@ -1814,7 +1814,7 @@ ProcRenderCreateAnimCursor(ClientPtr client)
     if (ret != Success)
         return ret;
 
-    if (AddResource(stuff->cid, RT_CURSOR, (pointer) pCursor))
+    if (AddResource(stuff->cid, RT_CURSOR, (void *) pCursor))
         return Success;
     return BadAlloc;
 }
@@ -1861,7 +1861,7 @@ ProcRenderCreateSolidFill(ClientPtr client)
                      pPicture, RT_NONE, NULL, DixCreateAccess);
     if (error != Success)
         return error;
-    if (!AddResource(stuff->pid, PictureType, (pointer) pPicture))
+    if (!AddResource(stuff->pid, PictureType, (void *) pPicture))
         return BadAlloc;
     return Success;
 }
@@ -1900,7 +1900,7 @@ ProcRenderCreateLinearGradient(ClientPtr client)
                      pPicture, RT_NONE, NULL, DixCreateAccess);
     if (error != Success)
         return error;
-    if (!AddResource(stuff->pid, PictureType, (pointer) pPicture))
+    if (!AddResource(stuff->pid, PictureType, (void *) pPicture))
         return BadAlloc;
     return Success;
 }
@@ -1938,7 +1938,7 @@ ProcRenderCreateRadialGradient(ClientPtr client)
                      pPicture, RT_NONE, NULL, DixCreateAccess);
     if (error != Success)
         return error;
-    if (!AddResource(stuff->pid, PictureType, (pointer) pPicture))
+    if (!AddResource(stuff->pid, PictureType, (void *) pPicture))
         return BadAlloc;
     return Success;
 }
@@ -1975,7 +1975,7 @@ ProcRenderCreateConicalGradient(ClientPtr client)
                      pPicture, RT_NONE, NULL, DixCreateAccess);
     if (error != Success)
         return error;
-    if (!AddResource(stuff->pid, PictureType, (pointer) pPicture))
+    if (!AddResource(stuff->pid, PictureType, (void *) pPicture))
         return BadAlloc;
     return Success;
 }
@@ -2566,7 +2566,7 @@ SProcRenderDispatch(ClientPtr client)
 
 #ifdef PANORAMIX
 #define VERIFY_XIN_PICTURE(pPicture, pid, client, mode) {\
-    int rc = dixLookupResourceByType((pointer *)&(pPicture), pid,\
+    int rc = dixLookupResourceByType((void **)&(pPicture), pid,\
                                      XRT_PICTURE, client, mode);\
     if (rc != Success)\
        return rc;\
@@ -2590,7 +2590,7 @@ PanoramiXRenderCreatePicture(ClientPtr client)
     int result, j;
 
     REQUEST_AT_LEAST_SIZE(xRenderCreatePictureReq);
-    result = dixLookupResourceByClass((pointer *) &refDraw, stuff->drawable,
+    result = dixLookupResourceByClass((void **) &refDraw, stuff->drawable,
                                       XRC_DRAWABLE, client, DixWriteAccess);
     if (result != Success)
         return (result == BadValue) ? BadDrawable : result;
index 34f53fc..32edc7a 100644 (file)
@@ -1,11 +1,11 @@
 if ENABLE_UNIT_TESTS
 SUBDIRS= .
-noinst_PROGRAMS = list string touch
+noinst_PROGRAMS = list string
 if XORG
 # Tests that require at least some DDX functions in order to fully link
 # For now, requires xf86 ddx, could be adjusted to use another
 SUBDIRS += xi2
-noinst_PROGRAMS += xkb input xtest misc fixes xfree86 hashtabletest os signal-logging
+noinst_PROGRAMS += xkb input xtest misc fixes xfree86 hashtabletest os signal-logging touch
 endif
 check_LTLIBRARIES = libxservertest.la
 
@@ -13,13 +13,13 @@ TESTS=$(noinst_PROGRAMS)
 TESTS_ENVIRONMENT = $(XORG_MALLOC_DEBUG_ENV)
 
 AM_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@
-INCLUDES = $(XORG_INCS) -I$(top_srcdir)/miext/cw
+AM_CPPFLAGS = $(XORG_INCS) -I$(top_srcdir)/miext/cw
 if XORG
-INCLUDES += -I$(top_srcdir)/hw/xfree86/parser \
+AM_CPPFLAGS += -I$(top_srcdir)/hw/xfree86/parser \
        -I$(top_srcdir)/hw/xfree86/ddc \
        -I$(top_srcdir)/hw/xfree86/i2c -I$(top_srcdir)/hw/xfree86/modes \
        -I$(top_srcdir)/hw/xfree86/ramdac -I$(top_srcdir)/hw/xfree86/dri \
-       -I$(top_srcdir)/hw/xfree86/dri2
+       -I$(top_srcdir)/hw/xfree86/dri2 -I$(top_srcdir)/dri3
 endif
 TEST_LDADD=libxservertest.la $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) $(GLX_SYS_LIBS)
 
@@ -30,19 +30,18 @@ endif
 xkb_LDADD=$(TEST_LDADD)
 input_LDADD=$(TEST_LDADD)
 xtest_LDADD=$(TEST_LDADD)
-list_LDADD=$(TEST_LDADD)
 misc_LDADD=$(TEST_LDADD)
 fixes_LDADD=$(TEST_LDADD)
 xfree86_LDADD=$(TEST_LDADD)
 touch_LDADD=$(TEST_LDADD)
 signal_logging_LDADD=$(TEST_LDADD)
-hashtabletest_LDADD=$(TEST_LDADD) $(top_srcdir)/Xext/hashtable.c
+hashtabletest_LDADD=$(TEST_LDADD)
 os_LDADD=$(TEST_LDADD)
 
 libxservertest_la_LIBADD = $(XSERVER_LIBS)
 if XORG
 
-nodist_libxservertest_la_SOURCES = $(top_builddir)/hw/xfree86/sdksyms.c
+nodist_libxservertest_la_SOURCES = sdksyms.c
 libxservertest_la_LIBADD += \
             $(top_builddir)/hw/xfree86/loader/libloader.la \
             $(top_builddir)/hw/xfree86/os-support/libxorgos.la \
@@ -56,6 +55,12 @@ libxservertest_la_LIBADD += \
             $(top_builddir)/hw/xfree86/dixmods/libxorgxkb.la \
             @XORG_LIBS@
 
+BUILT_SOURCES = sdksyms.c
+CLEANFILES = sdksyms.c
+
+sdksyms.c: $(top_builddir)/hw/xfree86/sdksyms.c
+       $(AM_V_GEN)$(LN_S) $(top_builddir)/hw/xfree86/sdksyms.c
+
 if DRI
 libxservertest_la_LIBADD += $(top_builddir)/hw/xfree86/dri/libdri.la
 endif
@@ -64,12 +69,14 @@ if DRI2
 libxservertest_la_LIBADD += $(top_builddir)/hw/xfree86/dri2/libdri2.la
 endif
 
+if DRI3
+libxservertest_la_LIBADD += $(top_builddir)/dri3/libdri3.la
+endif
+
 else
 nodist_libxservertest_la_SOURCES = \
             ddxstubs.c \
-            $(top_srcdir)/mi/miinitext.c \
-            $(top_srcdir)/Xext/dpmsstubs.c \
-            $(top_srcdir)/Xi/stubs.c
+            $(top_srcdir)/mi/miinitext.c
 
 libxservertest_la_LIBADD += \
             $(top_builddir)/damageext/libdamageext.la \
@@ -80,7 +87,9 @@ libxservertest_la_LIBADD += \
             $(top_builddir)/randr/librandr.la \
             $(top_builddir)/render/librender.la \
             $(top_builddir)/Xext/libXext.la \
+            $(top_builddir)/Xext/libXextdpmsstubs.la \
             $(top_builddir)/Xi/libXi.la \
+            $(top_builddir)/Xi/libXistubs.la \
             $(top_builddir)/xfixes/libxfixes.la \
             $(top_builddir)/xkb/libxkb.la \
             $(top_builddir)/xkb/libxkbstubs.la
@@ -105,6 +114,11 @@ libxservertest_la_LIBADD += \
             $(top_builddir)/record/librecord.la
 endif
 
+if DRI3
+libxservertest_la_LIBADD += \
+            $(top_builddir)/dri3/libdri3.la
+endif
+
 if XQUARTZ
 libxservertest_la_LIBADD += \
             $(top_builddir)/miext/rootless/librootless.la
index 7807c73..4ac6750 100644 (file)
@@ -265,6 +265,32 @@ fixes_pointer_barriers_test(void)
     x2 = x + 100;
     assert(!barrier_is_blocking(&barrier, x1, y1, x2, y2, &distance));
 
+    /* ray vert barrier */
+    barrier.x1 = x;
+    barrier.x2 = x;
+    barrier.y1 = -1;
+    barrier.y2 = y + 100;
+
+    /* ray barrier simple case */
+    y1 = y;
+    y2 = y;
+    x1 = x + 50;
+    x2 = x - 50;
+    assert(barrier_is_blocking(&barrier, x1, y1, x2, y2, &distance));
+
+    /* endpoint outside y range; should be blocked */
+    y1 = y - 1000;
+    y2 = y - 1000;
+    x1 = x + 50;
+    x2 = x - 50;
+    assert(barrier_is_blocking(&barrier, x1, y1, x2, y2, &distance));
+
+    /* endpoint outside y range */
+    y1 = y + 150;
+    y2 = y + 150;
+    x1 = x + 50;
+    x2 = x - 50;
+    assert(!barrier_is_blocking(&barrier, x1, y1, x2, y2, &distance));
 }
 
 static void
index 64c7091..86a0c58 100644 (file)
@@ -1,3 +1,7 @@
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
 #include <misc.h>
 #include <stdlib.h>
 #include <stdio.h>
@@ -8,7 +12,7 @@ static void
 print_xid(void* ptr, void* v)
 {
     XID *x = v;
-    printf("%ld", *x);
+    printf("%ld", (long)(*x));
 }
 
 static void
@@ -22,7 +26,6 @@ static int
 test1(void)
 {
     HashTable h;
-    XID id;
     int c;
     int ok = 1;
     const int numKeys = 420;
@@ -32,7 +35,7 @@ test1(void)
 
     for (c = 0; c < numKeys; ++c) {
       int *dest;
-      id = c;
+      XID id = c;
       dest = ht_add(h, &id);
       if (dest) {
         *dest = 2 * c;
@@ -81,7 +84,6 @@ static int
 test2(void)
 {
     HashTable h;
-    XID id;
     int c;
     int ok = 1;
     const int numKeys = 420;
@@ -90,7 +92,7 @@ test2(void)
     h = ht_create(sizeof(XID), 0, ht_resourceid_hash, ht_resourceid_compare, NULL);
 
     for (c = 0; c < numKeys; ++c) {
-      id = c;
+      XID id = c;
       ht_add(h, &id);
     }
 
index 191c817..a4615c9 100644 (file)
@@ -406,7 +406,7 @@ _dix_test_xi_convert(DeviceEvent *ev, int expected_rc, int expected_count)
         assert(kbp->same_screen == FALSE);
 
         while (--count > 0) {
-            deviceValuator *v = (deviceValuator *) & xi[count];
+            deviceValuator *v = (deviceValuator *) &xi[count];
 
             assert(v->type == DeviceValuator);
             assert(v->num_valuators <= 6);
@@ -1180,50 +1180,54 @@ cmp_attr_fields(InputAttributes * attr1, InputAttributes * attr2)
 static void
 dix_input_attributes(void)
 {
-    InputAttributes orig = { 0 };
+    InputAttributes *orig;
     InputAttributes *new;
-    char *tags[4] = { "tag1", "tag2", "tag2", NULL };
 
     new = DuplicateInputAttributes(NULL);
     assert(!new);
 
-    new = DuplicateInputAttributes(&orig);
-    assert(memcmp(&orig, new, sizeof(InputAttributes)) == 0);
+    orig = calloc(1, sizeof(InputAttributes));
+    assert(orig);
 
-    orig.product = "product name";
-    new = DuplicateInputAttributes(&orig);
-    cmp_attr_fields(&orig, new);
+    new = DuplicateInputAttributes(orig);
+    assert(memcmp(orig, new, sizeof(InputAttributes)) == 0);
+
+    orig->product = xnfstrdup("product name");
+    new = DuplicateInputAttributes(orig);
+    cmp_attr_fields(orig, new);
     FreeInputAttributes(new);
 
-    orig.vendor = "vendor name";
-    new = DuplicateInputAttributes(&orig);
-    cmp_attr_fields(&orig, new);
+    orig->vendor = xnfstrdup("vendor name");
+    new = DuplicateInputAttributes(orig);
+    cmp_attr_fields(orig, new);
     FreeInputAttributes(new);
 
-    orig.device = "device path";
-    new = DuplicateInputAttributes(&orig);
-    cmp_attr_fields(&orig, new);
+    orig->device = xnfstrdup("device path");
+    new = DuplicateInputAttributes(orig);
+    cmp_attr_fields(orig, new);
     FreeInputAttributes(new);
 
-    orig.pnp_id = "PnPID";
-    new = DuplicateInputAttributes(&orig);
-    cmp_attr_fields(&orig, new);
+    orig->pnp_id = xnfstrdup("PnPID");
+    new = DuplicateInputAttributes(orig);
+    cmp_attr_fields(orig, new);
     FreeInputAttributes(new);
 
-    orig.usb_id = "USBID";
-    new = DuplicateInputAttributes(&orig);
-    cmp_attr_fields(&orig, new);
+    orig->usb_id = xnfstrdup("USBID");
+    new = DuplicateInputAttributes(orig);
+    cmp_attr_fields(orig, new);
     FreeInputAttributes(new);
 
-    orig.flags = 0xF0;
-    new = DuplicateInputAttributes(&orig);
-    cmp_attr_fields(&orig, new);
+    orig->flags = 0xF0;
+    new = DuplicateInputAttributes(orig);
+    cmp_attr_fields(orig, new);
     FreeInputAttributes(new);
 
-    orig.tags = tags;
-    new = DuplicateInputAttributes(&orig);
-    cmp_attr_fields(&orig, new);
+    orig->tags = xstrtokenize("tag1 tag2 tag3", " ");
+    new = DuplicateInputAttributes(orig);
+    cmp_attr_fields(orig, new);
     FreeInputAttributes(new);
+
+    FreeInputAttributes(orig);
 }
 
 static void
@@ -1384,10 +1388,10 @@ dix_valuator_alloc(void)
 
         assert(v);
         assert(v->numAxes == num_axes);
-#if !defined(__i386__) && !defined(__sh__)
+#if !defined(__i386__) && !defined(__m68k__) && !defined(__sh__)
         /* must be double-aligned on 64 bit */
-        assert(((void *) v->axisVal - (void *) v) % sizeof(double) == 0);
-        assert(((void *) v->axes - (void *) v) % sizeof(double) == 0);
+        assert(offsetof(struct _ValuatorClassRec, axisVal) % sizeof(double) == 0);
+        assert(offsetof(struct _ValuatorClassRec, axes) % sizeof(double) == 0);
 #endif
         num_axes++;
     }
@@ -1708,6 +1712,18 @@ mieq_test_event_handler(int screenNum, InternalEvent *ie, DeviceIntPtr dev)
 static void
 _mieq_test_generate_events(uint32_t start, uint32_t count)
 {
+    static DeviceIntRec dev;
+    static SpriteInfoRec spriteInfo;
+    static SpriteRec sprite;
+
+    memset(&dev, 0, sizeof(dev));
+    memset(&spriteInfo, 0, sizeof(spriteInfo));
+    memset(&sprite, 0, sizeof(sprite));
+    dev.spriteInfo = &spriteInfo;
+    spriteInfo.sprite = &sprite;
+
+    dev.enabled = 1;
+
     count += start;
     while (start < count) {
         RawDeviceEvent e = { 0 };
@@ -1717,7 +1733,7 @@ _mieq_test_generate_events(uint32_t start, uint32_t count)
         e.time = GetTimeInMillis();
         e.flags = start;
 
-        mieqEnqueue(NULL, (InternalEvent *) &e);
+        mieqEnqueue(&dev, (InternalEvent *) &e);
 
         start++;
     }
index 2d005a0..d85dcff 100644 (file)
--- a/test/os.c
+++ b/test/os.c
@@ -150,10 +150,10 @@ static void block_sigio_test_nested(void)
        tail guard must be hit.
      */
     void (*old_handler)(int);
-    old_handler = signal(SIGIO, sighandler);
+    old_handler = OsSignal(SIGIO, sighandler);
     expect_signal = 1;
     assert(raise(SIGIO) == 0);
-    assert(signal(SIGIO, old_handler) == sighandler);
+    assert(OsSignal(SIGIO, old_handler) == sighandler);
 #endif
 }
 
index 810bd20..4320121 100644 (file)
@@ -41,15 +41,41 @@ struct signed_number_format_test {
     char string[21];
 };
 
+struct float_number_format_test {
+    double number;
+    char string[21];
+};
+
+static Bool
+check_signed_number_format_test(long int number)
+{
+    char string[21];
+    char expected[21];
+
+    sprintf(expected, "%ld", number);
+    FormatInt64(number, string);
+    if(strncmp(string, expected, 21) != 0) {
+        fprintf(stderr, "Failed to convert %jd to decimal string (expected %s but got %s)\n",
+                (intmax_t) number, expected, string);
+        return FALSE;
+    }
+
+    return TRUE;
+}
+
 static Bool
-check_signed_number_format_test(const struct signed_number_format_test *test)
+check_float_format_test(double number)
 {
     char string[21];
+    char expected[21];
+
+    /* we currently always print float as .2f */
+    sprintf(expected, "%.2f", number);
 
-    FormatInt64(test->number, string);
-    if(strncmp(string, test->string, 21) != 0) {
-        fprintf(stderr, "Failed to convert %jd to decimal string (%s vs %s)\n",
-                test->number, test->string, string);
+    FormatDouble(number, string);
+    if(strncmp(string, expected, 21) != 0) {
+        fprintf(stderr, "Failed to convert %f to string (%s vs %s)\n",
+                number, expected, string);
         return FALSE;
     }
 
@@ -57,128 +83,80 @@ check_signed_number_format_test(const struct signed_number_format_test *test)
 }
 
 static Bool
-check_number_format_test(const struct number_format_test *test)
+check_number_format_test(long unsigned int number)
 {
     char string[21];
+    char expected[21];
 
-    FormatUInt64(test->number, string);
-    if(strncmp(string, test->string, 21) != 0) {
+    sprintf(expected, "%lu", number);
+
+    FormatUInt64(number, string);
+    if(strncmp(string, expected, 21) != 0) {
         fprintf(stderr, "Failed to convert %ju to decimal string (%s vs %s)\n",
-                test->number, test->string, string);
+                (intmax_t) number, expected, string);
         return FALSE;
     }
-    FormatUInt64Hex(test->number, string);
-    if(strncmp(string, test->hex_string, 17) != 0) {
-        fprintf(stderr,
-                "Failed to convert %ju to hexadecimal string (%s vs %s)\n",
-                test->number, test->hex_string, string);
+
+    sprintf(expected, "%lx", number);
+    FormatUInt64Hex(number, string);
+    if(strncmp(string, expected, 17) != 0) {
+        fprintf(stderr, "Failed to convert %ju to hexadecimal string (%s vs %s)\n",
+                (intmax_t) number, expected, string);
         return FALSE;
     }
 
     return TRUE;
 }
 
+/* FIXME: max range stuff */
+double float_tests[] = { 0, 5, 0.1, 0.01, 5.2342, 10.2301,
+                         -1, -2.00, -0.6023, -1203.30
+                        };
+
 static void
 number_formatting(void)
 {
     int i;
-    struct number_format_test unsigned_tests[] = {
-        { /* Zero */
-            0,
-            "0",
-            "0",
-        },
-        { /* Single digit number */
-            5,
-            "5",
-            "5",
-        },
-        { /* Two digit decimal number */
-            12,
-            "12",
-            "c",
-        },
-        { /* Two digit hex number */
-            37,
-            "37",
-            "25",
-        },
-        { /* Large < 32 bit number */
-            0xC90B2,
-            "823474",
-            "c90b2",
-        },
-        { /* Large > 32 bit number */
-            0x15D027BF211B37A,
-            "98237498237498234",
-            "15d027bf211b37a",
-        },
-        { /* Maximum 64-bit number */
-            0xFFFFFFFFFFFFFFFF,
-            "18446744073709551615",
-            "ffffffffffffffff",
-        },
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Woverflow"
+    long unsigned int unsigned_tests[] = { 0,/* Zero */
+                                           5, /* Single digit number */
+                                           12, /* Two digit decimal number */
+                                           37, /* Two digit hex number */
+                                           0xC90B2, /* Large < 32 bit number */
+                                           0x15D027BF211B37A, /* Large > 32 bit number */
+                                           0xFFFFFFFFFFFFFFFF, /* Maximum 64-bit number */
     };
 
-    struct signed_number_format_test signed_tests[] = {
-        { /* Zero */
-            0,
-            "0",
-        },
-        { /* Single digit number */
-            5,
-            "5",
-        },
-        { /* Two digit decimal number */
-            12,
-            "12",
-        },
-        { /* Two digit hex number */
-            37,
-            "37",
-        },
-        { /* Large < 32 bit number */
-            0xC90B2,
-            "823474",
-        },
-        { /* Large > 32 bit number */
-            0x15D027BF211B37A,
-            "98237498237498234",
-        },
-        { /* Maximum 64-bit signed number */
-            0x7FFFFFFFFFFFFFFF,
-            "9223372036854775807",
-        },
-        { /* Single digit number */
-            -1,
-            "-1",
-        },
-        { /* Two digit decimal number */
-            -12,
-            "-12",
-        },
-        { /* Large < 32 bit number */
-            -0xC90B2,
-            "-823474",
-        },
-        { /* Large > 32 bit number */
-            -0x15D027BF211B37A,
-            "-98237498237498234",
-        },
-        { /* Maximum 64-bit number */
-            -0x7FFFFFFFFFFFFFFF,
-            "-9223372036854775807",
-        },
-    };
+    long int signed_tests[] = { 0,/* Zero */
+                                5, /* Single digit number */
+                                12, /* Two digit decimal number */
+                                37, /* Two digit hex number */
+                                0xC90B2, /* Large < 32 bit number */
+                                0x15D027BF211B37A, /* Large > 32 bit number */
+                                0x7FFFFFFFFFFFFFFF, /* Maximum 64-bit signed number */
+                                -1, /* Single digit number */
+                                -12, /* Two digit decimal number */
+                                -0xC90B2, /* Large < 32 bit number */
+                                -0x15D027BF211B37A, /* Large > 32 bit number */
+                                -0x7FFFFFFFFFFFFFFF, /* Maximum 64-bit signed number */
+    } ;
+#pragma GCC diagnostic pop
 
     for (i = 0; i < sizeof(unsigned_tests) / sizeof(unsigned_tests[0]); i++)
-        assert(check_number_format_test(unsigned_tests + i));
+        assert(check_number_format_test(unsigned_tests[i]));
 
     for (i = 0; i < sizeof(unsigned_tests) / sizeof(signed_tests[0]); i++)
-        assert(check_signed_number_format_test(signed_tests + i));
+        assert(check_signed_number_format_test(signed_tests[i]));
+
+    for (i = 0; i < sizeof(float_tests) / sizeof(float_tests[0]); i++)
+        assert(check_float_format_test(float_tests[i]));
 }
 
+#pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wformat-security"
+#pragma GCC diagnostic ignored "-Wformat"
+#pragma GCC diagnostic ignored "-Wformat-extra-args"
 static void logging_format(void)
 {
     const char *log_file_path = "/tmp/Xorg-logging-test.log";
@@ -186,6 +164,8 @@ static void logging_format(void)
     char buf[1024];
     int i;
     unsigned int ui;
+    long li;
+    unsigned long lui;
     FILE *f;
     char read_buf[2048];
     char *logmsg;
@@ -198,9 +178,14 @@ static void logging_format(void)
     LogInit(log_file_path, NULL);
     assert(f = fopen(log_file_path, "r"));
 
-#define read_log_msg(msg) \
-    fgets(read_buf, sizeof(read_buf), f); \
-    msg = strchr(read_buf, ']') + 2; /* advance past [time.stamp] */
+#define read_log_msg(msg) do {                                  \
+        msg = fgets(read_buf, sizeof(read_buf), f);             \
+        assert(msg != NULL);                                   \
+        msg = strchr(read_buf, ']');                            \
+        assert(msg != NULL);                                    \
+        assert(strlen(msg) > 2);                                \
+        msg = msg + 2; /* advance past [time.stamp] */          \
+    } while (0)
 
     /* boring test message */
     LogMessageVerbSigSafe(X_ERROR, -1, "test message\n");
@@ -222,11 +207,42 @@ static void logging_format(void)
     read_log_msg(logmsg);
     assert(strcmp(logmsg, "(EE) %s %d %u %% %p %i\n") == 0);
 
+    /* literal % */
+    LogMessageVerbSigSafe(X_ERROR, -1, "test %%\n");
+    read_log_msg(logmsg);
+    assert(strcmp(logmsg, "(EE) test %\n") == 0);
+
+    /* character */
+    LogMessageVerbSigSafe(X_ERROR, -1, "test %c\n", 'a');
+    read_log_msg(logmsg);
+    assert(strcmp(logmsg, "(EE) test a\n") == 0);
+
+    /* something unsupported % */
+    LogMessageVerbSigSafe(X_ERROR, -1, "test %Q\n");
+    read_log_msg(logmsg);
+    assert(strstr(logmsg, "BUG") != NULL);
+    LogMessageVerbSigSafe(X_ERROR, -1, "\n");
+    fseek(f, 0, SEEK_END);
+
     /* string substitution */
     LogMessageVerbSigSafe(X_ERROR, -1, "%s\n", "substituted string");
     read_log_msg(logmsg);
     assert(strcmp(logmsg, "(EE) substituted string\n") == 0);
 
+    /* Invalid format */
+    LogMessageVerbSigSafe(X_ERROR, -1, "%4", 4);
+    read_log_msg(logmsg);
+    assert(strcmp(logmsg, "(EE) ") == 0);
+    LogMessageVerbSigSafe(X_ERROR, -1, "\n");
+    fseek(f, 0, SEEK_END);
+
+    /* %hld is bogus */
+    LogMessageVerbSigSafe(X_ERROR, -1, "%hld\n", 4);
+    read_log_msg(logmsg);
+    assert(strstr(logmsg, "BUG") != NULL);
+    LogMessageVerbSigSafe(X_ERROR, -1, "\n");
+    fseek(f, 0, SEEK_END);
+
     /* number substitution */
     ui = 0;
     do {
@@ -235,12 +251,47 @@ static void logging_format(void)
         LogMessageVerbSigSafe(X_ERROR, -1, "%u\n", ui);
         read_log_msg(logmsg);
         assert(strcmp(logmsg, expected) == 0);
+
+        sprintf(expected, "(EE) %x\n", ui);
+        LogMessageVerbSigSafe(X_ERROR, -1, "%x\n", ui);
+        read_log_msg(logmsg);
+        assert(strcmp(logmsg, expected) == 0);
+
         if (ui == 0)
             ui = 1;
         else
             ui <<= 1;
     } while(ui);
 
+    lui = 0;
+    do {
+        char expected[30];
+        sprintf(expected, "(EE) %lu\n", lui);
+        LogMessageVerbSigSafe(X_ERROR, -1, "%lu\n", lui);
+        read_log_msg(logmsg);
+
+        sprintf(expected, "(EE) %lld\n", (unsigned long long)ui);
+        LogMessageVerbSigSafe(X_ERROR, -1, "%lld\n", (unsigned long long)ui);
+        read_log_msg(logmsg);
+        assert(strcmp(logmsg, expected) == 0);
+
+        sprintf(expected, "(EE) %lx\n", lui);
+        printf("%s\n", expected);
+        LogMessageVerbSigSafe(X_ERROR, -1, "%lx\n", lui);
+        read_log_msg(logmsg);
+        assert(strcmp(logmsg, expected) == 0);
+
+        sprintf(expected, "(EE) %llx\n", (unsigned long long)ui);
+        LogMessageVerbSigSafe(X_ERROR, -1, "%llx\n", (unsigned long long)ui);
+        read_log_msg(logmsg);
+        assert(strcmp(logmsg, expected) == 0);
+
+        if (lui == 0)
+            lui = 1;
+        else
+            lui <<= 1;
+    } while(lui);
+
     /* signed number substitution */
     i = 0;
     do {
@@ -250,7 +301,6 @@ static void logging_format(void)
         read_log_msg(logmsg);
         assert(strcmp(logmsg, expected) == 0);
 
-
         sprintf(expected, "(EE) %d\n", i | INT_MIN);
         LogMessageVerbSigSafe(X_ERROR, -1, "%d\n", i | INT_MIN);
         read_log_msg(logmsg);
@@ -262,19 +312,35 @@ static void logging_format(void)
             i <<= 1;
     } while(i > INT_MIN);
 
-    /* hex number substitution */
-    ui = 0;
+    li = 0;
     do {
         char expected[30];
-        sprintf(expected, "(EE) %x\n", ui);
-        LogMessageVerbSigSafe(X_ERROR, -1, "%x\n", ui);
+        sprintf(expected, "(EE) %ld\n", li);
+        LogMessageVerbSigSafe(X_ERROR, -1, "%ld\n", li);
         read_log_msg(logmsg);
         assert(strcmp(logmsg, expected) == 0);
-        if (ui == 0)
-            ui = 1;
+
+        sprintf(expected, "(EE) %ld\n", li | LONG_MIN);
+        LogMessageVerbSigSafe(X_ERROR, -1, "%ld\n", li | LONG_MIN);
+        read_log_msg(logmsg);
+        assert(strcmp(logmsg, expected) == 0);
+
+        sprintf(expected, "(EE) %lld\n", (long long)li);
+        LogMessageVerbSigSafe(X_ERROR, -1, "%lld\n", (long long)li);
+        read_log_msg(logmsg);
+        assert(strcmp(logmsg, expected) == 0);
+
+        sprintf(expected, "(EE) %lld\n", (long long)(li | LONG_MIN));
+        LogMessageVerbSigSafe(X_ERROR, -1, "%lld\n", (long long)(li | LONG_MIN));
+        read_log_msg(logmsg);
+        assert(strcmp(logmsg, expected) == 0);
+
+        if (li == 0)
+            li = 1;
         else
-            ui <<= 1;
-    } while(ui);
+            li <<= 1;
+    } while(li > LONG_MIN);
+
 
     /* pointer substitution */
     /* we print a null-pointer differently to printf */
@@ -285,19 +351,47 @@ static void logging_format(void)
     ptr = 1;
     do {
         char expected[30];
+#ifdef __sun /* Solaris doesn't autoadd "0x" to %p format */
+        sprintf(expected, "(EE) 0x%p\n", (void*)ptr);
+#else
         sprintf(expected, "(EE) %p\n", (void*)ptr);
+#endif
         LogMessageVerbSigSafe(X_ERROR, -1, "%p\n", (void*)ptr);
         read_log_msg(logmsg);
         assert(strcmp(logmsg, expected) == 0);
         ptr <<= 1;
     } while(ptr);
 
+
+    for (i = 0; i < sizeof(float_tests)/sizeof(float_tests[0]); i++) {
+        double d = float_tests[i];
+        char expected[30];
+        sprintf(expected, "(EE) %.2f\n", d);
+        LogMessageVerbSigSafe(X_ERROR, -1, "%f\n", d);
+        read_log_msg(logmsg);
+        assert(strcmp(logmsg, expected) == 0);
+
+        /* test for length modifiers, we just ignore them atm */
+        LogMessageVerbSigSafe(X_ERROR, -1, "%.3f\n", d);
+        read_log_msg(logmsg);
+        assert(strcmp(logmsg, expected) == 0);
+
+        LogMessageVerbSigSafe(X_ERROR, -1, "%3f\n", d);
+        read_log_msg(logmsg);
+        assert(strcmp(logmsg, expected) == 0);
+
+        LogMessageVerbSigSafe(X_ERROR, -1, "%.0f\n", d);
+        read_log_msg(logmsg);
+        assert(strcmp(logmsg, expected) == 0);
+    }
+
+
     LogClose(EXIT_NO_ERROR);
     unlink(log_file_path);
 
 #undef read_log_msg
 }
-#pragma GCC diagnostic pop "-Wformat-security"
+#pragma GCC diagnostic pop /* "-Wformat-security" */
 
 int
 main(int argc, char **argv)
index df1db11..981c694 100644 (file)
@@ -40,7 +40,7 @@ touch_grow_queue(void)
     int i;
 
     memset(&dev, 0, sizeof(dev));
-    dev.name = "test device";
+    dev.name = xnfstrdup("test device");
     dev.id = 2;
     dev.valuator = &val;
     val.numAxes = 5;
@@ -82,6 +82,8 @@ touch_grow_queue(void)
         assert(t->client_id == 0);
         assert(t->ddx_id == 0);
     }
+
+    free(dev.name);
 }
 
 static void
@@ -95,7 +97,7 @@ touch_find_ddxid(void)
     int i;
 
     memset(&dev, 0, sizeof(dev));
-    dev.name = "test device";
+    dev.name = xnfstrdup("test device");
     dev.id = 2;
     dev.valuator = &val;
     val.numAxes = 5;
@@ -150,6 +152,8 @@ touch_find_ddxid(void)
     ProcessWorkQueue();
     ti = TouchFindByDDXID(&dev, 40, TRUE);
     assert(ti == &dev.last.touches[size]);
+
+    free(dev.name);
 }
 
 static void
@@ -164,7 +168,7 @@ touch_begin_ddxtouch(void)
     int size = 5;
 
     memset(&dev, 0, sizeof(dev));
-    dev.name = "test device";
+    dev.name = xnfstrdup("test device");
     dev.id = 2;
     dev.valuator = &val;
     val.numAxes = 5;
@@ -195,6 +199,8 @@ touch_begin_ddxtouch(void)
     assert(ti->client_id > last_client_id);
     assert(!ti->emulate_pointer);
     last_client_id = ti->client_id;
+
+    free(dev.name);
 }
 
 static void
@@ -212,7 +218,7 @@ touch_begin_touch(void)
     screenInfo.screens[0] = &screen;
 
     memset(&dev, 0, sizeof(dev));
-    dev.name = "test device";
+    dev.name = xnfstrdup("test device");
     dev.id = 2;
 
     memset(&sprite, 0, sizeof(sprite));
@@ -237,6 +243,8 @@ touch_begin_touch(void)
     assert(ti->emulate_pointer);
 
     assert(touch.num_touches == 1);
+
+    free(dev.name);
 }
 
 static void
@@ -251,7 +259,7 @@ touch_init(void)
     screenInfo.screens[0] = &screen;
 
     memset(&dev, 0, sizeof(dev));
-    dev.name = "test device";
+    dev.name = xnfstrdup("test device");
 
     memset(&sprite, 0, sizeof(sprite));
     dev.spriteInfo = &sprite;
@@ -264,6 +272,8 @@ touch_init(void)
     rc = InitTouchClassDeviceStruct(&dev, 1, XIDirectTouch, 2);
     assert(rc == TRUE);
     assert(dev.touch);
+
+    free(dev.name);
 }
 
 int
index f9892e6..a986711 100644 (file)
@@ -73,7 +73,8 @@ xfree86_option_list_duplicate(void)
 static void
 xfree86_add_comment(void)
 {
-    char *current = NULL, *comment;
+    char *current = NULL;
+    const char *comment;
     char compare[1024] = { 0 };
 
     comment = "# foo";
index 9de7abf..bfddfef 100644 (file)
@@ -17,7 +17,7 @@ TESTS=$(noinst_PROGRAMS)
 TESTS_ENVIRONMENT = $(XORG_MALLOC_DEBUG_ENV)
 
 AM_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@
-INCLUDES = @XORG_INCS@
+AM_CPPFLAGS = @XORG_INCS@
 TEST_LDADD=../libxservertest.la $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) $(GLX_SYS_LIBS)
 COMMON_SOURCES=protocol-common.h protocol-common.c
 
index e2b0b8b..9a429e4 100644 (file)
@@ -41,10 +41,7 @@ WindowRec root;
 WindowRec window;
 static ClientRec server_client;
 
-void *userdata;
-
-extern int CorePointerProc(DeviceIntPtr pDev, int what);
-extern int CoreKeyboardProc(DeviceIntPtr pDev, int what);
+void *global_userdata;
 
 static void
 fake_init_sprite(DeviceIntPtr dev)
@@ -139,34 +136,34 @@ struct devices
 init_devices(void)
 {
     ClientRec client;
-    struct devices devices;
+    struct devices local_devices;
 
     client = init_client(0, NULL);
 
-    AllocDevicePair(&client, "Virtual core", &devices.vcp, &devices.vck,
+    AllocDevicePair(&client, "Virtual core", &local_devices.vcp, &local_devices.vck,
                     CorePointerProc, CoreKeyboardProc, TRUE);
-    inputInfo.pointer = devices.vcp;
+    inputInfo.pointer = local_devices.vcp;
 
-    inputInfo.keyboard = devices.vck;
-    ActivateDevice(devices.vcp, FALSE);
-    ActivateDevice(devices.vck, FALSE);
-    EnableDevice(devices.vcp, FALSE);
-    EnableDevice(devices.vck, FALSE);
+    inputInfo.keyboard = local_devices.vck;
+    ActivateDevice(local_devices.vcp, FALSE);
+    ActivateDevice(local_devices.vck, FALSE);
+    EnableDevice(local_devices.vcp, FALSE);
+    EnableDevice(local_devices.vck, FALSE);
 
-    AllocDevicePair(&client, "", &devices.mouse, &devices.kbd,
+    AllocDevicePair(&client, "", &local_devices.mouse, &local_devices.kbd,
                     TestPointerProc, CoreKeyboardProc, FALSE);
-    ActivateDevice(devices.mouse, FALSE);
-    ActivateDevice(devices.kbd, FALSE);
-    EnableDevice(devices.mouse, FALSE);
-    EnableDevice(devices.kbd, FALSE);
+    ActivateDevice(local_devices.mouse, FALSE);
+    ActivateDevice(local_devices.kbd, FALSE);
+    EnableDevice(local_devices.mouse, FALSE);
+    EnableDevice(local_devices.kbd, FALSE);
 
-    devices.num_devices = 4;
-    devices.num_master_devices = 2;
+    local_devices.num_devices = 4;
+    local_devices.num_master_devices = 2;
 
-    fake_init_sprite(devices.mouse);
-    fake_init_sprite(devices.vcp);
+    fake_init_sprite(local_devices.mouse);
+    fake_init_sprite(local_devices.vcp);
 
-    return devices;
+    return local_devices;
 }
 
 /* Create minimal client, with the given buffer and len as request buffer */
@@ -190,20 +187,20 @@ init_client(int len, void *data)
 }
 
 void
-init_window(WindowPtr window, WindowPtr parent, int id)
+init_window(WindowPtr local_window, WindowPtr parent, int id)
 {
-    memset(window, 0, sizeof(*window));
+    memset(local_window, 0, sizeof(*local_window));
 
-    window->drawable.id = id;
+    local_window->drawable.id = id;
     if (parent) {
-        window->drawable.x = 30;
-        window->drawable.y = 50;
-        window->drawable.width = 100;
-        window->drawable.height = 200;
+        local_window->drawable.x = 30;
+        local_window->drawable.y = 50;
+        local_window->drawable.width = 100;
+        local_window->drawable.height = 200;
     }
-    window->parent = parent;
-    window->optional = calloc(1, sizeof(WindowOptRec));
-    assert(window->optional);
+    local_window->parent = parent;
+    local_window->optional = calloc(1, sizeof(WindowOptRec));
+    assert(local_window->optional);
 }
 
 extern DevPrivateKeyRec miPointerScreenKeyRec;
@@ -211,18 +208,18 @@ extern DevPrivateKeyRec miPointerPrivKeyRec;
 
 /* Needed for the screen setup, otherwise we crash during sprite initialization */
 static Bool
-device_cursor_init(DeviceIntPtr dev, ScreenPtr screen)
+device_cursor_init(DeviceIntPtr dev, ScreenPtr local_screen)
 {
     return TRUE;
 }
 
 static void
-device_cursor_cleanup(DeviceIntPtr dev, ScreenPtr screen)
+device_cursor_cleanup(DeviceIntPtr dev, ScreenPtr local_screen)
 {
 }
 
 static Bool
-set_cursor_pos(DeviceIntPtr dev, ScreenPtr screen, int x, int y, Bool event)
+set_cursor_pos(DeviceIntPtr dev, ScreenPtr local_screen, int x, int y, Bool event)
 {
     return TRUE;
 }
@@ -254,7 +251,7 @@ init_simple(void)
     init_window(&window, &root, CLIENT_WINDOW_ID);
 
     serverClient = &server_client;
-    InitClient(serverClient, 0, (pointer) NULL);
+    InitClient(serverClient, 0, (void *) NULL);
     if (!InitClientResources(serverClient)) /* for root resources */
         FatalError("couldn't init server resources");
     SyncExtensionInit();
@@ -267,5 +264,5 @@ __wrap_WriteToClient(ClientPtr client, int len, void *data)
 {
     assert(reply_handler != NULL);
 
-    (*reply_handler) (client, len, data, userdata);
+    (*reply_handler) (client, len, data, global_userdata);
 }
index f27f248..f850478 100644 (file)
@@ -91,7 +91,7 @@ extern struct devices devices;
 /**
  * test-specific userdata, passed into the reply handler.
  */
-extern void *userdata;
+extern void *global_userdata;
 
 /**
  * The reply handler called from WriteToClient. Set this handler if you need
@@ -148,7 +148,7 @@ int __wrap_dixLookupWindow(WindowPtr *win, XID id, ClientPtr client,
                            Mask access);
 int __real_dixLookupWindow(WindowPtr *win, XID id, ClientPtr client,
                            Mask access);
-Bool __wrap_AddResource(XID id, RESTYPE type, pointer value);
+Bool __wrap_AddResource(XID id, RESTYPE type, void *value);
 int __wrap_dixLookupClient(ClientPtr *c, XID id, ClientPtr client, Mask access);
 int __real_dixLookupClient(ClientPtr *c, XID id, ClientPtr client, Mask access);
 
index 1188e8b..aea380e 100644 (file)
@@ -338,8 +338,8 @@ test_values_XIDeviceEvent(DeviceEvent *in, xXIDeviceEvent * out, BOOL swap)
     assert(out->event_x == 0);  /* set in FixUpEventFromWindow */
     assert(out->event_y == 0);  /* set in FixUpEventFromWindow */
 
-    assert(out->root_x == FP1616(in->root_x, in->root_x_frac));
-    assert(out->root_y == FP1616(in->root_y, in->root_y_frac));
+    assert(out->root_x == double_to_fp1616(in->root_x + in->root_x_frac));
+    assert(out->root_y == double_to_fp1616(in->root_y + in->root_y_frac));
 
     buttons = 0;
     for (i = 0; i < bits_to_bytes(sizeof(in->buttons)); i++) {
@@ -694,7 +694,7 @@ test_values_XIDeviceChangedEvent(DeviceChangedEvent *in,
             assert(k->num_keycodes == in->keys.max_keycode -
                    in->keys.min_keycode + 1);
 
-            kc = (uint32_t *) & k[1];
+            kc = (uint32_t *) &k[1];
             for (j = 0; j < k->num_keycodes; j++) {
                 if (swap) {
                     swapl(&kc[j]);
@@ -984,6 +984,221 @@ test_convert_XITouchOwnershipEvent(void)
     }
 }
 
+static void
+test_XIBarrierEvent(BarrierEvent *in)
+{
+    xXIBarrierEvent *out, *swapped;
+    int count;
+    int rc;
+    int eventlen;
+    FP3232 value;
+
+    rc = EventToXI((InternalEvent*)in, (xEvent**)&out, &count);
+    assert(rc == BadMatch);
+
+    rc = EventToCore((InternalEvent*)in, (xEvent**)&out, &count);
+    assert(rc == BadMatch);
+
+    rc = EventToXI2((InternalEvent*)in, (xEvent**)&out);
+
+    assert(out->type == GenericEvent);
+    assert(out->extension == 0); /* IReqCode defaults to 0 */
+    assert(out->evtype == GetXI2Type(in->type));
+    assert(out->time == in->time);
+    assert(out->deviceid == in->deviceid);
+    assert(out->sourceid == in->sourceid);
+    assert(out->barrier == in->barrierid);
+    assert(out->flags == in->flags);
+    assert(out->event == in->window);
+    assert(out->root == in->root);
+    assert(out->dtime == in->dt);
+    assert(out->eventid == in->event_id);
+    assert(out->root_x == double_to_fp1616(in->root_x));
+    assert(out->root_y == double_to_fp1616(in->root_y));
+
+    value = double_to_fp3232(in->dx);
+    assert(out->dx.integral == value.integral);
+    assert(out->dx.frac == value.frac);
+    value = double_to_fp3232(in->dy);
+    assert(out->dy.integral == value.integral);
+    assert(out->dy.frac == value.frac);
+
+    eventlen = sizeof(xEvent) + out->length * 4;
+    swapped = calloc(1, eventlen);
+    XI2EventSwap((xGenericEvent *) out, (xGenericEvent *) swapped);
+
+    swaps(&swapped->sequenceNumber);
+    swapl(&swapped->length);
+    swaps(&swapped->evtype);
+    swaps(&swapped->deviceid);
+    swapl(&swapped->time);
+    swapl(&swapped->eventid);
+    swapl(&swapped->root);
+    swapl(&swapped->event);
+    swapl(&swapped->barrier);
+    swapl(&swapped->dtime);
+    swaps(&swapped->sourceid);
+    swapl(&swapped->root_x);
+    swapl(&swapped->root_y);
+    swapl(&swapped->dx.integral);
+    swapl(&swapped->dx.frac);
+    swapl(&swapped->dy.integral);
+    swapl(&swapped->dy.frac);
+
+    assert(memcmp(swapped, out, eventlen) == 0);
+
+    free(swapped);
+    free(out);
+}
+
+static void
+test_convert_XIBarrierEvent(void)
+{
+    BarrierEvent in;
+
+    memset(&in, 0, sizeof(in));
+    in.header = ET_Internal;
+    in.type = ET_BarrierHit;
+    in.length = sizeof(in);
+    in.time = 0;
+    in.deviceid = 1;
+    in.sourceid = 2;
+
+    test_XIBarrierEvent(&in);
+
+    in.deviceid = 1;
+    while(in.deviceid & 0xFFFF) {
+        test_XIBarrierEvent(&in);
+        in.deviceid <<= 1;
+    }
+    in.deviceid = 0;
+
+    in.sourceid = 1;
+    while(in.sourceid & 0xFFFF) {
+        test_XIBarrierEvent(&in);
+        in.sourceid <<= 1;
+    }
+    in.sourceid = 0;
+
+    in.flags = 1;
+    while(in.flags) {
+        test_XIBarrierEvent(&in);
+        in.flags <<= 1;
+    }
+
+    in.barrierid = 1;
+    while(in.barrierid) {
+        test_XIBarrierEvent(&in);
+        in.barrierid <<= 1;
+    }
+
+    in.dt = 1;
+    while(in.dt) {
+        test_XIBarrierEvent(&in);
+        in.dt <<= 1;
+    }
+
+    in.event_id = 1;
+    while(in.event_id) {
+        test_XIBarrierEvent(&in);
+        in.event_id <<= 1;
+    }
+
+    in.window = 1;
+    while(in.window) {
+        test_XIBarrierEvent(&in);
+        in.window <<= 1;
+    }
+
+    in.root = 1;
+    while(in.root) {
+        test_XIBarrierEvent(&in);
+        in.root <<= 1;
+    }
+
+    /* pseudo-random 16 bit numbers */
+    in.root_x = 1;
+    test_XIBarrierEvent(&in);
+    in.root_x = 1.3;
+    test_XIBarrierEvent(&in);
+    in.root_x = 264.908;
+    test_XIBarrierEvent(&in);
+    in.root_x = 35638.292;
+    test_XIBarrierEvent(&in);
+
+    in.root_x = -1;
+    test_XIBarrierEvent(&in);
+    in.root_x = -1.3;
+    test_XIBarrierEvent(&in);
+    in.root_x = -264.908;
+    test_XIBarrierEvent(&in);
+    in.root_x = -35638.292;
+    test_XIBarrierEvent(&in);
+
+    in.root_y = 1;
+    test_XIBarrierEvent(&in);
+    in.root_y = 1.3;
+    test_XIBarrierEvent(&in);
+    in.root_y = 264.908;
+    test_XIBarrierEvent(&in);
+    in.root_y = 35638.292;
+    test_XIBarrierEvent(&in);
+
+    in.root_y = -1;
+    test_XIBarrierEvent(&in);
+    in.root_y = -1.3;
+    test_XIBarrierEvent(&in);
+    in.root_y = -264.908;
+    test_XIBarrierEvent(&in);
+    in.root_y = -35638.292;
+    test_XIBarrierEvent(&in);
+
+    /* equally pseudo-random 32 bit numbers */
+    in.dx = 1;
+    test_XIBarrierEvent(&in);
+    in.dx = 1.3;
+    test_XIBarrierEvent(&in);
+    in.dx = 264.908;
+    test_XIBarrierEvent(&in);
+    in.dx = 35638.292;
+    test_XIBarrierEvent(&in);
+    in.dx = 2947813871.2342;
+    test_XIBarrierEvent(&in);
+
+    in.dx = -1;
+    test_XIBarrierEvent(&in);
+    in.dx = -1.3;
+    test_XIBarrierEvent(&in);
+    in.dx = -264.908;
+    test_XIBarrierEvent(&in);
+    in.dx = -35638.292;
+    test_XIBarrierEvent(&in);
+    in.dx = -2947813871.2342;
+    test_XIBarrierEvent(&in);
+
+    in.dy = 1;
+    test_XIBarrierEvent(&in);
+    in.dy = 1.3;
+    test_XIBarrierEvent(&in);
+    in.dy = 264.908;
+    test_XIBarrierEvent(&in);
+    in.dy = 35638.292;
+    test_XIBarrierEvent(&in);
+    in.dy = 2947813871.2342;
+    test_XIBarrierEvent(&in);
+
+    in.dy = -1;
+    test_XIBarrierEvent(&in);
+    in.dy = -1.3;
+    test_XIBarrierEvent(&in);
+    in.dy = -264.908;
+    test_XIBarrierEvent(&in);
+    in.dy = -35638.292;
+    test_XIBarrierEvent(&in);
+    in.dy = -2947813871.2342;
+    test_XIBarrierEvent(&in);
+}
+
 int
 main(int argc, char **argv)
 {
@@ -992,6 +1207,7 @@ main(int argc, char **argv)
     test_convert_XIDeviceEvent();
     test_convert_XIDeviceChangedEvent();
     test_convert_XITouchOwnershipEvent();
+    test_convert_XIBarrierEvent();
 
     return 0;
 }
index fc33aa5..bedc217 100644 (file)
@@ -82,7 +82,7 @@ __wrap_dixLookupWindow(WindowPtr *win, XID id, ClientPtr client, Mask access)
 
 /* AddResource is called from XISetSEventMask, we don't need this */
 Bool
-__wrap_AddResource(XID id, RESTYPE type, pointer value)
+__wrap_AddResource(XID id, RESTYPE type, void *value)
 {
     return TRUE;
 }
index 84b386b..c747ddf 100644 (file)
@@ -136,7 +136,8 @@ request_XIPassiveGrabDevice(ClientPtr client, xXIPassiveGrabDeviceReq * req,
                             int error, int errval)
 {
     int rc;
-    int modifiers;
+    int local_modifiers;
+    int mask_len;
 
     rc = ProcXIPassiveGrabDevice(&client_request);
     assert(rc == error);
@@ -151,12 +152,13 @@ request_XIPassiveGrabDevice(ClientPtr client, xXIPassiveGrabDeviceReq * req,
     swapl(&req->cursor);
     swapl(&req->detail);
     swaps(&req->deviceid);
-    modifiers = req->num_modifiers;
+    local_modifiers = req->num_modifiers;
     swaps(&req->num_modifiers);
+    mask_len = req->mask_len;
     swaps(&req->mask_len);
 
-    while (modifiers--) {
-        CARD32 *mod = ((CARD32 *) (req + 1)) + modifiers;
+    while (local_modifiers--) {
+        CARD32 *mod = (CARD32 *) (req + 1) + mask_len + local_modifiers;
 
         swapl(mod);
     }
@@ -228,6 +230,11 @@ test_XIPassiveGrabDevice(void)
     request->detail = XIAnyButton;
     request_XIPassiveGrabDevice(&client_request, request, Success, 0);
 
+    /* Set a few random masks to make sure we handle modifiers correctly */
+    SetBit(mask, XI_ButtonPress);
+    SetBit(mask, XI_KeyPress);
+    SetBit(mask, XI_Enter);
+
     /* some modifiers */
     request->num_modifiers = N_MODS;
     request->length += N_MODS;
index 9d13bbb..deef1f1 100644 (file)
@@ -171,7 +171,7 @@ reply_XIQueryDevice_data(ClientPtr client, int len, char *data, void *closure)
                        (xkb->max_key_code - xkb->min_key_code + 1));
                 assert(any->length == (2 + ki->num_keycodes));
 
-                kc = (uint32_t *) & ki[1];
+                kc = (uint32_t *) &ki[1];
                 for (k = 0; k < ki->num_keycodes; k++, kc++) {
                     if (client->swapped)
                         swapl(kc);
@@ -312,7 +312,7 @@ test_XIQueryDevice(void)
     struct test_data data;
 
     reply_handler = reply_XIQueryDevice;
-    userdata = &data;
+    global_userdata = &data;
     request_init(&request, XIQueryDevice);
 
     printf("Testing XIAllDevices.\n");
index aff0237..3749b30 100644 (file)
@@ -44,8 +44,8 @@
 #include "extinit.h"            /* for XInputExtensionInit */
 #include "scrnintstr.h"
 #include "xiqueryversion.h"
-
 #include "protocol-common.h"
+#include "exglobals.h"
 
 extern XExtensionVersion XIVersion;
 
@@ -54,8 +54,8 @@ struct test_data {
     int minor_client;
     int major_server;
     int minor_server;
-    int major_cached;
-    int minor_cached;
+    int major_expected;
+    int minor_expected;
 };
 
 static void
@@ -93,13 +93,8 @@ reply_XIQueryVersion_multiple(ClientPtr client, int len, char *data, void *closu
     reply_check_defaults(rep, len, XIQueryVersion);
     assert(rep->length == 0);
 
-    if (versions->major_cached == -1) {
-        versions->major_cached = rep->major_version;
-        versions->minor_cached = rep->minor_version;
-    }
-
-    assert(versions->major_cached == rep->major_version);
-    assert(versions->minor_cached == rep->minor_version);
+    assert(versions->major_expected == rep->major_version);
+    assert(versions->minor_expected == rep->minor_version);
 }
 
 /**
@@ -118,7 +113,7 @@ request_XIQueryVersion(int smaj, int smin, int cmaj, int cmin, int error)
 
     request_init(&request, XIQueryVersion);
     client = init_client(request.length, &request);
-    userdata = (void *) &versions;
+    global_userdata = (void *) &versions;
 
     /* Change the server to support smaj.smin */
     XIVersion.major_version = smaj;
@@ -199,6 +194,7 @@ test_XIQueryVersion_multiple(void)
 {
     xXIQueryVersionReq request;
     ClientRec client;
+    XIClientPtr pXIClient;
     struct test_data versions;
     int rc;
 
@@ -210,31 +206,29 @@ test_XIQueryVersion_multiple(void)
     XIVersion.minor_version = 2;
 
     reply_handler = reply_XIQueryVersion_multiple;
-    userdata = (void *) &versions;
+    global_userdata = (void *) &versions;
 
     /* run 1 */
-    versions.major_cached = -1;
-    versions.minor_cached = -1;
 
-    /* client is lower than server, noncached */
-    request.major_version = 2;
-    request.minor_version = 1;
+    /* client is lower than server, nonexpected */
+    versions.major_expected = request.major_version = 2;
+    versions.minor_expected = request.minor_version = 1;
     rc = ProcXIQueryVersion(&client);
     assert(rc == Success);
 
-    /* client is higher than server, cached */
+    /* client is higher than server, no change */
     request.major_version = 2;
     request.minor_version = 3;
     rc = ProcXIQueryVersion(&client);
     assert(rc == Success);
 
-    /* client is equal, cached */
+    /* client tries to set higher version, stays same */
     request.major_version = 2;
     request.minor_version = 2;
     rc = ProcXIQueryVersion(&client);
     assert(rc == Success);
 
-    /* client is low than cached */
+    /* client tries to set lower version, no change */
     request.major_version = 2;
     request.minor_version = 0;
     rc = ProcXIQueryVersion(&client);
@@ -243,20 +237,24 @@ test_XIQueryVersion_multiple(void)
     /* run 2 */
     client = init_client(request.length, &request);
     XIVersion.major_version = 2;
-    XIVersion.minor_version = 2;
-    versions.major_cached = -1;
-    versions.minor_cached = -1;
+    XIVersion.minor_version = 3;
 
-    request.major_version = 2;
-    request.minor_version = 2;
+    versions.major_expected = request.major_version = 2;
+    versions.minor_expected = request.minor_version = 2;
     rc = ProcXIQueryVersion(&client);
     assert(rc == Success);
 
+    /* client bumps version from 2.2 to 2.3 */
     request.major_version = 2;
-    request.minor_version = 3;
+    versions.minor_expected = request.minor_version = 3;
     rc = ProcXIQueryVersion(&client);
     assert(rc == Success);
 
+    /* real version is changed, too! */
+    pXIClient = dixLookupPrivate(&client.devPrivates, XIClientPrivateKey);
+    assert(pXIClient->minor_version == 3);
+
+    /* client tries to set lower version, no change */
     request.major_version = 2;
     request.minor_version = 1;
     rc = ProcXIQueryVersion(&client);
@@ -265,20 +263,22 @@ test_XIQueryVersion_multiple(void)
     /* run 3 */
     client = init_client(request.length, &request);
     XIVersion.major_version = 2;
-    XIVersion.minor_version = 2;
-    versions.major_cached = -1;
-    versions.minor_cached = -1;
+    XIVersion.minor_version = 3;
 
-    request.major_version = 2;
-    request.minor_version = 3;
+    versions.major_expected = request.major_version = 2;
+    versions.minor_expected = request.minor_version = 3;
     rc = ProcXIQueryVersion(&client);
     assert(rc == Success);
 
     request.major_version = 2;
-    request.minor_version = 2;
+    versions.minor_expected = request.minor_version = 2;
     rc = ProcXIQueryVersion(&client);
     assert(rc == Success);
 
+    /* but real client version must not be lowered */
+    pXIClient = dixLookupPrivate(&client.devPrivates, XIClientPrivateKey);
+    assert(pXIClient->minor_version == 3);
+
     request.major_version = 2;
     request.minor_version = 1;
     rc = ProcXIQueryVersion(&client);
index 8f6b947..183746f 100644 (file)
@@ -98,7 +98,7 @@ request_XISelectEvent(xXISelectEventsReq * req, int error)
     xXIEventMask *mask, *next;
 
     req->length = (sz_xXISelectEventsReq / 4);
-    mask = (xXIEventMask *) & req[1];
+    mask = (xXIEventMask *) &req[1];
     for (i = 0; i < req->num_masks; i++) {
         req->length += sizeof(xXIEventMask) / 4 + mask->mask_len;
         mask = (xXIEventMask *) ((char *) &mask[1] + mask->mask_len * 4);
@@ -111,7 +111,7 @@ request_XISelectEvent(xXISelectEventsReq * req, int error)
 
     client.swapped = TRUE;
 
-    mask = (xXIEventMask *) & req[1];
+    mask = (xXIEventMask *) &req[1];
     for (i = 0; i < req->num_masks; i++) {
         next = (xXIEventMask *) ((char *) &mask[1] + mask->mask_len * 4);
         swaps(&mask->deviceid);
@@ -156,7 +156,7 @@ request_XISelectEvents_masks(xXISelectEventsReq * req)
     int nmasks = (XI2LASTEVENT + 7) / 8;
     unsigned char *bits;
 
-    mask = (xXIEventMask *) & req[1];
+    mask = (xXIEventMask *) &req[1];
     req->win = ROOT_WINDOW_ID;
 
     /* if a clients submits more than 100 masks, consider it insane and untested */
@@ -312,7 +312,7 @@ test_XISelectEvents(void)
     req->num_masks = 1;
 
     printf("Triggering bogus mask length error\n");
-    mask = (xXIEventMask *) & req[1];
+    mask = (xXIEventMask *) &req[1];
     mask->deviceid = 0;
     mask->mask_len = 0xFFFF;
     request_XISelectEvent(req, BadLength);
@@ -320,7 +320,7 @@ test_XISelectEvents(void)
     /* testing various device ids */
     printf("Testing existing device ids.\n");
     for (i = 0; i < 6; i++) {
-        mask = (xXIEventMask *) & req[1];
+        mask = (xXIEventMask *) &req[1];
         mask->deviceid = i;
         mask->mask_len = 1;
         req->win = ROOT_WINDOW_ID;
@@ -332,7 +332,7 @@ test_XISelectEvents(void)
     for (i = 6; i <= 0xFFFF; i++) {
         req->win = ROOT_WINDOW_ID;
         req->num_masks = 1;
-        mask = (xXIEventMask *) & req[1];
+        mask = (xXIEventMask *) &req[1];
         mask->deviceid = i;
         mask->mask_len = 1;
         request_XISelectEvent(req, BadDevice);
index 4bea333..f7986c1 100644 (file)
@@ -68,7 +68,7 @@ __wrap_dixLookupWindow(WindowPtr *win, XID id, ClientPtr client, Mask access)
  * This function overrides the one in the screen rec.
  */
 static Bool
-ScreenSetCursorPosition(DeviceIntPtr dev, ScreenPtr screen,
+ScreenSetCursorPosition(DeviceIntPtr dev, ScreenPtr scr,
                         int x, int y, Bool generateEvent)
 {
     assert(x == expected_x);
index 6ee7052..1cdad1d 100644 (file)
@@ -36,8 +36,14 @@ xi2mask_test(void)
     XI2Mask *xi2mask = NULL, *mergemask = NULL;
     unsigned char *mask;
     DeviceIntRec dev;
+    DeviceIntRec all_devices, all_master_devices;
     int i;
 
+    all_devices.id = XIAllDevices;
+    inputInfo.all_devices = &all_devices;
+    all_master_devices.id = XIAllMasterDevices;
+    inputInfo.all_master_devices = &all_master_devices;
+
     /* size >= nmasks * 2 for the test cases below */
     xi2mask = xi2mask_new_with_size(MAXDEVICES + 2, (MAXDEVICES + 2) * 2);
     assert(xi2mask);
index 955e72d..9047f59 100644 (file)
@@ -82,15 +82,17 @@ xkb_get_rules_test(void)
 static void
 xkb_set_rules_test(void)
 {
-    XkbRMLVOSet rmlvo = {
-        .rules = "test-rules",
-        .model = "test-model",
-        .layout = "test-layout",
-        .variant = "test-variant",
-        .options = "test-options"
-    };
+    XkbRMLVOSet rmlvo;
     XkbRMLVOSet rmlvo_new = { NULL };
 
+    XkbInitRules(&rmlvo, "test-rules", "test-model", "test-layout",
+                         "test-variant", "test-options");
+    assert(rmlvo.rules);
+    assert(rmlvo.model);
+    assert(rmlvo.layout);
+    assert(rmlvo.variant);
+    assert(rmlvo.options);
+
     XkbSetRulesDflts(&rmlvo);
     XkbGetRulesDflts(&rmlvo_new);
 
@@ -106,6 +108,8 @@ xkb_set_rules_test(void)
     assert(strcmp(rmlvo.layout, rmlvo_new.layout) == 0);
     assert(strcmp(rmlvo.variant, rmlvo_new.variant) == 0);
     assert(strcmp(rmlvo.options, rmlvo_new.options) == 0);
+
+    XkbFreeRMLVOSet(&rmlvo, FALSE);
 }
 
 /**
index e5e5241..e9fabfb 100644 (file)
@@ -71,7 +71,7 @@ xtest_init_devices(void)
     screen.DeviceCursorCleanup = device_cursor_cleanup;
     dixResetPrivates();
     serverClient = &server_client;
-    InitClient(serverClient, 0, (pointer) NULL);
+    InitClient(serverClient, 0, (void *) NULL);
     if (!InitClientResources(serverClient)) /* for root resources */
         FatalError("couldn't init server resources");
     InitAtoms();
index 4eee592..31a408f 100644 (file)
 #include "windowstr.h"
 #include "xace.h"
 #include "list.h"
+#include "xibarriers.h"
 
 static RESTYPE CursorClientType;
 static RESTYPE CursorHideCountType;
 static RESTYPE CursorWindowType;
-RESTYPE PointerBarrierType;
 static CursorPtr CursorCurrent[MAXDEVICES];
 
 static DevPrivateKeyRec CursorScreenPrivateKeyRec;
@@ -72,7 +72,7 @@ static void deleteCursorHideCountsForScreen(ScreenPtr pScreen);
 #define VERIFY_CURSOR(pCursor, cursor, client, access)                 \
     do {                                                               \
        int err;                                                        \
-       err = dixLookupResourceByType((pointer *) &pCursor, cursor,     \
+       err = dixLookupResourceByType((void **) &pCursor, cursor,       \
                                      RT_CURSOR, client, access);       \
        if (err != Success) {                                           \
            client->errorValue = cursor;                                \
@@ -112,14 +112,6 @@ typedef struct _CursorHideCountRec {
     XID resource;
 } CursorHideCountRec;
 
-typedef struct PointerBarrierClient *PointerBarrierClientPtr;
-
-struct PointerBarrierClient {
-    ScreenPtr screen;
-    struct PointerBarrier barrier;
-    struct xorg_list entry;
-};
-
 /*
  * Wrap DisplayCursor to catch cursor change events
  */
@@ -127,9 +119,7 @@ struct PointerBarrierClient {
 typedef struct _CursorScreen {
     DisplayCursorProcPtr DisplayCursor;
     CloseScreenProcPtr CloseScreen;
-    ConstrainCursorHarderProcPtr ConstrainCursorHarder;
     CursorHideCountPtr pCursorHideCounts;
-    struct xorg_list barriers;
 } CursorScreenRec, *CursorScreenPtr;
 
 #define GetCursorScreen(s) ((CursorScreenPtr)dixLookupPrivate(&(s)->devPrivates, CursorScreenPrivateKey))
@@ -139,8 +129,7 @@ typedef struct _CursorScreen {
 #define Unwrap(as,s,elt,backup)        (((backup) = (s)->elt), (s)->elt = (as)->elt)
 
 /* The cursor doesn't show up until the first XDefineCursor() */
-static Bool CursorVisible = FALSE;
-
+Bool CursorVisible = FALSE;
 Bool EnableCursor = TRUE;
 
 static Bool
@@ -152,12 +141,7 @@ CursorDisplayCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
 
     Unwrap(cs, pScreen, DisplayCursor, backupProc);
 
-    /*
-     * Have to check ConnectionInfo to distinguish client requests from
-     * initial root window setup.  Not a great way to do it, I admit.
-     */
-    if (ConnectionInfo)
-        CursorVisible = EnableCursor;
+    CursorVisible = CursorVisible && EnableCursor;
 
     if (cs->pCursorHideCounts != NULL || !CursorVisible) {
         ret = (*pScreen->DisplayCursor) (pDev, pScreen, NullCursor);
@@ -196,11 +180,9 @@ CursorCloseScreen(ScreenPtr pScreen)
     Bool ret;
     _X_UNUSED CloseScreenProcPtr close_proc;
     _X_UNUSED DisplayCursorProcPtr display_proc;
-    ConstrainCursorHarderProcPtr constrain_proc;
 
     Unwrap(cs, pScreen, CloseScreen, close_proc);
     Unwrap(cs, pScreen, DisplayCursor, display_proc);
-    Unwrap(cs, pScreen, ConstrainCursorHarder, constrain_proc);
     deleteCursorHideCountsForScreen(pScreen);
     ret = (*pScreen->CloseScreen) (pScreen);
     free(cs);
@@ -213,7 +195,7 @@ static int
 XFixesSelectCursorInput(ClientPtr pClient, WindowPtr pWindow, CARD32 eventMask)
 {
     CursorEventPtr *prev, e;
-    pointer val;
+    void *val;
     int rc;
 
     for (prev = &cursorEvents; (e = *prev); prev = &e->next) {
@@ -246,12 +228,12 @@ XFixesSelectCursorInput(ClientPtr pClient, WindowPtr pWindow, CARD32 eventMask)
                                      DixGetAttrAccess);
         if (rc != Success)
             if (!AddResource(pWindow->drawable.id, CursorWindowType,
-                             (pointer) pWindow)) {
+                             (void *) pWindow)) {
                 free(e);
                 return BadAlloc;
             }
 
-        if (!AddResource(e->clientResource, CursorClientType, (pointer) e))
+        if (!AddResource(e->clientResource, CursorClientType, (void *) e))
             return BadAlloc;
 
         *prev = e;
@@ -586,13 +568,13 @@ SProcXFixesGetCursorImageAndName(ClientPtr client)
  * whether it should be replaced with a reference to pCursor.
  */
 
-typedef Bool (*TestCursorFunc) (CursorPtr pOld, pointer closure);
+typedef Bool (*TestCursorFunc) (CursorPtr pOld, void *closure);
 
 typedef struct {
     RESTYPE type;
     TestCursorFunc testCursor;
     CursorPtr pNew;
-    pointer closure;
+    void *closure;
 } ReplaceCursorLookupRec, *ReplaceCursorLookupPtr;
 
 static const RESTYPE CursorRestypes[] = {
@@ -602,7 +584,7 @@ static const RESTYPE CursorRestypes[] = {
 #define NUM_CURSOR_RESTYPES (sizeof (CursorRestypes) / sizeof (CursorRestypes[0]))
 
 static Bool
-ReplaceCursorLookup(pointer value, XID id, pointer closure)
+ReplaceCursorLookup(void *value, XID id, void *closure)
 {
     ReplaceCursorLookupPtr rcl = (ReplaceCursorLookupPtr) closure;
     WindowPtr pWin;
@@ -631,12 +613,12 @@ ReplaceCursorLookup(pointer value, XID id, pointer closure)
     }
     if (pCursor && pCursor != rcl->pNew) {
         if ((*rcl->testCursor) (pCursor, rcl->closure)) {
-            rcl->pNew->refcnt++;
+            CursorPtr curs = RefCursor(rcl->pNew);
             /* either redirect reference or update resource database */
             if (pCursorRef)
-                *pCursorRef = rcl->pNew;
+                *pCursorRef = curs;
             else
-                ChangeResourceValue(id, RT_CURSOR, rcl->pNew);
+                ChangeResourceValue(id, RT_CURSOR, curs);
             FreeCursor(pCursor, cursor);
         }
     }
@@ -644,7 +626,7 @@ ReplaceCursorLookup(pointer value, XID id, pointer closure)
 }
 
 static void
-ReplaceCursor(CursorPtr pCursor, TestCursorFunc testCursor, pointer closure)
+ReplaceCursor(CursorPtr pCursor, TestCursorFunc testCursor, void *closure)
 {
     int clientIndex;
     int resIndex;
@@ -670,7 +652,7 @@ ReplaceCursor(CursorPtr pCursor, TestCursorFunc testCursor, pointer closure)
              */
             LookupClientResourceComplex(clients[clientIndex],
                                         rcl.type,
-                                        ReplaceCursorLookup, (pointer) &rcl);
+                                        ReplaceCursorLookup, (void *) &rcl);
         }
     }
     /* this "knows" that WindowHasNewCursor doesn't depend on it's argument */
@@ -678,7 +660,7 @@ ReplaceCursor(CursorPtr pCursor, TestCursorFunc testCursor, pointer closure)
 }
 
 static Bool
-TestForCursor(CursorPtr pCursor, pointer closure)
+TestForCursor(CursorPtr pCursor, void *closure)
 {
     return (pCursor == (CursorPtr) closure);
 }
@@ -696,7 +678,7 @@ ProcXFixesChangeCursor(ClientPtr client)
     VERIFY_CURSOR(pDestination, stuff->destination, client,
                   DixWriteAccess | DixSetAttrAccess);
 
-    ReplaceCursor(pSource, TestForCursor, (pointer) pDestination);
+    ReplaceCursor(pSource, TestForCursor, (void *) pDestination);
     return Success;
 }
 
@@ -713,7 +695,7 @@ SProcXFixesChangeCursor(ClientPtr client)
 }
 
 static Bool
-TestForCursorName(CursorPtr pCursor, pointer closure)
+TestForCursorName(CursorPtr pCursor, void *closure)
 {
     Atom *pName = closure;
 
@@ -794,7 +776,7 @@ createCursorHideCount(ClientPtr pClient, ScreenPtr pScreen)
      * Create a resource for this element so it can be deleted
      * when the client goes away.
      */
-    if (!AddResource(pChc->resource, CursorHideCountType, (pointer) pChc)) {
+    if (!AddResource(pChc->resource, CursorHideCountType, (void *) pChc)) {
         free(pChc);
         return BadAlloc;
     }
@@ -859,7 +841,7 @@ ProcXFixesHideCursor(ClientPtr client)
 
     REQUEST_SIZE_MATCH(xXFixesHideCursorReq);
 
-    ret = dixLookupResourceByType((pointer *) &pWin, stuff->window, RT_WINDOW,
+    ret = dixLookupResourceByType((void **) &pWin, stuff->window, RT_WINDOW,
                                   client, DixGetAttrAccess);
     if (ret != Success) {
         client->errorValue = stuff->window;
@@ -923,7 +905,7 @@ ProcXFixesShowCursor(ClientPtr client)
 
     REQUEST_SIZE_MATCH(xXFixesShowCursorReq);
 
-    rc = dixLookupResourceByType((pointer *) &pWin, stuff->window, RT_WINDOW,
+    rc = dixLookupResourceByType((void **) &pWin, stuff->window, RT_WINDOW,
                                  client, DixGetAttrAccess);
     if (rc != Success) {
         client->errorValue = stuff->window;
@@ -964,7 +946,7 @@ SProcXFixesShowCursor(ClientPtr client)
 }
 
 static int
-CursorFreeClient(pointer data, XID id)
+CursorFreeClient(void *data, XID id)
 {
     CursorEventPtr old = (CursorEventPtr) data;
     CursorEventPtr *prev, e;
@@ -980,7 +962,7 @@ CursorFreeClient(pointer data, XID id)
 }
 
 static int
-CursorFreeHideCount(pointer data, XID id)
+CursorFreeHideCount(void *data, XID id)
 {
     CursorHideCountPtr pChc = (CursorHideCountPtr) data;
     ScreenPtr pScreen = pChc->pScreen;
@@ -996,7 +978,7 @@ CursorFreeHideCount(pointer data, XID id)
 }
 
 static int
-CursorFreeWindow(pointer data, XID id)
+CursorFreeWindow(void *data, XID id)
 {
     WindowPtr pWindow = (WindowPtr) data;
     CursorEventPtr e, next;
@@ -1010,317 +992,28 @@ CursorFreeWindow(pointer data, XID id)
     return 1;
 }
 
-static BOOL
-barrier_is_horizontal(const struct PointerBarrier *barrier)
-{
-    return barrier->y1 == barrier->y2;
-}
-
-static BOOL
-barrier_is_vertical(const struct PointerBarrier *barrier)
-{
-    return barrier->x1 == barrier->x2;
-}
-
-/**
- * @return The set of barrier movement directions the movement vector
- * x1/y1 â†’ x2/y2 represents.
- */
-int
-barrier_get_direction(int x1, int y1, int x2, int y2)
-{
-    int direction = 0;
-
-    /* which way are we trying to go */
-    if (x2 > x1)
-        direction |= BarrierPositiveX;
-    if (x2 < x1)
-        direction |= BarrierNegativeX;
-    if (y2 > y1)
-        direction |= BarrierPositiveY;
-    if (y2 < y1)
-        direction |= BarrierNegativeY;
-
-    return direction;
-}
-
-/**
- * Test if the barrier may block movement in the direction defined by
- * x1/y1 â†’ x2/y2. This function only tests whether the directions could be
- * blocked, it does not test if the barrier actually blocks the movement.
- *
- * @return TRUE if the barrier blocks the direction of movement or FALSE
- * otherwise.
- */
-BOOL
-barrier_is_blocking_direction(const struct PointerBarrier * barrier,
-                              int direction)
-{
-    /* Barriers define which way is ok, not which way is blocking */
-    return (barrier->directions & direction) != direction;
-}
-
-/**
- * Test if the movement vector x1/y1 â†’ x2/y2 is intersecting with the
- * barrier. A movement vector with the startpoint or endpoint adjacent to
- * the barrier itself counts as intersecting.
- *
- * @param x1 X start coordinate of movement vector
- * @param y1 Y start coordinate of movement vector
- * @param x2 X end coordinate of movement vector
- * @param y2 Y end coordinate of movement vector
- * @param[out] distance The distance between the start point and the
- * intersection with the barrier (if applicable).
- * @return TRUE if the barrier intersects with the given vector
- */
-BOOL
-barrier_is_blocking(const struct PointerBarrier * barrier,
-                    int x1, int y1, int x2, int y2, double *distance)
-{
-    BOOL rc = FALSE;
-    float ua, ub, ud;
-    int dir = barrier_get_direction(x1, y1, x2, y2);
-
-    /* Algorithm below doesn't handle edge cases well, hence the extra
-     * checks. */
-    if (barrier_is_vertical(barrier)) {
-        /* handle immediate barrier adjacency, moving away */
-        if (dir & BarrierPositiveX && x1 == barrier->x1)
-            return FALSE;
-        if (dir & BarrierNegativeX && x1 == (barrier->x1 - 1))
-            return FALSE;
-        /* startpoint adjacent to barrier, moving towards -> block */
-        if (x1 == barrier->x1 && y1 >= barrier->y1 && y1 <= barrier->y2) {
-            *distance = 0;
-            return TRUE;
-        }
-    }
-    else {
-        /* handle immediate barrier adjacency, moving away */
-        if (dir & BarrierPositiveY && y1 == barrier->y1)
-            return FALSE;
-        if (dir & BarrierNegativeY && y1 == (barrier->y1 - 1))
-            return FALSE;
-        /* startpoint adjacent to barrier, moving towards -> block */
-        if (y1 == barrier->y1 && x1 >= barrier->x1 && x1 <= barrier->x2) {
-            *distance = 0;
-            return TRUE;
-        }
-    }
-
-    /* not an edge case, compute distance */
-    ua = 0;
-    ud = (barrier->y2 - barrier->y1) * (x2 - x1) - (barrier->x2 -
-                                                    barrier->x1) * (y2 - y1);
-    if (ud != 0) {
-        ua = ((barrier->x2 - barrier->x1) * (y1 - barrier->y1) -
-              (barrier->y2 - barrier->y1) * (x1 - barrier->x1)) / ud;
-        ub = ((x2 - x1) * (y1 - barrier->y1) -
-              (y2 - y1) * (x1 - barrier->x1)) / ud;
-        if (ua < 0 || ua > 1 || ub < 0 || ub > 1)
-            ua = 0;
-    }
-
-    if (ua > 0 && ua <= 1) {
-        double ix = barrier->x1 + ua * (barrier->x2 - barrier->x1);
-        double iy = barrier->y1 + ua * (barrier->y2 - barrier->y1);
-
-        *distance = sqrt(pow(x1 - ix, 2) + pow(y1 - iy, 2));
-        rc = TRUE;
-    }
-
-    return rc;
-}
-
-/**
- * Find the nearest barrier that is blocking movement from x1/y1 to x2/y2.
- *
- * @param dir Only barriers blocking movement in direction dir are checked
- * @param x1 X start coordinate of movement vector
- * @param y1 Y start coordinate of movement vector
- * @param x2 X end coordinate of movement vector
- * @param y2 Y end coordinate of movement vector
- * @return The barrier nearest to the movement origin that blocks this movement.
- */
-static struct PointerBarrier *
-barrier_find_nearest(CursorScreenPtr cs, int dir,
-                     int x1, int y1, int x2, int y2)
-{
-    struct PointerBarrierClient *c;
-    struct PointerBarrier *nearest = NULL;
-    double min_distance = INT_MAX;      /* can't get higher than that in X anyway */
-
-    xorg_list_for_each_entry(c, &cs->barriers, entry) {
-        struct PointerBarrier *b = &c->barrier;
-        double distance;
-
-        if (!barrier_is_blocking_direction(b, dir))
-            continue;
-
-        if (barrier_is_blocking(b, x1, y1, x2, y2, &distance)) {
-            if (min_distance > distance) {
-                min_distance = distance;
-                nearest = b;
-            }
-        }
-    }
-
-    return nearest;
-}
-
-/**
- * Clamp to the given barrier given the movement direction specified in dir.
- *
- * @param barrier The barrier to clamp to
- * @param dir The movement direction
- * @param[out] x The clamped x coordinate.
- * @param[out] y The clamped x coordinate.
- */
-void
-barrier_clamp_to_barrier(struct PointerBarrier *barrier, int dir, int *x,
-                         int *y)
-{
-    if (barrier_is_vertical(barrier)) {
-        if ((dir & BarrierNegativeX) & ~barrier->directions)
-            *x = barrier->x1;
-        if ((dir & BarrierPositiveX) & ~barrier->directions)
-            *x = barrier->x1 - 1;
-    }
-    if (barrier_is_horizontal(barrier)) {
-        if ((dir & BarrierNegativeY) & ~barrier->directions)
-            *y = barrier->y1;
-        if ((dir & BarrierPositiveY) & ~barrier->directions)
-            *y = barrier->y1 - 1;
-    }
-}
-
-static void
-CursorConstrainCursorHarder(DeviceIntPtr dev, ScreenPtr screen, int mode,
-                            int *x, int *y)
-{
-    CursorScreenPtr cs = GetCursorScreen(screen);
-
-    if (!xorg_list_is_empty(&cs->barriers) && !IsFloating(dev) &&
-        mode == Relative) {
-        int ox, oy;
-        int dir;
-        struct PointerBarrier *nearest = NULL;
-
-        /* where are we coming from */
-        miPointerGetPosition(dev, &ox, &oy);
-
-        /* How this works:
-         * Given the origin and the movement vector, get the nearest barrier
-         * to the origin that is blocking the movement.
-         * Clamp to that barrier.
-         * Then, check from the clamped intersection to the original
-         * destination, again finding the nearest barrier and clamping.
-         */
-        dir = barrier_get_direction(ox, oy, *x, *y);
-
-        nearest = barrier_find_nearest(cs, dir, ox, oy, *x, *y);
-        if (nearest) {
-            barrier_clamp_to_barrier(nearest, dir, x, y);
-
-            if (barrier_is_vertical(nearest)) {
-                dir &= ~(BarrierNegativeX | BarrierPositiveX);
-                ox = *x;
-            }
-            else if (barrier_is_horizontal(nearest)) {
-                dir &= ~(BarrierNegativeY | BarrierPositiveY);
-                oy = *y;
-            }
-
-            nearest = barrier_find_nearest(cs, dir, ox, oy, *x, *y);
-            if (nearest) {
-                barrier_clamp_to_barrier(nearest, dir, x, y);
-            }
-        }
-    }
-
-    if (cs->ConstrainCursorHarder) {
-        screen->ConstrainCursorHarder = cs->ConstrainCursorHarder;
-        screen->ConstrainCursorHarder(dev, screen, mode, x, y);
-        screen->ConstrainCursorHarder = CursorConstrainCursorHarder;
-    }
-}
-
-static struct PointerBarrierClient *
-CreatePointerBarrierClient(ScreenPtr screen, ClientPtr client,
-                           xXFixesCreatePointerBarrierReq * stuff)
-{
-    CursorScreenPtr cs = GetCursorScreen(screen);
-    struct PointerBarrierClient *ret = malloc(sizeof(*ret));
-
-    if (ret) {
-        ret->screen = screen;
-        ret->barrier.x1 = min(stuff->x1, stuff->x2);
-        ret->barrier.x2 = max(stuff->x1, stuff->x2);
-        ret->barrier.y1 = min(stuff->y1, stuff->y2);
-        ret->barrier.y2 = max(stuff->y1, stuff->y2);
-        ret->barrier.directions = stuff->directions & 0x0f;
-        if (barrier_is_horizontal(&ret->barrier))
-            ret->barrier.directions &= ~(BarrierPositiveX | BarrierNegativeX);
-        if (barrier_is_vertical(&ret->barrier))
-            ret->barrier.directions &= ~(BarrierPositiveY | BarrierNegativeY);
-        xorg_list_add(&ret->entry, &cs->barriers);
-    }
-
-    return ret;
-}
-
 int
 ProcXFixesCreatePointerBarrier(ClientPtr client)
 {
-    int err;
-    WindowPtr pWin;
-    struct PointerBarrierClient *barrier;
-    struct PointerBarrier b;
-
     REQUEST(xXFixesCreatePointerBarrierReq);
 
-    REQUEST_SIZE_MATCH(xXFixesCreatePointerBarrierReq);
+    REQUEST_FIXED_SIZE(xXFixesCreatePointerBarrierReq, pad_to_int32(stuff->num_devices));
     LEGAL_NEW_RESOURCE(stuff->barrier, client);
 
-    err = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess);
-    if (err != Success) {
-        client->errorValue = stuff->window;
-        return err;
-    }
-
-    /* This sure does need fixing. */
-    if (stuff->num_devices)
-        return BadImplementation;
-
-    b.x1 = stuff->x1;
-    b.x2 = stuff->x2;
-    b.y1 = stuff->y1;
-    b.y2 = stuff->y2;
-
-    if (!barrier_is_horizontal(&b) && !barrier_is_vertical(&b))
-        return BadValue;
-
-    /* no 0-sized barriers */
-    if (barrier_is_horizontal(&b) && barrier_is_vertical(&b))
-        return BadValue;
-
-    if (!(barrier = CreatePointerBarrierClient(pWin->drawable.pScreen,
-                                               client, stuff)))
-        return BadAlloc;
-
-    if (!AddResource(stuff->barrier, PointerBarrierType, &barrier->barrier))
-        return BadAlloc;
-
-    return Success;
+    return XICreatePointerBarrier(client, stuff);
 }
 
 int
 SProcXFixesCreatePointerBarrier(ClientPtr client)
 {
     REQUEST(xXFixesCreatePointerBarrierReq);
+    int i;
+    CARD16 *in_devices = (CARD16 *) &stuff[1];
 
     swaps(&stuff->length);
-    REQUEST_SIZE_MATCH(xXFixesCreatePointerBarrierReq);
+    swaps(&stuff->num_devices);
+    REQUEST_FIXED_SIZE(xXFixesCreatePointerBarrierReq, pad_to_int32(stuff->num_devices));
+
     swapl(&stuff->barrier);
     swapl(&stuff->window);
     swaps(&stuff->x1);
@@ -1328,52 +1021,21 @@ SProcXFixesCreatePointerBarrier(ClientPtr client)
     swaps(&stuff->x2);
     swaps(&stuff->y2);
     swapl(&stuff->directions);
-    return ProcXFixesVector[stuff->xfixesReqType] (client);
-}
-
-static int
-CursorFreeBarrier(void *data, XID id)
-{
-    struct PointerBarrierClient *b = NULL, *barrier;
-    ScreenPtr screen;
-    CursorScreenPtr cs;
-
-    barrier = container_of(data, struct PointerBarrierClient, barrier);
-
-    screen = barrier->screen;
-    cs = GetCursorScreen(screen);
-
-    /* find and unlink from the screen private */
-    xorg_list_for_each_entry(b, &cs->barriers, entry) {
-        if (b == barrier) {
-            xorg_list_del(&b->entry);
-            break;
-        }
+    for (i = 0; i < stuff->num_devices; i++) {
+        swaps(in_devices + i);
     }
 
-    free(barrier);
-    return Success;
+    return ProcXFixesVector[stuff->xfixesReqType] (client);
 }
 
 int
 ProcXFixesDestroyPointerBarrier(ClientPtr client)
 {
-    int err;
-    void *barrier;
-
     REQUEST(xXFixesDestroyPointerBarrierReq);
 
     REQUEST_SIZE_MATCH(xXFixesDestroyPointerBarrierReq);
 
-    err = dixLookupResourceByType((void **) &barrier, stuff->barrier,
-                                  PointerBarrierType, client, DixDestroyAccess);
-    if (err != Success) {
-        client->errorValue = stuff->barrier;
-        return err;
-    }
-
-    FreeResource(stuff->barrier, RT_NONE);
-    return Success;
+    return XIDestroyPointerBarrier(client, stuff);
 }
 
 int
@@ -1394,6 +1056,8 @@ XFixesCursorInit(void)
 
     if (party_like_its_1989)
         CursorVisible = EnableCursor;
+    else
+        CursorVisible = FALSE;
 
     if (!dixRegisterPrivateKey(&CursorScreenPrivateKeyRec, PRIVATE_SCREEN, 0))
         return FALSE;
@@ -1405,10 +1069,8 @@ XFixesCursorInit(void)
         cs = (CursorScreenPtr) calloc(1, sizeof(CursorScreenRec));
         if (!cs)
             return FALSE;
-        xorg_list_init(&cs->barriers);
         Wrap(cs, pScreen, CloseScreen, CursorCloseScreen);
         Wrap(cs, pScreen, DisplayCursor, CursorDisplayCursor);
-        Wrap(cs, pScreen, ConstrainCursorHarder, CursorConstrainCursorHarder);
         cs->pCursorHideCounts = NULL;
         SetCursorScreen(pScreen, cs);
     }
@@ -1418,9 +1080,6 @@ XFixesCursorInit(void)
                                                 "XFixesCursorHideCount");
     CursorWindowType = CreateNewResourceType(CursorFreeWindow,
                                              "XFixesCursorWindow");
-    PointerBarrierType = CreateNewResourceType(CursorFreeBarrier,
-                                               "XFixesPointerBarrier");
 
-    return CursorClientType && CursorHideCountType && CursorWindowType &&
-        PointerBarrierType;
+    return CursorClientType && CursorHideCountType && CursorWindowType;
 }
index 0e9ca44..f9de525 100644 (file)
@@ -35,7 +35,7 @@
 RESTYPE RegionResType;
 
 static int
-RegionResFree(pointer data, XID id)
+RegionResFree(void *data, XID id)
 {
     RegionPtr pRegion = (RegionPtr) data;
 
@@ -85,7 +85,7 @@ ProcXFixesCreateRegion(ClientPtr client)
     pRegion = RegionFromRects(things, (xRectangle *) (stuff + 1), CT_UNSORTED);
     if (!pRegion)
         return BadAlloc;
-    if (!AddResource(stuff->region, RegionResType, (pointer) pRegion))
+    if (!AddResource(stuff->region, RegionResType, (void *) pRegion))
         return BadAlloc;
 
     return Success;
@@ -115,7 +115,7 @@ ProcXFixesCreateRegionFromBitmap(ClientPtr client)
     REQUEST_SIZE_MATCH(xXFixesCreateRegionFromBitmapReq);
     LEGAL_NEW_RESOURCE(stuff->region, client);
 
-    rc = dixLookupResourceByType((pointer *) &pPixmap, stuff->bitmap, RT_PIXMAP,
+    rc = dixLookupResourceByType((void **) &pPixmap, stuff->bitmap, RT_PIXMAP,
                                  client, DixReadAccess);
     if (rc != Success) {
         client->errorValue = stuff->bitmap;
@@ -129,7 +129,7 @@ ProcXFixesCreateRegionFromBitmap(ClientPtr client)
     if (!pRegion)
         return BadAlloc;
 
-    if (!AddResource(stuff->region, RegionResType, (pointer) pRegion))
+    if (!AddResource(stuff->region, RegionResType, (void *) pRegion))
         return BadAlloc;
 
     return Success;
@@ -159,7 +159,7 @@ ProcXFixesCreateRegionFromWindow(ClientPtr client)
 
     REQUEST_SIZE_MATCH(xXFixesCreateRegionFromWindowReq);
     LEGAL_NEW_RESOURCE(stuff->region, client);
-    rc = dixLookupResourceByType((pointer *) &pWin, stuff->window, RT_WINDOW,
+    rc = dixLookupResourceByType((void **) &pWin, stuff->window, RT_WINDOW,
                                  client, DixGetAttrAccess);
     if (rc != Success) {
         client->errorValue = stuff->window;
@@ -188,7 +188,7 @@ ProcXFixesCreateRegionFromWindow(ClientPtr client)
         pRegion = XFixesRegionCopy(pRegion);
     if (!pRegion)
         return BadAlloc;
-    if (!AddResource(stuff->region, RegionResType, (pointer) pRegion))
+    if (!AddResource(stuff->region, RegionResType, (void *) pRegion))
         return BadAlloc;
 
     return Success;
@@ -238,7 +238,7 @@ ProcXFixesCreateRegionFromGC(ClientPtr client)
         return BadImplementation;       /* assume sane server bits */
     }
 
-    if (!AddResource(stuff->region, RegionResType, (pointer) pRegion))
+    if (!AddResource(stuff->region, RegionResType, (void *) pRegion))
         return BadAlloc;
 
     return Success;
@@ -269,6 +269,9 @@ ProcXFixesCreateRegionFromPicture(ClientPtr client)
 
     VERIFY_PICTURE(pPicture, stuff->picture, client, DixGetAttrAccess);
 
+    if (!pPicture->pDrawable)
+        return RenderErrBase + BadPicture;
+
     switch (pPicture->clientClipType) {
     case CT_PIXMAP:
         pRegion = BitmapToRegion(pPicture->pDrawable->pScreen,
@@ -285,7 +288,7 @@ ProcXFixesCreateRegionFromPicture(ClientPtr client)
         return BadImplementation;       /* assume sane server bits */
     }
 
-    if (!AddResource(stuff->region, RegionResType, (pointer) pRegion))
+    if (!AddResource(stuff->region, RegionResType, (void *) pRegion))
         return BadAlloc;
 
     return Success;
@@ -629,7 +632,7 @@ ProcXFixesSetGCClipRegion(ClientPtr client)
     vals[1].val = stuff->yOrigin;
     ChangeGC(NullClient, pGC, GCClipXOrigin | GCClipYOrigin, vals);
     (*pGC->funcs->ChangeClip) (pGC, pRegion ? CT_REGION : CT_NONE,
-                               (pointer) pRegion, 0);
+                               (void *) pRegion, 0);
 
     return Success;
 }
@@ -661,7 +664,7 @@ ProcXFixesSetWindowShapeRegion(ClientPtr client)
     REQUEST(xXFixesSetWindowShapeRegionReq);
 
     REQUEST_SIZE_MATCH(xXFixesSetWindowShapeRegionReq);
-    rc = dixLookupResourceByType((pointer *) &pWin, stuff->dest, RT_WINDOW,
+    rc = dixLookupResourceByType((void **) &pWin, stuff->dest, RT_WINDOW,
                                  client, DixSetAttrAccess);
     if (rc != Success) {
         client->errorValue = stuff->dest;
@@ -750,6 +753,9 @@ ProcXFixesSetPictureClipRegion(ClientPtr client)
     VERIFY_PICTURE(pPicture, stuff->picture, client, DixSetAttrAccess);
     VERIFY_REGION_OR_NONE(pRegion, stuff->region, client, DixReadAccess);
 
+    if (!pPicture->pDrawable)
+        return RenderErrBase + BadPicture;
+
     return SetPictureClipRegion(pPicture, stuff->xOrigin, stuff->yOrigin,
                                 pRegion);
 }
@@ -857,6 +863,7 @@ PanoramiXFixesSetWindowShapeRegion(ClientPtr client)
 {
     int result = Success, j;
     PanoramiXRes *win;
+    RegionPtr reg = NULL;
 
     REQUEST(xXFixesSetWindowShapeRegionReq);
 
@@ -869,10 +876,22 @@ PanoramiXFixesSetWindowShapeRegion(ClientPtr client)
         return result;
     }
 
+    if (win->u.win.root)
+        VERIFY_REGION_OR_NONE(reg, stuff->region, client, DixReadAccess);
+
     FOR_NSCREENS_FORWARD(j) {
+        ScreenPtr screen = screenInfo.screens[j];
         stuff->dest = win->info[j].id;
+
+        if (reg)
+            RegionTranslate(reg, -screen->x, -screen->y);
+
         result =
             (*PanoramiXSaveXFixesVector[X_XFixesSetWindowShapeRegion]) (client);
+
+        if (reg)
+            RegionTranslate(reg, screen->x, screen->y);
+
         if (result != Success)
             break;
     }
@@ -886,6 +905,7 @@ PanoramiXFixesSetPictureClipRegion(ClientPtr client)
     REQUEST(xXFixesSetPictureClipRegionReq);
     int result = Success, j;
     PanoramiXRes *pict;
+    RegionPtr reg = NULL;
 
     REQUEST_SIZE_MATCH(xXFixesSetPictureClipRegionReq);
 
@@ -896,10 +916,22 @@ PanoramiXFixesSetPictureClipRegion(ClientPtr client)
         return result;
     }
 
+    if (pict->u.pict.root)
+        VERIFY_REGION_OR_NONE(reg, stuff->region, client, DixReadAccess);
+
     FOR_NSCREENS_BACKWARD(j) {
+        ScreenPtr screen = screenInfo.screens[j];
         stuff->picture = pict->info[j].id;
+
+        if (reg)
+            RegionTranslate(reg, -screen->x, -screen->y);
+
         result =
             (*PanoramiXSaveXFixesVector[X_XFixesSetPictureClipRegion]) (client);
+
+        if (reg)
+            RegionTranslate(reg, screen->x, screen->y);
+
         if (result != Success)
             break;
     }
index ee8ed6f..c088ed3 100644 (file)
@@ -51,7 +51,7 @@ typedef struct _SelectionEvent {
 static SelectionEventPtr selectionEvents;
 
 static void
-XFixesSelectionCallback(CallbackListPtr *callbacks, pointer data, pointer args)
+XFixesSelectionCallback(CallbackListPtr *callbacks, void *data, void *args)
 {
     SelectionEventPtr e;
     SelectionInfoRec *info = (SelectionInfoRec *) args;
@@ -119,7 +119,7 @@ static int
 XFixesSelectSelectionInput(ClientPtr pClient,
                            Atom selection, WindowPtr pWindow, CARD32 eventMask)
 {
-    pointer val;
+    void *val;
     int rc;
     SelectionEventPtr *prev, e;
 
@@ -159,12 +159,12 @@ XFixesSelectSelectionInput(ClientPtr pClient,
                                      DixGetAttrAccess);
         if (rc != Success)
             if (!AddResource(pWindow->drawable.id, SelectionWindowType,
-                             (pointer) pWindow)) {
+                             (void *) pWindow)) {
                 free(e);
                 return BadAlloc;
             }
 
-        if (!AddResource(e->clientResource, SelectionClientType, (pointer) e))
+        if (!AddResource(e->clientResource, SelectionClientType, (void *) e))
             return BadAlloc;
 
         *prev = e;
@@ -222,7 +222,7 @@ SXFixesSelectionNotifyEvent(xXFixesSelectionNotifyEvent * from,
 }
 
 static int
-SelectionFreeClient(pointer data, XID id)
+SelectionFreeClient(void *data, XID id)
 {
     SelectionEventPtr old = (SelectionEventPtr) data;
     SelectionEventPtr *prev, e;
@@ -239,7 +239,7 @@ SelectionFreeClient(pointer data, XID id)
 }
 
 static int
-SelectionFreeWindow(pointer data, XID id)
+SelectionFreeWindow(void *data, XID id)
 {
     WindowPtr pWindow = (WindowPtr) data;
     SelectionEventPtr e, next;
index 52c57df..3307f87 100644 (file)
@@ -74,7 +74,7 @@ ProcXFixesQueryVersion(ClientPtr client)
 
     if (version_compare(stuff->majorVersion, stuff->minorVersion,
                         SERVER_XFIXES_MAJOR_VERSION,
-                        SERVER_XFIXES_MAJOR_VERSION) < 0) {
+                        SERVER_XFIXES_MINOR_VERSION) < 0) {
         rep.majorVersion = stuff->majorVersion;
         rep.minorVersion = stuff->minorVersion;
     }
@@ -213,7 +213,7 @@ SProcXFixesDispatch(ClientPtr client)
 }
 
 static void
-XFixesClientCallback(CallbackListPtr *list, pointer closure, pointer data)
+XFixesClientCallback(CallbackListPtr *list, void *closure, void *data)
 {
     NewClientInfoRec *clientinfo = (NewClientInfoRec *) data;
     ClientPtr pClient = clientinfo->client;
index 19af09f..fdcf44f 100644 (file)
 #include "resource.h"
 
 extern _X_EXPORT RESTYPE RegionResType;
-extern _X_EXPORT RESTYPE PointerBarrierType;
 extern _X_EXPORT int XFixesErrorBase;
 
 #define VERIFY_REGION(pRegion, rid, client, mode)                      \
     do {                                                               \
        int err;                                                        \
-       err = dixLookupResourceByType((pointer *) &pRegion, rid,        \
+       err = dixLookupResourceByType((void **) &pRegion, rid,  \
                                      RegionResType, client, mode);     \
        if (err != Success) {                                           \
            client->errorValue = rid;                                   \
@@ -52,20 +51,6 @@ extern _X_EXPORT int XFixesErrorBase;
 extern _X_EXPORT RegionPtr
  XFixesRegionCopy(RegionPtr pRegion);
 
-struct PointerBarrier {
-    CARD16 x1, x2, y1, y2;
-    CARD32 directions;
-};
-
-extern int
- barrier_get_direction(int, int, int, int);
-extern BOOL
-barrier_is_blocking(const struct PointerBarrier *, int, int, int, int,
-                    double *);
-extern BOOL barrier_is_blocking_direction(const struct PointerBarrier *, int);
-extern void
-
-barrier_clamp_to_barrier(struct PointerBarrier *barrier, int dir, int *x,
-                         int *y);
+#include "xibarriers.h"
 
 #endif                          /* _XFIXES_H_ */
index 334c71f..44e8890 100644 (file)
@@ -291,8 +291,10 @@ int
  SProcXFixesDestroyPointerBarrier(ClientPtr client);
 
 /* Xinerama */
+#ifdef PANORAMIX
 extern int (*PanoramiXSaveXFixesVector[XFixesNumberRequests]) (ClientPtr);
 void PanoramiXFixesInit(void);
 void PanoramiXFixesReset(void);
+#endif
 
 #endif                          /* _XFIXESINT_H_ */
index 9750aab..01d7360 100644 (file)
@@ -6,8 +6,7 @@ DDX_SRCS = \
         ddxBeep.c \
         ddxCtrls.c \
         ddxLEDs.c \
-        ddxLoad.c \
-        ddxList.c
+        ddxLoad.c
 
 DIX_SRCS = \
         xkb.c \
old mode 100755 (executable)
new mode 100644 (file)
index f95d0ee..caf78c9 100644 (file)
@@ -113,7 +113,7 @@ _XkbDDXBeepInitAtoms(void)
 }
 
 static CARD32
-_XkbDDXBeepExpire(OsTimerPtr timer, CARD32 now, pointer arg)
+_XkbDDXBeepExpire(OsTimerPtr timer, CARD32 now, void *arg)
 {
     DeviceIntPtr dev = (DeviceIntPtr) arg;
     KbdFeedbackPtr feed;
@@ -300,11 +300,11 @@ _XkbDDXBeepExpire(OsTimerPtr timer, CARD32 now, pointer arg)
         ctrl->bell_duration = duration;
         ctrl->bell_pitch = pitch;
         if (xkbInfo->beepCount == 0) {
-            XkbHandleBell(0, 0, dev, ctrl->bell, (pointer) ctrl,
+            XkbHandleBell(0, 0, dev, ctrl->bell, (void *) ctrl,
                           KbdFeedbackClass, name, None, NULL);
         }
         else if (xkbInfo->desc->ctrls->enabled_ctrls & XkbAudibleBellMask) {
-            (*dev->kbdfeed->BellProc) (ctrl->bell, dev, (pointer) ctrl,
+            (*dev->kbdfeed->BellProc) (ctrl->bell, dev, (void *) ctrl,
                                        KbdFeedbackClass);
         }
         ctrl->bell_duration = oldDuration;
@@ -340,11 +340,11 @@ XkbDDXAccessXBeep(DeviceIntPtr dev, unsigned what, unsigned which)
 
     xkbInfo->beepType = what;
     xkbInfo->beepCount = 0;
-    next = _XkbDDXBeepExpire(NULL, 0, (pointer) dev);
+    next = _XkbDDXBeepExpire(NULL, 0, (void *) dev);
     if (next > 0) {
         xkbInfo->beepTimer = TimerSet(xkbInfo->beepTimer,
                                       0, next,
-                                      _XkbDDXBeepExpire, (pointer) dev);
+                                      _XkbDDXBeepExpire, (void *) dev);
     }
     return 1;
 }
diff --git a/xkb/ddxList.c b/xkb/ddxList.c
deleted file mode 100644 (file)
index 79f4637..0000000
+++ /dev/null
@@ -1,304 +0,0 @@
-/************************************************************
-Copyright (c) 1995 by Silicon Graphics Computer Systems, Inc.
-
-Permission to use, copy, modify, and distribute this
-software and its documentation for any purpose and without
-fee is hereby granted, 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 Silicon Graphics not be 
-used in advertising or publicity pertaining to distribution 
-of the software without specific prior written permission.
-Silicon Graphics makes no representation about the suitability 
-of this software for any purpose. It is provided "as is"
-without any express or implied warranty.
-
-SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS 
-SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 
-AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
-GRAPHICS 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_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <stdio.h>
-#include <ctype.h>
-#include <X11/X.h>
-#include <X11/Xos.h>
-#include <X11/Xproto.h>
-#include <X11/keysym.h>
-#include <X11/extensions/XKM.h>
-#include "inputstr.h"
-#include "scrnintstr.h"
-#include "windowstr.h"
-#define        XKBSRV_NEED_FILE_FUNCS
-#include <xkbsrv.h>
-#include <X11/extensions/XI.h>
-
-#ifdef WIN32
-/* from ddxLoad.c */
-#define W32_tmparg " '%s'"
-#define W32_tmpfile ,tmpname
-#define W32_tmplen strlen(tmpname)+3
-#else
-#define W32_tmparg
-#define W32_tmpfile
-#define W32_tmplen 0
-#endif
-
-/***====================================================================***/
-
-static const char *componentDirs[_XkbListNumComponents] = {
-    "keycodes", "types", "compat", "symbols", "geometry"
-};
-
-/***====================================================================***/
-
-static Status
-_AddListComponent(XkbSrvListInfoPtr list,
-                  int what, unsigned flags, char *str, ClientPtr client)
-{
-    int slen, wlen;
-    unsigned char *wire8;
-    unsigned short *wire16;
-    char *tmp;
-
-    if (list->nTotal >= list->maxRtrn) {
-        list->nTotal++;
-        return Success;
-    }
-    tmp = strchr(str, ')');
-    if ((tmp == NULL) && ((tmp = strchr(str, '(')) == NULL)) {
-        slen = strlen(str);
-        while ((slen > 0) && isspace(str[slen - 1])) {
-            slen--;
-        }
-    }
-    else {
-        slen = (tmp - str + 1);
-    }
-    wlen = (((slen + 1) / 2) * 2) + 4;  /* four bytes for flags and length, pad to */
-    /* 2-byte boundary */
-    if ((list->szPool - list->nPool) < wlen) {
-        if (wlen > 1024)
-            list->szPool += XkbPaddedSize(wlen * 2);
-        else
-            list->szPool += 1024;
-        list->pool = realloc(list->pool, list->szPool * sizeof(char));
-        if (!list->pool)
-            return BadAlloc;
-    }
-    wire16 = (unsigned short *) &list->pool[list->nPool];
-    wire8 = (unsigned char *) &wire16[2];
-    wire16[0] = flags;
-    wire16[1] = slen;
-    memcpy(wire8, str, slen);
-    if (client->swapped) {
-        swaps(&wire16[0]);
-        swaps(&wire16[1]);
-    }
-    list->nPool += wlen;
-    list->nFound[what]++;
-    list->nTotal++;
-    return Success;
-}
-
-/***====================================================================***/
-static Status
-XkbDDXListComponent(DeviceIntPtr dev,
-                    int what, XkbSrvListInfoPtr list, ClientPtr client)
-{
-    char *file, *map, *tmp, *buf = NULL;
-    FILE *in;
-    Status status;
-    Bool haveDir;
-
-#ifdef WIN32
-    char tmpname[PATH_MAX];
-#else
-    int rval;
-#endif
-
-    if ((list->pattern[what] == NULL) || (list->pattern[what][0] == '\0'))
-        return Success;
-    file = list->pattern[what];
-    map = strrchr(file, '(');
-    if (map != NULL) {
-        char *tmp;
-
-        map++;
-        tmp = strrchr(map, ')');
-        if ((tmp == NULL) || (tmp[1] != '\0')) {
-            /* illegal pattern.  No error, but no match */
-            return Success;
-        }
-    }
-
-    in = NULL;
-    haveDir = TRUE;
-#ifdef WIN32
-    strcpy(tmpname, Win32TempDir());
-    strcat(tmpname, "\\xkb_XXXXXX");
-    (void) mktemp(tmpname);
-#endif
-    if (XkbBaseDirectory != NULL) {
-        if ((list->pattern[what][0] == '*') && (list->pattern[what][1] == '\0')) {
-            if (asprintf(&buf, "%s/%s.dir", XkbBaseDirectory,
-                         componentDirs[what]) == -1)
-                buf = NULL;
-            else
-                in = fopen(buf, "r");
-        }
-        if (!in) {
-            haveDir = FALSE;
-            free(buf);
-            if (asprintf
-                (&buf,
-                 "'%s/xkbcomp' '-R%s/%s' -w %ld -l -vlfhpR '%s'" W32_tmparg,
-                 XkbBinDirectory, XkbBaseDirectory, componentDirs[what],
-                 (long) ((xkbDebugFlags < 2) ? 1 :
-                         ((xkbDebugFlags > 10) ? 10 : xkbDebugFlags)),
-                 file W32_tmpfile) == -1)
-                buf = NULL;
-        }
-    }
-    else {
-        if ((list->pattern[what][0] == '*') && (list->pattern[what][1] == '\0')) {
-            if (asprintf(&buf, "%s.dir", componentDirs[what]) == -1)
-                buf = NULL;
-            else
-                in = fopen(buf, "r");
-        }
-        if (!in) {
-            haveDir = FALSE;
-            free(buf);
-            if (asprintf
-                (&buf,
-                 "xkbcomp -R%s -w %ld -l -vlfhpR '%s'" W32_tmparg,
-                 componentDirs[what],
-                 (long) ((xkbDebugFlags < 2) ? 1 :
-                         ((xkbDebugFlags > 10) ? 10 : xkbDebugFlags)),
-                 file W32_tmpfile) == -1)
-                buf = NULL;
-        }
-    }
-    status = Success;
-    if (!haveDir) {
-#ifndef WIN32
-        in = Popen(buf, "r");
-#else
-        if (xkbDebugFlags)
-            DebugF("[xkb] xkbList executes: %s\n", buf);
-        if (System(buf) < 0)
-            ErrorF("[xkb] Could not invoke keymap compiler\n");
-        else
-            in = fopen(tmpname, "r");
-#endif
-    }
-    if (!in) {
-        free(buf);
-#ifdef WIN32
-        unlink(tmpname);
-#endif
-        return BadImplementation;
-    }
-    list->nFound[what] = 0;
-    free(buf);
-    buf = malloc(PATH_MAX * sizeof(char));
-    if (!buf) {
-        fclose(in);
-#ifdef WIN32
-        unlink(tmpname);
-#endif
-        return BadAlloc;
-    }
-    while ((status == Success) && ((tmp = fgets(buf, PATH_MAX, in)) != NULL)) {
-        unsigned flags;
-        register unsigned int i;
-
-        if (*tmp == '#')        /* comment, skip it */
-            continue;
-        if (!strncmp(tmp, "Warning:", 8) || !strncmp(tmp, "        ", 8))
-            /* skip warnings too */
-            continue;
-        flags = 0;
-        /* each line in the listing is supposed to start with two */
-        /* groups of eight characters, which specify the general  */
-        /* flags and the flags that are specific to the component */
-        /* if they're missing, fail with BadImplementation        */
-        for (i = 0; (i < 8) && (status == Success); i++) {      /* read the general flags */
-            if (isalpha(*tmp))
-                flags |= (1L << i);
-            else if (*tmp != '-')
-                status = BadImplementation;
-            tmp++;
-        }
-        if (status != Success)
-            break;
-        if (!isspace(*tmp)) {
-            status = BadImplementation;
-            break;
-        }
-        else
-            tmp++;
-        for (i = 0; (i < 8) && (status == Success); i++) {      /* read the component flags */
-            if (isalpha(*tmp))
-                flags |= (1L << (i + 8));
-            else if (*tmp != '-')
-                status = BadImplementation;
-            tmp++;
-        }
-        if (status != Success)
-            break;
-        if (isspace(*tmp)) {
-            while (isspace(*tmp)) {
-                tmp++;
-            }
-        }
-        else {
-            status = BadImplementation;
-            break;
-        }
-        status = _AddListComponent(list, what, flags, tmp, client);
-    }
-#ifndef WIN32
-    if (haveDir)
-        fclose(in);
-    else if ((rval = Pclose(in)) != 0) {
-        if (xkbDebugFlags)
-            ErrorF("[xkb] xkbcomp returned exit code %d\n", rval);
-    }
-#else
-    fclose(in);
-    unlink(tmpname);
-#endif
-    free(buf);
-    return status;
-}
-
-/***====================================================================***/
-
-/* ARGSUSED */
-Status
-XkbDDXList(DeviceIntPtr dev, XkbSrvListInfoPtr list, ClientPtr client)
-{
-    Status status;
-
-    status = XkbDDXListComponent(dev, _XkbListKeycodes, list, client);
-    if (status == Success)
-        status = XkbDDXListComponent(dev, _XkbListTypes, list, client);
-    if (status == Success)
-        status = XkbDDXListComponent(dev, _XkbListCompat, list, client);
-    if (status == Success)
-        status = XkbDDXListComponent(dev, _XkbListSymbols, list, client);
-    if (status == Success)
-        status = XkbDDXListComponent(dev, _XkbListGeometry, list, client);
-    return status;
-}
old mode 100755 (executable)
new mode 100644 (file)
index 42ce474..f44d925
@@ -68,6 +68,9 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #define PATHSEPARATOR "/"
 #endif
 
+static unsigned
+LoadXKM(unsigned want, unsigned need, const char *keymap, XkbDescPtr *xkbRtrn);
+
 static void
 OutputDirectory(char *outdir, size_t size, Bool *is_private_directory)
 {
@@ -96,11 +99,17 @@ OutputDirectory(char *outdir, size_t size, Bool *is_private_directory)
     }
 }
 
-static Bool
-XkbDDXCompileKeymapByNames(XkbDescPtr xkb,
-                           XkbComponentNamesPtr names,
-                           unsigned want,
-                           unsigned need, char *file_name)
+/**
+ * Callback invoked by XkbRunXkbComp. Write to out to talk to xkbcomp.
+ */
+typedef void (*xkbcomp_buffer_callback)(FILE *out, void *userdata);
+
+/**
+ * Start xkbcomp, let the callback write into xkbcomp's stdin. When done,
+ * return a strdup'd copy of the file name we've written to.
+ */
+static char *
+RunXkbComp(xkbcomp_buffer_callback callback, void *userdata, char *file_name)
 {
     FILE *out;
     char *buf = NULL;
@@ -157,7 +166,7 @@ XkbDDXCompileKeymapByNames(XkbDescPtr xkb,
     if (!buf) {
         LogMessage(X_ERROR,
                    "XKB: Could not invoke xkbcomp: not enough memory\n");
-        return FALSE;
+        return NULL;
     }
 
 #ifndef WIN32
@@ -167,13 +176,9 @@ XkbDDXCompileKeymapByNames(XkbDescPtr xkb,
 #endif
 
     if (out != NULL) {
-#ifdef DEBUG
-        if (xkbDebugFlags) {
-            ErrorF("[xkb] XkbDDXCompileKeymapByNames compiling keymap:\n");
-            XkbWriteXKBKeymapForNames(stderr, names, xkb, want, need);
-        }
-#endif
-        XkbWriteXKBKeymapForNames(out, names, xkb, want, need);
+        /* Now write to xkbcomp */
+        (*callback)(out, userdata);
+
 #ifndef WIN32
         if (Pclose(out) == 0)
 #else
@@ -186,7 +191,7 @@ XkbDDXCompileKeymapByNames(XkbDescPtr xkb,
 #ifdef WIN32
             unlink(tmpname);
 #endif
-            return TRUE;
+            return xnfstrdup(file_name);
         }
         else
             LogMessage(X_ERROR, "Error compiling keymap (%s)\n", file_name);
@@ -203,7 +208,27 @@ XkbDDXCompileKeymapByNames(XkbDescPtr xkb,
 #endif
     }
     free(buf);
-    return FALSE;
+    return NULL;
+}
+
+typedef struct {
+    XkbDescPtr xkb;
+    XkbComponentNamesPtr names;
+    unsigned int want;
+    unsigned int need;
+} XkbKeymapNamesCtx;
+
+static void
+xkb_write_keymap_for_names_cb(FILE *out, void *userdata)
+{
+    XkbKeymapNamesCtx *ctx = userdata;
+#ifdef DEBUG
+    if (xkbDebugFlags) {
+        ErrorF("[xkb] XkbDDXCompileKeymapByNames compiling keymap:\n");
+        XkbWriteXKBKeymapForNames(stderr, ctx->names, ctx->xkb, ctx->want, ctx->need);
+    }
+#endif
+    XkbWriteXKBKeymapForNames(out, ctx->names, ctx->xkb, ctx->want, ctx->need);
 }
 
 static char *
@@ -243,6 +268,10 @@ xkb_load_keymap_file(char *file_name, unsigned want, unsigned need, XkbDescPtr *
                    file_name);
         return 0;
     }
+    if (!xkbRtrn) {
+        fclose(file);
+        return 0;
+    }
     missing = XkmReadFile(file, need, want, xkbRtrn);
     if (*xkbRtrn == NULL) {
         LogMessage(X_ERROR, "Error loading keymap %s\n", file_name);
@@ -257,6 +286,152 @@ xkb_load_keymap_file(char *file_name, unsigned want, unsigned need, XkbDescPtr *
     return (need | want) & (~missing);
 }
 
+static Bool
+XkbDDXCompileKeymapByNames(XkbDescPtr xkb,
+                           XkbComponentNamesPtr names,
+                           unsigned want,
+                           unsigned need, char *file_name)
+{
+    char *keymap;
+    Bool rc = FALSE;
+    XkbKeymapNamesCtx ctx = {
+        .xkb = xkb,
+        .names = names,
+        .want = want,
+        .need = need
+    };
+
+    keymap = RunXkbComp(xkb_write_keymap_for_names_cb, &ctx, file_name);
+
+    if (keymap)
+        rc = TRUE;
+
+    return rc;
+}
+
+typedef struct {
+    const char *keymap;
+    size_t len;
+} XkbKeymapString;
+
+static void
+xkb_write_keymap_string_cb(FILE *out, void *userdata)
+{
+    XkbKeymapString *s = userdata;
+    fwrite(s->keymap, s->len, 1, out);
+}
+
+static unsigned int
+XkbDDXLoadKeymapFromString(DeviceIntPtr keybd,
+                          const char *keymap, int keymap_length,
+                          unsigned int want,
+                          unsigned int need,
+                          XkbDescPtr *xkbRtrn)
+{
+    unsigned int have, provided;
+    char *map_name, *pathname, *filename;
+    Bool is_private_directory;
+    Bool unlink_on_success = TRUE;
+    XkbKeymapString map = {
+        .keymap = keymap,
+        .len = keymap_length
+    };
+
+    *xkbRtrn = NULL;
+
+    if (asprintf(&filename, "server-%s-%s.xkm",
+                 display,
+                keymap) <= 0)
+        return NULL;
+
+    pathname = xkb_config_pathname(filename, &is_private_directory);
+    if (pathname == NULL)
+        return NULL;
+
+#if XKM_CACHE_FILES
+    unlink_on_success = !is_private_directory;
+    if (is_private_directory)
+        provided = xkb_load_keymap_file(pathname, XkmAllIndicesMask, need, xkbRtrn);
+#endif
+
+    map_name = RunXkbComp(xkb_write_keymap_string_cb, &map, pathname);
+    if (!map_name) {
+        LogMessage(X_ERROR, "XKB: Couldn't compile keymap\n");
+        return 0;
+    }
+
+    have = LoadXKM(want, need, map_name, xkbRtrn);
+    free(map_name);
+
+    return have;
+}
+
+static FILE *
+XkbDDXOpenConfigFile(const char *mapName, char *fileNameRtrn, int fileNameRtrnLen)
+{
+    char buf[PATH_MAX], xkm_output_dir[PATH_MAX];
+    FILE *file;
+    Bool is_private_directory = FALSE;
+
+    buf[0] = '\0';
+    if (mapName != NULL) {
+        OutputDirectory(xkm_output_dir, sizeof(xkm_output_dir), &is_private_directory);
+        if ((XkbBaseDirectory != NULL) && (xkm_output_dir[0] != '/')
+#ifdef WIN32
+            && (!isalpha(xkm_output_dir[0]) || xkm_output_dir[1] != ':')
+#endif
+            ) {
+            if (snprintf(buf, PATH_MAX, "%s/%s%s.xkm", XkbBaseDirectory,
+                         xkm_output_dir, mapName) >= PATH_MAX)
+                buf[0] = '\0';
+        }
+        else {
+            if (snprintf(buf, PATH_MAX, "%s%s.xkm", xkm_output_dir, mapName)
+                >= PATH_MAX)
+                buf[0] = '\0';
+        }
+        if (buf[0] != '\0')
+            file = fopen(buf, "rb");
+        else
+            file = NULL;
+    }
+    else
+        file = NULL;
+    if ((fileNameRtrn != NULL) && (fileNameRtrnLen > 0)) {
+        strlcpy(fileNameRtrn, buf, fileNameRtrnLen);
+    }
+    return file;
+}
+
+static unsigned
+LoadXKM(unsigned want, unsigned need, const char *keymap, XkbDescPtr *xkbRtrn)
+{
+    FILE *file;
+    char fileName[PATH_MAX];
+    unsigned missing;
+
+    file = XkbDDXOpenConfigFile(keymap, fileName, PATH_MAX);
+    if (file == NULL) {
+        LogMessage(X_ERROR, "Couldn't open compiled keymap file %s\n",
+                   fileName);
+        return 0;
+    }
+    missing = XkmReadFile(file, need, want, xkbRtrn);
+    if (*xkbRtrn == NULL) {
+        LogMessage(X_ERROR, "Error loading keymap %s\n", fileName);
+        fclose(file);
+        (void) unlink(fileName);
+        return 0;
+    }
+    else {
+        DebugF("Loaded XKB keymap %s, defined=0x%x\n", fileName,
+               (*xkbRtrn)->defined);
+    }
+    fclose(file);
+    (void) unlink(fileName);
+    return (need | want) & (~missing);
+}
+
 unsigned
 XkbDDXLoadKeymapByNames(DeviceIntPtr keybd,
                         XkbComponentNamesPtr names,
@@ -281,7 +456,9 @@ XkbDDXLoadKeymapByNames(DeviceIntPtr keybd,
     if(!file_name)
         file_name = local_file_name;
 
-    *xkbRtrn = NULL;
+    if (xkbRtrn)
+        *xkbRtrn = NULL;
+
     if ((keybd == NULL) || (keybd->key == NULL) ||
         (keybd->key->xkbInfo == NULL))
         xkb = NULL;
@@ -291,7 +468,7 @@ XkbDDXLoadKeymapByNames(DeviceIntPtr keybd,
         (names->compat == NULL) && (names->symbols == NULL) &&
         (names->geometry == NULL)) {
         LogMessage(X_ERROR, "XKB: No components provided for device %s\n",
-                   keybd?(keybd->name ? keybd->name : "(unnamed keyboard)"):"(unnamed keyboard)");
+                   keybd->name ? keybd->name : "(unnamed keyboard)");
         if (local_file_name != file_name)
             free(local_file_name);
         return 0;
@@ -306,7 +483,7 @@ XkbDDXLoadKeymapByNames(DeviceIntPtr keybd,
 
     provided = xkb_load_keymap_file(file_name, want, need, xkbRtrn);
 
-    if (*xkbRtrn==NULL || !xkbRtrn) {
+    if (!xkbRtrn) {
         unlink(local_file_name);
         if (local_file_name != file_name)
             free(local_file_name);
@@ -321,7 +498,7 @@ XkbDDXLoadKeymapByNames(DeviceIntPtr keybd,
 
 Bool
 XkbDDXNamesFromRules(DeviceIntPtr keybd,
-                     char *rules_name,
+                     const char *rules_name,
                      XkbRF_VarDefsPtr defs, XkbComponentNamesPtr names)
 {
     char buf[PATH_MAX];
@@ -392,7 +569,7 @@ static XkbDescPtr
 XkbCompileKeymapForDevice(DeviceIntPtr dev, XkbRMLVOSet * rmlvo, int need)
 {
     XkbDescPtr xkb = NULL;
-    unsigned int provided = 0;
+    unsigned int provided;
     XkbComponentNamesRec kccgst = { 0 };
     char *filename, *pathname;
     Bool is_private_directory;
@@ -444,6 +621,29 @@ XkbCompileKeymapForDevice(DeviceIntPtr dev, XkbRMLVOSet * rmlvo, int need)
     return xkb;
 }
 
+static XkbDescPtr
+KeymapOrDefaults(DeviceIntPtr dev, XkbDescPtr xkb)
+{
+    XkbRMLVOSet dflts;
+
+    if (xkb)
+        return xkb;
+
+    /* we didn't get what we really needed. And that will likely leave
+     * us with a keyboard that doesn't work. Use the defaults instead */
+    LogMessage(X_ERROR, "XKB: Failed to load keymap. Loading default "
+                        "keymap instead.\n");
+
+    XkbGetRulesDflts(&dflts);
+
+    xkb = XkbCompileKeymapForDevice(dev, &dflts, 0);
+
+    XkbFreeRMLVOSet(&dflts, FALSE);
+
+    return xkb;
+}
+
+
 XkbDescPtr
 XkbCompileKeymap(DeviceIntPtr dev, XkbRMLVOSet * rmlvo)
 {
@@ -461,20 +661,34 @@ XkbCompileKeymap(DeviceIntPtr dev, XkbRMLVOSet * rmlvo)
 
     xkb = XkbCompileKeymapForDevice(dev, rmlvo, need);
 
-    if (!xkb) {
-        XkbRMLVOSet dflts;
+    return KeymapOrDefaults(dev, xkb);
+}
 
-        /* we didn't get what we really needed. And that will likely leave
-         * us with a keyboard that doesn't work. Use the defaults instead */
-        LogMessage(X_ERROR, "XKB: Failed to load keymap. Loading default "
-                   "keymap instead.\n");
+XkbDescPtr
+XkbCompileKeymapFromString(DeviceIntPtr dev,
+                           const char *keymap, int keymap_length)
+{
+    XkbDescPtr xkb;
+    unsigned int need, provided;
 
-        XkbGetRulesDflts(&dflts);
+    if (!dev || !keymap) {
+        LogMessage(X_ERROR, "XKB: No device or keymap specified\n");
+        return NULL;
+    }
 
-        xkb = XkbCompileKeymapForDevice(dev, &dflts, 0);
+    /* These are the components we really really need */
+    need = XkmSymbolsMask | XkmCompatMapMask | XkmTypesMask |
+           XkmKeyNamesMask | XkmVirtualModsMask;
 
-        XkbFreeRMLVOSet(&dflts, FALSE);
+    provided =
+        XkbDDXLoadKeymapFromString(dev, keymap, keymap_length,
+                                   XkmAllIndicesMask, need, &xkb);
+    if ((need & provided) != need) {
+        if (xkb) {
+            XkbFreeKeyboard(xkb, 0, TRUE);
+            xkb = NULL;
+        }
     }
 
-    return xkb;
+    return KeymapOrDefaults(dev, xkb);
 }
index c6900ec..6f5f8cc 100644 (file)
@@ -218,10 +218,10 @@ typedef struct _FileSpec {
 } FileSpec;
 
 typedef struct {
-    char *model;
-    char *layout[XkbNumKbdGroups + 1];
-    char *variant[XkbNumKbdGroups + 1];
-    char *options;
+    const char *model;
+    const char *layout[XkbNumKbdGroups + 1];
+    const char *variant[XkbNumKbdGroups + 1];
+    const char *options;
 } XkbRF_MultiDefsRec, *XkbRF_MultiDefsPtr;
 
 #define NDX_BUFF_SIZE  4
@@ -343,9 +343,9 @@ SetUpRemap(InputLine * line, RemapSpec * remap)
 }
 
 static Bool
-MatchOneOf(char *wanted, char *vals_defined)
+MatchOneOf(const char *wanted, const char *vals_defined)
 {
-    char *str, *next;
+    const char *str, *next;
     int want_len = strlen(wanted);
 
     for (str = vals_defined, next = NULL; str != NULL; str = next) {
@@ -469,7 +469,7 @@ CheckLine(InputLine * line,
 }
 
 static char *
-_Concat(char *str1, char *str2)
+_Concat(char *str1, const char *str2)
 {
     int len;
 
@@ -498,12 +498,13 @@ squeeze_spaces(char *p1)
 static Bool
 MakeMultiDefs(XkbRF_MultiDefsPtr mdefs, XkbRF_VarDefsPtr defs)
 {
-
+    char *options;
     memset((char *) mdefs, 0, sizeof(XkbRF_MultiDefsRec));
     mdefs->model = defs->model;
-    mdefs->options = Xstrdup(defs->options);
-    if (mdefs->options)
-        squeeze_spaces(mdefs->options);
+    options = Xstrdup(defs->options);
+    if (options)
+        squeeze_spaces(options);
+    mdefs->options = options;
 
     if (defs->layout) {
         if (!strchr(defs->layout, ',')) {
@@ -511,13 +512,15 @@ MakeMultiDefs(XkbRF_MultiDefsPtr mdefs, XkbRF_VarDefsPtr defs)
         }
         else {
             char *p;
+            char *layout;
             int i;
 
-            mdefs->layout[1] = Xstrdup(defs->layout);
-            if (mdefs->layout[1] == NULL)
+            layout = Xstrdup(defs->layout);
+            if (layout == NULL)
                 return FALSE;
-            squeeze_spaces(mdefs->layout[1]);
-            p = mdefs->layout[1];
+            squeeze_spaces(layout);
+            mdefs->layout[1] = layout;
+            p = layout;
             for (i = 2; i <= XkbNumKbdGroups; i++) {
                 if ((p = strchr(p, ','))) {
                     *p++ = '\0';
@@ -538,13 +541,15 @@ MakeMultiDefs(XkbRF_MultiDefsPtr mdefs, XkbRF_VarDefsPtr defs)
         }
         else {
             char *p;
+            char *variant;
             int i;
 
-            mdefs->variant[1] = Xstrdup(defs->variant);
-            if (mdefs->variant[1] == NULL)
+            variant = Xstrdup(defs->variant);
+            if (variant == NULL)
                 return FALSE;
-            squeeze_spaces(mdefs->variant[1]);
-            p = mdefs->variant[1];
+            squeeze_spaces(variant);
+            mdefs->variant[1] = variant;
+            p = variant;
             for (i = 2; i <= XkbNumKbdGroups; i++) {
                 if ((p = strchr(p, ','))) {
                     *p++ = '\0';
@@ -564,13 +569,13 @@ MakeMultiDefs(XkbRF_MultiDefsPtr mdefs, XkbRF_VarDefsPtr defs)
 static void
 FreeMultiDefs(XkbRF_MultiDefsPtr defs)
 {
-    free(defs->options);
-    free(defs->layout[1]);
-    free(defs->variant[1]);
+    free((void *) defs->options);
+    free((void *) defs->layout[1]);
+    free((void *) defs->variant[1]);
 }
 
 static void
-Apply(char *src, char **dst)
+Apply(const char *src, char **dst)
 {
     if (src) {
         if (*src == '+' || *src == '!') {
@@ -596,7 +601,7 @@ XkbRF_ApplyRule(XkbRF_RulePtr rule, XkbComponentNamesPtr names)
 }
 
 static Bool
-CheckGroup(XkbRF_RulesPtr rules, char *group_name, char *name)
+CheckGroup(XkbRF_RulesPtr rules, const char *group_name, const char *name)
 {
     int i;
     char *p;
@@ -864,6 +869,7 @@ XkbRF_GetComponents(XkbRF_RulesPtr rules,
     XkbRF_CheckApplyRules(rules, &mdefs, names, XkbRF_Append);
     XkbRF_ApplyPartialMatches(rules, names);
     XkbRF_CheckApplyRules(rules, &mdefs, names, XkbRF_Option);
+    XkbRF_ApplyPartialMatches(rules, names);
 
     if (names->keycodes)
         names->keycodes = XkbRF_SubstituteVars(names->keycodes, &mdefs);
@@ -1012,15 +1018,15 @@ XkbRF_Free(XkbRF_RulesPtr rules, Bool freeRules)
         return;
     if (rules->rules) {
         for (i = 0, rule = rules->rules; i < rules->num_rules; i++, rule++) {
-            free(rule->model);
-            free(rule->layout);
-            free(rule->variant);
-            free(rule->option);
-            free(rule->keycodes);
-            free(rule->symbols);
-            free(rule->types);
-            free(rule->compat);
-            free(rule->geometry);
+            free((void *) rule->model);
+            free((void *) rule->layout);
+            free((void *) rule->variant);
+            free((void *) rule->option);
+            free((void *) rule->keycodes);
+            free((void *) rule->symbols);
+            free((void *) rule->types);
+            free((void *) rule->compat);
+            free((void *) rule->geometry);
             memset((char *) rule, 0, sizeof(XkbRF_RuleRec));
         }
         free(rules->rules);
@@ -1030,7 +1036,7 @@ XkbRF_Free(XkbRF_RulesPtr rules, Bool freeRules)
 
     if (rules->groups) {
         for (i = 0, group = rules->groups; i < rules->num_groups; i++, group++) {
-            free(group->name);
+            free((void *) group->name);
             free(group->words);
         }
         free(rules->groups);
old mode 100755 (executable)
new mode 100644 (file)
index 8ee74b8..5692213
--- a/xkb/xkb.c
+++ b/xkb/xkb.c
@@ -57,10 +57,10 @@ static RESTYPE RT_XKBCLIENT;
 
 #define        CHK_DEVICE(dev, id, client, access_mode, lf) {\
     int why;\
-    int rc = lf(&(dev), id, client, access_mode, &why);\
-    if (rc != Success) {\
+    int tmprc = lf(&(dev), id, client, access_mode, &why);\
+    if (tmprc != Success) {\
        client->errorValue = _XkbErrCode2(why, id);\
-       return rc;\
+       return tmprc;\
     }\
 }
 
@@ -370,7 +370,7 @@ _XkbBell(ClientPtr client, DeviceIntPtr dev, WindowPtr pWin,
          int percent, int forceSound, int eventOnly, Atom name)
 {
     int base;
-    pointer ctrl;
+    void *ctrl;
     int oldPitch, oldDuration;
     int newPercent;
 
@@ -390,7 +390,7 @@ _XkbBell(ClientPtr client, DeviceIntPtr dev, WindowPtr pWin,
             return BadValue;
         }
         base = k->ctrl.bell;
-        ctrl = (pointer) &(k->ctrl);
+        ctrl = (void *) &(k->ctrl);
         oldPitch = k->ctrl.bell_pitch;
         oldDuration = k->ctrl.bell_duration;
         if (pitch != 0) {
@@ -422,7 +422,7 @@ _XkbBell(ClientPtr client, DeviceIntPtr dev, WindowPtr pWin,
             return BadValue;
         }
         base = b->ctrl.percent;
-        ctrl = (pointer) &(b->ctrl);
+        ctrl = (void *) &(b->ctrl);
         oldPitch = b->ctrl.pitch;
         oldDuration = b->ctrl.duration;
         if (pitch != 0) {
@@ -1026,22 +1026,22 @@ XkbWriteKeyTypes(XkbDescPtr xkb,
 
         buf = (char *) &wire[1];
         if (wire->nMapEntries > 0) {
-            xkbKTMapEntryWireDesc *wire;
+            xkbKTMapEntryWireDesc *ewire;
             XkbKTMapEntryPtr entry;
 
-            wire = (xkbKTMapEntryWireDesc *) buf;
+            ewire = (xkbKTMapEntryWireDesc *) buf;
             entry = type->map;
-            for (n = 0; n < type->map_count; n++, wire++, entry++) {
-                wire->active = entry->active;
-                wire->mask = entry->mods.mask;
-                wire->level = entry->level;
-                wire->realMods = entry->mods.real_mods;
-                wire->virtualMods = entry->mods.vmods;
+            for (n = 0; n < type->map_count; n++, ewire++, entry++) {
+                ewire->active = entry->active;
+                ewire->mask = entry->mods.mask;
+                ewire->level = entry->level;
+                ewire->realMods = entry->mods.real_mods;
+                ewire->virtualMods = entry->mods.vmods;
                 if (client->swapped) {
-                    swaps(&wire->virtualMods);
+                    swaps(&ewire->virtualMods);
                 }
             }
-            buf = (char *) wire;
+            buf = (char *) ewire;
             if (type->preserve != NULL) {
                 xkbModsWireDesc *pwire;
                 XkbModsPtr preserve;
@@ -1650,8 +1650,8 @@ CheckKeyTypes(ClientPtr client,
             xkbKTSetMapEntryWireDesc *mapWire;
             xkbModsWireDesc *preWire;
 
-            mapWire = (xkbKTSetMapEntryWireDesc *) & wire[1];
-            preWire = (xkbModsWireDesc *) & mapWire[wire->nMapEntries];
+            mapWire = (xkbKTSetMapEntryWireDesc *) &wire[1];
+            preWire = (xkbModsWireDesc *) &mapWire[wire->nMapEntries];
             for (n = 0; n < wire->nMapEntries; n++) {
                 if (client->swapped) {
                     swaps(&mapWire[n].virtualMods);
@@ -1761,8 +1761,8 @@ CheckKeySyms(ClientPtr client,
             *errorRtrn = _XkbErrCode3(0x17, i + req->firstKeySym, wire->nSyms);
             return 0;
         }
-        pSyms = (KeySym *) & wire[1];
-        wire = (xkbSymMapWireDesc *) & pSyms[wire->nSyms];
+        pSyms = (KeySym *) &wire[1];
+        wire = (xkbSymMapWireDesc *) &pSyms[wire->nSyms];
     }
 
     map = &xkb->map->key_sym_map[i];
@@ -2039,7 +2039,7 @@ SetKeyTypes(XkbDescPtr xkb,
             unsigned tmp;
 
             mapWire = (xkbKTSetMapEntryWireDesc *) map;
-            preWire = (xkbModsWireDesc *) & mapWire[wire->nMapEntries];
+            preWire = (xkbModsWireDesc *) &mapWire[wire->nMapEntries];
             for (n = 0; n < wire->nMapEntries; n++) {
                 pOld->map[n].active = 1;
                 pOld->map[n].mods.mask = mapWire[n].realMods;
@@ -2098,17 +2098,15 @@ SetKeySyms(ClientPtr client,
 
     oldMap = &xkb->map->key_sym_map[req->firstKeySym];
     for (i = 0; i < req->nKeySyms; i++, oldMap++) {
-        pSyms = (KeySym *) & wire[1];
+        pSyms = (KeySym *) &wire[1];
         if (wire->nSyms > 0) {
             newSyms = XkbResizeKeySyms(xkb, i + req->firstKeySym, wire->nSyms);
-            if (newSyms) {
+            for (s = 0; s < wire->nSyms; s++) {
+                newSyms[s] = pSyms[s];
+            }
+            if (client->swapped) {
                 for (s = 0; s < wire->nSyms; s++) {
-                    newSyms[s] = pSyms[s];
-                }
-                if (client->swapped) {
-                    for (s = 0; s < wire->nSyms; s++) {
-                        swapl(&newSyms[s]);
-                    }
+                    swapl(&newSyms[s]);
                 }
             }
         }
@@ -2118,7 +2116,7 @@ SetKeySyms(ClientPtr client,
         oldMap->kt_index[3] = wire->ktIndex[3];
         oldMap->group_info = wire->groupInfo;
         oldMap->width = wire->width;
-        wire = (xkbSymMapWireDesc *) & pSyms[wire->nSyms];
+        wire = (xkbSymMapWireDesc *) &pSyms[wire->nSyms];
     }
     first = req->firstKeySym;
     last = first + req->nKeySyms - 1;
@@ -2169,10 +2167,8 @@ SetKeyActions(XkbDescPtr xkb,
             xkb->server->key_acts[i + req->firstKeyAct] = 0;
         else {
             newActs = XkbResizeKeyActions(xkb, i + req->firstKeyAct, nActs[i]);
-            if (newActs) {
-                memcpy((char *) newActs, (char *) wire,
-                       nActs[i] * SIZEOF(xkbActionWireDesc));
-            }
+            memcpy((char *) newActs, (char *) wire,
+                   nActs[i] * SIZEOF(xkbActionWireDesc));
             wire += nActs[i] * SIZEOF(xkbActionWireDesc);
         }
     }
@@ -2412,7 +2408,7 @@ _XkbSetMapChecks(ClientPtr client, DeviceIntPtr dev, xkbSetMapReq * req,
     }
 
     if ((req->present & XkbKeyTypesMask) &&
-        (!CheckKeyTypes(client, xkb, req, (xkbKeyTypeWireDesc **) & values,
+        (!CheckKeyTypes(client, xkb, req, (xkbKeyTypeWireDesc **) &values,
                         &nTypes, mapWidths))) {
         client->errorValue = nTypes;
         return BadValue;
@@ -2437,7 +2433,7 @@ _XkbSetMapChecks(ClientPtr client, DeviceIntPtr dev, xkbSetMapReq * req,
 
     if ((req->present & XkbKeySymsMask) &&
         (!CheckKeySyms(client, xkb, req, nTypes, mapWidths, symsPerKey,
-                       (xkbSymMapWireDesc **) & values, &error))) {
+                       (xkbSymMapWireDesc **) &values, &error))) {
         client->errorValue = error;
         return BadValue;
     }
@@ -2451,7 +2447,7 @@ _XkbSetMapChecks(ClientPtr client, DeviceIntPtr dev, xkbSetMapReq * req,
 
     if ((req->present & XkbKeyBehaviorsMask) &&
         (!CheckKeyBehaviors
-         (xkb, req, (xkbBehaviorWireDesc **) & values, &error))) {
+         (xkb, req, (xkbBehaviorWireDesc **) &values, &error))) {
         client->errorValue = error;
         return BadValue;
     }
@@ -2473,7 +2469,7 @@ _XkbSetMapChecks(ClientPtr client, DeviceIntPtr dev, xkbSetMapReq * req,
     }
     if ((req->present & XkbVirtualModMapMask) &&
         (!CheckVirtualModMap
-         (xkb, req, (xkbVModMapWireDesc **) & values, &error))) {
+         (xkb, req, (xkbVModMapWireDesc **) &values, &error))) {
         client->errorValue = error;
         return BadValue;
     }
@@ -2907,7 +2903,6 @@ _XkbSetCompatMap(ClientPtr client, DeviceIntPtr dev,
     }
 
     if (req->groups != 0) {
-        unsigned i, bit;
         xkbModsWireDesc *wire = (xkbModsWireDesc *) data;
 
         for (i = 0, bit = 1; i < XkbNumKbdGroups; i++, bit <<= 1) {
@@ -3078,6 +3073,7 @@ XkbComputeGetIndicatorMapReplySize(XkbIndicatorPtr indicators,
             nIndicators++;
     }
     rep->length = (nIndicators * SIZEOF(xkbIndicatorMapWireDesc)) / 4;
+    rep->nIndicators = nIndicators;
     return Success;
 }
 
@@ -3974,7 +3970,6 @@ _XkbCheckTypeName(Atom name, int typeNdx)
     const char *str;
 
     str = NameForAtom(name);
-    if (!str) return TRUE;
     if ((strcmp(str, "ONE_LEVEL") == 0) || (strcmp(str, "TWO_LEVEL") == 0) ||
         (strcmp(str, "ALPHABETIC") == 0) || (strcmp(str, "KEYPAD") == 0))
         return FALSE;
@@ -3990,13 +3985,11 @@ _XkbSetNamesCheck(ClientPtr client, DeviceIntPtr dev,
                   xkbSetNamesReq * stuff, CARD32 *data)
 {
     XkbDescRec *xkb;
-    XkbNamesRec *names;
     CARD32 *tmp;
     Atom bad;
 
     tmp = data;
     xkb = dev->key->xkbInfo->desc;
-    names = xkb->names;
 
     if (stuff->which & XkbKeyTypeNamesMask) {
         int i;
@@ -4426,7 +4419,7 @@ ProcXkbSetNames(ClientPtr client)
  * (swapped) 16 bit string length, non-zero terminated.
  */
 static char *
-XkbWriteCountedString(char *wire, char *str, Bool swap)
+XkbWriteCountedString(char *wire, const char *str, Bool swap)
 {
     CARD16 len, *pLen, paddedLen;
 
@@ -5103,7 +5096,7 @@ _CheckSetOverlay(char **wire_inout,
     }
     CHK_ATOM_ONLY(olWire->name);
     ol = XkbAddGeomOverlay(section, olWire->name, olWire->nRows);
-    rWire = (xkbOverlayRowWireDesc *) & olWire[1];
+    rWire = (xkbOverlayRowWireDesc *) &olWire[1];
     for (r = 0; r < olWire->nRows; r++) {
         register int k;
         xkbOverlayKeyWireDesc *kWire;
@@ -5115,7 +5108,7 @@ _CheckSetOverlay(char **wire_inout,
             return BadMatch;
         }
         row = XkbAddGeomOverlayRow(ol, rWire->rowUnder, rWire->nKeys);
-        kWire = (xkbOverlayKeyWireDesc *) & rWire[1];
+        kWire = (xkbOverlayKeyWireDesc *) &rWire[1];
         for (k = 0; k < rWire->nKeys; k++, kWire++) {
             if (XkbAddGeomOverlayKey(ol, row,
                                      (char *) kWire->over,
@@ -5169,7 +5162,7 @@ _CheckSetSections(XkbGeometryPtr geom,
         section->width = sWire->width;
         section->height = sWire->height;
         section->angle = sWire->angle;
-        rWire = (xkbRowWireDesc *) & sWire[1];
+        rWire = (xkbRowWireDesc *) &sWire[1];
         for (r = 0; r < sWire->nRows; r++) {
             register int k;
             XkbRowPtr row;
@@ -5185,7 +5178,7 @@ _CheckSetSections(XkbGeometryPtr geom,
             row->top = rWire->top;
             row->left = rWire->left;
             row->vertical = rWire->vertical;
-            kWire = (xkbKeyWireDesc *) & rWire[1];
+            kWire = (xkbKeyWireDesc *) &rWire[1];
             for (k = 0; k < rWire->nKeys; k++) {
                 XkbKeyPtr key;
 
@@ -5207,7 +5200,7 @@ _CheckSetSections(XkbGeometryPtr geom,
                     return BadMatch;
                 }
             }
-            rWire = (xkbRowWireDesc *) & kWire[rWire->nKeys];
+            rWire = (xkbRowWireDesc *) &kWire[rWire->nKeys];
         }
         wire = (char *) rWire;
         if (sWire->nDoodads > 0) {
@@ -5271,7 +5264,7 @@ _CheckSetShapes(XkbGeometryPtr geom,
                 if (!ol)
                     return BadAlloc;
                 ol->corner_radius = olWire->cornerRadius;
-                ptWire = (xkbPointWireDesc *) & olWire[1];
+                ptWire = (xkbPointWireDesc *) &olWire[1];
                 for (p = 0, pt = ol->points; p < olWire->nPoints; p++, pt++) {
                     pt->x = ptWire[p].x;
                     pt->y = ptWire[p].y;
@@ -5626,9 +5619,9 @@ ProcXkbListComponents(ClientPtr client)
     DeviceIntPtr dev;
     xkbListComponentsReply rep;
     unsigned len;
-    int status;
     unsigned char *str;
-    XkbSrvListInfoRec list;
+    uint8_t size;
+    int i;
 
     REQUEST(xkbListComponentsReq);
     REQUEST_AT_LEAST_SIZE(xkbListComponentsReq);
@@ -5638,40 +5631,33 @@ ProcXkbListComponents(ClientPtr client)
 
     CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixGetAttrAccess);
 
-    status = Success;
+    /* The request is followed by six Pascal strings (i.e. size in characters
+     * followed by a string pattern) describing what the client wants us to
+     * list.  We don't care, but might as well check they haven't got the
+     * length wrong. */
     str = (unsigned char *) &stuff[1];
-    memset(&list, 0, sizeof(XkbSrvListInfoRec));
-    list.maxRtrn = stuff->maxNames;
-    list.pattern[_XkbListKeycodes] = GetComponentSpec(&str, FALSE, &status);
-    list.pattern[_XkbListTypes] = GetComponentSpec(&str, FALSE, &status);
-    list.pattern[_XkbListCompat] = GetComponentSpec(&str, FALSE, &status);
-    list.pattern[_XkbListSymbols] = GetComponentSpec(&str, FALSE, &status);
-    list.pattern[_XkbListGeometry] = GetComponentSpec(&str, FALSE, &status);
-    if (status != Success)
-        return status;
-    len = str - ((unsigned char *) stuff);
+    for (i = 0; i < 6; i++) {
+        size = *((uint8_t *)str);
+        len = (str + size + 1) - ((unsigned char *) stuff);
+        if ((XkbPaddedSize(len) / 4) > stuff->length)
+            return BadLength;
+        str += (size + 1);
+    }
     if ((XkbPaddedSize(len) / 4) != stuff->length)
         return BadLength;
-    if ((status = XkbDDXList(dev, &list, client)) != Success) {
-        free(list.pool);
-        list.pool = NULL;
-        return status;
-    }
     rep = (xkbListComponentsReply) {
         .type = X_Reply,
         .deviceID = dev->id,
         .sequenceNumber = client->sequence,
-        .length = XkbPaddedSize(list.nPool) / 4,
+        .length = 0,
         .nKeymaps = 0,
-        .nKeycodes = list.nFound[_XkbListKeycodes],
-        .nTypes = list.nFound[_XkbListTypes],
-        .nCompatMaps = list.nFound[_XkbListCompat],
-        .nSymbols = list.nFound[_XkbListSymbols],
-        .nGeometries = list.nFound[_XkbListGeometry],
+        .nKeycodes = 0,
+        .nTypes = 0,
+        .nCompatMaps = 0,
+        .nSymbols = 0,
+        .nGeometries = 0,
         .extra = 0
     };
-    if (list.nTotal > list.maxRtrn)
-        rep.extra = (list.nTotal - list.maxRtrn);
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swapl(&rep.length);
@@ -5684,11 +5670,6 @@ ProcXkbListComponents(ClientPtr client)
         swaps(&rep.extra);
     }
     WriteToClient(client, SIZEOF(xkbListComponentsReply), &rep);
-    if (list.nPool && list.pool) {
-        WriteToClient(client, XkbPaddedSize(list.nPool), list.pool);
-        free(list.pool);
-        list.pool = NULL;
-    }
     return Success;
 }
 
@@ -5736,14 +5717,8 @@ ProcXkbGetKbdByName(ClientPtr client)
     names.compat = GetComponentSpec(&str, TRUE, &status);
     names.symbols = GetComponentSpec(&str, TRUE, &status);
     names.geometry = GetComponentSpec(&str, TRUE, &status);
-    if (status != Success) {
-        if (names.keycodes) free(names.keycodes);
-        if (names.types) free(names.types);
-        if (names.compat) free(names.compat);
-        if (names.symbols) free(names.symbols);
-        if (names.geometry) free(names.geometry);
+    if (status != Success)
         return status;
-    }
     len = str - ((unsigned char *) stuff);
     if ((XkbPaddedSize(len) / 4) != stuff->length)
         return BadLength;
@@ -5972,25 +5947,13 @@ ProcXkbGetKbdByName(ClientPtr client)
     if (rep.loaded) {
         XkbDescPtr old_xkb;
         xkbNewKeyboardNotify nkn;
-        int i, nG, nTG;
 
         old_xkb = xkb;
         xkb = new;
         dev->key->xkbInfo->desc = xkb;
         new = old_xkb;          /* so it'll get freed automatically */
 
-        *xkb->ctrls = *old_xkb->ctrls;
-        for (nG = nTG = 0, i = xkb->min_key_code; i <= xkb->max_key_code; i++) {
-            nG = XkbKeyNumGroups(xkb, i);
-            if (nG >= XkbNumKbdGroups) {
-                nTG = XkbNumKbdGroups;
-                break;
-            }
-            if (nG > nTG) {
-                nTG = nG;
-            }
-        }
-        xkb->ctrls->num_groups = nTG;
+        XkbCopyControls(xkb, old_xkb);
 
         nkn.deviceID = nkn.oldDeviceID = dev->id;
         nkn.minKeyCode = new->min_key_code;
@@ -6013,7 +5976,7 @@ ProcXkbGetKbdByName(ClientPtr client)
                 continue;
 
             if (tmpd != dev)
-                XkbCopyDeviceKeymap(tmpd, dev);
+                XkbDeviceApplyKeymap(tmpd, xkb);
 
             if (tmpd->kbdfeed && tmpd->kbdfeed->xkb_sli) {
                 old_sli = tmpd->kbdfeed->xkb_sli;
@@ -6369,7 +6332,7 @@ ProcXkbGetDeviceInfo(ClientPtr client)
         xkbActionWireDesc *awire;
 
         sz = rep.nBtnsRtrn * SIZEOF(xkbActionWireDesc);
-        awire = (xkbActionWireDesc *) & dev->button->xkb_acts[rep.firstBtnRtrn];
+        awire = (xkbActionWireDesc *) &dev->button->xkb_acts[rep.firstBtnRtrn];
         WriteToClient(client, sz, awire);
         length -= sz;
     }
@@ -6842,7 +6805,7 @@ ProcXkbDispatch(ClientPtr client)
 }
 
 static int
-XkbClientGone(pointer data, XID id)
+XkbClientGone(void *data, XID id)
 {
     DevicePtr pXDev = (DevicePtr) data;
 
index 082c0db..5f3de0d 100644 (file)
@@ -279,7 +279,7 @@ AccessXStickyKeysTurnOff(DeviceIntPtr dev, xkbControlsNotify * pCN)
 }                               /* AccessXStickyKeysTurnOff */
 
 static CARD32
-AccessXKRGExpire(OsTimerPtr timer, CARD32 now, pointer arg)
+AccessXKRGExpire(OsTimerPtr timer, CARD32 now, void *arg)
 {
     xkbControlsNotify cn;
     DeviceIntPtr dev = arg;
@@ -291,8 +291,8 @@ AccessXKRGExpire(OsTimerPtr timer, CARD32 now, pointer arg)
         return 4000;
     }
     xkbi->krgTimerActive = _OFF_TIMER;
-    cn.keycode = 0;
-    cn.eventType = 0;
+    cn.keycode = xkbi->slowKeyEnableKey;
+    cn.eventType = KeyPress;
     cn.requestMajor = 0;
     cn.requestMinor = 0;
     if (xkbi->desc->ctrls->enabled_ctrls & XkbSlowKeysMask) {
@@ -304,11 +304,12 @@ AccessXKRGExpire(OsTimerPtr timer, CARD32 now, pointer arg)
         LogMessage(X_INFO, "XKB SlowKeys are now enabled. Hold shift to disable.\n");
     }
 
+    xkbi->slowKeyEnableKey = 0;
     return 0;
 }
 
 static CARD32
-AccessXRepeatKeyExpire(OsTimerPtr timer, CARD32 now, pointer arg)
+AccessXRepeatKeyExpire(OsTimerPtr timer, CARD32 now, void *arg)
 {
     DeviceIntPtr dev = (DeviceIntPtr) arg;
     XkbSrvInfoPtr xkbi = dev->key->xkbInfo;
@@ -330,7 +331,7 @@ AccessXCancelRepeatKey(XkbSrvInfoPtr xkbi, KeyCode key)
 }
 
 static CARD32
-AccessXSlowKeyExpire(OsTimerPtr timer, CARD32 now, pointer arg)
+AccessXSlowKeyExpire(OsTimerPtr timer, CARD32 now, void *arg)
 {
     DeviceIntPtr keybd;
     XkbSrvInfoPtr xkbi;
@@ -369,7 +370,7 @@ AccessXSlowKeyExpire(OsTimerPtr timer, CARD32 now, pointer arg)
                 xkbi->repeatKeyTimer = TimerSet(xkbi->repeatKeyTimer,
                                                 0, ctrls->repeat_delay,
                                                 AccessXRepeatKeyExpire,
-                                                (pointer) keybd);
+                                                (void *) keybd);
             }
         }
     }
@@ -377,7 +378,7 @@ AccessXSlowKeyExpire(OsTimerPtr timer, CARD32 now, pointer arg)
 }
 
 static CARD32
-AccessXBounceKeyExpire(OsTimerPtr timer, CARD32 now, pointer arg)
+AccessXBounceKeyExpire(OsTimerPtr timer, CARD32 now, void *arg)
 {
     XkbSrvInfoPtr xkbi = ((DeviceIntPtr) arg)->key->xkbInfo;
 
@@ -386,7 +387,7 @@ AccessXBounceKeyExpire(OsTimerPtr timer, CARD32 now, pointer arg)
 }
 
 static CARD32
-AccessXTimeoutExpire(OsTimerPtr timer, CARD32 now, pointer arg)
+AccessXTimeoutExpire(OsTimerPtr timer, CARD32 now, void *arg)
 {
     DeviceIntPtr dev = (DeviceIntPtr) arg;
     XkbSrvInfoPtr xkbi = dev->key->xkbInfo;
@@ -462,15 +463,16 @@ AccessXFilterPressEvent(DeviceEvent *event, DeviceIntPtr keybd)
     if (ctrls->enabled_ctrls & XkbAccessXKeysMask) {
         /* check for magic sequences */
         if ((sym[0] == XK_Shift_R) || (sym[0] == XK_Shift_L)) {
+            xkbi->slowKeyEnableKey = key;
             if (XkbAX_NeedFeedback(ctrls, XkbAX_SlowWarnFBMask)) {
                 xkbi->krgTimerActive = _KRG_WARN_TIMER;
                 xkbi->krgTimer = TimerSet(xkbi->krgTimer, 0, 4000,
-                                          AccessXKRGExpire, (pointer) keybd);
+                                          AccessXKRGExpire, (void *) keybd);
             }
             else {
                 xkbi->krgTimerActive = _KRG_TIMER;
                 xkbi->krgTimer = TimerSet(xkbi->krgTimer, 0, 8000,
-                                          AccessXKRGExpire, (pointer) keybd);
+                                          AccessXKRGExpire, (void *) keybd);
             }
             if (!(ctrls->enabled_ctrls & XkbSlowKeysMask)) {
                 CARD32 now = GetTimeInMillis();
@@ -512,7 +514,7 @@ AccessXFilterPressEvent(DeviceEvent *event, DeviceIntPtr keybd)
         xkbi->slowKey = key;
         xkbi->slowKeysTimer = TimerSet(xkbi->slowKeysTimer,
                                        0, ctrls->slow_keys_delay,
-                                       AccessXSlowKeyExpire, (pointer) keybd);
+                                       AccessXSlowKeyExpire, (void *) keybd);
         ignoreKeyEvent = TRUE;
     }
 
@@ -544,7 +546,7 @@ AccessXFilterPressEvent(DeviceEvent *event, DeviceIntPtr keybd)
                     xkbi->repeatKeyTimer = TimerSet(xkbi->repeatKeyTimer,
                                                     0, ctrls->repeat_delay,
                                                     AccessXRepeatKeyExpire,
-                                                    (pointer) keybd);
+                                                    (void *) keybd);
                 }
             }
         }
@@ -606,7 +608,7 @@ AccessXFilterReleaseEvent(DeviceEvent *event, DeviceIntPtr keybd)
         xkbi->bounceKeysTimer = TimerSet(xkbi->bounceKeysTimer, 0,
                                          ctrls->debounce_delay,
                                          AccessXBounceKeyExpire,
-                                         (pointer) keybd);
+                                         (void *) keybd);
     }
 
     /* Don't transmit the KeyRelease if SlowKeys is turned on and
@@ -649,7 +651,7 @@ AccessXFilterReleaseEvent(DeviceEvent *event, DeviceIntPtr keybd)
         xkbi->lastPtrEventTime = 0;
         xkbi->krgTimer = TimerSet(xkbi->krgTimer, 0,
                                   ctrls->ax_timeout * 1000,
-                                  AccessXTimeoutExpire, (pointer) keybd);
+                                  AccessXTimeoutExpire, (void *) keybd);
         xkbi->krgTimerActive = _ALL_TIMEOUT_TIMER;
     }
     else if (xkbi->krgTimerActive != _OFF_TIMER) {
@@ -721,23 +723,27 @@ ProcessPointerEvent(InternalEvent *ev, DeviceIntPtr mouse)
         changed |= XkbPointerButtonMask;
     }
     else if (event->type == ET_ButtonRelease) {
-        if (xkbi) {
-            xkbi->lockedPtrButtons &= ~(1 << (event->detail.key & 0x7));
-
-            if (IsMaster(dev)) {
-                DeviceIntPtr source;
-                int rc;
-
-                rc = dixLookupDevice(&source, event->sourceid, serverClient,
-                                     DixWriteAccess);
-                if (rc != Success)
-                    ErrorF("[xkb] bad sourceid '%d' on button release event.\n",
-                           event->sourceid);
-                else if (!IsXTestDevice(source, GetMaster(dev, MASTER_POINTER)))
+        if (IsMaster(dev)) {
+            DeviceIntPtr source;
+            int rc;
+
+            rc = dixLookupDevice(&source, event->sourceid, serverClient,
+                    DixWriteAccess);
+            if (rc != Success)
+                ErrorF("[xkb] bad sourceid '%d' on button release event.\n",
+                        event->sourceid);
+            else if (!IsXTestDevice(source, GetMaster(dev, MASTER_POINTER))) {
+                DeviceIntPtr xtest_device;
+
+                xtest_device = GetXTestDevice(GetMaster(dev, MASTER_POINTER));
+                if (button_is_down(xtest_device, ev->device_event.detail.button, BUTTON_PROCESSED))
                     XkbFakeDeviceButton(dev, FALSE, event->detail.key);
             }
         }
 
+        if (xkbi)
+            xkbi->lockedPtrButtons &= ~(1 << (event->detail.key & 0x7));
+
         changed |= XkbPointerButtonMask;
     }
 
old mode 100755 (executable)
new mode 100644 (file)
index c04513e..7c286e4
@@ -51,7 +51,7 @@ static void XkbFakePointerMotion(DeviceIntPtr dev, unsigned flags, int x,
                                  int y);
 
 void
-xkbUnwrapProc(DeviceIntPtr device, DeviceHandleProc proc, pointer data)
+xkbUnwrapProc(DeviceIntPtr device, DeviceHandleProc proc, void *data)
 {
     xkbDeviceInfoPtr xkbPrivPtr = XKBDEVICEINFO(device);
     ProcessInputProc backupproc;
@@ -222,7 +222,6 @@ _XkbFilterSetState(XkbSrvInfoPtr xkbi,
 
 #define        LATCH_KEY_DOWN  1
 #define        LATCH_PENDING   2
-#define        NO_LATCH        3
 
 static int
 _XkbFilterLatchState(XkbSrvInfoPtr xkbi,
@@ -230,6 +229,7 @@ _XkbFilterLatchState(XkbSrvInfoPtr xkbi,
 {
 
     if (filter->keycode == 0) { /* initial press */
+        AccessXCancelRepeatKey(xkbi,keycode);
         filter->keycode = keycode;
         filter->active = 1;
         filter->filterOthers = 1;
@@ -250,91 +250,102 @@ _XkbFilterLatchState(XkbSrvInfoPtr xkbi,
     else if (pAction && (filter->priv == LATCH_PENDING)) {
         if (((1 << pAction->type) & XkbSA_BreakLatch) != 0) {
             filter->active = 0;
-            if (filter->upAction.type == XkbSA_LatchMods)
-                xkbi->state.latched_mods &= ~filter->upAction.mods.mask;
-            else
-                xkbi->state.latched_group -=
-                    XkbSAGroup(&filter->upAction.group);
-        }
-        else if ((pAction->type == filter->upAction.type) &&
-                 (pAction->mods.flags == filter->upAction.mods.flags) &&
-                 (pAction->mods.mask == filter->upAction.mods.mask)) {
-            if (filter->upAction.mods.flags & XkbSA_LatchToLock) {
-                XkbControlsPtr ctrls = xkbi->desc->ctrls;
-
-                if (filter->upAction.type == XkbSA_LatchMods)
-                    pAction->mods.type = XkbSA_LockMods;
-                else
-                    pAction->group.type = XkbSA_LockGroup;
-                if (XkbAX_NeedFeedback(ctrls, XkbAX_StickyKeysFBMask) &&
-                    (ctrls->enabled_ctrls & XkbStickyKeysMask)) {
-                    XkbDDXAccessXBeep(xkbi->device, _BEEP_STICKY_LOCK,
-                                      XkbStickyKeysMask);
-                }
-            }
-            else {
-                if (filter->upAction.type == XkbSA_LatchMods)
-                    pAction->mods.type = XkbSA_SetMods;
-                else
-                    pAction->group.type = XkbSA_SetGroup;
-            }
-            if (filter->upAction.type == XkbSA_LatchMods)
-                xkbi->state.latched_mods &= ~filter->upAction.mods.mask;
-            else
-                xkbi->state.latched_group -=
-                    XkbSAGroup(&filter->upAction.group);
-            filter->active = 0;
+            /* If one latch is broken, all latches are broken, so it's no use
+               to find out which particular latch this filter tracks. */
+            xkbi->state.latched_mods = 0;
+            xkbi->state.latched_group = 0;
         }
     }
-    else if (filter->keycode == keycode) {      /* release */
+    else if (filter->keycode == keycode && filter->priv != LATCH_PENDING){
+        /* The test above for LATCH_PENDING skips subsequent releases of the
+           key after it has been released first time and the latch became
+           pending. */
         XkbControlsPtr ctrls = xkbi->desc->ctrls;
-        int needBeep;
-        int beepType = _BEEP_NONE;
+        int needBeep = ((ctrls->enabled_ctrls & XkbStickyKeysMask) &&
+                        XkbAX_NeedFeedback(ctrls, XkbAX_StickyKeysFBMask));
 
-        needBeep = ((ctrls->enabled_ctrls & XkbStickyKeysMask) &&
-                    XkbAX_NeedFeedback(ctrls, XkbAX_StickyKeysFBMask));
         if (filter->upAction.type == XkbSA_LatchMods) {
-            xkbi->clearMods = filter->upAction.mods.mask;
-            if ((filter->upAction.mods.flags & XkbSA_ClearLocks) &&
-                (xkbi->clearMods & xkbi->state.locked_mods) ==
-                xkbi->clearMods) {
-                xkbi->state.locked_mods &= ~xkbi->clearMods;
-                filter->priv = NO_LATCH;
-                beepType = _BEEP_STICKY_UNLOCK;
+            unsigned char mask = filter->upAction.mods.mask;
+            unsigned char common;
+
+            xkbi->clearMods = mask;
+
+            /* ClearLocks */
+            common = mask & xkbi->state.locked_mods;
+            if ((filter->upAction.mods.flags & XkbSA_ClearLocks) && common) {
+                mask &= ~common;
+                xkbi->state.locked_mods &= ~common;
+                if (needBeep)
+                    XkbDDXAccessXBeep(xkbi->device, _BEEP_STICKY_UNLOCK,
+                                      XkbStickyKeysMask);
+            }
+            /* LatchToLock */
+            common = mask & xkbi->state.latched_mods;
+            if ((filter->upAction.mods.flags & XkbSA_LatchToLock) && common) {
+                unsigned char newlocked;
+
+                mask &= ~common;
+                newlocked = common & ~xkbi->state.locked_mods;
+                if(newlocked){
+                    xkbi->state.locked_mods |= newlocked;
+                    if (needBeep)
+                        XkbDDXAccessXBeep(xkbi->device, _BEEP_STICKY_LOCK,
+                                          XkbStickyKeysMask);
+
+                }
+                xkbi->state.latched_mods &= ~common;
+            }
+            /* Latch remaining modifiers, if any. */
+            if (mask) {
+                xkbi->state.latched_mods |= mask;
+                filter->priv = LATCH_PENDING;
+                if (needBeep)
+                    XkbDDXAccessXBeep(xkbi->device, _BEEP_STICKY_LATCH,
+                                      XkbStickyKeysMask);
             }
         }
         else {
             xkbi->groupChange = -XkbSAGroup(&filter->upAction.group);
+            /* ClearLocks */
             if ((filter->upAction.group.flags & XkbSA_ClearLocks) &&
                 (xkbi->state.locked_group)) {
                 xkbi->state.locked_group = 0;
-                filter->priv = NO_LATCH;
-                beepType = _BEEP_STICKY_UNLOCK;
+                if (needBeep)
+                    XkbDDXAccessXBeep(xkbi->device, _BEEP_STICKY_UNLOCK,
+                                      XkbStickyKeysMask);
             }
-        }
-        if (filter->priv == NO_LATCH) {
-            filter->active = 0;
-        }
-        else {
-            filter->priv = LATCH_PENDING;
-            if (filter->upAction.type == XkbSA_LatchMods) {
-                xkbi->state.latched_mods |= filter->upAction.mods.mask;
-                needBeep = xkbi->state.latched_mods ? needBeep : 0;
-                xkbi->state.latched_mods |= filter->upAction.mods.mask;
+            /* LatchToLock */
+            else if ((filter->upAction.group.flags & XkbSA_LatchToLock)
+                     && (xkbi->state.latched_group)) {
+                xkbi->state.locked_group  += XkbSAGroup(&filter->upAction.group);
+                xkbi->state.latched_group -= XkbSAGroup(&filter->upAction.group);
+                if(XkbSAGroup(&filter->upAction.group) && needBeep)
+                    XkbDDXAccessXBeep(xkbi->device, _BEEP_STICKY_LOCK,
+                                      XkbStickyKeysMask);
             }
-            else {
-                xkbi->state.latched_group +=
-                    XkbSAGroup(&filter->upAction.group);
+            /* Latch group */
+            else if(XkbSAGroup(&filter->upAction.group)){
+                xkbi->state.latched_group += XkbSAGroup(&filter->upAction.group);
+                filter->priv = LATCH_PENDING;
+                if (needBeep)
+                    XkbDDXAccessXBeep(xkbi->device, _BEEP_STICKY_LATCH,
+                                      XkbStickyKeysMask);
             }
-            if (needBeep && (beepType == _BEEP_NONE))
-                beepType = _BEEP_STICKY_LATCH;
         }
-        if (needBeep && (beepType != _BEEP_NONE))
-            XkbDDXAccessXBeep(xkbi->device, beepType, XkbStickyKeysMask);
+
+        if (filter->priv != LATCH_PENDING)
+            filter->active = 0;
     }
-    else if (filter->priv == LATCH_KEY_DOWN) {
-        filter->priv = NO_LATCH;
-        filter->filterOthers = 0;
+    else if (pAction && (filter->priv == LATCH_KEY_DOWN)) {
+        /* Latch was broken before it became pending: degrade to a
+           SetMods/SetGroup. */
+        if (filter->upAction.type == XkbSA_LatchMods)
+            filter->upAction.type = XkbSA_SetMods;
+        else
+            filter->upAction.type = XkbSA_SetGroup;
+        filter->filter = _XkbFilterSetState;
+        filter->priv = 0;
+        return filter->filter(xkbi, filter, keycode, pAction);
     }
     return 1;
 }
@@ -350,7 +361,7 @@ _XkbFilterLockState(XkbSrvInfoPtr xkbi,
             xkbi->state.locked_group += XkbSAGroup(&pAction->group);
         return 1;
     }
-    if (filter->keycode == 0 && pAction) { /* initial press */
+    if (filter->keycode == 0) { /* initial press */
         filter->keycode = keycode;
         filter->active = 1;
         filter->filterOthers = 0;
@@ -459,7 +470,7 @@ _XkbFilterISOLock(XkbSrvInfoPtr xkbi,
 }
 
 static CARD32
-_XkbPtrAccelExpire(OsTimerPtr timer, CARD32 now, pointer arg)
+_XkbPtrAccelExpire(OsTimerPtr timer, CARD32 now, void *arg)
 {
     XkbSrvInfoPtr xkbi = (XkbSrvInfoPtr) arg;
     XkbControlsPtr ctrls = xkbi->desc->ctrls;
@@ -529,7 +540,7 @@ _XkbFilterPointerMove(XkbSrvInfoPtr xkbi,
         xkbi->mouseKeysDY = XkbPtrActionY(&pAction->ptr);
         xkbi->mouseKeyTimer = TimerSet(xkbi->mouseKeyTimer, 0,
                                        xkbi->desc->ctrls->mk_delay,
-                                       _XkbPtrAccelExpire, (pointer) xkbi);
+                                       _XkbPtrAccelExpire, (void *) xkbi);
     }
     else if (filter->keycode == keycode) {
         filter->active = 0;
@@ -747,6 +758,15 @@ _XkbFilterActionMessage(XkbSrvInfoPtr xkbi,
     XkbMessageAction *pMsg;
     DeviceIntPtr kbd;
 
+    if ((filter->keycode != 0) && (filter->keycode != keycode))
+       return 1;
+
+    /* This can happen if the key repeats, and the state (modifiers or group)
+       changes meanwhile. */
+    if ((filter->keycode == keycode) && pAction &&
+       (pAction->type != XkbSA_ActionMessage))
+       return 1;
+
     kbd = xkbi->device;
     if (filter->keycode == 0) { /* initial press */
         pMsg = &pAction->msg;
@@ -774,20 +794,27 @@ _XkbFilterActionMessage(XkbSrvInfoPtr xkbi,
     }
     else if (filter->keycode == keycode) {
         pMsg = &filter->upAction.msg;
-        if (pMsg->flags & XkbSA_MessageOnRelease) {
-            xkbActionMessage msg;
-
-            msg.keycode = keycode;
-            msg.press = 0;
-            msg.keyEventFollows =
-                ((pMsg->flags & XkbSA_MessageGenKeyEvent) != 0);
-            memcpy((char *) msg.message, (char *) pMsg->message,
-                   XkbActionMessageLength);
-            XkbSendActionMessage(kbd, &msg);
+       if (pAction == NULL) {
+           if (pMsg->flags & XkbSA_MessageOnRelease) {
+               xkbActionMessage msg;
+
+               msg.keycode = keycode;
+               msg.press = 0;
+               msg.keyEventFollows =
+                   ((pMsg->flags & XkbSA_MessageGenKeyEvent) != 0);
+               memcpy((char *) msg.message, (char *) pMsg->message,
+                      XkbActionMessageLength);
+               XkbSendActionMessage(kbd, &msg);
+           }
+           filter->keycode = 0;
+           filter->active = 0;
+           return ((pMsg->flags & XkbSA_MessageGenKeyEvent) != 0);
+       } else if (memcmp(pMsg, pAction, 8) == 0) {
+           /* Repeat: If we send the same message, avoid multiple messages
+              on release from piling up. */
+           filter->keycode = 0;
+           filter->active = 0;
         }
-        filter->keycode = 0;
-        filter->active = 0;
-        return ((pMsg->flags & XkbSA_MessageGenKeyEvent) != 0);
     }
     return 1;
 }
@@ -803,15 +830,21 @@ _XkbFilterRedirectKey(XkbSrvInfoPtr xkbi,
     xkbDeviceInfoPtr xkbPrivPtr = XKBDEVICEINFO(xkbi->device);
     ProcessInputProc backupproc;
 
+    if ((filter->keycode != 0) && (filter->keycode != keycode))
+        return 1;
+
+    /* This can happen if the key repeats, and the state (modifiers or group)
+       changes meanwhile. */
+    if ((filter->keycode == keycode) && pAction &&
+       (pAction->type != XkbSA_RedirectKey))
+       return 1;
+
     /* never actually used uninitialised, but gcc isn't smart enough
      * to work that out. */
     memset(&old, 0, sizeof(old));
     memset(&old_prev, 0, sizeof(old_prev));
     memset(&ev, 0, sizeof(ev));
 
-    if ((filter->keycode != 0) && (filter->keycode != keycode))
-        return 1;
-
     GetSpritePosition(xkbi->device, &x, &y);
     ev.header = ET_Internal;
     ev.length = sizeof(DeviceEvent);
@@ -870,49 +903,60 @@ _XkbFilterRedirectKey(XkbSrvInfoPtr xkbi,
             xkbi->state = old;
             xkbi->prev_state = old_prev;
         }
+       return 0;
     }
-    else if (filter->keycode == keycode) {
-
-        ev.type = ET_KeyRelease;
-        ev.detail.key = filter->upAction.redirect.new_key;
-
-        mask = XkbSARedirectVModsMask(&filter->upAction.redirect);
-        mods = XkbSARedirectVMods(&filter->upAction.redirect);
-        if (mask)
-            XkbVirtualModsToReal(xkbi->desc, mask, &mask);
-        if (mods)
-            XkbVirtualModsToReal(xkbi->desc, mods, &mods);
-        mask |= filter->upAction.redirect.mods_mask;
-        mods |= filter->upAction.redirect.mods;
-
-        if (mask || mods) {
-            old = xkbi->state;
-            old_prev = xkbi->prev_state;
-            xkbi->state.base_mods &= ~mask;
-            xkbi->state.base_mods |= (mods & mask);
-            xkbi->state.latched_mods &= ~mask;
-            xkbi->state.latched_mods |= (mods & mask);
-            xkbi->state.locked_mods &= ~mask;
-            xkbi->state.locked_mods |= (mods & mask);
-            XkbComputeDerivedState(xkbi);
-            xkbi->prev_state = xkbi->state;
-        }
-
-        UNWRAP_PROCESS_INPUT_PROC(xkbi->device, xkbPrivPtr, backupproc);
-        xkbi->device->public.processInputProc((InternalEvent *) &ev,
-                                              xkbi->device);
-        COND_WRAP_PROCESS_INPUT_PROC(xkbi->device, xkbPrivPtr, backupproc,
-                                     xkbUnwrapProc);
-
-        if (mask || mods) {
-            xkbi->state = old;
-            xkbi->prev_state = old_prev;
-        }
-
-        filter->keycode = 0;
-        filter->active = 0;
+    else {
+       /* If it is a key release, or we redirect to another key, release the
+          previous new_key.  Otherwise, repeat. */
+       ev.detail.key = filter->upAction.redirect.new_key;
+       if (pAction == NULL ||  ev.detail.key != pAction->redirect.new_key) {
+           ev.type = ET_KeyRelease;
+           filter->active = 0;
+       }
+       else {
+           ev.type = ET_KeyPress;
+           ev.key_repeat = TRUE;
+       }
+
+       mask = XkbSARedirectVModsMask(&filter->upAction.redirect);
+       mods = XkbSARedirectVMods(&filter->upAction.redirect);
+       if (mask)
+           XkbVirtualModsToReal(xkbi->desc, mask, &mask);
+       if (mods)
+           XkbVirtualModsToReal(xkbi->desc, mods, &mods);
+       mask |= filter->upAction.redirect.mods_mask;
+       mods |= filter->upAction.redirect.mods;
+
+       if (mask || mods) {
+           old = xkbi->state;
+           old_prev = xkbi->prev_state;
+           xkbi->state.base_mods &= ~mask;
+           xkbi->state.base_mods |= (mods & mask);
+           xkbi->state.latched_mods &= ~mask;
+           xkbi->state.latched_mods |= (mods & mask);
+           xkbi->state.locked_mods &= ~mask;
+           xkbi->state.locked_mods |= (mods & mask);
+           XkbComputeDerivedState(xkbi);
+           xkbi->prev_state = xkbi->state;
+       }
+
+       UNWRAP_PROCESS_INPUT_PROC(xkbi->device, xkbPrivPtr, backupproc);
+       xkbi->device->public.processInputProc((InternalEvent *) &ev,
+                                             xkbi->device);
+       COND_WRAP_PROCESS_INPUT_PROC(xkbi->device, xkbPrivPtr, backupproc,
+                                    xkbUnwrapProc);
+
+       if (mask || mods) {
+           xkbi->state = old;
+           xkbi->prev_state = old_prev;
+       }
+
+       /* We return 1 in case we have sent a release event because the new_key
+          has changed.  Then, subsequently, we will call this function again
+          with the same pAction, which will create the press for the new
+          new_key. */
+       return (pAction && ev.detail.key != pAction->redirect.new_key);
     }
-    return 0;
 }
 
 static int
@@ -1051,7 +1095,6 @@ _XkbNextFreeFilter(XkbSrvInfoPtr xkbi)
         xkbi->szFilters = 4;
         xkbi->filters = calloc(xkbi->szFilters, sizeof(XkbFilterRec));
         /* 6/21/93 (ef) -- XXX! deal with allocation failure */
-        if (!(xkbi->filters)) return NULL;
     }
     for (i = 0; i < xkbi->szFilters; i++) {
         if (!xkbi->filters[i].active) {
@@ -1062,7 +1105,6 @@ _XkbNextFreeFilter(XkbSrvInfoPtr xkbi)
     xkbi->szFilters *= 2;
     xkbi->filters = realloc(xkbi->filters,
                             xkbi->szFilters * sizeof(XkbFilterRec));
-    if (!(xkbi->filters)) return NULL;
     /* 6/21/93 (ef) -- XXX! deal with allocation failure */
     memset(&xkbi->filters[xkbi->szFilters / 2], 0,
            (xkbi->szFilters / 2) * sizeof(XkbFilterRec));
@@ -1085,13 +1127,78 @@ _XkbApplyFilters(XkbSrvInfoPtr xkbi, unsigned kc, XkbAction *pAction)
     return send;
 }
 
+static int
+_XkbEnsureStateChange(XkbSrvInfoPtr xkbi)
+{
+    Bool genStateNotify = FALSE;
+
+    /* The state may change, so if we're not in the middle of sending a state
+     * notify, prepare for it */
+    if ((xkbi->flags & _XkbStateNotifyInProgress) == 0) {
+        xkbi->prev_state = xkbi->state;
+        xkbi->flags |= _XkbStateNotifyInProgress;
+        genStateNotify = TRUE;
+    }
+
+    return genStateNotify;
+}
+
+static void
+_XkbApplyState(DeviceIntPtr dev, Bool genStateNotify, int evtype, int key)
+{
+    XkbSrvInfoPtr xkbi = dev->key->xkbInfo;
+    int changed;
+
+    XkbComputeDerivedState(xkbi);
+
+    changed = XkbStateChangedFlags(&xkbi->prev_state, &xkbi->state);
+    if (genStateNotify) {
+        if (changed) {
+            xkbStateNotify sn;
+
+            sn.keycode = key;
+            sn.eventType = evtype;
+            sn.requestMajor = sn.requestMinor = 0;
+            sn.changed = changed;
+            XkbSendStateNotify(dev, &sn);
+        }
+        xkbi->flags &= ~_XkbStateNotifyInProgress;
+    }
+
+    changed = XkbIndicatorsToUpdate(dev, changed, FALSE);
+    if (changed) {
+        XkbEventCauseRec cause;
+        XkbSetCauseKey(&cause, key, evtype);
+        XkbUpdateIndicators(dev, changed, FALSE, NULL, &cause);
+    }
+}
+
+void
+XkbPushLockedStateToSlaves(DeviceIntPtr master, int evtype, int key)
+{
+    DeviceIntPtr dev;
+    Bool genStateNotify;
+
+    nt_list_for_each_entry(dev, inputInfo.devices, next) {
+        if (!dev->key || GetMaster(dev, MASTER_KEYBOARD) != master)
+            continue;
+
+        genStateNotify = _XkbEnsureStateChange(dev->key->xkbInfo);
+
+        dev->key->xkbInfo->state.locked_mods =
+            master->key->xkbInfo->state.locked_mods;
+
+        _XkbApplyState(dev, genStateNotify, evtype, key);
+    }
+}
+
 void
 XkbHandleActions(DeviceIntPtr dev, DeviceIntPtr kbd, DeviceEvent *event)
 {
     int key, bit, i;
     XkbSrvInfoPtr xkbi;
     KeyClassPtr keyc;
-    int changed, sendEvent;
+    int sendEvent;
     Bool genStateNotify;
     XkbAction act;
     XkbFilterPtr filter;
@@ -1104,15 +1211,8 @@ XkbHandleActions(DeviceIntPtr dev, DeviceIntPtr kbd, DeviceEvent *event)
     keyc = kbd->key;
     xkbi = keyc->xkbInfo;
     key = event->detail.key;
-    /* The state may change, so if we're not in the middle of sending a state
-     * notify, prepare for it */
-    if ((xkbi->flags & _XkbStateNotifyInProgress) == 0) {
-        xkbi->prev_state = xkbi->state;
-        xkbi->flags |= _XkbStateNotifyInProgress;
-        genStateNotify = TRUE;
-    }
-    else
-        genStateNotify = FALSE;
+
+    genStateNotify = _XkbEnsureStateChange(xkbi);
 
     xkbi->clearMods = xkbi->setMods = 0;
     xkbi->groupChange = 0;
@@ -1245,28 +1345,8 @@ XkbHandleActions(DeviceIntPtr dev, DeviceIntPtr kbd, DeviceEvent *event)
         FixKeyState(event, dev);
     }
 
-    XkbComputeDerivedState(xkbi);
-    changed = XkbStateChangedFlags(&xkbi->prev_state, &xkbi->state);
-    if (genStateNotify) {
-        if (changed) {
-            xkbStateNotify sn;
-
-            sn.keycode = key;
-            sn.eventType = event->type;
-            sn.requestMajor = sn.requestMinor = 0;
-            sn.changed = changed;
-            XkbSendStateNotify(dev, &sn);
-        }
-        xkbi->flags &= ~_XkbStateNotifyInProgress;
-    }
-    changed = XkbIndicatorsToUpdate(dev, changed, FALSE);
-    if (changed) {
-        XkbEventCauseRec cause;
-
-        XkbSetCauseKey(&cause, key, event->type);
-        XkbUpdateIndicators(dev, changed, FALSE, NULL, &cause);
-    }
-    return;
+    _XkbApplyState(dev, genStateNotify, event->type, key);
+    XkbPushLockedStateToSlaves(dev, event->type, key);
 }
 
 int
@@ -1407,14 +1487,12 @@ InjectPointerKeyEvents(DeviceIntPtr dev, int type, int button, int flags,
     events = InitEventList(GetMaximumEventsNum() + 1);
     OsBlockSignals();
     pScreen = miPointerGetScreen(ptr);
-    if (pScreen)
-        saveWait = miPointerSetWaitForUpdate(pScreen, FALSE);
+    saveWait = miPointerSetWaitForUpdate(pScreen, FALSE);
     nevents = GetPointerEvents(events, ptr, type, button, flags, mask);
     if (IsMaster(dev) && (lastSlave && lastSlave != ptr))
         UpdateFromMaster(&events[nevents], lastSlave, DEVCHANGE_POINTER_EVENT,
                          &nevents);
-    if (pScreen)
-        miPointerSetWaitForUpdate(pScreen, saveWait);
+    miPointerSetWaitForUpdate(pScreen, saveWait);
     OsReleaseSignals();
 
     for (i = 0; i < nevents; i++)
index 87a4485..210d8eb 100644 (file)
@@ -482,7 +482,7 @@ XkbHandleBell(BOOL force,
               BOOL eventOnly,
               DeviceIntPtr kbd,
               CARD8 percent,
-              pointer pCtrl,
+              void *pCtrl,
               CARD8 class, Atom name, WindowPtr pWin, ClientPtr pClient)
 {
     xkbBellNotify bn;
@@ -502,7 +502,7 @@ XkbHandleBell(BOOL force,
     if ((force || (xkbi->desc->ctrls->enabled_ctrls & XkbAudibleBellMask)) &&
         (!eventOnly)) {
         if (kbd->kbdfeed->BellProc)
-            (*kbd->kbdfeed->BellProc) (percent, kbd, (pointer) pCtrl, class);
+            (*kbd->kbdfeed->BellProc) (percent, kbd, (void *) pCtrl, class);
     }
     interest = kbd->xkb_interest;
     if ((!interest) || (force))
index 4e8e267..06ec46e 100644 (file)
@@ -142,7 +142,7 @@ XkbFreeRMLVOSet(XkbRMLVOSet * rmlvo, Bool freeRMLVO)
 }
 
 static Bool
-XkbWriteRulesProp(ClientPtr client, pointer closure)
+XkbWriteRulesProp(ClientPtr client, void *closure)
 {
     int len, out;
     Atom name;
@@ -206,6 +206,21 @@ XkbWriteRulesProp(ClientPtr client, pointer closure)
     return TRUE;
 }
 
+void
+XkbInitRules(XkbRMLVOSet *rmlvo,
+             const char *rules,
+             const char *model,
+             const char *layout,
+             const char *variant,
+             const char *options)
+{
+    rmlvo->rules = rules ? xnfstrdup(rules) : NULL;
+    rmlvo->model = model ? xnfstrdup(model) : NULL;
+    rmlvo->layout = layout ? xnfstrdup(layout) : NULL;
+    rmlvo->variant = variant ? xnfstrdup(variant) : NULL;
+    rmlvo->options = options ? xnfstrdup(options) : NULL;
+}
+
 static void
 XkbSetRulesUsed(XkbRMLVOSet * rmlvo)
 {
@@ -251,6 +266,21 @@ XkbSetRulesDflts(XkbRMLVOSet * rmlvo)
 }
 
 void
+XkbDeleteRulesUsed(void)
+{
+    free(XkbRulesUsed);
+    XkbRulesUsed = NULL;
+    free(XkbModelUsed);
+    XkbModelUsed = NULL;
+    free(XkbLayoutUsed);
+    XkbLayoutUsed = NULL;
+    free(XkbVariantUsed);
+    XkbVariantUsed = NULL;
+    free(XkbOptionsUsed);
+    XkbOptionsUsed = NULL;
+}
+
+void
 XkbDeleteRulesDflts(void)
 {
     free(XkbRulesDflt);
@@ -475,9 +505,10 @@ XkbInitControls(DeviceIntPtr pXDev, XkbSrvInfoPtr xkbi)
     return Success;
 }
 
-_X_EXPORT Bool
-InitKeyboardDeviceStruct(DeviceIntPtr dev, XkbRMLVOSet * rmlvo,
-                         BellProcPtr bell_func, KbdCtrlProcPtr ctrl_func)
+static Bool
+InitKeyboardDeviceStructInternal(DeviceIntPtr dev, XkbRMLVOSet * rmlvo,
+                                 const char *keymap, int keymap_length,
+                                 BellProcPtr bell_func, KbdCtrlProcPtr ctrl_func)
 {
     int i;
     unsigned int check;
@@ -488,10 +519,12 @@ InitKeyboardDeviceStruct(DeviceIntPtr dev, XkbRMLVOSet * rmlvo,
     XkbEventCauseRec cause;
     XkbRMLVOSet rmlvo_dflts = { NULL };
 
-    if (dev->key || dev->kbdfeed)
-        return FALSE;
+    BUG_RETURN_VAL(dev == NULL, FALSE);
+    BUG_RETURN_VAL(dev->key != NULL, FALSE);
+    BUG_RETURN_VAL(dev->kbdfeed != NULL, FALSE);
+    BUG_RETURN_VAL(rmlvo && keymap, FALSE);
 
-    if (!rmlvo) {
+    if (!rmlvo && !keymap) {
         rmlvo = &rmlvo_dflts;
         XkbGetRulesDflts(rmlvo);
     }
@@ -519,7 +552,7 @@ InitKeyboardDeviceStruct(DeviceIntPtr dev, XkbRMLVOSet * rmlvo,
     }
     dev->key->xkbInfo = xkbi;
 
-    if (xkb_cached_map && !XkbCompareUsedRMLVO(rmlvo)) {
+    if (xkb_cached_map && (keymap || (rmlvo && !XkbCompareUsedRMLVO(rmlvo)))) {
         XkbFreeKeyboard(xkb_cached_map, XkbAllComponentsMask, TRUE);
         xkb_cached_map = NULL;
     }
@@ -527,7 +560,11 @@ InitKeyboardDeviceStruct(DeviceIntPtr dev, XkbRMLVOSet * rmlvo,
     if (xkb_cached_map)
         LogMessageVerb(X_INFO, 4, "XKB: Reusing cached keymap\n");
     else {
-        xkb_cached_map = XkbCompileKeymap(dev, rmlvo);
+        if (rmlvo)
+            xkb_cached_map = XkbCompileKeymap(dev, rmlvo);
+        else
+            xkb_cached_map = XkbCompileKeymapFromString(dev, keymap, keymap_length);
+
         if (!xkb_cached_map) {
             ErrorF("XKB: Failed to compile keymap\n");
             goto unwind_info;
@@ -574,7 +611,8 @@ InitKeyboardDeviceStruct(DeviceIntPtr dev, XkbRMLVOSet * rmlvo,
     XkbUpdateActions(dev, xkb->min_key_code, XkbNumKeys(xkb), &changes,
                      &check, &cause);
 
-    InitFocusClassDeviceStruct(dev);
+    if (!dev->focus)
+        InitFocusClassDeviceStruct(dev);
 
     xkbi->kbdProc = ctrl_func;
     dev->kbdfeed->BellProc = bell_func;
@@ -595,8 +633,10 @@ InitKeyboardDeviceStruct(DeviceIntPtr dev, XkbRMLVOSet * rmlvo,
 
     dev->kbdfeed->CtrlProc(dev, &dev->kbdfeed->ctrl);
 
-    XkbSetRulesDflts(rmlvo);
-    XkbSetRulesUsed(rmlvo);
+    if (rmlvo) {
+        XkbSetRulesDflts(rmlvo);
+        XkbSetRulesUsed(rmlvo);
+    }
     XkbFreeRMLVOSet(&rmlvo_dflts, FALSE);
 
     return TRUE;
@@ -615,6 +655,24 @@ InitKeyboardDeviceStruct(DeviceIntPtr dev, XkbRMLVOSet * rmlvo,
     return FALSE;
 }
 
+_X_EXPORT Bool
+InitKeyboardDeviceStruct(DeviceIntPtr dev, XkbRMLVOSet * rmlvo,
+                         BellProcPtr bell_func, KbdCtrlProcPtr ctrl_func)
+{
+    return InitKeyboardDeviceStructInternal(dev, rmlvo,
+                                            NULL, 0, bell_func, ctrl_func);
+}
+
+_X_EXPORT Bool
+InitKeyboardDeviceStructFromString(DeviceIntPtr dev,
+                                   const char *keymap, int keymap_length,
+                                   BellProcPtr bell_func, KbdCtrlProcPtr ctrl_func)
+{
+    return InitKeyboardDeviceStructInternal(dev, NULL,
+                                            keymap, keymap_length,
+                                            bell_func, ctrl_func);
+}
+
 /***====================================================================***/
 
         /*
@@ -742,13 +800,15 @@ XkbProcessArguments(int argc, char *argv[], int i)
     if ((strcmp(argv[i], "-ardelay") == 0) || (strcmp(argv[i], "-ar1") == 0)) { /* -ardelay int */
         if (++i >= argc)
             UseMsg();
-        XkbDfltRepeatDelay = (long) atoi(argv[i]);
+        else
+            XkbDfltRepeatDelay = (long) atoi(argv[i]);
         return 2;
     }
     if ((strcmp(argv[i], "-arinterval") == 0) || (strcmp(argv[i], "-ar2") == 0)) {      /* -arinterval int */
         if (++i >= argc)
             UseMsg();
-        XkbDfltRepeatInterval = (long) atoi(argv[i]);
+        else
+            XkbDfltRepeatInterval = (long) atoi(argv[i]);
         return 2;
     }
     return 0;
index 3241183..b24fd6c 100644 (file)
@@ -104,13 +104,13 @@ XkbProcessKeyboardEvent(DeviceEvent *event, DeviceIntPtr keybd)
                     return;
                 }
                 if (rg->currentDown != 0) {
-                    int key = event->detail.key;
+                    int tmpkey = event->detail.key;
 
                     event->type = ET_KeyRelease;
                     event->detail.key = rg->currentDown;
                     XkbHandleActions(keybd, keybd, event);
                     event->type = ET_KeyPress;
-                    event->detail.key = key;
+                    event->detail.key = tmpkey;
                 }
                 rg->currentDown = key;
             }
index c23cd77..c14a790 100644 (file)
@@ -642,6 +642,7 @@ XkbComputeCompatState(XkbSrvInfoPtr xkbi)
     CARD16 grp_mask;
     XkbStatePtr state = &xkbi->state;
     XkbCompatMapPtr map;
+    XkbControlsPtr ctrls;
 
     if (!state || !xkbi->desc || !xkbi->desc->ctrls || !xkbi->desc->compat)
         return;
@@ -650,9 +651,14 @@ XkbComputeCompatState(XkbSrvInfoPtr xkbi)
     grp_mask = map->groups[state->group].mask;
     state->compat_state = state->mods | grp_mask;
     state->compat_lookup_mods = state->lookup_mods | grp_mask;
+    ctrls= xkbi->desc->ctrls;
 
-    if (xkbi->desc->ctrls->enabled_ctrls & XkbIgnoreGroupLockMask)
-        grp_mask = map->groups[state->base_group].mask;
+    if (ctrls->enabled_ctrls & XkbIgnoreGroupLockMask) {
+       unsigned char grp = state->base_group+state->latched_group;
+       if (grp >= ctrls->num_groups)
+           grp = XkbAdjustGroup(XkbCharToInt(grp), ctrls);
+        grp_mask = map->groups[grp].mask;
+    }
     state->compat_grab_mods = state->grab_mods | grp_mask;
     return;
 }
@@ -1993,34 +1999,40 @@ XkbCopyKeymap(XkbDescPtr dst, XkbDescPtr src)
 }
 
 Bool
-XkbCopyDeviceKeymap(DeviceIntPtr dst, DeviceIntPtr src)
+XkbDeviceApplyKeymap(DeviceIntPtr dst, XkbDescPtr desc)
 {
     xkbNewKeyboardNotify nkn;
     Bool ret;
 
-    if (!dst->key || !src->key)
+    if (!dst->key || !desc)
         return FALSE;
 
     memset(&nkn, 0, sizeof(xkbNewKeyboardNotify));
     nkn.oldMinKeyCode = dst->key->xkbInfo->desc->min_key_code;
     nkn.oldMaxKeyCode = dst->key->xkbInfo->desc->max_key_code;
     nkn.deviceID = dst->id;
-    nkn.oldDeviceID = dst->id;  /* maybe src->id? */
-    nkn.minKeyCode = src->key->xkbInfo->desc->min_key_code;
-    nkn.maxKeyCode = src->key->xkbInfo->desc->max_key_code;
+    nkn.oldDeviceID = dst->id;
+    nkn.minKeyCode = desc->min_key_code;
+    nkn.maxKeyCode = desc->max_key_code;
     nkn.requestMajor = XkbReqCode;
     nkn.requestMinor = X_kbSetMap;      /* Near enough's good enough. */
     nkn.changed = XkbNKN_KeycodesMask;
-    if (src->key->xkbInfo->desc->geom)
+    if (desc->geom)
         nkn.changed |= XkbNKN_GeometryMask;
 
-    ret = XkbCopyKeymap(dst->key->xkbInfo->desc, src->key->xkbInfo->desc);
+    ret = XkbCopyKeymap(dst->key->xkbInfo->desc, desc);
     if (ret)
         XkbSendNewKeyboardNotify(dst, &nkn);
 
     return ret;
 }
 
+Bool
+XkbCopyDeviceKeymap(DeviceIntPtr dst, DeviceIntPtr src)
+{
+    return XkbDeviceApplyKeymap(dst, src->key->xkbInfo->desc);
+}
+
 int
 XkbGetEffectiveGroup(XkbSrvInfoPtr xkbi, XkbStatePtr xkbState, CARD8 keycode)
 {
@@ -2084,3 +2096,26 @@ XkbMergeLockedPtrBtns(DeviceIntPtr master)
         xkbi->lockedPtrButtons |= d->key->xkbInfo->lockedPtrButtons;
     }
 }
+
+void
+XkbCopyControls(XkbDescPtr dst, XkbDescPtr src)
+{
+    int i, nG, nTG;
+
+    if (!dst || !src)
+        return;
+
+    *dst->ctrls = *src->ctrls;
+
+    for (nG = nTG = 0, i = dst->min_key_code; i <= dst->max_key_code; i++) {
+        nG = XkbKeyNumGroups(dst, i);
+        if (nG >= XkbNumKbdGroups) {
+            nTG = XkbNumKbdGroups;
+            break;
+        }
+        if (nG > nTG) {
+            nTG = nG;
+        }
+    }
+    dst->ctrls->num_groups = nTG;
+}
index cd1ae0b..7bb6cea 100644 (file)
@@ -522,7 +522,7 @@ XkbWriteXKBSymbols(FILE * file,
                     for (s = 0; s < XkbKeyGroupWidth(xkb, i, g); s++) {
                         if (s != 0)
                             fprintf(file, ", ");
-                        WriteXKBAction(file, xkb, (XkbAnyAction *) & acts[s]);
+                        WriteXKBAction(file, xkb, (XkbAnyAction *) &acts[s]);
                     }
                     fprintf(file, " ]");
                     acts += XkbKeyGroupsWidth(xkb, i);
index f66a08f..fdf1d17 100644 (file)
@@ -1266,7 +1266,6 @@ XkbBehaviorText(XkbDescPtr xkb, XkbBehavior * behavior, unsigned format)
         }
         else if (type == XkbKB_RadioGroup) {
             int g;
-            char *tmp;
 
             g = ((behavior->data) & (~XkbKB_RGAllowNone)) + 1;
             if (XkbKB_RGAllowNone & behavior->data) {
index 45da965..b6241b5 100644 (file)
@@ -772,8 +772,6 @@ ReadXkmSymbols(FILE * file, XkbDescPtr xkb)
         memset((char *) typeName, 0, XkbNumKbdGroups * sizeof(Atom));
         memset((char *) type, 0, XkbNumKbdGroups * sizeof(XkbKeyTypePtr));
         if (wireMap.flags & XkmKeyHasTypes) {
-            register int g;
-
             for (g = 0; g < XkbNumKbdGroups; g++) {
                 if ((wireMap.flags & (1 << g)) &&
                     ((tmp = XkmGetCountedString(file, buf, 100)) > 0)) {
@@ -1206,7 +1204,8 @@ XkmReadTOC(FILE * file, xkmFileInfo * file_info, int max_toc,
         }
         return 0;
     }
-    fread(file_info, SIZEOF(xkmFileInfo), 1, file);
+    if (fread(file_info, SIZEOF(xkmFileInfo), 1, file) != 1)
+        return 0;
     size_toc = file_info->num_toc;
     if (size_toc > max_toc) {
         DebugF("Warning! Too many TOC entries; last %d ignored\n",
@@ -1214,7 +1213,8 @@ XkmReadTOC(FILE * file, xkmFileInfo * file_info, int max_toc,
         size_toc = max_toc;
     }
     for (i = 0; i < size_toc; i++) {
-        fread(&toc[i], SIZEOF(xkmSectionInfo), 1, file);
+        if (fread(&toc[i], SIZEOF(xkmSectionInfo), 1, file) != 1)
+            return 0;
     }
     return 1;
 }
old mode 100644 (file)
new mode 100755 (executable)
index bdecf62..18255b9 100644 (file)
@@ -23,10 +23,10 @@ dnl other dealings in this Software without prior written authorization
 dnl from the copyright holders.
 dnl 
 
-# XORG_DRIVER_CHECK_EXT()
+# XORG_DRIVER_CHECK_EXT(MACRO, PROTO)
 # --------------------------
-# Checks for the $1 define in xorg-server.h (from the sdk).  If it
-# is defined, then add $1 to $REQUIRED_MODULES.
+# Checks for the MACRO define in xorg-server.h (from the sdk).  If it
+# is defined, then add the given PROTO to $REQUIRED_MODULES.
 
 AC_DEFUN([XORG_DRIVER_CHECK_EXT],[
        AC_REQUIRE([PKG_PROG_PKG_CONFIG])
index b6be445..5edd444 100644 (file)
@@ -6,5 +6,7 @@
                <filesystem path="/usr/bin/Xorg" label="xorg" exec_label="xorg"/>
                <filesystem path="/usr/bin/cvt" label="xorg" exec_label="xorg"/>
                <filesystem path="/usr/bin/gtf" label="xorg" exec_label="xorg"/>
+               <filesystem path="/usr/lib/xorg/xserver-keymap-dir" label="_" exec_label="none"/>
+               <filesystem path="/var/xkb" label="xorg" exec_label="none"/>
        </assign>
 </manifest>