Added SDL_LockRect() and SDL_UnlockRect()
authorSam Lantinga <slouken@libsdl.org>
Tue, 05 Mar 2002 19:55:32 +0000
changeset 292eadc0746dfaf
parent 291 68a8a8237c09
child 293 585a7e1285ae
Added SDL_LockRect() and SDL_UnlockRect()
Incorporated XFree86 extension libraries into the source
Makefile.am
WhatsNew
configure.in
docs.html
include/SDL_video.h
src/main/beos/exports/SDL.exp
src/main/macos/exports/SDL.x
src/main/macosx/exports/SDL.x
src/main/win32/exports/SDL.def
src/video/Makefile.am
src/video/SDL_surface.c
src/video/SDL_sysvideo.h
src/video/SDL_yuv_sw.c
src/video/Xext/Makefile.am
src/video/Xext/README
src/video/Xext/Xinerama/Makefile.am
src/video/Xext/Xinerama/Xinerama.c
src/video/Xext/Xv/Makefile.am
src/video/Xext/Xv/Xv.c
src/video/Xext/Xv/Xvlibint.h
src/video/Xext/Xxf86dga/Makefile.am
src/video/Xext/Xxf86dga/XF86DGA.c
src/video/Xext/Xxf86dga/XF86DGA2.c
src/video/Xext/Xxf86vm/Makefile.am
src/video/Xext/Xxf86vm/XF86VMode.c
src/video/Xext/extensions/Makefile.am
src/video/Xext/extensions/SDLname.h
src/video/Xext/extensions/Xinerama.h
src/video/Xext/extensions/Xv.h
src/video/Xext/extensions/Xvlib.h
src/video/Xext/extensions/Xvproto.h
src/video/Xext/extensions/extutil.h
src/video/Xext/extensions/panoramiXext.h
src/video/Xext/extensions/panoramiXproto.h
src/video/Xext/extensions/xf86dga.h
src/video/Xext/extensions/xf86dga1.h
src/video/Xext/extensions/xf86dga1str.h
src/video/Xext/extensions/xf86dgastr.h
src/video/Xext/extensions/xf86vmode.h
src/video/Xext/extensions/xf86vmstr.h
src/video/dga/SDL_dgaevents.c
src/video/dga/SDL_dgavideo.c
src/video/windx5/SDL_dx5video.c
src/video/x11/SDL_x11dga.c
src/video/x11/SDL_x11gamma.c
src/video/x11/SDL_x11modes.c
src/video/x11/SDL_x11video.h
src/video/x11/SDL_x11yuv.c
test/configure.in
     1.1 --- a/Makefile.am	Sat Mar 02 16:50:35 2002 +0000
     1.2 +++ b/Makefile.am	Tue Mar 05 19:55:32 2002 +0000
     1.3 @@ -45,7 +45,7 @@
     1.4  	EpocBuildFiles.zip \
     1.5          WhatsNew	\
     1.6          docs.html	\
     1.7 -        sdl.m4		\
     1.8 +	sdl.m4		\
     1.9          SDL.spec	\
    1.10          autogen.sh	\
    1.11          strip_fPIC.sh
     2.1 --- a/WhatsNew	Sat Mar 02 16:50:35 2002 +0000
     2.2 +++ b/WhatsNew	Tue Mar 05 19:55:32 2002 +0000
     2.3 @@ -3,6 +3,12 @@
     2.4  
     2.5  Version 1.0:
     2.6  
     2.7 +1.2.4:
     2.8 +	Added SDL_LockRect() and SDL_UnlockRect() to lock a portion of a
     2.9 +	surface.  This may be more efficient than a full lock if you are
    2.10 +	using a hardware surface and plan to make a few changes to small
    2.11 +	areas in the surface.
    2.12 +
    2.13  1.2.0:
    2.14  	Added SDL_VIDEOEXPOSE event to signal that the screen needs to
    2.15  	be redrawn.  This is currently only delivered to OpenGL windows
     3.1 --- a/configure.in	Sat Mar 02 16:50:35 2002 +0000
     3.2 +++ b/configure.in	Tue Mar 05 19:55:32 2002 +0000
     3.3 @@ -372,7 +372,7 @@
     3.4  CheckNAS()
     3.5  {
     3.6      AC_ARG_ENABLE(nas,
     3.7 -[  --enable-nas		  support the NAS audio API [default=yes]],
     3.8 +[  --enable-nas                  support the NAS audio API [default=yes]],
     3.9                    , enable_nas=yes)
    3.10      if test x$enable_audio = xyes -a x$enable_nas = xyes; then
    3.11          AC_MSG_CHECKING(for NAS audio support)
    3.12 @@ -394,7 +394,7 @@
    3.13  CheckDiskAudio()
    3.14  {
    3.15      AC_ARG_ENABLE(diskaudio,
    3.16 -[  --enable-diskaudio  	  support the disk writer audio driver [default=yes]],
    3.17 +[  --enable-diskaudio            support the disk writer audio driver [default=yes]],
    3.18                    , enable_diskaudio=yes)
    3.19      if test x$enable_audio = xyes -a x$enable_diskaudio = xyes; then
    3.20          CFLAGS="$CFLAGS -DDISKAUD_SUPPORT"
    3.21 @@ -445,44 +445,44 @@
    3.22  dnl Find the nanox include and library directories
    3.23  CheckNANOX()
    3.24  {
    3.25 -	AC_ARG_ENABLE(video-nanox,
    3.26 -		[  --enable-video-nanox use nanox video driver [default=no]],
    3.27 -	        , enable_video_nanox=no)
    3.28 -	AC_ARG_ENABLE(nanox-debug,  
    3.29 -		[  --enable-nanox-debug print debug messages [default=no]],
    3.30 -		, enable_nanox_debug=no)
    3.31 -	AC_ARG_ENABLE(nanox-share-memory,  
    3.32 -		[  --enable-nanox-share-memory use share memory [default=no]],
    3.33 -		, enable_nanox_share_memory=no)
    3.34 +    AC_ARG_ENABLE(video-nanox,
    3.35 +        [  --enable-video-nanox use nanox video driver [default=no]],
    3.36 +        , enable_video_nanox=no)
    3.37 +    AC_ARG_ENABLE(nanox-debug,  
    3.38 +        [  --enable-nanox-debug print debug messages [default=no]],
    3.39 +        , enable_nanox_debug=no)
    3.40 +    AC_ARG_ENABLE(nanox-share-memory,  
    3.41 +        [  --enable-nanox-share-memory use share memory [default=no]],
    3.42 +        , enable_nanox_share_memory=no)
    3.43  
    3.44 -	AC_ARG_WITH(nanox_pixel_type, 
    3.45 -		[  --with-nanox-pixel-type=[rgb/0888/888/565/555/332/pal]])
    3.46 +    AC_ARG_WITH(nanox_pixel_type, 
    3.47 +        [  --with-nanox-pixel-type=[rgb/0888/888/565/555/332/pal]])
    3.48  
    3.49 -	if test x$enable_video = xyes -a x$enable_video_nanox = xyes; then
    3.50 -		if test x$enable_nanox_debug = xyes; then
    3.51 -			CFLAGS="$CFLAGS -DENABLE_NANOX_DEBUG"
    3.52 -		fi
    3.53 +    if test x$enable_video = xyes -a x$enable_video_nanox = xyes; then
    3.54 +        if test x$enable_nanox_debug = xyes; then
    3.55 +            CFLAGS="$CFLAGS -DENABLE_NANOX_DEBUG"
    3.56 +        fi
    3.57  
    3.58 -		if test x$enable_nanox_share_memory = xyes; then
    3.59 -			CFLAGS="$CFLAGS -DNANOX_SHARE_MEMORY"
    3.60 -		fi
    3.61 +        if test x$enable_nanox_share_memory = xyes; then
    3.62 +            CFLAGS="$CFLAGS -DNANOX_SHARE_MEMORY"
    3.63 +        fi
    3.64  
    3.65 -		case "$with_nanox_pixel_type" in
    3.66 -			 rgb) CFLAGS="$CFLAGS -DNANOX_PIXEL_RGB" ;;
    3.67 -			0888) CFLAGS="$CFLAGS -DNANOX_PIXEL_0888" ;;
    3.68 -			 888) CFLAGS="$CFLAGS -DNANOX_PIXEL_888"  ;;
    3.69 -			 565) CFLAGS="$CFLAGS -DNANOX_PIXEL_565"  ;;
    3.70 -			 555) CFLAGS="$CFLAGS -DNANOX_PIXEL_555"  ;;
    3.71 -			 332) CFLAGS="$CFLAGS -DNANOX_PIXEL_332"  ;;
    3.72 -			 pal) CFLAGS="$CFLAGS -DNANOX_PIXEL_PAL"  ;;
    3.73 -			   *) AC_MSG_ERROR([Invalid nanox_pixel_type]);;
    3.74 -		esac
    3.75 +        case "$with_nanox_pixel_type" in
    3.76 +             rgb) CFLAGS="$CFLAGS -DNANOX_PIXEL_RGB" ;;
    3.77 +            0888) CFLAGS="$CFLAGS -DNANOX_PIXEL_0888" ;;
    3.78 +             888) CFLAGS="$CFLAGS -DNANOX_PIXEL_888"  ;;
    3.79 +             565) CFLAGS="$CFLAGS -DNANOX_PIXEL_565"  ;;
    3.80 +             555) CFLAGS="$CFLAGS -DNANOX_PIXEL_555"  ;;
    3.81 +             332) CFLAGS="$CFLAGS -DNANOX_PIXEL_332"  ;;
    3.82 +             pal) CFLAGS="$CFLAGS -DNANOX_PIXEL_PAL"  ;;
    3.83 +               *) AC_MSG_ERROR([Invalid nanox_pixel_type]);;
    3.84 +        esac
    3.85  
    3.86 -		CFLAGS="$CFLAGS $X_CFLAGS -DENABLE_NANOX"
    3.87 -		SYSTEM_LIBS="$SYSTEM_LIBS -lnano-X"
    3.88 -		VIDEO_SUBDIRS="$VIDEO_SUBDIRS nanox"
    3.89 -		VIDEO_DRIVERS="$VIDEO_DRIVERS nanox/libvideo_nanox.la"
    3.90 -	fi
    3.91 +        CFLAGS="$CFLAGS $X_CFLAGS -DENABLE_NANOX"
    3.92 +        SYSTEM_LIBS="$SYSTEM_LIBS -lnano-X"
    3.93 +        VIDEO_SUBDIRS="$VIDEO_SUBDIRS nanox"
    3.94 +        VIDEO_DRIVERS="$VIDEO_DRIVERS nanox/libvideo_nanox.la"
    3.95 +    fi
    3.96  }
    3.97  
    3.98  dnl Find the X11 include and library directories
    3.99 @@ -495,7 +495,7 @@
   3.100          AC_PATH_X
   3.101          AC_PATH_XTRA
   3.102          if test x$have_x = xyes; then
   3.103 -            CFLAGS="$CFLAGS $X_CFLAGS -DENABLE_X11"
   3.104 +            CFLAGS="$CFLAGS $X_CFLAGS -DENABLE_X11 -Isrc/video"
   3.105              if test x$ac_cv_func_shmat != xyes; then
   3.106                  CFLAGS="$CFLAGS -DNO_SHARED_MEMORY"
   3.107              fi
   3.108 @@ -511,7 +511,7 @@
   3.109                  video_x11_vm=no
   3.110                  AC_TRY_COMPILE([
   3.111                   #include <X11/Xlib.h>
   3.112 -                 #include <X11/extensions/xf86vmode.h>
   3.113 +                 #include <XFree86/extensions/xf86vmode.h>
   3.114                  ],[
   3.115                  ],[
   3.116                  video_x11_vm=yes
   3.117 @@ -519,34 +519,15 @@
   3.118                  AC_MSG_RESULT($video_x11_vm)
   3.119                  if test x$video_x11_vm = xyes; then
   3.120                      CFLAGS="$CFLAGS -DXFREE86_VM"
   3.121 -                    # Check for nasty XFree86 4.0/Glide hack
   3.122 -                    AC_ARG_ENABLE(xfree86_glidehack,
   3.123 -[  --enable-xfree86-glidehack Alternate vidmode lib for old Glide [default=no]],
   3.124 -                                  , enable_xfreeglidehack=no)
   3.125 -                    if test x$enable_xfree86_glidehack = xyes; then
   3.126 -                        ac_save_libs="$LIBS"
   3.127 -                        LIBS="$LIBS $X_LIBS -lX11 -lXext"
   3.128 -                        if test x$xfree86_glidehack = x; then
   3.129 -                            AC_CHECK_LIB(Xxf86vm, XF40VidModeQueryExtension, xfree86_glidehack=Xxf86vm)
   3.130 -                        fi
   3.131 -                        if test x$xfree86_glidehack = x; then
   3.132 -                            AC_CHECK_LIB(Xxf86vm40, XF40VidModeQueryExtension, xfree86_glidehack=Xxf86vm40)
   3.133 -                        fi
   3.134 -                        LIBS="$ac_save_libs"
   3.135 -                    fi
   3.136 -                    if test x$xfree86_glidehack != x; then
   3.137 -                        CFLAGS="$CFLAGS -DXFREE86_VM_DYNAMIC_HACK"
   3.138 -                        SYSTEM_LIBS="$SYSTEM_LIBS -l$xfree86_glidehack"
   3.139 -                    else
   3.140 -                        SYSTEM_LIBS="$SYSTEM_LIBS -lXxf86vm"
   3.141 -                    fi
   3.142 +                    VIDEO_SUBDIRS="$VIDEO_SUBDIRS XFree86/Xxf86vm"
   3.143 +                    VIDEO_DRIVERS="$VIDEO_DRIVERS XFree86/Xxf86vm/libXFree86_Xxf86vm.la"
   3.144                      AC_MSG_CHECKING(for XFree86 VidMode gamma support)
   3.145                      video_x11_vmgamma=no
   3.146                      AC_TRY_COMPILE([
   3.147                       #include <X11/Xlib.h>
   3.148 -                     #include <X11/extensions/xf86vmode.h>
   3.149 +                     #include <XFree86/extensions/xf86vmode.h>
   3.150                      ],[
   3.151 -                     XF86VidModeGamma gamma;
   3.152 +                     SDL_NAME(XF86VidModeGamma) gamma;
   3.153                      ],[
   3.154                      video_x11_vmgamma=yes
   3.155                      ])
   3.156 @@ -567,7 +548,7 @@
   3.157                  video_x11_dga=no
   3.158                  AC_TRY_COMPILE([
   3.159                   #include <X11/Xlib.h>
   3.160 -                 #include <X11/extensions/xf86dga.h>
   3.161 +                 #include <XFree86/extensions/xf86dga.h>
   3.162                  ],[
   3.163                  ],[
   3.164                  video_x11_dga=yes
   3.165 @@ -578,7 +559,8 @@
   3.166                      if test x$enable_video_x11_dgamouse = xyes; then
   3.167                          CFLAGS="$CFLAGS -DDEFAULT_DGAMOUSE"
   3.168                      fi
   3.169 -                    SYSTEM_LIBS="$SYSTEM_LIBS -lXxf86dga"
   3.170 +                    VIDEO_SUBDIRS="$VIDEO_SUBDIRS XFree86/Xxf86dga"
   3.171 +                    VIDEO_DRIVERS="$VIDEO_DRIVERS XFree86/Xxf86dga/libXFree86_Xxf86dga.la"
   3.172                  fi
   3.173              fi
   3.174              AC_ARG_ENABLE(video-x11-xv,
   3.175 @@ -592,16 +574,17 @@
   3.176                   #include <sys/ipc.h>
   3.177                   #include <sys/shm.h>
   3.178                   #include <X11/extensions/XShm.h>
   3.179 -                 #include <X11/extensions/Xvlib.h>
   3.180 +                 #include <XFree86/extensions/Xvlib.h>
   3.181                  ],[
   3.182 -                 XvImage *image;
   3.183 +                 SDL_NAME(XvImage) *image;
   3.184                  ],[
   3.185                  video_x11_xv=yes
   3.186                  ])
   3.187                  AC_MSG_RESULT($video_x11_xv)
   3.188                  if test x$video_x11_xv = xyes; then
   3.189                      CFLAGS="$CFLAGS -DXFREE86_XV"
   3.190 -                    SYSTEM_LIBS="$SYSTEM_LIBS -lXv"
   3.191 +                    VIDEO_SUBDIRS="$VIDEO_SUBDIRS XFree86/Xv"
   3.192 +                    VIDEO_DRIVERS="$VIDEO_DRIVERS XFree86/Xv/libXFree86_Xv.la"
   3.193                  fi
   3.194              fi
   3.195              AC_ARG_ENABLE(video-x11-xinerama,
   3.196 @@ -612,16 +595,17 @@
   3.197                  video_x11_xinerama=no
   3.198                  AC_TRY_COMPILE([
   3.199                   #include <X11/Xlib.h>
   3.200 -                 #include <X11/extensions/Xinerama.h>
   3.201 +                 #include <XFree86/extensions/Xinerama.h>
   3.202                  ],[
   3.203 -                 XineramaScreenInfo *xinerama;
   3.204 +                 SDL_NAME(XineramaScreenInfo) *xinerama;
   3.205                  ],[
   3.206                  video_x11_xinerama=yes
   3.207                  ])
   3.208                  AC_MSG_RESULT($video_x11_xinerama)
   3.209                  if test x$video_x11_xinerama = xyes; then
   3.210                      CFLAGS="$CFLAGS -DHAVE_XINERAMA"
   3.211 -                    SYSTEM_LIBS="$SYSTEM_LIBS -lXinerama"
   3.212 +                    VIDEO_SUBDIRS="$VIDEO_SUBDIRS XFree86/Xinerama"
   3.213 +                    VIDEO_DRIVERS="$VIDEO_DRIVERS XFree86/Xinerama/libXFree86_Xinerama.la"
   3.214                  fi
   3.215              fi
   3.216              AC_ARG_ENABLE(video-x11-xme,
   3.217 @@ -648,6 +632,33 @@
   3.218      fi
   3.219  }
   3.220  
   3.221 +dnl Find the X11 DGA 2.0 include and library directories
   3.222 +CheckDGA()
   3.223 +{
   3.224 +    AC_ARG_ENABLE(video-dga,
   3.225 +[  --enable-video-dga      use DGA 2.0 video driver [default=yes]],
   3.226 +                  , enable_video_dga=yes)
   3.227 +    if test x$video_x11_dga = xyes -a x$enable_video_dga = xyes; then
   3.228 +        save_CFLAGS="$CFLAGS"; CFLAGS="$CFLAGS -Isrc/video"
   3.229 +        AC_MSG_CHECKING(for XFree86 DGA 2.0 support)
   3.230 +        video_x11_dga2=no
   3.231 +        AC_TRY_COMPILE([
   3.232 +         #include <X11/Xlib.h>
   3.233 +         #include <XFree86/extensions/xf86dga.h>
   3.234 +        ],[
   3.235 +         SDL_NAME(XDGAEvent) xevent;
   3.236 +        ],[
   3.237 +        video_x11_dga2=yes
   3.238 +        ])
   3.239 +        AC_MSG_RESULT($video_x11_dga2)
   3.240 +        if test x$video_x11_dga2 = xyes; then
   3.241 +            CFLAGS="$CFLAGS -DENABLE_DGA"
   3.242 +            VIDEO_SUBDIRS="$VIDEO_SUBDIRS dga"
   3.243 +            VIDEO_DRIVERS="$VIDEO_DRIVERS dga/libvideo_dga.la"
   3.244 +        fi
   3.245 +    fi
   3.246 +}
   3.247 +
   3.248  CheckPHOTON()
   3.249  {
   3.250      AC_ARG_ENABLE(video-photon,
   3.251 @@ -677,32 +688,6 @@
   3.252      fi
   3.253  }
   3.254  
   3.255 -dnl Find the X11 DGA 2.0 include and library directories
   3.256 -CheckDGA()
   3.257 -{
   3.258 -    AC_ARG_ENABLE(video-dga,
   3.259 -[  --enable-video-dga      use DGA 2.0 video driver [default=yes]],
   3.260 -                  , enable_video_dga=yes)
   3.261 -    if test x$video_x11_dga = xyes -a x$enable_video_dga = xyes; then
   3.262 -        AC_MSG_CHECKING(for XFree86 DGA 2.0 support)
   3.263 -        video_x11_dga2=no
   3.264 -        AC_TRY_COMPILE([
   3.265 -         #include <X11/Xlib.h>
   3.266 -         #include <X11/extensions/xf86dga.h>
   3.267 -        ],[
   3.268 -         XDGAEvent xevent;
   3.269 -        ],[
   3.270 -        video_x11_dga2=yes
   3.271 -        ])
   3.272 -        AC_MSG_RESULT($video_x11_dga2)
   3.273 -        if test x$video_x11_dga2 = xyes; then
   3.274 -            CFLAGS="$CFLAGS -DENABLE_DGA"
   3.275 -            VIDEO_SUBDIRS="$VIDEO_SUBDIRS dga"
   3.276 -            VIDEO_DRIVERS="$VIDEO_DRIVERS dga/libvideo_dga.la"
   3.277 -        fi
   3.278 -    fi
   3.279 -}
   3.280 -
   3.281  dnl Find the framebuffer console includes
   3.282  CheckFBCON()
   3.283  {
   3.284 @@ -2335,6 +2320,7 @@
   3.285  CFLAGS="$CFLAGS -I\$(top_srcdir)/src/main"
   3.286  CFLAGS="$CFLAGS -I\$(top_srcdir)/src/audio"
   3.287  CFLAGS="$CFLAGS -I\$(top_srcdir)/src/video"
   3.288 +CFLAGS="$CFLAGS -I\$(top_srcdir)/src/video/XFree86/extensions"
   3.289  CFLAGS="$CFLAGS -I\$(top_srcdir)/src/events"
   3.290  CFLAGS="$CFLAGS -I\$(top_srcdir)/src/joystick"
   3.291  CFLAGS="$CFLAGS -I\$(top_srcdir)/src/cdrom"
   3.292 @@ -2391,6 +2377,12 @@
   3.293  src/audio/windx5/Makefile
   3.294  src/audio/disk/Makefile
   3.295  src/video/Makefile
   3.296 +src/video/XFree86/Makefile
   3.297 +src/video/XFree86/extensions/Makefile
   3.298 +src/video/XFree86/Xinerama/Makefile
   3.299 +src/video/XFree86/Xv/Makefile
   3.300 +src/video/XFree86/Xxf86dga/Makefile
   3.301 +src/video/XFree86/Xxf86vm/Makefile
   3.302  src/video/cybergfx/Makefile
   3.303  src/video/x11/Makefile
   3.304  src/video/dga/Makefile
     4.1 --- a/docs.html	Sat Mar 02 16:50:35 2002 +0000
     4.2 +++ b/docs.html	Tue Mar 05 19:55:32 2002 +0000
     4.3 @@ -16,6 +16,8 @@
     4.4  Major changes since SDL 1.0.0:
     4.5  </H2>
     4.6  <UL>
     4.7 +	<LI> 1.2.4: Added SDL_LockRect() and SDL_UnlockRect()
     4.8 +	<LI> 1.2.4: Incorporated XFree86 extension libraries into the source
     4.9  	<LI> 1.2.4: Added initial support for Atari (thanks Patrice!)
    4.10  	<LI> 1.2.4: Added support for joysticks on *BSD (thanks Wilbern!)
    4.11  	<LI> 1.2.4: Added a YUV overlay test program (thanks Jon!)
     5.1 --- a/include/SDL_video.h	Sat Mar 02 16:50:35 2002 +0000
     5.2 +++ b/include/SDL_video.h	Tue Mar 05 19:55:32 2002 +0000
     5.3 @@ -532,6 +532,26 @@
     5.4  extern DECLSPEC void SDL_UnlockSurface(SDL_Surface *surface);
     5.5  
     5.6  /*
     5.7 + * SDL_LockRect() locks a portion of the surface designated by the 'rect'
     5.8 + * parameter, and saves the resulting pixels and pitch in the arguments.
     5.9 + * The rect will be clipped if it extends beyond the bounds of the surface
    5.10 + *
    5.11 + * This may be more efficient than a full lock if you are using a hardware
    5.12 + * surface and plan to make a few changes to small areas in the surface.
    5.13 + *
    5.14 + * While a rectangle is locked, no other lock or blit call may be called
    5.15 + * on the surface.  No operating system or library calls should be made
    5.16 + * between lock/unlock pairs, as critical system locks may be held during
    5.17 + * this time.
    5.18 + *
    5.19 + * After the surface is unlocked, the pixels pointer is no longer valid.
    5.20 + *
    5.21 + * SDL_LockRect() returns 0, or -1 if the surface couldn't be locked.
    5.22 + */
    5.23 +extern DECLSPEC int SDL_LockRect(SDL_Surface *surface, SDL_Rect *rect, void **pixels, int *pitch);
    5.24 +extern DECLSPEC void SDL_UnlockRect(SDL_Surface *surface);
    5.25 +
    5.26 +/*
    5.27   * Load a surface from a seekable SDL data source (memory or file.)
    5.28   * If 'freesrc' is non-zero, the source will be closed after being read.
    5.29   * Returns the new surface, or NULL if there was an error.
     6.1 --- a/src/main/beos/exports/SDL.exp	Sat Mar 02 16:50:35 2002 +0000
     6.2 +++ b/src/main/beos/exports/SDL.exp	Tue Mar 05 19:55:32 2002 +0000
     6.3 @@ -74,6 +74,7 @@
     6.4  _SDL_GetModState
     6.5  _SDL_SetModState
     6.6  _SDL_GetKeyName
     6.7 +_SDL_SetModuleHandle
     6.8  _SDL_RegisterApp
     6.9  _SDL_InitQuickDraw
    6.10  _SDL_GetMouseState
    6.11 @@ -143,6 +144,8 @@
    6.12  _SDL_FreeSurface
    6.13  _SDL_LockSurface
    6.14  _SDL_UnlockSurface
    6.15 +_SDL_LockRect
    6.16 +_SDL_UnlockRect
    6.17  _SDL_LoadBMP_RW
    6.18  _SDL_SaveBMP_RW
    6.19  _SDL_SetColorKey
    6.20 @@ -174,3 +177,4 @@
    6.21  _SDL_WM_IconifyWindow
    6.22  _SDL_WM_ToggleFullScreen
    6.23  _SDL_WM_GrabInput
    6.24 +_SDL_SoftStretch
     7.1 --- a/src/main/macos/exports/SDL.x	Sat Mar 02 16:50:35 2002 +0000
     7.2 +++ b/src/main/macos/exports/SDL.x	Tue Mar 05 19:55:32 2002 +0000
     7.3 @@ -143,6 +143,8 @@
     7.4  	SDL_FreeSurface
     7.5  	SDL_LockSurface
     7.6  	SDL_UnlockSurface
     7.7 +	SDL_LockRect
     7.8 +	SDL_UnlockRect
     7.9  	SDL_LoadBMP_RW
    7.10  	SDL_SaveBMP_RW
    7.11  	SDL_SetColorKey
    7.12 @@ -174,4 +176,5 @@
    7.13  	SDL_WM_IconifyWindow
    7.14  	SDL_WM_ToggleFullScreen
    7.15  	SDL_WM_GrabInput
    7.16 +	SDL_SoftStretch
    7.17  	SDL_InitQuickDraw
     8.1 --- a/src/main/macosx/exports/SDL.x	Sat Mar 02 16:50:35 2002 +0000
     8.2 +++ b/src/main/macosx/exports/SDL.x	Tue Mar 05 19:55:32 2002 +0000
     8.3 @@ -141,6 +141,8 @@
     8.4  	_SDL_FreeSurface
     8.5  	_SDL_LockSurface
     8.6  	_SDL_UnlockSurface
     8.7 +	_SDL_LockRect
     8.8 +	_SDL_UnlockRect
     8.9  	_SDL_LoadBMP_RW
    8.10  	_SDL_SaveBMP_RW
    8.11  	_SDL_SetColorKey
     9.1 --- a/src/main/win32/exports/SDL.def	Sat Mar 02 16:50:35 2002 +0000
     9.2 +++ b/src/main/win32/exports/SDL.def	Tue Mar 05 19:55:32 2002 +0000
     9.3 @@ -74,6 +74,7 @@
     9.4  	SDL_GetModState
     9.5  	SDL_SetModState
     9.6  	SDL_GetKeyName
     9.7 +	SDL_SetModuleHandle
     9.8  	SDL_RegisterApp
     9.9  	SDL_InitQuickDraw
    9.10  	SDL_GetMouseState
    9.11 @@ -143,6 +144,8 @@
    9.12  	SDL_FreeSurface
    9.13  	SDL_LockSurface
    9.14  	SDL_UnlockSurface
    9.15 +	SDL_LockRect
    9.16 +	SDL_UnlockRect
    9.17  	SDL_LoadBMP_RW
    9.18  	SDL_SaveBMP_RW
    9.19  	SDL_SetColorKey
    10.1 --- a/src/video/Makefile.am	Sat Mar 02 16:50:35 2002 +0000
    10.2 +++ b/src/video/Makefile.am	Tue Mar 05 19:55:32 2002 +0000
    10.3 @@ -9,7 +9,7 @@
    10.4                 wincommon windib windx5 \
    10.5                 maccommon macdsp macrom quartz \
    10.6                 bwindow ps2gs photon cybergfx epoc \
    10.7 -               ataricommon xbios gem
    10.8 +               ataricommon xbios gem XFree86
    10.9  
   10.10  DRIVERS = @VIDEO_DRIVERS@
   10.11  
    11.1 --- a/src/video/SDL_surface.c	Sat Mar 02 16:50:35 2002 +0000
    11.2 +++ b/src/video/SDL_surface.c	Tue Mar 05 19:55:32 2002 +0000
    11.3 @@ -630,6 +630,10 @@
    11.4   */
    11.5  int SDL_LockSurface (SDL_Surface *surface)
    11.6  {
    11.7 +	if ( surface->locked < 0 ) {
    11.8 +		SDL_SetError("Surface has a rectangle lock");
    11.9 +		return(-1);
   11.10 +	}
   11.11  	if ( ! surface->locked ) {
   11.12  		/* Perform the lock */
   11.13  		if ( surface->flags & (SDL_HWSURFACE|SDL_ASYNCBLIT) ) {
   11.14 @@ -653,6 +657,78 @@
   11.15  	/* Ready to go.. */
   11.16  	return(0);
   11.17  }
   11.18 +int SDL_LockRect (SDL_Surface *surface, SDL_Rect *rect, void **pixels, int *pitch)
   11.19 +{
   11.20 +	int retval = 0;
   11.21 +
   11.22 +	/* Check to see if the surface is already locked */
   11.23 +	*pixels = NULL;
   11.24 +	if ( surface->locked != 0 ) {
   11.25 +		SDL_SetError("Surface is already locked");
   11.26 +		return(-1);
   11.27 +	}
   11.28 +
   11.29 +	/* Clip the lock to the clipping rectangle of the surface */
   11.30 +	{
   11.31 +	        SDL_Rect *clip = &surface->clip_rect;
   11.32 +		int dx, dy;
   11.33 +		int h = rect->h;
   11.34 +		int w = rect->w;
   11.35 +
   11.36 +		dx = clip->x - rect->x;
   11.37 +		if(dx > 0) {
   11.38 +			w -= dx;
   11.39 +			rect->x += dx;
   11.40 +		}
   11.41 +		dx = rect->x + w - clip->x - clip->w;
   11.42 +		if(dx > 0)
   11.43 +			w -= dx;
   11.44 +
   11.45 +		dy = clip->y - rect->y;
   11.46 +		if(dy > 0) {
   11.47 +			h -= dy;
   11.48 +			rect->y += dy;
   11.49 +		}
   11.50 +		dy = rect->y + h - clip->y - clip->h;
   11.51 +		if(dy > 0)
   11.52 +			h -= dy;
   11.53 +
   11.54 +		if(w > 0 && h > 0) {
   11.55 +			rect->w = w;
   11.56 +			rect->h = h;
   11.57 +		} else {
   11.58 +			rect->w = 0;
   11.59 +			rect->h = 0;
   11.60 +			SDL_SetError("Rectangle was clipped");
   11.61 +			return(-1);
   11.62 +		}
   11.63 +	}
   11.64 +
   11.65 +	/* Perform the lock */
   11.66 +	if ( surface->flags & (SDL_HWSURFACE|SDL_ASYNCBLIT) ) {
   11.67 +		SDL_VideoDevice *video = current_video;
   11.68 +		SDL_VideoDevice *this  = current_video;
   11.69 +		if ( video->LockHWSurfaceRect ) {
   11.70 +			retval = video->LockHWSurfaceRect(this, surface, rect, pixels, pitch);
   11.71 +			if ( retval == 0 ) {
   11.72 +				surface->locked = -1;
   11.73 +				return 0;
   11.74 +			}
   11.75 +		}
   11.76 +	}
   11.77 +	if ( SDL_MUSTLOCK(surface) ) {
   11.78 +		retval = SDL_LockSurface(surface);
   11.79 +		if ( retval < 0 ) {
   11.80 +			return retval;
   11.81 +		}
   11.82 +	}
   11.83 +	surface->locked = -1;
   11.84 +	*pixels = (Uint8 *)surface->pixels + rect->y * surface->pitch + rect->x * surface->format->BytesPerPixel;
   11.85 +	*pitch = surface->pitch;
   11.86 +
   11.87 +	/* Ready to go.. */
   11.88 +	return(0);
   11.89 +}
   11.90  /*
   11.91   * Unlock a previously locked surface
   11.92   * -- Do not call this from any blit function, as SDL_DrawCursor() may recurse
   11.93 @@ -663,6 +739,9 @@
   11.94  void SDL_UnlockSurface (SDL_Surface *surface)
   11.95  {
   11.96  	/* Only perform an unlock if we are locked */
   11.97 +	if ( surface->locked < 0 ) {
   11.98 +		return;
   11.99 +	}
  11.100  	if ( ! surface->locked || (--surface->locked > 0) ) {
  11.101  		return;
  11.102  	}
  11.103 @@ -683,6 +762,29 @@
  11.104  		}
  11.105  	}
  11.106  }
  11.107 +void SDL_UnlockRect (SDL_Surface *surface)
  11.108 +{
  11.109 +	/* Only perform an unlock if we are locked */
  11.110 +	if ( surface->locked != -1 ) {
  11.111 +		return;
  11.112 +	}
  11.113 +
  11.114 +	/* Perform the unlock */
  11.115 +	if ( surface->flags & (SDL_HWSURFACE|SDL_ASYNCBLIT) ) {
  11.116 +		SDL_VideoDevice *video = current_video;
  11.117 +		SDL_VideoDevice *this  = current_video;
  11.118 +		if ( video->LockHWSurfaceRect ) {
  11.119 +			video->UnlockHWSurfaceRect(this, surface);
  11.120 +			return;
  11.121 +		}
  11.122 +	}
  11.123 +	if ( SDL_MUSTLOCK(surface) ) {
  11.124 +		surface->locked = 1;
  11.125 +		SDL_UnlockSurface(surface);
  11.126 +	} else {
  11.127 +		surface->locked = 0;
  11.128 +	}
  11.129 +}
  11.130  
  11.131  /* 
  11.132   * Convert a surface into the specified pixel format.
    12.1 --- a/src/video/SDL_sysvideo.h	Sat Mar 02 16:50:35 2002 +0000
    12.2 +++ b/src/video/SDL_sysvideo.h	Tue Mar 05 19:55:32 2002 +0000
    12.3 @@ -153,6 +153,8 @@
    12.4  	/* Returns a readable/writable surface */
    12.5  	int (*LockHWSurface)(_THIS, SDL_Surface *surface);
    12.6  	void (*UnlockHWSurface)(_THIS, SDL_Surface *surface);
    12.7 +	int (*LockHWSurfaceRect)(_THIS, SDL_Surface *surface, SDL_Rect *rect, void **pixels, int *pitch);
    12.8 +	void (*UnlockHWSurfaceRect)(_THIS, SDL_Surface *surface);
    12.9  
   12.10  	/* Performs hardware flipping */
   12.11  	int (*FlipHWSurface)(_THIS, SDL_Surface *surface);
    13.1 --- a/src/video/SDL_yuv_sw.c	Sat Mar 02 16:50:35 2002 +0000
    13.2 +++ b/src/video/SDL_yuv_sw.c	Tue Mar 05 19:55:32 2002 +0000
    13.3 @@ -1255,7 +1255,7 @@
    13.4  		Cb = lum + 3;
    13.5  		break;
    13.6  	    default:
    13.7 -		SDL_SetError("Unsupported YUV format in blit (??)");
    13.8 +		SDL_SetError("Unsupported YUV format in blit");
    13.9  		return(-1);
   13.10  	}
   13.11  	if ( SDL_MUSTLOCK(display) ) {
    14.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.2 +++ b/src/video/Xext/Makefile.am	Tue Mar 05 19:55:32 2002 +0000
    14.3 @@ -0,0 +1,4 @@
    14.4 +
    14.5 +SUBDIRS = extensions Xinerama Xv Xxf86dga Xxf86vm
    14.6 +
    14.7 +EXTRA_DIST = README
    15.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.2 +++ b/src/video/Xext/README	Tue Mar 05 19:55:32 2002 +0000
    15.3 @@ -0,0 +1,9 @@
    15.4 +
    15.5 +The reason these libraries are built outside of the standard XFree86
    15.6 +tree is so that they can be linked as shared object code directly into
    15.7 +SDL without causing any symbol collisions with code in the application.
    15.8 +
    15.9 +You can't link static library code into shared libraries on non-x86
   15.10 +Linux platforms.  Since these libraries haven't become standard yet,
   15.11 +we'll just include them directly.
   15.12 +
    16.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.2 +++ b/src/video/Xext/Xinerama/Makefile.am	Tue Mar 05 19:55:32 2002 +0000
    16.3 @@ -0,0 +1,5 @@
    16.4 +
    16.5 +## Makefile.am for the XFree86 Xinerama library
    16.6 +
    16.7 +noinst_LTLIBRARIES = libXFree86_Xinerama.la
    16.8 +libXFree86_Xinerama_la_SOURCES = Xinerama.c
    17.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    17.2 +++ b/src/video/Xext/Xinerama/Xinerama.c	Tue Mar 05 19:55:32 2002 +0000
    17.3 @@ -0,0 +1,319 @@
    17.4 +/* $Xorg: XPanoramiX.c,v 1.4 2000/08/17 19:45:51 cpqbld Exp $ */
    17.5 +/*****************************************************************
    17.6 +Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts.
    17.7 +Permission is hereby granted, free of charge, to any person obtaining a copy
    17.8 +of this software and associated documentation files (the "Software"), to deal
    17.9 +in the Software without restriction, including without limitation the rights
   17.10 +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
   17.11 +copies of the Software.
   17.12 +
   17.13 +The above copyright notice and this permission notice shall be included in
   17.14 +all copies or substantial portions of the Software.
   17.15 +
   17.16 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
   17.17 +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
   17.18 +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
   17.19 +DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING,
   17.20 +BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY,
   17.21 +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
   17.22 +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
   17.23 +
   17.24 +Except as contained in this notice, the name of Digital Equipment Corporation
   17.25 +shall not be used in advertising or otherwise to promote the sale, use or other
   17.26 +dealings in this Software without prior written authorization from Digital
   17.27 +Equipment Corporation.
   17.28 +******************************************************************/
   17.29 +/* $XFree86: xc/lib/Xinerama/Xinerama.c,v 1.2 2001/07/23 17:20:28 dawes Exp $ */
   17.30 +
   17.31 +#define NEED_EVENTS
   17.32 +#define NEED_REPLIES
   17.33 +#include <X11/Xlibint.h>
   17.34 +#include <X11/Xutil.h>
   17.35 +#include <X11/extensions/Xext.h>	/* in ../include */
   17.36 +#include "extutil.h"			/* in ../include */
   17.37 +#include "panoramiXext.h"
   17.38 +#include "panoramiXproto.h"		/* in ../include */
   17.39 +#include "Xinerama.h"
   17.40 +
   17.41 +
   17.42 +static XExtensionInfo _panoramiX_ext_info_data;
   17.43 +static XExtensionInfo *panoramiX_ext_info = &_panoramiX_ext_info_data;
   17.44 +static /* const */ char *panoramiX_extension_name = PANORAMIX_PROTOCOL_NAME;
   17.45 +
   17.46 +#define PanoramiXCheckExtension(dpy,i,val) \
   17.47 +  XextCheckExtension (dpy, i, panoramiX_extension_name, val)
   17.48 +#define PanoramiXSimpleCheckExtension(dpy,i) \
   17.49 +  XextSimpleCheckExtension (dpy, i, panoramiX_extension_name)
   17.50 +
   17.51 +static int close_display();
   17.52 +static /* const */ XExtensionHooks panoramiX_extension_hooks = {
   17.53 +    NULL,				/* create_gc */
   17.54 +    NULL,				/* copy_gc */
   17.55 +    NULL,				/* flush_gc */
   17.56 +    NULL,				/* free_gc */
   17.57 +    NULL,				/* create_font */
   17.58 +    NULL,				/* free_font */
   17.59 +    close_display,			/* close_display */
   17.60 +    NULL,				/* wire_to_event */
   17.61 +    NULL,				/* event_to_wire */
   17.62 +    NULL,				/* error */
   17.63 +    NULL,				/* error_string */
   17.64 +};
   17.65 +
   17.66 +static XEXT_GENERATE_FIND_DISPLAY (find_display, panoramiX_ext_info,
   17.67 +				   panoramiX_extension_name, 
   17.68 +				   &panoramiX_extension_hooks,
   17.69 +				   0, NULL)
   17.70 +
   17.71 +static XEXT_GENERATE_CLOSE_DISPLAY (close_display, panoramiX_ext_info)
   17.72 +
   17.73 +
   17.74 +
   17.75 +/****************************************************************************
   17.76 + *                                                                          *
   17.77 + *			    PanoramiX public interfaces                         *
   17.78 + *                                                                          *
   17.79 + ****************************************************************************/
   17.80 +
   17.81 +Bool SDL_NAME(XPanoramiXQueryExtension) (
   17.82 +    Display *dpy,
   17.83 +    int *event_basep,
   17.84 +    int *error_basep
   17.85 +)
   17.86 +{
   17.87 +    XExtDisplayInfo *info = find_display (dpy);
   17.88 +
   17.89 +    if (XextHasExtension(info)) {
   17.90 +	*event_basep = info->codes->first_event;
   17.91 +	*error_basep = info->codes->first_error;
   17.92 +	return True;
   17.93 +    } else {
   17.94 +	return False;
   17.95 +    }
   17.96 +}
   17.97 +
   17.98 +
   17.99 +Status SDL_NAME(XPanoramiXQueryVersion)(
  17.100 +    Display *dpy,
  17.101 +    int	    *major_versionp, 
  17.102 +    int *minor_versionp
  17.103 +)
  17.104 +{
  17.105 +    XExtDisplayInfo *info = find_display (dpy);
  17.106 +    xPanoramiXQueryVersionReply	    rep;
  17.107 +    register xPanoramiXQueryVersionReq  *req;
  17.108 +
  17.109 +    PanoramiXCheckExtension (dpy, info, 0);
  17.110 +
  17.111 +    LockDisplay (dpy);
  17.112 +    GetReq (PanoramiXQueryVersion, req);
  17.113 +    req->reqType = info->codes->major_opcode;
  17.114 +    req->panoramiXReqType = X_PanoramiXQueryVersion;
  17.115 +    req->clientMajor = PANORAMIX_MAJOR_VERSION;
  17.116 +    req->clientMinor = PANORAMIX_MINOR_VERSION;
  17.117 +    if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
  17.118 +	UnlockDisplay (dpy);
  17.119 +	SyncHandle ();
  17.120 +	return 0;
  17.121 +    }
  17.122 +    *major_versionp = rep.majorVersion;
  17.123 +    *minor_versionp = rep.minorVersion;
  17.124 +    UnlockDisplay (dpy);
  17.125 +    SyncHandle ();
  17.126 +    return 1;
  17.127 +}
  17.128 +
  17.129 +SDL_NAME(XPanoramiXInfo) *SDL_NAME(XPanoramiXAllocInfo)(void)
  17.130 +{
  17.131 +	return (SDL_NAME(XPanoramiXInfo) *) Xmalloc (sizeof (SDL_NAME(XPanoramiXInfo)));
  17.132 +}
  17.133 +
  17.134 +Status SDL_NAME(XPanoramiXGetState) (
  17.135 +    Display		*dpy,
  17.136 +    Drawable		drawable,
  17.137 +    SDL_NAME(XPanoramiXInfo)	*panoramiX_info
  17.138 +)
  17.139 +{
  17.140 +    XExtDisplayInfo			*info = find_display (dpy);
  17.141 +    xPanoramiXGetStateReply	rep;
  17.142 +    register xPanoramiXGetStateReq	*req;
  17.143 +
  17.144 +    PanoramiXCheckExtension (dpy, info, 0);
  17.145 +
  17.146 +    LockDisplay (dpy);
  17.147 +    GetReq (PanoramiXGetState, req);
  17.148 +    req->reqType = info->codes->major_opcode;
  17.149 +    req->panoramiXReqType = X_PanoramiXGetState;
  17.150 +    req->window = drawable;
  17.151 +    if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
  17.152 +	UnlockDisplay (dpy);
  17.153 +	SyncHandle ();
  17.154 +	return 0;
  17.155 +    }
  17.156 +    UnlockDisplay (dpy);
  17.157 +    SyncHandle ();
  17.158 +    panoramiX_info->window = rep.window;
  17.159 +    panoramiX_info->State = rep.state;
  17.160 +    return 1;
  17.161 +}
  17.162 +
  17.163 +Status SDL_NAME(XPanoramiXGetScreenCount) (
  17.164 +    Display		*dpy,
  17.165 +    Drawable		drawable,
  17.166 +    SDL_NAME(XPanoramiXInfo)	*panoramiX_info
  17.167 +)
  17.168 +{
  17.169 +    XExtDisplayInfo			*info = find_display (dpy);
  17.170 +    xPanoramiXGetScreenCountReply	rep;
  17.171 +    register xPanoramiXGetScreenCountReq	*req;
  17.172 +
  17.173 +    PanoramiXCheckExtension (dpy, info, 0);
  17.174 +
  17.175 +    LockDisplay (dpy);
  17.176 +    GetReq (PanoramiXGetScreenCount, req);
  17.177 +    req->reqType = info->codes->major_opcode;
  17.178 +    req->panoramiXReqType = X_PanoramiXGetScreenCount;
  17.179 +    req->window = drawable;
  17.180 +    if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
  17.181 +	UnlockDisplay (dpy);
  17.182 +	SyncHandle ();
  17.183 +	return 0;
  17.184 +    }
  17.185 +    UnlockDisplay (dpy);
  17.186 +    SyncHandle ();
  17.187 +    panoramiX_info->window = rep.window;
  17.188 +    panoramiX_info->ScreenCount = rep.ScreenCount;
  17.189 +    return 1;
  17.190 +}
  17.191 +
  17.192 +Status SDL_NAME(XPanoramiXGetScreenSize) (
  17.193 +    Display		*dpy,
  17.194 +    Drawable		drawable,
  17.195 +    int			screen_num,
  17.196 +    SDL_NAME(XPanoramiXInfo)	*panoramiX_info
  17.197 +)
  17.198 +{
  17.199 +    XExtDisplayInfo			*info = find_display (dpy);
  17.200 +    xPanoramiXGetScreenSizeReply	rep;
  17.201 +    register xPanoramiXGetScreenSizeReq	*req;
  17.202 +
  17.203 +    PanoramiXCheckExtension (dpy, info, 0);
  17.204 +
  17.205 +    LockDisplay (dpy);
  17.206 +    GetReq (PanoramiXGetScreenSize, req);
  17.207 +    req->reqType = info->codes->major_opcode;
  17.208 +    req->panoramiXReqType = X_PanoramiXGetScreenSize;
  17.209 +    req->window = drawable;
  17.210 +    req->screen = screen_num;			/* need to define */ 
  17.211 +    if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
  17.212 +	UnlockDisplay (dpy);
  17.213 +	SyncHandle ();
  17.214 +	return 0;
  17.215 +    }
  17.216 +    UnlockDisplay (dpy);
  17.217 +    SyncHandle ();
  17.218 +    panoramiX_info->window = rep.window;
  17.219 +    panoramiX_info->screen = rep.screen;
  17.220 +    panoramiX_info->width =  rep.width;
  17.221 +    panoramiX_info->height = rep.height;
  17.222 +    return 1;
  17.223 +}
  17.224 +
  17.225 +/*******************************************************************\
  17.226 +  Alternate interface to make up for shortcomings in the original,
  17.227 +  namely, the omission of the screen origin.  The new interface is
  17.228 +  in the "Xinerama" namespace instead of "PanoramiX".
  17.229 +\*******************************************************************/
  17.230 +
  17.231 +Bool SDL_NAME(XineramaQueryExtension) (
  17.232 +   Display *dpy,
  17.233 +   int     *event_base,
  17.234 +   int     *error_base
  17.235 +)
  17.236 +{
  17.237 +   return SDL_NAME(XPanoramiXQueryExtension)(dpy, event_base, error_base);
  17.238 +}
  17.239 +
  17.240 +Status SDL_NAME(XineramaQueryVersion)(
  17.241 +   Display *dpy,
  17.242 +   int     *major,
  17.243 +   int     *minor
  17.244 +)
  17.245 +{
  17.246 +   return SDL_NAME(XPanoramiXQueryVersion)(dpy, major, minor);
  17.247 +}
  17.248 +
  17.249 +Bool SDL_NAME(XineramaIsActive)(Display *dpy)
  17.250 +{
  17.251 +    xXineramaIsActiveReply	rep;
  17.252 +    xXineramaIsActiveReq  	*req;
  17.253 +    XExtDisplayInfo 		*info = find_display (dpy);
  17.254 +
  17.255 +    if(!XextHasExtension(info))
  17.256 +	return False;  /* server doesn't even have the extension */
  17.257 +
  17.258 +    LockDisplay (dpy);
  17.259 +    GetReq (XineramaIsActive, req);
  17.260 +    req->reqType = info->codes->major_opcode;
  17.261 +    req->panoramiXReqType = X_XineramaIsActive;
  17.262 +    if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
  17.263 +	UnlockDisplay (dpy);
  17.264 +	SyncHandle ();
  17.265 +	return False;
  17.266 +    }
  17.267 +    UnlockDisplay (dpy);
  17.268 +    SyncHandle ();
  17.269 +    return rep.state;
  17.270 +}
  17.271 +
  17.272 +#include <stdio.h>
  17.273 +
  17.274 +SDL_NAME(XineramaScreenInfo) * 
  17.275 +SDL_NAME(XineramaQueryScreens)(
  17.276 +   Display *dpy,
  17.277 +   int     *number
  17.278 +)
  17.279 +{
  17.280 +    XExtDisplayInfo		*info = find_display (dpy);
  17.281 +    xXineramaQueryScreensReply	rep;
  17.282 +    xXineramaQueryScreensReq	*req;
  17.283 +    SDL_NAME(XineramaScreenInfo)		*scrnInfo = NULL;
  17.284 +
  17.285 +    PanoramiXCheckExtension (dpy, info, 0);
  17.286 +
  17.287 +    LockDisplay (dpy);
  17.288 +    GetReq (XineramaQueryScreens, req);
  17.289 +    req->reqType = info->codes->major_opcode;
  17.290 +    req->panoramiXReqType = X_XineramaQueryScreens;
  17.291 +    if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) {
  17.292 +	UnlockDisplay (dpy);
  17.293 +	SyncHandle ();
  17.294 +	return NULL;
  17.295 +    }
  17.296 +
  17.297 +    if(rep.number) {
  17.298 +	if((scrnInfo = Xmalloc(sizeof(SDL_NAME(XineramaScreenInfo)) * rep.number))) {
  17.299 +	    xXineramaScreenInfo scratch;
  17.300 +	    int i;
  17.301 +
  17.302 +	    for(i = 0; i < rep.number; i++) {
  17.303 +		_XRead(dpy, (char*)(&scratch), sz_XineramaScreenInfo);
  17.304 +		scrnInfo[i].screen_number = i;
  17.305 +		scrnInfo[i].x_org 	  = scratch.x_org;
  17.306 +		scrnInfo[i].y_org 	  = scratch.y_org;
  17.307 +		scrnInfo[i].width 	  = scratch.width;
  17.308 +		scrnInfo[i].height 	  = scratch.height;
  17.309 +	    }
  17.310 +
  17.311 +	    *number = rep.number;
  17.312 +	} else
  17.313 +	    _XEatData(dpy, rep.length << 2);
  17.314 +    }
  17.315 +
  17.316 +    UnlockDisplay (dpy);
  17.317 +    SyncHandle ();
  17.318 +    return scrnInfo;
  17.319 +}
  17.320 +
  17.321 +
  17.322 +
    18.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.2 +++ b/src/video/Xext/Xv/Makefile.am	Tue Mar 05 19:55:32 2002 +0000
    18.3 @@ -0,0 +1,5 @@
    18.4 +
    18.5 +## Makefile.am for the XFree86 Xv library
    18.6 +
    18.7 +noinst_LTLIBRARIES = libXFree86_Xv.la
    18.8 +libXFree86_Xv_la_SOURCES = Xv.c Xvlibint.h
    19.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.2 +++ b/src/video/Xext/Xv/Xv.c	Tue Mar 05 19:55:32 2002 +0000
    19.3 @@ -0,0 +1,1152 @@
    19.4 +/***********************************************************
    19.5 +Copyright 1991 by Digital Equipment Corporation, Maynard, Massachusetts,
    19.6 +and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
    19.7 +
    19.8 +                        All Rights Reserved
    19.9 +
   19.10 +Permission to use, copy, modify, and distribute this software and its 
   19.11 +documentation for any purpose and without fee is hereby granted, 
   19.12 +provided that the above copyright notice appear in all copies and that
   19.13 +both that copyright notice and this permission notice appear in 
   19.14 +supporting documentation, and that the names of Digital or MIT not be
   19.15 +used in advertising or publicity pertaining to distribution of the
   19.16 +software without specific, written prior permission.  
   19.17 +
   19.18 +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
   19.19 +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
   19.20 +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
   19.21 +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
   19.22 +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
   19.23 +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
   19.24 +SOFTWARE.
   19.25 +
   19.26 +******************************************************************/
   19.27 +/* $XFree86: xc/lib/Xv/Xv.c,v 1.15 2001/05/11 08:23:22 alanh Exp $ */
   19.28 +/*
   19.29 +** File: 
   19.30 +**
   19.31 +**   Xv.c --- Xv library extension module.
   19.32 +**
   19.33 +** Author: 
   19.34 +**
   19.35 +**   David Carver (Digital Workstation Engineering/Project Athena)
   19.36 +**
   19.37 +** Revisions:
   19.38 +**
   19.39 +**   26.06.91 Carver
   19.40 +**     - changed XvFreeAdaptors to XvFreeAdaptorInfo
   19.41 +**     - changed XvFreeEncodings to XvFreeEncodingInfo
   19.42 +**
   19.43 +**   11.06.91 Carver
   19.44 +**     - changed SetPortControl to SetPortAttribute
   19.45 +**     - changed GetPortControl to GetPortAttribute
   19.46 +**     - changed QueryBestSize
   19.47 +**
   19.48 +**   15.05.91 Carver
   19.49 +**     - version 2.0 upgrade
   19.50 +**
   19.51 +**   240.01.91 Carver
   19.52 +**     - version 1.4 upgrade
   19.53 +**
   19.54 +*/
   19.55 +
   19.56 +#include <stdio.h>
   19.57 +#include "Xvlibint.h"
   19.58 +#include <X11/extensions/Xext.h>
   19.59 +#include <X11/extensions/XShm.h>
   19.60 +#include "extutil.h"
   19.61 +
   19.62 +static XExtensionInfo _xv_info_data;
   19.63 +static XExtensionInfo *xv_info = &_xv_info_data;
   19.64 +static char *xv_extension_name = XvName;
   19.65 +
   19.66 +#define XvCheckExtension(dpy, i, val) \
   19.67 +  XextCheckExtension(dpy, i, xv_extension_name, val)
   19.68 +
   19.69 +static char *xv_error_string();
   19.70 +static int xv_close_display();
   19.71 +static Bool xv_wire_to_event();
   19.72 +
   19.73 +static XExtensionHooks xv_extension_hooks = {
   19.74 +    NULL,                               /* create_gc */
   19.75 +    NULL,                               /* copy_gc */
   19.76 +    NULL,                               /* flush_gc */
   19.77 +    NULL,                               /* free_gc */
   19.78 +    NULL,                               /* create_font */
   19.79 +    NULL,                               /* free_font */
   19.80 +    xv_close_display,                   /* close_display */
   19.81 +    xv_wire_to_event,                   /* wire_to_event */
   19.82 +    NULL,                               /* event_to_wire */
   19.83 +    NULL,                               /* error */
   19.84 +    xv_error_string                     /* error_string */
   19.85 +};
   19.86 +
   19.87 +
   19.88 +static char *xv_error_list[] = 
   19.89 +{
   19.90 +   "BadPort",	    /* XvBadPort     */
   19.91 +   "BadEncoding",   /* XvBadEncoding */
   19.92 +   "BadControl"     /* XvBadControl  */
   19.93 +};
   19.94 +
   19.95 +static XEXT_GENERATE_CLOSE_DISPLAY (xv_close_display, xv_info)
   19.96 +
   19.97 +
   19.98 +static XEXT_GENERATE_FIND_DISPLAY (xv_find_display, xv_info, 
   19.99 +                                   xv_extension_name, 
  19.100 +                                   &xv_extension_hooks,
  19.101 +				   XvNumEvents, NULL)
  19.102 +     
  19.103 +
  19.104 +static XEXT_GENERATE_ERROR_STRING (xv_error_string, xv_extension_name,
  19.105 +                                   XvNumErrors, xv_error_list)
  19.106 +
  19.107 +
  19.108 +int
  19.109 +SDL_NAME(XvQueryExtension)(
  19.110 +     Display *dpy,
  19.111 +     unsigned int *p_version,
  19.112 +     unsigned int *p_revision,
  19.113 +     unsigned int *p_requestBase,
  19.114 +     unsigned int *p_eventBase,
  19.115 +     unsigned int *p_errorBase
  19.116 +){
  19.117 +  XExtDisplayInfo *info = xv_find_display(dpy);
  19.118 +  xvQueryExtensionReq *req;
  19.119 +  xvQueryExtensionReply rep;
  19.120 +
  19.121 +  XvCheckExtension(dpy, info, XvBadExtension);
  19.122 +
  19.123 +  LockDisplay(dpy);
  19.124 +
  19.125 +  XvGetReq(QueryExtension, req);
  19.126 +
  19.127 +  if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
  19.128 +     UnlockDisplay(dpy);
  19.129 +     SyncHandle();
  19.130 +     return XvBadExtension;
  19.131 +  }
  19.132 +
  19.133 +  *p_version = rep.version;
  19.134 +  *p_revision = rep.revision;
  19.135 +  *p_requestBase = info->codes->major_opcode;
  19.136 +  *p_eventBase = info->codes->first_event;
  19.137 +  *p_errorBase = info->codes->first_error;
  19.138 +
  19.139 +  UnlockDisplay(dpy);
  19.140 +  SyncHandle();
  19.141 +
  19.142 +  return Success;
  19.143 +}
  19.144 +
  19.145 +int
  19.146 +SDL_NAME(XvQueryAdaptors)(
  19.147 +     Display *dpy,
  19.148 +     Window window,
  19.149 +     unsigned int *p_nAdaptors,
  19.150 +     SDL_NAME(XvAdaptorInfo) **p_pAdaptors
  19.151 +){
  19.152 +  XExtDisplayInfo *info = xv_find_display(dpy);
  19.153 +  xvQueryAdaptorsReq *req;
  19.154 +  xvQueryAdaptorsReply rep;
  19.155 +  int size,ii,jj;
  19.156 +  char *name;
  19.157 +  SDL_NAME(XvAdaptorInfo) *pas, *pa;
  19.158 +  SDL_NAME(XvFormat) *pfs, *pf;
  19.159 +  char *buffer;
  19.160 +  union 
  19.161 +    {
  19.162 +      char *buffer;
  19.163 +      char *string;
  19.164 +      xvAdaptorInfo *pa;
  19.165 +      xvFormat *pf;
  19.166 +    } u;
  19.167 +  
  19.168 +  XvCheckExtension(dpy, info, XvBadExtension);
  19.169 +
  19.170 +  LockDisplay(dpy);
  19.171 +
  19.172 +  XvGetReq(QueryAdaptors, req);
  19.173 +  req->window = window;
  19.174 +
  19.175 +  /* READ THE REPLY */
  19.176 +
  19.177 +  if (_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0) {
  19.178 +      UnlockDisplay(dpy);
  19.179 +      SyncHandle();
  19.180 +      return(XvBadReply);
  19.181 +  }
  19.182 +
  19.183 +  size = rep.length << 2;
  19.184 +  if ( (buffer = (char *)Xmalloc ((unsigned) size)) == NULL) {
  19.185 +      UnlockDisplay(dpy);
  19.186 +      SyncHandle();
  19.187 +      return(XvBadAlloc);
  19.188 +  }
  19.189 +  _XRead (dpy, buffer, size);
  19.190 +
  19.191 +  u.buffer = buffer;
  19.192 +
  19.193 +  /* GET INPUT ADAPTORS */
  19.194 +
  19.195 +  if (rep.num_adaptors == 0) {
  19.196 +      pas = NULL;
  19.197 +  } else {
  19.198 +      size = rep.num_adaptors*sizeof(SDL_NAME(XvAdaptorInfo));
  19.199 +      if ((pas=(SDL_NAME(XvAdaptorInfo) *)Xmalloc(size))==NULL) {
  19.200 +          Xfree(buffer);
  19.201 +          UnlockDisplay(dpy);
  19.202 +          SyncHandle();
  19.203 +          return(XvBadAlloc);
  19.204 +      }
  19.205 +  }
  19.206 +
  19.207 +  /* INIT ADAPTOR FIELDS */
  19.208 +
  19.209 +  pa = pas;
  19.210 +  for (ii=0; ii<rep.num_adaptors; ii++) {
  19.211 +      pa->num_adaptors = 0;
  19.212 +      pa->name = (char *)NULL;
  19.213 +      pa->formats = (SDL_NAME(XvFormat) *)NULL;
  19.214 +      pa++;
  19.215 +  }
  19.216 +
  19.217 +  pa = pas;
  19.218 +  for (ii=0; ii<rep.num_adaptors; ii++) {
  19.219 +      pa->type = u.pa->type;
  19.220 +      pa->base_id = u.pa->base_id;
  19.221 +      pa->num_ports = u.pa->num_ports;
  19.222 +      pa->num_formats = u.pa->num_formats;
  19.223 +      pa->num_adaptors = rep.num_adaptors - ii;
  19.224 +
  19.225 +      /* GET ADAPTOR NAME */
  19.226 +
  19.227 +      size = u.pa->name_size;
  19.228 +      u.buffer += (sz_xvAdaptorInfo + 3) & ~3;
  19.229 +
  19.230 +      if ( (name = (char *)Xmalloc(size+1)) == NULL)
  19.231 +	{
  19.232 +	  SDL_NAME(XvFreeAdaptorInfo)(pas);
  19.233 +	  Xfree(buffer);
  19.234 +          UnlockDisplay(dpy);
  19.235 +          SyncHandle();
  19.236 +	  return(XvBadAlloc);
  19.237 +	}
  19.238 +      (void)strncpy(name, u.string, size);
  19.239 +      name[size] = '\0';
  19.240 +      pa->name = name;
  19.241 +
  19.242 +      u.buffer += (size + 3) & ~3;
  19.243 +
  19.244 +      /* GET FORMATS */
  19.245 +
  19.246 +      size = pa->num_formats*sizeof(SDL_NAME(XvFormat));
  19.247 +      if ((pfs=(SDL_NAME(XvFormat) *)Xmalloc(size))==NULL) {
  19.248 +	  SDL_NAME(XvFreeAdaptorInfo)(pas);
  19.249 +	  Xfree(buffer);
  19.250 +          UnlockDisplay(dpy);
  19.251 +          SyncHandle();
  19.252 +	  return(XvBadAlloc);
  19.253 +      }
  19.254 +
  19.255 +      pf = pfs;
  19.256 +      for (jj=0; jj<pa->num_formats; jj++) {
  19.257 +	  pf->depth = u.pf->depth;
  19.258 +	  pf->visual_id = u.pf->visual;
  19.259 +	  pf++;
  19.260 +	  
  19.261 +	  u.buffer += (sz_xvFormat + 3) & ~3;
  19.262 +      }
  19.263 +
  19.264 +      pa->formats = pfs;
  19.265 +
  19.266 +      pa++;
  19.267 +
  19.268 +  }
  19.269 +
  19.270 +  *p_nAdaptors = rep.num_adaptors;
  19.271 +  *p_pAdaptors = pas;
  19.272 +
  19.273 +  UnlockDisplay(dpy);
  19.274 +  SyncHandle();
  19.275 +
  19.276 +  return (Success);
  19.277 +}
  19.278 +
  19.279 +
  19.280 +void
  19.281 +SDL_NAME(XvFreeAdaptorInfo)(SDL_NAME(XvAdaptorInfo) *pAdaptors)
  19.282 +{
  19.283 +
  19.284 +  SDL_NAME(XvAdaptorInfo) *pa;
  19.285 +  int ii;
  19.286 +
  19.287 +  if (!pAdaptors) return;
  19.288 +
  19.289 +  pa = pAdaptors;
  19.290 +
  19.291 +  for (ii=0; ii<pAdaptors->num_adaptors; ii++, pa++)
  19.292 +    {
  19.293 +      if (pa->name)
  19.294 +	{
  19.295 +	  Xfree(pa->name);
  19.296 +	}
  19.297 +      if (pa->formats)
  19.298 +	{
  19.299 +	  Xfree(pa->formats);
  19.300 +	}
  19.301 +    } 
  19.302 +
  19.303 +  Xfree(pAdaptors);
  19.304 +}
  19.305 +
  19.306 +int
  19.307 +SDL_NAME(XvQueryEncodings)(
  19.308 +     Display *dpy,
  19.309 +     XvPortID port,
  19.310 +     unsigned int *p_nEncodings,
  19.311 +     SDL_NAME(XvEncodingInfo) **p_pEncodings
  19.312 +){
  19.313 +  XExtDisplayInfo *info = xv_find_display(dpy);
  19.314 +  xvQueryEncodingsReq *req;
  19.315 +  xvQueryEncodingsReply rep;
  19.316 +  int size, jj;
  19.317 +  char *name;
  19.318 +  SDL_NAME(XvEncodingInfo) *pes, *pe;
  19.319 +  char *buffer;
  19.320 +  union 
  19.321 +    {
  19.322 +      char *buffer;
  19.323 +      char *string;
  19.324 +      xvEncodingInfo *pe;
  19.325 +    } u;
  19.326 +  
  19.327 +  XvCheckExtension(dpy, info, XvBadExtension);
  19.328 +
  19.329 +  LockDisplay(dpy);
  19.330 +
  19.331 +  XvGetReq(QueryEncodings, req);
  19.332 +  req->port = port;
  19.333 +
  19.334 +  /* READ THE REPLY */
  19.335 +
  19.336 +  if (_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0) {
  19.337 +      UnlockDisplay(dpy);
  19.338 +      SyncHandle();
  19.339 +      return(XvBadReply);
  19.340 +  }
  19.341 +
  19.342 +  size = rep.length << 2;
  19.343 +  if ( (buffer = (char *)Xmalloc ((unsigned) size)) == NULL) {
  19.344 +      UnlockDisplay(dpy);
  19.345 +      SyncHandle();
  19.346 +      return(XvBadAlloc);
  19.347 +  }
  19.348 +  _XRead (dpy, buffer, size);
  19.349 +
  19.350 +  u.buffer = buffer;
  19.351 +
  19.352 +  /* GET ENCODINGS */
  19.353 +
  19.354 +  size = rep.num_encodings*sizeof(SDL_NAME(XvEncodingInfo));
  19.355 +  if ( (pes = (SDL_NAME(XvEncodingInfo) *)Xmalloc(size)) == NULL) {
  19.356 +      Xfree(buffer);
  19.357 +      UnlockDisplay(dpy);
  19.358 +      SyncHandle();
  19.359 +      return(XvBadAlloc);
  19.360 +  }
  19.361 +
  19.362 +  /* INITIALIZE THE ENCODING POINTER */
  19.363 +
  19.364 +  pe = pes;
  19.365 +  for (jj=0; jj<rep.num_encodings; jj++) {
  19.366 +      pe->name = (char *)NULL;
  19.367 +      pe->num_encodings = 0;
  19.368 +      pe++;
  19.369 +  }
  19.370 +
  19.371 +  pe = pes;
  19.372 +  for (jj=0; jj<rep.num_encodings; jj++) {
  19.373 +      pe->encoding_id = u.pe->encoding;
  19.374 +      pe->width = u.pe->width;
  19.375 +      pe->height = u.pe->height;
  19.376 +      pe->rate.numerator = u.pe->rate.numerator;
  19.377 +      pe->rate.denominator = u.pe->rate.denominator;
  19.378 +      pe->num_encodings = rep.num_encodings - jj;
  19.379 +
  19.380 +      size = u.pe->name_size;
  19.381 +      u.buffer += (sz_xvEncodingInfo + 3) & ~3;
  19.382 +
  19.383 +      if ( (name = (char *)Xmalloc(size+1)) == NULL) {
  19.384 +	  Xfree(buffer);
  19.385 +          UnlockDisplay(dpy);
  19.386 +          SyncHandle();
  19.387 +	  return(XvBadAlloc);
  19.388 +      }
  19.389 +      strncpy(name, u.string, size);
  19.390 +      name[size] = '\0';
  19.391 +      pe->name = name;
  19.392 +      pe++;
  19.393 +
  19.394 +      u.buffer += (size + 3) & ~3;
  19.395 +  }
  19.396 +
  19.397 +  *p_nEncodings = rep.num_encodings;
  19.398 +  *p_pEncodings = pes;
  19.399 +
  19.400 +  UnlockDisplay(dpy);
  19.401 +  SyncHandle();
  19.402 +
  19.403 +  return (Success);
  19.404 +}
  19.405 +
  19.406 +void
  19.407 +SDL_NAME(XvFreeEncodingInfo)(SDL_NAME(XvEncodingInfo) *pEncodings)
  19.408 +{
  19.409 +
  19.410 +  SDL_NAME(XvEncodingInfo) *pe;
  19.411 +  int ii;
  19.412 +
  19.413 +  if (!pEncodings) return;
  19.414 +
  19.415 +  pe = pEncodings;
  19.416 +
  19.417 +  for (ii=0; ii<pEncodings->num_encodings; ii++, pe++) {
  19.418 +      if (pe->name) Xfree(pe->name);
  19.419 +  }
  19.420 +
  19.421 +  Xfree(pEncodings);
  19.422 +}
  19.423 +
  19.424 +int
  19.425 +SDL_NAME(XvPutVideo)(
  19.426 +     Display *dpy,
  19.427 +     XvPortID port,
  19.428 +     Drawable d,
  19.429 +     GC gc,
  19.430 +     int vx, int vy, 
  19.431 +     unsigned int vw, unsigned int vh,
  19.432 +     int dx, int dy,
  19.433 +     unsigned int dw, unsigned int dh
  19.434 +){
  19.435 +  XExtDisplayInfo *info = xv_find_display(dpy);
  19.436 +  xvPutVideoReq *req;
  19.437 +
  19.438 +  XvCheckExtension(dpy, info, XvBadExtension);
  19.439 +
  19.440 +  LockDisplay(dpy);
  19.441 +  
  19.442 +  FlushGC(dpy, gc);
  19.443 +
  19.444 +  XvGetReq(PutVideo, req);
  19.445 +
  19.446 +  req->port = port;
  19.447 +  req->drawable = d;
  19.448 +  req->gc = gc->gid;
  19.449 +  req->vid_x = vx;
  19.450 +  req->vid_y = vy;
  19.451 +  req->vid_w = vw;
  19.452 +  req->vid_h = vh;
  19.453 +  req->drw_x = dx;
  19.454 +  req->drw_y = dy;
  19.455 +  req->drw_w = dw;
  19.456 +  req->drw_h = dh;
  19.457 +
  19.458 +  UnlockDisplay(dpy);
  19.459 +  SyncHandle();
  19.460 +
  19.461 +  return Success;
  19.462 +}
  19.463 +
  19.464 +int
  19.465 +SDL_NAME(XvPutStill)(
  19.466 +     Display *dpy,
  19.467 +     XvPortID port,
  19.468 +     Drawable d,
  19.469 +     GC gc,
  19.470 +     int vx, int vy, 
  19.471 +     unsigned int vw, unsigned int vh,
  19.472 +     int dx, int dy,
  19.473 +     unsigned int dw, unsigned int dh
  19.474 +){
  19.475 +  XExtDisplayInfo *info = xv_find_display(dpy);
  19.476 +  xvPutStillReq *req;
  19.477 +
  19.478 +  XvCheckExtension(dpy, info, XvBadExtension);
  19.479 +
  19.480 +  LockDisplay(dpy);
  19.481 +
  19.482 +  FlushGC(dpy, gc);
  19.483 +
  19.484 +  XvGetReq(PutStill, req);
  19.485 +  req->port = port;
  19.486 +  req->drawable = d;
  19.487 +  req->gc = gc->gid;
  19.488 +  req->vid_x = vx;
  19.489 +  req->vid_y = vy;
  19.490 +  req->vid_w = vw;
  19.491 +  req->vid_h = vh;
  19.492 +  req->drw_x = dx;
  19.493 +  req->drw_y = dy;
  19.494 +  req->drw_w = dw;
  19.495 +  req->drw_h = dh;
  19.496 +
  19.497 +  UnlockDisplay(dpy);
  19.498 +  SyncHandle();
  19.499 +
  19.500 +  return Success;
  19.501 +}
  19.502 +
  19.503 +int
  19.504 +SDL_NAME(XvGetVideo)(
  19.505 +     Display *dpy,
  19.506 +     XvPortID port,
  19.507 +     Drawable d,
  19.508 +     GC gc,
  19.509 +     int vx, int vy, 
  19.510 +     unsigned int vw, unsigned int vh,
  19.511 +     int dx, int dy,
  19.512 +     unsigned int dw, unsigned int dh
  19.513 +){
  19.514 +  XExtDisplayInfo *info = xv_find_display(dpy);
  19.515 +  xvGetVideoReq *req;
  19.516 +
  19.517 +  XvCheckExtension(dpy, info, XvBadExtension);
  19.518 +
  19.519 +  LockDisplay(dpy);
  19.520 +
  19.521 +  FlushGC(dpy, gc);
  19.522 +
  19.523 +  XvGetReq(GetVideo, req);
  19.524 +  req->port = port;
  19.525 +  req->drawable = d;
  19.526 +  req->gc = gc->gid;
  19.527 +  req->vid_x = vx;
  19.528 +  req->vid_y = vy;
  19.529 +  req->vid_w = vw;
  19.530 +  req->vid_h = vh;
  19.531 +  req->drw_x = dx;
  19.532 +  req->drw_y = dy;
  19.533 +  req->drw_w = dw;
  19.534 +  req->drw_h = dh;
  19.535 +
  19.536 +  UnlockDisplay(dpy);
  19.537 +  SyncHandle();
  19.538 +
  19.539 +  return Success;
  19.540 +}
  19.541 +
  19.542 +int
  19.543 +SDL_NAME(XvGetStill)(
  19.544 +     Display *dpy,
  19.545 +     XvPortID port,
  19.546 +     Drawable d,
  19.547 +     GC gc,
  19.548 +     int vx, int vy, 
  19.549 +     unsigned int vw, unsigned int vh,
  19.550 +     int dx, int dy,
  19.551 +     unsigned int dw, unsigned int dh
  19.552 +){
  19.553 +  XExtDisplayInfo *info = xv_find_display(dpy);
  19.554 +  xvGetStillReq *req;
  19.555 +
  19.556 +  XvCheckExtension(dpy, info, XvBadExtension);
  19.557 +
  19.558 +  LockDisplay(dpy);
  19.559 +
  19.560 +  FlushGC(dpy, gc);
  19.561 +
  19.562 +  XvGetReq(GetStill, req);
  19.563 +  req->port = port;
  19.564 +  req->drawable = d;
  19.565 +  req->gc = gc->gid;
  19.566 +  req->vid_x = vx;
  19.567 +  req->vid_y = vy;
  19.568 +  req->vid_w = vw;
  19.569 +  req->vid_h = vh;
  19.570 +  req->drw_x = dx;
  19.571 +  req->drw_y = dy;
  19.572 +  req->drw_w = dw;
  19.573 +  req->drw_h = dh;
  19.574 +
  19.575 +  UnlockDisplay(dpy);
  19.576 +  SyncHandle();
  19.577 +
  19.578 +  return Success;
  19.579 +}
  19.580 +
  19.581 +int
  19.582 +SDL_NAME(XvStopVideo)(
  19.583 +     Display *dpy,
  19.584 +     XvPortID port,
  19.585 +     Drawable draw
  19.586 +){
  19.587 +  XExtDisplayInfo *info = xv_find_display(dpy);
  19.588 +  xvStopVideoReq *req;
  19.589 +
  19.590 +  XvCheckExtension(dpy, info, XvBadExtension);
  19.591 +
  19.592 +  LockDisplay(dpy);
  19.593 +
  19.594 +  XvGetReq(StopVideo, req);
  19.595 +  req->port = port;
  19.596 +  req->drawable = draw;
  19.597 +
  19.598 +  UnlockDisplay(dpy);
  19.599 +  SyncHandle();
  19.600 +
  19.601 +  return Success;
  19.602 +}
  19.603 +
  19.604 +int
  19.605 +SDL_NAME(XvGrabPort)(
  19.606 +     Display *dpy,
  19.607 +     XvPortID port,
  19.608 +     Time time
  19.609 +){
  19.610 +  XExtDisplayInfo *info = xv_find_display(dpy);
  19.611 +  int result;
  19.612 +  xvGrabPortReply rep;
  19.613 +  xvGrabPortReq *req;
  19.614 +
  19.615 +  XvCheckExtension(dpy, info, XvBadExtension);
  19.616 +
  19.617 +  LockDisplay(dpy);
  19.618 +
  19.619 +  XvGetReq(GrabPort, req);
  19.620 +  req->port = port;
  19.621 +  req->time = time;
  19.622 +
  19.623 +  if (_XReply (dpy, (xReply *) &rep, 0, xTrue) == 0) 
  19.624 +    rep.result = GrabSuccess;
  19.625 +
  19.626 +  result = rep.result;
  19.627 +
  19.628 +  UnlockDisplay(dpy);
  19.629 +  SyncHandle();
  19.630 +
  19.631 +  return result;
  19.632 +}
  19.633 +
  19.634 +int
  19.635 +SDL_NAME(XvUngrabPort)(
  19.636 +     Display *dpy,
  19.637 +     XvPortID port,
  19.638 +     Time time
  19.639 +){
  19.640 +  XExtDisplayInfo *info = xv_find_display(dpy);
  19.641 +  xvUngrabPortReq *req;
  19.642 +
  19.643 +  XvCheckExtension(dpy, info, XvBadExtension);
  19.644 +
  19.645 +  LockDisplay(dpy);
  19.646 +
  19.647 +  XvGetReq(UngrabPort, req);
  19.648 +  req->port = port;
  19.649 +  req->time = time;
  19.650 +
  19.651 +  UnlockDisplay(dpy);
  19.652 +  SyncHandle();
  19.653 +
  19.654 +  return Success;
  19.655 +}
  19.656 +
  19.657 +int
  19.658 +SDL_NAME(XvSelectVideoNotify)(
  19.659 +     Display *dpy,
  19.660 +     Drawable drawable,
  19.661 +     Bool onoff
  19.662 +){
  19.663 +  XExtDisplayInfo *info = xv_find_display(dpy);
  19.664 +  xvSelectVideoNotifyReq *req;
  19.665 +
  19.666 +  XvCheckExtension(dpy, info, XvBadExtension);
  19.667 +
  19.668 +  LockDisplay(dpy);
  19.669 +
  19.670 +  XvGetReq(SelectVideoNotify, req);
  19.671 +  req->drawable = drawable;
  19.672 +  req->onoff = onoff;
  19.673 +
  19.674 +  UnlockDisplay(dpy);
  19.675 +  SyncHandle();
  19.676 +
  19.677 +  return Success;
  19.678 +}
  19.679 +
  19.680 +int
  19.681 +SDL_NAME(XvSelectPortNotify)(
  19.682 +     Display *dpy,
  19.683 +     XvPortID port,
  19.684 +     Bool onoff
  19.685 +){
  19.686 +  XExtDisplayInfo *info = xv_find_display(dpy);
  19.687 +  xvSelectPortNotifyReq *req;
  19.688 +
  19.689 +  XvCheckExtension(dpy, info, XvBadExtension);
  19.690 +
  19.691 +  LockDisplay(dpy);
  19.692 +
  19.693 +  XvGetReq(SelectPortNotify, req);
  19.694 +  req->port = port;
  19.695 +  req->onoff = onoff;
  19.696 +
  19.697 +  UnlockDisplay(dpy);
  19.698 +  SyncHandle();
  19.699 +
  19.700 +  return Success;
  19.701 +}
  19.702 +
  19.703 +int
  19.704 +SDL_NAME(XvSetPortAttribute) (
  19.705 +     Display *dpy,
  19.706 +     XvPortID port,
  19.707 +     Atom attribute,
  19.708 +     int value
  19.709 +)
  19.710 +{
  19.711 +  XExtDisplayInfo *info = xv_find_display(dpy);
  19.712 +  xvSetPortAttributeReq *req;
  19.713 +
  19.714 +  XvCheckExtension(dpy, info, XvBadExtension);
  19.715 +
  19.716 +  LockDisplay(dpy);
  19.717 +
  19.718 +  XvGetReq(SetPortAttribute, req);
  19.719 +  req->port = port;
  19.720 +  req->attribute = attribute;
  19.721 +  req->value = value;
  19.722 +
  19.723 +  UnlockDisplay(dpy);
  19.724 +  SyncHandle();
  19.725 +
  19.726 +  return (Success);
  19.727 +}
  19.728 +
  19.729 +int
  19.730 +SDL_NAME(XvGetPortAttribute) (
  19.731 +     Display *dpy,
  19.732 +     XvPortID port,
  19.733 +     Atom attribute,
  19.734 +     int *p_value
  19.735 +)
  19.736 +{
  19.737 +  XExtDisplayInfo *info = xv_find_display(dpy);
  19.738 +  xvGetPortAttributeReq *req;
  19.739 +  xvGetPortAttributeReply rep;
  19.740 +
  19.741 +  XvCheckExtension(dpy, info, XvBadExtension);
  19.742 +
  19.743 +  LockDisplay(dpy);
  19.744 +
  19.745 +  XvGetReq(GetPortAttribute, req);
  19.746 +  req->port = port;
  19.747 +  req->attribute = attribute;
  19.748 +
  19.749 +  /* READ THE REPLY */
  19.750 +
  19.751 +  if (_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0) {
  19.752 +      UnlockDisplay(dpy);
  19.753 +      SyncHandle();
  19.754 +      return(XvBadReply);
  19.755 +  }
  19.756 +
  19.757 +  *p_value = rep.value;
  19.758 +  
  19.759 +  UnlockDisplay(dpy);
  19.760 +  SyncHandle();
  19.761 +
  19.762 +  return (Success);
  19.763 +}
  19.764 +
  19.765 +int
  19.766 +SDL_NAME(XvQueryBestSize)(
  19.767 +     Display *dpy,
  19.768 +     XvPortID port,
  19.769 +     Bool motion,
  19.770 +     unsigned int vid_w, 
  19.771 +     unsigned int vid_h,
  19.772 +     unsigned int drw_w, 
  19.773 +     unsigned int drw_h,
  19.774 +     unsigned int *p_actual_width, 
  19.775 +     unsigned int *p_actual_height
  19.776 +)
  19.777 +{
  19.778 +  XExtDisplayInfo *info = xv_find_display(dpy);
  19.779 +  xvQueryBestSizeReq *req;
  19.780 +  xvQueryBestSizeReply rep;
  19.781 +
  19.782 +  XvCheckExtension(dpy, info, XvBadExtension);
  19.783 +
  19.784 +  LockDisplay(dpy);
  19.785 +
  19.786 +  XvGetReq(QueryBestSize, req);
  19.787 +  req->port = port;
  19.788 +  req->motion = motion;
  19.789 +  req->vid_w = vid_w;
  19.790 +  req->vid_h = vid_h;
  19.791 +  req->drw_w = drw_w;
  19.792 +  req->drw_h = drw_h;
  19.793 +
  19.794 +  /* READ THE REPLY */
  19.795 +
  19.796 +  if (_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0) {
  19.797 +      UnlockDisplay(dpy);
  19.798 +      SyncHandle();
  19.799 +      return(XvBadReply);
  19.800 +  }
  19.801 +
  19.802 +  *p_actual_width = rep.actual_width;
  19.803 +  *p_actual_height = rep.actual_height;
  19.804 +
  19.805 +  UnlockDisplay(dpy);
  19.806 +  SyncHandle();
  19.807 +
  19.808 +  return (Success);
  19.809 +}
  19.810 +
  19.811 +
  19.812 +SDL_NAME(XvAttribute)* 
  19.813 +SDL_NAME(XvQueryPortAttributes)(Display *dpy, XvPortID port, int *num)
  19.814 +{
  19.815 +  XExtDisplayInfo *info = xv_find_display(dpy);
  19.816 +  xvQueryPortAttributesReq *req;
  19.817 +  xvQueryPortAttributesReply rep;
  19.818 +  SDL_NAME(XvAttribute) *ret = NULL;
  19.819 +
  19.820 +  *num = 0;
  19.821 +
  19.822 +  XvCheckExtension(dpy, info, NULL);
  19.823 +
  19.824 +  LockDisplay(dpy);
  19.825 +
  19.826 +  XvGetReq(QueryPortAttributes, req);
  19.827 +  req->port = port;
  19.828 +
  19.829 +  /* READ THE REPLY */
  19.830 +
  19.831 +  if (_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0) {
  19.832 +      UnlockDisplay(dpy);
  19.833 +      SyncHandle();
  19.834 +      return ret;
  19.835 +  }
  19.836 +
  19.837 +  if(rep.num_attributes) {
  19.838 +      int size = (rep.num_attributes * sizeof(SDL_NAME(XvAttribute))) + rep.text_size;
  19.839 +
  19.840 +      if((ret = Xmalloc(size))) {
  19.841 +	  char* marker = (char*)(&ret[rep.num_attributes]);
  19.842 +	  xvAttributeInfo Info;
  19.843 +	  int i;
  19.844 +	
  19.845 +	  for(i = 0; i < rep.num_attributes; i++) {
  19.846 +             _XRead(dpy, (char*)(&Info), sz_xvAttributeInfo);
  19.847 +	      ret[i].flags = (int)Info.flags;	      
  19.848 +	      ret[i].min_value = Info.min;	      
  19.849 +	      ret[i].max_value = Info.max;	      
  19.850 +	      ret[i].name = marker;
  19.851 +	      _XRead(dpy, marker, Info.size);
  19.852 +	      marker += Info.size;
  19.853 +	      (*num)++;
  19.854 +	  }
  19.855 +      } else
  19.856 +	_XEatData(dpy, rep.length << 2);
  19.857 +  }
  19.858 +
  19.859 +  UnlockDisplay(dpy);
  19.860 +  SyncHandle();
  19.861 +
  19.862 +  return ret;
  19.863 +}
  19.864 +
  19.865 +SDL_NAME(XvImageFormatValues) * SDL_NAME(XvListImageFormats) (
  19.866 +   Display 	*dpy,
  19.867 +   XvPortID 	port,
  19.868 +   int 		*num
  19.869 +){
  19.870 +  XExtDisplayInfo *info = xv_find_display(dpy);
  19.871 +  xvListImageFormatsReq *req;
  19.872 +  xvListImageFormatsReply rep;
  19.873 +  SDL_NAME(XvImageFormatValues) *ret = NULL;
  19.874 +
  19.875 +  *num = 0;
  19.876 +
  19.877 +  XvCheckExtension(dpy, info, NULL);
  19.878 +
  19.879 +  LockDisplay(dpy);
  19.880 +
  19.881 +  XvGetReq(ListImageFormats, req);
  19.882 +  req->port = port;
  19.883 +
  19.884 +  /* READ THE REPLY */
  19.885 +
  19.886 +  if (_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0) {
  19.887 +      UnlockDisplay(dpy);
  19.888 +      SyncHandle();
  19.889 +      return NULL;
  19.890 +  }
  19.891 +
  19.892 +  if(rep.num_formats) {
  19.893 +      int size = (rep.num_formats * sizeof(SDL_NAME(XvImageFormatValues)));
  19.894 +
  19.895 +      if((ret = Xmalloc(size))) {
  19.896 +	  xvImageFormatInfo Info;
  19.897 +	  int i;
  19.898 +	
  19.899 +	  for(i = 0; i < rep.num_formats; i++) {
  19.900 +              _XRead(dpy, (char*)(&Info), sz_xvImageFormatInfo);
  19.901 +	      ret[i].id = Info.id;	      
  19.902 +	      ret[i].type = Info.type;	      
  19.903 +	      ret[i].byte_order = Info.byte_order;	      
  19.904 +	      memcpy(&(ret[i].guid[0]), &(Info.guid[0]), 16);
  19.905 +	      ret[i].bits_per_pixel = Info.bpp;	      
  19.906 +  	      ret[i].format = Info.format;	      
  19.907 +   	      ret[i].num_planes = Info.num_planes;	      
  19.908 +    	      ret[i].depth = Info.depth;	      
  19.909 +    	      ret[i].red_mask = Info.red_mask;	      
  19.910 +    	      ret[i].green_mask = Info.green_mask;	      
  19.911 +    	      ret[i].blue_mask = Info.blue_mask;	      
  19.912 +    	      ret[i].y_sample_bits = Info.y_sample_bits;	      
  19.913 +    	      ret[i].u_sample_bits = Info.u_sample_bits;	      
  19.914 +    	      ret[i].v_sample_bits = Info.v_sample_bits;
  19.915 +    	      ret[i].horz_y_period = Info.horz_y_period;
  19.916 +    	      ret[i].horz_u_period = Info.horz_u_period;
  19.917 +    	      ret[i].horz_v_period = Info.horz_v_period;
  19.918 +    	      ret[i].vert_y_period = Info.vert_y_period;
  19.919 +    	      ret[i].vert_u_period = Info.vert_u_period;
  19.920 +    	      ret[i].vert_v_period = Info.vert_v_period;
  19.921 +	      memcpy(&(ret[i].component_order[0]), &(Info.comp_order[0]), 32);
  19.922 +    	      ret[i].scanline_order = Info.scanline_order;
  19.923 +	      (*num)++;
  19.924 +	  }
  19.925 +      } else
  19.926 +	_XEatData(dpy, rep.length << 2);
  19.927 +  }
  19.928 +
  19.929 +  UnlockDisplay(dpy);
  19.930 +  SyncHandle();
  19.931 +
  19.932 +  return ret;
  19.933 +}
  19.934 +
  19.935 +SDL_NAME(XvImage) * SDL_NAME(XvCreateImage) (
  19.936 +   Display *dpy,
  19.937 +   XvPortID port,
  19.938 +   int id,
  19.939 +   char *data,
  19.940 +   int width, 
  19.941 +   int height 
  19.942 +) {
  19.943 +   XExtDisplayInfo *info = xv_find_display(dpy);
  19.944 +   xvQueryImageAttributesReq *req;
  19.945 +   xvQueryImageAttributesReply rep;
  19.946 +   SDL_NAME(XvImage) *ret = NULL;
  19.947 +
  19.948 +   XvCheckExtension(dpy, info, NULL);
  19.949 +
  19.950 +   LockDisplay(dpy);
  19.951 +
  19.952 +   XvGetReq(QueryImageAttributes, req);
  19.953 +   req->id = id;
  19.954 +   req->port = port;
  19.955 +   req->width = width;
  19.956 +   req->height = height;
  19.957 +
  19.958 +   /* READ THE REPLY */
  19.959 +
  19.960 +   if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
  19.961 +       UnlockDisplay(dpy);
  19.962 +       SyncHandle();
  19.963 +      return NULL;
  19.964 +   }
  19.965 +
  19.966 +   if((ret = (SDL_NAME(XvImage)*)Xmalloc(sizeof(SDL_NAME(XvImage)) + (rep.num_planes << 3)))) {
  19.967 +	ret->id = id;
  19.968 +	ret->width = rep.width;
  19.969 +	ret->height = rep.height;
  19.970 +	ret->data_size = rep.data_size;
  19.971 +	ret->num_planes = rep.num_planes;
  19.972 +	ret->pitches = (int*)(&ret[1]);
  19.973 +	ret->offsets = ret->pitches + rep.num_planes;
  19.974 +	ret->data = data;
  19.975 +	ret->obdata = NULL;
  19.976 +  	_XRead(dpy, (char*)(ret->pitches), rep.num_planes << 2);
  19.977 +	_XRead(dpy, (char*)(ret->offsets), rep.num_planes << 2);
  19.978 +   } else
  19.979 +	_XEatData(dpy, rep.length << 2);
  19.980 +
  19.981 +   UnlockDisplay(dpy);
  19.982 +   SyncHandle();
  19.983 +
  19.984 +   return ret;
  19.985 +}
  19.986 +
  19.987 +SDL_NAME(XvImage) * SDL_NAME(XvShmCreateImage) (
  19.988 +   Display *dpy,
  19.989 +   XvPortID port,
  19.990 +   int id,
  19.991 +   char *data,
  19.992 +   int width, 
  19.993 +   int height,
  19.994 +   XShmSegmentInfo *shminfo
  19.995 +){
  19.996 +   SDL_NAME(XvImage) *ret;
  19.997 +
  19.998 +   ret = SDL_NAME(XvCreateImage)(dpy, port, id, data, width, height);
  19.999 +
 19.1000 +   if(ret) ret->obdata = (XPointer)shminfo;
 19.1001 +
 19.1002 +   return ret;
 19.1003 +}
 19.1004 +
 19.1005 +int SDL_NAME(XvPutImage) (
 19.1006 +   Display *dpy,
 19.1007 +   XvPortID port,
 19.1008 +   Drawable d,
 19.1009 +   GC gc,
 19.1010 +   SDL_NAME(XvImage) *image,
 19.1011 +   int src_x,
 19.1012 +   int src_y,
 19.1013 +   unsigned int src_w,
 19.1014 +   unsigned int src_h,
 19.1015 +   int dest_x, 
 19.1016 +   int dest_y,
 19.1017 +   unsigned int dest_w,
 19.1018 +   unsigned int dest_h
 19.1019 +){
 19.1020 +  XExtDisplayInfo *info = xv_find_display(dpy);
 19.1021 +  xvPutImageReq *req;
 19.1022 +  int len;
 19.1023 +
 19.1024 +  XvCheckExtension(dpy, info, XvBadExtension);
 19.1025 +
 19.1026 +  LockDisplay(dpy);
 19.1027 +
 19.1028 +  FlushGC(dpy, gc);
 19.1029 +
 19.1030 +  XvGetReq(PutImage, req);
 19.1031 +
 19.1032 +  req->port = port;
 19.1033 +  req->drawable = d;
 19.1034 +  req->gc = gc->gid;
 19.1035 +  req->id = image->id;
 19.1036 +  req->src_x = src_x;
 19.1037 +  req->src_y = src_y;
 19.1038 +  req->src_w = src_w;
 19.1039 +  req->src_h = src_h;
 19.1040 +  req->drw_x = dest_x;
 19.1041 +  req->drw_y = dest_y;
 19.1042 +  req->drw_w = dest_w;
 19.1043 +  req->drw_h = dest_h;
 19.1044 +  req->width = image->width;
 19.1045 +  req->height = image->height;
 19.1046 +
 19.1047 +  len = (image->data_size + 3) >> 2;
 19.1048 +  SetReqLen(req, len, len);
 19.1049 +
 19.1050 +  /* Yes it's kindof lame that we are sending the whole thing,
 19.1051 +     but for video all of it may be needed even if displaying
 19.1052 +     only a subsection, and I don't want to go through the 
 19.1053 +     trouble of creating subregions to send */
 19.1054 +  Data(dpy, (char *)image->data, image->data_size);
 19.1055 +
 19.1056 +  UnlockDisplay(dpy);
 19.1057 +  SyncHandle();
 19.1058 +
 19.1059 +  return Success;
 19.1060 +}
 19.1061 +
 19.1062 +int SDL_NAME(XvShmPutImage) (
 19.1063 +   Display *dpy,
 19.1064 +   XvPortID port,
 19.1065 +   Drawable d,
 19.1066 +   GC gc,
 19.1067 +   SDL_NAME(XvImage) *image,
 19.1068 +   int src_x,
 19.1069 +   int src_y,
 19.1070 +   unsigned int src_w,
 19.1071 +   unsigned int src_h,
 19.1072 +   int dest_x, 
 19.1073 +   int dest_y,
 19.1074 +   unsigned int dest_w,
 19.1075 +   unsigned int dest_h,
 19.1076 +   Bool send_event
 19.1077 +){
 19.1078 +  XExtDisplayInfo *info = xv_find_display(dpy);
 19.1079 +  XShmSegmentInfo *shminfo = (XShmSegmentInfo *)image->obdata;
 19.1080 +  xvShmPutImageReq *req;
 19.1081 +
 19.1082 +  XvCheckExtension(dpy, info, XvBadExtension);
 19.1083 +
 19.1084 +  LockDisplay(dpy);
 19.1085 +  
 19.1086 +  FlushGC(dpy, gc);
 19.1087 +
 19.1088 +  XvGetReq(ShmPutImage, req);
 19.1089 +
 19.1090 +  req->port = port;
 19.1091 +  req->drawable = d;
 19.1092 +  req->gc = gc->gid;
 19.1093 +  req->shmseg = shminfo->shmseg;
 19.1094 +  req->id = image->id;
 19.1095 +  req->src_x = src_x;
 19.1096 +  req->src_y = src_y;
 19.1097 +  req->src_w = src_w;
 19.1098 +  req->src_h = src_h;
 19.1099 +  req->drw_x = dest_x;
 19.1100 +  req->drw_y = dest_y;
 19.1101 +  req->drw_w = dest_w;
 19.1102 +  req->drw_h = dest_h;
 19.1103 +  req->offset = image->data - shminfo->shmaddr;
 19.1104 +  req->width = image->width;
 19.1105 +  req->height = image->height;
 19.1106 +  req->send_event = send_event;
 19.1107 +
 19.1108 +  UnlockDisplay(dpy);
 19.1109 +  SyncHandle();
 19.1110 +
 19.1111 +  return Success;
 19.1112 +}
 19.1113 +
 19.1114 +
 19.1115 +static Bool
 19.1116 +xv_wire_to_event(Display *dpy, XEvent *host, xEvent *wire)
 19.1117 +{
 19.1118 +  XExtDisplayInfo *info = xv_find_display(dpy);
 19.1119 +  SDL_NAME(XvEvent) *re    = (SDL_NAME(XvEvent) *)host;
 19.1120 +  xvEvent *event = (xvEvent *)wire;
 19.1121 +
 19.1122 +  XvCheckExtension(dpy, info, False);
 19.1123 +
 19.1124 +  switch((event->u.u.type & 0x7F) - info->codes->first_event)
 19.1125 +  {
 19.1126 +    case XvVideoNotify:
 19.1127 +      re->xvvideo.type = event->u.u.type & 0x7f;
 19.1128 +      re->xvvideo.serial = 
 19.1129 +	_XSetLastRequestRead(dpy, (xGenericReply *)event);
 19.1130 +      re->xvvideo.send_event = ((event->u.u.type & 0x80) != 0);
 19.1131 +      re->xvvideo.display = dpy;
 19.1132 +      re->xvvideo.time = event->u.videoNotify.time;
 19.1133 +      re->xvvideo.reason = event->u.videoNotify.reason;
 19.1134 +      re->xvvideo.drawable = event->u.videoNotify.drawable;
 19.1135 +      re->xvvideo.port_id = event->u.videoNotify.port;
 19.1136 +      break;
 19.1137 +    case XvPortNotify:
 19.1138 +      re->xvport.type = event->u.u.type & 0x7f;
 19.1139 +      re->xvport.serial = 
 19.1140 +	_XSetLastRequestRead(dpy, (xGenericReply *)event);
 19.1141 +      re->xvport.send_event = ((event->u.u.type & 0x80) != 0);
 19.1142 +      re->xvport.display = dpy;
 19.1143 +      re->xvport.time = event->u.portNotify.time;
 19.1144 +      re->xvport.port_id = event->u.portNotify.port;
 19.1145 +      re->xvport.attribute = event->u.portNotify.attribute;
 19.1146 +      re->xvport.value = event->u.portNotify.value;
 19.1147 +      break;
 19.1148 +    default:
 19.1149 +      return False; 
 19.1150 +  }
 19.1151 +
 19.1152 +  return (True);
 19.1153 +}
 19.1154 +
 19.1155 +
    20.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    20.2 +++ b/src/video/Xext/Xv/Xvlibint.h	Tue Mar 05 19:55:32 2002 +0000
    20.3 @@ -0,0 +1,76 @@
    20.4 +/***********************************************************
    20.5 +Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
    20.6 +and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
    20.7 +
    20.8 +                        All Rights Reserved
    20.9 +
   20.10 +Permission to use, copy, modify, and distribute this software and its 
   20.11 +documentation for any purpose and without fee is hereby granted, 
   20.12 +provided that the above copyright notice appear in all copies and that
   20.13 +both that copyright notice and this permission notice appear in 
   20.14 +supporting documentation, and that the names of Digital or MIT not be
   20.15 +used in advertising or publicity pertaining to distribution of the
   20.16 +software without specific, written prior permission.  
   20.17 +
   20.18 +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
   20.19 +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
   20.20 +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
   20.21 +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
   20.22 +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
   20.23 +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
   20.24 +SOFTWARE.
   20.25 +
   20.26 +******************************************************************/
   20.27 +/* $XFree86: xc/lib/Xv/Xvlibint.h,v 1.5 2001/07/25 15:04:53 dawes Exp $ */
   20.28 +
   20.29 +#ifndef XVLIBINT_H
   20.30 +#define XVLIBINT_H
   20.31 +/*
   20.32 +** File: 
   20.33 +**
   20.34 +**   Xvlibint.h --- Xv library internal header file
   20.35 +**
   20.36 +** Author: 
   20.37 +**
   20.38 +**   David Carver (Digital Workstation Engineering/Project Athena)
   20.39 +**
   20.40 +** Revisions:
   20.41 +**
   20.42 +**   01.24.91 Carver
   20.43 +**     - version 1.4 upgrade
   20.44 +**
   20.45 +*/
   20.46 +
   20.47 +#define NEED_REPLIES
   20.48 +
   20.49 +#include <X11/Xlibint.h>
   20.50 +#include "Xvproto.h"
   20.51 +#include "Xvlib.h"
   20.52 +
   20.53 +#if !defined(UNIXCPP)
   20.54 +#define XvGetReq(name, req) \
   20.55 +        WORD64ALIGN\
   20.56 +	if ((dpy->bufptr + SIZEOF(xv##name##Req)) > dpy->bufmax)\
   20.57 +		_XFlush(dpy);\
   20.58 +	req = (xv##name##Req *)(dpy->last_req = dpy->bufptr);\
   20.59 +	req->reqType = info->codes->major_opcode;\
   20.60 +        req->xvReqType = xv_##name; \
   20.61 +        req->length = (SIZEOF(xv##name##Req))>>2;\
   20.62 +	dpy->bufptr += SIZEOF(xv##name##Req);\
   20.63 +	dpy->request++
   20.64 +
   20.65 +#else  /* non-ANSI C uses empty comment instead of "##" for token concatenation */
   20.66 +#define XvGetReq(name, req) \
   20.67 +        WORD64ALIGN\
   20.68 +	if ((dpy->bufptr + SIZEOF(xv/**/name/**/Req)) > dpy->bufmax)\
   20.69 +		_XFlush(dpy);\
   20.70 +	req = (xv/**/name/**/Req *)(dpy->last_req = dpy->bufptr);\
   20.71 +	req->reqType = info->codes->major_opcode;\
   20.72 +	req->xvReqType = xv_/**/name;\
   20.73 +	req->length = (SIZEOF(xv/**/name/**/Req))>>2;\
   20.74 +	dpy->bufptr += SIZEOF(xv/**/name/**/Req);\
   20.75 +	dpy->request++
   20.76 +#endif
   20.77 +
   20.78 +
   20.79 +#endif /* XVLIBINT_H */
    21.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    21.2 +++ b/src/video/Xext/Xxf86dga/Makefile.am	Tue Mar 05 19:55:32 2002 +0000
    21.3 @@ -0,0 +1,5 @@
    21.4 +
    21.5 +## Makefile.am for the XFree86 Xxf86dga library
    21.6 +
    21.7 +noinst_LTLIBRARIES = libXFree86_Xxf86dga.la
    21.8 +libXFree86_Xxf86dga_la_SOURCES = XF86DGA2.c XF86DGA.c
    22.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    22.2 +++ b/src/video/Xext/Xxf86dga/XF86DGA.c	Tue Mar 05 19:55:32 2002 +0000
    22.3 @@ -0,0 +1,716 @@
    22.4 +/* $XFree86: xc/lib/Xxf86dga/XF86DGA.c,v 3.19 2001/08/18 02:41:30 dawes Exp $ */
    22.5 +/*
    22.6 +
    22.7 +Copyright (c) 1995  Jon Tombs
    22.8 +Copyright (c) 1995,1996  The XFree86 Project, Inc
    22.9 +
   22.10 +*/
   22.11 +
   22.12 +/* THIS IS NOT AN X CONSORTIUM STANDARD */
   22.13 +
   22.14 +#ifdef __EMX__ /* needed here to override certain constants in X headers */
   22.15 +#define INCL_DOS
   22.16 +#define INCL_DOSIOCTL
   22.17 +#include <os2.h>
   22.18 +#endif
   22.19 +
   22.20 +#if defined(linux)
   22.21 +#define HAS_MMAP_ANON
   22.22 +#include <sys/types.h>
   22.23 +#include <sys/mman.h>
   22.24 +#include <asm/page.h>   /* PAGE_SIZE */
   22.25 +#define HAS_SC_PAGESIZE /* _SC_PAGESIZE may be an enum for Linux */
   22.26 +#define HAS_GETPAGESIZE
   22.27 +#endif /* linux */
   22.28 +
   22.29 +#if defined(CSRG_BASED)
   22.30 +#define HAS_MMAP_ANON
   22.31 +#define HAS_GETPAGESIZE
   22.32 +#include <sys/types.h>
   22.33 +#include <sys/mman.h>
   22.34 +#endif /* CSRG_BASED */
   22.35 +
   22.36 +#if defined(DGUX)
   22.37 +#define HAS_GETPAGESIZE
   22.38 +#define MMAP_DEV_ZERO
   22.39 +#include <sys/types.h>
   22.40 +#include <sys/mman.h>
   22.41 +#include <unistd.h>
   22.42 +#endif /* DGUX */
   22.43 +
   22.44 +#if defined(SVR4) && !defined(DGUX)
   22.45 +#define MMAP_DEV_ZERO
   22.46 +#include <sys/types.h>
   22.47 +#include <sys/mman.h>
   22.48 +#include <unistd.h>
   22.49 +#endif /* SVR4 && !DGUX */
   22.50 +
   22.51 +#if defined(sun) && !defined(SVR4) /* SunOS */
   22.52 +#define MMAP_DEV_ZERO   /* doesn't SunOS have MAP_ANON ?? */
   22.53 +#define HAS_GETPAGESIZE
   22.54 +#include <sys/types.h>
   22.55 +#include <sys/mman.h>
   22.56 +#endif /* sun && !SVR4 */
   22.57 +
   22.58 +#ifdef XNO_SYSCONF
   22.59 +#undef _SC_PAGESIZE
   22.60 +#endif
   22.61 +
   22.62 +
   22.63 +#define NEED_EVENTS
   22.64 +#define NEED_REPLIES
   22.65 +#include <X11/Xlibint.h>
   22.66 +#include "xf86dga.h"
   22.67 +#include "xf86dgastr.h"
   22.68 +#include <X11/extensions/Xext.h>
   22.69 +#include "extutil.h"
   22.70 +
   22.71 +extern XExtDisplayInfo* SDL_NAME(xdga_find_display)(Display*);
   22.72 +extern char *SDL_NAME(xdga_extension_name);
   22.73 +
   22.74 +#define XF86DGACheckExtension(dpy,i,val) \
   22.75 +  XextCheckExtension (dpy, i, SDL_NAME(xdga_extension_name), val)
   22.76 +
   22.77 +/*****************************************************************************
   22.78 + *                                                                           *
   22.79 + *		    public XFree86-DGA Extension routines                    *
   22.80 + *                                                                           *
   22.81 + *****************************************************************************/
   22.82 +
   22.83 +Bool SDL_NAME(XF86DGAQueryExtension) (
   22.84 +    Display *dpy,
   22.85 +    int *event_basep,
   22.86 +    int *error_basep
   22.87 +){
   22.88 +    return SDL_NAME(XDGAQueryExtension)(dpy, event_basep, error_basep);
   22.89 +}
   22.90 +
   22.91 +Bool SDL_NAME(XF86DGAQueryVersion)(
   22.92 +    Display* dpy,
   22.93 +    int* majorVersion, 
   22.94 +    int* minorVersion
   22.95 +){
   22.96 +    return SDL_NAME(XDGAQueryVersion)(dpy, majorVersion, minorVersion);
   22.97 +}
   22.98 +
   22.99 +Bool SDL_NAME(XF86DGAGetVideoLL)(
  22.100 +    Display* dpy,
  22.101 +    int screen,
  22.102 +    int *offset,
  22.103 +    int *width, 
  22.104 +    int *bank_size, 
  22.105 +    int *ram_size
  22.106 +){
  22.107 +    XExtDisplayInfo *info = SDL_NAME(xdga_find_display) (dpy);
  22.108 +    xXF86DGAGetVideoLLReply rep;
  22.109 +    xXF86DGAGetVideoLLReq *req;
  22.110 +
  22.111 +    XF86DGACheckExtension (dpy, info, False);
  22.112 +
  22.113 +    LockDisplay(dpy);
  22.114 +    GetReq(XF86DGAGetVideoLL, req);
  22.115 +    req->reqType = info->codes->major_opcode;
  22.116 +    req->dgaReqType = X_XF86DGAGetVideoLL;
  22.117 +    req->screen = screen;
  22.118 +    if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
  22.119 +	UnlockDisplay(dpy);
  22.120 +	SyncHandle();
  22.121 +	return False;
  22.122 +    }
  22.123 +
  22.124 +    *offset = /*(char *)*/rep.offset;
  22.125 +    *width = rep.width;
  22.126 +    *bank_size = rep.bank_size;
  22.127 +    *ram_size = rep.ram_size;
  22.128 +	
  22.129 +    UnlockDisplay(dpy);
  22.130 +    SyncHandle();
  22.131 +    return True;
  22.132 +}
  22.133 +
  22.134 +    
  22.135 +Bool SDL_NAME(XF86DGADirectVideoLL)(
  22.136 +    Display* dpy,
  22.137 +    int screen,
  22.138 +    int enable
  22.139 +){
  22.140 +    XExtDisplayInfo *info = SDL_NAME(xdga_find_display) (dpy);
  22.141 +    xXF86DGADirectVideoReq *req;
  22.142 +
  22.143 +    XF86DGACheckExtension (dpy, info, False);
  22.144 +
  22.145 +    LockDisplay(dpy);
  22.146 +    GetReq(XF86DGADirectVideo, req);
  22.147 +    req->reqType = info->codes->major_opcode;
  22.148 +    req->dgaReqType = X_XF86DGADirectVideo;
  22.149 +    req->screen = screen;
  22.150 +    req->enable = enable;
  22.151 +    UnlockDisplay(dpy);
  22.152 +    SyncHandle();
  22.153 +    XSync(dpy,False);
  22.154 +    return True;
  22.155 +}
  22.156 +
  22.157 +Bool SDL_NAME(XF86DGAGetViewPortSize)(
  22.158 +    Display* dpy,
  22.159 +    int screen,
  22.160 +    int *width, 
  22.161 +    int *height
  22.162 +){
  22.163 +    XExtDisplayInfo *info = SDL_NAME(xdga_find_display) (dpy);
  22.164 +    xXF86DGAGetViewPortSizeReply rep;
  22.165 +    xXF86DGAGetViewPortSizeReq *req;
  22.166 +
  22.167 +    XF86DGACheckExtension (dpy, info, False);
  22.168 +
  22.169 +    LockDisplay(dpy);
  22.170 +    GetReq(XF86DGAGetViewPortSize, req);
  22.171 +    req->reqType = info->codes->major_opcode;
  22.172 +    req->dgaReqType = X_XF86DGAGetViewPortSize;
  22.173 +    req->screen = screen;
  22.174 +    if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
  22.175 +	UnlockDisplay(dpy);
  22.176 +	SyncHandle();
  22.177 +	return False;
  22.178 +    }
  22.179 +
  22.180 +    *width = rep.width;
  22.181 +    *height = rep.height;
  22.182 +	
  22.183 +    UnlockDisplay(dpy);
  22.184 +    SyncHandle();
  22.185 +    return True;
  22.186 +}
  22.187 +    
  22.188 +    
  22.189 +Bool SDL_NAME(XF86DGASetViewPort)(
  22.190 +    Display* dpy,
  22.191 +    int screen,
  22.192 +    int x, 
  22.193 +    int y
  22.194 +){
  22.195 +    XExtDisplayInfo *info = SDL_NAME(xdga_find_display) (dpy);
  22.196 +    xXF86DGASetViewPortReq *req;
  22.197 +
  22.198 +    XF86DGACheckExtension (dpy, info, False);
  22.199 +
  22.200 +    LockDisplay(dpy);
  22.201 +    GetReq(XF86DGASetViewPort, req);
  22.202 +    req->reqType = info->codes->major_opcode;
  22.203 +    req->dgaReqType = X_XF86DGASetViewPort;
  22.204 +    req->screen = screen;
  22.205 +    req->x = x;
  22.206 +    req->y = y;
  22.207 +    UnlockDisplay(dpy);
  22.208 +    SyncHandle();
  22.209 +    XSync(dpy,False);
  22.210 +    return True;
  22.211 +}
  22.212 +
  22.213 +    
  22.214 +Bool SDL_NAME(XF86DGAGetVidPage)(
  22.215 +    Display* dpy,
  22.216 +    int screen,
  22.217 +    int *vpage
  22.218 +){
  22.219 +    XExtDisplayInfo *info = SDL_NAME(xdga_find_display) (dpy);
  22.220 +    xXF86DGAGetVidPageReply rep;
  22.221 +    xXF86DGAGetVidPageReq *req;
  22.222 +
  22.223 +    XF86DGACheckExtension (dpy, info, False);
  22.224 +
  22.225 +    LockDisplay(dpy);
  22.226 +    GetReq(XF86DGAGetVidPage, req);
  22.227 +    req->reqType = info->codes->major_opcode;
  22.228 +    req->dgaReqType = X_XF86DGAGetVidPage;
  22.229 +    req->screen = screen;
  22.230 +    if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
  22.231 +	UnlockDisplay(dpy);
  22.232 +	SyncHandle();
  22.233 +	return False;
  22.234 +    }
  22.235 +
  22.236 +    *vpage = rep.vpage;
  22.237 +    UnlockDisplay(dpy);
  22.238 +    SyncHandle();
  22.239 +    return True;
  22.240 +}
  22.241 +
  22.242 +    
  22.243 +Bool SDL_NAME(XF86DGASetVidPage)(
  22.244 +    Display* dpy,
  22.245 +    int screen,
  22.246 +    int vpage
  22.247 +){
  22.248 +    XExtDisplayInfo *info = SDL_NAME(xdga_find_display) (dpy);
  22.249 +    xXF86DGASetVidPageReq *req;
  22.250 +
  22.251 +    XF86DGACheckExtension (dpy, info, False);
  22.252 +
  22.253 +    LockDisplay(dpy);
  22.254 +    GetReq(XF86DGASetVidPage, req);
  22.255 +    req->reqType = info->codes->major_opcode;
  22.256 +    req->dgaReqType = X_XF86DGASetVidPage;
  22.257 +    req->screen = screen;
  22.258 +    req->vpage = vpage;
  22.259 +    UnlockDisplay(dpy);
  22.260 +    SyncHandle();
  22.261 +    XSync(dpy,False);
  22.262 +    return True;
  22.263 +}
  22.264 +
  22.265 +Bool SDL_NAME(XF86DGAInstallColormap)(
  22.266 +    Display* dpy,
  22.267 +    int screen,
  22.268 +    Colormap cmap
  22.269 +){
  22.270 +    XExtDisplayInfo *info = SDL_NAME(xdga_find_display) (dpy);
  22.271 +    xXF86DGAInstallColormapReq *req;
  22.272 +
  22.273 +    XF86DGACheckExtension (dpy, info, False);
  22.274 +
  22.275 +    LockDisplay(dpy);
  22.276 +    GetReq(XF86DGAInstallColormap, req);
  22.277 +    req->reqType = info->codes->major_opcode;
  22.278 +    req->dgaReqType = X_XF86DGAInstallColormap;
  22.279 +    req->screen = screen;
  22.280 +    req->id = cmap;
  22.281 +    UnlockDisplay(dpy);
  22.282 +    SyncHandle();
  22.283 +    XSync(dpy,False);
  22.284 +    return True;
  22.285 +}
  22.286 +
  22.287 +Bool SDL_NAME(XF86DGAQueryDirectVideo)(
  22.288 +    Display *dpy,
  22.289 +    int screen,
  22.290 +    int *flags
  22.291 +){
  22.292 +    XExtDisplayInfo *info = SDL_NAME(xdga_find_display) (dpy);
  22.293 +    xXF86DGAQueryDirectVideoReply rep;
  22.294 +    xXF86DGAQueryDirectVideoReq *req;
  22.295 +
  22.296 +    XF86DGACheckExtension (dpy, info, False);
  22.297 +
  22.298 +    LockDisplay(dpy);
  22.299 +    GetReq(XF86DGAQueryDirectVideo, req);
  22.300 +    req->reqType = info->codes->major_opcode;
  22.301 +    req->dgaReqType = X_XF86DGAQueryDirectVideo;
  22.302 +    req->screen = screen;
  22.303 +    if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
  22.304 +	UnlockDisplay(dpy);
  22.305 +	SyncHandle();
  22.306 +	return False;
  22.307 +    }
  22.308 +    *flags = rep.flags;
  22.309 +    UnlockDisplay(dpy);
  22.310 +    SyncHandle();
  22.311 +    return True;
  22.312 +}
  22.313 +
  22.314 +Bool SDL_NAME(XF86DGAViewPortChanged)(
  22.315 +    Display *dpy,
  22.316 +    int screen,
  22.317 +    int n
  22.318 +){
  22.319 +    XExtDisplayInfo *info = SDL_NAME(xdga_find_display) (dpy);
  22.320 +    xXF86DGAViewPortChangedReply rep;
  22.321 +    xXF86DGAViewPortChangedReq *req;
  22.322 +
  22.323 +    XF86DGACheckExtension (dpy, info, False);
  22.324 +
  22.325 +    LockDisplay(dpy);
  22.326 +    GetReq(XF86DGAViewPortChanged, req);
  22.327 +    req->reqType = info->codes->major_opcode;
  22.328 +    req->dgaReqType = X_XF86DGAViewPortChanged;
  22.329 +    req->screen = screen;
  22.330 +    req->n = n;
  22.331 +    if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
  22.332 +	UnlockDisplay(dpy);
  22.333 +	SyncHandle();
  22.334 +	return False;
  22.335 +    }
  22.336 +    UnlockDisplay(dpy);
  22.337 +    SyncHandle();
  22.338 +    return rep.result;
  22.339 +}
  22.340 +
  22.341 +
  22.342 +
  22.343 +/* Helper functions */
  22.344 +
  22.345 +#include <X11/Xmd.h>
  22.346 +#include <XFree86/extensions/xf86dga.h>
  22.347 +#include <stdlib.h>
  22.348 +#include <stdio.h>
  22.349 +#include <fcntl.h>
  22.350 +#if defined(ISC) 
  22.351 +# define HAS_SVR3_MMAP
  22.352 +# include <sys/types.h>
  22.353 +# include <errno.h>
  22.354 +
  22.355 +# include <sys/at_ansi.h>
  22.356 +# include <sys/kd.h>
  22.357 +
  22.358 +# include <sys/sysmacros.h>
  22.359 +# include <sys/immu.h>
  22.360 +# include <sys/region.h>
  22.361 +
  22.362 +# include <sys/mmap.h>
  22.363 +#else
  22.364 +# if !defined(Lynx)
  22.365 +#  if !defined(__EMX__)
  22.366 +#   include <sys/mman.h>
  22.367 +#  endif
  22.368 +# else
  22.369 +#  include <sys/types.h>
  22.370 +#  include <errno.h>
  22.371 +#  include <smem.h>
  22.372 +# endif
  22.373 +#endif
  22.374 +#include <sys/wait.h>
  22.375 +#include <signal.h>
  22.376 +#include <unistd.h>
  22.377 +
  22.378 +#if defined(SVR4) && !defined(sun) && !defined(SCO325)
  22.379 +#define DEV_MEM "/dev/pmem"
  22.380 +#elif defined(SVR4) && defined(sun)
  22.381 +#define DEV_MEM "/dev/xsvc"
  22.382 +#else
  22.383 +#define DEV_MEM "/dev/mem"
  22.384 +#endif
  22.385 +
  22.386 +typedef struct {
  22.387 +    unsigned long physaddr;	/* actual requested physical address */
  22.388 +    unsigned long size;		/* actual requested map size */
  22.389 +    unsigned long delta;	/* delta to account for page alignment */
  22.390 +    void *	  vaddr;	/* mapped address, without the delta */
  22.391 +    int		  refcount;	/* reference count */
  22.392 +} MapRec, *MapPtr;
  22.393 +
  22.394 +typedef struct {
  22.395 +    Display *	display;
  22.396 +    int		screen;
  22.397 +    MapPtr	map;
  22.398 +} ScrRec, *ScrPtr;
  22.399 +
  22.400 +static int mapFd = -1;
  22.401 +static int numMaps = 0;
  22.402 +static int numScrs = 0;
  22.403 +static MapPtr *mapList = NULL;
  22.404 +static ScrPtr *scrList = NULL;
  22.405 +
  22.406 +static MapPtr
  22.407 +AddMap(void)
  22.408 +{
  22.409 +    MapPtr *old;
  22.410 +
  22.411 +    old = mapList;
  22.412 +    mapList = realloc(mapList, sizeof(MapPtr) * (numMaps + 1));
  22.413 +    if (!mapList) {
  22.414 +	mapList = old;
  22.415 +	return NULL;
  22.416 +    }
  22.417 +    mapList[numMaps] = malloc(sizeof(MapRec));
  22.418 +    if (!mapList[numMaps])
  22.419 +	return NULL;
  22.420 +    return mapList[numMaps++];
  22.421 +}
  22.422 +
  22.423 +static ScrPtr
  22.424 +AddScr(void)
  22.425 +{
  22.426 +    ScrPtr *old;
  22.427 +
  22.428 +    old = scrList;
  22.429 +    scrList = realloc(scrList, sizeof(ScrPtr) * (numScrs + 1));
  22.430 +    if (!scrList) {
  22.431 +	scrList = old;
  22.432 +	return NULL;
  22.433 +    }
  22.434 +    scrList[numScrs] = malloc(sizeof(ScrRec));
  22.435 +    if (!scrList[numScrs])
  22.436 +	return NULL;
  22.437 +    return scrList[numScrs++];
  22.438 +}
  22.439 +
  22.440 +static MapPtr
  22.441 +FindMap(unsigned long address, unsigned long size)
  22.442 +{
  22.443 +    int i;
  22.444 +
  22.445 +    for (i = 0; i < numMaps; i++) {
  22.446 +	if (mapList[i]->physaddr == address &&
  22.447 +	    mapList[i]->size == size)
  22.448 +	    return mapList[i];
  22.449 +    }
  22.450 +    return NULL;
  22.451 +}
  22.452 +
  22.453 +static ScrPtr
  22.454 +FindScr(Display *display, int screen)
  22.455 +{
  22.456 +    int i;
  22.457 +
  22.458 +    for (i = 0; i < numScrs; i++) {
  22.459 +	if (scrList[i]->display == display &&
  22.460 +	    scrList[i]->screen == screen)
  22.461 +	    return scrList[i];
  22.462 +    }
  22.463 +    return NULL;
  22.464 +}
  22.465 +
  22.466 +static void *
  22.467 +MapPhysAddress(unsigned long address, unsigned long size)
  22.468 +{
  22.469 +    unsigned long offset, delta;
  22.470 +    int pagesize = -1;
  22.471 +    void *vaddr;
  22.472 +    MapPtr mp;
  22.473 +#if defined(ISC) && defined(HAS_SVR3_MMAP)
  22.474 +    struct kd_memloc mloc;
  22.475 +#elif defined(__EMX__)
  22.476 +    APIRET rc;
  22.477 +    ULONG action;
  22.478 +    HFILE hfd;
  22.479 +#endif
  22.480 +
  22.481 +    if ((mp = FindMap(address, size))) {
  22.482 +	mp->refcount++;
  22.483 +	return (void *)((unsigned long)mp->vaddr + mp->delta);
  22.484 +    }
  22.485 +
  22.486 +#if defined(_SC_PAGESIZE) && defined(HAS_SC_PAGESIZE)
  22.487 +    pagesize = sysconf(_SC_PAGESIZE);
  22.488 +#endif
  22.489 +#ifdef _SC_PAGE_SIZE
  22.490 +    if (pagesize == -1)
  22.491 +	pagesize = sysconf(_SC_PAGE_SIZE);
  22.492 +#endif
  22.493 +#ifdef HAS_GETPAGESIZE
  22.494 +    if (pagesize == -1)
  22.495 +	pagesize = getpagesize();
  22.496 +#endif
  22.497 +#ifdef PAGE_SIZE
  22.498 +    if (pagesize == -1)
  22.499 +	pagesize = PAGE_SIZE;
  22.500 +#endif
  22.501 +    if (pagesize == -1)
  22.502 +	pagesize = 4096;
  22.503 +
  22.504 +   delta = address % pagesize;
  22.505 +   offset = address - delta;
  22.506 +
  22.507 +#if defined(ISC) && defined(HAS_SVR3_MMAP)
  22.508 +    if (mapFd < 0) {
  22.509 +	if ((mapFd = open("/dev/mmap", O_RDWR)) < 0)
  22.510 +	    return NULL;
  22.511 +    }
  22.512 +    mloc.vaddr = (char *)0;
  22.513 +    mloc.physaddr = (char *)offset;
  22.514 +    mloc.length = size + delta;
  22.515 +    mloc.ioflg=1;
  22.516 +
  22.517 +    if ((vaddr = (void *)ioctl(mapFd, MAP, &mloc)) == (void *)-1)
  22.518 +	return NULL;
  22.519 +#elif defined (__EMX__)
  22.520 +    /*
  22.521 +     * Dragon warning here! /dev/pmap$ is never closed, except on progam exit.
  22.522 +     * Consecutive calling of this routine will make PMAP$ driver run out
  22.523 +     * of memory handles. Some umap/close mechanism should be provided
  22.524 +     */
  22.525 +
  22.526 +    rc = DosOpen("/dev/pmap$", &hfd, &action, 0, FILE_NORMAL, FILE_OPEN,
  22.527 +		 OPEN_ACCESS_READWRITE | OPEN_SHARE_DENYNONE, (PEAOP2)NULL);
  22.528 +    if (rc != 0)
  22.529 +	return NULL;
  22.530 +    {
  22.531 +	struct map_ioctl {
  22.532 +		union {
  22.533 +			ULONG phys;
  22.534 +			void* user;
  22.535 +		} a;
  22.536 +		ULONG size;
  22.537 +	} pmap,dmap;
  22.538 +	ULONG plen,dlen;
  22.539 +#define XFREE86_PMAP	0x76
  22.540 +#define PMAP_MAP	0x44
  22.541 +
  22.542 +	pmap.a.phys = offset;
  22.543 +	pmap.size = size + delta;
  22.544 +	rc = DosDevIOCtl(hfd, XFREE86_PMAP, PMAP_MAP,
  22.545 +			 (PULONG)&pmap, sizeof(pmap), &plen,
  22.546 +			 (PULONG)&dmap, sizeof(dmap), &dlen);
  22.547 +	if (rc == 0) {
  22.548 +		vaddr = dmap.a.user;
  22.549 +	}
  22.550 +   }
  22.551 +   if (rc != 0)
  22.552 +	return NULL;
  22.553 +#elif defined (Lynx)
  22.554 +    vaddr = (void *)smem_create("XF86DGA", (char *)offset, 
  22.555 +				size + delta, SM_READ|SM_WRITE);
  22.556 +#else
  22.557 +#ifndef MAP_FILE
  22.558 +#define MAP_FILE 0
  22.559 +#endif
  22.560 +    if (mapFd < 0) {
  22.561 +	if ((mapFd = open(DEV_MEM, O_RDWR)) < 0)
  22.562 +	    return NULL;
  22.563 +    }
  22.564 +    vaddr = (void *)mmap(NULL, size + delta, PROT_READ | PROT_WRITE,
  22.565 +                        MAP_FILE | MAP_SHARED, mapFd, (off_t)offset);
  22.566 +    if (vaddr == (void *)-1)
  22.567 +	return NULL;
  22.568 +#endif
  22.569 +
  22.570 +    if (!vaddr) {
  22.571 +	if (!(mp = AddMap()))
  22.572 +	    return NULL;
  22.573 +	mp->physaddr = address;
  22.574 +	mp->size = size;
  22.575 +	mp->delta = delta;
  22.576 +	mp->vaddr = vaddr;
  22.577 +	mp->refcount = 1;
  22.578 +    }
  22.579 +    return (void *)((unsigned long)vaddr + delta);
  22.580 +}
  22.581 +
  22.582 +/*
  22.583 + * Still need to find a clean way of detecting the death of a DGA app
  22.584 + * and returning things to normal - Jon
  22.585 + * This is here to help debugging without rebooting... Also C-A-BS
  22.586 + * should restore text mode.
  22.587 + */
  22.588 +
  22.589 +int
  22.590 +SDL_NAME(XF86DGAForkApp)(int screen)
  22.591 +{
  22.592 +    pid_t pid;
  22.593 +    int status;
  22.594 +    int i;
  22.595 +
  22.596 +     /* fork the app, parent hangs around to clean up */
  22.597 +    if ((pid = fork()) > 0) {
  22.598 +	ScrPtr sp;
  22.599 +
  22.600 +	waitpid(pid, &status, 0);
  22.601 +	for (i = 0; i < numScrs; i++) {
  22.602 +	    sp = scrList[i];
  22.603 +	    SDL_NAME(XF86DGADirectVideoLL)(sp->display, sp->screen, 0);
  22.604 +	    XSync(sp->display, False);
  22.605 +	}
  22.606 +        if (WIFEXITED(status))
  22.607 +	    _exit(0);
  22.608 +	else
  22.609 +	    _exit(-1);
  22.610 +    }
  22.611 +    return pid;
  22.612 +}
  22.613 +
  22.614 +
  22.615 +Bool
  22.616 +SDL_NAME(XF86DGADirectVideo)(
  22.617 +    Display *dis,
  22.618 +    int screen,
  22.619 +    int enable
  22.620 +){
  22.621 +    ScrPtr sp;
  22.622 +    MapPtr mp = NULL;
  22.623 +
  22.624 +    if ((sp = FindScr(dis, screen)))
  22.625 +	mp = sp->map;
  22.626 +
  22.627 +    if (enable & XF86DGADirectGraphics) {
  22.628 +#if !defined(ISC) && !defined(HAS_SVR3_MMAP) && !defined(Lynx) \
  22.629 +	&& !defined(__EMX__)
  22.630 +	if (mp && mp->vaddr)
  22.631 +	    mprotect(mp->vaddr, mp->size + mp->delta, PROT_READ | PROT_WRITE);
  22.632 +#endif
  22.633 +    } else {
  22.634 +#if !defined(ISC) && !defined(HAS_SVR3_MMAP) && !defined(Lynx) \
  22.635 +	&& !defined(__EMX__)
  22.636 +	if (mp && mp->vaddr)
  22.637 +	    mprotect(mp->vaddr, mp->size + mp->delta, PROT_READ);
  22.638 +#elif defined(Lynx)
  22.639 +	/* XXX this doesn't allow enable after disable */
  22.640 +	smem_create(NULL, mp->vaddr, mp->size + mp->delta, SM_DETACH);
  22.641 +	smem_remove("XF86DGA");
  22.642 +#endif
  22.643 +    }
  22.644 +
  22.645 +    SDL_NAME(XF86DGADirectVideoLL)(dis, screen, enable);
  22.646 +    return 1;
  22.647 +}
  22.648 +
  22.649 +
  22.650 +static void
  22.651 +XF86cleanup(int sig)
  22.652 +{
  22.653 +    ScrPtr sp;
  22.654 +    int i;
  22.655 +    static char beenhere = 0;
  22.656 +
  22.657 +    if (beenhere)
  22.658 +	_exit(3);
  22.659 +    beenhere = 1;
  22.660 +
  22.661 +    for (i = 0; i < numScrs; i++) {
  22.662 +	sp = scrList[i];
  22.663 +	SDL_NAME(XF86DGADirectVideo)(sp->display, sp->screen, 0);
  22.664 +	XSync(sp->display, False);
  22.665 +    }
  22.666 +    _exit(3);
  22.667 +}
  22.668 +
  22.669 +Bool
  22.670 +SDL_NAME(XF86DGAGetVideo)(
  22.671 +    Display *dis,
  22.672 +    int screen,
  22.673 +    char **addr,
  22.674 +    int *width, 
  22.675 +    int *bank, 
  22.676 +    int *ram
  22.677 +){
  22.678 +    /*unsigned long*/ int offset;
  22.679 +    static int beenHere = 0;
  22.680 +    ScrPtr sp;
  22.681 +    MapPtr mp;
  22.682 +
  22.683 +    if (!(sp = FindScr(dis, screen))) {
  22.684 +	if (!(sp = AddScr())) {
  22.685 +	    fprintf(stderr, "XF86DGAGetVideo: malloc failure\n");
  22.686 +	    exit(-2);
  22.687 +	}
  22.688 +	sp->display = dis;
  22.689 +	sp->screen = screen;
  22.690 +	sp->map = NULL;
  22.691 +    }
  22.692 +
  22.693 +    SDL_NAME(XF86DGAGetVideoLL)(dis, screen , &offset, width, bank, ram);
  22.694 +
  22.695 +    *addr = MapPhysAddress(offset, *bank);
  22.696 +    if (*addr == NULL) {
  22.697 +	fprintf(stderr, "XF86DGAGetVideo: failed to map video memory (%s)\n",
  22.698 +		strerror(errno));
  22.699 +	exit(-2);
  22.700 +    }
  22.701 +
  22.702 +    if ((mp = FindMap(offset, *bank)))
  22.703 +	sp->map = mp;
  22.704 +
  22.705 +    if (!beenHere) {
  22.706 +	beenHere = 1;
  22.707 +	atexit((void(*)(void))XF86cleanup);
  22.708 +	/* one shot XF86cleanup attempts */
  22.709 +	signal(SIGSEGV, XF86cleanup);
  22.710 +#ifdef SIGBUS
  22.711 +	signal(SIGBUS, XF86cleanup);
  22.712 +#endif
  22.713 +	signal(SIGHUP, XF86cleanup);
  22.714 +	signal(SIGFPE, XF86cleanup);  
  22.715 +    }
  22.716 +
  22.717 +    return 1;
  22.718 +}
  22.719 +
    23.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    23.2 +++ b/src/video/Xext/Xxf86dga/XF86DGA2.c	Tue Mar 05 19:55:32 2002 +0000
    23.3 @@ -0,0 +1,987 @@
    23.4 +/* $XFree86: xc/lib/Xxf86dga/XF86DGA2.c,v 1.18 2001/08/17 13:27:51 dawes Exp $ */
    23.5 +/*
    23.6 +
    23.7 +Copyright (c) 1995  Jon Tombs
    23.8 +Copyright (c) 1995,1996  The XFree86 Project, Inc
    23.9 +
   23.10 +*/
   23.11 +
   23.12 +/* THIS IS NOT AN X CONSORTIUM STANDARD */
   23.13 +
   23.14 +#ifdef __EMX__ /* needed here to override certain constants in X headers */
   23.15 +#define INCL_DOS
   23.16 +#define INCL_DOSIOCTL
   23.17 +#include <os2.h>
   23.18 +#endif
   23.19 +
   23.20 +#define NEED_EVENTS
   23.21 +#define NEED_REPLIES
   23.22 +#include <X11/Xlibint.h>
   23.23 +#include "xf86dga.h"
   23.24 +#include "xf86dgastr.h"
   23.25 +#include <X11/extensions/Xext.h>
   23.26 +#include "extutil.h"
   23.27 +#include <stdio.h>
   23.28 +
   23.29 +#if defined(linux)  /* Needed for framebuffer console support */
   23.30 +#include <sys/ioctl.h>
   23.31 +#include <linux/fb.h>
   23.32 +#endif
   23.33 +
   23.34 +/* If you change this, change the Bases[] array below as well */
   23.35 +#define MAX_HEADS 16
   23.36 +
   23.37 +char *SDL_NAME(xdga_extension_name) = XF86DGANAME;
   23.38 +
   23.39 +static XExtensionInfo _xdga_info_data;
   23.40 +static XExtensionInfo *xdga_info = &_xdga_info_data;
   23.41 +
   23.42 + 
   23.43 +Bool SDL_NAME(XDGAMapFramebuffer)(int, char *, unsigned char*, CARD32, CARD32, CARD32);
   23.44 +void SDL_NAME(XDGAUnmapFramebuffer)(int);
   23.45 +unsigned char* SDL_NAME(XDGAGetMappedMemory)(int);
   23.46 +
   23.47 +#define XDGACheckExtension(dpy,i,val) \
   23.48 +  XextCheckExtension (dpy, i, SDL_NAME(xdga_extension_name), val)
   23.49 +
   23.50 +/*****************************************************************************
   23.51 + *                                                                           *
   23.52 + *			   private utility routines                          *
   23.53 + *                                                                           *
   23.54 + *****************************************************************************/
   23.55 +
   23.56 +static int xdga_close_display(Display *dpy, XExtCodes *codes);
   23.57 +static Bool xdga_wire_to_event(Display *dpy, XEvent *event, xEvent *wire_ev);
   23.58 +static Status xdga_event_to_wire(Display *dpy, XEvent *event, xEvent *wire_ev);
   23.59 +
   23.60 +static XExtensionHooks xdga_extension_hooks = {
   23.61 +    NULL,				/* create_gc */
   23.62 +    NULL,				/* copy_gc */
   23.63 +    NULL,				/* flush_gc */
   23.64 +    NULL,				/* free_gc */
   23.65 +    NULL,				/* create_font */
   23.66 +    NULL,				/* free_font */
   23.67 +    xdga_close_display,			/* close_display */
   23.68 +    xdga_wire_to_event,			/* wire_to_event */
   23.69 +    xdga_event_to_wire,			/* event_to_wire */
   23.70 +    NULL,				/* error */
   23.71 +    NULL,				/* error_string */
   23.72 +};
   23.73 +
   23.74 +static XEXT_GENERATE_CLOSE_DISPLAY (xdga_close_display, xdga_info)
   23.75 +
   23.76 +
   23.77 +XEXT_GENERATE_FIND_DISPLAY (SDL_NAME(xdga_find_display), xdga_info, 
   23.78 +				   "XFree86-DGA", 
   23.79 +				   &xdga_extension_hooks, 
   23.80 +				   0, NULL)
   23.81 +
   23.82 +
   23.83 +static Status
   23.84 +xdga_event_to_wire(
   23.85 +  Display *dpy,
   23.86 +  XEvent *event,
   23.87 +  xEvent *wire_ev
   23.88 +){
   23.89 +    return True;
   23.90 +}
   23.91 +
   23.92 +static Bool
   23.93 +xdga_wire_to_event(
   23.94 +  Display *dpy,
   23.95 +  XEvent *event,
   23.96 +  xEvent *wire_ev
   23.97 +){
   23.98 +  dgaEvent *wire = (dgaEvent *) wire_ev;
   23.99 +  SDL_NAME(XDGAButtonEvent) *bevent;
  23.100 +  SDL_NAME(XDGAKeyEvent) *kevent;
  23.101 +  SDL_NAME(XDGAMotionEvent) *mevent;
  23.102 +  XExtDisplayInfo *info = SDL_NAME(xdga_find_display) (dpy);
  23.103 +
  23.104 +  XDGACheckExtension (dpy, info, False);
  23.105 +
  23.106 +  switch((wire->u.u.type & 0x7f) - info->codes->first_event) {
  23.107 +  case MotionNotify:
  23.108 +	mevent = (SDL_NAME(XDGAMotionEvent)*)event;
  23.109 +	mevent->type = wire->u.u.type & 0x7F;
  23.110 +	mevent->serial = _XSetLastRequestRead(dpy, (xGenericReply *)wire);
  23.111 +	mevent->display = dpy;
  23.112 +	mevent->screen = wire->u.event.screen;
  23.113 +	mevent->time = wire->u.event.time;
  23.114 +	mevent->state = wire->u.event.state;
  23.115 +	mevent->dx = wire->u.event.dx;
  23.116 +	mevent->dy = wire->u.event.dy;
  23.117 +	return True;
  23.118 +  case ButtonPress:
  23.119 +  case ButtonRelease:
  23.120 +	bevent = (SDL_NAME(XDGAButtonEvent)*)event;
  23.121 +	bevent->type = wire->u.u.type & 0x7F;
  23.122 +	bevent->serial = _XSetLastRequestRead(dpy, (xGenericReply *)wire);
  23.123 +	bevent->display = dpy;
  23.124 +	bevent->screen = wire->u.event.screen;
  23.125 +	bevent->time = wire->u.event.time;
  23.126 +	bevent->state = wire->u.event.state;
  23.127 +	bevent->button = wire->u.u.detail;
  23.128 +	return True;
  23.129 +  case KeyPress:
  23.130 +  case KeyRelease:
  23.131 +	kevent = (SDL_NAME(XDGAKeyEvent)*)event;
  23.132 +	kevent->type = wire->u.u.type & 0x7F;
  23.133 +	kevent->serial = _XSetLastRequestRead(dpy, (xGenericReply *)wire);
  23.134 +	kevent->display = dpy;
  23.135 +	kevent->screen = wire->u.event.screen;
  23.136 +	kevent->time = wire->u.event.time;
  23.137 +	kevent->state = wire->u.event.state;
  23.138 +	kevent->keycode = wire->u.u.detail;
  23.139 +	return True;
  23.140 +  }
  23.141 +
  23.142 +  return False;
  23.143 +}
  23.144 +
  23.145 +
  23.146 +Bool SDL_NAME(XDGAQueryExtension) (
  23.147 +    Display *dpy,
  23.148 +    int *event_basep,
  23.149 +    int *error_basep
  23.150 +){
  23.151 +    XExtDisplayInfo *info = SDL_NAME(xdga_find_display) (dpy);
  23.152 +
  23.153 +    if (XextHasExtension(info)) {
  23.154 +	*event_basep = info->codes->first_event;
  23.155 +	*error_basep = info->codes->first_error;
  23.156 +	return True;
  23.157 +    } else {
  23.158 +	return False;
  23.159 +    }
  23.160 +}
  23.161 +
  23.162 +
  23.163 +Bool SDL_NAME(XDGAQueryVersion)(
  23.164 +    Display *dpy,
  23.165 +    int *majorVersion, 
  23.166 +    int *minorVersion
  23.167 +){
  23.168 +    XExtDisplayInfo *info = SDL_NAME(xdga_find_display) (dpy);
  23.169 +    xXDGAQueryVersionReply rep;
  23.170 +    xXDGAQueryVersionReq *req;
  23.171 +
  23.172 +    XDGACheckExtension (dpy, info, False);
  23.173 +
  23.174 +    LockDisplay(dpy);
  23.175 +    GetReq(XDGAQueryVersion, req);
  23.176 +    req->reqType = info->codes->major_opcode;
  23.177 +    req->dgaReqType = X_XDGAQueryVersion;
  23.178 +    if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
  23.179 +	UnlockDisplay(dpy);
  23.180 +	SyncHandle();
  23.181 +	return False;
  23.182 +    }
  23.183 +    *majorVersion = rep.majorVersion;
  23.184 +    *minorVersion = rep.minorVersion;
  23.185 +    UnlockDisplay(dpy);
  23.186 +    SyncHandle();
  23.187 +    if (*majorVersion >= 2)
  23.188 +    {
  23.189 +	int i, j;
  23.190 +
  23.191 +	for (i = 0, j = info->codes->first_event;
  23.192 +	     i < XF86DGANumberEvents;
  23.193 +	     i++, j++) 
  23.194 +	{
  23.195 +	    XESetWireToEvent (dpy, j, xdga_wire_to_event);
  23.196 +	    XESetEventToWire (dpy, j, xdga_event_to_wire);
  23.197 +	}
  23.198 +	SDL_NAME(XDGASetClientVersion)(dpy);
  23.199 +    }
  23.200 +    return True;
  23.201 +}
  23.202 +
  23.203 +Bool SDL_NAME(XDGASetClientVersion)(
  23.204 +    Display	*dpy
  23.205 +){
  23.206 +    XExtDisplayInfo *info = SDL_NAME(xdga_find_display) (dpy);
  23.207 +    xXDGASetClientVersionReq *req;
  23.208 +
  23.209 +    XDGACheckExtension (dpy, info, False);
  23.210 +
  23.211 +    LockDisplay(dpy);
  23.212 +    GetReq(XDGASetClientVersion, req);
  23.213 +    req->reqType = info->codes->major_opcode;
  23.214 +    req->dgaReqType = X_XDGASetClientVersion;
  23.215 +    req->major = XDGA_MAJOR_VERSION;
  23.216 +    req->minor = XDGA_MINOR_VERSION;
  23.217 +    UnlockDisplay(dpy);
  23.218 +    SyncHandle();
  23.219 +    return True;
  23.220 +}
  23.221 +
  23.222 +Bool SDL_NAME(XDGAOpenFramebuffer)(
  23.223 +    Display	*dpy,
  23.224 +    int 	screen
  23.225 +){
  23.226 +    XExtDisplayInfo *info = SDL_NAME(xdga_find_display) (dpy);
  23.227 +    xXDGAOpenFramebufferReply rep;
  23.228 +    xXDGAOpenFramebufferReq *req;
  23.229 +    char *deviceName = NULL;
  23.230 +    Bool ret;
  23.231 +
  23.232 +    XDGACheckExtension (dpy, info, False);
  23.233 +
  23.234 +    LockDisplay(dpy);
  23.235 +    GetReq(XDGAOpenFramebuffer, req);
  23.236 +    req->reqType = info->codes->major_opcode;
  23.237 +    req->dgaReqType = X_XDGAOpenFramebuffer;
  23.238 +    req->screen = screen;
  23.239 +    if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
  23.240 +	UnlockDisplay(dpy);
  23.241 +	SyncHandle();
  23.242 +	return False;
  23.243 +    }
  23.244 +
  23.245 +    if(rep.length) {
  23.246 +	deviceName = Xmalloc(rep.length << 2);
  23.247 +	_XRead(dpy, deviceName, rep.length << 2);
  23.248 +    }
  23.249 +
  23.250 +    ret = SDL_NAME(XDGAMapFramebuffer)(screen, deviceName,
  23.251 +				(unsigned char*)(long)rep.mem1, 
  23.252 +				rep.size, rep.offset, rep.extra);
  23.253 +
  23.254 +    if(deviceName)
  23.255 +	Xfree(deviceName);	
  23.256 +
  23.257 +    UnlockDisplay(dpy);
  23.258 +    SyncHandle();
  23.259 +    return ret;
  23.260 +}
  23.261 +
  23.262 +void SDL_NAME(XDGACloseFramebuffer)(
  23.263 +    Display	*dpy,
  23.264 +    int		screen
  23.265 +){
  23.266 +    XExtDisplayInfo *info = SDL_NAME(xdga_find_display) (dpy);
  23.267 +    xXDGACloseFramebufferReq *req;
  23.268 +
  23.269 +    XextSimpleCheckExtension (dpy, info, SDL_NAME(xdga_extension_name));
  23.270 +
  23.271 +    SDL_NAME(XDGAUnmapFramebuffer)(screen);
  23.272 +
  23.273 +    LockDisplay(dpy);
  23.274 +    GetReq(XDGACloseFramebuffer, req);
  23.275 +    req->reqType = info->codes->major_opcode;
  23.276 +    req->dgaReqType = X_XDGACloseFramebuffer;
  23.277 +    req->screen = screen;
  23.278 +    UnlockDisplay(dpy);
  23.279 +    SyncHandle();
  23.280 +}
  23.281 +
  23.282 +
  23.283 +
  23.284 +SDL_NAME(XDGAMode)* SDL_NAME(XDGAQueryModes)(
  23.285 +    Display *dpy,
  23.286 +    int screen,
  23.287 +    int *num
  23.288 +){
  23.289 +    XExtDisplayInfo *dinfo = SDL_NAME(xdga_find_display) (dpy);
  23.290 +    xXDGAQueryModesReply rep;
  23.291 +    xXDGAQueryModesReq *req;
  23.292 +    SDL_NAME(XDGAMode) *modes = NULL;
  23.293 +
  23.294 +    *num = 0;
  23.295 +
  23.296 +    XDGACheckExtension (dpy, dinfo, NULL);
  23.297 +
  23.298 +    LockDisplay(dpy);
  23.299 +    GetReq(XDGAQueryModes, req);
  23.300 +    req->reqType = dinfo->codes->major_opcode;
  23.301 +    req->dgaReqType = X_XDGAQueryModes;
  23.302 +    req->screen = screen;
  23.303 +
  23.304 +    if (_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
  23.305 +	if(rep.length) {
  23.306 +	   xXDGAModeInfo info;
  23.307 +	   int i, size;
  23.308 +	   char *offset;
  23.309 +
  23.310 +	   size = rep.length << 2;
  23.311 +	   size -= rep.number * sz_xXDGAModeInfo; /* find text size */
  23.312 +	   modes = (SDL_NAME(XDGAMode)*)Xmalloc((rep.number * sizeof(SDL_NAME(XDGAMode))) + size);
  23.313 +	   offset = (char*)(&modes[rep.number]); /* start of text */
  23.314 +
  23.315 +
  23.316 +	   if(modes) {	
  23.317 +	      for(i = 0; i < rep.number; i++) {
  23.318 +		_XRead(dpy, (char*)(&info), sz_xXDGAModeInfo);
  23.319 +
  23.320 +		modes[i].num = info.num;
  23.321 +		modes[i].verticalRefresh = 
  23.322 +			(float)info.vsync_num / (float)info.vsync_den;
  23.323 +		modes[i].flags = info.flags;
  23.324 +		modes[i].imageWidth = info.image_width;
  23.325 +		modes[i].imageHeight = info.image_height;
  23.326 +		modes[i].pixmapWidth = info.pixmap_width;
  23.327 +		modes[i].pixmapHeight = info.pixmap_height;
  23.328 +		modes[i].bytesPerScanline = info.bytes_per_scanline;
  23.329 +		modes[i].byteOrder = info.byte_order;
  23.330 +		modes[i].depth = info.depth;
  23.331 +		modes[i].bitsPerPixel = info.bpp;
  23.332 +		modes[i].redMask = info.red_mask;
  23.333 +		modes[i].greenMask = info.green_mask;
  23.334 +		modes[i].blueMask = info.blue_mask;
  23.335 +		modes[i].visualClass = info.visual_class;
  23.336 +		modes[i].viewportWidth = info.viewport_width;
  23.337 +		modes[i].viewportHeight = info.viewport_height;
  23.338 +		modes[i].xViewportStep = info.viewport_xstep;
  23.339 +		modes[i].yViewportStep = info.viewport_ystep;
  23.340 +		modes[i].maxViewportX = info.viewport_xmax;
  23.341 +		modes[i].maxViewportY = info.viewport_ymax;
  23.342 +		modes[i].viewportFlags = info.viewport_flags;
  23.343 +		modes[i].reserved1 = info.reserved1;
  23.344 +		modes[i].reserved2 = info.reserved2;	
  23.345 +
  23.346 +		_XRead(dpy, offset, info.name_size);
  23.347 +		modes[i].name = offset;
  23.348 +		offset += info.name_size;
  23.349 +	      }
  23.350 +	      *num = rep.number;
  23.351 +	   } else
  23.352 +		_XEatData(dpy, rep.length << 2);
  23.353 +	}
  23.354 +    }
  23.355 +
  23.356 +    UnlockDisplay(dpy);
  23.357 +    SyncHandle();
  23.358 +
  23.359 +    return modes;
  23.360 +}
  23.361 +
  23.362 +
  23.363 +SDL_NAME(XDGADevice) * 
  23.364 +SDL_NAME(XDGASetMode)(
  23.365 +    Display	*dpy,
  23.366 +    int		screen,
  23.367 +    int		mode
  23.368 +){
  23.369 +    XExtDisplayInfo *dinfo = SDL_NAME(xdga_find_display) (dpy);
  23.370 +    xXDGASetModeReply rep;
  23.371 +    xXDGASetModeReq *req;
  23.372 +    SDL_NAME(XDGADevice) *dev = NULL;
  23.373 +    Pixmap pid;
  23.374 +
  23.375 +    XDGACheckExtension (dpy, dinfo, NULL);
  23.376 +
  23.377 +    LockDisplay(dpy);
  23.378 +    GetReq(XDGASetMode, req);
  23.379 +    req->reqType = dinfo->codes->major_opcode;
  23.380 +    req->dgaReqType = X_XDGASetMode;
  23.381 +    req->screen = screen;
  23.382 +    req->mode = mode;
  23.383 +    req->pid = pid = XAllocID(dpy);
  23.384 +    
  23.385 +    if (_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
  23.386 +	if(rep.length) {
  23.387 +	   xXDGAModeInfo info;
  23.388 +	   int size;
  23.389 +
  23.390 +	   size = rep.length << 2;
  23.391 +	   size -= sz_xXDGAModeInfo; /* get text size */
  23.392 +
  23.393 +	   dev = (SDL_NAME(XDGADevice)*)Xmalloc(sizeof(SDL_NAME(XDGADevice)) + size);
  23.394 +	    
  23.395 +	   if(dev) {
  23.396 +		_XRead(dpy, (char*)(&info), sz_xXDGAModeInfo);
  23.397 +
  23.398 +		dev->mode.num = info.num;
  23.399 +		dev->mode.verticalRefresh = 
  23.400 +				(float)info.vsync_num / (float)info.vsync_den;
  23.401 +		dev->mode.flags = info.flags;
  23.402 +		dev->mode.imageWidth = info.image_width;
  23.403 +		dev->mode.imageHeight = info.image_height;
  23.404 +		dev->mode.pixmapWidth = info.pixmap_width;
  23.405 +		dev->mode.pixmapHeight = info.pixmap_height;
  23.406 +		dev->mode.bytesPerScanline = info.bytes_per_scanline;
  23.407 +		dev->mode.byteOrder = info.byte_order;
  23.408 +		dev->mode.depth = info.depth;
  23.409 +		dev->mode.bitsPerPixel = info.bpp;
  23.410 +		dev->mode.redMask = info.red_mask;
  23.411 +		dev->mode.greenMask = info.green_mask;
  23.412 +		dev->mode.blueMask = info.blue_mask;
  23.413 +		dev->mode.visualClass = info.visual_class;
  23.414 +		dev->mode.viewportWidth = info.viewport_width;
  23.415 +		dev->mode.viewportHeight = info.viewport_height;
  23.416 +		dev->mode.xViewportStep = info.viewport_xstep;
  23.417 +		dev->mode.yViewportStep = info.viewport_ystep;
  23.418 +		dev->mode.maxViewportX = info.viewport_xmax;
  23.419 +		dev->mode.maxViewportY = info.viewport_ymax;
  23.420 +		dev->mode.viewportFlags = info.viewport_flags;
  23.421 +		dev->mode.reserved1 = info.reserved1;
  23.422 +		dev->mode.reserved2 = info.reserved2;
  23.423 +
  23.424 +		dev->mode.name = (char*)(&dev[1]);	
  23.425 +		_XRead(dpy, dev->mode.name, info.name_size);
  23.426 +
  23.427 +		dev->pixmap = (rep.flags & XDGAPixmap) ? pid : 0;
  23.428 +		dev->data = SDL_NAME(XDGAGetMappedMemory)(screen);
  23.429 +
  23.430 +		if(dev->data)
  23.431 +		    dev->data += rep.offset;
  23.432 +	   } 
  23.433 +	   /* not sure what to do if the allocation fails */
  23.434 +	}
  23.435 +    }
  23.436 +
  23.437 +    UnlockDisplay(dpy);
  23.438 +    SyncHandle();
  23.439 +
  23.440 +    return dev;
  23.441 +}
  23.442 +
  23.443 +
  23.444 +void SDL_NAME(XDGASetViewport)(
  23.445 +    Display	*dpy,
  23.446 +    int		screen,
  23.447 +    int		x,
  23.448 +    int		y,
  23.449 +    int		flags
  23.450 +){
  23.451 +    XExtDisplayInfo *info = SDL_NAME(xdga_find_display) (dpy);
  23.452 +    xXDGASetViewportReq *req;
  23.453 +
  23.454 +    XextSimpleCheckExtension (dpy, info, SDL_NAME(xdga_extension_name));
  23.455 +
  23.456 +    LockDisplay(dpy);
  23.457 +    GetReq(XDGASetViewport, req);
  23.458 +    req->reqType = info->codes->major_opcode;
  23.459 +    req->dgaReqType = X_XDGASetViewport;
  23.460 +    req->screen = screen;
  23.461 +    req->x = x;
  23.462 +    req->y = y;
  23.463 +    req->flags = flags;
  23.464 +    UnlockDisplay(dpy);
  23.465 +    SyncHandle();
  23.466 +}
  23.467 +
  23.468 +
  23.469 +void SDL_NAME(XDGAInstallColormap)(
  23.470 +    Display	*dpy,
  23.471 +    int		screen,
  23.472 +    Colormap	cmap
  23.473 +){
  23.474 +    XExtDisplayInfo *info = SDL_NAME(xdga_find_display) (dpy);
  23.475 +    xXDGAInstallColormapReq *req;
  23.476 +
  23.477 +    XextSimpleCheckExtension (dpy, info, SDL_NAME(xdga_extension_name));
  23.478 +
  23.479 +    LockDisplay(dpy);
  23.480 +    GetReq(XDGAInstallColormap, req);
  23.481 +    req->reqType = info->codes->major_opcode;
  23.482 +    req->dgaReqType = X_XDGAInstallColormap;
  23.483 +    req->screen = screen;
  23.484 +    req->cmap = cmap;
  23.485 +    UnlockDisplay(dpy);
  23.486 +    SyncHandle();
  23.487 +}
  23.488 +
  23.489 +void SDL_NAME(XDGASelectInput)(
  23.490 +    Display	*dpy,
  23.491 +    int		screen,
  23.492 +    long	mask
  23.493 +){
  23.494 +    XExtDisplayInfo *info = SDL_NAME(xdga_find_display) (dpy);
  23.495 +    xXDGASelectInputReq *req;
  23.496 +
  23.497 +    XextSimpleCheckExtension (dpy, info, SDL_NAME(xdga_extension_name));
  23.498 +
  23.499 +    LockDisplay(dpy);
  23.500 +    GetReq(XDGASelectInput, req);
  23.501 +    req->reqType = info->codes->major_opcode;
  23.502 +    req->dgaReqType = X_XDGASelectInput;
  23.503 +    req->screen = screen;
  23.504 +    req->mask = mask;
  23.505 +    UnlockDisplay(dpy);
  23.506 +    SyncHandle();
  23.507 +}
  23.508 +
  23.509 +void SDL_NAME(XDGAFillRectangle)(
  23.510 +    Display	*dpy,
  23.511 +    int		screen,
  23.512 +    int		x,
  23.513 +    int		y,
  23.514 +    unsigned int	width,
  23.515 +    unsigned int	height,
  23.516 +    unsigned long	color
  23.517 +){
  23.518 +    XExtDisplayInfo *info = SDL_NAME(xdga_find_display) (dpy);
  23.519 +    xXDGAFillRectangleReq *req;
  23.520 +
  23.521 +    XextSimpleCheckExtension (dpy, info, SDL_NAME(xdga_extension_name));
  23.522 +
  23.523 +    LockDisplay(dpy);
  23.524 +    GetReq(XDGAFillRectangle, req);
  23.525 +    req->reqType = info->codes->major_opcode;
  23.526 +    req->dgaReqType = X_XDGAFillRectangle;
  23.527 +    req->screen = screen;
  23.528 +    req->x = x;
  23.529 +    req->y = y;
  23.530 +    req->width = width;
  23.531 +    req->height = height;
  23.532 +    req->color = color;
  23.533 +    UnlockDisplay(dpy);
  23.534 +    SyncHandle();
  23.535 +}
  23.536 +
  23.537 +void SDL_NAME(XDGACopyArea)(
  23.538 +    Display	*dpy,
  23.539 +    int		screen,
  23.540 +    int		srcx,
  23.541 +    int		srcy,
  23.542 +    unsigned int	width,
  23.543 +    unsigned int	height,
  23.544 +    int		dstx,
  23.545 +    int		dsty
  23.546 +){
  23.547 +    XExtDisplayInfo *info = SDL_NAME(xdga_find_display) (dpy);
  23.548 +    xXDGACopyAreaReq *req;
  23.549 +
  23.550 +    XextSimpleCheckExtension (dpy, info, SDL_NAME(xdga_extension_name));
  23.551 +
  23.552 +    LockDisplay(dpy);
  23.553 +    GetReq(XDGACopyArea, req);
  23.554 +    req->reqType = info->codes->major_opcode;
  23.555 +    req->dgaReqType = X_XDGACopyArea;
  23.556 +    req->screen = screen;
  23.557 +    req->srcx = srcx;
  23.558 +    req->srcy = srcy;
  23.559 +    req->width = width;
  23.560 +    req->height = height;
  23.561 +    req->dstx = dstx;
  23.562 +    req->dsty = dsty;
  23.563 +    UnlockDisplay(dpy);
  23.564 +    SyncHandle();
  23.565 +}
  23.566 +
  23.567 +void SDL_NAME(XDGACopyTransparentArea)(
  23.568 +    Display	*dpy,
  23.569 +    int		screen,
  23.570 +    int		srcx,
  23.571 +    int		srcy,
  23.572 +    unsigned int	width,
  23.573 +    unsigned int	height,
  23.574 +    int		dstx,
  23.575 +    int		dsty,
  23.576 +    unsigned long key
  23.577 +){
  23.578 +    XExtDisplayInfo *info = SDL_NAME(xdga_find_display) (dpy);
  23.579 +    xXDGACopyTransparentAreaReq *req;
  23.580 +
  23.581 +    XextSimpleCheckExtension (dpy, info, SDL_NAME(xdga_extension_name));
  23.582 +
  23.583 +    LockDisplay(dpy);
  23.584 +    GetReq(XDGACopyTransparentArea, req);
  23.585 +    req->reqType = info->codes->major_opcode;
  23.586 +    req->dgaReqType = X_XDGACopyTransparentArea;
  23.587 +    req->screen = screen;
  23.588 +    req->srcx = srcx;
  23.589 +    req->srcy = srcy;
  23.590 +    req->width = width;
  23.591 +    req->height = height;
  23.592 +    req->dstx = dstx;
  23.593 +    req->dsty = dsty;
  23.594 +    req->key = key;
  23.595 +    UnlockDisplay(dpy);
  23.596 +    SyncHandle();
  23.597 +}
  23.598 +
  23.599 +
  23.600 +int SDL_NAME(XDGAGetViewportStatus)(
  23.601 +    Display *dpy,
  23.602 +    int screen 
  23.603 +){
  23.604 +    XExtDisplayInfo *info = SDL_NAME(xdga_find_display) (dpy);
  23.605 +    xXDGAGetViewportStatusReply rep;
  23.606 +    xXDGAGetViewportStatusReq *req;
  23.607 +    int status = 0;
  23.608 +
  23.609 +    XDGACheckExtension (dpy, info, 0);
  23.610 +
  23.611 +    LockDisplay(dpy);
  23.612 +    GetReq(XDGAGetViewportStatus, req);
  23.613 +    req->reqType = info->codes->major_opcode;
  23.614 +    req->dgaReqType = X_XDGAGetViewportStatus;
  23.615 +    req->screen = screen;
  23.616 +    if (!_XReply(dpy, (xReply *)&rep, 0, xFalse))
  23.617 +	status = rep.status;
  23.618 +    UnlockDisplay(dpy);
  23.619 +    SyncHandle();
  23.620 +    return status;
  23.621 +}
  23.622 +
  23.623 +void SDL_NAME(XDGASync)(
  23.624 +    Display *dpy,
  23.625 +    int screen 
  23.626 +){
  23.627 +    XExtDisplayInfo *info = SDL_NAME(xdga_find_display) (dpy);
  23.628 +    xXDGASyncReply rep;
  23.629 +    xXDGASyncReq *req;
  23.630 +
  23.631 +    XextSimpleCheckExtension (dpy, info, SDL_NAME(xdga_extension_name));
  23.632 +
  23.633 +    LockDisplay(dpy);
  23.634 +    GetReq(XDGASync, req);
  23.635 +    req->reqType = info->codes->major_opcode;
  23.636 +    req->dgaReqType = X_XDGASync;
  23.637 +    req->screen = screen;
  23.638 +    _XReply(dpy, (xReply *)&rep, 0, xFalse);
  23.639 +    UnlockDisplay(dpy);
  23.640 +    SyncHandle();
  23.641 +}
  23.642 +
  23.643 +
  23.644 +void SDL_NAME(XDGAChangePixmapMode)(
  23.645 +    Display *dpy,
  23.646 +    int screen,
  23.647 +    int *x,
  23.648 +    int *y,
  23.649 +    int mode 
  23.650 +){
  23.651 +    XExtDisplayInfo *info = SDL_NAME(xdga_find_display) (dpy);
  23.652 +    xXDGAChangePixmapModeReq *req;
  23.653 +    xXDGAChangePixmapModeReply rep;
  23.654 +
  23.655 +    XextSimpleCheckExtension (dpy, info, SDL_NAME(xdga_extension_name));
  23.656 +
  23.657 +    LockDisplay(dpy);
  23.658 +    GetReq(XDGAChangePixmapMode, req);
  23.659 +    req->reqType = info->codes->major_opcode;
  23.660 +    req->dgaReqType = X_XDGAChangePixmapMode;
  23.661 +    req->screen = screen;
  23.662 +    req->x = *x;
  23.663 +    req->y = *y;
  23.664 +    req->flags = mode;
  23.665 +    _XReply(dpy, (xReply *)&rep, 0, xFalse);
  23.666 +    *x = rep.x;
  23.667 +    *y = rep.y;
  23.668 +    UnlockDisplay(dpy);
  23.669 +    SyncHandle();
  23.670 +}
  23.671 +
  23.672 +Colormap SDL_NAME(XDGACreateColormap)(
  23.673 +    Display *dpy,
  23.674 +    int screen,
  23.675 +    SDL_NAME(XDGADevice) *dev,
  23.676 +    int	alloc
  23.677 +){
  23.678 +    XExtDisplayInfo *info = SDL_NAME(xdga_find_display) (dpy);
  23.679 +    xXDGACreateColormapReq *req;
  23.680 +    Colormap cid;
  23.681 +
  23.682 +    XDGACheckExtension (dpy, info, -1);
  23.683 +
  23.684 +    LockDisplay(dpy);
  23.685 +    GetReq(XDGACreateColormap, req);
  23.686 +    req->reqType = info->codes->major_opcode;
  23.687 +    req->dgaReqType = X_XDGACreateColormap;
  23.688 +    req->screen = screen;
  23.689 +    req->mode = dev->mode.num;
  23.690 +    req->alloc = alloc;
  23.691 +    cid = req->id = XAllocID(dpy);
  23.692 +    UnlockDisplay(dpy);
  23.693 +    SyncHandle();
  23.694 +
  23.695 +    return cid;
  23.696 +}
  23.697 +
  23.698 +
  23.699 +void SDL_NAME(XDGAKeyEventToXKeyEvent)(
  23.700 +    SDL_NAME(XDGAKeyEvent)* dk, 
  23.701 +    XKeyEvent* xk
  23.702 +){
  23.703 +    xk->type = dk->type;
  23.704 +    xk->serial = dk->serial;
  23.705 +    xk->send_event = False;
  23.706 +    xk->display = dk->display;
  23.707 +    xk->window = RootWindow(dk->display, dk->screen);
  23.708 +    xk->root = xk->window;
  23.709 +    xk->subwindow = None;
  23.710 +    xk->time = dk->time;
  23.711 +    xk->x = xk->y = xk->x_root = xk->y_root = 0;
  23.712 +    xk->state = dk->state;
  23.713 +    xk->keycode = dk->keycode;
  23.714 +    xk->same_screen = True;
  23.715 +}
  23.716 +
  23.717 +#include <X11/Xmd.h>
  23.718 +#include <stdlib.h>
  23.719 +#include <stdio.h>
  23.720 +#include <fcntl.h>
  23.721 +#if defined(ISC) 
  23.722 +# define HAS_SVR3_MMAP
  23.723 +# include <sys/types.h>
  23.724 +# include <errno.h>
  23.725 +
  23.726 +# include <sys/at_ansi.h>
  23.727 +# include <sys/kd.h>
  23.728 +
  23.729 +# include <sys/sysmacros.h>
  23.730 +# include <sys/immu.h>
  23.731 +# include <sys/region.h>
  23.732 +
  23.733 +# include <sys/mmap.h>
  23.734 +#else
  23.735 +# if !defined(Lynx)
  23.736 +#  if !defined(__EMX__)
  23.737 +#   include <sys/mman.h>
  23.738 +#  endif
  23.739 +# else
  23.740 +#  include <sys/types.h>
  23.741 +#  include <errno.h>
  23.742 +#  include <smem.h>
  23.743 +# endif
  23.744 +#endif
  23.745 +#include <sys/wait.h>
  23.746 +#include <signal.h>
  23.747 +#include <unistd.h>
  23.748 +
  23.749 +#if defined(SVR4) && !defined(sun) && !defined(SCO325)
  23.750 +#define DEV_MEM "/dev/pmem"
  23.751 +#elif defined(SVR4) && defined(sun)
  23.752 +#define DEV_MEM "/dev/xsvc"
  23.753 +#else
  23.754 +#define DEV_MEM "/dev/mem"
  23.755 +#endif
  23.756 +
  23.757 +
  23.758 +
  23.759 +typedef struct _DGAMapRec{
  23.760 +  unsigned char *physical;
  23.761 +  unsigned char *virtual;
  23.762 +  CARD32 size;
  23.763 +  int fd;
  23.764 +  int screen;
  23.765 +  struct _DGAMapRec *next;
  23.766 +} DGAMapRec, *DGAMapPtr;
  23.767 +
  23.768 +static Bool
  23.769 +DGAMapPhysical(int, char*, unsigned char*, CARD32, CARD32, CARD32, DGAMapPtr); 
  23.770 +static void DGAUnmapPhysical(DGAMapPtr);
  23.771 +
  23.772 +static DGAMapPtr _Maps = NULL;
  23.773 +
  23.774 +
  23.775 +unsigned char*
  23.776 +SDL_NAME(XDGAGetMappedMemory)(int screen)
  23.777 +{
  23.778 +    DGAMapPtr pMap = _Maps;
  23.779 +    unsigned char *pntr = NULL;
  23.780 +
  23.781 +    while(pMap != NULL) {
  23.782 +	if(pMap->screen == screen) {
  23.783 +	    pntr = pMap->virtual;
  23.784 +	    break;
  23.785 +	}
  23.786 +	pMap = pMap->next;
  23.787 +    }
  23.788 +
  23.789 +    return pntr;
  23.790 +}
  23.791 +
  23.792 +Bool
  23.793 +SDL_NAME(XDGAMapFramebuffer)(
  23.794 +   int screen,
  23.795 +   char *name,			/* optional device name */
  23.796 +   unsigned char* base,		/* physical memory */
  23.797 +   CARD32 size,			/* size */
  23.798 +   CARD32 offset,		/* optional offset */
  23.799 +   CARD32 extra			/* optional extra data */
  23.800 +){
  23.801 +   DGAMapPtr pMap = _Maps;
  23.802 +   Bool result;
  23.803 +   
  23.804 +   /* is it already mapped ? */
  23.805 +   while(pMap != NULL) {
  23.806 +     if(pMap->screen == screen)
  23.807 +	return True;
  23.808 +     pMap = pMap->next;
  23.809 +   }
  23.810 +
  23.811 +   if(extra & XDGANeedRoot) {
  23.812 +    /* we should probably check if we have root permissions and
  23.813 +       return False here */
  23.814 +
  23.815 +   }
  23.816 +
  23.817 +   pMap = (DGAMapPtr)Xmalloc(sizeof(DGAMapRec));
  23.818 +
  23.819 +   result = DGAMapPhysical(screen, name, base, size, offset, extra, pMap);
  23.820 +
  23.821 +   if(result) {
  23.822 +      pMap->next = _Maps;
  23.823 +      _Maps = pMap;
  23.824 +   } else 
  23.825 +      Xfree(pMap);
  23.826 +   
  23.827 +   return result;
  23.828 +}
  23.829 +
  23.830 +void
  23.831 +SDL_NAME(XDGAUnmapFramebuffer)(int screen)
  23.832 +{
  23.833 +   DGAMapPtr pMap = _Maps;
  23.834 +   DGAMapPtr pPrev = NULL;
  23.835 +
  23.836 +   /* is it already mapped */
  23.837 +    while(pMap != NULL) {
  23.838 +	if(pMap->screen == screen)
  23.839 +	    break;
  23.840 +	pPrev = pMap;
  23.841 +	pMap = pMap->next;
  23.842 +    }
  23.843 +
  23.844 +    if(!pMap)
  23.845 +	return;
  23.846 +
  23.847 +    DGAUnmapPhysical(pMap);
  23.848 +
  23.849 +    if(!pPrev)
  23.850 +	_Maps = pMap->next;
  23.851 +    else
  23.852 +	pPrev->next = pMap->next;
  23.853 +
  23.854 +    Xfree(pMap);
  23.855 +}
  23.856 +
  23.857 +
  23.858 +static Bool
  23.859 +DGAMapPhysical(
  23.860 +   int screen,
  23.861 +   char *name,			/* optional device name */
  23.862 +   unsigned char* base,		/* physical memory */
  23.863 +   CARD32 size,			/* size */
  23.864 +   CARD32 offset,		/* optional offset */
  23.865 +   CARD32 extra,		/* optional extra data */
  23.866 +   DGAMapPtr pMap
  23.867 +) {
  23.868 +#if defined(ISC) && defined(HAS_SVR3_MMAP)
  23.869 +    struct kd_memloc mloc;
  23.870 +#elif defined(__EMX__)
  23.871 +    APIRET rc;
  23.872 +    ULONG action;
  23.873 +    HFILE hfd;
  23.874 +#endif
  23.875 +  
  23.876 +    base += offset;
  23.877 +
  23.878 +    pMap->screen = screen;
  23.879 +    pMap->physical = base;
  23.880 +    pMap->size = size;
  23.881 +
  23.882 +#if defined(ISC) && defined(HAS_SVR3_MMAP)
  23.883 +    if ((pMap->fd = open("/dev/mmap", O_RDWR)) < 0)
  23.884 +	return False;
  23.885 +    mloc.vaddr = (char *)0;
  23.886 +    mloc.physaddr = (char *)base;
  23.887 +    mloc.length = size;
  23.888 +    mloc.ioflg=1;
  23.889 +
  23.890 +    if ((pMap->virtual = (void *)ioctl(pMap->fd, MAP, &mloc)) == (void *)-1)
  23.891 +	return False;
  23.892 +#elif defined (__EMX__)
  23.893 +    /*
  23.894 +     * Dragon warning here! /dev/pmap$ is never closed, except on progam exit.
  23.895 +     * Consecutive calling of this routine will make PMAP$ driver run out
  23.896 +     * of memory handles. Some umap/close mechanism should be provided
  23.897 +     */
  23.898 +
  23.899 +    rc = DosOpen("/dev/pmap$", &hfd, &action, 0, FILE_NORMAL, FILE_OPEN,
  23.900 +		 OPEN_ACCESS_READWRITE | OPEN_SHARE_DENYNONE, (PEAOP2)NULL);
  23.901 +    if (rc != 0)
  23.902 +	return False;
  23.903 +    {
  23.904 +	struct map_ioctl {
  23.905 +		union {
  23.906 +			ULONG phys;
  23.907 +			void* user;
  23.908 +		} a;
  23.909 +		ULONG size;
  23.910 +	} pmap,dmap;
  23.911 +	ULONG plen,dlen;
  23.912 +#define XFREE86_PMAP	0x76
  23.913 +#define PMAP_MAP	0x44
  23.914 +
  23.915 +	pmap.a.phys = base;
  23.916 +	pmap.size = size;
  23.917 +	rc = DosDevIOCtl(hfd, XFREE86_PMAP, PMAP_MAP,
  23.918 +			 (PULONG)&pmap, sizeof(pmap), &plen,
  23.919 +			 (PULONG)&dmap, sizeof(dmap), &dlen);
  23.920 +	if (rc == 0) {
  23.921 +		pMap->virtual = dmap.a.user;
  23.922 +	}
  23.923 +   }
  23.924 +   if (rc != 0)
  23.925 +	return False;
  23.926 +#elif defined (Lynx)
  23.927 +    pMap->virtual = smem_create("XF86DGA", (char*)base, size, SM_READ|SM_WRITE);
  23.928 +#else
  23.929 +#ifndef MAP_FILE
  23.930 +#define MAP_FILE 0
  23.931 +#endif
  23.932 +    if (!name)
  23.933 +	    name = DEV_MEM;
  23.934 +    if ((pMap->fd = open(name, O_RDWR)) < 0)
  23.935 +#if defined(linux)
  23.936 +    { /* /dev/fb0 fallback added by Sam Lantinga <hercules@lokigames.com> */
  23.937 +        /* Try to fall back to /dev/fb on Linux - FIXME: verify the device */
  23.938 +        struct fb_fix_screeninfo finfo;
  23.939 +
  23.940 +        if ((pMap->fd = open("/dev/fb0", O_RDWR)) < 0) {
  23.941 +            return False;
  23.942 +        }
  23.943 +        /* The useable framebuffer console memory may not be the whole
  23.944 +           framebuffer that X has access to. :-(
  23.945 +         */
  23.946 +        if ( ioctl(pMap->fd, FBIOGET_FSCREENINFO, &finfo) < 0 ) {
  23.947 +            close(pMap->fd);
  23.948 +            return False;
  23.949 +        }
  23.950 +        /* Warning: On PPC, the size and virtual need to be offset by:
  23.951 +           (((long)finfo.smem_start) -
  23.952 +           (((long)finfo.smem_start)&~(PAGE_SIZE-1)))
  23.953 +         */
  23.954 +        base = 0;
  23.955 +        size = finfo.smem_len;
  23.956 +    }
  23.957 +#else
  23.958 +	return False;
  23.959 +#endif
  23.960 +    pMap->virtual = mmap(NULL, size, PROT_READ | PROT_WRITE, 
  23.961 +			MAP_FILE | MAP_SHARED, pMap->fd, (off_t)base);
  23.962 +    if (pMap->virtual == (void *)-1)
  23.963 +	return False;
  23.964 +#endif
  23.965 +
  23.966 +#if !defined(ISC) && !defined(HAS_SVR3_MMAP) && !defined(Lynx) \
  23.967 +	&& !defined(__EMX__)
  23.968 +    mprotect(pMap->virtual, size, PROT_READ | PROT_WRITE);
  23.969 +#endif
  23.970 +
  23.971 +    return True;
  23.972 +}
  23.973 +
  23.974 +
  23.975 +
  23.976 +static void
  23.977 +DGAUnmapPhysical(DGAMapPtr pMap)
  23.978 +{
  23.979 +#if !defined(ISC) && !defined(HAS_SVR3_MMAP) && !defined(Lynx) \
  23.980 +	&& !defined(__EMX__)
  23.981 +    mprotect(pMap->virtual,pMap->size, PROT_READ);
  23.982 +#elif defined(Lynx)
  23.983 +	/* XXX this doesn't allow enable after disable */
  23.984 +    smem_create(NULL, pMap->virtual, pMap->size, SM_DETACH);
  23.985 +    smem_remove("XF86DGA");
  23.986 +#endif
  23.987 +
  23.988 +
  23.989 +   /* We need to unmap and close too !!!!!!!!!!*/
  23.990 +}
    24.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    24.2 +++ b/src/video/Xext/Xxf86vm/Makefile.am	Tue Mar 05 19:55:32 2002 +0000
    24.3 @@ -0,0 +1,5 @@
    24.4 +
    24.5 +## Makefile.am for the XFree86 Xxf86vm library
    24.6 +
    24.7 +noinst_LTLIBRARIES = libXFree86_Xxf86vm.la
    24.8 +libXFree86_Xxf86vm_la_SOURCES = XF86VMode.c
    25.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    25.2 +++ b/src/video/Xext/Xxf86vm/XF86VMode.c	Tue Mar 05 19:55:32 2002 +0000
    25.3 @@ -0,0 +1,1210 @@
    25.4 +/* $XConsortium: XF86VMode.c /main/2 1995/11/14 18:17:58 kaleb $ */
    25.5 +/* $XFree86: xc/lib/Xxf86vm/XF86VMode.c,v 3.32 2001/07/25 15:04:54 dawes Exp $ */
    25.6 +/*
    25.7 +
    25.8 +Copyright (c) 1995  Kaleb S. KEITHLEY
    25.9 +
   25.10 +Permission is hereby granted, free of charge, to any person obtaining
   25.11 +a copy of this software and associated documentation files (the
   25.12 +"Software"), to deal in the Software without restriction, including
   25.13 +without limitation the rights to use, copy, modify, merge, publish,
   25.14 +distribute, sublicense, and/or sell copies of the Software, and to
   25.15 +permit persons to whom the Software is furnished to do so, subject to
   25.16 +the following conditions:
   25.17 +
   25.18 +The above copyright notice and this permission notice shall be
   25.19 +included in all copies or substantial portions of the Software.
   25.20 +
   25.21 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
   25.22 +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
   25.23 +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
   25.24 +IN NO EVENT SHALL Kaleb S. KEITHLEY BE LIABLE FOR ANY CLAIM, DAMAGES 
   25.25 +OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
   25.26 +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
   25.27 +OTHER DEALINGS IN THE SOFTWARE.
   25.28 +
   25.29 +Except as contained in this notice, the name of Kaleb S. KEITHLEY 
   25.30 +shall not be used in advertising or otherwise to promote the sale, use 
   25.31 +or other dealings in this Software without prior written authorization
   25.32 +from Kaleb S. KEITHLEY.
   25.33 +
   25.34 +*/
   25.35 +/* $XConsortium: XF86VMode.c /main/4 1996/01/16 07:52:25 kaleb CHECKEDOUT $ */
   25.36 +
   25.37 +/* THIS IS NOT AN X CONSORTIUM STANDARD */
   25.38 +
   25.39 +#define NEED_EVENTS
   25.40 +#define NEED_REPLIES
   25.41 +#ifndef XBUILD_IN_CLIENT
   25.42 +#include <X11/Xlibint.h>
   25.43 +#include "xf86vmstr.h"
   25.44 +#include <X11/extensions/Xext.h>
   25.45 +#include "extutil.h"
   25.46 +#else
   25.47 +#include "lib/X11/Xlibint.h"
   25.48 +#include "include/extensions/xf86vmstr.h"
   25.49 +#include "include/extensions/Xext.h"
   25.50 +#include "include/extensions/extutil.h"
   25.51 +#endif
   25.52 +
   25.53 +#ifdef DEBUG
   25.54 +#include <stdio.h>
   25.55 +#endif
   25.56 +
   25.57 +#ifndef MODE_BAD
   25.58 +#define MODE_BAD 255
   25.59 +#endif
   25.60 +
   25.61 +static XExtensionInfo _xf86vidmode_info_data;
   25.62 +static XExtensionInfo *xf86vidmode_info = &_xf86vidmode_info_data;
   25.63 +static char *xf86vidmode_extension_name = XF86VIDMODENAME;
   25.64 +
   25.65 +#define XF86VidModeCheckExtension(dpy,i,val) \
   25.66 +  XextCheckExtension (dpy, i, xf86vidmode_extension_name, val)
   25.67 +
   25.68 +/*****************************************************************************
   25.69 + *                                                                           *
   25.70 + *			   private utility routines                          *
   25.71 + *                                                                           *
   25.72 + *****************************************************************************/
   25.73 +
   25.74 +static XEXT_CLOSE_DISPLAY_PROTO(close_display);
   25.75 +static /* const */ XExtensionHooks xf86vidmode_extension_hooks = {
   25.76 +    NULL,				/* create_gc */
   25.77 +    NULL,				/* copy_gc */
   25.78 +    NULL,				/* flush_gc */
   25.79 +    NULL,				/* free_gc */
   25.80 +    NULL,				/* create_font */
   25.81 +    NULL,				/* free_font */
   25.82 +    close_display,			/* close_display */
   25.83 +    NULL,				/* wire_to_event */
   25.84 +    NULL,				/* event_to_wire */
   25.85 +    NULL,				/* error */
   25.86 +    NULL,				/* error_string */
   25.87 +};
   25.88 +
   25.89 +static XEXT_GENERATE_FIND_DISPLAY (find_display, xf86vidmode_info, 
   25.90 +				   xf86vidmode_extension_name, 
   25.91 +				   &xf86vidmode_extension_hooks, 
   25.92 +				   0, NULL)
   25.93 +
   25.94 +static XEXT_GENERATE_CLOSE_DISPLAY (close_display, xf86vidmode_info)
   25.95 +
   25.96 +
   25.97 +/*****************************************************************************
   25.98 + *                                                                           *
   25.99 + *		    public XFree86-VidMode Extension routines                *
  25.100 + *                                                                           *
  25.101 + *****************************************************************************/
  25.102 +
  25.103 +Bool
  25.104 +SDL_NAME(XF86VidModeQueryExtension) (dpy, event_basep, error_basep)
  25.105 +    Display *dpy;
  25.106 +    int *event_basep, *error_basep;
  25.107 +{
  25.108 +    XExtDisplayInfo *info = find_display (dpy);
  25.109 +
  25.110 +    if (XextHasExtension(info)) {
  25.111 +	*event_basep = info->codes->first_event;
  25.112 +	*error_basep = info->codes->first_error;
  25.113 +	return True;
  25.114 +    } else {
  25.115 +	return False;
  25.116 +    }
  25.117 +}
  25.118 +
  25.119 +Bool
  25.120 +SDL_NAME(XF86VidModeQueryVersion)(dpy, majorVersion, minorVersion)
  25.121 +    Display* dpy;
  25.122 +    int* majorVersion; 
  25.123 +    int* minorVersion;
  25.124 +{
  25.125 +    XExtDisplayInfo *info = find_display (dpy);
  25.126 +    xXF86VidModeQueryVersionReply rep;
  25.127 +    xXF86VidModeQueryVersionReq *req;
  25.128 +
  25.129 +    XF86VidModeCheckExtension (dpy, info, False);
  25.130 +
  25.131 +    LockDisplay(dpy);
  25.132 +    GetReq(XF86VidModeQueryVersion, req);
  25.133 +    req->reqType = info->codes->major_opcode;
  25.134 +    req->xf86vidmodeReqType = X_XF86VidModeQueryVersion;
  25.135 +    if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
  25.136 +	UnlockDisplay(dpy);
  25.137 +	SyncHandle();
  25.138 +	return False;
  25.139 +    }
  25.140 +    *majorVersion = rep.majorVersion;
  25.141 +    *minorVersion = rep.minorVersion;
  25.142 +    UnlockDisplay(dpy);
  25.143 +    SyncHandle();
  25.144 +    if (*majorVersion >= 2)
  25.145 +	SDL_NAME(XF86VidModeSetClientVersion)(dpy);
  25.146 +    return True;
  25.147 +}
  25.148 +
  25.149 +Bool
  25.150 +SDL_NAME(XF86VidModeSetClientVersion)(Display *dpy)
  25.151 +{
  25.152 +    XExtDisplayInfo *info = find_display(dpy);
  25.153 +    xXF86VidModeSetClientVersionReq *req;
  25.154 +
  25.155 +    XF86VidModeCheckExtension(dpy, info, False);
  25.156 +
  25.157 +    LockDisplay(dpy);
  25.158 +    GetReq(XF86VidModeSetClientVersion, req);
  25.159 +    req->reqType = info->codes->major_opcode;
  25.160 +    req->xf86vidmodeReqType = X_XF86VidModeSetClientVersion;
  25.161 +    req->major = XF86VIDMODE_MAJOR_VERSION;
  25.162 +    req->minor = XF86VIDMODE_MINOR_VERSION;
  25.163 +    UnlockDisplay(dpy);
  25.164 +    SyncHandle();
  25.165 +    return True;
  25.166 +}
  25.167 +
  25.168 +Bool
  25.169 +SDL_NAME(XF86VidModeSetGamma)(Display *dpy, int screen, SDL_NAME(XF86VidModeGamma) *Gamma)
  25.170 +{
  25.171 +    XExtDisplayInfo *info = find_display(dpy);
  25.172 +    xXF86VidModeSetGammaReq *req;
  25.173 +
  25.174 +    XF86VidModeCheckExtension(dpy, info, False);
  25.175 +
  25.176 +    LockDisplay(dpy);
  25.177 +    GetReq(XF86VidModeSetGamma, req);
  25.178 +    req->reqType = info->codes->major_opcode;
  25.179 +    req->xf86vidmodeReqType = X_XF86VidModeSetGamma;
  25.180 +    req->screen = screen;
  25.181 +    req->red = (CARD32)(Gamma->red * 10000.);
  25.182 +    req->green = (CARD32)(Gamma->green * 10000.);
  25.183 +    req->blue = (CARD32)(Gamma->blue * 10000.);
  25.184 +    UnlockDisplay(dpy);
  25.185 +    SyncHandle();
  25.186 +    return True;
  25.187 +}
  25.188 +
  25.189 +Bool
  25.190 +SDL_NAME(XF86VidModeGetGamma)(Display *dpy, int screen, SDL_NAME(XF86VidModeGamma) *Gamma)
  25.191 +{
  25.192 +    XExtDisplayInfo *info = find_display (dpy);
  25.193 +    xXF86VidModeGetGammaReply rep;
  25.194 +    xXF86VidModeGetGammaReq *req;
  25.195 +
  25.196 +    XF86VidModeCheckExtension (dpy, info, False);
  25.197 +
  25.198 +    LockDisplay(dpy);
  25.199 +    GetReq(XF86VidModeGetGamma, req);
  25.200 +    req->reqType = info->codes->major_opcode;
  25.201 +    req->xf86vidmodeReqType = X_XF86VidModeGetGamma;
  25.202 +    req->screen = screen;
  25.203 +    if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
  25.204 +	UnlockDisplay(dpy);
  25.205 +	SyncHandle();
  25.206 +	return False;
  25.207 +    }
  25.208 +    Gamma->red = ((float)rep.red) / 10000.;
  25.209 +    Gamma->green = ((float)rep.green) / 10000.;
  25.210 +    Gamma->blue = ((float)rep.blue) / 10000.;
  25.211 +    UnlockDisplay(dpy);
  25.212 +    SyncHandle();
  25.213 +    return True;
  25.214 +}
  25.215 +
  25.216 +Bool
  25.217 +SDL_NAME(XF86VidModeGetModeLine)(dpy, screen, dotclock, modeline)
  25.218 +    Display* dpy;
  25.219 +    int screen;
  25.220 +    int* dotclock; 
  25.221 +    SDL_NAME(XF86VidModeModeLine)* modeline;
  25.222 +{
  25.223 +    XExtDisplayInfo *info = find_display (dpy);
  25.224 +    xXF86VidModeGetModeLineReply rep;
  25.225 +    xXF86OldVidModeGetModeLineReply oldrep;
  25.226 +    xXF86VidModeGetModeLineReq *req;
  25.227 +    int majorVersion, minorVersion;
  25.228 +
  25.229 +    XF86VidModeCheckExtension (dpy, info, False);
  25.230 +    SDL_NAME(XF86VidModeQueryVersion)(dpy, &majorVersion, &minorVersion);
  25.231 +
  25.232 +    LockDisplay(dpy);
  25.233 +    GetReq(XF86VidModeGetModeLine, req);
  25.234 +    req->reqType = info->codes->major_opcode;
  25.235 +    req->xf86vidmodeReqType = X_XF86VidModeGetModeLine;
  25.236 +    req->screen = screen;
  25.237 +    
  25.238 +    if (majorVersion < 2) {
  25.239 +	if (!_XReply(dpy, (xReply *)&oldrep, 
  25.240 +            (SIZEOF(xXF86OldVidModeGetModeLineReply) - SIZEOF(xReply)) >> 2, xFalse)) {
  25.241 +	    UnlockDisplay(dpy);
  25.242 +	    SyncHandle();
  25.243 +	    return False;
  25.244 +	}
  25.245 +	*dotclock = oldrep.dotclock;
  25.246 +	modeline->hdisplay   = oldrep.hdisplay;
  25.247 +	modeline->hsyncstart = oldrep.hsyncstart;
  25.248 +	modeline->hsyncend   = oldrep.hsyncend;
  25.249 +	modeline->htotal     = oldrep.htotal;
  25.250 +	modeline->hskew      = 0;
  25.251 +	modeline->vdisplay   = oldrep.vdisplay;
  25.252 +	modeline->vsyncstart = oldrep.vsyncstart;
  25.253 +	modeline->vsyncend   = oldrep.vsyncend;
  25.254 +	modeline->vtotal     = oldrep.vtotal;
  25.255 +	modeline->flags      = oldrep.flags;
  25.256 +	modeline->privsize   = oldrep.privsize;
  25.257 +    } else {
  25.258 +	if (!_XReply(dpy, (xReply *)&rep, 
  25.259 +            (SIZEOF(xXF86VidModeGetModeLineReply) - SIZEOF(xReply)) >> 2, xFalse)) {
  25.260 +	    UnlockDisplay(dpy);
  25.261 +	    SyncHandle();
  25.262 +	    return False;
  25.263 +	}
  25.264 +	*dotclock = rep.dotclock;
  25.265 +	modeline->hdisplay   = rep.hdisplay;
  25.266 +	modeline->hsyncstart = rep.hsyncstart;
  25.267 +	modeline->hsyncend   = rep.hsyncend;
  25.268 +	modeline->htotal     = rep.htotal;
  25.269 +	modeline->hskew      = rep.hskew;
  25.270 +	modeline->vdisplay   = rep.vdisplay;
  25.271 +	modeline->vsyncstart = rep.vsyncstart;
  25.272 +	modeline->vsyncend   = rep.vsyncend;
  25.273 +	modeline->vtotal     = rep.vtotal;
  25.274 +	modeline->flags      = rep.flags;
  25.275 +	modeline->privsize   = rep.privsize;
  25.276 +    }
  25.277 +    
  25.278 +    if (modeline->privsize > 0) {
  25.279 +	if (!(modeline->private = Xcalloc(modeline->privsize, sizeof(INT32)))) {
  25.280 +	    _XEatData(dpy, (modeline->privsize) * sizeof(INT32));
  25.281 +	    Xfree(modeline->private);
  25.282 +	    return False;
  25.283 +	}
  25.284 +	_XRead(dpy, (char*)modeline->private, modeline->privsize * sizeof(INT32));
  25.285 +    } else {
  25.286 +	modeline->private = NULL;
  25.287 +    }
  25.288 +    UnlockDisplay(dpy);
  25.289 +    SyncHandle();
  25.290 +    return True;
  25.291 +}
  25.292 +
  25.293 +Bool
  25.294 +SDL_NAME(XF86VidModeGetAllModeLines)(dpy, screen, modecount, modelinesPtr)
  25.295 +    Display* dpy;
  25.296 +    int screen;
  25.297 +    int* modecount; 
  25.298 +    SDL_NAME(XF86VidModeModeInfo) ***modelinesPtr;
  25.299 +{
  25.300 +    XExtDisplayInfo *info = find_display (dpy);
  25.301 +    xXF86VidModeGetAllModeLinesReply rep;
  25.302 +    xXF86VidModeGetAllModeLinesReq *req;
  25.303 +    SDL_NAME(XF86VidModeModeInfo) *mdinfptr, **modelines;
  25.304 +    xXF86VidModeModeInfo xmdline;
  25.305 +    xXF86OldVidModeModeInfo oldxmdline;
  25.306 +    int i;
  25.307 +    int majorVersion, minorVersion;
  25.308 +    Bool protocolBug = False;
  25.309 +
  25.310 +    XF86VidModeCheckExtension (dpy, info, False);
  25.311 +
  25.312 +    /*
  25.313 +     * Note: There was a bug in the protocol implementation in versions
  25.314 +     * 0.x with x < 8 (the .private field wasn't being passed over the wire).
  25.315 +     * Check the server's version, and accept the old format if appropriate.
  25.316 +     */
  25.317 +
  25.318 +    SDL_NAME(XF86VidModeQueryVersion)(dpy, &majorVersion, &minorVersion);
  25.319 +    if (majorVersion == 0 && minorVersion < 8) {
  25.320 +	protocolBug = True;
  25.321 +#ifdef DEBUG
  25.322 +	fprintf(stderr, "XF86VidModeGetAllModeLines: Warning: Xserver is"
  25.323 +		"running an old version (%d.%d)\n", majorVersion,
  25.324 +		minorVersion);
  25.325 +#endif
  25.326 +    }
  25.327 +    
  25.328 +    LockDisplay(dpy);
  25.329 +    GetReq(XF86VidModeGetAllModeLines, req);
  25.330 +    req->reqType = info->codes->major_opcode;
  25.331 +    req->xf86vidmodeReqType = X_XF86VidModeGetAllModeLines;
  25.332 +    req->screen = screen;
  25.333 +    if (!_XReply(dpy, (xReply *)&rep, 
  25.334 +        (SIZEOF(xXF86VidModeGetAllModeLinesReply) - SIZEOF(xReply)) >> 2, xFalse)) {
  25.335 +        UnlockDisplay(dpy);
  25.336 +	SyncHandle();
  25.337 +	return False;
  25.338 +    }
  25.339 +
  25.340 +    *modecount = rep.modecount;
  25.341 +
  25.342 +    if (!(modelines = (SDL_NAME(XF86VidModeModeInfo) **) Xcalloc(rep.modecount,
  25.343 +                                          sizeof(SDL_NAME(XF86VidModeModeInfo) *)
  25.344 +                                          +sizeof(SDL_NAME(XF86VidModeModeInfo))))) {
  25.345 +	if (majorVersion < 2)
  25.346 +            _XEatData(dpy, (rep.modecount) * sizeof(xXF86OldVidModeModeInfo));
  25.347 +	else
  25.348 +            _XEatData(dpy, (rep.modecount) * sizeof(xXF86VidModeModeInfo));
  25.349 +        Xfree(modelines);
  25.350 +        return False;
  25.351 +    }
  25.352 +    mdinfptr = (SDL_NAME(XF86VidModeModeInfo) *) (
  25.353 +			    (char *) modelines
  25.354 +			    + rep.modecount*sizeof(SDL_NAME(XF86VidModeModeInfo) *)
  25.355 +		    );
  25.356 +
  25.357 +    for (i = 0; i < rep.modecount; i++) {
  25.358 +        modelines[i] = mdinfptr++;
  25.359 +	if (majorVersion < 2) {
  25.360 +            _XRead(dpy, (char*)&oldxmdline, sizeof(xXF86OldVidModeModeInfo));
  25.361 +	    modelines[i]->dotclock   = oldxmdline.dotclock;
  25.362 +	    modelines[i]->hdisplay   = oldxmdline.hdisplay;
  25.363 +	    modelines[i]->hsyncstart = oldxmdline.hsyncstart;
  25.364 +	    modelines[i]->hsyncend   = oldxmdline.hsyncend;
  25.365 +	    modelines[i]->htotal     = oldxmdline.htotal;
  25.366 +	    modelines[i]->hskew      = 0;
  25.367 +	    modelines[i]->vdisplay   = oldxmdline.vdisplay;
  25.368 +	    modelines[i]->vsyncstart = oldxmdline.vsyncstart;
  25.369 +	    modelines[i]->vsyncend   = oldxmdline.vsyncend;
  25.370 +	    modelines[i]->vtotal     = oldxmdline.vtotal;
  25.371 +	    modelines[i]->flags      = oldxmdline.flags;
  25.372 +	    if (protocolBug) {
  25.373 +		modelines[i]->privsize = 0;
  25.374 +		modelines[i]->private = NULL;
  25.375 +	    } else {
  25.376 +		modelines[i]->privsize   = oldxmdline.privsize;
  25.377 +		if (oldxmdline.privsize > 0) {
  25.378 +	            if (!(modelines[i]->private =
  25.379 +			    Xcalloc(oldxmdline.privsize, sizeof(INT32)))) {
  25.380 +			_XEatData(dpy, (oldxmdline.privsize) * sizeof(INT32));
  25.381 +			Xfree(modelines[i]->private);
  25.382 +		    } else {
  25.383 +			_XRead(dpy, (char*)modelines[i]->private,
  25.384 +			     oldxmdline.privsize * sizeof(INT32));
  25.385 +		    }
  25.386 +		} else {
  25.387 +		  modelines[i]->private = NULL;
  25.388 +		}
  25.389 +	    }
  25.390 +	} else {
  25.391 +            _XRead(dpy, (char*)&xmdline, sizeof(xXF86VidModeModeInfo));
  25.392 +	    modelines[i]->dotclock   = xmdline.dotclock;
  25.393 +	    modelines[i]->hdisplay   = xmdline.hdisplay;
  25.394 +	    modelines[i]->hsyncstart = xmdline.hsyncstart;
  25.395 +	    modelines[i]->hsyncend   = xmdline.hsyncend;
  25.396 +	    modelines[i]->htotal     = xmdline.htotal;
  25.397 +	    modelines[i]->hskew      = xmdline.hskew;
  25.398 +	    modelines[i]->vdisplay   = xmdline.vdisplay;
  25.399 +	    modelines[i]->vsyncstart = xmdline.vsyncstart;
  25.400 +	    modelines[i]->vsyncend   = xmdline.vsyncend;
  25.401 +	    modelines[i]->vtotal     = xmdline.vtotal;
  25.402 +	    modelines[i]->flags      = xmdline.flags;
  25.403 +	    if (protocolBug) {
  25.404 +		modelines[i]->privsize = 0;
  25.405 +		modelines[i]->private = NULL;
  25.406 +	    } else {
  25.407 +		modelines[i]->privsize   = xmdline.privsize;
  25.408 +		if (xmdline.privsize > 0) {
  25.409 +		    if (!(modelines[i]->private =
  25.410 +			    Xcalloc(xmdline.privsize, sizeof(INT32)))) {
  25.411 +			_XEatData(dpy, (xmdline.privsize) * sizeof(INT32));
  25.412 +			Xfree(modelines[i]->private);
  25.413 +		    } else {
  25.414 +			_XRead(dpy, (char*)modelines[i]->private,
  25.415 +			     xmdline.privsize * sizeof(INT32));
  25.416 +		    }
  25.417 +		} else {
  25.418 +		    modelines[i]->private = NULL;
  25.419 +		}
  25.420 +	    }
  25.421 +	}
  25.422 +    }
  25.423 +    *modelinesPtr = modelines;
  25.424 +    UnlockDisplay(dpy);
  25.425 +    SyncHandle();
  25.426 +    return True;
  25.427 +}
  25.428 +
  25.429 +/*
  25.430 + * GetReq replacement for use with VidMode protocols earlier than 2.0
  25.431 + */
  25.432 +#if !defined(UNIXCPP) || defined(ANSICPP)
  25.433 +#define GetOldReq(name, oldname, req) \
  25.434 +        WORD64ALIGN\
  25.435 +	if ((dpy->bufptr + SIZEOF(x##oldname##Req)) > dpy->bufmax)\
  25.436 +		_XFlush(dpy);\
  25.437 +	req = (x##oldname##Req *)(dpy->last_req = dpy->bufptr);\
  25.438 +	req->reqType = X_##name;\
  25.439 +	req->length = (SIZEOF(x##oldname##Req))>>2;\
  25.440 +	dpy->bufptr += SIZEOF(x##oldname##Req);\
  25.441 +	dpy->request++
  25.442 +
  25.443 +#else  /* non-ANSI C uses empty comment instead of "##" for token concatenation */
  25.444 +#define GetOldReq(name, oldname, req) \
  25.445 +        WORD64ALIGN\
  25.446 +	if ((dpy->bufptr + SIZEOF(x/**/oldname/**/Req)) > dpy->bufmax)\
  25.447 +		_XFlush(dpy);\
  25.448 +	req = (x/**/oldname/**/Req *)(dpy->last_req = dpy->bufptr);\
  25.449 +	req->reqType = X_/**/name;\
  25.450 +	req->length = (SIZEOF(x/**/oldname/**/Req))>>2;\
  25.451 +	dpy->bufptr += SIZEOF(x/**/oldname/**/Req);\
  25.452 +	dpy->request++
  25.453 +#endif
  25.454 +
  25.455 +Bool
  25.456 +SDL_NAME(XF86VidModeAddModeLine) (dpy, screen, newmodeline, aftermodeline)
  25.457 +    Display *dpy;
  25.458 +    int screen;
  25.459 +    SDL_NAME(XF86VidModeModeInfo)* newmodeline;
  25.460 +    SDL_NAME(XF86VidModeModeInfo)* aftermodeline;
  25.461 +{
  25.462 +    XExtDisplayInfo *info = find_display (dpy);
  25.463 +    xXF86VidModeAddModeLineReq *req;
  25.464 +    xXF86OldVidModeAddModeLineReq *oldreq;
  25.465 +    int majorVersion, minorVersion;
  25.466 +
  25.467 +    XF86VidModeCheckExtension (dpy, info, False);
  25.468 +    SDL_NAME(XF86VidModeQueryVersion)(dpy, &majorVersion, &minorVersion);
  25.469 +
  25.470 +    LockDisplay(dpy);
  25.471 +    if (majorVersion < 2) {
  25.472 +	GetOldReq(XF86VidModeAddModeLine, XF86OldVidModeAddModeLine, oldreq);
  25.473 +	oldreq->reqType = info->codes->major_opcode;
  25.474 +	oldreq->xf86vidmodeReqType = X_XF86VidModeAddModeLine;
  25.475 +	oldreq->screen = screen;
  25.476 +	oldreq->dotclock =	newmodeline->dotclock;
  25.477 +	oldreq->hdisplay =	newmodeline->hdisplay;
  25.478 +	oldreq->hsyncstart =	newmodeline->hsyncstart;
  25.479 +	oldreq->hsyncend =	newmodeline->hsyncend;
  25.480 +	oldreq->htotal =	newmodeline->htotal;
  25.481 +	oldreq->vdisplay =	newmodeline->vdisplay;
  25.482 +	oldreq->vsyncstart =	newmodeline->vsyncstart;
  25.483 +	oldreq->vsyncend =	newmodeline->vsyncend;
  25.484 +	oldreq->vtotal =	newmodeline->vtotal;
  25.485 +	oldreq->flags =		newmodeline->flags;
  25.486 +	oldreq->privsize =	newmodeline->privsize;
  25.487 +	if (aftermodeline != NULL) {
  25.488 +	    oldreq->after_dotclock =	aftermodeline->dotclock;
  25.489 +	    oldreq->after_hdisplay =	aftermodeline->hdisplay;
  25.490 +	    oldreq->after_hsyncstart =	aftermodeline->hsyncstart;
  25.491 +	    oldreq->after_hsyncend =	aftermodeline->hsyncend;
  25.492 +	    oldreq->after_htotal =	aftermodeline->htotal;
  25.493 +	    oldreq->after_vdisplay =	aftermodeline->vdisplay;
  25.494 +	    oldreq->after_vsyncstart =	aftermodeline->vsyncstart;
  25.495 +	    oldreq->after_vsyncend =	aftermodeline->vsyncend;
  25.496 +	    oldreq->after_vtotal =	aftermodeline->vtotal;
  25.497 +	    oldreq->after_flags =	aftermodeline->flags;
  25.498 +	} else {
  25.499 +	    oldreq->after_dotclock =	0;
  25.500 +	    oldreq->after_hdisplay =	0;
  25.501 +	    oldreq->after_hsyncstart =	0;
  25.502 +	    oldreq->after_hsyncend =	0;
  25.503 +	    oldreq->after_htotal =	0;
  25.504 +	    oldreq->after_vdisplay =	0;
  25.505 +	    oldreq->after_vsyncstart =	0;
  25.506 +	    oldreq->after_vsyncend =	0;
  25.507 +	    oldreq->after_vtotal =	0;
  25.508 +	    oldreq->after_flags =	0;
  25.509 +	}
  25.510 +	if (newmodeline->privsize) {
  25.511 +	    oldreq->length += newmodeline->privsize;
  25.512 +	    Data32(dpy, (long *) newmodeline->private,
  25.513 +	       newmodeline->privsize * sizeof(INT32));
  25.514 +	}
  25.515 +    } else {
  25.516 +	GetReq(XF86VidModeAddModeLine, req);
  25.517 +	req->reqType = info->codes->major_opcode;
  25.518 +	req->xf86vidmodeReqType = X_XF86VidModeAddModeLine;
  25.519 +	req->screen = screen;
  25.520 +	req->dotclock =		newmodeline->dotclock;
  25.521 +	req->hdisplay =		newmodeline->hdisplay;
  25.522 +	req->hsyncstart =	newmodeline->hsyncstart;
  25.523 +	req->hsyncend =		newmodeline->hsyncend;
  25.524 +	req->htotal =		newmodeline->htotal;
  25.525 +	req->hskew =		newmodeline->hskew;
  25.526 +	req->vdisplay =		newmodeline->vdisplay;
  25.527 +	req->vsyncstart =	newmodeline->vsyncstart;
  25.528 +	req->vsyncend =		newmodeline->vsyncend;
  25.529 +	req->vtotal =		newmodeline->vtotal;
  25.530 +	req->flags =		newmodeline->flags;
  25.531 +	req->privsize =		newmodeline->privsize;
  25.532 +	if (aftermodeline != NULL) {
  25.533 +	    req->after_dotclock =	aftermodeline->dotclock;
  25.534 +	    req->after_hdisplay =	aftermodeline->hdisplay;
  25.535 +	    req->after_hsyncstart =	aftermodeline->hsyncstart;
  25.536 +	    req->after_hsyncend =	aftermodeline->hsyncend;
  25.537 +	    req->after_htotal =		aftermodeline->htotal;
  25.538 +	    req->after_hskew =		aftermodeline->hskew;
  25.539 +	    req->after_vdisplay =	aftermodeline->vdisplay;
  25.540 +	    req->after_vsyncstart =	aftermodeline->vsyncstart;
  25.541 +	    req->after_vsyncend =	aftermodeline->vsyncend;
  25.542 +	    req->after_vtotal =		aftermodeline->vtotal;
  25.543 +	    req->after_flags =		aftermodeline->flags;
  25.544 +	} else {
  25.545 +	    req->after_dotclock =	0;
  25.546 +	    req->after_hdisplay =	0;
  25.547 +	    req->after_hsyncstart =	0;
  25.548 +	    req->after_hsyncend =	0;
  25.549 +	    req->after_htotal =		0;
  25.550 +	    req->after_hskew =		0;
  25.551 +	    req->after_vdisplay =	0;
  25.552 +	    req->after_vsyncstart =	0;
  25.553 +	    req->after_vsyncend =	0;
  25.554 +	    req->after_vtotal =		0;
  25.555 +	    req->after_flags =		0;
  25.556 +	}
  25.557 +	if (newmodeline->privsize) {
  25.558 +	    req->length += newmodeline->privsize;
  25.559 +	    Data32(dpy, (long *) newmodeline->private,
  25.560 +	       newmodeline->privsize * sizeof(INT32));
  25.561 +	}
  25.562 +    }
  25.563 +    UnlockDisplay(dpy);
  25.564 +    SyncHandle();
  25.565 +    return True;
  25.566 +}
  25.567 +
  25.568 +Bool
  25.569 +SDL_NAME(XF86VidModeDeleteModeLine) (dpy, screen, modeline)
  25.570 +    Display *dpy;
  25.571 +    int screen;
  25.572 +    SDL_NAME(XF86VidModeModeInfo)* modeline;
  25.573 +{
  25.574 +    XExtDisplayInfo *info = find_display (dpy);
  25.575 +    xXF86VidModeDeleteModeLineReq *req;
  25.576 +    xXF86OldVidModeDeleteModeLineReq *oldreq;
  25.577 +    int majorVersion, minorVersion;
  25.578 +
  25.579 +    XF86VidModeCheckExtension (dpy, info, 0);
  25.580 +    SDL_NAME(XF86VidModeQueryVersion)(dpy, &majorVersion, &minorVersion);
  25.581 +
  25.582 +    LockDisplay(dpy);
  25.583 +    if (majorVersion < 2) {
  25.584 +	GetOldReq(XF86VidModeDeleteModeLine, XF86OldVidModeDeleteModeLine, oldreq);
  25.585 +	oldreq->reqType = info->codes->major_opcode;
  25.586 +	oldreq->xf86vidmodeReqType = X_XF86VidModeDeleteModeLine;
  25.587 +	oldreq->screen = screen;
  25.588 +	oldreq->dotclock =	modeline->dotclock;
  25.589 +	oldreq->hdisplay =	modeline->hdisplay;
  25.590 +	oldreq->hsyncstart =	modeline->hsyncstart;
  25.591 +	oldreq->hsyncend =	modeline->hsyncend;
  25.592 +	oldreq->htotal =	modeline->htotal;
  25.593 +	oldreq->vdisplay =	modeline->vdisplay;
  25.594 +	oldreq->vsyncstart =	modeline->vsyncstart;
  25.595 +	oldreq->vsyncend =	modeline->vsyncend;
  25.596 +	oldreq->vtotal =	modeline->vtotal;
  25.597 +	oldreq->flags =		modeline->flags;
  25.598 +	oldreq->privsize =	modeline->privsize;
  25.599 +	if (modeline->privsize) {
  25.600 +	    oldreq->length += modeline->privsize;
  25.601 +	    Data32(dpy, (long *) modeline->private,
  25.602 +	       modeline->privsize * sizeof(INT32));
  25.603 +	}
  25.604 +    } else {
  25.605 +	GetReq(XF86VidModeDeleteModeLine, req);
  25.606 +	req->reqType = info->codes->major_opcode;
  25.607 +	req->xf86vidmodeReqType = X_XF86VidModeDeleteModeLine;
  25.608 +	req->screen = screen;
  25.609 +	req->dotclock =		modeline->dotclock;
  25.610 +	req->hdisplay =		modeline->hdisplay;
  25.611 +	req->hsyncstart =	modeline->hsyncstart;
  25.612 +	req->hsyncend =		modeline->hsyncend;
  25.613 +	req->htotal =		modeline->htotal;
  25.614 +	req->hskew =		modeline->hskew;
  25.615 +	req->vdisplay =		modeline->vdisplay;
  25.616 +	req->vsyncstart =	modeline->vsyncstart;
  25.617 +	req->vsyncend =		modeline->vsyncend;
  25.618 +	req->vtotal =		modeline->vtotal;
  25.619 +	req->flags =		modeline->flags;
  25.620 +	req->privsize =		modeline->privsize;
  25.621 +	if (modeline->privsize) {
  25.622 +	    req->length += modeline->privsize;
  25.623 +	    Data32(dpy, (long *) modeline->private,
  25.624 +	       modeline->privsize * sizeof(INT32));
  25.625 +	}
  25.626 +    }
  25.627 +    UnlockDisplay(dpy);
  25.628 +    SyncHandle();
  25.629 +    return True;
  25.630 +}
  25.631 +
  25.632 +Bool
  25.633 +SDL_NAME(XF86VidModeModModeLine) (dpy, screen, modeline)
  25.634 +    Display *dpy;
  25.635 +    int screen;
  25.636 +    SDL_NAME(XF86VidModeModeLine)* modeline;
  25.637 +{
  25.638 +    XExtDisplayInfo *info = find_display (dpy);
  25.639 +    xXF86VidModeModModeLineReq *req;
  25.640 +    xXF86OldVidModeModModeLineReq *oldreq;
  25.641 +    int majorVersion, minorVersion;
  25.642 +
  25.643 +    XF86VidModeCheckExtension (dpy, info, 0);
  25.644 +    SDL_NAME(XF86VidModeQueryVersion)(dpy, &majorVersion, &minorVersion);
  25.645 +
  25.646 +    LockDisplay(dpy);
  25.647 +    if (majorVersion < 2) {
  25.648 +	GetOldReq(XF86VidModeModModeLine, XF86OldVidModeModModeLine, oldreq);
  25.649 +	oldreq->reqType = info->codes->major_opcode;
  25.650 +	oldreq->xf86vidmodeReqType = X_XF86VidModeModModeLine;
  25.651 +	oldreq->screen = screen;
  25.652 +	oldreq->hdisplay =	modeline->hdisplay;
  25.653 +	oldreq->hsyncstart =	modeline->hsyncstart;
  25.654 +	oldreq->hsyncend =	modeline->hsyncend;
  25.655 +	oldreq->htotal =	modeline->htotal;
  25.656 +	oldreq->vdisplay =	modeline->vdisplay;
  25.657 +	oldreq->vsyncstart =	modeline->vsyncstart;
  25.658 +	oldreq->vsyncend =	modeline->vsyncend;
  25.659 +	oldreq->vtotal =	modeline->vtotal;
  25.660 +	oldreq->flags =		modeline->flags;
  25.661 +	oldreq->privsize =	modeline->privsize;
  25.662 +	if (modeline->privsize) {
  25.663 +	    oldreq->length += modeline->privsize;
  25.664 +	    Data32(dpy, (long *) modeline->private,
  25.665 +	       modeline->privsize * sizeof(INT32));
  25.666 +	}
  25.667 +    } else {
  25.668 +	GetReq(XF86VidModeModModeLine, req);
  25.669 +	req->reqType = info->codes->major_opcode;
  25.670 +	req->xf86vidmodeReqType = X_XF86VidModeModModeLine;
  25.671 +	req->screen = screen;
  25.672 +	req->hdisplay =		modeline->hdisplay;
  25.673 +	req->hsyncstart =	modeline->hsyncstart;
  25.674 +	req->hsyncend =		modeline->hsyncend;
  25.675 +	req->htotal =		modeline->htotal;
  25.676 +	req->hskew =		modeline->hskew;
  25.677 +	req->vdisplay =		modeline->vdisplay;
  25.678 +	req->vsyncstart =	modeline->vsyncstart;
  25.679 +	req->vsyncend =		modeline->vsyncend;
  25.680 +	req->vtotal =		modeline->vtotal;
  25.681 +	req->flags =		modeline->flags;
  25.682 +	req->privsize =		modeline->privsize;
  25.683 +	if (modeline->privsize) {
  25.684 +	    req->length += modeline->privsize;
  25.685 +	    Data32(dpy, (long *) modeline->private,
  25.686 +	       modeline->privsize * sizeof(INT32));
  25.687 +	}
  25.688 +    }
  25.689 +    UnlockDisplay(dpy);
  25.690 +    SyncHandle();
  25.691 +    return True;
  25.692 +}
  25.693 +
  25.694 +Status
  25.695 +SDL_NAME(XF86VidModeValidateModeLine) (dpy, screen, modeline)
  25.696 +    Display *dpy;
  25.697 +    int screen;
  25.698 +    SDL_NAME(XF86VidModeModeInfo)* modeline;
  25.699 +{
  25.700 +    XExtDisplayInfo *info = find_display (dpy);
  25.701 +    xXF86VidModeValidateModeLineReq *req;
  25.702 +    xXF86OldVidModeValidateModeLineReq *oldreq;
  25.703 +    xXF86VidModeValidateModeLineReply rep;
  25.704 +    int majorVersion, minorVersion;
  25.705 +
  25.706 +    XF86VidModeCheckExtension (dpy, info, 0);
  25.707 +    SDL_NAME(XF86VidModeQueryVersion)(dpy, &majorVersion, &minorVersion);
  25.708 +
  25.709 +    LockDisplay(dpy);
  25.710 +
  25.711 +    if (majorVersion < 2) {
  25.712 +	GetOldReq(XF86VidModeValidateModeLine, XF86OldVidModeValidateModeLine, oldreq);
  25.713 +	oldreq->reqType = info->codes->major_opcode;
  25.714 +	oldreq->xf86vidmodeReqType = X_XF86VidModeValidateModeLine;
  25.715 +	oldreq->screen = screen;
  25.716 +	oldreq->dotclock =	modeline->dotclock;
  25.717 +	oldreq->hdisplay =	modeline->hdisplay;
  25.718 +	oldreq->hsyncstart =	modeline->hsyncstart;
  25.719 +	oldreq->hsyncend =	modeline->hsyncend;
  25.720 +	oldreq->htotal =	modeline->htotal;
  25.721 +	oldreq->vdisplay =	modeline->vdisplay;
  25.722 +	oldreq->vsyncstart =	modeline->vsyncstart;
  25.723 +	oldreq->vsyncend =	modeline->vsyncend;
  25.724 +	oldreq->vtotal =	modeline->vtotal;
  25.725 +	oldreq->flags =		modeline->flags;
  25.726 +	oldreq->privsize =	modeline->privsize;
  25.727 +	if (modeline->privsize) {
  25.728 +	    oldreq->length += modeline->privsize;
  25.729 +	    Data32(dpy, (long *) modeline->private,
  25.730 +	       modeline->privsize * sizeof(INT32));
  25.731 +	}
  25.732 +    } else {
  25.733 +	GetReq(XF86VidModeValidateModeLine, req);
  25.734 +	req->reqType = info->codes->major_opcode;
  25.735 +	req->xf86vidmodeReqType = X_XF86VidModeValidateModeLine;
  25.736 +	req->screen = screen;
  25.737 +	req->dotclock =		modeline->dotclock;
  25.738 +	req->hdisplay =		modeline->hdisplay;
  25.739 +	req->hsyncstart =	modeline->hsyncstart;
  25.740 +	req->hsyncend =		modeline->hsyncend;
  25.741 +	req->htotal =		modeline->htotal;
  25.742 +	req->hskew =		modeline->hskew;
  25.743 +	req->vdisplay =		modeline->vdisplay;
  25.744 +	req->vsyncstart =	modeline->vsyncstart;
  25.745 +	req->vsyncend =		modeline->vsyncend;
  25.746 +	req->vtotal =		modeline->vtotal;
  25.747 +	req->flags =		modeline->flags;
  25.748 +	req->privsize =		modeline->privsize;
  25.749 +	if (modeline->privsize) {
  25.750 +	    req->length += modeline->privsize;
  25.751 +	    Data32(dpy, (long *) modeline->private,
  25.752 +	       modeline->privsize * sizeof(INT32));
  25.753 +	}
  25.754 +    }
  25.755 +    if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
  25.756 +	UnlockDisplay(dpy);
  25.757 +	SyncHandle();
  25.758 +	return MODE_BAD;
  25.759 +    }
  25.760 +    UnlockDisplay(dpy);
  25.761 +    SyncHandle();
  25.762 +    return rep.status;
  25.763 +}
  25.764 +
  25.765 +Bool
  25.766 +SDL_NAME(XF86VidModeSwitchMode)(dpy, screen, zoom)
  25.767 +    Display* dpy;
  25.768 +    int screen;
  25.769 +    int zoom;
  25.770 +{
  25.771 +    XExtDisplayInfo *info = find_display (dpy);
  25.772 +    xXF86VidModeSwitchModeReq *req;
  25.773 +
  25.774 +    XF86VidModeCheckExtension (dpy, info, False);
  25.775 +
  25.776 +    LockDisplay(dpy);
  25.777 +    GetReq(XF86VidModeSwitchMode, req);
  25.778 +    req->reqType = info->codes->major_opcode;
  25.779 +    req->xf86vidmodeReqType = X_XF86VidModeSwitchMode;
  25.780 +    req->screen = screen;
  25.781 +    req->zoom = zoom;
  25.782 +    UnlockDisplay(dpy);
  25.783 +    SyncHandle();
  25.784 +    return True;
  25.785 +}
  25.786 +    
  25.787 +Bool
  25.788 +SDL_NAME(XF86VidModeSwitchToMode)(dpy, screen, modeline)
  25.789 +    Display* dpy;
  25.790 +    int screen;
  25.791 +    SDL_NAME(XF86VidModeModeInfo)* modeline;
  25.792 +{
  25.793 +    XExtDisplayInfo *info = find_display (dpy);
  25.794 +    xXF86VidModeSwitchToModeReq *req;
  25.795 +    xXF86OldVidModeSwitchToModeReq *oldreq;
  25.796 +    int majorVersion, minorVersion;
  25.797 +    Bool protocolBug = False;
  25.798 +
  25.799 +    XF86VidModeCheckExtension (dpy, info, False);
  25.800 +
  25.801 +    /*
  25.802 +     * Note: There was a bug in the protocol implementation in versions
  25.803 +     * 0.x with x < 8 (the .private field wasn't expected to be sent over
  25.804 +     * the wire).  Check the server's version, and accept the old format
  25.805 +     * if appropriate.
  25.806 +     */
  25.807 +
  25.808 +    SDL_NAME(XF86VidModeQueryVersion)(dpy, &majorVersion, &minorVersion);
  25.809 +    if (majorVersion == 0 && minorVersion < 8) {
  25.810 +	protocolBug = True;
  25.811 +#ifdef DEBUG
  25.812 +	fprintf(stderr, "XF86VidModeSwitchToMode: Warning: Xserver is"
  25.813 +		"running an old version (%d.%d)\n", majorVersion,
  25.814 +		minorVersion);
  25.815 +#endif
  25.816 +    }
  25.817 +    
  25.818 +    LockDisplay(dpy);
  25.819 +    if (majorVersion < 2) {
  25.820 +	GetOldReq(XF86VidModeSwitchToMode, XF86OldVidModeSwitchToMode, oldreq);
  25.821 +	oldreq->reqType = info->codes->major_opcode;
  25.822 +	oldreq->xf86vidmodeReqType = X_XF86VidModeSwitchToMode;
  25.823 +	oldreq->screen = screen;
  25.824 +	oldreq->dotclock =	modeline->dotclock;
  25.825 +	oldreq->hdisplay =	modeline->hdisplay;
  25.826 +	oldreq->hsyncstart =	modeline->hsyncstart;
  25.827 +	oldreq->hsyncend =	modeline->hsyncend;
  25.828 +	oldreq->htotal =	modeline->htotal;
  25.829 +	oldreq->vdisplay =	modeline->vdisplay;
  25.830 +	oldreq->vsyncstart =	modeline->vsyncstart;
  25.831 +	oldreq->vsyncend =	modeline->vsyncend;
  25.832 +	oldreq->vtotal =	modeline->vtotal;
  25.833 +	oldreq->flags =	modeline->flags;
  25.834 +	if (protocolBug) {
  25.835 +	    oldreq->privsize = 0;
  25.836 +	} else {
  25.837 +	    oldreq->privsize =	modeline->privsize;
  25.838 +	    if (modeline->privsize) {
  25.839 +		oldreq->length += modeline->privsize;
  25.840 +		Data32(dpy, (long *) modeline->private,
  25.841 +	           modeline->privsize * sizeof(INT32));
  25.842 +	    }
  25.843 +	}
  25.844 +    } else {
  25.845 +	GetReq(XF86VidModeSwitchToMode, req);
  25.846 +	req->reqType = info->codes->major_opcode;
  25.847 +	req->xf86vidmodeReqType = X_XF86VidModeSwitchToMode;
  25.848 +	req->screen = screen;
  25.849 +	req->dotclock =	modeline->dotclock;
  25.850 +	req->hdisplay =	modeline->hdisplay;
  25.851 +	req->hsyncstart =	modeline->hsyncstart;
  25.852 +	req->hsyncend =	modeline->hsyncend;
  25.853 +	req->htotal =	modeline->htotal;
  25.854 +	req->hskew =	modeline->hskew;
  25.855 +	req->vdisplay =	modeline->vdisplay;
  25.856 +	req->vsyncstart =	modeline->vsyncstart;
  25.857 +	req->vsyncend =	modeline->vsyncend;
  25.858 +	req->vtotal =	modeline->vtotal;
  25.859 +	req->flags =	modeline->flags;
  25.860 +	if (protocolBug) {
  25.861 +	    req->privsize = 0;
  25.862 +	} else {
  25.863 +	    req->privsize =	modeline->privsize;
  25.864 +	    if (modeline->privsize) {
  25.865 +		req->length += modeline->privsize;
  25.866 +		Data32(dpy, (long *) modeline->private,
  25.867 +	           modeline->privsize * sizeof(INT32));
  25.868 +	    }
  25.869 +	}
  25.870 +    }
  25.871 +    UnlockDisplay(dpy);
  25.872 +    SyncHandle();
  25.873 +    return True;
  25.874 +}
  25.875 +    
  25.876 +Bool
  25.877 +SDL_NAME(XF86VidModeLockModeSwitch)(dpy, screen, lock)
  25.878 +    Display* dpy;
  25.879 +    int screen;
  25.880 +    int lock;
  25.881 +{
  25.882 +    XExtDisplayInfo *info = find_display (dpy);
  25.883 +    xXF86VidModeLockModeSwitchReq *req;
  25.884 +
  25.885 +    XF86VidModeCheckExtension (dpy, info, False);
  25.886 +
  25.887 +    LockDisplay(dpy);
  25.888 +    GetReq(XF86VidModeLockModeSwitch, req);
  25.889 +    req->reqType = info->codes->major_opcode;
  25.890 +    req->xf86vidmodeReqType = X_XF86VidModeLockModeSwitch;
  25.891 +    req->screen = screen;
  25.892 +    req->lock = lock;
  25.893 +    UnlockDisplay(dpy);
  25.894 +    SyncHandle();
  25.895 +    return True;
  25.896 +}
  25.897 +    
  25.898 +Bool
  25.899 +SDL_NAME(XF86VidModeGetMonitor)(dpy, screen, monitor)
  25.900 +    Display* dpy;
  25.901 +    int screen;
  25.902 +    SDL_NAME(XF86VidModeMonitor)* monitor;
  25.903 +{
  25.904 +    XExtDisplayInfo *info = find_display (dpy);
  25.905 +    xXF86VidModeGetMonitorReply rep;
  25.906 +    xXF86VidModeGetMonitorReq *req;
  25.907 +    CARD32 syncrange;
  25.908 +    int i;
  25.909 +
  25.910 +    XF86VidModeCheckExtension (dpy, info, False);
  25.911 +
  25.912 +    LockDisplay(dpy);
  25.913 +    GetReq(XF86VidModeGetMonitor, req);
  25.914 +    req->reqType = info->codes->major_opcode;
  25.915 +    req->xf86vidmodeReqType = X_XF86VidModeGetMonitor;
  25.916 +    req->screen = screen;
  25.917 +    if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
  25.918 +	UnlockDisplay(dpy);
  25.919 +	SyncHandle();
  25.920 +	return False;
  25.921 +    }
  25.922 +    monitor->nhsync = rep.nhsync;
  25.923 +    monitor->nvsync = rep.nvsync;
  25.924 +#if 0
  25.925 +    monitor->bandwidth = (float)rep.bandwidth / 1e6;
  25.926 +#endif
  25.927 +    if (rep.vendorLength) {
  25.928 +	if (!(monitor->vendor = (char *)Xcalloc(rep.vendorLength + 1, 1))) {
  25.929 +	    _XEatData(dpy, (rep.nhsync + rep.nvsync) * 4 +
  25.930 +		      ((rep.vendorLength+3) & ~3) + ((rep.modelLength+3) & ~3));
  25.931 +	    return False;
  25.932 +	}
  25.933 +    } else {
  25.934 +	monitor->vendor = NULL;
  25.935 +    }
  25.936 +    if (rep.modelLength) {
  25.937 +	if (!(monitor->model = Xcalloc(rep.modelLength + 1, 1))) {
  25.938 +	    _XEatData(dpy, (rep.nhsync + rep.nvsync) * 4 +
  25.939 +		      ((rep.vendorLength+3) & ~3) + ((rep.modelLength+3) & ~3));
  25.940 +	    if (monitor->vendor)
  25.941 +		Xfree(monitor->vendor);
  25.942 +	    return False;
  25.943 +	}
  25.944 +    } else {
  25.945 +	monitor->model = NULL;
  25.946 +    }
  25.947 +    if (!(monitor->hsync = Xcalloc(rep.nhsync, sizeof(SDL_NAME(XF86VidModeSyncRange))))) {
  25.948 +	_XEatData(dpy, (rep.nhsync + rep.nvsync) * 4 +
  25.949 +		  ((rep.vendorLength+3) & ~3) + ((rep.modelLength+3) & ~3));
  25.950 +	
  25.951 +	if (monitor->vendor)
  25.952 +	    Xfree(monitor->vendor);
  25.953 +	if (monitor->model)
  25.954 +	    Xfree(monitor->model);
  25.955 +	return False;
  25.956 +    }
  25.957 +    if (!(monitor->vsync = Xcalloc(rep.nvsync, sizeof(SDL_NAME(XF86VidModeSyncRange))))) {
  25.958 +	_XEatData(dpy, (rep.nhsync + rep.nvsync) * 4 +
  25.959 +		  ((rep.vendorLength+3) & ~3) + ((rep.modelLength+3) & ~3));
  25.960 +	if (monitor->vendor)
  25.961 +	    Xfree(monitor->vendor);
  25.962 +	if (monitor->model)
  25.963 +	    Xfree(monitor->model);
  25.964 +	Xfree(monitor->hsync);
  25.965 +	return False;
  25.966 +    }
  25.967 +    for (i = 0; i < rep.nhsync; i++) {
  25.968 +	_XRead(dpy, (char *)&syncrange, 4);
  25.969 +	monitor->hsync[i].lo = (float)(syncrange & 0xFFFF) / 100.0;
  25.970 +	monitor->hsync[i].hi = (float)(syncrange >> 16) / 100.0;
  25.971 +    }
  25.972 +    for (i = 0; i < rep.nvsync; i++) {
  25.973 +	_XRead(dpy, (char *)&syncrange, 4);
  25.974 +	monitor->vsync[i].lo = (float)(syncrange & 0xFFFF) / 100.0;
  25.975 +	monitor->vsync[i].hi = (float)(syncrange >> 16) / 100.0;
  25.976 +    }
  25.977 +    if (rep.vendorLength)
  25.978 +	_XReadPad(dpy, monitor->vendor, rep.vendorLength);
  25.979 +    else
  25.980 +	monitor->vendor = "";
  25.981 +    if (rep.modelLength)
  25.982 +	_XReadPad(dpy, monitor->model, rep.modelLength);
  25.983 +    else
  25.984 +	monitor->model = "";
  25.985 +	
  25.986 +    UnlockDisplay(dpy);
  25.987 +    SyncHandle();
  25.988 +    return True;
  25.989 +}
  25.990 +
  25.991 +Bool
  25.992 +SDL_NAME(XF86VidModeGetViewPort)(dpy, screen, x, y)
  25.993 +    Display* dpy;
  25.994 +    int screen;
  25.995 +    int *x, *y;
  25.996 +{
  25.997 +    XExtDisplayInfo *info = find_display (dpy);
  25.998 +    xXF86VidModeGetViewPortReply rep;
  25.999 +    xXF86VidModeGetViewPortReq *req;
 25.1000 +    int majorVersion, minorVersion;
 25.1001 +    Bool protocolBug = False;
 25.1002 +
 25.1003 +    XF86VidModeCheckExtension (dpy, info, False);
 25.1004 +
 25.1005 +    /*
 25.1006 +     * Note: There was a bug in the protocol implementation in versions
 25.1007 +     * 0.x with x < 8 (no reply was sent, so the client would hang)
 25.1008 +     * Check the server's version, and don't wait for a reply with older
 25.1009 +     * versions.
 25.1010 +     */
 25.1011 +
 25.1012 +    SDL_NAME(XF86VidModeQueryVersion)(dpy, &majorVersion, &minorVersion);
 25.1013 +    if (majorVersion == 0 && minorVersion < 8) {
 25.1014 +	protocolBug = True;
 25.1015 +#ifdef DEBUG
 25.1016 +	fprintf(stderr, "XF86VidModeGetViewPort: Warning: Xserver is"
 25.1017 +		"running an old version (%d.%d)\n", majorVersion,
 25.1018 +		minorVersion);
 25.1019 +#endif
 25.1020 +    }
 25.1021 +    LockDisplay(dpy);
 25.1022 +    GetReq(XF86VidModeGetViewPort, req);
 25.1023 +    req->reqType = info->codes->major_opcode;
 25.1024 +    req->xf86vidmodeReqType = X_XF86VidModeGetViewPort;
 25.1025 +    req->screen = screen;
 25.1026 +    if (protocolBug) {
 25.1027 +	*x = 0;
 25.1028 +	*y = 0;
 25.1029 +    } else {
 25.1030 +	if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
 25.1031 +	    UnlockDisplay(dpy);
 25.1032 +	    SyncHandle();
 25.1033 +	    return False;
 25.1034 +	}
 25.1035 +	*x = rep.x;
 25.1036 +	*y = rep.y;
 25.1037 +    }
 25.1038 +
 25.1039 +    UnlockDisplay(dpy);
 25.1040 +    SyncHandle();
 25.1041 +    return True;
 25.1042 +}
 25.1043 +
 25.1044 +Bool
 25.1045 +SDL_NAME(XF86VidModeSetViewPort)(dpy, screen, x, y)
 25.1046 +    Display* dpy;
 25.1047 +    int screen;
 25.1048 +    int x, y;
 25.1049 +{
 25.1050 +    XExtDisplayInfo *info = find_display (dpy);
 25.1051 +    xXF86VidModeSetViewPortReq *req;
 25.1052 +
 25.1053 +    XF86VidModeCheckExtension (dpy, info, False);
 25.1054 +
 25.1055 +    LockDisplay(dpy);
 25.1056 +    GetReq(XF86VidModeSetViewPort, req);
 25.1057 +    req->reqType = info->codes->major_opcode;
 25.1058 +    req->xf86vidmodeReqType = X_XF86VidModeSetViewPort;
 25.1059 +    req->screen = screen;
 25.1060 +    req->x = x;
 25.1061 +    req->y = y;
 25.1062 +
 25.1063 +    UnlockDisplay(dpy);
 25.1064 +    SyncHandle();
 25.1065 +    return True;
 25.1066 +}
 25.1067 +
 25.1068 +Bool
 25.1069 +SDL_NAME(XF86VidModeGetDotClocks)(dpy, screen,
 25.1070 +	    flagsPtr, numclocksPtr, maxclocksPtr, clocksPtr)
 25.1071 +    Display* dpy;
 25.1072 +    int screen;
 25.1073 +    int *flagsPtr, *numclocksPtr, *maxclocksPtr, *clocksPtr[]; 
 25.1074 +{
 25.1075 +    XExtDisplayInfo *info = find_display (dpy);
 25.1076 +    xXF86VidModeGetDotClocksReply rep;
 25.1077 +    xXF86VidModeGetDotClocksReq *req;
 25.1078 +    int i, *dotclocks;
 25.1079 +    CARD32 dotclk;
 25.1080 +
 25.1081 +    XF86VidModeCheckExtension (dpy, info, False);
 25.1082 +
 25.1083 +    LockDisplay(dpy);
 25.1084 +    GetReq(XF86VidModeGetDotClocks, req);
 25.1085 +    req->reqType = info->codes->major_opcode;
 25.1086 +    req->xf86vidmodeReqType = X_XF86VidModeGetDotClocks;
 25.1087 +    req->screen = screen;
 25.1088 +    if (!_XReply(dpy, (xReply *)&rep, 
 25.1089 +        (SIZEOF(xXF86VidModeGetDotClocksReply) - SIZEOF(xReply)) >> 2, xFalse))
 25.1090 +    {
 25.1091 +        UnlockDisplay(dpy);
 25.1092 +        SyncHandle();
 25.1093 +        return False;
 25.1094 +    }
 25.1095 +    *numclocksPtr = rep.clocks;
 25.1096 +    *maxclocksPtr = rep.maxclocks;
 25.1097 +    *flagsPtr     = rep.flags;
 25.1098 +
 25.1099 +    if (!(dotclocks = (int*) Xcalloc(rep.clocks, sizeof(int)))) {
 25.1100 +        _XEatData(dpy, (rep.clocks) * 4);
 25.1101 +        Xfree(dotclocks);
 25.1102 +        return False;
 25.1103 +    }
 25.1104 +
 25.1105 +    for (i = 0; i < rep.clocks; i++) {
 25.1106 +        _XRead(dpy, (char*)&dotclk, 4);
 25.1107 +	dotclocks[i] = dotclk;
 25.1108 +    }
 25.1109 +    *clocksPtr = dotclocks;
 25.1110 +    UnlockDisplay(dpy);
 25.1111 +    SyncHandle();
 25.1112 +    return True;
 25.1113 +}
 25.1114 +
 25.1115 +Bool
 25.1116 +SDL_NAME(XF86VidModeSetGammaRamp) (
 25.1117 +    Display *dpy,
 25.1118 +    int screen,
 25.1119 +    int size,
 25.1120 +    unsigned short *red,
 25.1121 +    unsigned short *green,
 25.1122 +    unsigned short *blue
 25.1123 +)
 25.1124 +{
 25.1125 +    int length = (size + 1) & ~1;
 25.1126 +    XExtDisplayInfo *info = find_display (dpy);
 25.1127 +    xXF86VidModeSetGammaRampReq *req;
 25.1128 +
 25.1129 +    XF86VidModeCheckExtension (dpy, info, False);
 25.1130 +    LockDisplay(dpy);
 25.1131 +    GetReq(XF86VidModeSetGammaRamp, req);
 25.1132 +    req->reqType = info->codes->major_opcode;
 25.1133 +    req->xf86vidmodeReqType = X_XF86VidModeSetGammaRamp;
 25.1134 +    req->screen = screen;
 25.1135 +    req->length += (length >> 1) * 3;
 25.1136 +    req->size = size;
 25.1137 +    _XSend(dpy, (char*)red, size * 2);
 25.1138 +    _XSend(dpy, (char*)green, size * 2);
 25.1139 +    _XSend(dpy, (char*)blue, size * 2);
 25.1140 +    UnlockDisplay(dpy);
 25.1141 +    SyncHandle();
 25.1142 +    return True;
 25.1143 +}
 25.1144 +
 25.1145 +
 25.1146 +Bool
 25.1147 +SDL_NAME(XF86VidModeGetGammaRamp) (
 25.1148 +    Display *dpy,
 25.1149 +    int screen,
 25.1150 +    int size,
 25.1151 +    unsigned short *red,
 25.1152 +    unsigned short *green,
 25.1153 +    unsigned short *blue
 25.1154 +)
 25.1155 +{
 25.1156 +    XExtDisplayInfo *info = find_display (dpy);
 25.1157 +    xXF86VidModeGetGammaRampReq *req;
 25.1158 +    xXF86VidModeGetGammaRampReply rep;
 25.1159 +  
 25.1160 +    XF86VidModeCheckExtension (dpy, info, False);
 25.1161 +
 25.1162 +    LockDisplay(dpy);
 25.1163 +    GetReq(XF86VidModeGetGammaRamp, req);
 25.1164 +    req->reqType = info->codes->major_opcode;
 25.1165 +    req->xf86vidmodeReqType = X_XF86VidModeGetGammaRamp;
 25.1166 +    req->screen = screen;
 25.1167 +    req->size = size;
 25.1168 +    if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) {
 25.1169 +        UnlockDisplay (dpy);
 25.1170 +        SyncHandle ();
 25.1171 +        return False;
 25.1172 +    }
 25.1173 +    if(rep.size) {
 25.1174 +	_XRead(dpy, (char*)red, rep.size << 1);
 25.1175 +	_XRead(dpy, (char*)green, rep.size << 1);
 25.1176 +	_XRead(dpy, (char*)blue, rep.size << 1);
 25.1177 +    }
 25.1178 +
 25.1179 +    UnlockDisplay(dpy);
 25.1180 +    SyncHandle();
 25.1181 +    return True;
 25.1182 +}
 25.1183 +
 25.1184 +Bool SDL_NAME(XF86VidModeGetGammaRampSize)(
 25.1185 +    Display *dpy,
 25.1186 +    int screen,
 25.1187 +    int *size
 25.1188 +)
 25.1189 +{
 25.1190 +    XExtDisplayInfo *info = find_display (dpy);
 25.1191 +    xXF86VidModeGetGammaRampSizeReq *req;
 25.1192 +    xXF86VidModeGetGammaRampSizeReply rep;
 25.1193 +  
 25.1194 +    *size = 0;
 25.1195 +
 25.1196 +    XF86VidModeCheckExtension (dpy, info, False);
 25.1197 +
 25.1198 +    LockDisplay(dpy);
 25.1199 +    GetReq(XF86VidModeGetGammaRampSize, req);
 25.1200 +    req->reqType = info->codes->major_opcode;
 25.1201 +    req->xf86vidmodeReqType = X_XF86VidModeGetGammaRampSize;
 25.1202 +    req->screen = screen;
 25.1203 +    if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
 25.1204 +        UnlockDisplay (dpy);
 25.1205 +        SyncHandle ();
 25.1206 +        return False; 
 25.1207 +    }
 25.1208 +    *size = rep.size;
 25.1209 +    UnlockDisplay(dpy);
 25.1210 +    SyncHandle();
 25.1211 +    return True;
 25.1212 +}
 25.1213 +
    26.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    26.2 +++ b/src/video/Xext/extensions/Makefile.am	Tue Mar 05 19:55:32 2002 +0000
    26.3 @@ -0,0 +1,16 @@
    26.4 +
    26.5 +noinst_HEADERS =	\
    26.6 +	extutil.h	\
    26.7 +	panoramiXext.h	\
    26.8 +	panoramiXproto.h \
    26.9 +	SDLname.h	\
   26.10 +	xf86dga1.h	\
   26.11 +	xf86dga1str.h	\
   26.12 +	xf86dga.h	\
   26.13 +	xf86dgastr.h	\
   26.14 +	xf86vmode.h	\
   26.15 +	xf86vmstr.h	\
   26.16 +	Xinerama.h	\
   26.17 +	Xv.h		\
   26.18 +	Xvlib.h		\
   26.19 +	Xvproto.h
    27.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    27.2 +++ b/src/video/Xext/extensions/SDLname.h	Tue Mar 05 19:55:32 2002 +0000
    27.3 @@ -0,0 +1,8 @@
    27.4 +
    27.5 +#ifndef _SDLname_h_
    27.6 +#define _SDLname_h_
    27.7 +
    27.8 +#define NeedFunctionPrototypes 1
    27.9 +#define SDL_NAME(X)	SDL_##X
   27.10 +
   27.11 +#endif
    28.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    28.2 +++ b/src/video/Xext/extensions/Xinerama.h	Tue Mar 05 19:55:32 2002 +0000
    28.3 @@ -0,0 +1,46 @@
    28.4 +/* $XFree86: xc/include/extensions/Xinerama.h,v 3.2 2000/03/01 01:04:20 dawes Exp $ */
    28.5 +
    28.6 +#ifndef _Xinerama_h
    28.7 +#define _Xinerama_h
    28.8 +
    28.9 +#include "SDLname.h"
   28.10 +
   28.11 +typedef struct {
   28.12 +   int   screen_number;
   28.13 +   short x_org;
   28.14 +   short y_org;
   28.15 +   short width;
   28.16 +   short height;
   28.17 +} SDL_NAME(XineramaScreenInfo);
   28.18 +
   28.19 +Bool SDL_NAME(XineramaQueryExtension) (
   28.20 +   Display *dpy,
   28.21 +   int     *event_base,
   28.22 +   int     *error_base
   28.23 +);
   28.24 +
   28.25 +Status SDL_NAME(XineramaQueryVersion)(
   28.26 +   Display *dpy,
   28.27 +   int     *major,
   28.28 +   int     *minor
   28.29 +);
   28.30 +
   28.31 +Bool SDL_NAME(XineramaIsActive)(Display *dpy);
   28.32 +
   28.33 +
   28.34 +/* 
   28.35 +   Returns the number of heads and a pointer to an array of
   28.36 +   structures describing the position and size of the individual
   28.37 +   heads.  Returns NULL and number = 0 if Xinerama is not active.
   28.38 +  
   28.39 +   Returned array should be freed with XFree().
   28.40 +*/
   28.41 +
   28.42 +SDL_NAME(XineramaScreenInfo) * 
   28.43 +SDL_NAME(XineramaQueryScreens)(
   28.44 +   Display *dpy,
   28.45 +   int     *number
   28.46 +);
   28.47 +
   28.48 +#endif /* _Xinerama_h */
   28.49 +
    29.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    29.2 +++ b/src/video/Xext/extensions/Xv.h	Tue Mar 05 19:55:32 2002 +0000
    29.3 @@ -0,0 +1,129 @@
    29.4 +/***********************************************************
    29.5 +Copyright 1991 by Digital Equipment Corporation, Maynard, Massachusetts,
    29.6 +and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
    29.7 +
    29.8 +                        All Rights Reserved
    29.9 +
   29.10 +Permission to use, copy, modify, and distribute this software and its 
   29.11 +documentation for any purpose and without fee is hereby granted, 
   29.12 +provided that the above copyright notice appear in all copies and that
   29.13 +both that copyright notice and this permission notice appear in 
   29.14 +supporting documentation, and that the names of Digital or MIT not be
   29.15 +used in advertising or publicity pertaining to distribution of the
   29.16 +software without specific, written prior permission.  
   29.17 +
   29.18 +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
   29.19 +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
   29.20 +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
   29.21 +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
   29.22 +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
   29.23 +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
   29.24 +SOFTWARE.
   29.25 +
   29.26 +******************************************************************/
   29.27 +/* $XFree86: xc/include/extensions/Xv.h,v 1.5 1999/12/11 19:28:48 mvojkovi Exp $ */
   29.28 +
   29.29 +#ifndef XV_H
   29.30 +#define XV_H
   29.31 +/*
   29.32 +** File: 
   29.33 +**
   29.34 +**   Xv.h --- Xv shared library and server header file
   29.35 +**
   29.36 +** Author: 
   29.37 +**
   29.38 +**   David Carver (Digital Workstation Engineering/Project Athena)
   29.39 +**
   29.40 +** Revisions:
   29.41 +**
   29.42 +**   05.15.91 Carver
   29.43 +**     - version 2.0 upgrade
   29.44 +**
   29.45 +**   01.24.91 Carver
   29.46 +**     - version 1.4 upgrade
   29.47 +**
   29.48 +*/
   29.49 +
   29.50 +#include <X11/X.h>
   29.51 +
   29.52 +#define XvName "XVideo"
   29.53 +#define XvVersion 2
   29.54 +#define XvRevision 2
   29.55 +
   29.56 +/* Symbols */
   29.57 +
   29.58 +typedef XID XvPortID;
   29.59 +typedef XID XvEncodingID;
   29.60 +
   29.61 +#define XvNone 0
   29.62 +
   29.63 +#define XvInput          0
   29.64 +#define XvOutput         1
   29.65 +
   29.66 +#define XvInputMask      (1L<<XvInput)
   29.67 +#define XvOutputMask     (1L<<XvOutput)
   29.68 +#define XvVideoMask	 0x00000004
   29.69 +#define XvStillMask	 0x00000008
   29.70 +#define XvImageMask	 0x00000010
   29.71 +
   29.72 +/* These two are not client viewable */
   29.73 +#define XvPixmapMask	 0x00010000
   29.74 +#define XvWindowMask	 0x00020000
   29.75 +
   29.76 +
   29.77 +#define XvGettable	0x01
   29.78 +#define XvSettable	0x02
   29.79 +
   29.80 +#define XvRGB		0
   29.81 +#define XvYUV		1
   29.82 +
   29.83 +#define XvPacked	0
   29.84 +#define XvPlanar	1
   29.85 +
   29.86 +#define XvTopToBottom	0
   29.87 +#define XvBottomToTop	1
   29.88 +
   29.89 +
   29.90 +/* Events */
   29.91 +
   29.92 +#define XvVideoNotify 0
   29.93 +#define XvPortNotify 1
   29.94 +#define XvNumEvents 2
   29.95 +
   29.96 +/* Video Notify Reasons */
   29.97 +
   29.98 +#define XvStarted 0
   29.99 +#define XvStopped 1
  29.100 +#define XvBusy 2
  29.101 +#define XvPreempted 3
  29.102 +#define XvHardError 4
  29.103 +#define XvLastReason 4
  29.104 +
  29.105 +#define XvNumReasons (XvLastReason + 1)
  29.106 +
  29.107 +#define XvStartedMask     (1L<<XvStarted)
  29.108 +#define XvStoppedMask     (1L<<XvStopped)
  29.109 +#define XvBusyMask        (1L<<XvBusy)
  29.110 +#define XvPreemptedMask   (1L<<XvPreempted)
  29.111 +#define XvHardErrorMask   (1L<<XvHardError)
  29.112 +
  29.113 +#define XvAnyReasonMask   ((1L<<XvNumReasons) - 1)
  29.114 +#define XvNoReasonMask    0
  29.115 +
  29.116 +/* Errors */
  29.117 +
  29.118 +#define XvBadPort 0
  29.119 +#define XvBadEncoding 1
  29.120 +#define XvBadControl 2
  29.121 +#define XvNumErrors 3
  29.122 +
  29.123 +/* Status */
  29.124 +
  29.125 +#define XvBadExtension 1
  29.126 +#define XvAlreadyGrabbed 2
  29.127 +#define XvInvalidTime 3
  29.128 +#define XvBadReply 4
  29.129 +#define XvBadAlloc 5
  29.130 +
  29.131 +#endif /* XV_H */
  29.132 +
    30.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    30.2 +++ b/src/video/Xext/extensions/Xvlib.h	Tue Mar 05 19:55:32 2002 +0000
    30.3 @@ -0,0 +1,433 @@
    30.4 +/***********************************************************
    30.5 +Copyright 1991 by Digital Equipment Corporation, Maynard, Massachusetts,
    30.6 +and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
    30.7 +
    30.8 +                        All Rights Reserved
    30.9 +
   30.10 +Permission to use, copy, modify, and distribute this software and its 
   30.11 +documentation for any purpose and without fee is hereby granted, 
   30.12 +provided that the above copyright notice appear in all copies and that
   30.13 +both that copyright notice and this permission notice appear in 
   30.14 +supporting documentation, and that the names of Digital or MIT not be
   30.15 +used in advertising or publicity pertaining to distribution of the
   30.16 +software without specific, written prior permission.  
   30.17 +
   30.18 +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
   30.19 +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
   30.20 +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
   30.21 +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
   30.22 +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
   30.23 +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
   30.24 +SOFTWARE.
   30.25 +
   30.26 +******************************************************************/
   30.27 +/* $XFree86: xc/include/extensions/Xvlib.h,v 1.3 1999/12/11 19:28:48 mvojkovi Exp $ */
   30.28 +
   30.29 +#ifndef XVLIB_H
   30.30 +#define XVLIB_H
   30.31 +/*
   30.32 +** File: 
   30.33 +**
   30.34 +**   Xvlib.h --- Xv library public header file
   30.35 +**
   30.36 +** Author: 
   30.37 +**
   30.38 +**   David Carver (Digital Workstation Engineering/Project Athena)
   30.39 +**
   30.40 +** Revisions:
   30.41 +**
   30.42 +**   26.06.91 Carver
   30.43 +**     - changed XvFreeAdaptors to XvFreeAdaptorInfo
   30.44 +**     - changed XvFreeEncodings to XvFreeEncodingInfo
   30.45 +**
   30.46 +**   11.06.91 Carver
   30.47 +**     - changed SetPortControl to SetPortAttribute
   30.48 +**     - changed GetPortControl to GetPortAttribute
   30.49 +**     - changed QueryBestSize
   30.50 +**
   30.51 +**   05.15.91 Carver
   30.52 +**     - version 2.0 upgrade
   30.53 +**
   30.54 +**   01.24.91 Carver
   30.55 +**     - version 1.4 upgrade
   30.56 +**
   30.57 +*/
   30.58 +
   30.59 +#include <X11/Xfuncproto.h>
   30.60 +#include <XFree86/extensions/Xv.h>
   30.61 +#include "SDLname.h"
   30.62 +
   30.63 +typedef struct {
   30.64 +  int numerator;
   30.65 +  int denominator;
   30.66 +} SDL_NAME(XvRational);
   30.67 +
   30.68 +typedef struct {
   30.69 +  int flags;	/* XvGettable, XvSettable */
   30.70 +  int min_value;
   30.71 +  int max_value;
   30.72 +  char *name;
   30.73 +} SDL_NAME(XvAttribute);
   30.74 +
   30.75 +typedef struct {
   30.76 +  XvEncodingID encoding_id;
   30.77 +  char *name;
   30.78 +  unsigned long width;
   30.79 +  unsigned long height;
   30.80 +  SDL_NAME(XvRational) rate;
   30.81 +  unsigned long num_encodings;
   30.82 +} SDL_NAME(XvEncodingInfo);
   30.83 +
   30.84 +typedef struct {
   30.85 +  char depth;
   30.86 +  unsigned long visual_id;
   30.87 +} SDL_NAME(XvFormat);
   30.88 +
   30.89 +typedef struct {
   30.90 +  XvPortID base_id;
   30.91 +  unsigned long num_ports;
   30.92 +  char type;
   30.93 +  char *name;
   30.94 +  unsigned long num_formats;
   30.95 +  SDL_NAME(XvFormat) *formats;
   30.96 +  unsigned long num_adaptors;
   30.97 +} SDL_NAME(XvAdaptorInfo);
   30.98 +
   30.99 +typedef struct {
  30.100 +  int type;
  30.101 +  unsigned long serial;	   /* # of last request processed by server */
  30.102 +  Bool send_event;	   /* true if this came from a SendEvent request */
  30.103 +  Display *display;	   /* Display the event was read from */
  30.104 +  Drawable drawable;       /* drawable */
  30.105 +  unsigned long reason;    /* what generated this event */
  30.106 +  XvPortID port_id;        /* what port */
  30.107 +  Time time;		   /* milliseconds */
  30.108 +} SDL_NAME(XvVideoNotifyEvent);
  30.109 +
  30.110 +typedef struct {
  30.111 +  int type;
  30.112 +  unsigned long serial;	   /* # of last request processed by server */
  30.113 +  Bool send_event;	   /* true if this came from a SendEvent request */
  30.114 +  Display *display;	   /* Display the event was read from */
  30.115 +  XvPortID port_id;        /* what port */
  30.116 +  Time time;		   /* milliseconds */
  30.117 +  Atom attribute;           /* atom that identifies attribute */
  30.118 +  long value;              /* value of attribute */
  30.119 +} SDL_NAME(XvPortNotifyEvent);
  30.120 +
  30.121 +typedef union {
  30.122 +  int type;
  30.123 +  SDL_NAME(XvVideoNotifyEvent) xvvideo;
  30.124 +  SDL_NAME(XvPortNotifyEvent) xvport;
  30.125 +  long pad[24];
  30.126 +} SDL_NAME(XvEvent);
  30.127 +
  30.128 +typedef struct {
  30.129 +  int id;                      /* Unique descriptor for the format */
  30.130 +  int type;                    /* XvRGB, XvYUV */
  30.131 +  int byte_order;              /* LSBFirst, MSBFirst */
  30.132 +  char guid[16];               /* Globally Unique IDentifier */
  30.133 +  int bits_per_pixel;
  30.134 +  int format;                  /* XvPacked, XvPlanar */
  30.135 +  int num_planes;
  30.136 +
  30.137 +  /* for RGB formats only */
  30.138 +  int depth;
  30.139 +  unsigned int red_mask;       
  30.140 +  unsigned int green_mask;   
  30.141 +  unsigned int blue_mask;   
  30.142 +
  30.143 +  /* for YUV formats only */
  30.144 +  unsigned int y_sample_bits;
  30.145 +  unsigned int u_sample_bits;
  30.146 +  unsigned int v_sample_bits;   
  30.147 +  unsigned int horz_y_period;
  30.148 +  unsigned int horz_u_period;
  30.149 +  unsigned int horz_v_period;
  30.150 +  unsigned int vert_y_period;
  30.151 +  unsigned int vert_u_period;
  30.152 +  unsigned int vert_v_period;
  30.153 +  char component_order[32];    /* eg. UYVY */
  30.154 +  int scanline_order;          /* XvTopToBottom, XvBottomToTop */
  30.155 +} SDL_NAME(XvImageFormatValues); 
  30.156 +
  30.157 +typedef struct {
  30.158 +  int id;
  30.159 +  int width, height;
  30.160 +  int data_size;              /* bytes */
  30.161 +  int num_planes;
  30.162 +  int *pitches;               /* bytes */
  30.163 +  int *offsets;               /* bytes */
  30.164 +  char *data;
  30.165 +  XPointer obdata;     
  30.166 +} SDL_NAME(XvImage);
  30.167 +
  30.168 +_XFUNCPROTOBEGIN
  30.169 +
  30.170 +extern int SDL_NAME(XvQueryExtension)(
  30.171 +#if NeedFunctionPrototypes
  30.172 +  Display*                 /* display */,
  30.173 +  unsigned int*            /* p_version */,
  30.174 +  unsigned int*            /* p_revision */,
  30.175 +  unsigned int*            /* p_requestBase */,
  30.176 +  unsigned int*            /* p_eventBase */, 
  30.177 +  unsigned int*            /* p_errorBase */
  30.178 +#endif
  30.179 +);
  30.180 +
  30.181 +extern int SDL_NAME(XvQueryAdaptors)(
  30.182 +#if NeedFunctionPrototypes
  30.183 +  Display*                 /* display */,
  30.184 +  Window                   /* window */,
  30.185 +  unsigned int*            /* p_nAdaptors */,
  30.186 +  SDL_NAME(XvAdaptorInfo)**          /* p_pAdaptors */
  30.187 +#endif
  30.188 +);
  30.189 +
  30.190 +extern int SDL_NAME(XvQueryEncodings)(
  30.191 +#if NeedFunctionPrototypes
  30.192 +  Display*                 /* display */,
  30.193 +  XvPortID                 /* port */,
  30.194 +  unsigned int*            /* p_nEncoding */,
  30.195 +  SDL_NAME(XvEncodingInfo)**         /* p_pEncoding */
  30.196 +#endif
  30.197 +);
  30.198 +
  30.199 +extern int SDL_NAME(XvPutVideo)(
  30.200 +#if NeedFunctionPrototypes
  30.201 +  Display*                 /* display */,
  30.202 +  XvPortID                 /* port */,
  30.203 +  Drawable                 /* d */,
  30.204 +  GC                       /* gc */,
  30.205 +  int                      /* vx */, 
  30.206 +  int                      /* vy */,
  30.207 +  unsigned int             /* vw */, 
  30.208 +  unsigned int             /* vh */,
  30.209 +  int                      /* dx */, 
  30.210 +  int                      /* dy */,
  30.211 +  unsigned int             /* dw */,
  30.212 +  unsigned int             /* dh */
  30.213 +#endif
  30.214 +);
  30.215 +
  30.216 +extern int SDL_NAME(XvPutStill)(
  30.217 +#if NeedFunctionPrototypes
  30.218 +  Display*                 /* display */,
  30.219 +  XvPortID                 /* port */,
  30.220 +  Drawable                 /* d */,
  30.221 +  GC                       /* gc */,
  30.222 +  int                      /* vx */, 
  30.223 +  int                      /* vy */,
  30.224 +  unsigned int             /* vw */, 
  30.225 +  unsigned int             /* vh */,
  30.226 +  int                      /* dx */, 
  30.227 +  int                      /* dy */,
  30.228 +  unsigned int             /* dw */,
  30.229 +  unsigned int             /* dh */
  30.230 +#endif
  30.231 +);
  30.232 +
  30.233 +extern int SDL_NAME(XvGetVideo)(
  30.234 +#if NeedFunctionPrototypes
  30.235 +  Display*                 /* display */,
  30.236 +  XvPortID                 /* port */,
  30.237 +  Drawable                 /* d */,
  30.238 +  GC                       /* gc */,
  30.239 +  int                      /* vx */, 
  30.240 +  int                      /* vy */,
  30.241 +  unsigned int             /* vw */, 
  30.242 +  unsigned int             /* vh */,
  30.243 +  int                      /* dx */, 
  30.244 +  int                      /* dy */,
  30.245 +  unsigned int             /* dw */,
  30.246 +  unsigned int             /* dh */
  30.247 +#endif
  30.248 +);
  30.249 +
  30.250 +extern int SDL_NAME(XvGetStill)(
  30.251 +#if NeedFunctionPrototypes
  30.252 +  Display*                 /* display */,
  30.253 +  XvPortID                 /* port */,
  30.254 +  Drawable                 /* d */,
  30.255 +  GC                       /* gc */,
  30.256 +  int                      /* vx */, 
  30.257 +  int                      /* vy */,
  30.258 +  unsigned int             /* vw */, 
  30.259 +  unsigned int             /* vh */,
  30.260 +  int                      /* dx */, 
  30.261 +  int                      /* dy */,
  30.262 +  unsigned int             /* dw */,
  30.263 +  unsigned int             /* dh */
  30.264 +#endif
  30.265 +);
  30.266 +
  30.267 +extern int SDL_NAME(XvStopVideo)(
  30.268 +#if NeedFunctionPrototypes
  30.269 +  Display*                /* display */,
  30.270 +  XvPortID                /* port */,
  30.271 +  Drawable                /* drawable */
  30.272 +#endif
  30.273 +);
  30.274 +
  30.275 +extern int SDL_NAME(XvGrabPort)(
  30.276 +#if NeedFunctionPrototypes
  30.277 +  Display*                /* display */,
  30.278 +  XvPortID                /* port */,
  30.279 +  Time                    /* time */
  30.280 +#endif
  30.281 +);
  30.282 +
  30.283 +extern int SDL_NAME(XvUngrabPort)(
  30.284 +#if NeedFunctionPrototypes
  30.285 +  Display*                /* display */,
  30.286 +  XvPortID                /* port */,
  30.287 +  Time                    /* time */
  30.288 +#endif
  30.289 +);
  30.290 +
  30.291 +extern int SDL_NAME(XvSelectVideoNotify)(
  30.292 +#if NeedFunctionPrototypes
  30.293 +  Display*                /* display */,
  30.294 +  Drawable                /* drawable */,
  30.295 +  Bool                    /* onoff */
  30.296 +#endif
  30.297 +);
  30.298 +
  30.299 +extern int SDL_NAME(XvSelectPortNotify)(
  30.300 +#if NeedFunctionPrototypes
  30.301 +  Display*                /* display */,
  30.302 +  XvPortID                /* port */,
  30.303 +  Bool                    /* onoff */
  30.304 +#endif
  30.305 +);
  30.306 +
  30.307 +extern int SDL_NAME(XvSetPortAttribute)(
  30.308 +#if NeedFunctionPrototypes
  30.309 +  Display*                /* display */,
  30.310 +  XvPortID                /* port */,
  30.311 +  Atom                    /* attribute */,
  30.312 +  int                     /* value */
  30.313 +#endif
  30.314 +);
  30.315 +
  30.316 +extern int SDL_NAME(XvGetPortAttribute)(
  30.317 +#if NeedFunctionPrototypes
  30.318 +  Display*                /* display */,
  30.319 +  XvPortID                /* port */,
  30.320 +  Atom                    /* attribute */,
  30.321 +  int*                    /* p_value */
  30.322 +#endif
  30.323 +);
  30.324 +
  30.325 +extern int SDL_NAME(XvQueryBestSize)(
  30.326 +#if NeedFunctionPrototypes
  30.327 +  Display*                /* display */,
  30.328 +  XvPortID                /* port */,
  30.329 +  Bool                    /* motion */,
  30.330 +  unsigned int            /* vid_w */, 
  30.331 +  unsigned int            /* vid_h */,
  30.332 +  unsigned int            /* drw_w */, 
  30.333 +  unsigned int            /* drw_h */,
  30.334 +  unsigned int*           /* p_actual_width */, 
  30.335 +  unsigned int*           /* p_actual_width */
  30.336 +#endif
  30.337 +);
  30.338 +
  30.339 +extern SDL_NAME(XvAttribute)* SDL_NAME(XvQueryPortAttributes)(
  30.340 +#if NeedFunctionPrototypes
  30.341 +  Display*                /* display */,
  30.342 +  XvPortID                /* port */,
  30.343 +  int*                    /* number */
  30.344 +#endif
  30.345 +);
  30.346 +
  30.347 +
  30.348 +extern void SDL_NAME(XvFreeAdaptorInfo)(
  30.349 +#if NeedFunctionPrototypes
  30.350 +  SDL_NAME(XvAdaptorInfo)*          /* adaptors */
  30.351 +#endif
  30.352 +);
  30.353 +
  30.354 +extern void SDL_NAME(XvFreeEncodingInfo)(
  30.355 +#if NeedFunctionPrototypes
  30.356 +  SDL_NAME(XvEncodingInfo)*         /* encodings */
  30.357 +#endif
  30.358 +);
  30.359 +
  30.360 +
  30.361 +extern SDL_NAME(XvImageFormatValues) * SDL_NAME(XvListImageFormats) (
  30.362 +#if NeedFunctionPrototypes
  30.363 +   Display 	*display,
  30.364 +   XvPortID 	port_id,
  30.365 +   int 		*count_return
  30.366 +#endif
  30.367 +);
  30.368 +
  30.369 +extern SDL_NAME(XvImage) * SDL_NAME(XvCreateImage) (
  30.370 +#if NeedFunctionPrototypes
  30.371 +   Display *display,
  30.372 +   XvPortID port,
  30.373 +   int id,
  30.374 +   char *data,
  30.375 +   int width, 
  30.376 +   int height 
  30.377 +#endif
  30.378 +);
  30.379 +
  30.380 +extern int SDL_NAME(XvPutImage) (
  30.381 +#if NeedFunctionPrototypes
  30.382 +  Display *display,
  30.383 +   XvPortID id,
  30.384 +   Drawable d,
  30.385 +   GC gc,
  30.386 +   SDL_NAME(XvImage) *image,
  30.387 +   int src_x,
  30.388 +   int src_y,
  30.389 +   unsigned int src_w,
  30.390 +   unsigned int src_h,
  30.391 +   int dest_x, 
  30.392 +   int dest_y,
  30.393 +   unsigned int dest_w,
  30.394 +   unsigned int dest_h
  30.395 +#endif
  30.396 +);
  30.397 +
  30.398 +extern int SDL_NAME(XvShmPutImage) (
  30.399 +#if NeedFunctionPrototypes
  30.400 +   Display *display,
  30.401 +   XvPortID id,
  30.402 +   Drawable d,
  30.403 +   GC gc,
  30.404 +   SDL_NAME(XvImage) *image,
  30.405 +   int src_x,
  30.406 +   int src_y,
  30.407 +   unsigned int src_w,
  30.408 +   unsigned int src_h,
  30.409 +   int dest_x, 
  30.410 +   int dest_y,
  30.411 +   unsigned int dest_w,
  30.412 +   unsigned int dest_h,
  30.413 +   Bool send_event
  30.414 +#endif
  30.415 +);
  30.416 +
  30.417 +#ifdef _XSHM_H_
  30.418 +
  30.419 +extern SDL_NAME(XvImage) * SDL_NAME(XvShmCreateImage) (
  30.420 +#if NeedFunctionPrototypes
  30.421 +   Display *display,
  30.422 +   XvPortID port,
  30.423 +   int id,
  30.424 +   char* data,
  30.425 +   int width, 
  30.426 +   int height,
  30.427 +   XShmSegmentInfo *shminfo
  30.428 +#endif
  30.429 +);
  30.430 +
  30.431 +#endif
  30.432 +
  30.433 +
  30.434 +_XFUNCPROTOEND
  30.435 +
  30.436 +#endif /* XVLIB_H */
    31.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    31.2 +++ b/src/video/Xext/extensions/Xvproto.h	Tue Mar 05 19:55:32 2002 +0000
    31.3 @@ -0,0 +1,604 @@
    31.4 +/***********************************************************
    31.5 +Copyright 1991 by Digital Equipment Corporation, Maynard, Massachusetts,
    31.6 +and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
    31.7 +
    31.8 +                        All Rights Reserved
    31.9 +
   31.10 +Permission to use, copy, modify, and distribute this software and its 
   31.11 +documentation for any purpose and without fee is hereby granted, 
   31.12 +provided that the above copyright notice appear in all copies and that
   31.13 +both that copyright notice and this permission notice appear in 
   31.14 +supporting documentation, and that the names of Digital or MIT not be
   31.15 +used in advertising or publicity pertaining to distribution of the
   31.16 +software without specific, written prior permission.  
   31.17 +
   31.18 +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
   31.19 +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
   31.20 +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
   31.21 +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
   31.22 +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
   31.23 +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
   31.24 +SOFTWARE.
   31.25 +
   31.26 +******************************************************************/
   31.27 +/* $XFree86: xc/include/extensions/Xvproto.h,v 1.6 2001/05/07 21:37:12 tsi Exp $ */
   31.28 +
   31.29 +#ifndef XVPROTO_H
   31.30 +#define XVPROTO_H
   31.31 +/*
   31.32 +** File: 
   31.33 +**
   31.34 +**   Xvproto.h --- Xv protocol header file
   31.35 +**
   31.36 +** Author: 
   31.37 +**
   31.38 +**   David Carver (Digital Workstation Engineering/Project Athena)
   31.39 +**
   31.40 +** Revisions:
   31.41 +**
   31.42 +**   11.06.91 Carver
   31.43 +**     - changed SetPortControl to SetPortAttribute
   31.44 +**     - changed GetPortControl to GetPortAttribute
   31.45 +**     - changed QueryBestSize
   31.46 +**
   31.47 +**   15.05.91 Carver
   31.48 +**     - version 2.0 upgrade
   31.49 +**
   31.50 +**   24.01.91 Carver
   31.51 +**     - version 1.4 upgrade
   31.52 +**
   31.53 +*/
   31.54 +
   31.55 +#include <X11/Xmd.h>
   31.56 +
   31.57 +/* Symbols: These are undefined at the end of this file to restore the
   31.58 +   values they have in Xv.h */
   31.59 +
   31.60 +#define XvPortID CARD32
   31.61 +#define XvEncodingID CARD32
   31.62 +#define ShmSeg CARD32
   31.63 +#define VisualID CARD32
   31.64 +#define Drawable CARD32
   31.65 +#define GContext CARD32
   31.66 +#define Time CARD32
   31.67 +#define Atom CARD32
   31.68 +
   31.69 +/* Structures */
   31.70 +
   31.71 +typedef struct {
   31.72 +  INT32 numerator B32;
   31.73 +  INT32 denominator B32;
   31.74 +} xvRational;
   31.75 +#define sz_xvRational 8
   31.76 +
   31.77 +typedef struct {
   31.78 +  XvPortID base_id B32;
   31.79 +  CARD16 name_size B16;
   31.80 +  CARD16 num_ports B16;
   31.81 +  CARD16 num_formats B16;
   31.82 +  CARD8 type;
   31.83 +  CARD8 pad;
   31.84 +} xvAdaptorInfo;
   31.85 +#define sz_xvAdaptorInfo 12
   31.86 +
   31.87 +typedef struct {
   31.88 +  XvEncodingID encoding B32;
   31.89 +  CARD16 name_size B16;
   31.90 +  CARD16 width B16, height B16;
   31.91 +  xvRational rate;
   31.92 +  CARD16 pad B16;
   31.93 +} xvEncodingInfo;
   31.94 +#define sz_xvEncodingInfo (12 + sz_xvRational)
   31.95 +
   31.96 +typedef struct {
   31.97 +  VisualID visual B32;
   31.98 +  CARD8 depth;
   31.99 +  CARD8 pad1;
  31.100 +  CARD16 pad2 B16;
  31.101 +} xvFormat;
  31.102 +#define sz_xvFormat 8
  31.103 +
  31.104 +typedef struct {
  31.105 +  CARD32 flags B32;
  31.106 +  INT32 min B32;
  31.107 +  INT32 max B32;
  31.108 +  CARD32 size  B32;
  31.109 +} xvAttributeInfo;
  31.110 +#define sz_xvAttributeInfo 16
  31.111 +
  31.112 +typedef struct {
  31.113 +  CARD32 id B32;
  31.114 +  CARD8 type;
  31.115 +  CARD8 byte_order;
  31.116 +  CARD16 pad1 B16;
  31.117 +  CARD8 guid[16];
  31.118 +  CARD8 bpp;
  31.119 +  CARD8 num_planes;
  31.120 +  CARD16 pad2 B16;
  31.121 +  CARD8 depth;
  31.122 +  CARD8 pad3;
  31.123 +  CARD16 pad4 B16;
  31.124 +  CARD32 red_mask B32;
  31.125 +  CARD32 green_mask B32;
  31.126 +  CARD32 blue_mask B32;
  31.127 +  CARD8 format;
  31.128 +  CARD8 pad5;
  31.129 +  CARD16 pad6 B16;
  31.130 +  CARD32 y_sample_bits B32;
  31.131 +  CARD32 u_sample_bits B32;
  31.132 +  CARD32 v_sample_bits B32;   
  31.133 +  CARD32 horz_y_period B32;
  31.134 +  CARD32 horz_u_period B32;
  31.135 +  CARD32 horz_v_period B32;
  31.136 +  CARD32 vert_y_period B32;
  31.137 +  CARD32 vert_u_period B32;
  31.138 +  CARD32 vert_v_period B32;
  31.139 +  CARD8 comp_order[32];
  31.140 +  CARD8 scanline_order;
  31.141 +  CARD8 pad7;
  31.142 +  CARD16 pad8 B16;
  31.143 +  CARD32 pad9 B32;
  31.144 +  CARD32 pad10 B32;
  31.145 +} xvImageFormatInfo;
  31.146 +#define sz_xvImageFormatInfo 128
  31.147 +
  31.148 +
  31.149 +/* Requests */
  31.150 +
  31.151 +#define xv_QueryExtension                  0
  31.152 +#define	xv_QueryAdaptors                   1
  31.153 +#define	xv_QueryEncodings                  2
  31.154 +#define xv_GrabPort                        3
  31.155 +#define xv_UngrabPort                      4
  31.156 +#define xv_PutVideo                        5
  31.157 +#define xv_PutStill                        6
  31.158 +#define xv_GetVideo                        7
  31.159 +#define xv_GetStill                        8
  31.160 +#define xv_StopVideo                       9
  31.161 +#define xv_SelectVideoNotify              10
  31.162 +#define xv_SelectPortNotify               11
  31.163 +#define xv_QueryBestSize                  12
  31.164 +#define xv_SetPortAttribute               13
  31.165 +#define xv_GetPortAttribute               14
  31.166 +#define xv_QueryPortAttributes            15
  31.167 +#define xv_ListImageFormats               16
  31.168 +#define xv_QueryImageAttributes           17
  31.169 +#define xv_PutImage                       18
  31.170 +#define xv_ShmPutImage                    19
  31.171 +#define xv_LastRequest                    xv_ShmPutImage
  31.172 +
  31.173 +#define xvNumRequests                     (xv_LastRequest + 1)
  31.174 +
  31.175 +typedef struct {
  31.176 +  CARD8 reqType;
  31.177 +  CARD8 xvReqType;
  31.178 +  CARD16 length B16;
  31.179 +} xvQueryExtensionReq;
  31.180 +#define sz_xvQueryExtensionReq 4
  31.181 +
  31.182 +typedef struct {
  31.183 +  CARD8 reqType;
  31.184 +  CARD8 xvReqType;
  31.185 +  CARD16 length B16;
  31.186 +  CARD32 window B32;
  31.187 +} xvQueryAdaptorsReq;
  31.188 +#define sz_xvQueryAdaptorsReq 8
  31.189 +
  31.190 +typedef struct {
  31.191 +  CARD8 reqType;
  31.192 +  CARD8 xvReqType;
  31.193 +  CARD16 length B16;
  31.194 +  CARD32 port B32;
  31.195 +} xvQueryEncodingsReq;
  31.196 +#define sz_xvQueryEncodingsReq 8
  31.197 +
  31.198 +typedef struct {
  31.199 +  CARD8 reqType;
  31.200 +  CARD8 xvReqType;
  31.201 +  CARD16 length B16;
  31.202 +  XvPortID port B32;
  31.203 +  Drawable drawable B32;
  31.204 +  GContext gc B32;
  31.205 +  INT16 vid_x B16;
  31.206 +  INT16 vid_y B16;
  31.207 +  CARD16 vid_w B16;
  31.208 +  CARD16 vid_h B16;
  31.209 +  INT16 drw_x B16;
  31.210 +  INT16 drw_y B16;
  31.211 +  CARD16 drw_w B16;
  31.212 +  CARD16 drw_h B16;
  31.213 +} xvPutVideoReq;
  31.214 +#define sz_xvPutVideoReq 32
  31.215 +
  31.216 +typedef struct {
  31.217 +  CARD8 reqType;
  31.218 +  CARD8 xvReqType;
  31.219 +  CARD16 length B16;
  31.220 +  XvPortID port B32;
  31.221 +  Drawable drawable B32;
  31.222 +  GContext gc B32;
  31.223 +  INT16 vid_x B16;
  31.224 +  INT16 vid_y B16;
  31.225 +  CARD16 vid_w B16;
  31.226 +  CARD16 vid_h B16;
  31.227 +  INT16 drw_x B16;
  31.228 +  INT16 drw_y B16;
  31.229 +  CARD16 drw_w B16;
  31.230 +  CARD16 drw_h B16;
  31.231 +} xvPutStillReq;
  31.232 +#define sz_xvPutStillReq 32
  31.233 +
  31.234 +typedef struct {
  31.235 +  CARD8 reqType;
  31.236 +  CARD8 xvReqType;
  31.237 +  CARD16 length B16;
  31.238 +  XvPortID port B32;
  31.239 +  Drawable drawable B32;
  31.240 +  GContext gc B32;
  31.241 +  INT16 vid_x B16;
  31.242 +  INT16 vid_y B16;
  31.243 +  CARD16 vid_w B16;
  31.244 +  CARD16 vid_h B16;
  31.245 +  INT16 drw_x B16;
  31.246 +  INT16 drw_y B16;
  31.247 +  CARD16 drw_w B16;
  31.248 +  CARD16 drw_h B16;
  31.249 +} xvGetVideoReq;
  31.250 +#define sz_xvGetVideoReq 32
  31.251 +
  31.252 +typedef struct {
  31.253 +  CARD8 reqType;
  31.254 +  CARD8 xvReqType;
  31.255 +  CARD16 length B16;
  31.256 +  XvPortID port B32;
  31.257 +  Drawable drawable B32;
  31.258 +  GContext gc B32;
  31.259 +  INT16 vid_x B16;
  31.260 +  INT16 vid_y B16;
  31.261 +  CARD16 vid_w B16;
  31.262 +  CARD16 vid_h B16;
  31.263 +  INT16 drw_x B16;
  31.264 +  INT16 drw_y B16;
  31.265 +  CARD16 drw_w B16;
  31.266 +  CARD16 drw_h B16;
  31.267 +} xvGetStillReq;
  31.268 +#define sz_xvGetStillReq 32
  31.269 +
  31.270 +typedef struct {
  31.271 +  CARD8 reqType;
  31.272 +  CARD8 xvReqType;
  31.273 +  CARD16 length B16;
  31.274 +  XvPortID port B32;
  31.275 +  Time time B32;
  31.276 +} xvGrabPortReq;
  31.277 +#define sz_xvGrabPortReq 12
  31.278 +
  31.279 +typedef struct {
  31.280 +  CARD8 reqType;
  31.281 +  CARD8 xvReqType;
  31.282 +  CARD16 length B16;
  31.283 +  XvPortID port B32;
  31.284 +  Time time B32;
  31.285 +} xvUngrabPortReq;
  31.286 +#define sz_xvUngrabPortReq 12
  31.287 +
  31.288 +typedef struct {
  31.289 +  CARD8 reqType;
  31.290 +  CARD8 xvReqType;
  31.291 +  CARD16 length B16;
  31.292 +  Drawable drawable B32;
  31.293 +  BOOL onoff;
  31.294 +  CARD8 pad1;
  31.295 +  CARD16 pad2;
  31.296 +} xvSelectVideoNotifyReq;
  31.297 +#define sz_xvSelectVideoNotifyReq 12
  31.298 +
  31.299 +typedef struct {
  31.300 +  CARD8 reqType;
  31.301 +  CARD8 xvReqType;
  31.302 +  CARD16 length B16;
  31.303 +  XvPortID port B32;
  31.304 +  BOOL onoff;
  31.305 +  CARD8 pad1;
  31.306 +  CARD16 pad2;
  31.307 +} xvSelectPortNotifyReq;
  31.308 +#define sz_xvSelectPortNotifyReq 12
  31.309 +
  31.310 +typedef struct {
  31.311 +  CARD8 reqType;
  31.312 +  CARD8 xvReqType;
  31.313 +  CARD16 length B16;
  31.314 +  XvPortID port B32;
  31.315 +  Drawable drawable B32;
  31.316 +} xvStopVideoReq;
  31.317 +#define sz_xvStopVideoReq 12
  31.318 +
  31.319 +typedef struct {
  31.320 +  CARD8 reqType;
  31.321 +  CARD8 xvReqType;
  31.322 +  CARD16 length B16;
  31.323 +  XvPortID port B32;
  31.324 +  Atom attribute B32;
  31.325 +  INT32 value B32;
  31.326 +} xvSetPortAttributeReq;
  31.327 +#define sz_xvSetPortAttributeReq 16
  31.328 +
  31.329 +typedef struct {
  31.330 +  CARD8 reqType;
  31.331 +  CARD8 xvReqType;
  31.332 +  CARD16 length B16;
  31.333 +  XvPortID port B32;
  31.334 +  Atom attribute B32;
  31.335 +} xvGetPortAttributeReq;
  31.336 +#define sz_xvGetPortAttributeReq 12
  31.337 +
  31.338 +typedef struct {
  31.339 +  CARD8 reqType;
  31.340 +  CARD8 xvReqType;
  31.341 +  CARD16 length B16;
  31.342 +  XvPortID port B32;
  31.343 +  CARD16 vid_w B16;
  31.344 +  CARD16 vid_h B16;
  31.345 +  CARD16 drw_w B16;
  31.346 +  CARD16 drw_h B16;
  31.347 +  CARD8 motion;
  31.348 +  CARD8 pad1;
  31.349 +  CARD16 pad2 B16;
  31.350 +} xvQueryBestSizeReq;
  31.351 +#define sz_xvQueryBestSizeReq 20
  31.352 +
  31.353 +typedef struct {
  31.354 +  CARD8 reqType;
  31.355 +  CARD8 xvReqType;
  31.356 +  CARD16 length B16;
  31.357 +  XvPortID port B32;
  31.358 +} xvQueryPortAttributesReq;
  31.359 +#define sz_xvQueryPortAttributesReq 8
  31.360 +
  31.361 +typedef struct {
  31.362 +  CARD8 reqType;
  31.363 +  CARD8 xvReqType;
  31.364 +  CARD16 length B16;
  31.365 +  XvPortID port B32;
  31.366 +  Drawable drawable B32;
  31.367 +  GContext gc B32;
  31.368 +  CARD32 id B32;
  31.369 +  INT16 src_x B16;
  31.370 +  INT16 src_y B16;
  31.371 +  CARD16 src_w B16;
  31.372 +  CARD16 src_h B16;
  31.373 +  INT16 drw_x B16;
  31.374 +  INT16 drw_y B16;
  31.375 +  CARD16 drw_w B16;
  31.376 +  CARD16 drw_h B16;
  31.377 +  CARD16 width B16;
  31.378 +  CARD16 height B16;
  31.379 +} xvPutImageReq;
  31.380 +#define sz_xvPutImageReq 40
  31.381 +
  31.382 +typedef struct {
  31.383 +  CARD8 reqType;
  31.384 +  CARD8 xvReqType;
  31.385 +  CARD16 length B16;
  31.386 +  XvPortID port B32;
  31.387 +  Drawable drawable B32;
  31.388 +  GContext gc B32;
  31.389 +  ShmSeg shmseg B32;
  31.390 +  CARD32 id B32;
  31.391 +  CARD32 offset B32;
  31.392 +  INT16 src_x B16;
  31.393 +  INT16 src_y B16;
  31.394 +  CARD16 src_w B16;
  31.395 +  CARD16 src_h B16;
  31.396 +  INT16 drw_x B16;
  31.397 +  INT16 drw_y B16;
  31.398 +  CARD16 drw_w B16;
  31.399 +  CARD16 drw_h B16;
  31.400 +  CARD16 width B16;
  31.401 +  CARD16 height B16;
  31.402 +  CARD8 send_event;
  31.403 +  CARD8 pad1;
  31.404 +  CARD16 pad2 B16;
  31.405 +} xvShmPutImageReq;
  31.406 +#define sz_xvShmPutImageReq 52
  31.407 +
  31.408 +typedef struct {
  31.409 +  CARD8 reqType;
  31.410 +  CARD8 xvReqType;
  31.411 +  CARD16 length B16;
  31.412 +  XvPortID port B32;
  31.413 +} xvListImageFormatsReq;
  31.414 +#define sz_xvListImageFormatsReq 8
  31.415 +
  31.416 +typedef struct {
  31.417 +  CARD8 reqType;
  31.418 +  CARD8 xvReqType;
  31.419 +  CARD16 length B16;
  31.420 +  CARD32 port B32;
  31.421 +  CARD32 id B32;
  31.422 +  CARD16 width B16;
  31.423 +  CARD16 height B16;
  31.424 +} xvQueryImageAttributesReq;
  31.425 +#define sz_xvQueryImageAttributesReq 16
  31.426 +
  31.427 +
  31.428 +/* Replies */
  31.429 +
  31.430 +typedef struct _QueryExtensionReply {
  31.431 +  BYTE type;   /* X_Reply */
  31.432 +  CARD8 padb1;
  31.433 +  CARD16 sequenceNumber B16;
  31.434 +  CARD32 length B32;
  31.435 +  CARD16 version B16;
  31.436 +  CARD16 revision B16;
  31.437 +  CARD32 padl4 B32;
  31.438 +  CARD32 padl5 B32;
  31.439 +  CARD32 padl6 B32;
  31.440 +  CARD32 padl7 B32;
  31.441 +  CARD32 padl8 B32;
  31.442 +} xvQueryExtensionReply;
  31.443 +#define sz_xvQueryExtensionReply 32
  31.444 +
  31.445 +typedef struct _QueryAdaptorsReply {
  31.446 +  BYTE type;   /* X_Reply */
  31.447 +  CARD8 padb1;
  31.448 +  CARD16 sequenceNumber B16;
  31.449 +  CARD32 length B32;
  31.450 +  CARD16 num_adaptors B16;
  31.451 +  CARD16 pads3 B16;
  31.452 +  CARD32 padl4 B32;
  31.453 +  CARD32 padl5 B32;
  31.454 +  CARD32 padl6 B32;
  31.455 +  CARD32 padl7 B32;
  31.456 +  CARD32 padl8 B32;
  31.457 +} xvQueryAdaptorsReply;
  31.458 +#define sz_xvQueryAdaptorsReply 32
  31.459 +
  31.460 +typedef struct _QueryEncodingsReply {
  31.461 +  BYTE type;   /* X_Reply */
  31.462 +  CARD8 padb1;
  31.463 +  CARD16 sequenceNumber B16;
  31.464 +  CARD32 length B32;
  31.465 +  CARD16 num_encodings B16;
  31.466 +  CARD32 padl3 B32;
  31.467 +  CARD32 padl4 B32;
  31.468 +  CARD32 padl5 B32;
  31.469 +  CARD32 padl6 B32;
  31.470 +  CARD32 padl7 B32;
  31.471 +  CARD32 padl8 B32;
  31.472 +} xvQueryEncodingsReply;
  31.473 +#define sz_xvQueryEncodingsReply 32
  31.474 +
  31.475 +typedef struct {
  31.476 +  BYTE type;  /* X_Reply */
  31.477 +  BYTE result;
  31.478 +  CARD16 sequenceNumber B16;
  31.479 +  CARD32 length B32;  /* 0 */
  31.480 +  CARD32 padl3 B32;
  31.481 +  CARD32 padl4 B32;
  31.482 +  CARD32 padl5 B32;
  31.483 +  CARD32 padl6 B32;
  31.484 +  CARD32 padl7 B32;
  31.485 +  CARD32 padl8 B32;
  31.486 +} xvGrabPortReply;
  31.487 +#define sz_xvGrabPortReply 32
  31.488 +
  31.489 +typedef struct {
  31.490 +  BYTE type;  /* X_Reply */
  31.491 +  BYTE padb1;
  31.492 +  CARD16 sequenceNumber B16;
  31.493 +  CARD32 length B32;  /* 0 */
  31.494 +  INT32 value B32;
  31.495 +  CARD32 padl4 B32;
  31.496 +  CARD32 padl5 B32;
  31.497 +  CARD32 padl6 B32;
  31.498 +  CARD32 padl7 B32;
  31.499 +  CARD32 padl8 B32;
  31.500 +} xvGetPortAttributeReply;
  31.501 +#define sz_xvGetPortAttributeReply 32
  31.502 +
  31.503 +typedef struct {
  31.504 +  BYTE type;  /* X_Reply */
  31.505 +  BYTE padb1;
  31.506 +  CARD16 sequenceNumber B16;
  31.507 +  CARD32 length B32;  /* 0 */
  31.508 +  CARD16 actual_width B16;
  31.509 +  CARD16 actual_height B16;
  31.510 +  CARD32 padl4 B32;
  31.511 +  CARD32 padl5 B32;
  31.512 +  CARD32 padl6 B32;
  31.513 +  CARD32 padl7 B32;
  31.514 +  CARD32 padl8 B32;
  31.515 +} xvQueryBestSizeReply;
  31.516 +#define sz_xvQueryBestSizeReply 32
  31.517 +
  31.518 +typedef struct {
  31.519 +  BYTE type;  /* X_Reply */
  31.520 +  BYTE padb1;
  31.521 +  CARD16 sequenceNumber B16;
  31.522 +  CARD32 length B32;  /* 0 */
  31.523 +  CARD32 num_attributes B32; 
  31.524 +  CARD32 text_size B32;
  31.525 +  CARD32 padl5 B32;
  31.526 +  CARD32 padl6 B32;
  31.527 +  CARD32 padl7 B32;
  31.528 +  CARD32 padl8 B32;
  31.529 +} xvQueryPortAttributesReply;
  31.530 +#define sz_xvQueryPortAttributesReply 32
  31.531 +
  31.532 +typedef struct {
  31.533 +  BYTE type;  /* X_Reply */
  31.534 +  BYTE padb1;
  31.535 +  CARD16 sequenceNumber B16;
  31.536 +  CARD32 length B32;
  31.537 +  CARD32 num_formats B32; 
  31.538 +  CARD32 padl4 B32;
  31.539 +  CARD32 padl5 B32;
  31.540 +  CARD32 padl6 B32;
  31.541 +  CARD32 padl7 B32;
  31.542 +  CARD32 padl8 B32;
  31.543 +} xvListImageFormatsReply;
  31.544 +#define sz_xvListImageFormatsReply 32
  31.545 +
  31.546 +typedef struct {
  31.547 +  BYTE type;  /* X_Reply */
  31.548 +  BYTE padb1;
  31.549 +  CARD16 sequenceNumber B16;
  31.550 +  CARD32 length B32; 
  31.551 +  CARD32 num_planes B32; 
  31.552 +  CARD32 data_size B32;
  31.553 +  CARD16 width B16;
  31.554 +  CARD16 height B16;
  31.555 +  CARD32 padl6 B32;
  31.556 +  CARD32 padl7 B32;
  31.557 +  CARD32 padl8 B32;
  31.558 +} xvQueryImageAttributesReply;
  31.559 +#define sz_xvQueryImageAttributesReply 32
  31.560 +
  31.561 +/* DEFINE EVENT STRUCTURE */
  31.562 +
  31.563 +typedef struct {
  31.564 +  union {
  31.565 +    struct {
  31.566 +      BYTE type;
  31.567 +      BYTE detail;
  31.568 +      CARD16 sequenceNumber B16;
  31.569 +    } u;
  31.570 +    struct {
  31.571 +      BYTE type;
  31.572 +      BYTE reason;
  31.573 +      CARD16 sequenceNumber B16;
  31.574 +      Time time B32;
  31.575 +      Drawable drawable B32;
  31.576 +      XvPortID port B32;
  31.577 +      CARD32 padl5 B32;
  31.578 +      CARD32 padl6 B32;
  31.579 +      CARD32 padl7 B32;
  31.580 +      CARD32 padl8 B32;
  31.581 +    } videoNotify;
  31.582 +    struct {
  31.583 +      BYTE type;
  31.584 +      BYTE padb1;
  31.585 +      CARD16 sequenceNumber B16;
  31.586 +      Time time B32;
  31.587 +      XvPortID port B32;
  31.588 +      Atom attribute B32;
  31.589 +      INT32 value B32;
  31.590 +      CARD32 padl6 B32;
  31.591 +      CARD32 padl7 B32;
  31.592 +      CARD32 padl8 B32;
  31.593 +    } portNotify;
  31.594 +  } u;
  31.595 +} xvEvent;
  31.596 +
  31.597 +#undef XvPortID
  31.598 +#undef XvEncodingID
  31.599 +#undef ShmSeg
  31.600 +#undef VisualID
  31.601 +#undef Drawable
  31.602 +#undef GContext
  31.603 +#undef Time
  31.604 +#undef Atom
  31.605 +
  31.606 +#endif /* XVPROTO_H */
  31.607 +
    32.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    32.2 +++ b/src/video/Xext/extensions/extutil.h	Tue Mar 05 19:55:32 2002 +0000
    32.3 @@ -0,0 +1,224 @@
    32.4 +/*
    32.5 + * $Xorg: extutil.h,v 1.4 2001/02/09 02:03:24 xorgcvs Exp $
    32.6 + *
    32.7 +Copyright 1989, 1998  The Open Group
    32.8 +
    32.9 +Permission to use, copy, modify, distribute, and sell this software and its
   32.10 +documentation for any purpose is hereby granted without fee, provided that
   32.11 +the above copyright notice appear in all copies and that both that
   32.12 +copyright notice and this permission notice appear in supporting
   32.13 +documentation.
   32.14 +
   32.15 +The above copyright notice and this permission notice shall be included in
   32.16 +all copies or substantial portions of the Software.
   32.17 +
   32.18 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
   32.19 +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
   32.20 +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
   32.21 +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
   32.22 +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
   32.23 +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
   32.24 +
   32.25 +Except as contained in this notice, the name of The Open Group shall not be
   32.26 +used in advertising or otherwise to promote the sale, use or other dealings
   32.27 +in this Software without prior written authorization from The Open Group.
   32.28 + *
   32.29 + * Author:  Jim Fulton, MIT The Open Group
   32.30 + * 
   32.31 + *                     Xlib Extension-Writing Utilities
   32.32 + *
   32.33 + * This package contains utilities for writing the client API for various
   32.34 + * protocol extensions.  THESE INTERFACES ARE NOT PART OF THE X STANDARD AND
   32.35 + * ARE SUBJECT TO CHANGE!
   32.36 + */
   32.37 +/* $XFree86: xc/include/extensions/extutil.h,v 1.9 2001/12/14 19:53:28 dawes Exp $ */
   32.38 +
   32.39 +#ifndef _EXTUTIL_H_
   32.40 +#define _EXTUTIL_H_
   32.41 +
   32.42 +#include <X11/extensions/Xext.h>
   32.43 +
   32.44 +/*
   32.45 + * We need to keep a list of open displays since the Xlib display list isn't
   32.46 + * public.  We also have to per-display info in a separate block since it isn't
   32.47 + * stored directly in the Display structure.
   32.48 + */
   32.49 +typedef struct _XExtDisplayInfo {
   32.50 +    struct _XExtDisplayInfo *next;	/* keep a linked list */
   32.51 +    Display *display;			/* which display this is */
   32.52 +    XExtCodes *codes;			/* the extension protocol codes */
   32.53 +    XPointer data;			/* extra data for extension to use */
   32.54 +} XExtDisplayInfo;
   32.55 +
   32.56 +typedef struct _XExtensionInfo {
   32.57 +    XExtDisplayInfo *head;		/* start of list */
   32.58 +    XExtDisplayInfo *cur;		/* most recently used */
   32.59 +    int ndisplays;			/* number of displays */
   32.60 +} XExtensionInfo;
   32.61 +
   32.62 +typedef struct _XExtensionHooks {
   32.63 +    int (*create_gc)(
   32.64 +#if NeedNestedPrototypes
   32.65 +	      Display*			/* display */,
   32.66 +	      GC			/* gc */,
   32.67 +	      XExtCodes*		/* codes */
   32.68 +#endif
   32.69 +);
   32.70 +    int (*copy_gc)(
   32.71 +#if NeedNestedPrototypes
   32.72 +	      Display*			/* display */,
   32.73 +              GC			/* gc */,
   32.74 +              XExtCodes*		/* codes */
   32.75 +#endif
   32.76 +);
   32.77 +    int (*flush_gc)(
   32.78 +#if NeedNestedPrototypes
   32.79 +	      Display*			/* display */,
   32.80 +              GC			/* gc */,
   32.81 +              XExtCodes*		/* codes */
   32.82 +#endif
   32.83 +);
   32.84 +    int (*free_gc)(
   32.85 +#if NeedNestedPrototypes
   32.86 +	      Display*			/* display */,
   32.87 +              GC			/* gc */,
   32.88 +              XExtCodes*		/* codes */
   32.89 +#endif
   32.90 +);
   32.91 +    int (*create_font)(
   32.92 +#if NeedNestedPrototypes
   32.93 +	      Display*			/* display */,
   32.94 +              XFontStruct*		/* fs */,
   32.95 +              XExtCodes*		/* codes */
   32.96 +#endif
   32.97 +);
   32.98 +    int (*free_font)(
   32.99 +#if NeedNestedPrototypes
  32.100 +	      Display*			/* display */,
  32.101 +              XFontStruct*		/* fs */,
  32.102 +              XExtCodes*		/* codes */
  32.103 +#endif
  32.104 +);
  32.105 +    int (*close_display)(
  32.106 +#if NeedNestedPrototypes
  32.107 +	      Display*			/* display */,
  32.108 +              XExtCodes*		/* codes */
  32.109 +#endif
  32.110 +);
  32.111 +    Bool (*wire_to_event)(
  32.112 +#if NeedNestedPrototypes
  32.113 +	       Display*			/* display */,
  32.114 +               XEvent*			/* re */,
  32.115 +               xEvent*			/* event */
  32.116 +#endif
  32.117 +);
  32.118 +    Status (*event_to_wire)(
  32.119 +#if NeedNestedPrototypes
  32.120 +	      Display*			/* display */,
  32.121 +              XEvent*			/* re */,
  32.122 +              xEvent*			/* event */
  32.123 +#endif
  32.124 +);
  32.125 +    int (*error)(
  32.126 +#if NeedNestedPrototypes
  32.127 +	      Display*			/* display */,
  32.128 +              xError*			/* err */,
  32.129 +              XExtCodes*		/* codes */,
  32.130 +              int*			/* ret_code */
  32.131 +#endif
  32.132 +);
  32.133 +    char *(*error_string)(
  32.134 +#if NeedNestedPrototypes
  32.135 +	        Display*		/* display */,
  32.136 +                int			/* code */,
  32.137 +                XExtCodes*		/* codes */,
  32.138 +                char*			/* buffer */,
  32.139 +                int			/* nbytes */
  32.140 +#endif
  32.141 +);
  32.142 +} XExtensionHooks;
  32.143 +
  32.144 +extern XExtensionInfo *XextCreateExtension(
  32.145 +#if NeedFunctionPrototypes
  32.146 +    void
  32.147 +#endif
  32.148 +);
  32.149 +extern void XextDestroyExtension(
  32.150 +#if NeedFunctionPrototypes
  32.151 +    XExtensionInfo*	/* info */
  32.152 +#endif
  32.153 +);
  32.154 +extern XExtDisplayInfo *XextAddDisplay(
  32.155 +#if NeedFunctionPrototypes
  32.156 +    XExtensionInfo*	/* extinfo */,
  32.157 +    Display*		/* dpy */,
  32.158 +    char*		/* ext_name */,
  32.159 +    XExtensionHooks*	/* hooks */,
  32.160 +    int			/* nevents */,
  32.161 +    XPointer		/* data */
  32.162 +#endif
  32.163 +);
  32.164 +extern int XextRemoveDisplay(
  32.165 +#if NeedFunctionPrototypes
  32.166 +    XExtensionInfo*	/* extinfo */,
  32.167 +    Display*		/* dpy */
  32.168 +#endif
  32.169 +);
  32.170 +extern XExtDisplayInfo *XextFindDisplay(
  32.171 +#if NeedFunctionPrototypes
  32.172 +    XExtensionInfo*	/* extinfo */,
  32.173 +    Display*		/* dpy */
  32.174 +#endif
  32.175 +);
  32.176 +
  32.177 +#define XextHasExtension(i) ((i) && ((i)->codes))
  32.178 +#define XextCheckExtension(dpy,i,name,val) \
  32.179 +  if (!XextHasExtension(i)) { XMissingExtension (dpy, name); return val; }
  32.180 +#define XextSimpleCheckExtension(dpy,i,name) \
  32.181 +  if (!XextHasExtension(i)) { XMissingExtension (dpy, name); return; }
  32.182 +
  32.183 +
  32.184 +/*
  32.185 + * helper macros to generate code that is common to all extensions; caller
  32.186 + * should prefix it with static if extension source is in one file; this
  32.187 + * could be a utility function, but have to stack 6 unused arguments for 
  32.188 + * something that is called many, many times would be bad.
  32.189 + */
  32.190 +#define XEXT_GENERATE_FIND_DISPLAY(proc,extinfo,extname,hooks,nev,data) \
  32.191 +XExtDisplayInfo *proc (Display *dpy) \
  32.192 +{ \
  32.193 +    XExtDisplayInfo *dpyinfo; \
  32.194 +    if (!extinfo) { if (!(extinfo = XextCreateExtension())) return NULL; } \
  32.195 +    if (!(dpyinfo = XextFindDisplay (extinfo, dpy))) \
  32.196 +      dpyinfo = XextAddDisplay (extinfo,dpy,extname,hooks,nev,data); \
  32.197 +    return dpyinfo; \
  32.198 +}
  32.199 +
  32.200 +#define XEXT_FIND_DISPLAY_PROTO(proc) \
  32.201 +	XExtDisplayInfo *proc(Display *dpy)
  32.202 +
  32.203 +#define XEXT_GENERATE_CLOSE_DISPLAY(proc,extinfo) \
  32.204 +int proc (Display *dpy, XExtCodes *codes) \
  32.205 +{ \
  32.206 +    return XextRemoveDisplay (extinfo, dpy); \
  32.207 +}
  32.208 +
  32.209 +#define XEXT_CLOSE_DISPLAY_PROTO(proc) \
  32.210 +	int proc(Display *dpy, XExtCodes *codes)
  32.211 +
  32.212 +#define XEXT_GENERATE_ERROR_STRING(proc,extname,nerr,errl) \
  32.213 +char *proc (Display *dpy, int code, XExtCodes *codes, char *buf, int n) \
  32.214 +{  \
  32.215 +    code -= codes->first_error;  \
  32.216 +    if (code >= 0 && code < nerr) { \
  32.217 +	char tmp[256]; \
  32.218 +	sprintf (tmp, "%s.%d", extname, code); \
  32.219 +	XGetErrorDatabaseText (dpy, "XProtoError", tmp, errl[code], buf, n); \
  32.220 +	return buf; \
  32.221 +    } \
  32.222 +    return (char *)0; \
  32.223 +}
  32.224 +
  32.225 +#define XEXT_ERROR_STRING_PROTO(proc) \
  32.226 +	char *proc(Display *dpy, int code, XExtCodes *codes, char *buf, int n)
  32.227 +#endif
    33.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    33.2 +++ b/src/video/Xext/extensions/panoramiXext.h	Tue Mar 05 19:55:32 2002 +0000
    33.3 @@ -0,0 +1,52 @@
    33.4 +/* $Xorg: panoramiXext.h,v 1.4 2000/08/18 04:05:45 coskrey Exp $ */
    33.5 +/*****************************************************************
    33.6 +Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts.
    33.7 +Permission is hereby granted, free of charge, to any person obtaining a copy
    33.8 +of this software and associated documentation files (the "Software"), to deal
    33.9 +in the Software without restriction, including without limitation the rights
   33.10 +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
   33.11 +copies of the Software.
   33.12 +
   33.13 +The above copyright notice and this permission notice shall be included in
   33.14 +all copies or substantial portions of the Software.
   33.15 +
   33.16 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
   33.17 +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
   33.18 +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
   33.19 +DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING,
   33.20 +BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY,
   33.21 +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
   33.22 +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
   33.23 +
   33.24 +Except as contained in this notice, the name of Digital Equipment Corporation
   33.25 +shall not be used in advertising or otherwise to promote the sale, use or other
   33.26 +dealings in this Software without prior written authorization from Digital
   33.27 +Equipment Corporation.
   33.28 +******************************************************************/
   33.29 +/*  
   33.30 + *	PanoramiX definitions
   33.31 + */
   33.32 +/* $XFree86: xc/include/extensions/panoramiXext.h,v 3.6 2001/01/17 17:53:22 dawes Exp $ */
   33.33 +
   33.34 +#include "SDLname.h"
   33.35 +
   33.36 +/* THIS IS NOT AN X PROJECT TEAM SPECIFICATION */
   33.37 +
   33.38 +#define PANORAMIX_MAJOR_VERSION         1       /* current version number */
   33.39 +#define PANORAMIX_MINOR_VERSION         1
   33.40 +
   33.41 +typedef struct {
   33.42 +    Window  window;         /* PanoramiX window - may not exist */
   33.43 +    int	    screen;
   33.44 +    int     State;          /* PanroamiXOff, PanoramiXOn */
   33.45 +    int	    width;	    /* width of this screen */
   33.46 +    int     height;	    /* height of this screen */
   33.47 +    int     ScreenCount;    /* real physical number of screens */
   33.48 +    XID     eventMask;      /* selected events for this client */
   33.49 +} SDL_NAME(XPanoramiXInfo);    
   33.50 +
   33.51 +extern SDL_NAME(XPanoramiXInfo) *SDL_NAME(XPanoramiXAllocInfo) (
   33.52 +#if NeedFunctionPrototypes
   33.53 +    void
   33.54 +#endif
   33.55 +);        
    34.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    34.2 +++ b/src/video/Xext/extensions/panoramiXproto.h	Tue Mar 05 19:55:32 2002 +0000
    34.3 @@ -0,0 +1,192 @@
    34.4 +/* $Xorg: panoramiXproto.h,v 1.4 2000/08/18 04:05:45 coskrey Exp $ */
    34.5 +/*****************************************************************
    34.6 +Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts.
    34.7 +Permission is hereby granted, free of charge, to any person obtaining a copy
    34.8 +of this software and associated documentation files (the "Software"), to deal
    34.9 +in the Software without restriction, including without limitation the rights
   34.10 +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
   34.11 +copies of the Software.
   34.12 +
   34.13 +The above copyright notice and this permission notice shall be included in
   34.14 +all copies or substantial portions of the Software.
   34.15 +
   34.16 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
   34.17 +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
   34.18 +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
   34.19 +DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING,
   34.20 +BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY,
   34.21 +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
   34.22 +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
   34.23 +
   34.24 +Except as contained in this notice, the name of Digital Equipment Corporation
   34.25 +shall not be used in advertising or otherwise to promote the sale, use or other
   34.26 +dealings in this Software without prior written authorization from Digital
   34.27 +Equipment Corporation.
   34.28 +******************************************************************/
   34.29 +/* $XFree86: xc/include/extensions/panoramiXproto.h,v 3.6 2001/01/17 17:53:22 dawes Exp $ */
   34.30 +
   34.31 +/* THIS IS NOT AN X PROJECT TEAM SPECIFICATION */
   34.32 +
   34.33 +#ifndef _PANORAMIXPROTO_H_
   34.34 +#define _PANORAMIXPROTO_H_
   34.35 +
   34.36 +#define PANORAMIX_PROTOCOL_NAME "XINERAMA"
   34.37 +
   34.38 +#define X_PanoramiXQueryVersion		0
   34.39 +#define X_PanoramiXGetState		1
   34.40 +#define X_PanoramiXGetScreenCount	2
   34.41 +#define X_PanoramiXGetScreenSize	3
   34.42 +
   34.43 +#define X_XineramaIsActive		4
   34.44 +#define X_XineramaQueryScreens		5
   34.45 +
   34.46 +typedef struct _PanoramiXQueryVersion {
   34.47 +	CARD8	reqType;		/* always PanoramiXReqCode */
   34.48 +	CARD8	panoramiXReqType;	/* always X_PanoramiXQueryVersion */
   34.49 +	CARD16	length B16;
   34.50 +	CARD8	clientMajor;
   34.51 +	CARD8	clientMinor;
   34.52 +	CARD16	unused B16;           
   34.53 +} xPanoramiXQueryVersionReq;
   34.54 +
   34.55 +#define sz_xPanoramiXQueryVersionReq	8
   34.56 +
   34.57 +typedef struct {
   34.58 +	CARD8	type;			/* must be X_Reply */
   34.59 +	CARD8	pad1;			/* unused	*/
   34.60 +	CARD16	sequenceNumber  B16;	/* last sequence number */
   34.61 +	CARD32	length  B32;		/* 0 */
   34.62 +	CARD16	majorVersion  B16;	
   34.63 +	CARD16	minorVersion  B16;	
   34.64 +	CARD32	pad2	B32;		/* unused */
   34.65 +	CARD32	pad3	B32;		/* unused */
   34.66 +	CARD32	pad4	B32;		/* unused */
   34.67 +	CARD32	pad5	B32;		/* unused */
   34.68 +	CARD32	pad6	B32;		/* unused */
   34.69 +} xPanoramiXQueryVersionReply;
   34.70 +
   34.71 +#define sz_xPanoramiXQueryVersionReply	32
   34.72 +
   34.73 +
   34.74 +typedef	struct	_PanoramiXGetState {
   34.75 +        CARD8   reqType;	        /* always PanoramiXReqCode */
   34.76 +        CARD8   panoramiXReqType;    	/* always X_PanoramiXGetState */
   34.77 +        CARD16  length B16;
   34.78 +	CARD32  window B32;
   34.79 +} xPanoramiXGetStateReq;
   34.80 +#define sz_xPanoramiXGetStateReq	8	
   34.81 +
   34.82 +typedef struct {
   34.83 +	BYTE	type;
   34.84 +	BYTE	state;
   34.85 +	CARD16	sequenceNumber B16;
   34.86 +	CARD32	length	B32;
   34.87 +	CARD32  window  B32;
   34.88 +	CARD32	pad1	B32;		/* unused */
   34.89 +	CARD32	pad2	B32;		/* unused */
   34.90 +	CARD32	pad3	B32;		/* unused */
   34.91 +	CARD32	pad4	B32;		/* unused */
   34.92 +	CARD32	pad5	B32;		/* unused */
   34.93 +} xPanoramiXGetStateReply;
   34.94 +
   34.95 +#define sz_panoramiXGetStateReply	32
   34.96 +
   34.97 +typedef	struct	_PanoramiXGetScreenCount {
   34.98 +        CARD8   reqType;             /* always PanoramiXReqCode */
   34.99 +        CARD8   panoramiXReqType;    /* always X_PanoramiXGetScreenCount */
  34.100 +        CARD16  length B16;
  34.101 +	CARD32  window B32;
  34.102 +} xPanoramiXGetScreenCountReq;
  34.103 +#define sz_xPanoramiXGetScreenCountReq	8
  34.104 +
  34.105 +typedef struct {
  34.106 +	BYTE	type;
  34.107 +	BYTE	ScreenCount;
  34.108 +	CARD16	sequenceNumber B16;
  34.109 +	CARD32	length B32;
  34.110 +	CARD32  window  B32;
  34.111 +	CARD32	pad1	B32;		/* unused */
  34.112 +	CARD32	pad2	B32;		/* unused */
  34.113 +	CARD32	pad3	B32;		/* unused */
  34.114 +	CARD32	pad4	B32;		/* unused */
  34.115 +	CARD32	pad5	B32;		/* unused */
  34.116 +} xPanoramiXGetScreenCountReply;
  34.117 +#define sz_panoramiXGetScreenCountReply	32
  34.118 +
  34.119 +typedef	struct	_PanoramiXGetScreenSize {
  34.120 +        CARD8   reqType;                /* always PanoramiXReqCode */
  34.121 +        CARD8   panoramiXReqType;	/* always X_PanoramiXGetState */
  34.122 +        CARD16  length B16;
  34.123 +	CARD32  window B32;
  34.124 +	CARD32	screen B32;
  34.125 +} xPanoramiXGetScreenSizeReq;
  34.126 +#define sz_xPanoramiXGetScreenSizeReq	12	
  34.127 +
  34.128 +typedef struct {
  34.129 +	BYTE	type;
  34.130 +	CARD8	pad1;			
  34.131 +	CARD16	sequenceNumber B16;
  34.132 +	CARD32	length	B32;
  34.133 +	CARD32	width	B32;
  34.134 +	CARD32	height	B32;
  34.135 +	CARD32  window  B32;
  34.136 +	CARD32  screen  B32;
  34.137 +	CARD32	pad2	B32;		/* unused */
  34.138 +	CARD32	pad3	B32;		/* unused */
  34.139 +} xPanoramiXGetScreenSizeReply;
  34.140 +#define sz_panoramiXGetScreenSizeReply 32	
  34.141 +
  34.142 +/************  Alternate protocol  ******************/
  34.143 +
  34.144 +typedef struct {
  34.145 +        CARD8   reqType;
  34.146 +        CARD8   panoramiXReqType;
  34.147 +        CARD16  length B16;
  34.148 +} xXineramaIsActiveReq;
  34.149 +#define sz_xXineramaIsActiveReq 4
  34.150 +
  34.151 +typedef struct {
  34.152 +	BYTE	type;
  34.153 +	CARD8	pad1;			
  34.154 +	CARD16	sequenceNumber B16;
  34.155 +	CARD32	length	B32;
  34.156 +	CARD32	state	B32;
  34.157 +	CARD32	pad2	B32;
  34.158 +	CARD32  pad3  	B32;
  34.159 +	CARD32  pad4  	B32;
  34.160 +	CARD32	pad5	B32;
  34.161 +	CARD32	pad6	B32;
  34.162 +} xXineramaIsActiveReply;
  34.163 +#define sz_XineramaIsActiveReply 32	
  34.164 +
  34.165 +
  34.166 +typedef struct {
  34.167 +        CARD8   reqType;
  34.168 +        CARD8   panoramiXReqType;
  34.169 +        CARD16  length B16;
  34.170 +} xXineramaQueryScreensReq;
  34.171 +#define sz_xXineramaQueryScreensReq 4
  34.172 +
  34.173 +typedef struct {
  34.174 +	BYTE	type;
  34.175 +	CARD8	pad1;			
  34.176 +	CARD16	sequenceNumber B16;
  34.177 +	CARD32	length	B32;
  34.178 +	CARD32	number	B32;
  34.179 +	CARD32	pad2	B32;
  34.180 +	CARD32  pad3  	B32;
  34.181 +	CARD32  pad4  	B32;
  34.182 +	CARD32	pad5	B32;
  34.183 +	CARD32	pad6	B32;
  34.184 +} xXineramaQueryScreensReply;
  34.185 +#define sz_XineramaQueryScreensReply 32	
  34.186 +
  34.187 +typedef struct {
  34.188 +	INT16   x_org   B16;
  34.189 +	INT16   y_org   B16;
  34.190 +	CARD16  width   B16;
  34.191 +	CARD16  height  B16;
  34.192 +} xXineramaScreenInfo;
  34.193 +#define sz_XineramaScreenInfo 8
  34.194 +
  34.195 +#endif 
    35.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    35.2 +++ b/src/video/Xext/extensions/xf86dga.h	Tue Mar 05 19:55:32 2002 +0000
    35.3 @@ -0,0 +1,265 @@
    35.4 +/*
    35.5 +   Copyright (c) 1999  XFree86 Inc
    35.6 +*/
    35.7 +/* $XFree86: xc/include/extensions/xf86dga.h,v 3.21 2001/08/01 00:44:36 tsi Exp $ */
    35.8 +
    35.9 +#ifndef _XF86DGA_H_
   35.10 +#define _XF86DGA_H_
   35.11 +
   35.12 +#include <X11/Xfuncproto.h>
   35.13 +#include <XFree86/extensions/xf86dga1.h>
   35.14 +#include "SDLname.h"
   35.15 +
   35.16 +#define X_XDGAQueryVersion		0
   35.17 +
   35.18 +/* 1 through 9 are in xf86dga1.h */
   35.19 +
   35.20 +/* 10 and 11 are reserved to avoid conflicts with rogue DGA extensions */
   35.21 +
   35.22 +#define X_XDGAQueryModes		12
   35.23 +#define X_XDGASetMode			13
   35.24 +#define X_XDGASetViewport		14
   35.25 +#define X_XDGAInstallColormap		15
   35.26 +#define X_XDGASelectInput		16
   35.27 +#define X_XDGAFillRectangle		17
   35.28 +#define X_XDGACopyArea			18
   35.29 +#define X_XDGACopyTransparentArea	19
   35.30 +#define X_XDGAGetViewportStatus		20
   35.31 +#define X_XDGASync			21
   35.32 +#define X_XDGAOpenFramebuffer		22
   35.33 +#define X_XDGACloseFramebuffer		23
   35.34 +#define X_XDGASetClientVersion		24
   35.35 +#define X_XDGAChangePixmapMode		25
   35.36 +#define X_XDGACreateColormap		26
   35.37 +
   35.38 +
   35.39 +#define XDGAConcurrentAccess	0x00000001
   35.40 +#define XDGASolidFillRect	0x00000002
   35.41 +#define XDGABlitRect		0x00000004
   35.42 +#define XDGABlitTransRect	0x00000008
   35.43 +#define XDGAPixmap    		0x00000010
   35.44 +
   35.45 +#define XDGAInterlaced          0x00010000
   35.46 +#define XDGADoublescan          0x00020000
   35.47 +
   35.48 +#define XDGAFlipImmediate	0x00000001
   35.49 +#define XDGAFlipRetrace		0x00000002
   35.50 +
   35.51 +#define XDGANeedRoot		0x00000001
   35.52 +
   35.53 +#define XF86DGANumberEvents		7
   35.54 +
   35.55 +#define XDGAPixmapModeLarge		0
   35.56 +#define XDGAPixmapModeSmall		1
   35.57 +
   35.58 +#define XF86DGAClientNotLocal		0
   35.59 +#define XF86DGANoDirectVideoMode	1
   35.60 +#define XF86DGAScreenNotActive		2
   35.61 +#define XF86DGADirectNotActivated	3
   35.62 +#define XF86DGAOperationNotSupported	4
   35.63 +#define XF86DGANumberErrors		(XF86DGAOperationNotSupported + 1)
   35.64 +
   35.65 +
   35.66 +typedef struct {
   35.67 +   int num;		/* A unique identifier for the mode (num > 0) */
   35.68 +   char *name;		/* name of mode given in the XF86Config */
   35.69 +   float verticalRefresh;
   35.70 +   int flags;		/* DGA_CONCURRENT_ACCESS, etc... */
   35.71 +   int imageWidth;	/* linear accessible portion (pixels) */
   35.72 +   int imageHeight;
   35.73 +   int pixmapWidth;	/* Xlib accessible portion (pixels) */
   35.74 +   int pixmapHeight;	/* both fields ignored if no concurrent access */
   35.75 +   int bytesPerScanline; 
   35.76 +   int byteOrder;	/* MSBFirst, LSBFirst */
   35.77 +   int depth;		
   35.78 +   int bitsPerPixel;
   35.79 +   unsigned long redMask;
   35.80 +   unsigned long greenMask;
   35.81 +   unsigned long blueMask;
   35.82 +   short visualClass;
   35.83 +   int viewportWidth;
   35.84 +   int viewportHeight;
   35.85 +   int xViewportStep;	/* viewport position granularity */
   35.86 +   int yViewportStep;
   35.87 +   int maxViewportX;	/* max viewport origin */
   35.88 +   int maxViewportY;
   35.89 +   int viewportFlags;	/* types of page flipping possible */
   35.90 +   int reserved1;
   35.91 +   int reserved2;
   35.92 +} SDL_NAME(XDGAMode);
   35.93 +
   35.94 +
   35.95 +typedef struct {
   35.96 +   SDL_NAME(XDGAMode) mode;
   35.97 +   unsigned char *data;
   35.98 +   Pixmap pixmap;
   35.99 +} SDL_NAME(XDGADevice);
  35.100 +
  35.101 +
  35.102 +#ifndef _XF86DGA_SERVER_
  35.103 +_XFUNCPROTOBEGIN
  35.104 +
  35.105 +typedef struct {
  35.106 +   int type;
  35.107 +   unsigned long serial;
  35.108 +   Display *display;
  35.109 +   int screen;
  35.110 +   Time time;
  35.111 +   unsigned int state;
  35.112 +   unsigned int button;
  35.113 +} SDL_NAME(XDGAButtonEvent);
  35.114 +
  35.115 +typedef struct {
  35.116 +   int type;
  35.117 +   unsigned long serial;
  35.118 +   Display *display;
  35.119 +   int screen;
  35.120 +   Time time;
  35.121 +   unsigned int state;
  35.122 +   unsigned int keycode;
  35.123 +} SDL_NAME(XDGAKeyEvent);
  35.124 +
  35.125 +typedef struct {
  35.126 +   int type;
  35.127 +   unsigned long serial;
  35.128 +   Display *display;
  35.129 +   int screen;
  35.130 +   Time time;
  35.131 +   unsigned int state;
  35.132 +   int dx;
  35.133 +   int dy;
  35.134 +} SDL_NAME(XDGAMotionEvent);
  35.135 +
  35.136 +typedef union {
  35.137 +  int type;
  35.138 +  SDL_NAME(XDGAButtonEvent) xbutton;
  35.139 +  SDL_NAME(XDGAKeyEvent)	  xkey;
  35.140 +  SDL_NAME(XDGAMotionEvent) xmotion;
  35.141 +  long		  pad[24];
  35.142 +} SDL_NAME(XDGAEvent);
  35.143 +
  35.144 +Bool SDL_NAME(XDGAQueryExtension)(
  35.145 +    Display 	*dpy,
  35.146 +    int 	*eventBase,
  35.147 +    int 	*erroBase
  35.148 +);
  35.149 +
  35.150 +Bool SDL_NAME(XDGAQueryVersion)(
  35.151 +    Display 	*dpy,
  35.152 +    int 	*majorVersion,
  35.153 +    int 	*minorVersion
  35.154 +);
  35.155 +
  35.156 +SDL_NAME(XDGAMode)* SDL_NAME(XDGAQueryModes)(
  35.157 +    Display	*dpy,
  35.158 +    int 	screen,
  35.159 +    int		*num
  35.160 +);
  35.161 +
  35.162 +SDL_NAME(XDGADevice)* SDL_NAME(XDGASetMode)(
  35.163 +    Display	*dpy,
  35.164 +    int		screen,
  35.165 +    int		mode
  35.166 +);
  35.167 +
  35.168 +Bool SDL_NAME(XDGAOpenFramebuffer)(
  35.169 +    Display	*dpy,
  35.170 +    int 	screen
  35.171 +);
  35.172 +
  35.173 +void SDL_NAME(XDGACloseFramebuffer)(
  35.174 +    Display	*dpy,
  35.175 +    int		screen
  35.176 +);
  35.177 +
  35.178 +void SDL_NAME(XDGASetViewport)(
  35.179 +    Display	*dpy,
  35.180 +    int		screen,
  35.181 +    int		x,
  35.182 +    int		y,
  35.183 +    int		flags
  35.184 +);
  35.185 +
  35.186 +void SDL_NAME(XDGAInstallColormap)(
  35.187 +    Display	*dpy,
  35.188 +    int		screen,
  35.189 +    Colormap	cmap
  35.190 +);
  35.191 +
  35.192 +Colormap SDL_NAME(XDGACreateColormap)(
  35.193 +    Display	*dpy,
  35.194 +    int 	screen,
  35.195 +    SDL_NAME(XDGADevice)  *device,
  35.196 +    int 	alloc
  35.197 +);
  35.198 +
  35.199 +void SDL_NAME(XDGASelectInput)(
  35.200 +    Display	*dpy,
  35.201 +    int		screen,
  35.202 +    long	event_mask
  35.203 +);
  35.204 +
  35.205 +void SDL_NAME(XDGAFillRectangle)(
  35.206 +    Display	*dpy,
  35.207 +    int		screen,
  35.208 +    int		x,
  35.209 +    int		y,
  35.210 +    unsigned int	width,
  35.211 +    unsigned int	height,
  35.212 +    unsigned long	color
  35.213 +);
  35.214 +
  35.215 +
  35.216 +void SDL_NAME(XDGACopyArea)(
  35.217 +    Display	*dpy,
  35.218 +    int		screen,
  35.219 +    int		srcx,
  35.220 +    int		srcy,
  35.221 +    unsigned int	width,
  35.222 +    unsigned int	height,
  35.223 +    int		dstx,
  35.224 +    int		dsty
  35.225 +);
  35.226 +
  35.227 +
  35.228 +void SDL_NAME(XDGACopyTransparentArea)(
  35.229 +    Display	*dpy,
  35.230 +    int		screen,
  35.231 +    int		srcx,
  35.232 +    int		srcy,
  35.233 +    unsigned int	width,
  35.234 +    unsigned int	height,
  35.235 +    int		dstx,
  35.236 +    int		dsty,
  35.237 +    unsigned long key
  35.238 +);
  35.239 +
  35.240 +int SDL_NAME(XDGAGetViewportStatus)(
  35.241 +    Display	*dpy,
  35.242 +    int		screen
  35.243 +);
  35.244 +   
  35.245 +void SDL_NAME(XDGASync)(
  35.246 +    Display	*dpy,
  35.247 +    int		screen
  35.248 +);
  35.249 +
  35.250 +Bool SDL_NAME(XDGASetClientVersion)(
  35.251 +    Display	*dpy
  35.252 +);
  35.253 +
  35.254 +void SDL_NAME(XDGAChangePixmapMode)(
  35.255 +    Display 	*dpy,
  35.256 +    int		screen,
  35.257 +    int		*x,
  35.258 +    int		*y,
  35.259 +    int		mode
  35.260 +);
  35.261 +
  35.262 +
  35.263 +void SDL_NAME(XDGAKeyEventToXKeyEvent)(SDL_NAME(XDGAKeyEvent)* dk, XKeyEvent* xk);
  35.264 +
  35.265 +
  35.266 +_XFUNCPROTOEND
  35.267 +#endif /* _XF86DGA_SERVER_ */
  35.268 +#endif /* _XF86DGA_H_ */
    36.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    36.2 +++ b/src/video/Xext/extensions/xf86dga1.h	Tue Mar 05 19:55:32 2002 +0000
    36.3 @@ -0,0 +1,169 @@
    36.4 +/* $XFree86: xc/include/extensions/xf86dga1.h,v 1.2 1999/04/17 07:05:41 dawes Exp $ */
    36.5 +/*
    36.6 +
    36.7 +Copyright (c) 1995  Jon Tombs
    36.8 +Copyright (c) 1995  XFree86 Inc
    36.9 +
   36.10 +*/
   36.11 +
   36.12 +/************************************************************************
   36.13 +
   36.14 +   THIS IS THE OLD DGA API AND IS OBSOLETE.  PLEASE DO NOT USE IT ANYMORE
   36.15 +
   36.16 +************************************************************************/
   36.17 +
   36.18 +#ifndef _XF86DGA1_H_
   36.19 +#define _XF86DGA1_H_
   36.20 +
   36.21 +#include <X11/Xfuncproto.h>
   36.22 +#include "SDLname.h"
   36.23 +
   36.24 +#define X_XF86DGAQueryVersion		0
   36.25 +#define X_XF86DGAGetVideoLL		1
   36.26 +#define X_XF86DGADirectVideo		2
   36.27 +#define X_XF86DGAGetViewPortSize	3
   36.28 +#define X_XF86DGASetViewPort		4
   36.29 +#define X_XF86DGAGetVidPage		5
   36.30 +#define X_XF86DGASetVidPage		6
   36.31 +#define X_XF86DGAInstallColormap	7
   36.32 +#define X_XF86DGAQueryDirectVideo	8
   36.33 +#define X_XF86DGAViewPortChanged	9
   36.34 +
   36.35 +#define XF86DGADirectPresent		0x0001
   36.36 +#define XF86DGADirectGraphics		0x0002
   36.37 +#define XF86DGADirectMouse		0x0004
   36.38 +#define XF86DGADirectKeyb		0x0008
   36.39 +#define XF86DGAHasColormap		0x0100
   36.40 +#define XF86DGADirectColormap		0x0200
   36.41 +
   36.42 +
   36.43 +
   36.44 +
   36.45 +#ifndef _XF86DGA_SERVER_
   36.46 +
   36.47 +_XFUNCPROTOBEGIN
   36.48 +
   36.49 +Bool SDL_NAME(XF86DGAQueryVersion)(
   36.50 +#if NeedFunctionPrototypes
   36.51 +    Display*		/* dpy */,
   36.52 +    int*		/* majorVersion */,
   36.53 +    int*		/* minorVersion */
   36.54 +#endif
   36.55 +);
   36.56 +
   36.57 +Bool SDL_NAME(XF86DGAQueryExtension)(
   36.58 +#if NeedFunctionPrototypes
   36.59 +    Display*		/* dpy */,
   36.60 +    int*		/* event_base */,
   36.61 +    int*		/* error_base */
   36.62 +#endif
   36.63 +);
   36.64 +
   36.65 +Status SDL_NAME(XF86DGAGetVideoLL)(
   36.66 +#if NeedFunctionPrototypes
   36.67 +    Display*			/* dpy */,
   36.68 +    int				/* screen */,
   36.69 +    int *			/* base addr */,
   36.70 +    int *			/* width */,
   36.71 +    int *			/* bank_size */,
   36.72 +    int *			/* ram_size */ 
   36.73 +#endif
   36.74 +);
   36.75 +
   36.76 +Status SDL_NAME(XF86DGAGetVideo)(
   36.77 +#if NeedFunctionPrototypes
   36.78 +    Display*			/* dpy */,
   36.79 +    int				/* screen */,
   36.80 +    char **			/* base addr */,
   36.81 +    int *			/* width */,
   36.82 +    int *			/* bank_size */,
   36.83 +    int *			/* ram_size */
   36.84 +#endif
   36.85 +);
   36.86 +
   36.87 +Status SDL_NAME(XF86DGADirectVideo)(
   36.88 +#if NeedFunctionPrototypes
   36.89 +    Display*			/* dpy */,
   36.90 +    int				/* screen */,
   36.91 +    int 			/* enable */
   36.92 +#endif
   36.93 +);
   36.94 +
   36.95 +Status SDL_NAME(XF86DGADirectVideoLL)(
   36.96 +#if NeedFunctionPrototypes
   36.97 +    Display*			/* dpy */,
   36.98 +    int				/* screen */,
   36.99 +    int 			/* enable */
  36.100 +#endif
  36.101 +);
  36.102 +
  36.103 +Status SDL_NAME(XF86DGAGetViewPortSize)(
  36.104 +#if NeedFunctionPrototypes
  36.105 +    Display*			/* dpy */,
  36.106 +    int				/* screen */,
  36.107 +    int *			/* width */,
  36.108 +    int *			/* height */
  36.109 +#endif
  36.110 +);
  36.111 +
  36.112 +Status SDL_NAME(XF86DGASetViewPort)(
  36.113 +#if NeedFunctionPrototypes
  36.114 +    Display*			/* dpy */,
  36.115 +    int				/* screen */,
  36.116 +    int x			/* X */,
  36.117 +    int y			/* Y */
  36.118 +#endif
  36.119 +);
  36.120 +
  36.121 +Status SDL_NAME(XF86DGAGetVidPage)(
  36.122 +#if NeedFunctionPrototypes
  36.123 +    Display*			/* dpy */,
  36.124 +    int				/* screen */,
  36.125 +    int *			/* vid page */
  36.126 +#endif
  36.127 +);
  36.128 +
  36.129 +Status SDL_NAME(XF86DGASetVidPage)(
  36.130 +#if NeedFunctionPrototypes
  36.131 +    Display*			/* dpy */,
  36.132 +    int				/* screen */,
  36.133 +    int				/* vid page */
  36.134 +#endif
  36.135 +);
  36.136 +
  36.137 +Status SDL_NAME(XF86DGAInstallColormap)(
  36.138 +#if NeedFunctionPrototypes
  36.139 +    Display*			/* dpy */,
  36.140 +    int				/* screen */,
  36.141 +    Colormap			/*Colormap */
  36.142 +#endif
  36.143 +);
  36.144 +
  36.145 +int SDL_NAME(XF86DGAForkApp)(
  36.146 +#if NeedFunctionPrototypes
  36.147 +    int screen
  36.148 +#endif
  36.149 +);
  36.150 +
  36.151 +Status SDL_NAME(XF86DGAQueryDirectVideo)(
  36.152 +#if NeedFunctionPrototypes
  36.153 +    Display *		/* dpy */,
  36.154 +    int			/* screen */,
  36.155 +    int *		/* flags */
  36.156 +#endif
  36.157 +);
  36.158 +
  36.159 +Bool SDL_NAME(XF86DGAViewPortChanged)(
  36.160 +#if NeedFunctionPrototypes
  36.161 +    Display *		/* dpy */,
  36.162 +    int			/* screen */,
  36.163 +    int			/* n */
  36.164 +#endif
  36.165 +);
  36.166 +
  36.167 +
  36.168 +_XFUNCPROTOEND
  36.169 +
  36.170 +#endif /* _XF86DGA_SERVER_ */
  36.171 +
  36.172 +#endif /* _XF86DGA1_H_ */
    37.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    37.2 +++ b/src/video/Xext/extensions/xf86dga1str.h	Tue Mar 05 19:55:32 2002 +0000
    37.3 @@ -0,0 +1,194 @@
    37.4 +/* $XFree86: xc/include/extensions/xf86dga1str.h,v 1.2 1999/05/03 12:15:37 dawes Exp $ */
    37.5 +/*
    37.6 +
    37.7 +Copyright (c) 1995  Jon Tombs
    37.8 +Copyright (c) 1995  XFree86 Inc.
    37.9 +
   37.10 +*/
   37.11 +
   37.12 +#ifndef _XF86DGASTR1_H_
   37.13 +#define _XF86DGASTR1_H_
   37.14 +
   37.15 +typedef struct _XF86DGAQueryVersion {
   37.16 +    CARD8	reqType;		/* always DGAReqCode */
   37.17 +    CARD8	dgaReqType;		/* always X_DGAQueryVersion */
   37.18 +    CARD16	length B16;
   37.19 +} xXF86DGAQueryVersionReq;
   37.20 +#define sz_xXF86DGAQueryVersionReq	4
   37.21 +
   37.22 +typedef struct {
   37.23 +    BYTE	type;			/* X_Reply */
   37.24 +    BOOL	pad1;
   37.25 +    CARD16	sequenceNumber B16;
   37.26 +    CARD32	length B32;
   37.27 +    CARD16	majorVersion B16;	/* major version of DGA protocol */
   37.28 +    CARD16	minorVersion B16;	/* minor version of DGA protocol */
   37.29 +    CARD32	pad2 B32;
   37.30 +    CARD32	pad3 B32;
   37.31 +    CARD32	pad4 B32;
   37.32 +    CARD32	pad5 B32;
   37.33 +    CARD32	pad6 B32;
   37.34 +} xXF86DGAQueryVersionReply;
   37.35 +#define sz_xXF86DGAQueryVersionReply	32
   37.36 +
   37.37 +typedef struct _XF86DGAGetVideoLL {
   37.38 +    CARD8	reqType;		/* always DGAReqCode */
   37.39 +    CARD8	dgaReqType;		/* always X_XF86DGAGetVideoLL */
   37.40 +    CARD16	length B16;
   37.41 +    CARD16	screen B16;
   37.42 +    CARD16      pad B16;
   37.43 +} xXF86DGAGetVideoLLReq;
   37.44 +#define sz_xXF86DGAGetVideoLLReq	8
   37.45 +
   37.46 +typedef struct _XF86DGAInstallColormap{
   37.47 +    CARD8	reqType;
   37.48 +    CARD8	dgaReqType;
   37.49 +    CARD16	length B16;
   37.50 +    CARD16	screen B16;
   37.51 +    CARD16	pad2; 
   37.52 +    CARD32	id B32;  /* colormap. */
   37.53 +} xXF86DGAInstallColormapReq;
   37.54 +#define sz_xXF86DGAInstallColormapReq        12
   37.55 +
   37.56 +
   37.57 +typedef struct {
   37.58 +    BYTE	type;
   37.59 +    BOOL	pad1;
   37.60 +    CARD16	sequenceNumber B16;
   37.61 +    CARD32	length B32;
   37.62 +    CARD32	offset B32;
   37.63 +    CARD32	width B32;
   37.64 +    CARD32	bank_size B32;
   37.65 +    CARD32	ram_size B32;
   37.66 +    CARD32	pad4 B32;
   37.67 +    CARD32	pad5 B32;
   37.68 +} xXF86DGAGetVideoLLReply;
   37.69 +#define sz_xXF86DGAGetVideoLLReply	32
   37.70 +
   37.71 +typedef struct _XF86DGADirectVideo {
   37.72 +    CARD8	reqType;		/* always DGAReqCode */
   37.73 +    CARD8	dgaReqType;		/* always X_XF86DGADirectVideo */
   37.74 +    CARD16	length B16;
   37.75 +    CARD16	screen B16;
   37.76 +    CARD16	enable B16;
   37.77 +} xXF86DGADirectVideoReq;
   37.78 +#define sz_xXF86DGADirectVideoReq	8
   37.79 +
   37.80 +
   37.81 +typedef struct _XF86DGAGetViewPortSize {
   37.82 +    CARD8	reqType;		/* always DGAReqCode */
   37.83 +    CARD8	dgaReqType;		/* always X_XF86DGAGetViewPort */
   37.84 +    CARD16	length B16;
   37.85 +    CARD16	screen B16;
   37.86 +    CARD16      pad B16;
   37.87 +} xXF86DGAGetViewPortSizeReq;
   37.88 +#define sz_xXF86DGAGetViewPortSizeReq	8
   37.89 +
   37.90 +typedef struct {
   37.91 +    BYTE	type;
   37.92 +    BOOL	pad1;
   37.93 +    CARD16	sequenceNumber B16;
   37.94 +    CARD32	length B32;
   37.95 +    CARD32	width B32;
   37.96 +    CARD32	height B32;
   37.97 +    CARD32	pad2 B32;
   37.98 +    CARD32	pad3 B32;
   37.99 +    CARD32	pad4 B32;
  37.100 +    CARD32	pad5 B32;
  37.101 +} xXF86DGAGetViewPortSizeReply;
  37.102 +#define sz_xXF86DGAGetViewPortSizeReply	32
  37.103 +
  37.104 +typedef struct _XF86DGASetViewPort {
  37.105 +    CARD8	reqType;		/* always DGAReqCode */
  37.106 +    CARD8	dgaReqType;		/* always X_XF86DGASetViewPort */
  37.107 +    CARD16	length B16;
  37.108 +    CARD16	screen B16;
  37.109 +    CARD16	pad B16;
  37.110 +    CARD32      x B32;
  37.111 +    CARD32	y B32;
  37.112 +} xXF86DGASetViewPortReq;
  37.113 +#define sz_xXF86DGASetViewPortReq	16
  37.114 +
  37.115 +typedef struct _XF86DGAGetVidPage {
  37.116 +    CARD8	reqType;		/* always DGAReqCode */
  37.117 +    CARD8	dgaReqType;		/* always X_XF86DGAGetVidPage */
  37.118 +    CARD16	length B16;
  37.119 +    CARD16	screen B16;
  37.120 +    CARD16      pad B16;
  37.121 +} xXF86DGAGetVidPageReq;
  37.122 +#define sz_xXF86DGAGetVidPageReq	8
  37.123 +
  37.124 +typedef struct {
  37.125 +    BYTE	type;
  37.126 +    BOOL	pad1;
  37.127 +    CARD16	sequenceNumber B16;
  37.128 +    CARD32	length B32;
  37.129 +    CARD32	vpage B32;
  37.130 +    CARD32	pad B32;
  37.131 +    CARD32	pad2 B32;
  37.132 +    CARD32	pad3 B32;
  37.133 +    CARD32	pad4 B32;
  37.134 +    CARD32	pad5 B32;
  37.135 +} xXF86DGAGetVidPageReply;
  37.136 +#define sz_xXF86DGAGetVidPageReply	32
  37.137 +
  37.138 +
  37.139 +typedef struct _XF86DGASetVidPage {
  37.140 +    CARD8	reqType;		/* always DGAReqCode */
  37.141 +    CARD8	dgaReqType;		/* always X_XF86DGASetVidPage */
  37.142 +    CARD16	length B16;
  37.143 +    CARD16	screen B16;
  37.144 +    CARD16      vpage B16;
  37.145 +} xXF86DGASetVidPageReq;
  37.146 +#define sz_xXF86DGASetVidPageReq	8
  37.147 +
  37.148 +
  37.149 +typedef struct _XF86DGAQueryDirectVideo {
  37.150 +    CARD8	reqType;		/* always DGAReqCode */
  37.151 +    CARD8	dgaReqType;		/* always X_DGAQueryVersion */
  37.152 +    CARD16	length B16;
  37.153 +    CARD16	screen B16;
  37.154 +    CARD16      pad B16;
  37.155 +} xXF86DGAQueryDirectVideoReq;
  37.156 +#define sz_xXF86DGAQueryDirectVideoReq	8
  37.157 +
  37.158 +typedef struct {
  37.159 +    BYTE	type;
  37.160 +    BOOL	pad1;
  37.161 +    CARD16	sequenceNumber B16;
  37.162 +    CARD32	length B32;
  37.163 +    CARD32	flags B32;
  37.164 +    CARD32	pad B32;
  37.165 +    CARD32	pad2 B32;
  37.166 +    CARD32	pad3 B32;
  37.167 +    CARD32	pad4 B32;
  37.168 +    CARD32	pad5 B32;
  37.169 +} xXF86DGAQueryDirectVideoReply;
  37.170 +#define sz_xXF86DGAQueryDirectVideoReply 32
  37.171 +
  37.172 +
  37.173 +typedef struct _XF86DGAViewPortChanged {
  37.174 +    CARD8	reqType;		/* always DGAReqCode */
  37.175 +    CARD8	dgaReqType;		/* always X_DGAQueryVersion */
  37.176 +    CARD16	length B16;
  37.177 +    CARD16	screen B16;
  37.178 +    CARD16      n B16;
  37.179 +} xXF86DGAViewPortChangedReq;
  37.180 +#define sz_xXF86DGAViewPortChangedReq	8
  37.181 +
  37.182 +typedef struct {
  37.183 +    BYTE	type;
  37.184 +    BOOL	pad1;
  37.185 +    CARD16	sequenceNumber B16;
  37.186 +    CARD32	length B32;
  37.187 +    CARD32	result B32;
  37.188 +    CARD32	pad B32;
  37.189 +    CARD32	pad2 B32;
  37.190 +    CARD32	pad3 B32;
  37.191 +    CARD32	pad4 B32;
  37.192 +    CARD32	pad5 B32;
  37.193 +} xXF86DGAViewPortChangedReply;
  37.194 +#define sz_xXF86DGAViewPortChangedReply 32
  37.195 +
  37.196 +#endif /* _XF86DGASTR1_H_ */
  37.197 +
    38.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    38.2 +++ b/src/video/Xext/extensions/xf86dgastr.h	Tue Mar 05 19:55:32 2002 +0000
    38.3 @@ -0,0 +1,344 @@
    38.4 +/* $XFree86: xc/include/extensions/xf86dgastr.h,v 3.14 2001/08/01 00:44:36 tsi Exp $ */
    38.5 +/*
    38.6 +
    38.7 +Copyright (c) 1995  Jon Tombs
    38.8 +Copyright (c) 1995  XFree86 Inc.
    38.9 +
   38.10 +*/
   38.11 +
   38.12 +#ifndef _XF86DGASTR_H_
   38.13 +#define _XF86DGASTR_H_
   38.14 +
   38.15 +#include <XFree86/extensions/xf86dga1str.h>
   38.16 +
   38.17 +#define XF86DGANAME "XFree86-DGA"
   38.18 +
   38.19 +#define XDGA_MAJOR_VERSION	2	/* current version numbers */
   38.20 +#define XDGA_MINOR_VERSION	0
   38.21 +
   38.22 +
   38.23 +typedef struct _XDGAQueryVersion {
   38.24 +    CARD8	reqType;		/* always DGAReqCode */
   38.25 +    CARD8	dgaReqType;		/* always X_DGAQueryVersion */
   38.26 +    CARD16	length B16;
   38.27 +} xXDGAQueryVersionReq;
   38.28 +#define sz_xXDGAQueryVersionReq		4
   38.29 +
   38.30 +typedef struct {
   38.31 +    BYTE	type;			/* X_Reply */
   38.32 +    BOOL	pad1;
   38.33 +    CARD16	sequenceNumber B16;
   38.34 +    CARD32	length B32;
   38.35 +    CARD16	majorVersion B16;	/* major version of DGA protocol */
   38.36 +    CARD16	minorVersion B16;	/* minor version of DGA protocol */
   38.37 +    CARD32	pad2 B32;
   38.38 +    CARD32	pad3 B32;
   38.39 +    CARD32	pad4 B32;
   38.40 +    CARD32	pad5 B32;
   38.41 +    CARD32	pad6 B32;
   38.42 +} xXDGAQueryVersionReply;
   38.43 +#define sz_xXDGAQueryVersionReply	32
   38.44 +
   38.45 +typedef struct _XDGAQueryModes {
   38.46 +    CARD8	reqType;
   38.47 +    CARD8	dgaReqType;
   38.48 +    CARD16	length B16;
   38.49 +    CARD32	screen B32;
   38.50 +} xXDGAQueryModesReq;
   38.51 +#define sz_xXDGAQueryModesReq		8
   38.52 +
   38.53 +typedef struct {
   38.54 +    BYTE	type;			/* X_Reply */
   38.55 +    BOOL	pad1;
   38.56 +    CARD16	sequenceNumber B16;
   38.57 +    CARD32	length B32;
   38.58 +    CARD32	number B32;		/* number of modes available */
   38.59 +    CARD32	pad2 B32;
   38.60 +    CARD32	pad3 B32;
   38.61 +    CARD32	pad4 B32;
   38.62 +    CARD32	pad5 B32;
   38.63 +    CARD32	pad6 B32;
   38.64 +} xXDGAQueryModesReply;
   38.65 +#define sz_xXDGAQueryModesReply	32
   38.66 +
   38.67 +
   38.68 +typedef struct _XDGASetMode {
   38.69 +    CARD8	reqType;
   38.70 +    CARD8	dgaReqType;
   38.71 +    CARD16	length B16;
   38.72 +    CARD32	screen B32;
   38.73 +    CARD32	mode B32;		/* mode number to init */
   38.74 +    CARD32	pid B32;		/* Pixmap descriptor */
   38.75 +} xXDGASetModeReq;
   38.76 +#define sz_xXDGASetModeReq		16
   38.77 +
   38.78 +typedef struct {
   38.79 +    BYTE	type;			/* X_Reply */
   38.80 +    BOOL	pad1;
   38.81 +    CARD16	sequenceNumber B16;
   38.82 +    CARD32	length B32;
   38.83 +    CARD32	offset B32;		/* offset into framebuffer map */
   38.84 +    CARD32	flags B32;
   38.85 +    CARD32	pad2 B32;
   38.86 +    CARD32	pad3 B32;
   38.87 +    CARD32	pad4 B32;
   38.88 +    CARD32	pad5 B32;
   38.89 +} xXDGASetModeReply;
   38.90 +#define sz_xXDGASetModeReply	32
   38.91 +
   38.92 +typedef struct {
   38.93 +   CARD8	byte_order;
   38.94 +   CARD8	depth;
   38.95 +   CARD16 	num B16;
   38.96 +   CARD16	bpp B16;
   38.97 +   CARD16	name_size B16;
   38.98 +   CARD32	vsync_num B32;
   38.99 +   CARD32	vsync_den B32;
  38.100 +   CARD32	flags B32;
  38.101 +   CARD16	image_width B16;
  38.102 +   CARD16	image_height B16;
  38.103 +   CARD16	pixmap_width B16;
  38.104 +   CARD16	pixmap_height B16;
  38.105 +   CARD32	bytes_per_scanline B32;
  38.106 +   CARD32	red_mask B32;
  38.107 +   CARD32	green_mask B32;
  38.108 +   CARD32	blue_mask B32;
  38.109 +   CARD16	visual_class B16;
  38.110 +   CARD16	pad1 B16;
  38.111 +   CARD16	viewport_width B16;
  38.112 +   CARD16	viewport_height B16;
  38.113 +   CARD16	viewport_xstep B16;
  38.114 +   CARD16	viewport_ystep B16;
  38.115 +   CARD16	viewport_xmax B16;
  38.116 +   CARD16	viewport_ymax B16;
  38.117 +   CARD32	viewport_flags B32;
  38.118 +   CARD32	reserved1 B32;
  38.119 +   CARD32	reserved2 B32;
  38.120 +} xXDGAModeInfo;
  38.121 +#define sz_xXDGAModeInfo 72
  38.122 +
  38.123 +typedef struct _XDGAOpenFramebuffer {
  38.124 +    CARD8	reqType;
  38.125 +    CARD8	dgaReqType;
  38.126 +    CARD16	length B16;
  38.127 +    CARD32	screen B32;
  38.128 +} xXDGAOpenFramebufferReq;
  38.129 +#define sz_xXDGAOpenFramebufferReq	8
  38.130 +
  38.131 +typedef struct {
  38.132 +    BYTE	type;			/* X_Reply */
  38.133 +    BOOL	pad1;
  38.134 +    CARD16	sequenceNumber B16;
  38.135 +    CARD32	length B32;		/* device name size if there is one */
  38.136 +    CARD32	mem1 B32;		/* physical memory */	
  38.137 +    CARD32	mem2 B32;		/* spillover for _alpha_ */
  38.138 +    CARD32	size B32;		/* size of map in bytes */
  38.139 +    CARD32	offset B32;		/* optional offset into device */
  38.140 +    CARD32	extra B32;		/* extra info associated with the map */
  38.141 +    CARD32	pad2 B32;
  38.142 +} xXDGAOpenFramebufferReply;
  38.143 +#define sz_xXDGAOpenFramebufferReply	32
  38.144 +
  38.145 +
  38.146 +typedef struct _XDGACloseFramebuffer {
  38.147 +    CARD8	reqType;
  38.148 +    CARD8	dgaReqType;
  38.149 +    CARD16	length B16;
  38.150 +    CARD32	screen B32;
  38.151 +} xXDGACloseFramebufferReq;
  38.152 +#define sz_xXDGACloseFramebufferReq	8
  38.153 +
  38.154 +
  38.155 +typedef struct _XDGASetViewport {
  38.156 +    CARD8	reqType;
  38.157 +    CARD8	dgaReqType;
  38.158 +    CARD16	length B16;
  38.159 +    CARD32	screen B32;
  38.160 +    CARD16	x B16;
  38.161 +    CARD16	y B16;
  38.162 +    CARD32	flags B32;
  38.163 +} xXDGASetViewportReq;
  38.164 +#define sz_xXDGASetViewportReq	16
  38.165 +
  38.166 +
  38.167 +typedef struct _XDGAInstallColormap {
  38.168 +    CARD8	reqType;
  38.169 +    CARD8	dgaReqType;
  38.170 +    CARD16	length B16;
  38.171 +    CARD32	screen B32;
  38.172 +    CARD32	cmap B32;
  38.173 +} xXDGAInstallColormapReq;
  38.174 +#define sz_xXDGAInstallColormapReq	12
  38.175 +
  38.176 +typedef struct _XDGASelectInput {
  38.177 +    CARD8	reqType;
  38.178 +    CARD8	dgaReqType;
  38.179 +    CARD16	length B16;
  38.180 +    CARD32	screen B32;
  38.181 +    CARD32	mask B32;
  38.182 +} xXDGASelectInputReq;
  38.183 +#define sz_xXDGASelectInputReq	12
  38.184 +
  38.185 +typedef struct _XDGAFillRectangle {
  38.186 +    CARD8	reqType;
  38.187 +    CARD8	dgaReqType;
  38.188 +    CARD16	length B16;
  38.189 +    CARD32	screen B32;
  38.190 +    CARD16	x B16;
  38.191 +    CARD16	y B16;
  38.192 +    CARD16	width B16;
  38.193 +    CARD16	height B16;
  38.194 +    CARD32	color B32;
  38.195 +} xXDGAFillRectangleReq;
  38.196 +#define sz_xXDGAFillRectangleReq	20
  38.197 +
  38.198 +
  38.199 +typedef struct _XDGACopyArea {
  38.200 +    CARD8	reqType;
  38.201 +    CARD8	dgaReqType;
  38.202 +    CARD16	length B16;
  38.203 +    CARD32	screen B32;
  38.204 +    CARD16	srcx B16;
  38.205 +    CARD16	srcy B16;
  38.206 +    CARD16	width B16;
  38.207 +    CARD16	height B16;
  38.208 +    CARD16	dstx B16;
  38.209 +    CARD16	dsty B16;
  38.210 +} xXDGACopyAreaReq;
  38.211 +#define sz_xXDGACopyAreaReq	20
  38.212 +
  38.213 +typedef struct _XDGACopyTransparentArea {
  38.214 +    CARD8	reqType;
  38.215 +    CARD8	dgaReqType;
  38.216 +    CARD16	length B16;
  38.217 +    CARD32	screen B32;
  38.218 +    CARD16	srcx B16;
  38.219 +    CARD16	srcy B16;
  38.220 +    CARD16	width B16;
  38.221 +    CARD16	height B16;
  38.222 +    CARD16	dstx B16;
  38.223 +    CARD16	dsty B16;
  38.224 +    CARD32	key B32;
  38.225 +} xXDGACopyTransparentAreaReq;
  38.226 +#define sz_xXDGACopyTransparentAreaReq	24
  38.227 +
  38.228 +
  38.229 +typedef struct _XDGAGetViewportStatus {
  38.230 +    CARD8	reqType;
  38.231 +    CARD8	dgaReqType;
  38.232 +    CARD16	length B16;
  38.233 +    CARD32	screen B32;
  38.234 +} xXDGAGetViewportStatusReq;
  38.235 +#define sz_xXDGAGetViewportStatusReq	8
  38.236 +
  38.237 +typedef struct {
  38.238 +    BYTE	type;			
  38.239 +    BOOL	pad1;	
  38.240 +    CARD16	sequenceNumber B16;
  38.241 +    CARD32	length B32;
  38.242 +    CARD32	status B32;
  38.243 +    CARD32	pad2 B32;
  38.244 +    CARD32	pad3 B32;
  38.245 +    CARD32	pad4 B32;
  38.246 +    CARD32	pad5 B32;
  38.247 +    CARD32	pad6 B32;
  38.248 +} xXDGAGetViewportStatusReply;
  38.249 +#define sz_xXDGAGetViewportStatusReply	32
  38.250 +
  38.251 +typedef struct _XDGASync {
  38.252 +    CARD8	reqType;
  38.253 +    CARD8	dgaReqType;
  38.254 +    CARD16	length B16;
  38.255 +    CARD32	screen B32;
  38.256 +} xXDGASyncReq;
  38.257 +#define sz_xXDGASyncReq	8
  38.258 +
  38.259 +typedef struct {
  38.260 +    BYTE	type;			
  38.261 +    BOOL	pad1;	
  38.262 +    CARD16	sequenceNumber B16;
  38.263 +    CARD32	length B32;
  38.264 +    CARD32	pad2 B32;
  38.265 +    CARD32	pad3 B32;
  38.266 +    CARD32	pad4 B32;
  38.267 +    CARD32	pad5 B32;
  38.268 +    CARD32	pad6 B32;
  38.269 +    CARD32	pad7 B32;
  38.270 +} xXDGASyncReply;
  38.271 +#define sz_xXDGASyncReply	32
  38.272 +
  38.273 +typedef struct _XDGASetClientVersion {
  38.274 +    CARD8	reqType;
  38.275 +    CARD8	dgaReqType;
  38.276 +    CARD16	length B16;
  38.277 +    CARD16	major B16;
  38.278 +    CARD16	minor B16;
  38.279 +} xXDGASetClientVersionReq;
  38.280 +#define sz_xXDGASetClientVersionReq	8
  38.281 +
  38.282 +
  38.283 +typedef struct {
  38.284 +    CARD8	reqType;
  38.285 +    CARD8	dgaReqType;
  38.286 +    CARD16	length B16;
  38.287 +    CARD32	screen B32;
  38.288 +    CARD16	x B16;
  38.289 +    CARD16	y B16;
  38.290 +    CARD32	flags B32;
  38.291 +} xXDGAChangePixmapModeReq;
  38.292 +#define sz_xXDGAChangePixmapModeReq	16
  38.293 +
  38.294 +typedef struct {
  38.295 +    BYTE	type;			
  38.296 +    BOOL	pad1;	
  38.297 +    CARD16	sequenceNumber B16;
  38.298 +    CARD32	length B32;
  38.299 +    CARD16	x B16;
  38.300 +    CARD16	y B16;
  38.301 +    CARD32	pad3 B32;
  38.302 +    CARD32	pad4 B32;
  38.303 +    CARD32	pad5 B32;
  38.304 +    CARD32	pad6 B32;
  38.305 +    CARD32	pad7 B32;
  38.306 +} xXDGAChangePixmapModeReply;
  38.307 +#define sz_xXDGAChangePixmapModeReply	32
  38.308 +
  38.309 +typedef struct _XDGACreateColormap {
  38.310 +    CARD8	reqType;
  38.311 +    CARD8	dgaReqType;
  38.312 +    CARD16	length B16;
  38.313 +    CARD32	screen B32;
  38.314 +    CARD32	id B32;
  38.315 +    CARD32	mode B32;
  38.316 +    CARD8	alloc;
  38.317 +    CARD8	pad1;
  38.318 +    CARD16	pad2;
  38.319 +} xXDGACreateColormapReq;
  38.320 +#define sz_xXDGACreateColormapReq	20
  38.321 +
  38.322 +
  38.323 +typedef struct {
  38.324 +  union {
  38.325 +    struct {
  38.326 +      BYTE type;
  38.327 +      BYTE detail;
  38.328 +      CARD16 sequenceNumber B16;
  38.329 +    } u;
  38.330 +    struct {
  38.331 +      CARD32 pad0 B32;
  38.332 +      CARD32 time B32;
  38.333 +      INT16 dx B16;
  38.334 +      INT16 dy B16;
  38.335 +      INT16 screen B16;
  38.336 +      CARD16 state B16;
  38.337 +      CARD32 pad1 B32;
  38.338 +      CARD32 pad2 B32;
  38.339 +      CARD32 pad3 B32;
  38.340 +      CARD32 pad4 B32;
  38.341 +    } event;
  38.342 +  } u;
  38.343 +} dgaEvent;
  38.344 +
  38.345 +
  38.346 +#endif /* _XF86DGASTR_H_ */
  38.347 +
    39.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    39.2 +++ b/src/video/Xext/extensions/xf86vmode.h	Tue Mar 05 19:55:32 2002 +0000
    39.3 @@ -0,0 +1,314 @@
    39.4 +/* $XFree86: xc/include/extensions/xf86vmode.h,v 3.30 2001/05/07 20:09:50 mvojkovi Exp $ */
    39.5 +/*
    39.6 +
    39.7 +Copyright 1995  Kaleb S. KEITHLEY
    39.8 +
    39.9 +Permission is hereby granted, free of charge, to any person obtaining
   39.10 +a copy of this software and associated documentation files (the
   39.11 +"Software"), to deal in the Software without restriction, including
   39.12 +without limitation the rights to use, copy, modify, merge, publish,
   39.13 +distribute, sublicense, and/or sell copies of the Software, and to
   39.14 +permit persons to whom the Software is furnished to do so, subject to
   39.15 +the following conditions:
   39.16 +
   39.17 +The above copyright notice and this permission notice shall be
   39.18 +included in all copies or substantial portions of the Software.
   39.19 +
   39.20 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
   39.21 +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
   39.22 +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
   39.23 +IN NO EVENT SHALL Kaleb S. KEITHLEY BE LIABLE FOR ANY CLAIM, DAMAGES 
   39.24 +OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
   39.25 +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
   39.26 +OTHER DEALINGS IN THE SOFTWARE.
   39.27 +
   39.28 +Except as contained in this notice, the name of Kaleb S. KEITHLEY 
   39.29 +shall not be used in advertising or otherwise to promote the sale, use 
   39.30 +or other dealings in this Software without prior written authorization
   39.31 +from Kaleb S. KEITHLEY
   39.32 +
   39.33 +*/
   39.34 +/* $Xorg: xf86vmode.h,v 1.3 2000/08/18 04:05:46 coskrey Exp $ */
   39.35 +
   39.36 +/* THIS IS NOT AN X CONSORTIUM STANDARD OR AN X PROJECT TEAM SPECIFICATION */
   39.37 +
   39.38 +#ifndef _XF86VIDMODE_H_
   39.39 +#define _XF86VIDMODE_H_
   39.40 +
   39.41 +#include <X11/Xfuncproto.h>
   39.42 +#include <X11/Xmd.h>
   39.43 +#include "SDLname.h"
   39.44 +
   39.45 +#define X_XF86VidModeQueryVersion	0
   39.46 +#define X_XF86VidModeGetModeLine	1
   39.47 +#define X_XF86VidModeModModeLine	2
   39.48 +#define X_XF86VidModeSwitchMode		3
   39.49 +#define X_XF86VidModeGetMonitor		4
   39.50 +#define X_XF86VidModeLockModeSwitch	5
   39.51 +#define X_XF86VidModeGetAllModeLines	6
   39.52 +#define X_XF86VidModeAddModeLine	7
   39.53 +#define X_XF86VidModeDeleteModeLine	8
   39.54 +#define X_XF86VidModeValidateModeLine	9
   39.55 +#define X_XF86VidModeSwitchToMode	10
   39.56 +#define X_XF86VidModeGetViewPort	11
   39.57 +#define X_XF86VidModeSetViewPort	12
   39.58 +/* new for version 2.x of this extension */
   39.59 +#define X_XF86VidModeGetDotClocks	13
   39.60 +#define X_XF86VidModeSetClientVersion	14
   39.61 +#define X_XF86VidModeSetGamma		15
   39.62 +#define X_XF86VidModeGetGamma		16
   39.63 +#define X_XF86VidModeGetGammaRamp	17
   39.64 +#define X_XF86VidModeSetGammaRamp	18
   39.65 +#define X_XF86VidModeGetGammaRampSize	19
   39.66 +
   39.67 +#define CLKFLAG_PROGRAMABLE		1
   39.68 +
   39.69 +#ifdef XF86VIDMODE_EVENTS
   39.70 +#define XF86VidModeNotify		0
   39.71 +#define XF86VidModeNumberEvents		(XF86VidModeNotify + 1)
   39.72 +
   39.73 +#define XF86VidModeNotifyMask		0x00000001
   39.74 +
   39.75 +#define XF86VidModeNonEvent		0
   39.76 +#define XF86VidModeModeChange		1
   39.77 +#else
   39.78 +#define XF86VidModeNumberEvents		0
   39.79 +#endif
   39.80 +
   39.81 +#define XF86VidModeBadClock		0
   39.82 +#define XF86VidModeBadHTimings		1
   39.83 +#define XF86VidModeBadVTimings		2
   39.84 +#define XF86VidModeModeUnsuitable	3
   39.85 +#define XF86VidModeExtensionDisabled	4
   39.86 +#define XF86VidModeClientNotLocal	5
   39.87 +#define XF86VidModeZoomLocked		6
   39.88 +#define XF86VidModeNumberErrors		(XF86VidModeZoomLocked + 1)
   39.89 +
   39.90 +#ifndef _XF86VIDMODE_SERVER_
   39.91 +
   39.92 +typedef struct {
   39.93 +    unsigned short	hdisplay;
   39.94 +    unsigned short	hsyncstart;
   39.95 +    unsigned short	hsyncend;
   39.96 +    unsigned short	htotal;
   39.97 +    unsigned short	hskew;
   39.98 +    unsigned short	vdisplay;
   39.99 +    unsigned short	vsyncstart;
  39.100 +    unsigned short	vsyncend;
  39.101 +    unsigned short	vtotal;
  39.102 +    unsigned int	flags;
  39.103 +    int			privsize;
  39.104 +#if defined(__cplusplus) || defined(c_plusplus)
  39.105 +    /* private is a C++ reserved word */
  39.106 +    INT32		*c_private;
  39.107 +#else
  39.108 +    INT32		*private;
  39.109 +#endif
  39.110 +} SDL_NAME(XF86VidModeModeLine);
  39.111 +
  39.112 +typedef struct {
  39.113 +    unsigned int	dotclock;
  39.114 +    unsigned short	hdisplay;
  39.115 +    unsigned short	hsyncstart;
  39.116 +    unsigned short	hsyncend;
  39.117 +    unsigned short	htotal;
  39.118 +    unsigned short	hskew;
  39.119 +    unsigned short	vdisplay;
  39.120 +    unsigned short	vsyncstart;
  39.121 +    unsigned short	vsyncend;
  39.122 +    unsigned short	vtotal;
  39.123 +    unsigned int	flags;
  39.124 +    int			privsize;
  39.125 +#if defined(__cplusplus) || defined(c_plusplus)
  39.126 +    /* private is a C++ reserved word */
  39.127 +    INT32		*c_private;
  39.128 +#else
  39.129 +    INT32		*private;
  39.130 +#endif
  39.131 +} SDL_NAME(XF86VidModeModeInfo);
  39.132 +
  39.133 +typedef struct {
  39.134 +    float		hi;
  39.135 +    float		lo;
  39.136 +} SDL_NAME(XF86VidModeSyncRange);
  39.137 +
  39.138 +typedef struct {
  39.139 +    char*			vendor;
  39.140 +    char*			model;
  39.141 +    float			EMPTY;
  39.142 +    unsigned char		nhsync;
  39.143 +    SDL_NAME(XF86VidModeSyncRange)*	hsync;
  39.144 +    unsigned char		nvsync;
  39.145 +    SDL_NAME(XF86VidModeSyncRange)*	vsync;
  39.146 +} SDL_NAME(XF86VidModeMonitor);
  39.147 +    
  39.148 +typedef struct {
  39.149 +    int type;			/* of event */
  39.150 +    unsigned long serial;	/* # of last request processed by server */
  39.151 +    Bool send_event;		/* true if this came from a SendEvent req */
  39.152 +    Display *display;		/* Display the event was read from */
  39.153 +    Window root;		/* root window of event screen */
  39.154 +    int state;			/* What happened */
  39.155 +    int kind;			/* What happened */
  39.156 +    Bool forced;		/* extents of new region */
  39.157 +    Time time;			/* event timestamp */
  39.158 +} SDL_NAME(XF86VidModeNotifyEvent);
  39.159 +
  39.160 +typedef struct {
  39.161 +    float red;			/* Red Gamma value */
  39.162 +    float green;		/* Green Gamma value */
  39.163 +    float blue;			/* Blue Gamma value */
  39.164 +} SDL_NAME(XF86VidModeGamma);
  39.165 +
  39.166 +
  39.167 +#define SDL_XF86VidModeSelectNextMode(disp, scr) \
  39.168 +	SDL_NAME(XF86VidModeSwitchMode)(disp, scr, 1)
  39.169 +#define SDL_XF86VidModeSelectPrevMode(disp, scr) \
  39.170 +	SDL_NAME(XF86VidModeSwitchMode)(disp, scr, -1)
  39.171 +
  39.172 +_XFUNCPROTOBEGIN
  39.173 +
  39.174 +Bool SDL_NAME(XF86VidModeQueryVersion)(
  39.175 +    Display*		/* dpy */,
  39.176 +    int*		/* majorVersion */,
  39.177 +    int*		/* minorVersion */
  39.178 +);
  39.179 +
  39.180 +Bool SDL_NAME(XF86VidModeQueryExtension)(
  39.181 +    Display*		/* dpy */,
  39.182 +    int*		/* event_base */,
  39.183 +    int*		/* error_base */
  39.184 +);
  39.185 +
  39.186 +Bool SDL_NAME(XF86VidModeSetClientVersion)(
  39.187 +    Display*		/* dpy */
  39.188 +);
  39.189 +
  39.190 +Bool SDL_NAME(XF86VidModeGetModeLine)(
  39.191 +    Display*			/* dpy */,
  39.192 +    int				/* screen */,
  39.193 +    int*			/* dotclock */,
  39.194 +    SDL_NAME(XF86VidModeModeLine)*	/* modeline */
  39.195 +);
  39.196 +
  39.197 +Bool SDL_NAME(XF86VidModeGetAllModeLines)(
  39.198 +    Display*			/* dpy */,
  39.199 +    int				/* screen */,
  39.200 +    int*			/* modecount */,
  39.201 +    SDL_NAME(XF86VidModeModeInfo)***	/* modelinesPtr */
  39.202 +);
  39.203 +
  39.204 +Bool SDL_NAME(XF86VidModeAddModeLine)(
  39.205 +    Display*			/* dpy */,
  39.206 +    int				/* screen */,
  39.207 +    SDL_NAME(XF86VidModeModeInfo)*	/* new modeline */,
  39.208 +    SDL_NAME(XF86VidModeModeInfo)*	/* after modeline */
  39.209 +);
  39.210 +
  39.211 +Bool SDL_NAME(XF86VidModeDeleteModeLine)(
  39.212 +    Display*			/* dpy */,
  39.213 +    int				/* screen */,
  39.214 +    SDL_NAME(XF86VidModeModeInfo)*	/* modeline */
  39.215 +);
  39.216 +
  39.217 +Bool SDL_NAME(XF86VidModeModModeLine)(
  39.218 +    Display*			/* dpy */,
  39.219 +    int				/* screen */,
  39.220 +    SDL_NAME(XF86VidModeModeLine)*	/* modeline */
  39.221 +);
  39.222 +
  39.223 +Status SDL_NAME(XF86VidModeValidateModeLine)(
  39.224 +    Display*			/* dpy */,
  39.225 +    int				/* screen */,
  39.226 +    SDL_NAME(XF86VidModeModeInfo)*	/* modeline */
  39.227 +);
  39.228 +
  39.229 +Bool SDL_NAME(XF86VidModeSwitchMode)(
  39.230 +    Display*		/* dpy */,
  39.231 +    int			/* screen */,
  39.232 +    int			/* zoom */
  39.233 +);
  39.234 +
  39.235 +Bool SDL_NAME(XF86VidModeSwitchToMode)(
  39.236 +    Display*			/* dpy */,
  39.237 +    int				/* screen */,
  39.238 +    SDL_NAME(XF86VidModeModeInfo)*	/* modeline */
  39.239 +);
  39.240 +
  39.241 +Bool SDL_NAME(XF86VidModeLockModeSwitch)(
  39.242 +    Display*		/* dpy */,
  39.243 +    int			/* screen */,
  39.244 +    int			/* lock */
  39.245 +);
  39.246 +
  39.247 +Bool SDL_NAME(XF86VidModeGetMonitor)(
  39.248 +    Display*		/* dpy */,
  39.249 +    int			/* screen */,
  39.250 +    SDL_NAME(XF86VidModeMonitor)*	/* monitor */
  39.251 +);
  39.252 +
  39.253 +Bool SDL_NAME(XF86VidModeGetViewPort)(
  39.254 +    Display*		/* dpy */,
  39.255 +    int			/* screen */,
  39.256 +    int*		/* x return */,
  39.257 +    int*		/* y return */
  39.258 +);
  39.259 +
  39.260 +Bool SDL_NAME(XF86VidModeSetViewPort)(
  39.261 +    Display*		/* dpy */,
  39.262 +    int			/* screen */,
  39.263 +    int			/* x */,
  39.264 +    int			/* y */
  39.265 +);
  39.266 +
  39.267 +Bool SDL_NAME(XF86VidModeGetDotClocks)(
  39.268 +    Display*		/* dpy */,
  39.269 +    int			/* screen */,
  39.270 +    int*		/* flags return */,
  39.271 +    int*		/* number of clocks return */,
  39.272 +    int*		/* max dot clock return */,
  39.273 +    int**		/* clocks return */
  39.274 +);
  39.275 +
  39.276 +Bool SDL_NAME(XF86VidModeGetGamma)(
  39.277 +    Display*			/* dpy */,
  39.278 +    int				/* screen */,
  39.279 +    SDL_NAME(XF86VidModeGamma)*		/* Gamma */
  39.280 +);
  39.281 +
  39.282 +Bool SDL_NAME(XF86VidModeSetGamma)(
  39.283 +    Display*			/* dpy */,
  39.284 +    int				/* screen */,
  39.285 +    SDL_NAME(XF86VidModeGamma)*		/* Gamma */
  39.286 +);
  39.287 +
  39.288 +Bool SDL_NAME(XF86VidModeSetGammaRamp)(
  39.289 +    Display*                    /* dpy */,
  39.290 +    int                         /* screen */,
  39.291 +    int				/* size */, 
  39.292 +    unsigned short*             /* red array */,
  39.293 +    unsigned short*             /* green array */,
  39.294 +    unsigned short*             /* blue array */
  39.295 +);
  39.296 +
  39.297 +Bool SDL_NAME(XF86VidModeGetGammaRamp)(
  39.298 +    Display*                    /* dpy */,
  39.299 +    int                         /* screen */,
  39.300 +    int                         /* size */,
  39.301 +    unsigned short*             /* red array */,
  39.302 +    unsigned short*             /* green array */,
  39.303 +    unsigned short*             /* blue array */
  39.304 +);
  39.305 +
  39.306 +Bool SDL_NAME(XF86VidModeGetGammaRampSize)(
  39.307 +    Display*                    /* dpy */,
  39.308 +    int                         /* screen */,
  39.309 +    int*                        /* size */
  39.310 +);
  39.311 +
  39.312 +
  39.313 +_XFUNCPROTOEND
  39.314 +
  39.315 +#endif
  39.316 +
  39.317 +#endif
    40.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    40.2 +++ b/src/video/Xext/extensions/xf86vmstr.h	Tue Mar 05 19:55:32 2002 +0000
    40.3 @@ -0,0 +1,546 @@
    40.4 +/* $XFree86: xc/include/extensions/xf86vmstr.h,v 3.27 2001/08/01 00:44:36 tsi Exp $ */
    40.5 +/*
    40.6 +
    40.7 +Copyright 1995  Kaleb S. KEITHLEY
    40.8 +
    40.9 +Permission is hereby granted, free of charge, to any person obtaining
   40.10 +a copy of this software and associated documentation files (the
   40.11 +"Software"), to deal in the Software without restriction, including
   40.12 +without limitation the rights to use, copy, modify, merge, publish,
   40.13 +distribute, sublicense, and/or sell copies of the Software, and to
   40.14 +permit persons to whom the Software is furnished to do so, subject to
   40.15 +the following conditions:
   40.16 +
   40.17 +The above copyright notice and this permission notice shall be
   40.18 +included in all copies or substantial portions of the Software.
   40.19 +
   40.20 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
   40.21 +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
   40.22 +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
   40.23 +IN NO EVENT SHALL Kaleb S. KEITHLEY BE LIABLE FOR ANY CLAIM, DAMAGES 
   40.24 +OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
   40.25 +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
   40.26 +OTHER DEALINGS IN THE SOFTWARE.
   40.27 +
   40.28 +Except as contained in this notice, the name of Kaleb S. KEITHLEY 
   40.29 +shall not be used in advertising or otherwise to promote the sale, use 
   40.30 +or other dealings in this Software without prior written authorization
   40.31 +from Kaleb S. KEITHLEY
   40.32 +
   40.33 +*/
   40.34 +/* $Xorg: xf86vmstr.h,v 1.3 2000/08/18 04:05:46 coskrey Exp $ */
   40.35 +
   40.36 +/* THIS IS NOT AN X CONSORTIUM STANDARD OR AN X PROJECT TEAM SPECIFICATION */
   40.37 +
   40.38 +#ifndef _XF86VIDMODESTR_H_
   40.39 +#define _XF86VIDMODESTR_H_
   40.40 +
   40.41 +#include <XFree86/extensions/xf86vmode.h>
   40.42 +
   40.43 +#define XF86VIDMODENAME "XFree86-VidModeExtension"
   40.44 +
   40.45 +#define XF86VIDMODE_MAJOR_VERSION	2	/* current version numbers */
   40.46 +#define XF86VIDMODE_MINOR_VERSION	1
   40.47 +/*
   40.48 + * major version 0 == uses parameter-to-wire functions in XFree86 libXxf86vm.
   40.49 + * major version 1 == uses parameter-to-wire functions hard-coded in xvidtune
   40.50 + *                    client.
   40.51 + * major version 2 == uses new protocol version in XFree86 4.0.
   40.52 + */
   40.53 +
   40.54 +typedef struct _XF86VidModeQueryVersion {
   40.55 +    CARD8	reqType;		/* always XF86VidModeReqCode */
   40.56 +    CARD8	xf86vidmodeReqType;	/* always X_XF86VidModeQueryVersion */
   40.57 +    CARD16	length B16;
   40.58 +} xXF86VidModeQueryVersionReq;
   40.59 +#define sz_xXF86VidModeQueryVersionReq	4
   40.60 +
   40.61 +typedef struct {
   40.62 +    BYTE	type;			/* X_Reply */
   40.63 +    BOOL	pad1;
   40.64 +    CARD16	sequenceNumber B16;
   40.65 +    CARD32	length B32;
   40.66 +    CARD16	majorVersion B16;	/* major version of XF86VidMode */
   40.67 +    CARD16	minorVersion B16;	/* minor version of XF86VidMode */
   40.68 +    CARD32	pad2 B32;
   40.69 +    CARD32	pad3 B32;
   40.70 +    CARD32	pad4 B32;
   40.71 +    CARD32	pad5 B32;
   40.72 +    CARD32	pad6 B32;
   40.73 +} xXF86VidModeQueryVersionReply;
   40.74 +#define sz_xXF86VidModeQueryVersionReply	32
   40.75 +
   40.76 +typedef struct _XF86VidModeGetModeLine {
   40.77 +    CARD8	reqType;		/* always XF86VidModeReqCode */
   40.78 +    CARD8	xf86vidmodeReqType;
   40.79 +    CARD16	length B16;
   40.80 +    CARD16	screen B16;
   40.81 +    CARD16	pad B16;
   40.82 +} xXF86VidModeGetModeLineReq,
   40.83 +  xXF86VidModeGetAllModeLinesReq,
   40.84 +  xXF86VidModeGetMonitorReq,
   40.85 +  xXF86VidModeGetViewPortReq,
   40.86 +  xXF86VidModeGetDotClocksReq;
   40.87 +#define sz_xXF86VidModeGetModeLineReq		8
   40.88 +#define sz_xXF86VidModeGetAllModeLinesReq	8
   40.89 +#define sz_xXF86VidModeGetMonitorReq		8
   40.90 +#define sz_xXF86VidModeGetViewPortReq		8
   40.91 +#define sz_xXF86VidModeGetDotClocksReq		8
   40.92 +
   40.93 +typedef struct {
   40.94 +    BYTE	type;			/* X_Reply */
   40.95 +    BOOL	pad1;
   40.96 +    CARD16	sequenceNumber B16;
   40.97 +    CARD32	length B32;
   40.98 +    CARD32	dotclock B32;
   40.99 +    CARD16	hdisplay B16;
  40.100 +    CARD16	hsyncstart B16;
  40.101 +    CARD16	hsyncend B16;
  40.102 +    CARD16	htotal B16;
  40.103 +    CARD16	hskew B16;
  40.104 +    CARD16	vdisplay B16;
  40.105 +    CARD16	vsyncstart B16;
  40.106 +    CARD16	vsyncend B16;
  40.107 +    CARD16	vtotal B16;